@@ -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 | } |
@@ -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 | } |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | * @param integer $size size of the string required |
34 | 34 | * @return string |
35 | 35 | */ |
36 | - protected static function randomString($size=20) |
|
36 | + protected static function randomString($size = 20) |
|
37 | 37 | { |
38 | 38 | $source = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
39 | 39 | $sourceLen = strlen($source); |
40 | 40 | $string = ''; |
41 | - for ($i=0; $i<$size; $i++) |
|
42 | - $string .= substr($source, rand(0, $sourceLen-1), 1); |
|
41 | + for ($i = 0; $i < $size; $i++) |
|
42 | + $string .= substr($source, rand(0, $sourceLen - 1), 1); |
|
43 | 43 | return $string; |
44 | 44 | } |
45 | 45 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @param int $time the time if not now |
85 | 85 | * @return datetime in form yyyy-mm-dd hh-mm-ss |
86 | 86 | */ |
87 | - protected function datetime($time=null, $format='Y-m-d H:i:s') |
|
87 | + protected function datetime($time = null, $format = 'Y-m-d H:i:s') |
|
88 | 88 | { |
89 | - return date($format, ($time===null ? time() : $time)); |
|
89 | + return date($format, ($time === null ? time() : $time)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -105,7 +105,7 @@ |
||
105 | 105 | * ], |
106 | 106 | * ] |
107 | 107 | */ |
108 | - public function addFile($id, $path='/'); |
|
108 | + public function addFile($id, $path = '/'); |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Get the information about the root node. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | if (is_string($value)) { |
103 | 103 | if ($value != self::VISIBILITY_PRIVATE && $value != self::VISIBILITY_PUBLIC) { |
104 | - throw new \InvalidArgumentException('The visibility must be set to either "' . self::VISIBILITY_PRIVATE . '" or "' . self::VISIBILITY_PUBLIC . '"'); |
|
104 | + throw new \InvalidArgumentException('The visibility must be set to either "'.self::VISIBILITY_PRIVATE.'" or "'.self::VISIBILITY_PUBLIC.'"'); |
|
105 | 105 | } |
106 | 106 | $this->setAttribute('visibility', $value); |
107 | 107 | } // If the value is a boolean then a value of true means public a value of false means private |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $this->setAttribute('visibility', $value ? self::VISIBILITY_PUBLIC : self::VISIBILITY_PRIVATE); |
110 | 110 | } // We have no idea what you passed in :-S |
111 | 111 | else { |
112 | - throw new \InvalidArgumentException('Incorrect value being set on visibility, expecting either a boolean or a string, you gave ' . print_r($value, true)); |
|
112 | + throw new \InvalidArgumentException('Incorrect value being set on visibility, expecting either a boolean or a string, you gave '.print_r($value, true)); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ->all(); |
184 | 184 | $success = true; |
185 | 185 | foreach ($files as $file) { |
186 | - if ( ! $this->delete($file['path'])) { |
|
186 | + if (!$this->delete($file['path'])) { |
|
187 | 187 | $success = false; |
188 | 188 | } |
189 | 189 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $query->where(['like', 'path', $directory]); |
297 | 297 | } |
298 | 298 | $result = $query->asArray()->limit(1000)->all(); |
299 | - $result = array_map(function($r){ |
|
299 | + $result = array_map(function($r) { |
|
300 | 300 | return DbFile::convertToFileSystemFormat($r); |
301 | 301 | }, $result); |
302 | 302 | return Util::emulateDirectories($result); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | { |
313 | 313 | $path = rtrim($path, '/'); |
314 | 314 | $sanitizedPath = addcslashes($path, '_%'); |
315 | - return $sanitizedPath . '/'; |
|
315 | + return $sanitizedPath.'/'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @param string $path |
397 | 397 | * @throws \neon\firefly\services\fileManager\FileExceedsMemoryLimitException |
398 | 398 | */ |
399 | - protected function _checkFileSizeLimit($path, $message='') |
|
399 | + protected function _checkFileSizeLimit($path, $message = '') |
|
400 | 400 | { |
401 | 401 | if (function_exists('ini_get')) { |
402 | 402 | $bytes = to_bytes(ini_get('memory_limit')); |