diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-14 13:22:58 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-10-14 13:22:58 +0200 |
commit | 7fde6de1212323418401c15efba06026c704ca87 (patch) | |
tree | 63b7efe598d1c563eee939fe9be3505afff1d873 /plugins/readityourself | |
parent | f63632a6fb84594b8aeacb387a5cd17b4a841d2c (diff) | |
download | Shaarli-7fde6de1212323418401c15efba06026c704ca87.tar.gz Shaarli-7fde6de1212323418401c15efba06026c704ca87.tar.zst Shaarli-7fde6de1212323418401c15efba06026c704ca87.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 | /** |