mirror of
https://github.com/pi-hole/web.git
synced 2026-04-24 02:39:25 +01:00
Create separat convertDomainToIDNA function in func.php
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
@@ -554,4 +554,18 @@ function getGateway() {
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//Convert a given (unicode) domain to IDNA ASCII
|
||||
function convertDomainToIDNA($IDNA) {
|
||||
if (extension_loaded("intl")) {
|
||||
// Be prepared that this may fail and see our comments about "idn_to_utf8
|
||||
if (defined("INTL_IDNA_VARIANT_UTS46")) {
|
||||
$IDNA = idn_to_ascii($IDNA, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
|
||||
} elseif (defined("INTL_IDNA_VARIANT_2003")) {
|
||||
$IDNA = idn_to_ascii($IDNA, IDNA_DEFAULT, INTL_IDNA_VARIANT_2003);
|
||||
}
|
||||
}
|
||||
|
||||
return $IDNA;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user