Methods

Adding additional autoloader class map configuration.

addClassmapConfig(array $config) : void
Static

NOTE: Since this autoloader is implemented for CONTENIDO, it doesn't support to load classfiles being located outside of the CONTENIDO installation folder.

Parameters

$config

array

Assoziative class map array as follows:

// Structure is: "Classname" => "Path to classfile from CONTENIDO installation folder"
$config = array(
    'myPluginsClass' => 'contenido/plugins/myplugin/classes/class.myPluginClass.php',
    'myPluginsOtherClass' => 'contenido/plugins/myplugin/classes/class.myPluginsOtherClass.php',
);

Adding additional autoloader class map configuration file.

addClassmapConfigFile(string $configFile) : void
Static

NOTE: Since this autoloader is implemented for CONTENIDO, it doesn't support to load classfiles being located outside of the CONTENIDO installation folder.

Parameters

$configFile

string

Full path to class map configuration file. The provided file must return a class map configuration array as follows:

// Structure is: "Classname" => "Path to classfile from CONTENIDO installation folder"
return array(
    'myPluginsClass' => 'contenido/plugins/myplugin/classes/class.myPluginClass.php',
    'myPluginsOtherClass' => 'contenido/plugins/myplugin/classes/class.myPluginsOtherClass.php',
    'myCmsClass' => 'cms/includes/class.myCmsClass.php',
);

The main __autoload() implementation.

autoload(string $className) : void
Static

Tries to include the file of passed classname.

Parameters

$className

string

The classname

Exceptions

\cBadMethodCallException If autoloader wasn't initialized before

Returns the errorlist containing invalid classes (@see cAutoload::$_errors)

getErrors() : array
Static

Returns

array

Returns the loaded classes (@see cAutoload::$_loadedClasses)

getLoadedClasses() : array
Static

Returns

array

Initialization of CONTENIDO autoloader, is to call at least once.

initialize(array $cfg) : void
Static

Registers itself as a __autoload implementation, includes the class map file, and if exists, the user defined class map file, containing the includes.

Parameters

$cfg

array

The CONTENIDO cfg array

Checks, if passed filename is a file, which will be included by the autoloader.

isAutoloadable(string $file) : bool
Static

Parameters

$file

string

Filename or Filename with a part of the path, e. g. - class.foobar.php - classes/class.foobar.php - contenido/classes/class.foobar.php

Returns

bool

Returns the path to a CONTENIDO class file by processing the given classname

_getContenidoClassFile(string $className) : \(string | \null)
Static

Parameters

$className

string

Returns

\(string\null)Path and filename or null

Loads the desired file by invoking require_once method

_loadFile(string $filePathName, bool $beQuiet) : void
Static

Parameters

$filePathName

string

$beQuiet

bool

Flag to prevent thrown warnings/errors by using the error control operator @

Normalizes the passed configuration array by returning a new copy of it which contains the keys in lowercase.

_normalizeConfig(array $config) : array
Static

This prevents errors by trying to load class 'foobar' if the real class name is 'FooBar'.

Parameters

$config

array

Returns

array

Validates the given class and the file

_validateClassAndFile(string $className, string $filePathName) : \(string | \null)
Static

Parameters

$className

string

$filePathName

string

Returns

\(string\null)The file if validation was successfull, otherwhise null

 Properties

 

$_conRootPath : string

Path to the folder which contains the CONTENIDO installation.

 

$_errors : array

$_errors[pos] = array('class' => classname, 'file' => file, 'error' => errorType);

 

$_includeFiles : array
 

$_initialized : bool
 

$_loadedClasses : array

$_loadedClasses['classname'] = '/path/to/the/class.php';

 Constants

 

ERROR_CLASS_EXISTS

ERROR_CLASS_EXISTS 
 

ERROR_FILE_NOT_FOUND

ERROR_FILE_NOT_FOUND