@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | $retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n"; |
59 | 59 | $retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n"; |
60 | 60 | $retour = $this->_addJsCondition($jsCondition, $retour); |
61 | - if ($immediatly) |
|
62 | - $this->jquery_code_for_compile[] = $retour; |
|
61 | + if ($immediatly) { |
|
62 | + $this->jquery_code_for_compile[] = $retour; |
|
63 | + } |
|
63 | 64 | return $retour; |
64 | 65 | } |
65 | 66 | |
@@ -114,8 +115,9 @@ discard block |
||
114 | 115 | $retour .= "url=url+'" . $slash . "'+$(this).html();\n"; |
115 | 116 | } elseif (\substr($attr, 0, 3) === "js:") { |
116 | 117 | $retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n"; |
117 | - } elseif ($attr !== null && $attr !== "") |
|
118 | - $retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n"; |
|
118 | + } elseif ($attr !== null && $attr !== "") { |
|
119 | + $retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n"; |
|
120 | + } |
|
119 | 121 | } |
120 | 122 | return $retour; |
121 | 123 | } |
@@ -139,10 +141,11 @@ discard block |
||
139 | 141 | } elseif (isset($this->ajaxTransition)) { |
140 | 142 | $call = $this->ajaxTransition; |
141 | 143 | } |
142 | - if (\is_callable($call)) |
|
143 | - $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
144 | - else |
|
145 | - $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
144 | + if (\is_callable($call)) { |
|
145 | + $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
146 | + } else { |
|
147 | + $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
148 | + } |
|
146 | 149 | } |
147 | 150 | if (isset($history)) { |
148 | 151 | if ($this->params["autoActiveLinks"]) { |
@@ -165,8 +168,9 @@ discard block |
||
165 | 168 | } |
166 | 169 | |
167 | 170 | protected function _correctAjaxUrl($url) { |
168 | - if ($url !== "/" && JString::endsWith($url, "/") === true) |
|
169 | - $url = substr($url, 0, strlen($url) - 1); |
|
171 | + if ($url !== "/" && JString::endsWith($url, "/") === true) { |
|
172 | + $url = substr($url, 0, strlen($url) - 1); |
|
173 | + } |
|
170 | 174 | if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) { |
171 | 175 | $url = $this->getUrl($url); |
172 | 176 | } |
@@ -190,8 +194,9 @@ discard block |
||
190 | 194 | public static function _implodeParams($parameters) { |
191 | 195 | $allParameters = []; |
192 | 196 | foreach ($parameters as $params) { |
193 | - if (isset($params)) |
|
194 | - $allParameters[] = self::_correctParams($params); |
|
197 | + if (isset($params)) { |
|
198 | + $allParameters[] = self::_correctParams($params); |
|
199 | + } |
|
195 | 200 | } |
196 | 201 | return \implode("+'&'+", $allParameters); |
197 | 202 | } |
@@ -217,8 +222,9 @@ discard block |
||
217 | 222 | |
218 | 223 | protected function setDefaultParameters(&$parameters, $default) { |
219 | 224 | foreach ($default as $k => $v) { |
220 | - if (! isset($parameters[$k])) |
|
221 | - $parameters[$k] = $v; |
|
225 | + if (! isset($parameters[$k])) { |
|
226 | + $parameters[$k] = $v; |
|
227 | + } |
|
222 | 228 | } |
223 | 229 | } |
224 | 230 | |
@@ -712,7 +718,7 @@ discard block |
||
712 | 718 | if (isset($params)) { |
713 | 719 | $retour .= "params+='&'+" . self::_correctParams($params) . ";\n"; |
714 | 720 | } |
715 | - }else{ |
|
721 | + } else{ |
|
716 | 722 | $retour .= "\nvar params=new FormData($('#" . $form . "')[0]);\n"; |
717 | 723 | } |
718 | 724 | $responseElement = $this->_getResponseElement($responseElement); |
@@ -742,8 +748,9 @@ discard block |
||
742 | 748 | $retour .= "$('#" . $form . "').submit();\n"; |
743 | 749 | } |
744 | 750 | $retour = $this->_addJsCondition($jsCondition, $retour); |
745 | - if ($immediatly) |
|
746 | - $this->jquery_code_for_compile[] = $retour; |
|
751 | + if ($immediatly) { |
|
752 | + $this->jquery_code_for_compile[] = $retour; |
|
753 | + } |
|
747 | 754 | return $retour; |
748 | 755 | } |
749 | 756 |