]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - plugins/wallabag/wallabag.php
Use the configuration manager for wallabag and readityourself plugin
[github/shaarli/Shaarli.git] / plugins / wallabag / wallabag.php
index 0d6fc66de5fdf5df269455a0365c18f3fabcd557..4726d9369fab4ef8dd9ef0bada8e323a626d3aac 100644 (file)
@@ -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');