@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | parent::__construct($identifier, "div","field"); |
15 | 15 | $this->content=array(); |
16 | 16 | $this->_states=[State::ERROR,State::DISABLED]; |
17 | - if(isset($label)) |
|
18 | - $this->setLabel($label); |
|
17 | + if(isset($label)) { |
|
18 | + $this->setLabel($label); |
|
19 | + } |
|
19 | 20 | $this->setField($field); |
20 | 21 | } |
21 | 22 | |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | * @return mixed |
46 | 47 | */ |
47 | 48 | public function getLabel(){ |
48 | - if(\array_key_exists("label", $this->content)) |
|
49 | - return $this->content["label"]; |
|
49 | + if(\array_key_exists("label", $this->content)) { |
|
50 | + return $this->content["label"]; |
|
51 | + } |
|
50 | 52 | } |
51 | 53 | |
52 | 54 | /** |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getProperty($name) { |
53 | - if (array_key_exists($name, $this->properties)) |
|
54 | - return $this->properties[$name]; |
|
53 | + if (array_key_exists($name, $this->properties)) { |
|
54 | + return $this->properties[$name]; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
61 | 62 | } |
62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
63 | 64 | $v=@$this->properties[$name]; |
64 | - if (isset($v) && $v !== "") |
|
65 | - $v=$v . $separator . $value; |
|
66 | - else |
|
67 | - $v=$value; |
|
65 | + if (isset($v) && $v !== "") { |
|
66 | + $v=$v . $separator . $value; |
|
67 | + } else { |
|
68 | + $v=$value; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | return $this->setProperty($name, $v); |
70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
119 | 121 | } |
120 | 122 | |
121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
123 | - return $this->setProperty($name, $value); |
|
124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
125 | + return $this->setProperty($name, $value); |
|
126 | + } |
|
124 | 127 | return $this; |
125 | 128 | } |
126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
150 | 153 | } |
151 | 154 | |
152 | 155 | public function removeProperty($name) { |
153 | - if (\array_key_exists($name, $this->properties)) |
|
154 | - unset($this->properties[$name]); |
|
156 | + if (\array_key_exists($name, $this->properties)) { |
|
157 | + unset($this->properties[$name]); |
|
158 | + } |
|
155 | 159 | return $this; |
156 | 160 | } |
157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
171 | 175 | } |
172 | 176 | |
173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
174 | - if (@class_exists($typeCtrl, true)) |
|
175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
178 | + if (@class_exists($typeCtrl, true)) { |
|
179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
180 | + } |
|
176 | 181 | if (is_array($typeCtrl)) { |
177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
178 | 183 | } |
@@ -358,15 +363,18 @@ discard block |
||
358 | 363 | $flag=false; |
359 | 364 | $index=0; |
360 | 365 | while ( !$flag && $index < sizeof($elements) ) { |
361 | - if ($elements[$index] instanceof BaseHtml) |
|
362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
366 | + if ($elements[$index] instanceof BaseHtml) { |
|
367 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
368 | + } |
|
363 | 369 | $index++; |
364 | 370 | } |
365 | - if ($flag === true) |
|
366 | - return $elements[$index - 1]; |
|
371 | + if ($flag === true) { |
|
372 | + return $elements[$index - 1]; |
|
373 | + } |
|
367 | 374 | } elseif ($elements instanceof BaseHtml) { |
368 | - if ($elements->getIdentifier() === $identifier) |
|
369 | - return $elements; |
|
375 | + if ($elements->getIdentifier() === $identifier) { |
|
376 | + return $elements; |
|
377 | + } |
|
370 | 378 | } |
371 | 379 | return null; |
372 | 380 | } |
@@ -376,15 +384,18 @@ discard block |
||
376 | 384 | $flag=false; |
377 | 385 | $index=0; |
378 | 386 | while ( !$flag && $index < sizeof($elements) ) { |
379 | - if ($elements[$index] instanceof BaseHtml) |
|
380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
387 | + if ($elements[$index] instanceof BaseHtml) { |
|
388 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
389 | + } |
|
381 | 390 | $index++; |
382 | 391 | } |
383 | - if ($flag === true) |
|
384 | - return $elements[$index - 1]; |
|
392 | + if ($flag === true) { |
|
393 | + return $elements[$index - 1]; |
|
394 | + } |
|
385 | 395 | } elseif ($elements instanceof BaseHtml) { |
386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
387 | - return $elements; |
|
396 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
397 | + return $elements; |
|
398 | + } |
|
388 | 399 | } |
389 | 400 | return null; |
390 | 401 | } |
@@ -124,6 +124,10 @@ discard block |
||
124 | 124 | return $this; |
125 | 125 | } |
126 | 126 | |
127 | + /** |
|
128 | + * @param string $name |
|
129 | + * @param string[] $typeCtrl |
|
130 | + */ |
|
127 | 131 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
128 | 132 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
129 | 133 | return $name=$value; |
@@ -139,22 +143,35 @@ discard block |
||
139 | 143 | return $this; |
140 | 144 | } |
141 | 145 | |
146 | + /** |
|
147 | + * @param string $name |
|
148 | + */ |
|
142 | 149 | protected function removePropertyValue($name, $value) { |
143 | 150 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
144 | 151 | return $this; |
145 | 152 | } |
146 | 153 | |
154 | + /** |
|
155 | + * @param string $name |
|
156 | + */ |
|
147 | 157 | protected function removePropertyValues($name, $values) { |
148 | 158 | $this->removeOldValues($this->properties[$name], $values); |
149 | 159 | return $this; |
150 | 160 | } |
151 | 161 | |
162 | + /** |
|
163 | + * @param string $name |
|
164 | + */ |
|
152 | 165 | public function removeProperty($name) { |
153 | 166 | if (\array_key_exists($name, $this->properties)) |
154 | 167 | unset($this->properties[$name]); |
155 | 168 | return $this; |
156 | 169 | } |
157 | 170 | |
171 | + /** |
|
172 | + * @param string $name |
|
173 | + * @param string[] $typeCtrl |
|
174 | + */ |
|
158 | 175 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
159 | 176 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
160 | 177 | if (is_array($typeCtrl)) { |
@@ -165,6 +182,9 @@ discard block |
||
165 | 182 | return $this; |
166 | 183 | } |
167 | 184 | |
185 | + /** |
|
186 | + * @param string $name |
|
187 | + */ |
|
168 | 188 | protected function addToMember(&$name, $value, $separator=" ") { |
169 | 189 | $name=str_ireplace($value, "", $name) . $separator . $value; |
170 | 190 | return $this; |
@@ -179,6 +199,9 @@ discard block |
||
179 | 199 | return $this->addToProperty($name, $value); |
180 | 200 | } |
181 | 201 | |
202 | + /** |
|
203 | + * @param string $name |
|
204 | + */ |
|
182 | 205 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
183 | 206 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
184 | 207 | } |
@@ -283,6 +306,10 @@ discard block |
||
283 | 306 | return null; |
284 | 307 | } |
285 | 308 | |
309 | + /** |
|
310 | + * @param string $propertyName |
|
311 | + * @param string $value |
|
312 | + */ |
|
286 | 313 | protected function getElementByPropertyValue($propertyName,$value, $elements) { |
287 | 314 | if (is_array($elements)) { |
288 | 315 | $flag=false; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Insert an item at a position |
65 | 65 | * @param mixed $item |
66 | - * @param number $position |
|
66 | + * @param integer $position |
|
67 | 67 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
68 | 68 | */ |
69 | 69 | public function insertItem($item,$position=0){ |
@@ -164,6 +164,9 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | + /** |
|
168 | + * @param integer $index |
|
169 | + */ |
|
167 | 170 | public function getItem($index){ |
168 | 171 | return $this->items[$index]; |
169 | 172 | } |
@@ -254,6 +257,9 @@ discard block |
||
254 | 257 | return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
255 | 258 | } |
256 | 259 | |
260 | + /** |
|
261 | + * @param string $value |
|
262 | + */ |
|
257 | 263 | public function setValue($value){ |
258 | 264 | $this->value=$value; |
259 | 265 | return $this; |
@@ -288,6 +294,9 @@ discard block |
||
288 | 294 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
289 | 295 | } |
290 | 296 | |
297 | + /** |
|
298 | + * @param string $action |
|
299 | + */ |
|
291 | 300 | public function setAction($action){ |
292 | 301 | $this->_params["action"]=$action; |
293 | 302 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function onCreate($jsCode){ |
53 | 53 | if(isset($this->_events["_create"])){ |
54 | 54 | $this->_events["_create"][]=$jsCode; |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $this->_events["_create"]=[$jsCode]; |
57 | 57 | } |
58 | 58 | return $this; |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | if(\is_array($create)){ |
65 | 65 | $create=\implode("", $create); |
66 | 66 | } |
67 | - if($create!=="") |
|
68 | - $js->exec($create,true); |
|
67 | + if($create!=="") { |
|
68 | + $js->exec($create,true); |
|
69 | + } |
|
69 | 70 | unset($this->_events["_create"]); |
70 | 71 | } |
71 | 72 | if (isset($this->_bsComponent)) { |
@@ -141,8 +141,9 @@ discard block |
||
141 | 141 | |
142 | 142 | public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
143 | 143 | $result=$this->addInToolbar($caption,$callback); |
144 | - if(isset($icon)) |
|
145 | - $result->addIcon($icon); |
|
144 | + if(isset($icon)) { |
|
145 | + $result->addIcon($icon); |
|
146 | + } |
|
146 | 147 | return $result; |
147 | 148 | } |
148 | 149 | |
@@ -151,7 +152,7 @@ discard block |
||
151 | 152 | foreach ($items as $icon=>$item){ |
152 | 153 | $this->addItemInToolbar($item,$icon,$callback); |
153 | 154 | } |
154 | - }else{ |
|
155 | + } else{ |
|
155 | 156 | foreach ($items as $item){ |
156 | 157 | $this->addItemInToolbar($item,null,$callback); |
157 | 158 | } |
@@ -54,26 +54,29 @@ |
||
54 | 54 | for($i=0;$i<$count;$i++){ |
55 | 55 | $step=$this->content[$i]; |
56 | 56 | $step->removeStatus(); |
57 | - if($i<$activestep) |
|
58 | - $step->setCompleted(); |
|
59 | - elseif ($i===$activestep) |
|
60 | - $step->setActive(); |
|
61 | - else |
|
62 | - $step->setDisabled(); |
|
57 | + if($i<$activestep) { |
|
58 | + $step->setCompleted(); |
|
59 | + } elseif ($i===$activestep) { |
|
60 | + $step->setActive(); |
|
61 | + } else { |
|
62 | + $step->setDisabled(); |
|
63 | + } |
|
63 | 64 | } |
64 | - }else{ |
|
65 | + } else{ |
|
65 | 66 | foreach ($this->content as $step){ |
66 | 67 | $step->removeStatus(); |
67 | 68 | } |
68 | - if($activestep<$count) |
|
69 | - $this->content[$activestep]->setActive(); |
|
69 | + if($activestep<$count) { |
|
70 | + $this->content[$activestep]->setActive(); |
|
71 | + } |
|
70 | 72 | } |
71 | 73 | return $this; |
72 | 74 | } |
73 | 75 | |
74 | 76 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
76 | - $this->defineActiveStep(); |
|
77 | + if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) { |
|
78 | + $this->defineActiveStep(); |
|
79 | + } |
|
77 | 80 | return parent::compile($js,$view); |
78 | 81 | } |
79 | 82 |
@@ -136,10 +136,12 @@ discard block |
||
136 | 136 | if (isset($param)) { |
137 | 137 | $param=Javascript::prep_value($param); |
138 | 138 | $str="$({$element}).{$jQueryCall}({$param});"; |
139 | - } else |
|
140 | - $str="$({$element}).{$jQueryCall}();"; |
|
141 | - if ($immediatly) |
|
142 | - $this->jquery_code_for_compile[]=$str; |
|
139 | + } else { |
|
140 | + $str="$({$element}).{$jQueryCall}();"; |
|
141 | + } |
|
142 | + if ($immediatly) { |
|
143 | + $this->jquery_code_for_compile[]=$str; |
|
144 | + } |
|
143 | 145 | return $str; |
144 | 146 | } |
145 | 147 | /** |
@@ -154,8 +156,9 @@ discard block |
||
154 | 156 | $to=Javascript::prep_element($to); |
155 | 157 | $element=Javascript::prep_element($element); |
156 | 158 | $str="$({$to}).{$jQueryCall}({$element});"; |
157 | - if ($immediatly) |
|
158 | - $this->jquery_code_for_compile[]=$str; |
|
159 | + if ($immediatly) { |
|
160 | + $this->jquery_code_for_compile[]=$str; |
|
161 | + } |
|
159 | 162 | return $str; |
160 | 163 | } |
161 | 164 | |
@@ -211,12 +214,14 @@ discard block |
||
211 | 214 | if ($stopPropagation===true) { |
212 | 215 | $js="event.stopPropagation();\n".$js; |
213 | 216 | } |
214 | - if (array_search($event, $this->jquery_events)===false) |
|
215 | - $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
216 | - else |
|
217 | - $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
218 | - if($immediatly) |
|
219 | - $this->jquery_code_for_compile[]=$event; |
|
217 | + if (array_search($event, $this->jquery_events)===false) { |
|
218 | + $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
219 | + } else { |
|
220 | + $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
221 | + } |
|
222 | + if($immediatly) { |
|
223 | + $this->jquery_code_for_compile[]=$event; |
|
224 | + } |
|
220 | 225 | return $event; |
221 | 226 | } |
222 | 227 | |
@@ -296,7 +301,9 @@ discard block |
||
296 | 301 | } |
297 | 302 | |
298 | 303 | private function minify($input) { |
299 | - if(trim($input) === "") return $input; |
|
304 | + if(trim($input) === "") { |
|
305 | + return $input; |
|
306 | + } |
|
300 | 307 | return preg_replace( |
301 | 308 | array( |
302 | 309 | // Remove comment(s) |