$text = preg_replace("/<blockquote><b>Code:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td class=tablecode><pre>(.*)<\/pre><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[code]\\1
", $text);
[/code]
This is the code my forum uses to make code tags
The code works good but their is one problem. When I use IMG tags within these code tags, the IMG work. And every tag within the code tag must be disabeld. Example (the stars dont belong to the code ofcourse 😉 )
[code]
[img]http://www.eensite.nl/plaatje.gif[/img]
[/code]
Think the starts away 😉
Smilies are not working within the code tags and that is good
$text = preg_replace("/<img src='(.*)'>/Uis", "[img]\\1[/img]", $text);
This is part for the tags...It might be usefull
/* HTML => plain */
$query = $sql->get_smily();
while(list($code, $replacement) = $sql->fetch_row($query)){
$text = str_replace("<img src='$replacement'>", $code, $text);
}
$text = preg_replace("/<img src='(.*)'>/Uis", "[img]\\1[/img]", $text);
$text = preg_replace("/<img src='(.*)' width='(.*)' height='(.*)'>/Uis", "[img=\\2,\\3]\\1[/img]", $text);
$text = preg_replace("/<font color=000099>\* (.*)<\/font><br>/Uis", "[me=\\1]\r\n", $text);
$text = preg_replace("/<img src='(.*)'>/Uis", "[img]\\1[/img]", $text);
$text = preg_replace("/<font color=000099>\* (.*)<\/font><br>/Uis", "[me=\\1]\r\n", $text);
$text = preg_replace("/<font color=000099>\* (.*)<\/font>/Uis", "[me=\\1]\r\n", $text);
$text = preg_replace("/<blockquote><b>Quote:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td class=tablecode><font size=1>(.*)<\/font><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[quote]\\1[/quote]", $text);
$text = preg_replace("/<blockquote><b>Quote:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td><table><tr><td><font size=1>(.*)<\/font><\/td><\/tr><\/table><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[quote]\r\n\\1\r\n[/quote]", $text);
$text = preg_replace("/<blockquote><b>Quote:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td><table><tr><td>(.*)<\/font><\/td><\/tr><\/table><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[quote]\r\n\\1\r\n[/quote]", $text);
$text = preg_replace("/<blockquote><b>Quote:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td><font size=1>(.*)<\/font><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[quote]\r\n\\1\r\n[/quote]", $text);
$text = preg_replace("/<blockquote><b>Code:<\/b><table width=90% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000 height=1><\/td><\/tr><tr><td class=tablecode><pre>(.*)<\/pre><\/td<\/tr><tr><td bgcolor=#000000 height=1><\/td><\/tr><\/table><\/blockquote>/Uis", "[code]\\1
", $text);
$text = preg_replace("/<b>(.*)<\/b>/Uis", "\1", $text);
$text = preg_replace("/<i>(.*)<\/i>/Uis", "\1", $text);
$text = preg_replace("/<u>(.*)<\/u>/Uis", "\1", $text);
$text = preg_replace("/<s>(.*)<\/s>/Uis", "\1", $text);
$text = preg_replace("/<a href='search.php\?on=topicbod\y&searchstr=(.*)'>(.*)<\/a>/Uis", "[search=\1]", $text);
$text = preg_replace("/<a href='(.*)' target='_blank'>(.*)<\/a>/Uis", "\2", $text);
$text = preg_replace("/<a href='(.*)'>(.*)<\/a>/Uis", "\2", $text);
$text = preg_replace("/<li>/Uis", "[*]", $text);
$text = str_replace("<p>", "\r\n\r\n", $text);
$text = str_replace("<br>", "\r\n", $text);
}
}
function parse_code_backwards($body){
$orig = $body;
$body = preg_replace("/(<br><b>Code:<\/b><hr>)(.)(<hr>)/Uis", "
\\2
", $body);
$body = str_replace("<br>", "\n", $body);
$body = str_replace("<", "<", $body);
$body = str_replace(">", ">", $body);
$body = preg_replace("/(<b>)(.*)(<\/b>)/s", "\2", $body);
$body = preg_replace("/(<i>)(.)(<\/Uis>)/s", "\2[/Uis]", $body);
$body = preg_replace("/(<s>)(.)(<\/s>)/s", "\2", $body);
$body = preg_replace("/(<u>)(.)(<\/u>)/s", "\2", $body);
$body = preg_replace("/(<code>)(.)(<\/code>)/s", "
\\2
", $body);
$body = preg_replace("/(<a href=')(.)(' target='_blank'>)(.)(<\/a>)/Uis", "\2", $body);
$body = str_replace("\n", "", $body);
$body = str_replace("\r", "", $body);
$body = str_replace("<br />", "\n", $body);
return $body;
}
[/code]
What must i alter to stop the IMG tags and other tags to NOT function within the code tags
Klick quote or edit to see message better, the code is a bit fuckud up