示例#1
0
文件: XLite.php 项目: kingsj/core
 /**
  * Get controller
  *
  * @return \XLite\Controller\AController
  */
 public static function getController()
 {
     if (!isset(static::$controller)) {
         $class = static::getControllerClass();
         if (!\XLite\Core\Operator::isClassExists($class)) {
             \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT;
             \XLite\Logger::getInstance()->log('Controller class ' . $class . ' not found!', LOG_ERR);
             \XLite\Core\Request::getInstance()->target = static::TARGET_404;
             $class = static::getControllerClass();
         }
         static::$controller = new $class(\XLite\Core\Request::getInstance()->getData());
         static::$controller->init();
     }
     return static::$controller;
 }
示例#2
0
 /**
  * Get controller
  *
  * @return \XLite\Controller\AController
  */
 public static function getController()
 {
     if (!isset(static::$controller)) {
         $class = static::getControllerClass();
         if (!$class) {
             \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT;
             \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!');
             \XLite\Core\Request::getInstance()->target = static::TARGET_404;
             $class = static::getControllerClass();
         }
         static::$controller = new $class(\XLite\Core\Request::getInstance()->getData());
         static::$controller->init();
     }
     return static::$controller;
 }
示例#3
0
 /**
  * Get controller
  *
  * @return \XLite\Controller\AController
  */
 public static function getController()
 {
     if (null === static::$controller) {
         $class = static::getControllerClass();
         if (!$class) {
             \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT;
             \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!');
             \XLite\Core\Request::getInstance()->target = static::TARGET_404;
             $class = static::getControllerClass();
         }
         if (!\XLite\Core\Request::getInstance()->isCLI() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript(true)) {
             \XLite\Core\Request::getInstance()->target = static::TARGET_404;
             $class = static::getControllerClass();
         }
         static::$controller = new $class(\XLite\Core\Request::getInstance()->getData());
         static::$controller->init();
     }
     return static::$controller;
 }