mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Add option to escape() to keep user lang codes intact #1976
This commit is contained in:
parent
170f7f95b9
commit
8abe1b1d7d
2 changed files with 14 additions and 3 deletions
|
|
@ -180,12 +180,20 @@ function clean_path($path)
|
|||
*
|
||||
* @param string $str The string to escape
|
||||
* @param bool $double_escape Set this to false to skip symbols that are already escaped (default: true)
|
||||
* @param bool $except_lang_code Set this to true to skip user lang codes (default: false)
|
||||
* @return string
|
||||
*/
|
||||
function escape($str, $double_escape = true)
|
||||
function escape($str, $double_escape = true, $except_lang_code = false)
|
||||
{
|
||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||
return htmlspecialchars($str, $flags, 'UTF-8', $double_escape);
|
||||
if ($except_lang_code && preg_match('/^\$user_lang->userLang[0-9]+$/', $str))
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
else
|
||||
{
|
||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||
return htmlspecialchars($str, $flags, 'UTF-8', $double_escape);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue