Blame view

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

31b7f2792   Kload   Upgrade to ownclo...
26
27
28
  		$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
29
30
31
  		$this->defaultBaseUrl = "http://owncloud.org";
  		$this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
  		$this->defaultDocBaseUrl = "http://doc.owncloud.org";
31b7f2792   Kload   Upgrade to ownclo...
32
  		$this->defaultSlogan = $this->l->t("web services under your control");
03e52840d   Kload   Init
33
34
35
36
37
38
39
40
41
42
43
44
45
  		$this->defaultLogoClaim = "";
  
  		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...
46
47
48
49
  	/**
  	 * Returns the base URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
50
51
52
53
54
55
56
  	public function getBaseUrl() {
  		if ($this->themeExist('getBaseUrl')) {
  			return $this->theme->getBaseUrl();
  		} else {
  			return $this->defaultBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
57
58
59
60
  	/**
  	 * Returns the URL where the sync clients are listed
  	 * @return string URL
  	 */
03e52840d   Kload   Init
61
62
63
64
65
66
67
  	public function getSyncClientUrl() {
  		if ($this->themeExist('getSyncClientUrl')) {
  			return $this->theme->getSyncClientUrl();
  		} else {
  			return $this->defaultSyncClientUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
68
69
70
71
  	/**
  	 * Returns the documentation URL
  	 * @return string URL
  	 */
03e52840d   Kload   Init
72
73
74
75
76
77
78
  	public function getDocBaseUrl() {
  		if ($this->themeExist('getDocBaseUrl')) {
  			return $this->theme->getDocBaseUrl();
  		} else {
  			return $this->defaultDocBaseUrl;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  	/**
  	 * 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
95
96
97
98
99
100
101
  	public function getName() {
  		if ($this->themeExist('getName')) {
  			return $this->theme->getName();
  		} else {
  			return $this->defaultName;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
102
103
104
105
  	/**
  	 * Returns entity (e.g. company name) - used for footer, copyright
  	 * @return string entity name
  	 */
03e52840d   Kload   Init
106
107
108
109
110
111
112
  	public function getEntity() {
  		if ($this->themeExist('getEntity')) {
  			return $this->theme->getEntity();
  		} else {
  			return $this->defaultEntity;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
113
114
115
116
  	/**
  	 * Returns slogan
  	 * @return string slogan
  	 */
03e52840d   Kload   Init
117
118
119
120
121
122
123
  	public function getSlogan() {
  		if ($this->themeExist('getSlogan')) {
  			return $this->theme->getSlogan();
  		} else {
  			return $this->defaultSlogan;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
124
125
126
127
  	/**
  	 * Returns logo claim
  	 * @return string logo claim
  	 */
03e52840d   Kload   Init
128
129
130
131
132
133
134
  	public function getLogoClaim() {
  		if ($this->themeExist('getLogoClaim')) {
  			return $this->theme->getLogoClaim();
  		} else {
  			return $this->defaultLogoClaim;
  		}
  	}
31b7f2792   Kload   Upgrade to ownclo...
135
136
137
138
  	/**
  	 * Returns short version of the footer
  	 * @return string short footer
  	 */
03e52840d   Kload   Init
139
140
141
142
143
144
145
146
147
148
  	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...
149
150
151
152
  	/**
  	 * Returns long version of the footer
  	 * @return string long footer
  	 */
03e52840d   Kload   Init
153
154
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;
  	}
  
  }