JLoader
Static class to handle loading of libraries.
package |
Joomla.Platform |
---|---|
since |
11.1 |
Methods
_autoload
Autoload a class based on name.
_autoload(string $class) : void
since |
11.3 |
---|
Arguments
- $class
string
The class to be loaded.
_load
Load a class based on name and lookup array.
_load(string $class, array $lookup) : void
since |
12.1 |
---|
Arguments
- $class
string
The class to be loaded (wihtout prefix).- $lookup
array
The array of base paths to use for finding the class file.
discover
Method to discover classes of a given type in a given path.
discover(string $classPrefix, string $parentPath, boolean $force = true, boolean $recurse = false) : void
since |
11.1 |
---|
Arguments
- $classPrefix
string
The class name prefix to use for discovery.- $parentPath
string
Full path to the parent folder for the classes to discover.- $force
boolean
True to overwrite the autoload path value for the class if it already exists.- $recurse
boolean
Recurse through all child directories as well as the parent path.
getClassList
Method to get the list of registered classes and their respective file paths for the autoloader.
getClassList() : array
since |
11.1 |
---|
Response
array
The array of class => path values for the autoloader.
import
Loads a class from specified directories.
import(string $key, string $base = null) : boolean
since |
11.1 |
---|
Arguments
- $key
string
The class name to look for (dot notation).- $base
string
Search this directory for the class.
Response
boolean
True on success.
isFirstLetterAfterPrefixUpperCase
Check if first letter after the prefix length is uppercase (First letter of class name) This allows to match proper library when one library prefix is included in the prefix of another class e.g: LMyclass and LibMyclass
isFirstLetterAfterPrefixUpperCase(string $prefix, string $class) : boolean
Arguments
- $prefix
string
Library prefix- $class
string
Classname
Response
boolean
load
Load the file for a class.
load(string $class) : boolean
since |
11.1 |
---|
Arguments
- $class
string
The class to be loaded.
Response
boolean
True on success
register
Directly register a class to the autoload list.
register(string $class, string $path, boolean $force = true) : void
since |
11.1 |
---|
Arguments
- $class
string
The class name to register.- $path
string
Full path to the file that holds the class to register.- $force
boolean
True to overwrite the autoload path value for the class if it already exists.
registerPrefix
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.
registerPrefix(string $prefix, string $path, boolean $reset = false) : void
since |
12.1 |
---|
Arguments
- $prefix
string
The class prefix to register.- $path
string
Absolute file path to the library root where classes with the given prefix can be found.- $reset
boolean
True to reset the prefix with only the given lookup path.
setup
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.
setup() : void
since |
11.3 |
---|
Properties
classes
Container for already imported library paths.
since |
11.1 |
---|
Type(s)
array
imported
Container for already imported library paths.
since |
11.1 |
---|
Type(s)
array
prefixes
Container for registered library class prefixes and path lookups.
since |
12.1 |
---|
Type(s)
array