diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-11-12 13:02:36 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-12 13:02:36 +0100 |
commit | 1409f1c89a7ca01456ae2dcd6357d296e2b99f5a (patch) | |
tree | ffa30a9358e82d27be75d8fc5e57f3c8820dc6d3 /plugins/wallabag/wallabag.php | |
parent | 054e03f37fa29da8066f1a637919f13c7e7dc5d2 (diff) | |
parent | a6935feb22df8d9634189ee87d257da9f03eedbd (diff) | |
download | Shaarli-v0.12.tar.gz Shaarli-v0.12.tar.zst Shaarli-v0.12.zip |
Diffstat (limited to 'plugins/wallabag/wallabag.php')
-rw-r--r-- | plugins/wallabag/wallabag.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 805c1ad9..f2003cb9 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
2 | /** | 3 | /** |
3 | * Wallabag plugin | 4 | * Wallabag plugin |
4 | */ | 5 | */ |
@@ -18,10 +19,11 @@ function wallabag_init($conf) | |||
18 | { | 19 | { |
19 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | 20 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
20 | if (empty($wallabagUrl)) { | 21 | if (empty($wallabagUrl)) { |
21 | $error = t('Wallabag plugin error: '. | 22 | $error = t('Wallabag plugin error: ' . |
22 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'); | 23 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'); |
23 | return array($error); | 24 | return [$error]; |
24 | } | 25 | } |
26 | $conf->setEmpty('plugins.WALLABAG_URL', '2'); | ||
25 | } | 27 | } |
26 | 28 | ||
27 | /** | 29 | /** |
@@ -35,7 +37,7 @@ function wallabag_init($conf) | |||
35 | function hook_wallabag_render_linklist($data, $conf) | 37 | function hook_wallabag_render_linklist($data, $conf) |
36 | { | 38 | { |
37 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | 39 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
38 | if (empty($wallabagUrl)) { | 40 | if (empty($wallabagUrl) || !$data['_LOGGEDIN_']) { |
39 | return $data; | 41 | return $data; |
40 | } | 42 | } |
41 | 43 | ||
@@ -45,13 +47,13 @@ function hook_wallabag_render_linklist($data, $conf) | |||
45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 47 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
46 | 48 | ||
47 | $linkTitle = t('Save to wallabag'); | 49 | $linkTitle = t('Save to wallabag'); |
48 | $path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | 50 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; |
49 | 51 | ||
50 | foreach ($data['links'] as &$value) { | 52 | foreach ($data['links'] as &$value) { |
51 | $wallabag = sprintf( | 53 | $wallabag = sprintf( |
52 | $wallabagHtml, | 54 | $wallabagHtml, |
53 | $wallabagInstance->getWallabagUrl(), | 55 | $wallabagInstance->getWallabagUrl(), |
54 | urlencode($value['url']), | 56 | urlencode(unescape($value['url'])), |
55 | $path, | 57 | $path, |
56 | $linkTitle | 58 | $linkTitle |
57 | ); | 59 | ); |