ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_Bootstrap Class Reference

Bootstrap class that contains meta-functionality for HTML Purifier such as the autoload function. More...

+ Collaboration diagram for HTMLPurifier_Bootstrap:

Static Public Member Functions

static autoload ($class)
 Autoload function for HTML Purifier.
static getPath ($class)
 Returns the path for a specific class.
static registerAutoload ()
 "Pre-registers" our autoloader on the SPL stack.

Detailed Description

Bootstrap class that contains meta-functionality for HTML Purifier such as the autoload function.

Note
This class may be used without any other files from HTML Purifier.

Definition at line 30 of file Bootstrap.php.

Member Function Documentation

static HTMLPurifier_Bootstrap::autoload (   $class)
static

Autoload function for HTML Purifier.

Parameters
$classClass to load

Definition at line 37 of file Bootstrap.php.

References $file, and getPath().

{
if (!$file) return false;
require HTMLPURIFIER_PREFIX . '/' . $file;
return true;
}

+ Here is the call graph for this function:

static HTMLPurifier_Bootstrap::getPath (   $class)
static

Returns the path for a specific class.

Definition at line 47 of file Bootstrap.php.

References $file.

Referenced by autoload().

{
if (strncmp('HTMLPurifier', $class, 12) !== 0) return false;
// Custom implementations
if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
$code = str_replace('_', '-', substr($class, 22));
$file = 'HTMLPurifier/Language/classes/' . $code . '.php';
} else {
$file = str_replace('_', '/', $class) . '.php';
}
if (!file_exists(HTMLPURIFIER_PREFIX . '/' . $file)) return false;
return $file;
}

+ Here is the caller graph for this function:

static HTMLPurifier_Bootstrap::registerAutoload ( )
static

"Pre-registers" our autoloader on the SPL stack.

Definition at line 63 of file Bootstrap.php.

References $compat, and elseif().

{
$autoload = array('HTMLPurifier_Bootstrap', 'autoload');
if ( ($funcs = spl_autoload_functions()) === false ) {
spl_autoload_register($autoload);
} elseif (function_exists('spl_autoload_unregister')) {
$compat = version_compare(PHP_VERSION, '5.1.2', '<=') &&
version_compare(PHP_VERSION, '5.1.0', '>=');
foreach ($funcs as $func) {
if (is_array($func)) {
// :TRICKY: There are some compatibility issues and some
// places where we need to error out
$reflector = new ReflectionMethod($func[0], $func[1]);
if (!$reflector->isStatic()) {
throw new Exception('
HTML Purifier autoloader registrar is not compatible
with non-static object methods due to PHP Bug #44144;
Please do not use HTMLPurifier.autoload.php (or any
file that includes this file); instead, place the code:
spl_autoload_register(array(\'HTMLPurifier_Bootstrap\', \'autoload\'))
after your own autoloaders.
');
}
// Suprisingly, spl_autoload_register supports the
// Class::staticMethod callback format, although call_user_func doesn't
if ($compat) $func = implode('::', $func);
}
spl_autoload_unregister($func);
}
spl_autoload_register($autoload);
foreach ($funcs as $func) spl_autoload_register($func);
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: