PHP Code:
function bbcode($text)
{ // global $smilies;
$text=htmlspecialchars($text);
$text=preg_replace("/\[b\]\[big\](.*?)\[\/b\]\[\/big\]/i","[b]\\1[/b]", $text);
$text=preg_replace("/\[big\]\[b\](.*?)\[\/big\]\[\/b\]/i","[b]\\1[/b]", $text);
$text=preg_replace("/\[u\]\[big\](.*?)\[\/u\]\[\/big\]/i","[u]\\1[/u]", $text);
$text=preg_replace("/\[big\]\[u\](.*?)\[\/big\]\[\/u\]/i","[u]\\1[/u]", $text);
$text=preg_replace("/\[b\]\[u\](.*?)\[\/b\]\[\/u\]/i","[b][u]\\1[/u][/b]", $text);
$text=preg_replace("/\[u\]\[b\](.*?)\[\/u\]\[\/b\]/i","[b][u]\\1[/u][/b]", $text);
$text=preg_replace("/\[b\]\[i\](.*?)\[\/b\]\[\/i\]/i","[b][i]\\1[/i][/b]", $text);
$text=preg_replace("/\[i\]\[b\](.*?)\[\/i\]\[\/b\]/i","[b][i]\\1[/i][/b]", $text);
$text=preg_replace("/\[b\]\[u\](.*?)\[\/b\]\[\/u\]/i","[b][u]\\1[/u][/b]", $text);
$text=preg_replace("/\[u\]\[b\](.*?)\[\/u\]\[\/b\]/i","[b][u]\\1[/u][/b]", $text);
$text=preg_replace("/\[b\]\[small\](.*?)\[\/b\]\[\/small\]/i","[size="1"][b]\\1[/b][/size]", $text);
$text=preg_replace("/\[small\]\[b\](.*?)\[\/small\]\[\/b\]/i","[size="1"][b]\\1[/b][/size]", $text);
$text=preg_replace("/\[i\]\[small\](.*?)\[\/i\]\[\/small\]/i","[size="1"][i]\\1[/i][/size]", $text);
$text=preg_replace("/\[small\]\[i\](.*?)\[\/small\]\[\/i\]/i","[size="1"][i]\\1[/i][/size]", $text);
$text=preg_replace("/\[u\]\[small\](.*?)\[\/u\]\[\/small\]/i","[size="1"][u]\\1[/u][/size]", $text);
$text=preg_replace("/\[small\]\[u\](.*?)\[\/small\]\[\/u\]/i","[size="1"][u]\\1[/u][/size]", $text);
$text=preg_replace("/\[b\]\[big\](.*?)\[\/b\]\[\/big\]/i","[b]\\1[/b]", $text);
$text=preg_replace("/\[big\]\[b\](.*?)\[\/big\]\[\/b\]/i","[b]\\1[/b]", $text);
$text=preg_replace("/\[i\]\[big\](.*?)\[\/i\]\[\/big\]/i","[i]\\1[/i]", $text);
$text=preg_replace("/\[big\]\[i\](.*?)\[\/big\]\[\/i\]/i","[i]\\1[/i]", $text);
$text=preg_replace("/\[u\]\[big\](.*?)\[\/u\]\[\/big\]/i","[u]\\1[/u]", $text);
$text=preg_replace("/\[big\]\[u\](.*?)\[\/big\]\[\/u\]/i","[u]\\1[/u]", $text);
$text=preg_replace("/\[b\](.*?)\[\/b\]/i","[b]\\1[/b]", $text);
$text=preg_replace("/\[u\](.*?)\[\/u\]/i","[u]\\1[/u]", $text);
$text=preg_replace("/\[i\](.*?)\[\/i\]/i","[i]\\1[/i]", $text);
$text=preg_replace("/\[big\](.*?)\[\/big\]/i","\\1", $text);
$text=preg_replace("/\[small\](.*?)\[\/small\]/i","[size="1"]\\1[/size]", $text);
$text=preg_replace("/\[br\/\]/i","
", $text);
$text=preg_replace("/\[url\](.*?)\[\/url\]/i","\\1", $text);
$text=preg_replace("/\[link\=(.*?)\](.*?)\[\/link\]/i","\\2", $text);
$text=preg_replace("/\[img\=((.*?)(.jpg|jpeg))\]/i","", $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','[email="\\1"]\\1[/email]', $text);
}
No comments:
Post a Comment