Source for file Bootstrap.php
Documentation is available at Bootstrap.php
// constants are slow, so we use as few as possible
if (!defined('HTMLPURIFIER_PREFIX')) {
define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__
) .
'/..'));
// accomodations for versions earlier than 5.0.2
// borrowed from PHP_Compat, LGPL licensed, by Aidan Lister <aidan@php.net>
* Bootstrap class that contains meta-functionality for HTML Purifier such as
* This class may be used without any other files from HTML Purifier.
* Autoload function for HTML Purifier
* @param $class Class to load
public static function autoload($class) {
if (!$file) return false;
* Returns the path for a specific class.
public static function getPath($class) {
if (strncmp('HTMLPurifier', $class, 12) !==
0) return false;
// Custom implementations
if (strncmp('HTMLPurifier_Language_', $class, 22) ===
0) {
$file =
'HTMLPurifier/Language/classes/' .
$code .
'.php';
* "Pre-registers" our autoloader on the SPL stack.
$autoload =
array('HTMLPurifier_Bootstrap', 'autoload');
foreach ($funcs as $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()) {
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);
Documentation generated on Thu, 19 Jun 2008 18:48:54 -0400 by phpDocumentor 1.4.2