diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Server.php | 20 | ||||
-rw-r--r-- | lib/private/legacy/defaults.php | 37 | ||||
-rw-r--r-- | lib/private/legacy/template.php | 2 |
3 files changed, 25 insertions, 34 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 8345a0b66e0..df7bb619208 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -78,6 +78,7 @@ use OC\Security\SecureRandom; use OC\Security\TrustedDomainHelper; use OC\Session\CryptoWrapper; use OC\Tagging\TagMapper; +use OCA\Theming\Template; use OCP\IL10N; use OCP\IServerContainer; use OCP\Security\IContentSecurityPolicyManager; @@ -618,6 +619,17 @@ class Server extends ServerContainer implements IServerContainer { $factory = new $factoryClass($this); return $factory->getManager(); }); + $this->registerService('ThemingDefaults', function(Server $c) { + if($this->getAppManager()->isInstalled('theming')) { + return new Template( + $this->getConfig(), + $this->getL10N('theming'), + $this->getURLGenerator(), + new \OC_Defaults() + ); + } + return new \OC_Defaults(); + }); $this->registerService('EventDispatcher', function () { return new EventDispatcher(); }); @@ -1289,6 +1301,14 @@ class Server extends ServerContainer implements IServerContainer { } /** + * @internal Not public by intention. + * @return \OC_Defaults + */ + public function getThemingDefaults() { + return $this->query('ThemingDefaults'); + } + + /** * @return \OC\IntegrityCheck\Checker */ public function getIntegrityCodeChecker() { diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php index f0cc4c91851..2a97cfe89ed 100644 --- a/lib/private/legacy/defaults.php +++ b/lib/private/legacy/defaults.php @@ -31,13 +31,8 @@ class OC_Defaults { private $theme; - - /** @var \OCP\IL10N */ private $l; - /** @var \OCA\Theming\Template */ - private $template; - private $defaultEntity; private $defaultName; private $defaultTitle; @@ -54,45 +49,21 @@ class OC_Defaults { function __construct() { $this->l = \OC::$server->getL10N('lib'); - $config = \OC::$server->getConfig(); - - - try { - $themingAppEnabled = $config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming'); - } catch (\Exception $e) { - $themingAppEnabled = false; - } - - $config = \OC::$server->getConfig(); - - if ($themingAppEnabled) { - $this->template = new \OCA\Theming\Template( - $config, - $this->l, - \OC::$server->getURLGenerator(), - new \OCA\Theming\Init($config, \OC::$server->getLogger()) - ); - $this->defaultName = $this->template->getName(); /* short name, used when referring to the software */ - $this->defaultBaseUrl = $this->template->getUrl(); - $this->defaultSlogan = $this->template->getSlogan(); - $this->defaultMailHeaderColor = $this->template->getColor(); /* header color of mail notifications */ - } else { - $this->defaultName = 'Nextcloud'; - $this->defaultBaseUrl = 'https://nextcloud.com'; - $this->defaultSlogan = $this->l->t('a safe home for all your data'); - $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ - } $version = \OCP\Util::getVersion(); $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ + $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */ $this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */ + $this->defaultBaseUrl = 'https://nextcloud.com'; $this->defaultSyncClientUrl = 'https://nextcloud.com/install'; $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8'; $this->defaultiTunesAppId = '543672169'; $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android'; $this->defaultDocBaseUrl = 'https://doc.owncloud.org'; $this->defaultDocVersion = $version[0] . '.' . $version[1]; // used to generate doc links + $this->defaultSlogan = $this->l->t('a safe home for all your data'); $this->defaultLogoClaim = ''; + $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; if (file_exists($themePath)) { diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index 5023e3a60c8..e2956508090 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -80,7 +80,7 @@ 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 = new OC_Defaults(); + $themeDefaults = \OC::$server->getThemingDefaults(); list($path, $template) = $this->findTemplate($theme, $app, $name); |