@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $retour.="var self=this;\n"; |
33 | 33 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
34 | 34 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
35 | - }elseif($hasLoader==="internal"){ |
|
35 | + } elseif($hasLoader==="internal"){ |
|
36 | 36 | $retour.="\n$(this).addClass('loading');"; |
37 | 37 | } |
38 | 38 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
50 | 50 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
51 | 51 | $retour=$this->_addJsCondition($jsCondition,$retour); |
52 | - if ($immediatly) |
|
53 | - $this->jquery_code_for_compile[]=$retour; |
|
52 | + if ($immediatly) { |
|
53 | + $this->jquery_code_for_compile[]=$retour; |
|
54 | + } |
|
54 | 55 | return $retour; |
55 | 56 | } |
56 | 57 | |
@@ -86,12 +87,13 @@ discard block |
||
86 | 87 | if(JString::isNotNull($attr)){ |
87 | 88 | if ($attr==="value"){ |
88 | 89 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
89 | - }elseif ($attr==="html"){ |
|
90 | + } elseif ($attr==="html"){ |
|
90 | 91 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
91 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
92 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
92 | 93 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
93 | - }elseif($attr!==null && $attr!=="") |
|
94 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
94 | + } elseif($attr!==null && $attr!=="") { |
|
95 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
96 | + } |
|
95 | 97 | } |
96 | 98 | return $retour; |
97 | 99 | } |
@@ -105,13 +107,14 @@ discard block |
||
105 | 107 | if (JString::isNotNull($responseElement)) { |
106 | 108 | if(isset($ajaxTransition)){ |
107 | 109 | $call=$this->setAjaxDataCall($ajaxTransition); |
108 | - }elseif(isset($this->ajaxTransition)){ |
|
110 | + } elseif(isset($this->ajaxTransition)){ |
|
109 | 111 | $call=$this->ajaxTransition; |
110 | 112 | } |
111 | - if(\is_callable($call)) |
|
112 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
113 | - else |
|
114 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
113 | + if(\is_callable($call)) { |
|
114 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
115 | + } else { |
|
116 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
117 | + } |
|
115 | 118 | } |
116 | 119 | if(isset($history)){ |
117 | 120 | $retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);"; |
@@ -132,8 +135,9 @@ discard block |
||
132 | 135 | } |
133 | 136 | |
134 | 137 | protected function _correctAjaxUrl($url) { |
135 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
136 | - $url=substr($url, 0, strlen($url)-1); |
|
138 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
139 | + $url=substr($url, 0, strlen($url)-1); |
|
140 | + } |
|
137 | 141 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
138 | 142 | $url=$this->getUrl($url); |
139 | 143 | } |
@@ -153,8 +157,9 @@ discard block |
||
153 | 157 | public static function _implodeParams($parameters){ |
154 | 158 | $allParameters=[]; |
155 | 159 | foreach ($parameters as $params){ |
156 | - if(isset($params)) |
|
157 | - $allParameters[]=self::_correctParams($params); |
|
160 | + if(isset($params)) { |
|
161 | + $allParameters[]=self::_correctParams($params); |
|
162 | + } |
|
158 | 163 | } |
159 | 164 | return \implode("+'&'+", $allParameters); |
160 | 165 | } |
@@ -180,8 +185,9 @@ discard block |
||
180 | 185 | |
181 | 186 | protected function setDefaultParameters(&$parameters,$default){ |
182 | 187 | foreach ($default as $k=>$v){ |
183 | - if(!isset($parameters[$k])) |
|
184 | - $parameters[$k]=$v; |
|
188 | + if(!isset($parameters[$k])) { |
|
189 | + $parameters[$k]=$v; |
|
190 | + } |
|
185 | 191 | } |
186 | 192 | } |
187 | 193 | |
@@ -299,7 +305,7 @@ discard block |
||
299 | 305 | if($context===null){ |
300 | 306 | $parent="$('".$maskSelector."').parent()"; |
301 | 307 | $newElm = "$('#'+newId)"; |
302 | - }else{ |
|
308 | + } else{ |
|
303 | 309 | $parent=$context; |
304 | 310 | $newElm = $context.".find('#'+newId)"; |
305 | 311 | } |
@@ -490,7 +496,7 @@ discard block |
||
490 | 496 | $retour.="var self=this;\n"; |
491 | 497 | if($hasLoader===true){ |
492 | 498 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
493 | - }elseif($hasLoader==="internal"){ |
|
499 | + } elseif($hasLoader==="internal"){ |
|
494 | 500 | $retour.="\n$(this).addClass('loading');"; |
495 | 501 | } |
496 | 502 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -508,8 +514,9 @@ discard block |
||
508 | 514 | $retour.="$('#".$form."').submit();\n"; |
509 | 515 | } |
510 | 516 | $retour=$this->_addJsCondition($jsCondition, $retour); |
511 | - if ($immediatly) |
|
512 | - $this->jquery_code_for_compile[]=$retour; |
|
517 | + if ($immediatly) { |
|
518 | + $this->jquery_code_for_compile[]=$retour; |
|
519 | + } |
|
513 | 520 | return $retour; |
514 | 521 | } |
515 | 522 |