Example #1
0
 public static function __initialize()
 {
     $app = static::instance();
     $uri = Url::current()->uri();
     $css = ['css/bootstrap.css', 'css/bootstrap-responsive.css'];
     $js = ['js/jquery.js', 'js/bootstrap.js'];
     $app->response = Response::instance();
     $app->session = Session::instance();
     $app->cache = Datastore::instance();
     $app->css = Asset::collection($css);
     $app->js = Asset::collection($js);
     // If there is no url, then we're on the home page.
     trim($uri, '/') == '' and $uri = '@@HOME';
     if ($page = Model\Page::findOneByUri($uri)) {
         $app->response->setBody($page->title);
         return;
     }
     try {
         Controller::instance()->dispatch($uri, $app->response);
         return;
     } catch (HttpException $e) {
         if (!($page = Model\Page::findOneByUri($uri = '@@404'))) {
             // Fallback to system handling.
             throw new HttpException(404, 'Page Not Found');
         }
         $app->response->setStatus(404);
         $app->response->setBody($page->title);
         return;
     }
 }
Example #2
0
 /**
  * Magic method called when a class is first encountered by the Autoloader,
  * providing static initialization.
  *
  * @return   void             No value is returned
  */
 public static function __initialize()
 {
     self::$key = Datastore::key();
 }
Example #3
0
 /**
  * Magic method called when a class is first encountered by the Autoloader,
  * providing static initialization.
  *
  * @return   void             No value is returned
  */
 public static function __initialize()
 {
     self::$path = \STORAGE_PATH . \DS . 'datastore' . \DS . Datastore::key();
 }