lib/defaults.php should only contain the default strings and read the other strings directly from the theme

This commit is contained in:
Björn Schießle 2013-06-27 16:24:03 +02:00
parent 87bbdc1ed9
commit 996b1e80c6
1 changed files with 44 additions and 38 deletions

View File

@ -5,91 +5,97 @@
* community edition. Use the get methods to always get the right strings. * 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 { class OC_Defaults {
private static $communityEntity = "ownCloud"; private static $defaultEntity = "ownCloud";
private static $communityName = "ownCloud"; private static $defaultName = "ownCloud";
private static $communityBaseUrl = "http://owncloud.org"; private static $defaultBaseUrl = "http://owncloud.org";
private static $communitySyncClientUrl = " http://owncloud.org/sync-clients/"; private static $defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
private static $communityDocBaseUrl = "http://doc.owncloud.org"; private static $defaultDocBaseUrl = "http://doc.owncloud.org";
private static $communitySlogan = "web services under your control"; private static $defaultSlogan = "web services under your control";
private static $enterpriseEntity = "ownCloud Inc."; private function themeExist($method) {
private static $enterpriseName = "ownCloud Enterprise Edition"; if (OC_Util::getTheme() !== '' &&
private static $enterpriseBaseUrl = "https://owncloud.com"; //class_exists('OC_Theme') &&
private static $enterpriseDocBaseUrl = "http://doc.owncloud.com"; method_exists('OC_Theme', $method)) {
private static $enterpiseSyncClientUrl = "https://owncloud.com/products/desktop-clients";
private static $enterpriseSlogan = "Your Cloud, Your Data, Your Way!";
return true;
}
return false;
}
public static function getBaseUrl() { public static function getBaseUrl() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getBaseUrl')) {
return self::$communityBaseUrl; return OC_Theme::getBaseUrl();
} else { } else {
return self::$enterpriseBaseUrl; return self::$defaultBaseUrl;
} }
} }
public static function getSyncClientUrl() { public static function getSyncClientUrl() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getSyncClientUrl')) {
return self::$communitySyncClientUrl; return OC_Theme::getSyncClientUrl();
} else { } else {
return self::$enterpiseSyncClientUrl; return self::$defaultSyncClientUrl;
} }
} }
public static function getDocBaseUrl() { public static function getDocBaseUrl() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getDocBaseUrl')) {
return self::$communityDocBaseUrl; return OC_Theme::getDocBaseUrl();
} else { } else {
return self::$enterpriseDocBaseUrl; return self::$defaultDocBaseUrl;
} }
} }
public static function getName() { public static function getName() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getName')) {
return self::$communityName; return OC_Theme::getName();
} else { } else {
return self::$enterpriseName; return self::$defaultName;
} }
} }
public static function getEntity() { public static function getEntity() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getEntity')) {
return self::$communityEntity; return OC_Theme::getEntity();
} else { } else {
return self::$enterpriseEntity; return self::$defaultEntity;
} }
} }
public static function getSlogan() { public static function getSlogan() {
$l = OC_L10N::get('core'); $l = OC_L10N::get('core');
if (OC_Util::getEditionString() === '') { if (self::themeExist('getSlogan')) {
return $l->t(self::$communitySlogan); return OC_Theme::getSlogan();
} else { } else {
return self::$enterpriseSlogan; return $l->t(self::$defaultSlogan);
} }
} }
public static function getShortFooter() { public static function getShortFooter() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getShortFooter')) {
$footer = OC_Theme::getShortFooter();
} else {
$footer = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>". $footer = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>".
' ' . self::getSlogan(); ' ' . self::getSlogan();
} else {
$footer = "© 2013 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>".
" " . self::getSlogan();
} }
return $footer; return $footer;
} }
public static function getLongFooter() { public static function getLongFooter() {
if (OC_Util::getEditionString() === '') { if (self::themeExist('getLongFooter')) {
$footer = self::getShortFooter(); $footer = OC_Theme::getLongFooter();
} else { } else {
$footer = "© 2013 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>". $footer = self::getShortFooter();
"<br/>" . self::getSlogan();
} }
return $footer; return $footer;
} }