rendered paste body//// Convert BBCodes to their HTML equivalent//function do_bbcode($text){ global $lang_common, $pun_user; if (strpos($text, 'quote') !== false) { $text = str_replace('[quote]', '</p><blockquote><div class="incqbox"><p>', $text); $text = preg_replace('#\[quote=("|"|\'|)(.*)\\1\]#seU', '"</p><blockquote><div class=\"incqbox\"><h4>".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\'].":</h4><p>"', $text); $text = preg_replace('#\[\/quote\]\s*#', '</p></div></blockquote><p>', $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 '<strong>$1</strong>', //2 '<em>$1</em>', //3 '<span class="bbu">$1</span>', //4 '<object width="425" height="350"><param name="movie"'. ' value="http://www.youtube.com/v/$3"></param><embed '. 'src="http://www.youtube.com/v/$3" type="application/x-shockwave-flash" '. 'width="425" height="350"></embed></object>', //5 '<object codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab" '. 'height="350" width="425" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616">'. '<param name="src" value="$1" /><param name="custommode" value="Stage6" />'. '<param name="showpostplaybackad" value="false" /><embed type="video/divx" '. 'src="$1" pluginspage="http://go.divx.com/plugin/download/" showpostplaybackad="false" '. 'custommode="Stage6" height="350" width="425" /><param name="autoPlay" value="false" /></object>', //6 '<object width="450" height="370"><embed src="http://www.liveleak.com/player.swf" '. 'width="450" height="370" type="application/x-shockwave-flash" '. 'pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="autostart=false&token=$2" '. 'scale="showall" name="index"></embed></object>', //7 '<div align="center">$1</div>', //8 '<div align="right">$1</div>', //9 '<div align="left">$1</div>', //10 'handle_url_tag(\'$1\')', //11 'handle_url_tag(\'$1\', \'$2\')', //12 '<a href="mailto:$1">$1</a>', //13 '<a href="mailto:$1">$2</a>', //14 '<span style="color: $1">$2</span>', //15 '<object width="400" height="326"><embed style="width:400px; height:326px;" '. 'id="VideoPlayback" type="application/x-shockwave-flash" '. 'src="http://video.google.com/googleplayer.swf?docId=$3&hl=en" flashvars=""></embed></object>', //16 '<object width="400" height="345"><embed src="http://www.metacafe.com/fplayer/$2.swf" '. 'width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" '. 'type="application/x-shockwave-flash"></embed></object>' ); // This thing takes a while! :) $text = preg_replace( $pattern, $replace, $text ); return $text;}