1
0

Defaults.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. * @deprecated 13.0.0
  132. */
  133. public function getLogoClaim() {
  134. return '';
  135. }
  136. /**
  137. * footer, short version
  138. * @return string
  139. * @since 6.0.0
  140. */
  141. public function getShortFooter() {
  142. return $this->defaults->getShortFooter();
  143. }
  144. /**
  145. * footer, long version
  146. * @return string
  147. * @since 6.0.0
  148. */
  149. public function getLongFooter() {
  150. return $this->defaults->getLongFooter();
  151. }
  152. /**
  153. * Returns the AppId for the App Store for the iOS Client
  154. * @return string AppId
  155. * @since 8.0.0
  156. */
  157. public function getiTunesAppId() {
  158. return $this->defaults->getiTunesAppId();
  159. }
  160. /**
  161. * Themed logo url
  162. *
  163. * @param bool $useSvg Whether to point to the SVG image or a fallback
  164. * @return string
  165. * @since 12.0.0
  166. */
  167. public function getLogo($useSvg = true) {
  168. return $this->defaults->getLogo($useSvg);
  169. }
  170. /**
  171. * Returns primary color
  172. * @return string
  173. * @since 12.0.0
  174. */
  175. public function getColorPrimary() {
  176. return $this->defaults->getColorPrimary();
  177. }
  178. /**
  179. * @param string $key
  180. * @return string URL to doc with key
  181. * @since 12.0.0
  182. */
  183. public function buildDocLinkToKey($key) {
  184. return $this->defaults->buildDocLinkToKey($key);
  185. }
  186. /**
  187. * Returns the title
  188. * @return string title
  189. * @since 12.0.0
  190. */
  191. public function getTitle() {
  192. return $this->defaults->getTitle();
  193. }
  194. /**
  195. * Returns primary color
  196. * @return string
  197. * @since 13.0.0
  198. */
  199. public function getTextColorPrimary() {
  200. return $this->defaults->getTextColorPrimary();
  201. }
  202. }