diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
commit | 01e942d44c7194607649817216aeb5d65c6acad6 (patch) | |
tree | 15777aa1005251f119e6dd680291147117766b5b /plugins/readityourself | |
parent | bc22c9a0acb095970e9494cbe8954f0612e05dc0 (diff) | |
parent | 8868f3ca461011a8fb6dd9f90b60ed697ab52fc5 (diff) | |
download | Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.gz Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.zst Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.zip |
Merge tag 'v0.8.4' into stable
Release v0.8.4
Diffstat (limited to 'plugins/readityourself')
-rw-r--r-- | plugins/readityourself/config.php.dist | 3 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.html | 2 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.php | 34 |
3 files changed, 22 insertions, 17 deletions
diff --git a/plugins/readityourself/config.php.dist b/plugins/readityourself/config.php.dist deleted file mode 100644 index d6b5cb85..00000000 --- a/plugins/readityourself/config.php.dist +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | $GLOBALS['plugins']['READITYOUSELF_URL'] = 'http://someurl.com'; \ No newline at end of file | ||
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html index e8c5f784..5e200715 100644 --- a/plugins/readityourself/readityourself.html +++ b/plugins/readityourself/readityourself.html | |||
@@ -1 +1 @@ | |||
<span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" /></a></span> | <span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" alt="readityourself" /></a></span> | ||
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php index c8df4c4f..961c5bda 100644 --- a/plugins/readityourself/readityourself.php +++ b/plugins/readityourself/readityourself.php | |||
@@ -8,34 +8,42 @@ | |||
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 | /** |
12 | if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) { | 12 | * Init function, return an error if the server is not set. |
13 | include PluginManager::$PLUGINS_PATH . '/readityourself/config.php'; | 13 | * |
14 | } | 14 | * @param $conf ConfigManager instance. |
15 | 15 | * | |
16 | if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) { | 16 | * @return array Eventual error. |
17 | $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. | 17 | */ |
18 | 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. | 18 | function readityourself_init($conf) |
19 | 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.'; | 19 | { |
20 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
21 | if (empty($riyUrl)) { | ||
22 | $error = 'Readityourself plugin error: '. | ||
23 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; | ||
24 | return array($error); | ||
25 | } | ||
20 | } | 26 | } |
21 | 27 | ||
22 | /** | 28 | /** |
23 | * Add readityourself icon to link_plugin when rendering linklist. | 29 | * Add readityourself icon to link_plugin when rendering linklist. |
24 | * | 30 | * |
25 | * @param mixed $data - linklist data. | 31 | * @param mixed $data Linklist data. |
32 | * @param ConfigManager $conf Configuration Manager instance. | ||
26 | * | 33 | * |
27 | * @return mixed - linklist data with readityourself plugin. | 34 | * @return mixed - linklist data with readityourself plugin. |
28 | */ | 35 | */ |
29 | function hook_readityourself_render_linklist($data) | 36 | function hook_readityourself_render_linklist($data, $conf) |
30 | { | 37 | { |
31 | if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { | 38 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); |
39 | if (empty($riyUrl)) { | ||
32 | return $data; | 40 | return $data; |
33 | } | 41 | } |
34 | 42 | ||
35 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); | 43 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); |
36 | 44 | ||
37 | foreach ($data['links'] as &$value) { | 45 | foreach ($data['links'] as &$value) { |
38 | $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH); | 46 | $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH); |
39 | $value['link_plugin'][] = $readityourself; | 47 | $value['link_plugin'][] = $readityourself; |
40 | } | 48 | } |
41 | 49 | ||