From 263d1f649574083be4b8826a57688a85d48d4d15 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 15 Jul 2015 12:05:36 +0200 Subject: [PATCH 1/2] PLUGIN wallabag Add a Wallabag icon in linklist for each link. --- COPYING | 4 ++++ plugins/wallabag/README.md | 29 +++++++++++++++++++++++++++++ plugins/wallabag/config.php.dist | 3 +++ plugins/wallabag/wallabag.html | 1 + plugins/wallabag/wallabag.php | 31 +++++++++++++++++++++++++++++++ plugins/wallabag/wallabag.png | Bin 0 -> 369 bytes 6 files changed, 68 insertions(+) create mode 100644 plugins/wallabag/README.md create mode 100644 plugins/wallabag/config.php.dist create mode 100644 plugins/wallabag/wallabag.html create mode 100644 plugins/wallabag/wallabag.php create mode 100644 plugins/wallabag/wallabag.png diff --git a/COPYING b/COPYING index 1044a3b0..22929463 100644 --- a/COPYING +++ b/COPYING @@ -68,6 +68,10 @@ Files: inc/awesomplete* License: MIT License (http://opensource.org/licenses/MIT) Copyright: (C) 2015 Lea Verou - https://github.com/LeaVerou/awesomplete +Files: plugins/wallabag/wallabag.png +License: MIT License (http://opensource.org/licenses/MIT) +Copyright: (C) 2015 Nicolas Lœuillet - https://github.com/wallabag/wallabag + ---------------------------------------------------- ZLIB/LIBPNG LICENSE diff --git a/plugins/wallabag/README.md b/plugins/wallabag/README.md new file mode 100644 index 00000000..08e0d44a --- /dev/null +++ b/plugins/wallabag/README.md @@ -0,0 +1,29 @@ +## Save to Wallabag plugin for Shaarli + +For each link in your Shaarli, adds a button to save the target page in your [wallabag](https://www.wallabag.org/). + +### Installation/configuration +Clone this repository inside your `tpl/plugins/` directory, or download the archive and unpack it there. +The directory structure should look like: + +``` +└── tpl + └── plugins +    └── wallabag +    ├── README.md +    ├── wallabag.html +    └── wallabag.png +``` + +To enable the plugin, add `'wallabag'` to your list of enabled plugins in `data/options.php` (`PLUGINS` array) +. This should look like: + +``` +$GLOBALS['config']['PLUGINS'] = array('qrcode', 'any_other_plugin', 'wallabag') +``` + +Then, set the `WALLABAG_URL` variable in `data/options.php` pointing to your wallabag URL. Example: + +``` +$GLOBALS['config']['WALLABAG_URL'] = 'http://demo.wallabag.org' ; //Base URL of your wallabag installation +``` \ No newline at end of file diff --git a/plugins/wallabag/config.php.dist b/plugins/wallabag/config.php.dist new file mode 100644 index 00000000..7cf0d303 --- /dev/null +++ b/plugins/wallabag/config.php.dist @@ -0,0 +1,3 @@ + diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php new file mode 100644 index 00000000..db8151c9 --- /dev/null +++ b/plugins/wallabag/wallabag.php @@ -0,0 +1,31 @@ +0)3IFPO6{&;}^Ml;rL1!tlSn|IB_MkG;gx z*OmPqx14~ndfvvZnLwdRPZ!4!iOb19`q?Bp1aDma`1Jq&qnrQz{eNwzw2s2z4PX8< zv$aM44>$H`WL1$6`?vq_fr7vPi`WcV%Qrp1L%D^CEfu25!hTQy=%(P0} V8Z`e-n+(*z;OXk;vd$@?2>`)Zcwqnl literal 0 HcmV?d00001 From 1696f6aa07734c7502702cf810c9fdc93532ef56 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 8 Nov 2015 12:00:06 +0100 Subject: [PATCH 2/2] unit tests for the wallabag plugin + removed exit error if the config is not found + coding style --- plugins/wallabag/wallabag.php | 22 +++++++++---- tests/plugins/PluginWallabagTest.php | 49 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 tests/plugins/PluginWallabagTest.php diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index db8151c9..024a3d2b 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -1,25 +1,33 @@ $str, + 'links' => array( + array( + 'url' => $str, + ) + ) + ); + + $data = hook_wallabag_render_linklist($data); + $link = $data['links'][0]; + // data shouldn't be altered + $this->assertEquals($str, $data['title']); + $this->assertEquals($str, $link['url']); + + // plugin data + $this->assertEquals(1, count($link['link_plugin'])); + $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); + } +}