2015-07-15 12:04:22 +02:00
|
|
|
<?php
|
|
|
|
|
2015-11-08 12:16:55 +01:00
|
|
|
/**
|
|
|
|
* Plugin readityourself
|
|
|
|
*/
|
|
|
|
|
2015-07-15 12:04:22 +02:00
|
|
|
// If we're talking about https://github.com/memiks/readityourself
|
|
|
|
// it seems kinda dead.
|
|
|
|
// Not tested.
|
|
|
|
|
2016-10-14 13:22:58 +02:00
|
|
|
/**
|
|
|
|
* Init function, return an error if the server is not set.
|
|
|
|
*
|
|
|
|
* @param $conf ConfigManager instance.
|
|
|
|
*
|
|
|
|
* @return array Eventual error.
|
|
|
|
*/
|
|
|
|
function readityourself_init($conf)
|
|
|
|
{
|
|
|
|
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
|
|
|
|
if (empty($riyUrl)) {
|
|
|
|
$error = 'Readityourself plugin error: '.
|
|
|
|
'Please define the "READITYOUSELF_URL" setting in the plugin administration page.';
|
|
|
|
return array($error);
|
|
|
|
}
|
2015-07-15 12:04:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add readityourself icon to link_plugin when rendering linklist.
|
|
|
|
*
|
2016-06-09 20:04:32 +02:00
|
|
|
* @param mixed $data Linklist data.
|
|
|
|
* @param ConfigManager $conf Configuration Manager instance.
|
2015-11-08 12:16:55 +01:00
|
|
|
*
|
2015-07-15 12:04:22 +02:00
|
|
|
* @return mixed - linklist data with readityourself plugin.
|
|
|
|
*/
|
2016-06-09 20:04:32 +02:00
|
|
|
function hook_readityourself_render_linklist($data, $conf)
|
2015-11-08 12:16:55 +01:00
|
|
|
{
|
2016-05-29 14:41:30 +02:00
|
|
|
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
|
|
|
|
if (empty($riyUrl)) {
|
2015-11-08 12:16:55 +01:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2015-07-15 12:04:22 +02:00
|
|
|
$readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
|
|
|
|
|
|
|
|
foreach ($data['links'] as &$value) {
|
2016-05-29 14:41:30 +02:00
|
|
|
$readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
|
2015-07-15 12:04:22 +02:00
|
|
|
$value['link_plugin'][] = $readityourself;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|