@@ -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 | } |
@@ -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) |