Passed
Push — master ( 82c0ff...8e3dfb )
by Jean-Christophe
01:38
created
Ajax/common/traits/JsUtilsActionsTrait.php 1 patch
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 			$callback=", function(){\n{$callback}\n}";
30 30
 		}
31 31
 		$str="$({$element}).{$action}({$speed}{$callback});";
32
-		if ($immediatly)
33
-			$this->jquery_code_for_compile[]=$str;
32
+		if ($immediatly) {
33
+					$this->jquery_code_for_compile[]=$str;
34
+		}
34 35
 			return $str;
35 36
 	}
36 37
 	/**
@@ -62,10 +63,12 @@  discard block
 block discarded – undo
62 63
 		if (isset($param)) {
63 64
 			$param=Javascript::prep_value($param);
64 65
 			$str="$({$element}).{$jQueryCall}({$param});";
65
-		} else
66
-			$str="$({$element}).{$jQueryCall}();";
67
-		if ($immediatly)
68
-			$this->jquery_code_for_compile[]=$str;
66
+		} else {
67
+					$str="$({$element}).{$jQueryCall}();";
68
+		}
69
+		if ($immediatly) {
70
+					$this->jquery_code_for_compile[]=$str;
71
+		}
69 72
 		return $str;
70 73
 	}
71 74
 
@@ -81,8 +84,9 @@  discard block
 block discarded – undo
81 84
 		$to=Javascript::prep_element($to);
82 85
 		$element=Javascript::prep_element($element);
83 86
 		$str="$({$to}).{$jQueryCall}({$element});";
84
-		if ($immediatly)
85
-			$this->jquery_code_for_compile[]=$str;
87
+		if ($immediatly) {
88
+					$this->jquery_code_for_compile[]=$str;
89
+		}
86 90
 		return $str;
87 91
 	}
88 92
 	/**
@@ -131,10 +135,12 @@  discard block
 block discarded – undo
131 135
 		if (isset($value)) {
132 136
 			$value=Javascript::prep_value($value);
133 137
 			$str="$({$element}).attr(\"$attributeName\",{$value});";
134
-		} else
135
-			$str="$({$element}).attr(\"$attributeName\");";
136
-		if ($immediatly)
137
-			$this->jquery_code_for_compile[]=$str;
138
+		} else {
139
+					$str="$({$element}).attr(\"$attributeName\");";
140
+		}
141
+		if ($immediatly) {
142
+					$this->jquery_code_for_compile[]=$str;
143
+		}
138 144
 		return $str;
139 145
 	}
140 146
 
@@ -190,8 +196,9 @@  discard block
 block discarded – undo
190 196
 
191 197
 		$str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
192 198
 
193
-		if ($immediatly)
194
-			$this->jquery_code_for_compile[]=$str;
199
+		if ($immediatly) {
200
+					$this->jquery_code_for_compile[]=$str;
201
+		}
195 202
 		return $str;
196 203
 	}
197 204
 
@@ -342,8 +349,9 @@  discard block
 block discarded – undo
342 349
 		$element=Javascript::prep_element($element);
343 350
 		$str="$({$element}).trigger(\"$event\");";
344 351
 
345
-		if ($immediatly)
346
-			$this->jquery_code_for_compile[]=$str;
352
+		if ($immediatly) {
353
+					$this->jquery_code_for_compile[]=$str;
354
+		}
347 355
 		return $str;
348 356
 	}
349 357
 
@@ -405,8 +413,9 @@  discard block
 block discarded – undo
405 413
 			$str.="else{".$jsCodeIfFalse."}";
406 414
 		}
407 415
 
408
-		if ($immediatly)
409
-			$this->jquery_code_for_compile[]=$str;
416
+		if ($immediatly) {
417
+					$this->jquery_code_for_compile[]=$str;
418
+		}
410 419
 		return $str;
411 420
 	}
412 421
 
@@ -422,11 +431,13 @@  discard block
 block discarded – undo
422 431
 	private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) {
423 432
 		$param=Javascript::prep_value($param);
424 433
 		$callback="";
425
-		if ($jsCallback!="")
426
-			$callback=", function(event){\n{$jsCallback}\n}";
434
+		if ($jsCallback!="") {
435
+					$callback=", function(event){\n{$jsCallback}\n}";
436
+		}
427 437
 			$script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n";
428
-			if ($immediatly)
429
-				$this->jquery_code_for_compile[]=$script;
438
+			if ($immediatly) {
439
+							$this->jquery_code_for_compile[]=$script;
440
+			}
430 441
 				return $script;
431 442
 	}
432 443
 
@@ -497,8 +508,9 @@  discard block
 block discarded – undo
497 508
 	 */
498 509
 	public function exec($js, $immediatly=false) {
499 510
 		$script=$js."\n";
500
-		if ($immediatly)
501
-			$this->jquery_code_for_compile[]=$script;
511
+		if ($immediatly) {
512
+					$this->jquery_code_for_compile[]=$script;
513
+		}
502 514
 		return $script;
503 515
 	}
504 516
 
@@ -587,7 +599,7 @@  discard block
 block discarded – undo
587 599
 		}
588 600
 		if(isset($globalName)){
589 601
 			$script="if(window.{$globalName}){clearInterval(window.{$globalName});}\nwindow.{$globalName}=setInterval({$jsCode},{$time});";
590
-		}else{
602
+		} else{
591 603
 			$script="setInterval({$jsCode},{$time});";
592 604
 		}
593 605
 		return $this->exec($script,$immediatly);
@@ -617,7 +629,7 @@  discard block
 block discarded – undo
617 629
 		$stop="";
618 630
 		if($countDown){
619 631
 			$stop="if (--timer < ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}";
620
-		}else{
632
+		} else{
621 633
 			if($limit!=0){
622 634
 				$stop="if (++timer > ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}";
623 635
 			}
Please login to merge, or discard this patch.