コード例 #1
0
ファイル: App.php プロジェクト: vitordm/VTRMVC
 /**
  * @throws Exceptions\InvalidRouteException
  */
 private function executeError()
 {
     header("HTTP/1.0 404 Not Found");
     if ($this->configuration->getRoute("404")) {
         $action = $this->getAction($this->configuration->getRoute("404"));
         if (!App::loadController($action->controller_class)) {
             throw new Exceptions\InvalidRouteException("Error - Invalid route definition | " . __METHOD__, 1010);
         }
         Router::redirect($this->configuration->getRoute("404"));
     }
     throw new Exceptions\InvalidRouteException("Error 404 - Not found");
 }
コード例 #2
0
ファイル: View.php プロジェクト: vitordm/VTRMVC
 /**
  * Inclui a página de erro ao renderizar
  */
 public function include_error_page()
 {
     $this->define_http_code(self::HTTP_CODE_NOT_FOUND);
     if ($this->error_page) {
         App::import($this->error_page);
     } else {
         throw new InvalidRouteException("Not possible execute view");
     }
 }
コード例 #3
0
ファイル: Model.php プロジェクト: vitordm/VTRMVC
 /**
  * Carrega os component editaveis
  * @param string $component nome do component ex: \Namespace\Component
  */
 public function loadComponent($component)
 {
     App::loadComponent('AppComponent');
     $components = func_get_args();
     foreach ($components as $component) {
         $component = ltrim($component, "\\");
         $fulComponent = explode("\\", $component);
         $componentName = end($fulComponent);
         $component .= 'Component';
         if (App::loadComponent($component)) {
             $this->components->{$componentName} = new $component();
         }
     }
 }