@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | |
185 | 185 | if (isset($config) AND is_array($config)) { |
186 | 186 | // Set default timezone |
187 | - if (isset($config[ 'datetime' ][ 'timezone' ])) { |
|
188 | - date_default_timezone_set($config[ 'datetime' ][ 'timezone' ]); |
|
187 | + if (isset($config['datetime']['timezone'])) { |
|
188 | + date_default_timezone_set($config['datetime']['timezone']); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // Setup Language Ideom and Locale |
192 | - if (isset($config[ 'language' ])) { |
|
193 | - language()->setDefault($config[ 'language' ]); |
|
192 | + if (isset($config['language'])) { |
|
193 | + language()->setDefault($config['language']); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | config()->merge($config); |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
421 | 421 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
422 | 422 | |
423 | - if ($packageJsonFileInfo[ 'filename' ] === 'widget' or |
|
424 | - $packageJsonFileInfo[ 'filename' ] === 'language' or |
|
423 | + if ($packageJsonFileInfo['filename'] === 'widget' or |
|
424 | + $packageJsonFileInfo['filename'] === 'language' or |
|
425 | 425 | strpos($packageJsonFile, '.svn') !== false // subversion properties file conflict. |
426 | 426 | ) { |
427 | 427 | continue; |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | if (strpos($packageJsonFile, |
454 | - $modularType = ucfirst(plural($packageJsonFileInfo[ 'filename' ])) . DIRECTORY_SEPARATOR) === false) { |
|
455 | - $modularType = ucfirst($packageJsonFileInfo[ 'filename' ]) . DIRECTORY_SEPARATOR; |
|
454 | + $modularType = ucfirst(plural($packageJsonFileInfo['filename'])) . DIRECTORY_SEPARATOR) === false) { |
|
455 | + $modularType = ucfirst($packageJsonFileInfo['filename']) . DIRECTORY_SEPARATOR; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | $modularType = strtolower(rtrim($modularType, DIRECTORY_SEPARATOR)); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | PATH_PUBLIC, |
468 | 468 | PATH_RESOURCES, |
469 | 469 | PATH_APP, |
470 | - $packageJsonFileInfo[ 'basename' ], |
|
470 | + $packageJsonFileInfo['basename'], |
|
471 | 471 | ucfirst($modularType) . DIRECTORY_SEPARATOR, |
472 | 472 | ], |
473 | 473 | '', |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ) |
478 | 478 | ); |
479 | 479 | |
480 | - $moduleSegments = array_map(function ($string) { |
|
480 | + $moduleSegments = array_map(function($string) { |
|
481 | 481 | return dash(snakecase($string)); |
482 | 482 | }, $moduleSegments); |
483 | 483 | |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | str_replace( |
486 | 486 | PATH_ROOT, |
487 | 487 | '', |
488 | - $packageJsonFileInfo[ 'dirname' ] |
|
488 | + $packageJsonFileInfo['dirname'] |
|
489 | 489 | ), |
490 | 490 | false |
491 | 491 | ); |
492 | 492 | |
493 | - if (isset($packageJsonMetadata[ 'namespace' ])) { |
|
494 | - $moduleNamespace = $packageJsonMetadata[ 'namespace' ]; |
|
495 | - unset($packageJsonMetadata[ 'namespace' ]); |
|
493 | + if (isset($packageJsonMetadata['namespace'])) { |
|
494 | + $moduleNamespace = $packageJsonMetadata['namespace']; |
|
495 | + unset($packageJsonMetadata['namespace']); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | $moduleParentSegments = []; |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | $registryKey = implode('/', $moduleSegments); |
507 | 507 | |
508 | 508 | if ($registryKey === '') { |
509 | - if ($packageJsonFileInfo[ 'dirname' ] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
509 | + if ($packageJsonFileInfo['dirname'] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
510 | 510 | $registryKey = dash(snakecase( |
511 | - pathinfo($packageJsonFileInfo[ 'dirname' ], PATHINFO_FILENAME))); |
|
511 | + pathinfo($packageJsonFileInfo['dirname'], PATHINFO_FILENAME))); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $registry[ $registryKey ] = (new DataStructures\Module( |
|
516 | - $packageJsonFileInfo[ 'dirname' ] |
|
515 | + $registry[$registryKey] = (new DataStructures\Module( |
|
516 | + $packageJsonFileInfo['dirname'] |
|
517 | 517 | )) |
518 | - ->setType($packageJsonFileInfo[ 'filename' ]) |
|
518 | + ->setType($packageJsonFileInfo['filename']) |
|
519 | 519 | ->setNamespace($moduleNamespace) |
520 | 520 | ->setSegments($moduleSegments) |
521 | 521 | ->setParentSegments($moduleParentSegments) |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | $segment = dash($segment); |
678 | 678 | |
679 | 679 | if ($this->exists($segment)) { |
680 | - if ($this->registry[ $segment ] instanceof DataStructures\Module) { |
|
681 | - return $this->registry[ $segment ]; |
|
680 | + if ($this->registry[$segment] instanceof DataStructures\Module) { |
|
681 | + return $this->registry[$segment]; |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function first() |
716 | 716 | { |
717 | - if (isset($this->registry[ '' ])) { |
|
718 | - return $this->registry[ '' ]; |
|
717 | + if (isset($this->registry[''])) { |
|
718 | + return $this->registry['']; |
|
719 | 719 | } elseif (reset($this->registry)->type === 'APP') { |
720 | 720 | return reset($this->registry); |
721 | 721 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $segments = (is_array($segments) ? implode('/', array_map('dash', $segments)) : $segments); |
738 | 738 | |
739 | 739 | if ($this->exists($segments)) { |
740 | - return $this->registry[ $segments ]; |
|
740 | + return $this->registry[$segments]; |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | return false; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | foreach ($this as $key => $module) { |
760 | 760 | if ($module instanceof DataStructures\Module) { |
761 | - $namespaces[ $key ] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
761 | + $namespaces[$key] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | $session->set('language', language()->getDefault()); |
421 | 421 | } |
422 | 422 | |
423 | - if (config('security')->protection[ 'csrf' ] === true) { |
|
423 | + if (config('security')->protection['csrf'] === true) { |
|
424 | 424 | $csrfProtection = new Security\Protections\Csrf(); |
425 | 425 | $this->services->add($csrfProtection, 'csrfProtection'); |
426 | 426 | } |
427 | 427 | |
428 | - if (config('security')->protection[ 'xss' ] === true) { |
|
428 | + if (config('security')->protection['xss'] === true) { |
|
429 | 429 | $xssProtection = new Security\Protections\Xss(); |
430 | 430 | $this->services->add($xssProtection, 'xssProtection'); |
431 | 431 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $module->loadModel(); |
485 | 485 | |
486 | 486 | // Add View Resource Directory |
487 | - if($this->services->has('view')) { |
|
487 | + if ($this->services->has('view')) { |
|
488 | 488 | view()->addFilePath($module->getResourcesDir()); |
489 | 489 | presenter()->assets->pushFilePath($module->getResourcesDir()); |
490 | 490 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | } |
609 | 609 | |
610 | 610 | if (presenter()->partials->offsetExists('content')) { |
611 | - if(is_ajax()) { |
|
611 | + if (is_ajax()) { |
|
612 | 612 | echo presenter()->partials->content; |
613 | 613 | } else { |
614 | 614 | $htmlOutput = view()->render(); |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function setProperties(array $properties) |
198 | 198 | { |
199 | - if (isset($properties[ 'presets' ])) { |
|
200 | - $this->setPresets($properties[ 'presets' ]); |
|
199 | + if (isset($properties['presets'])) { |
|
200 | + $this->setPresets($properties['presets']); |
|
201 | 201 | |
202 | - unset($properties[ 'presets' ]); |
|
202 | + unset($properties['presets']); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $this->properties = $properties; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $themes = []; |
290 | 290 | foreach ($directory->getTree() as $themeName => $themeTree) { |
291 | 291 | if (($theme = $this->getTheme($themeName)) instanceof Module\Theme) { |
292 | - $themes[ $themeName ] = $theme; |
|
292 | + $themes[$themeName] = $theme; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | $dirPath = str_replace(PATH_APP, '', $this->getRealPath()); |
313 | 313 | $dirPathParts = explode(DIRECTORY_SEPARATOR, $dirPath); |
314 | 314 | |
315 | - if(count($dirPathParts)) { |
|
315 | + if (count($dirPathParts)) { |
|
316 | 316 | $dirPathParts = array_map('dash', $dirPathParts); |
317 | - $dirResources.= implode(DIRECTORY_SEPARATOR, $dirPathParts); |
|
317 | + $dirResources .= implode(DIRECTORY_SEPARATOR, $dirPathParts); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if (is_null($subDir)) { |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | $properties = json_decode(file_get_contents($propFilePath), true); |
62 | 62 | |
63 | 63 | if (json_last_error() === JSON_ERROR_NONE) { |
64 | - if (isset($properties[ 'config' ])) { |
|
65 | - $this->presets = $properties[ 'presets' ]; |
|
66 | - unset($properties[ 'presets' ]); |
|
64 | + if (isset($properties['config'])) { |
|
65 | + $this->presets = $properties['presets']; |
|
66 | + unset($properties['presets']); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $this->properties = $properties; |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | { |
198 | 198 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
199 | 199 | |
200 | - if (isset($this->presets[ 'extensions' ])) { |
|
201 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
202 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
203 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
200 | + if (isset($this->presets['extensions'])) { |
|
201 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
202 | + } elseif (isset($this->presets['extension'])) { |
|
203 | + array_unshift($extensions, $this->presets['extension']); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $found = false; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - return (bool) $found; |
|
222 | + return (bool)$found; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // ------------------------------------------------------------------------ |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | { |
236 | 236 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
237 | 237 | |
238 | - if (isset($this->presets[ 'extensions' ])) { |
|
239 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
240 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
241 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
238 | + if (isset($this->presets['extensions'])) { |
|
239 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
240 | + } elseif (isset($this->presets['extension'])) { |
|
241 | + array_unshift($extensions, $this->presets['extension']); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | foreach ($extensions as $extension) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | parent::__construct(); |
34 | 34 | |
35 | - if(services()->has('csrfProtection')) { |
|
35 | + if (services()->has('csrfProtection')) { |
|
36 | 36 | $this->addHeader('X-CSRF-TOKEN', services()->get('csrfProtection')->getToken()); |
37 | 37 | } |
38 | 38 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $error = new ErrorException($errorMessage, $errorSeverity, $errorFile, $errorLine, $errorContext); |
149 | 149 | |
150 | 150 | // Logged the error |
151 | - if(services()->has('logger')) { |
|
151 | + if (services()->has('logger')) { |
|
152 | 152 | logger()->error( |
153 | 153 | implode( |
154 | 154 | ' ', |
@@ -301,21 +301,21 @@ discard block |
||
301 | 301 | ]; |
302 | 302 | |
303 | 303 | $this->statusCode = $code; |
304 | - $this->reasonPhrase = $error[ 'title' ]; |
|
304 | + $this->reasonPhrase = $error['title']; |
|
305 | 305 | |
306 | 306 | if (is_string($vars)) { |
307 | 307 | $vars = ['message' => $vars]; |
308 | - } elseif (is_array($vars) and empty($vars[ 'message' ])) { |
|
309 | - $vars[ 'message' ] = $error[ 'message' ]; |
|
308 | + } elseif (is_array($vars) and empty($vars['message'])) { |
|
309 | + $vars['message'] = $error['message']; |
|
310 | 310 | } |
311 | 311 | |
312 | - if (isset($vars[ 'message' ])) { |
|
313 | - $error[ 'message' ] = $vars[ 'message' ]; |
|
312 | + if (isset($vars['message'])) { |
|
313 | + $error['message'] = $vars['message']; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | if (is_ajax() or $this->mimeType !== 'text/html') { |
317 | 317 | $this->statusCode = $code; |
318 | - $this->reasonPhrase = $error[ 'title' ]; |
|
318 | + $this->reasonPhrase = $error['title']; |
|
319 | 319 | $this->send($vars); |
320 | 320 | |
321 | 321 | exit(EXIT_ERROR); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ); |
74 | 74 | |
75 | 75 | if ($this->config->offsetExists('extensions')) { |
76 | - $this->setFileExtensions($this->config[ 'extensions' ]); |
|
76 | + $this->setFileExtensions($this->config['extensions']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->document = new Html\Document(); |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function &__get($property) |
91 | 91 | { |
92 | - $get[ $property ] = false; |
|
92 | + $get[$property] = false; |
|
93 | 93 | |
94 | 94 | if (property_exists($this, $property)) { |
95 | 95 | return $this->{$property}; |
96 | 96 | } |
97 | 97 | |
98 | - return $get[ $property ]; |
|
98 | + return $get[$property]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // ------------------------------------------------------------------------ |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (false !== ($filePath = $this->getFilePath($filename))) { |
187 | 187 | if ($return === false) { |
188 | 188 | if (presenter()->partials->hasPartial('content') === false) { |
189 | - if(is_ajax()) { |
|
189 | + if (is_ajax()) { |
|
190 | 190 | parser()->loadFile($filePath); |
191 | 191 | $content = parser()->parse(presenter()->getArrayCopy()); |
192 | 192 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $error = new ErrorException( |
212 | 212 | 'E_VIEW_NOT_FOUND', |
213 | 213 | 0, |
214 | - @$backtrace[ 0 ][ 'file' ], |
|
215 | - @$backtrace[ 0 ][ 'line' ], |
|
214 | + @$backtrace[0]['file'], |
|
215 | + @$backtrace[0]['line'], |
|
216 | 216 | [trim($filename)] |
217 | 217 | ); |
218 | 218 | |
@@ -726,12 +726,12 @@ discard block |
||
726 | 726 | $htmlOutput = $this->document->saveHTML(); |
727 | 727 | |
728 | 728 | // Uglify Output |
729 | - if ($this->config->output[ 'uglify' ] === true) { |
|
729 | + if ($this->config->output['uglify'] === true) { |
|
730 | 730 | $htmlOutput = preg_replace( |
731 | 731 | [ |
732 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
733 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
734 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
732 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
733 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
734 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
735 | 735 | '/<!--(.|\s)*?-->/', // Remove HTML comments |
736 | 736 | '/<!--(.*)-->/Uis', |
737 | 737 | "/[[:blank:]]+/", |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | |
750 | 750 | // Beautify Output |
751 | - if ($this->config->output[ 'beautify' ] === true) { |
|
751 | + if ($this->config->output['beautify'] === true) { |
|
752 | 752 | $beautifier = new Html\Dom\Beautifier(); |
753 | 753 | $htmlOutput = $beautifier->format($htmlOutput); |
754 | 754 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // autoload presenter assets |
108 | - if (isset($config[ 'assets' ])) { |
|
109 | - $this->assets->autoload($config[ 'assets' ]); |
|
108 | + if (isset($config['assets'])) { |
|
109 | + $this->assets->autoload($config['assets']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // autoload presenter theme |
113 | - if(isset($config['theme'])) { |
|
113 | + if (isset($config['theme'])) { |
|
114 | 114 | $this->setTheme($config['theme']); |
115 | 115 | } |
116 | 116 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | { |
131 | 131 | if (is_bool($theme)) { |
132 | 132 | $this->theme = false; |
133 | - } elseif(($moduleTheme = modules()->top()->getTheme($theme, true)) instanceof Theme) { |
|
133 | + } elseif (($moduleTheme = modules()->top()->getTheme($theme, true)) instanceof Theme) { |
|
134 | 134 | $this->theme = $moduleTheme; |
135 | - } elseif(($appTheme = modules()->first()->getTheme($theme, true)) instanceof Theme) { |
|
135 | + } elseif (($appTheme = modules()->first()->getTheme($theme, true)) instanceof Theme) { |
|
136 | 136 | $this->theme = $appTheme; |
137 | 137 | } |
138 | 138 | |
139 | - if($this->theme) { |
|
139 | + if ($this->theme) { |
|
140 | 140 | if ( ! defined('PATH_THEME')) { |
141 | 141 | define('PATH_THEME', $this->theme->getRealPath()); |
142 | 142 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // add theme assets directory |
145 | 145 | $this->assets->pushFilePath($this->theme->getRealPath()); |
146 | 146 | |
147 | - if(is_dir($themeViewPath = $this->theme->getRealPath() . 'views' . DIRECTORY_SEPARATOR)) { |
|
147 | + if (is_dir($themeViewPath = $this->theme->getRealPath() . 'views' . DIRECTORY_SEPARATOR)) { |
|
148 | 148 | |
149 | 149 | // add theme view directory |
150 | 150 | view()->addFilePath($this->theme->getRealPath()); |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | |
155 | 155 | $modules = modules()->getArrayCopy(); |
156 | 156 | |
157 | - foreach($modules as $module) { |
|
157 | + foreach ($modules as $module) { |
|
158 | 158 | if ( ! in_array($module->getType(), ['KERNEL', 'FRAMEWORK', 'APP'])) { |
159 | 159 | $moduleResourcesPath = str_replace(PATH_RESOURCES, '', $module->getResourcesDir()); |
160 | 160 | |
161 | - if(is_dir($themeViewPath . $moduleResourcesPath)) { |
|
161 | + if (is_dir($themeViewPath . $moduleResourcesPath)) { |
|
162 | 162 | view()->pushFilePath($themeViewPath . $moduleResourcesPath); |
163 | 163 | } |
164 | 164 | } |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | $storage = $this->storage; |
200 | 200 | |
201 | 201 | // Add Properties |
202 | - $storage[ 'meta' ] = $this->meta; |
|
203 | - $storage[ 'page' ] = $this->page; |
|
204 | - $storage[ 'assets' ] = new SplArrayObject([ |
|
202 | + $storage['meta'] = $this->meta; |
|
203 | + $storage['page'] = $this->page; |
|
204 | + $storage['assets'] = new SplArrayObject([ |
|
205 | 205 | 'head' => $this->assets->getHead(), |
206 | 206 | 'body' => $this->assets->getBody(), |
207 | 207 | ]); |
208 | - $storage[ 'partials' ] = $this->partials; |
|
209 | - $storage[ 'widgets' ] = $this->widgets; |
|
210 | - $storage[ 'theme' ] = $this->theme; |
|
208 | + $storage['partials'] = $this->partials; |
|
209 | + $storage['widgets'] = $this->widgets; |
|
210 | + $storage['theme'] = $this->theme; |
|
211 | 211 | |
212 | 212 | // Add Services |
213 | - $storage[ 'config' ] = config(); |
|
214 | - $storage[ 'language' ] = language(); |
|
215 | - $storage[ 'session' ] = session(); |
|
216 | - $storage[ 'presenter' ] = presenter(); |
|
217 | - $storage[ 'input' ] = input(); |
|
213 | + $storage['config'] = config(); |
|
214 | + $storage['language'] = language(); |
|
215 | + $storage['session'] = session(); |
|
216 | + $storage['presenter'] = presenter(); |
|
217 | + $storage['input'] = input(); |
|
218 | 218 | |
219 | 219 | if (services()->has('csrfProtection')) { |
220 | - $storage[ 'csrfToken' ] = services()->get('csrfProtection')->getToken(); |
|
220 | + $storage['csrfToken'] = services()->get('csrfProtection')->getToken(); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $storage; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } else { |
66 | 66 | $uriPath = urldecode( |
67 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
67 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | $uriPathParts = explode('public/', $uriPath); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // Module routing |
108 | 108 | if ($numOfUriSegments = count($uriSegments)) { |
109 | 109 | if (empty($app)) { |
110 | - if (false !== ($module = modules()->getModule( reset($uriSegments) ))) { |
|
110 | + if (false !== ($module = modules()->getModule(reset($uriSegments)))) { |
|
111 | 111 | //array_shift($uriSegments); |
112 | 112 | $this->uri = $this->uri->withSegments(new KernelMessageUriSegments($uriSegments)); |
113 | 113 | $uriString = $this->uri->getSegments()->getString(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - if($numOfUriSegments = count($uriSegments)) { |
|
119 | + if ($numOfUriSegments = count($uriSegments)) { |
|
120 | 120 | for ($i = 0; $i <= $numOfUriSegments; $i++) { |
121 | 121 | $uriRoutedSegments = array_diff($uriSegments, |
122 | 122 | array_slice($uriSegments, ($numOfUriSegments - $i))); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * Try to find requested page |
217 | 217 | */ |
218 | 218 | if (false !== ($pagesDir = $module->getResourcesDir('pages', true))) { |
219 | - if($controllerClassName = $this->getPagesControllerClassName()) { |
|
219 | + if ($controllerClassName = $this->getPagesControllerClassName()) { |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Try to find from database |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | presenter()->page->setFile($pageFilePath); |
252 | 252 | } else { |
253 | 253 | $pageFilePath = str_replace('.phtml', DIRECTORY_SEPARATOR . 'index.phtml', $pageFilePath); |
254 | - if(is_file($pageFilePath)) { |
|
254 | + if (is_file($pageFilePath)) { |
|
255 | 255 | presenter()->page->setFile($pageFilePath); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if(presenter()->page->file instanceof SplFileInfo) { |
|
259 | + if (presenter()->page->file instanceof SplFileInfo) { |
|
260 | 260 | $this->setController( |
261 | 261 | (new KernelControllerDataStructure($controllerClassName)) |
262 | 262 | ->setRequestMethod('index') |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | { |
300 | 300 | $modules = modules()->getArrayCopy(); |
301 | 301 | |
302 | - foreach($modules as $module) { |
|
302 | + foreach ($modules as $module) { |
|
303 | 303 | $controllerClassName = $module->getNamespace() . 'Controllers\Pages'; |
304 | 304 | if ($module->getNamespace() === 'O2System\Framework\\') { |
305 | 305 | $controllerClassName = 'O2System\Framework\Http\Controllers\Pages'; |
306 | 306 | } |
307 | 307 | |
308 | - if(class_exists($controllerClassName)) { |
|
308 | + if (class_exists($controllerClassName)) { |
|
309 | 309 | return $controllerClassName; |
310 | 310 | break; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | - if(class_exists('O2System\Framework\Http\Controllers\Pages')) { |
|
314 | + if (class_exists('O2System\Framework\Http\Controllers\Pages')) { |
|
315 | 315 | return 'O2System\Framework\Http\Controllers\Pages'; |
316 | 316 | } |
317 | 317 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (class_exists($controllerClassName)) { |
357 | 357 | $this->addresses->any( |
358 | 358 | '/', |
359 | - function () use ($controllerClassName) { |
|
359 | + function() use ($controllerClassName) { |
|
360 | 360 | return new $controllerClassName(); |
361 | 361 | } |
362 | 362 | ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if (class_exists($controllerClassName)) { |
372 | 372 | $this->addresses->any( |
373 | 373 | '/', |
374 | - function () use ($controllerClassName) { |
|
374 | + function() use ($controllerClassName) { |
|
375 | 375 | return new $controllerClassName(); |
376 | 376 | } |
377 | 377 | ); |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | ); |
424 | 424 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
425 | 425 | $this->setController( |
426 | - (new KernelControllerDataStructure($matches[ 1 ])) |
|
427 | - ->setRequestMethod($matches[ 3 ]), |
|
426 | + (new KernelControllerDataStructure($matches[1])) |
|
427 | + ->setRequestMethod($matches[3]), |
|
428 | 428 | $uriSegments |
429 | 429 | ); |
430 | 430 | } elseif (presenter()->theme->use === true) { |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | $bundleFontsFile = $this->bundleFile('assets' . DIRECTORY_SEPARATOR . 'fonts.css', |
194 | 194 | implode(PHP_EOL, $this->fonts)); |
195 | 195 | |
196 | - if (is_file($bundleFontsFile[ 'filePath' ])) { |
|
196 | + if (is_file($bundleFontsFile['filePath'])) { |
|
197 | 197 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
198 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleFontsFile[ 'url' ] . '?v=' . $bundleFontsFile[ 'version' ] . '">'; |
|
198 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleFontsFile['url'] . '?v=' . $bundleFontsFile['version'] . '">'; |
|
199 | 199 | } else { |
200 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleFontsFile[ 'url' ] . '?v=' . $bundleFontsFile[ 'version' ] . '">'; |
|
200 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleFontsFile['url'] . '?v=' . $bundleFontsFile['version'] . '">'; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | } elseif (in_array(pathinfo($style, PATHINFO_FILENAME), ['module', 'module.min'])) { |
234 | 234 | $modulePublicFile = $this->publishFile($style); |
235 | 235 | |
236 | - if (is_file($modulePublicFile[ 'filePath' ])) { |
|
236 | + if (is_file($modulePublicFile['filePath'])) { |
|
237 | 237 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
238 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $modulePublicFile[ 'minify' ][ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '">'; |
|
238 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $modulePublicFile['minify']['url'] . '?v=' . $modulePublicFile['version'] . '">'; |
|
239 | 239 | } else { |
240 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $modulePublicFile[ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '">'; |
|
240 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $modulePublicFile['url'] . '?v=' . $modulePublicFile['version'] . '">'; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } else { |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | if (count($bundleStyleSources)) { |
249 | 249 | $bundleStylePublicFile = $this->bundleFile($bundleFilename . '.css', $bundleStyleSources); |
250 | 250 | |
251 | - if (is_file($bundleStylePublicFile[ 'filePath' ])) { |
|
251 | + if (is_file($bundleStylePublicFile['filePath'])) { |
|
252 | 252 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
253 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleStylePublicFile[ 'minify' ][ 'url' ] . '?v=' . $bundleStylePublicFile[ 'version' ] . '">'; |
|
253 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleStylePublicFile['minify']['url'] . '?v=' . $bundleStylePublicFile['version'] . '">'; |
|
254 | 254 | } else { |
255 | - $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleStylePublicFile[ 'url' ] . '?v=' . $bundleStylePublicFile[ 'version' ] . '">'; |
|
255 | + $output[] = '<link rel="stylesheet" type="text/css" media="all" href="' . $bundleStylePublicFile['url'] . '?v=' . $bundleStylePublicFile['version'] . '">'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
@@ -265,15 +265,15 @@ discard block |
||
265 | 265 | foreach ($this->javascripts as $javascript) { |
266 | 266 | if (in_array(pathinfo($style, PATHINFO_FILENAME), $unbundledFilenames)) { |
267 | 267 | $fileVersion = $this->getVersion(filemtime($javascript)); |
268 | - $output[] = '<script type="text/javascript" id="js-'.pathinfo($javascript, PATHINFO_FILENAME).'" src="' . $this->getUrl($javascript) . '?v=' . $fileVersion . '"></script>'; |
|
268 | + $output[] = '<script type="text/javascript" id="js-' . pathinfo($javascript, PATHINFO_FILENAME) . '" src="' . $this->getUrl($javascript) . '?v=' . $fileVersion . '"></script>'; |
|
269 | 269 | } elseif (in_array(pathinfo($javascript, PATHINFO_FILENAME), ['module', 'module.min'])) { |
270 | 270 | $modulePublicFile = $this->publishFile($javascript); |
271 | 271 | |
272 | - if (is_file($modulePublicFile[ 'filePath' ])) { |
|
272 | + if (is_file($modulePublicFile['filePath'])) { |
|
273 | 273 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
274 | - $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile[ 'minify' ][ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '"></script>'; |
|
274 | + $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile['minify']['url'] . '?v=' . $modulePublicFile['version'] . '"></script>'; |
|
275 | 275 | } else { |
276 | - $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile[ 'url' ] . '?v=' . $modulePublicFile[ 'version' ] . '"></script>'; |
|
276 | + $output[] = '<script type="text/javascript" id="js-module" src="' . $modulePublicFile['url'] . '?v=' . $modulePublicFile['version'] . '"></script>'; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } else { |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | if (count($bundleJavascriptSources)) { |
285 | 285 | $bundleJavascriptPublicFile = $this->bundleFile($bundleFilename . '.js', $bundleJavascriptSources); |
286 | 286 | |
287 | - if (is_file($bundleJavascriptPublicFile[ 'filePath' ])) { |
|
287 | + if (is_file($bundleJavascriptPublicFile['filePath'])) { |
|
288 | 288 | if (input()->env('DEBUG_STAGE') === 'PRODUCTION') { |
289 | - $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile[ 'minify' ][ 'url' ] . '?v=' . $bundleJavascriptPublicFile[ 'version' ] . '"></script>'; |
|
289 | + $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile['minify']['url'] . '?v=' . $bundleJavascriptPublicFile['version'] . '"></script>'; |
|
290 | 290 | } else { |
291 | - $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile[ 'url' ] . '?v=' . $bundleJavascriptPublicFile[ 'version' ] . '"></script>'; |
|
291 | + $output[] = '<script type="text/javascript" id="js-bundle" src="' . $bundleJavascriptPublicFile['url'] . '?v=' . $bundleJavascriptPublicFile['version'] . '"></script>'; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | } |