Passed
Push — master ( f0238f...56ece0 )
by Joas
15:37 queued 13s
created
lib/private/legacy/OC_Defaults.php 1 patch
Indentation   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -38,311 +38,311 @@
 block discarded – undo
38 38
  */
39 39
 
40 40
 class OC_Defaults {
41
-	private $theme;
41
+    private $theme;
42 42
 
43
-	private $defaultEntity;
44
-	private $defaultName;
45
-	private $defaultTitle;
46
-	private $defaultBaseUrl;
47
-	private $defaultSyncClientUrl;
48
-	private $defaultiOSClientUrl;
49
-	private $defaultiTunesAppId;
50
-	private $defaultAndroidClientUrl;
51
-	private $defaultFDroidClientUrl;
52
-	private $defaultDocBaseUrl;
53
-	private $defaultDocVersion;
54
-	private $defaultSlogan;
55
-	private $defaultColorPrimary;
56
-	private $defaultTextColorPrimary;
57
-	private $defaultProductName;
43
+    private $defaultEntity;
44
+    private $defaultName;
45
+    private $defaultTitle;
46
+    private $defaultBaseUrl;
47
+    private $defaultSyncClientUrl;
48
+    private $defaultiOSClientUrl;
49
+    private $defaultiTunesAppId;
50
+    private $defaultAndroidClientUrl;
51
+    private $defaultFDroidClientUrl;
52
+    private $defaultDocBaseUrl;
53
+    private $defaultDocVersion;
54
+    private $defaultSlogan;
55
+    private $defaultColorPrimary;
56
+    private $defaultTextColorPrimary;
57
+    private $defaultProductName;
58 58
 
59
-	public function __construct() {
60
-		$config = \OC::$server->getConfig();
59
+    public function __construct() {
60
+        $config = \OC::$server->getConfig();
61 61
 
62
-		$this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
63
-		$this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */
64
-		$this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */
65
-		$this->defaultBaseUrl = 'https://nextcloud.com';
66
-		$this->defaultSyncClientUrl = $config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients');
67
-		$this->defaultiOSClientUrl = $config->getSystemValue('customclient_ios', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8');
68
-		$this->defaultiTunesAppId = $config->getSystemValue('customclient_ios_appid', '1125420102');
69
-		$this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client');
70
-		$this->defaultFDroidClientUrl = $config->getSystemValue('customclient_fdroid', 'https://f-droid.org/packages/com.nextcloud.client/');
71
-		$this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
72
-		$this->defaultDocVersion = \OC_Util::getVersion()[0]; // used to generate doc links
73
-		$this->defaultColorPrimary = '#0082c9';
74
-		$this->defaultTextColorPrimary = '#ffffff';
75
-		$this->defaultProductName = 'Nextcloud';
62
+        $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
63
+        $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */
64
+        $this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */
65
+        $this->defaultBaseUrl = 'https://nextcloud.com';
66
+        $this->defaultSyncClientUrl = $config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients');
67
+        $this->defaultiOSClientUrl = $config->getSystemValue('customclient_ios', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8');
68
+        $this->defaultiTunesAppId = $config->getSystemValue('customclient_ios_appid', '1125420102');
69
+        $this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client');
70
+        $this->defaultFDroidClientUrl = $config->getSystemValue('customclient_fdroid', 'https://f-droid.org/packages/com.nextcloud.client/');
71
+        $this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
72
+        $this->defaultDocVersion = \OC_Util::getVersion()[0]; // used to generate doc links
73
+        $this->defaultColorPrimary = '#0082c9';
74
+        $this->defaultTextColorPrimary = '#ffffff';
75
+        $this->defaultProductName = 'Nextcloud';
76 76
 
77
-		$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
78
-		if (file_exists($themePath)) {
79
-			// prevent defaults.php from printing output
80
-			ob_start();
81
-			require_once $themePath;
82
-			ob_end_clean();
83
-			if (class_exists('OC_Theme')) {
84
-				$this->theme = new OC_Theme();
85
-			}
86
-		}
87
-	}
77
+        $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
78
+        if (file_exists($themePath)) {
79
+            // prevent defaults.php from printing output
80
+            ob_start();
81
+            require_once $themePath;
82
+            ob_end_clean();
83
+            if (class_exists('OC_Theme')) {
84
+                $this->theme = new OC_Theme();
85
+            }
86
+        }
87
+    }
88 88
 
89
-	/**
90
-	 * @param string $method
91
-	 */
92
-	private function themeExist($method) {
93
-		if (isset($this->theme) && method_exists($this->theme, $method)) {
94
-			return true;
95
-		}
96
-		return false;
97
-	}
89
+    /**
90
+     * @param string $method
91
+     */
92
+    private function themeExist($method) {
93
+        if (isset($this->theme) && method_exists($this->theme, $method)) {
94
+            return true;
95
+        }
96
+        return false;
97
+    }
98 98
 
99
-	/**
100
-	 * Returns the base URL
101
-	 * @return string URL
102
-	 */
103
-	public function getBaseUrl() {
104
-		if ($this->themeExist('getBaseUrl')) {
105
-			return $this->theme->getBaseUrl();
106
-		} else {
107
-			return $this->defaultBaseUrl;
108
-		}
109
-	}
99
+    /**
100
+     * Returns the base URL
101
+     * @return string URL
102
+     */
103
+    public function getBaseUrl() {
104
+        if ($this->themeExist('getBaseUrl')) {
105
+            return $this->theme->getBaseUrl();
106
+        } else {
107
+            return $this->defaultBaseUrl;
108
+        }
109
+    }
110 110
 
111
-	/**
112
-	 * Returns the URL where the sync clients are listed
113
-	 * @return string URL
114
-	 */
115
-	public function getSyncClientUrl() {
116
-		if ($this->themeExist('getSyncClientUrl')) {
117
-			return $this->theme->getSyncClientUrl();
118
-		} else {
119
-			return $this->defaultSyncClientUrl;
120
-		}
121
-	}
111
+    /**
112
+     * Returns the URL where the sync clients are listed
113
+     * @return string URL
114
+     */
115
+    public function getSyncClientUrl() {
116
+        if ($this->themeExist('getSyncClientUrl')) {
117
+            return $this->theme->getSyncClientUrl();
118
+        } else {
119
+            return $this->defaultSyncClientUrl;
120
+        }
121
+    }
122 122
 
123
-	/**
124
-	 * Returns the URL to the App Store for the iOS Client
125
-	 * @return string URL
126
-	 */
127
-	public function getiOSClientUrl() {
128
-		if ($this->themeExist('getiOSClientUrl')) {
129
-			return $this->theme->getiOSClientUrl();
130
-		} else {
131
-			return $this->defaultiOSClientUrl;
132
-		}
133
-	}
123
+    /**
124
+     * Returns the URL to the App Store for the iOS Client
125
+     * @return string URL
126
+     */
127
+    public function getiOSClientUrl() {
128
+        if ($this->themeExist('getiOSClientUrl')) {
129
+            return $this->theme->getiOSClientUrl();
130
+        } else {
131
+            return $this->defaultiOSClientUrl;
132
+        }
133
+    }
134 134
 
135
-	/**
136
-	 * Returns the AppId for the App Store for the iOS Client
137
-	 * @return string AppId
138
-	 */
139
-	public function getiTunesAppId() {
140
-		if ($this->themeExist('getiTunesAppId')) {
141
-			return $this->theme->getiTunesAppId();
142
-		} else {
143
-			return $this->defaultiTunesAppId;
144
-		}
145
-	}
135
+    /**
136
+     * Returns the AppId for the App Store for the iOS Client
137
+     * @return string AppId
138
+     */
139
+    public function getiTunesAppId() {
140
+        if ($this->themeExist('getiTunesAppId')) {
141
+            return $this->theme->getiTunesAppId();
142
+        } else {
143
+            return $this->defaultiTunesAppId;
144
+        }
145
+    }
146 146
 
147
-	/**
148
-	 * Returns the URL to Google Play for the Android Client
149
-	 * @return string URL
150
-	 */
151
-	public function getAndroidClientUrl() {
152
-		if ($this->themeExist('getAndroidClientUrl')) {
153
-			return $this->theme->getAndroidClientUrl();
154
-		} else {
155
-			return $this->defaultAndroidClientUrl;
156
-		}
157
-	}
147
+    /**
148
+     * Returns the URL to Google Play for the Android Client
149
+     * @return string URL
150
+     */
151
+    public function getAndroidClientUrl() {
152
+        if ($this->themeExist('getAndroidClientUrl')) {
153
+            return $this->theme->getAndroidClientUrl();
154
+        } else {
155
+            return $this->defaultAndroidClientUrl;
156
+        }
157
+    }
158 158
 
159
-	/**
160
-	 * Returns the URL to Google Play for the Android Client
161
-	 * @return string URL
162
-	 */
163
-	public function getFDroidClientUrl() {
164
-		if ($this->themeExist('getFDroidClientUrl')) {
165
-			return $this->theme->getFDroidClientUrl();
166
-		} else {
167
-			return $this->defaultFDroidClientUrl;
168
-		}
169
-	}
159
+    /**
160
+     * Returns the URL to Google Play for the Android Client
161
+     * @return string URL
162
+     */
163
+    public function getFDroidClientUrl() {
164
+        if ($this->themeExist('getFDroidClientUrl')) {
165
+            return $this->theme->getFDroidClientUrl();
166
+        } else {
167
+            return $this->defaultFDroidClientUrl;
168
+        }
169
+    }
170 170
 
171
-	/**
172
-	 * Returns the documentation URL
173
-	 * @return string URL
174
-	 */
175
-	public function getDocBaseUrl() {
176
-		if ($this->themeExist('getDocBaseUrl')) {
177
-			return $this->theme->getDocBaseUrl();
178
-		} else {
179
-			return $this->defaultDocBaseUrl;
180
-		}
181
-	}
171
+    /**
172
+     * Returns the documentation URL
173
+     * @return string URL
174
+     */
175
+    public function getDocBaseUrl() {
176
+        if ($this->themeExist('getDocBaseUrl')) {
177
+            return $this->theme->getDocBaseUrl();
178
+        } else {
179
+            return $this->defaultDocBaseUrl;
180
+        }
181
+    }
182 182
 
183
-	/**
184
-	 * Returns the title
185
-	 * @return string title
186
-	 */
187
-	public function getTitle() {
188
-		if ($this->themeExist('getTitle')) {
189
-			return $this->theme->getTitle();
190
-		} else {
191
-			return $this->defaultTitle;
192
-		}
193
-	}
183
+    /**
184
+     * Returns the title
185
+     * @return string title
186
+     */
187
+    public function getTitle() {
188
+        if ($this->themeExist('getTitle')) {
189
+            return $this->theme->getTitle();
190
+        } else {
191
+            return $this->defaultTitle;
192
+        }
193
+    }
194 194
 
195
-	/**
196
-	 * Returns the short name of the software
197
-	 * @return string title
198
-	 */
199
-	public function getName() {
200
-		if ($this->themeExist('getName')) {
201
-			return $this->theme->getName();
202
-		} else {
203
-			return $this->defaultName;
204
-		}
205
-	}
195
+    /**
196
+     * Returns the short name of the software
197
+     * @return string title
198
+     */
199
+    public function getName() {
200
+        if ($this->themeExist('getName')) {
201
+            return $this->theme->getName();
202
+        } else {
203
+            return $this->defaultName;
204
+        }
205
+    }
206 206
 
207
-	/**
208
-	 * Returns the short name of the software containing HTML strings
209
-	 * @return string title
210
-	 */
211
-	public function getHTMLName() {
212
-		if ($this->themeExist('getHTMLName')) {
213
-			return $this->theme->getHTMLName();
214
-		} else {
215
-			return $this->defaultName;
216
-		}
217
-	}
207
+    /**
208
+     * Returns the short name of the software containing HTML strings
209
+     * @return string title
210
+     */
211
+    public function getHTMLName() {
212
+        if ($this->themeExist('getHTMLName')) {
213
+            return $this->theme->getHTMLName();
214
+        } else {
215
+            return $this->defaultName;
216
+        }
217
+    }
218 218
 
219
-	/**
220
-	 * Returns entity (e.g. company name) - used for footer, copyright
221
-	 * @return string entity name
222
-	 */
223
-	public function getEntity() {
224
-		if ($this->themeExist('getEntity')) {
225
-			return $this->theme->getEntity();
226
-		} else {
227
-			return $this->defaultEntity;
228
-		}
229
-	}
219
+    /**
220
+     * Returns entity (e.g. company name) - used for footer, copyright
221
+     * @return string entity name
222
+     */
223
+    public function getEntity() {
224
+        if ($this->themeExist('getEntity')) {
225
+            return $this->theme->getEntity();
226
+        } else {
227
+            return $this->defaultEntity;
228
+        }
229
+    }
230 230
 
231
-	/**
232
-	 * Returns slogan
233
-	 * @return string slogan
234
-	 */
235
-	public function getSlogan(?string $lang = null) {
236
-		if ($this->themeExist('getSlogan')) {
237
-			return $this->theme->getSlogan($lang);
238
-		} else {
239
-			if ($this->defaultSlogan === null) {
240
-				$l10n = \OC::$server->getL10N('lib', $lang);
241
-				$this->defaultSlogan = $l10n->t('a safe home for all your data');
242
-			}
243
-			return $this->defaultSlogan;
244
-		}
245
-	}
231
+    /**
232
+     * Returns slogan
233
+     * @return string slogan
234
+     */
235
+    public function getSlogan(?string $lang = null) {
236
+        if ($this->themeExist('getSlogan')) {
237
+            return $this->theme->getSlogan($lang);
238
+        } else {
239
+            if ($this->defaultSlogan === null) {
240
+                $l10n = \OC::$server->getL10N('lib', $lang);
241
+                $this->defaultSlogan = $l10n->t('a safe home for all your data');
242
+            }
243
+            return $this->defaultSlogan;
244
+        }
245
+    }
246 246
 
247
-	/**
248
-	 * Returns short version of the footer
249
-	 * @return string short footer
250
-	 */
251
-	public function getShortFooter() {
252
-		if ($this->themeExist('getShortFooter')) {
253
-			$footer = $this->theme->getShortFooter();
254
-		} else {
255
-			$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
256
-				' rel="noreferrer noopener">' .$this->getEntity() . '</a>'.
257
-				' – ' . $this->getSlogan();
258
-		}
247
+    /**
248
+     * Returns short version of the footer
249
+     * @return string short footer
250
+     */
251
+    public function getShortFooter() {
252
+        if ($this->themeExist('getShortFooter')) {
253
+            $footer = $this->theme->getShortFooter();
254
+        } else {
255
+            $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
256
+                ' rel="noreferrer noopener">' .$this->getEntity() . '</a>'.
257
+                ' – ' . $this->getSlogan();
258
+        }
259 259
 
260
-		return $footer;
261
-	}
260
+        return $footer;
261
+    }
262 262
 
263
-	/**
264
-	 * Returns long version of the footer
265
-	 * @return string long footer
266
-	 */
267
-	public function getLongFooter() {
268
-		if ($this->themeExist('getLongFooter')) {
269
-			$footer = $this->theme->getLongFooter();
270
-		} else {
271
-			$footer = $this->getShortFooter();
272
-		}
263
+    /**
264
+     * Returns long version of the footer
265
+     * @return string long footer
266
+     */
267
+    public function getLongFooter() {
268
+        if ($this->themeExist('getLongFooter')) {
269
+            $footer = $this->theme->getLongFooter();
270
+        } else {
271
+            $footer = $this->getShortFooter();
272
+        }
273 273
 
274
-		return $footer;
275
-	}
274
+        return $footer;
275
+    }
276 276
 
277
-	/**
278
-	 * @param string $key
279
-	 * @return string URL to doc with key
280
-	 */
281
-	public function buildDocLinkToKey($key) {
282
-		if ($this->themeExist('buildDocLinkToKey')) {
283
-			return $this->theme->buildDocLinkToKey($key);
284
-		}
285
-		return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
286
-	}
277
+    /**
278
+     * @param string $key
279
+     * @return string URL to doc with key
280
+     */
281
+    public function buildDocLinkToKey($key) {
282
+        if ($this->themeExist('buildDocLinkToKey')) {
283
+            return $this->theme->buildDocLinkToKey($key);
284
+        }
285
+        return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
286
+    }
287 287
 
288
-	/**
289
-	 * Returns primary color
290
-	 * @return string
291
-	 */
292
-	public function getColorPrimary() {
293
-		if ($this->themeExist('getColorPrimary')) {
294
-			return $this->theme->getColorPrimary();
295
-		}
296
-		if ($this->themeExist('getMailHeaderColor')) {
297
-			return $this->theme->getMailHeaderColor();
298
-		}
299
-		return $this->defaultColorPrimary;
300
-	}
288
+    /**
289
+     * Returns primary color
290
+     * @return string
291
+     */
292
+    public function getColorPrimary() {
293
+        if ($this->themeExist('getColorPrimary')) {
294
+            return $this->theme->getColorPrimary();
295
+        }
296
+        if ($this->themeExist('getMailHeaderColor')) {
297
+            return $this->theme->getMailHeaderColor();
298
+        }
299
+        return $this->defaultColorPrimary;
300
+    }
301 301
 
302
-	/**
303
-	 * @return array scss variables to overwrite
304
-	 */
305
-	public function getScssVariables() {
306
-		if ($this->themeExist('getScssVariables')) {
307
-			return $this->theme->getScssVariables();
308
-		}
309
-		return [];
310
-	}
302
+    /**
303
+     * @return array scss variables to overwrite
304
+     */
305
+    public function getScssVariables() {
306
+        if ($this->themeExist('getScssVariables')) {
307
+            return $this->theme->getScssVariables();
308
+        }
309
+        return [];
310
+    }
311 311
 
312
-	public function shouldReplaceIcons() {
313
-		return false;
314
-	}
312
+    public function shouldReplaceIcons() {
313
+        return false;
314
+    }
315 315
 
316
-	/**
317
-	 * Themed logo url
318
-	 *
319
-	 * @param bool $useSvg Whether to point to the SVG image or a fallback
320
-	 * @return string
321
-	 */
322
-	public function getLogo($useSvg = true) {
323
-		if ($this->themeExist('getLogo')) {
324
-			return $this->theme->getLogo($useSvg);
325
-		}
316
+    /**
317
+     * Themed logo url
318
+     *
319
+     * @param bool $useSvg Whether to point to the SVG image or a fallback
320
+     * @return string
321
+     */
322
+    public function getLogo($useSvg = true) {
323
+        if ($this->themeExist('getLogo')) {
324
+            return $this->theme->getLogo($useSvg);
325
+        }
326 326
 
327
-		if ($useSvg) {
328
-			$logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo/logo.svg');
329
-		} else {
330
-			$logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo/logo.png');
331
-		}
332
-		return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion()));
333
-	}
327
+        if ($useSvg) {
328
+            $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo/logo.svg');
329
+        } else {
330
+            $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo/logo.png');
331
+        }
332
+        return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion()));
333
+    }
334 334
 
335
-	public function getTextColorPrimary() {
336
-		if ($this->themeExist('getTextColorPrimary')) {
337
-			return $this->theme->getTextColorPrimary();
338
-		}
339
-		return $this->defaultTextColorPrimary;
340
-	}
335
+    public function getTextColorPrimary() {
336
+        if ($this->themeExist('getTextColorPrimary')) {
337
+            return $this->theme->getTextColorPrimary();
338
+        }
339
+        return $this->defaultTextColorPrimary;
340
+    }
341 341
 
342
-	public function getProductName() {
343
-		if ($this->themeExist('getProductName')) {
344
-			return $this->theme->getProductName();
345
-		}
346
-		return $this->defaultProductName;
347
-	}
342
+    public function getProductName() {
343
+        if ($this->themeExist('getProductName')) {
344
+            return $this->theme->getProductName();
345
+        }
346
+        return $this->defaultProductName;
347
+    }
348 348
 }
Please login to merge, or discard this patch.