diff options
author | Mario Vavti <mario@mariovavti.com> | 2023-12-31 09:54:54 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2023-12-31 09:54:54 +0100 |
commit | ae3db366e50a07b1d960650e8c40a0de09341d10 (patch) | |
tree | 85ddb011900a5b9f8f5fc8bbf679cd0d2f68bdea /include/text.php | |
parent | c3a235242eb180860ac778743184d2297dd8f3a9 (diff) | |
download | volse-hubzilla-ae3db366e50a07b1d960650e8c40a0de09341d10.tar.gz volse-hubzilla-ae3db366e50a07b1d960650e8c40a0de09341d10.tar.bz2 volse-hubzilla-ae3db366e50a07b1d960650e8c40a0de09341d10.zip |
deprecate simplepie idna_convert
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 29 |
1 files 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; |