@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (isset($value)) { |
| 19 | 19 | $value=$this->_prep_value($value); |
| 20 | 20 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 21 | - } else |
|
| 21 | + }else |
|
| 22 | 22 | $str="$({$element}).attr(\"$attributeName\");"; |
| 23 | 23 | if ($immediatly) |
| 24 | 24 | $this->jquery_code_for_compile[]=$str; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param boolean $immediatly defers the execution if set to false |
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function after($element='this', $value='', $immediatly=false){ |
|
| 35 | + public function after($element='this', $value='', $immediatly=false) { |
|
| 36 | 36 | $element=$this->_prep_element($element); |
| 37 | 37 | $value=$this->_prep_value($value); |
| 38 | 38 | $str="$({$element}).after({$value});"; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $animations="\t\t\t"; |
| 59 | 59 | if (is_array($params)) { |
| 60 | - foreach ( $params as $param => $value ) { |
|
| 60 | + foreach ($params as $param => $value) { |
|
| 61 | 61 | $animations.=$param.': \''.$value.'\', '; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | * @param boolean $immediatly |
| 351 | 351 | * @return string |
| 352 | 352 | */ |
| 353 | - public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
| 354 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 353 | + public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
| 354 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | * @param boolean $immediatly |
| 378 | 378 | * @return String |
| 379 | 379 | */ |
| 380 | - public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 381 | - return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 380 | + public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 381 | + return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | * @return string |
| 388 | 388 | */ |
| 389 | 389 | private function _validate_speed($speed) { |
| 390 | - if (in_array($speed, array ( |
|
| 391 | - 'slow','normal','fast' |
|
| 390 | + if (in_array($speed, array( |
|
| 391 | + 'slow', 'normal', 'fast' |
|
| 392 | 392 | ))) { |
| 393 | 393 | $speed='"'.$speed.'"'; |
| 394 | 394 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 10 | 10 | |
| 11 | 11 | public abstract function _prep_value($value); |
| 12 | - public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 12 | + public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 13 | 13 | protected function addLoading(&$retour, $responseElement) { |
| 14 | 14 | $loading_notifier='<div class="ajax-loader">'; |
| 15 | 15 | if ($this->ajaxLoader=='') { |
| 16 | 16 | $loading_notifier.="Loading..."; |
| 17 | - } else { |
|
| 17 | + }else { |
|
| 18 | 18 | $loading_notifier.=$this->ajaxLoader; |
| 19 | 19 | } |
| 20 | 20 | $loading_notifier.='</div>'; |
@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 26 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 25 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 26 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 27 | 27 | } |
| 28 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 29 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 28 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 29 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 33 | - if(JString::isNull($params)){$params="{}";} |
|
| 32 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 33 | + if (JString::isNull($params)) {$params="{}"; } |
|
| 34 | 34 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 35 | 35 | $retour=$this->_getAjaxUrl($url, $attr); |
| 36 | 36 | $responseElement=$this->_getResponseElement($responseElement); |
| 37 | 37 | $retour.="var self=this;\n"; |
| 38 | - if($hasLoader===true){ |
|
| 38 | + if ($hasLoader===true) { |
|
| 39 | 39 | $this->addLoading($retour, $responseElement); |
| 40 | 40 | } |
| 41 | 41 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -45,22 +45,22 @@ discard block |
||
| 45 | 45 | return $retour; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - protected function _getAjaxUrl($url,$attr){ |
|
| 48 | + protected function _getAjaxUrl($url, $attr) { |
|
| 49 | 49 | $url=$this->_correctAjaxUrl($url); |
| 50 | 50 | $retour="url='".$url."';\n"; |
| 51 | 51 | $slash="/"; |
| 52 | - if(PhalconUtils::endsWith($url, "/")) |
|
| 52 | + if (PhalconUtils::endsWith($url, "/")) |
|
| 53 | 53 | $slash=""; |
| 54 | - if(JString::isNotNull($attr)){ |
|
| 54 | + if (JString::isNotNull($attr)) { |
|
| 55 | 55 | if ($attr=="value") |
| 56 | 56 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
| 57 | - else if($attr!=null && $attr!=="") |
|
| 57 | + else if ($attr!=null && $attr!=="") |
|
| 58 | 58 | $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
| 59 | 59 | } |
| 60 | 60 | return $retour; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
| 63 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
| 64 | 64 | $retour=""; |
| 65 | 65 | if ($responseElement!=="") { |
| 66 | 66 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return $retour; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - protected function _getResponseElement($responseElement){ |
|
| 72 | + protected function _getResponseElement($responseElement) { |
|
| 73 | 73 | if ($responseElement!=="") { |
| 74 | 74 | $responseElement=$this->_prep_value($responseElement); |
| 75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | protected function _correctAjaxUrl($url) { |
| 80 | 80 | if (PhalconUtils::endsWith($url, "/")) |
| 81 | 81 | $url=substr($url, 0, strlen($url)-1); |
| 82 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
| 82 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
| 83 | 83 | $url=$this->_di->get("url")->get($url); |
| 84 | 84 | } |
| 85 | 85 | return $url; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $jsCallback javascript code to execute after the request |
| 94 | 94 | * @param boolean $immediatly |
| 95 | 95 | */ |
| 96 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 96 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 97 | 97 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 98 | 98 | $retour=$this->_getAjaxUrl($url, $attr); |
| 99 | 99 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param string $url the request address |
| 115 | 115 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 116 | 116 | */ |
| 117 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
| 117 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
| 118 | 118 | $preventDefault=true; |
| 119 | 119 | $stopPropagation=true; |
| 120 | 120 | $jsCallback=null; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $params="{}"; |
| 125 | 125 | $immediatly=true; |
| 126 | 126 | extract($parameters); |
| 127 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 127 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -136,19 +136,19 @@ discard block |
||
| 136 | 136 | * @param string $context jquery DOM element, array container. |
| 137 | 137 | * @param boolean $immediatly |
| 138 | 138 | */ |
| 139 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
| 139 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
| 140 | 140 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 141 | 141 | $retour=$this->_getAjaxUrl($url, $attr); |
| 142 | - if($context===null){ |
|
| 142 | + if ($context===null) { |
|
| 143 | 143 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 144 | - $newElm = "$('#'+newId)"; |
|
| 145 | - }else{ |
|
| 144 | + $newElm="$('#'+newId)"; |
|
| 145 | + }else { |
|
| 146 | 146 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 147 | - $newElm = $context.".find('#'+newId)"; |
|
| 147 | + $newElm=$context.".find('#'+newId)"; |
|
| 148 | 148 | } |
| 149 | 149 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
| 150 | 150 | $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=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"; |
| 151 | - $retour.= $appendTo; |
|
| 151 | + $retour.=$appendTo; |
|
| 152 | 152 | $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"; |
| 153 | 153 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 154 | 154 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -163,26 +163,26 @@ discard block |
||
| 163 | 163 | * @param string $url the request address |
| 164 | 164 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
| 165 | 165 | */ |
| 166 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
| 166 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 167 | 167 | $preventDefault=true; |
| 168 | 168 | $stopPropagation=true; |
| 169 | 169 | $jsCallback=null; |
| 170 | 170 | $attr="id"; |
| 171 | 171 | $method="get"; |
| 172 | - $context = null; |
|
| 172 | + $context=null; |
|
| 173 | 173 | $params="{}"; |
| 174 | 174 | $immediatly=true; |
| 175 | 175 | extract($parameters); |
| 176 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 176 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 179 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 180 | 180 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 181 | 181 | $retour=$this->_getAjaxUrl($url, $attr); |
| 182 | 182 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
| 183 | 183 | $responseElement=$this->_getResponseElement($responseElement); |
| 184 | 184 | $retour.="var self=this;\n"; |
| 185 | - if($hasLoader===true){ |
|
| 185 | + if ($hasLoader===true) { |
|
| 186 | 186 | $this->addLoading($retour, $responseElement); |
| 187 | 187 | } |
| 188 | 188 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @param string $responseElement |
| 210 | 210 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 211 | 211 | */ |
| 212 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 212 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 213 | 213 | $preventDefault=true; |
| 214 | 214 | $stopPropagation=true; |
| 215 | 215 | $jsCallback=null; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $hasLoader=true; |
| 218 | 218 | $immediatly=true; |
| 219 | 219 | extract($parameters); |
| 220 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 220 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param string $responseElement |
| 231 | 231 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 232 | 232 | */ |
| 233 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 233 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 234 | 234 | $preventDefault=true; |
| 235 | 235 | $stopPropagation=true; |
| 236 | 236 | $jsCallback=null; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $hasLoader=true; |
| 239 | 239 | $immediatly=true; |
| 240 | 240 | extract($parameters); |
| 241 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 241 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param string $responseElement |
| 252 | 252 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 253 | 253 | */ |
| 254 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 254 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 255 | 255 | $preventDefault=true; |
| 256 | 256 | $stopPropagation=true; |
| 257 | 257 | $validation=false; |
@@ -260,6 +260,6 @@ discard block |
||
| 260 | 260 | $hasLoader=true; |
| 261 | 261 | $immediatly=true; |
| 262 | 262 | extract($parameters); |
| 263 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 263 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | trait JqueryEventsTrait { |
| 6 | 6 | public abstract function _prep_element($element); |
| 7 | - public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 7 | + public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Blur |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
| 48 | 48 | if (!is_array($js)) { |
| 49 | - $js=array ( |
|
| 49 | + $js=array( |
|
| 50 | 50 | $js |
| 51 | 51 | ); |
| 52 | 52 | } |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | * jQuery Class |
| 18 | 18 | */ |
| 19 | 19 | class Jquery { |
| 20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
| 20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
| 21 | 21 | protected $_di; |
| 22 | 22 | protected $_ui; |
| 23 | 23 | protected $_bootstrap; |
| 24 | 24 | protected $_semantic; |
| 25 | 25 | protected $libraryFile; |
| 26 | 26 | protected $_javascript_folder='js'; |
| 27 | - protected $jquery_code_for_load=array (); |
|
| 28 | - protected $jquery_code_for_compile=array (); |
|
| 27 | + protected $jquery_code_for_load=array(); |
|
| 28 | + protected $jquery_code_for_compile=array(); |
|
| 29 | 29 | protected $jquery_corner_active=FALSE; |
| 30 | 30 | protected $jquery_table_sorter_active=FALSE; |
| 31 | 31 | protected $jquery_table_sorter_pager_active=FALSE; |
| 32 | 32 | |
| 33 | - protected $jquery_events=array ( |
|
| 34 | - "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" |
|
| 33 | + protected $jquery_events=array( |
|
| 34 | + "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" |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | public function setDi($di) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function __construct($params) { |
| 63 | 63 | $this->params=array(); |
| 64 | - foreach ( $params as $key => $val ) { |
|
| 64 | + foreach ($params as $key => $val) { |
|
| 65 | 65 | $this->params[$key]=$params[$key]; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function _output($array_js='') { |
| 137 | 137 | if (!is_array($array_js)) { |
| 138 | - $array_js=array ( |
|
| 138 | + $array_js=array( |
|
| 139 | 139 | $array_js |
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - foreach ( $array_js as $js ) { |
|
| 143 | + foreach ($array_js as $js) { |
|
| 144 | 144 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | * @param string $param |
| 153 | 153 | * @param boolean $immediatly delayed if false |
| 154 | 154 | */ |
| 155 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 155 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 156 | 156 | $element=$this->_prep_element($element); |
| 157 | 157 | if (isset($param)) { |
| 158 | 158 | $param=$this->_prep_value($param); |
| 159 | 159 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 160 | - } else |
|
| 160 | + }else |
|
| 161 | 161 | $str="$({$element}).{$jQueryCall}();"; |
| 162 | 162 | if ($immediatly) |
| 163 | 163 | $this->jquery_code_for_compile[]=$str; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param boolean $immediatly delayed if false |
| 172 | 172 | * @return string |
| 173 | 173 | */ |
| 174 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 174 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 175 | 175 | $to=$this->_prep_element($to); |
| 176 | 176 | $element=$this->_prep_element($element); |
| 177 | 177 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function sortable($element, $options=array()) { |
| 191 | 191 | if (count($options)>0) { |
| 192 | - $sort_options=array (); |
|
| 193 | - foreach ( $options as $k => $v ) { |
|
| 192 | + $sort_options=array(); |
|
| 193 | + foreach ($options as $k => $v) { |
|
| 194 | 194 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 195 | 195 | } |
| 196 | 196 | $sort_options=implode(",", $sort_options); |
| 197 | - } else { |
|
| 197 | + }else { |
|
| 198 | 198 | $sort_options=''; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
| 223 | 223 | * @return string |
| 224 | 224 | */ |
| 225 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 225 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 226 | 226 | if (is_array($js)) { |
| 227 | 227 | $js=implode("\n\t\t", $js); |
| 228 | 228 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
| 237 | 237 | else |
| 238 | 238 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
| 239 | - if($immediatly) |
|
| 239 | + if ($immediatly) |
|
| 240 | 240 | $this->jquery_code_for_compile[]=$event; |
| 241 | 241 | return $event; |
| 242 | 242 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | // External references |
| 278 | 278 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 279 | - extract(array ( |
|
| 279 | + extract(array( |
|
| 280 | 280 | 'library_src' => $external_scripts |
| 281 | 281 | )); |
| 282 | 282 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $script.='});'; |
| 292 | 292 | |
| 293 | 293 | $this->jquery_code_for_compile=array(); |
| 294 | - if($this->params["debug"]==false){ |
|
| 294 | + if ($this->params["debug"]==false) { |
|
| 295 | 295 | $script=$this->minify($script); |
| 296 | 296 | } |
| 297 | 297 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @return void |
| 312 | 312 | */ |
| 313 | 313 | public function _clear_compile() { |
| 314 | - $this->jquery_code_for_compile=array (); |
|
| 314 | + $this->jquery_code_for_compile=array(); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function _document_ready($js) { |
| 322 | 322 | if (!is_array($js)) { |
| 323 | - $js=array ( |
|
| 323 | + $js=array( |
|
| 324 | 324 | $js |
| 325 | 325 | ); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - foreach ( $js as $script ) { |
|
| 328 | + foreach ($js as $script) { |
|
| 329 | 329 | $this->jquery_code_for_compile[]=$script; |
| 330 | 330 | } |
| 331 | 331 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * @return string |
| 340 | 340 | */ |
| 341 | 341 | public function _prep_element($element) { |
| 342 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 342 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 343 | 343 | $element='"'.addslashes($element).'"'; |
| 344 | 344 | } |
| 345 | 345 | return $element; |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | if (is_array($value)) { |
| 358 | 358 | $value=implode(",", $value); |
| 359 | 359 | } |
| 360 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 360 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 361 | 361 | $value='"'.$value.'"'; |
| 362 | 362 | } |
| 363 | 363 | return $value; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | private function minify($input) { |
| 367 | - if(trim($input) === "") return $input; |
|
| 367 | + if (trim($input)==="") return $input; |
|
| 368 | 368 | return preg_replace( |
| 369 | 369 | array( |
| 370 | 370 | // Remove comment(s) |