• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/sanitizer.php
  • Класс: CBXSanitizer
  • Вызов: CBXSanitizer::encodeAttributeValue
protected function encodeAttributeValue(array $attr)
	{
		if (!$this->bHtmlSpecChars)
		{
			return $attr[3];
		}

		$result = $attr[3];
		$flags = ENT_QUOTES;

		if ($attr[1] === 'style')
		{
			$flags = ENT_COMPAT;
		}
		elseif ($attr[1] === 'href')
		{
			$result = str_replace('&', '##AMP##', $result);
		}

		$result = htmlspecialchars($result, $flags, LANG_CHARSET, $this->bDoubleEncode);

		if ($attr[1] === 'href')
		{
			$result = str_replace('##AMP##', '&', $result);
		}

		return $result;
	}