public function peek($type = FALSE)
  {
  
	$messages = $this->_session_get();
	
	if (!is_array($messages)){
		
		return array();
	}
	
    if ($type === FALSE)
    {
	   return $messages;
    }
    else
    {
		$tmessages = array();
		
		foreach($messages as $message){
		
			if ($message->type == $type){
				
				$tmessages[] = $message;
			}
		}
		
		return $tmessages;
    }
    
  }
public function peek($type = FALSE)
  {
  
	$messages = $this->_session_get();
	
	if (!is_array($messages)){
		
		return array();
	}
	
    if ($type === FALSE)
    {
	   return $messages;
    }
    else
    {
		$tmessages = array();
		
		foreach($messages as $message){
		
			if ($message->type == $type){
				
				$tmessages[] = $message;
			}
		}
		
		return $tmessages;
    }
    
  }
public function peek ( $ type = FALSE ) { $ messages = $ this -> _session_get ( ) ; if ( ! is_array ( $ messages ) ) { return array ( ) ; } if ( $ type === FALSE ) { return $ messages ; } else { $ tmessages = array ( ) ; foreach ( $ messages as $ message ) { if ( $ message -> type == $ type ) { $ tmessages [ ] = $ message ; } } return $ tmessages ; } }
Returns an array of messages to be displayed without removing them from the session

If $type is given, returns an array of messages of that type
If $type is not given, returns an array of all messages objects,
in the order they were added. Each message object contains two
properties, type and text.

@param string $type type of messages to peek at
@return array messages
Returns an array of messages to be displayed without removing them from the session