diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
commit | 01e942d44c7194607649817216aeb5d65c6acad6 (patch) | |
tree | 15777aa1005251f119e6dd680291147117766b5b /plugins/wallabag/wallabag.php | |
parent | bc22c9a0acb095970e9494cbe8954f0612e05dc0 (diff) | |
parent | 8868f3ca461011a8fb6dd9f90b60ed697ab52fc5 (diff) | |
download | Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.gz Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.zst Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.zip |
Merge tag 'v0.8.4' into stable
Release v0.8.4
Diffstat (limited to 'plugins/wallabag/wallabag.php')
-rw-r--r-- | plugins/wallabag/wallabag.php | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 0d6fc66d..641e4cc2 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -6,34 +6,40 @@ | |||
6 | 6 | ||
7 | require_once 'WallabagInstance.php'; | 7 | require_once 'WallabagInstance.php'; |
8 | 8 | ||
9 | // don't raise unnecessary warnings | 9 | /** |
10 | if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { | 10 | * Init function, return an error if the server is not set. |
11 | include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; | 11 | * |
12 | } | 12 | * @param $conf ConfigManager instance. |
13 | 13 | * | |
14 | if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { | 14 | * @return array Eventual error. |
15 | $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. | 15 | */ |
16 | 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. | 16 | function wallabag_init($conf) |
17 | 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; | 17 | { |
18 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | ||
19 | if (empty($wallabagUrl)) { | ||
20 | $error = 'Wallabag plugin error: '. | ||
21 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; | ||
22 | return array($error); | ||
23 | } | ||
18 | } | 24 | } |
19 | 25 | ||
20 | /** | 26 | /** |
21 | * Add wallabag icon to link_plugin when rendering linklist. | 27 | * Add wallabag icon to link_plugin when rendering linklist. |
22 | * | 28 | * |
23 | * @param mixed $data - linklist data. | 29 | * @param mixed $data Linklist data. |
30 | * @param ConfigManager $conf Configuration Manager instance. | ||
24 | * | 31 | * |
25 | * @return mixed - linklist data with wallabag plugin. | 32 | * @return mixed - linklist data with wallabag plugin. |
26 | */ | 33 | */ |
27 | function hook_wallabag_render_linklist($data) | 34 | function hook_wallabag_render_linklist($data, $conf) |
28 | { | 35 | { |
29 | if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { | 36 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
37 | if (empty($wallabagUrl)) { | ||
30 | return $data; | 38 | return $data; |
31 | } | 39 | } |
32 | 40 | ||
33 | $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) | 41 | $version = $conf->get('plugins.WALLABAG_VERSION'); |
34 | ? $GLOBALS['plugins']['WALLABAG_VERSION'] | 42 | $wallabagInstance = new WallabagInstance($wallabagUrl, $version); |
35 | : ''; | ||
36 | $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version); | ||
37 | 43 | ||
38 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 44 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
39 | 45 | ||