You are here

function _xautoload_autoload_temp in X Autoload 7.2

Same name and namespace in other branches
  1. 7.5 xautoload.early.lib.inc \_xautoload_autoload_temp()
  2. 7.3 xautoload.early.inc \_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.

1 call to _xautoload_autoload_temp()
_xautoload_register in ./xautoload.module
Build and register the xautoload loader.
1 string reference to '_xautoload_autoload_temp'
_xautoload_register in ./xautoload.module
Build and register the xautoload loader.

File

./xautoload.module, line 308

Code

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

    // This is boot time, drupal_get_path() is not available yet.
    $file = dirname(__FILE__) . '/lib/' . 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}.");
    }
  }
}