ok, i figured i'd post a list of bbcodes i put together...
PHP Code:
//////////////////////url bbcode safer////////////////////////////////
$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"urlredir.php?redir=$1&who=$user\">$2</a>",$text);
(safe links... i'll upload urlredir.php as attachment)
//////////////////align codes//////////////////////
$text=preg_replace("/\[left\](.*?)\[\/left\]/i","<p align=\"left\">\\1</p>", $text);
$text=preg_replace("/\[center\](.*?)\[\/center\]/i","<p align=\"center\">\\1</p>", $text);
$text=preg_replace("/\[right\](.*?)\[\/right\]/i","<p align=\"right\">\\1</p>", $text);
$text = preg_replace("/\[div\=(.*?)\](.*?)\[\/div\]/i","<div align=\"$1\">$2</div>",$text);
/////////////////////////////////quote/code bbcode/////////////////////////////
$text = preg_replace("/\[code\](.+?)\[\/code\]/is","<div align=\"left\"><BLOCKQUOTE><b>Code:</b><br/><i>\\1<i/></BLOCKQUOTE></div>", $text);
$text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","<div align=\"left\"><BLOCKQUOTE><b>Quote:<br/></b>\\1</BLOCKQUOTE></div>", $text);
//////////////////////////////search engine bbcodes/////////////////////////////
$text = preg_replace("/\[ufym\=(.*?)\](.*?)\[\/ufym\]/is","<a href=\"http://ufym.net/search.asp?q=$1&s=ufym&sbmt=Search\">ufym:$2</a>",$text);
$text = preg_replace("/\[google\=(.*?)\](.*?)\[\/google\]/is","<a href=\"http://www.google.com/search?q=$1\">Google:$2</a>",$text);
$text = preg_replace("/\[gimg\=(.*?)\](.*?)\[\/gimg\]/is","<a href=\"http://www.google.com/m/search?sa=2&q=$1&site=images\">G-IMG:$2</a>",$text);
$text = preg_replace("/\[vuclip\=(.*?)\](.*?)\[\/vuclip\]/is","<a href=\"http://vuclip.com/s?sn=1&z=1002&k=$1&output=video\">VidSearch:$2</a>",$text);
$text = preg_replace("/\[h2g2\=(.*?)\](.*?)\[\/h2g2\]/i","<a href=\"http://www.bbc.co.uk/dna/h2g2/pda/search?searchtype=article&searchstring=$1&showapproved=1&show=12\">h2g2:$2</a>",$text);
$text = preg_replace("/\[news\=(.*?)\](.*?)\[\/news\]/i","<a href=\"http://news.google.com/news/search?q=$1\">news:$2</a>",$text);
$text = preg_replace("/\[define\=(.*?)\](.*?)\[\/define\]/i","<a href=\"http://lookwayup.com/lwu.exe/lwu/d?s=s&w=$1\">define:$2</a>",$text);
$text = preg_replace("/\[rhyme\=(.*?)\](.*?)\[\/rhyme\]/i","<a href=\"http://www.rhymezone.com/r/rhyme.cgi?Word=$1&typeofrhyme=perfect&org1=syl&org2=l\">rhymez4:$2</a>",$text);
//////////////////////////////@linking (twitter style)////////////////////////////////
if(substr_count($text,"@")<=5)
{
$text=preg_replace("/\@(.*?)\@/i","<font color=\"lime\"><b>@</b></font><a href=\"index.php?action=viewuser&user=\\1&sid=$sid\">\\1</a><font color=\"lime\"><b>@</b></font> ", $text);
}
///////////////extra code to post inbox when mentoined///////////////////////////
if(substr_count($text,"@")<=5)
{
$text=preg_replace("/\@(.*?)\ /i","@<a href=extraz.php?action=statusbar&user=$1&sid=$sid>$1</a>", $text);
(modify to view user)
$number = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_users WHERE name='$1'"));
if ($number[0]>=1)
{
$mem = mysql_fetch_array(mysql_query("SELECT id FROM fun_users WHERE name='$1'"));
$msg = "@$user mentioned you in a status update...";
autopm($msg, $mem[0]);
}
}
Comment