diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-05-08 14:51:55 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-05-08 14:51:55 +0200 |
commit | 099234cf12c4d1ec2d1942ed506f463b28ef738c (patch) | |
tree | 371d6475df8e76f1c1ce62d983f2059cad4b7eae /lib | |
parent | 6acae94a021a6e961a00fe2c33e5468461e65893 (diff) | |
download | nextcloud-server-099234cf12c4d1ec2d1942ed506f463b28ef738c.tar.gz nextcloud-server-099234cf12c4d1ec2d1942ed506f463b28ef738c.zip |
Add function to request SVG or regular fallback image
Fixes https://github.com/nextcloud/server/issues/4647
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Mail/EMailTemplate.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/defaults.php | 17 | ||||
-rw-r--r-- | lib/public/Defaults.php | 5 |
3 files changed, 14 insertions, 10 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 3442e8e9430..0ae79345e4c 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -357,7 +357,7 @@ EOF; } $this->headerAdded = true; - $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()); + $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo(false)); $this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getColorPrimary(), $logoUrl, $this->themingDefaults->getName()]); } diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php index cc4991efd3e..f6d72d9776d 100644 --- a/lib/private/legacy/defaults.php +++ b/lib/private/legacy/defaults.php @@ -47,9 +47,8 @@ class OC_Defaults { private $defaultSlogan; private $defaultLogoClaim; private $defaultColorPrimary; - private $defaultLogoUrl; - function __construct() { + public function __construct() { $this->l = \OC::$server->getL10N('lib'); $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ @@ -65,8 +64,6 @@ class OC_Defaults { $this->defaultSlogan = $this->l->t('a safe home for all your data'); $this->defaultLogoClaim = ''; $this->defaultColorPrimary = '#0082c9'; - $this->defaultLogoUrl = \OC::$server->getURLGenerator()->imagePath('core','logo.svg'); - $this->defaultLogoUrl .= '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; if (file_exists($themePath)) { @@ -307,13 +304,19 @@ class OC_Defaults { /** * Themed logo url * + * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string */ - public function getLogo() { + public function getLogo($useSvg = true) { if ($this->themeExist('getLogo')) { - return $this->theme->getLogo(); + return $this->theme->getLogo($useSvg); } - return $this->defaultLogoUrl; + if($useSvg) { + $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo.svg'); + } else { + $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo.png'); + } + return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); } } diff --git a/lib/public/Defaults.php b/lib/public/Defaults.php index dbde78bce68..543657694c5 100644 --- a/lib/public/Defaults.php +++ b/lib/public/Defaults.php @@ -178,11 +178,12 @@ class Defaults { /** * Themed logo url * + * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string * @since 12.0.0 */ - public function getLogo() { - return $this->defaults->getLogo(); + public function getLogo($useSvg = true) { + return $this->defaults->getLogo($useSvg); } /** |