aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/readityourself/readityourself.php
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/readityourself/readityourself.php
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/readityourself/readityourself.php')
-rw-r--r--plugins/readityourself/readityourself.php35
1 files changed, 35 insertions, 0 deletions
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}