diff options
author | Arthur <arthur@hoa.ro> | 2015-11-08 13:29:32 +0100 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2015-11-08 13:29:32 +0100 |
commit | fd006c630b64146edc402b68d8503c716f8a55d6 (patch) | |
tree | e53904cc6232c7f2fe8e1de6f23c9a5d6c5403ad /plugins/readityourself/readityourself.php | |
parent | 70df947af60afb05529024bb2d3825eaf6cc7950 (diff) | |
parent | 056107ab4eae0a4867cf8d55de77d31f8868b899 (diff) | |
download | Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.gz Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.tar.zst Shaarli-fd006c630b64146edc402b68d8503c716f8a55d6.zip |
Merge pull request #275 from shaarli/plugin-proposition
Plugin proposition
Diffstat (limited to 'plugins/readityourself/readityourself.php')
-rw-r--r-- | plugins/readityourself/readityourself.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php new file mode 100644 index 00000000..68efc543 --- /dev/null +++ b/plugins/readityourself/readityourself.php | |||
@@ -0,0 +1,43 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Plugin readityourself | ||
5 | */ | ||
6 | |||
7 | // If we're talking about https://github.com/memiks/readityourself | ||
8 | // it seems kinda dead. | ||
9 | // Not tested. | ||
10 | |||
11 | // don't raise unnecessary warnings | ||
12 | if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) { | ||
13 | include PluginManager::$PLUGINS_PATH . '/readityourself/config.php'; | ||
14 | } | ||
15 | |||
16 | if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { | ||
17 | $GLOBALS['plugins']['errors'][] = 'Readityourself plugin error: '. | ||
18 | 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. | ||
19 | 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.'; | ||
20 | } | ||
21 | |||
22 | /** | ||
23 | * Add readityourself icon to link_plugin when rendering linklist. | ||
24 | * | ||
25 | * @param mixed $data - linklist data. | ||
26 | * | ||
27 | * @return mixed - linklist data with readityourself plugin. | ||
28 | */ | ||
29 | function hook_readityourself_render_linklist($data) | ||
30 | { | ||
31 | if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { | ||
32 | return $data; | ||
33 | } | ||
34 | |||
35 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); | ||
36 | |||
37 | foreach ($data['links'] as &$value) { | ||
38 | $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH); | ||
39 | $value['link_plugin'][] = $readityourself; | ||
40 | } | ||
41 | |||
42 | return $data; | ||
43 | } | ||