Resources
1 year ago
Mbstring.php
6 months ago
bootstrap.php
1 year ago
bootstrap80.php
1 year ago
index.php
3 years ago
bootstrap80.php
253 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Polyfill\Mbstring as p; |
| 5 | if (!\function_exists('mb_convert_encoding')) { |
| 6 | function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null) : array|string|false |
| 7 | { |
| 8 | return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); |
| 9 | } |
| 10 | } |
| 11 | if (!\function_exists('mb_decode_mimeheader')) { |
| 12 | function mb_decode_mimeheader(?string $string) : string |
| 13 | { |
| 14 | return p\Mbstring::mb_decode_mimeheader((string) $string); |
| 15 | } |
| 16 | } |
| 17 | if (!\function_exists('mb_encode_mimeheader')) { |
| 18 | function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0) : string |
| 19 | { |
| 20 | return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); |
| 21 | } |
| 22 | } |
| 23 | if (!\function_exists('mb_decode_numericentity')) { |
| 24 | function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null) : string |
| 25 | { |
| 26 | return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); |
| 27 | } |
| 28 | } |
| 29 | if (!\function_exists('mb_encode_numericentity')) { |
| 30 | function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = \false) : string |
| 31 | { |
| 32 | return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); |
| 33 | } |
| 34 | } |
| 35 | if (!\function_exists('mb_convert_case')) { |
| 36 | function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null) : string |
| 37 | { |
| 38 | return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); |
| 39 | } |
| 40 | } |
| 41 | if (!\function_exists('mb_internal_encoding')) { |
| 42 | function mb_internal_encoding(?string $encoding = null) : string|bool |
| 43 | { |
| 44 | return p\Mbstring::mb_internal_encoding($encoding); |
| 45 | } |
| 46 | } |
| 47 | if (!\function_exists('mb_language')) { |
| 48 | function mb_language(?string $language = null) : string|bool |
| 49 | { |
| 50 | return p\Mbstring::mb_language($language); |
| 51 | } |
| 52 | } |
| 53 | if (!\function_exists('mb_list_encodings')) { |
| 54 | function mb_list_encodings() : array |
| 55 | { |
| 56 | return p\Mbstring::mb_list_encodings(); |
| 57 | } |
| 58 | } |
| 59 | if (!\function_exists('mb_encoding_aliases')) { |
| 60 | function mb_encoding_aliases(?string $encoding) : array |
| 61 | { |
| 62 | return p\Mbstring::mb_encoding_aliases((string) $encoding); |
| 63 | } |
| 64 | } |
| 65 | if (!\function_exists('mb_check_encoding')) { |
| 66 | function mb_check_encoding(array|string|null $value = null, ?string $encoding = null) : bool |
| 67 | { |
| 68 | return p\Mbstring::mb_check_encoding($value, $encoding); |
| 69 | } |
| 70 | } |
| 71 | if (!\function_exists('mb_detect_encoding')) { |
| 72 | function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = \false) : string|false |
| 73 | { |
| 74 | return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); |
| 75 | } |
| 76 | } |
| 77 | if (!\function_exists('mb_detect_order')) { |
| 78 | function mb_detect_order(array|string|null $encoding = null) : array|bool |
| 79 | { |
| 80 | return p\Mbstring::mb_detect_order($encoding); |
| 81 | } |
| 82 | } |
| 83 | if (!\function_exists('mb_parse_str')) { |
| 84 | function mb_parse_str(?string $string, &$result = []) : bool |
| 85 | { |
| 86 | \parse_str((string) $string, $result); |
| 87 | return (bool) $result; |
| 88 | } |
| 89 | } |
| 90 | if (!\function_exists('mb_strlen')) { |
| 91 | function mb_strlen(?string $string, ?string $encoding = null) : int |
| 92 | { |
| 93 | return p\Mbstring::mb_strlen((string) $string, $encoding); |
| 94 | } |
| 95 | } |
| 96 | if (!\function_exists('mb_strpos')) { |
| 97 | function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 98 | { |
| 99 | return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 100 | } |
| 101 | } |
| 102 | if (!\function_exists('mb_strtolower')) { |
| 103 | function mb_strtolower(?string $string, ?string $encoding = null) : string |
| 104 | { |
| 105 | return p\Mbstring::mb_strtolower((string) $string, $encoding); |
| 106 | } |
| 107 | } |
| 108 | if (!\function_exists('mb_strtoupper')) { |
| 109 | function mb_strtoupper(?string $string, ?string $encoding = null) : string |
| 110 | { |
| 111 | return p\Mbstring::mb_strtoupper((string) $string, $encoding); |
| 112 | } |
| 113 | } |
| 114 | if (!\function_exists('mb_substitute_character')) { |
| 115 | function mb_substitute_character(string|int|null $substitute_character = null) : string|int|bool |
| 116 | { |
| 117 | return p\Mbstring::mb_substitute_character($substitute_character); |
| 118 | } |
| 119 | } |
| 120 | if (!\function_exists('mb_substr')) { |
| 121 | function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null) : string |
| 122 | { |
| 123 | return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); |
| 124 | } |
| 125 | } |
| 126 | if (!\function_exists('mb_stripos')) { |
| 127 | function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 128 | { |
| 129 | return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 130 | } |
| 131 | } |
| 132 | if (!\function_exists('mb_stristr')) { |
| 133 | function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = \false, ?string $encoding = null) : string|false |
| 134 | { |
| 135 | return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); |
| 136 | } |
| 137 | } |
| 138 | if (!\function_exists('mb_strrchr')) { |
| 139 | function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = \false, ?string $encoding = null) : string|false |
| 140 | { |
| 141 | return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); |
| 142 | } |
| 143 | } |
| 144 | if (!\function_exists('mb_strrichr')) { |
| 145 | function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = \false, ?string $encoding = null) : string|false |
| 146 | { |
| 147 | return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); |
| 148 | } |
| 149 | } |
| 150 | if (!\function_exists('mb_strripos')) { |
| 151 | function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 152 | { |
| 153 | return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 154 | } |
| 155 | } |
| 156 | if (!\function_exists('mb_strrpos')) { |
| 157 | function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 158 | { |
| 159 | return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 160 | } |
| 161 | } |
| 162 | if (!\function_exists('mb_strstr')) { |
| 163 | function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = \false, ?string $encoding = null) : string|false |
| 164 | { |
| 165 | return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); |
| 166 | } |
| 167 | } |
| 168 | if (!\function_exists('mb_get_info')) { |
| 169 | function mb_get_info(?string $type = 'all') : array|string|int|false |
| 170 | { |
| 171 | return p\Mbstring::mb_get_info((string) $type); |
| 172 | } |
| 173 | } |
| 174 | if (!\function_exists('mb_http_output')) { |
| 175 | function mb_http_output(?string $encoding = null) : string|bool |
| 176 | { |
| 177 | return p\Mbstring::mb_http_output($encoding); |
| 178 | } |
| 179 | } |
| 180 | if (!\function_exists('mb_strwidth')) { |
| 181 | function mb_strwidth(?string $string, ?string $encoding = null) : int |
| 182 | { |
| 183 | return p\Mbstring::mb_strwidth((string) $string, $encoding); |
| 184 | } |
| 185 | } |
| 186 | if (!\function_exists('mb_substr_count')) { |
| 187 | function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null) : int |
| 188 | { |
| 189 | return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); |
| 190 | } |
| 191 | } |
| 192 | if (!\function_exists('mb_output_handler')) { |
| 193 | function mb_output_handler(?string $string, ?int $status) : string |
| 194 | { |
| 195 | return p\Mbstring::mb_output_handler((string) $string, (int) $status); |
| 196 | } |
| 197 | } |
| 198 | if (!\function_exists('mb_http_input')) { |
| 199 | function mb_http_input(?string $type = null) : array|string|false |
| 200 | { |
| 201 | return p\Mbstring::mb_http_input($type); |
| 202 | } |
| 203 | } |
| 204 | if (!\function_exists('mb_convert_variables')) { |
| 205 | function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars) : string|false |
| 206 | { |
| 207 | return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); |
| 208 | } |
| 209 | } |
| 210 | if (!\function_exists('mb_ord')) { |
| 211 | function mb_ord(?string $string, ?string $encoding = null) : int|false |
| 212 | { |
| 213 | return p\Mbstring::mb_ord((string) $string, $encoding); |
| 214 | } |
| 215 | } |
| 216 | if (!\function_exists('mb_chr')) { |
| 217 | function mb_chr(?int $codepoint, ?string $encoding = null) : string|false |
| 218 | { |
| 219 | return p\Mbstring::mb_chr((int) $codepoint, $encoding); |
| 220 | } |
| 221 | } |
| 222 | if (!\function_exists('mb_scrub')) { |
| 223 | function mb_scrub(?string $string, ?string $encoding = null) : string |
| 224 | { |
| 225 | $encoding ??= \mb_internal_encoding(); |
| 226 | return \mb_convert_encoding((string) $string, $encoding, $encoding); |
| 227 | } |
| 228 | } |
| 229 | if (!\function_exists('mb_str_split')) { |
| 230 | function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null) : array |
| 231 | { |
| 232 | return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); |
| 233 | } |
| 234 | } |
| 235 | if (!\function_exists('mb_str_pad')) { |
| 236 | function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null) : string |
| 237 | { |
| 238 | return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); |
| 239 | } |
| 240 | } |
| 241 | if (\extension_loaded('mbstring')) { |
| 242 | return; |
| 243 | } |
| 244 | if (!\defined('MB_CASE_UPPER')) { |
| 245 | \define('MB_CASE_UPPER', 0); |
| 246 | } |
| 247 | if (!\defined('MB_CASE_LOWER')) { |
| 248 | \define('MB_CASE_LOWER', 1); |
| 249 | } |
| 250 | if (!\defined('MB_CASE_TITLE')) { |
| 251 | \define('MB_CASE_TITLE', 2); |
| 252 | } |
| 253 |