Commit e8c7d2e0 authored by Dries's avatar Dries

- Made it possible to set and display multiple status messages.  Modified patch by
  Kjartan.
parent f6cae094
......@@ -34,17 +34,16 @@ function drupal_get_title() {
* @{
*/
function drupal_set_message($message = NULL, $type = "status") {
static $stored_message;
static $stored_message = array();
if (isset($message)) {
$stored_message->message = $message;
$stored_message->type = $type;
$stored_message[] = array($message, $type);
}
return $stored_message;
}
function drupal_get_message() {
function drupal_get_messages() {
return drupal_set_message();
}
// @}
......@@ -437,7 +436,6 @@ function valid_input_data($data) {
// check attributes:
$match += preg_match("/\W(dynsrc|datasrc|data|lowsrc|on[a-z]+)\s*=[^>]+?>/i", $data);
// check tags:
$match += preg_match("/<\s*(applet|script|object|style|embed|form|blink|meta|html|frame|iframe|layer|ilayer|head|frameset|xml)/i", $data);
......
<?php
// $Id$
function chameleon_help($section) {
......@@ -66,8 +65,9 @@ function chameleon_header($title = "") {
$output .= "<small>$help</small><hr />";
}
if ($message = drupal_get_message()) {
$output .= "<strong>". t("Status") ."</strong>: ". $message->message ."<hr />";
foreach (drupal_get_messages() as $message) {
list($message, $type) = $message;
$output .= "<strong>". t("Status") ."</strong>: $message<hr />";
}
return $output;
......
......@@ -65,8 +65,9 @@ function marvin_header() {
$output .= "<small>$help</small><hr />";
}
if ($message = drupal_get_message()) {
$output .= "<strong>". t("Status") ."</strong>: ". $message->message ."<hr />";
foreach (drupal_get_messages() as $message) {
list($message, $type) = $message;
$output .= "<strong>". t("Status") ."</strong>: $message<hr />";
}
return $output;
......
......@@ -111,9 +111,10 @@ function xtemplate_header() {
$xtemplate->template->parse("header.help");
}
if ($message = drupal_get_message()) {
$xtemplate->template->assign("message", ucfirst($message->message));
$xtemplate->template->assign("type", $message->type);
foreach (drupal_get_messages() as $message) {
list($message, $type) = $message;
$xtemplate->template->assign("message", ucfirst($message));
$xtemplate->template->assign("type", $type);
$xtemplate->template->parse("header.message");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment