// // Convert BBCodes to their HTML equivalent // function do_bbcode($text) { global $lang_common, $pun_user; if (strpos($text, 'quote') !== false) { $text = str_replace('[quote]', '

', $text); $text = preg_replace('#\[quote=("|"|\'|)(.*)\\1\]#seU', '"

".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\'].":

"', $text); $text = preg_replace('#\[\/quote\]\s*#', '

', $text); } $pattern = array( //1 '#\[b\](.*?)\[/b\]#s', //2 '#\[i\](.*?)\[/i\]#s', //3 '#\[u\](.*?)\[/u\]#s', //4 '#\[youtube\](.*?)youtube(.*?)/watch\?v=(.*?)\[/youtube\]#s', //5 '#\[divx\](.*?)\[/divx\]#s', //6 '#\[liveleak\](.*?)liveleak.com/view\?i=(.*?)\[/liveleak\]#s', //7 '#\[center\](.*?)\[/center\]#s', //8 '#\[right\](.*?)\[/right\]#s', //9 '#\[left\](.*?)\[/left\]#s', //10 '#\[url\]([^\[]*?)\[/url\]#e', //11 '#\[url=([^\[]*?)\](.*?)\[/url\]#e', //12 '#\[email\]([^\[]*?)\[/email\]#', //13 '#\[email=([^\[]*?)\](.*?)\[/email\]#', //14 '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s', //15 '#\[googlevid\](.*?)video.google(.*?)/videoplay\?docid=(.*?)&(.*?)\[/googlevid\]#s', //16 '#\[metacafe\](.*?)metacafe.com/watch/(.*?)/\[/metacafe\]#s' ); $replace = array( //1 '$1', //2 '$1', //3 '$1', //4 '', //5 ''. ''. '', //6 '', //7 '

$1
', //8 '
$1
', //9 '
$1
', //10 'handle_url_tag(\'$1\')', //11 'handle_url_tag(\'$1\', \'$2\')', //12 '$1', //13 '$2', //14 '$2', //15 '', //16 '' ); // This thing takes a while! :) $text = preg_replace( $pattern, $replace, $text ); return $text; }