Esempio n. 1
0
 function BBParseToHTML($text, $bForList = false)
 {
     if ($text != "") {
         if (!is_object(self::$TextParser)) {
             self::$TextParser = new CTextParser();
             self::$TextParser->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "Y", "LIST" => "Y", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
         }
         $html = self::$TextParser->convertText($text);
         if ($bForList) {
             $html = preg_replace(array("/\\[st_title\\](.+?)\\[\\/st_title\\]/is" . BX_UTF_PCRE_MODIFIER, "/<br(.+?)>/is" . BX_UTF_PCRE_MODIFIER, "/<\\/??ol(.+?)>/is" . BX_UTF_PCRE_MODIFIER, "/<\\/??ul(.+?)>/is" . BX_UTF_PCRE_MODIFIER, "/<\\/??li(.+?)>/is" . BX_UTF_PCRE_MODIFIER, "/<\\/??w+(.+?)>/is" . BX_UTF_PCRE_MODIFIER), " ", $html);
             $html = preg_replace(array("/\\[st_title\\]/is" . BX_UTF_PCRE_MODIFIER, "/\\[\\/st_title\\]/is" . BX_UTF_PCRE_MODIFIER), "", $html);
             if (strlen($html) > 40) {
                 $html = substr($html, 0, 40) . "...";
             }
         } else {
             $html = preg_replace("/\\[st_title\\](.*?)\\[\\/st_title\\]/is" . BX_UTF_PCRE_MODIFIER, "<span class=\"bxst-title\">\\1</span> ", $html);
             // ?
             $html = preg_replace(array("/\\[st_title\\]/is" . BX_UTF_PCRE_MODIFIER, "/\\[\\/st_title\\]/is" . BX_UTF_PCRE_MODIFIER), "", $html);
         }
     }
     return $html;
 }