diff options
author | ArthurHoaro <arthur@hoa.ro> | 2015-07-15 12:05:36 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2015-11-07 16:45:20 +0100 |
commit | 263d1f649574083be4b8826a57688a85d48d4d15 (patch) | |
tree | ad7600940c1d4a4cbeeb7a020aefea6b412d5e85 | |
parent | a52e8435939c641f964939f1df55cf7ceddcc0fd (diff) | |
download | Shaarli-263d1f649574083be4b8826a57688a85d48d4d15.tar.gz Shaarli-263d1f649574083be4b8826a57688a85d48d4d15.tar.zst Shaarli-263d1f649574083be4b8826a57688a85d48d4d15.zip |
PLUGIN wallabag
Add a Wallabag icon in linklist for each link.
-rw-r--r-- | COPYING | 4 | ||||
-rw-r--r-- | plugins/wallabag/README.md | 29 | ||||
-rw-r--r-- | plugins/wallabag/config.php.dist | 3 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.html | 1 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.php | 31 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.png | bin | 0 -> 369 bytes |
6 files changed, 68 insertions, 0 deletions
@@ -68,6 +68,10 @@ Files: inc/awesomplete* | |||
68 | License: MIT License (http://opensource.org/licenses/MIT) | 68 | License: MIT License (http://opensource.org/licenses/MIT) |
69 | Copyright: (C) 2015 Lea Verou - https://github.com/LeaVerou/awesomplete | 69 | Copyright: (C) 2015 Lea Verou - https://github.com/LeaVerou/awesomplete |
70 | 70 | ||
71 | Files: plugins/wallabag/wallabag.png | ||
72 | License: MIT License (http://opensource.org/licenses/MIT) | ||
73 | Copyright: (C) 2015 Nicolas Lœuillet - https://github.com/wallabag/wallabag | ||
74 | |||
71 | ---------------------------------------------------- | 75 | ---------------------------------------------------- |
72 | ZLIB/LIBPNG LICENSE | 76 | ZLIB/LIBPNG LICENSE |
73 | 77 | ||
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 @@ | |||
1 | ## Save to Wallabag plugin for Shaarli | ||
2 | |||
3 | For each link in your Shaarli, adds a button to save the target page in your [wallabag](https://www.wallabag.org/). | ||
4 | |||
5 | ### Installation/configuration | ||
6 | Clone this repository inside your `tpl/plugins/` directory, or download the archive and unpack it there. | ||
7 | The directory structure should look like: | ||
8 | |||
9 | ``` | ||
10 | └── tpl | ||
11 | └── plugins | ||
12 | └── wallabag | ||
13 | ├── README.md | ||
14 | ├── wallabag.html | ||
15 | └── wallabag.png | ||
16 | ``` | ||
17 | |||
18 | To enable the plugin, add `'wallabag'` to your list of enabled plugins in `data/options.php` (`PLUGINS` array) | ||
19 | . This should look like: | ||
20 | |||
21 | ``` | ||
22 | $GLOBALS['config']['PLUGINS'] = array('qrcode', 'any_other_plugin', 'wallabag') | ||
23 | ``` | ||
24 | |||
25 | Then, set the `WALLABAG_URL` variable in `data/options.php` pointing to your wallabag URL. Example: | ||
26 | |||
27 | ``` | ||
28 | $GLOBALS['config']['WALLABAG_URL'] = 'http://demo.wallabag.org' ; //Base URL of your wallabag installation | ||
29 | ``` \ 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 @@ | |||
1 | <?php | ||
2 | |||
3 | $GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/'; \ No newline at end of file | ||
diff --git a/plugins/wallabag/wallabag.html b/plugins/wallabag/wallabag.html new file mode 100644 index 00000000..ddcf8126 --- /dev/null +++ b/plugins/wallabag/wallabag.html | |||
@@ -0,0 +1 @@ | |||
<span><a href="%s/?plainurl=%s" target="_blank"><img width="13" height="13" src="%s/wallabag/wallabag.png" title="Save to wallabag" /></a></span> | |||
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 @@ | |||
1 | <?php | ||
2 | |||
3 | // don't raise unnecessary warnings | ||
4 | if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { | ||
5 | include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; | ||
6 | } | ||
7 | |||
8 | if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { | ||
9 | header('Content-Type: text/plain; charset=utf-8'); | ||
10 | echo 'Wallabag plugin error: '. PHP_EOL; | ||
11 | echo ' Please copy "plugins/wallabag/config.php.dist" to config.php and configure your Wallabag URL.'. PHP_EOL; | ||
12 | echo ' You can also define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" in your global Shaarli config.php file.'; | ||
13 | exit; | ||
14 | } | ||
15 | |||
16 | /** | ||
17 | * Add wallabag icon to link_plugin when rendering linklist. | ||
18 | * | ||
19 | * @param $data - linklist data. | ||
20 | * @return mixed - linklist data with wallabag plugin. | ||
21 | */ | ||
22 | function hook_wallabag_render_linklist($data) { | ||
23 | $wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | ||
24 | |||
25 | foreach ($data['links'] as &$value) { | ||
26 | $wallabag = sprintf($wallabag_html, $GLOBALS['plugins']['WALLABAG_URL'], $value['url'], PluginManager::$PLUGINS_PATH); | ||
27 | $value['link_plugin'][] = $wallabag; | ||
28 | } | ||
29 | |||
30 | return $data; | ||
31 | } | ||
diff --git a/plugins/wallabag/wallabag.png b/plugins/wallabag/wallabag.png new file mode 100644 index 00000000..70aad33b --- /dev/null +++ b/plugins/wallabag/wallabag.png | |||
Binary files differ | |||