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/Builder/ConfigSchema.php | |
parent | 655214ab30ee84884dc408488b85586f36263fcb (diff) | |
parent | d3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff) | |
download | wallabag-1.5.2.tar.gz wallabag-1.5.2.tar.zst wallabag-1.5.2.zip |
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php new file mode 100644 index 00000000..1174575e --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php | |||
@@ -0,0 +1,48 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime | ||
5 | * representation used to perform checks on user configuration. | ||
6 | */ | ||
7 | class HTMLPurifier_ConfigSchema_Builder_ConfigSchema | ||
8 | { | ||
9 | |||
10 | /** | ||
11 | * @param HTMLPurifier_ConfigSchema_Interchange $interchange | ||
12 | * @return HTMLPurifier_ConfigSchema | ||
13 | */ | ||
14 | public function build($interchange) | ||
15 | { | ||
16 | $schema = new HTMLPurifier_ConfigSchema(); | ||
17 | foreach ($interchange->directives as $d) { | ||
18 | $schema->add( | ||
19 | $d->id->key, | ||
20 | $d->default, | ||
21 | $d->type, | ||
22 | $d->typeAllowsNull | ||
23 | ); | ||
24 | if ($d->allowed !== null) { | ||
25 | $schema->addAllowedValues( | ||
26 | $d->id->key, | ||
27 | $d->allowed | ||
28 | ); | ||
29 | } | ||
30 | foreach ($d->aliases as $alias) { | ||
31 | $schema->addAlias( | ||
32 | $alias->key, | ||
33 | $d->id->key | ||
34 | ); | ||
35 | } | ||
36 | if ($d->valueAliases !== null) { | ||
37 | $schema->addValueAliases( | ||
38 | $d->id->key, | ||
39 | $d->valueAliases | ||
40 | ); | ||
41 | } | ||
42 | } | ||
43 | $schema->postProcess(); | ||
44 | return $schema; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // vim: et sw=4 sts=4 | ||