move to non-static OC_Defaults

Conflicts:

	lib/mail.php
This commit is contained in:
Björn Schießle 2013-07-03 14:21:51 +02:00
parent d46e62886a
commit 3c691c9ec9
10 changed files with 81 additions and 78 deletions

View File

@ -2,7 +2,7 @@
<div id="notification" style="display: none;"></div> <div id="notification" style="display: none;"></div>
</div> </div>
<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?>
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
<input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL"> <input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
@ -11,7 +11,7 @@
<header><div id="header"> <header><div id="header">
<a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg" <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg"
src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="ownCloud" /></a> src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="ownCloud" /></a>
<div id="logo-claim" style="display:none;"><?php p(OC_Defaults::getLogoClaim()); ?></div> <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div>
<div class="header-right"> <div class="header-right">
<?php if (isset($_['folder'])): ?> <?php if (isset($_['folder'])): ?>
<span id="details"><?php p($l->t('%s shared the folder %s with you', <span id="details"><?php p($l->t('%s shared the folder %s with you',
@ -91,6 +91,6 @@
</div> </div>
<footer> <footer>
<p class="info"> <p class="info">
<?php print_unescaped(OC_Defaults::getLongFooter()); ?> <?php print_unescaped($defaults->getLongFooter()); ?>
</p> </p>
</footer> </footer>

View File

@ -6,11 +6,11 @@
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?>
<head> <head>
<title> <title>
<?php p(OC_Defaults::getName()); ?> <?php p($defaults->getName()); ?>
</title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<?php print_unescaped(image_path('', 'favicon.png')); ?>" /> <link rel="shortcut icon" href="<?php print_unescaped(image_path('', 'favicon.png')); ?>" />

View File

@ -6,11 +6,11 @@
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?>
<head data-requesttoken="<?php p($_['requesttoken']); ?>"> <head data-requesttoken="<?php p($_['requesttoken']); ?>">
<title> <title>
<?php p(OC_Defaults::getName()); ?> <?php p($defaults->getName()); ?>
</title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-itunes-app" content="app-id=543672169"> <meta name="apple-itunes-app" content="app-id=543672169">
@ -38,13 +38,13 @@
<div id="login"> <div id="login">
<header><div id="header"> <header><div id="header">
<img src="<?php print_unescaped(image_path('', 'logo.svg')); ?>" class="svg" alt="ownCloud" /> <img src="<?php print_unescaped(image_path('', 'logo.svg')); ?>" class="svg" alt="ownCloud" />
<div id="logo-claim" style="display:none;"><?php p(OC_Defaults::getLogoClaim()); ?></div> <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div>
</div></header> </div></header>
<?php print_unescaped($_['content']); ?> <?php print_unescaped($_['content']); ?>
</div> </div>
<footer> <footer>
<p class="info"> <p class="info">
<?php print_unescaped(OC_Defaults::getLongFooter()); ?> <?php print_unescaped($defaults->getLongFooter()); ?>
</p></footer> </p></footer>
</body> </body>
</html> </html>

View File

@ -6,12 +6,12 @@
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?>
<head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>">
<title> <title>
<?php p(!empty($_['application'])?$_['application'].' | ':''); <?php p(!empty($_['application'])?$_['application'].' | ':'');
p(OC_Defaults::getName()); p($defaults->getName());
p(trim($_['user_displayname']) != '' ?' ('.$_['user_displayname'].') ':'') ?> p(trim($_['user_displayname']) != '' ?' ('.$_['user_displayname'].') ':'') ?>
</title> </title>
<meta charset="utf-8"> <meta charset="utf-8">
@ -46,7 +46,7 @@
<header><div id="header"> <header><div id="header">
<a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg" <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg"
src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="ownCloud" /></a> src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="ownCloud" /></a>
<div id="logo-claim" style="display:none;"><?php p(OC_Defaults::getLogoClaim()); ?></div> <div id="logo-claim" style="display:none;"><?php p($defaults->getLogoClaim()); ?></div>
<ul id="settings" class="svg"> <ul id="settings" class="svg">
<span id="expand" tabindex="0" role="link"> <span id="expand" tabindex="0" role="link">
<span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span>

View File

@ -5,115 +5,118 @@
* 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')) { if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php'; require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
} }
class OC_Defaults { class OC_Defaults {
private static $defaultEntity; private $theme;
private static $defaultName;
private static $defaultBaseUrl;
private static $defaultSyncClientUrl;
private static $defaultDocBaseUrl;
private static $defaultSlogan;
private static $defaultLogoClaim;
public static function init() { private $defaultEntity;
private $defaultName;
private $defaultBaseUrl;
private $defaultSyncClientUrl;
private $defaultDocBaseUrl;
private $defaultSlogan;
private $defaultLogoClaim;
function __construct() {
$l = OC_L10N::get('core'); $l = OC_L10N::get('core');
self::$defaultEntity = "ownCloud"; $this->defaultEntity = "ownCloud";
self::$defaultName = "ownCloud"; $this->defaultName = "ownCloud";
self::$defaultBaseUrl = "http://owncloud.org"; $this->defaultBaseUrl = "http://owncloud.org";
self::$defaultSyncClientUrl = " http://owncloud.org/sync-clients/"; $this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
self::$defaultDocBaseUrl = "http://doc.owncloud.org"; $this->defaultDocBaseUrl = "http://doc.owncloud.org";
self::$defaultSlogan = $l->t("web services under your control"); $this->defaultSlogan = $l->t("web services under your control");
self::$defaultLogoClaim = ""; $this->defaultLogoClaim = "";
if (class_exists("OC_Theme")) { if (class_exists("OC_Theme")) {
OC_Theme::init(); $this->theme = new OC_Theme();
} }
} }
private static function themeExist($method) { private function themeExist($method) {
if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) { if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) {
return true; return true;
} }
return false; return false;
} }
public static function getBaseUrl() { public function getBaseUrl() {
if (self::themeExist('getBaseUrl')) { if ($this->themeExist('getBaseUrl')) {
return OC_Theme::getBaseUrl(); return $this->theme->getBaseUrl();
} else { } else {
return self::$defaultBaseUrl; return $this->defaultBaseUrl;
} }
} }
public static function getSyncClientUrl() { public function getSyncClientUrl() {
if (self::themeExist('getSyncClientUrl')) { if ($this->themeExist('getSyncClientUrl')) {
return OC_Theme::getSyncClientUrl(); return $this->theme->getSyncClientUrl();
} else { } else {
return self::$defaultSyncClientUrl; return $this->defaultSyncClientUrl;
} }
} }
public static function getDocBaseUrl() { public function getDocBaseUrl() {
if (self::themeExist('getDocBaseUrl')) { if ($this->themeExist('getDocBaseUrl')) {
return OC_Theme::getDocBaseUrl(); return $this->theme->getDocBaseUrl();
} else { } else {
return self::$defaultDocBaseUrl; return $this->defaultDocBaseUrl;
} }
} }
public static function getName() { public function getName() {
if (self::themeExist('getName')) { if ($this->themeExist('getName')) {
return OC_Theme::getName(); return $this->theme->getName();
} else { } else {
return self::$defaultName; return $this->defaultName;
} }
} }
public static function getEntity() { public function getEntity() {
if (self::themeExist('getEntity')) { if ($this->themeExist('getEntity')) {
return OC_Theme::getEntity(); return $this->theme->getEntity();
} else { } else {
return self::$defaultEntity; return $this->defaultEntity;
} }
} }
public static function getSlogan() { public function getSlogan() {
if (self::themeExist('getSlogan')) { if ($this->themeExist('getSlogan')) {
return OC_Theme::getSlogan(); return $this->theme->getSlogan();
} else { } else {
return self::$defaultSlogan; return $this->defaultSlogan;
} }
} }
public static function getLogoClaim() { public function getLogoClaim() {
if (self::themeExist('getLogoClaim')) { if ($this->themeExist('getLogoClaim')) {
return OC_Theme::getLogoClaim(); return $this->theme->getLogoClaim();
} else { } else {
return self::$defaultLogoClaim; return $this->defaultLogoClaim;
} }
} }
public static function getShortFooter() { public function getShortFooter() {
if (self::themeExist('getShortFooter')) { if ($this->themeExist('getShortFooter')) {
$footer = OC_Theme::getShortFooter(); $footer = $this->theme->getShortFooter();
} else { } else {
$footer = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>". $footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
' ' . self::getSlogan(); ' ' . $this->getSlogan();
} }
return $footer; return $footer;
} }
public static function getLongFooter() { public function getLongFooter() {
if (self::themeExist('getLongFooter')) { if ($this->themeExist('getLongFooter')) {
$footer = OC_Theme::getLongFooter(); $footer = $this->theme->getLongFooter();
} else { } else {
$footer = self::getShortFooter(); $footer = $this->getShortFooter();
} }
return $footer; return $footer;

View File

@ -113,11 +113,11 @@ class OC_Mail {
*/ */
public static function getfooter() { public static function getfooter() {
OC_Defaults::init(); $defaults = new OC_Defaults();
$txt="\n--\n"; $txt="\n--\n";
$txt.=OC_Defaults::getName() . "\n"; $txt.=$defaults->getName() . "\n";
$txt.=OC_Defaults::getSlogan() . "\n"; $txt.=$defaults->getSlogan() . "\n";
return($txt); return($txt);

View File

@ -98,7 +98,7 @@ class OC_Util {
* @return string * @return string
*/ */
public static function getEditionString() { public static function getEditionString() {
return ''; return 'Enteerprise';
} }
/** /**

View File

@ -8,7 +8,7 @@
OC_Util::checkLoggedIn(); OC_Util::checkLoggedIn();
OC_App::loadApps(); OC_App::loadApps();
OC_Defaults::init(); // initialize themable default strings and urls $defaults = new OC_Defaults(); // initialize themable default strings and urls
// Highlight navigation entry // Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' ); OC_Util::addScript( 'settings', 'personal' );
@ -62,7 +62,7 @@ usort( $languages, function ($a, $b) {
//links to clients //links to clients
$clients = array( $clients = array(
'desktop' => OC_Config::getValue('customclient_desktop', OC_Defaults::getSyncClientUrl()), 'desktop' => OC_Config::getValue('customclient_desktop', $defaults->getSyncClientUrl()),
'android' => OC_Config::getValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.owncloud.android'), 'android' => OC_Config::getValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.owncloud.android'),
'ios' => OC_Config::getValue('customclient_ios', 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8') 'ios' => OC_Config::getValue('customclient_ios', 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8')
); );

View File

@ -5,7 +5,7 @@
*/ */
$levels = array('Debug', 'Info', 'Warning', 'Error', 'Fatal'); $levels = array('Debug', 'Info', 'Warning', 'Error', 'Fatal');
OC_Defaults::init(); // initialize themable default strings and urls $defaults = new OC_Defaults(); // initialize themable default strings and urls
?> ?>
<?php <?php
@ -234,7 +234,7 @@ endfor;?>
<fieldset class="personalblock"> <fieldset class="personalblock">
<legend><strong><?php p($l->t('Version'));?></strong></legend> <legend><strong><?php p($l->t('Version'));?></strong></legend>
<strong><?php p(OC_Defaults::getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?> <strong><?php p($defaults->getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?>
<?php if (OC_Util::getEditionString() === ''): ?> <?php if (OC_Util::getEditionString() === ''): ?>
(<?php print_unescaped(OC_Updater::ShowUpdatingHint()); ?>)<br/> (<?php print_unescaped(OC_Updater::ShowUpdatingHint()); ?>)<br/>
<?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?> <?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?>
@ -242,6 +242,6 @@ endfor;?>
</fieldset> </fieldset>
<fieldset class="personalblock credits-footer"> <fieldset class="personalblock credits-footer">
<p> <p>
<?php print_unescaped(OC_Defaults::getShortFooter()); ?> <?php print_unescaped($defaults->getShortFooter()); ?>
</p> </p>
</fieldset> </fieldset>

View File

@ -4,7 +4,7 @@
* See the COPYING-README file. * See the COPYING-README file.
*/?> */?>
<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <?php $defaults = new OC_Defaults(); // initialize themable default strings and urls ?>
<div class="clientsbox"> <div class="clientsbox">
<h2><?php p($l->t('Get the apps to sync your files'));?></h2> <h2><?php p($l->t('Get the apps to sync your files'));?></h2>
@ -114,13 +114,13 @@ if($_['passwordChangeSupported']) {
<fieldset class="personalblock"> <fieldset class="personalblock">
<legend><strong><?php p($l->t('Version'));?></strong></legend> <legend><strong><?php p($l->t('Version'));?></strong></legend>
<strong><?php p(OC_Defaults::getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?><br/> <strong><?php p($defaults->getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?><br/>
<?php if (OC_Util::getEditionString() === ''): ?> <?php if (OC_Util::getEditionString() === ''): ?>
<?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?> <?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?>
<?php endif; ?> <?php endif; ?>
</fieldset> </fieldset>
<fieldset class="personalblock credits-footer"> <fieldset class="personalblock credits-footer">
<p> <p>
<?php print_unescaped(OC_Defaults::getShortFooter()); ?> <?php print_unescaped($defaults->getShortFooter()); ?>
</p> </p>
</fieldset> </fieldset>