From: Robert Kaiser Date: Sun, 8 Mar 2015 19:56:06 +0000 (+0100) Subject: add functions for easily adding images X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=commitdiff_plain;h=53510e9ea65c1e344e0a3b2f8c75319f8bf5f001 add functions for easily adding images --- diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class index c063544..5863785 100755 --- 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 // + // 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
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 with the given target (href) and (optional) value // + // function createElementImage($src, [$alt_text]) + // returns an ExtendedElement that is an HTML with the given (src) and alt attributes (set to '' by default) + // // function createElementForm($action, $method, $name) // returns an ExtendedElement that is an HTML
that is a child of an HTML
// with the given action, method, and name @@ -368,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 // + // 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
that is a child of the new child @@ -439,6 +450,9 @@ class ExtendedElement extends DOMElement { 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'); @@ -504,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 // + // 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
that is a child of the new child @@ -575,6 +593,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { 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');