From f373ead95fb5beb962c376b5b7b46dfde8ac4e57 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 23 Feb 2026 22:57:27 -0500 Subject: update website to work with crimson framework --- src/web/core/component.php | 119 --------------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 src/web/core/component.php (limited to 'src/web/core/component.php') diff --git a/src/web/core/component.php b/src/web/core/component.php deleted file mode 100644 index 376e24d..0000000 --- a/src/web/core/component.php +++ /dev/null @@ -1,119 +0,0 @@ -newInstance(); - Component::$loaded[$path] = $obj; - - return $obj; - } - - /** - * Loads a model - * @param string $name - the name of the model to load - */ - protected function load_model($name): Model|NULL - { - $dir = WEB_ROOT . '/_model'; - return $this->load_type($name, $dir, 'model'); - } - - /** - * Loads a controller - * @param string $name - the name of the controller to load - */ - public function load_controller($name): Controller|NULL - { - $dir = WEB_ROOT . '/_controller'; - return $this->load_type($name, $dir, 'controller'); - } - -// ========================================= LANG == - - /** - * Loads a php lang file into the lang array - */ - private static function load_lang_file(string $file): void - { - $lang = $GLOBALS['__lang']; - require($file); - $GLOBALS['__lang'] = $lang; - } - - /** - * Loads each php file lang strings in a directory - */ - private static function load_lang_dir(string $dir): void - { - if ($handle = opendir($dir)) { - while (false !== ($entry = readdir($handle))) { - if ($entry === '.' || $entry === '..') - continue; - Component::load_lang_file($entry); - } - } - } - - /** - * Loads the given common lang - */ - protected static function load_lang(string ...$langs): void - { - $root = WEB_ROOT . '/lang'; - - foreach ($langs as $lang) { - $file = "{$root}/{$lang}.php"; - $dir = "{$root}/{$lang}"; - - if (file_exists($file)) - Component::load_lang_file($file); - else if (is_dir($dir)) - Component::load_lang_dir($dir); - - } - } - -} -- cgit v1.2.3-freya