From 3e03b0a7ca4055b4f05be7d4ec7bcfaacf364eff Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 5 Jun 2014 06:44:37 +0200 Subject: refs #5301 started to simplify scheduled tasks API while staying backwards compatible --- core/Menu/MenuAbstract.php | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'core/Menu') diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index 4ffbe8f532..06d972f064 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -61,42 +61,11 @@ abstract class MenuAbstract extends Singleton return self::$menus; } - $pluginNames = PluginManager::getInstance()->getLoadedPluginsName(); - - self::$menus = array(); - foreach ($pluginNames as $pluginName) { - $menu = $this->findMenuInPlugin($pluginName); - - if (!empty($menu)) { - self::$menus[] = $menu; - } - } + self::$menus = PluginManager::getInstance()->findComponents('Menu', 'Piwik\\Plugin\\Menu'); return self::$menus; } - private function findMenuInPlugin($pluginName) - { - $menuFile = PIWIK_INCLUDE_PATH . '/plugins/' . $pluginName . '/Menu.php'; - - if (!file_exists($menuFile)) { - return; - } - - $klassName = sprintf('Piwik\\Plugins\\%s\\Menu', $pluginName); - - if (!class_exists($klassName)) { - return; - } - - if (!is_subclass_of($klassName, 'Piwik\\Plugin\\Menu')) { - Log::warning(sprintf('Cannot use menu for plugin %s, class %s does not extend Piwik\Plugin\Menu', $pluginName, $klassName)); - return; - } - - return new $klassName; - } - /** * Adds a new entry to the menu. * -- cgit v1.2.3