fixed message classes

In #3069 the internal structure of messages was accidentally changed to
be numeric. This reintroduces the proper string constants.

I thought about keeping the integers and do the mapping in
html_msgarea() but some plugins rely on inspecting the global $MSG so I
don't want to change it.
This commit is contained in:
Andreas Gohr 2020-06-02 11:30:02 +02:00
parent 6dc405e1a9
commit 556e996e8e
1 changed files with 9 additions and 4 deletions

View File

@ -338,15 +338,20 @@ define('MSG_ADMINS_ONLY',4);
*/
function msg($message,$lvl=0,$line='',$file='',$allow=MSG_PUBLIC){
global $MSG, $MSG_shown;
static $errors = array(-1=>'error', 0=>'info', 1=>'success', 2=>'notify');
static $errors = [
-1 => 'error',
0 => 'info',
1 => 'success',
2 => 'notify',
];
$msgdata = array(
$msgdata = [
'msg' => $message,
'lvl' => $lvl,
'lvl' => $errors[$lvl],
'allow' => $allow,
'line' => $line,
'file' => $file,
);
];
$evt = new \dokuwiki\Extension\Event('INFOUTIL_MSG_SHOW', $msgdata);
if ($evt->advise_before()) {