1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
html_entity.php
См. документацию.
1<?php
2
4{
5 private static $htmlMnemonics = array(
6 "html" => array(
7 "/&colon;/i", "/&tab;/i", "/&newline;/i"
8 ),
9 "text" => array(
10 ":", "\r", "\n"
11 ),
12 );
13
20 protected static function decodeCb($entity)
21 {
22 $ad = $entity[2];
23 if($ad == ';')
24 $ad="";
25 $num = intval($entity[1]);
26 return chr($num).$ad;
27 }
28
35 protected static function decodeCbHex($entity)
36 {
37 $ad = $entity[2];
38 if($ad==';')
39 $ad="";
40 $num = intval(hexdec($entity[1]));
41 return chr($num).$ad;
42 }
43
51 protected static function decode($string)
52 {
53 $string = preg_replace_callback("/\&\#(\d+)([^\d]|$)/is", array(__CLASS__, "decodeCb"), $string);
54 $string = preg_replace_callback("/\&\#x([\da-f]+)([^\da-f]|$)/is", array(__CLASS__, "decodeCbHex"), $string);
55 $string = preg_replace(self::$htmlMnemonics["html"], self::$htmlMnemonics["text"],$string);
56 return $string;
57 }
58
65 public static function decodeString($pString)
66 {
67 $strY = $pString;
68 $str1 = "";
69 while($str1 <> $strY)
70 {
71 $str1 = $strY;
72 $strY = self::decode($strY);
73 $strY = str_replace("\x00", "", $strY);
74 $strY = preg_replace("/\&\#0+(;|([^\d;]))/is", "\\2", $strY);
75 $strY = preg_replace("/\&\#x0+(;|([^\da-f;]))/is", "\\2", $strY);
76 }
77
78 return $str1;
79 }
80}
static decodeCb($entity)
Определения html_entity.php:20
static decode($string)
Определения html_entity.php:51
static decodeString($pString)
Определения html_entity.php:65
static decodeCbHex($entity)
Определения html_entity.php:35
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$entity