bootstrap.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 (!function_exists('iconv')) {
  12. define('ICONV_IMPL', 'Symfony');
  13. define('ICONV_VERSION', '1.0');
  14. define('ICONV_MIME_DECODE_STRICT', 1);
  15. define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
  16. function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
  17. function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
  18. function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
  19. function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); }
  20. function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); }
  21. if (extension_loaded('mbstring')) {
  22. function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); }
  23. function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); }
  24. function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); }
  25. function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); }
  26. function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); }
  27. } else {
  28. if (extension_loaded('xml')) {
  29. function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); }
  30. } else {
  31. function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); }
  32. }
  33. function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); }
  34. function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); }
  35. function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); }
  36. function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); }
  37. }
  38. }