Definition.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Super-class for definition datatype objects, implements serialization
  4. * functions for the class.
  5. */
  6. abstract class HTMLPurifier_Definition
  7. {
  8. /**
  9. * Has setup() been called yet?
  10. */
  11. public $setup = false;
  12. /**
  13. * If true, write out the final definition object to the cache after
  14. * setup. This will be true only if all invocations to get a raw
  15. * definition object are also optimized. This does not cause file
  16. * system thrashing because on subsequent calls the cached object
  17. * is used and any writes to the raw definition object are short
  18. * circuited. See enduser-customize.html for the high-level
  19. * picture.
  20. */
  21. public $optimized = null;
  22. /**
  23. * What type of definition is it?
  24. */
  25. public $type;
  26. /**
  27. * Sets up the definition object into the final form, something
  28. * not done by the constructor
  29. * @param $config HTMLPurifier_Config instance
  30. */
  31. abstract protected function doSetup($config);
  32. /**
  33. * Setup function that aborts if already setup
  34. * @param $config HTMLPurifier_Config instance
  35. */
  36. public function setup($config) {
  37. if ($this->setup) return;
  38. $this->setup = true;
  39. $this->doSetup($config);
  40. }
  41. }
  42. // vim: et sw=4 sts=4