require_once 'WallabagInstance.php';
-$conf = ConfigManager::getInstance();
-$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
-if (empty($wallabagUrl)) {
- $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '.
- 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
- 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
+/**
+ * Init function, return an error if the server is not set.
+ *
+ * @param $conf ConfigManager instance.
+ *
+ * @return array Eventual error.
+ */
+function wallabag_init($conf)
+{
+ $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
+ if (empty($wallabagUrl)) {
+ $error = 'Wallabag plugin error: '.
+ 'Please define the "WALLABAG_URL" setting in the plugin administration page.';
+ return array($error);
+ }
}
/**
* Add wallabag icon to link_plugin when rendering linklist.
*
- * @param mixed $data - linklist data.
+ * @param mixed $data Linklist data.
+ * @param ConfigManager $conf Configuration Manager instance.
*
* @return mixed - linklist data with wallabag plugin.
*/
-function hook_wallabag_render_linklist($data)
+function hook_wallabag_render_linklist($data, $conf)
{
- $conf = ConfigManager::getInstance();
$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
if (empty($wallabagUrl)) {
return $data;