@@ -147,18 +147,18 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | public function getShortFooter() { |
| 149 | 149 | $slogan = $this->getSlogan(); |
| 150 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
| 151 | - ' rel="noreferrer noopener">' .$this->getEntity() . '</a>'. |
|
| 152 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 150 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
| 151 | + ' rel="noreferrer noopener">'.$this->getEntity().'</a>'. |
|
| 152 | + ($slogan !== '' ? ' – '.$slogan : ''); |
|
| 153 | 153 | |
| 154 | - $imprintUrl = (string)$this->getImprintUrl(); |
|
| 155 | - if($imprintUrl !== '' |
|
| 154 | + $imprintUrl = (string) $this->getImprintUrl(); |
|
| 155 | + if ($imprintUrl !== '' |
|
| 156 | 156 | && filter_var($imprintUrl, FILTER_VALIDATE_URL, [ |
| 157 | 157 | 'flags' => FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED |
| 158 | 158 | ]) |
| 159 | 159 | ) { |
| 160 | - $footer .= '<br/><a href="' . $imprintUrl . '" class="legal" target="_blank"' . |
|
| 161 | - ' rel="noreferrer noopener">' . $this->l->t('Legal notice') . '</a>'; |
|
| 160 | + $footer .= '<br/><a href="'.$imprintUrl.'" class="legal" target="_blank"'. |
|
| 161 | + ' rel="noreferrer noopener">'.$this->l->t('Legal notice').'</a>'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | return $footer; |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 193 | 193 | |
| 194 | - if(!$logo || !$logoExists) { |
|
| 195 | - if($useSvg) { |
|
| 194 | + if (!$logo || !$logoExists) { |
|
| 195 | + if ($useSvg) { |
|
| 196 | 196 | $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); |
| 197 | 197 | } else { |
| 198 | 198 | $logo = $this->urlGenerator->imagePath('core', 'logo.png'); |
| 199 | 199 | } |
| 200 | - return $logo . '?v=' . $cacheBusterCounter; |
|
| 200 | + return $logo.'?v='.$cacheBusterCounter; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo' ]) . '?v=' . $cacheBusterCounter; |
|
| 203 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo']).'?v='.$cacheBusterCounter; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -238,17 +238,17 @@ discard block |
||
| 238 | 238 | * @return array scss variables to overwrite |
| 239 | 239 | */ |
| 240 | 240 | public function getScssVariables() { |
| 241 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
| 241 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
| 242 | 242 | if ($value = $cache->get('getScssVariables')) { |
| 243 | 243 | return $value; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $variables = [ |
| 247 | - 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
| 248 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
| 249 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
| 250 | - 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
| 251 | - 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
| 247 | + 'theming-cachebuster' => "'".$this->config->getAppValue('theming', 'cachebuster', '0')."'", |
|
| 248 | + 'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime')."'", |
|
| 249 | + 'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime')."'", |
|
| 250 | + 'theming-logoheader-mime' => "'".$this->config->getAppValue('theming', 'logoheaderMime')."'", |
|
| 251 | + 'theming-favicon-mime' => "'".$this->config->getAppValue('theming', 'faviconMime')."'" |
|
| 252 | 252 | ]; |
| 253 | 253 | |
| 254 | 254 | $variables['image-logo'] = "'".$this->imageManager->getImageUrl('logo')."'"; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @return bool|string false if image should not replaced, otherwise the location of the image |
| 280 | 280 | */ |
| 281 | 281 | public function replaceImagePath($app, $image) { |
| 282 | - if($app==='') { |
|
| 282 | + if ($app === '') { |
|
| 283 | 283 | $app = 'core'; |
| 284 | 284 | } |
| 285 | 285 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
@@ -291,19 +291,19 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | if ($image === 'favicon.ico' && ($customFavicon !== null || $this->shouldReplaceIcons())) { |
| 294 | - return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue; |
|
| 294 | + return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
| 295 | 295 | } |
| 296 | 296 | if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->shouldReplaceIcons())) { |
| 297 | - return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue; |
|
| 297 | + return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
| 298 | 298 | } |
| 299 | 299 | if ($image === 'manifest.json') { |
| 300 | 300 | try { |
| 301 | 301 | $appPath = $this->appManager->getAppPath($app); |
| 302 | - if (file_exists($appPath . '/img/manifest.json')) { |
|
| 302 | + if (file_exists($appPath.'/img/manifest.json')) { |
|
| 303 | 303 | return false; |
| 304 | 304 | } |
| 305 | 305 | } catch (AppPathNotFoundException $e) {} |
| 306 | - return $this->urlGenerator->linkToRoute('theming.Theming.getManifest') . '?v=' . $cacheBusterValue; |
|
| 306 | + return $this->urlGenerator->linkToRoute('theming.Theming.getManifest').'?v='.$cacheBusterValue; |
|
| 307 | 307 | } |
| 308 | 308 | return false; |
| 309 | 309 | } |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | * @return bool |
| 316 | 316 | */ |
| 317 | 317 | public function shouldReplaceIcons() { |
| 318 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
| 319 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
| 320 | - return (bool)$value; |
|
| 318 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
| 319 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
| 320 | + return (bool) $value; |
|
| 321 | 321 | } |
| 322 | 322 | $value = false; |
| 323 | - if(extension_loaded('imagick')) { |
|
| 323 | + if (extension_loaded('imagick')) { |
|
| 324 | 324 | $checkImagick = new \Imagick(); |
| 325 | 325 | if (count($checkImagick->queryFormats('SVG')) >= 1) { |
| 326 | 326 | $value = true; |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | */ |
| 337 | 337 | private function increaseCacheBuster() { |
| 338 | 338 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 339 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
| 339 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
| 340 | 340 | $this->cacheFactory->createDistributed('theming-')->clear(); |
| 341 | 341 | $this->cacheFactory->createDistributed('imagePath')->clear(); |
| 342 | 342 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $expires->add(new \DateInterval('PT24H')); |
| 363 | 363 | $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); |
| 364 | 364 | $response->addHeader('Pragma', 'cache'); |
| 365 | - $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); |
|
| 365 | + $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key.'Mime', '')); |
|
| 366 | 366 | return $response; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * since we need to add the cacheBuster value to the url |
| 384 | 384 | */ |
| 385 | 385 | $cssCached = $this->scssCacher->process($appPath, 'css/theming.scss', 'theming'); |
| 386 | - if(!$cssCached) { |
|
| 386 | + if (!$cssCached) { |
|
| 387 | 387 | return new NotFoundResponse(); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -412,13 +412,13 @@ discard block |
||
| 412 | 412 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 413 | 413 | $responseJS = '(function() { |
| 414 | 414 | OCA.Theming = { |
| 415 | - name: ' . json_encode($this->themingDefaults->getName()) . ', |
|
| 416 | - url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ', |
|
| 417 | - slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ', |
|
| 418 | - color: ' . json_encode($this->themingDefaults->getColorPrimary()) . ', |
|
| 419 | - imprintUrl: ' . json_encode($this->themingDefaults->getImprintUrl()) . ', |
|
| 420 | - inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())) . ', |
|
| 421 | - cacheBuster: ' . json_encode($cacheBusterValue) . ' |
|
| 415 | + name: ' . json_encode($this->themingDefaults->getName()).', |
|
| 416 | + url: ' . json_encode($this->themingDefaults->getBaseUrl()).', |
|
| 417 | + slogan: ' . json_encode($this->themingDefaults->getSlogan()).', |
|
| 418 | + color: ' . json_encode($this->themingDefaults->getColorPrimary()).', |
|
| 419 | + imprintUrl: ' . json_encode($this->themingDefaults->getImprintUrl()).', |
|
| 420 | + inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())).', |
|
| 421 | + cacheBuster: ' . json_encode($cacheBusterValue).' |
|
| 422 | 422 | }; |
| 423 | 423 | })();'; |
| 424 | 424 | $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); |
@@ -443,13 +443,13 @@ discard block |
||
| 443 | 443 | [ |
| 444 | 444 | [ |
| 445 | 445 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', |
| 446 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
| 446 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
| 447 | 447 | 'type'=> 'image/png', |
| 448 | 448 | 'sizes'=> '128x128' |
| 449 | 449 | ], |
| 450 | 450 | [ |
| 451 | 451 | 'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', |
| 452 | - ['app' => $app]) . '?v=' . $cacheBusterValue, |
|
| 452 | + ['app' => $app]).'?v='.$cacheBusterValue, |
|
| 453 | 453 | 'type' => 'image/svg+xml', |
| 454 | 454 | 'sizes' => '16x16' |
| 455 | 455 | ] |