aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wallabag/wallabag.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index db8151c9..024a3d2b 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -1,25 +1,33 @@
1<?php 1<?php
2 2
3/**
4 * Plugin Wallabag.
5 */
6
3// don't raise unnecessary warnings 7// don't raise unnecessary warnings
4if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { 8if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
5 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; 9 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
6} 10}
7 11
8if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { 12if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
9 header('Content-Type: text/plain; charset=utf-8'); 13 $GLOBALS['plugins']['errors'][] = 'Wallabag plugin error: '.
10 echo 'Wallabag plugin error: '. PHP_EOL; 14 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
11 echo ' Please copy "plugins/wallabag/config.php.dist" to config.php and configure your Wallabag URL.'. PHP_EOL; 15 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
12 echo ' You can also define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" in your global Shaarli config.php file.';
13 exit;
14} 16}
15 17
16/** 18/**
17 * Add wallabag icon to link_plugin when rendering linklist. 19 * Add wallabag icon to link_plugin when rendering linklist.
18 * 20 *
19 * @param $data - linklist data. 21 * @param mixed $data - linklist data.
22 *
20 * @return mixed - linklist data with wallabag plugin. 23 * @return mixed - linklist data with wallabag plugin.
21 */ 24 */
22function hook_wallabag_render_linklist($data) { 25function hook_wallabag_render_linklist($data)
26{
27 if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
28 return $data;
29 }
30
23 $wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); 31 $wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
24 32
25 foreach ($data['links'] as &$value) { 33 foreach ($data['links'] as &$value) {