@@ -2,10 +2,10 @@ 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 (); |
|
8 | - protected $jquery_code_for_compile_at_last=array (); |
|
7 | + protected $jquery_code_for_compile=array(); |
|
8 | + protected $jquery_code_for_compile_at_last=array(); |
|
9 | 9 | |
10 | 10 | protected function _addToCompile($jsScript) { |
11 | 11 | $this->jquery_code_for_compile[]=$jsScript; |
@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | * @param BaseGui $library |
16 | 16 | * @param mixed $view |
17 | 17 | */ |
18 | - protected function _compileLibrary(BaseGui $library, &$view=NULL){ |
|
19 | - if(isset($view)) |
|
18 | + protected function _compileLibrary(BaseGui $library, &$view=NULL) { |
|
19 | + if (isset($view)) |
|
20 | 20 | $library->compileHtml($this, $view); |
21 | 21 | if ($library->isAutoCompile()) { |
22 | 22 | $library->compile(true); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - protected function defer($script){ |
|
26 | + protected function defer($script) { |
|
27 | 27 | $result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};"; |
28 | 28 | $result.="window.defer(function(){".$script."})"; |
29 | 29 | return $result; |
30 | 30 | } |
31 | 31 | |
32 | - protected function ready($script){ |
|
32 | + protected function ready($script) { |
|
33 | 33 | $result='$(document).ready(function() {'."\n"; |
34 | 34 | $result.=$script.'})'; |
35 | 35 | return $result; |
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function minify($input) { |
39 | - if(trim($input) === "") return $input; |
|
40 | - $input= preg_replace( |
|
39 | + if (trim($input)==="") return $input; |
|
40 | + $input=preg_replace( |
|
41 | 41 | array( |
42 | 42 | // Remove comment(s) |
43 | 43 | '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#', |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | * @param mixed $view |
17 | 17 | */ |
18 | 18 | protected function _compileLibrary(BaseGui $library, &$view=NULL){ |
19 | - if(isset($view)) |
|
20 | - $library->compileHtml($this, $view); |
|
19 | + if(isset($view)) { |
|
20 | + $library->compileHtml($this, $view); |
|
21 | + } |
|
21 | 22 | if ($library->isAutoCompile()) { |
22 | 23 | $library->compile(true); |
23 | 24 | } |
@@ -36,7 +37,9 @@ discard block |
||
36 | 37 | } |
37 | 38 | |
38 | 39 | protected function minify($input) { |
39 | - if(trim($input) === "") return $input; |
|
40 | + if(trim($input) === "") { |
|
41 | + return $input; |
|
42 | + } |
|
40 | 43 | $input= preg_replace( |
41 | 44 | array( |
42 | 45 | // Remove comment(s) |