"; $endbefore = "

"; $after = "
"; //Broken quotes $match = '#\[quote ((name=|post=)|name=post=|name=([\w\d ]+?)( *?)post=|name=( *?)post=([\0-9]+?))?\]#si'; //Fix broken quotes $text = preg_replace($match, '[quote]', $text); //Extended quotes regex $exta = '\[quote name=([\w\d ]+?) post=([\0-9]+?)\]'; //name and post $extb = '\[quote name=([\w\d ]+?)\]'; //name only //Count all quotes $qcount = substr_count($text, '[quote]'); $qcount = $qcount + preg_match_all('#'.$exta.'#si', $text, $matches); $qcount = $qcount + preg_match_all('#'.$extb.'#si', $text, $matches); for ($i = 0; $i < $qcount; $i++) { //Replace default quotes $text = preg_replace('#\[quote\](.*?)\[/quote\]#si', $before.$locale['bb_quote'].$endbefore.'$1'.$after, $text); //replace default quote //HTML //Replace extended quotes $text = preg_replace('#'.$exta.'(.*?)\[/quote\]#si', $before.'$1 '.$locale['bb_wrote'].': '.$endbefore.'$3'.$after, $text); //replace quote with valid name and post //HTML $text = preg_replace('#'.$extb.'(.*?)\[/quote\]#si', $before.'$1'.$endbefore.'$2'.$after, $text); //replace quote with valid name and no post //HTML } // Add once only if (!defined('bbcode_quote_js')) { define('bbcode_quote_js', TRUE); add_to_footer(""); }