Exemplo n.º 1
0
 public function boot()
 {
     $uri = $this->getUri();
     list($controllerName, $action, $render) = $this->routes($uri);
     RouterLib::$data['controller'] = $controllerName;
     RouterLib::$data['action'] = $action;
     $controllerFile = Config::get('app.module.dir') . DS . 'controllers' . DS . $controllerName . '.php';
     if (!is_file($controllerFile)) {
         $controllerFile = Config::get('app.module.dir') . DS . 'controllers' . DS . 'static.php';
         $action = 404;
     }
     require_once $controllerFile;
     $class = '\\Thin\\' . ucfirst(Inflector::lower(SITE_NAME)) . ucfirst(Inflector::lower($controllerName)) . 'Controller';
     RouterLib::$request = (new Object())->populate($_REQUEST);
     $controller = new $class($action);
     if (true === $render) {
         self::render($controller);
     }
 }
Exemplo n.º 2
0
 public function __construct($action)
 {
     $method = Request::method();
     $this->_name = 'static';
     $this->session = session(SITE_NAME);
     $this->me = lib('me');
     $this->action = $action;
     $this->bucket = new Bucket(SITE_NAME, URLSITE . 'bucket');
     if ($action == 404) {
         $this->routing();
     } else {
         $action = Inflector::lower($method) . ucfirst(Inflector::camelize(strtolower($action)));
         $methods = get_class_methods($this);
         if (in_array($action, $methods)) {
             $this->{$action}();
         } else {
             RouterLib::is404();
         }
     }
 }