Exemplo n.º 1
0
 public static function autoload($class)
 {
     $class = strtolower($class);
     if (strpos($class, '_') !== false) {
         list($folder) = explode('_', $class);
         $file = 'class/' . $folder . '/' . substr($class, strlen($folder) + 1);
     } else {
         $file = 'class/' . $class;
     }
     try {
         self::import($file);
         return true;
     } catch (Exception $exc) {
         $trace = $exc->getTrace();
         foreach ($trace as $log) {
             if (empty($log['class']) && $log['function'] == 'class_exists') {
                 return false;
             }
         }
         discuz_error::exception_error($exc);
     }
 }
Exemplo n.º 2
0
 public static function autoload($class)
 {
     $class = strtolower($class);
     if (strpos($class, '_') !== false) {
         list($folder) = explode('_', $class);
         $file = 'class/' . $folder . '/' . substr($class, strlen($folder) + 1);
     } else {
         $file = 'class/' . $class;
     }
     try {
         if (defined('EXTEND') && EXTEND === true && strpos($class, 'table') === FALSE && self::import($file . '_ext', '', false, true, true) === true) {
             $mts = defined('EXTEND_NO_DETECT') && EXTEND_NO_DETECT === false ? (string) date('Ymd~Hi~s', self::import($file . '_ext', '', false, true, false, false, true)) : '';
             $cacf = DISCUZ_ROOT . '/data/sysdata/' . $class . '_ext' . $mts . '.php';
             if (defined('EXTEND_NO_CACHE') && EXTEND_NO_CACHE === true || !is_file($cacf)) {
                 $class_cont = self::combine_class($class);
                 self::put_class($class_cont, $cacf);
             }
             include $cacf;
             return true;
         }
         self::import($file);
         return true;
     } catch (Exception $exc) {
         $trace = $exc->getTrace();
         foreach ($trace as $log) {
             if (empty($log['class']) && $log['function'] == 'class_exists') {
                 return false;
             }
         }
         discuz_error::exception_error($exc);
     }
 }