Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  /**

   4   * Super-class for definition datatype objects, implements serialization

   5   * functions for the class.

   6   */
   7  abstract class HTMLPurifier_Definition
   8  {
   9  
  10      /**

  11       * Has setup() been called yet?

  12       * @type bool

  13       */
  14      public $setup = false;
  15  
  16      /**

  17       * If true, write out the final definition object to the cache after

  18       * setup.  This will be true only if all invocations to get a raw

  19       * definition object are also optimized.  This does not cause file

  20       * system thrashing because on subsequent calls the cached object

  21       * is used and any writes to the raw definition object are short

  22       * circuited.  See enduser-customize.html for the high-level

  23       * picture.

  24       * @type bool

  25       */
  26      public $optimized = null;
  27  
  28      /**

  29       * What type of definition is it?

  30       * @type string

  31       */
  32      public $type;
  33  
  34      /**

  35       * Sets up the definition object into the final form, something

  36       * not done by the constructor

  37       * @param HTMLPurifier_Config $config

  38       */
  39      abstract protected function doSetup($config);
  40  
  41      /**

  42       * Setup function that aborts if already setup

  43       * @param HTMLPurifier_Config $config

  44       */
  45      public function setup($config)
  46      {
  47          if ($this->setup) {
  48              return;
  49          }
  50          $this->setup = true;
  51          $this->doSetup($config);
  52      }
  53  }
  54  
  55  // vim: et sw=4 sts=4