Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
htmlconverter.php
1<?php
2namespace Bitrix\Main\Text;
3
5{
6 public function encode($text, $textType = '')
7 {
8 if (is_object($text))
9 {
10 return $text;
11 }
12
13 $textType = Converter::initTextType($textType);
14 if ($textType === Converter::HTML)
15 {
16 return $text;
17 }
18
19 if ($text === null)
20 {
21 return '';
22 }
23
24 return HtmlFilter::encode($text);
25 }
26
27 public function decode($text, $textType = '')
28 {
29 if (is_object($text))
30 {
31 return $text;
32 }
33
34 $textType = Converter::initTextType($textType);
35 if ($textType === Converter::HTML)
36 {
37 return $text;
38 }
39
40 if ($text === null)
41 {
42 return '';
43 }
44
45 return htmlspecialchars_decode($text);
46 }
47}
static initTextType($textType)
Definition converter.php:34
decode($text, $textType='')
encode($text, $textType='')
static encode($string, $flags=ENT_COMPAT, $doubleEncode=true)