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.
*/
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 = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>".
' ' . self::getSlogan();
} else {
$footer = "© 2013 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>".
" " . 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 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>".
"<br/>" . self::getSlogan();
$footer = self::getShortFooter();
}
return $footer;
}