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-05-29 14:41:30 +02:00
|
|
|
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
|
|
|
|
if (empty($riyUrl)) {
|
2015-11-22 14:45:09 +01:00
|
|
|
$GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '.
|
2016-06-09 20:04:32 +02:00
|
|
|
'Please define the "READITYOUSELF_URL" setting in the plugin administration page.';
|
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;
|
|
|
|
}
|