bootstrap.php 2.7 KB

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