HTMLPurifier_ConfigSchema::addAlias PHP Method

addAlias() public method

Defines a directive alias for backwards compatibility
public addAlias ( string $key, string $new_key )
$key string Directive that will be aliased
$new_key string Directive that the alias will be to
    public function addAlias($key, $new_key)
    {
        $obj = new stdclass();
        $obj->key = $new_key;
        $obj->isAlias = true;
        $this->info[$key] = $obj;
    }

Usage Example

コード例 #1
0
ファイル: ConfigSchema.php プロジェクト: gitanton/cono-rest
 public function build($interchange)
 {
     $schema = new HTMLPurifier_ConfigSchema();
     foreach ($interchange->directives as $d) {
         $schema->add($d->id->key, $d->default, $d->type, $d->typeAllowsNull);
         if ($d->allowed !== NULL) {
             $schema->addAllowedValues($d->id->key, $d->allowed);
         }
         foreach ($d->aliases as $alias) {
             $schema->addAlias($alias->key, $d->id->key);
         }
         if ($d->valueAliases !== NULL) {
             $schema->addValueAliases($d->id->key, $d->valueAliases);
         }
     }
     $schema->postProcess();
     return $schema;
 }