aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag/wallabag.php
diff options
context:
space:
mode:
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}