2013-06-12 17:15:08 +04:00
|
|
|
|
<?php
|
|
|
|
|
|
2013-06-27 18:24:03 +04:00
|
|
|
|
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
|
|
|
|
|
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Default strings and values which differ between the enterprise and the
|
|
|
|
|
* community edition. Use the get methods to always get the right strings.
|
|
|
|
|
*/
|
2013-06-12 17:15:08 +04:00
|
|
|
|
class OC_Defaults {
|
|
|
|
|
|
2013-07-03 16:21:51 +04:00
|
|
|
|
private $theme;
|
2013-08-30 15:53:49 +04:00
|
|
|
|
private $l;
|
2013-07-03 16:21:51 +04:00
|
|
|
|
|
|
|
|
|
private $defaultEntity;
|
|
|
|
|
private $defaultName;
|
2013-07-11 18:38:07 +04:00
|
|
|
|
private $defaultTitle;
|
2013-07-03 16:21:51 +04:00
|
|
|
|
private $defaultBaseUrl;
|
|
|
|
|
private $defaultSyncClientUrl;
|
|
|
|
|
private $defaultDocBaseUrl;
|
2014-05-29 03:21:54 +04:00
|
|
|
|
private $defaultDocVersion;
|
2013-07-03 16:21:51 +04:00
|
|
|
|
private $defaultSlogan;
|
|
|
|
|
private $defaultLogoClaim;
|
2014-03-03 15:43:22 +04:00
|
|
|
|
private $defaultMailHeaderColor;
|
2013-07-03 14:38:20 +04:00
|
|
|
|
|
2013-07-03 16:21:51 +04:00
|
|
|
|
function __construct() {
|
2014-05-29 03:21:54 +04:00
|
|
|
|
$this->l = OC_L10N::get('lib');
|
|
|
|
|
$version = OC_Util::getVersion();
|
2013-07-03 14:38:20 +04:00
|
|
|
|
|
2013-07-11 18:38:07 +04:00
|
|
|
|
$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 */
|
2014-04-07 00:06:38 +04:00
|
|
|
|
$this->defaultBaseUrl = "https://owncloud.org";
|
2014-04-07 00:04:14 +04:00
|
|
|
|
$this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/";
|
2013-07-03 16:21:51 +04:00
|
|
|
|
$this->defaultDocBaseUrl = "http://doc.owncloud.org";
|
2014-05-29 03:21:54 +04:00
|
|
|
|
$this->defaultDocVersion = $version[0] . ".0"; // used to generate doc links
|
2013-08-30 15:53:49 +04:00
|
|
|
|
$this->defaultSlogan = $this->l->t("web services under your control");
|
2013-07-03 16:21:51 +04:00
|
|
|
|
$this->defaultLogoClaim = "";
|
2014-03-03 15:43:22 +04:00
|
|
|
|
$this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */
|
2013-07-03 14:38:20 +04:00
|
|
|
|
|
|
|
|
|
if (class_exists("OC_Theme")) {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
$this->theme = new OC_Theme();
|
2013-07-03 14:38:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-12 17:15:08 +04:00
|
|
|
|
|
2014-02-06 19:30:58 +04:00
|
|
|
|
/**
|
|
|
|
|
* @param string $method
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
private function themeExist($method) {
|
2014-07-15 17:39:44 +04:00
|
|
|
|
if (isset($this->theme) && method_exists($this->theme, $method)) {
|
2013-06-27 18:24:03 +04:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-06-12 17:15:08 +04:00
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns the base URL
|
|
|
|
|
* @return string URL
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getBaseUrl() {
|
|
|
|
|
if ($this->themeExist('getBaseUrl')) {
|
|
|
|
|
return $this->theme->getBaseUrl();
|
2013-06-12 17:15:08 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultBaseUrl;
|
2013-06-12 17:15:08 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns the URL where the sync clients are listed
|
|
|
|
|
* @return string URL
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getSyncClientUrl() {
|
|
|
|
|
if ($this->themeExist('getSyncClientUrl')) {
|
|
|
|
|
return $this->theme->getSyncClientUrl();
|
2013-06-12 17:44:11 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultSyncClientUrl;
|
2013-06-12 17:44:11 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns the documentation URL
|
|
|
|
|
* @return string URL
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getDocBaseUrl() {
|
|
|
|
|
if ($this->themeExist('getDocBaseUrl')) {
|
|
|
|
|
return $this->theme->getDocBaseUrl();
|
2013-06-12 18:19:28 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultDocBaseUrl;
|
2013-06-12 18:19:28 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns the title
|
|
|
|
|
* @return string title
|
|
|
|
|
*/
|
2013-07-11 18:38:07 +04:00
|
|
|
|
public function getTitle() {
|
|
|
|
|
if ($this->themeExist('getTitle')) {
|
|
|
|
|
return $this->theme->getTitle();
|
|
|
|
|
} else {
|
|
|
|
|
return $this->defaultTitle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns the short name of the software
|
|
|
|
|
* @return string title
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getName() {
|
|
|
|
|
if ($this->themeExist('getName')) {
|
|
|
|
|
return $this->theme->getName();
|
2013-06-12 17:15:08 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultName;
|
2013-06-12 17:15:08 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns entity (e.g. company name) - used for footer, copyright
|
|
|
|
|
* @return string entity name
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getEntity() {
|
|
|
|
|
if ($this->themeExist('getEntity')) {
|
|
|
|
|
return $this->theme->getEntity();
|
2013-06-12 17:15:08 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultEntity;
|
2013-06-12 17:15:08 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns slogan
|
|
|
|
|
* @return string slogan
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getSlogan() {
|
|
|
|
|
if ($this->themeExist('getSlogan')) {
|
|
|
|
|
return $this->theme->getSlogan();
|
2013-06-12 17:15:08 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultSlogan;
|
2013-06-12 17:15:08 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns logo claim
|
|
|
|
|
* @return string logo claim
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getLogoClaim() {
|
|
|
|
|
if ($this->themeExist('getLogoClaim')) {
|
|
|
|
|
return $this->theme->getLogoClaim();
|
2013-06-28 12:06:57 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
return $this->defaultLogoClaim;
|
2013-06-28 12:06:57 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns short version of the footer
|
|
|
|
|
* @return string short footer
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getShortFooter() {
|
|
|
|
|
if ($this->themeExist('getShortFooter')) {
|
|
|
|
|
$footer = $this->theme->getShortFooter();
|
2013-06-27 18:24:03 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
$footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
|
|
|
|
|
' – ' . $this->getSlogan();
|
2013-06-26 19:56:19 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $footer;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 17:12:07 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns long version of the footer
|
|
|
|
|
* @return string long footer
|
|
|
|
|
*/
|
2013-07-03 16:21:51 +04:00
|
|
|
|
public function getLongFooter() {
|
|
|
|
|
if ($this->themeExist('getLongFooter')) {
|
|
|
|
|
$footer = $this->theme->getLongFooter();
|
2013-06-26 19:56:19 +04:00
|
|
|
|
} else {
|
2013-07-03 16:21:51 +04:00
|
|
|
|
$footer = $this->getShortFooter();
|
2013-06-26 19:56:19 +04:00
|
|
|
|
}
|
2013-06-27 18:24:03 +04:00
|
|
|
|
|
2013-06-26 19:56:19 +04:00
|
|
|
|
return $footer;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 02:06:23 +04:00
|
|
|
|
public function buildDocLinkToKey($key) {
|
|
|
|
|
if ($this->themeExist('buildDocLinkToKey')) {
|
|
|
|
|
return $this->theme->buildDocLinkToKey($key);
|
|
|
|
|
}
|
2014-05-29 03:21:54 +04:00
|
|
|
|
return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
|
2014-02-26 02:06:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-03 15:43:22 +04:00
|
|
|
|
/**
|
|
|
|
|
* Returns mail header color
|
2014-05-12 00:51:30 +04:00
|
|
|
|
* @return string
|
2014-03-03 15:43:22 +04:00
|
|
|
|
*/
|
|
|
|
|
public function getMailHeaderColor() {
|
|
|
|
|
if ($this->themeExist('getMailHeaderColor')) {
|
|
|
|
|
return $this->theme->getMailHeaderColor();
|
|
|
|
|
} else {
|
|
|
|
|
return $this->defaultMailHeaderColor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-26 19:56:19 +04:00
|
|
|
|
}
|