@@ -420,8 +420,9 @@ discard block |
||
| 420 | 420 | $element=$this->_prep_element($element); |
| 421 | 421 | $value=$this->_prep_value($value); |
| 422 | 422 | $str="$({$element}).after({$value});"; |
| 423 | - if ($immediatly) |
|
| 424 | - $this->jquery_code_for_compile[]=$str; |
|
| 423 | + if ($immediatly) { |
|
| 424 | + $this->jquery_code_for_compile[]=$str; |
|
| 425 | + } |
|
| 425 | 426 | return $str; |
| 426 | 427 | } |
| 427 | 428 | |
@@ -437,10 +438,12 @@ discard block |
||
| 437 | 438 | if (isset($value)) { |
| 438 | 439 | $value=$this->_prep_value($value); |
| 439 | 440 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 440 | - } else |
|
| 441 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
| 442 | - if ($immediatly) |
|
| 443 | - $this->jquery_code_for_compile[]=$str; |
|
| 441 | + } else { |
|
| 442 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 443 | + } |
|
| 444 | + if ($immediatly) { |
|
| 445 | + $this->jquery_code_for_compile[]=$str; |
|
| 446 | + } |
|
| 444 | 447 | return $str; |
| 445 | 448 | } |
| 446 | 449 | |
@@ -456,10 +459,12 @@ discard block |
||
| 456 | 459 | if (isset($param)) { |
| 457 | 460 | $param=$this->_prep_value($param); |
| 458 | 461 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 459 | - } else |
|
| 460 | - $str="$({$element}).{$jQueryCall}();"; |
|
| 461 | - if ($immediatly) |
|
| 462 | - $this->jquery_code_for_compile[]=$str; |
|
| 462 | + } else { |
|
| 463 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 464 | + } |
|
| 465 | + if ($immediatly) { |
|
| 466 | + $this->jquery_code_for_compile[]=$str; |
|
| 467 | + } |
|
| 463 | 468 | return $str; |
| 464 | 469 | } |
| 465 | 470 | /** |
@@ -474,8 +479,9 @@ discard block |
||
| 474 | 479 | $to=$this->_prep_element($to); |
| 475 | 480 | $element=$this->_prep_element($element); |
| 476 | 481 | $str="$({$to}).{$jQueryCall}({$element});"; |
| 477 | - if ($immediatly) |
|
| 478 | - $this->jquery_code_for_compile[]=$str; |
|
| 482 | + if ($immediatly) { |
|
| 483 | + $this->jquery_code_for_compile[]=$str; |
|
| 484 | + } |
|
| 479 | 485 | return $str; |
| 480 | 486 | } |
| 481 | 487 | // -------------------------------------------------------------------- |
@@ -512,8 +518,9 @@ discard block |
||
| 512 | 518 | |
| 513 | 519 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
| 514 | 520 | |
| 515 | - if ($immediatly) |
|
| 516 | - $this->jquery_code_for_compile[]=$str; |
|
| 521 | + if ($immediatly) { |
|
| 522 | + $this->jquery_code_for_compile[]=$str; |
|
| 523 | + } |
|
| 517 | 524 | return $str; |
| 518 | 525 | } |
| 519 | 526 | |
@@ -538,8 +545,9 @@ discard block |
||
| 538 | 545 | |
| 539 | 546 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
| 540 | 547 | |
| 541 | - if ($immediatly) |
|
| 542 | - $this->jquery_code_for_compile[]=$str; |
|
| 548 | + if ($immediatly) { |
|
| 549 | + $this->jquery_code_for_compile[]=$str; |
|
| 550 | + } |
|
| 543 | 551 | return $str; |
| 544 | 552 | } |
| 545 | 553 | |
@@ -564,8 +572,9 @@ discard block |
||
| 564 | 572 | |
| 565 | 573 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
| 566 | 574 | |
| 567 | - if ($immediatly) |
|
| 568 | - $this->jquery_code_for_compile[]=$str; |
|
| 575 | + if ($immediatly) { |
|
| 576 | + $this->jquery_code_for_compile[]=$str; |
|
| 577 | + } |
|
| 569 | 578 | return $str; |
| 570 | 579 | } |
| 571 | 580 | |
@@ -590,8 +599,9 @@ discard block |
||
| 590 | 599 | |
| 591 | 600 | $str="$({$element}).hide({$speed}{$callback});"; |
| 592 | 601 | |
| 593 | - if ($immediatly) |
|
| 594 | - $this->jquery_code_for_compile[]=$str; |
|
| 602 | + if ($immediatly) { |
|
| 603 | + $this->jquery_code_for_compile[]=$str; |
|
| 604 | + } |
|
| 595 | 605 | return $str; |
| 596 | 606 | } |
| 597 | 607 | |
@@ -618,8 +628,9 @@ discard block |
||
| 618 | 628 | |
| 619 | 629 | $str="$({$element}).slideUp({$speed}{$callback});"; |
| 620 | 630 | |
| 621 | - if ($immediatly) |
|
| 622 | - $this->jquery_code_for_compile[]=$str; |
|
| 631 | + if ($immediatly) { |
|
| 632 | + $this->jquery_code_for_compile[]=$str; |
|
| 633 | + } |
|
| 623 | 634 | return $str; |
| 624 | 635 | } |
| 625 | 636 | |
@@ -644,8 +655,9 @@ discard block |
||
| 644 | 655 | |
| 645 | 656 | $str="$({$element}).slideDown({$speed}{$callback});"; |
| 646 | 657 | |
| 647 | - if ($immediatly) |
|
| 648 | - $this->jquery_code_for_compile[]=$str; |
|
| 658 | + if ($immediatly) { |
|
| 659 | + $this->jquery_code_for_compile[]=$str; |
|
| 660 | + } |
|
| 649 | 661 | return $str; |
| 650 | 662 | } |
| 651 | 663 | |
@@ -670,8 +682,9 @@ discard block |
||
| 670 | 682 | |
| 671 | 683 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
| 672 | 684 | |
| 673 | - if ($immediatly) |
|
| 674 | - $this->jquery_code_for_compile[]=$str; |
|
| 685 | + if ($immediatly) { |
|
| 686 | + $this->jquery_code_for_compile[]=$str; |
|
| 687 | + } |
|
| 675 | 688 | return $str; |
| 676 | 689 | } |
| 677 | 690 | |
@@ -688,8 +701,9 @@ discard block |
||
| 688 | 701 | $element=$this->_prep_element($element); |
| 689 | 702 | $str="$({$element}).toggle();"; |
| 690 | 703 | |
| 691 | - if ($immediatly) |
|
| 692 | - $this->jquery_code_for_compile[]=$str; |
|
| 704 | + if ($immediatly) { |
|
| 705 | + $this->jquery_code_for_compile[]=$str; |
|
| 706 | + } |
|
| 693 | 707 | return $str; |
| 694 | 708 | } |
| 695 | 709 | |
@@ -705,8 +719,9 @@ discard block |
||
| 705 | 719 | $element=$this->_prep_element($element); |
| 706 | 720 | $str="$({$element}).trigger(\"$event\");"; |
| 707 | 721 | |
| 708 | - if ($immediatly) |
|
| 709 | - $this->jquery_code_for_compile[]=$str; |
|
| 722 | + if ($immediatly) { |
|
| 723 | + $this->jquery_code_for_compile[]=$str; |
|
| 724 | + } |
|
| 710 | 725 | return $str; |
| 711 | 726 | } |
| 712 | 727 | |
@@ -731,8 +746,9 @@ discard block |
||
| 731 | 746 | |
| 732 | 747 | $str="$({$element}).show({$speed}{$callback});"; |
| 733 | 748 | |
| 734 | - if ($immediatly) |
|
| 735 | - $this->jquery_code_for_compile[]=$str; |
|
| 749 | + if ($immediatly) { |
|
| 750 | + $this->jquery_code_for_compile[]=$str; |
|
| 751 | + } |
|
| 736 | 752 | return $str; |
| 737 | 753 | } |
| 738 | 754 | |
@@ -750,8 +766,9 @@ discard block |
||
| 750 | 766 | $str.="else{".$jsCodeIfFalse."}"; |
| 751 | 767 | } |
| 752 | 768 | |
| 753 | - if ($immediatly) |
|
| 754 | - $this->jquery_code_for_compile[]=$str; |
|
| 769 | + if ($immediatly) { |
|
| 770 | + $this->jquery_code_for_compile[]=$str; |
|
| 771 | + } |
|
| 755 | 772 | return $str; |
| 756 | 773 | } |
| 757 | 774 | |
@@ -817,10 +834,11 @@ discard block |
||
| 817 | 834 | if ($stopPropagation===true) { |
| 818 | 835 | $js="event.stopPropagation();\n".$js; |
| 819 | 836 | } |
| 820 | - if (array_search($event, $this->jquery_events)===false) |
|
| 821 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 822 | - else |
|
| 823 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 837 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 838 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 839 | + } else { |
|
| 840 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 841 | + } |
|
| 824 | 842 | $this->jquery_code_for_compile[]=$event; |
| 825 | 843 | return $event; |
| 826 | 844 | } |
@@ -870,8 +888,9 @@ discard block |
||
| 870 | 888 | |
| 871 | 889 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
| 872 | 890 | |
| 873 | - if ($view!=NULL) |
|
| 874 | - $view->setVar($view_var, $output); |
|
| 891 | + if ($view!=NULL) { |
|
| 892 | + $view->setVar($view_var, $output); |
|
| 893 | + } |
|
| 875 | 894 | return $output; |
| 876 | 895 | } |
| 877 | 896 | |
@@ -992,8 +1011,9 @@ discard block |
||
| 992 | 1011 | } |
| 993 | 1012 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 994 | 1013 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 995 | - if ($immediatly) |
|
| 996 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1014 | + if ($immediatly) { |
|
| 1015 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1016 | + } |
|
| 997 | 1017 | return $retour; |
| 998 | 1018 | } |
| 999 | 1019 | |
@@ -1001,10 +1021,11 @@ discard block |
||
| 1001 | 1021 | $url=$this->_correctAjaxUrl($url); |
| 1002 | 1022 | $retour="url='".$url."';\n"; |
| 1003 | 1023 | if(JString::isNotNull($attr)){ |
| 1004 | - if ($attr=="value") |
|
| 1005 | - $retour.="url=url+'/'+$(this).val();\n"; |
|
| 1006 | - else if($attr!=null && $attr!=="") |
|
| 1007 | - $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
| 1024 | + if ($attr=="value") { |
|
| 1025 | + $retour.="url=url+'/'+$(this).val();\n"; |
|
| 1026 | + } else if($attr!=null && $attr!=="") { |
|
| 1027 | + $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
| 1028 | + } |
|
| 1008 | 1029 | } |
| 1009 | 1030 | return $retour; |
| 1010 | 1031 | } |
@@ -1020,8 +1041,9 @@ discard block |
||
| 1020 | 1041 | } |
| 1021 | 1042 | |
| 1022 | 1043 | protected function _correctAjaxUrl($url) { |
| 1023 | - if (PhalconUtils::endsWith($url, "/")) |
|
| 1024 | - $url=substr($url, 0, strlen($url)-1); |
|
| 1044 | + if (PhalconUtils::endsWith($url, "/")) { |
|
| 1045 | + $url=substr($url, 0, strlen($url)-1); |
|
| 1046 | + } |
|
| 1025 | 1047 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 1026 | 1048 | $url=$this->_di->get("url")->get($url); |
| 1027 | 1049 | } |
@@ -1042,8 +1064,9 @@ discard block |
||
| 1042 | 1064 | $retour.="\tdata=$.parseJSON(data);for(var key in data){if($('#'+key,".$context.").length){ if($('#'+key,".$context.").is('[value]')) { $('#'+key,".$context.").val(data[key]);} else { $('#'+key,".$context.").html(data[key]); }}};\n"; |
| 1043 | 1065 | $retour.="\t".$jsCallback."\n |
| 1044 | 1066 | });\n"; |
| 1045 | - if ($immediatly) |
|
| 1046 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1067 | + if ($immediatly) { |
|
| 1068 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1069 | + } |
|
| 1047 | 1070 | return $retour; |
| 1048 | 1071 | } |
| 1049 | 1072 | |
@@ -1080,8 +1103,9 @@ discard block |
||
| 1080 | 1103 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=$('#'+newId);\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"."\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"."\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"; |
| 1081 | 1104 | |
| 1082 | 1105 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 1083 | - if ($immediatly) |
|
| 1084 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1106 | + if ($immediatly) { |
|
| 1107 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1108 | + } |
|
| 1085 | 1109 | return $retour; |
| 1086 | 1110 | } |
| 1087 | 1111 | /** |
@@ -1118,8 +1142,9 @@ discard block |
||
| 1118 | 1142 | }});\n"; |
| 1119 | 1143 | $retour.="$('#".$form."').submit();\n"; |
| 1120 | 1144 | } |
| 1121 | - if ($immediatly) |
|
| 1122 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1145 | + if ($immediatly) { |
|
| 1146 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1147 | + } |
|
| 1123 | 1148 | return $retour; |
| 1124 | 1149 | } |
| 1125 | 1150 | |
@@ -1195,11 +1220,13 @@ discard block |
||
| 1195 | 1220 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
| 1196 | 1221 | $param=$this->_prep_value($param); |
| 1197 | 1222 | $callback=""; |
| 1198 | - if ($jsCallback!="") |
|
| 1199 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1223 | + if ($jsCallback!="") { |
|
| 1224 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1225 | + } |
|
| 1200 | 1226 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
| 1201 | - if ($immediatly) |
|
| 1202 | - $this->jquery_code_for_compile[]=$script; |
|
| 1227 | + if ($immediatly) { |
|
| 1228 | + $this->jquery_code_for_compile[]=$script; |
|
| 1229 | + } |
|
| 1203 | 1230 | return $script; |
| 1204 | 1231 | } |
| 1205 | 1232 | |
@@ -1227,8 +1254,9 @@ discard block |
||
| 1227 | 1254 | */ |
| 1228 | 1255 | public function _exec($js, $immediatly=false) { |
| 1229 | 1256 | $script=$js."\n"; |
| 1230 | - if ($immediatly) |
|
| 1231 | - $this->jquery_code_for_compile[]=$script; |
|
| 1257 | + if ($immediatly) { |
|
| 1258 | + $this->jquery_code_for_compile[]=$script; |
|
| 1259 | + } |
|
| 1232 | 1260 | return $script; |
| 1233 | 1261 | } |
| 1234 | 1262 | |
@@ -52,10 +52,11 @@ discard block |
||
| 52 | 52 | $this->from=$from; |
| 53 | 53 | $this->to=$to; |
| 54 | 54 | $this->urlMask="%page%"; |
| 55 | - if(!isset($countVisible)) |
|
| 56 | - $this->countVisible=$to-$from+1; |
|
| 57 | - else |
|
| 58 | - $this->countVisible=$countVisible; |
|
| 55 | + if(!isset($countVisible)) { |
|
| 56 | + $this->countVisible=$to-$from+1; |
|
| 57 | + } else { |
|
| 58 | + $this->countVisible=$countVisible; |
|
| 59 | + } |
|
| 59 | 60 | $this->createContent(); |
| 60 | 61 | } |
| 61 | 62 | |
@@ -74,7 +75,7 @@ discard block |
||
| 74 | 75 | $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
| 75 | 76 | $href->setProperty($this->attr, $url); |
| 76 | 77 | $elem->setContent($href); |
| 77 | - }else{ |
|
| 78 | + } else{ |
|
| 78 | 79 | $elem->setContent($content); |
| 79 | 80 | } |
| 80 | 81 | $this->content[]=$elem; |
@@ -107,8 +108,9 @@ discard block |
||
| 107 | 108 | public function _addEvent($event, $jsCode) { |
| 108 | 109 | foreach ($this->content as $li){ |
| 109 | 110 | $content=$li->getContent(); |
| 110 | - if($content instanceof BaseHtml) |
|
| 111 | - $content->_addEvent($event,$jsCode); |
|
| 111 | + if($content instanceof BaseHtml) { |
|
| 112 | + $content->_addEvent($event,$jsCode); |
|
| 113 | + } |
|
| 112 | 114 | } |
| 113 | 115 | } |
| 114 | 116 | /** |
@@ -146,8 +148,9 @@ discard block |
||
| 146 | 148 | if (is_int($size)) { |
| 147 | 149 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
| 148 | 150 | } |
| 149 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
| 150 | - $size="pagination-".$size; |
|
| 151 | + if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") { |
|
| 152 | + $size="pagination-".$size; |
|
| 153 | + } |
|
| 151 | 154 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
| 152 | 155 | } |
| 153 | 156 | |