IdnaHelper.php 647 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace MGModule\DNSManager2\mgLibs\custom\helpers;
  3. use MGModule\DNSManager2\mgLibs\custom\dns\utils\IDNAConvert;
  4. class IdnaHelper
  5. {
  6. public static function idnaDecode($domain)
  7. {
  8. $idna = new IDNAConvert();
  9. return $idna->decode($domain);
  10. }
  11. public static function idnaEncode($domain)
  12. {
  13. $idna = new IDNAConvert();
  14. return $idna->encode($domain);
  15. }
  16. public static function isDomainIdn($domainName)
  17. {
  18. if(stripos($domainName, 'xn--') === 0)
  19. {
  20. return true;
  21. }
  22. return false;
  23. }
  24. }