Source for file DefinitionCacheFactory.php
Documentation is available at DefinitionCacheFactory.php
* Responsible for creating definition caches.
protected $caches =
array('Serializer' =>
array());
* Initialize default decorators
public function setup() {
* Retrieves an instance of global definition cache factory.
public static function instance($prototype =
null) {
if ($prototype !==
null) {
} elseif ($instance ===
null ||
$prototype ===
true) {
* Registers a new definition cache object
* @param $short Short name of cache object, for reference
* @param $long Full class name of cache object, for construction
public function register($short, $long) {
* Factory method that creates a cache object based on configuration
* @param $name Name of definitions handled by cache
* @param $config Instance of HTMLPurifier_Config
public function create($type, $config) {
$method =
$config->get('Cache', 'DefinitionImpl');
if (!empty($this->caches[$method][$type])) {
return $this->caches[$method][$type];
$cache =
new $class($type);
if ($method !=
'Serializer') {
trigger_error("Unrecognized DefinitionCache $method, using Serializer instead", E_USER_WARNING);
$new_cache =
$decorator->decorate($cache);
// prevent infinite recursion in PHP 4
$this->caches[$method][$type] =
$cache;
return $this->caches[$method][$type];
* Registers a decorator to add to all new cache objects
$class =
"HTMLPurifier_DefinitionCache_Decorator_$decorator";
Documentation generated on Thu, 19 Jun 2008 18:49:01 -0400 by phpDocumentor 1.4.2