Author: Chuck Hagenbuch (chuck@horde.org)
Author: Bob Mckee (bmckee@bywires.com)
Inheritance: extends Horde_Autoloader
Ejemplo n.º 1
0
 * @package   Autoloader
 */
require_once 'Horde/Autoloader.php';
require_once 'Horde/Autoloader/ClassPathMapper.php';
require_once 'Horde/Autoloader/ClassPathMapper/Default.php';
/**
 * Default autoloader definition that uses the include path with default
 * class path mappers.
 *
 * @author    Chuck Hagenbuch <*****@*****.**>
 * @author    Bob Mckee <*****@*****.**>
 * @category  Horde
 * @copyright 2008-2015 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   Autoloader
 */
class Horde_Autoloader_Default extends Horde_Autoloader
{
    /**
     */
    public function __construct()
    {
        $paths = array_map('realpath', array_diff(array_unique(explode(PATH_SEPARATOR, get_include_path())), array('.')));
        foreach (array_reverse($paths) as $path) {
            $this->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Default($path));
        }
    }
}
/* Load default autoloader and register. */
$__autoloader = new Horde_Autoloader_Default();
$__autoloader->registerAutoloader();
Ejemplo n.º 2
0
 /**
  * Search registered mappers in LIFO order.
  *
  * @param string $className  Classname.
  *
  * @return string  Path.
  */
 public function mapToPath($className)
 {
     if (isset($this->_cache[$className])) {
         return $this->_cache[$className];
     }
     if ($res = parent::mapToPath($className)) {
         $this->_cache[$className] = $res;
         $this->_changed = true;
     }
     return $res;
 }