Definition.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. * @type bool
  11. */
  12. public $setup = false;
  13. /**
  14. * If true, write out the final definition object to the cache after
  15. * setup. This will be true only if all invocations to get a raw
  16. * definition object are also optimized. This does not cause file
  17. * system thrashing because on subsequent calls the cached object
  18. * is used and any writes to the raw definition object are short
  19. * circuited. See enduser-customize.html for the high-level
  20. * picture.
  21. * @type bool
  22. */
  23. public $optimized = null;
  24. /**
  25. * What type of definition is it?
  26. * @type string
  27. */
  28. public $type;
  29. /**
  30. * Sets up the definition object into the final form, something
  31. * not done by the constructor
  32. * @param HTMLPurifier_Config $config
  33. */
  34. abstract protected function doSetup($config);
  35. /**
  36. * Setup function that aborts if already setup
  37. * @param HTMLPurifier_Config $config
  38. */
  39. public function setup($config)
  40. {
  41. if ($this->setup) {
  42. return;
  43. }
  44. $this->setup = true;
  45. $this->doSetup($config);
  46. }
  47. }
  48. // vim: et sw=4 sts=4