Advertisement
Guest User

Untitled

a guest
Feb 27th, 2012
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. static function autoload($class){
  2.                 $class_path = str_replace("\\", "/", $class).'.php';
  3.                 if(strpos($class, 'Proxie\\') !== false) {
  4.                         $class_path = str_replace("Proxie/",'',$class_path);
  5.                 }
  6.                 $ok = @include_once($class_path);
  7.                 if($ok){
  8.                         if(PROD_MODE){
  9.                                 if(strpos($class, 'Model\\') === false){
  10.                                         $f = fopen(ROOT_PATH.'system/777/autoloader/classes_cache.php',"a");
  11.                                         $refl = new \ReflectionClass($class);
  12.                                         $classfile = $refl->getFileName();
  13.                                         $content = file_get_contents($classfile);
  14.                                         $content = str_replace(array('<?php','?>'), '', $content);
  15.                                         $content = str_replace('__DIR__', '"'.dirname($classfile).'"', $content);
  16.                                         fwrite($f, $content);
  17.                                         fclose($f);
  18.                     apc_clear_cache("user");
  19.                     apc_clear_cache("system");
  20.                     apc_clear_cache("opcode");
  21.                                 }
  22.                         }
  23.                 }
  24.                 return $ok;
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement