HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class HTMLPurifier_DefinitionCache_Decorator_Memory extends
00009       HTMLPurifier_DefinitionCache_Decorator
00010 {
00011 
00012     protected $definitions;
00013     public $name = 'Memory';
00014 
00015     public function copy() {
00016         return new HTMLPurifier_DefinitionCache_Decorator_Memory();
00017     }
00018 
00019     public function add($def, $config) {
00020         $status = parent::add($def, $config);
00021         if ($status) $this->definitions[$this->generateKey($config)] = $def;
00022         return $status;
00023     }
00024 
00025     public function set($def, $config) {
00026         $status = parent::set($def, $config);
00027         if ($status) $this->definitions[$this->generateKey($config)] = $def;
00028         return $status;
00029     }
00030 
00031     public function replace($def, $config) {
00032         $status = parent::replace($def, $config);
00033         if ($status) $this->definitions[$this->generateKey($config)] = $def;
00034         return $status;
00035     }
00036 
00037     public function get($config) {
00038         $key = $this->generateKey($config);
00039         if (isset($this->definitions[$key])) return $this->definitions[$key];
00040         $this->definitions[$key] = parent::get($config);
00041         return $this->definitions[$key];
00042     }
00043 
00044 }
00045 
00046 // vim: et sw=4 sts=4