aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/readityourself/readityourself.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/readityourself/readityourself.php')
-rw-r--r--plugins/readityourself/readityourself.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php
index c8df4c4f..4bfcf501 100644
--- a/plugins/readityourself/readityourself.php
+++ b/plugins/readityourself/readityourself.php
@@ -8,34 +8,31 @@
8// it seems kinda dead. 8// it seems kinda dead.
9// Not tested. 9// Not tested.
10 10
11// don't raise unnecessary warnings 11$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
12if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) { 12if (empty($riyUrl)) {
13 include PluginManager::$PLUGINS_PATH . '/readityourself/config.php';
14}
15
16if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) {
17 $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. 13 $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '.
18 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. 14 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.';
19 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.';
20} 15}
21 16
22/** 17/**
23 * Add readityourself icon to link_plugin when rendering linklist. 18 * Add readityourself icon to link_plugin when rendering linklist.
24 * 19 *
25 * @param mixed $data - linklist data. 20 * @param mixed $data Linklist data.
21 * @param ConfigManager $conf Configuration Manager instance.
26 * 22 *
27 * @return mixed - linklist data with readityourself plugin. 23 * @return mixed - linklist data with readityourself plugin.
28 */ 24 */
29function hook_readityourself_render_linklist($data) 25function hook_readityourself_render_linklist($data, $conf)
30{ 26{
31 if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { 27 $riyUrl = $conf->get('plugins.READITYOUSELF_URL');
28 if (empty($riyUrl)) {
32 return $data; 29 return $data;
33 } 30 }
34 31
35 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); 32 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
36 33
37 foreach ($data['links'] as &$value) { 34 foreach ($data['links'] as &$value) {
38 $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH); 35 $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
39 $value['link_plugin'][] = $readityourself; 36 $value['link_plugin'][] = $readityourself;
40 } 37 }
41 38