aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
commit99679d06884120c57f43b44e55e03595f1f87bed (patch)
treea3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule
parent655214ab30ee84884dc408488b85586f36263fcb (diff)
parentd3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff)
downloadwallabag-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')
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Bdo.php44
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/CommonAttributes.php31
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php55
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Forms.php190
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Hypertext.php40
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Iframe.php51
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php49
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.php186
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/List.php51
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Name.php26
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Nofollow.php25
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php20
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Object.php62
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Presentation.php42
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Proprietary.php40
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Ruby.php36
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeEmbed.php40
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeObject.php62
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeScripting.php40
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Scripting.php73
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/StyleAttribute.php33
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tables.php75
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Target.php28
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/TargetBlank.php24
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Text.php87
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php230
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Name.php33
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Proprietary.php34
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Strict.php43
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Transitional.php16
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTML.php26
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php179
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/XMLCommonAttributes.php20
33 files changed, 1991 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Bdo.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Bdo.php
new file mode 100644
index 00000000..191a78d1
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Bdo.php
@@ -0,0 +1,44 @@
1<?php
2
3/**
4 * XHTML 1.1 Bi-directional Text Module, defines elements that
5 * declare directionality of content. Text Extension Module.
6 */
7class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
8{
9
10 /**
11 * @type string
12 */
13 public $name = 'Bdo';
14
15 /**
16 * @type array
17 */
18 public $attr_collections = array(
19 'I18N' => array('dir' => false)
20 );
21
22 /**
23 * @param HTMLPurifier_Config $config
24 */
25 public function setup($config)
26 {
27 $bdo = $this->addElement(
28 'bdo',
29 'Inline',
30 'Inline',
31 array('Core', 'Lang'),
32 array(
33 'dir' => 'Enum#ltr,rtl', // required
34 // The Abstract Module specification has the attribute
35 // inclusions wrong for bdo: bdo allows Lang
36 )
37 );
38 $bdo->attr_transform_post[] = new HTMLPurifier_AttrTransform_BdoDir();
39
40 $this->attr_collections['I18N']['dir'] = 'Enum#ltr,rtl';
41 }
42}
43
44// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/CommonAttributes.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/CommonAttributes.php
new file mode 100644
index 00000000..e2fe53fc
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/CommonAttributes.php
@@ -0,0 +1,31 @@
1<?php
2
3class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
4{
5 /**
6 * @type string
7 */
8 public $name = 'CommonAttributes';
9
10 /**
11 * @type array
12 */
13 public $attr_collections = array(
14 'Core' => array(
15 0 => array('Style'),
16 // 'xml:space' => false,
17 'class' => 'Class',
18 'id' => 'ID',
19 'title' => 'CDATA',
20 ),
21 'Lang' => array(),
22 'I18N' => array(
23 0 => array('Lang'), // proprietary, for xml:lang/lang
24 ),
25 'Common' => array(
26 0 => array('Core', 'I18N')
27 )
28 );
29}
30
31// vim: et sw=4 sts=4
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 */
7class 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
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Forms.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Forms.php
new file mode 100644
index 00000000..13ce6ad5
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Forms.php
@@ -0,0 +1,190 @@
1<?php
2
3/**
4 * XHTML 1.1 Forms module, defines all form-related elements found in HTML 4.
5 */
6class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
7{
8 /**
9 * @type string
10 */
11 public $name = 'Forms';
12
13 /**
14 * @type bool
15 */
16 public $safe = false;
17
18 /**
19 * @type array
20 */
21 public $content_sets = array(
22 'Block' => 'Form',
23 'Inline' => 'Formctrl',
24 );
25
26 /**
27 * @param HTMLPurifier_Config $config
28 */
29 public function setup($config)
30 {
31 $form = $this->addElement(
32 'form',
33 'Form',
34 'Required: Heading | List | Block | fieldset',
35 'Common',
36 array(
37 'accept' => 'ContentTypes',
38 'accept-charset' => 'Charsets',
39 'action*' => 'URI',
40 'method' => 'Enum#get,post',
41 // really ContentType, but these two are the only ones used today
42 'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',
43 )
44 );
45 $form->excludes = array('form' => true);
46
47 $input = $this->addElement(
48 'input',
49 'Formctrl',
50 'Empty',
51 'Common',
52 array(
53 'accept' => 'ContentTypes',
54 'accesskey' => 'Character',
55 'alt' => 'Text',
56 'checked' => 'Bool#checked',
57 'disabled' => 'Bool#disabled',
58 'maxlength' => 'Number',
59 'name' => 'CDATA',
60 'readonly' => 'Bool#readonly',
61 'size' => 'Number',
62 'src' => 'URI#embedded',
63 'tabindex' => 'Number',
64 'type' => 'Enum#text,password,checkbox,button,radio,submit,reset,file,hidden,image',
65 'value' => 'CDATA',
66 )
67 );
68 $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();
69
70 $this->addElement(
71 'select',
72 'Formctrl',
73 'Required: optgroup | option',
74 'Common',
75 array(
76 'disabled' => 'Bool#disabled',
77 'multiple' => 'Bool#multiple',
78 'name' => 'CDATA',
79 'size' => 'Number',
80 'tabindex' => 'Number',
81 )
82 );
83
84 $this->addElement(
85 'option',
86 false,
87 'Optional: #PCDATA',
88 'Common',
89 array(
90 'disabled' => 'Bool#disabled',
91 'label' => 'Text',
92 'selected' => 'Bool#selected',
93 'value' => 'CDATA',
94 )
95 );
96 // It's illegal for there to be more than one selected, but not
97 // be multiple. Also, no selected means undefined behavior. This might
98 // be difficult to implement; perhaps an injector, or a context variable.
99
100 $textarea = $this->addElement(
101 'textarea',
102 'Formctrl',
103 'Optional: #PCDATA',
104 'Common',
105 array(
106 'accesskey' => 'Character',
107 'cols*' => 'Number',
108 'disabled' => 'Bool#disabled',
109 'name' => 'CDATA',
110 'readonly' => 'Bool#readonly',
111 'rows*' => 'Number',
112 'tabindex' => 'Number',
113 )
114 );
115 $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();
116
117 $button = $this->addElement(
118 'button',
119 'Formctrl',
120 'Optional: #PCDATA | Heading | List | Block | Inline',
121 'Common',
122 array(
123 'accesskey' => 'Character',
124 'disabled' => 'Bool#disabled',
125 'name' => 'CDATA',
126 'tabindex' => 'Number',
127 'type' => 'Enum#button,submit,reset',
128 'value' => 'CDATA',
129 )
130 );
131
132 // For exclusions, ideally we'd specify content sets, not literal elements
133 $button->excludes = $this->makeLookup(
134 'form',
135 'fieldset', // Form
136 'input',
137 'select',
138 'textarea',
139 'label',
140 'button', // Formctrl
141 'a', // as per HTML 4.01 spec, this is omitted by modularization
142 'isindex',
143 'iframe' // legacy items
144 );
145
146 // Extra exclusion: img usemap="" is not permitted within this element.
147 // We'll omit this for now, since we don't have any good way of
148 // indicating it yet.
149
150 // This is HIGHLY user-unfriendly; we need a custom child-def for this
151 $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');
152
153 $label = $this->addElement(
154 'label',
155 'Formctrl',
156 'Optional: #PCDATA | Inline',
157 'Common',
158 array(
159 'accesskey' => 'Character',
160 // 'for' => 'IDREF', // IDREF not implemented, cannot allow
161 )
162 );
163 $label->excludes = array('label' => true);
164
165 $this->addElement(
166 'legend',
167 false,
168 'Optional: #PCDATA | Inline',
169 'Common',
170 array(
171 'accesskey' => 'Character',
172 )
173 );
174
175 $this->addElement(
176 'optgroup',
177 false,
178 'Required: option',
179 'Common',
180 array(
181 'disabled' => 'Bool#disabled',
182 'label*' => 'Text',
183 )
184 );
185 // Don't forget an injector for <isindex>. This one's a little complex
186 // because it maps to multiple elements.
187 }
188}
189
190// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Hypertext.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Hypertext.php
new file mode 100644
index 00000000..968c07e9
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Hypertext.php
@@ -0,0 +1,40 @@
1<?php
2
3/**
4 * XHTML 1.1 Hypertext Module, defines hypertext links. Core Module.
5 */
6class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
7{
8
9 /**
10 * @type string
11 */
12 public $name = 'Hypertext';
13
14 /**
15 * @param HTMLPurifier_Config $config
16 */
17 public function setup($config)
18 {
19 $a = $this->addElement(
20 'a',
21 'Inline',
22 'Inline',
23 'Common',
24 array(
25 // 'accesskey' => 'Character',
26 // 'charset' => 'Charset',
27 'href' => 'URI',
28 // 'hreflang' => 'LanguageCode',
29 'rel' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rel'),
30 'rev' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rev'),
31 // 'tabindex' => 'Number',
32 // 'type' => 'ContentType',
33 )
34 );
35 $a->formatting = true;
36 $a->excludes = array('a' => true);
37 }
38}
39
40// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Iframe.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Iframe.php
new file mode 100644
index 00000000..2c9bdc58
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Iframe.php
@@ -0,0 +1,51 @@
1<?php
2
3/**
4 * XHTML 1.1 Iframe Module provides inline frames.
5 *
6 * @note This module is not considered safe unless an Iframe
7 * whitelisting mechanism is specified. Currently, the only
8 * such mechanism is %URL.SafeIframeRegexp
9 */
10class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule
11{
12
13 /**
14 * @type string
15 */
16 public $name = 'Iframe';
17
18 /**
19 * @type bool
20 */
21 public $safe = false;
22
23 /**
24 * @param HTMLPurifier_Config $config
25 */
26 public function setup($config)
27 {
28 if ($config->get('HTML.SafeIframe')) {
29 $this->safe = true;
30 }
31 $this->addElement(
32 'iframe',
33 'Inline',
34 'Flow',
35 'Common',
36 array(
37 'src' => 'URI#embedded',
38 'width' => 'Length',
39 'height' => 'Length',
40 'name' => 'ID',
41 'scrolling' => 'Enum#yes,no,auto',
42 'frameborder' => 'Enum#0,1',
43 'longdesc' => 'URI',
44 'marginheight' => 'Pixels',
45 'marginwidth' => 'Pixels',
46 )
47 );
48 }
49}
50
51// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php
new file mode 100644
index 00000000..0ed7411e
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Image.php
@@ -0,0 +1,49 @@
1<?php
2
3/**
4 * XHTML 1.1 Image Module provides basic image embedding.
5 * @note There is specialized code for removing empty images in
6 * HTMLPurifier_Strategy_RemoveForeignElements
7 */
8class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
9{
10
11 /**
12 * @type string
13 */
14 public $name = 'Image';
15
16 /**
17 * @param HTMLPurifier_Config $config
18 */
19 public function setup($config)
20 {
21 $max = $config->get('HTML.MaxImgLength');
22 $img = $this->addElement(
23 'img',
24 'Inline',
25 'Empty',
26 'Common',
27 array(
28 'alt*' => 'Text',
29 // According to the spec, it's Length, but percents can
30 // be abused, so we allow only Pixels.
31 'height' => 'Pixels#' . $max,
32 'width' => 'Pixels#' . $max,
33 'longdesc' => 'URI',
34 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
35 )
36 );
37 if ($max === null || $config->get('HTML.Trusted')) {
38 $img->attr['height'] =
39 $img->attr['width'] = 'Length';
40 }
41
42 // kind of strange, but splitting things up would be inefficient
43 $img->attr_transform_pre[] =
44 $img->attr_transform_post[] =
45 new HTMLPurifier_AttrTransform_ImgRequired();
46 }
47}
48
49// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.php
new file mode 100644
index 00000000..9ca1cb37
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.php
@@ -0,0 +1,186 @@
1<?php
2
3/**
4 * XHTML 1.1 Legacy module defines elements that were previously
5 * deprecated.
6 *
7 * @note Not all legacy elements have been implemented yet, which
8 * is a bit of a reverse problem as compared to browsers! In
9 * addition, this legacy module may implement a bit more than
10 * mandated by XHTML 1.1.
11 *
12 * This module can be used in combination with TransformToStrict in order
13 * to transform as many deprecated elements as possible, but retain
14 * questionably deprecated elements that do not have good alternatives
15 * as well as transform elements that don't have an implementation.
16 * See docs/ref-strictness.txt for more details.
17 */
18
19class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
20{
21 /**
22 * @type string
23 */
24 public $name = 'Legacy';
25
26 /**
27 * @param HTMLPurifier_Config $config
28 */
29 public function setup($config)
30 {
31 $this->addElement(
32 'basefont',
33 'Inline',
34 'Empty',
35 null,
36 array(
37 'color' => 'Color',
38 'face' => 'Text', // extremely broad, we should
39 'size' => 'Text', // tighten it
40 'id' => 'ID'
41 )
42 );
43 $this->addElement('center', 'Block', 'Flow', 'Common');
44 $this->addElement(
45 'dir',
46 'Block',
47 'Required: li',
48 'Common',
49 array(
50 'compact' => 'Bool#compact'
51 )
52 );
53 $this->addElement(
54 'font',
55 'Inline',
56 'Inline',
57 array('Core', 'I18N'),
58 array(
59 'color' => 'Color',
60 'face' => 'Text', // extremely broad, we should
61 'size' => 'Text', // tighten it
62 )
63 );
64 $this->addElement(
65 'menu',
66 'Block',
67 'Required: li',
68 'Common',
69 array(
70 'compact' => 'Bool#compact'
71 )
72 );
73
74 $s = $this->addElement('s', 'Inline', 'Inline', 'Common');
75 $s->formatting = true;
76
77 $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common');
78 $strike->formatting = true;
79
80 $u = $this->addElement('u', 'Inline', 'Inline', 'Common');
81 $u->formatting = true;
82
83 // setup modifications to old elements
84
85 $align = 'Enum#left,right,center,justify';
86
87 $address = $this->addBlankElement('address');
88 $address->content_model = 'Inline | #PCDATA | p';
89 $address->content_model_type = 'optional';
90 $address->child = false;
91
92 $blockquote = $this->addBlankElement('blockquote');
93 $blockquote->content_model = 'Flow | #PCDATA';
94 $blockquote->content_model_type = 'optional';
95 $blockquote->child = false;
96
97 $br = $this->addBlankElement('br');
98 $br->attr['clear'] = 'Enum#left,all,right,none';
99
100 $caption = $this->addBlankElement('caption');
101 $caption->attr['align'] = 'Enum#top,bottom,left,right';
102
103 $div = $this->addBlankElement('div');
104 $div->attr['align'] = $align;
105
106 $dl = $this->addBlankElement('dl');
107 $dl->attr['compact'] = 'Bool#compact';
108
109 for ($i = 1; $i <= 6; $i++) {
110 $h = $this->addBlankElement("h$i");
111 $h->attr['align'] = $align;
112 }
113
114 $hr = $this->addBlankElement('hr');
115 $hr->attr['align'] = $align;
116 $hr->attr['noshade'] = 'Bool#noshade';
117 $hr->attr['size'] = 'Pixels';
118 $hr->attr['width'] = 'Length';
119
120 $img = $this->addBlankElement('img');
121 $img->attr['align'] = 'IAlign';
122 $img->attr['border'] = 'Pixels';
123 $img->attr['hspace'] = 'Pixels';
124 $img->attr['vspace'] = 'Pixels';
125
126 // figure out this integer business
127
128 $li = $this->addBlankElement('li');
129 $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
130 $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle';
131
132 $ol = $this->addBlankElement('ol');
133 $ol->attr['compact'] = 'Bool#compact';
134 $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
135 $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
136
137 $p = $this->addBlankElement('p');
138 $p->attr['align'] = $align;
139
140 $pre = $this->addBlankElement('pre');
141 $pre->attr['width'] = 'Number';
142
143 // script omitted
144
145 $table = $this->addBlankElement('table');
146 $table->attr['align'] = 'Enum#left,center,right';
147 $table->attr['bgcolor'] = 'Color';
148
149 $tr = $this->addBlankElement('tr');
150 $tr->attr['bgcolor'] = 'Color';
151
152 $th = $this->addBlankElement('th');
153 $th->attr['bgcolor'] = 'Color';
154 $th->attr['height'] = 'Length';
155 $th->attr['nowrap'] = 'Bool#nowrap';
156 $th->attr['width'] = 'Length';
157
158 $td = $this->addBlankElement('td');
159 $td->attr['bgcolor'] = 'Color';
160 $td->attr['height'] = 'Length';
161 $td->attr['nowrap'] = 'Bool#nowrap';
162 $td->attr['width'] = 'Length';
163
164 $ul = $this->addBlankElement('ul');
165 $ul->attr['compact'] = 'Bool#compact';
166 $ul->attr['type'] = 'Enum#square,disc,circle';
167
168 // "safe" modifications to "unsafe" elements
169 // WARNING: If you want to add support for an unsafe, legacy
170 // attribute, make a new TrustedLegacy module with the trusted
171 // bit set appropriately
172
173 $form = $this->addBlankElement('form');
174 $form->content_model = 'Flow | #PCDATA';
175 $form->content_model_type = 'optional';
176 $form->attr['target'] = 'FrameTarget';
177
178 $input = $this->addBlankElement('input');
179 $input->attr['align'] = 'IAlign';
180
181 $legend = $this->addBlankElement('legend');
182 $legend->attr['align'] = 'LAlign';
183 }
184}
185
186// vim: et sw=4 sts=4
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 */
6class 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
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Name.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Name.php
new file mode 100644
index 00000000..315e22a8
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Name.php
@@ -0,0 +1,26 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Name extends HTMLPurifier_HTMLModule
4{
5 /**
6 * @type string
7 */
8 public $name = 'Name';
9
10 /**
11 * @param HTMLPurifier_Config $config
12 */
13 public function setup($config)
14 {
15 $elements = array('a', 'applet', 'form', 'frame', 'iframe', 'img', 'map');
16 foreach ($elements as $name) {
17 $element = $this->addBlankElement($name);
18 $element->attr['name'] = 'CDATA';
19 if (!$config->get('HTML.Attr.Name.UseCDATA')) {
20 $element->attr_transform_post[] = new HTMLPurifier_AttrTransform_NameSync();
21 }
22 }
23 }
24}
25
26// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Nofollow.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Nofollow.php
new file mode 100644
index 00000000..c145e8e9
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Nofollow.php
@@ -0,0 +1,25 @@
1<?php
2
3/**
4 * Module adds the nofollow attribute transformation to a tags. It
5 * is enabled by HTML.Nofollow
6 */
7class HTMLPurifier_HTMLModule_Nofollow extends HTMLPurifier_HTMLModule
8{
9
10 /**
11 * @type string
12 */
13 public $name = 'Nofollow';
14
15 /**
16 * @param HTMLPurifier_Config $config
17 */
18 public function setup($config)
19 {
20 $a = $this->addBlankElement('a');
21 $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_Nofollow();
22 }
23}
24
25// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
new file mode 100644
index 00000000..7d66e114
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
@@ -0,0 +1,20 @@
1<?php
2
3class HTMLPurifier_HTMLModule_NonXMLCommonAttributes extends HTMLPurifier_HTMLModule
4{
5 /**
6 * @type string
7 */
8 public $name = 'NonXMLCommonAttributes';
9
10 /**
11 * @type array
12 */
13 public $attr_collections = array(
14 'Lang' => array(
15 'lang' => 'LanguageCode',
16 )
17 );
18}
19
20// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Object.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Object.php
new file mode 100644
index 00000000..d388b24c
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Object.php
@@ -0,0 +1,62 @@
1<?php
2
3/**
4 * XHTML 1.1 Object Module, defines elements for generic object inclusion
5 * @warning Users will commonly use <embed> to cater to legacy browsers: this
6 * module does not allow this sort of behavior
7 */
8class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
9{
10 /**
11 * @type string
12 */
13 public $name = 'Object';
14
15 /**
16 * @type bool
17 */
18 public $safe = false;
19
20 /**
21 * @param HTMLPurifier_Config $config
22 */
23 public function setup($config)
24 {
25 $this->addElement(
26 'object',
27 'Inline',
28 'Optional: #PCDATA | Flow | param',
29 'Common',
30 array(
31 'archive' => 'URI',
32 'classid' => 'URI',
33 'codebase' => 'URI',
34 'codetype' => 'Text',
35 'data' => 'URI',
36 'declare' => 'Bool#declare',
37 'height' => 'Length',
38 'name' => 'CDATA',
39 'standby' => 'Text',
40 'tabindex' => 'Number',
41 'type' => 'ContentType',
42 'width' => 'Length'
43 )
44 );
45
46 $this->addElement(
47 'param',
48 false,
49 'Empty',
50 null,
51 array(
52 'id' => 'ID',
53 'name*' => 'Text',
54 'type' => 'Text',
55 'value' => 'Text',
56 'valuetype' => 'Enum#data,ref,object'
57 )
58 );
59 }
60}
61
62// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Presentation.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Presentation.php
new file mode 100644
index 00000000..831db4cf
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Presentation.php
@@ -0,0 +1,42 @@
1<?php
2
3/**
4 * XHTML 1.1 Presentation Module, defines simple presentation-related
5 * markup. Text Extension Module.
6 * @note The official XML Schema and DTD specs further divide this into
7 * two modules:
8 * - Block Presentation (hr)
9 * - Inline Presentation (b, big, i, small, sub, sup, tt)
10 * We have chosen not to heed this distinction, as content_sets
11 * provides satisfactory disambiguation.
12 */
13class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
14{
15
16 /**
17 * @type string
18 */
19 public $name = 'Presentation';
20
21 /**
22 * @param HTMLPurifier_Config $config
23 */
24 public function setup($config)
25 {
26 $this->addElement('hr', 'Block', 'Empty', 'Common');
27 $this->addElement('sub', 'Inline', 'Inline', 'Common');
28 $this->addElement('sup', 'Inline', 'Inline', 'Common');
29 $b = $this->addElement('b', 'Inline', 'Inline', 'Common');
30 $b->formatting = true;
31 $big = $this->addElement('big', 'Inline', 'Inline', 'Common');
32 $big->formatting = true;
33 $i = $this->addElement('i', 'Inline', 'Inline', 'Common');
34 $i->formatting = true;
35 $small = $this->addElement('small', 'Inline', 'Inline', 'Common');
36 $small->formatting = true;
37 $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common');
38 $tt->formatting = true;
39 }
40}
41
42// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Proprietary.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Proprietary.php
new file mode 100644
index 00000000..4593fc40
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Proprietary.php
@@ -0,0 +1,40 @@
1<?php
2
3/**
4 * Module defines proprietary tags and attributes in HTML.
5 * @warning If this module is enabled, standards-compliance is off!
6 */
7class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
8{
9 /**
10 * @type string
11 */
12 public $name = 'Proprietary';
13
14 /**
15 * @param HTMLPurifier_Config $config
16 */
17 public function setup($config)
18 {
19 $this->addElement(
20 'marquee',
21 'Inline',
22 'Flow',
23 'Common',
24 array(
25 'direction' => 'Enum#left,right,up,down',
26 'behavior' => 'Enum#alternate',
27 'width' => 'Length',
28 'height' => 'Length',
29 'scrolldelay' => 'Number',
30 'scrollamount' => 'Number',
31 'loop' => 'Number',
32 'bgcolor' => 'Color',
33 'hspace' => 'Pixels',
34 'vspace' => 'Pixels',
35 )
36 );
37 }
38}
39
40// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Ruby.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Ruby.php
new file mode 100644
index 00000000..9a261729
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Ruby.php
@@ -0,0 +1,36 @@
1<?php
2
3/**
4 * XHTML 1.1 Ruby Annotation Module, defines elements that indicate
5 * short runs of text alongside base text for annotation or pronounciation.
6 */
7class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
8{
9
10 /**
11 * @type string
12 */
13 public $name = 'Ruby';
14
15 /**
16 * @param HTMLPurifier_Config $config
17 */
18 public function setup($config)
19 {
20 $this->addElement(
21 'ruby',
22 'Inline',
23 'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
24 'Common'
25 );
26 $this->addElement('rbc', false, 'Required: rb', 'Common');
27 $this->addElement('rtc', false, 'Required: rt', 'Common');
28 $rb = $this->addElement('rb', false, 'Inline', 'Common');
29 $rb->excludes = array('ruby' => true);
30 $rt = $this->addElement('rt', false, 'Inline', 'Common', array('rbspan' => 'Number'));
31 $rt->excludes = array('ruby' => true);
32 $this->addElement('rp', false, 'Optional: #PCDATA', 'Common');
33 }
34}
35
36// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeEmbed.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeEmbed.php
new file mode 100644
index 00000000..11572887
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeEmbed.php
@@ -0,0 +1,40 @@
1<?php
2
3/**
4 * A "safe" embed module. See SafeObject. This is a proprietary element.
5 */
6class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule
7{
8 /**
9 * @type string
10 */
11 public $name = 'SafeEmbed';
12
13 /**
14 * @param HTMLPurifier_Config $config
15 */
16 public function setup($config)
17 {
18 $max = $config->get('HTML.MaxImgLength');
19 $embed = $this->addElement(
20 'embed',
21 'Inline',
22 'Empty',
23 'Common',
24 array(
25 'src*' => 'URI#embedded',
26 'type' => 'Enum#application/x-shockwave-flash',
27 'width' => 'Pixels#' . $max,
28 'height' => 'Pixels#' . $max,
29 'allowscriptaccess' => 'Enum#never',
30 'allownetworking' => 'Enum#internal',
31 'flashvars' => 'Text',
32 'wmode' => 'Enum#window,transparent,opaque',
33 'name' => 'ID',
34 )
35 );
36 $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed();
37 }
38}
39
40// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeObject.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeObject.php
new file mode 100644
index 00000000..a061cec1
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeObject.php
@@ -0,0 +1,62 @@
1<?php
2
3/**
4 * A "safe" object module. In theory, objects permitted by this module will
5 * be safe, and untrusted users can be allowed to embed arbitrary flash objects
6 * (maybe other types too, but only Flash is supported as of right now).
7 * Highly experimental.
8 */
9class HTMLPurifier_HTMLModule_SafeObject extends HTMLPurifier_HTMLModule
10{
11 /**
12 * @type string
13 */
14 public $name = 'SafeObject';
15
16 /**
17 * @param HTMLPurifier_Config $config
18 */
19 public function setup($config)
20 {
21 // These definitions are not intrinsically safe: the attribute transforms
22 // are a vital part of ensuring safety.
23
24 $max = $config->get('HTML.MaxImgLength');
25 $object = $this->addElement(
26 'object',
27 'Inline',
28 'Optional: param | Flow | #PCDATA',
29 'Common',
30 array(
31 // While technically not required by the spec, we're forcing
32 // it to this value.
33 'type' => 'Enum#application/x-shockwave-flash',
34 'width' => 'Pixels#' . $max,
35 'height' => 'Pixels#' . $max,
36 'data' => 'URI#embedded',
37 'codebase' => new HTMLPurifier_AttrDef_Enum(
38 array(
39 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
40 )
41 ),
42 )
43 );
44 $object->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeObject();
45
46 $param = $this->addElement(
47 'param',
48 false,
49 'Empty',
50 false,
51 array(
52 'id' => 'ID',
53 'name*' => 'Text',
54 'value' => 'Text'
55 )
56 );
57 $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam();
58 $this->info_injector[] = 'SafeObject';
59 }
60}
61
62// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeScripting.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeScripting.php
new file mode 100644
index 00000000..6e9113cb
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/SafeScripting.php
@@ -0,0 +1,40 @@
1<?php
2
3/**
4 * A "safe" script module. No inline JS is allowed, and pointed to JS
5 * files must match whitelist.
6 */
7class HTMLPurifier_HTMLModule_SafeScripting extends HTMLPurifier_HTMLModule
8{
9 /**
10 * @type string
11 */
12 public $name = 'SafeScripting';
13
14 /**
15 * @param HTMLPurifier_Config $config
16 */
17 public function setup($config)
18 {
19 // These definitions are not intrinsically safe: the attribute transforms
20 // are a vital part of ensuring safety.
21
22 $allowed = $config->get('HTML.SafeScripting');
23 $script = $this->addElement(
24 'script',
25 'Inline',
26 'Empty',
27 null,
28 array(
29 // While technically not required by the spec, we're forcing
30 // it to this value.
31 'type' => 'Enum#text/javascript',
32 'src*' => new HTMLPurifier_AttrDef_Enum(array_keys($allowed))
33 )
34 );
35 $script->attr_transform_pre[] =
36 $script->attr_transform_post[] = new HTMLPurifier_AttrTransform_ScriptRequired();
37 }
38}
39
40// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Scripting.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Scripting.php
new file mode 100644
index 00000000..18785372
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Scripting.php
@@ -0,0 +1,73 @@
1<?php
2
3/*
4
5WARNING: THIS MODULE IS EXTREMELY DANGEROUS AS IT ENABLES INLINE SCRIPTING
6INSIDE HTML PURIFIER DOCUMENTS. USE ONLY WITH TRUSTED USER INPUT!!!
7
8*/
9
10/**
11 * XHTML 1.1 Scripting module, defines elements that are used to contain
12 * information pertaining to executable scripts or the lack of support
13 * for executable scripts.
14 * @note This module does not contain inline scripting elements
15 */
16class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
17{
18 /**
19 * @type string
20 */
21 public $name = 'Scripting';
22
23 /**
24 * @type array
25 */
26 public $elements = array('script', 'noscript');
27
28 /**
29 * @type array
30 */
31 public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
32
33 /**
34 * @type bool
35 */
36 public $safe = false;
37
38 /**
39 * @param HTMLPurifier_Config $config
40 */
41 public function setup($config)
42 {
43 // TODO: create custom child-definition for noscript that
44 // auto-wraps stray #PCDATA in a similar manner to
45 // blockquote's custom definition (we would use it but
46 // blockquote's contents are optional while noscript's contents
47 // are required)
48
49 // TODO: convert this to new syntax, main problem is getting
50 // both content sets working
51
52 // In theory, this could be safe, but I don't see any reason to
53 // allow it.
54 $this->info['noscript'] = new HTMLPurifier_ElementDef();
55 $this->info['noscript']->attr = array(0 => array('Common'));
56 $this->info['noscript']->content_model = 'Heading | List | Block';
57 $this->info['noscript']->content_model_type = 'required';
58
59 $this->info['script'] = new HTMLPurifier_ElementDef();
60 $this->info['script']->attr = array(
61 'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')),
62 'src' => new HTMLPurifier_AttrDef_URI(true),
63 'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript'))
64 );
65 $this->info['script']->content_model = '#PCDATA';
66 $this->info['script']->content_model_type = 'optional';
67 $this->info['script']->attr_transform_pre[] =
68 $this->info['script']->attr_transform_post[] =
69 new HTMLPurifier_AttrTransform_ScriptRequired();
70 }
71}
72
73// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/StyleAttribute.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/StyleAttribute.php
new file mode 100644
index 00000000..f192780a
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/StyleAttribute.php
@@ -0,0 +1,33 @@
1<?php
2
3/**
4 * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
5 * Module.
6 */
7class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
8{
9 /**
10 * @type string
11 */
12 public $name = 'StyleAttribute';
13
14 /**
15 * @type array
16 */
17 public $attr_collections = array(
18 // The inclusion routine differs from the Abstract Modules but
19 // is in line with the DTD and XML Schemas.
20 'Style' => array('style' => false), // see constructor
21 'Core' => array(0 => array('Style'))
22 );
23
24 /**
25 * @param HTMLPurifier_Config $config
26 */
27 public function setup($config)
28 {
29 $this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
30 }
31}
32
33// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tables.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tables.php
new file mode 100644
index 00000000..f993e3ca
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tables.php
@@ -0,0 +1,75 @@
1<?php
2
3/**
4 * XHTML 1.1 Tables Module, fully defines accessible table elements.
5 */
6class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
7{
8 /**
9 * @type string
10 */
11 public $name = 'Tables';
12
13 /**
14 * @param HTMLPurifier_Config $config
15 */
16 public function setup($config)
17 {
18 $this->addElement('caption', false, 'Inline', 'Common');
19
20 $this->addElement(
21 'table',
22 'Block',
23 new HTMLPurifier_ChildDef_Table(),
24 'Common',
25 array(
26 'border' => 'Pixels',
27 'cellpadding' => 'Length',
28 'cellspacing' => 'Length',
29 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
30 'rules' => 'Enum#none,groups,rows,cols,all',
31 'summary' => 'Text',
32 'width' => 'Length'
33 )
34 );
35
36 // common attributes
37 $cell_align = array(
38 'align' => 'Enum#left,center,right,justify,char',
39 'charoff' => 'Length',
40 'valign' => 'Enum#top,middle,bottom,baseline',
41 );
42
43 $cell_t = array_merge(
44 array(
45 'abbr' => 'Text',
46 'colspan' => 'Number',
47 'rowspan' => 'Number',
48 // Apparently, as of HTML5 this attribute only applies
49 // to 'th' elements.
50 'scope' => 'Enum#row,col,rowgroup,colgroup',
51 ),
52 $cell_align
53 );
54 $this->addElement('td', false, 'Flow', 'Common', $cell_t);
55 $this->addElement('th', false, 'Flow', 'Common', $cell_t);
56
57 $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
58
59 $cell_col = array_merge(
60 array(
61 'span' => 'Number',
62 'width' => 'MultiLength',
63 ),
64 $cell_align
65 );
66 $this->addElement('col', false, 'Empty', 'Common', $cell_col);
67 $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
68
69 $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
70 $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
71 $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
72 }
73}
74
75// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Target.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Target.php
new file mode 100644
index 00000000..f3af0486
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Target.php
@@ -0,0 +1,28 @@
1<?php
2
3/**
4 * XHTML 1.1 Target Module, defines target attribute in link elements.
5 */
6class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
7{
8 /**
9 * @type string
10 */
11 public $name = 'Target';
12
13 /**
14 * @param HTMLPurifier_Config $config
15 */
16 public function setup($config)
17 {
18 $elements = array('a');
19 foreach ($elements as $name) {
20 $e = $this->addBlankElement($name);
21 $e->attr = array(
22 'target' => new HTMLPurifier_AttrDef_HTML_FrameTarget()
23 );
24 }
25 }
26}
27
28// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/TargetBlank.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/TargetBlank.php
new file mode 100644
index 00000000..757cddcd
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/TargetBlank.php
@@ -0,0 +1,24 @@
1<?php
2
3/**
4 * Module adds the target=blank attribute transformation to a tags. It
5 * is enabled by HTML.TargetBlank
6 */
7class HTMLPurifier_HTMLModule_TargetBlank extends HTMLPurifier_HTMLModule
8{
9 /**
10 * @type string
11 */
12 public $name = 'TargetBlank';
13
14 /**
15 * @param HTMLPurifier_Config $config
16 */
17 public function setup($config)
18 {
19 $a = $this->addBlankElement('a');
20 $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_TargetBlank();
21 }
22}
23
24// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Text.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Text.php
new file mode 100644
index 00000000..11fdd8bd
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Text.php
@@ -0,0 +1,87 @@
1<?php
2
3/**
4 * XHTML 1.1 Text Module, defines basic text containers. Core Module.
5 * @note In the normative XML Schema specification, this module
6 * is further abstracted into the following modules:
7 * - Block Phrasal (address, blockquote, pre, h1, h2, h3, h4, h5, h6)
8 * - Block Structural (div, p)
9 * - Inline Phrasal (abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var)
10 * - Inline Structural (br, span)
11 * This module, functionally, does not distinguish between these
12 * sub-modules, but the code is internally structured to reflect
13 * these distinctions.
14 */
15class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
16{
17 /**
18 * @type string
19 */
20 public $name = 'Text';
21
22 /**
23 * @type array
24 */
25 public $content_sets = array(
26 'Flow' => 'Heading | Block | Inline'
27 );
28
29 /**
30 * @param HTMLPurifier_Config $config
31 */
32 public function setup($config)
33 {
34 // Inline Phrasal -------------------------------------------------
35 $this->addElement('abbr', 'Inline', 'Inline', 'Common');
36 $this->addElement('acronym', 'Inline', 'Inline', 'Common');
37 $this->addElement('cite', 'Inline', 'Inline', 'Common');
38 $this->addElement('dfn', 'Inline', 'Inline', 'Common');
39 $this->addElement('kbd', 'Inline', 'Inline', 'Common');
40 $this->addElement('q', 'Inline', 'Inline', 'Common', array('cite' => 'URI'));
41 $this->addElement('samp', 'Inline', 'Inline', 'Common');
42 $this->addElement('var', 'Inline', 'Inline', 'Common');
43
44 $em = $this->addElement('em', 'Inline', 'Inline', 'Common');
45 $em->formatting = true;
46
47 $strong = $this->addElement('strong', 'Inline', 'Inline', 'Common');
48 $strong->formatting = true;
49
50 $code = $this->addElement('code', 'Inline', 'Inline', 'Common');
51 $code->formatting = true;
52
53 // Inline Structural ----------------------------------------------
54 $this->addElement('span', 'Inline', 'Inline', 'Common');
55 $this->addElement('br', 'Inline', 'Empty', 'Core');
56
57 // Block Phrasal --------------------------------------------------
58 $this->addElement('address', 'Block', 'Inline', 'Common');
59 $this->addElement('blockquote', 'Block', 'Optional: Heading | Block | List', 'Common', array('cite' => 'URI'));
60 $pre = $this->addElement('pre', 'Block', 'Inline', 'Common');
61 $pre->excludes = $this->makeLookup(
62 'img',
63 'big',
64 'small',
65 'object',
66 'applet',
67 'font',
68 'basefont'
69 );
70 $this->addElement('h1', 'Heading', 'Inline', 'Common');
71 $this->addElement('h2', 'Heading', 'Inline', 'Common');
72 $this->addElement('h3', 'Heading', 'Inline', 'Common');
73 $this->addElement('h4', 'Heading', 'Inline', 'Common');
74 $this->addElement('h5', 'Heading', 'Inline', 'Common');
75 $this->addElement('h6', 'Heading', 'Inline', 'Common');
76
77 // Block Structural -----------------------------------------------
78 $p = $this->addElement('p', 'Block', 'Inline', 'Common');
79 $p->autoclose = array_flip(
80 array("address", "blockquote", "center", "dir", "div", "dl", "fieldset", "ol", "p", "ul")
81 );
82
83 $this->addElement('div', 'Block', 'Flow', 'Common');
84 }
85}
86
87// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
new file mode 100644
index 00000000..f482a374
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
@@ -0,0 +1,230 @@
1<?php
2
3/**
4 * Abstract class for a set of proprietary modules that clean up (tidy)
5 * poorly written HTML.
6 * @todo Figure out how to protect some of these methods/properties
7 */
8class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
9{
10 /**
11 * List of supported levels.
12 * Index zero is a special case "no fixes" level.
13 * @type array
14 */
15 public $levels = array(0 => 'none', 'light', 'medium', 'heavy');
16
17 /**
18 * Default level to place all fixes in.
19 * Disabled by default.
20 * @type string
21 */
22 public $defaultLevel = null;
23
24 /**
25 * Lists of fixes used by getFixesForLevel().
26 * Format is:
27 * HTMLModule_Tidy->fixesForLevel[$level] = array('fix-1', 'fix-2');
28 * @type array
29 */
30 public $fixesForLevel = array(
31 'light' => array(),
32 'medium' => array(),
33 'heavy' => array()
34 );
35
36 /**
37 * Lazy load constructs the module by determining the necessary
38 * fixes to create and then delegating to the populate() function.
39 * @param HTMLPurifier_Config $config
40 * @todo Wildcard matching and error reporting when an added or
41 * subtracted fix has no effect.
42 */
43 public function setup($config)
44 {
45 // create fixes, initialize fixesForLevel
46 $fixes = $this->makeFixes();
47 $this->makeFixesForLevel($fixes);
48
49 // figure out which fixes to use
50 $level = $config->get('HTML.TidyLevel');
51 $fixes_lookup = $this->getFixesForLevel($level);
52
53 // get custom fix declarations: these need namespace processing
54 $add_fixes = $config->get('HTML.TidyAdd');
55 $remove_fixes = $config->get('HTML.TidyRemove');
56
57 foreach ($fixes as $name => $fix) {
58 // needs to be refactored a little to implement globbing
59 if (isset($remove_fixes[$name]) ||
60 (!isset($add_fixes[$name]) && !isset($fixes_lookup[$name]))) {
61 unset($fixes[$name]);
62 }
63 }
64
65 // populate this module with necessary fixes
66 $this->populate($fixes);
67 }
68
69 /**
70 * Retrieves all fixes per a level, returning fixes for that specific
71 * level as well as all levels below it.
72 * @param string $level level identifier, see $levels for valid values
73 * @return array Lookup up table of fixes
74 */
75 public function getFixesForLevel($level)
76 {
77 if ($level == $this->levels[0]) {
78 return array();
79 }
80 $activated_levels = array();
81 for ($i = 1, $c = count($this->levels); $i < $c; $i++) {
82 $activated_levels[] = $this->levels[$i];
83 if ($this->levels[$i] == $level) {
84 break;
85 }
86 }
87 if ($i == $c) {
88 trigger_error(
89 'Tidy level ' . htmlspecialchars($level) . ' not recognized',
90 E_USER_WARNING
91 );
92 return array();
93 }
94 $ret = array();
95 foreach ($activated_levels as $level) {
96 foreach ($this->fixesForLevel[$level] as $fix) {
97 $ret[$fix] = true;
98 }
99 }
100 return $ret;
101 }
102
103 /**
104 * Dynamically populates the $fixesForLevel member variable using
105 * the fixes array. It may be custom overloaded, used in conjunction
106 * with $defaultLevel, or not used at all.
107 * @param array $fixes
108 */
109 public function makeFixesForLevel($fixes)
110 {
111 if (!isset($this->defaultLevel)) {
112 return;
113 }
114 if (!isset($this->fixesForLevel[$this->defaultLevel])) {
115 trigger_error(
116 'Default level ' . $this->defaultLevel . ' does not exist',
117 E_USER_ERROR
118 );
119 return;
120 }
121 $this->fixesForLevel[$this->defaultLevel] = array_keys($fixes);
122 }
123
124 /**
125 * Populates the module with transforms and other special-case code
126 * based on a list of fixes passed to it
127 * @param array $fixes Lookup table of fixes to activate
128 */
129 public function populate($fixes)
130 {
131 foreach ($fixes as $name => $fix) {
132 // determine what the fix is for
133 list($type, $params) = $this->getFixType($name);
134 switch ($type) {
135 case 'attr_transform_pre':
136 case 'attr_transform_post':
137 $attr = $params['attr'];
138 if (isset($params['element'])) {
139 $element = $params['element'];
140 if (empty($this->info[$element])) {
141 $e = $this->addBlankElement($element);
142 } else {
143 $e = $this->info[$element];
144 }
145 } else {
146 $type = "info_$type";
147 $e = $this;
148 }
149 // PHP does some weird parsing when I do
150 // $e->$type[$attr], so I have to assign a ref.
151 $f =& $e->$type;
152 $f[$attr] = $fix;
153 break;
154 case 'tag_transform':
155 $this->info_tag_transform[$params['element']] = $fix;
156 break;
157 case 'child':
158 case 'content_model_type':
159 $element = $params['element'];
160 if (empty($this->info[$element])) {
161 $e = $this->addBlankElement($element);
162 } else {
163 $e = $this->info[$element];
164 }
165 $e->$type = $fix;
166 break;
167 default:
168 trigger_error("Fix type $type not supported", E_USER_ERROR);
169 break;
170 }
171 }
172 }
173
174 /**
175 * Parses a fix name and determines what kind of fix it is, as well
176 * as other information defined by the fix
177 * @param $name String name of fix
178 * @return array(string $fix_type, array $fix_parameters)
179 * @note $fix_parameters is type dependant, see populate() for usage
180 * of these parameters
181 */
182 public function getFixType($name)
183 {
184 // parse it
185 $property = $attr = null;
186 if (strpos($name, '#') !== false) {
187 list($name, $property) = explode('#', $name);
188 }
189 if (strpos($name, '@') !== false) {
190 list($name, $attr) = explode('@', $name);
191 }
192
193 // figure out the parameters
194 $params = array();
195 if ($name !== '') {
196 $params['element'] = $name;
197 }
198 if (!is_null($attr)) {
199 $params['attr'] = $attr;
200 }
201
202 // special case: attribute transform
203 if (!is_null($attr)) {
204 if (is_null($property)) {
205 $property = 'pre';
206 }
207 $type = 'attr_transform_' . $property;
208 return array($type, $params);
209 }
210
211 // special case: tag transform
212 if (is_null($property)) {
213 return array('tag_transform', $params);
214 }
215
216 return array($property, $params);
217
218 }
219
220 /**
221 * Defines all fixes the module will perform in a compact
222 * associative array of fix name to fix implementation.
223 * @return array
224 */
225 public function makeFixes()
226 {
227 }
228}
229
230// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Name.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Name.php
new file mode 100644
index 00000000..bb47bafd
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Name.php
@@ -0,0 +1,33 @@
1<?php
2
3/**
4 * Name is deprecated, but allowed in strict doctypes, so onl
5 */
6class HTMLPurifier_HTMLModule_Tidy_Name extends HTMLPurifier_HTMLModule_Tidy
7{
8 /**
9 * @type string
10 */
11 public $name = 'Tidy_Name';
12
13 /**
14 * @type string
15 */
16 public $defaultLevel = 'heavy';
17
18 /**
19 * @return array
20 */
21 public function makeFixes()
22 {
23 $r = array();
24 // @name for img, a -----------------------------------------------
25 // Technically, it's allowed even on strict, so we allow authors to use
26 // it. However, it's deprecated in future versions of XHTML.
27 $r['img@name'] =
28 $r['a@name'] = new HTMLPurifier_AttrTransform_Name();
29 return $r;
30 }
31}
32
33// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Proprietary.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
new file mode 100644
index 00000000..638cb541
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
@@ -0,0 +1,34 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Tidy_Proprietary extends HTMLPurifier_HTMLModule_Tidy
4{
5
6 /**
7 * @type string
8 */
9 public $name = 'Tidy_Proprietary';
10
11 /**
12 * @type string
13 */
14 public $defaultLevel = 'light';
15
16 /**
17 * @return array
18 */
19 public function makeFixes()
20 {
21 $r = array();
22 $r['table@background'] = new HTMLPurifier_AttrTransform_Background();
23 $r['td@background'] = new HTMLPurifier_AttrTransform_Background();
24 $r['th@background'] = new HTMLPurifier_AttrTransform_Background();
25 $r['tr@background'] = new HTMLPurifier_AttrTransform_Background();
26 $r['thead@background'] = new HTMLPurifier_AttrTransform_Background();
27 $r['tfoot@background'] = new HTMLPurifier_AttrTransform_Background();
28 $r['tbody@background'] = new HTMLPurifier_AttrTransform_Background();
29 $r['table@height'] = new HTMLPurifier_AttrTransform_Length('height');
30 return $r;
31 }
32}
33
34// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Strict.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Strict.php
new file mode 100644
index 00000000..ba3260e6
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Strict.php
@@ -0,0 +1,43 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Tidy_Strict extends HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4
4{
5 /**
6 * @type string
7 */
8 public $name = 'Tidy_Strict';
9
10 /**
11 * @type string
12 */
13 public $defaultLevel = 'light';
14
15 /**
16 * @return array
17 */
18 public function makeFixes()
19 {
20 $r = parent::makeFixes();
21 $r['blockquote#content_model_type'] = 'strictblockquote';
22 return $r;
23 }
24
25 /**
26 * @type bool
27 */
28 public $defines_child_def = true;
29
30 /**
31 * @param HTMLPurifier_ElementDef $def
32 * @return HTMLPurifier_ChildDef_StrictBlockquote
33 */
34 public function getChildDef($def)
35 {
36 if ($def->content_model_type != 'strictblockquote') {
37 return parent::getChildDef($def);
38 }
39 return new HTMLPurifier_ChildDef_StrictBlockquote($def->content_model);
40 }
41}
42
43// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Transitional.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Transitional.php
new file mode 100644
index 00000000..79411d25
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Transitional.php
@@ -0,0 +1,16 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Tidy_Transitional extends HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4
4{
5 /**
6 * @type string
7 */
8 public $name = 'Tidy_Transitional';
9
10 /**
11 * @type string
12 */
13 public $defaultLevel = 'heavy';
14}
15
16// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTML.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTML.php
new file mode 100644
index 00000000..935ad7f5
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTML.php
@@ -0,0 +1,26 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Tidy_XHTML extends HTMLPurifier_HTMLModule_Tidy
4{
5 /**
6 * @type string
7 */
8 public $name = 'Tidy_XHTML';
9
10 /**
11 * @type string
12 */
13 public $defaultLevel = 'medium';
14
15 /**
16 * @return array
17 */
18 public function makeFixes()
19 {
20 $r = array();
21 $r['@lang'] = new HTMLPurifier_AttrTransform_Lang();
22 return $r;
23 }
24}
25
26// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
new file mode 100644
index 00000000..17164fb6
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
@@ -0,0 +1,179 @@
1<?php
2
3class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule_Tidy
4{
5
6 /**
7 * @return array
8 */
9 public function makeFixes()
10 {
11 $r = array();
12
13 // == deprecated tag transforms ===================================
14
15 $r['font'] = new HTMLPurifier_TagTransform_Font();
16 $r['menu'] = new HTMLPurifier_TagTransform_Simple('ul');
17 $r['dir'] = new HTMLPurifier_TagTransform_Simple('ul');
18 $r['center'] = new HTMLPurifier_TagTransform_Simple('div', 'text-align:center;');
19 $r['u'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:underline;');
20 $r['s'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
21 $r['strike'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
22
23 // == deprecated attribute transforms =============================
24
25 $r['caption@align'] =
26 new HTMLPurifier_AttrTransform_EnumToCSS(
27 'align',
28 array(
29 // we're following IE's behavior, not Firefox's, due
30 // to the fact that no one supports caption-side:right,
31 // W3C included (with CSS 2.1). This is a slightly
32 // unreasonable attribute!
33 'left' => 'text-align:left;',
34 'right' => 'text-align:right;',
35 'top' => 'caption-side:top;',
36 'bottom' => 'caption-side:bottom;' // not supported by IE
37 )
38 );
39
40 // @align for img -------------------------------------------------
41 $r['img@align'] =
42 new HTMLPurifier_AttrTransform_EnumToCSS(
43 'align',
44 array(
45 'left' => 'float:left;',
46 'right' => 'float:right;',
47 'top' => 'vertical-align:top;',
48 'middle' => 'vertical-align:middle;',
49 'bottom' => 'vertical-align:baseline;',
50 )
51 );
52
53 // @align for table -----------------------------------------------
54 $r['table@align'] =
55 new HTMLPurifier_AttrTransform_EnumToCSS(
56 'align',
57 array(
58 'left' => 'float:left;',
59 'center' => 'margin-left:auto;margin-right:auto;',
60 'right' => 'float:right;'
61 )
62 );
63
64 // @align for hr -----------------------------------------------
65 $r['hr@align'] =
66 new HTMLPurifier_AttrTransform_EnumToCSS(
67 'align',
68 array(
69 // we use both text-align and margin because these work
70 // for different browsers (IE and Firefox, respectively)
71 // and the melange makes for a pretty cross-compatible
72 // solution
73 'left' => 'margin-left:0;margin-right:auto;text-align:left;',
74 'center' => 'margin-left:auto;margin-right:auto;text-align:center;',
75 'right' => 'margin-left:auto;margin-right:0;text-align:right;'
76 )
77 );
78
79 // @align for h1, h2, h3, h4, h5, h6, p, div ----------------------
80 // {{{
81 $align_lookup = array();
82 $align_values = array('left', 'right', 'center', 'justify');
83 foreach ($align_values as $v) {
84 $align_lookup[$v] = "text-align:$v;";
85 }
86 // }}}
87 $r['h1@align'] =
88 $r['h2@align'] =
89 $r['h3@align'] =
90 $r['h4@align'] =
91 $r['h5@align'] =
92 $r['h6@align'] =
93 $r['p@align'] =
94 $r['div@align'] =
95 new HTMLPurifier_AttrTransform_EnumToCSS('align', $align_lookup);
96
97 // @bgcolor for table, tr, td, th ---------------------------------
98 $r['table@bgcolor'] =
99 $r['td@bgcolor'] =
100 $r['th@bgcolor'] =
101 new HTMLPurifier_AttrTransform_BgColor();
102
103 // @border for img ------------------------------------------------
104 $r['img@border'] = new HTMLPurifier_AttrTransform_Border();
105
106 // @clear for br --------------------------------------------------
107 $r['br@clear'] =
108 new HTMLPurifier_AttrTransform_EnumToCSS(
109 'clear',
110 array(
111 'left' => 'clear:left;',
112 'right' => 'clear:right;',
113 'all' => 'clear:both;',
114 'none' => 'clear:none;',
115 )
116 );
117
118 // @height for td, th ---------------------------------------------
119 $r['td@height'] =
120 $r['th@height'] =
121 new HTMLPurifier_AttrTransform_Length('height');
122
123 // @hspace for img ------------------------------------------------
124 $r['img@hspace'] = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
125
126 // @noshade for hr ------------------------------------------------
127 // this transformation is not precise but often good enough.
128 // different browsers use different styles to designate noshade
129 $r['hr@noshade'] =
130 new HTMLPurifier_AttrTransform_BoolToCSS(
131 'noshade',
132 'color:#808080;background-color:#808080;border:0;'
133 );
134
135 // @nowrap for td, th ---------------------------------------------
136 $r['td@nowrap'] =
137 $r['th@nowrap'] =
138 new HTMLPurifier_AttrTransform_BoolToCSS(
139 'nowrap',
140 'white-space:nowrap;'
141 );
142
143 // @size for hr --------------------------------------------------
144 $r['hr@size'] = new HTMLPurifier_AttrTransform_Length('size', 'height');
145
146 // @type for li, ol, ul -------------------------------------------
147 // {{{
148 $ul_types = array(
149 'disc' => 'list-style-type:disc;',
150 'square' => 'list-style-type:square;',
151 'circle' => 'list-style-type:circle;'
152 );
153 $ol_types = array(
154 '1' => 'list-style-type:decimal;',
155 'i' => 'list-style-type:lower-roman;',
156 'I' => 'list-style-type:upper-roman;',
157 'a' => 'list-style-type:lower-alpha;',
158 'A' => 'list-style-type:upper-alpha;'
159 );
160 $li_types = $ul_types + $ol_types;
161 // }}}
162
163 $r['ul@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ul_types);
164 $r['ol@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ol_types, true);
165 $r['li@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $li_types, true);
166
167 // @vspace for img ------------------------------------------------
168 $r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
169
170 // @width for hr, td, th ------------------------------------------
171 $r['td@width'] =
172 $r['th@width'] =
173 $r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
174
175 return $r;
176 }
177}
178
179// vim: et sw=4 sts=4
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/XMLCommonAttributes.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
new file mode 100644
index 00000000..27a353db
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
@@ -0,0 +1,20 @@
1<?php
2
3class HTMLPurifier_HTMLModule_XMLCommonAttributes extends HTMLPurifier_HTMLModule
4{
5 /**
6 * @type string
7 */
8 public $name = 'XMLCommonAttributes';
9
10 /**
11 * @type array
12 */
13 public $attr_collections = array(
14 'Lang' => array(
15 'xml:lang' => 'LanguageCode',
16 )
17 );
18}
19
20// vim: et sw=4 sts=4