Blame view

sources/lib/private/defaults.php 4.47 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
19
20
21
  	private $defaultBaseUrl;
  	private $defaultSyncClientUrl;
  	private $defaultDocBaseUrl;
  	private $defaultSlogan;
  	private $defaultLogoClaim;
837968727   Kload   [enh] Upgrade to ...
22
  	private $defaultMailHeaderColor;
03e52840d   Kload   Init
23
24
  
  	function __construct() {
31b7f2792   Kload   Upgrade to ownclo...
25
  		$this->l = OC_L10N::get('core');
03e52840d   Kload   Init
26

31b7f2792   Kload   Upgrade to ownclo...
27
28
29
  		$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 */
03e52840d   Kload   Init
30
31
32
  		$this->defaultBaseUrl = "http://owncloud.org";
  		$this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
  		$this->defaultDocBaseUrl = "http://doc.owncloud.org";
31b7f2792   Kload   Upgrade to ownclo...
33
  		$this->defaultSlogan = $this->l->t("web services under your control");
03e52840d   Kload   Init
34
  		$this->defaultLogoClaim = "";
837968727   Kload   [enh] Upgrade to ...
35
  		$this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */
03e52840d   Kload   Init
36
37
38
39
40
41
42
43
44
45
46
47
  
  		if (class_exists("OC_Theme")) {
  			$this->theme = new OC_Theme();
  		}
  	}
  
  	private function themeExist($method) {
  		if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) {
  			return true;
  		}
  		return false;
  	}
31b7f2792   Kload   Upgrade to ownclo...
48
49
50
51
  	/**
  	 * Returns the base URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
52
53
54
55
56
57
58
  	public function getBaseUrl() {
  		if ($this->themeExist('getBaseUrl')) {
  			return $this->theme->getBaseUrl();
  		} else {
  			return $this->defaultBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
59
60
61
62
  	/**
  	 * Returns the URL where the sync clients are listed
  	 * @return string URL
  	 */
03e52840d   Kload   Init
63
64
65
66
67
68
69
  	public function getSyncClientUrl() {
  		if ($this->themeExist('getSyncClientUrl')) {
  			return $this->theme->getSyncClientUrl();
  		} else {
  			return $this->defaultSyncClientUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
70
71
72
73
  	/**
  	 * Returns the documentation URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
74
75
76
77
78
79
80
  	public function getDocBaseUrl() {
  		if ($this->themeExist('getDocBaseUrl')) {
  			return $this->theme->getDocBaseUrl();
  		} else {
  			return $this->defaultDocBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  	/**
  	 * 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
97
98
99
100
101
102
103
  	public function getName() {
  		if ($this->themeExist('getName')) {
  			return $this->theme->getName();
  		} else {
  			return $this->defaultName;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
104
105
106
107
  	/**
  	 * Returns entity (e.g. company name) - used for footer, copyright
  	 * @return string entity name
  	 */
03e52840d   Kload   Init
108
109
110
111
112
113
114
  	public function getEntity() {
  		if ($this->themeExist('getEntity')) {
  			return $this->theme->getEntity();
  		} else {
  			return $this->defaultEntity;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
115
116
117
118
  	/**
  	 * Returns slogan
  	 * @return string slogan
  	 */
03e52840d   Kload   Init
119
120
121
122
123
124
125
  	public function getSlogan() {
  		if ($this->themeExist('getSlogan')) {
  			return $this->theme->getSlogan();
  		} else {
  			return $this->defaultSlogan;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
126
127
128
129
  	/**
  	 * Returns logo claim
  	 * @return string logo claim
  	 */
03e52840d   Kload   Init
130
131
132
133
134
135
136
  	public function getLogoClaim() {
  		if ($this->themeExist('getLogoClaim')) {
  			return $this->theme->getLogoClaim();
  		} else {
  			return $this->defaultLogoClaim;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
137
138
139
140
  	/**
  	 * Returns short version of the footer
  	 * @return string short footer
  	 */
03e52840d   Kload   Init
141
142
143
144
145
146
147
148
149
150
  	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   Kload   Upgrade to ownclo...
151
152
153
154
  	/**
  	 * Returns long version of the footer
  	 * @return string long footer
  	 */
03e52840d   Kload   Init
155
156
157
158
159
160
161
162
163
  	public function getLongFooter() {
  		if ($this->themeExist('getLongFooter')) {
  			$footer = $this->theme->getLongFooter();
  		} else {
  			$footer = $this->getShortFooter();
  		}
  
  		return $footer;
  	}
a293d369c   Kload   Update sources to...
164
165
166
167
168
169
  	public function buildDocLinkToKey($key) {
  		if ($this->themeExist('buildDocLinkToKey')) {
  			return $this->theme->buildDocLinkToKey($key);
  		}
  		return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
  	}
837968727   Kload   [enh] Upgrade to ...
170
171
172
173
174
175
176
177
178
179
180
  	/**
  	 * Returns mail header color
  	 * @return mail header color
  	 */
  	public function getMailHeaderColor() {
  		if ($this->themeExist('getMailHeaderColor')) {
  			return $this->theme->getMailHeaderColor();
  		} else {
  			return $this->defaultMailHeaderColor;
  		}
  	}
03e52840d   Kload   Init
181
  }