Blame view

sources/lib/private/defaults.php 5.46 KB
03e52840d   Kload   Init
1
  <?php
03e52840d   Kload   Init
2
3
4
  if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
  	require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
  }
31b7f2792   Kload   Upgrade to ownclo...
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   Kload   Init
9
10
11
  class OC_Defaults {
  
  	private $theme;
31b7f2792   Kload   Upgrade to ownclo...
12
  	private $l;
03e52840d   Kload   Init
13
14
15
  
  	private $defaultEntity;
  	private $defaultName;
31b7f2792   Kload   Upgrade to ownclo...
16
  	private $defaultTitle;
03e52840d   Kload   Init
17
18
  	private $defaultBaseUrl;
  	private $defaultSyncClientUrl;
f7d878ff1   kload   [enh] Update to 7...
19
20
  	private $defaultiOSClientUrl;
  	private $defaultAndroidClientUrl;
03e52840d   Kload   Init
21
  	private $defaultDocBaseUrl;
6d9380f96   Cédric Dupont   Update sources OC...
22
  	private $defaultDocVersion;
03e52840d   Kload   Init
23
24
  	private $defaultSlogan;
  	private $defaultLogoClaim;
837968727   Kload   [enh] Upgrade to ...
25
  	private $defaultMailHeaderColor;
03e52840d   Kload   Init
26
27
  
  	function __construct() {
6d9380f96   Cédric Dupont   Update sources OC...
28
29
  		$this->l = OC_L10N::get('lib');
  		$version = OC_Util::getVersion();
03e52840d   Kload   Init
30

f7d878ff1   kload   [enh] Update to 7...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  		$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/';
  		$this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8';
  		$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')) {
03e52840d   Kload   Init
45
46
47
  			$this->theme = new OC_Theme();
  		}
  	}
6d9380f96   Cédric Dupont   Update sources OC...
48
49
50
  	/**
  	 * @param string $method
  	 */
03e52840d   Kload   Init
51
  	private function themeExist($method) {
6d9380f96   Cédric Dupont   Update sources OC...
52
  		if (isset($this->theme) && method_exists($this->theme, $method)) {
03e52840d   Kload   Init
53
54
55
56
  			return true;
  		}
  		return false;
  	}
31b7f2792   Kload   Upgrade to ownclo...
57
58
59
60
  	/**
  	 * Returns the base URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
61
62
63
64
65
66
67
  	public function getBaseUrl() {
  		if ($this->themeExist('getBaseUrl')) {
  			return $this->theme->getBaseUrl();
  		} else {
  			return $this->defaultBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
68
69
70
71
  	/**
  	 * Returns the URL where the sync clients are listed
  	 * @return string URL
  	 */
03e52840d   Kload   Init
72
73
74
75
76
77
78
  	public function getSyncClientUrl() {
  		if ($this->themeExist('getSyncClientUrl')) {
  			return $this->theme->getSyncClientUrl();
  		} else {
  			return $this->defaultSyncClientUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
79
  	/**
f7d878ff1   kload   [enh] Update to 7...
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  	 * 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 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;
  		}
  	}
  
  	/**
31b7f2792   Kload   Upgrade to ownclo...
104
105
106
  	 * Returns the documentation URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
107
108
109
110
111
112
113
  	public function getDocBaseUrl() {
  		if ($this->themeExist('getDocBaseUrl')) {
  			return $this->theme->getDocBaseUrl();
  		} else {
  			return $this->defaultDocBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  	/**
  	 * 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   Kload   Init
130
131
132
133
134
135
136
  	public function getName() {
  		if ($this->themeExist('getName')) {
  			return $this->theme->getName();
  		} else {
  			return $this->defaultName;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
137
138
139
140
  	/**
  	 * Returns entity (e.g. company name) - used for footer, copyright
  	 * @return string entity name
  	 */
03e52840d   Kload   Init
141
142
143
144
145
146
147
  	public function getEntity() {
  		if ($this->themeExist('getEntity')) {
  			return $this->theme->getEntity();
  		} else {
  			return $this->defaultEntity;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
148
149
150
151
  	/**
  	 * Returns slogan
  	 * @return string slogan
  	 */
03e52840d   Kload   Init
152
153
154
155
156
157
158
  	public function getSlogan() {
  		if ($this->themeExist('getSlogan')) {
  			return $this->theme->getSlogan();
  		} else {
  			return $this->defaultSlogan;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
159
160
161
162
  	/**
  	 * Returns logo claim
  	 * @return string logo claim
  	 */
03e52840d   Kload   Init
163
164
165
166
167
168
169
  	public function getLogoClaim() {
  		if ($this->themeExist('getLogoClaim')) {
  			return $this->theme->getLogoClaim();
  		} else {
  			return $this->defaultLogoClaim;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
170
171
172
173
  	/**
  	 * Returns short version of the footer
  	 * @return string short footer
  	 */
03e52840d   Kload   Init
174
175
176
177
  	public function getShortFooter() {
  		if ($this->themeExist('getShortFooter')) {
  			$footer = $this->theme->getShortFooter();
  		} else {
f7d878ff1   kload   [enh] Update to 7...
178
  			$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank">' .$this->getEntity() . '</a>'.
03e52840d   Kload   Init
179
180
181
182
183
  				' – ' . $this->getSlogan();
  		}
  
  		return $footer;
  	}
31b7f2792   Kload   Upgrade to ownclo...
184
185
186
187
  	/**
  	 * Returns long version of the footer
  	 * @return string long footer
  	 */
03e52840d   Kload   Init
188
189
190
191
192
193
194
195
196
  	public function getLongFooter() {
  		if ($this->themeExist('getLongFooter')) {
  			$footer = $this->theme->getLongFooter();
  		} else {
  			$footer = $this->getShortFooter();
  		}
  
  		return $footer;
  	}
a293d369c   Kload   Update sources to...
197
198
199
200
  	public function buildDocLinkToKey($key) {
  		if ($this->themeExist('buildDocLinkToKey')) {
  			return $this->theme->buildDocLinkToKey($key);
  		}
6d9380f96   Cédric Dupont   Update sources OC...
201
  		return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
a293d369c   Kload   Update sources to...
202
  	}
837968727   Kload   [enh] Upgrade to ...
203
204
  	/**
  	 * Returns mail header color
6d9380f96   Cédric Dupont   Update sources OC...
205
  	 * @return string
837968727   Kload   [enh] Upgrade to ...
206
207
208
209
210
211
212
213
  	 */
  	public function getMailHeaderColor() {
  		if ($this->themeExist('getMailHeaderColor')) {
  			return $this->theme->getMailHeaderColor();
  		} else {
  			return $this->defaultMailHeaderColor;
  		}
  	}
03e52840d   Kload   Init
214
  }