@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getThemedIcon(string $app, string $image): Response { |
92 | 92 | try { |
93 | - $iconFile = $this->imageManager->getCachedImage('icon-' . $app . '-' . str_replace('/', '_',$image)); |
|
93 | + $iconFile = $this->imageManager->getCachedImage('icon-'.$app.'-'.str_replace('/', '_', $image)); |
|
94 | 94 | } catch (NotFoundException $exception) { |
95 | 95 | $icon = $this->iconBuilder->colorSvg($app, $image); |
96 | 96 | if ($icon === false || $icon === '') { |
97 | 97 | return new NotFoundResponse(); |
98 | 98 | } |
99 | - $iconFile = $this->imageManager->setCachedImage('icon-' . $app . '-' . str_replace('/', '_',$image), $icon); |
|
99 | + $iconFile = $this->imageManager->setCachedImage('icon-'.$app.'-'.str_replace('/', '_', $image), $icon); |
|
100 | 100 | } |
101 | 101 | if ($iconFile !== false) { |
102 | 102 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | } |
133 | 133 | if ($iconFile === null && $this->themingDefaults->shouldReplaceIcons()) { |
134 | 134 | try { |
135 | - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
135 | + $iconFile = $this->imageManager->getCachedImage('favIcon-'.$app); |
|
136 | 136 | } catch (NotFoundException $exception) { |
137 | 137 | $icon = $this->iconBuilder->getFavicon($app); |
138 | - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
138 | + $iconFile = $this->imageManager->setCachedImage('favIcon-'.$app, $icon); |
|
139 | 139 | } |
140 | 140 | if ($iconFile !== false) { |
141 | 141 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
142 | 142 | } |
143 | 143 | } |
144 | - if($response === null) { |
|
145 | - $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png'; |
|
144 | + if ($response === null) { |
|
145 | + $fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon.png'; |
|
146 | 146 | $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
147 | 147 | } |
148 | 148 | $response->cacheFor(86400); |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | } |
174 | 174 | if ($this->themingDefaults->shouldReplaceIcons()) { |
175 | 175 | try { |
176 | - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
176 | + $iconFile = $this->imageManager->getCachedImage('touchIcon-'.$app); |
|
177 | 177 | } catch (NotFoundException $exception) { |
178 | 178 | $icon = $this->iconBuilder->getTouchIcon($app); |
179 | - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
179 | + $iconFile = $this->imageManager->setCachedImage('touchIcon-'.$app, $icon); |
|
180 | 180 | } |
181 | 181 | if ($iconFile !== false) { |
182 | 182 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
183 | 183 | } |
184 | 184 | } |
185 | - if($response === null) { |
|
186 | - $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png'; |
|
185 | + if ($response === null) { |
|
186 | + $fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon-touch.png'; |
|
187 | 187 | $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']); |
188 | 188 | } |
189 | 189 | $response->cacheFor(86400); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
65 | 65 | try { |
66 | 66 | $this->getImage($key); |
67 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter; |
|
67 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => $key]).'?v='.$cacheBusterCounter; |
|
68 | 68 | } catch (NotFoundException $e) { |
69 | 69 | } |
70 | 70 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | case 'logo': |
73 | 73 | case 'logoheader': |
74 | 74 | case 'favicon': |
75 | - return $this->urlGenerator->imagePath('core', 'logo.png') . '?v=' . $cacheBusterCounter; |
|
75 | + return $this->urlGenerator->imagePath('core', 'logo.png').'?v='.$cacheBusterCounter; |
|
76 | 76 | case 'background': |
77 | - return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter; |
|
77 | + return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @throws NotFoundException |
89 | 89 | */ |
90 | 90 | public function getImage(string $key): ISimpleFile { |
91 | - $logo = $this->config->getAppValue('theming', $key . 'Mime', false); |
|
91 | + $logo = $this->config->getAppValue('theming', $key.'Mime', false); |
|
92 | 92 | if ($logo === false) { |
93 | 93 | throw new NotFoundException(); |
94 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $images = []; |
101 | 101 | foreach ($this->supportedImageKeys as $key) { |
102 | 102 | $images[$key] = [ |
103 | - 'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''), |
|
103 | + 'mime' => $this->config->getAppValue('theming', $key.'Mime', ''), |
|
104 | 104 | 'url' => $this->getImageUrl($key), |
105 | 105 | ]; |
106 | 106 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $expires->add(new \DateInterval('PT24H')); |
353 | 353 | $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
354 | 354 | $response->addHeader('Pragma', 'cache'); |
355 | - $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); |
|
355 | + $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key.'Mime', '')); |
|
356 | 356 | return $response; |
357 | 357 | } |
358 | 358 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * since we need to add the cacheBuster value to the url |
374 | 374 | */ |
375 | 375 | $cssCached = $this->scssCacher->process($appPath, 'css/theming.scss', 'theming'); |
376 | - if(!$cssCached) { |
|
376 | + if (!$cssCached) { |
|
377 | 377 | return new NotFoundResponse(); |
378 | 378 | } |
379 | 379 | |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
403 | 403 | $responseJS = '(function() { |
404 | 404 | OCA.Theming = { |
405 | - name: ' . json_encode($this->themingDefaults->getName()) . ', |
|
406 | - url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ', |
|
407 | - slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ', |
|
408 | - color: ' . json_encode($this->themingDefaults->getColorPrimary()) . ', |
|
409 | - inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())) . ', |
|
410 | - cacheBuster: ' . json_encode($cacheBusterValue) . ' |
|
405 | + name: ' . json_encode($this->themingDefaults->getName()).', |
|
406 | + url: ' . json_encode($this->themingDefaults->getBaseUrl()).', |
|
407 | + slogan: ' . json_encode($this->themingDefaults->getSlogan()).', |
|
408 | + color: ' . json_encode($this->themingDefaults->getColorPrimary()).', |
|
409 | + inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())).', |
|
410 | + cacheBuster: ' . json_encode($cacheBusterValue).' |
|
411 | 411 | }; |
412 | 412 | })();'; |
413 | 413 | $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | [ |
433 | 433 | [ |
434 | 434 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', |
435 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
435 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
436 | 436 | 'type'=> 'image/png', |
437 | 437 | 'sizes'=> '128x128' |
438 | 438 | ], |
439 | 439 | [ |
440 | 440 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', |
441 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
441 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
442 | 442 | 'type' => 'image/svg+xml', |
443 | 443 | 'sizes' => '16x16' |
444 | 444 | ] |
@@ -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' ]) . '?v=' . $cacheBusterCounter; |
|
189 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo']).'?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 | } |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | * @return bool |
302 | 302 | */ |
303 | 303 | public function shouldReplaceIcons() { |
304 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
305 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
306 | - return (bool)$value; |
|
304 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
305 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
306 | + return (bool) $value; |
|
307 | 307 | } |
308 | 308 | $value = false; |
309 | - if(extension_loaded('imagick')) { |
|
309 | + if (extension_loaded('imagick')) { |
|
310 | 310 | $checkImagick = new \Imagick(); |
311 | 311 | if (count($checkImagick->queryFormats('SVG')) >= 1) { |
312 | 312 | $value = true; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | private function increaseCacheBuster() { |
324 | 324 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
325 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
325 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
326 | 326 | $this->cacheFactory->createDistributed('theming-')->clear(); |
327 | 327 | $this->cacheFactory->createDistributed('imagePath')->clear(); |
328 | 328 |