PluginProbe
CSS & JavaScript Toolbox / 11.5
CSS & JavaScript Toolbox v11.5
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 / element / script.php

script.php in CSS & JavaScript Toolbox 11.5, at framework/html/dom/element/script.php

66 lines 1.0 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_Element_Script
7 extends CJT_Framework_Html_Dom_Elementbase {
8
9 /**
10 * put your comment there...
11 *
12 * @var mixed
13 */
14 protected $vars;
15
16 /**
17 * put your comment there...
18 *
19 */
20 public function __construct() {
21 // Create script element.
22 parent::__construct('script');
23 // INitialize vars.
24 $this->vars = new ArrayObject(array());
25 // INitialize with defauls.
26 $this->setType('text/javascript');
27 }
28
29 /**
30 * put your comment there...
31 *
32 */
33 public function __toString() {
34 // Set vars.
35 $content = '';
36 $vars =& $this->vars();
37 foreach ($vars as $var => $value) {
38 $content .= "var {$var}={$value};";
39 }
40 $this->setContent($content);
41 // Get parent string.
42 return parent::__toString();
43 }
44
45 /**
46 * put your comment there...
47 *
48 * @param mixed $type
49 */
50 public function & setType($type) {
51 // Set type.
52 $this->setAttribute('type', $type);
53 // chain.
54 return $this;
55 }
56
57 /**
58 * put your comment there...
59 *
60 */
61 public function & vars() {
62 return $this->vars;
63 }
64
65 } // End class.
66