PluginProbe
CSS & JavaScript Toolbox / 12
CSS & JavaScript Toolbox v12
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / framework / html / dom / elementbase.php

elementbase.php in CSS & JavaScript Toolbox 12, at framework/html/dom/elementbase.php

70 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 class CJT_Framework_Html_Dom_Elementbase {
7
8 /**
9 * put your comment there...
10 *
11 * @var SimpleXMLElement
12 */
13 protected $simpleXML;
14
15 /**
16 * put your comment there...
17 *
18 * @param mixed $tag
19 * @return CJT_Framework_Html_Dom_Elementbase
20 */
21 public function __construct($tag) {
22 // Build XML Content.
23 $xmlContent = "<root><{$tag}></{$tag}></root>";
24 // Create SIMPLEXMLElement.
25 $this->simpleXML = new SimpleXMLElement($xmlContent);
26 // Target the tag element.
27 $children = $this->getSimpleXML()->children();
28 $this->simpleXML = $children[0];
29 }
30
31 /**
32 * put your comment there...
33 *
34 */
35 public function __toString() {
36 return $this->getSimpleXML()->asXML();
37 }
38
39 /**
40 * put your comment there...
41 *
42 */
43 protected function & getSimpleXML() {
44 return $this->simpleXML;
45 }
46
47 /**
48 * put your comment there...
49 *
50 * @param mixed $name
51 * @param mixed $value
52 * @param mixed $ns
53 */
54 public function setAttribute($name, $value, $ns = null) {
55 return $this->getSimpleXML()->addAttribute($name, $value, $ns);
56 }
57
58 /**
59 * put your comment there...
60 *
61 * @param mixed $content
62 */
63 public function & setContent($content) {
64 // Set content.
65 $this->getSimpleXML()->{0} = $content;
66 // Chain.
67 return $this;
68 }
69 } // End class.
70