You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Definition.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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