You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

227 lines
4.7 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Björn Schießle <bjoern@schiessle.org>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author scolebrook <scolebrook@mac.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. /**
  28. * Public interface of ownCloud for apps to use.
  29. * Defaults Class
  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. namespace OCP;
  35. /**
  36. * public api to access default strings and urls for your templates
  37. * @since 6.0.0
  38. */
  39. class Defaults {
  40. /**
  41. * \OC_Defaults instance to retrieve the defaults
  42. * @since 6.0.0
  43. */
  44. private $defaults;
  45. /**
  46. * creates a \OC_Defaults instance which is used in all methods to retrieve the
  47. * actual defaults
  48. * @since 6.0.0
  49. */
  50. public function __construct(\OC_Defaults $defaults = null) {
  51. if ($defaults === null) {
  52. $defaults = \OC::$server->getThemingDefaults();
  53. }
  54. $this->defaults = $defaults;
  55. }
  56. /**
  57. * get base URL for the organisation behind your ownCloud instance
  58. * @return string
  59. * @since 6.0.0
  60. */
  61. public function getBaseUrl() {
  62. return $this->defaults->getBaseUrl();
  63. }
  64. /**
  65. * link to the desktop sync client
  66. * @return string
  67. * @since 6.0.0
  68. */
  69. public function getSyncClientUrl() {
  70. return $this->defaults->getSyncClientUrl();
  71. }
  72. /**
  73. * link to the iOS client
  74. * @return string
  75. * @since 8.0.0
  76. */
  77. public function getiOSClientUrl() {
  78. return $this->defaults->getiOSClientUrl();
  79. }
  80. /**
  81. * link to the Android client
  82. * @return string
  83. * @since 8.0.0
  84. */
  85. public function getAndroidClientUrl() {
  86. return $this->defaults->getAndroidClientUrl();
  87. }
  88. /**
  89. * base URL to the documentation of your ownCloud instance
  90. * @return string
  91. * @since 6.0.0
  92. */
  93. public function getDocBaseUrl() {
  94. return $this->defaults->getDocBaseUrl();
  95. }
  96. /**
  97. * name of your ownCloud instance
  98. * @return string
  99. * @since 6.0.0
  100. */
  101. public function getName() {
  102. return $this->defaults->getName();
  103. }
  104. /**
  105. * name of your ownCloud instance containing HTML styles
  106. * @return string
  107. * @since 8.0.0
  108. */
  109. public function getHTMLName() {
  110. return $this->defaults->getHTMLName();
  111. }
  112. /**
  113. * Entity behind your onwCloud instance
  114. * @return string
  115. * @since 6.0.0
  116. */
  117. public function getEntity() {
  118. return $this->defaults->getEntity();
  119. }
  120. /**
  121. * ownCloud slogan
  122. * @return string
  123. * @since 6.0.0
  124. */
  125. public function getSlogan(?string $lang = null) {
  126. return $this->defaults->getSlogan($lang);
  127. }
  128. /**
  129. * logo claim
  130. * @return string
  131. * @since 6.0.0
  132. * @deprecated 13.0.0
  133. */
  134. public function getLogoClaim() {
  135. return '';
  136. }
  137. /**
  138. * footer, short version
  139. * @return string
  140. * @since 6.0.0
  141. */
  142. public function getShortFooter() {
  143. return $this->defaults->getShortFooter();
  144. }
  145. /**
  146. * footer, long version
  147. * @return string
  148. * @since 6.0.0
  149. */
  150. public function getLongFooter() {
  151. return $this->defaults->getLongFooter();
  152. }
  153. /**
  154. * Returns the AppId for the App Store for the iOS Client
  155. * @return string AppId
  156. * @since 8.0.0
  157. */
  158. public function getiTunesAppId() {
  159. return $this->defaults->getiTunesAppId();
  160. }
  161. /**
  162. * Themed logo url
  163. *
  164. * @param bool $useSvg Whether to point to the SVG image or a fallback
  165. * @return string
  166. * @since 12.0.0
  167. */
  168. public function getLogo($useSvg = true) {
  169. return $this->defaults->getLogo($useSvg);
  170. }
  171. /**
  172. * Returns primary color
  173. * @return string
  174. * @since 12.0.0
  175. */
  176. public function getColorPrimary() {
  177. return $this->defaults->getColorPrimary();
  178. }
  179. /**
  180. * @param string $key
  181. * @return string URL to doc with key
  182. * @since 12.0.0
  183. */
  184. public function buildDocLinkToKey($key) {
  185. return $this->defaults->buildDocLinkToKey($key);
  186. }
  187. /**
  188. * Returns the title
  189. * @return string title
  190. * @since 12.0.0
  191. */
  192. public function getTitle() {
  193. return $this->defaults->getTitle();
  194. }
  195. /**
  196. * Returns primary color
  197. * @return string
  198. * @since 13.0.0
  199. */
  200. public function getTextColorPrimary() {
  201. return $this->defaults->getTextColorPrimary();
  202. }
  203. }