Ejemplo n.º 1
0
 public static function cached($file, $vars = false)
 {
     $page = md5($_SERVER['REQUEST_URI']);
     $dir = ACCOUNT_DIR . 'cache/' . $page;
     $cachefile = $dir . '/' . md5($file) . '.html';
     //Cache the file if it dosen't exist
     if (!file_exists($cachefile) || Core_Framework_Singleton::config()->ini['web_shop']['disablecache'] == 'yes') {
         //Make sure the folder exists
         if (!is_dir($dir)) {
             mkdir($dir, 0755);
         }
         //HTML Cache
         ob_start();
         Core_Framework_View::getPartial($file, $vars);
         $output = ob_get_contents();
         ob_end_clean();
         $handle = fopen($cachefile, 'w');
         fwrite($handle, $output);
         fclose($handle);
     }
     include $cachefile;
 }