Esempio n. 1
0
 public static function file_name()
 {
     if (!self::$cache_file) {
         $sess = $_SESSION[Session::get_hash()];
         unset($sess['referrer']);
         $path = $_SERVER['REQUEST_URI'] . serialize($_GET) . serialize($sess);
         self::$cache_file = CACHE_DIR . self::$sub_directory . str_replace("-", "_", $_SERVER['HTTP_HOST']) . md5($path) . '.' . self::$cache_type . '.' . self::$file_suffix;
     }
     if (is_readable(self::$cache_file)) {
         return self::$cache_file;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 public function execute_partial($path, $format = false)
 {
     if (strpos($path, "/")) {
         $partial = substr($path, strrpos($path, "/") + 1);
         $path = substr($path, 0, strrpos($path, "/") + 1);
         $path = $path . $partial;
     } else {
         $partial = $path;
     }
     $sess = $_SESSION[Session::get_hash()];
     unset($sess['referrer']);
     $cache = new WaxCache($_SERVER['HTTP_HOST'] . md5($_SERVER['REQUEST_URI'] . serialize($_GET) . serialize($sess)) . '.partial');
     if (count($_POST)) {
         $cache->expire();
     }
     if (Config::get('partial_cache') && !substr_count($path, "admin") && !substr_count(strtolower($this->controller), "admin") && $cache->valid()) {
         $partial = $cache->get();
     } else {
         if ($this->is_public_method($this, $partial)) {
             $this->{$partial}();
         }
     }
     $partial = $this->build_partial($path, $format);
     if (Config::get('partial_cache') && !substr_count($this->controller, "admin")) {
         $cache->set($partial);
     }
     return $partial;
 }