@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * @return string |
18 | 18 | */ |
19 | 19 | private function _validate_speed($speed) { |
20 | - if (in_array($speed, array ( |
|
21 | - 'slow','normal','fast' |
|
20 | + if (in_array($speed, array( |
|
21 | + 'slow', 'normal', 'fast' |
|
22 | 22 | ))) { |
23 | 23 | $speed='"'.$speed.'"'; |
24 | 24 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param string $param |
36 | 36 | * @param boolean $immediatly delayed if false |
37 | 37 | */ |
38 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
38 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
39 | 39 | $element=Javascript::prep_element($element); |
40 | 40 | if (isset($param)) { |
41 | 41 | $param=Javascript::prep_value($param); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param boolean $immediatly delayed if false |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
58 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
59 | 59 | $to=Javascript::prep_element($to); |
60 | 60 | $element=Javascript::prep_element($element); |
61 | 61 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string |
73 | 73 | */ |
74 | 74 | public function addClass($element='this', $class='', $immediatly=false) { |
75 | - return $this->_genericCallValue('addClass',$element, $class, $immediatly); |
|
75 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param boolean $immediatly defers the execution if set to false |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public function after($to, $element, $immediatly=false){ |
|
86 | - return $this->_genericCallElement('after',$to, $element, $immediatly); |
|
85 | + public function after($to, $element, $immediatly=false) { |
|
86 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * @param boolean $immediatly defers the execution if set to false |
94 | 94 | * @return string |
95 | 95 | */ |
96 | - public function before($to, $element, $immediatly=false){ |
|
97 | - return $this->_genericCallElement('before',$to, $element, $immediatly); |
|
96 | + public function before($to, $element, $immediatly=false) { |
|
97 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $value |
123 | 123 | * @param boolean $immediatly defers the execution if set to false |
124 | 124 | */ |
125 | - public function val($element='this',$value='',$immediatly=false){ |
|
126 | - return $this->_genericCallValue('val',$element,$value,$immediatly); |
|
125 | + public function val($element='this', $value='', $immediatly=false) { |
|
126 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param boolean $immediatly defers the execution if set to false |
134 | 134 | */ |
135 | 135 | public function html($element='this', $value='', $immediatly=false) { |
136 | - return $this->_genericCallValue('html',$element, $value, $immediatly); |
|
136 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $animations="\t\t\t"; |
154 | 154 | if (\is_array($params)) { |
155 | - foreach ( $params as $param => $value ) { |
|
155 | + foreach ($params as $param => $value) { |
|
156 | 156 | $animations.=$param.': \''.$value.'\', '; |
157 | 157 | } |
158 | 158 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return string |
182 | 182 | */ |
183 | 183 | public function append($to, $element, $immediatly=false) { |
184 | - return $this->_genericCallElement('append',$to, $element, $immediatly); |
|
184 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | public function prepend($to, $element, $immediatly=false) { |
195 | - return $this->_genericCallElement('prepend',$to, $element, $immediatly); |
|
195 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @return string |
277 | 277 | */ |
278 | 278 | public function removeClass($element='this', $class='', $immediatly=false) { |
279 | - return $this->_genericCall('removeClass',$element, $class, $immediatly); |
|
279 | + return $this->_genericCall('removeClass', $element, $class, $immediatly); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @return string |
376 | 376 | */ |
377 | 377 | public function toggleClass($element='this', $class='', $immediatly=false) { |
378 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
378 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function sortable($element, $options=array()) { |
428 | 428 | if (count($options)>0) { |
429 | - $sort_options=array (); |
|
430 | - foreach ( $options as $k => $v ) { |
|
429 | + $sort_options=array(); |
|
430 | + foreach ($options as $k => $v) { |
|
431 | 431 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
432 | 432 | } |
433 | 433 | $sort_options=implode(",", $sort_options); |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @param boolean $immediatly |
525 | 525 | * @return string |
526 | 526 | */ |
527 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
528 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
527 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
528 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $preventDefault=false; |
544 | 544 | $immediatly=true; |
545 | 545 | extract($parameters); |
546 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
546 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $preventDefault=false; |
573 | 573 | $immediatly=true; |
574 | 574 | extract($parameters); |
575 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
575 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
576 | 576 | return $script; |
577 | 577 | } |
578 | 578 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | trait JsUtilsEventsTrait { |
11 | 11 | |
12 | 12 | |
13 | - protected $jquery_events=array ( |
|
14 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
13 | + protected $jquery_events=array( |
|
14 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
27 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
28 | 28 | if (\is_array($js)) { |
29 | 29 | $js=implode("\n\t\t", $js); |
30 | 30 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
39 | 39 | else |
40 | 40 | $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
41 | - if($immediatly) |
|
41 | + if ($immediatly) |
|
42 | 42 | $this->jquery_code_for_compile[]=$event; |
43 | 43 | return $event; |
44 | 44 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function click($element='this', $js='', $ret_false=TRUE) { |
77 | 77 | if (!is_array($js)) { |
78 | - $js=array ( |
|
78 | + $js=array( |
|
79 | 79 | $js |
80 | 80 | ); |
81 | 81 | } |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | namespace Ajax\common\traits; |
3 | 3 | use Ajax\common\BaseGui; |
4 | 4 | |
5 | -trait JsUtilsInternalTrait{ |
|
5 | +trait JsUtilsInternalTrait { |
|
6 | 6 | |
7 | - protected $jquery_code_for_compile=array (); |
|
7 | + protected $jquery_code_for_compile=array(); |
|
8 | 8 | |
9 | 9 | protected function _addToCompile($jsScript) { |
10 | 10 | $this->jquery_code_for_compile[]=$jsScript; |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | * @param BaseGui $library |
15 | 15 | * @param mixed $view |
16 | 16 | */ |
17 | - private function _compileLibrary($library, &$view=NULL){ |
|
17 | + private function _compileLibrary($library, &$view=NULL) { |
|
18 | 18 | if ($library!=NULL) { |
19 | - if(isset($view)) |
|
19 | + if (isset($view)) |
|
20 | 20 | $library->compileHtml($this, $view); |
21 | 21 | if ($library->isAutoCompile()) { |
22 | 22 | $library->compile(true); |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | - private function defer($script){ |
|
27 | + private function defer($script) { |
|
28 | 28 | $result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};"; |
29 | 29 | $result.="window.defer(function(){".$script."})"; |
30 | 30 | return $result; |
31 | 31 | } |
32 | 32 | |
33 | - private function ready($script){ |
|
33 | + private function ready($script) { |
|
34 | 34 | $result='$(document).ready(function() {'."\n"; |
35 | 35 | $result.=$script.'})'; |
36 | 36 | return $result; |
37 | 37 | } |
38 | 38 | |
39 | 39 | private function minify($input) { |
40 | - if(trim($input) === "") return $input; |
|
40 | + if (trim($input)==="") return $input; |
|
41 | 41 | return preg_replace( |
42 | 42 | array( |
43 | 43 | // Remove comment(s) |