Refined
This commit is contained in:
parent
4542b4a80a
commit
04c8a7d66f
1 changed files with 2 additions and 2 deletions
|
@ -3,8 +3,8 @@
|
|||
function text2html($text,$ifnoe) {
|
||||
if (is_null($text) || preg_match('#^\s*$#',$text)===1)
|
||||
return $ifnoe;
|
||||
$text=htmlspecialchars($text,ENT_QUOTES|ENT_HTML5,'UTF-8');
|
||||
$text=preg_replace('#(https?://.+?)(\n|\s|$|\W\s|\W\n|\W$)#','<a href="$1" target="_blank">$1</a>$2',$text);
|
||||
$text=preg_replace(['#<#','#>#'],['<','>'],$text);
|
||||
$text=preg_replace('#(https?://.+?)(\s|$|\W\s|\W$)#m','<a href="$1" target="_blank">$1</a>$2',$text);
|
||||
$text=nl2br($text);
|
||||
return $text;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue