diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-05 08:44:37 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-05 08:44:37 +0400 |
commit | 3e03b0a7ca4055b4f05be7d4ec7bcfaacf364eff (patch) | |
tree | 47afa18c0b671f38e17405078bdee156ad020058 /core/Menu | |
parent | 0ed11b178860844b97b967f6cfa1ffd12ab2eaab (diff) |
refs #5301 started to simplify scheduled tasks API while staying backwards compatible
Diffstat (limited to 'core/Menu')
-rw-r--r-- | core/Menu/MenuAbstract.php | 33 |
1 files changed, 1 insertions, 32 deletions
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. * |