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