]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - plugins/readityourself/readityourself.php
Markdown: fixes feed rendering with nomarkdown tag
[github/shaarli/Shaarli.git] / plugins / readityourself / readityourself.php
CommitLineData
75b69987
A
1<?php
2
b11c8f25
A
3/**
4 * Plugin readityourself
5 */
6
75b69987
A
7// If we're talking about https://github.com/memiks/readityourself
8// it seems kinda dead.
9// Not tested.
10
7fde6de1
A
11/**
12 * Init function, return an error if the server is not set.
13 *
14 * @param $conf ConfigManager instance.
15 *
16 * @return array Eventual error.
17 */
18function readityourself_init($conf)
19{
20 $riyUrl = $conf->get('plugins.READITYOUSELF_URL');
21 if (empty($riyUrl)) {
22 $error = 'Readityourself plugin error: '.
23 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.';
24 return array($error);
25 }
75b69987
A
26}
27
28/**
29 * Add readityourself icon to link_plugin when rendering linklist.
30 *
51def0d8
A
31 * @param mixed $data Linklist data.
32 * @param ConfigManager $conf Configuration Manager instance.
b11c8f25 33 *
75b69987
A
34 * @return mixed - linklist data with readityourself plugin.
35 */
51def0d8 36function hook_readityourself_render_linklist($data, $conf)
b11c8f25 37{
eeea1c3d
A
38 $riyUrl = $conf->get('plugins.READITYOUSELF_URL');
39 if (empty($riyUrl)) {
b11c8f25
A
40 return $data;
41 }
42
75b69987
A
43 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
44
45 foreach ($data['links'] as &$value) {
eeea1c3d 46 $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
75b69987
A
47 $value['link_plugin'][] = $readityourself;
48 }
49
50 return $data;
51}