Home > Genel > Opencart glob hatası

Opencart glob hatası

<?php
////////////////////////////////////////////
// Opencart.com
// Farhad Sakhaei ~ parsmizban.com
// Mohammad Reza Mahmoudi ~ iropencart.com
///////////////////////////////////////////

    function MRMs_glob($dir){
     $files = array();
      if(is_dir($dir)){
         if($dh=opendir($dir)){
         while(($file = readdir($dh)) !== false){
               $files[]=$dir.$file;
            }}
         }
      return $files;
      }
      
/////////////////////////////////////////

final class Cache { 
   private $expire = 3600; 

     public function __construct() {
      $files = MRMs_glob(DIR_CACHE . ‘cache.*’);
      
      if ($files) {
         foreach ($files as $file) {
            $time = substr(strrchr($file, ‘.’), 1);

               if ($time < time()) {
               if (file_exists($file)) {
                  @unlink($file);
               }
               }
          }
      }
     }

   public function get($key) {
      $files = MRMs_glob(DIR_CACHE . ‘cache.’ . $key . ‘.*’);
      
      if ($files) {
          foreach ($files as $file) {
               $cache = ”;
            
            $handle = fopen($file, ‘r’);
               
            if ($handle) {
               $cache = fread($handle, filesize($file));
     
               fclose($handle);
            }

               return unserialize($cache);
             }
      }
     }

     public function set($key, $value) {
       $this->delete($key);
      
      $file = DIR_CACHE . ‘cache.’ . $key . ‘.’ . (time() + $this->expire);
       
      $handle = fopen($file, ‘w’);

       fwrite($handle, serialize($value));
      
       fclose($handle);
     }
   
     public function delete($key) {
      $files = MRMs_glob(DIR_CACHE . ‘cache.’ . $key . ‘.*’);
      
      if ($files) {
          foreach ($files as $file) {
               if (file_exists($file)) {
               @unlink($file);
               clearstatcache();
            }
          }
      }
     }
}
?>

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

*

Şu HTML etiketlerini ve özelliklerini kullanabilirsiniz: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks:0

Listed below are links to weblogs that reference
Opencart glob hatası from Grafikey
TOP