1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 05:07:55 +02:00

[1.7.0] Implement Cleanup decorator

- Create generic DecoratorHarness
- Name decorators, so that they can be overridden or removed
- Add setup function to definition cache factory

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1118 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-05-29 20:49:33 +00:00
parent 002395de09
commit e2a951420f
10 changed files with 161 additions and 26 deletions

View File

@@ -24,6 +24,13 @@ class HTMLPurifier_DefinitionCacheFactory
var $caches = array('Serializer' => array());
var $decorators = array();
/**
* Initialize default decorators
*/
function setup() {
$this->addDecorator('Cleanup');
}
/**
* Retrieves an instance of global definition cache factory.
* @static
@@ -34,6 +41,7 @@ class HTMLPurifier_DefinitionCacheFactory
$instance = $prototype;
} elseif ($instance === null || $prototype === true) {
$instance = new HTMLPurifier_DefinitionCacheFactory();
$instance->setup();
}
return $instance;
}
@@ -74,7 +82,7 @@ class HTMLPurifier_DefinitionCacheFactory
$class = "HTMLPurifier_DefinitionCache_Decorator_$decorator";
$decorator = new $class;
}
$this->decorators[] = $decorator;
$this->decorators[$decorator->name] = $decorator;
}
}