summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/ThemingDefaults.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/lib/ThemingDefaults.php')
-rw-r--r--apps/theming/lib/ThemingDefaults.php39
1 files changed, 35 insertions, 4 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 7b846919db3..9139dd56247 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -23,12 +23,10 @@
namespace OCA\Theming;
-
-
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
-
+use OCP\Files\IRootFolder;
class ThemingDefaults extends \OC_Defaults {
@@ -38,6 +36,8 @@ class ThemingDefaults extends \OC_Defaults {
private $l;
/** @var IURLGenerator */
private $urlGenerator;
+ /** @var IRootFolder */
+ private $rootFolder;
/** @var string */
private $name;
/** @var string */
@@ -54,16 +54,19 @@ class ThemingDefaults extends \OC_Defaults {
* @param IL10N $l
* @param IURLGenerator $urlGenerator
* @param \OC_Defaults $defaults
+ * @param IRootFolder $rootFolder
*/
public function __construct(IConfig $config,
IL10N $l,
IURLGenerator $urlGenerator,
- \OC_Defaults $defaults
+ \OC_Defaults $defaults,
+ IRootFolder $rootFolder
) {
parent::__construct();
$this->config = $config;
$this->l = $l;
$this->urlGenerator = $urlGenerator;
+ $this->rootFolder = $rootFolder;
$this->name = $defaults->getName();
$this->url = $defaults->getBaseUrl();
@@ -114,6 +117,34 @@ class ThemingDefaults extends \OC_Defaults {
}
/**
+ * Themed logo url
+ *
+ * @return string
+ */
+ public function getLogo() {
+ $logo = $this->config->getAppValue('theming', 'logoMime');
+ if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) {
+ return $this->urlGenerator->imagePath('core','logo.svg');
+ } else {
+ return $this->urlGenerator->linkToRoute('theming.Theming.getLogo');
+ }
+ }
+
+ /**
+ * Themed background image url
+ *
+ * @return string
+ */
+ public function getBackground() {
+ $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime');
+ if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) {
+ return $this->urlGenerator->imagePath('core','background.jpg');
+ } else {
+ return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground');
+ }
+ }
+
+ /**
* Increases the cache buster key
*/
private function increaseCacheBuster() {