Your IP : 3.142.212.150


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/modules/vote/lib/inner/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/modules/vote/lib/inner/sanitizer.php

<?php
namespace Bitrix\Vote\Inner;

class Sanitizer
{
	private static \CBXSanitizer $sanitizer;

	protected static function getSanitizer(): \CBXSanitizer
	{
		if (!isset(static::$sanitizer))
		{
			$sanitizer = new \CBXSanitizer();
			$sanitizer->applyDoubleEncode(false);
			$sanitizer->setLevel(\CBXSanitizer::SECURE_LEVEL_LOW);
			static::$sanitizer = $sanitizer;
		}
		return static::$sanitizer;
	}

	public static function cleanText(?string $text): string
	{
		if (empty($text) || mb_strpos($text, '<') === false)
		{
			return strval($text);
		}
		return static::getSanitizer()->sanitizeHtml($text);
	}
}