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