From ae3db366e50a07b1d960650e8c40a0de09341d10 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 31 Dec 2023 09:54:54 +0100 Subject: deprecate simplepie idna_convert --- include/text.php | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/include/text.php b/include/text.php index 38a207c5d..fc30ed8aa 100644 --- a/include/text.php +++ b/include/text.php @@ -3839,30 +3839,21 @@ function featured_sort($a,$b) { } -// Be aware that punify will convert domain names and pathnames - - -function punify($s) { - require_once('vendor/simplepie/simplepie/idn/idna_convert.class.php'); - $x = new idna_convert(['encoding' => 'utf8']); - return $x->encode($s); - +function unpunify($s) { + if (function_exists('idn_to_utf8') && isset($s)) { + return idn_to_utf8($s); + } + return $s; } -/** - * Be aware that unpunify() will only convert domain names and not pathnames. - * - * @param string $s - * @return string - */ -function unpunify($s) { - require_once('vendor/simplepie/simplepie/idn/idna_convert.class.php'); - $x = new idna_convert(['encoding' => 'utf8']); - return $x->decode($s); +function punify($s) { + if (function_exists('idn_to_ascii') && isset($s)) { + return idn_to_ascii($s); + } + return $s; } - function unique_multidim_array($array, $key) { $temp_array = array(); $i = 0; -- cgit v1.2.3