mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-18 11:41:52 +00:00
[1.6.1] Invert HTMLModuleManager->addModule() processing order to check prefixes first and then the literal module
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@971 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
d6c4473a12
commit
c0b38bab85
2
NEWS
2
NEWS
@ -16,6 +16,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
a non-alphanumeric character. This means that certain emoticons
|
a non-alphanumeric character. This means that certain emoticons
|
||||||
are now preserved.
|
are now preserved.
|
||||||
- Possibly fatal bug with __autoload() fixed in module manager
|
- Possibly fatal bug with __autoload() fixed in module manager
|
||||||
|
- Invert HTMLModuleManager->addModule() processing order to check
|
||||||
|
prefixes first and then the literal module
|
||||||
|
|
||||||
1.6.0, released 2007-04-01
|
1.6.0, released 2007-04-01
|
||||||
! Support for most common deprecated attributes via transformations:
|
! Support for most common deprecated attributes via transformations:
|
||||||
|
@ -208,20 +208,33 @@ class HTMLPurifier_HTMLModuleManager
|
|||||||
* subclass of HTMLPurifier_HTMLModule.
|
* subclass of HTMLPurifier_HTMLModule.
|
||||||
* @note This function will not call autoload, you must instantiate
|
* @note This function will not call autoload, you must instantiate
|
||||||
* (and thus invoke) autoload outside the method.
|
* (and thus invoke) autoload outside the method.
|
||||||
|
* @note If a string is passed as a module name, different variants
|
||||||
|
* will be tested in this order:
|
||||||
|
* - Check for HTMLPurifier_HTMLModule_$name
|
||||||
|
* - Check all prefixes with $name in order they were added
|
||||||
|
* - Check for literal object name
|
||||||
|
* - Throw fatal error
|
||||||
|
* If your object name collides with an internal class, specify
|
||||||
|
* your module manually.
|
||||||
*/
|
*/
|
||||||
function addModule($module) {
|
function addModule($module) {
|
||||||
if (is_string($module)) {
|
if (is_string($module)) {
|
||||||
$original_module = $module;
|
$original_module = $module;
|
||||||
if (!class_exists($module, false)) {
|
$ok = false;
|
||||||
foreach ($this->prefixes as $prefix) {
|
foreach ($this->prefixes as $prefix) {
|
||||||
$module = $prefix . $original_module;
|
$module = $prefix . $original_module;
|
||||||
if (class_exists($module)) break;
|
if (class_exists($module)) {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!class_exists($module, false)) {
|
if (!$ok) {
|
||||||
trigger_error($original_module . ' module does not exist',
|
$module = $original_module;
|
||||||
E_USER_ERROR);
|
if (!class_exists($module, false)) {
|
||||||
return;
|
trigger_error($original_module . ' module does not exist',
|
||||||
|
E_USER_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$module = new $module();
|
$module = new $module();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user