2008-03-01 17:06:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic schema interchange format that can be converted to a runtime
|
|
|
|
* representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members
|
|
|
|
* are completely validated.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_ConfigSchema_Interchange
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Array of Namespace ID => array(namespace info)
|
|
|
|
*/
|
2008-03-22 20:26:04 +00:00
|
|
|
public $namespaces = array();
|
2008-03-01 17:06:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Array of Directive ID => array(directive info)
|
|
|
|
*/
|
2008-03-22 20:26:04 +00:00
|
|
|
public $directives = array();
|
2008-03-01 17:06:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a namespace array to $namespaces
|
|
|
|
*/
|
2008-03-22 03:55:59 +00:00
|
|
|
public function addNamespace($namespace) {
|
2008-03-23 01:06:35 +00:00
|
|
|
if (isset($this->namespaces[$i = $namespace->namespace])) {
|
|
|
|
throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine namespace '$i'");
|
|
|
|
}
|
|
|
|
$this->namespaces[$i] = $namespace;
|
2008-03-01 17:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a directive array to $directives
|
|
|
|
*/
|
2008-03-22 03:55:59 +00:00
|
|
|
public function addDirective($directive) {
|
2008-03-23 02:50:42 +00:00
|
|
|
if (isset($this->directives[$i = $directive->id->toString()])) {
|
2008-03-23 01:06:35 +00:00
|
|
|
throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
|
|
|
|
}
|
|
|
|
$this->directives[$i] = $directive;
|
2008-03-04 05:21:04 +00:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:06:23 +00:00
|
|
|
}
|