Bitrix-D7  20.0.0
htmlconverter.php
См. документацию.
1 <?php
2 namespace Bitrix\Main\Text;
3 
4 class HtmlConverter extends Converter
5 {
6  public function encode($text, $textType = "")
7  {
8  if (is_object($text))
9  return $text;
10 
11  $textType = Converter::initTextType($textType);
12 
13  if ($textType == Converter::HTML)
14  return $text;
15 
16  return HtmlFilter::encode($text);
17  }
18 
19  public function decode($text, $textType = "")
20  {
21  if (is_object($text))
22  return $text;
23 
24  $textType = Converter::initTextType($textType);
25 
26  if ($textType == Converter::HTML)
27  return $text;
28 
29  return htmlspecialchars_decode($text);
30  }
31 }
Bitrix\Main\Text\Converter\HTML
const HTML
Definition: main/lib/text/converter.php:7
Bitrix\Main\Text\HtmlConverter\encode
encode($text, $textType="")
Definition: htmlconverter.php:6
Bitrix\Main\Text\Converter
Definition: main/lib/text/converter.php:4
Bitrix\Main\Text
Definition: base32.php:2
Bitrix\Main\Text\Converter\initTextType
static initTextType($textType)
Definition: main/lib/text/converter.php:34
Bitrix\Main\Text\HtmlConverter\decode
decode($text, $textType="")
Definition: htmlconverter.php:19
Bitrix\Main\Text\HtmlConverter
Definition: htmlconverter.php:4
Bitrix\Main\Text\HtmlFilter\encode
static encode($string, $flags=ENT_COMPAT)
Definition: htmlfilter.php:12