Loading...
DCMS | Дырка dcms social
[hljs class="php"]<?php
/**
* Convert all HTML entities to UTF-8 characters
* Функция декодирует гораздо больше именованных сущностей, чем стандартная html_entity_decode()
* Все dec и hex сущности так же переводятся в UTF-8.
*
* @param string $s
* @param bool $is_htmlspecialchars обрабатывать специальные html сущности? (&lt; &gt; &amp; &quot;)
* @return string
* @link http://www.htmlhelp.com/reference/html40/entities/
* @link http://www.alanwood.net/demos/ent4_frame.html (HTML 4.01 Character Entity References)
* @link http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/...1.asp?frame=true
* @link http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/...2.asp?frame=true
* @link http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/...3.asp?frame=true
*
* @author Nasibullin Rinat <n a s i b u l l i n at starlink ru>
* @charset ANSI
* @version 2.1.12
*/
function utf8_html_entity_decode($s, $is_htmlspecialchars = false)
{
#оптимизация скорости
if (strlen($s) < 4 #по минимальной длине сущности - 4 байта: &#d; &xx;
|| ($pos = strpos($s, '&') === false) || strpos($s, ';', $pos) === false) return $s;
$table = array(
#Latin-1 Entities:
'&nbsp;' => "\xc2\xa0", #no-break space = non-breaking space
'&iexcl;' => "\xc2\xa1", #inverted exclamation mark
'&cent;' => "\xc2\xa2", #cent sign
'&pound;' => "\xc2\xa3", #pound sign
'&curren;' => "\xc2\xa4", #currency sign
'&yen;' => "\xc2\xa5", #yen sign = yuan sign
'&brvbar;' => "\xc2\xa6", #broken bar = broken vertical bar
'&sect;' => "\xc2\xa7", #section sign
'&uml;' => "\xc2\xa8", #diaeresis = spacing diaeresis
'&copy;' => "\xc2\xa9", #copyright sign
'&ordf;' => "\xc2\xaa", #feminine ordinal indicator
'&laquo;' => "\xc2\xab", #left-pointing double angle quotation mark = left pointing guillemet («)
'&not;' => "\xc2\xac", #not sign
'&shy;' => "\xc2\xad", #soft hyphen = discretionary hyphen
'&reg;' => "\xc2\xae", #registered sign = registered trade mark sign
'&macr;' => "\xc2\xaf", #macron = spacing macron = overline = APL overbar
'&deg;' => "\xc2\xb0", #degree sign
'&plusmn;' => "\xc2\xb1", #plus-minus sign = plus-or-minus sign
'&sup2;' => "\xc2\xb2", #superscript two = superscript digit two = squared
'&sup3;' => "\xc2\xb3", #superscript three = superscript digit three = cubed
'&acute;' => "\xc2\xb4", #acute accent = spacing acute
'&micro;' => "\xc2\xb5", #micro sign
'&para;' => "\xc2\xb6", #pilcrow sign = paragraph sign
'&middot;' => "\xc2\xb7", #middle dot = Georgian comma = Greek middle dot
'&cedil;' => "\xc2\xb8", #cedilla = spacing cedilla
'&sup1;' => "\xc2\xb9", #superscript one = superscript digit one
'&ordm;' => "\xc2\xba", #masculine ordinal indicator
'&raquo;' => "\xc2\xbb", #right-pointing double angle quotation mark = right pointing guillemet (»)
'&frac14;' => "\xc2\xbc", #vulgar fraction one quarter = fraction one quarter
'&frac12;' => "\xc2\xbd", #vulgar fraction one half = fraction one half
'&frac34;' => "\xc2\xbe", #vulgar fraction three quarters = fraction three quarters
'&iquest;' => "\xc2\xbf", #inverted question mark = turned question mark
#Latin capital letter
'&Agrave;' => "\xc3\x80", #Latin capital letter A with grave = Latin capital letter A grave
'&Aacute;' => "\xc3\x81", #Latin capital letter A with acute
'&Acirc;' => "\xc3\x82", #Latin capital letter A with circumflex
'&Atilde;' => "\xc3\x83", #Latin capital letter A with tilde
'&Auml;' => "\xc3\x84", #Latin capital letter A with diaeresis
'&Aring;' => "\xc3\x85", #Latin capital letter A with ring above = Latin capital letter A ring
'&AElig;' => "\xc3\x86", #Latin capital letter AE = Latin capital ligature AE
'&Ccedil;' => "\xc3\x87", #Latin capital letter C with cedilla
'&Egrave;' => "\xc3\x88", #Latin capital letter E with grave
'&Eacute;' => "\xc3\x89", #Latin capital letter E with acute
'&Ecirc;' => "\xc3\x8a", #Latin capital letter E with circumflex
'&Euml;' => "\xc3\x8b", #Latin capital letter E with diaeresis
'&Igrave;' => "\xc3\x8c", #Latin capital letter I with grave
'&Iacute;' => "\xc3\x8d", #Latin capital letter I with acute
'&Icirc;' => "\xc3\x8e", #Latin capital letter I with circumflex
'&Iuml;' => "\xc3\x8f", #Latin capital letter I with diaeresis
'&ETH;' => "\xc3\x90", #Latin capital letter ETH
'&Ntilde;' => "\xc3\x91", #Latin capital letter N with tilde
'&Ograve;' => "\xc3\x92", #Latin capital letter O with grave
'&Oacute;' =>
И что это?:/
567773372, файл. Из двига.
Че за файл?
Дырка у тебя в жопе кидала, а это код изменения одних слов в другие, по функционалу хз
Baymax (28.11.2019 в 00:27)
Дырка у тебя в жопе кидала, а это код изменения одних слов в другие, по функционалу хз

Там отверстие :))
И где тут дырка? .гитлерзол.
________
посл. ред. 28.11.2019 в 00:39; всего 2 раз(а); by Pain
Шта? .45.
И где тут узбечки?
Zabil_parol,


if (($pos = strpos($s, '&#')) !== false) #speed optimization
{
#заменяем числовые dec и hex сущности:
$htmlspecialchars_flip = array_flip($htmlspecialchars);
$s = preg_replace(
'/&#((x)[\da-fA-F]{2,4}|\d{1,4});/se',
'(array_key_exists($a = pack("C", $d = ("$2") ? hexdec("$1") : "$1"), $htmlspecialchars_flip) && ! $is_htmlspecialchars) ?
$htmlspecialchars_flip[$a] :
iconv("UCS-2BE", "UTF-8", pack("n", $d))', $s, -1, $pos);
}
return $s;
}
Онлайн: 2
Время:
Gen. 0.1033
(c) ByMAS.RU 2010-2025