Bitrix-D7  20.0.0
main/lib/text/converter.php
См. документацию.
1 <?php
2 namespace Bitrix\Main\Text;
3 
4 abstract class Converter
5 {
6  const TEXT = "text";
7  const HTML = "html";
8 
9  private static $htmlConverter;
10  private static $xmlConverter;
11  private static $emptyConverter;
12 
13  public static function getHtmlConverter()
14  {
15  if (self::$htmlConverter == null)
16  self::$htmlConverter = new HtmlConverter();
17  return self::$htmlConverter;
18  }
19 
20  public static function getXmlConverter()
21  {
22  if (self::$xmlConverter == null)
23  self::$xmlConverter = new XmlConverter();
24  return self::$xmlConverter;
25  }
26 
27  public static function getEmptyConverter()
28  {
29  if (self::$emptyConverter == null)
30  self::$emptyConverter = new EmptyConverter();
31  return self::$emptyConverter;
32  }
33 
34  public static function initTextType($textType)
35  {
36  $textType = strtolower($textType);
37  if ($textType != self::TEXT && $textType != self::HTML)
38  $textType = self::TEXT;
39  return $textType;
40  }
41 
42  abstract public function encode($text, $textType = "");
43  abstract public function decode($text, $textType = "");
44 }
Bitrix\Main\Text\Converter\HTML
const HTML
Definition: main/lib/text/converter.php:7
Bitrix\Main\Text\Converter\TEXT
const TEXT
Definition: main/lib/text/converter.php:6
Bitrix\Main\Text\Converter
Definition: main/lib/text/converter.php:4
Bitrix\Main\Text\Converter\getEmptyConverter
static getEmptyConverter()
Definition: main/lib/text/converter.php:27
Bitrix\Main\Text\EmptyConverter
Definition: emptyconverter.php:4
Bitrix\Main\Text\Converter\decode
decode($text, $textType="")
Bitrix\Main\Text
Definition: base32.php:2
Bitrix\Main\Text\Converter\encode
encode($text, $textType="")
Bitrix\Main\Text\Converter\initTextType
static initTextType($textType)
Definition: main/lib/text/converter.php:34
Bitrix\Main\Text\Converter\getXmlConverter
static getXmlConverter()
Definition: main/lib/text/converter.php:20
Bitrix\Main\Text\HtmlConverter
Definition: htmlconverter.php:4
Bitrix\Main\Text\XmlConverter
Definition: xmlconverter.php:4
Bitrix\Main\Text\Converter\getHtmlConverter
static getHtmlConverter()
Definition: main/lib/text/converter.php:13