diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-02-21 15:43:14 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-02-21 15:43:14 +0100 |
commit | d4949327efa15b492cab1bef3fe074290a328a17 (patch) | |
tree | e89e0322bb1f1b06d663fd10fdded21bac867e5d /inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php | |
parent | c9bd17a1007bb78e5de0775efca01df0fb515031 (diff) | |
download | wallabag-d4949327efa15b492cab1bef3fe074290a328a17.tar.gz wallabag-d4949327efa15b492cab1bef3fe074290a328a17.tar.zst wallabag-d4949327efa15b492cab1bef3fe074290a328a17.zip |
[add] HTML Purifier added to clean code
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php new file mode 100644 index 00000000..605e37c9 --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php | |||
@@ -0,0 +1,51 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * XHTML 1.1 List Module, defines list-oriented elements. Core Module. | ||
5 | */ | ||
6 | class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule | ||
7 | { | ||
8 | /** | ||
9 | * @type string | ||
10 | */ | ||
11 | public $name = 'List'; | ||
12 | |||
13 | // According to the abstract schema, the List content set is a fully formed | ||
14 | // one or more expr, but it invariably occurs in an optional declaration | ||
15 | // so we're not going to do that subtlety. It might cause trouble | ||
16 | // if a user defines "List" and expects that multiple lists are | ||
17 | // allowed to be specified, but then again, that's not very intuitive. | ||
18 | // Furthermore, the actual XML Schema may disagree. Regardless, | ||
19 | // we don't have support for such nested expressions without using | ||
20 | // the incredibly inefficient and draconic Custom ChildDef. | ||
21 | |||
22 | /** | ||
23 | * @type array | ||
24 | */ | ||
25 | public $content_sets = array('Flow' => 'List'); | ||
26 | |||
27 | /** | ||
28 | * @param HTMLPurifier_Config $config | ||
29 | */ | ||
30 | public function setup($config) | ||
31 | { | ||
32 | $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); | ||
33 | $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); | ||
34 | // XXX The wrap attribute is handled by MakeWellFormed. This is all | ||
35 | // quite unsatisfactory, because we generated this | ||
36 | // *specifically* for lists, and now a big chunk of the handling | ||
37 | // is done properly by the List ChildDef. So actually, we just | ||
38 | // want enough information to make autoclosing work properly, | ||
39 | // and then hand off the tricky stuff to the ChildDef. | ||
40 | $ol->wrap = 'li'; | ||
41 | $ul->wrap = 'li'; | ||
42 | $this->addElement('dl', 'List', 'Required: dt | dd', 'Common'); | ||
43 | |||
44 | $this->addElement('li', false, 'Flow', 'Common'); | ||
45 | |||
46 | $this->addElement('dd', false, 'Flow', 'Common'); | ||
47 | $this->addElement('dt', false, 'Inline', 'Common'); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | // vim: et sw=4 sts=4 | ||