Parameters

$type:
(optional) Only return messages of this type.

$clear_queue:
(optional) Set to FALSE if you do not want to clear the messages queue

Return value

An associative array, the key is the message type, the value an array
of messages. If the $type parameter is passed, you get only that type,
or an empty array if there are no such messages. If $type is not passed,
all message types are returned, or an empty array if none exist.