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;