2009-06-22 09:56:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
|
|
|
|
* representation used to perform checks on user configuration.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
|
|
|
|
{
|
|
|
|
|
|
|
|
public function build($interchange) {
|
|
|
|
$schema = new HTMLPurifier_ConfigSchema();
|
|
|
|
foreach ($interchange->directives as $d) {
|
|
|
|
$schema->add(
|
2011-04-11 12:41:01 +00:00
|
|
|
$d->id->key,
|
2009-06-22 09:56:49 +00:00
|
|
|
$d->default,
|
|
|
|
$d->type,
|
|
|
|
$d->typeAllowsNull
|
|
|
|
);
|
|
|
|
if ($d->allowed !== null) {
|
|
|
|
$schema->addAllowedValues(
|
2011-04-11 12:41:01 +00:00
|
|
|
$d->id->key,
|
2009-06-22 09:56:49 +00:00
|
|
|
$d->allowed
|
|
|
|
);
|
|
|
|
}
|
|
|
|
foreach ($d->aliases as $alias) {
|
|
|
|
$schema->addAlias(
|
2011-04-11 12:41:01 +00:00
|
|
|
$alias->key,
|
|
|
|
$d->id->key
|
2009-06-22 09:56:49 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
if ($d->valueAliases !== null) {
|
|
|
|
$schema->addValueAliases(
|
2011-04-11 12:41:01 +00:00
|
|
|
$d->id->key,
|
2009-06-22 09:56:49 +00:00
|
|
|
$d->valueAliases
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$schema->postProcess();
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|