aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/readityourself/readityourself.php
diff options
context:
space:
mode:
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}