2007-05-24 22:08:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Super-class for definition datatype objects, implements serialization
|
|
|
|
* functions for the class.
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
abstract class HTMLPurifier_Definition
|
2007-05-24 22:08:29 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-24 22:08:29 +00:00
|
|
|
/**
|
|
|
|
* Has setup() been called yet?
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $setup = false;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2010-12-30 23:51:53 +00:00
|
|
|
/**
|
|
|
|
* If true, write out the final definition object to the cache after
|
|
|
|
* setup. This will be true only if all invocations to get a raw
|
|
|
|
* definition object are also optimized. This does not cause file
|
|
|
|
* system thrashing because on subsequent calls the cached object
|
|
|
|
* is used and any writes to the raw definition object are short
|
|
|
|
* circuited. See enduser-customize.html for the high-level
|
|
|
|
* picture.
|
|
|
|
*/
|
|
|
|
public $optimized = null;
|
|
|
|
|
2007-05-25 01:32:29 +00:00
|
|
|
/**
|
|
|
|
* What type of definition is it?
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $type;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-24 22:08:29 +00:00
|
|
|
/**
|
|
|
|
* Sets up the definition object into the final form, something
|
|
|
|
* not done by the constructor
|
|
|
|
* @param $config HTMLPurifier_Config instance
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
abstract protected function doSetup($config);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-24 22:08:29 +00:00
|
|
|
/**
|
|
|
|
* Setup function that aborts if already setup
|
|
|
|
* @param $config HTMLPurifier_Config instance
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public function setup($config) {
|
2007-05-24 22:08:29 +00:00
|
|
|
if ($this->setup) return;
|
|
|
|
$this->setup = true;
|
|
|
|
$this->doSetup($config);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-24 22:08:29 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|