Author:   Lars Michelsen <[email protected]>
Date:     Tue Aug 23 23:36:03 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Tue Aug 23 23:36:03 2011 +0200

Removed getLang() from GlobalCore class

---

 .../nagvis-js/classes/NagVisHeaderMenu.php         |    7 +++----
 share/server/core/classes/GlobalCore.php           |   10 ----------
 share/server/core/classes/NagVisContextMenu.php    |    3 ++-
 share/server/core/classes/NagVisHoverMenu.php      |    4 ++--
 share/server/core/functions/i18n.php               |    5 +++++
 5 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php 
b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
index b8c7bf4..ce36402 100644
--- a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
+++ b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
@@ -270,9 +270,8 @@ class NagVisHeaderMenu {
      * @author Lars Michelsen <[email protected]>
      */
     private function getDocLanguage() {
-       $lang = $this->CORE->getLang()->getCurrentLanguage();
-        if(in_array($lang, $this->CORE->getAvailableDocs()))
-           return $lang;
+        if(in_array(curLang(), $this->CORE->getAvailableDocs()))
+           return curLang();
        else
            return 'en_US';
     }
@@ -297,7 +296,7 @@ class NagVisHeaderMenu {
             'langSearch'         => l('Search'),
             'langUserMgmt'       => l('Manage Users'),
             'langManageRoles'    => l('Manage Roles'),
-            'currentLanguage'    => 
$this->CORE->getLang()->getCurrentLanguage(),
+            'currentLanguage'    => curLang(),
            'docLanguage'        => $this->getDocLanguage(),
             'langChooseLanguage' => l('Choose Language'),
             'langUser' => l('User menu'),
diff --git a/share/server/core/classes/GlobalCore.php 
b/share/server/core/classes/GlobalCore.php
index c85b57b..ab616e9 100644
--- a/share/server/core/classes/GlobalCore.php
+++ b/share/server/core/classes/GlobalCore.php
@@ -70,16 +70,6 @@ class GlobalCore {
     }
 
     /**
-     * Getter function to initialize LANG
-     *
-     * @author Lars Michelsen <[email protected]>
-     */
-    public static function getLang() {
-        global $_LANG;
-        return $_LANG;
-    }
-
-    /**
      * Setter for AA
      *
      * @author Lars Michelsen <[email protected]>
diff --git a/share/server/core/classes/NagVisContextMenu.php 
b/share/server/core/classes/NagVisContextMenu.php
index 2157a93..03d28a8 100644
--- a/share/server/core/classes/NagVisContextMenu.php
+++ b/share/server/core/classes/NagVisContextMenu.php
@@ -50,7 +50,8 @@ class NagVisContextMenu {
         $this->pathHtmlBase     = $this->CORE->getMainCfg()->getValue('paths', 
'htmlbase');
         $this->pathTemplateFile = $this->CORE->getMainCfg()->getPath('sys', 
'', 'templates', $this->templateName.'.context.html');
 
-        $this->CACHE = new GlobalFileCache($this->CORE, 
$this->pathTemplateFile, 
$this->CORE->getMainCfg()->getValue('paths','var').'context-'.$this->templateName.'-'.$this->CORE->getLang()->getCurrentLanguage().'.cache');
+        $this->CACHE = new GlobalFileCache($this->CORE, 
$this->pathTemplateFile,
+                                           
$this->CORE->getMainCfg()->getValue('paths','var').'context-'.$this->templateName.'-'.curLang().'.cache');
 
         // Only use cache when there is
         // a) Some valid cache file
diff --git a/share/server/core/classes/NagVisHoverMenu.php 
b/share/server/core/classes/NagVisHoverMenu.php
index 75b78f8..290971e 100644
--- a/share/server/core/classes/NagVisHoverMenu.php
+++ b/share/server/core/classes/NagVisHoverMenu.php
@@ -51,7 +51,7 @@ class NagVisHoverMenu {
         $this->pathHtmlBase     = 
$this->CORE->getMainCfg()->getValue('paths','htmlbase');
         $this->pathTemplateFile = $this->CORE->getMainCfg()->getPath('sys', 
'', 'templates', $this->templateName.'.hover.html');
 
-        $this->CACHE = new GlobalFileCache($this->CORE, 
$this->pathTemplateFile, 
$this->CORE->getMainCfg()->getValue('paths','var').'hover-'.$this->templateName.'-'.$this->CORE->getLang()->getCurrentLanguage().'.cache');
+        $this->CACHE = new GlobalFileCache($this->CORE, 
$this->pathTemplateFile, 
$this->CORE->getMainCfg()->getValue('paths','var').'hover-'.$this->templateName.'-'.curLang().'.cache');
 
         // Only use cache when there is
         // a) Some valid cache file
@@ -223,4 +223,4 @@ class NagVisHoverMenu {
         return $this->CORE->getMainCfg()->getPath('html', 'global', 
'templates', $this->templateName.'.hover.css');
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/share/server/core/functions/i18n.php 
b/share/server/core/functions/i18n.php
index a75bca4..9a21510 100644
--- a/share/server/core/functions/i18n.php
+++ b/share/server/core/functions/i18n.php
@@ -30,4 +30,9 @@ function l($txt, $vars = null) {
     return $_LANG->getText($txt, $vars);
 }
 
+function curLang() {
+    global $_LANG;
+    return $_LANG->getCurrentLanguage();
+}
+
 ?>


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to