40 if (!is_array($modules)) {
41 $modules = array($modules);
46 foreach ($module->content_sets as
$key => $value) {
48 if (isset($this->lookup[
$key])) {
50 $this->lookup[
$key] = array_merge($this->lookup[$key], $temp);
52 $this->lookup[
$key] = $temp;
57 while ($old_lookup !== $this->lookup) {
59 foreach ($this->lookup as
$i => $set) {
61 foreach ($set as $element =>
$x) {
62 if (isset($this->lookup[$element])) {
63 $add += $this->lookup[$element];
64 unset($this->lookup[
$i][$element]);
67 $this->lookup[
$i] += $add;
74 $this->keys = array_keys($this->
info);
75 $this->values = array_values($this->
info);
85 if (!empty(
$def->child)) {
88 $content_model =
$def->content_model;
89 if (is_string($content_model)) {
91 $def->content_model = preg_replace_callback(
92 '/\b(' . implode(
'|', $this->keys) .
')\b/',
93 array($this,
'generateChildDefCallback'),
104 return $this->
info[$matches[0]];
118 $value =
$def->content_model;
119 if (is_object($value)) {
121 'Literal object child definitions should be stored in '.
122 'ElementDef->child not ElementDef->content_model',
127 switch (
$def->content_model_type) {
139 if (
$module->defines_child_def) {
142 if ($return !==
false) {
147 'Could not determine which ChildDef class to instantiate',
161 $array = explode(
'|', str_replace(
' ',
'', $string));
163 foreach ($array as $k) {
Definition that allows a set of elements, but disallows empty children.
Definition that disallows all elements.
convertToLookup($string)
Converts a string list of elements separated by pipes into a lookup array.
Custom validation class, accepts DTD child definitions.
Definition that allows a set of elements, and allows no children.
if($modEnd===false) $module
getChildDef($def, $module)
Instantiates a ChildDef based on content_model and content_model_type member variables in HTMLPurifie...
$values
Synchronized list of defined content values (values of info).
__construct($modules)
Merges in module's content sets, expands identifiers in the content sets and populates the keys...
generateChildDefCallback($matches)
$keys
Synchronized list of defined content sets (keys of info).
$lookup
List of content set lookups (element => true) indexed by name.
$info
List of content set strings (pipe separators) indexed by name.
generateChildDef(&$def, $module)
Accepts a definition; generates and assigns a ChildDef for it.