bootstrap.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Iconv as p;
  11. if (extension_loaded('iconv')) {
  12. return;
  13. }
  14. if (!defined('ICONV_IMPL')) {
  15. define('ICONV_IMPL', 'Symfony');
  16. }
  17. if (!defined('ICONV_VERSION')) {
  18. define('ICONV_VERSION', '1.0');
  19. }
  20. if (!defined('ICONV_MIME_DECODE_STRICT')) {
  21. define('ICONV_MIME_DECODE_STRICT', 1);
  22. }
  23. if (!defined('ICONV_MIME_DECODE_CONTINUE_ON_ERROR')) {
  24. define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
  25. }
  26. if (!function_exists('iconv')) {
  27. function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
  28. }
  29. if (!function_exists('iconv_get_encoding')) {
  30. function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
  31. }
  32. if (!function_exists('iconv_set_encoding')) {
  33. function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
  34. }
  35. if (!function_exists('iconv_mime_encode')) {
  36. function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); }
  37. }
  38. if (!function_exists('iconv_mime_decode_headers')) {
  39. function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); }
  40. }
  41. if (extension_loaded('mbstring')) {
  42. if (!function_exists('iconv_strlen')) {
  43. function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); }
  44. }
  45. if (!function_exists('iconv_strpos')) {
  46. function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); }
  47. }
  48. if (!function_exists('iconv_strrpos')) {
  49. function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); }
  50. }
  51. if (!function_exists('iconv_substr')) {
  52. function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); }
  53. }
  54. if (!function_exists('iconv_mime_decode')) {
  55. function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); }
  56. }
  57. } else {
  58. if (!function_exists('iconv_strlen')) {
  59. if (extension_loaded('xml')) {
  60. function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); }
  61. } else {
  62. function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); }
  63. }
  64. }
  65. if (!function_exists('iconv_strpos')) {
  66. function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); }
  67. }
  68. if (!function_exists('iconv_strrpos')) {
  69. function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); }
  70. }
  71. if (!function_exists('iconv_substr')) {
  72. function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); }
  73. }
  74. if (!function_exists('iconv_mime_decode')) {
  75. function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); }
  76. }
  77. }