X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fhtml_entity_decode_php4.php;h=9b90e4bf63710a857e96c519093ac91301ee7acb;hb=7e6e0807990447d2977b970c3a0fd28dc9250194;hp=1ecad710f053238c35af49248154a976780ae129;hpb=9967d9b22e1200e516aadf98ffcbcc65ac1c35bb;p=fa-stable.git diff --git a/reporting/includes/html_entity_decode_php4.php b/reporting/includes/html_entity_decode_php4.php index 1ecad710..9b90e4bf 100644 --- a/reporting/includes/html_entity_decode_php4.php +++ b/reporting/includes/html_entity_decode_php4.php @@ -332,12 +332,20 @@ function html_entity_decode_php4($text_to_convert) { "<" => "<" ); $return_text = strtr($text_to_convert, $htmlentities_table); - $return_text = preg_replace('~&#x([0-9a-f]+);~ei', 'code_to_utf8(hexdec("\\1"))', $return_text); - $return_text = preg_replace('~&#([0-9]+);~e', 'code_to_utf8(\\1)', $return_text); + + if (version_compare(PHP_VERSION, '5.3.0') >= 0 && function_exists("preg_replace_callback")) + { + $return_text = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($m){ return chr(hexdec($m[1]));}, $return_text); + $return_text = preg_replace_callback('~&#([0-9]+);~', function ($m){ return chr($m[1]);}, $return_text); + } + else + { + $return_text = preg_replace('~&#x([0-9a-f]+);~ei', 'code_to_utf8(hexdec("\\1"))', $return_text); + $return_text = preg_replace('~&#([0-9]+);~e', 'code_to_utf8(\\1)', $return_text); + } return $return_text; } //============================================================+ // END OF FILE //============================================================+ -?> \ No newline at end of file