diff options
author | Arthur <arthur@hoa.ro> | 2015-11-08 12:45:19 +0100 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2015-11-08 12:45:19 +0100 |
commit | e760840feaf7eff6b3aae86545ff45231b9e3592 (patch) | |
tree | 5f56a61e929efd146470b367bafcf057f0a28b9a /plugins | |
parent | 00c25040c523104e1b845fd71d1cd134a1a5e7ff (diff) | |
parent | b11c8f25dfe3c684f2f39352e3acdeb660a069ac (diff) | |
download | Shaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.tar.gz Shaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.tar.zst Shaarli-e760840feaf7eff6b3aae86545ff45231b9e3592.zip |
Merge pull request #280 from ArthurHoaro/plugin-readityourself
PLUGIN readityourself
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/readityourself/book-open.png | bin | 0 -> 568 bytes | |||
-rw-r--r-- | plugins/readityourself/config.php.dist | 3 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.html | 1 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.php | 43 |
4 files changed, 47 insertions, 0 deletions
diff --git a/plugins/readityourself/book-open.png b/plugins/readityourself/book-open.png new file mode 100644 index 00000000..36513d7b --- /dev/null +++ b/plugins/readityourself/book-open.png | |||
Binary files differ | |||
diff --git a/plugins/readityourself/config.php.dist b/plugins/readityourself/config.php.dist new file mode 100644 index 00000000..d6b5cb85 --- /dev/null +++ b/plugins/readityourself/config.php.dist | |||
@@ -0,0 +1,3 @@ | |||
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 new file mode 100644 index 00000000..fa0210f7 --- /dev/null +++ b/plugins/readityourself/readityourself.html | |||
@@ -0,0 +1 @@ | |||
<span><a href="%s?url=%s"><img width="13" height="13" src="%s/readityourself/book-open.png" title="Read with Readityourself" /></a></span> \ No newline at end of file | |||
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php new file mode 100644 index 00000000..ee7579c0 --- /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'][] = 'Wallabag plugin error: '. | ||
18 | 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. | ||
19 | 'in "plugins/wallabag/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 | } | ||