@@ -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 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | self::$_scriptsPackages = $packages; |
180 | 180 | } |
181 | 181 | |
182 | - if (isset(self::$_scripts[$name])) |
|
182 | + if(isset(self::$_scripts[$name])) |
|
183 | 183 | $this->_registeredScripts[$name] = true; |
184 | 184 | else |
185 | 185 | throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name); |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | { |
189 | 189 | $packagesUrl = []; |
190 | 190 | $isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug; |
191 | - foreach ($packages as $p) |
|
191 | + foreach($packages as $p) |
|
192 | 192 | { |
193 | - foreach (self::$_scripts[$p] as $dep) |
|
193 | + foreach(self::$_scripts[$p] as $dep) |
|
194 | 194 | { |
195 | - foreach (self::$_scriptsPackages[$dep] as $script) |
|
195 | + foreach(self::$_scriptsPackages[$dep] as $script) |
|
196 | 196 | { |
197 | - if (!isset($this->_expandedScripts[$script])) |
|
197 | + if(!isset($this->_expandedScripts[$script])) |
|
198 | 198 | { |
199 | 199 | list($base, $subPath) = $this->getScriptPackageFolder($script); |
200 | 200 | list($path, $baseUrl) = $this->getPackagePathUrl($base); |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | $this->_expandedScripts[$script] = true; |
203 | 203 | if($isDebug) |
204 | 204 | { |
205 | - if (!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl)) |
|
205 | + if(!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl)) |
|
206 | 206 | $packagesUrl[] = $url; |
207 | 207 | } else { |
208 | 208 | $minPath = preg_replace('/^(.*)(?<!\.min)\.js$/', "\\1.min.js", $subPath); |
209 | - if (!in_array($url = $baseUrl . '/' . $minPath, $packagesUrl)) |
|
209 | + if(!in_array($url = $baseUrl . '/' . $minPath, $packagesUrl)) |
|
210 | 210 | { |
211 | 211 | if(!is_file($filePath = $path . DIRECTORY_SEPARATOR . $minPath)) |
212 | 212 | { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function registerDefaultButton($panel, $button) |
387 | 387 | { |
388 | - $panelID = is_string($panel)?$panel:$panel->getUniqueID(); |
|
388 | + $panelID = is_string($panel) ? $panel : $panel->getUniqueID(); |
|
389 | 389 | |
390 | 390 | if(is_string($button)) |
391 | 391 | $buttonID = $button; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $this->_endScripts['prado:' . $panelID] = $code; |
401 | 401 | $this->registerPradoScriptInternal('prado'); |
402 | 402 | |
403 | - $params = [$panelID,$buttonID]; |
|
403 | + $params = [$panelID, $buttonID]; |
|
404 | 404 | $this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params); |
405 | 405 | } |
406 | 406 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | self::$_stylesPackages = $packages; |
464 | 464 | } |
465 | 465 | |
466 | - if (isset(self::$_styles[$name])) |
|
466 | + if(isset(self::$_styles[$name])) |
|
467 | 467 | $this->_registeredStyles[$name] = true; |
468 | 468 | else |
469 | 469 | throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name); |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | { |
473 | 473 | $packagesUrl = []; |
474 | 474 | $isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug; |
475 | - foreach ($packages as $p) |
|
475 | + foreach($packages as $p) |
|
476 | 476 | { |
477 | - foreach (self::$_styles[$p] as $dep) |
|
477 | + foreach(self::$_styles[$p] as $dep) |
|
478 | 478 | { |
479 | - foreach (self::$_stylesPackages[$dep] as $style) |
|
479 | + foreach(self::$_stylesPackages[$dep] as $style) |
|
480 | 480 | { |
481 | - if (!isset($this->_expandedStyles[$style])) |
|
481 | + if(!isset($this->_expandedStyles[$style])) |
|
482 | 482 | { |
483 | 483 | list($base, $subPath) = $this->getStylePackageFolder($style); |
484 | 484 | list($path, $baseUrl) = $this->getPackagePathUrl($base); |
485 | 485 | |
486 | 486 | $this->_expandedStyles[$style] = true; |
487 | 487 | // TODO minify css? |
488 | - if (!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl)) |
|
488 | + if(!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl)) |
|
489 | 489 | $packagesUrl[] = $url; |
490 | 490 | } |
491 | 491 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | if($media === '') |
525 | 525 | $this->_styleSheetFiles[$key] = $url; |
526 | 526 | else |
527 | - $this->_styleSheetFiles[$key] = [$url,$media]; |
|
527 | + $this->_styleSheetFiles[$key] = [$url, $media]; |
|
528 | 528 | |
529 | 529 | $params = func_get_args(); |
530 | 530 | $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | ); |
557 | 557 | |
558 | 558 | foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path => $url) |
559 | - if (substr($url, strlen($url) - 4) == '.css') |
|
559 | + if(substr($url, strlen($url) - 4) == '.css') |
|
560 | 560 | $stylesheets[] = $url; |
561 | 561 | |
562 | 562 | $stylesheets = array_unique($stylesheets); |
@@ -893,11 +893,11 @@ discard block |
||
893 | 893 | |
894 | 894 | protected function renderHiddenFieldsInt($writer, $initial) |
895 | 895 | { |
896 | - if ($initial) $this->_renderedHiddenFields = []; |
|
896 | + if($initial) $this->_renderedHiddenFields = []; |
|
897 | 897 | $str = ''; |
898 | 898 | foreach($this->_hiddenFields as $name => $value) |
899 | 899 | { |
900 | - if (in_array($name, $this->_renderedHiddenFields)) continue; |
|
900 | + if(in_array($name, $this->_renderedHiddenFields)) continue; |
|
901 | 901 | $id = strtr($name, ':', '_'); |
902 | 902 | if(is_array($value)) |
903 | 903 | { |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | */ |
925 | 925 | protected function checkIfNotInRender() |
926 | 926 | { |
927 | - if ($form = $this->_page->InFormRender) |
|
927 | + if($form = $this->_page->InFormRender) |
|
928 | 928 | throw new \Exception('Operation invalid when page is already rendering'); |
929 | 929 | } |
930 | 930 | } |
@@ -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 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $timestamps[$fileName] = filemtime($fileName); |
105 | 105 | foreach($includedFiles as $includedFile) |
106 | 106 | $timestamps[$includedFile] = filemtime($includedFile); |
107 | - $cache->set(self::TEMPLATE_CACHE_PREFIX . $fileName, [$template,$timestamps]); |
|
107 | + $cache->set(self::TEMPLATE_CACHE_PREFIX . $fileName, [$template, $timestamps]); |
|
108 | 108 | return $template; |
109 | 109 | } |
110 | 110 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | protected function getLocalizedTemplate($filename) |
121 | 121 | { |
122 | 122 | if(($app = $this->getApplication()->getGlobalization(false)) === null) |
123 | - return is_file($filename)?$filename:null; |
|
123 | + return is_file($filename) ? $filename : null; |
|
124 | 124 | foreach($app->getLocalizedResource($filename) as $file) |
125 | 125 | { |
126 | 126 | if(($file = realpath($file)) !== false && is_file($file)) |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return; |
57 | 57 | |
58 | 58 | $this->setViewState('Interval', $interval, 1); |
59 | - if ($this->getActiveControl()->canUpdateClientSide()){ |
|
59 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
60 | 60 | $client = $this->getPage()->getCallbackClient(); |
61 | 61 | $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', [$this, $interval]); |
62 | 62 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | parent::render($writer); |
118 | 118 | $this->getActiveControl()->registerCallbackClientScript( |
119 | 119 | $this->getClientClassName(), $this->getTriggerOptions()); |
120 | - if($this->getStartTimerOnLoad()){ |
|
120 | + if($this->getStartTimerOnLoad()) { |
|
121 | 121 | $id = $this->getClientID(); |
122 | 122 | $code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');"; |
123 | 123 | $cs = $this->getPage()->getClientScript(); |
@@ -107,7 +107,7 @@ |
||
107 | 107 | { |
108 | 108 | parent::addAttributesToRender($writer); |
109 | 109 | $writer->addAttribute('id', $this->getClientID()); |
110 | - if ($this->getAutoPostBack()) |
|
110 | + if($this->getAutoPostBack()) |
|
111 | 111 | $this->getActiveControl()->registerCallbackClientScript( |
112 | 112 | $this->getClientClassName(), $this->getPostBackOptions()); |
113 | 113 | } |
@@ -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(' '); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | * updated later. |
73 | 73 | *@return boolean always true |
74 | 74 | */ |
75 | - protected function getSpanNeeded () |
|
75 | + protected function getSpanNeeded() |
|
76 | 76 | { |
77 | 77 | return true; |
78 | 78 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $id = $control->getUniqueID(); |
123 | 123 | if(!isset($this->_controlsToRender[$id])) |
124 | - $this->_controlsToRender[$id] = [$control,$writer]; |
|
124 | + $this->_controlsToRender[$id] = [$control, $writer]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -212,22 +212,22 @@ discard block |
||
212 | 212 | |
213 | 213 | // collect all stylesheet file references |
214 | 214 | $stylesheets = $cs->getStyleSheetUrls(); |
215 | - if (count($stylesheets) > 0) |
|
215 | + if(count($stylesheets) > 0) |
|
216 | 216 | $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
217 | 217 | |
218 | 218 | // collect all stylesheet snippets references |
219 | 219 | $stylesheets = $cs->getStyleSheetCodes(); |
220 | - if (count($stylesheets) > 0) |
|
220 | + if(count($stylesheets) > 0) |
|
221 | 221 | $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
222 | 222 | |
223 | 223 | // collect all script file references |
224 | 224 | $scripts = $cs->getScriptUrls(); |
225 | - if (count($scripts) > 0) |
|
225 | + if(count($scripts) > 0) |
|
226 | 226 | $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
227 | 227 | |
228 | 228 | // collect all hidden field references |
229 | 229 | $fields = $cs->getHiddenFields(); |
230 | - if (count($fields) > 0) |
|
230 | + if(count($fields) > 0) |
|
231 | 231 | $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
232 | 232 | } |
233 | 233 |
@@ -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 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | { |
111 | 111 | $diff = new $details[0]($new, $old, $this->_nullObject); |
112 | 112 | if(($change = $diff->getDifference()) !== $this->_nullObject) |
113 | - $changes[] = [$details[1],[$change]]; |
|
113 | + $changes[] = [$details[1], [$change]]; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return $changes; |