From: Björn Schießle Date: Wed, 3 Jul 2013 10:38:20 +0000 (+0200) Subject: Add init funtion to OC_Defaults to be able to wrap translatable strings X-Git-Tag: v6.0.0alpha2~530 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d46e62886a2b22a4c80df8cca09fb6f354d48614;p=nextcloud-server.git Add init funtion to OC_Defaults to be able to wrap translatable strings --- diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index cbd5ddf7a7d..a3a73f77ab7 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -2,6 +2,8 @@ + + diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php index 163e8e3ae7e..51bac790741 100644 --- a/core/templates/layout.base.php +++ b/core/templates/layout.base.php @@ -5,6 +5,9 @@ + + + <?php p(OC_Defaults::getName()); ?> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index fde970554c6..b17e2fc547c 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -5,6 +5,9 @@ <!--[if IE 9]><html class="ng-csp ie ie9 lte9"><![endif]--> <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> + + <?php OC_Defaults::init(); // initialize themable default strings and urls ?> + <head data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> <?php p(OC_Defaults::getName()); ?> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index b424669e35a..2dd339cef96 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -5,6 +5,9 @@ <!--[if IE 9]><html class="ng-csp ie ie9 lte9"><![endif]--> <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> + + <?php OC_Defaults::init(); // initialize themable default strings and urls ?> + <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> <?php p(!empty($_['application'])?$_['application'].' | ':''); diff --git a/lib/defaults.php b/lib/defaults.php index 08bf6be43a3..1c3f8ffd056 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -11,13 +11,29 @@ if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults. class OC_Defaults { - 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 $defaultLogoClaim = ""; + private static $defaultEntity; + private static $defaultName; + private static $defaultBaseUrl; + private static $defaultSyncClientUrl; + private static $defaultDocBaseUrl; + private static $defaultSlogan; + private static $defaultLogoClaim; + + public static function init() { + $l = OC_L10N::get('core'); + + self::$defaultEntity = "ownCloud"; + self::$defaultName = "ownCloud"; + self::$defaultBaseUrl = "http://owncloud.org"; + self::$defaultSyncClientUrl = " http://owncloud.org/sync-clients/"; + self::$defaultDocBaseUrl = "http://doc.owncloud.org"; + self::$defaultSlogan = $l->t("web services under your control"); + self::$defaultLogoClaim = ""; + + if (class_exists("OC_Theme")) { + OC_Theme::init(); + } + } private static function themeExist($method) { if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) { @@ -67,11 +83,10 @@ class OC_Defaults { } public static function getSlogan() { - $l = OC_L10N::get('core'); if (self::themeExist('getSlogan')) { return OC_Theme::getSlogan(); } else { - return $l->t(self::$defaultSlogan); + return self::$defaultSlogan; } } diff --git a/lib/mail.php b/lib/mail.php index d6a383fe003..7c786ecc290 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -113,6 +113,8 @@ class OC_Mail { */ public static function getfooter() { + OC_Defaults::init(); + $txt="\n--\n"; $txt.=OC_Defaults::getName() . "\n"; $txt.=OC_Defaults::getSlogan() . "\n"; diff --git a/settings/personal.php b/settings/personal.php index cb411cacc5b..d68de4d570a 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -8,6 +8,8 @@ OC_Util::checkLoggedIn(); OC_App::loadApps(); +OC_Defaults::init(); // initialize themable default strings and urls + // Highlight navigation entry OC_Util::addScript( 'settings', 'personal' ); OC_Util::addStyle( 'settings', 'settings' ); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 68a4cbe0590..fd79f88af1c 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -4,6 +4,8 @@ * See the COPYING-README file. */ $levels = array('Debug', 'Info', 'Warning', 'Error', 'Fatal'); + +OC_Defaults::init(); // initialize themable default strings and urls ?> <?php diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 5d0bb77c78e..4cf2b2393b3 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -4,6 +4,7 @@ * See the COPYING-README file. */?> +<?php OC_Defaults::init(); // initialize themable default strings and urls ?> <div class="clientsbox"> <h2><?php p($l->t('Get the apps to sync your files'));?></h2>