aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/readityourself/readityourself.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-11-08 12:16:55 +0100
committerArthurHoaro <arthur@hoa.ro>2015-11-08 12:42:29 +0100
commitb11c8f25dfe3c684f2f39352e3acdeb660a069ac (patch)
treeeec2ea5e6642111907ed9eff28049dd8d37fabf1 /plugins/readityourself/readityourself.php
parent75b69987b3562be62f41763a99bbf0684a603374 (diff)
downloadShaarli-b11c8f25dfe3c684f2f39352e3acdeb660a069ac.tar.gz
Shaarli-b11c8f25dfe3c684f2f39352e3acdeb660a069ac.tar.zst
Shaarli-b11c8f25dfe3c684f2f39352e3acdeb660a069ac.zip
unit tests for readityourself plugin + remove hard error
Diffstat (limited to 'plugins/readityourself/readityourself.php')
-rw-r--r--plugins/readityourself/readityourself.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php
index 7bad906d..ee7579c0 100644
--- a/plugins/readityourself/readityourself.php
+++ b/plugins/readityourself/readityourself.php
@@ -1,5 +1,9 @@
1<?php 1<?php
2 2
3/**
4 * Plugin readityourself
5 */
6
3// If we're talking about https://github.com/memiks/readityourself 7// If we're talking about https://github.com/memiks/readityourself
4// it seems kinda dead. 8// it seems kinda dead.
5// Not tested. 9// Not tested.
@@ -10,20 +14,24 @@ if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) {
10} 14}
11 15
12if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { 16if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
13 header('Content-Type: text/plain; charset=utf-8'); 17 $GLOBALS['plugins']['errors'][] = 'Wallabag plugin error: '.
14 echo 'ReadItYourself plugin error: '. PHP_EOL; 18 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
15 echo ' Please copy "plugins/readityourself/config.php.dist" to config.php and configure your readityourself URL.'. PHP_EOL; 19 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
16 echo ' You can also define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" in your global Shaarli config.php file.';
17 exit;
18} 20}
19 21
20/** 22/**
21 * Add readityourself icon to link_plugin when rendering linklist. 23 * Add readityourself icon to link_plugin when rendering linklist.
22 * 24 *
23 * @param $data - linklist data. 25 * @param mixed $data - linklist data.
26 *
24 * @return mixed - linklist data with readityourself plugin. 27 * @return mixed - linklist data with readityourself plugin.
25 */ 28 */
26function hook_readityourself_render_linklist($data) { 29function hook_readityourself_render_linklist($data)
30{
31 if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
32 return $data;
33 }
34
27 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); 35 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
28 36
29 foreach ($data['links'] as &$value) { 37 foreach ($data['links'] as &$value) {