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.php31
1 files changed, 31 insertions, 0 deletions
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
4if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
5 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
6}
7
8if (!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 */
22function 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}