@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | parent::__construct('div'); |
40 | 40 | |
41 | - if (isset($attributes[ 'id' ])) { |
|
42 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
41 | + if (isset($attributes['id'])) { |
|
42 | + $this->entity->setEntityName($attributes['id']); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (count($attributes)) { |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | |
145 | 145 | if (is_dir($baseDirectory)) { |
146 | 146 | // initialize the namespace prefix array |
147 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
148 | - $this->namespaceDirs[ $namespace ] = []; |
|
147 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
148 | + $this->namespaceDirs[$namespace] = []; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // retain the base directory for the namespace prefix |
152 | - if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) { |
|
152 | + if ( ! in_array($baseDirectory, $this->namespaceDirs[$namespace])) { |
|
153 | 153 | if ($prepend) { |
154 | - array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
154 | + array_unshift($this->namespaceDirs[$namespace], $baseDirectory); |
|
155 | 155 | } else { |
156 | - array_push($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
156 | + array_push($this->namespaceDirs[$namespace], $baseDirectory); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - $this->namespaceDirsMap[ $baseDirectory ] = $namespace; |
|
160 | + $this->namespaceDirsMap[$baseDirectory] = $namespace; |
|
161 | 161 | |
162 | 162 | // Register Namespace Language |
163 | 163 | language()->addFilePath($baseDirectory); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | |
197 | 197 | if (is_dir($publicDir) and ! in_array($publicDir, $this->publicDirs)) { |
198 | 198 | if (isset($offset)) { |
199 | - $this->publicDirs[ $offset ] = $publicDir; |
|
199 | + $this->publicDirs[$offset] = $publicDir; |
|
200 | 200 | } else { |
201 | - $this->publicDirs[ rtrim(str_replace(PATH_PUBLIC, '', $publicDir), '/') ] = $publicDir; |
|
201 | + $this->publicDirs[rtrim(str_replace(PATH_PUBLIC, '', $publicDir), '/')] = $publicDir; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | |
223 | 223 | if (is_dir($resourcesDir) and ! in_array($resourcesDir, $this->resourcesDirs)) { |
224 | 224 | if (isset($offset)) { |
225 | - $this->resourcesDirs[ $offset ] = $resourcesDir; |
|
225 | + $this->resourcesDirs[$offset] = $resourcesDir; |
|
226 | 226 | } else { |
227 | - $this->resourcesDirs[ rtrim(str_replace(PATH_RESOURCES, '', $resourcesDir), '/') ] = $resourcesDir; |
|
227 | + $this->resourcesDirs[rtrim(str_replace(PATH_RESOURCES, '', $resourcesDir), '/')] = $resourcesDir; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
283 | 283 | |
284 | 284 | if (array_key_exists($dir, $this->namespaceDirsMap)) { |
285 | - return $this->namespaceDirsMap[ $dir ]; |
|
285 | + return $this->namespaceDirsMap[$dir]; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return false; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $namespace = trim($namespace, '\\') . '\\'; |
328 | 328 | |
329 | 329 | if (array_key_exists($namespace, $this->namespaceDirs)) { |
330 | - return $this->namespaceDirs[ $namespace ]; |
|
330 | + return $this->namespaceDirs[$namespace]; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return false; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | if (false !== ($modules = modules()->getRegistry())) { |
349 | 349 | foreach ($modules as $module) { |
350 | 350 | if ($module instanceof Module) { |
351 | - if (empty($this->namespaceDirs[ $module->getNamespace() ])) { |
|
351 | + if (empty($this->namespaceDirs[$module->getNamespace()])) { |
|
352 | 352 | $this->addNamespace($module->getNamespace(), $module->getRealPath()); |
353 | 353 | } |
354 | 354 | } |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | public function loadMappedFile($namespace, $relativeClass) |
417 | 417 | { |
418 | 418 | // are there any base directories for this namespace prefix? |
419 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
419 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | 423 | // look through base directories for this namespace prefix |
424 | - foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) { |
|
424 | + foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) { |
|
425 | 425 | |
426 | 426 | // replace the namespace prefix with the base directory, |
427 | 427 | // replace namespace separators with directory separators |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | if ($this->requireFile($helper)) { |
507 | - $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper; |
|
507 | + $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper; |
|
508 | 508 | |
509 | 509 | return; |
510 | 510 | } |
@@ -520,17 +520,17 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | if ( ! array_key_exists($helper, $this->loadedHelpers)) { |
523 | - $this->loadedHelpers[ $helper ] = []; |
|
523 | + $this->loadedHelpers[$helper] = []; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | foreach ($helperDirectories as $helperDirectory) { |
527 | 527 | |
528 | 528 | $helperFilePath = $helperDirectory . studlycase($helper) . '.php'; |
529 | 529 | |
530 | - if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) { |
|
530 | + if (in_array($helperFilePath, $this->loadedHelpers[$helper])) { |
|
531 | 531 | continue; |
532 | 532 | } elseif ($this->requireFile($helperFilePath)) { |
533 | - $this->loadedHelpers[ $helper ][] = $helperFilePath; |
|
533 | + $this->loadedHelpers[$helper][] = $helperFilePath; |
|
534 | 534 | } |
535 | 535 | } |
536 | 536 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $download = false; |
71 | 71 | if (false !== ($key = array_search('download', $segments))) { |
72 | 72 | $download = true; |
73 | - unset($segments[ $key ]); |
|
73 | + unset($segments[$key]); |
|
74 | 74 | $segments = array_values($segments); |
75 | 75 | } |
76 | 76 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | public function index() |
34 | 34 | { |
35 | - if($this->presenter->page->file instanceof SplFileInfo) { |
|
35 | + if ($this->presenter->page->file instanceof SplFileInfo) { |
|
36 | 36 | $this->view->page(presenter()->page->file->getRealPath()); |
37 | 37 | } |
38 | 38 | } |
@@ -155,12 +155,12 @@ |
||
155 | 155 | $properties = file_get_contents($propertiesFilePath); |
156 | 156 | $properties = json_decode($properties, true); |
157 | 157 | |
158 | - if (isset($properties[ 'vars' ])) { |
|
159 | - $this->vars = $properties[ 'vars' ]; |
|
158 | + if (isset($properties['vars'])) { |
|
159 | + $this->vars = $properties['vars']; |
|
160 | 160 | } |
161 | 161 | |
162 | - if (isset($properties[ 'presets' ])) { |
|
163 | - $this->presets = new SplArrayObject($properties[ 'presets' ]); |
|
162 | + if (isset($properties['presets'])) { |
|
163 | + $this->presets = new SplArrayObject($properties['presets']); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -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(); |
@@ -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); |
@@ -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 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | if (is_file($mapFilePath = $publicFilePath . '.map')) { |
174 | 174 | $mapMetadata = json_decode(file_get_contents($mapFilePath), true); |
175 | 175 | // if the file version is changed delete it first |
176 | - if ( ! hash_equals($fileVersion, $mapMetadata[ 'version' ])) { |
|
176 | + if ( ! hash_equals($fileVersion, $mapMetadata['version'])) { |
|
177 | 177 | unlink($publicFilePath); |
178 | 178 | unlink($publicMinifyFilePath); |
179 | 179 | unlink($mapFilePath); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | if ( ! empty($content)) { |
267 | 267 | $sourcesContent[] = $content; |
268 | 268 | } else { |
269 | - unset($sources[ $key ]); |
|
269 | + unset($sources[$key]); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | if (is_file($mapFilePath = $publicFilePath . '.map')) { |
288 | 288 | $mapMetadata = json_decode(file_get_contents($mapFilePath), true); |
289 | 289 | // if the file version is changed delete it first |
290 | - if ( ! hash_equals($fileVersion, $mapMetadata[ 'version' ])) { |
|
290 | + if ( ! hash_equals($fileVersion, $mapMetadata['version'])) { |
|
291 | 291 | unlink($publicFilePath); |
292 | 292 | unlink($publicMinifyFilePath); |
293 | 293 | unlink($mapFilePath); |