Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / HTMLModule / Legacy.php
blobf702b581549379f405c625d17c7a202a693d9e91
1 <?php
3 require_once 'HTMLPurifier/AttrDef/HTML/Bool.php';
5 /**
6 * XHTML 1.1 Legacy module defines elements that were previously
7 * deprecated.
8 *
9 * @note Not all legacy elements have been implemented yet, which
10 * is a bit of a reverse problem as compared to browsers! In
11 * addition, this legacy module may implement a bit more than
12 * mandated by XHTML 1.1.
14 * This module can be used in combination with TransformToStrict in order
15 * to transform as many deprecated elements as possible, but retain
16 * questionably deprecated elements that do not have good alternatives
17 * as well as transform elements that don't have an implementation.
18 * See docs/ref-strictness.txt for more details.
21 class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
24 // incomplete
26 var $name = 'Legacy';
28 function HTMLPurifier_HTMLModule_Legacy() {
30 $this->addElement('basefont', true, 'Inline', 'Empty', false, array(
31 'color' => 'Color',
32 'face' => 'Text', // extremely broad, we should
33 'size' => 'Text', // tighten it
34 'id' => 'ID'
35 ));
36 $this->addElement('center', true, 'Block', 'Flow', 'Common');
37 $this->addElement('dir', true, 'Block', 'Required: li', 'Common', array(
38 'compact' => 'Bool#compact'
39 ));
40 $this->addElement('font', true, 'Inline', 'Inline', array('Core', 'I18N'), array(
41 'color' => 'Color',
42 'face' => 'Text', // extremely broad, we should
43 'size' => 'Text', // tighten it
44 ));
45 $this->addElement('menu', true, 'Block', 'Required: li', 'Common', array(
46 'compact' => 'Bool#compact'
47 ));
48 $this->addElement('s', true, 'Inline', 'Inline', 'Common');
49 $this->addElement('strike', true, 'Inline', 'Inline', 'Common');
50 $this->addElement('u', true, 'Inline', 'Inline', 'Common');
52 // setup modifications to old elements
54 $align = 'Enum#left,right,center,justify';
56 $address =& $this->addBlankElement('address');
57 $address->content_model = 'Inline | #PCDATA | p';
58 $address->content_model_type = 'optional';
59 $address->child = false;
61 $blockquote =& $this->addBlankElement('blockquote');
62 $blockquote->content_model = 'Flow | #PCDATA';
63 $blockquote->content_model_type = 'optional';
64 $blockquote->child = false;
66 $br =& $this->addBlankElement('br');
67 $br->attr['clear'] = 'Enum#left,all,right,none';
69 $caption =& $this->addBlankElement('caption');
70 $caption->attr['align'] = 'Enum#top,bottom,left,right';
72 $div =& $this->addBlankElement('div');
73 $div->attr['align'] = $align;
75 $dl =& $this->addBlankElement('dl');
76 $dl->attr['compact'] = 'Bool#compact';
78 for ($i = 1; $i <= 6; $i++) {
79 $h =& $this->addBlankElement("h$i");
80 $h->attr['align'] = $align;
83 $hr =& $this->addBlankElement('hr');
84 $hr->attr['align'] = $align;
85 $hr->attr['noshade'] = 'Bool#noshade';
86 $hr->attr['size'] = 'Pixels';
87 $hr->attr['width'] = 'Length';
89 $img =& $this->addBlankElement('img');
90 $img->attr['align'] = 'Enum#top,middle,bottom,left,right';
91 $img->attr['border'] = 'Pixels';
92 $img->attr['hspace'] = 'Pixels';
93 $img->attr['vspace'] = 'Pixels';
95 // figure out this integer business
97 $li =& $this->addBlankElement('li');
98 $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
99 $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle';
101 $ol =& $this->addBlankElement('ol');
102 $ol->attr['compact'] = 'Bool#compact';
103 $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
104 $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
106 $p =& $this->addBlankElement('p');
107 $p->attr['align'] = $align;
109 $pre =& $this->addBlankElement('pre');
110 $pre->attr['width'] = 'Number';
112 // script omitted
114 $table =& $this->addBlankElement('table');
115 $table->attr['align'] = 'Enum#left,center,right';
116 $table->attr['bgcolor'] = 'Color';
118 $tr =& $this->addBlankElement('tr');
119 $tr->attr['bgcolor'] = 'Color';
121 $th =& $this->addBlankElement('th');
122 $th->attr['bgcolor'] = 'Color';
123 $th->attr['height'] = 'Length';
124 $th->attr['nowrap'] = 'Bool#nowrap';
125 $th->attr['width'] = 'Length';
127 $td =& $this->addBlankElement('td');
128 $td->attr['bgcolor'] = 'Color';
129 $td->attr['height'] = 'Length';
130 $td->attr['nowrap'] = 'Bool#nowrap';
131 $td->attr['width'] = 'Length';
133 $ul =& $this->addBlankElement('ul');
134 $ul->attr['compact'] = 'Bool#compact';
135 $ul->attr['type'] = 'Enum#square,disc,circle';