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.

defaults.php 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
  3. require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
  4. }
  5. /**
  6. * Default strings and values which differ between the enterprise and the
  7. * community edition. Use the get methods to always get the right strings.
  8. */
  9. class OC_Defaults {
  10. private $theme;
  11. private $l;
  12. private $defaultEntity;
  13. private $defaultName;
  14. private $defaultTitle;
  15. private $defaultBaseUrl;
  16. private $defaultSyncClientUrl;
  17. private $defaultDocBaseUrl;
  18. private $defaultSlogan;
  19. private $defaultLogoClaim;
  20. private $defaultMailHeaderColor;
  21. function __construct() {
  22. $this->l = OC_L10N::get('core');
  23. $this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */
  24. $this->defaultName = "ownCloud"; /* short name, used when referring to the software */
  25. $this->defaultTitle = "ownCloud"; /* can be a longer name, for titles */
  26. $this->defaultBaseUrl = "https://owncloud.org";
  27. $this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/";
  28. $this->defaultDocBaseUrl = "http://doc.owncloud.org";
  29. $this->defaultSlogan = $this->l->t("web services under your control");
  30. $this->defaultLogoClaim = "";
  31. $this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */
  32. if (class_exists("OC_Theme")) {
  33. $this->theme = new OC_Theme();
  34. }
  35. }
  36. /**
  37. * @param string $method
  38. */
  39. private function themeExist($method) {
  40. if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) {
  41. return true;
  42. }
  43. return false;
  44. }
  45. /**
  46. * Returns the base URL
  47. * @return string URL
  48. */
  49. public function getBaseUrl() {
  50. if ($this->themeExist('getBaseUrl')) {
  51. return $this->theme->getBaseUrl();
  52. } else {
  53. return $this->defaultBaseUrl;
  54. }
  55. }
  56. /**
  57. * Returns the URL where the sync clients are listed
  58. * @return string URL
  59. */
  60. public function getSyncClientUrl() {
  61. if ($this->themeExist('getSyncClientUrl')) {
  62. return $this->theme->getSyncClientUrl();
  63. } else {
  64. return $this->defaultSyncClientUrl;
  65. }
  66. }
  67. /**
  68. * Returns the documentation URL
  69. * @return string URL
  70. */
  71. public function getDocBaseUrl() {
  72. if ($this->themeExist('getDocBaseUrl')) {
  73. return $this->theme->getDocBaseUrl();
  74. } else {
  75. return $this->defaultDocBaseUrl;
  76. }
  77. }
  78. /**
  79. * Returns the title
  80. * @return string title
  81. */
  82. public function getTitle() {
  83. if ($this->themeExist('getTitle')) {
  84. return $this->theme->getTitle();
  85. } else {
  86. return $this->defaultTitle;
  87. }
  88. }
  89. /**
  90. * Returns the short name of the software
  91. * @return string title
  92. */
  93. public function getName() {
  94. if ($this->themeExist('getName')) {
  95. return $this->theme->getName();
  96. } else {
  97. return $this->defaultName;
  98. }
  99. }
  100. /**
  101. * Returns entity (e.g. company name) - used for footer, copyright
  102. * @return string entity name
  103. */
  104. public function getEntity() {
  105. if ($this->themeExist('getEntity')) {
  106. return $this->theme->getEntity();
  107. } else {
  108. return $this->defaultEntity;
  109. }
  110. }
  111. /**
  112. * Returns slogan
  113. * @return string slogan
  114. */
  115. public function getSlogan() {
  116. if ($this->themeExist('getSlogan')) {
  117. return $this->theme->getSlogan();
  118. } else {
  119. return $this->defaultSlogan;
  120. }
  121. }
  122. /**
  123. * Returns logo claim
  124. * @return string logo claim
  125. */
  126. public function getLogoClaim() {
  127. if ($this->themeExist('getLogoClaim')) {
  128. return $this->theme->getLogoClaim();
  129. } else {
  130. return $this->defaultLogoClaim;
  131. }
  132. }
  133. /**
  134. * Returns short version of the footer
  135. * @return string short footer
  136. */
  137. public function getShortFooter() {
  138. if ($this->themeExist('getShortFooter')) {
  139. $footer = $this->theme->getShortFooter();
  140. } else {
  141. $footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
  142. ' – ' . $this->getSlogan();
  143. }
  144. return $footer;
  145. }
  146. /**
  147. * Returns long version of the footer
  148. * @return string long footer
  149. */
  150. public function getLongFooter() {
  151. if ($this->themeExist('getLongFooter')) {
  152. $footer = $this->theme->getLongFooter();
  153. } else {
  154. $footer = $this->getShortFooter();
  155. }
  156. return $footer;
  157. }
  158. public function buildDocLinkToKey($key) {
  159. if ($this->themeExist('buildDocLinkToKey')) {
  160. return $this->theme->buildDocLinkToKey($key);
  161. }
  162. return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
  163. }
  164. /**
  165. * Returns mail header color
  166. * @return mail header color
  167. */
  168. public function getMailHeaderColor() {
  169. if ($this->themeExist('getMailHeaderColor')) {
  170. return $this->theme->getMailHeaderColor();
  171. } else {
  172. return $this->defaultMailHeaderColor;
  173. }
  174. }
  175. }