X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fwallabag%2Fwallabag.php;h=ec09c8a14d03dc89e2865efb794756d5ee199102;hb=876533e86801246bef893e7124ce044ebf33239f;hp=e3c399a9ab5d85a124db5f99a1f0a135f8fbbbc8;hpb=938d9cce77ed5098dd69643795cb4014f3688b35;p=github%2Fshaarli%2FShaarli.git diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index e3c399a9..ec09c8a1 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -6,34 +6,29 @@ 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 (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { +$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.'; + 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; } /** * Add wallabag icon to link_plugin when rendering linklist. * - * @param mixed $data - linklist data. + * @param mixed $data Linklist data. + * @param ConfigManager $conf Configuration Manager instance. * * @return mixed - linklist data with wallabag plugin. */ -function hook_wallabag_render_linklist($data) +function hook_wallabag_render_linklist($data, $conf) { - if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { + $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');