aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag/wallabag.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2015-11-08 13:29:32 +0100
committerArthur <arthur@hoa.ro>2015-11-08 13:29:32 +0100
commitfd006c630b64146edc402b68d8503c716f8a55d6 (patch)
treee53904cc6232c7f2fe8e1de6f23c9a5d6c5403ad /plugins/wallabag/wallabag.php
parent70df947af60afb05529024bb2d3825eaf6cc7950 (diff)
parent056107ab4eae0a4867cf8d55de77d31f8868b899 (diff)
downloadShaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.gz
Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.zst
Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.zip
Merge pull request #275 from shaarli/plugin-proposition
Plugin proposition
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}