@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | public function getImageUrl(string $key, bool $useSvg = true): string { |
80 | 80 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
81 | 81 | if ($this->hasImage($key)) { |
82 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter; |
|
82 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => $key]).'?v='.$cacheBusterCounter; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | switch ($key) { |
86 | 86 | case 'logo': |
87 | 87 | case 'logoheader': |
88 | 88 | case 'favicon': |
89 | - return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter; |
|
89 | + return $this->urlGenerator->imagePath('core', 'logo/logo.png').'?v='.$cacheBusterCounter; |
|
90 | 90 | case 'background': |
91 | - return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter; |
|
91 | + return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter; |
|
92 | 92 | } |
93 | 93 | return ''; |
94 | 94 | } |
@@ -105,33 +105,33 @@ discard block |
||
105 | 105 | * @throws NotPermittedException |
106 | 106 | */ |
107 | 107 | public function getImage(string $key, bool $useSvg = true): ISimpleFile { |
108 | - $logo = $this->config->getAppValue('theming', $key . 'Mime', ''); |
|
108 | + $logo = $this->config->getAppValue('theming', $key.'Mime', ''); |
|
109 | 109 | $folder = $this->appData->getFolder('images'); |
110 | 110 | if ($logo === '' || !$folder->fileExists($key)) { |
111 | 111 | throw new NotFoundException(); |
112 | 112 | } |
113 | 113 | if (!$useSvg && $this->shouldReplaceIcons()) { |
114 | - if (!$folder->fileExists($key . '.png')) { |
|
114 | + if (!$folder->fileExists($key.'.png')) { |
|
115 | 115 | try { |
116 | 116 | $finalIconFile = new \Imagick(); |
117 | 117 | $finalIconFile->setBackgroundColor('none'); |
118 | 118 | $finalIconFile->readImageBlob($folder->getFile($key)->getContent()); |
119 | 119 | $finalIconFile->setImageFormat('png32'); |
120 | - $pngFile = $folder->newFile($key . '.png'); |
|
120 | + $pngFile = $folder->newFile($key.'.png'); |
|
121 | 121 | $pngFile->putContent($finalIconFile->getImageBlob()); |
122 | 122 | return $pngFile; |
123 | 123 | } catch (\ImagickException $e) { |
124 | - $this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage()); |
|
124 | + $this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: '.$e->getMessage()); |
|
125 | 125 | } |
126 | 126 | } else { |
127 | - return $folder->getFile($key . '.png'); |
|
127 | + return $folder->getFile($key.'.png'); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | return $folder->getFile($key); |
131 | 131 | } |
132 | 132 | |
133 | 133 | public function hasImage(string $key): bool { |
134 | - $mimeSetting = $this->config->getAppValue('theming', $key . 'Mime', ''); |
|
134 | + $mimeSetting = $this->config->getAppValue('theming', $key.'Mime', ''); |
|
135 | 135 | return $mimeSetting !== ''; |
136 | 136 | } |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $images = []; |
143 | 143 | foreach ($this->supportedImageKeys as $key) { |
144 | 144 | $images[$key] = [ |
145 | - 'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''), |
|
145 | + 'mime' => $this->config->getAppValue('theming', $key.'Mime', ''), |
|
146 | 146 | 'url' => $this->getImageUrl($key), |
147 | 147 | ]; |
148 | 148 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } catch (NotPermittedException $e) { |
209 | 209 | } |
210 | 210 | try { |
211 | - $file = $this->appData->getFolder('images')->getFile($key . '.png'); |
|
211 | + $file = $this->appData->getFolder('images')->getFile($key.'.png'); |
|
212 | 212 | $file->delete(); |
213 | 213 | } catch (NotFoundException $e) { |
214 | 214 | } catch (NotPermittedException $e) { |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | imagealphablending($newImage, true); |
242 | 242 | |
243 | 243 | $tmpFile = $this->tempManager->getTemporaryFile(); |
244 | - $newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096); |
|
245 | - $newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth)); |
|
244 | + $newWidth = (int) (imagesx($newImage) < 4096 ? imagesx($newImage) : 4096); |
|
245 | + $newHeight = (int) (imagesy($newImage) / (imagesx($newImage) / $newWidth)); |
|
246 | 246 | $outputImage = imagescale($newImage, $newWidth, $newHeight); |
247 | 247 | |
248 | 248 | imageinterlace($outputImage, 1); |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * @return bool |
304 | 304 | */ |
305 | 305 | public function shouldReplaceIcons() { |
306 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
306 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
307 | 307 | if ($value = $cache->get('shouldReplaceIcons')) { |
308 | - return (bool)$value; |
|
308 | + return (bool) $value; |
|
309 | 309 | } |
310 | 310 | $value = false; |
311 | 311 | if (extension_loaded('imagick')) { |