From eeea1c3daa87f133c57c96fa17ed26b02c392636 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 29 May 2016 14:41:30 +0200 Subject: Use the configuration manager for wallabag and readityourself plugin --- plugins/wallabag/wallabag.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'plugins/wallabag') diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 0d6fc66d..4726d936 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -6,12 +6,9 @@ require_once 'WallabagInstance.php'; -// don't raise unnecessary warnings -if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { - include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; -} - -if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { +$conf = ConfigManager::getInstance(); +$wallabagUrl = $conf->get('plugins.WALLABAG_URL'); +if (empty($wallabagUrl)) { $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; @@ -26,14 +23,14 @@ if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { */ function hook_wallabag_render_linklist($data) { - if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { + $conf = ConfigManager::getInstance(); + $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); + if (empty($wallabagUrl)) { return $data; } - $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) - ? $GLOBALS['plugins']['WALLABAG_VERSION'] - : ''; - $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version); + $version = $conf->get('plugins.WALLABAG_VERSION'); + $wallabagInstance = new WallabagInstance($wallabagUrl, $version); $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); -- cgit v1.2.3