@@ -68,10 +68,11 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | public function setDismissable($dismiss=true){ |
71 | - if($dismiss===true) |
|
72 | - $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
73 | - else |
|
74 | - $this->close=NULL; |
|
71 | + if($dismiss===true) { |
|
72 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
73 | + } else { |
|
74 | + $this->close=NULL; |
|
75 | + } |
|
75 | 76 | return $this; |
76 | 77 | } |
77 | 78 | |
@@ -115,8 +116,9 @@ discard block |
||
115 | 116 | public function setMessage($message){ |
116 | 117 | if(\is_array($this->content)){ |
117 | 118 | $this->content[\sizeof($this->content)-1]=$message; |
118 | - }else |
|
119 | - $this->setContent($message); |
|
119 | + } else { |
|
120 | + $this->setContent($message); |
|
121 | + } |
|
120 | 122 | } |
121 | 123 | |
122 | 124 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | $actionO=$action; |
48 | 48 | if (\is_object($action) === false) { |
49 | 49 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
50 | - if (isset($icon)) |
|
51 | - $actionO->addIcon($icon, true, $labeled); |
|
50 | + if (isset($icon)) { |
|
51 | + $actionO->addIcon($icon, true, $labeled); |
|
52 | + } |
|
52 | 53 | } |
53 | 54 | $field->addToProperty("class", $direction . " action"); |
54 | 55 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | |
83 | 84 | public function setDisabled($disable=true) { |
84 | 85 | $field=$this->getField(); |
85 | - if($disable) |
|
86 | - $field->addToProperty("class", "disabled"); |
|
86 | + if($disable) { |
|
87 | + $field->addToProperty("class", "disabled"); |
|
88 | + } |
|
87 | 89 | return $this; |
88 | 90 | } |
89 | 91 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | 27 | foreach ( $input as $v ) { |
28 | - if (\is_object($v) || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) || \is_array($v)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | return false; |
32 | 33 | } |
@@ -44,12 +45,13 @@ discard block |
||
44 | 45 | |
45 | 46 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | 47 | return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
47 | - if (is_object($v)) |
|
48 | - return $v->compile($js); |
|
49 | - elseif (\is_array($v)) { |
|
48 | + if (is_object($v)) { |
|
49 | + return $v->compile($js); |
|
50 | + } elseif (\is_array($v)) { |
|
50 | 51 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
52 | - return $v; |
|
52 | + } else { |
|
53 | + return $v; |
|
54 | + } |
|
53 | 55 | }, $input)); |
54 | 56 | } |
55 | 57 | } |
@@ -28,10 +28,11 @@ discard block |
||
28 | 28 | $this->setProperty("aria-describedby", $id); |
29 | 29 | $span->setContent($text); |
30 | 30 | $span->setClass("input-group-addon"); |
31 | - if (strtolower($position)==="left") |
|
32 | - $this->addonLeft=$span; |
|
33 | - else |
|
34 | - $this->addonRight=$span; |
|
31 | + if (strtolower($position)==="left") { |
|
32 | + $this->addonLeft=$span; |
|
33 | + } else { |
|
34 | + $this->addonRight=$span; |
|
35 | + } |
|
35 | 36 | return $span; |
36 | 37 | } |
37 | 38 | |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | $bt=NULL; |
75 | 76 | if(is_string($item)){ |
76 | 77 | $bt=new HtmlButton($this->identifier."-bt-".$i++,$item); |
77 | - }elseif ($item instanceof HtmlButton){ |
|
78 | + } elseif ($item instanceof HtmlButton){ |
|
78 | 79 | $bt=$item; |
79 | 80 | } |
80 | 81 | if(isset($bt)){ |
@@ -88,10 +89,11 @@ discard block |
||
88 | 89 | $dropdown->setBtnCaption($caption); |
89 | 90 | $dropdown->fromArray($items); |
90 | 91 | |
91 | - if (strtolower($position)==="left") |
|
92 | - $this->addonLeft=$dropdown; |
|
93 | - else |
|
94 | - $this->addonRight=$dropdown; |
|
92 | + if (strtolower($position)==="left") { |
|
93 | + $this->addonLeft=$dropdown; |
|
94 | + } else { |
|
95 | + $this->addonRight=$dropdown; |
|
96 | + } |
|
95 | 97 | return $dropdown; |
96 | 98 | } |
97 | 99 | |
@@ -126,10 +128,12 @@ discard block |
||
126 | 128 | |
127 | 129 | public function run(JsUtils $js) { |
128 | 130 | parent::run($js); |
129 | - if (isset($this->addonLeft)) |
|
130 | - $this->addonLeft->run($js); |
|
131 | - if (isset($this->addonRight)) |
|
132 | - $this->addonRight->run($js); |
|
131 | + if (isset($this->addonLeft)) { |
|
132 | + $this->addonLeft->run($js); |
|
133 | + } |
|
134 | + if (isset($this->addonRight)) { |
|
135 | + $this->addonRight->run($js); |
|
136 | + } |
|
133 | 137 | } |
134 | 138 | |
135 | 139 | } |
@@ -69,7 +69,8 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | public function getPanel($index) { |
72 | - if ($index<sizeof($this->content)) |
|
73 | - return $this->content [$index]; |
|
72 | + if ($index<sizeof($this->content)) { |
|
73 | + return $this->content [$index]; |
|
74 | + } |
|
74 | 75 | } |
75 | 76 | } |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | * @return \Ajax\bootstrap\html\HtmlPanel default : "panel-default" |
90 | 90 | */ |
91 | 91 | public function setStyle($cssStyle) { |
92 | - if (!PhalconUtils::startsWith($cssStyle, "panel")) |
|
93 | - $cssStyle="panel".$cssStyle; |
|
92 | + if (!PhalconUtils::startsWith($cssStyle, "panel")) { |
|
93 | + $cssStyle="panel".$cssStyle; |
|
94 | + } |
|
94 | 95 | return $this->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("panel")); |
95 | 96 | } |
96 | 97 | |
@@ -132,7 +133,8 @@ discard block |
||
132 | 133 | * @return $this default : false |
133 | 134 | */ |
134 | 135 | public function show($value) { |
135 | - if ($this->_collapsable) |
|
136 | - $this->_showOnStartup=$value; |
|
136 | + if ($this->_collapsable) { |
|
137 | + $this->_showOnStartup=$value; |
|
138 | + } |
|
137 | 139 | } |
138 | 140 | } |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function getTab($index) { |
39 | - if ($index>0&&$index<sizeof($this->tabs)) |
|
40 | - return $this->tabs [$index]; |
|
39 | + if ($index>0&&$index<sizeof($this->tabs)) { |
|
40 | + return $this->tabs [$index]; |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | |
43 | 44 | public function show($index) { |
@@ -53,8 +54,9 @@ discard block |
||
53 | 54 | */ |
54 | 55 | public function onShow($index, $jsCode) { |
55 | 56 | $tab=$this->getTab($index); |
56 | - if (isset($tab)) |
|
57 | - return $tab->onShow($jsCode); |
|
57 | + if (isset($tab)) { |
|
58 | + return $tab->onShow($jsCode); |
|
59 | + } |
|
58 | 60 | } |
59 | 61 | |
60 | 62 | /** |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | */ |
66 | 68 | public function onShown($index, $jsCode) { |
67 | 69 | $tab=$this->getTab($index); |
68 | - if (isset($tab)) |
|
69 | - return $tab->onShown($jsCode); |
|
70 | + if (isset($tab)) { |
|
71 | + return $tab->onShown($jsCode); |
|
72 | + } |
|
70 | 73 | } |
71 | 74 | |
72 | 75 | /** |
@@ -77,8 +80,9 @@ discard block |
||
77 | 80 | */ |
78 | 81 | public function onHide($index, $jsCode) { |
79 | 82 | $tab=$this->getTab($index); |
80 | - if (isset($tab)) |
|
81 | - return $tab->onShow($jsCode); |
|
83 | + if (isset($tab)) { |
|
84 | + return $tab->onShow($jsCode); |
|
85 | + } |
|
82 | 86 | } |
83 | 87 | |
84 | 88 | /** |
@@ -89,7 +93,8 @@ discard block |
||
89 | 93 | */ |
90 | 94 | public function onHidden($index, $jsCode) { |
91 | 95 | $tab=$this->getTab($index); |
92 | - if (isset($tab)) |
|
93 | - return $tab->onShow($jsCode); |
|
96 | + if (isset($tab)) { |
|
97 | + return $tab->onShow($jsCode); |
|
98 | + } |
|
94 | 99 | } |
95 | 100 | } |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | } |
30 | 30 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
31 | 31 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
32 | - if ($immediatly) |
|
33 | - $this->jquery_code_for_compile[]=$retour; |
|
32 | + if ($immediatly) { |
|
33 | + $this->jquery_code_for_compile[]=$retour; |
|
34 | + } |
|
34 | 35 | return $retour; |
35 | 36 | } |
36 | 37 | |
@@ -40,15 +41,17 @@ discard block |
||
40 | 41 | $url=$this->_correctAjaxUrl($url); |
41 | 42 | $retour="url='".$url."';"; |
42 | 43 | $slash="/"; |
43 | - if(JString::endswith($url, "/")===true) |
|
44 | - $slash=""; |
|
44 | + if(JString::endswith($url, "/")===true) { |
|
45 | + $slash=""; |
|
46 | + } |
|
45 | 47 | if(JString::isNotNull($attr)){ |
46 | - if ($attr==="value") |
|
47 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
48 | - elseif ($attr==="html") |
|
49 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
50 | - elseif($attr!==null && $attr!=="") |
|
51 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
48 | + if ($attr==="value") { |
|
49 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
50 | + } elseif ($attr==="html") { |
|
51 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
52 | + } elseif($attr!==null && $attr!=="") { |
|
53 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
54 | + } |
|
52 | 55 | } |
53 | 56 | return $retour; |
54 | 57 | } |
@@ -58,13 +61,14 @@ discard block |
||
58 | 61 | if ($responseElement!=="") { |
59 | 62 | if(isset($ajaxTransition)){ |
60 | 63 | $call=$this->setAjaxDataCall($ajaxTransition); |
61 | - }elseif(isset($this->ajaxTransition)){ |
|
64 | + } elseif(isset($this->ajaxTransition)){ |
|
62 | 65 | $call=$this->ajaxTransition; |
63 | 66 | } |
64 | - if(\is_callable($call)) |
|
65 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
66 | - else |
|
67 | - $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
67 | + if(\is_callable($call)) { |
|
68 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
69 | + } else { |
|
70 | + $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
71 | + } |
|
68 | 72 | } |
69 | 73 | $retour.="\t".$jsCallback."\n"; |
70 | 74 | return $retour; |
@@ -78,8 +82,9 @@ discard block |
||
78 | 82 | } |
79 | 83 | |
80 | 84 | protected function _correctAjaxUrl($url) { |
81 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
82 | - $url=substr($url, 0, strlen($url)-1); |
|
85 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
86 | + $url=substr($url, 0, strlen($url)-1); |
|
87 | + } |
|
83 | 88 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
84 | 89 | $url=$this->getUrl($url); |
85 | 90 | } |
@@ -159,8 +164,9 @@ discard block |
||
159 | 164 | $retour.="\t".$jsCallback."\n". |
160 | 165 | "\t$(document).trigger('jsonReady',[data]);\n". |
161 | 166 | "});\n"; |
162 | - if ($immediatly) |
|
163 | - $this->jquery_code_for_compile[]=$retour; |
|
167 | + if ($immediatly) { |
|
168 | + $this->jquery_code_for_compile[]=$retour; |
|
169 | + } |
|
164 | 170 | return $retour; |
165 | 171 | } |
166 | 172 | |
@@ -225,7 +231,7 @@ discard block |
||
225 | 231 | if($context===null){ |
226 | 232 | $parent="$('".$maskSelector."').parent()"; |
227 | 233 | $newElm = "$('#'+newId)"; |
228 | - }else{ |
|
234 | + } else{ |
|
229 | 235 | $parent=$context; |
230 | 236 | $newElm = $context.".find('#'+newId)"; |
231 | 237 | } |
@@ -238,8 +244,9 @@ discard block |
||
238 | 244 | $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"; |
239 | 245 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
240 | 246 | $retour.="\t".$jsCallback."\n"."});\n"; |
241 | - if ($immediatly) |
|
242 | - $this->jquery_code_for_compile[]=$retour; |
|
247 | + if ($immediatly) { |
|
248 | + $this->jquery_code_for_compile[]=$retour; |
|
249 | + } |
|
243 | 250 | return $retour; |
244 | 251 | } |
245 | 252 | |
@@ -430,8 +437,9 @@ discard block |
||
430 | 437 | }});\n"; |
431 | 438 | $retour.="$('#".$form."').submit();\n"; |
432 | 439 | } |
433 | - if ($immediatly) |
|
434 | - $this->jquery_code_for_compile[]=$retour; |
|
440 | + if ($immediatly) { |
|
441 | + $this->jquery_code_for_compile[]=$retour; |
|
442 | + } |
|
435 | 443 | return $retour; |
436 | 444 | } |
437 | 445 |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | $callback=", function(){\n{$callback}\n}"; |
29 | 29 | } |
30 | 30 | $str="$({$element}).{$action}({$speed}{$callback});"; |
31 | - if ($immediatly) |
|
32 | - $this->jquery_code_for_compile[]=$str; |
|
31 | + if ($immediatly) { |
|
32 | + $this->jquery_code_for_compile[]=$str; |
|
33 | + } |
|
33 | 34 | return $str; |
34 | 35 | } |
35 | 36 | /** |
@@ -61,10 +62,12 @@ discard block |
||
61 | 62 | if (isset($param)) { |
62 | 63 | $param=Javascript::prep_value($param); |
63 | 64 | $str="$({$element}).{$jQueryCall}({$param});"; |
64 | - } else |
|
65 | - $str="$({$element}).{$jQueryCall}();"; |
|
66 | - if ($immediatly) |
|
67 | - $this->jquery_code_for_compile[]=$str; |
|
65 | + } else { |
|
66 | + $str="$({$element}).{$jQueryCall}();"; |
|
67 | + } |
|
68 | + if ($immediatly) { |
|
69 | + $this->jquery_code_for_compile[]=$str; |
|
70 | + } |
|
68 | 71 | return $str; |
69 | 72 | } |
70 | 73 | |
@@ -80,8 +83,9 @@ discard block |
||
80 | 83 | $to=Javascript::prep_element($to); |
81 | 84 | $element=Javascript::prep_element($element); |
82 | 85 | $str="$({$to}).{$jQueryCall}({$element});"; |
83 | - if ($immediatly) |
|
84 | - $this->jquery_code_for_compile[]=$str; |
|
86 | + if ($immediatly) { |
|
87 | + $this->jquery_code_for_compile[]=$str; |
|
88 | + } |
|
85 | 89 | return $str; |
86 | 90 | } |
87 | 91 | /** |
@@ -130,10 +134,12 @@ discard block |
||
130 | 134 | if (isset($value)) { |
131 | 135 | $value=Javascript::prep_value($value); |
132 | 136 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
133 | - } else |
|
134 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
135 | - if ($immediatly) |
|
136 | - $this->jquery_code_for_compile[]=$str; |
|
137 | + } else { |
|
138 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
139 | + } |
|
140 | + if ($immediatly) { |
|
141 | + $this->jquery_code_for_compile[]=$str; |
|
142 | + } |
|
137 | 143 | return $str; |
138 | 144 | } |
139 | 145 | |
@@ -189,8 +195,9 @@ discard block |
||
189 | 195 | |
190 | 196 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
191 | 197 | |
192 | - if ($immediatly) |
|
193 | - $this->jquery_code_for_compile[]=$str; |
|
198 | + if ($immediatly) { |
|
199 | + $this->jquery_code_for_compile[]=$str; |
|
200 | + } |
|
194 | 201 | return $str; |
195 | 202 | } |
196 | 203 | |
@@ -340,8 +347,9 @@ discard block |
||
340 | 347 | $element=Javascript::prep_element($element); |
341 | 348 | $str="$({$element}).trigger(\"$event\");"; |
342 | 349 | |
343 | - if ($immediatly) |
|
344 | - $this->jquery_code_for_compile[]=$str; |
|
350 | + if ($immediatly) { |
|
351 | + $this->jquery_code_for_compile[]=$str; |
|
352 | + } |
|
345 | 353 | return $str; |
346 | 354 | } |
347 | 355 | |
@@ -403,8 +411,9 @@ discard block |
||
403 | 411 | $str.="else{".$jsCodeIfFalse."}"; |
404 | 412 | } |
405 | 413 | |
406 | - if ($immediatly) |
|
407 | - $this->jquery_code_for_compile[]=$str; |
|
414 | + if ($immediatly) { |
|
415 | + $this->jquery_code_for_compile[]=$str; |
|
416 | + } |
|
408 | 417 | return $str; |
409 | 418 | } |
410 | 419 | |
@@ -420,11 +429,13 @@ discard block |
||
420 | 429 | private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
421 | 430 | $param=Javascript::prep_value($param); |
422 | 431 | $callback=""; |
423 | - if ($jsCallback!="") |
|
424 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
432 | + if ($jsCallback!="") { |
|
433 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
434 | + } |
|
425 | 435 | $script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
426 | - if ($immediatly) |
|
427 | - $this->jquery_code_for_compile[]=$script; |
|
436 | + if ($immediatly) { |
|
437 | + $this->jquery_code_for_compile[]=$script; |
|
438 | + } |
|
428 | 439 | return $script; |
429 | 440 | } |
430 | 441 | |
@@ -495,8 +506,9 @@ discard block |
||
495 | 506 | */ |
496 | 507 | public function exec($js, $immediatly=false) { |
497 | 508 | $script=$js."\n"; |
498 | - if ($immediatly) |
|
499 | - $this->jquery_code_for_compile[]=$script; |
|
509 | + if ($immediatly) { |
|
510 | + $this->jquery_code_for_compile[]=$script; |
|
511 | + } |
|
500 | 512 | return $script; |
501 | 513 | } |
502 | 514 |