コード例 #1
0
ファイル: Controller.php プロジェクト: ale88andr/RHP
 private function getPartialPath($partial)
 {
     $path = [];
     $partial = ltrim($partial, '/') . '.html.php';
     if (!strpos($partial, '/')) {
         Hash::set($path, 'dir', strtolower(get_class($this)));
         Hash::set($path, 'file', $partial);
     } else {
         $tmp = explode('/', $partial);
         Hash::set($path, 'file', array_pop($tmp));
         Hash::set($path, 'dir', join($tmp));
     }
     return $path;
 }
コード例 #2
0
ファイル: App.php プロジェクト: ale88andr/RHP
 /**
  * Controller handler by request params.
  *
  * @param array $url Request string (URI)
  * @throws Exception
  * @return void
  */
 private function applyController($url)
 {
     $this->controller = Hash::shift($url);
     if (is_null($this->controller)) {
         $this->controller = $this->routes->get('root.resource');
     }
     $controller_path = $this->controllersPath() . $this->controller . '.php';
     try {
         if (file_exists($controller_path)) {
             require_once $controller_path;
             $this->controller = new $this->controller($this);
             $this->action = empty($url[0]) ? $this->routes->get('root.action') : Hash::shift($url);
             $this->applyControllerAction($url);
         } else {
             throw new RequireFileException('controller', $this->controller, $this->controllersPath());
         }
     } catch (RequireFileException $e) {
         die($e);
     }
 }
コード例 #3
0
ファイル: Configuration.php プロジェクト: ale88andr/RHP
 public function set(array $item, $value)
 {
     Hash::set($this->items, $item, $value);
 }