You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
2.7 KiB

  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Intl\Idn as p;
  11. if (!defined('IDNA_DEFAULT')) {
  12. define('U_IDNA_PROHIBITED_ERROR', 66560);
  13. define('U_IDNA_ERROR_START', 66560);
  14. define('U_IDNA_UNASSIGNED_ERROR', 66561);
  15. define('U_IDNA_CHECK_BIDI_ERROR', 66562);
  16. define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563);
  17. define('U_IDNA_ACE_PREFIX_ERROR', 66564);
  18. define('U_IDNA_VERIFICATION_ERROR', 66565);
  19. define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566);
  20. define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567);
  21. define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568);
  22. define('U_IDNA_ERROR_LIMIT', 66569);
  23. define('U_STRINGPREP_PROHIBITED_ERROR', 66560);
  24. define('U_STRINGPREP_UNASSIGNED_ERROR', 66561);
  25. define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562);
  26. define('IDNA_DEFAULT', 0);
  27. define('IDNA_ALLOW_UNASSIGNED', 1);
  28. define('IDNA_USE_STD3_RULES', 2);
  29. define('IDNA_CHECK_BIDI', 4);
  30. define('IDNA_CHECK_CONTEXTJ', 8);
  31. define('IDNA_NONTRANSITIONAL_TO_ASCII', 16);
  32. define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32);
  33. define('INTL_IDNA_VARIANT_2003', 0);
  34. define('INTL_IDNA_VARIANT_UTS46', 1);
  35. define('IDNA_ERROR_EMPTY_LABEL', 1);
  36. define('IDNA_ERROR_LABEL_TOO_LONG', 2);
  37. define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4);
  38. define('IDNA_ERROR_LEADING_HYPHEN', 8);
  39. define('IDNA_ERROR_TRAILING_HYPHEN', 16);
  40. define('IDNA_ERROR_HYPHEN_3_4', 32);
  41. define('IDNA_ERROR_LEADING_COMBINING_MARK', 64);
  42. define('IDNA_ERROR_DISALLOWED', 128);
  43. define('IDNA_ERROR_PUNYCODE', 256);
  44. define('IDNA_ERROR_LABEL_HAS_DOT', 512);
  45. define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
  46. define('IDNA_ERROR_BIDI', 2048);
  47. define('IDNA_ERROR_CONTEXTJ', 4096);
  48. }
  49. if (!function_exists('idn_to_ascii')) {
  50. if (PHP_VERSION_ID < 70400) {
  51. function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
  52. function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
  53. } else {
  54. function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
  55. function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
  56. }
  57. }