Blame view
sources/lib/private/defaults.php
4.66 KB
|
03e52840d
|
1 |
<?php |
|
03e52840d
|
2 3 4 |
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
}
|
|
31b7f2792
|
5 6 7 8 |
/** * Default strings and values which differ between the enterprise and the * community edition. Use the get methods to always get the right strings. */ |
|
03e52840d
|
9 10 11 |
class OC_Defaults {
private $theme;
|
|
31b7f2792
|
12 |
private $l; |
|
03e52840d
|
13 14 15 |
private $defaultEntity; private $defaultName; |
|
31b7f2792
|
16 |
private $defaultTitle; |
|
03e52840d
|
17 18 19 |
private $defaultBaseUrl; private $defaultSyncClientUrl; private $defaultDocBaseUrl; |
|
6d9380f96
|
20 |
private $defaultDocVersion; |
|
03e52840d
|
21 22 |
private $defaultSlogan; private $defaultLogoClaim; |
|
837968727
|
23 |
private $defaultMailHeaderColor; |
|
03e52840d
|
24 25 |
function __construct() {
|
|
6d9380f96
|
26 27 |
$this->l = OC_L10N::get('lib');
$version = OC_Util::getVersion();
|
|
03e52840d
|
28 |
|
|
31b7f2792
|
29 30 31 |
$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 */ |
|
6d9380f96
|
32 33 |
$this->defaultBaseUrl = "https://owncloud.org"; $this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/"; |
|
03e52840d
|
34 |
$this->defaultDocBaseUrl = "http://doc.owncloud.org"; |
|
6d9380f96
|
35 |
$this->defaultDocVersion = $version[0] . ".0"; // used to generate doc links |
|
31b7f2792
|
36 |
$this->defaultSlogan = $this->l->t("web services under your control");
|
|
03e52840d
|
37 |
$this->defaultLogoClaim = ""; |
|
837968727
|
38 |
$this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */ |
|
03e52840d
|
39 40 41 42 43 |
if (class_exists("OC_Theme")) {
$this->theme = new OC_Theme();
}
}
|
|
6d9380f96
|
44 45 46 |
/** * @param string $method */ |
|
03e52840d
|
47 |
private function themeExist($method) {
|
|
6d9380f96
|
48 |
if (isset($this->theme) && method_exists($this->theme, $method)) {
|
|
03e52840d
|
49 50 51 52 |
return true; } return false; } |
|
31b7f2792
|
53 54 55 56 |
/** * Returns the base URL * @return string URL */ |
|
03e52840d
|
57 58 59 60 61 62 63 |
public function getBaseUrl() {
if ($this->themeExist('getBaseUrl')) {
return $this->theme->getBaseUrl();
} else {
return $this->defaultBaseUrl;
}
}
|
|
31b7f2792
|
64 65 66 67 |
/** * Returns the URL where the sync clients are listed * @return string URL */ |
|
03e52840d
|
68 69 70 71 72 73 74 |
public function getSyncClientUrl() {
if ($this->themeExist('getSyncClientUrl')) {
return $this->theme->getSyncClientUrl();
} else {
return $this->defaultSyncClientUrl;
}
}
|
|
31b7f2792
|
75 76 77 78 |
/** * Returns the documentation URL * @return string URL */ |
|
03e52840d
|
79 80 81 82 83 84 85 |
public function getDocBaseUrl() {
if ($this->themeExist('getDocBaseUrl')) {
return $this->theme->getDocBaseUrl();
} else {
return $this->defaultDocBaseUrl;
}
}
|
|
31b7f2792
|
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
/**
* Returns the title
* @return string title
*/
public function getTitle() {
if ($this->themeExist('getTitle')) {
return $this->theme->getTitle();
} else {
return $this->defaultTitle;
}
}
/**
* Returns the short name of the software
* @return string title
*/
|
|
03e52840d
|
102 103 104 105 106 107 108 |
public function getName() {
if ($this->themeExist('getName')) {
return $this->theme->getName();
} else {
return $this->defaultName;
}
}
|
|
31b7f2792
|
109 110 111 112 |
/** * Returns entity (e.g. company name) - used for footer, copyright * @return string entity name */ |
|
03e52840d
|
113 114 115 116 117 118 119 |
public function getEntity() {
if ($this->themeExist('getEntity')) {
return $this->theme->getEntity();
} else {
return $this->defaultEntity;
}
}
|
|
31b7f2792
|
120 121 122 123 |
/** * Returns slogan * @return string slogan */ |
|
03e52840d
|
124 125 126 127 128 129 130 |
public function getSlogan() {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan();
} else {
return $this->defaultSlogan;
}
}
|
|
31b7f2792
|
131 132 133 134 |
/** * Returns logo claim * @return string logo claim */ |
|
03e52840d
|
135 136 137 138 139 140 141 |
public function getLogoClaim() {
if ($this->themeExist('getLogoClaim')) {
return $this->theme->getLogoClaim();
} else {
return $this->defaultLogoClaim;
}
}
|
|
31b7f2792
|
142 143 144 145 |
/** * Returns short version of the footer * @return string short footer */ |
|
03e52840d
|
146 147 148 149 150 151 152 153 154 155 |
public function getShortFooter() {
if ($this->themeExist('getShortFooter')) {
$footer = $this->theme->getShortFooter();
} else {
$footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
' – ' . $this->getSlogan();
}
return $footer;
}
|
|
31b7f2792
|
156 157 158 159 |
/** * Returns long version of the footer * @return string long footer */ |
|
03e52840d
|
160 161 162 163 164 165 166 167 168 |
public function getLongFooter() {
if ($this->themeExist('getLongFooter')) {
$footer = $this->theme->getLongFooter();
} else {
$footer = $this->getShortFooter();
}
return $footer;
}
|
|
a293d369c
|
169 170 171 172 |
public function buildDocLinkToKey($key) {
if ($this->themeExist('buildDocLinkToKey')) {
return $this->theme->buildDocLinkToKey($key);
}
|
|
6d9380f96
|
173 |
return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key; |
|
a293d369c
|
174 |
} |
|
837968727
|
175 176 |
/** * Returns mail header color |
|
6d9380f96
|
177 |
* @return string |
|
837968727
|
178 179 180 181 182 183 184 185 |
*/
public function getMailHeaderColor() {
if ($this->themeExist('getMailHeaderColor')) {
return $this->theme->getMailHeaderColor();
} else {
return $this->defaultMailHeaderColor;
}
}
|
|
03e52840d
|
186 |
} |