<?php header('Content-Type: text/html; charset=utf-8'); session_start(); !defined('PROJECT_ROOT_DIR') ? define('PROJECT_ROOT_DIR', dirname(__FILE__)) : ''; // define project root if not defined !defined('APPLICATION_ROOT_DIR') ? define('APPLICATION_ROOT_DIR', PROJECT_ROOT_DIR . DIRECTORY_SEPARATOR . 'application') : ''; // define application root paths !defined('ADMIN_ROOT_DIR') ? define('ADMIN_ROOT_DIR', PROJECT_ROOT_DIR . DIRECTORY_SEPARATOR . 'administration') : ''; // define admin root paths !defined('SITE_ROOT_URI') ? define('SITE_ROOT_URI', 'http://' . $_SERVER['HTTP_HOST'] . '/adm') : ''; // !defined('APPLICATUIN_ROOT_URI') ? define('APPLICATUIN_ROOT_URI', SITE_ROOT_URI . '/application') : ''; // require_once PROJECT_ROOT_DIR . '/libraries/loader.php'; Libraries_Loader::getInstance()->register(); Libraries_Event::registerEvents(ADMIN_ROOT_DIR); Libraries_Event::registerEvents(APPLICATION_ROOT_DIR); $enviorement = Libraries_Environment_Factory::getEnvironment(); $request = Libraries_Request::getInstance(); // only one request per call $router = Libraries_Router::getInstance(); $router->route($request);
/** * @return Libraries_Loader */ public static function getInstance() { if (empty(self::$instance) || !self::$instance instanceof Libraries_Loader) { self::$instance = new Libraries_Loader(); } return self::$instance; }
/** * Create controller class name based on given string * @param string $controller_name * @return string */ private function createControllerClassName($controller_name) { $name_separator = Libraries_Loader::getInstance()->getNameSeparator(); $controller_class_name = $this->module . $name_separator . 'controllers' . $name_separator . $controller_name; $controller_class_name = str_replace('-', $name_separator, $controller_class_name); $controller_class_name = Libraries_Loader::getInstance()->convertToClassName($controller_class_name); return $controller_class_name; }