aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag/wallabag.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-07-09 07:19:48 +0200
committerGitHub <noreply@github.com>2016-07-09 07:19:48 +0200
commit649af5b501d2a90448242f53764ff693e9854039 (patch)
tree23cde80a7ee2949e552c48939ae22fa462cfa0fc /plugins/wallabag/wallabag.php
parenta9cfa38df92bd2e1e2c00a67b6ac1516a2116ade (diff)
parent5ff23f02b80ec6ddee28dee869171ee8e3656b7c (diff)
downloadShaarli-649af5b501d2a90448242f53764ff693e9854039.tar.gz
Shaarli-649af5b501d2a90448242f53764ff693e9854039.tar.zst
Shaarli-649af5b501d2a90448242f53764ff693e9854039.zip
Merge pull request #570 from ArthurHoaro/config-manager
Introduce a configuration manager
Diffstat (limited to 'plugins/wallabag/wallabag.php')
-rw-r--r--plugins/wallabag/wallabag.php25
1 files changed, 10 insertions, 15 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index 0d6fc66d..ec09c8a1 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -6,34 +6,29 @@
6 6
7require_once 'WallabagInstance.php'; 7require_once 'WallabagInstance.php';
8 8
9// don't raise unnecessary warnings 9$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
10if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { 10if (empty($wallabagUrl)) {
11 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
12}
13
14if (empty($GLOBALS['plugins']['WALLABAG_URL'])) {
15 $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. 11 $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '.
16 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. 12 'Please define the "WALLABAG_URL" setting in the plugin administration page.';
17 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
18} 13}
19 14
20/** 15/**
21 * Add wallabag icon to link_plugin when rendering linklist. 16 * Add wallabag icon to link_plugin when rendering linklist.
22 * 17 *
23 * @param mixed $data - linklist data. 18 * @param mixed $data Linklist data.
19 * @param ConfigManager $conf Configuration Manager instance.
24 * 20 *
25 * @return mixed - linklist data with wallabag plugin. 21 * @return mixed - linklist data with wallabag plugin.
26 */ 22 */
27function hook_wallabag_render_linklist($data) 23function hook_wallabag_render_linklist($data, $conf)
28{ 24{
29 if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { 25 $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
26 if (empty($wallabagUrl)) {
30 return $data; 27 return $data;
31 } 28 }
32 29
33 $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) 30 $version = $conf->get('plugins.WALLABAG_VERSION');
34 ? $GLOBALS['plugins']['WALLABAG_VERSION'] 31 $wallabagInstance = new WallabagInstance($wallabagUrl, $version);
35 : '';
36 $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version);
37 32
38 $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); 33 $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
39 34