static function init() { if (!defined('HIANO_APP_PATH')) { die('ERROR:HIANO_APP_PATH undefined!'); } spl_autoload_register(array('Hiano\\ClassLoader', 'load')); if (App\App::getConfig()->get('debug.enable', false)) { $debug_config = App\App::getConfig()->get('debug'); error_reporting($debug_config['error_reporting']); unset($debug_config); } else { error_reporting(0); } if (App\App::getConfig()->get('timezone')) { date_default_timezone_set(App\App::getConfig()->get('timezone')); } if ($session_path = App\App::getConfig()->get('session_path')) { //todo load and register SessionDriver //$session_driver = Hiano::loadDriver('\\Hiano\\') //\Hiano\Session\SessionManager::register(); } //\Hiano\App\App::registerModelPath(HIANO_APP_PATH . '/widgets/models'); $app_path = realpath(HIANO_APP_PATH); \Hiano\App\App::registerModelPath($app_path . '/Model'); \Hiano\App\App::registerImportPath($app_path . '/Include'); App\App::setErrorHandler(function ($ex) { /* @var $ex \Hiano\ErrorException */ throw new \Exception("Error[{$ex->getCode()}]:" . $ex->getMessage()); }); App\App::setRedirectHandler(function ($ex) { /* @var $ex \Hiano\RedirectException */ header('Location:' . $ex->getRedirectUrl()); }); }