|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
7
|
|
|
* |
|
8
|
|
|
* @author Björn Schießle <[email protected]> |
|
9
|
|
|
* @author J0WI <[email protected]> |
|
10
|
|
|
* @author Joas Schilling <[email protected]> |
|
11
|
|
|
* @author Julius Härtl <[email protected]> |
|
12
|
|
|
* @author Lukas Reschke <[email protected]> |
|
13
|
|
|
* @author Morris Jobke <[email protected]> |
|
14
|
|
|
* @author Roeland Jago Douma <[email protected]> |
|
15
|
|
|
* @author scolebrook <[email protected]> |
|
16
|
|
|
* |
|
17
|
|
|
* @license AGPL-3.0 |
|
18
|
|
|
* |
|
19
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
20
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
21
|
|
|
* as published by the Free Software Foundation. |
|
22
|
|
|
* |
|
23
|
|
|
* This program is distributed in the hope that it will be useful, |
|
24
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
25
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
26
|
|
|
* GNU Affero General Public License for more details. |
|
27
|
|
|
* |
|
28
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
29
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
30
|
|
|
* |
|
31
|
|
|
*/ |
|
32
|
|
|
// use OCP namespace for all classes that are considered public. |
|
33
|
|
|
// This means that they should be used by apps instead of the internal ownCloud classes |
|
34
|
|
|
|
|
35
|
|
|
namespace OCP; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* public api to access default strings and urls for your templates |
|
39
|
|
|
* @since 6.0.0 |
|
40
|
|
|
*/ |
|
41
|
|
|
class Defaults { |
|
42
|
|
|
/** |
|
43
|
|
|
* \OC_Defaults instance to retrieve the defaults |
|
44
|
|
|
* @since 6.0.0 |
|
45
|
|
|
*/ |
|
46
|
|
|
private $defaults; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* creates a \OC_Defaults instance which is used in all methods to retrieve the |
|
50
|
|
|
* actual defaults |
|
51
|
|
|
* @since 6.0.0 |
|
52
|
|
|
*/ |
|
53
|
|
|
public function __construct(\OC_Defaults $defaults = null) { |
|
54
|
|
|
if ($defaults === null) { |
|
55
|
|
|
$defaults = \OC::$server->getThemingDefaults(); |
|
56
|
|
|
} |
|
57
|
|
|
$this->defaults = $defaults; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* get base URL for the organisation behind your ownCloud instance |
|
62
|
|
|
* @return string |
|
63
|
|
|
* @since 6.0.0 |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getBaseUrl(): string { |
|
66
|
|
|
return $this->defaults->getBaseUrl(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* link to the desktop sync client |
|
71
|
|
|
* @return string |
|
72
|
|
|
* @since 6.0.0 |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getSyncClientUrl(): string { |
|
75
|
|
|
return $this->defaults->getSyncClientUrl(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* link to the iOS client |
|
80
|
|
|
* @return string |
|
81
|
|
|
* @since 8.0.0 |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getiOSClientUrl(): string { |
|
84
|
|
|
return $this->defaults->getiOSClientUrl(); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* link to the Android client |
|
89
|
|
|
* @return string |
|
90
|
|
|
* @since 8.0.0 |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getAndroidClientUrl(): string { |
|
93
|
|
|
return $this->defaults->getAndroidClientUrl(); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* link to the Android client on F-Droid |
|
98
|
|
|
* @return string |
|
99
|
|
|
* @since 23.0.0 |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getFDroidClientUrl() { |
|
102
|
|
|
return $this->defaults->getFDroidClientUrl(); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* base URL to the documentation of your ownCloud instance |
|
107
|
|
|
* @return string |
|
108
|
|
|
* @since 6.0.0 |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getDocBaseUrl(): string { |
|
111
|
|
|
return $this->defaults->getDocBaseUrl(); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* name of your Nextcloud instance (e.g. MyPrivateCloud) |
|
116
|
|
|
* @return string |
|
117
|
|
|
* @since 6.0.0 |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getName(): string { |
|
120
|
|
|
return $this->defaults->getName(); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Name of the software product (defaults to Nextcloud) |
|
125
|
|
|
* |
|
126
|
|
|
* @return string |
|
127
|
|
|
* @since 22.0.0 |
|
128
|
|
|
*/ |
|
129
|
|
|
public function getProductName(): string { |
|
130
|
|
|
return $this->defaults->getProductName(); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* name of your ownCloud instance containing HTML styles |
|
135
|
|
|
* @return string |
|
136
|
|
|
* @since 8.0.0 |
|
137
|
|
|
* @deprecated 22.0.0 |
|
138
|
|
|
*/ |
|
139
|
|
|
public function getHTMLName(): string { |
|
140
|
|
|
return $this->defaults->getHTMLName(); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Entity behind your onwCloud instance |
|
145
|
|
|
* @return string |
|
146
|
|
|
* @since 6.0.0 |
|
147
|
|
|
*/ |
|
148
|
|
|
public function getEntity(): string { |
|
149
|
|
|
return $this->defaults->getEntity(); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* ownCloud slogan |
|
154
|
|
|
* @return string |
|
155
|
|
|
* @since 6.0.0 |
|
156
|
|
|
*/ |
|
157
|
|
|
public function getSlogan(?string $lang = null): string { |
|
158
|
|
|
return $this->defaults->getSlogan($lang); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* footer, short version |
|
163
|
|
|
* @return string |
|
164
|
|
|
* @since 6.0.0 |
|
165
|
|
|
*/ |
|
166
|
|
|
public function getShortFooter(): string { |
|
167
|
|
|
return $this->defaults->getShortFooter(); |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* footer, long version |
|
172
|
|
|
* @return string |
|
173
|
|
|
* @since 6.0.0 |
|
174
|
|
|
*/ |
|
175
|
|
|
public function getLongFooter(): string { |
|
176
|
|
|
return $this->defaults->getLongFooter(); |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* Returns the AppId for the App Store for the iOS Client |
|
181
|
|
|
* @return string AppId |
|
182
|
|
|
* @since 8.0.0 |
|
183
|
|
|
*/ |
|
184
|
|
|
public function getiTunesAppId(): string { |
|
185
|
|
|
return $this->defaults->getiTunesAppId(); |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* Themed logo url |
|
190
|
|
|
* |
|
191
|
|
|
* @param bool $useSvg Whether to point to the SVG image or a fallback |
|
192
|
|
|
* @return string |
|
193
|
|
|
* @since 12.0.0 |
|
194
|
|
|
*/ |
|
195
|
|
|
public function getLogo(bool $useSvg = true): string { |
|
196
|
|
|
return $this->defaults->getLogo($useSvg); |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* Returns primary color |
|
201
|
|
|
* @return string |
|
202
|
|
|
* @since 12.0.0 |
|
203
|
|
|
*/ |
|
204
|
|
|
public function getColorPrimary(): string { |
|
205
|
|
|
return $this->defaults->getColorPrimary(); |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* Return the default color primary |
|
210
|
|
|
* @return string |
|
211
|
|
|
* @since 25.0.4 |
|
212
|
|
|
*/ |
|
213
|
|
|
public function getDefaultColorPrimary(): string { |
|
214
|
|
|
if (method_exists($this->defaults, 'getDefaultColorPrimary')) { |
|
215
|
|
|
return $this->defaults->getDefaultColorPrimary(); |
|
216
|
|
|
} |
|
217
|
|
|
return $this->defaults->getColorPrimary(); |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @param string $key |
|
222
|
|
|
* @return string URL to doc with key |
|
223
|
|
|
* @since 12.0.0 |
|
224
|
|
|
*/ |
|
225
|
|
|
public function buildDocLinkToKey(string $key): string { |
|
226
|
|
|
return $this->defaults->buildDocLinkToKey($key); |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* Returns the title |
|
231
|
|
|
* @return string title |
|
232
|
|
|
* @since 12.0.0 |
|
233
|
|
|
*/ |
|
234
|
|
|
public function getTitle(): string { |
|
235
|
|
|
return $this->defaults->getTitle(); |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* Returns primary color |
|
240
|
|
|
* @return string |
|
241
|
|
|
* @since 13.0.0 |
|
242
|
|
|
*/ |
|
243
|
|
|
public function getTextColorPrimary(): string { |
|
244
|
|
|
return $this->defaults->getTextColorPrimary(); |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Returns primary color |
|
249
|
|
|
* @return string |
|
250
|
|
|
* @since 25.0.4 |
|
251
|
|
|
*/ |
|
252
|
|
|
public function getDefaultTextColorPrimary(): string { |
|
253
|
|
|
if (method_exists($this->defaults, 'getDefaultTextColorPrimary')) { |
|
254
|
|
|
return $this->defaults->getDefaultTextColorPrimary(); |
|
255
|
|
|
} |
|
256
|
|
|
return $this->defaults->getTextColorPrimary(); |
|
257
|
|
|
} |
|
258
|
|
|
} |
|
259
|
|
|
|