X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=classes%2Fdocument.php-class;h=5a60615b7189eac910f8f245ce4bad86954eaf10;hp=f266fb073b022b3fdbcb3ae16edd5d4277fced4d;hb=9d19c120cf7e3e112a5bd72103a412332d486bc2;hpb=69409ddbd7c3c478d5e2828757ece01301fecaef diff --git a/classes/document.php-class b/classes/document.php-class index f266fb0..5a60615 100755 --- a/classes/document.php-class +++ b/classes/document.php-class @@ -101,6 +101,10 @@ class ExtendedDocument extends DOMDocument { // appends a DOMDocument::createTextNode() as a child of this document (see there for params) // returns the new child // + // public function appendLinebreak() + // appends a
as a child of this document + // returns the new child + // // public function appendEntity($name) // appends a DOMDocument::createEntityReference() as a child of this document (see there for params) // returns the new child @@ -284,6 +288,9 @@ class ExtendedDocument extends DOMDocument { public function appendText($text) { return $this->appendChild($this->createTextNode($text)); } + public function appendLinebreak() { + return $this->appendChild($this->createElement('br')); + } public function appendEntity($name) { return $this->appendChild($this->createEntityReference($name)); } @@ -589,6 +596,10 @@ class ExtendedElement extends DOMElement { // appends a DOMDocument::createTextNode() as a child of this element (see there for params) // returns the new child // + // public function appendLinebreak() + // appends a
as a child of this element + // returns the new child + // // public function appendEntity($name) // appends a DOMDocument::createEntityReference() as a child of this element (see there for params) // returns the new child @@ -612,6 +623,16 @@ class ExtendedElement extends DOMElement { // public function appendJSFile($jsURL, [$defer], [$async]) // appends an ExtendedDocument::createElementJSFile() as a child of this element (see there for params) // returns the new child + // + // public function setClass($classname) + // sets the 'class' attribute of the element to the given classname value + // + // public function addClass($classname) + // adds the given classname value to the space-separated list in the 'class' attribute + // returns the value of the 'class' attribute + // + // public function setID($elem_id) + // sets the 'id' attribute of the element to the given elem_id value public function appendElement($name, $value = '') { return $this->appendChild($this->ownerDocument->createElement($name, $value)); @@ -679,6 +700,9 @@ class ExtendedElement extends DOMElement { public function appendText($text) { return $this->appendChild($this->ownerDocument->createTextNode($text)); } + public function appendLinebreak() { + return $this->appendChild($this->ownerDocument->createElement('br')); + } public function appendEntity($name) { return $this->appendChild($this->ownerDocument->createEntityReference($name)); } @@ -697,6 +721,19 @@ class ExtendedElement extends DOMElement { public function appendJSFile($jsdata, $defer = false, $async = false) { return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata, $defer, $async)); } + public function setClass($classname) { + $this->setAttribute('class', $classname); + } + public function addClass($classname) { + $classval = $this->getAttribute('class'); + if (strlen($classval)) { $classval .= ' '; } + $classval .= $classname; + $this->setClass($classval); + return $classval; + } + public function setID($elem_id) { + $this->setAttribute('id', $elem_id); + } } class ExtendedDocumentFragment extends DOMDocumentFragment { @@ -788,6 +825,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params) // returns the new child // + // public function appendLinebreak() + // appends a
as a child of this fragment + // returns the new child + // // public function appendEntity($name) // appends a DOMDocument::createEntityReference() as a child of this fragment (see there for params) // returns the new child @@ -878,6 +919,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { public function appendText($text) { return $this->appendChild($this->ownerDocument->createTextNode($text)); } + public function appendLinebreak() { + return $this->appendChild($this->ownerDocument->createElement('br')); + } public function appendEntity($name) { return $this->appendChild($this->ownerDocument->createEntityReference($name)); }