public function __construct($request, $response, $params = NULL) { parent::__construct($request, $response, $params); $this->parameter->setDefault(array('type' => NULL)); /** 初始化常用组件 */ $this->options = $this->widget('Widget_Options'); $this->user = $this->widget('Widget_User'); /** 初始化皮肤路径 */ $this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/'; if (NULL == $this->parameter->type) { $this->parameter->type = Typecho_Router::$current; } }
/** * 构造函数,初始化组件 * * @access public * @param mixed $request request对象 * @param mixed $response response对象 * @param mixed $params 参数列表 */ public function __construct($request, $response, $params = NULL) { parent::__construct($request, $response, $params); /** 初始化数据库 */ $this->db = Typecho_Db::get(); /** 初始化常用组件 */ $this->options = $this->widget('Widget_Options'); $this->user = $this->widget('Widget_User'); $this->security = $this->widget('Widget_Security'); $this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/'; /** 加载皮肤函数 */ $functionsFile = $this->_themeDir . 'functions.php'; if (!$this->_invokeFromOutside && file_exists($functionsFile)) { require_once $functionsFile; } }