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.
|
|
|
|
|
|
|
|
// don't raise unnecessary warnings
|
|
|
|
if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) {
|
|
|
|
include PluginManager::$PLUGINS_PATH . '/readityourself/config.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
|
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)
|
|
|
|
{
|
|
|
|
if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
|
|
|
|
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) {
|
|
|
|
$readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH);
|
|
|
|
$value['link_plugin'][] = $readityourself;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|