@@ -14,16 +14,18 @@ |
||
14 | 14 | const TOGGLE_INTERVAL = 2; |
15 | 15 | |
16 | 16 | public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) { |
17 | - if (! isset($placeholder) && $type === "text") |
|
18 | - $placeholder = $label; |
|
17 | + if (! isset($placeholder) && $type === "text") { |
|
18 | + $placeholder = $label; |
|
19 | + } |
|
19 | 20 | parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
20 | 21 | $this->_identifier = $identifier; |
21 | 22 | } |
22 | 23 | |
23 | 24 | public function getDataField() { |
24 | 25 | $field = $this->getField(); |
25 | - if ($field instanceof HtmlInput) |
|
26 | - $field = $field->getDataField(); |
|
26 | + if ($field instanceof HtmlInput) { |
|
27 | + $field = $field->getDataField(); |
|
28 | + } |
|
27 | 29 | return $field; |
28 | 30 | } |
29 | 31 |
@@ -112,15 +112,18 @@ discard block |
||
112 | 112 | $flag = false; |
113 | 113 | $index = 0; |
114 | 114 | while (! $flag && $index < sizeof($elements)) { |
115 | - if ($elements[$index] instanceof BaseHtml) |
|
116 | - $flag = ($callback($elements[$index])); |
|
115 | + if ($elements[$index] instanceof BaseHtml) { |
|
116 | + $flag = ($callback($elements[$index])); |
|
117 | + } |
|
117 | 118 | $index ++; |
118 | 119 | } |
119 | - if ($flag === true) |
|
120 | - return $elements[$index - 1]; |
|
120 | + if ($flag === true) { |
|
121 | + return $elements[$index - 1]; |
|
122 | + } |
|
121 | 123 | } elseif ($elements instanceof BaseHtml) { |
122 | - if ($callback($elements)) |
|
123 | - return $elements; |
|
124 | + if ($callback($elements)) { |
|
125 | + return $elements; |
|
126 | + } |
|
124 | 127 | } |
125 | 128 | return null; |
126 | 129 | } |
@@ -146,8 +149,9 @@ discard block |
||
146 | 149 | |
147 | 150 | public function fromArray($array) { |
148 | 151 | foreach ($this as $key => $value) { |
149 | - if (array_key_exists($key, $array) === true) |
|
150 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
152 | + if (array_key_exists($key, $array) === true) { |
|
153 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
154 | + } |
|
151 | 155 | } |
152 | 156 | foreach ($array as $key => $value) { |
153 | 157 | if ($this->_callSetter($key, $key, $value, $array) === false) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if (isset($partial)) { |
68 | 68 | $ajaxParameters["xhr"] = "xhrProvider"; |
69 | 69 | $retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };"; |
70 | - }elseif (isset($upload)) { |
|
70 | + } elseif (isset($upload)) { |
|
71 | 71 | $ajaxParameters["xhr"] = "xhrProvider"; |
72 | 72 | $retour .= 'var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.upload.addEventListener("progress", function(event) {if (event.lengthComputable) {'.$upload.'}}, false);'; |
73 | 73 | } |
@@ -165,10 +165,11 @@ discard block |
||
165 | 165 | } elseif (isset($this->ajaxTransition)) { |
166 | 166 | $call = $this->ajaxTransition; |
167 | 167 | } |
168 | - if (\is_callable($call)) |
|
169 | - $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
170 | - else |
|
171 | - $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
168 | + if (\is_callable($call)) { |
|
169 | + $retour = "\t" . $call($responseElement, $jqueryDone) . ";\n"; |
|
170 | + } else { |
|
171 | + $retour = "\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
172 | + } |
|
172 | 173 | } |
173 | 174 | if (isset($history)) { |
174 | 175 | if ($this->params["autoActiveLinks"]) { |
@@ -208,8 +209,9 @@ discard block |
||
208 | 209 | } |
209 | 210 | |
210 | 211 | protected function _correctAjaxUrl($url) { |
211 | - if ($url !== "/" && JString::endsWith($url, "/") === true) |
|
212 | - $url = substr($url, 0, strlen($url) - 1); |
|
212 | + if ($url !== "/" && JString::endsWith($url, "/") === true) { |
|
213 | + $url = substr($url, 0, strlen($url) - 1); |
|
214 | + } |
|
213 | 215 | if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) { |
214 | 216 | $url = $this->getUrl($url); |
215 | 217 | } |
@@ -233,8 +235,9 @@ discard block |
||
233 | 235 | public static function _implodeParams($parameters) { |
234 | 236 | $allParameters = []; |
235 | 237 | foreach ($parameters as $params) { |
236 | - if (isset($params)) |
|
237 | - $allParameters[] = self::_correctParams($params); |
|
238 | + if (isset($params)) { |
|
239 | + $allParameters[] = self::_correctParams($params); |
|
240 | + } |
|
238 | 241 | } |
239 | 242 | return \implode("+'&'+", $allParameters); |
240 | 243 | } |
@@ -268,8 +271,9 @@ discard block |
||
268 | 271 | |
269 | 272 | protected function setDefaultParameters(&$parameters, $default) { |
270 | 273 | foreach ($default as $k => $v) { |
271 | - if (! isset($parameters[$k])) |
|
272 | - $parameters[$k] = $v; |
|
274 | + if (! isset($parameters[$k])) { |
|
275 | + $parameters[$k] = $v; |
|
276 | + } |
|
273 | 277 | } |
274 | 278 | } |
275 | 279 | |
@@ -844,8 +848,9 @@ discard block |
||
844 | 848 | $retour .= "$('#'+" . $form . ").submit();\n"; |
845 | 849 | } |
846 | 850 | $retour = $this->_addJsCondition($jsCondition, $retour); |
847 | - if ($immediatly) |
|
848 | - $this->jquery_code_for_compile[] = $retour; |
|
851 | + if ($immediatly) { |
|
852 | + $this->jquery_code_for_compile[] = $retour; |
|
853 | + } |
|
849 | 854 | return $retour; |
850 | 855 | } |
851 | 856 |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | * @param mixed $view |
20 | 20 | */ |
21 | 21 | protected function _compileLibrary(BaseGui $library, &$view = NULL) { |
22 | - if (isset($view)) |
|
23 | - $library->compileHtml($this, $view); |
|
22 | + if (isset($view)) { |
|
23 | + $library->compileHtml($this, $view); |
|
24 | + } |
|
24 | 25 | if ($library->isAutoCompile()) { |
25 | 26 | $library->compile(true); |
26 | 27 | } |
@@ -39,8 +40,9 @@ discard block |
||
39 | 40 | } |
40 | 41 | |
41 | 42 | protected function minify($input) { |
42 | - if (trim($input) === "") |
|
43 | - return $input; |
|
43 | + if (trim($input) === "") { |
|
44 | + return $input; |
|
45 | + } |
|
44 | 46 | $input = preg_replace(array( |
45 | 47 | // Remove comment(s) |
46 | 48 | '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#', |
@@ -59,10 +59,12 @@ discard block |
||
59 | 59 | #[\ReturnTypeWillChange] |
60 | 60 | public function jsonSerialize() { |
61 | 61 | $result= ["type"=>$this->type]; |
62 | - if(isset($this->prompt)) |
|
63 | - $result["prompt"]=$this->prompt; |
|
64 | - if(isset($this->value)) |
|
65 | - $result["value"]=$this->value; |
|
62 | + if(isset($this->prompt)) { |
|
63 | + $result["prompt"]=$this->prompt; |
|
64 | + } |
|
65 | + if(isset($this->value)) { |
|
66 | + $result["value"]=$this->value; |
|
67 | + } |
|
66 | 68 | return $result; |
67 | 69 | } |
68 | 70 | |
@@ -94,8 +96,9 @@ discard block |
||
94 | 96 | * @return \Ajax\semantic\components\validation\Rule |
95 | 97 | */ |
96 | 98 | public static function integer($min=NULL,$max=NULL,$prompt=NULL){ |
97 | - if(\is_int($min) && \is_int($max)) |
|
98 | - return new Rule("integer[{$min}..{$max}]",$prompt); |
|
99 | + if(\is_int($min) && \is_int($max)) { |
|
100 | + return new Rule("integer[{$min}..{$max}]",$prompt); |
|
101 | + } |
|
99 | 102 | return new Rule("integer",$prompt); |
100 | 103 | } |
101 | 104 |