1
0
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:
Cameron
2013-03-03 20:53:08 -08:00
parent c3e7104c64
commit 883e4eb0c8
2 changed files with 10 additions and 7 deletions

View File

@@ -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'))
{ {

View File

@@ -3,6 +3,6 @@
$mes = e107::getMessage(); $mes = e107::getMessage();
echo $mes->render(); echo $mes->render('default','info',false);
?> ?>