refactor:去除多余的 htmlspecialchars 参数

This commit is contained in:
妙码生花 2023-08-25 17:10:11 +08:00
parent d5ade8d027
commit 793c7f63ca

View File

@ -58,13 +58,11 @@ if (!function_exists('clean_xss')) {
* 清理XSS
* 通常只用于富文本,比 filter
* @param string $string
* @param bool $htmlspecialchars
* @return string
*/
function clean_xss(string $string, bool $htmlspecialchars = true): string
function clean_xss(string $string): string
{
$string = (new AntiXSS())->xss_clean($string);
return $htmlspecialchars ? htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8') : $string;
return (new AntiXSS())->xss_clean($string);
}
}