From 8cc988a162d23a6a43b1a76d7441120646f811a8 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 13 May 2019 14:53:29 -0500 Subject: [PATCH] Fix plugins menu (#10222) * Merge pull request #54 from librenms-plugins/revert-52-PluginNamespaceCorrection Revert "Adding namespace LibreNMS\Plugins;" Fix plugins menu * Only use scrollable where needed --- LibreNMS/Plugins.php | 10 ++++++++-- includes/html/pages/device/overview.inc.php | 2 +- includes/html/pages/device/port/plugins.inc.php | 2 +- resources/views/layouts/menu.blade.php | 14 ++++++++------ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/LibreNMS/Plugins.php b/LibreNMS/Plugins.php index d5c720be92..b440e87a9f 100644 --- a/LibreNMS/Plugins.php +++ b/LibreNMS/Plugins.php @@ -171,14 +171,16 @@ class Plugins /** * Call hook for plugin. * - * @param string $hook Name of hook to call - * @param array $params Optional array of parameters for hook + * @param string $hook Name of hook to call + * @param array|false $params Optional array of parameters for hook + * @return string */ public static function call($hook, $params = false) { chdir(Config::get('install_dir') . '/html'); self::start(); + ob_start(); if (!empty(self::$plugins[$hook])) { foreach (self::$plugins[$hook] as $name) { try { @@ -192,7 +194,11 @@ class Plugins } } } + $output = ob_get_contents(); + ob_end_clean(); + chdir(Config::get('install_dir')); + return $output; } /** diff --git a/includes/html/pages/device/overview.inc.php b/includes/html/pages/device/overview.inc.php index aaaf11699f..f5f4f66cbf 100644 --- a/includes/html/pages/device/overview.inc.php +++ b/includes/html/pages/device/overview.inc.php @@ -15,7 +15,7 @@ echo(' require 'includes/html/dev-overview-data.inc.php'; require 'overview/tracepath.inc.php'; -LibreNMS\Plugins::call('device_overview_container', array($device)); +echo LibreNMS\Plugins::call('device_overview_container', [$device]); require 'overview/ports.inc.php'; diff --git a/includes/html/pages/device/port/plugins.inc.php b/includes/html/pages/device/port/plugins.inc.php index 2ff7166cd7..6015484996 100644 --- a/includes/html/pages/device/port/plugins.inc.php +++ b/includes/html/pages/device/port/plugins.inc.php @@ -20,5 +20,5 @@ $no_refresh = true;

Plugins


user()->isAdmin() || \LibreNMS\Plugins::count())