JLoader

Static class to handle loading of libraries.

abstract
package

Joomla.Platform

since

11.1

Methods

_autoload

Autoload a class based on name.

_autoload(string $class) : void
static
since

11.3

Arguments

$class

stringThe class to be loaded.

_load

Load a class based on name and lookup array.

_load(string $class, array $lookup) : void
static
since

12.1

Arguments

$class

stringThe class to be loaded (wihtout prefix).

$lookup

arrayThe 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
static
since

11.1

Arguments

$classPrefix

stringThe class name prefix to use for discovery.

$parentPath

stringFull path to the parent folder for the classes to discover.

$force

booleanTrue to overwrite the autoload path value for the class if it already exists.

$recurse

booleanRecurse 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
static
since

11.1

Response

arrayThe array of class => path values for the autoloader.

import

Loads a class from specified directories.

import(string $key, string $base = null) : boolean
static
since

11.1

Arguments

$key

stringThe class name to look for (dot notation).

$base

stringSearch this directory for the class.

Response

booleanTrue 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
static

Arguments

$prefix

stringLibrary prefix

$class

stringClassname

Response

boolean

load

Load the file for a class.

load(string $class) : boolean
static
since

11.1

Arguments

$class

stringThe class to be loaded.

Response

booleanTrue on success

register

Directly register a class to the autoload list.

register(string $class, string $path, boolean $force = true) : void
static
since

11.1

Arguments

$class

stringThe class name to register.

$path

stringFull path to the file that holds the class to register.

$force

booleanTrue 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
static
since

12.1

Arguments

$prefix

stringThe class prefix to register.

$path

stringAbsolute file path to the library root where classes with the given prefix can be found.

$reset

booleanTrue 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
static
since

11.3

Properties

classes

Container for already imported library paths.

static
since

11.1

Type(s)

array

imported

Container for already imported library paths.

static
since

11.1

Type(s)

array

prefixes

Container for registered library class prefixes and path lookups.

static
since

12.1

Type(s)

array