mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Message Handler enhancement - render specific types.
This commit is contained in:
@@ -443,23 +443,26 @@ class eMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output all accumulated messages
|
* Output all accumulated messages OR a specific type of messages. eg. 'info', 'warning', 'error', 'success'
|
||||||
*
|
*
|
||||||
* @param string $mstack message stack name
|
* @param string $mstack message stack name
|
||||||
* @param bool $session merge with session messages
|
* @param bool|string $options - true : merge with session messages or enter a type 'info', 'warning', 'error', 'success'
|
||||||
* @param bool $reset reset all messages
|
* @param bool $reset reset all messages
|
||||||
* @param bool $raw force return type array
|
* @param bool $raw force return type array
|
||||||
* @return array|string messages
|
* @return array|string messages
|
||||||
*/
|
*/
|
||||||
public function render($mstack = 'default', $session = false, $reset = true, $raw = false)
|
public function render($mstack = 'default', $options = false, $reset = true, $raw = false)
|
||||||
{
|
{
|
||||||
if($session)
|
if($options === true )
|
||||||
{
|
{
|
||||||
$this->mergeWithSession(true, $mstack);
|
$this->mergeWithSession(true, $mstack);
|
||||||
}
|
}
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$unique = array();
|
$unique = array();
|
||||||
foreach ($this->_get_types() as $type)
|
|
||||||
|
$typesArray = (is_string($options) && in_array($options, $this->_get_types())) ? array($options) : $this->_get_types();
|
||||||
|
|
||||||
|
foreach ($typesArray as $type)
|
||||||
{
|
{
|
||||||
if(E_MESSAGE_DEBUG === $type && !deftrue('E107_DEBUG_LEVEL'))
|
if(E_MESSAGE_DEBUG === $type && !deftrue('E107_DEBUG_LEVEL'))
|
||||||
{
|
{
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
|
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
echo $mes->render();
|
echo $mes->render('default','info',false);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user