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