X-Git-Url: https://git-public.kairo.at/?a=blobdiff_plain;ds=sidebyside;f=include%2Fcbsm%2Futil%2Fdocument.php-class;h=6a36dfc704987e24c8bb5ea5bb9b120cd12c0b03;hb=6e698a41c5017150623531a9f2d6ec3baceda9c2;hp=257d52bcbcda23848532fbba679ba071a6d78e27;hpb=1109f526885e1e23ab52321ddb941dda14eb5f2f;p=php-utility-classes.git
diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class
index 257d52b..6a36dfc 100755
--- a/include/cbsm/util/document.php-class
+++ b/include/cbsm/util/document.php-class
@@ -62,6 +62,10 @@ class ExtendedDocument extends DOMDocument {
// appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
// returns the new child
//
+ // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
+ // returns the new child
+ //
// function appendInputRadio($name, $id, $value, $checked)
// appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
// returns the new child
@@ -135,6 +139,10 @@ class ExtendedDocument extends DOMDocument {
// returns an ExtendedElement that is an HTML of type 'text' with the given name, maxlength, size,
// and optionally id and value
//
+ // function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
+ // returns an ExtendedElement that is an HTML of type 'password' with the given name, maxlength, size,
+ // and optionally id and value
+ //
// function createElementInputRadio($name, $id, $value, $checked)
// returns an ExtendedElement that is an HTML of type 'radio' with the given name, id, value and
// checked state
@@ -179,7 +187,10 @@ class ExtendedDocument extends DOMDocument {
}
function appendElement($name, $value = '') {
- return $this->appendChild($this->createElement($name, $value));
+ // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+ $aelem = $this->appendChild($this->createElement($name));
+ $aelem->appendText($value);
+ return $aelem;
}
function appendElementXML($name, $xmldata) {
$aelem = $this->appendChild($this->createElement($name));
@@ -203,6 +214,9 @@ class ExtendedDocument extends DOMDocument {
function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
}
+ function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
+ }
function appendInputRadio($name, $id, $value, $checked) {
return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
}
@@ -259,16 +273,17 @@ class ExtendedDocument extends DOMDocument {
}
function createElementLink($target, $value = '') {
- $link = $this->createElement('a', $value);
+ $link = $this->createElement('a');
+ $link->appendText($value);
$link->setAttribute('href', $target); // XXX: take care of & etc. in links
return $link;
}
function createElementImage($src, $alt_text = '') {
- $link = $this->createElement('img');
- $link->setAttribute('src', $src);
- $link->setAttribute('alt', $alt_text);
- return $link;
+ $img = $this->createElement('img');
+ $img->setAttribute('src', $src);
+ $img->setAttribute('alt', $alt_text);
+ return $img;
}
function createElementForm($action, $method, $name) {
@@ -298,6 +313,17 @@ class ExtendedDocument extends DOMDocument {
return $txfield;
}
+ function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+ $pwfield = $this->createElement('input');
+ $pwfield->setAttribute('type', 'password');
+ if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
+ $pwfield->setAttribute('name', $name);
+ $pwfield->setAttribute('maxlength', $maxlength);
+ $pwfield->setAttribute('size', $size);
+ if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
+ return $pwfield;
+ }
+
function createElementInputRadio($name, $id, $value, $checked) {
$radio = $this->createElement('input');
$radio->setAttribute('type', 'radio');
@@ -416,6 +442,10 @@ class ExtendedElement extends DOMElement {
// appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
// returns the new child
//
+ // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
+ // returns the new child
+ //
// function appendInputRadio($name, $id, $value, $checked)
// appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
// returns the new child
@@ -473,7 +503,10 @@ class ExtendedElement extends DOMElement {
// returns the new child
function appendElement($name, $value = '') {
- return $this->appendChild($this->ownerDocument->createElement($name, $value));
+ // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+ $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+ $aelem->appendText($value);
+ return $aelem;
}
function appendElementXML($name, $xmldata) {
$aelem = $this->appendChild($this->ownerDocument->createElement($name));
@@ -496,6 +529,9 @@ class ExtendedElement extends DOMElement {
function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
}
+ function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+ }
function appendInputRadio($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
}
@@ -573,6 +609,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
// returns the new child
//
+ // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
+ // returns the new child
+ //
// function appendInputRadio($name, $id, $value, $checked)
// appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
// returns the new child
@@ -630,7 +670,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
// returns the new child
function appendElement($name, $value = '') {
- return $this->appendChild($this->ownerDocument->createElement($name, $value));
+ // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+ $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+ $aelem->appendText($value);
+ return $aelem;
}
function appendElementXML($name, $xmldata) {
$aelem = $this->appendChild($this->ownerDocument->createElement($name));
@@ -653,6 +696,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
}
+ function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+ }
function appendInputRadio($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
}