Added new features: adding new constant in a loop
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* In this array, please add the functions you may want to add on your project.
|
||||
* Please note that you can use a variable or a costant by adding a space rather than
|
||||
*/
|
||||
|
||||
$NewCostants = [
|
||||
[ "BLOCKNOTES_FOLD", "ROOT_DIR", "blocknotes/" ]
|
||||
|
||||
];
|
||||
|
||||
// ##### PLEASE DO NOT TOUCH THE BELOW COSTANTS ##### //
|
||||
// --- ROOT DIR --- //
|
||||
define("ASSETS_FOLD", ROOT_DIR . "assets/");
|
||||
define("ADMIN_FOLD", ROOT_DIR . "admin/");
|
||||
@@ -32,5 +43,36 @@
|
||||
// --------------- //
|
||||
|
||||
|
||||
/// CUSTOM COSTANTS DECLARED ///
|
||||
foreach ($NewCostants as $const_array) {
|
||||
$const_name = strtoupper($const_array[0]);
|
||||
|
||||
if (isset($const_array[2]) && !empty($const_array[2])) {
|
||||
$base = $const_array[1];
|
||||
$const_before = defined($base) ? constant($base) : $base;
|
||||
$const_value = $const_array[2];
|
||||
$full_path = $const_before . $const_value;
|
||||
|
||||
if (!is_dir($full_path) && !is_file($full_path)) {
|
||||
debugStatusMes("The folder/file declared into '$const_name' constant is missing or not accessible. Please check it.", "High");
|
||||
die;
|
||||
}
|
||||
|
||||
if (!defined($const_name)) {
|
||||
define($const_name, $full_path);
|
||||
}
|
||||
} else {
|
||||
$const_value = $const_array[1];
|
||||
|
||||
if (!is_dir($const_value) && !is_file($const_value)) {
|
||||
debugStatusMes("The folder/file declared into '$const_name' constant is missing or not accessible. Please check it.", "High");
|
||||
die;
|
||||
}
|
||||
|
||||
if (!defined($const_name)) {
|
||||
define($const_name, $const_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
// -- GENERAL SETTING --
|
||||
$debug="on";
|
||||
$php_debug="on";
|
||||
|
||||
// --- DB SETTINGS ---
|
||||
$db_needed="no";
|
||||
@@ -17,6 +18,15 @@ $db_pass="database-user-password";
|
||||
// --- GENERAL SECTION CONFIGURATION
|
||||
if ($debug == "on"){ define("DEBUG",true);} else { define("DEBUG", false); }
|
||||
|
||||
if ($php_debug == "on") {
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
ini_set('display_errors', 0);
|
||||
error_reporting(0);
|
||||
}
|
||||
|
||||
// --- DB SECTION CONFIGURATION
|
||||
if ($db_needed == "yes"){
|
||||
define("DB_HOST", $db_host);
|
||||
|
||||
Reference in New Issue
Block a user