projects
/
php-utility-classes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add functions for easily adding images
[php-utility-classes.git]
/
include
/
cbsm
/
util
/
document.php-class
diff --git
a/include/cbsm/util/document.php-class
b/include/cbsm/util/document.php-class
index e641d23c56364fec3610153d65803280cf03c726..58637850153d708b5015f58f128f0df484be1dec 100755
(executable)
--- a/
include/cbsm/util/document.php-class
+++ b/
include/cbsm/util/document.php-class
@@
-46,6
+46,10
@@
class ExtendedDocument extends DOMDocument {
// appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
// returns the new child
//
+ // function appendImage($src, [$alt_text])
+ // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+ // returns the new child
+ //
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
// returns an HTML <div> that is a child of the new child
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
// returns an HTML <div> that is a child of the new child
@@
-109,6
+113,9
@@
class ExtendedDocument extends DOMDocument {
// function createElementLink($target, [$value])
// returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
//
// function createElementLink($target, [$value])
// returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
//
+ // function createElementImage($src, [$alt_text])
+ // returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
+ //
// function createElementForm($action, $method, $name)
// returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
// with the given action, method, and name
// function createElementForm($action, $method, $name)
// returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
// with the given action, method, and name
@@
-172,6
+179,9
@@
class ExtendedDocument extends DOMDocument {
function appendLink($target, $value = '') {
return $this->appendChild($this->createElementLink($target, $value));
}
function appendLink($target, $value = '') {
return $this->appendChild($this->createElementLink($target, $value));
}
+ function appendImage($src, $alt_text = '') {
+ return $this->appendChild($this->createElementImage($src, $alt_text));
+ }
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->createElementForm($action, $method, $name));
return $formelem->appendElement('div');
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->createElementForm($action, $method, $name));
return $formelem->appendElement('div');
@@
-237,6
+247,13
@@
class ExtendedDocument extends DOMDocument {
return $link;
}
return $link;
}
+ function createElementImage($src, $alt_text = '') {
+ $link = $this->createElement('img');
+ $link->setAttribute('src', $src);
+ $link->setAttribute('alt', $alt_text);
+ return $link;
+ }
+
function createElementForm($action, $method, $name) {
$formelem = $this->createElement('form');
$formelem->setAttribute('action', $action);
function createElementForm($action, $method, $name) {
$formelem = $this->createElement('form');
$formelem->setAttribute('action', $action);
@@
-358,6
+375,10
@@
class ExtendedElement extends DOMElement {
// appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
// returns the new child
//
+ // function appendImage($src, [$alt_text])
+ // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+ // returns the new child
+ //
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
// returns an HTML <div> that is a child of the new child
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
// returns an HTML <div> that is a child of the new child
@@
-429,6
+450,9
@@
class ExtendedElement extends DOMElement {
function appendLink($target, $value = '') {
return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
}
function appendLink($target, $value = '') {
return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
}
+ function appendImage($src, $alt_text = '') {
+ return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
+ }
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
return $formelem->appendElement('div');
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
return $formelem->appendElement('div');
@@
-494,6
+518,10
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
// returns the new child
//
+ // function appendImage($src, [$alt_text])
+ // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+ // returns the new child
+ //
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
// returns an HTML <div> that is a child of the new child
// function appendFormDiv($action, $method, $name)
// appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
// returns an HTML <div> that is a child of the new child
@@
-565,6
+593,9
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
function appendLink($target, $value = '') {
return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
}
function appendLink($target, $value = '') {
return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
}
+ function appendImage($src, $alt_text = '') {
+ return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
+ }
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
return $formelem->appendElement('div');
function appendFormDiv($action, $method, $name) {
$formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
return $formelem->appendElement('div');