Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

53 lines
1.5KB

  1. <?php
  2. /**
  3. * Defines allowed child nodes and validates nodes against it.
  4. */
  5. abstract class HTMLPurifier_ChildDef
  6. {
  7. /**
  8. * Type of child definition, usually right-most part of class name lowercase.
  9. * Used occasionally in terms of context.
  10. * @type string
  11. */
  12. public $type;
  13. /**
  14. * Indicates whether or not an empty array of children is okay.
  15. *
  16. * This is necessary for redundant checking when changes affecting
  17. * a child node may cause a parent node to now be disallowed.
  18. * @type bool
  19. */
  20. public $allow_empty;
  21. /**
  22. * Lookup array of all elements that this definition could possibly allow.
  23. * @type array
  24. */
  25. public $elements = array();
  26. /**
  27. * Get lookup of tag names that should not close this element automatically.
  28. * All other elements will do so.
  29. * @param HTMLPurifier_Config $config HTMLPurifier_Config object
  30. * @return array
  31. */
  32. public function getAllowedElements($config)
  33. {
  34. return $this->elements;
  35. }
  36. /**
  37. * Validates nodes according to definition and returns modification.
  38. *
  39. * @param HTMLPurifier_Node[] $children Array of HTMLPurifier_Node
  40. * @param HTMLPurifier_Config $config HTMLPurifier_Config object
  41. * @param HTMLPurifier_Context $context HTMLPurifier_Context object
  42. * @return bool|array true to leave nodes as is, false to remove parent node, array of replacement children
  43. */
  44. abstract public function validateChildren($children, $config, $context);
  45. }
  46. // vim: et sw=4 sts=4