Files
sld-php-template/config/constants.php
T
2026-08-19 17:26:06 +01:00

77 lines
2.5 KiB
PHP

<?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/");
define("BLOCKNOTES_FOLD", ROOT_DIR . "blocknotes/");
define("CONFIG_FOLD", ROOT_DIR . "config/");
define("PAGES_FOLD", ROOT_DIR . "pages/");
define("PUBLIC_FOLD", ROOT_DIR . "public/");
define("TEMPLATES_FOLD", ROOT_DIR . "templates/");
define("THEMES_FOLD", ROOT_DIR . "themes/");
define("FUNCTIONS_FOLD", ROOT_DIR . "functions/");
define("INCLUDES_FOLD", ROOT_DIR . "includes/");
// - ASSETS
define("CSS_FOLD", ASSETS_FOLD . "css/");
define("IMG_FOLD", ASSETS_FOLD . "img/");
define("JS_FOLD", ASSETS_FOLD . "js/");
define("FONTS_FOLD", CSS_FOLD . "fonts/");
// --------------- //
// --- ROOT URL --- //
// - CSS
define("CSS_STYLE", ROOT_URL . "/assets/css/style.css");
define("CSS_VAR", ROOT_URL . "/assets/css/variables.css");
define("CSS_ANIM", ROOT_URL . "/assets/css/animations.css");
define("CSS_FONTS", ROOT_URL . "/assets/css/fonts.css");
// - JS
define("JS_MAIN", ROOT_URL . "/assets/js/main.js");
// --------------- //
/// 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)) {
@mkdir($full_path, 0777, true);
}
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);
}
}
}
?>