* - string: data to convert */ function tpl_modifier_bbcode2html($data) { $data = nl2br(stripslashes(addslashes($data))); $search = array("\n", "\r", "[b]", "[/b]", "[i]", "[/i]", "[u]", "[/u]"); $replace = array("", "", "", "", "", "", "", ""); $data = str_replace($search, $replace, $data); $search = array( "/\[email\](.*?)\[\/email\]/si", "/\[email=(.*?)\](.*?)\[\/email\]/si", "/\[url\](.*?)\[\/url\]/si", "/\[url=(.*?)\](.*?)\[\/url\]/si", "/\[img\](.*?)\[\/img\]/si", "/\[code\](.*?)\[\/code\]/si", "/\[pre\](.*?)\[\/pre\]/si", "/\[list\](.*?)\[\/list\]/si", "/\[\*\](.*?)/si" ); $replace = array( "\\1", "\\2", "\\1", "\\2", "", "
code:", "\\1
\\1", "