diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 445ab33e2563a..549820641dab1 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -68,27 +68,45 @@ public function __construct( $this->docBaseUrl = parent::getDocBaseUrl(); } - public function getName() { + public function getName(): string { + if (parent::themeExist('getName')) { + return $this->name; + } return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->name)); } - public function getHTMLName() { + public function getHTMLName(): string { + if (parent::themeExist('getHTMLName')) { + return parent::getHTMLName(); + } return $this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->name); } - public function getTitle() { + public function getTitle() : string { + if (parent::themeExist('getTitle')) { + return strip_tags($this->title); + } return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->title)); } - public function getEntity() { + public function getEntity() : string { + if (parent::themeExist('getEntity')) { + return $this->entity; + } return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_NAME, $this->entity)); } - public function getProductName() { + public function getProductName() : string { + if (parent::themeExist("getProductName")) { + return strip_tags($this->productName); + } return strip_tags($this->appConfig->getAppValueString(ConfigLexicon::PRODUCT_NAME, $this->productName)); } - public function getBaseUrl() { + public function getBaseUrl() : string { + if (parent::themeExist('getBaseUrl')) { + return $this->url; + } return $this->appConfig->getAppValueString(ConfigLexicon::BASE_URL, $this->url); } @@ -97,19 +115,31 @@ public function getBaseUrl() { * @psalm-suppress InvalidReturnStatement * @psalm-suppress InvalidReturnType */ - public function getSlogan(?string $lang = null): string { + public function getSlogan(?string $lang = null) : string { + if (parent::themeExist('getSlogan')) { + return \OCP\Util::sanitizeHTML(parent::getSlogan($lang)); + } return \OCP\Util::sanitizeHTML($this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_SLOGAN, parent::getSlogan($lang))); } - public function getImprintUrl(): string { + public function getImprintUrl() : string { + if (parent::themeExist('getImprintUrl')) { + return parent::getImprintUrl(); + } return $this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_IMPRINT_URL, ''); } - public function getPrivacyUrl(): string { + public function getPrivacyUrl() : string { + if (parent::themeExist('getPrivacyUrl')) { + return parent::getPrivacyUrl(); + } return $this->appConfig->getAppValueString(ConfigLexicon::INSTANCE_PRIVACY_URL, ''); } - public function getDocBaseUrl(): string { + public function getDocBaseUrl() { + if (parent::themeExist('getDocBaseUrl')) { + return $this->docBaseUrl; + } return $this->appConfig->getAppValueString(ConfigLexicon::DOC_BASE_URL, $this->docBaseUrl); } diff --git a/lib/private/legacy/OC_Defaults.php b/lib/private/legacy/OC_Defaults.php index 0d460ff966d9c..160342dfa202a 100644 --- a/lib/private/legacy/OC_Defaults.php +++ b/lib/private/legacy/OC_Defaults.php @@ -65,7 +65,7 @@ public function __construct() { /** * @param string $method */ - private function themeExist($method) { + protected function themeExist($method) { if (isset($this->theme) && method_exists($this->theme, $method)) { return true; } @@ -332,4 +332,18 @@ public function getProductName() { } return $this->defaultProductName; } + + public function getImprintUrl() : string { + if ($this->themeExist('getImprintUrl')) { + return $this->theme->getImprintUrl(); + } + return ''; + } + + public function getPrivacyUrl() : string { + if ($this->themeExist('getPrivacyUrl')) { + return $this->theme->getPrivacyUrl(); + } + return ''; + } }