@@ -47,9 +47,9 @@ |
||
47 | 47 | $rules=$attributes["rules"]; |
48 | 48 | if(\is_array($rules)){ |
49 | 49 | $element->addRules($rules); |
50 | + } else { |
|
51 | + $element->addRule($rules); |
|
50 | 52 | } |
51 | - else |
|
52 | - $element->addRule($rules); |
|
53 | 53 | unset($attributes["rules"]); |
54 | 54 | } |
55 | 55 | } |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $name=$attributes["name"]; |
36 | 36 | } |
37 | 37 | $element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,""); |
38 | - if(\is_array($attributes)) |
|
39 | - $this->_applyAttributes($element, $attributes,$index); |
|
38 | + if(\is_array($attributes)) { |
|
39 | + $this->_applyAttributes($element, $attributes,$index); |
|
40 | + } |
|
40 | 41 | return $element; |
41 | 42 | }); |
42 | 43 | return $this; |
@@ -70,8 +71,9 @@ discard block |
||
70 | 71 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
71 | 72 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
72 | 73 | $header=new HtmlHeader($id,$niveau,$value); |
73 | - if(isset($icon)) |
|
74 | - $header->asIcon($icon, $value); |
|
74 | + if(isset($icon)) { |
|
75 | + $header->asIcon($icon, $value); |
|
76 | + } |
|
75 | 77 | return $header; |
76 | 78 | }, $index,$attributes,"header"); |
77 | 79 | } |
@@ -79,7 +81,9 @@ discard block |
||
79 | 81 | |
80 | 82 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
81 | 83 | $this->setValueFunction($index,function($img) use($size,$circular){ |
82 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
84 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
85 | + $image->setCircular(); |
|
86 | + } |
|
83 | 87 | return $image; |
84 | 88 | }); |
85 | 89 | return $this; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if(\sizeof($this->_compileParts)<3){ |
233 | 233 | $this->_template="%content%"; |
234 | 234 | $this->refresh(); |
235 | - }else{ |
|
235 | + } else{ |
|
236 | 236 | if ($this->propertyContains("class", "sortable")) { |
237 | 237 | $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
238 | 238 | } |
@@ -255,8 +255,9 @@ discard block |
||
255 | 255 | $result= $this->getBody()->_addRow($result); |
256 | 256 | } |
257 | 257 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
258 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
259 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
258 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
259 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
260 | + } |
|
260 | 261 | } |
261 | 262 | return $result; |
262 | 263 | } |
@@ -277,8 +278,9 @@ discard block |
||
277 | 278 | |
278 | 279 | public function run(JsUtils $js){ |
279 | 280 | $result= parent::run($js); |
280 | - if(isset($this->_footer)) |
|
281 | - $this->_footer->run($js); |
|
281 | + if(isset($this->_footer)) { |
|
282 | + $this->_footer->run($js); |
|
283 | + } |
|
282 | 284 | return $result; |
283 | 285 | } |
284 | 286 |
@@ -17,8 +17,9 @@ |
||
17 | 17 | |
18 | 18 | public function setBasic($very=false) { |
19 | 19 | $table=$this->getTable(); |
20 | - if ($very) |
|
21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
20 | + if ($very) { |
|
21 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
22 | + } |
|
22 | 23 | return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
23 | 24 | } |
24 | 25 |
@@ -14,21 +14,24 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
18 | - return $values[$pos]; |
|
17 | + if ($pos < sizeof($values)) { |
|
18 | + return $values[$pos]; |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
22 | 23 | $result=NULL; |
23 | 24 | if (array_key_exists($key, $array)) { |
24 | 25 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
26 | - return $result; |
|
26 | + if ($condition($result) === true) { |
|
27 | + return $result; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | $values=array_values($array); |
29 | 31 | foreach ( $values as $val ) { |
30 | - if ($condition($val) === true) |
|
31 | - return $val; |
|
32 | + if ($condition($val) === true) { |
|
33 | + return $val; |
|
34 | + } |
|
32 | 35 | } |
33 | 36 | return $result; |
34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 40 | if (array_key_exists($key, $array)) { |
38 | 41 | return $array[$key]; |
39 | - } else |
|
40 | - return $default; |
|
42 | + } else { |
|
43 | + return $default; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | public static function implode($glue, $pieces) { |
@@ -84,7 +88,7 @@ discard block |
||
84 | 88 | foreach ($objects as $object){ |
85 | 89 | $result[]=self::callFunction($object, $modelFunction); |
86 | 90 | } |
87 | - }else{ |
|
91 | + } else{ |
|
88 | 92 | foreach ($objects as $object){ |
89 | 93 | $result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction); |
90 | 94 | } |
@@ -93,9 +97,9 @@ discard block |
||
93 | 97 | } |
94 | 98 | |
95 | 99 | private static function callFunction($object,$callback){ |
96 | - if(\is_string($callback)) |
|
97 | - return \call_user_func(array($object, $callback),[]); |
|
98 | - else if (\is_callable($callback)){ |
|
100 | + if(\is_string($callback)) { |
|
101 | + return \call_user_func(array($object, $callback),[]); |
|
102 | + } else if (\is_callable($callback)){ |
|
99 | 103 | return $callback($object); |
100 | 104 | } |
101 | 105 | } |
@@ -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) |