defaults.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 $defaultEntity;
  12. private $defaultName;
  13. private $defaultTitle;
  14. private $defaultBaseUrl;
  15. private $defaultSyncClientUrl;
  16. private $defaultDocBaseUrl;
  17. private $defaultSlogan;
  18. private $defaultLogoClaim;
  19. function __construct() {
  20. $l = OC_L10N::get('core');
  21. $this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */
  22. $this->defaultName = "ownCloud"; /* short name, used when referring to the software */
  23. $this->defaultTitle = "ownCloud"; /* can be a longer name, for titles */
  24. $this->defaultBaseUrl = "http://owncloud.org";
  25. $this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
  26. $this->defaultDocBaseUrl = "http://doc.owncloud.org";
  27. $this->defaultSlogan = $l->t("web services under your control");
  28. $this->defaultLogoClaim = "";
  29. if (class_exists("OC_Theme")) {
  30. $this->theme = new OC_Theme();
  31. }
  32. }
  33. private function themeExist($method) {
  34. if (OC_Util::getTheme() !== '' && method_exists('OC_Theme', $method)) {
  35. return true;
  36. }
  37. return false;
  38. }
  39. public function getBaseUrl() {
  40. if ($this->themeExist('getBaseUrl')) {
  41. return $this->theme->getBaseUrl();
  42. } else {
  43. return $this->defaultBaseUrl;
  44. }
  45. }
  46. public function getSyncClientUrl() {
  47. if ($this->themeExist('getSyncClientUrl')) {
  48. return $this->theme->getSyncClientUrl();
  49. } else {
  50. return $this->defaultSyncClientUrl;
  51. }
  52. }
  53. public function getDocBaseUrl() {
  54. if ($this->themeExist('getDocBaseUrl')) {
  55. return $this->theme->getDocBaseUrl();
  56. } else {
  57. return $this->defaultDocBaseUrl;
  58. }
  59. }
  60. public function getTitle() {
  61. if ($this->themeExist('getTitle')) {
  62. return $this->theme->getTitle();
  63. } else {
  64. return $this->defaultTitle;
  65. }
  66. }
  67. public function getName() {
  68. if ($this->themeExist('getName')) {
  69. return $this->theme->getName();
  70. } else {
  71. return $this->defaultName;
  72. }
  73. }
  74. public function getEntity() {
  75. if ($this->themeExist('getEntity')) {
  76. return $this->theme->getEntity();
  77. } else {
  78. return $this->defaultEntity;
  79. }
  80. }
  81. public function getSlogan() {
  82. if ($this->themeExist('getSlogan')) {
  83. return $this->theme->getSlogan();
  84. } else {
  85. return $this->defaultSlogan;
  86. }
  87. }
  88. public function getLogoClaim() {
  89. if ($this->themeExist('getLogoClaim')) {
  90. return $this->theme->getLogoClaim();
  91. } else {
  92. return $this->defaultLogoClaim;
  93. }
  94. }
  95. public function getShortFooter() {
  96. if ($this->themeExist('getShortFooter')) {
  97. $footer = $this->theme->getShortFooter();
  98. } else {
  99. $footer = "<a href=\"". $this->getBaseUrl() . "\" target=\"_blank\">" .$this->getEntity() . "</a>".
  100. ' – ' . $this->getSlogan();
  101. }
  102. return $footer;
  103. }
  104. public function getLongFooter() {
  105. if ($this->themeExist('getLongFooter')) {
  106. $footer = $this->theme->getLongFooter();
  107. } else {
  108. $footer = $this->getShortFooter();
  109. }
  110. return $footer;
  111. }
  112. }