]> source.dussan.org Git - nextcloud-server.git/commitdiff
Better way of getting the navigation entries for an app
authorBart Visscher <bartv@thisnet.nl>
Fri, 8 Feb 2013 17:53:43 +0000 (18:53 +0100)
committerBart Visscher <bartv@thisnet.nl>
Fri, 8 Feb 2013 17:53:43 +0000 (18:53 +0100)
lib/app.php
settings/ajax/navigationdetect.php

index 3a4e21e8cd1e9f49730f79ef549be77d05ddbded..c7e20a9fa965b8c730e6792601eed4ee03075402 100644 (file)
@@ -285,6 +285,23 @@ class OC_App{
                return true;
        }
 
+       /**
+        * @brief Get the navigation entries for the $app
+        * @param string $app app
+        * @return array of the $data added with addNavigationEntry
+        */
+       public static function getAppNavigationEntries($app) {
+               if(is_file(self::getAppPath($app).'/appinfo/app.php')) {
+                       $save = self::$navigation;
+                       self::$navigation = array();
+                       require $app.'/appinfo/app.php';
+                       $app_entries = self::$navigation;
+                       self::$navigation = $save;
+                       return $app_entries;
+               }
+               return array();
+       }
+
        /**
         * @brief gets the active Menu entry
         * @return string id or empty string
index 93acb50dc200adffd78285b94fc46c4d084839be..d21f774126cd8a4b5b83b9d304946e377067339a 100644 (file)
@@ -5,10 +5,7 @@ OCP\JSON::callCheck();
 
 $app = $_GET['app'];
 
-//load the one app and see what it adds to the navigation
-OC_App::loadApp($app);
-
-$navigation = OC_App::getNavigation();
+$navigation = OC_App::getAppNavigationEntries($app);
 
 $navIds = array();
 foreach ($navigation as $nav) {