4 if (!defined(
'HTMLPURIFIER_PREFIX')) {
5 define(
'HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) .
'/..'));
10 if (!defined(
'PHP_EOL')) {
11 switch (strtoupper(substr(PHP_OS, 0, 3))) {
13 define(
'PHP_EOL',
"\r\n");
16 define(
'PHP_EOL',
"\r");
19 define(
'PHP_EOL',
"\n");
49 require_once HTMLPURIFIER_PREFIX .
'/' .
$file;
60 if (strncmp(
'HTMLPurifier', $class, 12) !== 0) {
64 if (strncmp(
'HTMLPurifier_Language_', $class, 22) === 0) {
65 $code = str_replace(
'_',
'-', substr($class, 22));
66 $file =
'HTMLPurifier/Language/classes/' . $code .
'.php';
68 $file = str_replace(
'_',
'/', $class) .
'.php';
70 if (!file_exists(HTMLPURIFIER_PREFIX .
'/' .
$file)) {
81 $autoload = array(
'HTMLPurifier_Bootstrap',
'autoload');
82 if (($funcs = spl_autoload_functions()) ===
false) {
83 spl_autoload_register($autoload);
84 } elseif (function_exists(
'spl_autoload_unregister')) {
85 if (version_compare(PHP_VERSION,
'5.3.0',
'>=')) {
87 spl_autoload_register($autoload,
true,
true);
89 $buggy = version_compare(PHP_VERSION,
'5.2.11',
'<');
90 $compat = version_compare(PHP_VERSION,
'5.1.2',
'<=') &&
91 version_compare(PHP_VERSION,
'5.1.0',
'>=');
92 foreach ($funcs as $func) {
93 if ($buggy && is_array($func)) {
96 $reflector =
new ReflectionMethod($func[0], $func[1]);
97 if (!$reflector->isStatic()) {
99 'HTML Purifier autoloader registrar is not compatible
100 with non-static object methods due to PHP Bug #44144;
101 Please do not use HTMLPurifier.autoload.php (or any
102 file that includes this file); instead, place the code:
103 spl_autoload_register(array(\'HTMLPurifier_Bootstrap\', \'autoload\'))
104 after your own autoloaders.'
110 $func = implode(
'::', $func);
113 spl_autoload_unregister($func);
115 spl_autoload_register($autoload);
116 foreach ($funcs as $func) {
117 spl_autoload_register($func);