2 /* ***** BEGIN LICENSE BLOCK *****
4 * The contents of this file are subject to Austrian copyright reegulations
5 * ("Urheberrecht"); you may not use this file except in compliance with
7 * This contents and any derived work, if it gets distributed in any way,
8 * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
9 * either express or implied.
11 * The Original Code is KaiRo's extended DOM document classes.
13 * The Initial Developer of the Original Code is
14 * KaiRo - Robert Kaiser.
15 * Portions created by the Initial Developer are Copyright (C) 2010
16 * the Initial Developer. All Rights Reserved.
18 * Contributor(s): Robert Kaiser <kairo@kairo.at>
20 * ***** END LICENSE BLOCK ***** */
22 class ExtendedDocument extends DOMDocument {
23 // ExtendedDocument PHP class
24 // this extends the general PHP DOM Document class to simplify some usual constructs
26 // function __construct([$version], [$encoding])
28 // construct a new DOM Document that uses our element definitions
31 // the default XML header
33 // private $xhtmldtype
34 // the XHTML doctype to use by default
36 // function appendElement($name, [$value])
37 // appends a DOMDocument::createElement() as a child of this document (see there for params)
38 // returns the new child
40 // function appendElementXML($name, $xmldata)
41 // appends a DOMDocument::createElement() with the given name as a child of this document,
42 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
43 // returns the new child
45 // function appendLink($target, [$value])
46 // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
47 // returns the new child
49 // function appendImage($src, [$alt_text])
50 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
51 // returns the new child
53 // function appendForm($action, $method, $name, [$id])
54 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
55 // returns the new child
57 // function appendFormDiv($action, $method, $name, [$id])
58 // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
59 // returns an HTML <div> that is a child of the new child
61 // function appendInputHidden($name, $value)
62 // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
63 // returns the new child
65 // function appendInputText($name, $maxlength, $size, [$id], [$value])
66 // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
67 // returns the new child
69 // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
70 // appends an ExtendedDocument::createElementInputNumber() as a child of this document (see there for params)
71 // returns the new child
73 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
74 // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
75 // returns the new child
77 // function appendInputRadio($name, $id, $value, $checked)
78 // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
79 // returns the new child
81 // function appendInputCheckbox($name, $id, $value, $checked)
82 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
83 // returns the new child
85 // function appendInputSubmit($value)
86 // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
87 // returns the new child
89 // function appendButton($value, $onclick = null)
90 // appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
91 // returns the new child
93 // function appendTextArea($name, $columns, $rows, [$id], [$value])
94 // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
95 // returns the new child
97 // function appendElementSelect($name, [$id], [$options], [$default])
98 // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
99 // returns the new child
101 // function appendElementOption($key, $desc, [$selected])
102 // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
103 // returns the new child
105 // function appendLabel($for_id, $value)
106 // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
107 // returns the new child
109 // function appendText($text)
110 // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
111 // returns the new child
113 // function appendComment($comment_data)
114 // appends a DOMDocument::createComment() as a child of this document (see there for params)
115 // returns the new child
117 // function appendHTMLMarkup($htmldata, [$parentNode])
118 // appends a representation of the HTML data as children of the given parent node, by default this document
121 // function appendXMLMarkup($xmldata, [$parentNode])
122 // appends a representation of the XML data as children of the given parent node, by default this document
125 // function appendJSElement($jsdata)
126 // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
129 // function appendCOMElement($module, $attributes)
130 // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
131 // returns the new child
133 // function createElementLink($target, [$value])
134 // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
136 // function createElementImage($src, [$alt_text])
137 // returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
139 // function createElementForm($action, $method, $name)
140 // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
141 // with the given action, method, and name
143 // function createElementInputHidden($name, $value)
144 // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
146 // function createElementInputText($name, $maxlength, $size, [$id], [$value])
147 // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
148 // and optionally id and value
150 // function createElementInputNumber($name, $maxlength, $size, [$id], [$value])
151 // returns an ExtendedElement that is an HTML <input> of type 'number' with the given name, maxlength, size,
152 // and optionally id and value
154 // function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
155 // returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
156 // and optionally id and value
158 // function createElementInputRadio($name, $id, $value, $checked)
159 // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
162 // function createElementInputCheckbox($name, $id, $value, $checked)
163 // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
166 // function createElementInputSubmit($value)
167 // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
169 // function createElementButton($value, $onclick = null)
170 // returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
172 // function createElementTextArea($name, $columns, $rows, [$id], [$value])
173 // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
174 // and optionally id and value
176 // function createElementSelect($name, [$id], [$options], [$default])
177 // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
178 // array of options (key => description) and key of the by-default selected entry
180 // function createElementOption($key, $desc, [$selected])
181 // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
182 // and optionally bool that tells if the entry is selected
184 // function createElementLabel($for_id, $value)
185 // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
187 // function createElementJS($jsdata)
188 // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
190 // function createCOMElement($module, $attributes)
191 // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
192 // given name=>value array as attributes
194 function __construct($version = '1.0', $encoding = 'utf-8') {
195 // make sure the default DOMDocument constructor runs
196 parent::__construct($version, $encoding);
197 $this->registerNodeClass('DOMElement', 'ExtendedElement');
198 $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
201 function appendElement($name, $value = '') {
202 return $this->appendChild($this->createElement($name, $value));
204 function appendElementXML($name, $xmldata) {
205 $aelem = $this->appendChild($this->createElement($name));
206 $aelem->appendXMLMarkup($xmldata);
207 //$aelem->appendChild($this->createXMLFragment($xmldata));
210 function appendLink($target, $value = '') {
211 return $this->appendChild($this->createElementLink($target, $value));
213 function appendImage($src, $alt_text = '') {
214 return $this->appendChild($this->createElementImage($src, $alt_text));
216 function appendForm($action, $method, $name, $id = null) {
217 return $this->appendChild($this->createElementForm($action, $method, $name, $id));
219 function appendFormDiv($action, $method, $name, $id = null) {
220 $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id));
221 return $formelem->appendElement('div');
223 function appendInputHidden($name, $value) {
224 return $this->appendChild($this->createElementInputHidden($name, $value));
226 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
227 return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
229 function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
230 return $this->appendChild($this->createElementInputNumber($name, $maxlength, $size, $id, $value));
232 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
233 return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
235 function appendInputRadio($name, $id, $value, $checked) {
236 return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
238 function appendInputCheckbox($name, $id, $value, $checked) {
239 return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
241 function appendInputSubmit($value) {
242 return $this->appendChild($this->createElementInputSubmit($value));
244 function appendButton($value, $onclick = null) {
245 return $this->appendChild($this->createElementButton($value, $onclick));
247 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
248 return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
250 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
251 return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
253 function appendElementOption($key, $desc, $selected = false) {
254 return $this->appendChild($this->createElementOption($key, $desc, $selected));
256 function appendLabel($for_id, $value) {
257 return $this->appendChild($this->createElementLabel($for_id, $value));
259 function appendText($text) {
260 return $this->appendChild($this->createTextNode($text));
262 function appendComment($comment_data) {
263 return $this->appendChild($this->createComment($comment_data));
265 function appendJSElement($jsdata) {
266 $this->appendChild($this->createElementJS($jsdata));
268 function appendCOMElement($module, $attributes) {
269 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
272 function appendHTMLMarkup($htmldata, $parentNode = null) {
273 if (is_null($parentNode)) { $parentNode =& $this; }
274 // XXX: just a workaround for now!
275 $parentNode->appendChild($this->createCDATASection($htmldata));
278 function appendXMLMarkup($xmldata, $parentNode = null) {
279 if (is_null($parentNode)) { $parentNode =& $this; }
280 $tmpdoc = new ExtendedDocument;
281 $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
282 $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
283 $tmpxml .= '<root>'.$xmldata.'</root>';
284 $tmpdoc->loadXML($tmpxml);
285 foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
286 $parentNode->appendChild($this->importNode($child, true));
290 function createElement($name, $value = '') {
291 // Adding the $value in DOMDocument's createElement does NOT escape it, so override it and use appendText to support that.
292 $aelem = parent::createElement($name);
293 $aelem->appendText($value);
297 function createElementLink($target, $value = '') {
298 $link = $this->createElement('a', $value);
299 $link->setAttribute('href', $target); // XXX: take care of & etc. in links
303 function createElementImage($src, $alt_text = '') {
304 $img = $this->createElement('img');
305 $img->setAttribute('src', $src);
306 $img->setAttribute('alt', $alt_text);
310 function createElementForm($action, $method, $name, $id = null) {
311 $formelem = $this->createElement('form');
312 $formelem->setAttribute('action', $action);
313 $formelem->setAttribute('method', $method);
314 $formelem->setAttribute('name', $name);
315 $formelem->setAttribute('id', $id);
319 function createElementInputHidden($name, $value) {
320 $hidden = $this->createElement('input');
321 $hidden->setAttribute('type', 'hidden');
322 $hidden->setAttribute('name', $name);
323 $hidden->setAttribute('value', $value);
327 function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
328 $txfield = $this->createElement('input');
329 $txfield->setAttribute('type', 'text');
330 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
331 $txfield->setAttribute('name', $name);
332 $txfield->setAttribute('maxlength', $maxlength);
333 $txfield->setAttribute('size', $size);
334 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
338 function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
339 $txfield = $this->createElement('input');
340 $txfield->setAttribute('type', 'number');
341 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
342 $txfield->setAttribute('name', $name);
343 $txfield->setAttribute('maxlength', $maxlength);
344 $txfield->setAttribute('size', $size);
345 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
349 function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
350 $pwfield = $this->createElement('input');
351 $pwfield->setAttribute('type', 'password');
352 if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
353 $pwfield->setAttribute('name', $name);
354 $pwfield->setAttribute('maxlength', $maxlength);
355 $pwfield->setAttribute('size', $size);
356 if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
360 function createElementInputRadio($name, $id, $value, $checked) {
361 $radio = $this->createElement('input');
362 $radio->setAttribute('type', 'radio');
363 $radio->setAttribute('name', $name);
364 $radio->setAttribute('id', $id);
365 $radio->setAttribute('value', $value);
366 if ($checked) { $radio->setAttribute('checked', ''); }
370 function createElementInputCheckbox($name, $id, $value, $checked) {
371 $cbox = $this->createElement('input');
372 $cbox->setAttribute('type', 'checkbox');
373 $cbox->setAttribute('name', $name);
374 $cbox->setAttribute('id', $id);
375 $cbox->setAttribute('value', $value);
376 if ($checked) { $cbox->setAttribute('checked', ''); }
380 function createElementInputSubmit($value) {
381 $submitbtn = $this->createElement('input');
382 $submitbtn->setAttribute('type', 'submit');
383 $submitbtn->setAttribute('value', $value);
387 function createElementButton($value, $onclick = null) {
388 $btn = $this->createElement('input');
389 $btn->setAttribute('type', 'button');
390 $btn->setAttribute('value', $value);
391 if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
395 function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
396 $txtarea = $this->createElement('textarea', $value);
397 $txtarea->setAttribute('name', $name);
398 $txtarea->setAttribute('cols', $columns);
399 $txtarea->setAttribute('rows', $rows);
400 if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
404 function createElementSelect($name, $id = null, $options = array(), $default = null) {
405 $select = $this->createElement('select');
406 $select->setAttribute('name', $name);
407 if (!is_null($id)) { $select->setAttribute('id', $id); }
408 foreach ($options as $key => $desc) {
409 $select->appendElementOption($key, $desc, ($key == $default));
414 function createElementOption($key, $desc, $selected = false) {
415 $option = $this->createElement('option', $desc);
416 $option->setAttribute('value', $key);
417 if ($selected) { $option->setAttribute('selected', ''); }
421 function createElementLabel($for_id, $value) {
422 $label = $this->createElement('label', $value);
423 $label->setAttribute('for', $for_id);
427 function createElementJS($jsdata) {
428 $jselem = $this->createElement('script');
429 $jselem->setAttribute('type', 'text/javascript');
430 $jselem->appendChild($this->createCDATASection($jsdata));
434 function createCOMElement($module, $attributes) {
435 $com_elem = $this->createElementNS(COM_NS, $module);
436 if (is_array($attributes) && count($attributes)) {
437 foreach ($attributes as $name=>$value) {
438 $com_elem->setAttribute($name, $value);
445 class ExtendedElement extends DOMElement {
446 // ExtendedElement PHP class
447 // this extends the general PHP DOM Element class to simplify some usual constructs
449 // function appendElement($name, [$value])
450 // appends a DOMDocument::createElement() as a child of this element (see there for params)
451 // returns the new child
453 // function appendElementXML($name, $xmldata)
454 // appends a DOMDocument::createElement() with the given name as a child of this element,
455 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
456 // returns the new child
458 // function appendLink($target, [$value])
459 // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
460 // returns the new child
462 // function appendImage($src, [$alt_text])
463 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
464 // returns the new child
466 // function appendForm($action, $method, $name, [$id])
467 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
468 // returns the new child
470 // function appendFormDiv($action, $method, $name, [$id])
471 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
472 // returns an HTML <div> that is a child of the new child
474 // function appendInputHidden($name, $value)
475 // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
476 // returns the new child
478 // function appendInputText($name, $maxlength, $size, [$id], [$value])
479 // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
480 // returns the new child
482 // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
483 // appends an ExtendedDocument::createElementInputNumber() as a child of this element (see there for params)
484 // returns the new child
486 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
487 // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
488 // returns the new child
490 // function appendInputRadio($name, $id, $value, $checked)
491 // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
492 // returns the new child
494 // function appendInputCheckbox($name, $id, $value, $checked)
495 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
496 // returns the new child
498 // function appendInputSubmit($value)
499 // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
500 // returns the new child
502 // function appendButton($value, $onclick = null)
503 // appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
504 // returns the new child
506 // function appendTextArea($name, $columns, $rows, [$id], [$value])
507 // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
508 // returns the new child
510 // function appendElementSelect($name, [$id], [$options], [$default])
511 // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
512 // returns the new child
514 // function appendElementOption($key, $desc, [$selected])
515 // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
516 // returns the new child
518 // function appendLabel($for_id, $value)
519 // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
520 // returns the new child
522 // function appendText($text)
523 // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
524 // returns the new child
526 // function appendComment($comment_data)
527 // appends a DOMDocument::createComment() as a child of this element (see there for params)
528 // returns the new child
530 // function appendHTMLMarkup($htmldata)
531 // appends a representation of the HTML data as children of this element
534 // function appendXMLMarkup($xmldata)
535 // appends a representation of the XML data as children of this element
538 // function appendJSElement($jsdata)
539 // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
542 // function appendCOMElement($module, $attributes)
543 // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
544 // returns the new child
546 function appendElement($name, $value = '') {
547 return $this->appendChild($this->ownerDocument->createElement($name, $value));
549 function appendElementXML($name, $xmldata) {
550 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
551 $aelem->appendXMLMarkup($xmldata);
554 function appendLink($target, $value = '') {
555 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
557 function appendImage($src, $alt_text = '') {
558 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
560 function appendForm($action, $method, $name, $id = null) {
561 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
563 function appendFormDiv($action, $method, $name, $id = null) {
564 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
565 return $formelem->appendElement('div');
567 function appendInputHidden($name, $value) {
568 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
570 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
571 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
573 function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
574 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
576 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
577 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
579 function appendInputRadio($name, $id, $value, $checked) {
580 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
582 function appendInputCheckbox($name, $id, $value, $checked) {
583 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
585 function appendInputSubmit($value) {
586 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
588 function appendButton($value, $onclick = null) {
589 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
591 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
592 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
594 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
595 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
597 function appendElementOption($key, $desc, $selected = false) {
598 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
600 function appendLabel($for_id, $value) {
601 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
603 function appendText($text) {
604 return $this->appendChild($this->ownerDocument->createTextNode($text));
606 function appendComment($comment_data) {
607 return $this->appendChild($this->ownerDocument->createComment($comment_data));
609 function appendHTMLMarkup($htmldata) {
610 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
612 function appendXMLMarkup($xmldata) {
613 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
615 function appendJSElement($jsdata) {
616 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
618 function appendCOMElement($module, $attributes) {
619 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
623 class ExtendedDocumentFragment extends DOMDocumentFragment {
624 // ExtendedDocumentFragment PHP class
625 // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
627 // function appendElement($name, [$value])
628 // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
629 // returns the new child
631 // function appendElementXML($name, $xmldata)
632 // appends a DOMDocument::createElement() with the given name as a child of this fragment,
633 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
634 // returns the new child
636 // function appendLink($target, [$value])
637 // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
638 // returns the new child
640 // function appendImage($src, [$alt_text])
641 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
642 // returns the new child
644 // function appendForm($action, $method, $name, [$id])
645 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
646 // returns the new child
648 // function appendFormDiv($action, $method, $name, [$id])
649 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
650 // returns an HTML <div> that is a child of the new child
652 // function appendInputHidden($name, $value)
653 // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
654 // returns the new child
656 // function appendInputText($name, $maxlength, $size, [$id], [$value])
657 // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
658 // returns the new child
660 // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
661 // appends an ExtendedDocument::createElementInputNumber() as a child of this fragment (see there for params)
662 // returns the new child
664 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
665 // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
666 // returns the new child
668 // function appendInputRadio($name, $id, $value, $checked)
669 // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
670 // returns the new child
672 // function appendInputCheckbox($name, $id, $value, $checked)
673 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
674 // returns the new child
676 // function appendInputSubmit($value)
677 // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
678 // returns the new child
680 // function appendButton($value, $onclick = null)
681 // appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
682 // returns the new child
684 // function appendTextArea($name, $columns, $rows, [$id], [$value])
685 // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
686 // returns the new child
688 // function appendElementSelect($name, [$id], [$options], [$default])
689 // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
690 // returns the new child
692 // function appendElementOption($key, $desc, [$selected])
693 // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
694 // returns the new child
696 // function appendLabel($for_id, $value)
697 // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
698 // returns the new child
700 // function appendText($text)
701 // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
702 // returns the new child
704 // function appendComment($comment_data)
705 // appends a DOMDocument::createComment() as a child of this fragment (see there for params)
706 // returns the new child
708 // function appendHTMLMarkup($htmldata)
709 // appends a representation of the HTML data as children of this fragment
712 // function appendXMLMarkup($xmldata)
713 // appends a representation of the XML data as children of this fragment
716 // function appendJSElement($jsdata)
717 // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
720 // function appendCOMElement($module, $attributes)
721 // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
722 // returns the new child
724 function appendElement($name, $value = '') {
725 return $this->appendChild($this->ownerDocument->createElement($name, $value));
727 function appendElementXML($name, $xmldata) {
728 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
729 $aelem->appendXMLMarkup($xmldata);
732 function appendLink($target, $value = '') {
733 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
735 function appendImage($src, $alt_text = '') {
736 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
738 function appendForm($action, $method, $name, $id = null) {
739 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
741 function appendFormDiv($action, $method, $name, $id = null) {
742 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
743 return $formelem->appendElement('div');
745 function appendInputHidden($name, $value) {
746 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
748 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
749 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
751 function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
752 return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
754 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
755 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
757 function appendInputRadio($name, $id, $value, $checked) {
758 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
760 function appendInputCheckbox($name, $id, $value, $checked) {
761 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
763 function appendInputSubmit($value) {
764 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
766 function appendButton($value, $onclick = null) {
767 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
769 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
770 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
772 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
773 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
775 function appendElementOption($key, $desc, $selected = false) {
776 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
778 function appendLabel($for_id, $value) {
779 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
781 function appendText($text) {
782 return $this->appendChild($this->ownerDocument->createTextNode($text));
784 function appendComment($comment_data) {
785 return $this->appendChild($this->ownerDocument->createComment($comment_data));
787 function appendHTMLMarkup($htmldata) {
788 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
790 function appendXMLMarkup($xmldata) {
791 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
793 function appendJSElement($jsdata) {
794 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
796 function appendCOMElement($module, $attributes) {
797 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));