| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
7 |
*
|
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
|
|
9 |
* file that was distributed with this source code.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
use Symfony\Polyfill\Intl\Idn as p;
|
|
|
13 |
|
|
|
14 |
if (extension_loaded('intl')) {
|
|
|
15 |
return;
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
if (\PHP_VERSION_ID >= 80000) {
|
|
|
19 |
return require __DIR__.'/bootstrap80.php';
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
if (!defined('U_IDNA_PROHIBITED_ERROR')) {
|
|
|
23 |
define('U_IDNA_PROHIBITED_ERROR', 66560);
|
|
|
24 |
}
|
|
|
25 |
if (!defined('U_IDNA_ERROR_START')) {
|
|
|
26 |
define('U_IDNA_ERROR_START', 66560);
|
|
|
27 |
}
|
|
|
28 |
if (!defined('U_IDNA_UNASSIGNED_ERROR')) {
|
|
|
29 |
define('U_IDNA_UNASSIGNED_ERROR', 66561);
|
|
|
30 |
}
|
|
|
31 |
if (!defined('U_IDNA_CHECK_BIDI_ERROR')) {
|
|
|
32 |
define('U_IDNA_CHECK_BIDI_ERROR', 66562);
|
|
|
33 |
}
|
|
|
34 |
if (!defined('U_IDNA_STD3_ASCII_RULES_ERROR')) {
|
|
|
35 |
define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563);
|
|
|
36 |
}
|
|
|
37 |
if (!defined('U_IDNA_ACE_PREFIX_ERROR')) {
|
|
|
38 |
define('U_IDNA_ACE_PREFIX_ERROR', 66564);
|
|
|
39 |
}
|
|
|
40 |
if (!defined('U_IDNA_VERIFICATION_ERROR')) {
|
|
|
41 |
define('U_IDNA_VERIFICATION_ERROR', 66565);
|
|
|
42 |
}
|
|
|
43 |
if (!defined('U_IDNA_LABEL_TOO_LONG_ERROR')) {
|
|
|
44 |
define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566);
|
|
|
45 |
}
|
|
|
46 |
if (!defined('U_IDNA_ZERO_LENGTH_LABEL_ERROR')) {
|
|
|
47 |
define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567);
|
|
|
48 |
}
|
|
|
49 |
if (!defined('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR')) {
|
|
|
50 |
define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568);
|
|
|
51 |
}
|
|
|
52 |
if (!defined('U_IDNA_ERROR_LIMIT')) {
|
|
|
53 |
define('U_IDNA_ERROR_LIMIT', 66569);
|
|
|
54 |
}
|
|
|
55 |
if (!defined('U_STRINGPREP_PROHIBITED_ERROR')) {
|
|
|
56 |
define('U_STRINGPREP_PROHIBITED_ERROR', 66560);
|
|
|
57 |
}
|
|
|
58 |
if (!defined('U_STRINGPREP_UNASSIGNED_ERROR')) {
|
|
|
59 |
define('U_STRINGPREP_UNASSIGNED_ERROR', 66561);
|
|
|
60 |
}
|
|
|
61 |
if (!defined('U_STRINGPREP_CHECK_BIDI_ERROR')) {
|
|
|
62 |
define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562);
|
|
|
63 |
}
|
|
|
64 |
if (!defined('IDNA_DEFAULT')) {
|
|
|
65 |
define('IDNA_DEFAULT', 0);
|
|
|
66 |
}
|
|
|
67 |
if (!defined('IDNA_ALLOW_UNASSIGNED')) {
|
|
|
68 |
define('IDNA_ALLOW_UNASSIGNED', 1);
|
|
|
69 |
}
|
|
|
70 |
if (!defined('IDNA_USE_STD3_RULES')) {
|
|
|
71 |
define('IDNA_USE_STD3_RULES', 2);
|
|
|
72 |
}
|
|
|
73 |
if (!defined('IDNA_CHECK_BIDI')) {
|
|
|
74 |
define('IDNA_CHECK_BIDI', 4);
|
|
|
75 |
}
|
|
|
76 |
if (!defined('IDNA_CHECK_CONTEXTJ')) {
|
|
|
77 |
define('IDNA_CHECK_CONTEXTJ', 8);
|
|
|
78 |
}
|
|
|
79 |
if (!defined('IDNA_NONTRANSITIONAL_TO_ASCII')) {
|
|
|
80 |
define('IDNA_NONTRANSITIONAL_TO_ASCII', 16);
|
|
|
81 |
}
|
|
|
82 |
if (!defined('IDNA_NONTRANSITIONAL_TO_UNICODE')) {
|
|
|
83 |
define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32);
|
|
|
84 |
}
|
|
|
85 |
if (!defined('INTL_IDNA_VARIANT_2003')) {
|
|
|
86 |
define('INTL_IDNA_VARIANT_2003', 0);
|
|
|
87 |
}
|
|
|
88 |
if (!defined('INTL_IDNA_VARIANT_UTS46')) {
|
|
|
89 |
define('INTL_IDNA_VARIANT_UTS46', 1);
|
|
|
90 |
}
|
|
|
91 |
if (!defined('IDNA_ERROR_EMPTY_LABEL')) {
|
|
|
92 |
define('IDNA_ERROR_EMPTY_LABEL', 1);
|
|
|
93 |
}
|
|
|
94 |
if (!defined('IDNA_ERROR_LABEL_TOO_LONG')) {
|
|
|
95 |
define('IDNA_ERROR_LABEL_TOO_LONG', 2);
|
|
|
96 |
}
|
|
|
97 |
if (!defined('IDNA_ERROR_DOMAIN_NAME_TOO_LONG')) {
|
|
|
98 |
define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4);
|
|
|
99 |
}
|
|
|
100 |
if (!defined('IDNA_ERROR_LEADING_HYPHEN')) {
|
|
|
101 |
define('IDNA_ERROR_LEADING_HYPHEN', 8);
|
|
|
102 |
}
|
|
|
103 |
if (!defined('IDNA_ERROR_TRAILING_HYPHEN')) {
|
|
|
104 |
define('IDNA_ERROR_TRAILING_HYPHEN', 16);
|
|
|
105 |
}
|
|
|
106 |
if (!defined('IDNA_ERROR_HYPHEN_3_4')) {
|
|
|
107 |
define('IDNA_ERROR_HYPHEN_3_4', 32);
|
|
|
108 |
}
|
|
|
109 |
if (!defined('IDNA_ERROR_LEADING_COMBINING_MARK')) {
|
|
|
110 |
define('IDNA_ERROR_LEADING_COMBINING_MARK', 64);
|
|
|
111 |
}
|
|
|
112 |
if (!defined('IDNA_ERROR_DISALLOWED')) {
|
|
|
113 |
define('IDNA_ERROR_DISALLOWED', 128);
|
|
|
114 |
}
|
|
|
115 |
if (!defined('IDNA_ERROR_PUNYCODE')) {
|
|
|
116 |
define('IDNA_ERROR_PUNYCODE', 256);
|
|
|
117 |
}
|
|
|
118 |
if (!defined('IDNA_ERROR_LABEL_HAS_DOT')) {
|
|
|
119 |
define('IDNA_ERROR_LABEL_HAS_DOT', 512);
|
|
|
120 |
}
|
|
|
121 |
if (!defined('IDNA_ERROR_INVALID_ACE_LABEL')) {
|
|
|
122 |
define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
|
|
|
123 |
}
|
|
|
124 |
if (!defined('IDNA_ERROR_BIDI')) {
|
|
|
125 |
define('IDNA_ERROR_BIDI', 2048);
|
|
|
126 |
}
|
|
|
127 |
if (!defined('IDNA_ERROR_CONTEXTJ')) {
|
|
|
128 |
define('IDNA_ERROR_CONTEXTJ', 4096);
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
if (\PHP_VERSION_ID < 70400) {
|
|
|
132 |
if (!function_exists('idn_to_ascii')) {
|
|
|
133 |
function idn_to_ascii($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = null) { return p\Idn::idn_to_ascii($domain, $flags, $variant, $idna_info); }
|
|
|
134 |
}
|
|
|
135 |
if (!function_exists('idn_to_utf8')) {
|
|
|
136 |
function idn_to_utf8($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = null) { return p\Idn::idn_to_utf8($domain, $flags, $variant, $idna_info); }
|
|
|
137 |
}
|
|
|
138 |
} else {
|
|
|
139 |
if (!function_exists('idn_to_ascii')) {
|
|
|
140 |
function idn_to_ascii($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = null) { return p\Idn::idn_to_ascii($domain, $flags, $variant, $idna_info); }
|
|
|
141 |
}
|
|
|
142 |
if (!function_exists('idn_to_utf8')) {
|
|
|
143 |
function idn_to_utf8($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = null) { return p\Idn::idn_to_utf8($domain, $flags, $variant, $idna_info); }
|
|
|
144 |
}
|
|
|
145 |
}
|