52     protected $prefixes = array();
 
   53     protected $fallbacks = array();
 
   93         return $this->prefixes;
 
  103         foreach (
$namespaces as $namespace => $locations) {
 
  104             $this->namespaces[$namespace] = (array)$locations;
 
  116         $this->namespaces[$namespace] = (array)$paths;
 
  126         foreach (
$classes as $prefix => $locations) {
 
  127             $this->prefixes[$prefix] = (array)$locations;
 
  139         $this->prefixes[$prefix] = (array)$paths;
 
  149         $this->fallbacks[] = rtrim(
$path, 
'/\\');
 
  157     public function register() {
 
  158         spl_autoload_register(array($this, 
'loadClass'));
 
  168         $file = $this->map->getPath(
$class);
 
  169         if ($file && is_readable($file)) {
 
  174         $file = $this->findFile(
$class);
 
  175         if ($file && is_readable($file)) {
 
  176             $this->map->setPath(
$class, $file);
 
  177             $this->map->setAltered(
true);
 
  194         $pos = strrpos(
$class, 
'\\');
 
  195         if (
false !== $pos) {
 
  197             $namespace = substr(
$class, 0, $pos);
 
  198             $className = substr(
$class, $pos + 1);
 
  199             $normalizedClass = str_replace(
'\\', DIRECTORY_SEPARATOR, $namespace)
 
  200                 . DIRECTORY_SEPARATOR
 
  201                 . str_replace(
'_', DIRECTORY_SEPARATOR, $className) . 
'.php';
 
  202             foreach ($this->namespaces as $ns => $dirs) {
 
  203                 if (0 !== strpos($namespace, $ns)) {
 
  207                 foreach ($dirs as $dir) {
 
  208                     $file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
 
  209                     if (is_file($file)) {
 
  217             $normalizedClass = str_replace(
'_', DIRECTORY_SEPARATOR, 
$class) . 
'.php';
 
  218             foreach ($this->prefixes as $prefix => $dirs) {
 
  219                 if (0 !== strpos(
$class, $prefix)) {
 
  223                 foreach ($dirs as $dir) {
 
  224                     $file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
 
  225                     if (is_file($file)) {
 
  232         foreach ($this->fallbacks as $dir) {
 
  233             $file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
 
  234             if (is_file($file)) {
 
if(isset($vars['id'])) $class
 
__construct(\Elgg\ClassMap $map)
Constructor.
 
findFile($class)
Finds the path to the file where the class is defined.
 
getNamespaces()
Gets the configured namespaces.
 
loadClass($class)
Loads the given class or interface, possibly updating the class map.
 
addFallback($path)
Add a directory to search if no registered directory is found.
 
registerPrefixes(array $classes)
Registers an array of classes using the PEAR naming convention.
 
registerNamespaces(array $namespaces)
Registers an array of namespaces.
 
getClassMap()
Get the class map.
 
registerPrefix($prefix, $paths)
Registers a set of classes using the PEAR naming convention.
 
getPrefixes()
Gets the configured class prefixes.
 
registerNamespace($namespace, $paths)
Registers a namespace.