You are here

function _xautoload_autoload_temp in X Autoload 7.3

Same name and namespace in other branches
  1. 7.5 xautoload.early.lib.inc \_xautoload_autoload_temp()
  2. 7.2 xautoload.module \_xautoload_autoload_temp()
  3. 7.4 xautoload.early.lib.inc \_xautoload_autoload_temp()

Temporary loader callback, to avoid any module_load_include() while building the real autoloader.

Parameters

string $name: Name of the class or interface we want to load.

Throws

Exception

1 call to _xautoload_autoload_temp()
_xautoload_register in ./xautoload.early.inc
Create and register the xautoload class loader. Register the xautoload prefix, but don't register any Drupal-specific stuff yet.
1 string reference to '_xautoload_autoload_temp'
_xautoload_register in ./xautoload.early.inc
Create and register the xautoload class loader. Register the xautoload prefix, but don't register any Drupal-specific stuff yet.

File

./xautoload.early.inc, line 93

Code

function _xautoload_autoload_temp($name) {
  if (preg_match('#^xautoload_(.*)$#', $name, $m)) {

    // This is boot time, drupal_get_path() is not available yet.
    $file = XAUTOLOAD_LIB_DIR . '/' . strtr($m[1], '_', '/') . '.php';
    require_once $file;
    if (!class_exists($name, FALSE) && !interface_exists($name, FALSE)) {
      throw new Exception("Class {$name} not found in {$file}.");
    }
  }
}