2008-03-22 03:55:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
|
|
|
|
* representation used to perform checks on user configuration.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-03-22 03:55:59 +00:00
|
|
|
public function build($interchange) {
|
|
|
|
$schema = new HTMLPurifier_ConfigSchema();
|
2008-03-30 21:44:16 +00:00
|
|
|
foreach ($interchange->directives as $d) {
|
2008-03-22 03:55:59 +00:00
|
|
|
$schema->add(
|
2009-02-07 07:53:20 +00:00
|
|
|
$d->id->key,
|
2008-03-22 03:55:59 +00:00
|
|
|
$d->default,
|
|
|
|
$d->type,
|
|
|
|
$d->typeAllowsNull
|
|
|
|
);
|
|
|
|
if ($d->allowed !== null) {
|
|
|
|
$schema->addAllowedValues(
|
2009-02-07 07:53:20 +00:00
|
|
|
$d->id->key,
|
2008-03-22 03:55:59 +00:00
|
|
|
$d->allowed
|
|
|
|
);
|
|
|
|
}
|
|
|
|
foreach ($d->aliases as $alias) {
|
|
|
|
$schema->addAlias(
|
2009-02-07 07:53:20 +00:00
|
|
|
$alias->key,
|
|
|
|
$d->id->key
|
2008-03-22 03:55:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
if ($d->valueAliases !== null) {
|
|
|
|
$schema->addValueAliases(
|
2009-02-07 07:53:20 +00:00
|
|
|
$d->id->key,
|
2008-03-22 03:55:59 +00:00
|
|
|
$d->valueAliases
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2008-05-23 17:00:58 +00:00
|
|
|
$schema->postProcess();
|
2008-03-30 21:44:16 +00:00
|
|
|
return $schema;
|
2008-03-22 03:55:59 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-03-22 03:55:59 +00:00
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|