Skip to content

Commit dd276fb

Browse files
committed
支持p标记转换
1 parent 1b86ca9 commit dd276fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Extend/Function/extend.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ function h($text, $tags = null) {
208208
$text = preg_replace('/\r?\n/','',$text);
209209
//br
210210
$text = preg_replace('/<br(\s\/)?'.'>/i','[br]',$text);
211+
$text = preg_replace('/<p(\s\/)?'.'>/i','[br]',$text);
211212
$text = preg_replace('/(\[br\]\s*){10,}/i','[br]',$text);
212213
//过滤危险的属性,如:过滤on事件lang js
213214
while(preg_match('/(<[^><]+)( lang|on|action|background|codebase|dynsrc|lowsrc)[^><]+/i',$text,$mat)){
@@ -221,7 +222,7 @@ function h($text, $tags = null) {
221222
}
222223
//允许的HTML标签
223224
$text = preg_replace('/<('.$tags.')( [^><\[\]]*)>/i','[\1\2]',$text);
224-
$text = preg_replace('/<\/('.$tags.')>/Ui','[/\1]',$text);
225+
$text = preg_replace('/<\/('.$tags.')>/Ui','[/\1]',$text);
225226
//过滤多余html
226227
$text = preg_replace('/<\/?(html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml)[^><]*>/i','',$text);
227228
//过滤合法的html标签
@@ -484,4 +485,4 @@ function auto_charset($fContents, $from='gbk', $to='utf-8') {
484485
else {
485486
return $fContents;
486487
}
487-
}
488+
}

0 commit comments

Comments
 (0)