Resources
1 year ago
Iconv.php
1 year ago
bootstrap.php
1 year ago
bootstrap80.php
1 year ago
index.php
3 years ago
bootstrap80.php
126 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Polyfill\Iconv as p; |
| 5 | if (!\defined('ICONV_IMPL')) { |
| 6 | \define('ICONV_IMPL', 'Symfony'); |
| 7 | } |
| 8 | if (!\defined('ICONV_VERSION')) { |
| 9 | \define('ICONV_VERSION', '1.0'); |
| 10 | } |
| 11 | if (!\defined('ICONV_MIME_DECODE_STRICT')) { |
| 12 | \define('ICONV_MIME_DECODE_STRICT', 1); |
| 13 | } |
| 14 | if (!\defined('ICONV_MIME_DECODE_CONTINUE_ON_ERROR')) { |
| 15 | \define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2); |
| 16 | } |
| 17 | if (!\function_exists('iconv')) { |
| 18 | function iconv(?string $from_encoding, ?string $to_encoding, ?string $string) : string|false |
| 19 | { |
| 20 | return p\Iconv::iconv((string) $from_encoding, (string) $to_encoding, (string) $string); |
| 21 | } |
| 22 | } |
| 23 | if (!\function_exists('iconv_get_encoding')) { |
| 24 | function iconv_get_encoding(?string $type = 'all') : array|string|false |
| 25 | { |
| 26 | return p\Iconv::iconv_get_encoding((string) $type); |
| 27 | } |
| 28 | } |
| 29 | if (!\function_exists('iconv_set_encoding')) { |
| 30 | function iconv_set_encoding(?string $type, ?string $encoding) : bool |
| 31 | { |
| 32 | return p\Iconv::iconv_set_encoding((string) $type, (string) $encoding); |
| 33 | } |
| 34 | } |
| 35 | if (!\function_exists('iconv_mime_encode')) { |
| 36 | function iconv_mime_encode(?string $field_name, ?string $field_value, ?array $options = []) : string|false |
| 37 | { |
| 38 | return p\Iconv::iconv_mime_encode((string) $field_name, (string) $field_value, (array) $options); |
| 39 | } |
| 40 | } |
| 41 | if (!\function_exists('iconv_mime_decode_headers')) { |
| 42 | function iconv_mime_decode_headers(?string $headers, ?int $mode = 0, ?string $encoding = null) : array|false |
| 43 | { |
| 44 | return p\Iconv::iconv_mime_decode_headers((string) $headers, (int) $mode, $encoding); |
| 45 | } |
| 46 | } |
| 47 | if (\extension_loaded('mbstring')) { |
| 48 | if (!\function_exists('iconv_strlen')) { |
| 49 | function iconv_strlen(?string $string, ?string $encoding = null) : int|false |
| 50 | { |
| 51 | null === $encoding && ($encoding = p\Iconv::$internalEncoding); |
| 52 | return \mb_strlen((string) $string, $encoding); |
| 53 | } |
| 54 | } |
| 55 | if (!\function_exists('iconv_strpos')) { |
| 56 | function iconv_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 57 | { |
| 58 | null === $encoding && ($encoding = p\Iconv::$internalEncoding); |
| 59 | return \mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 60 | } |
| 61 | } |
| 62 | if (!\function_exists('iconv_strrpos')) { |
| 63 | function iconv_strrpos(?string $haystack, ?string $needle, ?string $encoding = null) : int|false |
| 64 | { |
| 65 | null === $encoding && ($encoding = p\Iconv::$internalEncoding); |
| 66 | return \mb_strrpos((string) $haystack, (string) $needle, 0, $encoding); |
| 67 | } |
| 68 | } |
| 69 | if (!\function_exists('iconv_substr')) { |
| 70 | function iconv_substr(?string $string, ?int $offset, ?int $length = null, ?string $encoding = null) : string|false |
| 71 | { |
| 72 | null === $encoding && ($encoding = p\Iconv::$internalEncoding); |
| 73 | return \mb_substr((string) $string, (int) $offset, $length, $encoding); |
| 74 | } |
| 75 | } |
| 76 | if (!\function_exists('iconv_mime_decode')) { |
| 77 | function iconv_mime_decode($string, $mode = 0, $encoding = null) |
| 78 | { |
| 79 | $currentMbEncoding = \mb_internal_encoding(); |
| 80 | null === $encoding && ($encoding = p\Iconv::$internalEncoding); |
| 81 | \mb_internal_encoding($encoding); |
| 82 | $decoded = \mb_decode_mimeheader($string); |
| 83 | \mb_internal_encoding($currentMbEncoding); |
| 84 | return $decoded; |
| 85 | } |
| 86 | } |
| 87 | } else { |
| 88 | if (!\function_exists('iconv_strlen')) { |
| 89 | if (\extension_loaded('xml')) { |
| 90 | function iconv_strlen(?string $string, ?string $encoding = null) : int|false |
| 91 | { |
| 92 | return p\Iconv::strlen1((string) $string, $encoding); |
| 93 | } |
| 94 | } else { |
| 95 | function iconv_strlen(?string $string, ?string $encoding = null) : int|false |
| 96 | { |
| 97 | return p\Iconv::strlen2((string) $string, $encoding); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | if (!\function_exists('iconv_strpos')) { |
| 102 | function iconv_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null) : int|false |
| 103 | { |
| 104 | return p\Iconv::iconv_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); |
| 105 | } |
| 106 | } |
| 107 | if (!\function_exists('iconv_strrpos')) { |
| 108 | function iconv_strrpos(?string $haystack, ?string $needle, ?string $encoding = null) : int|false |
| 109 | { |
| 110 | return p\Iconv::iconv_strrpos((string) $haystack, (string) $needle, $encoding); |
| 111 | } |
| 112 | } |
| 113 | if (!\function_exists('iconv_substr')) { |
| 114 | function iconv_substr(?string $string, ?int $offset, ?int $length = null, ?string $encoding = null) : string|false |
| 115 | { |
| 116 | return p\Iconv::iconv_substr((string) $string, (string) $offset, $length, $encoding); |
| 117 | } |
| 118 | } |
| 119 | if (!\function_exists('iconv_mime_decode')) { |
| 120 | function iconv_mime_decode(?string $string, ?int $mode = 0, ?string $encoding = null) : string|false |
| 121 | { |
| 122 | return p\Iconv::iconv_mime_decode((string) $string, (int) $mode, $encoding); |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 |