// ###################### Start bbcodeparse ####################### function bbcode($bbcode) { $bbcode = str_replace("<","&lt;",$bbcode); $bbcode = str_replace(">","&gt;",$bbcode); $bbcode = str_replace("<","<",$bbcode); $bbcode = str_replace(">",">",$bbcode); $bbcode = nl2br($bbcode); $searcharray = array( "/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU", "/(\[)(list)(])(.*)(\[\/list\])/siU", "/(\[\*\])/siU", "/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4)(.*)(\[\/url\])/siU", "/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU", "/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU", "/(\[)(url)(])([^\"]*)(\[\/url\])/siU", "/(\[)(b)(])(\r\n)*(.*)(\[\/b\])/siU", "/(\[)(u)(])(\r\n)*(.*)(\[\/u\])/siU", "/(\[)(i)(])(\r\n)*(.*)(\[\/i\])/siU", "/(\[)(php)(])(\r\n)*(.*)(\[\/php\])/siU", "/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU", "/(\[)(pre)(])(\r\n)*(.*)(\[\/pre\])/siU", "/javascript:/si", "/about:/si" ); //'" $replacearray = array( "
    \\7
", "", "
  • ", "\\8", "\\7", "\\5", "\\4", "\\5", "\\5", "\\5", "
    código:
    \\5
    ", "
    código:
    \\5
    ", "
    código:\\5
    ", "java script:", "about :" ); $bbcode = preg_replace($searcharray, $replacearray, $bbcode); $bbcode = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "\"\"", $bbcode); //$bbcode = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "\\5", $bbcode); $bbcode = str_replace("\\'", "'", $bbcode); $codebits = explode("
    código:
    ",$bbcode); list($key,$bbcode) = each($codebits); while (list($key,$val) = each($codebits)) { $sbbits = explode("

    ",$val); $newbits = str_replace("
    ", "", $sbbits[0])."
    ".$sbbits[1]; $bbcode .= "
    code:
    ".$newbits; } return $bbcode; }