diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-05-29 14:41:30 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-06-11 09:30:56 +0200 |
commit | eeea1c3daa87f133c57c96fa17ed26b02c392636 (patch) | |
tree | 40a54d6ab27cf30bbfccbd524f02f401551e761c /plugins/wallabag | |
parent | d93d51b213bd3bda9bfa67d23c31dcce5a8b7fc0 (diff) | |
download | Shaarli-eeea1c3daa87f133c57c96fa17ed26b02c392636.tar.gz Shaarli-eeea1c3daa87f133c57c96fa17ed26b02c392636.tar.zst Shaarli-eeea1c3daa87f133c57c96fa17ed26b02c392636.zip |
Use the configuration manager for wallabag and readityourself plugin
Diffstat (limited to 'plugins/wallabag')
-rw-r--r-- | plugins/wallabag/wallabag.php | 19 |
1 files changed, 8 insertions, 11 deletions
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 @@ | |||
6 | 6 | ||
7 | require_once 'WallabagInstance.php'; | 7 | require_once 'WallabagInstance.php'; |
8 | 8 | ||
9 | // don't raise unnecessary warnings | 9 | $conf = ConfigManager::getInstance(); |
10 | if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { | 10 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
11 | include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; | 11 | if (empty($wallabagUrl)) { |
12 | } | ||
13 | |||
14 | if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { | ||
15 | $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. | 12 | $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. |
16 | 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. | 13 | 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. |
17 | 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; | 14 | 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; |
@@ -26,14 +23,14 @@ if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { | |||
26 | */ | 23 | */ |
27 | function hook_wallabag_render_linklist($data) | 24 | function hook_wallabag_render_linklist($data) |
28 | { | 25 | { |
29 | if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { | 26 | $conf = ConfigManager::getInstance(); |
27 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | ||
28 | if (empty($wallabagUrl)) { | ||
30 | return $data; | 29 | return $data; |
31 | } | 30 | } |
32 | 31 | ||
33 | $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) | 32 | $version = $conf->get('plugins.WALLABAG_VERSION'); |
34 | ? $GLOBALS['plugins']['WALLABAG_VERSION'] | 33 | $wallabagInstance = new WallabagInstance($wallabagUrl, $version); |
35 | : ''; | ||
36 | $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version); | ||
37 | 34 | ||
38 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 35 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
39 | 36 | ||