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/HTMLModule/Edit.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/HTMLModule/Edit.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php new file mode 100644 index 00000000..b8288368 --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension | ||
5 | * Module. | ||
6 | */ | ||
7 | class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule | ||
8 | { | ||
9 | |||
10 | /** | ||
11 | * @type string | ||
12 | */ | ||
13 | public $name = 'Edit'; | ||
14 | |||
15 | /** | ||
16 | * @param HTMLPurifier_Config $config | ||
17 | */ | ||
18 | public function setup($config) | ||
19 | { | ||
20 | $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow'; | ||
21 | $attr = array( | ||
22 | 'cite' => 'URI', | ||
23 | // 'datetime' => 'Datetime', // not implemented | ||
24 | ); | ||
25 | $this->addElement('del', 'Inline', $contents, 'Common', $attr); | ||
26 | $this->addElement('ins', 'Inline', $contents, 'Common', $attr); | ||
27 | } | ||
28 | |||
29 | // HTML 4.01 specifies that ins/del must not contain block | ||
30 | // elements when used in an inline context, chameleon is | ||
31 | // a complicated workaround to acheive this effect | ||
32 | |||
33 | // Inline context ! Block context (exclamation mark is | ||
34 | // separator, see getChildDef for parsing) | ||
35 | |||
36 | /** | ||
37 | * @type bool | ||
38 | */ | ||
39 | public $defines_child_def = true; | ||
40 | |||
41 | /** | ||
42 | * @param HTMLPurifier_ElementDef $def | ||
43 | * @return HTMLPurifier_ChildDef_Chameleon | ||
44 | */ | ||
45 | public function getChildDef($def) | ||
46 | { | ||
47 | if ($def->content_model_type != 'chameleon') { | ||
48 | return false; | ||
49 | } | ||
50 | $value = explode('!', $def->content_model); | ||
51 | return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | // vim: et sw=4 sts=4 | ||