Some errors corrected and comments added.
This commit is contained in:
parent
d30f115eb8
commit
0670f4a520
|
@ -25,6 +25,7 @@ $Id$
|
|||
|
||||
function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
||||
{
|
||||
/* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */
|
||||
if($MessageTyp == "INFO")
|
||||
{
|
||||
$class = "class=\"status_info\"";
|
||||
|
@ -40,6 +41,7 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
|||
$class = "class=\"status_error\"";
|
||||
$MessageTyp = _("Error");
|
||||
}
|
||||
/* Set output-message, when none or false $MessageTyp is submitted. */
|
||||
else
|
||||
{
|
||||
$class = "class=\"status_error\"";
|
||||
|
@ -48,43 +50,42 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
|
|||
$MessageText = _("Please report this error to the {link=mailto:lam-devel@sourceforge.net}LDAP Account Manager Development Team{endlink}. The error number is {bold}0001:Invalid/Missing Message Typ.{endbold} Thank you.");
|
||||
}
|
||||
|
||||
$MessageHeadline = parseMessageText($MessageHeadline);
|
||||
$MessageText = parseMessageText($MessageText);
|
||||
$MessageHeadline = parseMessageString($MessageHeadline);
|
||||
$MessageText = parseMessageString($MessageText);
|
||||
|
||||
$MessageTyp = "<h1 $class>$MessageTyp</h1>";
|
||||
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>";
|
||||
$MessageText = "<p $class>$MessageText</p>";
|
||||
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>";
|
||||
$MessageTyp = "<h1 $class>$MessageTyp</h1>"; // Format $MessageTyp
|
||||
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>"; // Format $MessageHeadline
|
||||
$MessageText = "<p $class>$MessageText</p>"; // Format $MessageText
|
||||
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>"; // Writing status message
|
||||
}
|
||||
|
||||
function parseMessageText($MessageText)
|
||||
/* Use the three replace functions on the submitted Text. */
|
||||
function parseMessageString($MessageString)
|
||||
{
|
||||
$return = linkText(colorText(boldText($MessageText)));
|
||||
return $return;
|
||||
return = linkText(colorText(boldText($MessageString)));
|
||||
}
|
||||
|
||||
/* Replace {bold} and {endbold} with <b> and </b> HTML-Tags. */
|
||||
function boldText($text)
|
||||
{
|
||||
$pattern = "/\{bold\}([^{]*)\{endbold\}/";
|
||||
$replace = "<b class\"status\">\\1</b>";
|
||||
$return = preg_replace($pattern,$replace,$text);
|
||||
return $return;
|
||||
$pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold}
|
||||
$replace = "<b class\"status\">\\1</b>"; // Replace pattern
|
||||
return = preg_replace($pattern,$replace,$text);
|
||||
}
|
||||
|
||||
/* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with <font color="#[HEX-Value]"> and </font> HTML-Tags. */
|
||||
function colorText($text)
|
||||
{
|
||||
$pattern = "/\{color=([0-9,a,b,c,d,e,f,A,B,C,D,F]{6})\}([^{]*)\{endcolor\}/";
|
||||
$replace = "<font color=\"#\\1\">\\2</font>";
|
||||
$return = preg_replace($pattern,$replace,$text);
|
||||
return $return;
|
||||
$pattern = "/\{color=#?([0-9,a-f,A-F]{6})\}([^{]*)\{endcolor\}/"; // Regular expression matching {color=#[HEX-Value]}[Text]{endcolor} or {color=[HEX-Value]}[Text]{endcolor}
|
||||
$replace = "<font color=\"#\\1\">\\2</font>"; // Replace pattern
|
||||
return = preg_replace($pattern,$replace,$text);
|
||||
}
|
||||
|
||||
/* Replace {link=[Link-Target]} and {endlink} with <a href="[Link-Target]" target="_blank"> and </a> HTML-Tags. */
|
||||
function linkText($text)
|
||||
{
|
||||
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/";
|
||||
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>";
|
||||
$return = preg_replace($pattern,$replace,$text);
|
||||
return $return;
|
||||
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}
|
||||
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>"; //Replace pattern
|
||||
return = preg_replace($pattern,$replace,$text);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
Reference in New Issue