]> source.dussan.org Git - nextcloud-server.git/commitdiff
lib/defaults.php should only contain the default strings and read the other strings...
authorBjörn Schießle <schiessle@owncloud.com>
Thu, 27 Jun 2013 14:24:03 +0000 (16:24 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Mon, 1 Jul 2013 08:46:27 +0000 (10:46 +0200)
lib/defaults.php

index 9043c04e7b60f27c76f1195d25f8789bc6f5c80a..ba2b2b93ee2d37305dfc7870d13776ce2c930522 100644 (file)
@@ -5,91 +5,97 @@
  * community edition. Use the get methods to always get the right strings.
  */
 
+if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
+       require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
+}
+
 class OC_Defaults {
 
-       private static $communityEntity = "ownCloud";
-       private static $communityName = "ownCloud";
-       private static $communityBaseUrl = "http://owncloud.org";
-       private static $communitySyncClientUrl = " http://owncloud.org/sync-clients/";
-       private static $communityDocBaseUrl = "http://doc.owncloud.org";
-       private static $communitySlogan = "web services under your control";
+       private static $defaultEntity = "ownCloud";
+       private static $defaultName = "ownCloud";
+       private static $defaultBaseUrl = "http://owncloud.org";
+       private static $defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
+       private static $defaultDocBaseUrl = "http://doc.owncloud.org";
+       private static $defaultSlogan = "web services under your control";
 
-       private static $enterpriseEntity = "ownCloud Inc.";
-       private static $enterpriseName = "ownCloud Enterprise Edition";
-       private static $enterpriseBaseUrl = "https://owncloud.com";
-       private static $enterpriseDocBaseUrl = "http://doc.owncloud.com";
-       private static $enterpiseSyncClientUrl = "https://owncloud.com/products/desktop-clients";
-       private static $enterpriseSlogan = "Your Cloud, Your Data, Your Way!";
+       private function themeExist($method) {
+               if (OC_Util::getTheme() !== '' &&
+                       //class_exists('OC_Theme') &&
+                       method_exists('OC_Theme', $method)) {
 
+                       return true;
+               }
+
+               return false;
+       }
 
        public static function getBaseUrl() {
-               if (OC_Util::getEditionString() === '') {
-                       return self::$communityBaseUrl;
+               if (self::themeExist('getBaseUrl')) {
+                       return OC_Theme::getBaseUrl();
                } else {
-                       return self::$enterpriseBaseUrl;
+                       return self::$defaultBaseUrl;
                }
        }
 
        public static function getSyncClientUrl() {
-               if (OC_Util::getEditionString() === '') {
-                       return self::$communitySyncClientUrl;
+               if (self::themeExist('getSyncClientUrl')) {
+                       return OC_Theme::getSyncClientUrl();
                } else {
-                       return self::$enterpiseSyncClientUrl;
+                       return self::$defaultSyncClientUrl;
                }
        }
 
        public static function getDocBaseUrl() {
-               if (OC_Util::getEditionString() === '') {
-                       return self::$communityDocBaseUrl;
+               if (self::themeExist('getDocBaseUrl')) {
+                       return OC_Theme::getDocBaseUrl();
                } else {
-                       return self::$enterpriseDocBaseUrl;
+                       return self::$defaultDocBaseUrl;
                }
        }
 
        public static function getName() {
-               if (OC_Util::getEditionString() === '') {
-                       return self::$communityName;
+               if (self::themeExist('getName')) {
+                       return OC_Theme::getName();
                } else {
-                       return self::$enterpriseName;
+                       return self::$defaultName;
                }
        }
 
        public static function getEntity() {
-               if (OC_Util::getEditionString() === '') {
-                       return self::$communityEntity;
+               if (self::themeExist('getEntity')) {
+                       return OC_Theme::getEntity();
                } else {
-                       return self::$enterpriseEntity;
+                       return self::$defaultEntity;
                }
        }
 
        public static function getSlogan() {
                $l = OC_L10N::get('core');
-               if (OC_Util::getEditionString() === '') {
-                       return $l->t(self::$communitySlogan);
+               if (self::themeExist('getSlogan')) {
+                       return OC_Theme::getSlogan();
                } else {
-                       return self::$enterpriseSlogan;
+                       return $l->t(self::$defaultSlogan);
                }
        }
 
        public static function getShortFooter() {
-               if (OC_Util::getEditionString() === '') {
+               if (self::themeExist('getShortFooter')) {
+                       $footer = OC_Theme::getShortFooter();
+               } else {
                        $footer = "<a href=\"". self::getBaseUrl() . "\" target=\"_blank\">" .self::getEntity() . "</a>".
                                ' – ' . self::getSlogan();
-               } else {
-                       $footer = "© 2013 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>".
-                               " – " . self::getSlogan();
                }
 
                return $footer;
        }
 
        public static function getLongFooter() {
-               if (OC_Util::getEditionString() === '') {
-                       $footer = self::getShortFooter();
+               if (self::themeExist('getLongFooter')) {
+                       $footer = OC_Theme::getLongFooter();
                } else {
-                       $footer = "© 2013 <a href=\"".self::getBaseUrl()."\" target=\"_blank\">".self::getEntity()."</a>".
-                               "<br/>" . self::getSlogan();
+                       $footer = self::getShortFooter();
                }
+
                return $footer;
        }