Skip to content

icms_Autoloader

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_Autoloader

ImpressCMS Autoloader

  • Class name: icms_Autoloader
  • Namespace:

Properties

$globalRepositories

protected array $globalRepositories = array()

Paths of known global repositories

  • Visibility: protected
  • This property is static.

$imported

protected array $imported = array()

Imported namespaces

  • Visibility: protected
  • This property is static.

$initialized

protected bool $initialized = \false

Whether setup has already been called or not

  • Visibility: protected
  • This property is static.

Methods

setup

void icms_Autoloader::setup()

Initialize the autoloader, and register its autoload method

  • Visibility: public
  • This method is static.

split

array icms_Autoloader::split(string class)

Split a fully qualified class name into Namespace and Local class name

Supports both PHP 5.3 proj\sub\Class and 5.2 proj_sub_Class naming convention.

  • Visibility: public
  • This method is static.

Arguments

  • class string

register

void icms_Autoloader::register(string path, string namespace)

Register/unregister a class repository

The autoload system will look for classes in all registered repositories one after the other.

  • Visibility: public
  • This method is static.

Arguments

  • path string - <p>Repository physical path</p>
  • namespace string - <p>If specified, all classes of the repository belong to this namespace</p>

import

bool icms_Autoloader::import(string namespace, bool required)

Import a namespace global elements (constants and functions)

If a namespace has functions or constants, they must be put in a file called "namespace.php" that will be read by this function.

  • Visibility: public
  • This method is static.

Arguments

  • namespace string
  • required bool - <p>Whether to throw an exception or not if the namespace file is not found</p>

autoload

bool icms_Autoloader::autoload(string class)

Locate and load the appropriate file, based on a class name

  • Visibility: public
  • This method is static.

Arguments

  • class string

classPath

mixed icms_Autoloader::classPath(string class, bool useIncludePath, mixed ext)

Attempt to find a class path by scanning registered repositories

  • Visibility: public
  • This method is static.

Arguments

  • class string - <p>Name of the class to find</p>
  • useIncludePath bool - <p>If to search include paths too</p>
  • ext mixed

registerLegacy

mixed icms_Autoloader::registerLegacy(mixed class)

This function maps the legacy classes that were included in common.php and xoopsformloader.php Rather than including all the legacy files, this defines where PHP should look to use these classes It's ugly, but so was the code we're getting rid of

  • Visibility: public
  • This method is static.

Arguments

  • class mixed
Clone this wiki locally