diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-07-04 18:23:47 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-07-04 18:23:47 +0200 |
commit | ad9458e85d319c12575293e0b25069d35db15720 (patch) | |
tree | 83801af641b47e346bef0d72821b26e5d4cfb0fa /lib | |
parent | 32d69f68896c08e216bc0e84db409d00ec654856 (diff) | |
parent | f67fc78531a0180d3c60edb849b29ac744bacbaa (diff) | |
download | nextcloud-server-ad9458e85d319c12575293e0b25069d35db15720.tar.gz nextcloud-server-ad9458e85d319c12575293e0b25069d35db15720.zip |
Merge branch 'master' into convert-oc_config
Conflicts:
lib/config.php
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api.php | 2 | ||||
-rw-r--r-- | lib/defaults.php | 110 | ||||
-rw-r--r-- | lib/mail.php | 6 | ||||
-rw-r--r-- | lib/public/defaults.php | 108 |
4 files changed, 178 insertions, 48 deletions
diff --git a/lib/api.php b/lib/api.php index fc76836995b..31f3f968d9b 100644 --- a/lib/api.php +++ b/lib/api.php @@ -67,6 +67,8 @@ class OC_API { OC::getRouter()->useCollection('ocs'); OC::getRouter()->create($name, $url) ->method($method) + ->defaults($defaults) + ->requirements($requirements) ->action('OC_API', 'call'); self::$actions[$name] = array(); } diff --git a/lib/defaults.php b/lib/defaults.php index 08bf6be43a3..196bb5cf14d 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -5,100 +5,118 @@ * 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 $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 $theme; + + private $defaultEntity; + private $defaultName; + private $defaultBaseUrl; + private $defaultSyncClientUrl; + private $defaultDocBaseUrl; + private $defaultSlogan; + private $defaultLogoClaim; + + function __construct() { + $l = OC_L10N::get('core'); + + $this->defaultEntity = "ownCloud"; + $this->defaultName = "ownCloud"; + $this->defaultBaseUrl = "http://owncloud.org"; + $this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/"; + $this->defaultDocBaseUrl = "http://doc.owncloud.org"; + $this->defaultSlogan = $l->t("web services under your control"); + $this->defaultLogoClaim = ""; - private static function themeExist($method) { + if (class_exists("OC_Theme")) { + $this->theme = new OC_Theme(); + } + } + + private function themeExist($method) { if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) { return true; } return false; } - public static function getBaseUrl() { - if (self::themeExist('getBaseUrl')) { - return OC_Theme::getBaseUrl(); + public function getBaseUrl() { + if ($this->themeExist('getBaseUrl')) { + return $this->theme->getBaseUrl(); } else { - return self::$defaultBaseUrl; + return $this->defaultBaseUrl; } } - public static function getSyncClientUrl() { - if (self::themeExist('getSyncClientUrl')) { - return OC_Theme::getSyncClientUrl(); + public function getSyncClientUrl() { + if ($this->themeExist('getSyncClientUrl')) { + return $this->theme->getSyncClientUrl(); } else { - return self::$defaultSyncClientUrl; + return $this->defaultSyncClientUrl; } } - public static function getDocBaseUrl() { - if (self::themeExist('getDocBaseUrl')) { - return OC_Theme::getDocBaseUrl(); + public function getDocBaseUrl() { + if ($this->themeExist('getDocBaseUrl')) { + return $this->theme->getDocBaseUrl(); } else { - return self::$defaultDocBaseUrl; + return $this->defaultDocBaseUrl; } } - public static function getName() { - if (self::themeExist('getName')) { - return OC_Theme::getName(); + public function getName() { + if ($this->themeExist('getName')) { + return $this->theme->getName(); } else { - return self::$defaultName; + return $this->defaultName; } } - public static function getEntity() { - if (self::themeExist('getEntity')) { - return OC_Theme::getEntity(); + public function getEntity() { + if ($this->themeExist('getEntity')) { + return $this->theme->getEntity(); } else { - return self::$defaultEntity; + return $this->defaultEntity; } } - public static function getSlogan() { - $l = OC_L10N::get('core'); - if (self::themeExist('getSlogan')) { - return OC_Theme::getSlogan(); + public function getSlogan() { + if ($this->themeExist('getSlogan')) { + return $this->theme->getSlogan(); } else { - return $l->t(self::$defaultSlogan); + return $this->defaultSlogan; } } - public static function getLogoClaim() { - if (self::themeExist('getLogoClaim')) { - return OC_Theme::getLogoClaim(); + public function getLogoClaim() { + if ($this->themeExist('getLogoClaim')) { + return $this->theme->getLogoClaim(); } else { - return self::$defaultLogoClaim; + return $this->defaultLogoClaim; } } - public static function getShortFooter() { - if (self::themeExist('getShortFooter')) { - $footer = OC_Theme::getShortFooter(); + public function getShortFooter() { + if ($this->themeExist('getShortFooter')) { + $footer = $this->theme->getShortFooter(); } else { - $footer = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>". - ' – ' . self::getSlogan(); + $footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>". + ' – ' . $this->getSlogan(); } return $footer; } - public static function getLongFooter() { - if (self::themeExist('getLongFooter')) { - $footer = OC_Theme::getLongFooter(); + public function getLongFooter() { + if ($this->themeExist('getLongFooter')) { + $footer = $this->theme->getLongFooter(); } else { - $footer = self::getShortFooter(); + $footer = $this->getShortFooter(); } return $footer; diff --git a/lib/mail.php b/lib/mail.php index d6a383fe003..b339b33e962 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -113,9 +113,11 @@ class OC_Mail { */ public static function getfooter() { + $defaults = new OC_Defaults(); + $txt="\n--\n"; - $txt.=OC_Defaults::getName() . "\n"; - $txt.=OC_Defaults::getSlogan() . "\n"; + $txt.=$defaults->getName() . "\n"; + $txt.=$defaults->getSlogan() . "\n"; return($txt); diff --git a/lib/public/defaults.php b/lib/public/defaults.php new file mode 100644 index 00000000000..147f23e341f --- /dev/null +++ b/lib/public/defaults.php @@ -0,0 +1,108 @@ +<?php +/** +* ownCloud +* +* @author Björn Schießle +* @copyright 2013 Björn Schießle schiessle@owncloud.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCP; + +/* + * public api to access default strings and urls for your templates + */ + +class Defaults { + + private $defaults; + + function __construct() { + $this->defaults = new \OC_Defaults(); + } + + /** + * @breif get base URL for the organisation behind your ownCloud instance + * @return string + */ + public function getBaseUrl() { + return $this->defaults->getBaseUrl(); + } + + /** + * @breif link to the desktop sync client + * @return string + */ + public function getSyncClientUrl() { + return $this->defaults->getSyncClientUrl(); + } + + /** + * @breif base URL to the documentation of your ownCloud instance + * @return string + */ + public function getDocBaseUrl() { + return $this->defaults->getDocBaseUrl(); + } + + /** + * @breif name of your ownCloud instance + * @return string + */ + public function getName() { + return $this->defaults->getName(); + } + + /** + * @breif Entity behind your onwCloud instance + * @return string + */ + public function getEntity() { + return $this->defaults->getEntity(); + } + + /** + * @breif ownCloud slogan + * @return string + */ + public function getSlogan() { + return $this->defaults->getSlogan(); + } + + /** + * @breif logo claim + * @return string + */ + public function getLogoClaim() { + return $this->defaults->getLogoClaim(); + } + + /** + * @breif footer, short version + * @return string + */ + public function getShortFooter() { + return $this->defaults->getShortFooter(); + } + + /** + * @breif footer, long version + * @return string + */ + public function getLongFooter() { + return $this->defaults->getLongFooter(); + } +} |