@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
73 | 73 | try { |
74 | 74 | $this->getImage($key); |
75 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter; |
|
75 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => $key]).'?v='.$cacheBusterCounter; |
|
76 | 76 | } catch (NotFoundException $e) { |
77 | 77 | } |
78 | 78 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | case 'logo': |
81 | 81 | case 'logoheader': |
82 | 82 | case 'favicon': |
83 | - return $this->urlGenerator->imagePath('core', 'logo.png') . '?v=' . $cacheBusterCounter; |
|
83 | + return $this->urlGenerator->imagePath('core', 'logo.png').'?v='.$cacheBusterCounter; |
|
84 | 84 | case 'background': |
85 | - return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter; |
|
85 | + return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | * @throws NotFoundException |
97 | 97 | */ |
98 | 98 | public function getImage(string $key, bool $useSvg = false): ISimpleFile { |
99 | - $logo = $this->config->getAppValue('theming', $key . 'Mime', false); |
|
99 | + $logo = $this->config->getAppValue('theming', $key.'Mime', false); |
|
100 | 100 | if ($logo === false) { |
101 | 101 | throw new NotFoundException(); |
102 | 102 | } |
103 | 103 | $folder = $this->appData->getFolder('images'); |
104 | 104 | if (!$useSvg && $this->shouldReplaceIcons()) { |
105 | - if (!$folder->fileExists($key . '.png')) { |
|
105 | + if (!$folder->fileExists($key.'.png')) { |
|
106 | 106 | try { |
107 | 107 | $finalIconFile = new \Imagick(); |
108 | 108 | $finalIconFile->setBackgroundColor('none'); |
109 | 109 | $finalIconFile->readImageBlob($folder->getFile($key)->getContent()); |
110 | 110 | $finalIconFile->setImageFormat('png32'); |
111 | - $pngFile = $folder->newFile($key . '.png'); |
|
111 | + $pngFile = $folder->newFile($key.'.png'); |
|
112 | 112 | $pngFile->putContent($finalIconFile->getImageBlob()); |
113 | 113 | } catch (\ImagickException $e) { |
114 | 114 | } |
115 | 115 | } else { |
116 | - $pngFile = $folder->getFile($key . '.png'); |
|
116 | + $pngFile = $folder->getFile($key.'.png'); |
|
117 | 117 | } |
118 | 118 | return $pngFile; |
119 | 119 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $images = []; |
125 | 125 | foreach ($this->supportedImageKeys as $key) { |
126 | 126 | $images[$key] = [ |
127 | - 'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''), |
|
127 | + 'mime' => $this->config->getAppValue('theming', $key.'Mime', ''), |
|
128 | 128 | 'url' => $this->getImageUrl($key), |
129 | 129 | ]; |
130 | 130 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } catch (NotPermittedException $e) { |
190 | 190 | } |
191 | 191 | try { |
192 | - $file = $this->appData->getFolder('images')->getFile($key . '.png'); |
|
192 | + $file = $this->appData->getFolder('images')->getFile($key.'.png'); |
|
193 | 193 | $file->delete(); |
194 | 194 | } catch (NotFoundException $e) { |
195 | 195 | } catch (NotPermittedException $e) { |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | * @return bool |
220 | 220 | */ |
221 | 221 | public function shouldReplaceIcons() { |
222 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
223 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
224 | - return (bool)$value; |
|
222 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
223 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
224 | + return (bool) $value; |
|
225 | 225 | } |
226 | 226 | $value = false; |
227 | - if(extension_loaded('imagick')) { |
|
227 | + if (extension_loaded('imagick')) { |
|
228 | 228 | if (count(\Imagick::queryFormats('SVG')) >= 1) { |
229 | 229 | $value = true; |
230 | 230 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | |
144 | 144 | public function getShortFooter() { |
145 | 145 | $slogan = $this->getSlogan(); |
146 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
147 | - ' rel="noreferrer noopener">' .$this->getEntity() . '</a>'. |
|
148 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
146 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
147 | + ' rel="noreferrer noopener">'.$this->getEntity().'</a>'. |
|
148 | + ($slogan !== '' ? ' – '.$slogan : ''); |
|
149 | 149 | |
150 | 150 | return $footer; |
151 | 151 | } |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | |
178 | 178 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
179 | 179 | |
180 | - if(!$logo || !$logoExists) { |
|
181 | - if($useSvg) { |
|
180 | + if (!$logo || !$logoExists) { |
|
181 | + if ($useSvg) { |
|
182 | 182 | $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); |
183 | 183 | } else { |
184 | 184 | $logo = $this->urlGenerator->imagePath('core', 'logo.png'); |
185 | 185 | } |
186 | - return $logo . '?v=' . $cacheBusterCounter; |
|
186 | + return $logo.'?v='.$cacheBusterCounter; |
|
187 | 187 | } |
188 | 188 | |
189 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]); |
|
189 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter]); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | * @return array scss variables to overwrite |
225 | 225 | */ |
226 | 226 | public function getScssVariables() { |
227 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
227 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
228 | 228 | if ($value = $cache->get('getScssVariables')) { |
229 | 229 | return $value; |
230 | 230 | } |
231 | 231 | |
232 | 232 | $variables = [ |
233 | - 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
234 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
235 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
236 | - 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
237 | - 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
233 | + 'theming-cachebuster' => "'".$this->config->getAppValue('theming', 'cachebuster', '0')."'", |
|
234 | + 'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime')."'", |
|
235 | + 'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime')."'", |
|
236 | + 'theming-logoheader-mime' => "'".$this->config->getAppValue('theming', 'logoheaderMime')."'", |
|
237 | + 'theming-favicon-mime' => "'".$this->config->getAppValue('theming', 'faviconMime')."'" |
|
238 | 238 | ]; |
239 | 239 | |
240 | 240 | $variables['image-logo'] = "'".$this->imageManager->getImageUrl('logo')."'"; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return bool|string false if image should not replaced, otherwise the location of the image |
266 | 266 | */ |
267 | 267 | public function replaceImagePath($app, $image) { |
268 | - if($app==='') { |
|
268 | + if ($app === '') { |
|
269 | 269 | $app = 'core'; |
270 | 270 | } |
271 | 271 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
@@ -277,19 +277,19 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | if ($image === 'favicon.ico' && ($customFavicon !== null || $this->shouldReplaceIcons())) { |
280 | - return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue; |
|
280 | + return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
281 | 281 | } |
282 | 282 | if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->shouldReplaceIcons())) { |
283 | - return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue; |
|
283 | + return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
284 | 284 | } |
285 | 285 | if ($image === 'manifest.json') { |
286 | 286 | try { |
287 | 287 | $appPath = $this->appManager->getAppPath($app); |
288 | - if (file_exists($appPath . '/img/manifest.json')) { |
|
288 | + if (file_exists($appPath.'/img/manifest.json')) { |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | } catch (AppPathNotFoundException $e) {} |
292 | - return $this->urlGenerator->linkToRoute('theming.Theming.getManifest') . '?v=' . $cacheBusterValue; |
|
292 | + return $this->urlGenerator->linkToRoute('theming.Theming.getManifest').'?v='.$cacheBusterValue; |
|
293 | 293 | } |
294 | 294 | return false; |
295 | 295 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | private function increaseCacheBuster() { |
313 | 313 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
314 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
314 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
315 | 315 | $this->cacheFactory->createDistributed('theming-')->clear(); |
316 | 316 | $this->cacheFactory->createDistributed('imagePath')->clear(); |
317 | 317 |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | if ($asPng) { |
358 | 358 | $response->addHeader('Content-Type', 'image/png'); |
359 | 359 | } else { |
360 | - $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); |
|
360 | + $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key.'Mime', '')); |
|
361 | 361 | } |
362 | 362 | return $response; |
363 | 363 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * since we need to add the cacheBuster value to the url |
380 | 380 | */ |
381 | 381 | $cssCached = $this->scssCacher->process($appPath, 'css/theming.scss', 'theming'); |
382 | - if(!$cssCached) { |
|
382 | + if (!$cssCached) { |
|
383 | 383 | return new NotFoundResponse(); |
384 | 384 | } |
385 | 385 | |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
409 | 409 | $responseJS = '(function() { |
410 | 410 | OCA.Theming = { |
411 | - name: ' . json_encode($this->themingDefaults->getName()) . ', |
|
412 | - url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ', |
|
413 | - slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ', |
|
414 | - color: ' . json_encode($this->themingDefaults->getColorPrimary()) . ', |
|
415 | - inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())) . ', |
|
416 | - cacheBuster: ' . json_encode($cacheBusterValue) . ' |
|
411 | + name: ' . json_encode($this->themingDefaults->getName()).', |
|
412 | + url: ' . json_encode($this->themingDefaults->getBaseUrl()).', |
|
413 | + slogan: ' . json_encode($this->themingDefaults->getSlogan()).', |
|
414 | + color: ' . json_encode($this->themingDefaults->getColorPrimary()).', |
|
415 | + inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())).', |
|
416 | + cacheBuster: ' . json_encode($cacheBusterValue).' |
|
417 | 417 | }; |
418 | 418 | })();'; |
419 | 419 | $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | [ |
439 | 439 | [ |
440 | 440 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', |
441 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
441 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
442 | 442 | 'type'=> 'image/png', |
443 | 443 | 'sizes'=> '128x128' |
444 | 444 | ], |
445 | 445 | [ |
446 | 446 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', |
447 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
447 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
448 | 448 | 'type' => 'image/svg+xml', |
449 | 449 | 'sizes' => '16x16' |
450 | 450 | ] |