@@ -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 |
@@ -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 |
@@ -38,8 +38,9 @@ |
||
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 | 44 | return $string; |
44 | 45 | } |
45 | 46 |
@@ -158,7 +158,9 @@ |
||
158 | 158 | |
159 | 159 | $result = $this->put($path = trim($path), $stream, $visibility); |
160 | 160 | |
161 | - if (is_resource($stream)) fclose($stream); |
|
161 | + if (is_resource($stream)) { |
|
162 | + fclose($stream); |
|
163 | + } |
|
162 | 164 | |
163 | 165 | return $result ? (bool) $path : false; |
164 | 166 | } |
@@ -203,8 +203,7 @@ |
||
203 | 203 | $file = DbFile::findOne($dirname); |
204 | 204 | if ($file === null) { |
205 | 205 | $file = new DbFile(['path' => $dirname]); |
206 | - } |
|
207 | - else if ($file->type == DbFile::TYPE_FILE) { |
|
206 | + } else if ($file->type == DbFile::TYPE_FILE) { |
|
208 | 207 | throw new FileExistsException('Can not create a directory as a file already exists.'); |
209 | 208 | } |
210 | 209 | if ($visibility = $config->get('visibility')) { |
@@ -33,22 +33,26 @@ discard block |
||
33 | 33 | private function convertFireflyGetsToFiles($search, $replace) |
34 | 34 | { |
35 | 35 | $potentiallyAffected = $this->db->createCommand("SELECT `class_type`, `member_ref` FROM `dds_member` WHERE `data_type_ref`='textlong'")->queryAll(); |
36 | - if (count($potentiallyAffected)==0) |
|
37 | - return; |
|
36 | + if (count($potentiallyAffected)==0) { |
|
37 | + return; |
|
38 | + } |
|
38 | 39 | $classes = []; |
39 | - foreach ($potentiallyAffected as $pa) |
|
40 | - $classes[$pa['class_type']][] = $pa['member_ref']; |
|
40 | + foreach ($potentiallyAffected as $pa) { |
|
41 | + $classes[$pa['class_type']][] = $pa['member_ref']; |
|
42 | + } |
|
41 | 43 | $phoebeClasses = array_keys($classes); |
42 | 44 | $phoebe = neon('phoebe')->getIPhoebeType('daedalus'); |
43 | 45 | |
44 | 46 | $phoebeDefinition = []; |
45 | - foreach ($phoebeClasses as $pc) |
|
46 | - $phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false); |
|
47 | + foreach ($phoebeClasses as $pc) { |
|
48 | + $phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false); |
|
49 | + } |
|
47 | 50 | |
48 | 51 | $potentiallyAffectedLookup = []; |
49 | 52 | foreach ($potentiallyAffected as $pa) { |
50 | - if (empty($potentiallyAffectedLookup[$pa['class_type']])) |
|
51 | - $potentiallyAffectedLookup[$pa['class_type']] = []; |
|
53 | + if (empty($potentiallyAffectedLookup[$pa['class_type']])) { |
|
54 | + $potentiallyAffectedLookup[$pa['class_type']] = []; |
|
55 | + } |
|
52 | 56 | $potentiallyAffectedLookup[$pa['class_type']][] = $pa['member_ref']; |
53 | 57 | } |
54 | 58 | |
@@ -77,8 +81,9 @@ discard block |
||
77 | 81 | foreach ($found as $objectData) { |
78 | 82 | $changes = []; |
79 | 83 | foreach ($fields as $field) { |
80 | - if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false) |
|
81 | - $changes[$field] = str_replace($search, $replace, $objectData[$field]); |
|
84 | + if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false) { |
|
85 | + $changes[$field] = str_replace($search, $replace, $objectData[$field]); |
|
86 | + } |
|
82 | 87 | } |
83 | 88 | if (count($changes)) { |
84 | 89 | $dds->editObject($objectData['_uuid'], $changes); |
@@ -366,8 +366,9 @@ |
||
366 | 366 | */ |
367 | 367 | public function isFileObjectValid($file, $throwExceptions=true) |
368 | 368 | { |
369 | - if ($file instanceof IFile) |
|
370 | - return true; |
|
369 | + if ($file instanceof IFile) { |
|
370 | + return true; |
|
371 | + } |
|
371 | 372 | // not all objects have the privilege of implementing the IFile interface like \SplFileObject |
372 | 373 | // Firefly only cares about these two functions 'getRealPath' and 'getFilename' |
373 | 374 | $objectIsValid = is_object($file) |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | if (is_string($root) && count($themes)) { |
30 | 30 | foreach ($themes as $theme) { |
31 | 31 | $themePath = $root.$theme; |
32 | - if (!isset($hierarchy[$theme])) |
|
33 | - $hierarchy[$theme] = []; |
|
32 | + if (!isset($hierarchy[$theme])) { |
|
33 | + $hierarchy[$theme] = []; |
|
34 | + } |
|
34 | 35 | |
35 | 36 | // add the default template and plugin directories |
36 | 37 | $hierarchy[$theme]['templates'][] = $themePath; |
@@ -104,8 +105,9 @@ discard block |
||
104 | 105 | private static function getRoot() |
105 | 106 | { |
106 | 107 | static $root = null; |
107 | - if ($root === null) |
|
108 | - $root = Neon::getAlias('@root/themes/'); |
|
108 | + if ($root === null) { |
|
109 | + $root = Neon::getAlias('@root/themes/'); |
|
110 | + } |
|
109 | 111 | return $root; |
110 | 112 | } |
111 | 113 | } |
@@ -39,17 +39,19 @@ discard block |
||
39 | 39 | { |
40 | 40 | // see if we have a key and if not we can do nothing |
41 | 41 | $key = neon()->request->post('key'); |
42 | - if (empty($key)) |
|
43 | - return; |
|
42 | + if (empty($key)) { |
|
43 | + return; |
|
44 | + } |
|
44 | 45 | $content = neon()->request->postUnsafe('content'); |
45 | 46 | $content = Html::sanitise($content, $this->inlineAllowedTags); |
46 | 47 | $pageId = neon()->request->post('pageId', null); |
47 | 48 | try { |
48 | 49 | $result = neon('cms')->getICmsStaticData()->editStaticContent($key, $pageId, $content); |
49 | - if ($result === true) |
|
50 | - return ['success'=>true, 'saved'=>$content]; |
|
51 | - else |
|
52 | - return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false]; |
|
50 | + if ($result === true) { |
|
51 | + return ['success'=>true, 'saved'=>$content]; |
|
52 | + } else { |
|
53 | + return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false]; |
|
54 | + } |
|
53 | 55 | } catch (\Exception $e) { |
54 | 56 | return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false]; |
55 | 57 | } |
@@ -67,10 +69,11 @@ discard block |
||
67 | 69 | $pageId = neon()->request->post('pageId', null); |
68 | 70 | try { |
69 | 71 | $result = neon()->cms->getICmsStaticData()->editStaticContent($key, $pageId, $content); |
70 | - if ($result === true) |
|
71 | - return ['success'=>true, 'saved'=>$content]; |
|
72 | - else if (neon()->debug) |
|
73 | - return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false]; |
|
72 | + if ($result === true) { |
|
73 | + return ['success'=>true, 'saved'=>$content]; |
|
74 | + } else if (neon()->debug) { |
|
75 | + return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false]; |
|
76 | + } |
|
74 | 77 | } catch (\Exception $e) { |
75 | 78 | return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false]; |
76 | 79 | } |