Defaults.php 4.5 KB

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