getMessageQueue(); // Build the sorted message list if (is_array($messages) && count($messages)) { foreach ($messages as $msg) { if (isset($msg['type']) && isset($msg['message'])) { $lists[$msg['type']][] = $msg['message']; } } } // If messages exist render them if (is_array($lists)) { // Build the return string $contents .= "\n