aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/wallabag
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-10-14 13:22:58 +0200
committerArthurHoaro <arthur@hoa.ro>2016-11-05 14:30:13 +0100
commitbaec9c402873a716497b591b9756bf5b2c46ed9b (patch)
tree33ae9c12bdcce378ca08973f553df15a50c00e8c /plugins/wallabag
parentb3c039b02f9608802d0ba2cf5b5742caa3b9d430 (diff)
downloadShaarli-baec9c402873a716497b591b9756bf5b2c46ed9b.tar.gz
Shaarli-baec9c402873a716497b591b9756bf5b2c46ed9b.tar.zst
Shaarli-baec9c402873a716497b591b9756bf5b2c46ed9b.zip
New init function for plugins, supports errors reporting
All plugins can optionally add an init function named `pluginname_init()` which is called when the plugin is loaded. This function is aware of the config, and can return initialization errors, which are displayed in the header template. Note that the previous error system hack no longer work.
Diffstat (limited to 'plugins/wallabag')
-rw-r--r--plugins/wallabag/wallabag.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index ec09c8a1..641e4cc2 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -6,10 +6,21 @@
6 6
7require_once 'WallabagInstance.php'; 7require_once 'WallabagInstance.php';
8 8
9$wallabagUrl = $conf->get('plugins.WALLABAG_URL'); 9/**
10if (empty($wallabagUrl)) { 10 * Init function, return an error if the server is not set.
11 $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. 11 *
12 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; 12 * @param $conf ConfigManager instance.
13 *
14 * @return array Eventual error.
15 */
16function wallabag_init($conf)
17{
18 $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
19 if (empty($wallabagUrl)) {
20 $error = 'Wallabag plugin error: '.
21 'Please define the "WALLABAG_URL" setting in the plugin administration page.';
22 return array($error);
23 }
13} 24}
14 25
15/** 26/**