Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
16 changes: 15 additions & 1 deletion lib/private/legacy/OC_Defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 '';
}
}