/** * 构造函数 * * @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))); }
/** * 构造函数 * @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; //加载应用函数 $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; } }