aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag/wallabag.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2015-11-08 12:46:17 +0100
committerArthur <arthur@hoa.ro>2015-11-08 12:46:17 +0100
commit66017e28935c72ad4ed037f022483ee5630e7372 (patch)
treeed7ccfb26cda7cc42cfdeef69557ec071785a47e /plugins/wallabag/wallabag.php
parente760840feaf7eff6b3aae86545ff45231b9e3592 (diff)
parent1696f6aa07734c7502702cf810c9fdc93532ef56 (diff)
downloadShaarli-66017e28935c72ad4ed037f022483ee5630e7372.tar.gz
Shaarli-66017e28935c72ad4ed037f022483ee5630e7372.tar.zst
Shaarli-66017e28935c72ad4ed037f022483ee5630e7372.zip
Merge pull request #281 from ArthurHoaro/plugin-wallabag
PLUGIN wallabag
Diffstat (limited to 'plugins/wallabag/wallabag.php')
-rw-r--r--plugins/wallabag/wallabag.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
new file mode 100644
index 00000000..024a3d2b
--- /dev/null
+++ b/plugins/wallabag/wallabag.php
@@ -0,0 +1,39 @@
1<?php
2
3/**
4 * Plugin Wallabag.
5 */
6
7// don't raise unnecessary warnings
8if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
9 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
10}
11
12if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
13 $GLOBALS['plugins']['errors'][] = 'Wallabag plugin error: '.
14 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
15 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
16}
17
18/**
19 * Add wallabag icon to link_plugin when rendering linklist.
20 *
21 * @param mixed $data - linklist data.
22 *
23 * @return mixed - linklist data with wallabag plugin.
24 */
25function hook_wallabag_render_linklist($data)
26{
27 if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
28 return $data;
29 }
30
31 $wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
32
33 foreach ($data['links'] as &$value) {
34 $wallabag = sprintf($wallabag_html, $GLOBALS['plugins']['WALLABAG_URL'], $value['url'], PluginManager::$PLUGINS_PATH);
35 $value['link_plugin'][] = $wallabag;
36 }
37
38 return $data;
39}