1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
emoji.php
См. документацию.
1<?php
2namespace Bitrix\Main\Text;
9class Emoji
10{
11 private static $emojiPattern = '%(?:
12 \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
13 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
14 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
15 )%xs';
16
17 public static function encode($text)
18 {
19 return self::replace($text, function ($m) {
20 return ":".bin2hex($m[0]).":";
21 });
22 }
23
24 public static function decode($text)
25 {
26 return preg_replace_callback("/:([A-F0-9]{8}):/isu", function ($m)
27 {
28 $result = hex2bin($m[1]);
29
30 if (preg_match(self::$emojiPattern, $result))
31 {
32 return $result;
33 }
34
35 return $m[0];
36 }, $text);
37 }
38
45 public static function replace($text, $callback)
46 {
47 return preg_replace_callback(self::$emojiPattern, $callback, $text);
48 }
49
50 public static function getSaveModificator()
51 {
52 return array(
53 array(__CLASS__, 'encode')
54 );
55 }
56
57 public static function getFetchModificator()
58 {
59 return array(
60 array(__CLASS__, 'decode')
61 );
62 }
63}
Определения emoji.php:10
static getFetchModificator()
Определения emoji.php:57
static replace($text, $callback)
Определения emoji.php:45
static getSaveModificator()
Определения emoji.php:50
static encode($text)
Определения emoji.php:17
static decode($text)
Определения emoji.php:24
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$text
Определения template_pdf.php:79