HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
Go to the documentation of this file.
00001 <?php
00002 
00007 class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
00008 {
00009 
00010     public function build($interchange) {
00011         $schema = new HTMLPurifier_ConfigSchema();
00012         foreach ($interchange->directives as $d) {
00013             $schema->add(
00014                 $d->id->key,
00015                 $d->default,
00016                 $d->type,
00017                 $d->typeAllowsNull
00018             );
00019             if ($d->allowed !== null) {
00020                 $schema->addAllowedValues(
00021                     $d->id->key,
00022                     $d->allowed
00023                 );
00024             }
00025             foreach ($d->aliases as $alias) {
00026                 $schema->addAlias(
00027                     $alias->key,
00028                     $d->id->key
00029                 );
00030             }
00031             if ($d->valueAliases !== null) {
00032                 $schema->addValueAliases(
00033                     $d->id->key,
00034                     $d->valueAliases
00035                 );
00036             }
00037         }
00038         $schema->postProcess();
00039         return $schema;
00040     }
00041 
00042 }
00043 
00044 // vim: et sw=4 sts=4