- Модуль: security
- Путь к файлу: ~/bitrix/modules/security/classes/general/post_filter.php
- Класс: CSecurityXSSDetect
- Вызов: CSecurityXSSDetect::removeQuotedStrings
public function removeQuotedStrings($string, $isSaveQuotes = true)
{
// http://stackoverflow.com/questions/5695240/php-regex-to-ignore-escaped-quotes-within-quotes
// ToDo: R&D, what about JS comments?
static $regexp = '/(
"[^"\\]*(?:\\.[^"\\]*)*" # match double quoted string
|
'[^'\\]*(?:\\.[^'\\]*)*' # match single quoted string
)/xs';
if ($isSaveQuotes)
{
$this->quotes = array();
return preg_replace_callback($regexp, array($this, "pushQuote"), $string);
}
return preg_replace($regexp, '', $string);
}