[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/ -> loader.php (summary)

Joomla! Content Management System

Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 720 lines (25 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 21 functions

  discover()
  getClassList()
  getDeprecatedAliases()
  getNamespaces()
  import()
  load()
  register()
  registerPrefix()
  registerAlias()
  registerNamespace()
  setup()
  loadByPsr4()
  loadByPsr()
  loadByAlias()
  applyAliasFor()
  _autoload()
  _load()
  loadAliasFor()
  stripFirstBackslash()
  jexit()
  jimport()

Functions
Functions that are not part of a class:

discover($classPrefix, $parentPath, $force = true, $recurse = false)   X-Ref
Method to discover classes of a given type in a given path.

param: string   $classPrefix  The class name prefix to use for discovery.
param: string   $parentPath   Full path to the parent folder for the classes to discover.
param: boolean  $force        True to overwrite the autoload path value for the class if it already exists.
param: boolean  $recurse      Recurse through all child directories as well as the parent path.
return: void

getClassList()   X-Ref
Method to get the list of registered classes and their respective file paths for the autoloader.

return: array  The array of class => path values for the autoloader.

getDeprecatedAliases()   X-Ref
Method to get the list of deprecated class aliases.

return: array  An associative array with deprecated class alias data.

getNamespaces()   X-Ref
Method to get the list of registered namespaces.

return: array  The array of namespace => path values for the autoloader.

import($key, $base = null)   X-Ref
Loads a class from specified directories.

param: string  $key   The class name to look for (dot notation).
param: string  $base  Search this directory for the class.
return: boolean  True on success.

load($class)   X-Ref
Load the file for a class.

param: string  $class  The class to be loaded.
return: boolean  True on success

register($class, $path, $force = true)   X-Ref
Directly register a class to the autoload list.

param: string   $class  The class name to register.
param: string   $path   Full path to the file that holds the class to register.
param: boolean  $force  True to overwrite the autoload path value for the class if it already exists.
return: void

registerPrefix($prefix, $path, $reset = false, $prepend = false)   X-Ref
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: string   $prefix   The class prefix to register.
param: string   $path     Absolute file path to the library root where classes with the given prefix can be found.
param: boolean  $reset    True to reset the prefix with only the given lookup path.
param: boolean  $prepend  If true, push the path to the beginning of the prefix lookup paths array.
return: void

registerAlias($alias, $original, $version = false)   X-Ref
Offers the ability for "just in time" usage of `class_alias()`.
You cannot overwrite an existing alias.

param: string          $alias     The alias name to register.
param: string          $original  The original class to alias.
param: string|boolean  $version   The version in which the alias will no longer be present.
return: boolean  True if registration was successful. False if the alias already exists.

registerNamespace($namespace, $path, $reset = false, $prepend = false)   X-Ref
Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.

param: string   $namespace  A case sensitive Namespace to register.
param: string   $path       A case sensitive absolute file path to the library root where classes of the given namespace can be found.
param: boolean  $reset      True to reset the namespace with only the given lookup path.
param: boolean  $prepend    If true, push the path to the beginning of the namespace lookup paths array.
return: void

setup($enablePsr = true, $enablePrefixes = true, $enableClasses = true)   X-Ref
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: boolean  $enablePsr       True to enable autoloading based on PSR-0.
param: boolean  $enablePrefixes  True to enable prefix based class loading (needed to auto load the Joomla core).
param: boolean  $enableClasses   True to enable class map based class loading (needed to auto load the Joomla core).
return: void

loadByPsr4($class)   X-Ref
Method to autoload classes that are namespaced to the PSR-4 standard.

param: string  $class  The fully qualified class name to autoload.
return: boolean  True on success, false otherwise.

loadByPsr($class)   X-Ref
Method to autoload classes that are namespaced to the PSR-4 standard.

param: string  $class  The fully qualified class name to autoload.
return: boolean  True on success, false otherwise.

loadByAlias($class)   X-Ref
Method to autoload classes that have been aliased using the registerAlias method.

param: string  $class  The fully qualified class name to autoload.
return: boolean  True on success, false otherwise.

applyAliasFor($class)   X-Ref
Applies a class alias for an already loaded class, if a class alias was created for it.

param: string  $class  We'll look for and register aliases for this (real) class name
return: void

_autoload($class)   X-Ref
Autoload a class based on name.

param: string  $class  The class to be loaded.
return: boolean  True if the class was loaded, false otherwise.

_load($class, $lookup)   X-Ref
Load a class based on name and lookup array.

param: string  $class   The class to be loaded (without prefix).
param: array   $lookup  The array of base paths to use for finding the class file.
return: boolean  True if the class was loaded, false otherwise.

loadAliasFor($class)   X-Ref
Loads the aliases for the given class.

param: string  $class  The class.
return: void

stripFirstBackslash($class)   X-Ref
Strips the first backslash from the given class if present.

param: string  $class  The class to strip the first prefix from.
return: string  The striped class name.

jexit($message = 0)   X-Ref
Global application exit.

This function provides a single exit point for the platform.

param: mixed  $message  Exit code or string. Defaults to zero.
return: void

jimport($path, $base = null)   X-Ref
Intelligent file importer.

param: string  $path  A dot syntax path.
param: string  $base  Search this directory for the class.
return: boolean  True on success.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer