Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
   1  <?php
   2  
   3  class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCache
   4  {
   5  
   6      /**
   7       * Cache object we are decorating
   8       * @type HTMLPurifier_DefinitionCache
   9       */
  10      public $cache;
  11  
  12      /**
  13       * The name of the decorator
  14       * @var string
  15       */
  16      public $name;
  17  
  18      public function __construct()
  19      {
  20      }
  21  
  22      /**
  23       * Lazy decorator function
  24       * @param HTMLPurifier_DefinitionCache $cache Reference to cache object to decorate
  25       * @return HTMLPurifier_DefinitionCache_Decorator
  26       */
  27      public function decorate(&$cache)
  28      {
  29          $decorator = $this->copy();
  30          // reference is necessary for mocks in PHP 4
  31          $decorator->cache =& $cache;
  32          $decorator->type = $cache->type;
  33          return $decorator;
  34      }
  35  
  36      /**
  37       * Cross-compatible clone substitute
  38       * @return HTMLPurifier_DefinitionCache_Decorator
  39       */
  40      public function copy()
  41      {
  42          return new HTMLPurifier_DefinitionCache_Decorator();
  43      }
  44  
  45      /**
  46       * @param HTMLPurifier_Definition $def
  47       * @param HTMLPurifier_Config $config
  48       * @return mixed
  49       */
  50      public function add($def, $config)
  51      {
  52          return $this->cache->add($def, $config);
  53      }
  54  
  55      /**
  56       * @param HTMLPurifier_Definition $def
  57       * @param HTMLPurifier_Config $config
  58       * @return mixed
  59       */
  60      public function set($def, $config)
  61      {
  62          return $this->cache->set($def, $config);
  63      }
  64  
  65      /**
  66       * @param HTMLPurifier_Definition $def
  67       * @param HTMLPurifier_Config $config
  68       * @return mixed
  69       */
  70      public function replace($def, $config)
  71      {
  72          return $this->cache->replace($def, $config);
  73      }
  74  
  75      /**
  76       * @param HTMLPurifier_Config $config
  77       * @return mixed
  78       */
  79      public function get($config)
  80      {
  81          return $this->cache->get($config);
  82      }
  83  
  84      /**
  85       * @param HTMLPurifier_Config $config
  86       * @return mixed
  87       */
  88      public function remove($config)
  89      {
  90          return $this->cache->remove($config);
  91      }
  92  
  93      /**
  94       * @param HTMLPurifier_Config $config
  95       * @return mixed
  96       */
  97      public function flush($config)
  98      {
  99          return $this->cache->flush($config);
 100      }
 101  
 102      /**
 103       * @param HTMLPurifier_Config $config
 104       * @return mixed
 105       */
 106      public function cleanup($config)
 107      {
 108          return $this->cache->cleanup($config);
 109      }
 110  }
 111  
 112  // vim: et sw=4 sts=4