diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-07 15:42:43 -0500 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-09 21:43:01 -0500 |
commit | 5b4adf66e51e21b3ecbd683397a362b60f792a50 (patch) | |
tree | 8bdc129ac9fd6575ee41be438ff667e49f7110a2 /lib/private/legacy | |
parent | ca9d25169dcdd2923a356e2a797d8704506a3787 (diff) | |
download | nextcloud-server-5b4adf66e51e21b3ecbd683397a362b60f792a50.tar.gz nextcloud-server-5b4adf66e51e21b3ecbd683397a362b60f792a50.zip |
Move OC_Defaults to OCP\Defaults
* currently there are two ways to access default values:
OCP\Defaults or OC_Defaults (which is extended by
OCA\Theming\ThemingDefaults)
* our code used a mixture of both of them, which made
it hard to work on theme values
* this extended the public interface with the missing
methods and uses them everywhere to only rely on the
public interface
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/defaults.php | 18 | ||||
-rw-r--r-- | lib/private/legacy/template.php | 3 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php index 9fd9b621a14..10dd935d26b 100644 --- a/lib/private/legacy/defaults.php +++ b/lib/private/legacy/defaults.php @@ -47,6 +47,8 @@ class OC_Defaults { private $defaultSlogan; private $defaultLogoClaim; private $defaultColorPrimary; + private $defaultLogoUrl; + private $defaultCacheBuster; function __construct() { $this->l = \OC::$server->getL10N('lib'); @@ -64,6 +66,8 @@ 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)) { @@ -263,6 +267,7 @@ class OC_Defaults { /** * @param string $key + * @return string URL to doc with key */ public function buildDocLinkToKey($key) { if ($this->themeExist('buildDocLinkToKey')) { @@ -289,4 +294,17 @@ class OC_Defaults { public function shouldReplaceIcons() { return false; } + + /** + * Themed logo url + * + * @return string + */ + public function getLogo() { + if ($this->themeExist('getLogo')) { + return $this->theme->getLogo(); + } + + return $this->defaultLogoUrl; + } } diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index 969f5174278..19b5e418110 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -79,7 +79,8 @@ class OC_Template extends \OC\Template\Base { $parts = explode('/', $app); // fix translation when app is something like core/lostpassword $l10n = \OC::$server->getL10N($parts[0]); - $themeDefaults = \OC::$server->getThemingDefaults(); + /** @var \OCP\Defaults $themeDefaults */ + $themeDefaults = \OC::$server->query(\OCP\Defaults::class); list($path, $template) = $this->findTemplate($theme, $app, $name); diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 0672fefbe0c..f067a12cb76 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -651,7 +651,7 @@ class OC_Util { $webServerRestart = false; $setup = new \OC\Setup($config, \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), - \OC::$server->getThemingDefaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom()); + \OC::$server->query(\OCP\Defaults::class), \OC::$server->getLogger(), \OC::$server->getSecureRandom()); $urlGenerator = \OC::$server->getURLGenerator(); |