@@ -51,394 +51,394 @@ |
||
| 51 | 51 | |
| 52 | 52 | class ThemingDefaults extends \OC_Defaults { |
| 53 | 53 | |
| 54 | - /** @var IConfig */ |
|
| 55 | - private $config; |
|
| 56 | - /** @var IL10N */ |
|
| 57 | - private $l; |
|
| 58 | - /** @var ImageManager */ |
|
| 59 | - private $imageManager; |
|
| 60 | - /** @var IURLGenerator */ |
|
| 61 | - private $urlGenerator; |
|
| 62 | - /** @var ICacheFactory */ |
|
| 63 | - private $cacheFactory; |
|
| 64 | - /** @var Util */ |
|
| 65 | - private $util; |
|
| 66 | - /** @var IAppManager */ |
|
| 67 | - private $appManager; |
|
| 68 | - /** @var INavigationManager */ |
|
| 69 | - private $navigationManager; |
|
| 70 | - |
|
| 71 | - /** @var string */ |
|
| 72 | - private $name; |
|
| 73 | - /** @var string */ |
|
| 74 | - private $title; |
|
| 75 | - /** @var string */ |
|
| 76 | - private $entity; |
|
| 77 | - /** @var string */ |
|
| 78 | - private $url; |
|
| 79 | - /** @var string */ |
|
| 80 | - private $color; |
|
| 81 | - |
|
| 82 | - /** @var string */ |
|
| 83 | - private $iTunesAppId; |
|
| 84 | - /** @var string */ |
|
| 85 | - private $iOSClientUrl; |
|
| 86 | - /** @var string */ |
|
| 87 | - private $AndroidClientUrl; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * ThemingDefaults constructor. |
|
| 91 | - * |
|
| 92 | - * @param IConfig $config |
|
| 93 | - * @param IL10N $l |
|
| 94 | - * @param ImageManager $imageManager |
|
| 95 | - * @param IURLGenerator $urlGenerator |
|
| 96 | - * @param ICacheFactory $cacheFactory |
|
| 97 | - * @param Util $util |
|
| 98 | - * @param IAppManager $appManager |
|
| 99 | - */ |
|
| 100 | - public function __construct(IConfig $config, |
|
| 101 | - IL10N $l, |
|
| 102 | - IURLGenerator $urlGenerator, |
|
| 103 | - ICacheFactory $cacheFactory, |
|
| 104 | - Util $util, |
|
| 105 | - ImageManager $imageManager, |
|
| 106 | - IAppManager $appManager, |
|
| 107 | - INavigationManager $navigationManager |
|
| 108 | - ) { |
|
| 109 | - parent::__construct(); |
|
| 110 | - $this->config = $config; |
|
| 111 | - $this->l = $l; |
|
| 112 | - $this->imageManager = $imageManager; |
|
| 113 | - $this->urlGenerator = $urlGenerator; |
|
| 114 | - $this->cacheFactory = $cacheFactory; |
|
| 115 | - $this->util = $util; |
|
| 116 | - $this->appManager = $appManager; |
|
| 117 | - $this->navigationManager = $navigationManager; |
|
| 118 | - |
|
| 119 | - $this->name = parent::getName(); |
|
| 120 | - $this->title = parent::getTitle(); |
|
| 121 | - $this->entity = parent::getEntity(); |
|
| 122 | - $this->url = parent::getBaseUrl(); |
|
| 123 | - $this->color = parent::getColorPrimary(); |
|
| 124 | - $this->iTunesAppId = parent::getiTunesAppId(); |
|
| 125 | - $this->iOSClientUrl = parent::getiOSClientUrl(); |
|
| 126 | - $this->AndroidClientUrl = parent::getAndroidClientUrl(); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - public function getName() { |
|
| 130 | - return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function getHTMLName() { |
|
| 134 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - public function getTitle() { |
|
| 138 | - return strip_tags($this->config->getAppValue('theming', 'name', $this->title)); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function getEntity() { |
|
| 142 | - return strip_tags($this->config->getAppValue('theming', 'name', $this->entity)); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - public function getBaseUrl() { |
|
| 146 | - return $this->config->getAppValue('theming', 'url', $this->url); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - public function getSlogan(?string $lang = null) { |
|
| 150 | - return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', parent::getSlogan($lang))); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - public function getImprintUrl() { |
|
| 154 | - return (string)$this->config->getAppValue('theming', 'imprintUrl', ''); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - public function getPrivacyUrl() { |
|
| 158 | - return (string)$this->config->getAppValue('theming', 'privacyUrl', ''); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - public function getShortFooter() { |
|
| 162 | - $slogan = $this->getSlogan(); |
|
| 163 | - $baseUrl = $this->getBaseUrl(); |
|
| 164 | - if ($baseUrl !== '') { |
|
| 165 | - $footer = '<a href="' . $baseUrl . '" target="_blank"' . |
|
| 166 | - ' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>'; |
|
| 167 | - } else { |
|
| 168 | - $footer = '<span class="entity-name">' .$this->getEntity() . '</span>'; |
|
| 169 | - } |
|
| 170 | - $footer .= ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 171 | - |
|
| 172 | - $links = [ |
|
| 173 | - [ |
|
| 174 | - 'text' => $this->l->t('Legal notice'), |
|
| 175 | - 'url' => (string)$this->getImprintUrl() |
|
| 176 | - ], |
|
| 177 | - [ |
|
| 178 | - 'text' => $this->l->t('Privacy policy'), |
|
| 179 | - 'url' => (string)$this->getPrivacyUrl() |
|
| 180 | - ], |
|
| 181 | - ]; |
|
| 182 | - |
|
| 183 | - $navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST); |
|
| 184 | - $guestNavigation = array_map(function ($nav) { |
|
| 185 | - return [ |
|
| 186 | - 'text' => $nav['name'], |
|
| 187 | - 'url' => $nav['href'] |
|
| 188 | - ]; |
|
| 189 | - }, $navigation); |
|
| 190 | - $links = array_merge($links, $guestNavigation); |
|
| 191 | - |
|
| 192 | - $legalLinks = ''; |
|
| 193 | - $divider = ''; |
|
| 194 | - foreach ($links as $link) { |
|
| 195 | - if ($link['url'] !== '' |
|
| 196 | - && filter_var($link['url'], FILTER_VALIDATE_URL) |
|
| 197 | - ) { |
|
| 198 | - $legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' . |
|
| 199 | - ' rel="noreferrer noopener">' . $link['text'] . '</a>'; |
|
| 200 | - $divider = ' · '; |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - if ($legalLinks !== '') { |
|
| 204 | - $footer .= '<br/>' . $legalLinks; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - return $footer; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Color that is used for the header as well as for mail headers |
|
| 212 | - * |
|
| 213 | - * @return string |
|
| 214 | - */ |
|
| 215 | - public function getColorPrimary() { |
|
| 216 | - return $this->config->getAppValue('theming', 'color', $this->color); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * Themed logo url |
|
| 221 | - * |
|
| 222 | - * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
| 223 | - * @return string |
|
| 224 | - */ |
|
| 225 | - public function getLogo($useSvg = true): string { |
|
| 226 | - $logo = $this->config->getAppValue('theming', 'logoMime', ''); |
|
| 227 | - |
|
| 228 | - // short cut to avoid setting up the filesystem just to check if the logo is there |
|
| 229 | - // |
|
| 230 | - // explanation: if an SVG is requested and the app config value for logoMime is set then the logo is there. |
|
| 231 | - // otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which |
|
| 232 | - // needs to be called then) |
|
| 233 | - if ($useSvg === true && $logo !== false) { |
|
| 234 | - $logoExists = true; |
|
| 235 | - } else { |
|
| 236 | - try { |
|
| 237 | - $this->imageManager->getImage('logo', $useSvg); |
|
| 238 | - $logoExists = true; |
|
| 239 | - } catch (\Exception $e) { |
|
| 240 | - $logoExists = false; |
|
| 241 | - } |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 245 | - |
|
| 246 | - if (!$logo || !$logoExists) { |
|
| 247 | - if ($useSvg) { |
|
| 248 | - $logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg'); |
|
| 249 | - } else { |
|
| 250 | - $logo = $this->urlGenerator->imagePath('core', 'logo/logo.png'); |
|
| 251 | - } |
|
| 252 | - return $logo . '?v=' . $cacheBusterCounter; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * Themed background image url |
|
| 260 | - * |
|
| 261 | - * @return string |
|
| 262 | - */ |
|
| 263 | - public function getBackground(): string { |
|
| 264 | - return $this->imageManager->getImageUrl('background'); |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - /** |
|
| 268 | - * @return string |
|
| 269 | - */ |
|
| 270 | - public function getiTunesAppId() { |
|
| 271 | - return $this->config->getAppValue('theming', 'iTunesAppId', $this->iTunesAppId); |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * @return string |
|
| 276 | - */ |
|
| 277 | - public function getiOSClientUrl() { |
|
| 278 | - return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * @return string |
|
| 283 | - */ |
|
| 284 | - public function getAndroidClientUrl() { |
|
| 285 | - return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * @return array scss variables to overwrite |
|
| 291 | - */ |
|
| 292 | - public function getScssVariables() { |
|
| 293 | - $cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 294 | - $cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl()); |
|
| 295 | - if ($value = $cache->get('getScssVariables')) { |
|
| 296 | - return $value; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - $variables = [ |
|
| 300 | - 'theming-cachebuster' => "'" . $cacheBuster . "'", |
|
| 301 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
| 302 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
| 303 | - 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
| 304 | - 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
| 305 | - ]; |
|
| 306 | - |
|
| 307 | - $variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')"; |
|
| 308 | - $variables['image-logoheader'] = "url('".$this->imageManager->getImageUrl('logoheader')."')"; |
|
| 309 | - $variables['image-favicon'] = "url('".$this->imageManager->getImageUrl('favicon')."')"; |
|
| 310 | - $variables['image-login-background'] = "url('".$this->imageManager->getImageUrl('background')."')"; |
|
| 311 | - $variables['image-login-plain'] = 'false'; |
|
| 312 | - |
|
| 313 | - if ($this->config->getAppValue('theming', 'color', '') !== '') { |
|
| 314 | - $variables['color-primary'] = $this->getColorPrimary(); |
|
| 315 | - $variables['color-primary-text'] = $this->getTextColorPrimary(); |
|
| 316 | - $variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary()); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') { |
|
| 320 | - $variables['image-login-plain'] = 'true'; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - $variables['has-legal-links'] = 'false'; |
|
| 324 | - if ($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') { |
|
| 325 | - $variables['has-legal-links'] = 'true'; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - $cache->set('getScssVariables', $variables); |
|
| 329 | - return $variables; |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * Check if the image should be replaced by the theming app |
|
| 334 | - * and return the new image location then |
|
| 335 | - * |
|
| 336 | - * @param string $app name of the app |
|
| 337 | - * @param string $image filename of the image |
|
| 338 | - * @return bool|string false if image should not replaced, otherwise the location of the image |
|
| 339 | - */ |
|
| 340 | - public function replaceImagePath($app, $image) { |
|
| 341 | - if ($app === '' || $app === 'files_sharing') { |
|
| 342 | - $app = 'core'; |
|
| 343 | - } |
|
| 344 | - $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 345 | - |
|
| 346 | - try { |
|
| 347 | - $customFavicon = $this->imageManager->getImage('favicon'); |
|
| 348 | - } catch (NotFoundException $e) { |
|
| 349 | - $customFavicon = null; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - $route = false; |
|
| 353 | - if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { |
|
| 354 | - $route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]); |
|
| 355 | - } |
|
| 356 | - if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { |
|
| 357 | - $route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]); |
|
| 358 | - } |
|
| 359 | - if ($image === 'manifest.json') { |
|
| 360 | - try { |
|
| 361 | - $appPath = $this->appManager->getAppPath($app); |
|
| 362 | - if (file_exists($appPath . '/img/manifest.json')) { |
|
| 363 | - return false; |
|
| 364 | - } |
|
| 365 | - } catch (AppPathNotFoundException $e) { |
|
| 366 | - } |
|
| 367 | - $route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest'); |
|
| 368 | - } |
|
| 369 | - if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) { |
|
| 370 | - $route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]); |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - if ($route) { |
|
| 374 | - return $route . '?v=' . $cacheBusterValue; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - return false; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * Increases the cache buster key |
|
| 382 | - */ |
|
| 383 | - private function increaseCacheBuster() { |
|
| 384 | - $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 385 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey + 1); |
|
| 386 | - $this->cacheFactory->createDistributed('theming-')->clear(); |
|
| 387 | - $this->cacheFactory->createDistributed('imagePath')->clear(); |
|
| 388 | - } |
|
| 389 | - |
|
| 390 | - /** |
|
| 391 | - * Update setting in the database |
|
| 392 | - * |
|
| 393 | - * @param string $setting |
|
| 394 | - * @param string $value |
|
| 395 | - */ |
|
| 396 | - public function set($setting, $value) { |
|
| 397 | - $this->config->setAppValue('theming', $setting, $value); |
|
| 398 | - $this->increaseCacheBuster(); |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - /** |
|
| 402 | - * Revert settings to the default value |
|
| 403 | - * |
|
| 404 | - * @param string $setting setting which should be reverted |
|
| 405 | - * @return string default value |
|
| 406 | - */ |
|
| 407 | - public function undo($setting) { |
|
| 408 | - $this->config->deleteAppValue('theming', $setting); |
|
| 409 | - $this->increaseCacheBuster(); |
|
| 410 | - |
|
| 411 | - $returnValue = ''; |
|
| 412 | - switch ($setting) { |
|
| 413 | - case 'name': |
|
| 414 | - $returnValue = $this->getEntity(); |
|
| 415 | - break; |
|
| 416 | - case 'url': |
|
| 417 | - $returnValue = $this->getBaseUrl(); |
|
| 418 | - break; |
|
| 419 | - case 'slogan': |
|
| 420 | - $returnValue = $this->getSlogan(); |
|
| 421 | - break; |
|
| 422 | - case 'color': |
|
| 423 | - $returnValue = $this->getColorPrimary(); |
|
| 424 | - break; |
|
| 425 | - case 'logo': |
|
| 426 | - case 'logoheader': |
|
| 427 | - case 'background': |
|
| 428 | - case 'favicon': |
|
| 429 | - $this->imageManager->delete($setting); |
|
| 430 | - break; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - return $returnValue; |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Color of text in the header and primary buttons |
|
| 438 | - * |
|
| 439 | - * @return string |
|
| 440 | - */ |
|
| 441 | - public function getTextColorPrimary() { |
|
| 442 | - return $this->util->invertTextColor($this->getColorPrimary()) ? '#000000' : '#ffffff'; |
|
| 443 | - } |
|
| 54 | + /** @var IConfig */ |
|
| 55 | + private $config; |
|
| 56 | + /** @var IL10N */ |
|
| 57 | + private $l; |
|
| 58 | + /** @var ImageManager */ |
|
| 59 | + private $imageManager; |
|
| 60 | + /** @var IURLGenerator */ |
|
| 61 | + private $urlGenerator; |
|
| 62 | + /** @var ICacheFactory */ |
|
| 63 | + private $cacheFactory; |
|
| 64 | + /** @var Util */ |
|
| 65 | + private $util; |
|
| 66 | + /** @var IAppManager */ |
|
| 67 | + private $appManager; |
|
| 68 | + /** @var INavigationManager */ |
|
| 69 | + private $navigationManager; |
|
| 70 | + |
|
| 71 | + /** @var string */ |
|
| 72 | + private $name; |
|
| 73 | + /** @var string */ |
|
| 74 | + private $title; |
|
| 75 | + /** @var string */ |
|
| 76 | + private $entity; |
|
| 77 | + /** @var string */ |
|
| 78 | + private $url; |
|
| 79 | + /** @var string */ |
|
| 80 | + private $color; |
|
| 81 | + |
|
| 82 | + /** @var string */ |
|
| 83 | + private $iTunesAppId; |
|
| 84 | + /** @var string */ |
|
| 85 | + private $iOSClientUrl; |
|
| 86 | + /** @var string */ |
|
| 87 | + private $AndroidClientUrl; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * ThemingDefaults constructor. |
|
| 91 | + * |
|
| 92 | + * @param IConfig $config |
|
| 93 | + * @param IL10N $l |
|
| 94 | + * @param ImageManager $imageManager |
|
| 95 | + * @param IURLGenerator $urlGenerator |
|
| 96 | + * @param ICacheFactory $cacheFactory |
|
| 97 | + * @param Util $util |
|
| 98 | + * @param IAppManager $appManager |
|
| 99 | + */ |
|
| 100 | + public function __construct(IConfig $config, |
|
| 101 | + IL10N $l, |
|
| 102 | + IURLGenerator $urlGenerator, |
|
| 103 | + ICacheFactory $cacheFactory, |
|
| 104 | + Util $util, |
|
| 105 | + ImageManager $imageManager, |
|
| 106 | + IAppManager $appManager, |
|
| 107 | + INavigationManager $navigationManager |
|
| 108 | + ) { |
|
| 109 | + parent::__construct(); |
|
| 110 | + $this->config = $config; |
|
| 111 | + $this->l = $l; |
|
| 112 | + $this->imageManager = $imageManager; |
|
| 113 | + $this->urlGenerator = $urlGenerator; |
|
| 114 | + $this->cacheFactory = $cacheFactory; |
|
| 115 | + $this->util = $util; |
|
| 116 | + $this->appManager = $appManager; |
|
| 117 | + $this->navigationManager = $navigationManager; |
|
| 118 | + |
|
| 119 | + $this->name = parent::getName(); |
|
| 120 | + $this->title = parent::getTitle(); |
|
| 121 | + $this->entity = parent::getEntity(); |
|
| 122 | + $this->url = parent::getBaseUrl(); |
|
| 123 | + $this->color = parent::getColorPrimary(); |
|
| 124 | + $this->iTunesAppId = parent::getiTunesAppId(); |
|
| 125 | + $this->iOSClientUrl = parent::getiOSClientUrl(); |
|
| 126 | + $this->AndroidClientUrl = parent::getAndroidClientUrl(); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + public function getName() { |
|
| 130 | + return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function getHTMLName() { |
|
| 134 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + public function getTitle() { |
|
| 138 | + return strip_tags($this->config->getAppValue('theming', 'name', $this->title)); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function getEntity() { |
|
| 142 | + return strip_tags($this->config->getAppValue('theming', 'name', $this->entity)); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + public function getBaseUrl() { |
|
| 146 | + return $this->config->getAppValue('theming', 'url', $this->url); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + public function getSlogan(?string $lang = null) { |
|
| 150 | + return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', parent::getSlogan($lang))); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + public function getImprintUrl() { |
|
| 154 | + return (string)$this->config->getAppValue('theming', 'imprintUrl', ''); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + public function getPrivacyUrl() { |
|
| 158 | + return (string)$this->config->getAppValue('theming', 'privacyUrl', ''); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + public function getShortFooter() { |
|
| 162 | + $slogan = $this->getSlogan(); |
|
| 163 | + $baseUrl = $this->getBaseUrl(); |
|
| 164 | + if ($baseUrl !== '') { |
|
| 165 | + $footer = '<a href="' . $baseUrl . '" target="_blank"' . |
|
| 166 | + ' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>'; |
|
| 167 | + } else { |
|
| 168 | + $footer = '<span class="entity-name">' .$this->getEntity() . '</span>'; |
|
| 169 | + } |
|
| 170 | + $footer .= ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 171 | + |
|
| 172 | + $links = [ |
|
| 173 | + [ |
|
| 174 | + 'text' => $this->l->t('Legal notice'), |
|
| 175 | + 'url' => (string)$this->getImprintUrl() |
|
| 176 | + ], |
|
| 177 | + [ |
|
| 178 | + 'text' => $this->l->t('Privacy policy'), |
|
| 179 | + 'url' => (string)$this->getPrivacyUrl() |
|
| 180 | + ], |
|
| 181 | + ]; |
|
| 182 | + |
|
| 183 | + $navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST); |
|
| 184 | + $guestNavigation = array_map(function ($nav) { |
|
| 185 | + return [ |
|
| 186 | + 'text' => $nav['name'], |
|
| 187 | + 'url' => $nav['href'] |
|
| 188 | + ]; |
|
| 189 | + }, $navigation); |
|
| 190 | + $links = array_merge($links, $guestNavigation); |
|
| 191 | + |
|
| 192 | + $legalLinks = ''; |
|
| 193 | + $divider = ''; |
|
| 194 | + foreach ($links as $link) { |
|
| 195 | + if ($link['url'] !== '' |
|
| 196 | + && filter_var($link['url'], FILTER_VALIDATE_URL) |
|
| 197 | + ) { |
|
| 198 | + $legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' . |
|
| 199 | + ' rel="noreferrer noopener">' . $link['text'] . '</a>'; |
|
| 200 | + $divider = ' · '; |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + if ($legalLinks !== '') { |
|
| 204 | + $footer .= '<br/>' . $legalLinks; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + return $footer; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Color that is used for the header as well as for mail headers |
|
| 212 | + * |
|
| 213 | + * @return string |
|
| 214 | + */ |
|
| 215 | + public function getColorPrimary() { |
|
| 216 | + return $this->config->getAppValue('theming', 'color', $this->color); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * Themed logo url |
|
| 221 | + * |
|
| 222 | + * @param bool $useSvg Whether to point to the SVG image or a fallback |
|
| 223 | + * @return string |
|
| 224 | + */ |
|
| 225 | + public function getLogo($useSvg = true): string { |
|
| 226 | + $logo = $this->config->getAppValue('theming', 'logoMime', ''); |
|
| 227 | + |
|
| 228 | + // short cut to avoid setting up the filesystem just to check if the logo is there |
|
| 229 | + // |
|
| 230 | + // explanation: if an SVG is requested and the app config value for logoMime is set then the logo is there. |
|
| 231 | + // otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which |
|
| 232 | + // needs to be called then) |
|
| 233 | + if ($useSvg === true && $logo !== false) { |
|
| 234 | + $logoExists = true; |
|
| 235 | + } else { |
|
| 236 | + try { |
|
| 237 | + $this->imageManager->getImage('logo', $useSvg); |
|
| 238 | + $logoExists = true; |
|
| 239 | + } catch (\Exception $e) { |
|
| 240 | + $logoExists = false; |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 245 | + |
|
| 246 | + if (!$logo || !$logoExists) { |
|
| 247 | + if ($useSvg) { |
|
| 248 | + $logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg'); |
|
| 249 | + } else { |
|
| 250 | + $logo = $this->urlGenerator->imagePath('core', 'logo/logo.png'); |
|
| 251 | + } |
|
| 252 | + return $logo . '?v=' . $cacheBusterCounter; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * Themed background image url |
|
| 260 | + * |
|
| 261 | + * @return string |
|
| 262 | + */ |
|
| 263 | + public function getBackground(): string { |
|
| 264 | + return $this->imageManager->getImageUrl('background'); |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + /** |
|
| 268 | + * @return string |
|
| 269 | + */ |
|
| 270 | + public function getiTunesAppId() { |
|
| 271 | + return $this->config->getAppValue('theming', 'iTunesAppId', $this->iTunesAppId); |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * @return string |
|
| 276 | + */ |
|
| 277 | + public function getiOSClientUrl() { |
|
| 278 | + return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * @return string |
|
| 283 | + */ |
|
| 284 | + public function getAndroidClientUrl() { |
|
| 285 | + return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl); |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * @return array scss variables to overwrite |
|
| 291 | + */ |
|
| 292 | + public function getScssVariables() { |
|
| 293 | + $cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 294 | + $cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl()); |
|
| 295 | + if ($value = $cache->get('getScssVariables')) { |
|
| 296 | + return $value; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + $variables = [ |
|
| 300 | + 'theming-cachebuster' => "'" . $cacheBuster . "'", |
|
| 301 | + 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
| 302 | + 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
| 303 | + 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
| 304 | + 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
| 305 | + ]; |
|
| 306 | + |
|
| 307 | + $variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')"; |
|
| 308 | + $variables['image-logoheader'] = "url('".$this->imageManager->getImageUrl('logoheader')."')"; |
|
| 309 | + $variables['image-favicon'] = "url('".$this->imageManager->getImageUrl('favicon')."')"; |
|
| 310 | + $variables['image-login-background'] = "url('".$this->imageManager->getImageUrl('background')."')"; |
|
| 311 | + $variables['image-login-plain'] = 'false'; |
|
| 312 | + |
|
| 313 | + if ($this->config->getAppValue('theming', 'color', '') !== '') { |
|
| 314 | + $variables['color-primary'] = $this->getColorPrimary(); |
|
| 315 | + $variables['color-primary-text'] = $this->getTextColorPrimary(); |
|
| 316 | + $variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary()); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') { |
|
| 320 | + $variables['image-login-plain'] = 'true'; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + $variables['has-legal-links'] = 'false'; |
|
| 324 | + if ($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') { |
|
| 325 | + $variables['has-legal-links'] = 'true'; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + $cache->set('getScssVariables', $variables); |
|
| 329 | + return $variables; |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * Check if the image should be replaced by the theming app |
|
| 334 | + * and return the new image location then |
|
| 335 | + * |
|
| 336 | + * @param string $app name of the app |
|
| 337 | + * @param string $image filename of the image |
|
| 338 | + * @return bool|string false if image should not replaced, otherwise the location of the image |
|
| 339 | + */ |
|
| 340 | + public function replaceImagePath($app, $image) { |
|
| 341 | + if ($app === '' || $app === 'files_sharing') { |
|
| 342 | + $app = 'core'; |
|
| 343 | + } |
|
| 344 | + $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 345 | + |
|
| 346 | + try { |
|
| 347 | + $customFavicon = $this->imageManager->getImage('favicon'); |
|
| 348 | + } catch (NotFoundException $e) { |
|
| 349 | + $customFavicon = null; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + $route = false; |
|
| 353 | + if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { |
|
| 354 | + $route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]); |
|
| 355 | + } |
|
| 356 | + if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { |
|
| 357 | + $route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]); |
|
| 358 | + } |
|
| 359 | + if ($image === 'manifest.json') { |
|
| 360 | + try { |
|
| 361 | + $appPath = $this->appManager->getAppPath($app); |
|
| 362 | + if (file_exists($appPath . '/img/manifest.json')) { |
|
| 363 | + return false; |
|
| 364 | + } |
|
| 365 | + } catch (AppPathNotFoundException $e) { |
|
| 366 | + } |
|
| 367 | + $route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest'); |
|
| 368 | + } |
|
| 369 | + if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) { |
|
| 370 | + $route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]); |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + if ($route) { |
|
| 374 | + return $route . '?v=' . $cacheBusterValue; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + return false; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * Increases the cache buster key |
|
| 382 | + */ |
|
| 383 | + private function increaseCacheBuster() { |
|
| 384 | + $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 385 | + $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey + 1); |
|
| 386 | + $this->cacheFactory->createDistributed('theming-')->clear(); |
|
| 387 | + $this->cacheFactory->createDistributed('imagePath')->clear(); |
|
| 388 | + } |
|
| 389 | + |
|
| 390 | + /** |
|
| 391 | + * Update setting in the database |
|
| 392 | + * |
|
| 393 | + * @param string $setting |
|
| 394 | + * @param string $value |
|
| 395 | + */ |
|
| 396 | + public function set($setting, $value) { |
|
| 397 | + $this->config->setAppValue('theming', $setting, $value); |
|
| 398 | + $this->increaseCacheBuster(); |
|
| 399 | + } |
|
| 400 | + |
|
| 401 | + /** |
|
| 402 | + * Revert settings to the default value |
|
| 403 | + * |
|
| 404 | + * @param string $setting setting which should be reverted |
|
| 405 | + * @return string default value |
|
| 406 | + */ |
|
| 407 | + public function undo($setting) { |
|
| 408 | + $this->config->deleteAppValue('theming', $setting); |
|
| 409 | + $this->increaseCacheBuster(); |
|
| 410 | + |
|
| 411 | + $returnValue = ''; |
|
| 412 | + switch ($setting) { |
|
| 413 | + case 'name': |
|
| 414 | + $returnValue = $this->getEntity(); |
|
| 415 | + break; |
|
| 416 | + case 'url': |
|
| 417 | + $returnValue = $this->getBaseUrl(); |
|
| 418 | + break; |
|
| 419 | + case 'slogan': |
|
| 420 | + $returnValue = $this->getSlogan(); |
|
| 421 | + break; |
|
| 422 | + case 'color': |
|
| 423 | + $returnValue = $this->getColorPrimary(); |
|
| 424 | + break; |
|
| 425 | + case 'logo': |
|
| 426 | + case 'logoheader': |
|
| 427 | + case 'background': |
|
| 428 | + case 'favicon': |
|
| 429 | + $this->imageManager->delete($setting); |
|
| 430 | + break; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + return $returnValue; |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Color of text in the header and primary buttons |
|
| 438 | + * |
|
| 439 | + * @return string |
|
| 440 | + */ |
|
| 441 | + public function getTextColorPrimary() { |
|
| 442 | + return $this->util->invertTextColor($this->getColorPrimary()) ? '#000000' : '#ffffff'; |
|
| 443 | + } |
|
| 444 | 444 | } |
@@ -151,37 +151,37 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function getImprintUrl() { |
| 154 | - return (string)$this->config->getAppValue('theming', 'imprintUrl', ''); |
|
| 154 | + return (string) $this->config->getAppValue('theming', 'imprintUrl', ''); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function getPrivacyUrl() { |
| 158 | - return (string)$this->config->getAppValue('theming', 'privacyUrl', ''); |
|
| 158 | + return (string) $this->config->getAppValue('theming', 'privacyUrl', ''); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function getShortFooter() { |
| 162 | 162 | $slogan = $this->getSlogan(); |
| 163 | 163 | $baseUrl = $this->getBaseUrl(); |
| 164 | 164 | if ($baseUrl !== '') { |
| 165 | - $footer = '<a href="' . $baseUrl . '" target="_blank"' . |
|
| 166 | - ' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>'; |
|
| 165 | + $footer = '<a href="'.$baseUrl.'" target="_blank"'. |
|
| 166 | + ' rel="noreferrer noopener" class="entity-name">'.$this->getEntity().'</a>'; |
|
| 167 | 167 | } else { |
| 168 | - $footer = '<span class="entity-name">' .$this->getEntity() . '</span>'; |
|
| 168 | + $footer = '<span class="entity-name">'.$this->getEntity().'</span>'; |
|
| 169 | 169 | } |
| 170 | - $footer .= ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 170 | + $footer .= ($slogan !== '' ? ' – '.$slogan : ''); |
|
| 171 | 171 | |
| 172 | 172 | $links = [ |
| 173 | 173 | [ |
| 174 | 174 | 'text' => $this->l->t('Legal notice'), |
| 175 | - 'url' => (string)$this->getImprintUrl() |
|
| 175 | + 'url' => (string) $this->getImprintUrl() |
|
| 176 | 176 | ], |
| 177 | 177 | [ |
| 178 | 178 | 'text' => $this->l->t('Privacy policy'), |
| 179 | - 'url' => (string)$this->getPrivacyUrl() |
|
| 179 | + 'url' => (string) $this->getPrivacyUrl() |
|
| 180 | 180 | ], |
| 181 | 181 | ]; |
| 182 | 182 | |
| 183 | 183 | $navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST); |
| 184 | - $guestNavigation = array_map(function ($nav) { |
|
| 184 | + $guestNavigation = array_map(function($nav) { |
|
| 185 | 185 | return [ |
| 186 | 186 | 'text' => $nav['name'], |
| 187 | 187 | 'url' => $nav['href'] |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | if ($link['url'] !== '' |
| 196 | 196 | && filter_var($link['url'], FILTER_VALIDATE_URL) |
| 197 | 197 | ) { |
| 198 | - $legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' . |
|
| 199 | - ' rel="noreferrer noopener">' . $link['text'] . '</a>'; |
|
| 198 | + $legalLinks .= $divider.'<a href="'.$link['url'].'" class="legal" target="_blank"'. |
|
| 199 | + ' rel="noreferrer noopener">'.$link['text'].'</a>'; |
|
| 200 | 200 | $divider = ' · '; |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | if ($legalLinks !== '') { |
| 204 | - $footer .= '<br/>' . $legalLinks; |
|
| 204 | + $footer .= '<br/>'.$legalLinks; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | return $footer; |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | } else { |
| 250 | 250 | $logo = $this->urlGenerator->imagePath('core', 'logo/logo.png'); |
| 251 | 251 | } |
| 252 | - return $logo . '?v=' . $cacheBusterCounter; |
|
| 252 | + return $logo.'?v='.$cacheBusterCounter; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]); |
|
| 255 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter]); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -291,17 +291,17 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function getScssVariables() { |
| 293 | 293 | $cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 294 | - $cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl()); |
|
| 294 | + $cache = $this->cacheFactory->createDistributed('theming-'.$cacheBuster.'-'.$this->urlGenerator->getBaseUrl()); |
|
| 295 | 295 | if ($value = $cache->get('getScssVariables')) { |
| 296 | 296 | return $value; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | $variables = [ |
| 300 | - 'theming-cachebuster' => "'" . $cacheBuster . "'", |
|
| 301 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
| 302 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
| 303 | - 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
| 304 | - 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
| 300 | + 'theming-cachebuster' => "'".$cacheBuster."'", |
|
| 301 | + 'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime')."'", |
|
| 302 | + 'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime')."'", |
|
| 303 | + 'theming-logoheader-mime' => "'".$this->config->getAppValue('theming', 'logoheaderMime')."'", |
|
| 304 | + 'theming-favicon-mime' => "'".$this->config->getAppValue('theming', 'faviconMime')."'" |
|
| 305 | 305 | ]; |
| 306 | 306 | |
| 307 | 307 | $variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')"; |
@@ -359,19 +359,19 @@ discard block |
||
| 359 | 359 | if ($image === 'manifest.json') { |
| 360 | 360 | try { |
| 361 | 361 | $appPath = $this->appManager->getAppPath($app); |
| 362 | - if (file_exists($appPath . '/img/manifest.json')) { |
|
| 362 | + if (file_exists($appPath.'/img/manifest.json')) { |
|
| 363 | 363 | return false; |
| 364 | 364 | } |
| 365 | 365 | } catch (AppPathNotFoundException $e) { |
| 366 | 366 | } |
| 367 | 367 | $route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest'); |
| 368 | 368 | } |
| 369 | - if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) { |
|
| 369 | + if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT.'/core/img/'.$image)) { |
|
| 370 | 370 | $route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | if ($route) { |
| 374 | - return $route . '?v=' . $cacheBusterValue; |
|
| 374 | + return $route.'?v='.$cacheBusterValue; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | return false; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | private function increaseCacheBuster() { |
| 384 | 384 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 385 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey + 1); |
|
| 385 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
| 386 | 386 | $this->cacheFactory->createDistributed('theming-')->clear(); |
| 387 | 387 | $this->cacheFactory->createDistributed('imagePath')->clear(); |
| 388 | 388 | } |