css
1 year ago
js
1 year ago
class-dc-skroutz-feed-admin.php
1 year ago
class-dc-skroutz-feed-creator.php
1 year ago
class-dc-skroutz-feed-data-helper.php
1 year ago
index.php
1 year ago
mod_simplexml.php
1 year ago
mod_simplexml.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | class Dicha_SimpleXMLElement_Extension extends SimpleXMLElement |
| 4 | { |
| 5 | /** |
| 6 | * Add CDATA text in a node |
| 7 | * @param string $cdata_text The CDATA value to add |
| 8 | */ |
| 9 | private function addCData($cdata_text) |
| 10 | { |
| 11 | $node= dom_import_simplexml($this); |
| 12 | $no = $node->ownerDocument; |
| 13 | $node->appendChild($no->createCDATASection($cdata_text)); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Create a child with CDATA value |
| 18 | * @param string $name The name of the child element to add. |
| 19 | * @param string $cdata_text The CDATA value of the child element. |
| 20 | */ |
| 21 | public function addChildCData($name,$cdata_text) |
| 22 | { |
| 23 | $child = $this->addChild($name); |
| 24 | $child->addCData($cdata_text); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Add SimpleXMLElement code into a SimpleXMLElement |
| 29 | * @param SimpleXMLElement $append |
| 30 | */ |
| 31 | public function appendXML($append) |
| 32 | { |
| 33 | if ($append) { |
| 34 | if (strlen(trim((string) $append))==0) { |
| 35 | $xml = $this->addChild($append->getName()); |
| 36 | foreach($append->children() as $child) { |
| 37 | $xml->appendXML($child); |
| 38 | } |
| 39 | } else { |
| 40 | $xml = $this->addChild($append->getName(), (string) $append); |
| 41 | } |
| 42 | foreach($append->attributes() as $n => $v) { |
| 43 | $xml->addAttribute($n, $v); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | ?> |