diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-14 13:22:58 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-11-05 14:30:13 +0100 |
commit | baec9c402873a716497b591b9756bf5b2c46ed9b (patch) | |
tree | 33ae9c12bdcce378ca08973f553df15a50c00e8c /plugins/readityourself | |
parent | b3c039b02f9608802d0ba2cf5b5742caa3b9d430 (diff) | |
download | Shaarli-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/readityourself')
-rw-r--r-- | plugins/readityourself/readityourself.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php index 4bfcf501..961c5bda 100644 --- a/plugins/readityourself/readityourself.php +++ b/plugins/readityourself/readityourself.php | |||
@@ -8,10 +8,21 @@ | |||
8 | // it seems kinda dead. | 8 | // it seems kinda dead. |
9 | // Not tested. | 9 | // Not tested. |
10 | 10 | ||
11 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | 11 | /** |
12 | if (empty($riyUrl)) { | 12 | * Init function, return an error if the server is not set. |
13 | $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. | 13 | * |
14 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; | 14 | * @param $conf ConfigManager instance. |
15 | * | ||
16 | * @return array Eventual error. | ||
17 | */ | ||
18 | function readityourself_init($conf) | ||
19 | { | ||
20 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
21 | if (empty($riyUrl)) { | ||
22 | $error = 'Readityourself plugin error: '. | ||
23 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; | ||
24 | return array($error); | ||
25 | } | ||
15 | } | 26 | } |
16 | 27 | ||
17 | /** | 28 | /** |