@@ -123,8 +123,9 @@ |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | public function run(JsUtils $js){ |
126 | - if(JString::isNotNull($this->_identifier)) |
|
127 | - $js->execOn("click", "#".$this->_identifier." .ui.toggle", 'var active=$(this).hasClass("active");$(this).children("i").toggleClass("up",active).toggleClass("down",!active);var nextTd=$(this).closest("td").next("td");nextTd.children(":not(.toggle-caption)").toggle(active);nextTd.children(".toggle-caption").toggle(!active);$(this).trigger({type:"toggled",active: active,caption: nextTd.children(".toggle-caption")});'); |
|
126 | + if(JString::isNotNull($this->_identifier)) { |
|
127 | + $js->execOn("click", "#".$this->_identifier." .ui.toggle", 'var active=$(this).hasClass("active");$(this).children("i").toggleClass("up",active).toggleClass("down",!active);var nextTd=$(this).closest("td").next("td");nextTd.children(":not(.toggle-caption)").toggle(active);nextTd.children(".toggle-caption").toggle(!active);$(this).trigger({type:"toggled",active: active,caption: nextTd.children(".toggle-caption")});'); |
|
128 | + } |
|
128 | 129 | parent::run($js); |
129 | 130 | } |
130 | 131 | } |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | * @param string $popupEvent |
42 | 42 | */ |
43 | 43 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
44 | - if (isset($this->_popup)) |
|
45 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
44 | + if (isset($this->_popup)) { |
|
45 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | /** |
@@ -97,8 +98,9 @@ discard block |
||
97 | 98 | $labelO=$label; |
98 | 99 | if (\is_object($label) === false) { |
99 | 100 | $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
100 | - if (isset($icon)) |
|
101 | - $labelO->addIcon($icon); |
|
101 | + if (isset($icon)) { |
|
102 | + $labelO->addIcon($icon); |
|
103 | + } |
|
102 | 104 | } else { |
103 | 105 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
104 | 106 | } |
@@ -125,10 +127,12 @@ discard block |
||
125 | 127 | * @return HtmlSemDoubleElement |
126 | 128 | */ |
127 | 129 | public function asLink($href=NULL,$target=NULL) { |
128 | - if (isset($href)) |
|
129 | - $this->setProperty("href", $href); |
|
130 | - if(isset($target)) |
|
131 | - $this->setProperty("target", $target); |
|
130 | + if (isset($href)) { |
|
131 | + $this->setProperty("href", $href); |
|
132 | + } |
|
133 | + if(isset($target)) { |
|
134 | + $this->setProperty("target", $target); |
|
135 | + } |
|
132 | 136 | return $this->setTagName("a"); |
133 | 137 | } |
134 | 138 | |
@@ -139,8 +143,9 @@ discard block |
||
139 | 143 | */ |
140 | 144 | public function jsShowDimmer($show=true) { |
141 | 145 | $status="hide"; |
142 | - if ($show === true) |
|
143 | - $status="show"; |
|
146 | + if ($show === true) { |
|
147 | + $status="show"; |
|
148 | + } |
|
144 | 149 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
145 | 150 | } |
146 | 151 |
@@ -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) |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $retour.="var self=this;\n"; |
33 | 33 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
34 | 34 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
35 | - }elseif($hasLoader==="internal"){ |
|
35 | + } elseif($hasLoader==="internal"){ |
|
36 | 36 | $retour.="\n$(this).addClass('loading');"; |
37 | 37 | } |
38 | 38 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
50 | 50 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
51 | 51 | $retour=$this->_addJsCondition($jsCondition,$retour); |
52 | - if ($immediatly) |
|
53 | - $this->jquery_code_for_compile[]=$retour; |
|
52 | + if ($immediatly) { |
|
53 | + $this->jquery_code_for_compile[]=$retour; |
|
54 | + } |
|
54 | 55 | return $retour; |
55 | 56 | } |
56 | 57 | |
@@ -86,12 +87,13 @@ discard block |
||
86 | 87 | if(JString::isNotNull($attr)){ |
87 | 88 | if ($attr==="value"){ |
88 | 89 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
89 | - }elseif ($attr==="html"){ |
|
90 | + } elseif ($attr==="html"){ |
|
90 | 91 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
91 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
92 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
92 | 93 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
93 | - }elseif($attr!==null && $attr!=="") |
|
94 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
94 | + } elseif($attr!==null && $attr!=="") { |
|
95 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
96 | + } |
|
95 | 97 | } |
96 | 98 | return $retour; |
97 | 99 | } |
@@ -105,13 +107,14 @@ discard block |
||
105 | 107 | if (JString::isNotNull($responseElement)) { |
106 | 108 | if(isset($ajaxTransition)){ |
107 | 109 | $call=$this->setAjaxDataCall($ajaxTransition); |
108 | - }elseif(isset($this->ajaxTransition)){ |
|
110 | + } elseif(isset($this->ajaxTransition)){ |
|
109 | 111 | $call=$this->ajaxTransition; |
110 | 112 | } |
111 | - if(\is_callable($call)) |
|
112 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
113 | - else |
|
114 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
113 | + if(\is_callable($call)) { |
|
114 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
115 | + } else { |
|
116 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
117 | + } |
|
115 | 118 | } |
116 | 119 | if(isset($history)){ |
117 | 120 | $retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);"; |
@@ -132,8 +135,9 @@ discard block |
||
132 | 135 | } |
133 | 136 | |
134 | 137 | protected function _correctAjaxUrl($url) { |
135 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
136 | - $url=substr($url, 0, strlen($url)-1); |
|
138 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
139 | + $url=substr($url, 0, strlen($url)-1); |
|
140 | + } |
|
137 | 141 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
138 | 142 | $url=$this->getUrl($url); |
139 | 143 | } |
@@ -153,8 +157,9 @@ discard block |
||
153 | 157 | public static function _implodeParams($parameters){ |
154 | 158 | $allParameters=[]; |
155 | 159 | foreach ($parameters as $params){ |
156 | - if(isset($params)) |
|
157 | - $allParameters[]=self::_correctParams($params); |
|
160 | + if(isset($params)) { |
|
161 | + $allParameters[]=self::_correctParams($params); |
|
162 | + } |
|
158 | 163 | } |
159 | 164 | return \implode("+'&'+", $allParameters); |
160 | 165 | } |
@@ -180,8 +185,9 @@ discard block |
||
180 | 185 | |
181 | 186 | protected function setDefaultParameters(&$parameters,$default){ |
182 | 187 | foreach ($default as $k=>$v){ |
183 | - if(!isset($parameters[$k])) |
|
184 | - $parameters[$k]=$v; |
|
188 | + if(!isset($parameters[$k])) { |
|
189 | + $parameters[$k]=$v; |
|
190 | + } |
|
185 | 191 | } |
186 | 192 | } |
187 | 193 | |
@@ -299,7 +305,7 @@ discard block |
||
299 | 305 | if($context===null){ |
300 | 306 | $parent="$('".$maskSelector."').parent()"; |
301 | 307 | $newElm = "$('#'+newId)"; |
302 | - }else{ |
|
308 | + } else{ |
|
303 | 309 | $parent=$context; |
304 | 310 | $newElm = $context.".find('#'+newId)"; |
305 | 311 | } |
@@ -490,7 +496,7 @@ discard block |
||
490 | 496 | $retour.="var self=this;\n"; |
491 | 497 | if($hasLoader===true){ |
492 | 498 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
493 | - }elseif($hasLoader==="internal"){ |
|
499 | + } elseif($hasLoader==="internal"){ |
|
494 | 500 | $retour.="\n$(this).addClass('loading');"; |
495 | 501 | } |
496 | 502 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -508,8 +514,9 @@ discard block |
||
508 | 514 | $retour.="$('#".$form."').submit();\n"; |
509 | 515 | } |
510 | 516 | $retour=$this->_addJsCondition($jsCondition, $retour); |
511 | - if ($immediatly) |
|
512 | - $this->jquery_code_for_compile[]=$retour; |
|
517 | + if ($immediatly) { |
|
518 | + $this->jquery_code_for_compile[]=$retour; |
|
519 | + } |
|
513 | 520 | return $retour; |
514 | 521 | } |
515 | 522 |