diff options
Diffstat (limited to 'include')
-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; |