bootstrap80.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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\Mbstring as p;
  11. if (!function_exists('mb_convert_encoding')) {
  12. /**
  13. * @param mixed[]|string|null $string
  14. * @param mixed[]|string|null $from_encoding
  15. * @return mixed[]|string|false
  16. */
  17. function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
  18. }
  19. if (!function_exists('mb_decode_mimeheader')) {
  20. function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader((string) $string); }
  21. }
  22. if (!function_exists('mb_encode_mimeheader')) {
  23. function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
  24. }
  25. if (!function_exists('mb_decode_numericentity')) {
  26. function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
  27. }
  28. if (!function_exists('mb_encode_numericentity')) {
  29. function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
  30. }
  31. if (!function_exists('mb_convert_case')) {
  32. function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
  33. }
  34. if (!function_exists('mb_internal_encoding')) {
  35. /**
  36. * @return string|bool
  37. */
  38. function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
  39. }
  40. if (!function_exists('mb_language')) {
  41. /**
  42. * @return string|bool
  43. */
  44. function mb_language($language = null) { return p\Mbstring::mb_language($language); }
  45. }
  46. if (!function_exists('mb_list_encodings')) {
  47. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  48. }
  49. if (!function_exists('mb_encoding_aliases')) {
  50. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
  51. }
  52. if (!function_exists('mb_check_encoding')) {
  53. /**
  54. * @param mixed[]|string|null $value
  55. */
  56. function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
  57. }
  58. if (!function_exists('mb_detect_encoding')) {
  59. /**
  60. * @param mixed[]|string|null $encodings
  61. * @return string|false
  62. */
  63. function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
  64. }
  65. if (!function_exists('mb_detect_order')) {
  66. /**
  67. * @param mixed[]|string|null $encoding
  68. * @return mixed[]|bool
  69. */
  70. function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
  71. }
  72. if (!function_exists('mb_parse_str')) {
  73. function mb_parse_str($string, &$result = []) { parse_str((string) $string, $result); return (bool) $result; }
  74. }
  75. if (!function_exists('mb_strlen')) {
  76. function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen((string) $string, $encoding); }
  77. }
  78. if (!function_exists('mb_strpos')) {
  79. /**
  80. * @return int|false
  81. */
  82. function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  83. }
  84. if (!function_exists('mb_strtolower')) {
  85. function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
  86. }
  87. if (!function_exists('mb_strtoupper')) {
  88. function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
  89. }
  90. if (!function_exists('mb_substitute_character')) {
  91. /**
  92. * @param string|int|null $substitute_character
  93. * @return string|int|bool
  94. */
  95. function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
  96. }
  97. if (!function_exists('mb_substr')) {
  98. function mb_substr($string, $start, $length = null, $encoding = null) { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
  99. }
  100. if (!function_exists('mb_stripos')) {
  101. /**
  102. * @return int|false
  103. */
  104. function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  105. }
  106. if (!function_exists('mb_stristr')) {
  107. /**
  108. * @return string|false
  109. */
  110. function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  111. }
  112. if (!function_exists('mb_strrchr')) {
  113. /**
  114. * @return string|false
  115. */
  116. function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  117. }
  118. if (!function_exists('mb_strrichr')) {
  119. /**
  120. * @return string|false
  121. */
  122. function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  123. }
  124. if (!function_exists('mb_strripos')) {
  125. /**
  126. * @return int|false
  127. */
  128. function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  129. }
  130. if (!function_exists('mb_strrpos')) {
  131. /**
  132. * @return int|false
  133. */
  134. function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  135. }
  136. if (!function_exists('mb_strstr')) {
  137. /**
  138. * @return string|false
  139. */
  140. function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  141. }
  142. if (!function_exists('mb_get_info')) {
  143. /**
  144. * @return mixed[]|string|int|false
  145. */
  146. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info((string) $type); }
  147. }
  148. if (!function_exists('mb_http_output')) {
  149. /**
  150. * @return string|bool
  151. */
  152. function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
  153. }
  154. if (!function_exists('mb_strwidth')) {
  155. function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
  156. }
  157. if (!function_exists('mb_substr_count')) {
  158. function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
  159. }
  160. if (!function_exists('mb_output_handler')) {
  161. function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
  162. }
  163. if (!function_exists('mb_http_input')) {
  164. /**
  165. * @return mixed[]|string|false
  166. */
  167. function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
  168. }
  169. if (!function_exists('mb_convert_variables')) {
  170. /**
  171. * @param mixed[]|string|null $from_encoding
  172. * @return string|false
  173. * @param mixed $var
  174. * @param mixed ...$vars
  175. */
  176. function mb_convert_variables($to_encoding, $from_encoding, &$var, &...$vars) { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
  177. }
  178. if (!function_exists('mb_ord')) {
  179. /**
  180. * @return int|false
  181. */
  182. function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord((string) $string, $encoding); }
  183. }
  184. if (!function_exists('mb_chr')) {
  185. /**
  186. * @return string|false
  187. */
  188. function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
  189. }
  190. if (!function_exists('mb_scrub')) {
  191. function mb_scrub($string, $encoding = null) { $encoding = $encoding ?? mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
  192. }
  193. if (!function_exists('mb_str_split')) {
  194. function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
  195. }
  196. if (!function_exists('mb_str_pad')) {
  197. function mb_str_pad($string, $length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT, $encoding = null) { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
  198. }
  199. if (extension_loaded('mbstring')) {
  200. return;
  201. }
  202. if (!defined('MB_CASE_UPPER')) {
  203. define('MB_CASE_UPPER', 0);
  204. }
  205. if (!defined('MB_CASE_LOWER')) {
  206. define('MB_CASE_LOWER', 1);
  207. }
  208. if (!defined('MB_CASE_TITLE')) {
  209. define('MB_CASE_TITLE', 2);
  210. }