1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 12:21:45 +02:00

Closes #5106 - system notification consolidation.

This commit is contained in:
camer0n
2023-11-15 16:26:24 -08:00
parent a96dde2648
commit 1b69719330
7 changed files with 190 additions and 23 deletions

View File

@@ -4864,6 +4864,8 @@ class eHelper
protected static $_idRegEx = '#[^\w\-]#';
protected static $_styleRegEx = '#[^\w\s\-\.;:!]#';
protected static $_systemNotify = 'systemNotifications';
/**
* @param $string
* @return array|string|string[]|null
@@ -4873,6 +4875,39 @@ class eHelper
return preg_replace(self::$_classRegEx, '', $string);
}
/**
* @return array
*/
public static function getSystemNotification()
{
return (array) e107::getSession()->get(self::$_systemNotify);
}
/**
* @param string $id
* @param string $message
* @return array|e_core_session|null
*/
public static function addSystemNotification($id, $message)
{
return e107::getSession()->set(self::$_systemNotify.'/'.$id.'/message', $message);
}
/**
* @param $id
* @return array|e_core_session|null
*/
public static function clearSystemNotification($id = '')
{
$key = !empty($id) ? self::$_systemNotify.'/'.$id : self::$_systemNotify;
return e107::getSession()->clear($key);
}
/**
* @param $string
* @return array|string|string[]|null