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 сущности? (< > & ")
* @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:
' ' => "\xc2\xa0", #no-break space = non-breaking space
'¡' => "\xc2\xa1", #inverted exclamation mark
'¢' => "\xc2\xa2", #cent sign
'£' => "\xc2\xa3", #pound sign
'¤' => "\xc2\xa4", #currency sign
'¥' => "\xc2\xa5", #yen sign = yuan sign
'¦' => "\xc2\xa6", #broken bar = broken vertical bar
'§' => "\xc2\xa7", #section sign
'¨' => "\xc2\xa8", #diaeresis = spacing diaeresis
'©' => "\xc2\xa9", #copyright sign
'ª' => "\xc2\xaa", #feminine ordinal indicator
'«' => "\xc2\xab", #left-pointing double angle quotation mark = left pointing guillemet («)
'¬' => "\xc2\xac", #not sign
'­' => "\xc2\xad", #soft hyphen = discretionary hyphen
'®' => "\xc2\xae", #registered sign = registered trade mark sign
'¯' => "\xc2\xaf", #macron = spacing macron = overline = APL overbar
'°' => "\xc2\xb0", #degree sign
'±' => "\xc2\xb1", #plus-minus sign = plus-or-minus sign
'²' => "\xc2\xb2", #superscript two = superscript digit two = squared
'³' => "\xc2\xb3", #superscript three = superscript digit three = cubed
'´' => "\xc2\xb4", #acute accent = spacing acute
'µ' => "\xc2\xb5", #micro sign
'¶' => "\xc2\xb6", #pilcrow sign = paragraph sign
'·' => "\xc2\xb7", #middle dot = Georgian comma = Greek middle dot
'¸' => "\xc2\xb8", #cedilla = spacing cedilla
'¹' => "\xc2\xb9", #superscript one = superscript digit one
'º' => "\xc2\xba", #masculine ordinal indicator
'»' => "\xc2\xbb", #right-pointing double angle quotation mark = right pointing guillemet (»)
'¼' => "\xc2\xbc", #vulgar fraction one quarter = fraction one quarter
'½' => "\xc2\xbd", #vulgar fraction one half = fraction one half
'¾' => "\xc2\xbe", #vulgar fraction three quarters = fraction three quarters
'¿' => "\xc2\xbf", #inverted question mark = turned question mark
#Latin capital letter
'À' => "\xc3\x80", #Latin capital letter A with grave = Latin capital letter A grave
'Á' => "\xc3\x81", #Latin capital letter A with acute
'Â' => "\xc3\x82", #Latin capital letter A with circumflex
'Ã' => "\xc3\x83", #Latin capital letter A with tilde
'Ä' => "\xc3\x84", #Latin capital letter A with diaeresis
'Å' => "\xc3\x85", #Latin capital letter A with ring above = Latin capital letter A ring
'Æ' => "\xc3\x86", #Latin capital letter AE = Latin capital ligature AE
'Ç' => "\xc3\x87", #Latin capital letter C with cedilla
'È' => "\xc3\x88", #Latin capital letter E with grave
'É' => "\xc3\x89", #Latin capital letter E with acute
'Ê' => "\xc3\x8a", #Latin capital letter E with circumflex
'Ë' => "\xc3\x8b", #Latin capital letter E with diaeresis
'Ì' => "\xc3\x8c", #Latin capital letter I with grave
'Í' => "\xc3\x8d", #Latin capital letter I with acute
'Î' => "\xc3\x8e", #Latin capital letter I with circumflex
'Ï' => "\xc3\x8f", #Latin capital letter I with diaeresis
'Ð' => "\xc3\x90", #Latin capital letter ETH
'Ñ' => "\xc3\x91", #Latin capital letter N with tilde
'Ò' => "\xc3\x92", #Latin capital letter O with grave
'Ó' =>
/**
* Convert all HTML entities to UTF-8 characters
* Функция декодирует гораздо больше именованных сущностей, чем стандартная html_entity_decode()
* Все dec и hex сущности так же переводятся в UTF-8.
*
* @param string $s
* @param bool $is_htmlspecialchars обрабатывать специальные html сущности? (< > & ")
* @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:
' ' => "\xc2\xa0", #no-break space = non-breaking space
'¡' => "\xc2\xa1", #inverted exclamation mark
'¢' => "\xc2\xa2", #cent sign
'£' => "\xc2\xa3", #pound sign
'¤' => "\xc2\xa4", #currency sign
'¥' => "\xc2\xa5", #yen sign = yuan sign
'¦' => "\xc2\xa6", #broken bar = broken vertical bar
'§' => "\xc2\xa7", #section sign
'¨' => "\xc2\xa8", #diaeresis = spacing diaeresis
'©' => "\xc2\xa9", #copyright sign
'ª' => "\xc2\xaa", #feminine ordinal indicator
'«' => "\xc2\xab", #left-pointing double angle quotation mark = left pointing guillemet («)
'¬' => "\xc2\xac", #not sign
'­' => "\xc2\xad", #soft hyphen = discretionary hyphen
'®' => "\xc2\xae", #registered sign = registered trade mark sign
'¯' => "\xc2\xaf", #macron = spacing macron = overline = APL overbar
'°' => "\xc2\xb0", #degree sign
'±' => "\xc2\xb1", #plus-minus sign = plus-or-minus sign
'²' => "\xc2\xb2", #superscript two = superscript digit two = squared
'³' => "\xc2\xb3", #superscript three = superscript digit three = cubed
'´' => "\xc2\xb4", #acute accent = spacing acute
'µ' => "\xc2\xb5", #micro sign
'¶' => "\xc2\xb6", #pilcrow sign = paragraph sign
'·' => "\xc2\xb7", #middle dot = Georgian comma = Greek middle dot
'¸' => "\xc2\xb8", #cedilla = spacing cedilla
'¹' => "\xc2\xb9", #superscript one = superscript digit one
'º' => "\xc2\xba", #masculine ordinal indicator
'»' => "\xc2\xbb", #right-pointing double angle quotation mark = right pointing guillemet (»)
'¼' => "\xc2\xbc", #vulgar fraction one quarter = fraction one quarter
'½' => "\xc2\xbd", #vulgar fraction one half = fraction one half
'¾' => "\xc2\xbe", #vulgar fraction three quarters = fraction three quarters
'¿' => "\xc2\xbf", #inverted question mark = turned question mark
#Latin capital letter
'À' => "\xc3\x80", #Latin capital letter A with grave = Latin capital letter A grave
'Á' => "\xc3\x81", #Latin capital letter A with acute
'Â' => "\xc3\x82", #Latin capital letter A with circumflex
'Ã' => "\xc3\x83", #Latin capital letter A with tilde
'Ä' => "\xc3\x84", #Latin capital letter A with diaeresis
'Å' => "\xc3\x85", #Latin capital letter A with ring above = Latin capital letter A ring
'Æ' => "\xc3\x86", #Latin capital letter AE = Latin capital ligature AE
'Ç' => "\xc3\x87", #Latin capital letter C with cedilla
'È' => "\xc3\x88", #Latin capital letter E with grave
'É' => "\xc3\x89", #Latin capital letter E with acute
'Ê' => "\xc3\x8a", #Latin capital letter E with circumflex
'Ë' => "\xc3\x8b", #Latin capital letter E with diaeresis
'Ì' => "\xc3\x8c", #Latin capital letter I with grave
'Í' => "\xc3\x8d", #Latin capital letter I with acute
'Î' => "\xc3\x8e", #Latin capital letter I with circumflex
'Ï' => "\xc3\x8f", #Latin capital letter I with diaeresis
'Ð' => "\xc3\x90", #Latin capital letter ETH
'Ñ' => "\xc3\x91", #Latin capital letter N with tilde
'Ò' => "\xc3\x92", #Latin capital letter O with grave
'Ó' =>
И что это?:/
567773372, файл. Из двига.
Дырка у тебя в жопе кидала, а это код изменения одних слов в другие, по функционалу хз

DELETED
28 ноября 2019, в 0:35
Delete
Baymax (28.11.2019 в 00:27)
Дырка у тебя в жопе кидала, а это код изменения одних слов в другие, по функционалу хз
Дырка у тебя в жопе кидала, а это код изменения одних слов в другие, по функционалу хз
Там отверстие

И где тут дырка?
________
посл. ред. 28.11.2019 в 00:39; всего 2 раз(а); by Pain

________
посл. ред. 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;
}
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;
}