芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/lib/mustache/src/Mustache/Autoloader.php
baseDir = $realDir; } else { $this->baseDir = $baseDir; } } /** * Register a new instance as an SPL autoloader. * * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..') * * @return Mustache_Autoloader Registered Autoloader instance */ public static function register($baseDir = null) { $key = $baseDir ? $baseDir : 0; if (!isset(self::$instances[$key])) { self::$instances[$key] = new self($baseDir); } $loader = self::$instances[$key]; spl_autoload_register(array($loader, 'autoload')); return $loader; } /** * Autoload Mustache classes. * * @param string $class */ public function autoload($class) { if ($class[0] === '\\') { $class = substr($class, 1); } if (strpos($class, 'Mustache') !== 0) { return; } $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class)); if (is_file($file)) { require $file; } } }