Пример #1
0
<?php

// Autoloader
require_once realpath(dirname(__FILE__) . '/../../engine') . '/infra/Ezer_Autoloader.php';
Ezer_Autoloader::addClassPath(Ezer_Autoloader::buildPath(dirname(__FILE__), 'lib', '*'));
Ezer_Autoloader::setClassMapFilePath(Ezer_Autoloader::buildPath(dirname(__FILE__), 'cache', 'EzerClassMap.cache'));
//Ezer_Autoloader::dumpExtra();
Ezer_Autoloader::register();
Пример #2
0
 /**
  * Load and cache the class map
  */
 private static function loadClassMap()
 {
     if (!file_exists(self::$_classMapFileLocation) || self::$_noCache == true) {
         // cached map doesn't exists, rebuild the cache map
         foreach (self::$_classPath as $dir) {
             if (strpos($dir, DIRECTORY_SEPARATOR . "*") == strlen($dir) - 2) {
                 $dir = substr($dir, 0, strlen($dir) - 2);
                 $recursive = true;
             } else {
                 $recursive = false;
             }
             self::scanDirectory($dir, $recursive);
         }
         if (self::$_noCache === false) {
             // save the cached map
             file_put_contents(self::$_classMapFileLocation, serialize(self::$_classMap));
         }
     } else {
         if (count(self::$_classMap) == 0) {
             // if cached map was not loaded but exists on the disk, load it
             self::$_classMap = unserialize(file_get_contents(self::$_classMapFileLocation));
         }
     }
 }