Buongiorno a tutti il fornitore di hosting dove e' ospitato il mio sito web ha fatto un upgrade di versione del php precisamente alla vversione 5.5.38 dopo questo upgrade alcune funzione risultano deprecated, pertanto sto cercando di sostituire appunto tutte le funzioni deprecated.
Nel caso di specie pero' non riesco proprio a sostituire preg_replace con preg_replace_callback vi posto il codice doce devo fare appunto questa modifiche, riuscite a darmi una mano nella sostituzione almeno di una di queste funzioni?
Grazie a tutti in anticipo
<?php
function named_to_numeric ($string) {
global $_entities;
$string = strtr($string, $_entities['latin']);
$string = strtr($string, $_entities['extended']);
return $string;
}
function normalize_numeric ($string) {
global $_entities;
$string = strtr($string, $_entities['cp1251']);
$string = preg_replace('/&#([0-9]+)/e', "'&#x'.dechex('\\1')", $string);
$string = preg_replace('/&#[Xx]([0-9A-Fa-f]+)(;?|([^A-Za-z0-9\;\:\.\-\_]))/', '&#x\\1;\\3', $string);
return $string;
}
function numeric_to_utf8 ($string) {
$string = preg_replace('/&#([0-9]+)/e', "'�'.dechex('\\1')", $string);
$string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', "_hex_to_utf8('\\1')", $string);
return $string;
}
function numeric_to_named ($string) {
global $_entities;
$string = preg_replace('/&#[Xx]([0-9A-Fa-f]+)/e', "'&#'.hexdec('\\1')", $string);
$string = strtr($string, array_flip($_entities['latin']));
$string = strtr($string, array_flip($_entities['extended']));
return $string;
}
function specialchars ($string, $type = 'xml') {
$apos = $type == 'xml' ? ''' : ''';
$specialchars = array (
'"' => '"', '&' => '&',
''' => $apos, '<' => '<',
'>' => '>', '"' => '"',
'&' => '&', "'" => $apos,
'<' => '<', '>' => '>'
);
$string = preg_replace('/&(#?[Xx]?[0-9A-Za-z]+);/', "[[[ENTITY:\\1]]]", $string);
$string = strtr($string, $specialchars);
$string = preg_replace('/\[\[\[ENTITY\[^\]]+)\]\]\]/', "&\\1;", $string);
return $string;
}
function _hex_to_utf8($s)
{
/* IN: string containing one hexadecimal Unicode character
* OUT: string containing one binary UTF-8 character
*/
$c = hexdec($s);
if ($c < 0x80) {
$str = chr($c);
}
else if ($c < 0x800) {
$str = chr(0xC0 | $c>>6) . chr(0x80 | $c & 0x3F);
}
else if ($c < 0x10000) {
$str = chr(0xE0 | $c>>12) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);
}
else if ($c < 0x200000) {
$str = chr(0xF0 | $c>>18) . chr(0x80 | $c>>12 & 0x3F) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);
}
return $str;
}
$_entities['cp1251'] = array (
'€' => '€', '‚' => '‚', 'ƒ' => 'ƒ',
'„' => '„', '…' => '…', '†' => '†',
'‡' => '‡', 'ˆ' => 'ˆ', '‰' => '‰',
'Š' => 'Š', '‹' => '‹', 'Œ' => 'Œ',
'Ž' => 'Ž', '‘' => '‘', '’' => '’',
'“' => '“', '”' => '”', '•' => '•',
'–' => '–', '—' => '—', '˜' => '˜',
'™' => '™', 'š' => 'š', '›' => '›',
'œ' => 'œ', 'ž' => 'ž', 'Ÿ' => 'Ÿ',
);
$_entities['latin'] = array (
' ' => ' ', '¡' => '¡', '¢' => '¢',
'£' => '£', '¤' => '¤', '¥' => '¥',
'¦' => '¦', '§' => '§', '¨' => '¨',
'©' => '©', 'ª' => 'ª', '«' => '«',
'¬' => '¬', '­' => '­', '®' => '®',
'¯' => '¯', '°' => '°', '±' => '±',
'²' => '²', '³' => '³', '´' => '´',
'µ' => 'µ', '¶' => '¶', '·' => '·',
'¸' => '¸', '¹' => '¹', 'º' => 'º',
'»' => '»', '¼' => '¼', '½' => '½',
'¾' => '¾', '¿' => '¿', 'À' => 'À',
'Á' => 'Á', 'Â' => 'Â', 'Ã' => 'Ã',
'Ä' => 'Ä', 'Å' => 'Å', 'Æ' => 'Æ',
'Ç' => 'Ç', 'È' => 'È', 'É' => 'É',
'Ê' => 'Ê', 'Ë' => 'Ë', 'Ì' => 'Ì',
'Í' => 'Í', 'Î' => 'Î', 'Ï' => 'Ï',
'Ð' => 'Ð', 'Ñ' => 'Ñ', 'Ò' => 'Ò',
'Ó' => 'Ó', 'Ô' => 'Ô', 'Õ' => 'Õ',
'Ö' => 'Ö', '×' => '×', 'Ø' => 'Ø',
'Ù' => 'Ù', 'Ú' => 'Ú', 'Û' => 'Û',
'Ü' => 'Ü', 'Ý' => 'Ý', 'Þ' => 'Þ',
'ß' => 'ß', 'à' => 'à', 'á' => 'á',
'â' => 'â', 'ã' => 'ã', 'ä' => 'ä',
'å' => 'å', 'æ' => 'æ', 'ç' => 'ç',
'è' => 'è', 'é' => 'é', 'ê' => 'ê',
'ë' => 'ë', 'ì' => 'ì', 'í' => 'í',
'î' => 'î', 'ï' => 'ï', 'ð' => 'ð',
'ñ' => 'ñ', 'ò' => 'ò', 'ó' => 'ó',
'ô' => 'ô', 'õ' => 'õ', 'ö' => 'ö',
'÷' => '÷', 'ø' => 'ø', 'ù' => 'ù',
'ú' => 'ú', 'û' => 'û', 'ü' => 'ü',
'ý' => 'ý', 'þ' => 'þ', 'ÿ' => 'ÿ',
);
$_entities['extended'] = array (
'&OElig' => 'Œ', '&oelig' => 'å', '&Scaron' => 'Š',
'&scaron' => 'š', '&Yuml' => 'Ÿ', '&circ' => 'ˆ',
'&tilde' => '˜', '&esnp' => ' ', '&emsp' => ' ',
'&thinsp' => ' ', '&zwnj' => '‌', '&zwj' => '‍',
'&lrm' => '‎', '&rlm' => '‏', '&ndash' => '–',
'&mdash' => '—', '&lsquo' => '‘', '&rsquo' => '’',
'&sbquo' => '‚', '&ldquo' => '“', '&rdquo' => '”',
'&bdquo' => '„', '&dagger' => '†', '&Dagger' => '‡',
'&permil' => '‰', '&lsaquo' => '‹', '&rsaquo' => '›',
'&euro' => '€', '&fnof' => 'ƒ', '&Alpha' => 'Α',
);
?>