defaults.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * Default strings and values which differ between the enterprise and the
  4. * community edition. Use the get methods to always get the right strings.
  5. */
  6. if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
  7. require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
  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. public function getBaseUrl() {
  41. if ($this->themeExist('getBaseUrl')) {
  42. return $this->theme->getBaseUrl();
  43. } else {
  44. return $this->defaultBaseUrl;
  45. }
  46. }
  47. public function getSyncClientUrl() {
  48. if ($this->themeExist('getSyncClientUrl')) {
  49. return $this->theme->getSyncClientUrl();
  50. } else {
  51. return $this->defaultSyncClientUrl;
  52. }
  53. }
  54. public function getDocBaseUrl() {
  55. if ($this->themeExist('getDocBaseUrl')) {
  56. return $this->theme->getDocBaseUrl();
  57. } else {
  58. return $this->defaultDocBaseUrl;
  59. }
  60. }
  61. public function getTitle() {
  62. if ($this->themeExist('getTitle')) {
  63. return $this->theme->getTitle();
  64. } else {
  65. return $this->defaultTitle;
  66. }
  67. }
  68. public function getName() {
  69. if ($this->themeExist('getName')) {
  70. return $this->theme->getName();
  71. } else {
  72. return $this->defaultName;
  73. }
  74. }
  75. public function getEntity() {
  76. if ($this->themeExist('getEntity')) {
  77. return $this->theme->getEntity();
  78. } else {
  79. return $this->defaultEntity;
  80. }
  81. }
  82. public function getSlogan() {
  83. if ($this->themeExist('getSlogan')) {
  84. return $this->theme->getSlogan();
  85. } else {
  86. return $this->defaultSlogan;
  87. }
  88. }
  89. public function getLogoClaim() {
  90. if ($this->themeExist('getLogoClaim')) {
  91. return $this->theme->getLogoClaim();
  92. } else {
  93. return $this->defaultLogoClaim;
  94. }
  95. }
  96. public function getShortFooter() {
  97. if ($this->themeExist('getShortFooter')) {
  98. $footer = $this->theme->getShortFooter();
  99. } else {
  100. $footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
  101. ' – ' . $this->getSlogan();
  102. }
  103. return $footer;
  104. }
  105. public function getLongFooter() {
  106. if ($this->themeExist('getLongFooter')) {
  107. $footer = $this->theme->getLongFooter();
  108. } else {
  109. $footer = $this->getShortFooter();
  110. }
  111. return $footer;
  112. }
  113. }