server/lib/private/defaults.php

244 lines
5.8 KiB
PHP
Raw Normal View History

<?php
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
}
2013-11-25 13:12:07 +00:00
/**
* Default strings and values which differ between the enterprise and the
* community edition. Use the get methods to always get the right strings.
*/
class OC_Defaults {
private $theme;
private $l;
private $defaultEntity;
private $defaultName;
private $defaultTitle;
private $defaultBaseUrl;
private $defaultSyncClientUrl;
2014-07-30 09:38:17 +00:00
private $defaultiOSClientUrl;
private $defaultiTunesAppId;
2014-07-30 09:38:17 +00:00
private $defaultAndroidClientUrl;
private $defaultDocBaseUrl;
private $defaultDocVersion;
private $defaultSlogan;
private $defaultLogoClaim;
private $defaultMailHeaderColor;
function __construct() {
2014-08-31 08:05:59 +00:00
$this->l = \OC::$server->getL10N('lib');
$version = OC_Util::getVersion();
$this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */
$this->defaultName = 'ownCloud'; /* short name, used when referring to the software */
$this->defaultTitle = 'ownCloud'; /* can be a longer name, for titles */
$this->defaultBaseUrl = 'https://owncloud.org';
$this->defaultSyncClientUrl = 'https://owncloud.org/sync-clients/';
2014-07-30 09:38:17 +00:00
$this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8';
$this->defaultiTunesAppId = '543672169';
2014-07-30 09:38:17 +00:00
$this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android';
$this->defaultDocBaseUrl = 'http://doc.owncloud.org';
$this->defaultDocVersion = $version[0] . '.0'; // used to generate doc links
$this->defaultSlogan = $this->l->t('web services under your control');
$this->defaultLogoClaim = '';
$this->defaultMailHeaderColor = '#1d2d44'; /* header color of mail notifications */
if (class_exists('OC_Theme')) {
$this->theme = new OC_Theme();
}
}
/**
* @param string $method
*/
private function themeExist($method) {
if (isset($this->theme) && method_exists($this->theme, $method)) {
return true;
}
return false;
}
2013-11-25 13:12:07 +00:00
/**
* Returns the base URL
* @return string URL
*/
public function getBaseUrl() {
if ($this->themeExist('getBaseUrl')) {
return $this->theme->getBaseUrl();
} else {
return $this->defaultBaseUrl;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns the URL where the sync clients are listed
* @return string URL
*/
public function getSyncClientUrl() {
if ($this->themeExist('getSyncClientUrl')) {
return $this->theme->getSyncClientUrl();
} else {
return $this->defaultSyncClientUrl;
}
}
/**
* Returns the URL to the App Store for the iOS Client
* @return string URL
*/
public function getiOSClientUrl() {
if ($this->themeExist('getiOSClientUrl')) {
return $this->theme->getiOSClientUrl();
} else {
return $this->defaultiOSClientUrl;
}
}
/**
* Returns the AppId for the App Store for the iOS Client
* @return string AppId
*/
public function getiTunesAppId() {
if ($this->themeExist('getiTunesAppId')) {
return $this->theme->getiTunesAppId();
} else {
return $this->defaultiTunesAppId;
}
}
/**
* Returns the URL to Google Play for the Android Client
* @return string URL
*/
public function getAndroidClientUrl() {
if ($this->themeExist('getAndroidClientUrl')) {
return $this->theme->getAndroidClientUrl();
} else {
return $this->defaultAndroidClientUrl;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns the documentation URL
* @return string URL
*/
public function getDocBaseUrl() {
if ($this->themeExist('getDocBaseUrl')) {
return $this->theme->getDocBaseUrl();
2013-06-12 14:19:28 +00:00
} else {
return $this->defaultDocBaseUrl;
2013-06-12 14:19:28 +00:00
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns the title
* @return string title
*/
public function getTitle() {
if ($this->themeExist('getTitle')) {
return $this->theme->getTitle();
} else {
return $this->defaultTitle;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns the short name of the software
* @return string title
*/
public function getName() {
if ($this->themeExist('getName')) {
return $this->theme->getName();
} else {
return $this->defaultName;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns entity (e.g. company name) - used for footer, copyright
* @return string entity name
*/
public function getEntity() {
if ($this->themeExist('getEntity')) {
return $this->theme->getEntity();
} else {
return $this->defaultEntity;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns slogan
* @return string slogan
*/
public function getSlogan() {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan();
} else {
return $this->defaultSlogan;
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns logo claim
* @return string logo claim
*/
public function getLogoClaim() {
if ($this->themeExist('getLogoClaim')) {
return $this->theme->getLogoClaim();
2013-06-28 08:06:57 +00:00
} else {
return $this->defaultLogoClaim;
2013-06-28 08:06:57 +00:00
}
}
2013-11-25 13:12:07 +00:00
/**
* Returns short version of the footer
* @return string short footer
*/
public function getShortFooter() {
if ($this->themeExist('getShortFooter')) {
$footer = $this->theme->getShortFooter();
} else {
2014-08-05 11:18:38 +00:00
$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank">' .$this->getEntity() . '</a>'.
' ' . $this->getSlogan();
}
return $footer;
}
2013-11-25 13:12:07 +00:00
/**
* Returns long version of the footer
* @return string long footer
*/
public function getLongFooter() {
if ($this->themeExist('getLongFooter')) {
$footer = $this->theme->getLongFooter();
} else {
$footer = $this->getShortFooter();
}
return $footer;
}
public function buildDocLinkToKey($key) {
if ($this->themeExist('buildDocLinkToKey')) {
return $this->theme->buildDocLinkToKey($key);
}
return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
}
/**
* Returns mail header color
* @return string
*/
public function getMailHeaderColor() {
if ($this->themeExist('getMailHeaderColor')) {
return $this->theme->getMailHeaderColor();
} else {
return $this->defaultMailHeaderColor;
}
}
}