root/afridex/plugins/Flutter/purifier_lib/HTMLPurifier/HTMLModule/Legacy.php

Revision 21, 4.9 kB (checked in by admin, 18 years ago)
Line 
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    public $name = 'Legacy';
23   
24    public function __construct() {
25       
26        $this->addElement('basefont', 'Inline', 'Empty', false, array(
27            'color' => 'Color',
28            'face' => 'Text', // extremely broad, we should
29            'size' => 'Text', // tighten it
30            'id' => 'ID'
31        ));
32        $this->addElement('center', 'Block', 'Flow', 'Common');
33        $this->addElement('dir', 'Block', 'Required: li', 'Common', array(
34            'compact' => 'Bool#compact'
35        ));
36        $this->addElement('font', 'Inline', 'Inline', array('Core', 'I18N'), array(
37            'color' => 'Color',
38            'face' => 'Text', // extremely broad, we should
39            'size' => 'Text', // tighten it
40        ));
41        $this->addElement('menu', 'Block', 'Required: li', 'Common', array(
42            'compact' => 'Bool#compact'
43        ));
44        $this->addElement('s', 'Inline', 'Inline', 'Common');
45        $this->addElement('strike', 'Inline', 'Inline', 'Common');
46        $this->addElement('u', 'Inline', 'Inline', 'Common');
47       
48        // setup modifications to old elements
49       
50        $align = 'Enum#left,right,center,justify';
51       
52        $address = $this->addBlankElement('address');
53        $address->content_model = 'Inline | #PCDATA | p';
54        $address->content_model_type = 'optional';
55        $address->child = false;
56       
57        $blockquote = $this->addBlankElement('blockquote');
58        $blockquote->content_model = 'Flow | #PCDATA';
59        $blockquote->content_model_type = 'optional';
60        $blockquote->child = false;
61       
62        $br = $this->addBlankElement('br');
63        $br->attr['clear'] = 'Enum#left,all,right,none';
64       
65        $caption = $this->addBlankElement('caption');
66        $caption->attr['align'] = 'Enum#top,bottom,left,right';
67       
68        $div = $this->addBlankElement('div');
69        $div->attr['align'] = $align;
70       
71        $dl = $this->addBlankElement('dl');
72        $dl->attr['compact'] = 'Bool#compact';
73       
74        for ($i = 1; $i <= 6; $i++) {
75            $h = $this->addBlankElement("h$i");
76            $h->attr['align'] = $align;
77        }
78       
79        $hr = $this->addBlankElement('hr');
80        $hr->attr['align'] = $align;
81        $hr->attr['noshade'] = 'Bool#noshade';
82        $hr->attr['size'] = 'Pixels';
83        $hr->attr['width'] = 'Length';
84       
85        $img = $this->addBlankElement('img');
86        $img->attr['align'] = 'Enum#top,middle,bottom,left,right';
87        $img->attr['border'] = 'Pixels';
88        $img->attr['hspace'] = 'Pixels';
89        $img->attr['vspace'] = 'Pixels';
90       
91        // figure out this integer business
92       
93        $li = $this->addBlankElement('li');
94        $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
95        $li->attr['type']  = 'Enum#s:1,i,I,a,A,disc,square,circle';
96       
97        $ol = $this->addBlankElement('ol');
98        $ol->attr['compact'] = 'Bool#compact';
99        $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
100        $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
101       
102        $p = $this->addBlankElement('p');
103        $p->attr['align'] = $align;
104       
105        $pre = $this->addBlankElement('pre');
106        $pre->attr['width'] = 'Number';
107       
108        // script omitted
109       
110        $table = $this->addBlankElement('table');
111        $table->attr['align'] = 'Enum#left,center,right';
112        $table->attr['bgcolor'] = 'Color';
113       
114        $tr = $this->addBlankElement('tr');
115        $tr->attr['bgcolor'] = 'Color';
116       
117        $th = $this->addBlankElement('th');
118        $th->attr['bgcolor'] = 'Color';
119        $th->attr['height'] = 'Length';
120        $th->attr['nowrap'] = 'Bool#nowrap';
121        $th->attr['width'] = 'Length';
122       
123        $td = $this->addBlankElement('td');
124        $td->attr['bgcolor'] = 'Color';
125        $td->attr['height'] = 'Length';
126        $td->attr['nowrap'] = 'Bool#nowrap';
127        $td->attr['width'] = 'Length';
128       
129        $ul = $this->addBlankElement('ul');
130        $ul->attr['compact'] = 'Bool#compact';
131        $ul->attr['type'] = 'Enum#square,disc,circle';
132       
133    }
134   
135}
136
Note: See TracBrowser for help on using the browser.