2015-07-15 12:05:36 +02:00
|
|
|
<?php
|
|
|
|
|
2015-11-08 12:00:06 +01:00
|
|
|
/**
|
|
|
|
* Plugin Wallabag.
|
|
|
|
*/
|
|
|
|
|
2015-07-15 12:05:36 +02:00
|
|
|
// don't raise unnecessary warnings
|
|
|
|
if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
|
|
|
|
include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
|
2015-11-22 14:45:09 +01:00
|
|
|
$GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '.
|
2015-11-08 12:00:06 +01:00
|
|
|
'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
|
|
|
|
'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
|
2015-07-15 12:05:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add wallabag icon to link_plugin when rendering linklist.
|
|
|
|
*
|
2015-11-08 12:00:06 +01:00
|
|
|
* @param mixed $data - linklist data.
|
|
|
|
*
|
2015-07-15 12:05:36 +02:00
|
|
|
* @return mixed - linklist data with wallabag plugin.
|
|
|
|
*/
|
2015-11-08 12:00:06 +01:00
|
|
|
function hook_wallabag_render_linklist($data)
|
|
|
|
{
|
|
|
|
if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2015-07-15 12:05:36 +02:00
|
|
|
$wallabag_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
|
|
|
|
|
|
|
|
foreach ($data['links'] as &$value) {
|
|
|
|
$wallabag = sprintf($wallabag_html, $GLOBALS['plugins']['WALLABAG_URL'], $value['url'], PluginManager::$PLUGINS_PATH);
|
|
|
|
$value['link_plugin'][] = $wallabag;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|