bootstrap.php
124 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 (!\defined('ICONV_IMPL')) { |
| 8 | \define('ICONV_IMPL', 'Symfony'); |
| 9 | } |
| 10 | if (!\defined('ICONV_VERSION')) { |
| 11 | \define('ICONV_VERSION', '1.0'); |
| 12 | } |
| 13 | if (!\defined('ICONV_MIME_DECODE_STRICT')) { |
| 14 | \define('ICONV_MIME_DECODE_STRICT', 1); |
| 15 | } |
| 16 | if (!\defined('ICONV_MIME_DECODE_CONTINUE_ON_ERROR')) { |
| 17 | \define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2); |
| 18 | } |
| 19 | if (!\function_exists('iconv')) { |
| 20 | function iconv($from, $to, $s) |
| 21 | { |
| 22 | return p\Iconv::iconv($from, $to, $s); |
| 23 | } |
| 24 | } |
| 25 | if (!\function_exists('iconv_get_encoding')) { |
| 26 | function iconv_get_encoding($type = 'all') |
| 27 | { |
| 28 | return p\Iconv::iconv_get_encoding($type); |
| 29 | } |
| 30 | } |
| 31 | if (!\function_exists('iconv_set_encoding')) { |
| 32 | function iconv_set_encoding($type, $charset) |
| 33 | { |
| 34 | return p\Iconv::iconv_set_encoding($type, $charset); |
| 35 | } |
| 36 | } |
| 37 | if (!\function_exists('iconv_mime_encode')) { |
| 38 | function iconv_mime_encode($name, $value, $pref = null) |
| 39 | { |
| 40 | return p\Iconv::iconv_mime_encode($name, $value, $pref); |
| 41 | } |
| 42 | } |
| 43 | if (!\function_exists('iconv_mime_decode_headers')) { |
| 44 | function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) |
| 45 | { |
| 46 | return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); |
| 47 | } |
| 48 | } |
| 49 | if (\extension_loaded('mbstring')) { |
| 50 | if (!\function_exists('iconv_strlen')) { |
| 51 | function iconv_strlen($s, $enc = null) |
| 52 | { |
| 53 | null === $enc and $enc = p\Iconv::$internalEncoding; |
| 54 | return \mb_strlen($s, $enc); |
| 55 | } |
| 56 | } |
| 57 | if (!\function_exists('iconv_strpos')) { |
| 58 | function iconv_strpos($s, $needle, $offset = 0, $enc = null) |
| 59 | { |
| 60 | null === $enc and $enc = p\Iconv::$internalEncoding; |
| 61 | return \mb_strpos($s, $needle, $offset, $enc); |
| 62 | } |
| 63 | } |
| 64 | if (!\function_exists('iconv_strrpos')) { |
| 65 | function iconv_strrpos($s, $needle, $enc = null) |
| 66 | { |
| 67 | null === $enc and $enc = p\Iconv::$internalEncoding; |
| 68 | return \mb_strrpos($s, $needle, 0, $enc); |
| 69 | } |
| 70 | } |
| 71 | if (!\function_exists('iconv_substr')) { |
| 72 | function iconv_substr($s, $start, $length = 2147483647, $enc = null) |
| 73 | { |
| 74 | null === $enc and $enc = p\Iconv::$internalEncoding; |
| 75 | return \mb_substr($s, $start, $length, $enc); |
| 76 | } |
| 77 | } |
| 78 | if (!\function_exists('iconv_mime_decode')) { |
| 79 | function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) |
| 80 | { |
| 81 | null === $enc and $enc = p\Iconv::$internalEncoding; |
| 82 | return \mb_decode_mimeheader($encodedHeaders, $mode, $enc); |
| 83 | } |
| 84 | } |
| 85 | } else { |
| 86 | if (!\function_exists('iconv_strlen')) { |
| 87 | if (\extension_loaded('xml')) { |
| 88 | function iconv_strlen($s, $enc = null) |
| 89 | { |
| 90 | return p\Iconv::strlen1($s, $enc); |
| 91 | } |
| 92 | } else { |
| 93 | function iconv_strlen($s, $enc = null) |
| 94 | { |
| 95 | return p\Iconv::strlen2($s, $enc); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | if (!\function_exists('iconv_strpos')) { |
| 100 | function iconv_strpos($s, $needle, $offset = 0, $enc = null) |
| 101 | { |
| 102 | return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); |
| 103 | } |
| 104 | } |
| 105 | if (!\function_exists('iconv_strrpos')) { |
| 106 | function iconv_strrpos($s, $needle, $enc = null) |
| 107 | { |
| 108 | return p\Iconv::iconv_strrpos($s, $needle, $enc); |
| 109 | } |
| 110 | } |
| 111 | if (!\function_exists('iconv_substr')) { |
| 112 | function iconv_substr($s, $start, $length = 2147483647, $enc = null) |
| 113 | { |
| 114 | return p\Iconv::iconv_substr($s, $start, $length, $enc); |
| 115 | } |
| 116 | } |
| 117 | if (!\function_exists('iconv_mime_decode')) { |
| 118 | function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) |
| 119 | { |
| 120 | return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 |