From 31d565131ce426678b77510fb9117b121a5822e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Thu, 27 Jun 2013 16:24:03 +0200 Subject: [PATCH] lib/defaults.php should only contain the default strings and read the other strings directly from the theme --- lib/defaults.php | 82 ++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/lib/defaults.php b/lib/defaults.php index 9043c04e7b6..ba2b2b93ee2 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -5,91 +5,97 @@ * community edition. Use the get methods to always get the right strings. */ +if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) { + require_once 'themes/' . OC_Util::getTheme() . '/defaults.php'; +} + class OC_Defaults { - private static $communityEntity = "ownCloud"; - private static $communityName = "ownCloud"; - private static $communityBaseUrl = "http://owncloud.org"; - private static $communitySyncClientUrl = " http://owncloud.org/sync-clients/"; - private static $communityDocBaseUrl = "http://doc.owncloud.org"; - private static $communitySlogan = "web services under your control"; + private static $defaultEntity = "ownCloud"; + private static $defaultName = "ownCloud"; + private static $defaultBaseUrl = "http://owncloud.org"; + private static $defaultSyncClientUrl = " http://owncloud.org/sync-clients/"; + private static $defaultDocBaseUrl = "http://doc.owncloud.org"; + private static $defaultSlogan = "web services under your control"; - private static $enterpriseEntity = "ownCloud Inc."; - private static $enterpriseName = "ownCloud Enterprise Edition"; - private static $enterpriseBaseUrl = "https://owncloud.com"; - private static $enterpriseDocBaseUrl = "http://doc.owncloud.com"; - private static $enterpiseSyncClientUrl = "https://owncloud.com/products/desktop-clients"; - private static $enterpriseSlogan = "Your Cloud, Your Data, Your Way!"; + private function themeExist($method) { + if (OC_Util::getTheme() !== '' && + //class_exists('OC_Theme') && + method_exists('OC_Theme', $method)) { + return true; + } + + return false; + } public static function getBaseUrl() { - if (OC_Util::getEditionString() === '') { - return self::$communityBaseUrl; + if (self::themeExist('getBaseUrl')) { + return OC_Theme::getBaseUrl(); } else { - return self::$enterpriseBaseUrl; + return self::$defaultBaseUrl; } } public static function getSyncClientUrl() { - if (OC_Util::getEditionString() === '') { - return self::$communitySyncClientUrl; + if (self::themeExist('getSyncClientUrl')) { + return OC_Theme::getSyncClientUrl(); } else { - return self::$enterpiseSyncClientUrl; + return self::$defaultSyncClientUrl; } } public static function getDocBaseUrl() { - if (OC_Util::getEditionString() === '') { - return self::$communityDocBaseUrl; + if (self::themeExist('getDocBaseUrl')) { + return OC_Theme::getDocBaseUrl(); } else { - return self::$enterpriseDocBaseUrl; + return self::$defaultDocBaseUrl; } } public static function getName() { - if (OC_Util::getEditionString() === '') { - return self::$communityName; + if (self::themeExist('getName')) { + return OC_Theme::getName(); } else { - return self::$enterpriseName; + return self::$defaultName; } } public static function getEntity() { - if (OC_Util::getEditionString() === '') { - return self::$communityEntity; + if (self::themeExist('getEntity')) { + return OC_Theme::getEntity(); } else { - return self::$enterpriseEntity; + return self::$defaultEntity; } } public static function getSlogan() { $l = OC_L10N::get('core'); - if (OC_Util::getEditionString() === '') { - return $l->t(self::$communitySlogan); + if (self::themeExist('getSlogan')) { + return OC_Theme::getSlogan(); } else { - return self::$enterpriseSlogan; + return $l->t(self::$defaultSlogan); } } public static function getShortFooter() { - if (OC_Util::getEditionString() === '') { + if (self::themeExist('getShortFooter')) { + $footer = OC_Theme::getShortFooter(); + } else { $footer = "" .self::getEntity() . "". ' – ' . self::getSlogan(); - } else { - $footer = "© 2013 ".self::getEntity()."". - " – " . self::getSlogan(); } return $footer; } public static function getLongFooter() { - if (OC_Util::getEditionString() === '') { - $footer = self::getShortFooter(); + if (self::themeExist('getLongFooter')) { + $footer = OC_Theme::getLongFooter(); } else { - $footer = "© 2013 ".self::getEntity()."". - "
" . self::getSlogan(); + $footer = self::getShortFooter(); } + return $footer; } -- 2.39.5