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 12:20:01 +00:00
|
|
|
* @var 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
|
|
|
|
2007-11-29 04:29:51 +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;
|
|
|
|
$decorator->type = $cache->type;
|
|
|
|
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 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 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 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 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 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 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 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 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
|