]> git.wh0rd.org - tt-rss.git/blob - lib/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange.php
quickAddFeed: remove oauth notice, mention you can paste site URL
[tt-rss.git] / lib / htmlpurifier / library / HTMLPurifier / ConfigSchema / Interchange.php
1 <?php
2
3 /**
4 * Generic schema interchange format that can be converted to a runtime
5 * representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members
6 * are completely validated.
7 */
8 class HTMLPurifier_ConfigSchema_Interchange
9 {
10
11 /**
12 * Name of the application this schema is describing.
13 */
14 public $name;
15
16 /**
17 * Array of Directive ID => array(directive info)
18 */
19 public $directives = array();
20
21 /**
22 * Adds a directive array to $directives
23 */
24 public function addDirective($directive) {
25 if (isset($this->directives[$i = $directive->id->toString()])) {
26 throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
27 }
28 $this->directives[$i] = $directive;
29 }
30
31 /**
32 * Convenience function to perform standard validation. Throws exception
33 * on failed validation.
34 */
35 public function validate() {
36 $validator = new HTMLPurifier_ConfigSchema_Validator();
37 return $validator->validate($this);
38 }
39
40 }
41
42 // vim: et sw=4 sts=4