← All changes
|
vendor_prefixed/twig/symfony/polyfill-mbstring/bootstrap.php
+279
-1
4.3.1
→
3.35.0-dev4
View file →
| @@ -9,8 +9,286 @@ | ||
| 9 | 9 | * |
| 10 | 10 | * For the full copyright and license information, please view the LICENSE |
| 11 | 11 | * file that was distributed with this source code. |
| 12 | 12 | */ |
| 13 | +use ElementorDeps\Symfony\Polyfill\Mbstring as p; | |
| 13 | 14 | if (\PHP_VERSION_ID >= 80000) { |
| 14 | 15 | return require __DIR__ . '/bootstrap80.php'; |
| 15 | 16 | } |
| 16 | -return require __DIR__ . '/bootstrap72.php'; | |
| 17 | +if (!\function_exists('mb_convert_encoding')) { | |
| 18 | + function mb_convert_encoding($string, $to_encoding, $from_encoding = null) | |
| 19 | + { | |
| 20 | + return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); | |
| 21 | + } | |
| 22 | +} | |
| 23 | +if (!\function_exists('mb_decode_mimeheader')) { | |
| 24 | + function mb_decode_mimeheader($string) | |
| 25 | + { | |
| 26 | + return p\Mbstring::mb_decode_mimeheader($string); | |
| 27 | + } | |
| 28 | +} | |
| 29 | +if (!\function_exists('mb_encode_mimeheader')) { | |
| 30 | + function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) | |
| 31 | + { | |
| 32 | + return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); | |
| 33 | + } | |
| 34 | +} | |
| 35 | +if (!\function_exists('mb_decode_numericentity')) { | |
| 36 | + function mb_decode_numericentity($string, $map, $encoding = null) | |
| 37 | + { | |
| 38 | + return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); | |
| 39 | + } | |
| 40 | +} | |
| 41 | +if (!\function_exists('mb_encode_numericentity')) { | |
| 42 | + function mb_encode_numericentity($string, $map, $encoding = null, $hex = \false) | |
| 43 | + { | |
| 44 | + return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); | |
| 45 | + } | |
| 46 | +} | |
| 47 | +if (!\function_exists('mb_convert_case')) { | |
| 48 | + function mb_convert_case($string, $mode, $encoding = null) | |
| 49 | + { | |
| 50 | + return p\Mbstring::mb_convert_case($string, $mode, $encoding); | |
| 51 | + } | |
| 52 | +} | |
| 53 | +if (!\function_exists('mb_internal_encoding')) { | |
| 54 | + function mb_internal_encoding($encoding = null) | |
| 55 | + { | |
| 56 | + return p\Mbstring::mb_internal_encoding($encoding); | |
| 57 | + } | |
| 58 | +} | |
| 59 | +if (!\function_exists('mb_language')) { | |
| 60 | + function mb_language($language = null) | |
| 61 | + { | |
| 62 | + return p\Mbstring::mb_language($language); | |
| 63 | + } | |
| 64 | +} | |
| 65 | +if (!\function_exists('mb_list_encodings')) { | |
| 66 | + function mb_list_encodings() | |
| 67 | + { | |
| 68 | + return p\Mbstring::mb_list_encodings(); | |
| 69 | + } | |
| 70 | +} | |
| 71 | +if (!\function_exists('mb_encoding_aliases')) { | |
| 72 | + function mb_encoding_aliases($encoding) | |
| 73 | + { | |
| 74 | + return p\Mbstring::mb_encoding_aliases($encoding); | |
| 75 | + } | |
| 76 | +} | |
| 77 | +if (!\function_exists('mb_check_encoding')) { | |
| 78 | + function mb_check_encoding($value = null, $encoding = null) | |
| 79 | + { | |
| 80 | + return p\Mbstring::mb_check_encoding($value, $encoding); | |
| 81 | + } | |
| 82 | +} | |
| 83 | +if (!\function_exists('mb_detect_encoding')) { | |
| 84 | + function mb_detect_encoding($string, $encodings = null, $strict = \false) | |
| 85 | + { | |
| 86 | + return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); | |
| 87 | + } | |
| 88 | +} | |
| 89 | +if (!\function_exists('mb_detect_order')) { | |
| 90 | + function mb_detect_order($encoding = null) | |
| 91 | + { | |
| 92 | + return p\Mbstring::mb_detect_order($encoding); | |
| 93 | + } | |
| 94 | +} | |
| 95 | +if (!\function_exists('mb_parse_str')) { | |
| 96 | + function mb_parse_str($string, &$result = []) | |
| 97 | + { | |
| 98 | + \parse_str($string, $result); | |
| 99 | + return (bool) $result; | |
| 100 | + } | |
| 101 | +} | |
| 102 | +if (!\function_exists('mb_strlen')) { | |
| 103 | + function mb_strlen($string, $encoding = null) | |
| 104 | + { | |
| 105 | + return p\Mbstring::mb_strlen($string, $encoding); | |
| 106 | + } | |
| 107 | +} | |
| 108 | +if (!\function_exists('mb_strpos')) { | |
| 109 | + function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) | |
| 110 | + { | |
| 111 | + return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); | |
| 112 | + } | |
| 113 | +} | |
| 114 | +if (!\function_exists('mb_strtolower')) { | |
| 115 | + function mb_strtolower($string, $encoding = null) | |
| 116 | + { | |
| 117 | + return p\Mbstring::mb_strtolower($string, $encoding); | |
| 118 | + } | |
| 119 | +} | |
| 120 | +if (!\function_exists('mb_strtoupper')) { | |
| 121 | + function mb_strtoupper($string, $encoding = null) | |
| 122 | + { | |
| 123 | + return p\Mbstring::mb_strtoupper($string, $encoding); | |
| 124 | + } | |
| 125 | +} | |
| 126 | +if (!\function_exists('mb_substitute_character')) { | |
| 127 | + function mb_substitute_character($substitute_character = null) | |
| 128 | + { | |
| 129 | + return p\Mbstring::mb_substitute_character($substitute_character); | |
| 130 | + } | |
| 131 | +} | |
| 132 | +if (!\function_exists('mb_substr')) { | |
| 133 | + function mb_substr($string, $start, $length = 2147483647, $encoding = null) | |
| 134 | + { | |
| 135 | + return p\Mbstring::mb_substr($string, $start, $length, $encoding); | |
| 136 | + } | |
| 137 | +} | |
| 138 | +if (!\function_exists('mb_stripos')) { | |
| 139 | + function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) | |
| 140 | + { | |
| 141 | + return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); | |
| 142 | + } | |
| 143 | +} | |
| 144 | +if (!\function_exists('mb_stristr')) { | |
| 145 | + function mb_stristr($haystack, $needle, $before_needle = \false, $encoding = null) | |
| 146 | + { | |
| 147 | + return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); | |
| 148 | + } | |
| 149 | +} | |
| 150 | +if (!\function_exists('mb_strrchr')) { | |
| 151 | + function mb_strrchr($haystack, $needle, $before_needle = \false, $encoding = null) | |
| 152 | + { | |
| 153 | + return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); | |
| 154 | + } | |
| 155 | +} | |
| 156 | +if (!\function_exists('mb_strrichr')) { | |
| 157 | + function mb_strrichr($haystack, $needle, $before_needle = \false, $encoding = null) | |
| 158 | + { | |
| 159 | + return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); | |
| 160 | + } | |
| 161 | +} | |
| 162 | +if (!\function_exists('mb_strripos')) { | |
| 163 | + function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) | |
| 164 | + { | |
| 165 | + return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); | |
| 166 | + } | |
| 167 | +} | |
| 168 | +if (!\function_exists('mb_strrpos')) { | |
| 169 | + function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) | |
| 170 | + { | |
| 171 | + return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); | |
| 172 | + } | |
| 173 | +} | |
| 174 | +if (!\function_exists('mb_strstr')) { | |
| 175 | + function mb_strstr($haystack, $needle, $before_needle = \false, $encoding = null) | |
| 176 | + { | |
| 177 | + return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); | |
| 178 | + } | |
| 179 | +} | |
| 180 | +if (!\function_exists('mb_get_info')) { | |
| 181 | + function mb_get_info($type = 'all') | |
| 182 | + { | |
| 183 | + return p\Mbstring::mb_get_info($type); | |
| 184 | + } | |
| 185 | +} | |
| 186 | +if (!\function_exists('mb_http_output')) { | |
| 187 | + function mb_http_output($encoding = null) | |
| 188 | + { | |
| 189 | + return p\Mbstring::mb_http_output($encoding); | |
| 190 | + } | |
| 191 | +} | |
| 192 | +if (!\function_exists('mb_strwidth')) { | |
| 193 | + function mb_strwidth($string, $encoding = null) | |
| 194 | + { | |
| 195 | + return p\Mbstring::mb_strwidth($string, $encoding); | |
| 196 | + } | |
| 197 | +} | |
| 198 | +if (!\function_exists('mb_substr_count')) { | |
| 199 | + function mb_substr_count($haystack, $needle, $encoding = null) | |
| 200 | + { | |
| 201 | + return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); | |
| 202 | + } | |
| 203 | +} | |
| 204 | +if (!\function_exists('mb_output_handler')) { | |
| 205 | + function mb_output_handler($string, $status) | |
| 206 | + { | |
| 207 | + return p\Mbstring::mb_output_handler($string, $status); | |
| 208 | + } | |
| 209 | +} | |
| 210 | +if (!\function_exists('mb_http_input')) { | |
| 211 | + function mb_http_input($type = null) | |
| 212 | + { | |
| 213 | + return p\Mbstring::mb_http_input($type); | |
| 214 | + } | |
| 215 | +} | |
| 216 | +if (!\function_exists('mb_convert_variables')) { | |
| 217 | + function mb_convert_variables($to_encoding, $from_encoding, &...$vars) | |
| 218 | + { | |
| 219 | + return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); | |
| 220 | + } | |
| 221 | +} | |
| 222 | +if (!\function_exists('mb_ord')) { | |
| 223 | + function mb_ord($string, $encoding = null) | |
| 224 | + { | |
| 225 | + return p\Mbstring::mb_ord($string, $encoding); | |
| 226 | + } | |
| 227 | +} | |
| 228 | +if (!\function_exists('mb_chr')) { | |
| 229 | + function mb_chr($codepoint, $encoding = null) | |
| 230 | + { | |
| 231 | + return p\Mbstring::mb_chr($codepoint, $encoding); | |
| 232 | + } | |
| 233 | +} | |
| 234 | +if (!\function_exists('mb_scrub')) { | |
| 235 | + function mb_scrub($string, $encoding = null) | |
| 236 | + { | |
| 237 | + $encoding = null === $encoding ? \mb_internal_encoding() : $encoding; | |
| 238 | + return \mb_convert_encoding($string, $encoding, $encoding); | |
| 239 | + } | |
| 240 | +} | |
| 241 | +if (!\function_exists('mb_str_split')) { | |
| 242 | + function mb_str_split($string, $length = 1, $encoding = null) | |
| 243 | + { | |
| 244 | + return p\Mbstring::mb_str_split($string, $length, $encoding); | |
| 245 | + } | |
| 246 | +} | |
| 247 | +if (!\function_exists('ElementorDeps\\mb_str_pad')) { | |
| 248 | + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null) : string | |
| 249 | + { | |
| 250 | + return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); | |
| 251 | + } | |
| 252 | +} | |
| 253 | +if (!\function_exists('ElementorDeps\\mb_ucfirst')) { | |
| 254 | + function mb_ucfirst(string $string, ?string $encoding = null) : string | |
| 255 | + { | |
| 256 | + return p\Mbstring::mb_ucfirst($string, $encoding); | |
| 257 | + } | |
| 258 | +} | |
| 259 | +if (!\function_exists('ElementorDeps\\mb_lcfirst')) { | |
| 260 | + function mb_lcfirst(string $string, ?string $encoding = null) : string | |
| 261 | + { | |
| 262 | + return p\Mbstring::mb_lcfirst($string, $encoding); | |
| 263 | + } | |
| 264 | +} | |
| 265 | +if (!\function_exists('ElementorDeps\\mb_trim')) { | |
| 266 | + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null) : string | |
| 267 | + { | |
| 268 | + return p\Mbstring::mb_trim($string, $characters, $encoding); | |
| 269 | + } | |
| 270 | +} | |
| 271 | +if (!\function_exists('ElementorDeps\\mb_ltrim')) { | |
| 272 | + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null) : string | |
| 273 | + { | |
| 274 | + return p\Mbstring::mb_ltrim($string, $characters, $encoding); | |
| 275 | + } | |
| 276 | +} | |
| 277 | +if (!\function_exists('ElementorDeps\\mb_rtrim')) { | |
| 278 | + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null) : string | |
| 279 | + { | |
| 280 | + return p\Mbstring::mb_rtrim($string, $characters, $encoding); | |
| 281 | + } | |
| 282 | +} | |
| 283 | +if (\extension_loaded('mbstring')) { | |
| 284 | + return; | |
| 285 | +} | |
| 286 | +if (!\defined('MB_CASE_UPPER')) { | |
| 287 | + \define('MB_CASE_UPPER', 0); | |
| 288 | +} | |
| 289 | +if (!\defined('MB_CASE_LOWER')) { | |
| 290 | + \define('MB_CASE_LOWER', 1); | |
| 291 | +} | |
| 292 | +if (!\defined('MB_CASE_TITLE')) { | |
| 293 | + \define('MB_CASE_TITLE', 2); | |
| 294 | +} | |