widget('Widget_Options'); /** 语言包初始化 */ if ($options->lang && $options->lang != 'zh_CN') { $dir = defined('__TYPECHO_LANG_DIR__') ? __TYPECHO_LANG_DIR__ : __TYPECHO_ROOT_DIR__ . '/usr/langs'; Typecho_I18n::setLang($dir . '/' . $options->lang . '.mo'); } /** 进入命令行格式 */ if (defined('__TYPECHO_CLI__')) { new CLI(); exit(0); } /** cookie初始化 */ Typecho_Cookie::setPrefix($options->rootUrl); /** 初始化charset */ Typecho_Common::$charset = $options->charset; /** 初始化exception */ Typecho_Common::$exceptionHandle = 'Widget_ExceptionHandle'; /** 设置路径 */ if (defined('__TYPECHO_PATHINFO_ENCODING__')) { $pathInfo = $this->request->getPathInfo(__TYPECHO_PATHINFO_ENCODING__, $options->charset); } else { $pathInfo = $this->request->getPathInfo(); } Typecho_Router::setPathInfo($pathInfo); /** 初始化路由器 */ Typecho_Router::setRoutes($options->routingTable); /** 初始化插件 */ Typecho_Plugin::init($options->plugins); /** 初始化回执 */ $this->response->setCharset($options->charset); $this->response->setContentType($options->contentType); /** 默认时区 */ if (function_exists("ini_get") && !ini_get("date.timezone") && function_exists("date_default_timezone_set")) { @date_default_timezone_set('UTC'); } /** 初始化时区 */ Typecho_Date::setTimezoneOffset($options->timezone); /** 开始会话, 减小负载只针对后台打开session支持 */ if ($this->widget('Widget_User')->hasLogin()) { @session_start(); } /** 监听缓冲区 */ ob_start(); } }