@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $this->widgetIdentifier = $identifier; |
36 | 36 | $this->values = []; |
37 | 37 | $this->afterCompile = []; |
38 | - if (isset($instance)) |
|
39 | - $this->setInstance($instance); |
|
38 | + if (isset($instance)) { |
|
39 | + $this->setInstance($instance); |
|
40 | + } |
|
40 | 41 | $this->setCaptions($captions); |
41 | 42 | $this->captionCallback = NULL; |
42 | 43 | $this->defaultValueFunction = function ($name, $value) { |
@@ -86,14 +87,16 @@ discard block |
||
86 | 87 | } |
87 | 88 | |
88 | 89 | public function getIdentifier($index = NULL) { |
89 | - if (! isset($index)) |
|
90 | - $index = self::$index; |
|
90 | + if (! isset($index)) { |
|
91 | + $index = self::$index; |
|
92 | + } |
|
91 | 93 | $value = $index; |
92 | 94 | if (isset($this->values["identifier"])) { |
93 | - if (\is_string($this->values["identifier"])) |
|
94 | - $value = JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
95 | - else |
|
96 | - $value = $this->values["identifier"]($index, $this->instance); |
|
95 | + if (\is_string($this->values["identifier"])) { |
|
96 | + $value = JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
97 | + } else { |
|
98 | + $value = $this->values["identifier"]($index, $this->instance); |
|
99 | + } |
|
97 | 100 | } |
98 | 101 | return $value; |
99 | 102 | } |
@@ -124,9 +127,8 @@ discard block |
||
124 | 127 | } elseif (\is_callable($property) && \array_search($property, ['system','date']) === false){ |
125 | 128 | try{ |
126 | 129 | $value = $property($this->instance); |
127 | - }catch(\Error $e){} |
|
128 | - } |
|
129 | - elseif (\is_array($property)) { |
|
130 | + } catch(\Error $e){} |
|
131 | + } elseif (\is_array($property)) { |
|
130 | 132 | $values = \array_map(function ($v) use ($index) { |
131 | 133 | return $this->_getValue($v, $index); |
132 | 134 | }, $property); |
@@ -280,10 +282,11 @@ discard block |
||
280 | 282 | } |
281 | 283 | } elseif (\is_int($property)) { |
282 | 284 | $props = $this->getDefaultProperties(); |
283 | - if (isset($props[$property])) |
|
284 | - $this->properties[] = $props[$property]; |
|
285 | - else |
|
286 | - $this->properties[] = $property; |
|
285 | + if (isset($props[$property])) { |
|
286 | + $this->properties[] = $props[$property]; |
|
287 | + } else { |
|
288 | + $this->properties[] = $property; |
|
289 | + } |
|
287 | 290 | } else { |
288 | 291 | $this->properties[] = $property; |
289 | 292 | } |
@@ -328,12 +331,13 @@ discard block |
||
328 | 331 | if (isset($this->captions[$index])) { |
329 | 332 | return $this->captions[$index]; |
330 | 333 | } |
331 | - if ($this->properties[$index] instanceof \ReflectionProperty) |
|
332 | - return $this->properties[$index]->getName(); |
|
333 | - elseif (\is_callable($this->properties[$index])) |
|
334 | - return ""; |
|
335 | - else |
|
336 | - return $this->properties[$index]; |
|
334 | + if ($this->properties[$index] instanceof \ReflectionProperty) { |
|
335 | + return $this->properties[$index]->getName(); |
|
336 | + } elseif (\is_callable($this->properties[$index])) { |
|
337 | + return ""; |
|
338 | + } else { |
|
339 | + return $this->properties[$index]; |
|
340 | + } |
|
337 | 341 | } |
338 | 342 | |
339 | 343 | public function getCaptions() { |
@@ -366,8 +370,9 @@ discard block |
||
366 | 370 | } |
367 | 371 | |
368 | 372 | public function setCaption($index, $caption) { |
369 | - if (isset($this->captions) === false) |
|
370 | - $this->captions = []; |
|
373 | + if (isset($this->captions) === false) { |
|
374 | + $this->captions = []; |
|
375 | + } |
|
371 | 376 | $this->captions[$index] = $caption; |
372 | 377 | return $this; |
373 | 378 | } |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | if (isset($this->content[$index]) === false) { |
87 | 87 | $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
88 | 88 | ->getIdentifier()); |
89 | - } else |
|
90 | - $this->content[$index]->setContent($content); |
|
89 | + } else { |
|
90 | + $this->content[$index]->setContent($content); |
|
91 | + } |
|
91 | 92 | } |
92 | 93 | return $this; |
93 | 94 | } |
@@ -281,15 +282,17 @@ discard block |
||
281 | 282 | * @see BaseHtml::run() |
282 | 283 | */ |
283 | 284 | public function run(JsUtils $js) { |
284 | - if (isset($this->_bsComponent) === false) |
|
285 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
285 | + if (isset($this->_bsComponent) === false) { |
|
286 | + $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
287 | + } |
|
286 | 288 | $this->addEventsOnRun($js); |
287 | 289 | return $this->_bsComponent; |
288 | 290 | } |
289 | 291 | |
290 | 292 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
291 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
292 | - $this->activate(0); |
|
293 | + if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) { |
|
294 | + $this->activate(0); |
|
295 | + } |
|
293 | 296 | return parent::compile($js, $view); |
294 | 297 | } |
295 | 298 |
@@ -288,8 +288,9 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) { |
290 | 290 | $result = $this->addInToolbar($caption, $callback); |
291 | - if (isset($icon) && method_exists($result, "addIcon")) |
|
292 | - $result->addIcon($icon); |
|
291 | + if (isset($icon) && method_exists($result, "addIcon")) { |
|
292 | + $result->addIcon($icon); |
|
293 | + } |
|
293 | 294 | return $result; |
294 | 295 | } |
295 | 296 | |
@@ -478,8 +479,9 @@ discard block |
||
478 | 479 | protected function _compileForm() { |
479 | 480 | if (isset($this->_form)) { |
480 | 481 | $noValidate = ""; |
481 | - if (\sizeof($this->_form->getValidationParams()) > 0) |
|
482 | - $noValidate = "novalidate"; |
|
482 | + if (\sizeof($this->_form->getValidationParams()) > 0) { |
|
483 | + $noValidate = "novalidate"; |
|
484 | + } |
|
483 | 485 | $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>"); |
484 | 486 | } |
485 | 487 | } |
@@ -62,12 +62,12 @@ |
||
62 | 62 | $this->customRules[]=$type; |
63 | 63 | $this->hasCustomRules=true; |
64 | 64 | } |
65 | - }elseif(\is_array($type)){ |
|
65 | + } elseif(\is_array($type)){ |
|
66 | 66 | $value=JArray::getValue($type, "value", 2); |
67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
68 | 68 | $type=JArray::getValue($type, "type", 0); |
69 | 69 | $rule=new Rule($type,$prompt,$value); |
70 | - }else { |
|
70 | + } else { |
|
71 | 71 | $rule = new Rule($type, $prompt, $value); |
72 | 72 | } |
73 | 73 | $this->rules[]=$rule; |
@@ -35,17 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | public function addContent($content, $before = false) { |
37 | 37 | if (! \is_array($this->content)) { |
38 | - if (isset($this->content)) |
|
39 | - $this->content = array( |
|
38 | + if (isset($this->content)) { |
|
39 | + $this->content = array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | - else |
|
43 | - $this->content = array(); |
|
42 | + } else { |
|
43 | + $this->content = array(); |
|
44 | + } |
|
45 | + } |
|
46 | + if ($before) { |
|
47 | + \array_unshift($this->content, $content); |
|
48 | + } else { |
|
49 | + $this->content[] = $content; |
|
44 | 50 | } |
45 | - if ($before) |
|
46 | - \array_unshift($this->content, $content); |
|
47 | - else |
|
48 | - $this->content[] = $content; |
|
49 | 51 | return $this; |
50 | 52 | } |
51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
108 | 110 | * @return HtmlDoubleElement |
109 | 111 | */ |
110 | 112 | public function asLink($href = NULL, $target = NULL) { |
111 | - if (isset($href)) |
|
112 | - $this->setProperty("href", $href); |
|
113 | - if (isset($target)) |
|
114 | - $this->setProperty("target", $target); |
|
113 | + if (isset($href)) { |
|
114 | + $this->setProperty("href", $href); |
|
115 | + } |
|
116 | + if (isset($target)) { |
|
117 | + $this->setProperty("target", $target); |
|
118 | + } |
|
115 | 119 | return $this->setTagName("a"); |
116 | 120 | } |
117 | 121 |
@@ -73,8 +73,9 @@ discard block |
||
73 | 73 | $retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n"; |
74 | 74 | |
75 | 75 | $retour = $this->_addJsCondition($jsCondition, $retour); |
76 | - if ($immediatly) |
|
77 | - $this->jquery_code_for_compile[] = $retour; |
|
76 | + if ($immediatly) { |
|
77 | + $this->jquery_code_for_compile[] = $retour; |
|
78 | + } |
|
78 | 79 | return $retour; |
79 | 80 | } |
80 | 81 | |
@@ -157,10 +158,11 @@ discard block |
||
157 | 158 | } elseif (isset($this->ajaxTransition)) { |
158 | 159 | $call = $this->ajaxTransition; |
159 | 160 | } |
160 | - if (\is_callable($call)) |
|
161 | - $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
162 | - else |
|
163 | - $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
161 | + if (\is_callable($call)) { |
|
162 | + $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
163 | + } else { |
|
164 | + $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
165 | + } |
|
164 | 166 | } |
165 | 167 | if (isset($history)) { |
166 | 168 | if ($this->params["autoActiveLinks"]) { |
@@ -194,8 +196,9 @@ discard block |
||
194 | 196 | } |
195 | 197 | |
196 | 198 | protected function _correctAjaxUrl($url) { |
197 | - if ($url !== "/" && JString::endsWith($url, "/") === true) |
|
198 | - $url = substr($url, 0, strlen($url) - 1); |
|
199 | + if ($url !== "/" && JString::endsWith($url, "/") === true) { |
|
200 | + $url = substr($url, 0, strlen($url) - 1); |
|
201 | + } |
|
199 | 202 | if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) { |
200 | 203 | $url = $this->getUrl($url); |
201 | 204 | } |
@@ -219,8 +222,9 @@ discard block |
||
219 | 222 | public static function _implodeParams($parameters) { |
220 | 223 | $allParameters = []; |
221 | 224 | foreach ($parameters as $params) { |
222 | - if (isset($params)) |
|
223 | - $allParameters[] = self::_correctParams($params); |
|
225 | + if (isset($params)) { |
|
226 | + $allParameters[] = self::_correctParams($params); |
|
227 | + } |
|
224 | 228 | } |
225 | 229 | return \implode("+'&'+", $allParameters); |
226 | 230 | } |
@@ -254,8 +258,9 @@ discard block |
||
254 | 258 | |
255 | 259 | protected function setDefaultParameters(&$parameters, $default) { |
256 | 260 | foreach ($default as $k => $v) { |
257 | - if (! isset($parameters[$k])) |
|
258 | - $parameters[$k] = $v; |
|
261 | + if (! isset($parameters[$k])) { |
|
262 | + $parameters[$k] = $v; |
|
263 | + } |
|
259 | 264 | } |
260 | 265 | } |
261 | 266 | |
@@ -820,8 +825,9 @@ discard block |
||
820 | 825 | $retour .= "$('#'+" . $form . ").submit();\n"; |
821 | 826 | } |
822 | 827 | $retour = $this->_addJsCondition($jsCondition, $retour); |
823 | - if ($immediatly) |
|
824 | - $this->jquery_code_for_compile[] = $retour; |
|
828 | + if ($immediatly) { |
|
829 | + $this->jquery_code_for_compile[] = $retour; |
|
830 | + } |
|
825 | 831 | return $retour; |
826 | 832 | } |
827 | 833 |