@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * Outputs a jQuery click event |
| 160 | 160 | * |
| 161 | 161 | * @param string $element The element to attach the event to |
| 162 | - * @param mixed $js The code to execute |
|
| 162 | + * @param string $js The code to execute |
|
| 163 | 163 | * @param boolean $ret_false whether or not to return false |
| 164 | 164 | * @return string |
| 165 | 165 | */ |
@@ -235,6 +235,8 @@ discard block |
||
| 235 | 235 | * @param string - element |
| 236 | 236 | * @param string - Javascript code for mouse over |
| 237 | 237 | * @param string - Javascript code for mouse out |
| 238 | + * @param string $over |
|
| 239 | + * @param string $out |
|
| 238 | 240 | * @return string |
| 239 | 241 | */ |
| 240 | 242 | public function _hover($element='this', $over, $out) { |
@@ -768,7 +770,7 @@ discard block |
||
| 768 | 770 | * |
| 769 | 771 | * @param string $element |
| 770 | 772 | * @param array $options |
| 771 | - * @return void |
|
| 773 | + * @return string |
|
| 772 | 774 | */ |
| 773 | 775 | public function sortable($element, $options=array()) { |
| 774 | 776 | if (count($options)>0) { |
@@ -904,6 +906,7 @@ discard block |
||
| 904 | 906 | /** |
| 905 | 907 | * A wrapper for writing document.ready() |
| 906 | 908 | * |
| 909 | + * @param string $js |
|
| 907 | 910 | * @return string |
| 908 | 911 | */ |
| 909 | 912 | public function _document_ready($js) { |
@@ -958,7 +961,7 @@ discard block |
||
| 958 | 961 | /** |
| 959 | 962 | * Ensures the speed parameter is valid for jQuery |
| 960 | 963 | * |
| 961 | - * @param string|int $speed |
|
| 964 | + * @param string $speed |
|
| 962 | 965 | * @return string |
| 963 | 966 | */ |
| 964 | 967 | private function _validate_speed($speed) { |
@@ -973,6 +976,10 @@ discard block |
||
| 973 | 976 | return $speed; |
| 974 | 977 | } |
| 975 | 978 | // ------------------------------------------------------------------------ |
| 979 | + |
|
| 980 | + /** |
|
| 981 | + * @param string $retour |
|
| 982 | + */ |
|
| 976 | 983 | protected function addLoading(&$retour, $responseElement) { |
| 977 | 984 | $loading_notifier='<div class="ajax-loader">'; |
| 978 | 985 | if ($this->ajaxLoader=='') { |
@@ -985,13 +992,25 @@ discard block |
||
| 985 | 992 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 986 | 993 | } |
| 987 | 994 | |
| 995 | + /** |
|
| 996 | + * @param string $url |
|
| 997 | + * @param string $jsCallback |
|
| 998 | + */ |
|
| 988 | 999 | public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 989 | 1000 | return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 990 | 1001 | } |
| 1002 | + |
|
| 1003 | + /** |
|
| 1004 | + * @param string $url |
|
| 1005 | + * @param string $jsCallback |
|
| 1006 | + */ |
|
| 991 | 1007 | public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 992 | 1008 | return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 993 | 1009 | } |
| 994 | 1010 | |
| 1011 | + /** |
|
| 1012 | + * @param string $method |
|
| 1013 | + */ |
|
| 995 | 1014 | protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 996 | 1015 | if(JString::isNull($params)){$params="{}";} |
| 997 | 1016 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
@@ -1008,6 +1027,9 @@ discard block |
||
| 1008 | 1027 | return $retour; |
| 1009 | 1028 | } |
| 1010 | 1029 | |
| 1030 | + /** |
|
| 1031 | + * @param string $attr |
|
| 1032 | + */ |
|
| 1011 | 1033 | protected function _getAjaxUrl($url,$attr){ |
| 1012 | 1034 | $url=$this->_correctAjaxUrl($url); |
| 1013 | 1035 | $retour="url='".$url."';\n"; |
@@ -1139,6 +1161,12 @@ discard block |
||
| 1139 | 1161 | return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
| 1140 | 1162 | } |
| 1141 | 1163 | |
| 1164 | + /** |
|
| 1165 | + * @param string $url |
|
| 1166 | + * @param string $form |
|
| 1167 | + * @param string $responseElement |
|
| 1168 | + * @param string $jsCallback |
|
| 1169 | + */ |
|
| 1142 | 1170 | public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 1143 | 1171 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1144 | 1172 | $retour=$this->_getAjaxUrl($url, $attr); |
@@ -1252,7 +1280,7 @@ discard block |
||
| 1252 | 1280 | * @param string $element |
| 1253 | 1281 | * @param string $elementToModify |
| 1254 | 1282 | * @param string $jqueryCall |
| 1255 | - * @param string|array $param |
|
| 1283 | + * @param string $param |
|
| 1256 | 1284 | * @param boolean $preventDefault |
| 1257 | 1285 | * @param boolean $stopPropagation |
| 1258 | 1286 | * @param string $jsCallback javascript code to execute after the jquery call |
@@ -1290,6 +1318,9 @@ discard block |
||
| 1290 | 1318 | return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
| 1291 | 1319 | } |
| 1292 | 1320 | |
| 1321 | + /** |
|
| 1322 | + * @param string $input |
|
| 1323 | + */ |
|
| 1293 | 1324 | private function minify($input) { |
| 1294 | 1325 | if(trim($input) === "") return $input; |
| 1295 | 1326 | return preg_replace( |
@@ -424,8 +424,9 @@ discard block |
||
| 424 | 424 | $element=$this->_prep_element($element); |
| 425 | 425 | $value=$this->_prep_value($value); |
| 426 | 426 | $str="$({$element}).after({$value});"; |
| 427 | - if ($immediatly) |
|
| 428 | - $this->jquery_code_for_compile[]=$str; |
|
| 427 | + if ($immediatly) { |
|
| 428 | + $this->jquery_code_for_compile[]=$str; |
|
| 429 | + } |
|
| 429 | 430 | return $str; |
| 430 | 431 | } |
| 431 | 432 | |
@@ -441,10 +442,12 @@ discard block |
||
| 441 | 442 | if (isset($value)) { |
| 442 | 443 | $value=$this->_prep_value($value); |
| 443 | 444 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 444 | - } else |
|
| 445 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
| 446 | - if ($immediatly) |
|
| 447 | - $this->jquery_code_for_compile[]=$str; |
|
| 445 | + } else { |
|
| 446 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 447 | + } |
|
| 448 | + if ($immediatly) { |
|
| 449 | + $this->jquery_code_for_compile[]=$str; |
|
| 450 | + } |
|
| 448 | 451 | return $str; |
| 449 | 452 | } |
| 450 | 453 | |
@@ -460,10 +463,12 @@ discard block |
||
| 460 | 463 | if (isset($param)) { |
| 461 | 464 | $param=$this->_prep_value($param); |
| 462 | 465 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 463 | - } else |
|
| 464 | - $str="$({$element}).{$jQueryCall}();"; |
|
| 465 | - if ($immediatly) |
|
| 466 | - $this->jquery_code_for_compile[]=$str; |
|
| 466 | + } else { |
|
| 467 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 468 | + } |
|
| 469 | + if ($immediatly) { |
|
| 470 | + $this->jquery_code_for_compile[]=$str; |
|
| 471 | + } |
|
| 467 | 472 | return $str; |
| 468 | 473 | } |
| 469 | 474 | /** |
@@ -478,8 +483,9 @@ discard block |
||
| 478 | 483 | $to=$this->_prep_element($to); |
| 479 | 484 | $element=$this->_prep_element($element); |
| 480 | 485 | $str="$({$to}).{$jQueryCall}({$element});"; |
| 481 | - if ($immediatly) |
|
| 482 | - $this->jquery_code_for_compile[]=$str; |
|
| 486 | + if ($immediatly) { |
|
| 487 | + $this->jquery_code_for_compile[]=$str; |
|
| 488 | + } |
|
| 483 | 489 | return $str; |
| 484 | 490 | } |
| 485 | 491 | // -------------------------------------------------------------------- |
@@ -516,8 +522,9 @@ discard block |
||
| 516 | 522 | |
| 517 | 523 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
| 518 | 524 | |
| 519 | - if ($immediatly) |
|
| 520 | - $this->jquery_code_for_compile[]=$str; |
|
| 525 | + if ($immediatly) { |
|
| 526 | + $this->jquery_code_for_compile[]=$str; |
|
| 527 | + } |
|
| 521 | 528 | return $str; |
| 522 | 529 | } |
| 523 | 530 | |
@@ -542,8 +549,9 @@ discard block |
||
| 542 | 549 | |
| 543 | 550 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
| 544 | 551 | |
| 545 | - if ($immediatly) |
|
| 546 | - $this->jquery_code_for_compile[]=$str; |
|
| 552 | + if ($immediatly) { |
|
| 553 | + $this->jquery_code_for_compile[]=$str; |
|
| 554 | + } |
|
| 547 | 555 | return $str; |
| 548 | 556 | } |
| 549 | 557 | |
@@ -568,8 +576,9 @@ discard block |
||
| 568 | 576 | |
| 569 | 577 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
| 570 | 578 | |
| 571 | - if ($immediatly) |
|
| 572 | - $this->jquery_code_for_compile[]=$str; |
|
| 579 | + if ($immediatly) { |
|
| 580 | + $this->jquery_code_for_compile[]=$str; |
|
| 581 | + } |
|
| 573 | 582 | return $str; |
| 574 | 583 | } |
| 575 | 584 | |
@@ -594,8 +603,9 @@ discard block |
||
| 594 | 603 | |
| 595 | 604 | $str="$({$element}).hide({$speed}{$callback});"; |
| 596 | 605 | |
| 597 | - if ($immediatly) |
|
| 598 | - $this->jquery_code_for_compile[]=$str; |
|
| 606 | + if ($immediatly) { |
|
| 607 | + $this->jquery_code_for_compile[]=$str; |
|
| 608 | + } |
|
| 599 | 609 | return $str; |
| 600 | 610 | } |
| 601 | 611 | |
@@ -622,8 +632,9 @@ discard block |
||
| 622 | 632 | |
| 623 | 633 | $str="$({$element}).slideUp({$speed}{$callback});"; |
| 624 | 634 | |
| 625 | - if ($immediatly) |
|
| 626 | - $this->jquery_code_for_compile[]=$str; |
|
| 635 | + if ($immediatly) { |
|
| 636 | + $this->jquery_code_for_compile[]=$str; |
|
| 637 | + } |
|
| 627 | 638 | return $str; |
| 628 | 639 | } |
| 629 | 640 | |
@@ -648,8 +659,9 @@ discard block |
||
| 648 | 659 | |
| 649 | 660 | $str="$({$element}).slideDown({$speed}{$callback});"; |
| 650 | 661 | |
| 651 | - if ($immediatly) |
|
| 652 | - $this->jquery_code_for_compile[]=$str; |
|
| 662 | + if ($immediatly) { |
|
| 663 | + $this->jquery_code_for_compile[]=$str; |
|
| 664 | + } |
|
| 653 | 665 | return $str; |
| 654 | 666 | } |
| 655 | 667 | |
@@ -674,8 +686,9 @@ discard block |
||
| 674 | 686 | |
| 675 | 687 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
| 676 | 688 | |
| 677 | - if ($immediatly) |
|
| 678 | - $this->jquery_code_for_compile[]=$str; |
|
| 689 | + if ($immediatly) { |
|
| 690 | + $this->jquery_code_for_compile[]=$str; |
|
| 691 | + } |
|
| 679 | 692 | return $str; |
| 680 | 693 | } |
| 681 | 694 | |
@@ -692,8 +705,9 @@ discard block |
||
| 692 | 705 | $element=$this->_prep_element($element); |
| 693 | 706 | $str="$({$element}).toggle();"; |
| 694 | 707 | |
| 695 | - if ($immediatly) |
|
| 696 | - $this->jquery_code_for_compile[]=$str; |
|
| 708 | + if ($immediatly) { |
|
| 709 | + $this->jquery_code_for_compile[]=$str; |
|
| 710 | + } |
|
| 697 | 711 | return $str; |
| 698 | 712 | } |
| 699 | 713 | |
@@ -709,8 +723,9 @@ discard block |
||
| 709 | 723 | $element=$this->_prep_element($element); |
| 710 | 724 | $str="$({$element}).trigger(\"$event\");"; |
| 711 | 725 | |
| 712 | - if ($immediatly) |
|
| 713 | - $this->jquery_code_for_compile[]=$str; |
|
| 726 | + if ($immediatly) { |
|
| 727 | + $this->jquery_code_for_compile[]=$str; |
|
| 728 | + } |
|
| 714 | 729 | return $str; |
| 715 | 730 | } |
| 716 | 731 | |
@@ -735,8 +750,9 @@ discard block |
||
| 735 | 750 | |
| 736 | 751 | $str="$({$element}).show({$speed}{$callback});"; |
| 737 | 752 | |
| 738 | - if ($immediatly) |
|
| 739 | - $this->jquery_code_for_compile[]=$str; |
|
| 753 | + if ($immediatly) { |
|
| 754 | + $this->jquery_code_for_compile[]=$str; |
|
| 755 | + } |
|
| 740 | 756 | return $str; |
| 741 | 757 | } |
| 742 | 758 | |
@@ -754,8 +770,9 @@ discard block |
||
| 754 | 770 | $str.="else{".$jsCodeIfFalse."}"; |
| 755 | 771 | } |
| 756 | 772 | |
| 757 | - if ($immediatly) |
|
| 758 | - $this->jquery_code_for_compile[]=$str; |
|
| 773 | + if ($immediatly) { |
|
| 774 | + $this->jquery_code_for_compile[]=$str; |
|
| 775 | + } |
|
| 759 | 776 | return $str; |
| 760 | 777 | } |
| 761 | 778 | |
@@ -821,12 +838,14 @@ discard block |
||
| 821 | 838 | if ($stopPropagation===true) { |
| 822 | 839 | $js="event.stopPropagation();\n".$js; |
| 823 | 840 | } |
| 824 | - if (array_search($event, $this->jquery_events)===false) |
|
| 825 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 826 | - else |
|
| 827 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 828 | - if($immediatly) |
|
| 829 | - $this->jquery_code_for_compile[]=$event; |
|
| 841 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 842 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 843 | + } else { |
|
| 844 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 845 | + } |
|
| 846 | + if($immediatly) { |
|
| 847 | + $this->jquery_code_for_compile[]=$event; |
|
| 848 | + } |
|
| 830 | 849 | return $event; |
| 831 | 850 | } |
| 832 | 851 | |
@@ -879,8 +898,9 @@ discard block |
||
| 879 | 898 | } |
| 880 | 899 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
| 881 | 900 | |
| 882 | - if ($view!=NULL) |
|
| 883 | - $view->setVar($view_var, $output); |
|
| 901 | + if ($view!=NULL) { |
|
| 902 | + $view->setVar($view_var, $output); |
|
| 903 | + } |
|
| 884 | 904 | return $output; |
| 885 | 905 | } |
| 886 | 906 | |
@@ -1003,8 +1023,9 @@ discard block |
||
| 1003 | 1023 | } |
| 1004 | 1024 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 1005 | 1025 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 1006 | - if ($immediatly) |
|
| 1007 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1026 | + if ($immediatly) { |
|
| 1027 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1028 | + } |
|
| 1008 | 1029 | return $retour; |
| 1009 | 1030 | } |
| 1010 | 1031 | |
@@ -1012,13 +1033,15 @@ discard block |
||
| 1012 | 1033 | $url=$this->_correctAjaxUrl($url); |
| 1013 | 1034 | $retour="url='".$url."';\n"; |
| 1014 | 1035 | $slash="/"; |
| 1015 | - if(PhalconUtils::endsWith($url, "/")) |
|
| 1016 | - $slash=""; |
|
| 1036 | + if(PhalconUtils::endsWith($url, "/")) { |
|
| 1037 | + $slash=""; |
|
| 1038 | + } |
|
| 1017 | 1039 | if(JString::isNotNull($attr)){ |
| 1018 | - if ($attr=="value") |
|
| 1019 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 1020 | - else if($attr!=null && $attr!=="") |
|
| 1021 | - $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
|
| 1040 | + if ($attr=="value") { |
|
| 1041 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 1042 | + } else if($attr!=null && $attr!=="") { |
|
| 1043 | + $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
|
| 1044 | + } |
|
| 1022 | 1045 | } |
| 1023 | 1046 | return $retour; |
| 1024 | 1047 | } |
@@ -1040,8 +1063,9 @@ discard block |
||
| 1040 | 1063 | } |
| 1041 | 1064 | |
| 1042 | 1065 | protected function _correctAjaxUrl($url) { |
| 1043 | - if (PhalconUtils::endsWith($url, "/")) |
|
| 1044 | - $url=substr($url, 0, strlen($url)-1); |
|
| 1066 | + if (PhalconUtils::endsWith($url, "/")) { |
|
| 1067 | + $url=substr($url, 0, strlen($url)-1); |
|
| 1068 | + } |
|
| 1045 | 1069 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 1046 | 1070 | $url=$this->_di->get("url")->get($url); |
| 1047 | 1071 | } |
@@ -1065,8 +1089,9 @@ discard block |
||
| 1065 | 1089 | $retour.="\t".$jsCallback."\n". |
| 1066 | 1090 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 1067 | 1091 | "});\n"; |
| 1068 | - if ($immediatly) |
|
| 1069 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1092 | + if ($immediatly) { |
|
| 1093 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1094 | + } |
|
| 1070 | 1095 | return $retour; |
| 1071 | 1096 | } |
| 1072 | 1097 | |
@@ -1105,7 +1130,7 @@ discard block |
||
| 1105 | 1130 | if($context===null){ |
| 1106 | 1131 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 1107 | 1132 | $newElm = "$('#'+newId)"; |
| 1108 | - }else{ |
|
| 1133 | + } else{ |
|
| 1109 | 1134 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 1110 | 1135 | $newElm = $context.".find('#'+newId)"; |
| 1111 | 1136 | } |
@@ -1115,8 +1140,9 @@ discard block |
||
| 1115 | 1140 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
| 1116 | 1141 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 1117 | 1142 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 1118 | - if ($immediatly) |
|
| 1119 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1143 | + if ($immediatly) { |
|
| 1144 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1145 | + } |
|
| 1120 | 1146 | return $retour; |
| 1121 | 1147 | } |
| 1122 | 1148 | /** |
@@ -1157,8 +1183,9 @@ discard block |
||
| 1157 | 1183 | }});\n"; |
| 1158 | 1184 | $retour.="$('#".$form."').submit();\n"; |
| 1159 | 1185 | } |
| 1160 | - if ($immediatly) |
|
| 1161 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1186 | + if ($immediatly) { |
|
| 1187 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1188 | + } |
|
| 1162 | 1189 | return $retour; |
| 1163 | 1190 | } |
| 1164 | 1191 | |
@@ -1238,11 +1265,13 @@ discard block |
||
| 1238 | 1265 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
| 1239 | 1266 | $param=$this->_prep_value($param); |
| 1240 | 1267 | $callback=""; |
| 1241 | - if ($jsCallback!="") |
|
| 1242 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1268 | + if ($jsCallback!="") { |
|
| 1269 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1270 | + } |
|
| 1243 | 1271 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
| 1244 | - if ($immediatly) |
|
| 1245 | - $this->jquery_code_for_compile[]=$script; |
|
| 1272 | + if ($immediatly) { |
|
| 1273 | + $this->jquery_code_for_compile[]=$script; |
|
| 1274 | + } |
|
| 1246 | 1275 | return $script; |
| 1247 | 1276 | } |
| 1248 | 1277 | |
@@ -1271,8 +1300,9 @@ discard block |
||
| 1271 | 1300 | */ |
| 1272 | 1301 | public function _exec($js, $immediatly=false) { |
| 1273 | 1302 | $script=$js."\n"; |
| 1274 | - if ($immediatly) |
|
| 1275 | - $this->jquery_code_for_compile[]=$script; |
|
| 1303 | + if ($immediatly) { |
|
| 1304 | + $this->jquery_code_for_compile[]=$script; |
|
| 1305 | + } |
|
| 1276 | 1306 | return $script; |
| 1277 | 1307 | } |
| 1278 | 1308 | |
@@ -1291,7 +1321,9 @@ discard block |
||
| 1291 | 1321 | } |
| 1292 | 1322 | |
| 1293 | 1323 | private function minify($input) { |
| 1294 | - if(trim($input) === "") return $input; |
|
| 1324 | + if(trim($input) === "") { |
|
| 1325 | + return $input; |
|
| 1326 | + } |
|
| 1295 | 1327 | return preg_replace( |
| 1296 | 1328 | array( |
| 1297 | 1329 | // Remove comment(s) |