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:
@@ -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
|
||||
|
Reference in New Issue
Block a user