defaults.php 3.9 KB

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