1 | <?php |
||
17 | class Dom |
||
18 | { |
||
19 | // single standalone tags |
||
20 | public static $singleTags = [ |
||
21 | 'hr', 'br', 'img', 'input' |
||
22 | ]; |
||
23 | |||
24 | // container tags |
||
25 | public static $containerTags = [ |
||
26 | 'article', 'nav', |
||
27 | 'div', 'p', 'a', |
||
28 | 'b', 's', 'strong', 'strike', 'u', 'span', |
||
29 | 'ul', 'ol', 'li', |
||
30 | 'table', 'thead', 'tbody', 'tr', 'td', 'th', 'dt', 'dd', |
||
31 | 'form', 'label' |
||
32 | ]; |
||
33 | |||
34 | // private variables storage |
||
35 | private $_vars; |
||
36 | |||
37 | /** |
||
38 | * Catch all callbacks |
||
39 | * @param $name |
||
40 | * @param $arguments |
||
41 | * @return null|string |
||
42 | */ |
||
43 | public function __call($name, $arguments) |
||
60 | |||
61 | /** |
||
62 | * Build output content by tag name, tag content and properties |
||
63 | * @param string $name |
||
64 | * @param string|null $content |
||
65 | * @param array|null $properties |
||
66 | * @return null|string |
||
67 | */ |
||
68 | private function buildTag($name, $content = null, array $properties = null) |
||
80 | |||
81 | /** |
||
82 | * Parse properties from array to html string |
||
83 | * @param array|null $properties |
||
84 | * @return null|string |
||
85 | */ |
||
86 | public static function applyProperties(array $properties = null) |
||
108 | |||
109 | /** |
||
110 | * Variable magic set |
||
111 | * @param string $name |
||
112 | * @param string $value |
||
113 | */ |
||
114 | public function __set($name, $value) |
||
118 | |||
119 | /** |
||
120 | * Variable magic get |
||
121 | * @param string $name |
||
122 | * @return mixed |
||
123 | */ |
||
124 | public function __get($name) |
||
128 | } |