support defer and sanc for added JS files
[php-utility-classes.git] / classes / document.php-class
CommitLineData
cea5b93a 1<?php
880bcb60
RK
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
cea5b93a
RK
5
6class ExtendedDocument extends DOMDocument {
7 // ExtendedDocument PHP class
8 // this extends the general PHP DOM Document class to simplify some usual constructs
9 //
10 // function __construct([$version], [$encoding])
11 // CONSTRUCTOR
12 // construct a new DOM Document that uses our element definitions
13 //
b841a92b 14 // static function initHTML5([$doc])
14014b8f 15 // initialize as an HTML5 document and return references to its basic elements.
b841a92b 16 // If a $doc is handed over (an ExtendedDocument or a derived class), load the content into that document.
14014b8f 17 // returns an associative array with the following elements: 'html', 'head', 'title', 'body'
ae41c41b 18 //
61cc8aa9 19 // public function appendElement($name, [$value])
cea5b93a
RK
20 // appends a DOMDocument::createElement() as a child of this document (see there for params)
21 // returns the new child
22 //
61cc8aa9 23 // public function appendElementXML($name, $xmldata)
cea5b93a
RK
24 // appends a DOMDocument::createElement() with the given name as a child of this document,
25 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
26 // returns the new child
27 //
61cc8aa9 28 // public function appendLink($target, [$value])
cea5b93a
RK
29 // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
30 // returns the new child
31 //
61cc8aa9 32 // public function appendImage($src, [$alt_text])
53510e9e
RK
33 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
34 // returns the new child
35 //
61cc8aa9 36 // public function appendForm($action, $method, $name, [$id])
b8d16837
RK
37 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
38 // returns the new child
39 //
61cc8aa9 40 // public function appendFormDiv($action, $method, $name, [$id])
ae41c41b
RK
41 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
42 // returns an HTML <div> that is a child of the new child
43 //
61cc8aa9 44 // public function appendInputHidden($name, $value)
ae41c41b
RK
45 // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
46 // returns the new child
47 //
61cc8aa9 48 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
ae41c41b
RK
49 // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
50 // returns the new child
51 //
61cc8aa9 52 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
262e0bbb
RK
53 // appends an ExtendedDocument::createElementInputNumber() as a child of this document (see there for params)
54 // returns the new child
55 //
ea32f7e5
RK
56 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
57 // appends an ExtendedDocument::createElementInputEmail() as a child of this document (see there for params)
58 // returns the new child
59 //
61cc8aa9 60 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
645a7eb6
RK
61 // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
62 // returns the new child
63 //
61cc8aa9 64 // public function appendInputRadio($name, $id, $value, $checked)
ae41c41b
RK
65 // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
66 // returns the new child
67 //
61cc8aa9 68 // public function appendInputCheckbox($name, $id, $value, $checked)
ae41c41b
RK
69 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
70 // returns the new child
71 //
61cc8aa9 72 // public function appendInputFile($name, $id, $accept)
4bb9d784
RK
73 // appends an ExtendedDocument::createElementInputFile() as a child of this document (see there for params)
74 // returns the new child
75 //
61cc8aa9 76 // public function appendInputSubmit($value)
ae41c41b
RK
77 // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
78 // returns the new child
79 //
61cc8aa9 80 // public function appendButton($value, $onclick = null)
1109f526
RK
81 // appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
82 // returns the new child
83 //
61cc8aa9 84 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
bf91764c
RK
85 // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
86 // returns the new child
87 //
61cc8aa9 88 // public function appendElementSelect($name, [$id], [$options], [$default])
bf91764c
RK
89 // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
90 // returns the new child
91 //
61cc8aa9 92 // public function appendElementOption($key, $desc, [$selected])
bf91764c
RK
93 // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
94 // returns the new child
95 //
61cc8aa9 96 // public function appendLabel($for_id, $value)
ae41c41b
RK
97 // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
98 // returns the new child
99 //
61cc8aa9 100 // public function appendText($text)
cea5b93a
RK
101 // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
102 // returns the new child
103 //
6638efd5
RK
104 // public function appendEntity($name)
105 // appends a DOMDocument::createEntityReference() as a child of this document (see there for params)
106 // returns the new child
107 //
61cc8aa9 108 // public function appendComment($comment_data)
cadc5980
RK
109 // appends a DOMDocument::createComment() as a child of this document (see there for params)
110 // returns the new child
111 //
61cc8aa9 112 // public function appendHTMLMarkup($htmldata, [$parentNode])
ae41c41b
RK
113 // appends a representation of the HTML data as children of the given parent node, by default this document
114 // NO return value!
115 //
61cc8aa9 116 // public function appendXMLMarkup($xmldata, [$parentNode])
ae41c41b 117 // appends a representation of the XML data as children of the given parent node, by default this document
cea5b93a
RK
118 // NO return value!
119 //
61cc8aa9 120 // public function appendJSElement($jsdata)
cea5b93a
RK
121 // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
122 // NO return value!
123 //
8afa2e61 124 // public function appendJSFile($jsURL, [$defer], [$async])
ea32f7e5
RK
125 // appends an ExtendedDocument::createElementJSFile() as a child of this document (see there for params)
126 // returns the new child
127 //
61cc8aa9 128 // public function createElementLink($target, [$value])
cea5b93a
RK
129 // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
130 //
61cc8aa9 131 // public function createElementImage($src, [$alt_text])
53510e9e
RK
132 // returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
133 //
61cc8aa9 134 // public function createElementForm($action, $method, $name)
ae41c41b
RK
135 // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
136 // with the given action, method, and name
137 //
61cc8aa9 138 // public function createElementInputHidden($name, $value)
ae41c41b
RK
139 // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
140 //
61cc8aa9 141 // public function createElementInputText($name, $maxlength, $size, [$id], [$value])
ae41c41b
RK
142 // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
143 // and optionally id and value
144 //
61cc8aa9 145 // public function createElementInputNumber($name, $maxlength, $size, [$id], [$value])
262e0bbb
RK
146 // returns an ExtendedElement that is an HTML <input> of type 'number' with the given name, maxlength, size,
147 // and optionally id and value
148 //
ea32f7e5
RK
149 // public function createElementInputEmail($name, $maxlength, $size, [$id], [$value])
150 // returns an ExtendedElement that is an HTML <input> of type 'email' with the given name, maxlength, size,
151 // and optionally id and value
152 //
61cc8aa9 153 // public function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
645a7eb6
RK
154 // returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
155 // and optionally id and value
156 //
61cc8aa9 157 // public function createElementInputRadio($name, $id, $value, $checked)
ae41c41b
RK
158 // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
159 // checked state
160 //
61cc8aa9 161 // public function createElementInputCheckbox($name, $id, $value, $checked)
ae41c41b
RK
162 // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
163 // checked state
164 //
61cc8aa9 165 // public function createElementInputFile($name, $id, $accept)
4bb9d784
RK
166 // returns an ExtendedElement that is an HTML <input> of type 'file' with the given name, id and accept
167 //
61cc8aa9 168 // public function createElementInputSubmit($value)
1109f526
RK
169 // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
170 //
61cc8aa9 171 // public function createElementButton($value, $onclick = null)
1109f526 172 // returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
ae41c41b 173 //
61cc8aa9 174 // public function createElementTextArea($name, $columns, $rows, [$id], [$value])
bf91764c
RK
175 // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
176 // and optionally id and value
177 //
61cc8aa9 178 // public function createElementSelect($name, [$id], [$options], [$default])
bf91764c
RK
179 // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
180 // array of options (key => description) and key of the by-default selected entry
181 //
61cc8aa9 182 // public function createElementOption($key, $desc, [$selected])
bf91764c
RK
183 // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
184 // and optionally bool that tells if the entry is selected
185 //
61cc8aa9 186 // public function createElementLabel($for_id, $value)
ae41c41b 187 // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
cea5b93a 188 //
61cc8aa9 189 // public function createElementJS($jsdata)
cea5b93a 190 // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
c1666e91 191 //
8afa2e61 192 // public function createElementJSFile($jsURL, [$defer], [$async])
ea32f7e5 193 // returns an ExtendedElement that is an HTML <script> of JavaScript type linking to the file given by the URL
8afa2e61 194 // $defer and $async are boolean attributes that set if the script should be executed after parsing but before onload, and if it should be loaded asynchronously.
cea5b93a
RK
195
196 function __construct($version = '1.0', $encoding = 'utf-8') {
197 // make sure the default DOMDocument constructor runs
198 parent::__construct($version, $encoding);
199 $this->registerNodeClass('DOMElement', 'ExtendedElement');
bf91764c 200 $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
cea5b93a
RK
201 }
202
b841a92b
RK
203 static function initHTML5($doc = null) {
204 if (is_null($doc)) { $doc = new ExtendedDocument(); }
14014b8f
RK
205 $doc->loadHTML('<!DOCTYPE html><html></html>'); // this seems to be the only way to get the DOCTYPE set properly.
206
207 // Created basic HTML document structure.
208 $root = $doc->getElementsByTagName('html')->item(0);
209 $head = $root->appendElement('head');
210 $title = $head->appendElement('title');
211 $body = $root->appendElement('body');
212
213 return array('document' => $doc,
214 'html' => $root,
215 'head' => $head,
216 'title' => $title,
217 'body' => $body);
218 }
219
61cc8aa9 220 public function appendElement($name, $value = '') {
a8816f43 221 return $this->appendChild($this->createElement($name, $value));
cea5b93a 222 }
61cc8aa9 223 public function appendElementXML($name, $xmldata) {
cea5b93a 224 $aelem = $this->appendChild($this->createElement($name));
ae41c41b
RK
225 $aelem->appendXMLMarkup($xmldata);
226 //$aelem->appendChild($this->createXMLFragment($xmldata));
cea5b93a
RK
227 return $aelem;
228 }
61cc8aa9 229 public function appendLink($target, $value = '') {
cea5b93a
RK
230 return $this->appendChild($this->createElementLink($target, $value));
231 }
61cc8aa9 232 public function appendImage($src, $alt_text = '') {
4aa31782
RK
233 return $this->appendChild($this->createElementImage($src, $alt_text));
234 }
61cc8aa9 235 public function appendForm($action, $method, $name, $id = null) {
b8d16837
RK
236 return $this->appendChild($this->createElementForm($action, $method, $name, $id));
237 }
61cc8aa9 238 public function appendFormDiv($action, $method, $name, $id = null) {
b8d16837 239 $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id));
ae41c41b
RK
240 return $formelem->appendElement('div');
241 }
61cc8aa9 242 public function appendInputHidden($name, $value) {
ae41c41b
RK
243 return $this->appendChild($this->createElementInputHidden($name, $value));
244 }
61cc8aa9 245 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
ae41c41b
RK
246 return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
247 }
61cc8aa9 248 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
262e0bbb
RK
249 return $this->appendChild($this->createElementInputNumber($name, $maxlength, $size, $id, $value));
250 }
ea32f7e5
RK
251 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
252 return $this->appendChild($this->createElementInputEmail($name, $maxlength, $size, $id, $value));
253 }
61cc8aa9 254 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
645a7eb6
RK
255 return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
256 }
61cc8aa9 257 public function appendInputRadio($name, $id, $value, $checked) {
ae41c41b
RK
258 return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
259 }
61cc8aa9 260 public function appendInputCheckbox($name, $id, $value, $checked) {
ae41c41b
RK
261 return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
262 }
61cc8aa9 263 public function appendInputFile($name, $id, $accept) {
4bb9d784
RK
264 return $this->appendChild($this->createElementInputFile($name, $id, $accept));
265 }
61cc8aa9 266 public function appendInputSubmit($value) {
ae41c41b
RK
267 return $this->appendChild($this->createElementInputSubmit($value));
268 }
61cc8aa9 269 public function appendButton($value, $onclick = null) {
1109f526
RK
270 return $this->appendChild($this->createElementButton($value, $onclick));
271 }
61cc8aa9 272 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
bf91764c
RK
273 return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
274 }
61cc8aa9 275 public function appendElementSelect($name, $id = null, $options = array(), $default = null) {
bf91764c
RK
276 return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
277 }
61cc8aa9 278 public function appendElementOption($key, $desc, $selected = false) {
bf91764c
RK
279 return $this->appendChild($this->createElementOption($key, $desc, $selected));
280 }
61cc8aa9 281 public function appendLabel($for_id, $value) {
ae41c41b
RK
282 return $this->appendChild($this->createElementLabel($for_id, $value));
283 }
61cc8aa9 284 public function appendText($text) {
cea5b93a
RK
285 return $this->appendChild($this->createTextNode($text));
286 }
6638efd5
RK
287 public function appendEntity($name) {
288 return $this->appendChild($this->createEntityReference($name));
289 }
61cc8aa9 290 public function appendComment($comment_data) {
cadc5980
RK
291 return $this->appendChild($this->createComment($comment_data));
292 }
61cc8aa9 293 public function appendJSElement($jsdata) {
cea5b93a
RK
294 $this->appendChild($this->createElementJS($jsdata));
295 }
8afa2e61
RK
296 public function appendJSFile($jsdata, $defer = false, $async = false) {
297 return $this->appendChild($this->createElementJSFile($jsdata, $defer, $async));
ea32f7e5 298 }
cea5b93a 299
61cc8aa9 300 public function appendHTMLMarkup($htmldata, $parentNode = null) {
ae41c41b
RK
301 if (is_null($parentNode)) { $parentNode =& $this; }
302 // XXX: just a workaround for now!
303 $parentNode->appendChild($this->createCDATASection($htmldata));
304 }
305
61cc8aa9 306 public function appendXMLMarkup($xmldata, $parentNode = null) {
ae41c41b
RK
307 if (is_null($parentNode)) { $parentNode =& $this; }
308 $tmpdoc = new ExtendedDocument;
309 $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
310 $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
311 $tmpxml .= '<root>'.$xmldata.'</root>';
312 $tmpdoc->loadXML($tmpxml);
313 foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
314 $parentNode->appendChild($this->importNode($child, true));
315 }
cea5b93a
RK
316 }
317
61cc8aa9 318 public function createElement($name, $value = '') {
a8816f43
RK
319 // Adding the $value in DOMDocument's createElement does NOT escape it, so override it and use appendText to support that.
320 $aelem = parent::createElement($name);
321 $aelem->appendText($value);
322 return $aelem;
323 }
324
61cc8aa9 325 public function createElementLink($target, $value = '') {
a8816f43 326 $link = $this->createElement('a', $value);
bf91764c 327 $link->setAttribute('href', $target); // XXX: take care of & etc. in links
cea5b93a
RK
328 return $link;
329 }
330
61cc8aa9 331 public function createElementImage($src, $alt_text = '') {
319cfe8d
RK
332 $img = $this->createElement('img');
333 $img->setAttribute('src', $src);
334 $img->setAttribute('alt', $alt_text);
335 return $img;
4aa31782
RK
336 }
337
61cc8aa9 338 public function createElementForm($action, $method, $name, $id = null) {
ae41c41b
RK
339 $formelem = $this->createElement('form');
340 $formelem->setAttribute('action', $action);
341 $formelem->setAttribute('method', $method);
342 $formelem->setAttribute('name', $name);
b8d16837 343 $formelem->setAttribute('id', $id);
ae41c41b
RK
344 return $formelem;
345 }
346
61cc8aa9 347 public function createElementInputHidden($name, $value) {
ae41c41b
RK
348 $hidden = $this->createElement('input');
349 $hidden->setAttribute('type', 'hidden');
350 $hidden->setAttribute('name', $name);
351 $hidden->setAttribute('value', $value);
352 return $hidden;
353 }
354
61cc8aa9 355 public function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
ae41c41b
RK
356 $txfield = $this->createElement('input');
357 $txfield->setAttribute('type', 'text');
358 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
359 $txfield->setAttribute('name', $name);
360 $txfield->setAttribute('maxlength', $maxlength);
361 $txfield->setAttribute('size', $size);
362 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
363 return $txfield;
364 }
365
61cc8aa9 366 public function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
262e0bbb
RK
367 $txfield = $this->createElement('input');
368 $txfield->setAttribute('type', 'number');
369 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
370 $txfield->setAttribute('name', $name);
371 $txfield->setAttribute('maxlength', $maxlength);
372 $txfield->setAttribute('size', $size);
373 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
374 return $txfield;
375 }
376
ea32f7e5
RK
377 public function createElementInputEmail($name, $maxlength, $size, $id = null, $value = null) {
378 $txfield = $this->createElement('input');
379 $txfield->setAttribute('type', 'email');
380 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
381 $txfield->setAttribute('name', $name);
382 $txfield->setAttribute('maxlength', $maxlength);
383 $txfield->setAttribute('size', $size);
384 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
385 return $txfield;
386 }
387
61cc8aa9 388 public function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
319cfe8d
RK
389 $pwfield = $this->createElement('input');
390 $pwfield->setAttribute('type', 'password');
391 if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
392 $pwfield->setAttribute('name', $name);
393 $pwfield->setAttribute('maxlength', $maxlength);
394 $pwfield->setAttribute('size', $size);
395 if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
396 return $pwfield;
645a7eb6
RK
397 }
398
61cc8aa9 399 public function createElementInputRadio($name, $id, $value, $checked) {
ae41c41b
RK
400 $radio = $this->createElement('input');
401 $radio->setAttribute('type', 'radio');
402 $radio->setAttribute('name', $name);
4bb9d784 403 if (!is_null($id)) { $radio->setAttribute('id', $id); }
ae41c41b
RK
404 $radio->setAttribute('value', $value);
405 if ($checked) { $radio->setAttribute('checked', ''); }
406 return $radio;
407 }
408
61cc8aa9 409 public function createElementInputCheckbox($name, $id, $value, $checked) {
ae41c41b
RK
410 $cbox = $this->createElement('input');
411 $cbox->setAttribute('type', 'checkbox');
412 $cbox->setAttribute('name', $name);
4bb9d784 413 if (!is_null($id)) { $cbox->setAttribute('id', $id); }
ae41c41b
RK
414 $cbox->setAttribute('value', $value);
415 if ($checked) { $cbox->setAttribute('checked', ''); }
416 return $cbox;
417 }
418
61cc8aa9 419 public function createElementInputFile($name, $id, $accept) {
4bb9d784
RK
420 $fileinput = $this->createElement('input');
421 $fileinput->setAttribute('type', 'file');
422 $fileinput->setAttribute('name', $name);
423 if (!is_null($id)) { $fileinput->setAttribute('id', $id); }
424 $fileinput->setAttribute('accept', $accept);
425 return $fileinput;
426 }
427
61cc8aa9 428 public function createElementInputSubmit($value) {
ae41c41b
RK
429 $submitbtn = $this->createElement('input');
430 $submitbtn->setAttribute('type', 'submit');
431 $submitbtn->setAttribute('value', $value);
432 return $submitbtn;
433 }
434
61cc8aa9 435 public function createElementButton($value, $onclick = null) {
1109f526
RK
436 $btn = $this->createElement('input');
437 $btn->setAttribute('type', 'button');
438 $btn->setAttribute('value', $value);
439 if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
440 return $btn;
441 }
442
61cc8aa9 443 public function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
bf91764c
RK
444 $txtarea = $this->createElement('textarea', $value);
445 $txtarea->setAttribute('name', $name);
446 $txtarea->setAttribute('cols', $columns);
447 $txtarea->setAttribute('rows', $rows);
448 if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
449 return $txtarea;
450 }
451
61cc8aa9 452 public function createElementSelect($name, $id = null, $options = array(), $default = null) {
bf91764c
RK
453 $select = $this->createElement('select');
454 $select->setAttribute('name', $name);
455 if (!is_null($id)) { $select->setAttribute('id', $id); }
456 foreach ($options as $key => $desc) {
457 $select->appendElementOption($key, $desc, ($key == $default));
458 }
459 return $select;
460 }
461
61cc8aa9 462 public function createElementOption($key, $desc, $selected = false) {
bf91764c
RK
463 $option = $this->createElement('option', $desc);
464 $option->setAttribute('value', $key);
465 if ($selected) { $option->setAttribute('selected', ''); }
466 return $option;
467 }
468
61cc8aa9 469 public function createElementLabel($for_id, $value) {
ae41c41b
RK
470 $label = $this->createElement('label', $value);
471 $label->setAttribute('for', $for_id);
472 return $label;
cea5b93a
RK
473 }
474
61cc8aa9 475 public function createElementJS($jsdata) {
cea5b93a 476 $jselem = $this->createElement('script');
ea32f7e5 477 // Note: type can/should be left out for HTML5.
cea5b93a
RK
478 $jselem->setAttribute('type', 'text/javascript');
479 $jselem->appendChild($this->createCDATASection($jsdata));
480 return $jselem;
481 }
c1666e91 482
8afa2e61 483 public function createElementJSFile($jsURL, $defer = false, $async = false) {
ea32f7e5
RK
484 $jselem = $this->createElement('script');
485 // Note: type can/should be left out for HTML5.
486 $jselem->setAttribute('type', 'text/javascript');
8afa2e61
RK
487 if ($defer) {
488 $jselem->setAttribute('defer', '');
489 }
490 if ($async) {
491 $jselem->setAttribute('async', '');
492 }
ea32f7e5
RK
493 $jselem->setAttribute('src', $jsURL);
494 return $jselem;
495 }
cea5b93a
RK
496}
497
498class ExtendedElement extends DOMElement {
499 // ExtendedElement PHP class
500 // this extends the general PHP DOM Element class to simplify some usual constructs
501 //
61cc8aa9 502 // public function appendElement($name, [$value])
cea5b93a
RK
503 // appends a DOMDocument::createElement() as a child of this element (see there for params)
504 // returns the new child
505 //
61cc8aa9 506 // public function appendElementXML($name, $xmldata)
cea5b93a
RK
507 // appends a DOMDocument::createElement() with the given name as a child of this element,
508 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
509 // returns the new child
510 //
61cc8aa9 511 // public function appendLink($target, [$value])
cea5b93a
RK
512 // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
513 // returns the new child
514 //
61cc8aa9 515 // public function appendImage($src, [$alt_text])
53510e9e
RK
516 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
517 // returns the new child
518 //
61cc8aa9 519 // public function appendForm($action, $method, $name, [$id])
b8d16837
RK
520 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
521 // returns the new child
522 //
61cc8aa9 523 // public function appendFormDiv($action, $method, $name, [$id])
ae41c41b
RK
524 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
525 // returns an HTML <div> that is a child of the new child
526 //
61cc8aa9 527 // public function appendInputHidden($name, $value)
ae41c41b
RK
528 // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
529 // returns the new child
530 //
61cc8aa9 531 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
ae41c41b
RK
532 // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
533 // returns the new child
534 //
61cc8aa9 535 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
262e0bbb
RK
536 // appends an ExtendedDocument::createElementInputNumber() as a child of this element (see there for params)
537 // returns the new child
538 //
ea32f7e5
RK
539 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
540 // appends an ExtendedDocument::createElementInputEmail() as a child of this element (see there for params)
541 // returns the new child
542 //
61cc8aa9 543 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
645a7eb6
RK
544 // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
545 // returns the new child
546 //
61cc8aa9 547 // public function appendInputRadio($name, $id, $value, $checked)
ae41c41b
RK
548 // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
549 // returns the new child
550 //
61cc8aa9 551 // public function appendInputCheckbox($name, $id, $value, $checked)
ae41c41b
RK
552 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
553 // returns the new child
554 //
61cc8aa9 555 // public function appendInputFile($name, $id, $accept)
4bb9d784
RK
556 // appends an ExtendedDocument::createElementInputFile() as a child of this element (see there for params)
557 // returns the new child
558 //
61cc8aa9 559 // public function appendInputSubmit($value)
ae41c41b
RK
560 // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
561 // returns the new child
562 //
61cc8aa9 563 // public function appendButton($value, $onclick = null)
1109f526
RK
564 // appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
565 // returns the new child
566 //
61cc8aa9 567 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
bf91764c
RK
568 // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
569 // returns the new child
570 //
61cc8aa9 571 // public function appendElementSelect($name, [$id], [$options], [$default])
bf91764c
RK
572 // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
573 // returns the new child
574 //
61cc8aa9 575 // public function appendElementOption($key, $desc, [$selected])
bf91764c
RK
576 // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
577 // returns the new child
578 //
61cc8aa9 579 // public function appendLabel($for_id, $value)
ae41c41b
RK
580 // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
581 // returns the new child
582 //
61cc8aa9 583 // public function appendText($text)
cea5b93a
RK
584 // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
585 // returns the new child
586 //
6638efd5
RK
587 // public function appendEntity($name)
588 // appends a DOMDocument::createEntityReference() as a child of this element (see there for params)
589 // returns the new child
590 //
61cc8aa9 591 // public function appendComment($comment_data)
cadc5980
RK
592 // appends a DOMDocument::createComment() as a child of this element (see there for params)
593 // returns the new child
594 //
61cc8aa9 595 // public function appendHTMLMarkup($htmldata)
ae41c41b
RK
596 // appends a representation of the HTML data as children of this element
597 // NO return value!
598 //
61cc8aa9 599 // public function appendXMLMarkup($xmldata)
ae41c41b 600 // appends a representation of the XML data as children of this element
cea5b93a
RK
601 // NO return value!
602 //
61cc8aa9 603 // public function appendJSElement($jsdata)
cea5b93a
RK
604 // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
605 // NO return value!
c1666e91 606 //
8afa2e61 607 // public function appendJSFile($jsURL, [$defer], [$async])
0bbc241e 608 // appends an ExtendedDocument::createElementJSFile() as a child of this element (see there for params)
ea32f7e5 609 // returns the new child
cea5b93a 610
61cc8aa9 611 public function appendElement($name, $value = '') {
a8816f43 612 return $this->appendChild($this->ownerDocument->createElement($name, $value));
cea5b93a 613 }
61cc8aa9 614 public function appendElementXML($name, $xmldata) {
cea5b93a 615 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
ae41c41b 616 $aelem->appendXMLMarkup($xmldata);
cea5b93a
RK
617 return $aelem;
618 }
61cc8aa9 619 public function appendLink($target, $value = '') {
cea5b93a
RK
620 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
621 }
61cc8aa9 622 public function appendImage($src, $alt_text = '') {
53510e9e
RK
623 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
624 }
61cc8aa9 625 public function appendForm($action, $method, $name, $id = null) {
b8d16837
RK
626 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
627 }
61cc8aa9 628 public function appendFormDiv($action, $method, $name, $id = null) {
b8d16837 629 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
ae41c41b
RK
630 return $formelem->appendElement('div');
631 }
61cc8aa9 632 public function appendInputHidden($name, $value) {
ae41c41b
RK
633 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
634 }
61cc8aa9 635 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
ae41c41b
RK
636 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
637 }
61cc8aa9 638 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
262e0bbb
RK
639 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
640 }
ea32f7e5
RK
641 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
642 return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
643 }
61cc8aa9 644 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
645a7eb6
RK
645 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
646 }
61cc8aa9 647 public function appendInputRadio($name, $id, $value, $checked) {
ae41c41b
RK
648 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
649 }
61cc8aa9 650 public function appendInputCheckbox($name, $id, $value, $checked) {
ae41c41b
RK
651 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
652 }
61cc8aa9 653 public function appendInputFile($name, $id, $accept) {
4bb9d784
RK
654 return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
655 }
61cc8aa9 656 public function appendInputSubmit($value) {
ae41c41b
RK
657 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
658 }
61cc8aa9 659 public function appendButton($value, $onclick = null) {
1109f526
RK
660 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
661 }
61cc8aa9 662 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
bf91764c
RK
663 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
664 }
61cc8aa9 665 public function appendElementSelect($name, $id = null, $options = array(), $default = null) {
bf91764c
RK
666 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
667 }
61cc8aa9 668 public function appendElementOption($key, $desc, $selected = false) {
bf91764c
RK
669 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
670 }
61cc8aa9 671 public function appendLabel($for_id, $value) {
bf91764c
RK
672 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
673 }
61cc8aa9 674 public function appendText($text) {
bf91764c
RK
675 return $this->appendChild($this->ownerDocument->createTextNode($text));
676 }
6638efd5
RK
677 public function appendEntity($name) {
678 return $this->appendChild($this->ownerDocument->createEntityReference($name));
679 }
61cc8aa9 680 public function appendComment($comment_data) {
cadc5980
RK
681 return $this->appendChild($this->ownerDocument->createComment($comment_data));
682 }
61cc8aa9 683 public function appendHTMLMarkup($htmldata) {
bf91764c
RK
684 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
685 }
61cc8aa9 686 public function appendXMLMarkup($xmldata) {
bf91764c
RK
687 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
688 }
61cc8aa9 689 public function appendJSElement($jsdata) {
bf91764c
RK
690 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
691 }
8afa2e61
RK
692 public function appendJSFile($jsdata, $defer = false, $async = false) {
693 return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));
ea32f7e5 694 }
bf91764c
RK
695}
696
697class ExtendedDocumentFragment extends DOMDocumentFragment {
698 // ExtendedDocumentFragment PHP class
699 // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
700 //
61cc8aa9 701 // public function appendElement($name, [$value])
bf91764c
RK
702 // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
703 // returns the new child
704 //
61cc8aa9 705 // public function appendElementXML($name, $xmldata)
bf91764c
RK
706 // appends a DOMDocument::createElement() with the given name as a child of this fragment,
707 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
708 // returns the new child
709 //
61cc8aa9 710 // public function appendLink($target, [$value])
bf91764c
RK
711 // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
712 // returns the new child
713 //
61cc8aa9 714 // public function appendImage($src, [$alt_text])
53510e9e
RK
715 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
716 // returns the new child
717 //
61cc8aa9 718 // public function appendForm($action, $method, $name, [$id])
b8d16837
RK
719 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
720 // returns the new child
721 //
61cc8aa9 722 // public function appendFormDiv($action, $method, $name, [$id])
bf91764c
RK
723 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
724 // returns an HTML <div> that is a child of the new child
725 //
61cc8aa9 726 // public function appendInputHidden($name, $value)
bf91764c
RK
727 // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
728 // returns the new child
729 //
61cc8aa9 730 // public function appendInputText($name, $maxlength, $size, [$id], [$value])
bf91764c
RK
731 // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
732 // returns the new child
733 //
61cc8aa9 734 // public function appendInputNumber($name, $maxlength, $size, [$id], [$value])
262e0bbb
RK
735 // appends an ExtendedDocument::createElementInputNumber() as a child of this fragment (see there for params)
736 // returns the new child
737 //
ea32f7e5
RK
738 // public function appendInputEmail($name, $maxlength, $size, [$id], [$value])
739 // appends an ExtendedDocument::createElementInputEmail() as a child of this fragment (see there for params)
740 // returns the new child
741 //
61cc8aa9 742 // public function appendInputPassword($name, $maxlength, $size, [$id], [$value])
645a7eb6
RK
743 // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
744 // returns the new child
745 //
61cc8aa9 746 // public function appendInputRadio($name, $id, $value, $checked)
bf91764c
RK
747 // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
748 // returns the new child
749 //
61cc8aa9 750 // public function appendInputCheckbox($name, $id, $value, $checked)
bf91764c
RK
751 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
752 // returns the new child
753 //
61cc8aa9 754 // public function appendInputFile($name, $id, $accept)
4bb9d784
RK
755 // appends an ExtendedDocument::createElementInputFile() as a child of this fragment (see there for params)
756 // returns the new child
757 //
61cc8aa9 758 // public function appendInputSubmit($value)
bf91764c
RK
759 // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
760 // returns the new child
761 //
61cc8aa9 762 // public function appendButton($value, $onclick = null)
1109f526
RK
763 // appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
764 // returns the new child
765 //
61cc8aa9 766 // public function appendTextArea($name, $columns, $rows, [$id], [$value])
bf91764c
RK
767 // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
768 // returns the new child
769 //
61cc8aa9 770 // public function appendElementSelect($name, [$id], [$options], [$default])
bf91764c
RK
771 // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
772 // returns the new child
773 //
61cc8aa9 774 // public function appendElementOption($key, $desc, [$selected])
bf91764c
RK
775 // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
776 // returns the new child
777 //
61cc8aa9 778 // public function appendLabel($for_id, $value)
bf91764c
RK
779 // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
780 // returns the new child
781 //
61cc8aa9 782 // public function appendText($text)
bf91764c
RK
783 // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
784 // returns the new child
785 //
6638efd5
RK
786 // public function appendEntity($name)
787 // appends a DOMDocument::createEntityReference() as a child of this fragment (see there for params)
788 // returns the new child
789 //
61cc8aa9 790 // public function appendComment($comment_data)
cadc5980
RK
791 // appends a DOMDocument::createComment() as a child of this fragment (see there for params)
792 // returns the new child
793 //
61cc8aa9 794 // public function appendHTMLMarkup($htmldata)
bf91764c
RK
795 // appends a representation of the HTML data as children of this fragment
796 // NO return value!
797 //
61cc8aa9 798 // public function appendXMLMarkup($xmldata)
bf91764c
RK
799 // appends a representation of the XML data as children of this fragment
800 // NO return value!
801 //
61cc8aa9 802 // public function appendJSElement($jsdata)
bf91764c
RK
803 // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
804 // NO return value!
c1666e91 805 //
8afa2e61 806 // public function appendJSFile($jsURL, [$defer], [$async])
0bbc241e 807 // appends an ExtendedDocument::createElementJSFile() as a child of this fragment (see there for params)
ea32f7e5 808 // returns the new child
bf91764c 809
61cc8aa9 810 public function appendElement($name, $value = '') {
a8816f43 811 return $this->appendChild($this->ownerDocument->createElement($name, $value));
bf91764c 812 }
61cc8aa9 813 public function appendElementXML($name, $xmldata) {
bf91764c
RK
814 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
815 $aelem->appendXMLMarkup($xmldata);
816 return $aelem;
817 }
61cc8aa9 818 public function appendLink($target, $value = '') {
bf91764c
RK
819 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
820 }
61cc8aa9 821 public function appendImage($src, $alt_text = '') {
53510e9e
RK
822 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
823 }
61cc8aa9 824 public function appendForm($action, $method, $name, $id = null) {
b8d16837
RK
825 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
826 }
61cc8aa9 827 public function appendFormDiv($action, $method, $name, $id = null) {
b8d16837 828 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
bf91764c
RK
829 return $formelem->appendElement('div');
830 }
61cc8aa9 831 public function appendInputHidden($name, $value) {
bf91764c
RK
832 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
833 }
61cc8aa9 834 public function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
bf91764c 835 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
645a7eb6 836 }
61cc8aa9 837 public function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
262e0bbb
RK
838 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
839 }
ea32f7e5
RK
840 public function appendInputEmail($name, $maxlength, $size, $id = null, $value = null) {
841 return $this->appendChild($this->ownerDocument->createElementInputEmail($name, $maxlength, $size, $id, $value));
842 }
61cc8aa9 843 public function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
645a7eb6 844 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
bf91764c 845 }
61cc8aa9 846 public function appendInputRadio($name, $id, $value, $checked) {
bf91764c
RK
847 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
848 }
61cc8aa9 849 public function appendInputCheckbox($name, $id, $value, $checked) {
bf91764c
RK
850 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
851 }
61cc8aa9 852 public function appendInputFile($name, $id, $accept) {
4bb9d784
RK
853 return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
854 }
61cc8aa9 855 public function appendInputSubmit($value) {
bf91764c
RK
856 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
857 }
61cc8aa9 858 public function appendButton($value, $onclick = null) {
1109f526
RK
859 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
860 }
61cc8aa9 861 public function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
bf91764c
RK
862 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
863 }
61cc8aa9 864 public function appendElementSelect($name, $id = null, $options = array(), $default = null) {
bf91764c
RK
865 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
866 }
61cc8aa9 867 public function appendElementOption($key, $desc, $selected = false) {
bf91764c
RK
868 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
869 }
61cc8aa9 870 public function appendLabel($for_id, $value) {
ae41c41b
RK
871 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
872 }
61cc8aa9 873 public function appendText($text) {
cea5b93a
RK
874 return $this->appendChild($this->ownerDocument->createTextNode($text));
875 }
6638efd5
RK
876 public function appendEntity($name) {
877 return $this->appendChild($this->ownerDocument->createEntityReference($name));
878 }
61cc8aa9 879 public function appendComment($comment_data) {
cadc5980
RK
880 return $this->appendChild($this->ownerDocument->createComment($comment_data));
881 }
61cc8aa9 882 public function appendHTMLMarkup($htmldata) {
ae41c41b
RK
883 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
884 }
61cc8aa9 885 public function appendXMLMarkup($xmldata) {
ae41c41b 886 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
cea5b93a 887 }
61cc8aa9 888 public function appendJSElement($jsdata) {
cea5b93a
RK
889 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
890 }
8afa2e61
RK
891 public function appendJSFile($jsdata, $defer = false, $async = false) {
892 return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async));
ea32f7e5 893 }
cea5b93a
RK
894}
895?>