Example #1
0
 private static function _preprocess_url()
 {
     // Parse url
     $parse = parse_url('http://dummy:80' . self::$url);
     $path = $parse['path'];
     $query = $parse['query'];
     // Split by '/'
     self::$parts = explode('/', $path);
     // Remove first if empty
     if (count(self::$parts) && '' === self::$parts[0]) {
         array_shift(self::$parts);
     }
     // Remove last if empty
     if (count(self::$parts) && '' === end(self::$parts)) {
         array_pop(self::$parts);
     }
     // Decode url parts
     foreach (self::$parts as $i => $part) {
         self::$parts[$i] = rawurldecode($part);
     }
 }
Example #2
0
 private function initialize($node)
 {
     $this->title = '';
     $this->keywords = '';
     $this->description = '';
     $this->html = '';
     $this->css = '';
     $this->js = '';
     $is_404 = null === $this->page;
     $this->page = SystemPage::get($node->getProperty('reference'));
     if (null === $this->page) {
         header("HTTP/1.0 404 Not Found");
         $this->initialize(Router::$root->getById(Config::get('404_PAGE')));
         return;
     }
     $this->title = $node->getProperty('title');
     $this->keywords = $node->getProperty('keywords');
     $this->description = $node->getProperty('description');
     $this->render_page();
     $this->render_view();
     ob_start();
     eval('?>' . $this->html);
     if (count(Router::$parts)) {
         ob_end_clean();
         Router::$parts = array();
         header("HTTP/1.0 404 Not Found");
         $this->initialize(Router::$root->getById(Config::get('404_PAGE')));
         return;
     }
     if (Config::get('CACHE_ENABLED')) {
         Cache::add(Router::$url, Router::export() . $this->html);
         $filename = 'cache/' . md5(Router::$url);
         file_put_contents($filename, php_strip_whitespace($filename));
     }
 }