HTMLPurifier/HTMLModule/Legacy.php Quellcode

Legacy.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
20 {
24  public $name = 'Legacy';
25 
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




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.