From 71771b0c769f7a7be15b178accc41c22b7039d5a Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Fri, 11 May 2018 21:24:17 +0200 Subject: [PATCH] add a linebreak convenience function --- classes/document.php-class | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/classes/document.php-class b/classes/document.php-class index be9d150..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 @@ -689,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)); } @@ -811,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 @@ -901,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)); } -- 2.35.3