PHP:
function group_post_bbcode_parse_view($string)
{
// DO [quote]
$open_quote = preg_match_all('/\[quote\=(.*?)\]/i', $string, $matches);
$close_quote = preg_match_all('/\[\/quote\]/i', $string, $matches);
$total_tags = ( $open_quote>$close_quote ? $close_quote : $open_quote );
if( $total_tags )
{
$string = preg_replace('/\[quote\=(.*?)\]/i', "<blockquote><div>".SE_Language::get(2000323, Array('$1'))."</div>", $string, $total_tags);
$string = strrev(preg_replace('/\]etouq\/\[/i', ">etouqkcolb/<", strrev($string), $total_tags));
}
/* // DO [code]
$open_code = preg_match_all('/\[code\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/code\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[code\=?(.*?)\](.*?)\[\/code\]/ie', "'Code:<br /><div class=\'group_discussion_code\'>'.( '\\1'!='' ? '<div class=\'group_discussion_code_title\'>'.'\\1'.'</div>' : '').'\\2'.'</div>'", $string, $total_tags);
}
// DO [b]
$open_code = preg_match_all('/\[b\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/b\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[b\=?(.*?)\](.*?)\[\/b\]/ie', "'<b>'.( '\\1'!='' ? '<b>'.'\\1'.'</b>' : '').'\\2'.'</b>'", $string, $total_tags);
}
// DO [i]
$open_code = preg_match_all('/\[i\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/i\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[i\=?(.*?)\](.*?)\[\/i\]/ie', "'<i>'.( '\\1'!='' ? '<i>'.'\\1'.'</i>' : '').'\\2'.'</i>'", $string, $total_tags);
}
// DO [u]
$open_code = preg_match_all('/\[u\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/u\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[u\=?(.*?)\](.*?)\[\/u\]/ie', "'<u>'.( '\\1'!='' ? '<u>'.'\\1'.'</u>' : '').'\\2'.'</u>'", $string, $total_tags);
}
// DO [s]
$open_code = preg_match_all('/\<s\=?(.*?)\>/i', $string, $matches);
$close_code = preg_match_all('/\<\/s\>/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\<s\=?(.*?)\>(.*?)\<\/s\>/ie', "'<del>'.( '\\1'!='' ? '<del>'.'\\1'.'</del>' : '').'\\2'.'</del>'", $string, $total_tags);
}
// DO [left]
$open_code = preg_match_all('/\[left\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/left\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[left\=?(.*?)\](.*?)\[\/left\]/ie', "'<div align=\'left\'>'.( '\\1'!='' ? '<div align=\'left\'>'.'\\1'.'</div>' : '').'\\2'.'</div>'", $string, $total_tags);
}
// DO [center]
$open_code = preg_match_all('/\[center\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/center\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[center\=?(.*?)\](.*?)\[\/center\]/ie', "'<div align=\'center\'>'.( '\\1'!='' ? '<div align=\'center\'>'.'\\1'.'</div>' : '').'\\2'.'</div>'", $string, $total_tags);
}
// DO [right]
$open_code = preg_match_all('/\[right\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/right\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[right\=?(.*?)\](.*?)\[\/right\]/ie', "'<div align=\'right\'>'.( '\\1'!='' ? '<div align=\'right\'>'.'\\1'.'</div>' : '').'\\2'.'</div>'", $string, $total_tags);
} */
// DO [:bad:]
$open_code = preg_match_all('/\:bad:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('//i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\:bad:\=?(.*?)(.*?)/ie', "' <img src=\'/templates/images/smiles/bad.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/bad.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:biggrin:]
$open_code = preg_match_all('/\[:biggrin:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:biggrin:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/biggrin.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/biggrin.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:blum:]
$open_code = preg_match_all('/\[:blum:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:blum:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/blum.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/blum.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:blush:]
$open_code = preg_match_all('/\[:blush:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:blush:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/blush.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/blush.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:cray:]
$open_code = preg_match_all('/\[:cray:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:cray:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/cray.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/cray.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:crazy:]
$open_code = preg_match_all('/\[:crazy:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:crazy:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/crazy.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/crazy.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:dance:]
$open_code = preg_match_all('/\[:dance:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:dance:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/dance.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/dance.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:diablo:]
$open_code = preg_match_all('/\[:diablo:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:diablo:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/diablo.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/diablo.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:dirol:]
$open_code = preg_match_all('/\[:dirol:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:dirol:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/dirol.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/dirol.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:drinks:]
$open_code = preg_match_all('/\[:drinks:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:drinks:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/drinks.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/drinks.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:fool:]
$open_code = preg_match_all('/\[:fool:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:fool:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/fool.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/fool.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:good:]
$open_code = preg_match_all('/\[:good:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:good:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/good.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/good.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:kiss_mini:]
$open_code = preg_match_all('/\[:kiss_mini:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:kiss_mini:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/kiss_mini.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/kiss_mini.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:man_in_love:]
$open_code = preg_match_all('/\[:man_in_love:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:man_in_love:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/man_in_love.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/man_in_love.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:music:]
$open_code = preg_match_all('/\[:music:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:music:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/music.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/music.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:nea:]
$open_code = preg_match_all('/\[:nea:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:nea:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/nea.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/nea.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:pardon:]
$open_code = preg_match_all('/\[:pardon:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:pardon:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/pardon.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/pardon.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:rofl:]
$open_code = preg_match_all('/\[:rofl:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:rofl:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/rofl.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/rofl.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:rolleyes:]
$open_code = preg_match_all('/\[:rolleyes:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:rolleyes:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/rolleyes.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/rolleyes.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:sad:]
$open_code = preg_match_all('/\[:sad:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:sad:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/sad.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/sad.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:scratch_one-s_head:]
$open_code = preg_match_all('/\[:scratch_one-s_head:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:scratch_one-s_head:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/scratch_one-s_head.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/scratch_one-s_head.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:shok:]
$open_code = preg_match_all('/\[:shok:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:shok:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/shok.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/shok.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:shout:]
$open_code = preg_match_all('/\[:shout:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:shout:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/shout.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/shout.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:smile:]
$open_code = preg_match_all('/\[:smile:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:smile:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/smile.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/smile.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:unknw:]
$open_code = preg_match_all('/\[:unknw:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:unknw:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/unknw.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/unknw.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:wacko2:]
$open_code = preg_match_all('/\[:wacko2:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:wacko2:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/wacko2.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/wacko2.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:wink:]
$open_code = preg_match_all('/\[:wink:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:wink:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/wink.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/wink.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:yahoo:]
$open_code = preg_match_all('/\[:yahoo:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:yahoo:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/yahoo.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/yahoo.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
// DO [:angel:]
$open_code = preg_match_all('/\[:angel:\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[:angel:\=?(.*?)(.*?)\]/ie', "' <img src=\'/templates/images/smiles/angel.gif\'>'.( '\\1'!='' ? '<img src=\'/templates/images/smiles/angel.gif\'>'.'\\1'.' ' : '').'\\2'.' '", $string, $total_tags);
}
/* // DO [size_3]
$open_code = preg_match_all('/\[size_3\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/size\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[size_3\=?(.*?)\](.*?)\[\/size\]/ie', "'<font size=\'3px\'>'.( '\\1'!='' ? '<font size=\'3px\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [size_4]
$open_code = preg_match_all('/\[size_4\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/size\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[size_4\=?(.*?)\](.*?)\[\/size\]/ie', "'<font size=\'4px\'>'.( '\\1'!='' ? '<font size=\'4px\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [size_5]
$open_code = preg_match_all('/\[size_5\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/size\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[size_5\=?(.*?)\](.*?)\[\/size\]/ie', "'<font size=\'5px\'>'.( '\\1'!='' ? '<font size=\'5px\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_aqua]
$open_code = preg_match_all('/\[color_aqua\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_aqua\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'aqua\'>'.( '\\1'!='' ? '<font color=\'aqua\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_black]
$open_code = preg_match_all('/\[color_black\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_black\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'black\'>'.( '\\1'!='' ? '<font color=\'black\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_blue]
$open_code = preg_match_all('/\[color_blue\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_blue\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'blue\'>'.( '\\1'!='' ? '<font color=\'blue\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_fuchsia]
$open_code = preg_match_all('/\[color_fuchsia\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_fuchsia\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'fuchsia\'>'.( '\\1'!='' ? '<font color=\'fuchsia\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_gray]
$open_code = preg_match_all('/\[color_gray\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_gray\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'gray\'>'.( '\\1'!='' ? '<font color=\'gray\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_green]
$open_code = preg_match_all('/\[color_green\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_green\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'green\'>'.( '\\1'!='' ? '<font color=\'green\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_lime]
$open_code = preg_match_all('/\[color_lime\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_lime\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'lime\'>'.( '\\1'!='' ? '<font color=\'lime\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_maroon]
$open_code = preg_match_all('/\[color_maroon\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_maroon\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'maroon\'>'.( '\\1'!='' ? '<font color=\'maroon\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_navy]
$open_code = preg_match_all('/\[color_navy\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_navy\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'navy\'>'.( '\\1'!='' ? '<font color=\'navy\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_olive]
$open_code = preg_match_all('/\[color_olive\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_olive\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'olive\'>'.( '\\1'!='' ? '<font color=\'olive\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_purple]
$open_code = preg_match_all('/\[color_purple\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_purple\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'purple\'>'.( '\\1'!='' ? '<font color=\'purple\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_red]
$open_code = preg_match_all('/\[color_red\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_red\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'red\'>'.( '\\1'!='' ? '<font color=\'red\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_silver]
$open_code = preg_match_all('/\[color_silver\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_silver\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'silver\'>'.( '\\1'!='' ? '<font color=\'silver\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_teal]
$open_code = preg_match_all('/\[color_teal\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_teal\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'teal\'>'.( '\\1'!='' ? '<font color=\'teal\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_white]
$open_code = preg_match_all('/\[color_white\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_white\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'white\'>'.( '\\1'!='' ? '<font color=\'white\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [color_yellow]
$open_code = preg_match_all('/\[color_yellow\=?(.*?)/i', $string, $matches);
$close_code = preg_match_all('/\[\/color\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[color_yellow\=?(.*?)\](.*?)\[\/color\]/ie', "'<font color=\'yellow\'>'.( '\\1'!='' ? '<font color=\'yellow\'>'.'\\1'.'</font>' : '').'\\2'.'</font>'", $string, $total_tags);
}
// DO [img]
$open_code = preg_match_all('/\[img\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/img\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[img\=?(.*?)\](.*?)\[\/img\]/ie', "'<img src=\''.( '\\1'!='' ? '<img src=\''.'\\1'.'\'>' : '').'\\2'.'\'>'", $string, $total_tags);
}
// DO [url]
$open_code = preg_match_all('/\[url\=?(.*?)\]/i', $string, $matches);
$close_code = preg_match_all('/\[\/url\]/i', $string, $matches);
$total_tags = ( ($open_code > $close_code) ? $close_code : $open_code );
if( $total_tags )
{
$string = preg_replace('/\[url\=?(.*?)\](.*?)\[\/url\]/ie', "'<a href=\''.( '\\1'!='' ? '<a href=\''.'\\1'.'\'>Link</a>' : '').'\\2'.'\'>Link</a>'", $string, $total_tags);
}*/
return $string;
}
}
?>