@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | public static function renderScriptFiles($files) |
35 | 35 | { |
36 | 36 | $str = ''; |
37 | - foreach($files as $file) |
|
38 | - $str .= self::renderScriptFile($file); |
|
37 | + foreach($files as $file) { |
|
38 | + $str .= self::renderScriptFile($file); |
|
39 | + } |
|
39 | 40 | return $str; |
40 | 41 | } |
41 | 42 | |
@@ -160,8 +161,7 @@ discard block |
||
160 | 161 | } |
161 | 162 | } |
162 | 163 | return '{' . $results . '}'; |
163 | - } |
|
164 | - else |
|
164 | + } else |
|
165 | 165 | { |
166 | 166 | foreach($value as $v) |
167 | 167 | { |
@@ -174,8 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | return '[' . $results . ']'; |
176 | 176 | } |
177 | - } |
|
178 | - elseif(is_int($value)) |
|
177 | + } elseif(is_int($value)) |
|
179 | 178 | return "$value"; |
180 | 179 | elseif(is_float($value)) |
181 | 180 | { |
@@ -195,8 +194,7 @@ discard block |
||
195 | 194 | return str_replace($locale['decimal_point'], '.', "$value"); |
196 | 195 | break; |
197 | 196 | } |
198 | - } |
|
199 | - elseif(is_object($value)) |
|
197 | + } elseif(is_object($value)) |
|
200 | 198 | if ($value instanceof TJavaScriptLiteral) |
201 | 199 | return $value->toJavaScriptLiteral(); |
202 | 200 | else |
@@ -234,8 +232,9 @@ discard block |
||
234 | 232 | $value = iconv($sourceEncoding, 'UTF-8', $value); |
235 | 233 | elseif (is_array($value)) |
236 | 234 | { |
237 | - foreach($value as &$element) |
|
238 | - self::convertToUtf8($element, $sourceEncoding); |
|
235 | + foreach($value as &$element) { |
|
236 | + self::convertToUtf8($element, $sourceEncoding); |
|
237 | + } |
|
239 | 238 | } |
240 | 239 | } |
241 | 240 |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | if(!isset(self::$_template[$class])) |
73 | 73 | self::$_template[$class] = $this->loadTemplate(); |
74 | 74 | return self::$_template[$class]; |
75 | - } |
|
76 | - else |
|
75 | + } else |
|
77 | 76 | return $this->_localTemplate; |
78 | 77 | } |
79 | 78 | |
@@ -208,8 +207,7 @@ discard block |
||
208 | 207 | $controls = $placeholder->getParent()->getControls(); |
209 | 208 | $loc = $controls->remove($placeholder); |
210 | 209 | $controls->insertAt($loc, $content); |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
214 | 212 | } |
215 | 213 | |
@@ -233,10 +231,10 @@ discard block |
||
233 | 231 | $this->getControls()->clear(); |
234 | 232 | $this->getControls()->add($master); |
235 | 233 | $master->ensureChildControls(); |
236 | - foreach($this->_contents as $id => $content) |
|
237 | - $master->injectContent($id, $content); |
|
238 | - } |
|
239 | - elseif(!empty($this->_contents)) |
|
234 | + foreach($this->_contents as $id => $content) { |
|
235 | + $master->injectContent($id, $content); |
|
236 | + } |
|
237 | + } elseif(!empty($this->_contents)) |
|
240 | 238 | throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
241 | 239 | parent::initRecursive($namingContainer); |
242 | 240 | } |
@@ -264,8 +262,7 @@ discard block |
||
264 | 262 | $control->Checked = (boolean) $arObj->{$key}; |
265 | 263 | elseif ($control instanceof TDatePicker) |
266 | 264 | $control->Date = $arObj->{$key}; |
267 | - } |
|
268 | - else |
|
265 | + } else |
|
269 | 266 | { |
270 | 267 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
271 | 268 | { |
@@ -287,8 +284,7 @@ discard block |
||
287 | 284 | } |
288 | 285 | break; |
289 | 286 | } |
290 | - } |
|
291 | - catch (Exception $ex) |
|
287 | + } catch (Exception $ex) |
|
292 | 288 | { |
293 | 289 | if ($throwExceptions) |
294 | 290 | throw $ex; |
@@ -318,8 +314,7 @@ discard block |
||
318 | 314 | $arObj->{$key} = $control->Checked; |
319 | 315 | elseif ($control instanceof TDatePicker) |
320 | 316 | $arObj->{$key} = $control->Date; |
321 | - } |
|
322 | - catch (Exception $ex) |
|
317 | + } catch (Exception $ex) |
|
323 | 318 | { |
324 | 319 | if ($throwExceptions) |
325 | 320 | throw $ex; |
@@ -220,8 +220,9 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | - foreach($packagesUrl as $url) |
|
224 | - $this->registerScriptFile($url, $url); |
|
223 | + foreach($packagesUrl as $url) { |
|
224 | + $this->registerScriptFile($url, $url); |
|
225 | + } |
|
225 | 226 | } |
226 | 227 | } |
227 | 228 | } |
@@ -275,8 +276,7 @@ discard block |
||
275 | 276 | if(strpos($base, $assets->getBaseUrl()) === false) |
276 | 277 | { |
277 | 278 | return [$assets->getPublishedPath($base), $assets->publishFilePath($base)]; |
278 | - } |
|
279 | - else |
|
279 | + } else |
|
280 | 280 | { |
281 | 281 | return [$assets->getBasePath() . str_replace($assets->getBaseUrl(), '', $base), $base]; |
282 | 282 | } |
@@ -491,8 +491,9 @@ discard block |
||
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
494 | - foreach($packagesUrl as $url) |
|
495 | - $this->registerStyleSheetFile($url, $url); |
|
494 | + foreach($packagesUrl as $url) { |
|
495 | + $this->registerStyleSheetFile($url, $url); |
|
496 | + } |
|
496 | 497 | } |
497 | 498 | } |
498 | 499 | } |
@@ -555,9 +556,10 @@ discard block |
||
555 | 556 | }, $this->_styleSheetFiles) |
556 | 557 | ); |
557 | 558 | |
558 | - foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path => $url) |
|
559 | - if (substr($url, strlen($url) - 4) == '.css') |
|
559 | + foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path => $url) { |
|
560 | + if (substr($url, strlen($url) - 4) == '.css') |
|
560 | 561 | $stylesheets[] = $url; |
562 | + } |
|
561 | 563 | |
562 | 564 | $stylesheets = array_unique($stylesheets); |
563 | 565 | |
@@ -901,10 +903,10 @@ discard block |
||
901 | 903 | $id = strtr($name, ':', '_'); |
902 | 904 | if(is_array($value)) |
903 | 905 | { |
904 | - foreach($value as $v) |
|
905 | - $str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '[]" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n"; |
|
906 | - } |
|
907 | - else |
|
906 | + foreach($value as $v) { |
|
907 | + $str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '[]" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n"; |
|
908 | + } |
|
909 | + } else |
|
908 | 910 | { |
909 | 911 | $str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n"; |
910 | 912 | } |
@@ -102,13 +102,13 @@ |
||
102 | 102 | $includedFiles = $template->getIncludedFiles(); |
103 | 103 | $timestamps = []; |
104 | 104 | $timestamps[$fileName] = filemtime($fileName); |
105 | - foreach($includedFiles as $includedFile) |
|
106 | - $timestamps[$includedFile] = filemtime($includedFile); |
|
105 | + foreach($includedFiles as $includedFile) { |
|
106 | + $timestamps[$includedFile] = filemtime($includedFile); |
|
107 | + } |
|
107 | 108 | $cache->set(self::TEMPLATE_CACHE_PREFIX . $fileName, [$template,$timestamps]); |
108 | 109 | return $template; |
109 | 110 | } |
110 | - } |
|
111 | - else |
|
111 | + } else |
|
112 | 112 | return null; |
113 | 113 | } |
114 | 114 |
@@ -115,8 +115,9 @@ |
||
115 | 115 | { |
116 | 116 | $this->updateListItems(); |
117 | 117 | $list = []; |
118 | - foreach($values as $value) |
|
119 | - $list[] = $value; |
|
118 | + foreach($values as $value) { |
|
119 | + $list[] = $value; |
|
120 | + } |
|
120 | 121 | if(count($list) > 0) |
121 | 122 | $this->getPage()->getCallbackClient()->select( |
122 | 123 | $this->getControl(), 'Values', $list); |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | $control->setData($text); |
52 | 52 | } |
53 | 53 | $cell->getControls()->add($control); |
54 | - } |
|
55 | - elseif($this->getAllowSorting()) |
|
54 | + } elseif($this->getAllowSorting()) |
|
56 | 55 | { |
57 | 56 | $sortExpression = $this->getSortExpression(); |
58 | 57 | if(($url = $this->getHeaderImageUrl()) !== '') |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | $button->setAlternateText($text); |
66 | 65 | $button->setCausesValidation(false); |
67 | 66 | $cell->getControls()->add($button); |
68 | - } |
|
69 | - elseif($text !== '') |
|
67 | + } elseif($text !== '') |
|
70 | 68 | { |
71 | 69 | $button = new TActiveLinkButton; |
72 | 70 | $button->setText($text); |
@@ -74,11 +72,9 @@ discard block |
||
74 | 72 | $button->setCommandParameter($sortExpression); |
75 | 73 | $button->setCausesValidation(false); |
76 | 74 | $cell->getControls()->add($button); |
77 | - } |
|
78 | - else |
|
75 | + } else |
|
79 | 76 | $cell->setText(' '); |
80 | - } |
|
81 | - else |
|
77 | + } else |
|
82 | 78 | { |
83 | 79 | if(($url = $this->getHeaderImageUrl()) !== '') |
84 | 80 | { |
@@ -87,8 +83,7 @@ discard block |
||
87 | 83 | if($text !== '') |
88 | 84 | $image->setAlternateText($text); |
89 | 85 | $cell->getControls()->add($image); |
90 | - } |
|
91 | - elseif($text !== '') |
|
86 | + } elseif($text !== '') |
|
92 | 87 | $cell->setText($text); |
93 | 88 | else |
94 | 89 | $cell->setText(' '); |
@@ -164,8 +164,9 @@ discard block |
||
164 | 164 | { |
165 | 165 | Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
166 | 166 | //renders all the defered render() calls. |
167 | - foreach($this->_controlsToRender as $rid => $forRender) |
|
168 | - $forRender[0]->render($forRender[1]); |
|
167 | + foreach($this->_controlsToRender as $rid => $forRender) { |
|
168 | + $forRender[0]->render($forRender[1]); |
|
169 | + } |
|
169 | 170 | |
170 | 171 | $response = $this->getResponse(); |
171 | 172 | |
@@ -256,14 +257,12 @@ discard block |
||
256 | 257 | $param = $this->getCallbackEventParameter(); |
257 | 258 | $result = new TCallbackEventParameter($this->getResponse(), $param); |
258 | 259 | $callbackHandler->raiseCallbackEvent($result); |
259 | - } |
|
260 | - else |
|
260 | + } else |
|
261 | 261 | { |
262 | 262 | throw new TInvalidCallbackException( |
263 | 263 | 'callback_invalid_handler', $callbackHandler->getUniqueID()); |
264 | 264 | } |
265 | - } |
|
266 | - else |
|
265 | + } else |
|
267 | 266 | { |
268 | 267 | $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
269 | 268 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
@@ -121,8 +121,9 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function respondToChanges() |
123 | 123 | { |
124 | - foreach($this->getChanges() as $change) |
|
125 | - call_user_func_array($change[0], $change[1]); |
|
124 | + foreach($this->getChanges() as $change) { |
|
125 | + call_user_func_array($change[0], $change[1]); |
|
126 | + } |
|
126 | 127 | } |
127 | 128 | |
128 | 129 | /** |
@@ -200,7 +201,8 @@ discard block |
||
200 | 201 | */ |
201 | 202 | protected function updateAttributes($attributes) |
202 | 203 | { |
203 | - foreach($attributes as $name => $value) |
|
204 | - $this->client()->setAttribute($this->_control, $name, $value); |
|
204 | + foreach($attributes as $name => $value) { |
|
205 | + $this->client()->setAttribute($this->_control, $name, $value); |
|
206 | + } |
|
205 | 207 | } |
206 | 208 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | $control->setData($text); |
49 | 49 | } |
50 | 50 | $cell->getControls()->add($control); |
51 | - } |
|
52 | - elseif($this->getAllowSorting()) { |
|
51 | + } elseif($this->getAllowSorting()) { |
|
53 | 52 | $sortExpression = $this->getSortExpression(); |
54 | 53 | if(($url = $this->getHeaderImageUrl()) !== '') { |
55 | 54 | $button = new TActiveImageButton; |
@@ -62,19 +61,16 @@ discard block |
||
62 | 61 | } |
63 | 62 | $button->setCausesValidation(false); |
64 | 63 | $cell->getControls()->add($button); |
65 | - } |
|
66 | - elseif($text !== '') { |
|
64 | + } elseif($text !== '') { |
|
67 | 65 | $button = new TActiveLinkButton; |
68 | 66 | $button->setText($text); |
69 | 67 | $button->setCommandName(TDataGrid::CMD_SORT); |
70 | 68 | $button->setCommandParameter($sortExpression); |
71 | 69 | $button->setCausesValidation(false); |
72 | 70 | $cell->getControls()->add($button); |
73 | - } |
|
74 | - else |
|
71 | + } else |
|
75 | 72 | $cell->setText(' '); |
76 | - } |
|
77 | - else { |
|
73 | + } else { |
|
78 | 74 | if(($url = $this->getHeaderImageUrl()) !== '') { |
79 | 75 | $image = new TActiveImage; |
80 | 76 | $image->setImageUrl($url); |
@@ -83,8 +79,7 @@ discard block |
||
83 | 79 | $image->setToolTip($text); |
84 | 80 | } |
85 | 81 | $cell->getControls()->add($image); |
86 | - } |
|
87 | - elseif($text !== '') |
|
82 | + } elseif($text !== '') |
|
88 | 83 | $cell->setText($text); |
89 | 84 | else |
90 | 85 | $cell->setText(' '); |