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