28 return $builder->buildDir($interchange,
$dir);
39 $dir = HTMLPURIFIER_PREFIX .
'/HTMLPurifier/ConfigSchema/schema';
41 if (file_exists(
$dir .
'/info.ini')) {
42 $info = parse_ini_file(
$dir .
'/info.ini');
43 $interchange->name = $info[
'name'];
48 while (
false !== ($file = readdir($dh))) {
49 if (!$file || $file[0] ==
'.' || strrchr($file,
'.') !==
'.txt') {
57 foreach ($files
as $file) {
87 if (!isset(
$hash[
'ID'])) {
90 if (strpos(
$hash[
'ID'],
'.') ===
false) {
91 if (count(
$hash) == 2 && isset(
$hash[
'DESCRIPTION'])) {
92 $hash->offsetGet(
'DESCRIPTION');
112 $directive->id = $this->
id(
$hash->offsetGet(
'ID'));
113 $id = $directive->id->toString();
115 if (isset(
$hash[
'TYPE'])) {
116 $type = explode(
'/',
$hash->offsetGet(
'TYPE'));
117 if (isset($type[1])) {
118 $directive->typeAllowsNull =
true;
120 $directive->type = $type[0];
125 if (isset(
$hash[
'DEFAULT'])) {
127 $directive->default = $this->varParser->parse(
128 $hash->offsetGet(
'DEFAULT'),
130 $directive->typeAllowsNull
137 if (isset(
$hash[
'DESCRIPTION'])) {
138 $directive->description =
$hash->offsetGet(
'DESCRIPTION');
141 if (isset(
$hash[
'ALLOWED'])) {
145 if (isset(
$hash[
'VALUE-ALIASES'])) {
146 $directive->valueAliases = $this->
evalArray(
$hash->offsetGet(
'VALUE-ALIASES'));
149 if (isset(
$hash[
'ALIASES'])) {
150 $raw_aliases = trim(
$hash->offsetGet(
'ALIASES'));
151 $aliases = preg_split(
'/\s*,\s*/', $raw_aliases);
152 foreach ($aliases
as $alias) {
153 $directive->aliases[] = $this->
id($alias);
157 if (isset(
$hash[
'VERSION'])) {
158 $directive->version =
$hash->offsetGet(
'VERSION');
161 if (isset(
$hash[
'DEPRECATED-USE'])) {
162 $directive->deprecatedUse = $this->
id(
$hash->offsetGet(
'DEPRECATED-USE'));
165 if (isset(
$hash[
'DEPRECATED-VERSION'])) {
166 $directive->deprecatedVersion =
$hash->offsetGet(
'DEPRECATED-VERSION');
169 if (isset(
$hash[
'EXTERNAL'])) {
170 $directive->external = preg_split(
'/\s*,\s*/', trim(
$hash->offsetGet(
'EXTERNAL')));
173 $interchange->addDirective($directive);
182 return eval(
'return array(' . $contents .
');');
193 foreach ($array
as $val) {
205 protected function id($id)
217 $accessed =
$hash->getAccessed();
219 if (!isset($accessed[$k])) {
220 trigger_error(
"String hash key '$k' not used by builder", E_USER_NOTICE);