You are here

function xautoload_LoaderManager::register in X Autoload 7.3

Register the loader for the given mode, and unregister other loaders. This can be used both for initial registration, and later on to change the cache mode.

Parameters

string|NULL $mode: Loader mode, e.g. 'apc' or 'default'. If NULL, the loader mode will be detected from settings.

boolean $prepend: If TRUE, the loader will be prepended before other loaders. If FALSE, the loader will be inserted into the dedicated position between other loaders.

File

lib/LoaderManager.php, line 51

Class

xautoload_LoaderManager
This thing has an overview of available class loaders with different cache mechanics. It can detect the currently applicable cache method, and it can switch between cache methods.

Code

function register($mode = NULL, $prepend = FALSE) {
  if (!isset($mode)) {
    $mode = $this
      ->detectLoaderMode();
  }
  $success = $this
    ->initLoaderMode($mode);
  if (!$success) {

    // Fallback to 'default' mode.
    $this
      ->initLoaderMode('default');
    $mode = 'default';
  }
  $this
    ->switchLoaderMode($mode, $prepend);
}