/** * Парсит текст комментария к работе * @param string $sText */ public function parseItemComment($sMessage) { $sMessage = preg_replace("/(\\<script)(.*?)(script>)/si", '', $sMessage); $sMessage = htmlspecialchars($sMessage); $sMessage = preg_replace("/(\\<)(.*?)(--\\>)/mi", '' . nl2br("\\2") . '', $sMessage); return Func::hrefActivate(nl2br($sMessage)); }
function cleanMessage($sMessage, $nMaxLenght = 4100) { $sMessage = preg_replace("/(\\<script)(.*?)(script>)/si", '', $sMessage); $sMessage = htmlspecialchars($sMessage); $sMessage = preg_replace("/(\\<)(.*?)(--\\>)/mi", '' . nl2br("\\2") . '', $sMessage); return mb_substr(Func::hrefActivate($sMessage), 0, $nMaxLenght); }
static function cleanComment($text) { $text = preg_replace("/(\\<script)(.*?)(script>)/si", '', "{$text}"); $text = strip_tags($text); $text = str_replace("<!--", "<!--", $text); $text = preg_replace("/(\\<)(.*?)(--\\>)/mi", "" . nl2br("\\2") . "", $text); return Func::hrefActivate($text); }