3 class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule_Tidy
9 public function makeFixes()
13 // == deprecated tag transforms ===================================
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;');
23 // == deprecated attribute transforms =============================
26 new HTMLPurifier_AttrTransform_EnumToCSS(
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
40 // @align for img -------------------------------------------------
42 new HTMLPurifier_AttrTransform_EnumToCSS(
45 'left' => 'float:left;',
46 'right' => 'float:right;',
47 'top' => 'vertical-align:top;',
48 'middle' => 'vertical-align:middle;',
49 'bottom' => 'vertical-align:baseline;',
53 // @align for table -----------------------------------------------
55 new HTMLPurifier_AttrTransform_EnumToCSS(
58 'left' => 'float:left;',
59 'center' => 'margin-left:auto;margin-right:auto;',
60 'right' => 'float:right;'
64 // @align for hr -----------------------------------------------
66 new HTMLPurifier_AttrTransform_EnumToCSS(
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
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;'
79 // @align for h1, h2, h3, h4, h5, h6, p, div ----------------------
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;";
95 new HTMLPurifier_AttrTransform_EnumToCSS('align', $align_lookup);
97 // @bgcolor for table, tr, td, th ---------------------------------
102 new HTMLPurifier_AttrTransform_BgColor();
104 // @border for img ------------------------------------------------
105 $r['img@border'] = new HTMLPurifier_AttrTransform_Border();
107 // @clear for br --------------------------------------------------
109 new HTMLPurifier_AttrTransform_EnumToCSS(
112 'left' => 'clear:left;',
113 'right' => 'clear:right;',
114 'all' => 'clear:both;',
115 'none' => 'clear:none;',
119 // @height for td, th ---------------------------------------------
122 new HTMLPurifier_AttrTransform_Length('height');
124 // @hspace for img ------------------------------------------------
125 $r['img@hspace'] = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
127 // @noshade for hr ------------------------------------------------
128 // this transformation is not precise but often good enough.
129 // different browsers use different styles to designate noshade
131 new HTMLPurifier_AttrTransform_BoolToCSS(
133 'color:#808080;background-color:#808080;border:0;'
136 // @nowrap for td, th ---------------------------------------------
139 new HTMLPurifier_AttrTransform_BoolToCSS(
141 'white-space:nowrap;'
144 // @size for hr --------------------------------------------------
145 $r['hr@size'] = new HTMLPurifier_AttrTransform_Length('size', 'height');
147 // @type for li, ol, ul -------------------------------------------
150 'disc' => 'list-style-type:disc;',
151 'square' => 'list-style-type:square;',
152 'circle' => 'list-style-type:circle;'
155 '1' => 'list-style-type:decimal;',
156 'i' => 'list-style-type:lower-roman;',
157 'I' => 'list-style-type:upper-roman;',
158 'a' => 'list-style-type:lower-alpha;',
159 'A' => 'list-style-type:upper-alpha;'
161 $li_types = $ul_types + $ol_types;
164 $r['ul@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ul_types);
165 $r['ol@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ol_types, true);
166 $r['li@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $li_types, true);
168 // @vspace for img ------------------------------------------------
169 $r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
171 // @width for hr, td, th ------------------------------------------
174 $r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
180 // vim: et sw=4 sts=4