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
|
|
|
$conf = ConfigManager::getInstance();
|
|
|
|
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
|
|
|
|
if (empty($riyUrl)) {
|
2015-11-22 14:45:09 +01:00
|
|
|
$GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '.
|
2015-11-08 13:22:44 +01:00
|
|
|
'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '.
|
|
|
|
'in "plugins/readityourself/config.php" or in your Shaarli config.php file.';
|
2015-07-15 12:04:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add readityourself icon to link_plugin when rendering linklist.
|
|
|
|
*
|
2015-11-08 12:16:55 +01:00
|
|
|
* @param mixed $data - linklist data.
|
|
|
|
*
|
2015-07-15 12:04:22 +02:00
|
|
|
* @return mixed - linklist data with readityourself plugin.
|
|
|
|
*/
|
2015-11-08 12:16:55 +01:00
|
|
|
function hook_readityourself_render_linklist($data)
|
|
|
|
{
|
2016-05-29 14:41:30 +02:00
|
|
|
$conf = ConfigManager::getInstance();
|
|
|
|
$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;
|
|
|
|
}
|