2007-05-29 20:21:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCache
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
/**
|
|
|
|
* Cache object we are decorating
|
2013-07-16 11:56:14 +00:00
|
|
|
* @type HTMLPurifier_DefinitionCache
|
2007-05-29 20:21:33 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $cache;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-27 04:37:33 +00:00
|
|
|
/**
|
|
|
|
* The name of the decorator
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $name;
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
/**
|
|
|
|
* Lazy decorator function
|
2013-07-16 12:20:01 +00:00
|
|
|
* @param HTMLPurifier_DefinitionCache $cache Reference to cache object to decorate
|
|
|
|
* @return HTMLPurifier_DefinitionCache_Decorator
|
2007-05-29 20:21:33 +00:00
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function decorate(&$cache)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
$decorator = $this->copy();
|
|
|
|
// reference is necessary for mocks in PHP 4
|
|
|
|
$decorator->cache =& $cache;
|
2013-07-16 11:56:14 +00:00
|
|
|
$decorator->type = $cache->type;
|
2007-05-29 20:21:33 +00:00
|
|
|
return $decorator;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-29 20:21:33 +00:00
|
|
|
/**
|
|
|
|
* Cross-compatible clone substitute
|
2013-07-16 11:56:14 +00:00
|
|
|
* @return HTMLPurifier_DefinitionCache_Decorator
|
2007-05-29 20:21:33 +00:00
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function copy()
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return new HTMLPurifier_DefinitionCache_Decorator();
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Definition $def
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function add($def, $config)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return $this->cache->add($def, $config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Definition $def
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function set($def, $config)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return $this->cache->set($def, $config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Definition $def
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function replace($def, $config)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return $this->cache->replace($def, $config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function get($config)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return $this->cache->get($config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function remove($config)
|
|
|
|
{
|
2007-11-25 02:24:39 +00:00
|
|
|
return $this->cache->remove($config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function flush($config)
|
|
|
|
{
|
2007-06-16 20:46:44 +00:00
|
|
|
return $this->cache->flush($config);
|
2007-05-29 20:21:33 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-07-16 12:20:01 +00:00
|
|
|
public function cleanup($config)
|
|
|
|
{
|
2007-05-29 20:21:33 +00:00
|
|
|
return $this->cache->cleanup($config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|