@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $retour.=$before; |
37 | 37 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
38 | 38 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
39 | - }elseif($hasLoader==="internal"){ |
|
39 | + } elseif($hasLoader==="internal"){ |
|
40 | 40 | $retour.="\n$(this).addClass('loading');"; |
41 | 41 | } |
42 | 42 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
54 | 54 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
55 | 55 | $retour=$this->_addJsCondition($jsCondition,$retour); |
56 | - if ($immediatly) |
|
57 | - $this->jquery_code_for_compile[]=$retour; |
|
56 | + if ($immediatly) { |
|
57 | + $this->jquery_code_for_compile[]=$retour; |
|
58 | + } |
|
58 | 59 | return $retour; |
59 | 60 | } |
60 | 61 | |
@@ -75,7 +76,7 @@ discard block |
||
75 | 76 | } |
76 | 77 | if(is_array($v)){ |
77 | 78 | $s .= "'{$k}':{".self::implodeAjaxParameters($v)."}"; |
78 | - }else{ |
|
79 | + } else{ |
|
79 | 80 | $s .= "'{$k}':{$v}"; |
80 | 81 | } |
81 | 82 | } |
@@ -100,12 +101,13 @@ discard block |
||
100 | 101 | if(JString::isNotNull($attr)){ |
101 | 102 | if ($attr==="value"){ |
102 | 103 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
103 | - }elseif ($attr==="html"){ |
|
104 | + } elseif ($attr==="html"){ |
|
104 | 105 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
105 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | 107 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
107 | - }elseif($attr!==null && $attr!=="") |
|
108 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
108 | + } elseif($attr!==null && $attr!=="") { |
|
109 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
110 | + } |
|
109 | 111 | } |
110 | 112 | return $retour; |
111 | 113 | } |
@@ -125,13 +127,14 @@ discard block |
||
125 | 127 | if (JString::isNotNull($responseElement)) { |
126 | 128 | if(isset($ajaxTransition)){ |
127 | 129 | $call=$this->setAjaxDataCall($ajaxTransition); |
128 | - }elseif(isset($this->ajaxTransition)){ |
|
130 | + } elseif(isset($this->ajaxTransition)){ |
|
129 | 131 | $call=$this->ajaxTransition; |
130 | 132 | } |
131 | - if(\is_callable($call)) |
|
132 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
133 | - else |
|
134 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
133 | + if(\is_callable($call)) { |
|
134 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
135 | + } else { |
|
136 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
137 | + } |
|
135 | 138 | } |
136 | 139 | if(isset($history)){ |
137 | 140 | if($this->params["autoActiveLinks"]){ |
@@ -154,8 +157,9 @@ discard block |
||
154 | 157 | } |
155 | 158 | |
156 | 159 | protected function _correctAjaxUrl($url) { |
157 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
158 | - $url=substr($url, 0, strlen($url)-1); |
|
160 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
161 | + $url=substr($url, 0, strlen($url)-1); |
|
162 | + } |
|
159 | 163 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
160 | 164 | $url=$this->getUrl($url); |
161 | 165 | } |
@@ -169,7 +173,7 @@ discard block |
||
169 | 173 | if(\preg_match("@^\{.*?\}$@", $params)){ |
170 | 174 | if( !isset($ajaxParameters['contentType'])|| !UString::contains('json', $ajaxParameters['contentType'])){ |
171 | 175 | return '$.param('.$params.')'; |
172 | - }else{ |
|
176 | + } else{ |
|
173 | 177 | return 'JSON.stringify('.$params.')'; |
174 | 178 | } |
175 | 179 | } |
@@ -179,8 +183,9 @@ discard block |
||
179 | 183 | public static function _implodeParams($parameters){ |
180 | 184 | $allParameters=[]; |
181 | 185 | foreach ($parameters as $params){ |
182 | - if(isset($params)) |
|
183 | - $allParameters[]=self::_correctParams($params); |
|
186 | + if(isset($params)) { |
|
187 | + $allParameters[]=self::_correctParams($params); |
|
188 | + } |
|
184 | 189 | } |
185 | 190 | return \implode("+'&'+", $allParameters); |
186 | 191 | } |
@@ -206,8 +211,9 @@ discard block |
||
206 | 211 | |
207 | 212 | protected function setDefaultParameters(&$parameters,$default){ |
208 | 213 | foreach ($default as $k=>$v){ |
209 | - if(!isset($parameters[$k])) |
|
210 | - $parameters[$k]=$v; |
|
214 | + if(!isset($parameters[$k])) { |
|
215 | + $parameters[$k]=$v; |
|
216 | + } |
|
211 | 217 | } |
212 | 218 | } |
213 | 219 | |
@@ -340,7 +346,7 @@ discard block |
||
340 | 346 | if($context===null){ |
341 | 347 | $parent="$('".$maskSelector."').parent()"; |
342 | 348 | $newElm = "$('#'+newId)"; |
343 | - }else{ |
|
349 | + } else{ |
|
344 | 350 | $parent=$context; |
345 | 351 | $newElm = $context.".find('#'+newId)"; |
346 | 352 | } |
@@ -567,7 +573,7 @@ discard block |
||
567 | 573 | $retour.="var self=this;\n"; |
568 | 574 | if($hasLoader===true){ |
569 | 575 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
570 | - }elseif($hasLoader==="internal"){ |
|
576 | + } elseif($hasLoader==="internal"){ |
|
571 | 577 | $retour.="\n$(this).addClass('loading');"; |
572 | 578 | } |
573 | 579 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -585,8 +591,9 @@ discard block |
||
585 | 591 | $retour.="$('#".$form."').submit();\n"; |
586 | 592 | } |
587 | 593 | $retour=$this->_addJsCondition($jsCondition, $retour); |
588 | - if ($immediatly) |
|
589 | - $this->jquery_code_for_compile[]=$retour; |
|
594 | + if ($immediatly) { |
|
595 | + $this->jquery_code_for_compile[]=$retour; |
|
596 | + } |
|
590 | 597 | return $retour; |
591 | 598 | } |
592 | 599 |