backend/bootstrap.php

48 lines
1.3 KiB
PHP
Raw Normal View History

2024-07-03 14:41:15 +03:00
<?php
2024-07-10 12:42:50 +03:00
require_once __DIR__ . "/vendor/autoload.php";
2024-07-03 15:15:59 +03:00
2024-07-10 12:42:50 +03:00
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
include_once __DIR__ . "/bootstrap/db.php";
2024-07-29 16:07:51 +03:00
include_once __DIR__ . "/bootstrap/header.php";
2024-10-22 16:40:40 +03:00
include_once __DIR__ . "/bootstrap/secure.php";
2024-07-10 12:42:50 +03:00
const ROOT_DIR = __DIR__;
2024-07-29 15:57:20 +03:00
const KERNEL_DIR = __DIR__ . "/kernel";
2024-09-03 16:29:44 +03:00
const KERNEL_MODULES_DIR = __DIR__ . "/kernel/modules";
const KERNEL_ADMIN_THEMES_DIR = __DIR__ . "/kernel/admin_themes";
2024-07-29 15:57:20 +03:00
const CONSOLE_DIR = __DIR__ . "/kernel/console";
2024-09-03 16:29:44 +03:00
const RESOURCES_DIR = __DIR__ . "/resources";
const KERNEL_TEMPLATES_DIR = __DIR__ . "/kernel/templates";
2024-10-08 13:16:57 +03:00
const KERNEL_APP_MODULES_DIR = KERNEL_DIR . "/app_modules";
2024-09-10 16:44:27 +03:00
const APP_DIR = ROOT_DIR . "/app";
2024-09-03 16:29:44 +03:00
function getConst($text): array|false|string
{
$constStr = [
"{ROOT}" => ROOT_DIR,
"{RESOURCES}" => RESOURCES_DIR,
"{KERNEL_ADMIN_THEMES}" => KERNEL_ADMIN_THEMES_DIR,
"{KERNEL}" => KERNEL_DIR,
"{KERNEL_MODULES}" => KERNEL_MODULES_DIR,
2024-10-08 13:16:57 +03:00
"{KERNEL_APP_MODULES}" => KERNEL_APP_MODULES_DIR,
"{KERNEL_TEMPLATES}" => KERNEL_TEMPLATES_DIR,
2024-09-03 16:29:44 +03:00
"{CONSOLE}" => CONSOLE_DIR,
2024-09-10 16:44:27 +03:00
"{APP}" => APP_DIR,
2024-09-03 16:29:44 +03:00
];
$str = $text;
2024-10-10 16:45:53 +03:00
2024-09-03 16:29:44 +03:00
foreach($constStr as $key => $value)
{
$str = str_replace($key, $value, $str);
}
return $str;
}
2024-07-29 15:57:20 +03:00
2024-07-03 15:15:59 +03:00