aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-07-15 12:04:22 +0200
committerArthurHoaro <arthur@hoa.ro>2015-11-08 12:02:41 +0100
commit75b69987b3562be62f41763a99bbf0684a603374 (patch)
tree8f7a9a24861e797116241eda3a54082d4ceb91f0 /plugins
parenta52e8435939c641f964939f1df55cf7ceddcc0fd (diff)
downloadShaarli-75b69987b3562be62f41763a99bbf0684a603374.tar.gz
Shaarli-75b69987b3562be62f41763a99bbf0684a603374.tar.zst
Shaarli-75b69987b3562be62f41763a99bbf0684a603374.zip
PLUGIN readityourself
Add an icon for each link (linklist) for ReadItYourself
Diffstat (limited to 'plugins')
-rw-r--r--plugins/readityourself/book-open.pngbin0 -> 568 bytes
-rw-r--r--plugins/readityourself/config.php.dist3
-rw-r--r--plugins/readityourself/readityourself.html1
-rw-r--r--plugins/readityourself/readityourself.php35
4 files changed, 39 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..7bad906d
--- /dev/null
+++ b/plugins/readityourself/readityourself.php
@@ -0,0 +1,35 @@
1<?php
2
3// If we're talking about https://github.com/memiks/readityourself
4// it seems kinda dead.
5// Not tested.
6
7// don't raise unnecessary warnings
8if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) {
9 include PluginManager::$PLUGINS_PATH . '/readityourself/config.php';
10}
11
12if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
13 header('Content-Type: text/plain; charset=utf-8');
14 echo 'ReadItYourself plugin error: '. PHP_EOL;
15 echo ' Please copy "plugins/readityourself/config.php.dist" to config.php and configure your readityourself URL.'. PHP_EOL;
16 echo ' You can also define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" in your global Shaarli config.php file.';
17 exit;
18}
19
20/**
21 * Add readityourself icon to link_plugin when rendering linklist.
22 *
23 * @param $data - linklist data.
24 * @return mixed - linklist data with readityourself plugin.
25 */
26function hook_readityourself_render_linklist($data) {
27 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
28
29 foreach ($data['links'] as &$value) {
30 $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH);
31 $value['link_plugin'][] = $readityourself;
32 }
33
34 return $data;
35}