@@ -50,8 +50,9 @@ |
||
| 50 | 50 | $comp=$item->compile($js); |
| 51 | 51 | if(isset($js)){ |
| 52 | 52 | $bs=$item->run($js); |
| 53 | - if(isset($bs)) |
|
| 54 | - $this->params['onShow']=$bs->getScript(); |
|
| 53 | + if(isset($bs)) { |
|
| 54 | + $this->params['onShow']=$bs->getScript(); |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | $item=$comp; |
| 57 | 58 | } |
@@ -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) |
@@ -68,8 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $table->setRowCount(0, \sizeof($captions)); |
| 70 | 70 | $table->setHeaderValues($captions); |
| 71 | - if(isset($this->_compileParts)) |
|
| 72 | - $table->setCompileParts($this->_compileParts); |
|
| 71 | + if(isset($this->_compileParts)) { |
|
| 72 | + $table->setCompileParts($this->_compileParts); |
|
| 73 | + } |
|
| 73 | 74 | if(isset($this->_searchField) && isset($js)){ |
| 74 | 75 | $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
| 75 | 76 | } |
@@ -275,8 +276,9 @@ discard block |
||
| 275 | 276 | private function getDefaultButton($icon,$class=null){ |
| 276 | 277 | $bt=$this->getFieldButton(""); |
| 277 | 278 | $bt->asIcon($icon); |
| 278 | - if(isset($class)) |
|
| 279 | - $bt->addToProperty("class", $class); |
|
| 279 | + if(isset($class)) { |
|
| 280 | + $bt->addToProperty("class", $class); |
|
| 281 | + } |
|
| 280 | 282 | return $bt; |
| 281 | 283 | } |
| 282 | 284 | |
@@ -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; |
@@ -87,8 +87,9 @@ discard block |
||
| 87 | 87 | if(\is_array($create)){ |
| 88 | 88 | $create=\implode("", $create); |
| 89 | 89 | } |
| 90 | - if(isset($js) && $create!=="") |
|
| 91 | - $js->exec($create,true); |
|
| 90 | + if(isset($js) && $create!=="") { |
|
| 91 | + $js->exec($create,true); |
|
| 92 | + } |
|
| 92 | 93 | unset($this->_events["_create"]); |
| 93 | 94 | } |
| 94 | 95 | } |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | $this->widgetIdentifier=$identifier; |
| 21 | 21 | $this->values=[]; |
| 22 | 22 | $this->afterCompile=[]; |
| 23 | - if(isset($instance)) |
|
| 24 | - $this->setInstance($instance); |
|
| 23 | + if(isset($instance)) { |
|
| 24 | + $this->setInstance($instance); |
|
| 25 | + } |
|
| 25 | 26 | $this->setCaptions($captions); |
| 26 | 27 | $this->captionCallback=NULL; |
| 27 | 28 | } |
@@ -38,8 +39,9 @@ discard block |
||
| 38 | 39 | |
| 39 | 40 | public function getIdentifier(){ |
| 40 | 41 | $value=self::$index; |
| 41 | - if(isset($this->values["identifier"])) |
|
| 42 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 42 | + if(isset($this->values["identifier"])) { |
|
| 43 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 44 | + } |
|
| 43 | 45 | return $value; |
| 44 | 46 | } |
| 45 | 47 | |
@@ -62,19 +64,19 @@ discard block |
||
| 62 | 64 | $value=$property->getValue($this->instance); |
| 63 | 65 | if(isset($this->values[$index])){ |
| 64 | 66 | $value= $this->values[$index]($value,$this->instance,$index); |
| 65 | - }else{ |
|
| 67 | + } else{ |
|
| 66 | 68 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
| 67 | 69 | } |
| 68 | - }else{ |
|
| 69 | - if(\is_callable($property)) |
|
| 70 | - $value=$property($this->instance); |
|
| 71 | - elseif(\is_array($property)){ |
|
| 70 | + } else{ |
|
| 71 | + if(\is_callable($property)) { |
|
| 72 | + $value=$property($this->instance); |
|
| 73 | + } elseif(\is_array($property)){ |
|
| 72 | 74 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
| 73 | 75 | $value=\implode("", $values); |
| 74 | - }else{ |
|
| 76 | + } else{ |
|
| 75 | 77 | if(isset($this->values[$index])){ |
| 76 | 78 | $value= $this->values[$index]($property,$this->instance,$index); |
| 77 | - }else{ |
|
| 79 | + } else{ |
|
| 78 | 80 | $value=$property; |
| 79 | 81 | } |
| 80 | 82 | } |
@@ -97,10 +99,10 @@ discard block |
||
| 97 | 99 | if(isset($vb[$index])){ |
| 98 | 100 | if(\is_array($vb[$index])){ |
| 99 | 101 | $this->visibleProperties[$index][]=$field; |
| 100 | - }else{ |
|
| 102 | + } else{ |
|
| 101 | 103 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
| 102 | 104 | } |
| 103 | - }else{ |
|
| 105 | + } else{ |
|
| 104 | 106 | return $this->insertField($index, $field); |
| 105 | 107 | } |
| 106 | 108 | return $this; |
@@ -136,7 +138,7 @@ discard block |
||
| 136 | 138 | $this->reflect=new \ReflectionClass($instance); |
| 137 | 139 | if(\sizeof($this->visibleProperties)===0){ |
| 138 | 140 | $this->properties=$this->getDefaultProperties(); |
| 139 | - }else{ |
|
| 141 | + } else{ |
|
| 140 | 142 | foreach ($this->visibleProperties as $property){ |
| 141 | 143 | $this->setInstanceProperty($property); |
| 142 | 144 | } |
@@ -147,22 +149,23 @@ discard block |
||
| 147 | 149 | private function setInstanceProperty($property){ |
| 148 | 150 | if(\is_callable($property)){ |
| 149 | 151 | $this->properties[]=$property; |
| 150 | - }elseif(\is_string($property)){ |
|
| 152 | + } elseif(\is_string($property)){ |
|
| 151 | 153 | try{ |
| 152 | 154 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 153 | 155 | $rProperty=$this->reflect->getProperty($property); |
| 154 | 156 | $this->properties[]=$rProperty; |
| 155 | - }catch(\Exception $e){ |
|
| 157 | + } catch(\Exception $e){ |
|
| 156 | 158 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 157 | 159 | $this->properties[]=$property; |
| 158 | 160 | } |
| 159 | - }elseif(\is_int($property)){ |
|
| 161 | + } elseif(\is_int($property)){ |
|
| 160 | 162 | $props=$this->getDefaultProperties(); |
| 161 | - if(isset($props[$property])) |
|
| 162 | - $this->properties[]=$props[$property]; |
|
| 163 | - else |
|
| 164 | - $this->properties[]=$property; |
|
| 165 | - }else{ |
|
| 163 | + if(isset($props[$property])) { |
|
| 164 | + $this->properties[]=$props[$property]; |
|
| 165 | + } else { |
|
| 166 | + $this->properties[]=$property; |
|
| 167 | + } |
|
| 168 | + } else{ |
|
| 166 | 169 | $this->properties[]=$property; |
| 167 | 170 | } |
| 168 | 171 | } |
@@ -206,12 +209,13 @@ discard block |
||
| 206 | 209 | if(isset($this->captions[$index])){ |
| 207 | 210 | return $this->captions[$index]; |
| 208 | 211 | } |
| 209 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
| 210 | - return $this->properties[$index]->getName(); |
|
| 211 | - elseif(\is_callable($this->properties[$index])) |
|
| 212 | - return ""; |
|
| 213 | - else |
|
| 214 | - return $this->properties[$index]; |
|
| 212 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
| 213 | + return $this->properties[$index]->getName(); |
|
| 214 | + } elseif(\is_callable($this->properties[$index])) { |
|
| 215 | + return ""; |
|
| 216 | + } else { |
|
| 217 | + return $this->properties[$index]; |
|
| 218 | + } |
|
| 215 | 219 | } |
| 216 | 220 | |
| 217 | 221 | public function getCaptions(){ |
@@ -220,7 +224,7 @@ discard block |
||
| 220 | 224 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
| 221 | 225 | $captions[]=""; |
| 222 | 226 | } |
| 223 | - }else{ |
|
| 227 | + } else{ |
|
| 224 | 228 | $captions=[]; |
| 225 | 229 | $index=0; |
| 226 | 230 | $count=$this->count(); |
@@ -236,8 +240,9 @@ discard block |
||
| 236 | 240 | } |
| 237 | 241 | |
| 238 | 242 | public function setCaption($index,$caption){ |
| 239 | - if(isset($this->captions)===false) |
|
| 240 | - $this->captions=[]; |
|
| 243 | + if(isset($this->captions)===false) { |
|
| 244 | + $this->captions=[]; |
|
| 245 | + } |
|
| 241 | 246 | $this->captions[$index]=$caption; |
| 242 | 247 | return $this; |
| 243 | 248 | } |
@@ -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 | } |
@@ -213,8 +218,9 @@ discard block |
||
| 213 | 218 | |
| 214 | 219 | public function fromArray($array) { |
| 215 | 220 | foreach ( $this as $key => $value ) { |
| 216 | - if(array_key_exists($key, $array)===true) |
|
| 217 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 221 | + if(array_key_exists($key, $array)===true) { |
|
| 222 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 223 | + } |
|
| 218 | 224 | } |
| 219 | 225 | foreach ( $array as $key => $value ) { |
| 220 | 226 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -265,15 +271,18 @@ discard block |
||
| 265 | 271 | $flag=false; |
| 266 | 272 | $index=0; |
| 267 | 273 | while ( !$flag && $index < sizeof($elements) ) { |
| 268 | - if ($elements[$index] instanceof BaseHtml) |
|
| 269 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 274 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 275 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 276 | + } |
|
| 270 | 277 | $index++; |
| 271 | 278 | } |
| 272 | - if ($flag === true) |
|
| 273 | - return $elements[$index - 1]; |
|
| 279 | + if ($flag === true) { |
|
| 280 | + return $elements[$index - 1]; |
|
| 281 | + } |
|
| 274 | 282 | } elseif ($elements instanceof BaseHtml) { |
| 275 | - if ($elements->getIdentifier() === $identifier) |
|
| 276 | - return $elements; |
|
| 283 | + if ($elements->getIdentifier() === $identifier) { |
|
| 284 | + return $elements; |
|
| 285 | + } |
|
| 277 | 286 | } |
| 278 | 287 | return null; |
| 279 | 288 | } |
@@ -283,15 +292,18 @@ discard block |
||
| 283 | 292 | $flag=false; |
| 284 | 293 | $index=0; |
| 285 | 294 | while ( !$flag && $index < sizeof($elements) ) { |
| 286 | - if ($elements[$index] instanceof BaseHtml) |
|
| 287 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 295 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 296 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 297 | + } |
|
| 288 | 298 | $index++; |
| 289 | 299 | } |
| 290 | - if ($flag === true) |
|
| 291 | - return $elements[$index - 1]; |
|
| 300 | + if ($flag === true) { |
|
| 301 | + return $elements[$index - 1]; |
|
| 302 | + } |
|
| 292 | 303 | } elseif ($elements instanceof BaseHtml) { |
| 293 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 294 | - return $elements; |
|
| 304 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 305 | + return $elements; |
|
| 306 | + } |
|
| 295 | 307 | } |
| 296 | 308 | return null; |
| 297 | 309 | } |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function asAvatar($caption=NULL) { |
| 17 | - if (isset($caption)) |
|
| 18 | - $this->wrap("", $caption); |
|
| 17 | + if (isset($caption)) { |
|
| 18 | + $this->wrap("", $caption); |
|
| 19 | + } |
|
| 19 | 20 | return $this->addToProperty("class", "avatar"); |
| 20 | 21 | } |
| 21 | 22 | |