Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sanitizer.php
1<?php
3
5{
6 private static \CBXSanitizer $sanitizer;
7
8 protected static function getSanitizer(): \CBXSanitizer
9 {
10 if (!isset(static::$sanitizer))
11 {
12 $sanitizer = new \CBXSanitizer();
13 $sanitizer->applyDoubleEncode(false);
14 $sanitizer->setLevel(\CBXSanitizer::SECURE_LEVEL_LOW);
15 static::$sanitizer = $sanitizer;
16 }
17 return static::$sanitizer;
18 }
19
20 public static function cleanText(?string $text): string
21 {
22 if (empty($text) || mb_strpos($text, '<') === false)
23 {
24 return strval($text);
25 }
26 return static::getSanitizer()->sanitizeHtml($text);
27 }
28}
static cleanText(?string $text)
Definition sanitizer.php:20