@@ -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.="\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}"; |
@@ -133,8 +136,9 @@ discard block |
||
133 | 136 | } |
134 | 137 | |
135 | 138 | protected function _correctAjaxUrl($url) { |
136 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
137 | - $url=substr($url, 0, strlen($url)-1); |
|
139 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
140 | + $url=substr($url, 0, strlen($url)-1); |
|
141 | + } |
|
138 | 142 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
139 | 143 | $url=$this->getUrl($url); |
140 | 144 | } |
@@ -154,8 +158,9 @@ discard block |
||
154 | 158 | public static function _implodeParams($parameters){ |
155 | 159 | $allParameters=[]; |
156 | 160 | foreach ($parameters as $params){ |
157 | - if(isset($params)) |
|
158 | - $allParameters[]=self::_correctParams($params); |
|
161 | + if(isset($params)) { |
|
162 | + $allParameters[]=self::_correctParams($params); |
|
163 | + } |
|
159 | 164 | } |
160 | 165 | return \implode("+'&'+", $allParameters); |
161 | 166 | } |
@@ -181,8 +186,9 @@ discard block |
||
181 | 186 | |
182 | 187 | protected function setDefaultParameters(&$parameters,$default){ |
183 | 188 | foreach ($default as $k=>$v){ |
184 | - if(!isset($parameters[$k])) |
|
185 | - $parameters[$k]=$v; |
|
189 | + if(!isset($parameters[$k])) { |
|
190 | + $parameters[$k]=$v; |
|
191 | + } |
|
186 | 192 | } |
187 | 193 | } |
188 | 194 | |
@@ -300,7 +306,7 @@ discard block |
||
300 | 306 | if($context===null){ |
301 | 307 | $parent="$('".$maskSelector."').parent()"; |
302 | 308 | $newElm = "$('#'+newId)"; |
303 | - }else{ |
|
309 | + } else{ |
|
304 | 310 | $parent=$context; |
305 | 311 | $newElm = $context.".find('#'+newId)"; |
306 | 312 | } |
@@ -526,7 +532,7 @@ discard block |
||
526 | 532 | $retour.="var self=this;\n"; |
527 | 533 | if($hasLoader===true){ |
528 | 534 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
529 | - }elseif($hasLoader==="internal"){ |
|
535 | + } elseif($hasLoader==="internal"){ |
|
530 | 536 | $retour.="\n$(this).addClass('loading');"; |
531 | 537 | } |
532 | 538 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -544,8 +550,9 @@ discard block |
||
544 | 550 | $retour.="$('#".$form."').submit();\n"; |
545 | 551 | } |
546 | 552 | $retour=$this->_addJsCondition($jsCondition, $retour); |
547 | - if ($immediatly) |
|
548 | - $this->jquery_code_for_compile[]=$retour; |
|
553 | + if ($immediatly) { |
|
554 | + $this->jquery_code_for_compile[]=$retour; |
|
555 | + } |
|
549 | 556 | return $retour; |
550 | 557 | } |
551 | 558 |