/** * 获得系统的相关参数 */ function __construct() { parent::__construct(); // filter $_GET $this->filterDatas($_GET); $this->filterDatas($_POST); $this->filterDatas($_COOKIE); $this->filterDatas($_SESSION); }
/** * 构造函数 * * @param Leb_Config */ protected function __construct($params = array()) { parent::__construct($params); $this->_initConfig(); $engine = $this->getEnv('engine'); $engine = isset($engine) && $engine ? $engine : "Leb_Router_Stand"; if (!self::$_engine) { self::$_engine = new $engine(); } }
/** * 构造函数 * @param array $params */ protected function __construct($params = array()) { parent::__construct($params); $errorMapFile = $this->getEnv('errorMapFile'); if (!empty($errorMapFile)) { $this->_errorMapFile = $errorMapFile; } // 错误触发 $trggierMethod = $this->getEnv('trggierMethod'); if (!empty($trggierMethod)) { $this->_trigerErrorMethod = $trggierMethod; } }
/** * 构造函数 * 代理某个具体渲染器的方法 * * @param Leb_Config */ protected function __construct($params = array()) { parent::__construct($params); $this->_initConfig(); $engine = $this->getEnv('engine'); $engine = isset($engine) && $engine ? $engine : "Leb_View_Stand"; if (!self::$_engine) { $engine_file_name = strtolower(substr($engine, strlen(__CLASS__) + 1)) . '.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . $engine_file_name; self::$_engine = new $engine(); } if ($this->isAllowLayout()) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'view/layout.php'; $this->_layouter = Leb_View_Layout::getInstance(); } self::$_engine->setTemplateSuffix($this->getEnv('suffix')); }
/** * 应用程序加载前实例化 * 如果需要对本方法进行扩展,可以重载本方法 * @param array $plugins 要在本执行里执行的插件组 * @return self */ protected function execute($plugins) { if (!empty($plugins)) { $this->setPlugins($plugins); } $result = null; $plugins = $this->getPlugins(); if (!empty($plugins) && is_array($plugins)) { $result = null; foreach ($plugins as $plugin) { // 加工厂,把前面一个插件运行的结果传递给后面 $result = $plugin->run($result); // 把前面的结果保存在运行对象里供后续使用 if ($result instanceof Leb_Plugin_Abstract) { $this->setRunner($result->getAlias(), $result); } } } return parent::execute($result); }
/** * 构造函数 * * @param * 传递进来一个分发对象,可以通过分发对象获得Request及Router等对象 */ public function __construct($plugins = null) { parent::__construct(); $this->setRunner($plugins); // define 几个常用常量 $this->_action = $this->getRouter()->getAction(); $GLOBALS['ACTION'] = $this->_action; $this->_controller = $this->getRouter()->getController(); $GLOBALS['CONTROLLER'] = $this->_controller; $this->_application = $this->getRouter()->getApp(); $GLOBALS['APPLICATION'] = $this->_application; $timeZone = $this->getEnv('timeZone'); if ($timeZone && function_exists('date_default_timezone_set')) { date_default_timezone_set($timeZone); } if ($encoding = $this->getEnv('encode')) { mb_internal_encoding($encoding); } //加载应用函数 $appFnPath = _APP_ . '_function/functions.php'; if (!in_array($appFnPath, $this->_fnPath) && file_exists($appFnPath)) { include_once $appFnPath; $this->_fnPath[] = $appFnPath; } //加载模块函数 $appPath = _APP_ . $this->getRouter()->getApp() . '/function/functions.php'; if (!in_array($appPath, $this->_fnPath) && file_exists($appPath)) { include_once $appPath; $this->_fnPath[] = $appPath; } //初始化应用配置目录 $configDir = array(); $configDir[] = _APP_ . $this->_application . '/config/'; $configDir[] = _APP_ . '_config/'; $configDir[] = _ROOT_ . 'config/'; Leb_Plugin_Abstract::addConfigSearchPath($configDir); //注册应用参数的模板变量 $this->assign('APP_PARAMS', array('action' => $this->_action, 'controller' => $this->_controller, 'app' => $this->_application, 'url' => $this->buildUrl($this->_action, $this->_controller, $this->_application))); }
public function __construct() { parent::__construct(); }
/** * 设置本对象需要的请求对象 * * @param Leb_Request $plugins */ public function execute($plugins) { $this->_initConfig(); // 获得传递过来的request对象 $this->setRequest($plugins); // 解析网址以生成相应的参数对象 if ($this->getEnv('rewrite')) { $this->matchRouter(); $this->_appName = $this->_getApp(); $this->_controllerName = $this->_getController(); $this->_actionName = $this->_getAction(); //$this->_querys = $this->_getQuerys(); } return parent::execute($plugins); }
/** * 设置本对象需要的请求对象 * * @param Leb_Request $plugins */ public function execute($plugins) { $this->_initConfig(); // 获得传递过来的request对象 $this->setRequest($plugins); // 解析网址以生成相应的参数对象 $this->_querys = $this->_matches = $this->_getQuerys(); if ($this->_matches) { unset($this->_matches[0]); $this->_matches['app'] = $this->_matches['controller'] = $this->_matches['action'] = ''; foreach ($this->_matches as $key => $value) { $pre = strpos($value, '--'); $pos = strpos($value, '='); if (false === $pre && false === $pos) { if (!$this->_matches['app']) { $this->_matches['app'] = $value; } elseif (!$this->_matches['controller']) { $this->_matches['controller'] = $value; } elseif (!$this->_matches['action']) { $this->_matches['action'] = $value; } } } } $this->_appName = $this->_getApp(); $this->_controllerName = $this->_getController(); $this->_actionName = $this->_getAction(); return parent::execute($plugins); }