You are here

function _xautoload_autoload_temp in X Autoload 7.4

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.3 xautoload.early.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 string reference to '_xautoload_autoload_temp'
_xautoload_register in ./xautoload.early.lib.inc
Create and register the xautoload class loader. Register the xautoload prefix, but don't register any Drupal-specific stuff yet.

File

./xautoload.early.lib.inc, line 112

Code

function _xautoload_autoload_temp($name) {
  if ('Drupal\\xautoload\\' === substr($name, 0, 17)) {

    // PSR-4 case
    $file = XAUTOLOAD_LIB_DIR . '/' . str_replace('\\', '/', substr($name, 17)) . '.php';
    require_once $file;
  }
  elseif ('xautoload_' === substr($name, 0, 10) && FALSE === strpos($name, '\\')) {

    // Legacy case
    $file = XAUTOLOAD_LIB_DIR . '/' . str_replace('_', '/', substr($name, 10)) . '.php';
    require_once $file;
  }
}