@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | foreach ($ajaxSubmit as $ajaxSubmitItem){ |
50 | 50 | $compilation.=$ajaxSubmitItem->compile($js); |
51 | 51 | } |
52 | - }elseif($ajaxSubmit instanceof AjaxCall){ |
|
52 | + } elseif($ajaxSubmit instanceof AjaxCall){ |
|
53 | 53 | $compilation=$ajaxSubmit->compile($js); |
54 | 54 | } |
55 | 55 | $compilation=str_ireplace("\"","%quote%", $compilation); |
@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | public function setAttached($value=true){ |
69 | 69 | $form=$this->getForm(); |
70 | - if($value) |
|
71 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
70 | + if($value) { |
|
71 | + $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
72 | + } |
|
72 | 73 | return $form; |
73 | 74 | } |
74 | 75 | |
@@ -90,10 +91,11 @@ discard block |
||
90 | 91 | */ |
91 | 92 | public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
92 | 93 | $form=$this->getForm(); |
93 | - if($identifierOrElement instanceof BaseHtml) |
|
94 | - $elem=$identifierOrElement; |
|
95 | - else |
|
96 | - $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
94 | + if($identifierOrElement instanceof BaseHtml) { |
|
95 | + $elem=$identifierOrElement; |
|
96 | + } else { |
|
97 | + $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
98 | + } |
|
97 | 99 | if(isset($elem)){ |
98 | 100 | $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
99 | 101 | } |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | $this->widgetIdentifier=$identifier; |
24 | 24 | $this->values=[]; |
25 | 25 | $this->afterCompile=[]; |
26 | - if(isset($instance)) |
|
27 | - $this->setInstance($instance); |
|
26 | + if(isset($instance)) { |
|
27 | + $this->setInstance($instance); |
|
28 | + } |
|
28 | 29 | $this->setCaptions($captions); |
29 | 30 | $this->captionCallback=NULL; |
30 | 31 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -62,14 +63,16 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | public function getIdentifier($index=NULL){ |
65 | - if(!isset($index)) |
|
66 | - $index=self::$index; |
|
66 | + if(!isset($index)) { |
|
67 | + $index=self::$index; |
|
68 | + } |
|
67 | 69 | $value=$index; |
68 | 70 | if(isset($this->values["identifier"])){ |
69 | - if(\is_string($this->values["identifier"])) |
|
70 | - $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
71 | - else |
|
72 | - $value=$this->values["identifier"]($index,$this->instance); |
|
71 | + if(\is_string($this->values["identifier"])) { |
|
72 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
73 | + } else { |
|
74 | + $value=$this->values["identifier"]($index,$this->instance); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | return $value; |
75 | 78 | } |
@@ -99,16 +102,16 @@ discard block |
||
99 | 102 | if($property instanceof \ReflectionProperty){ |
100 | 103 | $value=$this->_getPropertyValue($property); |
101 | 104 | $propertyName=$property->getName(); |
102 | - }elseif(\is_callable($property) && array_search($property, ["system"])===false) |
|
103 | - $value=$property($this->instance); |
|
104 | - elseif(\is_array($property)){ |
|
105 | + } elseif(\is_callable($property) && array_search($property, ["system"])===false) { |
|
106 | + $value=$property($this->instance); |
|
107 | + } elseif(\is_array($property)){ |
|
105 | 108 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
106 | 109 | $value=\implode("", $values); |
107 | - }elseif(\is_string($property)){ |
|
110 | + } elseif(\is_string($property)){ |
|
108 | 111 | $value=$property; |
109 | 112 | if(isset($this->instance->{$property})){ |
110 | 113 | $value=$this->instance->{$property}; |
111 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
114 | + } elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
112 | 115 | $value=JReflection::callMethod($this->instance, $getter, []); |
113 | 116 | } |
114 | 117 | } |
@@ -118,7 +121,7 @@ discard block |
||
118 | 121 | protected function _postGetValue($index,$propertyName,$value){ |
119 | 122 | if(isset($this->values[$index])){ |
120 | 123 | $value= $this->values[$index]($value,$this->instance,$index,self::$index); |
121 | - }else{ |
|
124 | + } else{ |
|
122 | 125 | $value=$this->_getDefaultValue($propertyName,$value, $index); |
123 | 126 | } |
124 | 127 | if(isset($this->afterCompile[$index])){ |
@@ -139,10 +142,10 @@ discard block |
||
139 | 142 | if(isset($vb[$index])){ |
140 | 143 | if(\is_array($vb[$index])){ |
141 | 144 | $this->visibleProperties[$index][]=$field; |
142 | - }else{ |
|
145 | + } else{ |
|
143 | 146 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
144 | 147 | } |
145 | - }else{ |
|
148 | + } else{ |
|
146 | 149 | return $this->insertField($index, $field); |
147 | 150 | } |
148 | 151 | return $this; |
@@ -174,9 +177,9 @@ discard block |
||
174 | 177 | $property=$this->getProperty($index); |
175 | 178 | if($property instanceof \ReflectionProperty){ |
176 | 179 | $result=$property->getName(); |
177 | - }elseif(\is_callable($property)){ |
|
180 | + } elseif(\is_callable($property)){ |
|
178 | 181 | $result=$this->visibleProperties[$index]; |
179 | - }else{ |
|
182 | + } else{ |
|
180 | 183 | $result=$property; |
181 | 184 | } |
182 | 185 | return $result; |
@@ -196,7 +199,7 @@ discard block |
||
196 | 199 | $this->reflect=new \ReflectionClass($instance); |
197 | 200 | if(JArray::count($this->visibleProperties)===0){ |
198 | 201 | $this->properties=$this->getDefaultProperties(); |
199 | - }else{ |
|
202 | + } else{ |
|
200 | 203 | foreach ($this->visibleProperties as $property){ |
201 | 204 | $this->setInstanceProperty($property); |
202 | 205 | } |
@@ -207,22 +210,23 @@ discard block |
||
207 | 210 | private function setInstanceProperty($property){ |
208 | 211 | if(\is_callable($property)){ |
209 | 212 | $this->properties[]=$property; |
210 | - }elseif(\is_string($property)){ |
|
213 | + } elseif(\is_string($property)){ |
|
211 | 214 | try{ |
212 | 215 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
213 | 216 | $rProperty=$this->reflect->getProperty($property); |
214 | 217 | $this->properties[]=$rProperty; |
215 | - }catch(\Exception $e){ |
|
218 | + } catch(\Exception $e){ |
|
216 | 219 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
217 | 220 | $this->properties[]=$property; |
218 | 221 | } |
219 | - }elseif(\is_int($property)){ |
|
222 | + } elseif(\is_int($property)){ |
|
220 | 223 | $props=$this->getDefaultProperties(); |
221 | - if(isset($props[$property])) |
|
222 | - $this->properties[]=$props[$property]; |
|
223 | - else |
|
224 | - $this->properties[]=$property; |
|
225 | - }else{ |
|
224 | + if(isset($props[$property])) { |
|
225 | + $this->properties[]=$props[$property]; |
|
226 | + } else { |
|
227 | + $this->properties[]=$property; |
|
228 | + } |
|
229 | + } else{ |
|
226 | 230 | $this->properties[]=$property; |
227 | 231 | } |
228 | 232 | } |
@@ -266,12 +270,13 @@ discard block |
||
266 | 270 | if(isset($this->captions[$index])){ |
267 | 271 | return $this->captions[$index]; |
268 | 272 | } |
269 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
270 | - return $this->properties[$index]->getName(); |
|
271 | - elseif(\is_callable($this->properties[$index])) |
|
272 | - return ""; |
|
273 | - else |
|
274 | - return $this->properties[$index]; |
|
273 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
274 | + return $this->properties[$index]->getName(); |
|
275 | + } elseif(\is_callable($this->properties[$index])) { |
|
276 | + return ""; |
|
277 | + } else { |
|
278 | + return $this->properties[$index]; |
|
279 | + } |
|
275 | 280 | } |
276 | 281 | |
277 | 282 | public function getCaptions(){ |
@@ -282,7 +287,7 @@ discard block |
||
282 | 287 | for($i=$captionsSize;$i<$count;$i++){ |
283 | 288 | $captions[]=""; |
284 | 289 | } |
285 | - }else{ |
|
290 | + } else{ |
|
286 | 291 | $captions=[]; |
287 | 292 | $index=0; |
288 | 293 | while($index<$count){ |
@@ -297,8 +302,9 @@ discard block |
||
297 | 302 | } |
298 | 303 | |
299 | 304 | public function setCaption($index,$caption){ |
300 | - if(isset($this->captions)===false) |
|
301 | - $this->captions=[]; |
|
305 | + if(isset($this->captions)===false) { |
|
306 | + $this->captions=[]; |
|
307 | + } |
|
302 | 308 | $this->captions[$index]=$caption; |
303 | 309 | return $this; |
304 | 310 | } |