From 51def0d84955c7a951bd091eb5eeb3fce9deabd4 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 9 Jun 2016 20:04:32 +0200 Subject: PluginManager no longer uses singleton pattern --- plugins/readityourself/config.php.dist | 3 --- plugins/readityourself/readityourself.php | 10 ++++------ plugins/wallabag/README.md | 29 ++++++++++++----------------- plugins/wallabag/config.php.dist | 4 ---- plugins/wallabag/wallabag.php | 10 ++++------ 5 files changed, 20 insertions(+), 36 deletions(-) delete mode 100644 plugins/readityourself/config.php.dist delete mode 100644 plugins/wallabag/config.php.dist (limited to 'plugins') diff --git a/plugins/readityourself/config.php.dist b/plugins/readityourself/config.php.dist deleted file mode 100644 index d6b5cb85..00000000 --- a/plugins/readityourself/config.php.dist +++ /dev/null @@ -1,3 +0,0 @@ -get('plugins.READITYOUSELF_URL'); if (empty($riyUrl)) { $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. - 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. - 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.'; + 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; } /** * Add readityourself 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 readityourself plugin. */ -function hook_readityourself_render_linklist($data) +function hook_readityourself_render_linklist($data, $conf) { - $conf = ConfigManager::getInstance(); $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); if (empty($riyUrl)) { return $data; diff --git a/plugins/wallabag/README.md b/plugins/wallabag/README.md index 5bc35be1..3f930564 100644 --- a/plugins/wallabag/README.md +++ b/plugins/wallabag/README.md @@ -12,31 +12,26 @@ The directory structure should look like: └── plugins    └── wallabag    ├── README.md - ├── config.php.dist    ├── wallabag.html +    ├── wallabag.meta    ├── wallabag.php -    └── wallabag.png +    ├── wallabag.php +    └── WallabagInstance.php ``` -To enable the plugin, add `'wallabag'` to your list of enabled plugins in `data/options.php` (`PLUGINS` array). -This should look like: +To enable the plugin, you can either: -``` -$GLOBALS['config']['PLUGINS'] = array('qrcode', 'any_other_plugin', 'wallabag') -``` + * enable it in the plugins administration page (`?do=pluginadmin`). + * add `wallabag` to your list of enabled plugins in `data/config.json.php` (`general.enabled_plugins` section). ### Configuration -Copy `config.php.dist` into `config.php` and setup your instance. +Go to the plugin administration page, and edit the following settings (with the plugin enabled). -*Wallabag instance URL* -``` -$GLOBALS['config']['WALLABAG_URL'] = 'http://v2.wallabag.org' ; -``` +**WALLABAG_URL**: *Wallabag instance URL* +Example value: `http://v2.wallabag.org` -*Wallabag version*: either `1` (for 1.x) or `2` (for 2.x) -``` -$GLOBALS['config']['WALLABAG_VERSION'] = 2; -``` +**WALLABAG_VERSION**: *Wallabag version* +Value: either `1` (for 1.x) or `2` (for 2.x) -> Note: these settings can also be set in `data/config.php`. \ No newline at end of file +> Note: these settings can also be set in `data/config.json.php`, in the plugins section. \ No newline at end of file diff --git a/plugins/wallabag/config.php.dist b/plugins/wallabag/config.php.dist deleted file mode 100644 index a602708f..00000000 --- a/plugins/wallabag/config.php.dist +++ /dev/null @@ -1,4 +0,0 @@ -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.'; + 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; } /** * 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; -- cgit v1.2.3