File indexing completed on 2024-04-28 05:58:53

0001 <?php
0002 
0003 /**
0004  * Super-class for definition datatype objects, implements serialization
0005  * functions for the class.
0006  */
0007 abstract class HTMLPurifier_Definition
0008 {
0009 
0010     /**
0011      * Has setup() been called yet?
0012      * @type bool
0013      */
0014     public $setup = false;
0015 
0016     /**
0017      * If true, write out the final definition object to the cache after
0018      * setup.  This will be true only if all invocations to get a raw
0019      * definition object are also optimized.  This does not cause file
0020      * system thrashing because on subsequent calls the cached object
0021      * is used and any writes to the raw definition object are short
0022      * circuited.  See enduser-customize.html for the high-level
0023      * picture.
0024      * @type bool
0025      */
0026     public $optimized = null;
0027 
0028     /**
0029      * What type of definition is it?
0030      * @type string
0031      */
0032     public $type;
0033 
0034     /**
0035      * Sets up the definition object into the final form, something
0036      * not done by the constructor
0037      * @param HTMLPurifier_Config $config
0038      */
0039     abstract protected function doSetup($config);
0040 
0041     /**
0042      * Setup function that aborts if already setup
0043      * @param HTMLPurifier_Config $config
0044      */
0045     public function setup($config)
0046     {
0047         if ($this->setup) {
0048             return;
0049         }
0050         $this->setup = true;
0051         $this->doSetup($config);
0052     }
0053 }
0054 
0055 // vim: et sw=4 sts=4