public function getPathInfo()
 {
     $pathInfo = parent::getPathInfo();
     if (ConfigHandler::has('__urlSuffix__', 'routing') && '' != ($suffix = ConfigHandler::get('routing.__urlSuffix__'))) {
         $pathInfo = str_replace($suffix, '', $pathInfo);
     }
     return $pathInfo;
 }
 /**
  * Initialize
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     ini_set('display_errors', Base::ENV_DEV == Base::getEnv() || Base::ENV_TEST == Base::getEnv() ? 'on' : 'off');
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
 }
 /**
  *
  */
 protected function _init()
 {
     define('TASK_DIR', APP_PATH . '/');
     ini_set('display_errors', ConfigHandler::get('debug') ? 'on' : 'off');
     //Error reporting
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     //set timezone
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
     if (true === $this->isCli()) {
         $argv = $_SERVER['argv'];
         $seek = 1;
         if (null == $this->_task) {
             $this->_task = $argv[$seek];
             ++$seek;
         }
         if (null == $this->_act && isset($argv[$seek])) {
             $this->_act = $argv[$seek];
             ++$seek;
         } else {
             $this->_act = 'default';
         }
         if (isset($argv[$seek])) {
             $this->_originalParams = array_slice($argv, $seek);
             $this->_params = $this->_process($this->_originalParams);
         }
     } else {
         //run on browser (only for test)
         if (null !== ($task = Factory::getRequest()->get('task'))) {
             $this->_task = $task;
         }
         if (null !== ($act = Factory::getRequest()->get('act'))) {
             $this->_act = $act;
         }
     }
 }
 protected function _init()
 {
     ini_set('display_errors', Base::ENV_DEV == Base::getEnv() || Base::ENV_TEST == Base::getEnv() ? 'on' : 'off');
     //Error reporting
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     //set timezone
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
     $this->_requestMethod = strtoupper($_SERVER['REQUEST_METHOD']);
     if (!in_array($this->_requestMethod, self::$RESTfulREQUEST)) {
         throw new ApiException('Application: Request method unsupported!', null, 400);
     }
 }
Exemple #5
0
 /**
  * @param $buffer
  * @throws \Exception
  * @return string
  */
 protected function _renderPage($buffer)
 {
     //@TODO Addition document object and register it in factory
     $document = $this->document();
     //@TODO same as view
     $view = $this->view();
     $view->assign('buffer', $buffer);
     if ($this->_layout == null) {
         $config = ConfigHandler::get('template');
         $this->_layout = ConfigHandler::has('default_layout') ? ConfigHandler::get('default_layout') : 'default';
         //load default layout
     }
     $content = $view->render($this->getTemplatePath() . '/' . $this->_layout);
     if ($document->getMode() == Html::MODE_ASSETS_END) {
         $content = $document->disbursement($content);
     }
     return $content;
 }