aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag/wallabag.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-12-22 10:20:27 +0100
committerArthurHoaro <arthur@hoa.ro>2015-12-27 15:30:34 +0100
commit938d9cce77ed5098dd69643795cb4014f3688b35 (patch)
treeb0bbdd80b81e6f54009f0c67631e69020e2f4399 /plugins/wallabag/wallabag.php
parent79851b489087f8a3027ecd805255cd13ee6fcf63 (diff)
downloadShaarli-938d9cce77ed5098dd69643795cb4014f3688b35.tar.gz
Shaarli-938d9cce77ed5098dd69643795cb4014f3688b35.tar.zst
Shaarli-938d9cce77ed5098dd69643795cb4014f3688b35.zip
Wallabag plugin improvement
* Fixes a bug where URL weren't properly encoded. * Adds Wallabag V2 support. * Adds a URL function to handle trailing slash. * UT. * README updated.
Diffstat (limited to 'plugins/wallabag/wallabag.php')
-rw-r--r--plugins/wallabag/wallabag.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index 37969c97..e3c399a9 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -4,6 +4,8 @@
4 * Plugin Wallabag. 4 * Plugin Wallabag.
5 */ 5 */
6 6
7require_once 'WallabagInstance.php';
8
7// don't raise unnecessary warnings 9// don't raise unnecessary warnings
8if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { 10if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
9 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; 11 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
@@ -28,12 +30,23 @@ function hook_wallabag_render_linklist($data)
28 return $data; 30 return $data;
29 } 31 }
30 32
31 $wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); 33 $version = isset($GLOBALS['plugins']['WALLABAG_VERSION'])
34 ? $GLOBALS['plugins']['WALLABAG_VERSION']
35 : '';
36 $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version);
37
38 $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
32 39
33 foreach ($data['links'] as &$value) { 40 foreach ($data['links'] as &$value) {
34 $wallabag = sprintf($wallabag_html, $GLOBALS['plugins']['WALLABAG_URL'], $value['url'], PluginManager::$PLUGINS_PATH); 41 $wallabag = sprintf(
42 $wallabagHtml,
43 $wallabagInstance->getWallabagUrl(),
44 urlencode($value['url']),
45 PluginManager::$PLUGINS_PATH
46 );
35 $value['link_plugin'][] = $wallabag; 47 $value['link_plugin'][] = $wallabag;
36 } 48 }
37 49
38 return $data; 50 return $data;
39} 51}
52