diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
commit | 99679d06884120c57f43b44e55e03595f1f87bed (patch) | |
tree | a3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php | |
parent | 655214ab30ee84884dc408488b85586f36263fcb (diff) | |
parent | d3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff) | |
download | wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip |
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php new file mode 100644 index 00000000..c094fa0b --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php | |||
@@ -0,0 +1,47 @@ | |||
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 | * @type string | ||
14 | */ | ||
15 | public $name; | ||
16 | |||
17 | /** | ||
18 | * Array of Directive ID => array(directive info) | ||
19 | * @type HTMLPurifier_ConfigSchema_Interchange_Directive[] | ||
20 | */ | ||
21 | public $directives = array(); | ||
22 | |||
23 | /** | ||
24 | * Adds a directive array to $directives | ||
25 | * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive | ||
26 | * @throws HTMLPurifier_ConfigSchema_Exception | ||
27 | */ | ||
28 | public function addDirective($directive) | ||
29 | { | ||
30 | if (isset($this->directives[$i = $directive->id->toString()])) { | ||
31 | throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'"); | ||
32 | } | ||
33 | $this->directives[$i] = $directive; | ||
34 | } | ||
35 | |||
36 | /** | ||
37 | * Convenience function to perform standard validation. Throws exception | ||
38 | * on failed validation. | ||
39 | */ | ||
40 | public function validate() | ||
41 | { | ||
42 | $validator = new HTMLPurifier_ConfigSchema_Validator(); | ||
43 | return $validator->validate($this); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | // vim: et sw=4 sts=4 | ||