39 $dir = HTMLPURIFIER_PREFIX .
'/HTMLPurifier/ConfigSchema/schema';
41 if (file_exists($dir .
'/info.ini')) {
42 $info = parse_ini_file($dir .
'/info.ini');
48 while (
false !== (
$file = readdir($dh))) {
85 $hash =
new HTMLPurifier_StringHash($hash);
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'])) {
142 $directive->allowed = $this->
lookup($this->
evalArray($hash->offsetGet(
'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')));
182 return eval(
'return array(' .
$contents .
');');
193 foreach ($array as $val) {
205 protected function id($id)
217 $accessed = $hash->getAccessed();
218 foreach ($hash as $k => $v) {
219 if (!isset($accessed[$k])) {
220 trigger_error(
"String hash key '$k' not used by builder", E_USER_NOTICE);
__construct($varParser=null)
Interchange component class describing configuration directives.
buildDir($interchange, $dir=null)
build($interchange, $hash)
Builds an interchange object based on a hash.
Exception type for HTMLPurifier_VarParser.
buildFile($interchange, $file)
evalArray($contents)
Evaluates an array PHP code string without array() wrapper.
$varParser
Used for processing DEFAULT, nothing else.
Generic schema interchange format that can be converted to a runtime representation (HTMLPurifier_Con...
This variable parser uses PHP's internal code engine.
_findUnused($hash)
Triggers errors for any unused keys passed in the hash; such keys may indicate typos, missing values, etc.
Create styles array
The data for the language used.
Exceptions related to configuration schema.
Parses string hash files.
static buildFromDirectory($dir=null)
lookup($array)
Converts an array list into a lookup array.
This is in almost every respect equivalent to an array except that it keeps track of which keys were ...
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
buildDirective($interchange, $hash)
id($id)
Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id object based on a strin...