Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe JLoader

Fonctions membres publiques statiques

static discover ($classPrefix, $parentPath, $force=true, $recurse=false)
 
static getClassList ()
 
static getDeprecatedAliases ()
 
static getNamespaces ()
 
static import ($key, $base=null)
 
static load ($class)
 
static register ($class, $path, $force=true)
 
static registerPrefix ($prefix, $path, $reset=false, $prepend=false)
 
static registerAlias ($alias, $original, $version=false)
 
static registerNamespace ($namespace, $path, $reset=false, $prepend=false)
 
static setup ($enablePsr=true, $enablePrefixes=true, $enableClasses=true)
 
static loadByPsr4 ($class)
 
static loadByPsr ($class)
 
static loadByAlias ($class)
 
static applyAliasFor ($class)
 
static _autoload ($class)
 

Attributs protégés statiques

static $classes = array()
 
static $imported = array()
 
static $prefixes = array()
 
static $classAliases = array()
 
static $classAliasesInverse = array()
 
static $namespaces = array()
 
static $deprecatedAliases = array()
 
static $extensionRootFolders = array()
 

Fonctions membres privées statiques

static _load ($class, $lookup)
 
static loadAliasFor ($class)
 
static stripFirstBackslash ($class)
 

Description détaillée

Static class to handle loading of libraries.

Depuis
1.7.0

Documentation des fonctions membres

◆ _autoload()

static _autoload (   $class)
static

Autoload a class based on name.

Paramètres
string$classThe class to be loaded.
Renvoie
boolean True if the class was loaded, false otherwise.
Depuis
1.7.3

Références $class, et $prefix.

◆ _load()

static _load (   $class,
  $lookup 
)
staticprivate

Load a class based on name and lookup array.

Paramètres
string$classThe class to be loaded (without prefix).
array$lookupThe array of base paths to use for finding the class file.
Renvoie
boolean True if the class was loaded, false otherwise.
Depuis
3.0.0

Références $base, $class, $parts, et $path.

◆ applyAliasFor()

static applyAliasFor (   $class)
static

Applies a class alias for an already loaded class, if a class alias was created for it.

Paramètres
string$classWe'll look for and register aliases for this (real) class name
Renvoie
void
Depuis
3.4

Références $class.

Référencé par ClassLoader\loadClass().

◆ discover()

static discover (   $classPrefix,
  $parentPath,
  $force = true,
  $recurse = false 
)
static

Method to discover classes of a given type in a given path.

Paramètres
string$classPrefixThe class name prefix to use for discovery.
string$parentPathFull path to the parent folder for the classes to discover.
boolean$forceTrue to overwrite the autoload path value for the class if it already exists.
boolean$recurseRecurse through all child directories as well as the parent path.
Renvoie
void
Depuis
1.7.0
Obsolète:
5.0 Classes should be autoloaded. Use JLoader::registerPrefix() or JLoader::registerNamespace() to register an autoloader for your files.

$file DirectoryIterator

Références $class, et $classes.

◆ getClassList()

static getClassList ( )
static

Method to get the list of registered classes and their respective file paths for the autoloader.

Renvoie
array The array of class => path values for the autoloader.
Depuis
1.7.0

Références $classes.

◆ getDeprecatedAliases()

static getDeprecatedAliases ( )
static

Method to get the list of deprecated class aliases.

Renvoie
array An associative array with deprecated class alias data.
Depuis
3.6.3

◆ getNamespaces()

static getNamespaces ( )
static

Method to get the list of registered namespaces.

Renvoie
array The array of namespace => path values for the autoloader.
Depuis
3.1.4

◆ import()

static import (   $key,
  $base = null 
)
static

Loads a class from specified directories.

Paramètres
string$keyThe class name to look for (dot notation).
string$baseSearch this directory for the class.
Renvoie
boolean True on success.
Depuis
1.7.0
Obsolète:
5.0 Classes should be autoloaded. Use JLoader::registerPrefix() or JLoader::registerNamespace() to register an autoloader for your files.

If we are not importing a library from the Joomla namespace directly include the file since we cannot assert the file/folder naming conventions.

Références $base, $class, $classes, $key, $parts, $path, et __DIR__.

Référencé par jimport().

◆ load()

static load (   $class)
static

Load the file for a class.

Paramètres
string$classThe class to be loaded.
Renvoie
boolean True on success
Depuis
1.7.0

Références $class, $classes, et $key.

◆ loadAliasFor()

static loadAliasFor (   $class)
staticprivate

Loads the aliases for the given class.

Paramètres
string$classThe class.
Renvoie
void
Depuis
3.8.0

Références $class.

◆ loadByAlias()

static loadByAlias (   $class)
static

Method to autoload classes that have been aliased using the registerAlias method.

Paramètres
string$classThe fully qualified class name to autoload.
Renvoie
boolean True on success, false otherwise.
Depuis
3.2

Références $class.

◆ loadByPsr()

static loadByPsr (   $class)
static

Method to autoload classes that are namespaced to the PSR-4 standard.

Paramètres
string$classThe fully qualified class name to autoload.
Renvoie
boolean True on success, false otherwise.
Depuis
4.0.0

Références $class, $className, $path, et null.

◆ loadByPsr4()

static loadByPsr4 (   $class)
static

Method to autoload classes that are namespaced to the PSR-4 standard.

Paramètres
string$classThe fully qualified class name to autoload.
Renvoie
boolean True on success, false otherwise.
Depuis
3.7.0
Obsolète:
5.0 Use JLoader::loadByPsr instead

Références $class.

◆ register()

static register (   $class,
  $path,
  $force = true 
)
static

◆ registerAlias()

static registerAlias (   $alias,
  $original,
  $version = false 
)
static

Offers the ability for "just in time" usage of class_alias(). You cannot overwrite an existing alias.

Paramètres
string$aliasThe alias name to register.
string$originalThe original class to alias.
string | boolean$versionThe version in which the alias will no longer be present.
Renvoie
boolean True if registration was successful. False if the alias already exists.
Depuis
3.2

Références $version.

◆ registerNamespace()

static registerNamespace (   $namespace,
  $path,
  $reset = false,
  $prepend = false 
)
static

Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.

Paramètres
string$namespaceA case sensitive Namespace to register.
string$pathA case sensitive absolute file path to the library root where classes of the given namespace can be found.
boolean$resetTrue to reset the namespace with only the given lookup path.
boolean$prependIf true, push the path to the beginning of the namespace lookup paths array.
Renvoie
void
Exceptions
RuntimeException
Depuis
3.1.4

Références $namespace, $path, et JPATH_ROOT.

◆ registerPrefix()

static registerPrefix (   $prefix,
  $path,
  $reset = false,
  $prepend = false 
)
static

Register a class prefix with lookup path. This will allow developers to register library packages with different class prefixes to the system autoloader. More than one lookup path may be registered for the same class prefix, but if this method is called with the reset flag set to true then any registered lookups for the given prefix will be overwritten with the current lookup path. When loaded, prefix paths are searched in a "last in, first out" order.

Paramètres
string$prefixThe class prefix to register.
string$pathAbsolute file path to the library root where classes with the given prefix can be found.
boolean$resetTrue to reset the prefix with only the given lookup path.
boolean$prependIf true, push the path to the beginning of the prefix lookup paths array.
Renvoie
void
Exceptions
RuntimeException
Depuis
3.0.0

Références $path, $prefix, et JPATH_ROOT.

◆ setup()

static setup (   $enablePsr = true,
  $enablePrefixes = true,
  $enableClasses = true 
)
static

Method to setup the autoloaders for the Joomla Platform. Since the SPL autoloaders are called in a queue we will add our explicit class-registration based loader first, then fall back on the autoloader based on conventions. This will allow people to register a class in a specific location and override platform libraries as was previously possible.

Paramètres
boolean$enablePsrTrue to enable autoloading based on PSR-0.
boolean$enablePrefixesTrue to enable prefix based class loading (needed to auto load the Joomla core).
boolean$enableClassesTrue to enable class map based class loading (needed to auto load the Joomla core).
Renvoie
void
Depuis
3.1.4

◆ stripFirstBackslash()

static stripFirstBackslash (   $class)
staticprivate

Strips the first backslash from the given class if present.

Paramètres
string$classThe class to strip the first prefix from.
Renvoie
string The striped class name.
Depuis
3.8.0

Références $class.

Documentation des champs

◆ $classAliases

$classAliases = array()
staticprotected

◆ $classAliasesInverse

$classAliasesInverse = array()
staticprotected

◆ $classes

$classes = array()
staticprotected

◆ $deprecatedAliases

$deprecatedAliases = array()
staticprotected

◆ $extensionRootFolders

$extensionRootFolders = array()
staticprotected

◆ $imported

$imported = array()
staticprotected

◆ $namespaces

$namespaces = array()
staticprotected

◆ $prefixes

$prefixes = array()
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :