35 if (!is_array($modules)) $modules = array($modules);
38 foreach ($modules as $module_i => $module) {
39 foreach ($module->content_sets as $key => $value) {
41 if (isset($this->lookup[$key])) {
43 $this->lookup[$key] = array_merge($this->lookup[$key], $temp);
45 $this->lookup[$key] = $temp;
50 while ($old_lookup !== $this->lookup) {
52 foreach ($this->lookup as $i => $set) {
54 foreach ($set as $element =>
$x) {
55 if (isset($this->lookup[$element])) {
56 $add += $this->lookup[$element];
57 unset($this->lookup[$i][$element]);
60 $this->lookup[$i] += $add;
64 foreach ($this->lookup as $key =>
$lookup) {
65 $this->info[$key] = implode(
' | ', array_keys(
$lookup));
67 $this->keys = array_keys($this->info);
68 $this->values = array_values($this->info);
77 if (!empty($def->child))
return;
78 $content_model = $def->content_model;
79 if (is_string($content_model)) {
81 $def->content_model = preg_replace_callback(
82 '/\b(' . implode(
'|', $this->keys) .
')\b/',
83 array($this,
'generateChildDefCallback'),
93 return $this->info[$matches[0]];
105 $value = $def->content_model;
106 if (is_object($value)) {
108 'Literal object child definitions should be stored in '.
109 'ElementDef->child not ElementDef->content_model',
114 switch ($def->content_model_type) {
126 if ($module->defines_child_def) {
127 $return = $module->getChildDef($def);
129 if ($return !==
false)
return $return;
132 'Could not determine which ChildDef class to instantiate',
145 $array = explode(
'|', str_replace(
' ',
'', $string));
147 foreach ($array as $i => $k) {