@@ -31,293 +31,293 @@ |
||
31 | 31 | |
32 | 32 | class ThemingDefaults extends \OC_Defaults { |
33 | 33 | |
34 | - /** @var IConfig */ |
|
35 | - private $config; |
|
36 | - /** @var IL10N */ |
|
37 | - private $l; |
|
38 | - /** @var IURLGenerator */ |
|
39 | - private $urlGenerator; |
|
40 | - /** @var IAppData */ |
|
41 | - private $appData; |
|
42 | - /** @var ICacheFactory */ |
|
43 | - private $cacheFactory; |
|
44 | - /** @var string */ |
|
45 | - private $name; |
|
46 | - /** @var string */ |
|
47 | - private $url; |
|
48 | - /** @var string */ |
|
49 | - private $slogan; |
|
50 | - /** @var string */ |
|
51 | - private $color; |
|
52 | - /** @var Util */ |
|
53 | - private $util; |
|
54 | - /** @var string */ |
|
55 | - private $iTunesAppId; |
|
56 | - /** @var string */ |
|
57 | - private $iOSClientUrl; |
|
58 | - /** @var string */ |
|
59 | - private $AndroidClientUrl; |
|
60 | - |
|
61 | - /** |
|
62 | - * ThemingDefaults constructor. |
|
63 | - * |
|
64 | - * @param IConfig $config |
|
65 | - * @param IL10N $l |
|
66 | - * @param IURLGenerator $urlGenerator |
|
67 | - * @param \OC_Defaults $defaults |
|
68 | - * @param IAppData $appData |
|
69 | - * @param ICacheFactory $cacheFactory |
|
70 | - * @param Util $util |
|
71 | - */ |
|
72 | - public function __construct(IConfig $config, |
|
73 | - IL10N $l, |
|
74 | - IURLGenerator $urlGenerator, |
|
75 | - IAppData $appData, |
|
76 | - ICacheFactory $cacheFactory, |
|
77 | - Util $util |
|
78 | - ) { |
|
79 | - parent::__construct(); |
|
80 | - $this->config = $config; |
|
81 | - $this->l = $l; |
|
82 | - $this->urlGenerator = $urlGenerator; |
|
83 | - $this->appData = $appData; |
|
84 | - $this->cacheFactory = $cacheFactory; |
|
85 | - $this->util = $util; |
|
86 | - |
|
87 | - $this->name = parent::getName(); |
|
88 | - $this->url = parent::getBaseUrl(); |
|
89 | - $this->slogan = parent::getSlogan(); |
|
90 | - $this->color = parent::getColorPrimary(); |
|
91 | - $this->iTunesAppId = parent::getiTunesAppId(); |
|
92 | - $this->iOSClientUrl = parent::getiOSClientUrl(); |
|
93 | - $this->AndroidClientUrl = parent::getAndroidClientUrl(); |
|
94 | - } |
|
95 | - |
|
96 | - public function getName() { |
|
97 | - return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
98 | - } |
|
99 | - |
|
100 | - public function getHTMLName() { |
|
101 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
102 | - } |
|
103 | - |
|
104 | - public function getTitle() { |
|
105 | - return $this->getName(); |
|
106 | - } |
|
107 | - |
|
108 | - public function getEntity() { |
|
109 | - return $this->getName(); |
|
110 | - } |
|
111 | - |
|
112 | - public function getBaseUrl() { |
|
113 | - return $this->config->getAppValue('theming', 'url', $this->url); |
|
114 | - } |
|
115 | - |
|
116 | - public function getSlogan() { |
|
117 | - return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan)); |
|
118 | - } |
|
119 | - |
|
120 | - public function getShortFooter() { |
|
121 | - $slogan = $this->getSlogan(); |
|
122 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
123 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
124 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
125 | - |
|
126 | - return $footer; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Color that is used for the header as well as for mail headers |
|
131 | - * |
|
132 | - * @return string |
|
133 | - */ |
|
134 | - public function getColorPrimary() { |
|
135 | - return $this->config->getAppValue('theming', 'color', $this->color); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Themed logo url |
|
140 | - * |
|
141 | - * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
142 | - * @return string |
|
143 | - */ |
|
144 | - public function getLogo($useSvg = true) { |
|
145 | - $logo = $this->config->getAppValue('theming', 'logoMime', false); |
|
146 | - |
|
147 | - $logoExists = true; |
|
148 | - try { |
|
149 | - $this->appData->getFolder('images')->getFile('logo'); |
|
150 | - } catch (\Exception $e) { |
|
151 | - $logoExists = false; |
|
152 | - } |
|
153 | - |
|
154 | - $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
155 | - |
|
156 | - if(!$logo || !$logoExists) { |
|
157 | - if($useSvg) { |
|
158 | - $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); |
|
159 | - } else { |
|
160 | - $logo = $this->urlGenerator->imagePath('core', 'logo.png'); |
|
161 | - } |
|
162 | - return $logo . '?v=' . $cacheBusterCounter; |
|
163 | - } |
|
164 | - |
|
165 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Themed background image url |
|
170 | - * |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function getBackground() { |
|
174 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false); |
|
175 | - |
|
176 | - $backgroundExists = true; |
|
177 | - try { |
|
178 | - $this->appData->getFolder('images')->getFile('background'); |
|
179 | - } catch (\Exception $e) { |
|
180 | - $backgroundExists = false; |
|
181 | - } |
|
182 | - |
|
183 | - $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
184 | - |
|
185 | - if(!$backgroundLogo || !$backgroundExists) { |
|
186 | - return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter; |
|
187 | - } |
|
188 | - |
|
189 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter; |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * @return string |
|
194 | - */ |
|
195 | - public function getiTunesAppId() { |
|
196 | - return $this->config->getAppValue('theming', 'iTunesAppId', $this->iTunesAppId); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * @return string |
|
201 | - */ |
|
202 | - public function getiOSClientUrl() { |
|
203 | - return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl); |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - public function getAndroidClientUrl() { |
|
210 | - return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl); |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * @return array scss variables to overwrite |
|
216 | - */ |
|
217 | - public function getScssVariables() { |
|
218 | - $cache = $this->cacheFactory->create('theming'); |
|
219 | - if ($value = $cache->get('getScssVariables')) { |
|
220 | - return $value; |
|
221 | - } |
|
222 | - |
|
223 | - $variables = [ |
|
224 | - 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
225 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime', '') . "'", |
|
226 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime', '') . "'" |
|
227 | - ]; |
|
228 | - |
|
229 | - $variables['image-logo'] = "'".$this->urlGenerator->getAbsoluteURL($this->getLogo())."'"; |
|
230 | - $variables['image-login-background'] = "'".$this->urlGenerator->getAbsoluteURL($this->getBackground())."'"; |
|
231 | - $variables['image-login-plain'] = 'false'; |
|
232 | - |
|
233 | - if ($this->config->getAppValue('theming', 'color', null) !== null) { |
|
234 | - if ($this->util->invertTextColor($this->getColorPrimary())) { |
|
235 | - $colorPrimaryText = '#000000'; |
|
236 | - } else { |
|
237 | - $colorPrimaryText = '#ffffff'; |
|
238 | - } |
|
239 | - $variables['color-primary'] = $this->getColorPrimary(); |
|
240 | - $variables['color-primary-text'] = $colorPrimaryText; |
|
241 | - } |
|
242 | - |
|
243 | - if ($this->config->getAppValue('theming', 'backgroundMime', null) === 'backgroundColor') { |
|
244 | - $variables['image-login-plain'] = 'true'; |
|
245 | - } |
|
246 | - $cache->set('getScssVariables', $variables); |
|
247 | - return $variables; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * Check if Imagemagick is enabled and if SVG is supported |
|
252 | - * otherwise we can't render custom icons |
|
253 | - * |
|
254 | - * @return bool |
|
255 | - */ |
|
256 | - public function shouldReplaceIcons() { |
|
257 | - $cache = $this->cacheFactory->create('theming'); |
|
258 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
259 | - return (bool)$value; |
|
260 | - } |
|
261 | - $value = false; |
|
262 | - if(extension_loaded('imagick')) { |
|
263 | - $checkImagick = new \Imagick(); |
|
264 | - if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
265 | - $value = true; |
|
266 | - } |
|
267 | - $checkImagick->clear(); |
|
268 | - } |
|
269 | - $cache->set('shouldReplaceIcons', $value); |
|
270 | - return $value; |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Increases the cache buster key |
|
275 | - */ |
|
276 | - private function increaseCacheBuster() { |
|
277 | - $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
278 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
279 | - $this->cacheFactory->create('theming')->clear('getScssVariables'); |
|
280 | - } |
|
281 | - |
|
282 | - /** |
|
283 | - * Update setting in the database |
|
284 | - * |
|
285 | - * @param string $setting |
|
286 | - * @param string $value |
|
287 | - */ |
|
288 | - public function set($setting, $value) { |
|
289 | - $this->config->setAppValue('theming', $setting, $value); |
|
290 | - $this->increaseCacheBuster(); |
|
291 | - } |
|
292 | - |
|
293 | - /** |
|
294 | - * Revert settings to the default value |
|
295 | - * |
|
296 | - * @param string $setting setting which should be reverted |
|
297 | - * @return string default value |
|
298 | - */ |
|
299 | - public function undo($setting) { |
|
300 | - $this->config->deleteAppValue('theming', $setting); |
|
301 | - $this->increaseCacheBuster(); |
|
302 | - |
|
303 | - switch ($setting) { |
|
304 | - case 'name': |
|
305 | - $returnValue = $this->getEntity(); |
|
306 | - break; |
|
307 | - case 'url': |
|
308 | - $returnValue = $this->getBaseUrl(); |
|
309 | - break; |
|
310 | - case 'slogan': |
|
311 | - $returnValue = $this->getSlogan(); |
|
312 | - break; |
|
313 | - case 'color': |
|
314 | - $returnValue = $this->getColorPrimary(); |
|
315 | - break; |
|
316 | - default: |
|
317 | - $returnValue = ''; |
|
318 | - break; |
|
319 | - } |
|
320 | - |
|
321 | - return $returnValue; |
|
322 | - } |
|
34 | + /** @var IConfig */ |
|
35 | + private $config; |
|
36 | + /** @var IL10N */ |
|
37 | + private $l; |
|
38 | + /** @var IURLGenerator */ |
|
39 | + private $urlGenerator; |
|
40 | + /** @var IAppData */ |
|
41 | + private $appData; |
|
42 | + /** @var ICacheFactory */ |
|
43 | + private $cacheFactory; |
|
44 | + /** @var string */ |
|
45 | + private $name; |
|
46 | + /** @var string */ |
|
47 | + private $url; |
|
48 | + /** @var string */ |
|
49 | + private $slogan; |
|
50 | + /** @var string */ |
|
51 | + private $color; |
|
52 | + /** @var Util */ |
|
53 | + private $util; |
|
54 | + /** @var string */ |
|
55 | + private $iTunesAppId; |
|
56 | + /** @var string */ |
|
57 | + private $iOSClientUrl; |
|
58 | + /** @var string */ |
|
59 | + private $AndroidClientUrl; |
|
60 | + |
|
61 | + /** |
|
62 | + * ThemingDefaults constructor. |
|
63 | + * |
|
64 | + * @param IConfig $config |
|
65 | + * @param IL10N $l |
|
66 | + * @param IURLGenerator $urlGenerator |
|
67 | + * @param \OC_Defaults $defaults |
|
68 | + * @param IAppData $appData |
|
69 | + * @param ICacheFactory $cacheFactory |
|
70 | + * @param Util $util |
|
71 | + */ |
|
72 | + public function __construct(IConfig $config, |
|
73 | + IL10N $l, |
|
74 | + IURLGenerator $urlGenerator, |
|
75 | + IAppData $appData, |
|
76 | + ICacheFactory $cacheFactory, |
|
77 | + Util $util |
|
78 | + ) { |
|
79 | + parent::__construct(); |
|
80 | + $this->config = $config; |
|
81 | + $this->l = $l; |
|
82 | + $this->urlGenerator = $urlGenerator; |
|
83 | + $this->appData = $appData; |
|
84 | + $this->cacheFactory = $cacheFactory; |
|
85 | + $this->util = $util; |
|
86 | + |
|
87 | + $this->name = parent::getName(); |
|
88 | + $this->url = parent::getBaseUrl(); |
|
89 | + $this->slogan = parent::getSlogan(); |
|
90 | + $this->color = parent::getColorPrimary(); |
|
91 | + $this->iTunesAppId = parent::getiTunesAppId(); |
|
92 | + $this->iOSClientUrl = parent::getiOSClientUrl(); |
|
93 | + $this->AndroidClientUrl = parent::getAndroidClientUrl(); |
|
94 | + } |
|
95 | + |
|
96 | + public function getName() { |
|
97 | + return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
98 | + } |
|
99 | + |
|
100 | + public function getHTMLName() { |
|
101 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
102 | + } |
|
103 | + |
|
104 | + public function getTitle() { |
|
105 | + return $this->getName(); |
|
106 | + } |
|
107 | + |
|
108 | + public function getEntity() { |
|
109 | + return $this->getName(); |
|
110 | + } |
|
111 | + |
|
112 | + public function getBaseUrl() { |
|
113 | + return $this->config->getAppValue('theming', 'url', $this->url); |
|
114 | + } |
|
115 | + |
|
116 | + public function getSlogan() { |
|
117 | + return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan)); |
|
118 | + } |
|
119 | + |
|
120 | + public function getShortFooter() { |
|
121 | + $slogan = $this->getSlogan(); |
|
122 | + $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
123 | + ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
124 | + ($slogan !== '' ? ' – ' . $slogan : ''); |
|
125 | + |
|
126 | + return $footer; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Color that is used for the header as well as for mail headers |
|
131 | + * |
|
132 | + * @return string |
|
133 | + */ |
|
134 | + public function getColorPrimary() { |
|
135 | + return $this->config->getAppValue('theming', 'color', $this->color); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Themed logo url |
|
140 | + * |
|
141 | + * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
142 | + * @return string |
|
143 | + */ |
|
144 | + public function getLogo($useSvg = true) { |
|
145 | + $logo = $this->config->getAppValue('theming', 'logoMime', false); |
|
146 | + |
|
147 | + $logoExists = true; |
|
148 | + try { |
|
149 | + $this->appData->getFolder('images')->getFile('logo'); |
|
150 | + } catch (\Exception $e) { |
|
151 | + $logoExists = false; |
|
152 | + } |
|
153 | + |
|
154 | + $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
155 | + |
|
156 | + if(!$logo || !$logoExists) { |
|
157 | + if($useSvg) { |
|
158 | + $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); |
|
159 | + } else { |
|
160 | + $logo = $this->urlGenerator->imagePath('core', 'logo.png'); |
|
161 | + } |
|
162 | + return $logo . '?v=' . $cacheBusterCounter; |
|
163 | + } |
|
164 | + |
|
165 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Themed background image url |
|
170 | + * |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function getBackground() { |
|
174 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false); |
|
175 | + |
|
176 | + $backgroundExists = true; |
|
177 | + try { |
|
178 | + $this->appData->getFolder('images')->getFile('background'); |
|
179 | + } catch (\Exception $e) { |
|
180 | + $backgroundExists = false; |
|
181 | + } |
|
182 | + |
|
183 | + $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
184 | + |
|
185 | + if(!$backgroundLogo || !$backgroundExists) { |
|
186 | + return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter; |
|
187 | + } |
|
188 | + |
|
189 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter; |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * @return string |
|
194 | + */ |
|
195 | + public function getiTunesAppId() { |
|
196 | + return $this->config->getAppValue('theming', 'iTunesAppId', $this->iTunesAppId); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * @return string |
|
201 | + */ |
|
202 | + public function getiOSClientUrl() { |
|
203 | + return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl); |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + public function getAndroidClientUrl() { |
|
210 | + return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl); |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * @return array scss variables to overwrite |
|
216 | + */ |
|
217 | + public function getScssVariables() { |
|
218 | + $cache = $this->cacheFactory->create('theming'); |
|
219 | + if ($value = $cache->get('getScssVariables')) { |
|
220 | + return $value; |
|
221 | + } |
|
222 | + |
|
223 | + $variables = [ |
|
224 | + 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
225 | + 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime', '') . "'", |
|
226 | + 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime', '') . "'" |
|
227 | + ]; |
|
228 | + |
|
229 | + $variables['image-logo'] = "'".$this->urlGenerator->getAbsoluteURL($this->getLogo())."'"; |
|
230 | + $variables['image-login-background'] = "'".$this->urlGenerator->getAbsoluteURL($this->getBackground())."'"; |
|
231 | + $variables['image-login-plain'] = 'false'; |
|
232 | + |
|
233 | + if ($this->config->getAppValue('theming', 'color', null) !== null) { |
|
234 | + if ($this->util->invertTextColor($this->getColorPrimary())) { |
|
235 | + $colorPrimaryText = '#000000'; |
|
236 | + } else { |
|
237 | + $colorPrimaryText = '#ffffff'; |
|
238 | + } |
|
239 | + $variables['color-primary'] = $this->getColorPrimary(); |
|
240 | + $variables['color-primary-text'] = $colorPrimaryText; |
|
241 | + } |
|
242 | + |
|
243 | + if ($this->config->getAppValue('theming', 'backgroundMime', null) === 'backgroundColor') { |
|
244 | + $variables['image-login-plain'] = 'true'; |
|
245 | + } |
|
246 | + $cache->set('getScssVariables', $variables); |
|
247 | + return $variables; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * Check if Imagemagick is enabled and if SVG is supported |
|
252 | + * otherwise we can't render custom icons |
|
253 | + * |
|
254 | + * @return bool |
|
255 | + */ |
|
256 | + public function shouldReplaceIcons() { |
|
257 | + $cache = $this->cacheFactory->create('theming'); |
|
258 | + if($value = $cache->get('shouldReplaceIcons')) { |
|
259 | + return (bool)$value; |
|
260 | + } |
|
261 | + $value = false; |
|
262 | + if(extension_loaded('imagick')) { |
|
263 | + $checkImagick = new \Imagick(); |
|
264 | + if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
265 | + $value = true; |
|
266 | + } |
|
267 | + $checkImagick->clear(); |
|
268 | + } |
|
269 | + $cache->set('shouldReplaceIcons', $value); |
|
270 | + return $value; |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Increases the cache buster key |
|
275 | + */ |
|
276 | + private function increaseCacheBuster() { |
|
277 | + $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
278 | + $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
279 | + $this->cacheFactory->create('theming')->clear('getScssVariables'); |
|
280 | + } |
|
281 | + |
|
282 | + /** |
|
283 | + * Update setting in the database |
|
284 | + * |
|
285 | + * @param string $setting |
|
286 | + * @param string $value |
|
287 | + */ |
|
288 | + public function set($setting, $value) { |
|
289 | + $this->config->setAppValue('theming', $setting, $value); |
|
290 | + $this->increaseCacheBuster(); |
|
291 | + } |
|
292 | + |
|
293 | + /** |
|
294 | + * Revert settings to the default value |
|
295 | + * |
|
296 | + * @param string $setting setting which should be reverted |
|
297 | + * @return string default value |
|
298 | + */ |
|
299 | + public function undo($setting) { |
|
300 | + $this->config->deleteAppValue('theming', $setting); |
|
301 | + $this->increaseCacheBuster(); |
|
302 | + |
|
303 | + switch ($setting) { |
|
304 | + case 'name': |
|
305 | + $returnValue = $this->getEntity(); |
|
306 | + break; |
|
307 | + case 'url': |
|
308 | + $returnValue = $this->getBaseUrl(); |
|
309 | + break; |
|
310 | + case 'slogan': |
|
311 | + $returnValue = $this->getSlogan(); |
|
312 | + break; |
|
313 | + case 'color': |
|
314 | + $returnValue = $this->getColorPrimary(); |
|
315 | + break; |
|
316 | + default: |
|
317 | + $returnValue = ''; |
|
318 | + break; |
|
319 | + } |
|
320 | + |
|
321 | + return $returnValue; |
|
322 | + } |
|
323 | 323 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | public function getShortFooter() { |
121 | 121 | $slogan = $this->getSlogan(); |
122 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
123 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
124 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
122 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
123 | + ' rel="noreferrer">'.$this->getEntity().'</a>'. |
|
124 | + ($slogan !== '' ? ' – '.$slogan : ''); |
|
125 | 125 | |
126 | 126 | return $footer; |
127 | 127 | } |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | |
154 | 154 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
155 | 155 | |
156 | - if(!$logo || !$logoExists) { |
|
157 | - if($useSvg) { |
|
156 | + if (!$logo || !$logoExists) { |
|
157 | + if ($useSvg) { |
|
158 | 158 | $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); |
159 | 159 | } else { |
160 | 160 | $logo = $this->urlGenerator->imagePath('core', 'logo.png'); |
161 | 161 | } |
162 | - return $logo . '?v=' . $cacheBusterCounter; |
|
162 | + return $logo.'?v='.$cacheBusterCounter; |
|
163 | 163 | } |
164 | 164 | |
165 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter; |
|
165 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLogo').'?v='.$cacheBusterCounter; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return string |
172 | 172 | */ |
173 | 173 | public function getBackground() { |
174 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false); |
|
174 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); |
|
175 | 175 | |
176 | 176 | $backgroundExists = true; |
177 | 177 | try { |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | |
183 | 183 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
184 | 184 | |
185 | - if(!$backgroundLogo || !$backgroundExists) { |
|
186 | - return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter; |
|
185 | + if (!$backgroundLogo || !$backgroundExists) { |
|
186 | + return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter; |
|
187 | 187 | } |
188 | 188 | |
189 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter; |
|
189 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground').'?v='.$cacheBusterCounter; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | $variables = [ |
224 | - 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
225 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime', '') . "'", |
|
226 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime', '') . "'" |
|
224 | + 'theming-cachebuster' => "'".$this->config->getAppValue('theming', 'cachebuster', '0')."'", |
|
225 | + 'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime', '')."'", |
|
226 | + 'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime', '')."'" |
|
227 | 227 | ]; |
228 | 228 | |
229 | 229 | $variables['image-logo'] = "'".$this->urlGenerator->getAbsoluteURL($this->getLogo())."'"; |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function shouldReplaceIcons() { |
257 | 257 | $cache = $this->cacheFactory->create('theming'); |
258 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
259 | - return (bool)$value; |
|
258 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
259 | + return (bool) $value; |
|
260 | 260 | } |
261 | 261 | $value = false; |
262 | - if(extension_loaded('imagick')) { |
|
262 | + if (extension_loaded('imagick')) { |
|
263 | 263 | $checkImagick = new \Imagick(); |
264 | 264 | if (count($checkImagick->queryFormats('SVG')) >= 1) { |
265 | 265 | $value = true; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function increaseCacheBuster() { |
277 | 277 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
278 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
278 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
279 | 279 | $this->cacheFactory->create('theming')->clear('getScssVariables'); |
280 | 280 | } |
281 | 281 |