Improve escape_css() to accept most common CSS expressions

This commit is contained in:
Kijin Sung 2025-03-18 23:53:06 +09:00
parent 62eb6b2aae
commit baadb36e37
2 changed files with 4 additions and 2 deletions

View file

@ -205,7 +205,7 @@ function escape($str, bool $double_escape = true, bool $except_lang_code = false
*/
function escape_css(string $str): string
{
return preg_replace('/[^a-zA-Z0-9_.#\/-]/', '', (string)$str);
return preg_replace('/[^a-zA-Z0-9_.,#%\/\'()\x20-]/', '', (string)$str);
}
/**