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 appendInputPassword($name, $maxlength, $size, [$id], [$value])
70 // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
71 // returns the new child
73 // function appendInputRadio($name, $id, $value, $checked)
74 // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
75 // returns the new child
77 // function appendInputCheckbox($name, $id, $value, $checked)
78 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
79 // returns the new child
81 // function appendInputSubmit($value)
82 // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
83 // returns the new child
85 // function appendButton($value, $onclick = null)
86 // appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
87 // returns the new child
89 // function appendTextArea($name, $columns, $rows, [$id], [$value])
90 // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
91 // returns the new child
93 // function appendElementSelect($name, [$id], [$options], [$default])
94 // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
95 // returns the new child
97 // function appendElementOption($key, $desc, [$selected])
98 // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
99 // returns the new child
101 // function appendLabel($for_id, $value)
102 // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
103 // returns the new child
105 // function appendText($text)
106 // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
107 // returns the new child
109 // function appendComment($comment_data)
110 // appends a DOMDocument::createComment() as a child of this document (see there for params)
111 // returns the new child
113 // function appendHTMLMarkup($htmldata, [$parentNode])
114 // appends a representation of the HTML data as children of the given parent node, by default this document
117 // function appendXMLMarkup($xmldata, [$parentNode])
118 // appends a representation of the XML data as children of the given parent node, by default this document
121 // function appendJSElement($jsdata)
122 // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
125 // function appendCOMElement($module, $attributes)
126 // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
127 // returns the new child
129 // function createElementLink($target, [$value])
130 // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
132 // function createElementImage($src, [$alt_text])
133 // returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
135 // function createElementForm($action, $method, $name)
136 // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
137 // with the given action, method, and name
139 // function createElementInputHidden($name, $value)
140 // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
142 // function createElementInputText($name, $maxlength, $size, [$id], [$value])
143 // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
144 // and optionally id and value
146 // function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
147 // returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
148 // and optionally id and value
150 // function createElementInputRadio($name, $id, $value, $checked)
151 // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
154 // function createElementInputCheckbox($name, $id, $value, $checked)
155 // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
158 // function createElementInputSubmit($value)
159 // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
161 // function createElementButton($value, $onclick = null)
162 // returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
164 // function createElementTextArea($name, $columns, $rows, [$id], [$value])
165 // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
166 // and optionally id and value
168 // function createElementSelect($name, [$id], [$options], [$default])
169 // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
170 // array of options (key => description) and key of the by-default selected entry
172 // function createElementOption($key, $desc, [$selected])
173 // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
174 // and optionally bool that tells if the entry is selected
176 // function createElementLabel($for_id, $value)
177 // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
179 // function createElementJS($jsdata)
180 // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
182 // function createCOMElement($module, $attributes)
183 // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
184 // given name=>value array as attributes
186 function __construct($version = '1.0', $encoding = 'utf-8') {
187 // make sure the default DOMDocument constructor runs
188 parent::__construct($version, $encoding);
189 $this->registerNodeClass('DOMElement', 'ExtendedElement');
190 $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
193 function appendElement($name, $value = '') {
194 // Adding the $value in createElement does NOT escape it, so use appendText to support that.
195 $aelem = $this->appendChild($this->createElement($name));
196 $aelem->appendText($value);
199 function appendElementXML($name, $xmldata) {
200 $aelem = $this->appendChild($this->createElement($name));
201 $aelem->appendXMLMarkup($xmldata);
202 //$aelem->appendChild($this->createXMLFragment($xmldata));
205 function appendLink($target, $value = '') {
206 return $this->appendChild($this->createElementLink($target, $value));
208 function appendImage($src, $alt_text = '') {
209 return $this->appendChild($this->createElementImage($src, $alt_text));
211 function appendForm($action, $method, $name, $id = null) {
212 return $this->appendChild($this->createElementForm($action, $method, $name, $id));
214 function appendFormDiv($action, $method, $name, $id = null) {
215 $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id));
216 return $formelem->appendElement('div');
218 function appendInputHidden($name, $value) {
219 return $this->appendChild($this->createElementInputHidden($name, $value));
221 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
222 return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
224 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
225 return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
227 function appendInputRadio($name, $id, $value, $checked) {
228 return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
230 function appendInputCheckbox($name, $id, $value, $checked) {
231 return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
233 function appendInputSubmit($value) {
234 return $this->appendChild($this->createElementInputSubmit($value));
236 function appendButton($value, $onclick = null) {
237 return $this->appendChild($this->createElementButton($value, $onclick));
239 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
240 return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
242 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
243 return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
245 function appendElementOption($key, $desc, $selected = false) {
246 return $this->appendChild($this->createElementOption($key, $desc, $selected));
248 function appendLabel($for_id, $value) {
249 return $this->appendChild($this->createElementLabel($for_id, $value));
251 function appendText($text) {
252 return $this->appendChild($this->createTextNode($text));
254 function appendComment($comment_data) {
255 return $this->appendChild($this->createComment($comment_data));
257 function appendJSElement($jsdata) {
258 $this->appendChild($this->createElementJS($jsdata));
260 function appendCOMElement($module, $attributes) {
261 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
264 function appendHTMLMarkup($htmldata, $parentNode = null) {
265 if (is_null($parentNode)) { $parentNode =& $this; }
266 // XXX: just a workaround for now!
267 $parentNode->appendChild($this->createCDATASection($htmldata));
270 function appendXMLMarkup($xmldata, $parentNode = null) {
271 if (is_null($parentNode)) { $parentNode =& $this; }
272 $tmpdoc = new ExtendedDocument;
273 $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
274 $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
275 $tmpxml .= '<root>'.$xmldata.'</root>';
276 $tmpdoc->loadXML($tmpxml);
277 foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
278 $parentNode->appendChild($this->importNode($child, true));
282 function createElementLink($target, $value = '') {
283 $link = $this->createElement('a');
284 $link->appendText($value);
285 $link->setAttribute('href', $target); // XXX: take care of & etc. in links
289 function createElementImage($src, $alt_text = '') {
290 $img = $this->createElement('img');
291 $img->setAttribute('src', $src);
292 $img->setAttribute('alt', $alt_text);
296 function createElementForm($action, $method, $name, $id = null) {
297 $formelem = $this->createElement('form');
298 $formelem->setAttribute('action', $action);
299 $formelem->setAttribute('method', $method);
300 $formelem->setAttribute('name', $name);
301 $formelem->setAttribute('id', $id);
305 function createElementInputHidden($name, $value) {
306 $hidden = $this->createElement('input');
307 $hidden->setAttribute('type', 'hidden');
308 $hidden->setAttribute('name', $name);
309 $hidden->setAttribute('value', $value);
313 function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
314 $txfield = $this->createElement('input');
315 $txfield->setAttribute('type', 'text');
316 if (!is_null($id)) { $txfield->setAttribute('id', $id); }
317 $txfield->setAttribute('name', $name);
318 $txfield->setAttribute('maxlength', $maxlength);
319 $txfield->setAttribute('size', $size);
320 if (!is_null($value)) { $txfield->setAttribute('value', $value); }
324 function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
325 $pwfield = $this->createElement('input');
326 $pwfield->setAttribute('type', 'password');
327 if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
328 $pwfield->setAttribute('name', $name);
329 $pwfield->setAttribute('maxlength', $maxlength);
330 $pwfield->setAttribute('size', $size);
331 if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
335 function createElementInputRadio($name, $id, $value, $checked) {
336 $radio = $this->createElement('input');
337 $radio->setAttribute('type', 'radio');
338 $radio->setAttribute('name', $name);
339 $radio->setAttribute('id', $id);
340 $radio->setAttribute('value', $value);
341 if ($checked) { $radio->setAttribute('checked', ''); }
345 function createElementInputCheckbox($name, $id, $value, $checked) {
346 $cbox = $this->createElement('input');
347 $cbox->setAttribute('type', 'checkbox');
348 $cbox->setAttribute('name', $name);
349 $cbox->setAttribute('id', $id);
350 $cbox->setAttribute('value', $value);
351 if ($checked) { $cbox->setAttribute('checked', ''); }
355 function createElementInputSubmit($value) {
356 $submitbtn = $this->createElement('input');
357 $submitbtn->setAttribute('type', 'submit');
358 $submitbtn->setAttribute('value', $value);
362 function createElementButton($value, $onclick = null) {
363 $btn = $this->createElement('input');
364 $btn->setAttribute('type', 'button');
365 $btn->setAttribute('value', $value);
366 if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
370 function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
371 $txtarea = $this->createElement('textarea', $value);
372 $txtarea->setAttribute('name', $name);
373 $txtarea->setAttribute('cols', $columns);
374 $txtarea->setAttribute('rows', $rows);
375 if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
379 function createElementSelect($name, $id = null, $options = array(), $default = null) {
380 $select = $this->createElement('select');
381 $select->setAttribute('name', $name);
382 if (!is_null($id)) { $select->setAttribute('id', $id); }
383 foreach ($options as $key => $desc) {
384 $select->appendElementOption($key, $desc, ($key == $default));
389 function createElementOption($key, $desc, $selected = false) {
390 $option = $this->createElement('option', $desc);
391 $option->setAttribute('value', $key);
392 if ($selected) { $option->setAttribute('selected', ''); }
396 function createElementLabel($for_id, $value) {
397 $label = $this->createElement('label', $value);
398 $label->setAttribute('for', $for_id);
402 function createElementJS($jsdata) {
403 $jselem = $this->createElement('script');
404 $jselem->setAttribute('type', 'text/javascript');
405 $jselem->appendChild($this->createCDATASection($jsdata));
409 function createCOMElement($module, $attributes) {
410 $com_elem = $this->createElementNS(COM_NS, $module);
411 if (is_array($attributes) && count($attributes)) {
412 foreach ($attributes as $name=>$value) {
413 $com_elem->setAttribute($name, $value);
420 class ExtendedElement extends DOMElement {
421 // ExtendedElement PHP class
422 // this extends the general PHP DOM Element class to simplify some usual constructs
424 // function appendElement($name, [$value])
425 // appends a DOMDocument::createElement() as a child of this element (see there for params)
426 // returns the new child
428 // function appendElementXML($name, $xmldata)
429 // appends a DOMDocument::createElement() with the given name as a child of this element,
430 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
431 // returns the new child
433 // function appendLink($target, [$value])
434 // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
435 // returns the new child
437 // function appendImage($src, [$alt_text])
438 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
439 // returns the new child
441 // function appendForm($action, $method, $name, [$id])
442 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
443 // returns the new child
445 // function appendFormDiv($action, $method, $name, [$id])
446 // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
447 // returns an HTML <div> that is a child of the new child
449 // function appendInputHidden($name, $value)
450 // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
451 // returns the new child
453 // function appendInputText($name, $maxlength, $size, [$id], [$value])
454 // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
455 // returns the new child
457 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
458 // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
459 // returns the new child
461 // function appendInputRadio($name, $id, $value, $checked)
462 // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
463 // returns the new child
465 // function appendInputCheckbox($name, $id, $value, $checked)
466 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
467 // returns the new child
469 // function appendInputSubmit($value)
470 // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
471 // returns the new child
473 // function appendButton($value, $onclick = null)
474 // appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
475 // returns the new child
477 // function appendTextArea($name, $columns, $rows, [$id], [$value])
478 // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
479 // returns the new child
481 // function appendElementSelect($name, [$id], [$options], [$default])
482 // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
483 // returns the new child
485 // function appendElementOption($key, $desc, [$selected])
486 // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
487 // returns the new child
489 // function appendLabel($for_id, $value)
490 // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
491 // returns the new child
493 // function appendText($text)
494 // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
495 // returns the new child
497 // function appendComment($comment_data)
498 // appends a DOMDocument::createComment() as a child of this element (see there for params)
499 // returns the new child
501 // function appendHTMLMarkup($htmldata)
502 // appends a representation of the HTML data as children of this element
505 // function appendXMLMarkup($xmldata)
506 // appends a representation of the XML data as children of this element
509 // function appendJSElement($jsdata)
510 // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
513 // function appendCOMElement($module, $attributes)
514 // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
515 // returns the new child
517 function appendElement($name, $value = '') {
518 // Adding the $value in createElement does NOT escape it, so use appendText to support that.
519 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
520 $aelem->appendText($value);
523 function appendElementXML($name, $xmldata) {
524 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
525 $aelem->appendXMLMarkup($xmldata);
528 function appendLink($target, $value = '') {
529 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
531 function appendImage($src, $alt_text = '') {
532 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
534 function appendForm($action, $method, $name, $id = null) {
535 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
537 function appendFormDiv($action, $method, $name, $id = null) {
538 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
539 return $formelem->appendElement('div');
541 function appendInputHidden($name, $value) {
542 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
544 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
545 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
547 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
548 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
550 function appendInputRadio($name, $id, $value, $checked) {
551 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
553 function appendInputCheckbox($name, $id, $value, $checked) {
554 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
556 function appendInputSubmit($value) {
557 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
559 function appendButton($value, $onclick = null) {
560 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
562 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
563 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
565 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
566 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
568 function appendElementOption($key, $desc, $selected = false) {
569 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
571 function appendLabel($for_id, $value) {
572 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
574 function appendText($text) {
575 return $this->appendChild($this->ownerDocument->createTextNode($text));
577 function appendComment($comment_data) {
578 return $this->appendChild($this->ownerDocument->createComment($comment_data));
580 function appendHTMLMarkup($htmldata) {
581 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
583 function appendXMLMarkup($xmldata) {
584 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
586 function appendJSElement($jsdata) {
587 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
589 function appendCOMElement($module, $attributes) {
590 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
594 class ExtendedDocumentFragment extends DOMDocumentFragment {
595 // ExtendedDocumentFragment PHP class
596 // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
598 // function appendElement($name, [$value])
599 // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
600 // returns the new child
602 // function appendElementXML($name, $xmldata)
603 // appends a DOMDocument::createElement() with the given name as a child of this fragment,
604 // with an ExtendedDocument::createXMLFragment() of the given XML data inside
605 // returns the new child
607 // function appendLink($target, [$value])
608 // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
609 // returns the new child
611 // function appendImage($src, [$alt_text])
612 // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
613 // returns the new child
615 // function appendForm($action, $method, $name, [$id])
616 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
617 // returns the new child
619 // function appendFormDiv($action, $method, $name, [$id])
620 // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
621 // returns an HTML <div> that is a child of the new child
623 // function appendInputHidden($name, $value)
624 // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
625 // returns the new child
627 // function appendInputText($name, $maxlength, $size, [$id], [$value])
628 // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
629 // returns the new child
631 // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
632 // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
633 // returns the new child
635 // function appendInputRadio($name, $id, $value, $checked)
636 // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
637 // returns the new child
639 // function appendInputCheckbox($name, $id, $value, $checked)
640 // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
641 // returns the new child
643 // function appendInputSubmit($value)
644 // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
645 // returns the new child
647 // function appendButton($value, $onclick = null)
648 // appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
649 // returns the new child
651 // function appendTextArea($name, $columns, $rows, [$id], [$value])
652 // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
653 // returns the new child
655 // function appendElementSelect($name, [$id], [$options], [$default])
656 // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
657 // returns the new child
659 // function appendElementOption($key, $desc, [$selected])
660 // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
661 // returns the new child
663 // function appendLabel($for_id, $value)
664 // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
665 // returns the new child
667 // function appendText($text)
668 // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
669 // returns the new child
671 // function appendComment($comment_data)
672 // appends a DOMDocument::createComment() as a child of this fragment (see there for params)
673 // returns the new child
675 // function appendHTMLMarkup($htmldata)
676 // appends a representation of the HTML data as children of this fragment
679 // function appendXMLMarkup($xmldata)
680 // appends a representation of the XML data as children of this fragment
683 // function appendJSElement($jsdata)
684 // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
687 // function appendCOMElement($module, $attributes)
688 // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
689 // returns the new child
691 function appendElement($name, $value = '') {
692 // Adding the $value in createElement does NOT escape it, so use appendText to support that.
693 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
694 $aelem->appendText($value);
697 function appendElementXML($name, $xmldata) {
698 $aelem = $this->appendChild($this->ownerDocument->createElement($name));
699 $aelem->appendXMLMarkup($xmldata);
702 function appendLink($target, $value = '') {
703 return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
705 function appendImage($src, $alt_text = '') {
706 return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
708 function appendForm($action, $method, $name, $id = null) {
709 return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
711 function appendFormDiv($action, $method, $name, $id = null) {
712 $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
713 return $formelem->appendElement('div');
715 function appendInputHidden($name, $value) {
716 return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
718 function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
719 return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
721 function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
722 return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
724 function appendInputRadio($name, $id, $value, $checked) {
725 return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
727 function appendInputCheckbox($name, $id, $value, $checked) {
728 return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
730 function appendInputSubmit($value) {
731 return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
733 function appendButton($value, $onclick = null) {
734 return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
736 function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
737 return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
739 function appendElementSelect($name, $id = null, $options = array(), $default = null) {
740 return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
742 function appendElementOption($key, $desc, $selected = false) {
743 return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
745 function appendLabel($for_id, $value) {
746 return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
748 function appendText($text) {
749 return $this->appendChild($this->ownerDocument->createTextNode($text));
751 function appendComment($comment_data) {
752 return $this->appendChild($this->ownerDocument->createComment($comment_data));
754 function appendHTMLMarkup($htmldata) {
755 $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
757 function appendXMLMarkup($xmldata) {
758 $this->ownerDocument->appendXMLMarkup($xmldata, $this);
760 function appendJSElement($jsdata) {
761 $this->appendChild($this->ownerDocument->createElementJS($jsdata));
763 function appendCOMElement($module, $attributes) {
764 $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));