da bin ich wohl etwas altmodisch
$output = preg_replace_callback('#\[code\](.*)\[/code\]#isU', create_function('$str', 'return "<table class=\"tableb\"><tr><td>Code:</td></tr></table><table class=\"tablea\"><tr><td>".htmlspecialchars_decode(highlight_string($str[1],TRUE))."</td></tr></table>";'), str_replace("\n", "", $output));
Problem halb gelöst, wie vermeide ich nun das die Smilies umgewandelt werden?
Und das highlighting funktioniert auch nicht leider.
Hier mal die komplette Funktion wie sie aktuell aussieht:
/* Posting --> Parser */
function bbxxcode($post)
{
$output=$post;
//BBCodes
$output=preg_replace("|\[b\](.*)\[/b\]|Uism","<b>$1</b>",$output);
$output=preg_replace("|\[u\](.*)\[/u\]|Uism","<span style=\"text-decoration:underline;\">$1</span>",$output);
$output=preg_replace("|\[i\](.*)\[/i\]|Uism","<span style=\"font-style:italic;\">$1</span>",$output);
$output=preg_replace("|\[url\](.*)\[/url\]|Uism","<a href=\"$1\" target=\"blank\">$1</a>",$output);
$output=preg_replace("|\[url=(.*)\](.*)\[/url\]|Uism","<a href=\"$1\" target=\"blank\">$2</a>",$output);
$output=preg_replace("|\[img\](.*)\[/img\]|Uism","<img src=\"$1\" border=\"0\">",$output);
$output=preg_replace("|\[quote=(.*)\](.*)\[/quote\]|Uism","<table class=\"tableb\"><tr><td>Original from <b>$1:</b></td></tr></table><table class=\"tablea\"><tr><td>$2</td></tr></table>",$output);
$output=preg_replace("|\[size=(.*)\](.*)\[/size\]|Uism","<span style=\"font-size:$1pt;\">$2</span>",$output);
$output=preg_replace("|\[color=(.*)\](.*)\[/color\]|Uism","<span style=\"color:$1;\">$2</span>",$output);
$output = preg_replace_callback('#\[code\](.*)\[/code\]#isU', create_function('$str', 'return "<table class=\"tableb\"><tr><td>Code:</td></tr></table><table class=\"tablea\"><tr><td>".htmlspecialchars_decode(highlight_string($str[1],TRUE))."</td></tr></table>";'), str_replace("\n", "", $output));
if($bbxxuserdata_username != "") $bbxxcode_username = $bbxxuserdata_username;
else $bbxxcode_username = "Guest";
$output=str_replace("{username}","$bbxxcode_username",$output);
//smilies
$output=str_replace(":)","<img src=\"images/smilies/smile.gif\" alt=\"smile\" />",$output);
$output=str_replace(":D","<img src=\"images/smilies/biggrin.gif\" alt=\"grins\" />",$output);
$output=str_replace(":(","<img src=\"images/smilies/sad.gif\" alt=\"sad\" />",$output);
$output=str_replace(";)","<img src=\"images/smilies/wink.gif\" alt=\"wink\" />",$output);
$output=str_replace(":rolleyes:","<img src=\"images/smilies/rolleyes.gif\" alt=\"rolleyes\" />",$output);
$output=str_replace(":P","<img src=\"images/smilies/tongue.gif\" alt=\"tongue\" />",$output);
return $output;
}
Alles anzeigen
lg
Michael [/i]