@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
556 | - * The install specific to the core apps (admin, user, settings, etc) |
|
557 | - * @return void |
|
558 | - */ |
|
556 | + * The install specific to the core apps (admin, user, settings, etc) |
|
557 | + * @return void |
|
558 | + */ |
|
559 | 559 | public function installCore() |
560 | 560 | { |
561 | 561 | foreach ($this->getCoreApps() as $appName => $config) { |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | } |
566 | 566 | |
567 | 567 | /** |
568 | - * Run the install function of each app |
|
569 | - * @return void |
|
570 | - */ |
|
568 | + * Run the install function of each app |
|
569 | + * @return void |
|
570 | + */ |
|
571 | 571 | public function installApps() |
572 | 572 | { |
573 | 573 | foreach ($this->getApps() as $appName => $config) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getApps() |
208 | 208 | { |
209 | - if ($this->_appsRequiredOrder==false) { |
|
209 | + if ($this->_appsRequiredOrder == false) { |
|
210 | 210 | $this->orderAppsByRequired($this->_apps, $ordered); |
211 | 211 | $this->setApps($ordered); |
212 | 212 | $this->_appsRequiredOrder = true; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function getCoreApps() |
243 | 243 | { |
244 | - if ($this->_coreAppsRequiredOrder==false) { |
|
244 | + if ($this->_coreAppsRequiredOrder == false) { |
|
245 | 245 | $this->orderAppsByRequired($this->_coreApps, $ordered); |
246 | 246 | $this->setCoreApps($ordered); |
247 | 247 | $this->_coreAppsRequiredOrder = true; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return array |
280 | 280 | */ |
281 | - public static function getConfig($path, $required=true) |
|
281 | + public static function getConfig($path, $required = true) |
|
282 | 282 | { |
283 | 283 | $file = Neon::getAlias($path); |
284 | 284 | $fileExists = file_exists($file); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | throw new \Exception('The config file alias: "'.$path.'" can not be found. File path: "'.$file.'". This config file is required.'); |
290 | 290 | } |
291 | 291 | // The file does NOT exist and it is NOT required |
292 | - if (!$fileExists && !$required){ |
|
292 | + if (!$fileExists && !$required) { |
|
293 | 293 | // the config is not required so we can just return an empty array |
294 | 294 | return []; |
295 | 295 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function registerApps($apps) |
353 | 353 | { |
354 | - foreach($apps as $name => $config) { |
|
354 | + foreach ($apps as $name => $config) { |
|
355 | 355 | $this->registerApp($name, $config); |
356 | 356 | } |
357 | 357 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | { |
468 | 468 | $apps = array_merge($this->getCoreApps(), $this->getApps()); |
469 | 469 | $ret = []; |
470 | - foreach($apps as $app => $config) { |
|
470 | + foreach ($apps as $app => $config) { |
|
471 | 471 | $appObject = $this->getApp($app); |
472 | 472 | // apps that are disabled will return null |
473 | 473 | if ($appObject !== null) |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | */ |
529 | 529 | public function getClassAlias() |
530 | 530 | { |
531 | - return '@' . str_replace(['\\', 'Application'], ['/', ''], get_called_class()); |
|
531 | + return '@'.str_replace(['\\', 'Application'], ['/', ''], get_called_class()); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | $client = new \GuzzleHttp\Client(); |
626 | 626 | $res = $client->request('GET', 'https://neon.newicon.net/api/versions/', ['connect_timeout' => 2]); |
627 | 627 | $versions = json_decode((string) $res->getBody()); |
628 | - } catch(\Exception $e) { |
|
628 | + } catch (\Exception $e) { |
|
629 | 629 | $versions = []; |
630 | 630 | } |
631 | 631 | return $versions; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $versions = $this->getNeonVersions(); |
643 | 643 | $newerVersion = []; |
644 | 644 | $neonVersion = neon()->getVersion(); |
645 | - foreach($versions as $v) { |
|
645 | + foreach ($versions as $v) { |
|
646 | 646 | if (version_compare($v, $neonVersion, '>')) { |
647 | 647 | $newerVersion[] = $v; |
648 | 648 | } |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | */ |
680 | 680 | private function setModuleAliases($name, $aliases) |
681 | 681 | { |
682 | - foreach($aliases as $alias) |
|
682 | + foreach ($aliases as $alias) |
|
683 | 683 | static::$_moduleAliases[$alias] = $name; |
684 | 684 | } |
685 | 685 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @param string $instanceOf - a string defining a class or interface that the classes must implement or be |
702 | 702 | * @return array indexed by the app name to a list of valid classes |
703 | 703 | */ |
704 | - public function getAppClasses($subPath='', $instanceOf=false) |
|
704 | + public function getAppClasses($subPath = '', $instanceOf = false) |
|
705 | 705 | { |
706 | 706 | profile_begin('neon:getAppClasses'); |
707 | 707 | foreach (neon()->getAllApps() as $key => $config) { |
@@ -414,8 +414,9 @@ discard block |
||
414 | 414 | $this->setModule($name, $config); |
415 | 415 | |
416 | 416 | // set up any alternatives for this |
417 | - if (isset($config['appAliases'])) |
|
418 | - $this->setModuleAliases($name, $config['appAliases']); |
|
417 | + if (isset($config['appAliases'])) { |
|
418 | + $this->setModuleAliases($name, $config['appAliases']); |
|
419 | + } |
|
419 | 420 | } |
420 | 421 | |
421 | 422 | /** |
@@ -442,7 +443,9 @@ discard block |
||
442 | 443 | */ |
443 | 444 | public function getApp($name) |
444 | 445 | { |
445 | - if ($name === 'neon') return $this; |
|
446 | + if ($name === 'neon') { |
|
447 | + return $this; |
|
448 | + } |
|
446 | 449 | $module = $this->getModuleFromName($name); |
447 | 450 | return $this->getModule($module); |
448 | 451 | } |
@@ -470,8 +473,9 @@ discard block |
||
470 | 473 | foreach($apps as $app => $config) { |
471 | 474 | $appObject = $this->getApp($app); |
472 | 475 | // apps that are disabled will return null |
473 | - if ($appObject !== null) |
|
474 | - $ret[$app] = $this->getApp($app); |
|
476 | + if ($appObject !== null) { |
|
477 | + $ret[$app] = $this->getApp($app); |
|
478 | + } |
|
475 | 479 | } |
476 | 480 | return $ret; |
477 | 481 | } |
@@ -487,8 +491,9 @@ discard block |
||
487 | 491 | public function orderAppsByRequired($apps, &$ordered = null, &$read = null) |
488 | 492 | { |
489 | 493 | static $initialApps = null; |
490 | - if ($ordered == null) |
|
491 | - $initialApps = $apps; |
|
494 | + if ($ordered == null) { |
|
495 | + $initialApps = $apps; |
|
496 | + } |
|
492 | 497 | $ordered = $ordered == null ? [] : $ordered; |
493 | 498 | $read = $read == null ? [] : $read; |
494 | 499 | foreach ($apps as $key=>$app) { |
@@ -499,15 +504,17 @@ discard block |
||
499 | 504 | foreach ($requires as $r) { |
500 | 505 | $r = trim($r); |
501 | 506 | // prevent circular references breaking the system |
502 | - if (!array_key_exists($r, $read)) |
|
503 | - $required[$r] = $initialApps[$r]; |
|
507 | + if (!array_key_exists($r, $read)) { |
|
508 | + $required[$r] = $initialApps[$r]; |
|
509 | + } |
|
504 | 510 | } |
505 | 511 | if (count($required)) { |
506 | 512 | $this->orderAppsByRequired($required, $ordered, $read); |
507 | 513 | } |
508 | 514 | } |
509 | - if (!array_key_exists($key, $ordered)) |
|
510 | - $ordered[$key] = $app; |
|
515 | + if (!array_key_exists($key, $ordered)) { |
|
516 | + $ordered[$key] = $app; |
|
517 | + } |
|
511 | 518 | } |
512 | 519 | } |
513 | 520 | |
@@ -679,8 +686,9 @@ discard block |
||
679 | 686 | */ |
680 | 687 | private function setModuleAliases($name, $aliases) |
681 | 688 | { |
682 | - foreach($aliases as $alias) |
|
683 | - static::$_moduleAliases[$alias] = $name; |
|
689 | + foreach($aliases as $alias) { |
|
690 | + static::$_moduleAliases[$alias] = $name; |
|
691 | + } |
|
684 | 692 | } |
685 | 693 | |
686 | 694 | /** |
@@ -707,7 +715,9 @@ discard block |
||
707 | 715 | foreach (neon()->getAllApps() as $key => $config) { |
708 | 716 | $app = neon()->getApp($key); |
709 | 717 | // disabled apps wil return null |
710 | - if ($app === null) continue; |
|
718 | + if ($app === null) { |
|
719 | + continue; |
|
720 | + } |
|
711 | 721 | $classes[$key] = $app->getClasses('form/fields', $instanceOf); |
712 | 722 | } |
713 | 723 | profile_end('neon:getAppClasses'); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | protected function hash($path) |
28 | 28 | { |
29 | - if (isset($this->publishOptions['path'])){ |
|
29 | + if (isset($this->publishOptions['path'])) { |
|
30 | 30 | // if a path is specified then use this instead of a hash |
31 | 31 | return $this->publishOptions['path']; |
32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | // of text/html instead of application/json then we are probably browsing the API |
19 | 19 | // and therefore want a prettier version of the response. |
20 | 20 | $acceptableContentTypes = array_keys(neon()->request->getAcceptableContentTypes()); |
21 | - $contentTypeIsHtml = (isset($acceptableContentTypes[0]) && $acceptableContentTypes[0] === 'text/html'); |
|
21 | + $contentTypeIsHtml = (isset($acceptableContentTypes[0]) && $acceptableContentTypes[0] === 'text/html'); |
|
22 | 22 | $prettyGetVarExists = (neon()->request->get('_pretty', false) !== false); |
23 | 23 | if ($contentTypeIsHtml || $prettyGetVarExists) { |
24 | 24 | $this->prettyPrint = true; |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | public function getForm() |
49 | 49 | { |
50 | 50 | $f = new \neon\core\form\Form('style'); |
51 | - foreach($this->getDefinition() as $field) { |
|
51 | + foreach ($this->getDefinition() as $field) { |
|
52 | 52 | $f->add($field); |
53 | 53 | } |
54 | 54 | $f->load($this->getStyles()); |
55 | 55 | return $f; |
56 | 56 | } |
57 | 57 | |
58 | - public function loadStyles($key='default') |
|
58 | + public function loadStyles($key = 'default') |
|
59 | 59 | { |
60 | 60 | return setting('cms', 'styles'); |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param array $options |
68 | 68 | * @return string - the current value for the style if the style variable with he name $name already exists |
69 | 69 | */ |
70 | - public function add($name, $default, $type, $options=[]) |
|
70 | + public function add($name, $default, $type, $options = []) |
|
71 | 71 | { |
72 | 72 | // check if a style property already exists |
73 | 73 | $styleValue = $this->getStyleValue($name, $default); |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | return $styleValue; |
80 | 80 | } |
81 | 81 | |
82 | - public function getStyleValue($name, $default='') |
|
82 | + public function getStyleValue($name, $default = '') |
|
83 | 83 | { |
84 | 84 | $styles = $this->getStyles(); |
85 | 85 | return Arr::get($styles, $name, $default); |
86 | 86 | } |
87 | 87 | |
88 | - public function set($name, $value, $field=null, $key='default') |
|
88 | + public function set($name, $value, $field = null, $key = 'default') |
|
89 | 89 | { |
90 | 90 | $styles = $this->getStyles(); |
91 | 91 | Arr::setValue($styles, $name, $value); |
@@ -72,8 +72,9 @@ |
||
72 | 72 | // check if a style property already exists |
73 | 73 | $styleValue = $this->getStyleValue($name, $default); |
74 | 74 | $options['name'] = $name; |
75 | - if (!isset($options['class'])) |
|
76 | - $options['class'] = $type; |
|
75 | + if (!isset($options['class'])) { |
|
76 | + $options['class'] = $type; |
|
77 | + } |
|
77 | 78 | $options['label'] = Arr::get($options, 'label', Str::humanize($name)); |
78 | 79 | $this->set($name, $styleValue, $options); |
79 | 80 | return $styleValue; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function findView($view, $context) |
125 | 125 | { |
126 | 126 | $exists = file_exists($this->findViewFile($view, $context)); |
127 | - return $exists ? $this->findViewFile($view, $context) : false ; |
|
127 | + return $exists ? $this->findViewFile($view, $context) : false; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | profile_begin('renderHeadHtml'); |
192 | 192 | if ($this->cssConcatenate) |
193 | 193 | $this->cssFiles = $this->resolveFiles($this->cssFiles, 'css'); |
194 | - $out = parent::renderHeadHtml() . "\n" . $this->getHtmlFragment(self::POS_HEAD); |
|
194 | + $out = parent::renderHeadHtml()."\n".$this->getHtmlFragment(self::POS_HEAD); |
|
195 | 195 | profile_end('renderHeadHtml'); |
196 | 196 | return $out; |
197 | 197 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function renderBodyBeginHtml() |
203 | 203 | { |
204 | - return parent::renderBodyBeginHtml() . "\n" . $this->getHtmlFragment(self::POS_BEGIN); |
|
204 | + return parent::renderBodyBeginHtml()."\n".$this->getHtmlFragment(self::POS_BEGIN); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if (isset($this->jsFiles[self::POS_END])) |
215 | 215 | $this->jsFiles[self::POS_END] = $this->resolveFiles($this->jsFiles[self::POS_END], 'js'); |
216 | 216 | } |
217 | - $out = parent::renderBodyEndHtml($ajaxMode) . "\n" . $this->getHtmlFragment(self::POS_END); |
|
217 | + $out = parent::renderBodyEndHtml($ajaxMode)."\n".$this->getHtmlFragment(self::POS_END); |
|
218 | 218 | profile_end('renderBodyEndHtml'); |
219 | 219 | return $out; |
220 | 220 | } |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | * @throws \yii\base\Exception - if the file/directory containing the new concatenated file could not be created |
255 | 255 | * @return array - new array of css files to replace $this->cssFiles |
256 | 256 | */ |
257 | - public function resolveFiles($files, $type='css') |
|
257 | + public function resolveFiles($files, $type = 'css') |
|
258 | 258 | { |
259 | 259 | // should cache results here |
260 | 260 | $concatFiles = $this->findFilesToConcatenate($files); |
261 | 261 | $url = ($type === 'css') ? $this->cssConcatenateFiles($concatFiles) : $this->jsConcatenateFiles($concatFiles); |
262 | 262 | // replace css/js files to be output with the one concatenated file |
263 | - foreach($concatFiles as $fileKey) unset($files[$fileKey]); |
|
263 | + foreach ($concatFiles as $fileKey) unset($files[$fileKey]); |
|
264 | 264 | $files[$url] = ($type === 'css') ? Html::cssFile($url) : Html::jsFile($url); |
265 | 265 | return $files; |
266 | 266 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @throws \yii\base\Exception - if the file/directory containing the new concatenated file could not be created |
278 | 278 | * @return string - url to dynamic css file url |
279 | 279 | */ |
280 | - public function cssConcatenateFiles($concatenateFiles, &$key='') |
|
280 | + public function cssConcatenateFiles($concatenateFiles, &$key = '') |
|
281 | 281 | { |
282 | 282 | $key = md5(serialize([$concatenateFiles, $this->cssMinify])); |
283 | 283 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | // for cache busting. Lets remove get params ? (namely the cache busting ?v=) |
292 | 292 | $file = substr($fileKey, 0, strpos($fileKey, '?')); |
293 | 293 | // Get the disk file path - replace web root path with the disk root path |
294 | - $fileName = $rootPath . Str::replaceFirst($webPath, '', $file); |
|
294 | + $fileName = $rootPath.Str::replaceFirst($webPath, '', $file); |
|
295 | 295 | // make sure local css url's are made absolute |
296 | 296 | $css = Css::replaceRelativeUrls(file_get_contents($fileName), $fileKey); |
297 | 297 | $cssConcat .= $css; |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | // remove get params ? (namely the cache busting ?v=) |
328 | 328 | $file = substr($fileKey, 0, strpos($fileKey, '?')); |
329 | 329 | // replace overlap web root path |
330 | - $fileName = $rootPath . (empty($webPath) ? $file : Str::replaceFirst($webPath, '', $file)); |
|
330 | + $fileName = $rootPath.(empty($webPath) ? $file : Str::replaceFirst($webPath, '', $file)); |
|
331 | 331 | // make sure we can find the file here |
332 | 332 | // we must concatenate each file on a new line to prevent |
333 | 333 | // line comments commenting out the first line of the next file |
334 | 334 | if (substr($fileName, -6) === 'min.js') { |
335 | - $jsConcat .= "\n" . file_get_contents($fileName); |
|
335 | + $jsConcat .= "\n".file_get_contents($fileName); |
|
336 | 336 | } else { |
337 | - $jsConcat .= "\n" . file_get_contents($fileName); |
|
337 | + $jsConcat .= "\n".file_get_contents($fileName); |
|
338 | 338 | // if allow auto php minify: its a bit too slow |
339 | 339 | //$jsConcat .= \JShrink\Minifier::minify(file_get_contents($fileName), array('flaggedComments' => false)); |
340 | 340 | } |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | */ |
383 | 383 | private function _assetManagerGenerate($path, $callback) |
384 | 384 | { |
385 | - $file = neon()->getAlias(neon()->assetManager->basePath . $path); |
|
386 | - if (! file_exists($file)) |
|
385 | + $file = neon()->getAlias(neon()->assetManager->basePath.$path); |
|
386 | + if (!file_exists($file)) |
|
387 | 387 | File::createFile($file, $callback()); |
388 | - return neon()->assetManager->baseUrl . $path; |
|
388 | + return neon()->assetManager->baseUrl.$path; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @param $styleKey |
398 | 398 | * @return string |
399 | 399 | */ |
400 | - public function getCssByKey($key, $styleKey='') |
|
400 | + public function getCssByKey($key, $styleKey = '') |
|
401 | 401 | { |
402 | 402 | $css = ''; |
403 | 403 | // load css file |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getCssFileByKey($key) |
422 | 422 | { |
423 | - return '@webroot/assets/css/' . $key . '.css'; |
|
423 | + return '@webroot/assets/css/'.$key.'.css'; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param string $styleKey - a key to identify the style to load |
430 | 430 | * @return array |
431 | 431 | */ |
432 | - public function getStyleData($styleKey='') |
|
432 | + public function getStyleData($styleKey = '') |
|
433 | 433 | { |
434 | 434 | return neon()->view->styleManager->getStyles(); |
435 | 435 | } |
@@ -189,8 +189,9 @@ discard block |
||
189 | 189 | public function renderHeadHtml() |
190 | 190 | { |
191 | 191 | profile_begin('renderHeadHtml'); |
192 | - if ($this->cssConcatenate) |
|
193 | - $this->cssFiles = $this->resolveFiles($this->cssFiles, 'css'); |
|
192 | + if ($this->cssConcatenate) { |
|
193 | + $this->cssFiles = $this->resolveFiles($this->cssFiles, 'css'); |
|
194 | + } |
|
194 | 195 | $out = parent::renderHeadHtml() . "\n" . $this->getHtmlFragment(self::POS_HEAD); |
195 | 196 | profile_end('renderHeadHtml'); |
196 | 197 | return $out; |
@@ -211,8 +212,9 @@ discard block |
||
211 | 212 | { |
212 | 213 | profile_begin('renderBodyEndHtml'); |
213 | 214 | if ($this->jsConcatenate) { |
214 | - if (isset($this->jsFiles[self::POS_END])) |
|
215 | - $this->jsFiles[self::POS_END] = $this->resolveFiles($this->jsFiles[self::POS_END], 'js'); |
|
215 | + if (isset($this->jsFiles[self::POS_END])) { |
|
216 | + $this->jsFiles[self::POS_END] = $this->resolveFiles($this->jsFiles[self::POS_END], 'js'); |
|
217 | + } |
|
216 | 218 | } |
217 | 219 | $out = parent::renderBodyEndHtml($ajaxMode) . "\n" . $this->getHtmlFragment(self::POS_END); |
218 | 220 | profile_end('renderBodyEndHtml'); |
@@ -260,7 +262,9 @@ discard block |
||
260 | 262 | $concatFiles = $this->findFilesToConcatenate($files); |
261 | 263 | $url = ($type === 'css') ? $this->cssConcatenateFiles($concatFiles) : $this->jsConcatenateFiles($concatFiles); |
262 | 264 | // replace css/js files to be output with the one concatenated file |
263 | - foreach($concatFiles as $fileKey) unset($files[$fileKey]); |
|
265 | + foreach($concatFiles as $fileKey) { |
|
266 | + unset($files[$fileKey]); |
|
267 | + } |
|
264 | 268 | $files[$url] = ($type === 'css') ? Html::cssFile($url) : Html::jsFile($url); |
265 | 269 | return $files; |
266 | 270 | } |
@@ -359,11 +363,13 @@ discard block |
||
359 | 363 | $concatenateFiles = []; |
360 | 364 | foreach ($files as $fileKey => $tag) { |
361 | 365 | // Do not concatenate externally loaded files (for e.g. from cdns) |
362 | - if (Url::isAbsolute($fileKey)) |
|
363 | - continue; |
|
366 | + if (Url::isAbsolute($fileKey)) { |
|
367 | + continue; |
|
368 | + } |
|
364 | 369 | // remove excluded files - files we do not want to concatenate |
365 | - if (Str::contains($tag, 'concatenate="false"')) |
|
366 | - continue; |
|
370 | + if (Str::contains($tag, 'concatenate="false"')) { |
|
371 | + continue; |
|
372 | + } |
|
367 | 373 | $concatenateFiles[] = $fileKey; |
368 | 374 | } |
369 | 375 | profile_end('_findFilesToConcatenate'); |
@@ -383,8 +389,9 @@ discard block |
||
383 | 389 | private function _assetManagerGenerate($path, $callback) |
384 | 390 | { |
385 | 391 | $file = neon()->getAlias(neon()->assetManager->basePath . $path); |
386 | - if (! file_exists($file)) |
|
387 | - File::createFile($file, $callback()); |
|
392 | + if (! file_exists($file)) { |
|
393 | + File::createFile($file, $callback()); |
|
394 | + } |
|
388 | 395 | return neon()->assetManager->baseUrl . $path; |
389 | 396 | } |
390 | 397 | |
@@ -407,8 +414,9 @@ discard block |
||
407 | 414 | $this->renderFile($file, $this->getStyleData($styleKey)) |
408 | 415 | : file_get_contents(neon()->getAlias($file)); |
409 | 416 | // minify css file |
410 | - if (neon()->view->cssMinify) |
|
411 | - $css = Css::minify($css); |
|
417 | + if (neon()->view->cssMinify) { |
|
418 | + $css = Css::minify($css); |
|
419 | + } |
|
412 | 420 | return $css; |
413 | 421 | } |
414 | 422 |
@@ -56,11 +56,11 @@ |
||
56 | 56 | // allow authenticated users |
57 | 57 | [ |
58 | 58 | 'allow' => true, |
59 | - 'roles' => [ 'neon-administrator' ] |
|
59 | + 'roles' => ['neon-administrator'] |
|
60 | 60 | ], |
61 | 61 | [ |
62 | 62 | 'allow' => true, |
63 | - 'matchCallback' => function ($rule, $action) { |
|
63 | + 'matchCallback' => function($rule, $action) { |
|
64 | 64 | return neon()->user->isSuper(); |
65 | 65 | } |
66 | 66 | ] |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @return array |
20 | 20 | * @throws \Exception |
21 | 21 | */ |
22 | - public function actionGetMapObjects($objectToken, $formField, $query=null, $start=0, $length=100) |
|
22 | + public function actionGetMapObjects($objectToken, $formField, $query = null, $start = 0, $length = 100) |
|
23 | 23 | { |
24 | 24 | /** @var \neon\core\form\Form $form */ |
25 | 25 | $form = Hash::getObjectFromToken($objectToken); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | // NOTE: may be useful to add this to the request / view as a helper function if the headers work |
32 | 32 | // `neon()->response->sendCachePermanentHeaders()`; |
33 | 33 | header("Content-type: text/css; charset: UTF-8"); |
34 | - header("Expires: " . gmdate("D, d M Y H:i:s", time() + $cacheSeconds) . " GMT"); |
|
34 | + header("Expires: ".gmdate("D, d M Y H:i:s", time() + $cacheSeconds)." GMT"); |
|
35 | 35 | header("Pragma: cache"); |
36 | 36 | header("Cache-Control: public, max-age=$cacheSeconds"); |
37 | 37 | // return css content with correct headers |
@@ -50,7 +50,7 @@ |
||
50 | 50 | private function createCSVFile() |
51 | 51 | { |
52 | 52 | // create a temp directory |
53 | - $tmpDir = \Yii::$app->runtimePath . '/csvtmp'; |
|
53 | + $tmpDir = \Yii::$app->runtimePath.'/csvtmp'; |
|
54 | 54 | if (!is_dir($tmpDir) && (!@mkdir($tmpDir) && !is_dir($tmpDir))) { |
55 | 55 | throw new \yii\web\NotFoundHttpException('temp directory does not exist'); |
56 | 56 | } |
@@ -29,8 +29,9 @@ |
||
29 | 29 | unset($rows); |
30 | 30 | } while ($hasRows === true); |
31 | 31 | $handle = fopen($csvFile, 'r'); |
32 | - if ($handle) |
|
33 | - neon()->response->sendStreamAsFile($handle, $grid->title.'.csv')->send(); |
|
32 | + if ($handle) { |
|
33 | + neon()->response->sendStreamAsFile($handle, $grid->title.'.csv')->send(); |
|
34 | + } |
|
34 | 35 | @unlink($csvFile); |
35 | 36 | } |
36 | 37 |