/** * The function runs application. * * @statis * @access public * @param string $modules The modules to load, separated by comma. */ public static function run($modules = null) { self::$started = array(microtime(true), memory_get_usage(true)); Runtime::set('ROOT_DIR', ROOT_DIR); Runtime::set('INCLUDE_DIR', INCLUDE_DIR); Runtime::set('LOCALE_DIR', LOCALE_DIR); if (defined('CONFIG_DIR')) { Runtime::set('CONFIG_DIR', CONFIG_DIR); } else { Runtime::set('CONFIG_DIR', Runtime::get('ROOT_DIR') . '/config'); } if (defined('TEMPLATE_DIR')) { Runtime::set('TEMPLATE_DIR', TEMPLATE_DIR); } else { Runtime::set('TEMPLATE_DIR', Runtime::get('ROOT_DIR') . '/templates'); define('TEMPLATE_DIR', Runtime::get('TEMPLATE_DIR')); } if (defined('FILES_DIR')) { Runtime::set('FILES_DIR', FILES_DIR); } else { Runtime::set('FILES_DIR', Runtime::get('ROOT_DIR') . '/files'); } if (defined('LIBS_DIR')) { Runtime::set('LIBS_DIR', LIBS_DIR); } else { Runtime::set('LIBS_DIR', Runtime::get('ROOT_DIR') . '/libs'); } $arr = array('config', 'settings', 'locale', 'route', 'security', 'controller'); if ($modules !== null) { $arr = explode(',', $modules); } if (in_array('config', $arr)) { self::initConfig(); } if (in_array('settings', $arr)) { self::initSettings(); } Runtime::set('HTTP_HOST', Request::get('HTTP_HOST', Config::get('host'), 'SERVER')); Runtime::set('HTTP_PROTOCOL', Request::get('HTTPS', false, 'SERVER') ? 'https://' : 'http://'); if (Config::get('timezone')) { date_default_timezone_set(Config::get('timezone')); } if (in_array('locale', $arr)) { self::initLocale(); } if (in_array('route', $arr)) { self::initRoute(); } if (in_array('security', $arr)) { self::initSecurity(); } if (in_array('controller', $arr)) { Custom_Application::initController(); self::initController(); } }