Cyr-To-Lat - Version 4.2.3

Version Description

(29.08.2019) = * Scoped Symfony polyfill to avoid problems with composer autoloader on some sites.

Download this release

Release Info

Developer mihdan
Plugin Icon 128x128 Cyr-To-Lat
Version 4.2.3
Comparing to
See all releases

Code changes from version 4.2.2 to 4.2.3

Files changed (114) hide show
  1. cyr-to-lat.php +4 -4
  2. includes/class-cyr-to-lat-conversion-tables.php +2 -2
  3. includes/class-cyr-to-lat-main.php +1 -1
  4. lib/polyfill-mbstring/Mbstring.php +830 -0
  5. lib/polyfill-mbstring/Resources/unidata/lowerCase.php +1096 -0
  6. lib/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +5 -0
  7. lib/polyfill-mbstring/Resources/unidata/upperCase.php +1104 -0
  8. readme.txt +4 -1
  9. vendor/a5hleyrich/wp-background-processing/.gitignore +0 -1
  10. vendor/a5hleyrich/wp-background-processing/README.md +0 -158
  11. vendor/a5hleyrich/wp-background-processing/composer.json +0 -18
  12. vendor/composer/autoload_classmap.php +1 -1
  13. vendor/composer/autoload_files.php +0 -10
  14. vendor/composer/autoload_psr4.php +0 -1
  15. vendor/composer/autoload_real.php +0 -18
  16. vendor/composer/autoload_static.php +1 -13
  17. vendor/composer/installed.json +0 -61
  18. vendor/composer/installers/composer.json +0 -107
  19. vendor/composer/installers/src/Composer/Installers/AglInstaller.php +0 -21
  20. vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +0 -9
  21. vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php +0 -11
  22. vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +0 -49
  23. vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php +0 -9
  24. vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +0 -136
  25. vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +0 -126
  26. vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +0 -9
  27. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +0 -82
  28. vendor/composer/installers/src/Composer/Installers/ChefInstaller.php +0 -11
  29. vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php +0 -9
  30. vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php +0 -10
  31. vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php +0 -34
  32. vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php +0 -11
  33. vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +0 -13
  34. vendor/composer/installers/src/Composer/Installers/CraftInstaller.php +0 -35
  35. vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php +0 -21
  36. vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php +0 -10
  37. vendor/composer/installers/src/Composer/Installers/DframeInstaller.php +0 -10
  38. vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php +0 -50
  39. vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php +0 -16
  40. vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +0 -20
  41. vendor/composer/installers/src/Composer/Installers/ElggInstaller.php +0 -9
  42. vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +0 -12
  43. vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php +0 -29
  44. vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php +0 -10
  45. vendor/composer/installers/src/Composer/Installers/FuelInstaller.php +0 -11
  46. vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php +0 -9
  47. vendor/composer/installers/src/Composer/Installers/GravInstaller.php +0 -30
  48. vendor/composer/installers/src/Composer/Installers/HuradInstaller.php +0 -25
  49. vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php +0 -11
  50. vendor/composer/installers/src/Composer/Installers/Installer.php +0 -278
  51. vendor/composer/installers/src/Composer/Installers/ItopInstaller.php +0 -9
  52. vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php +0 -15
  53. vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php +0 -18
  54. vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php +0 -11
  55. vendor/composer/installers/src/Composer/Installers/KnownInstaller.php +0 -11
  56. vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +0 -10
  57. vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php +0 -9
  58. vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php +0 -27
  59. vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php +0 -9
  60. vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php +0 -10
  61. vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php +0 -10
  62. vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php +0 -9
  63. vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php +0 -16
  64. vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php +0 -11
  65. vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +0 -37
  66. vendor/composer/installers/src/Composer/Installers/MakoInstaller.php +0 -9
  67. vendor/composer/installers/src/Composer/Installers/MauticInstaller.php +0 -25
  68. vendor/composer/installers/src/Composer/Installers/MayaInstaller.php +0 -33
  69. vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +0 -51
  70. vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +0 -119
  71. vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +0 -12
  72. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +0 -58
  73. vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +0 -47
  74. vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php +0 -24
  75. vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php +0 -14
  76. vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +0 -59
  77. vendor/composer/installers/src/Composer/Installers/PPIInstaller.php +0 -9
  78. vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php +0 -11
  79. vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php +0 -11
  80. vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php +0 -21
  81. vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php +0 -32
  82. vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php +0 -29
  83. vendor/composer/installers/src/Composer/Installers/Plugin.php +0 -17
  84. vendor/composer/installers/src/Composer/Installers/PortoInstaller.php +0 -9
  85. vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +0 -10
  86. vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php +0 -11
  87. vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +0 -63
  88. vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php +0 -24
  89. vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php +0 -10
  90. vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php +0 -10
  91. vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php +0 -10
  92. vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php +0 -22
  93. vendor/composer/installers/src/Composer/Installers/SMFInstaller.php +0 -10
  94. vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +0 -60
  95. vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +0 -35
  96. vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +0 -25
  97. vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +0 -49
  98. vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php +0 -26
  99. vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php +0 -16
  100. vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php +0 -38
  101. vendor/composer/installers/src/Composer/Installers/TaoInstaller.php +0 -12
  102. vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php +0 -12
  103. vendor/composer/installers/src/Composer/Installers/TuskInstaller.php +0 -14
  104. vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php +0 -9
  105. vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php +0 -10
  106. vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php +0 -49
  107. vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +0 -21
  108. vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php +0 -9
  109. vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +0 -12
  110. vendor/composer/installers/src/Composer/Installers/YawikInstaller.php +0 -32
  111. vendor/composer/installers/src/Composer/Installers/ZendInstaller.php +0 -11
  112. vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php +0 -10
  113. vendor/composer/installers/src/bootstrap.php +0 -13
  114. vendor/symfony/polyfill-mbstring +0 -1
cyr-to-lat.php CHANGED
@@ -7,10 +7,10 @@
7
  * Description: Converts Cyrillic characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
8
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
- * Requires at least: 2.3
11
  * Tested up to: 5.2
12
- * Version: 4.2.2
13
- * Stable tag: 4.2.2
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
@@ -28,7 +28,7 @@ if ( ! defined( 'CYR_TO_LAT_VERSION' ) ) {
28
  /**
29
  * Plugin version.
30
  */
31
- define( 'CYR_TO_LAT_VERSION', '4.2.2' );
32
  }
33
 
34
  if ( ! defined( 'CYR_TO_LAT_PATH' ) ) {
7
  * Description: Converts Cyrillic characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
8
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
+ * Requires at least: 5.1
11
  * Tested up to: 5.2
12
+ * Version: 4.2.3
13
+ * Stable tag: 4.2.3
14
  *
15
  * Text Domain: cyr2lat
16
  * Domain Path: /languages/
28
  /**
29
  * Plugin version.
30
  */
31
+ define( 'CYR_TO_LAT_VERSION', '4.2.3' );
32
  }
33
 
34
  if ( ! defined( 'CYR_TO_LAT_PATH' ) ) {
includes/class-cyr-to-lat-conversion-tables.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package cyr-to-lat
6
  */
7
 
8
- use Symfony\Polyfill\Mbstring\Mbstring;
9
 
10
  /**
11
  * Class Cyr_To_Lat_Conversion_Tables
@@ -398,7 +398,7 @@ class Cyr_To_Lat_Conversion_Tables {
398
  *
399
  * Example of wrong encoding on Mac:
400
  * берЁзовыЙ-белозёрский - original input,
401
- * берЁзовыЙ-белозёрский.png - actual filename created on Mac,
402
  * ber%d0%95%cc%88zovy%d0%98%cc%86-beloz%d0%B5%cc%88rski%d0%B8%cc%86.png - urlencode() of the above,
403
  * berËzovyĬ-belozërskiĭ.png - actual filename passed via standard ISO9 transliteration table,
404
  * berE%CC%88zovyI%CC%86-beloze%CC%88rskii%CC%86.png - urlencode() of the above.
5
  * @package cyr-to-lat
6
  */
7
 
8
+ use Cyr_To_Lat\Symfony\Polyfill\Mbstring\Mbstring;
9
 
10
  /**
11
  * Class Cyr_To_Lat_Conversion_Tables
398
  *
399
  * Example of wrong encoding on Mac:
400
  * берЁзовыЙ-белозёрский - original input,
401
+ * берЁзовыЙ-белозёрский.png - actual filename created on Mac (ЁёЙй are already wrongly encoded),
402
  * ber%d0%95%cc%88zovy%d0%98%cc%86-beloz%d0%B5%cc%88rski%d0%B8%cc%86.png - urlencode() of the above,
403
  * berËzovyĬ-belozërskiĭ.png - actual filename passed via standard ISO9 transliteration table,
404
  * berE%CC%88zovyI%CC%86-beloze%CC%88rskii%CC%86.png - urlencode() of the above.
includes/class-cyr-to-lat-main.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package cyr-to-lat
6
  */
7
 
8
- use Symfony\Polyfill\Mbstring\Mbstring;
9
 
10
  /**
11
  * Class Cyr_To_Lat_Main
5
  * @package cyr-to-lat
6
  */
7
 
8
+ use Cyr_To_Lat\Symfony\Polyfill\Mbstring\Mbstring;
9
 
10
  /**
11
  * Class Cyr_To_Lat_Main
lib/polyfill-mbstring/Mbstring.php ADDED
@@ -0,0 +1,830 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @package cyr-to-lat
11
+ */
12
+
13
+ namespace Cyr_To_Lat\Symfony\Polyfill\Mbstring;
14
+
15
+ /**
16
+ * Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
17
+ *
18
+ * Implemented:
19
+ * - mb_chr - Returns a specific character from its Unicode code point
20
+ * - mb_convert_encoding - Convert character encoding
21
+ * - mb_convert_variables - Convert character code in variable(s)
22
+ * - mb_decode_mimeheader - Decode string in MIME header field
23
+ * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED
24
+ * - mb_decode_numericentity - Decode HTML numeric string reference to character
25
+ * - mb_encode_numericentity - Encode character to HTML numeric string reference
26
+ * - mb_convert_case - Perform case folding on a string
27
+ * - mb_detect_encoding - Detect character encoding
28
+ * - mb_get_info - Get internal settings of mbstring
29
+ * - mb_http_input - Detect HTTP input character encoding
30
+ * - mb_http_output - Set/Get HTTP output character encoding
31
+ * - mb_internal_encoding - Set/Get internal character encoding
32
+ * - mb_list_encodings - Returns an array of all supported encodings
33
+ * - mb_ord - Returns the Unicode code point of a character
34
+ * - mb_output_handler - Callback function converts character encoding in output buffer
35
+ * - mb_scrub - Replaces ill-formed byte sequences with substitute characters
36
+ * - mb_strlen - Get string length
37
+ * - mb_strpos - Find position of first occurrence of string in a string
38
+ * - mb_strrpos - Find position of last occurrence of a string in a string
39
+ * - mb_str_split - Convert a string to an array
40
+ * - mb_strtolower - Make a string lowercase
41
+ * - mb_strtoupper - Make a string uppercase
42
+ * - mb_substitute_character - Set/Get substitution character
43
+ * - mb_substr - Get part of string
44
+ * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive
45
+ * - mb_stristr - Finds first occurrence of a string within another, case insensitive
46
+ * - mb_strrchr - Finds the last occurrence of a character in a string within another
47
+ * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
48
+ * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive
49
+ * - mb_strstr - Finds first occurrence of a string within another
50
+ * - mb_strwidth - Return width of string
51
+ * - mb_substr_count - Count the number of substring occurrences
52
+ *
53
+ * Not implemented:
54
+ * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
55
+ * - mb_ereg_* - Regular expression with multibyte support
56
+ * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable
57
+ * - mb_preferred_mime_name - Get MIME charset string
58
+ * - mb_regex_encoding - Returns current encoding for multibyte regex as string
59
+ * - mb_regex_set_options - Set/Get the default options for mbregex functions
60
+ * - mb_send_mail - Send encoded mail
61
+ * - mb_split - Split multibyte string using regular expression
62
+ * - mb_strcut - Get part of string
63
+ * - mb_strimwidth - Get truncated string with specified width
64
+ *
65
+ * @author Nicolas Grekas <p@tchwork.com>
66
+ *
67
+ * @internal
68
+ */
69
+ final class Mbstring
70
+ {
71
+ const MB_CASE_FOLD = PHP_INT_MAX;
72
+
73
+ private static $encodingList = array('ASCII', 'UTF-8');
74
+ private static $language = 'neutral';
75
+ private static $internalEncoding = 'UTF-8';
76
+ private static $caseFold = array(
77
+ array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
78
+ array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'),
79
+ );
80
+
81
+ public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
82
+ {
83
+ if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
84
+ $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
85
+ } else {
86
+ $fromEncoding = self::getEncoding($fromEncoding);
87
+ }
88
+
89
+ $toEncoding = self::getEncoding($toEncoding);
90
+
91
+ if ('BASE64' === $fromEncoding) {
92
+ $s = base64_decode($s);
93
+ $fromEncoding = $toEncoding;
94
+ }
95
+
96
+ if ('BASE64' === $toEncoding) {
97
+ return base64_encode($s);
98
+ }
99
+
100
+ if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
101
+ if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
102
+ $fromEncoding = 'Windows-1252';
103
+ }
104
+ if ('UTF-8' !== $fromEncoding) {
105
+ $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
106
+ }
107
+
108
+ return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
109
+ }
110
+
111
+ if ('HTML-ENTITIES' === $fromEncoding) {
112
+ $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
113
+ $fromEncoding = 'UTF-8';
114
+ }
115
+
116
+ return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
117
+ }
118
+
119
+ public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
120
+ {
121
+ $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
122
+
123
+ $ok = true;
124
+ array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
125
+ if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
126
+ $ok = false;
127
+ }
128
+ });
129
+
130
+ return $ok ? $fromEncoding : false;
131
+ }
132
+
133
+ public static function mb_decode_mimeheader($s)
134
+ {
135
+ return iconv_mime_decode($s, 2, self::$internalEncoding);
136
+ }
137
+
138
+ public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
139
+ {
140
+ trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
141
+ }
142
+
143
+ public static function mb_decode_numericentity($s, $convmap, $encoding = null)
144
+ {
145
+ if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
146
+ trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
147
+
148
+ return null;
149
+ }
150
+
151
+ if (!\is_array($convmap) || !$convmap) {
152
+ return false;
153
+ }
154
+
155
+ if (null !== $encoding && !\is_scalar($encoding)) {
156
+ trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
157
+
158
+ return ''; // Instead of null (cf. mb_encode_numericentity).
159
+ }
160
+
161
+ $s = (string) $s;
162
+ if ('' === $s) {
163
+ return '';
164
+ }
165
+
166
+ $encoding = self::getEncoding($encoding);
167
+
168
+ if ('UTF-8' === $encoding) {
169
+ $encoding = null;
170
+ if (!preg_match('//u', $s)) {
171
+ $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
172
+ }
173
+ } else {
174
+ $s = iconv($encoding, 'UTF-8//IGNORE', $s);
175
+ }
176
+
177
+ $cnt = floor(\count($convmap) / 4) * 4;
178
+
179
+ for ($i = 0; $i < $cnt; $i += 4) {
180
+ // collector_decode_htmlnumericentity ignores $convmap[$i + 3]
181
+ $convmap[$i] += $convmap[$i + 2];
182
+ $convmap[$i + 1] += $convmap[$i + 2];
183
+ }
184
+
185
+ $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
186
+ $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
187
+ for ($i = 0; $i < $cnt; $i += 4) {
188
+ if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
189
+ return Mbstring::mb_chr($c - $convmap[$i + 2]);
190
+ }
191
+ }
192
+
193
+ return $m[0];
194
+ }, $s);
195
+
196
+ if (null === $encoding) {
197
+ return $s;
198
+ }
199
+
200
+ return iconv('UTF-8', $encoding.'//IGNORE', $s);
201
+ }
202
+
203
+ public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
204
+ {
205
+ if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
206
+ trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
207
+
208
+ return null;
209
+ }
210
+
211
+ if (!\is_array($convmap) || !$convmap) {
212
+ return false;
213
+ }
214
+
215
+ if (null !== $encoding && !\is_scalar($encoding)) {
216
+ trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
217
+
218
+ return null; // Instead of '' (cf. mb_decode_numericentity).
219
+ }
220
+
221
+ if (null !== $is_hex && !\is_scalar($is_hex)) {
222
+ trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
223
+
224
+ return null;
225
+ }
226
+
227
+ $s = (string) $s;
228
+ if ('' === $s) {
229
+ return '';
230
+ }
231
+
232
+ $encoding = self::getEncoding($encoding);
233
+
234
+ if ('UTF-8' === $encoding) {
235
+ $encoding = null;
236
+ if (!preg_match('//u', $s)) {
237
+ $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
238
+ }
239
+ } else {
240
+ $s = iconv($encoding, 'UTF-8//IGNORE', $s);
241
+ }
242
+
243
+ static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
244
+
245
+ $cnt = floor(\count($convmap) / 4) * 4;
246
+ $i = 0;
247
+ $len = \strlen($s);
248
+ $result = '';
249
+
250
+ while ($i < $len) {
251
+ $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
252
+ $uchr = substr($s, $i, $ulen);
253
+ $i += $ulen;
254
+ $c = self::mb_ord($uchr);
255
+
256
+ for ($j = 0; $j < $cnt; $j += 4) {
257
+ if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
258
+ $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
259
+ $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
260
+ continue 2;
261
+ }
262
+ }
263
+ $result .= $uchr;
264
+ }
265
+
266
+ if (null === $encoding) {
267
+ return $result;
268
+ }
269
+
270
+ return iconv('UTF-8', $encoding.'//IGNORE', $result);
271
+ }
272
+
273
+ public static function mb_convert_case($s, $mode, $encoding = null)
274
+ {
275
+ $s = (string) $s;
276
+ if ('' === $s) {
277
+ return '';
278
+ }
279
+
280
+ $encoding = self::getEncoding($encoding);
281
+
282
+ if ('UTF-8' === $encoding) {
283
+ $encoding = null;
284
+ if (!preg_match('//u', $s)) {
285
+ $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
286
+ }
287
+ } else {
288
+ $s = iconv($encoding, 'UTF-8//IGNORE', $s);
289
+ }
290
+
291
+ if (MB_CASE_TITLE == $mode) {
292
+ static $titleRegexp = null;
293
+ if (null === $titleRegexp) {
294
+ $titleRegexp = self::getData('titleCaseRegexp');
295
+ }
296
+ $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
297
+ } else {
298
+ if (MB_CASE_UPPER == $mode) {
299
+ static $upper = null;
300
+ if (null === $upper) {
301
+ $upper = self::getData('upperCase');
302
+ }
303
+ $map = $upper;
304
+ } else {
305
+ if (self::MB_CASE_FOLD === $mode) {
306
+ $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
307
+ }
308
+
309
+ static $lower = null;
310
+ if (null === $lower) {
311
+ $lower = self::getData('lowerCase');
312
+ }
313
+ $map = $lower;
314
+ }
315
+
316
+ static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
317
+
318
+ $i = 0;
319
+ $len = \strlen($s);
320
+
321
+ while ($i < $len) {
322
+ $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
323
+ $uchr = substr($s, $i, $ulen);
324
+ $i += $ulen;
325
+
326
+ if (isset($map[$uchr])) {
327
+ $uchr = $map[$uchr];
328
+ $nlen = \strlen($uchr);
329
+
330
+ if ($nlen == $ulen) {
331
+ $nlen = $i;
332
+ do {
333
+ $s[--$nlen] = $uchr[--$ulen];
334
+ } while ($ulen);
335
+ } else {
336
+ $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
337
+ $len += $nlen - $ulen;
338
+ $i += $nlen - $ulen;
339
+ }
340
+ }
341
+ }
342
+ }
343
+
344
+ if (null === $encoding) {
345
+ return $s;
346
+ }
347
+
348
+ return iconv('UTF-8', $encoding.'//IGNORE', $s);
349
+ }
350
+
351
+ public static function mb_internal_encoding($encoding = null)
352
+ {
353
+ if (null === $encoding) {
354
+ return self::$internalEncoding;
355
+ }
356
+
357
+ $encoding = self::getEncoding($encoding);
358
+
359
+ if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
360
+ self::$internalEncoding = $encoding;
361
+
362
+ return true;
363
+ }
364
+
365
+ return false;
366
+ }
367
+
368
+ public static function mb_language($lang = null)
369
+ {
370
+ if (null === $lang) {
371
+ return self::$language;
372
+ }
373
+
374
+ switch ($lang = strtolower($lang)) {
375
+ case 'uni':
376
+ case 'neutral':
377
+ self::$language = $lang;
378
+
379
+ return true;
380
+ }
381
+
382
+ return false;
383
+ }
384
+
385
+ public static function mb_list_encodings()
386
+ {
387
+ return array('UTF-8');
388
+ }
389
+
390
+ public static function mb_encoding_aliases($encoding)
391
+ {
392
+ switch (strtoupper($encoding)) {
393
+ case 'UTF8':
394
+ case 'UTF-8':
395
+ return array('utf8');
396
+ }
397
+
398
+ return false;
399
+ }
400
+
401
+ public static function mb_check_encoding($var = null, $encoding = null)
402
+ {
403
+ if (null === $encoding) {
404
+ if (null === $var) {
405
+ return false;
406
+ }
407
+ $encoding = self::$internalEncoding;
408
+ }
409
+
410
+ return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
411
+ }
412
+
413
+ public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
414
+ {
415
+ if (null === $encodingList) {
416
+ $encodingList = self::$encodingList;
417
+ } else {
418
+ if (!\is_array($encodingList)) {
419
+ $encodingList = array_map('trim', explode(',', $encodingList));
420
+ }
421
+ $encodingList = array_map('strtoupper', $encodingList);
422
+ }
423
+
424
+ foreach ($encodingList as $enc) {
425
+ switch ($enc) {
426
+ case 'ASCII':
427
+ if (!preg_match('/[\x80-\xFF]/', $str)) {
428
+ return $enc;
429
+ }
430
+ break;
431
+
432
+ case 'UTF8':
433
+ case 'UTF-8':
434
+ if (preg_match('//u', $str)) {
435
+ return 'UTF-8';
436
+ }
437
+ break;
438
+
439
+ default:
440
+ if (0 === strncmp($enc, 'ISO-8859-', 9)) {
441
+ return $enc;
442
+ }
443
+ }
444
+ }
445
+
446
+ return false;
447
+ }
448
+
449
+ public static function mb_detect_order($encodingList = null)
450
+ {
451
+ if (null === $encodingList) {
452
+ return self::$encodingList;
453
+ }
454
+
455
+ if (!\is_array($encodingList)) {
456
+ $encodingList = array_map('trim', explode(',', $encodingList));
457
+ }
458
+ $encodingList = array_map('strtoupper', $encodingList);
459
+
460
+ foreach ($encodingList as $enc) {
461
+ switch ($enc) {
462
+ default:
463
+ if (strncmp($enc, 'ISO-8859-', 9)) {
464
+ return false;
465
+ }
466
+ // no break
467
+ case 'ASCII':
468
+ case 'UTF8':
469
+ case 'UTF-8':
470
+ }
471
+ }
472
+
473
+ self::$encodingList = $encodingList;
474
+
475
+ return true;
476
+ }
477
+
478
+ public static function mb_strlen($s, $encoding = null)
479
+ {
480
+ $encoding = self::getEncoding($encoding);
481
+ if ('CP850' === $encoding || 'ASCII' === $encoding) {
482
+ return \strlen($s);
483
+ }
484
+
485
+ return @iconv_strlen($s, $encoding);
486
+ }
487
+
488
+ public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
489
+ {
490
+ $encoding = self::getEncoding($encoding);
491
+ if ('CP850' === $encoding || 'ASCII' === $encoding) {
492
+ return strpos($haystack, $needle, $offset);
493
+ }
494
+
495
+ $needle = (string) $needle;
496
+ if ('' === $needle) {
497
+ trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
498
+
499
+ return false;
500
+ }
501
+
502
+ return iconv_strpos($haystack, $needle, $offset, $encoding);
503
+ }
504
+
505
+ public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
506
+ {
507
+ $encoding = self::getEncoding($encoding);
508
+ if ('CP850' === $encoding || 'ASCII' === $encoding) {
509
+ return strrpos($haystack, $needle, $offset);
510
+ }
511
+
512
+ if ($offset != (int) $offset) {
513
+ $offset = 0;
514
+ } elseif ($offset = (int) $offset) {
515
+ if ($offset < 0) {
516
+ $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
517
+ $offset = 0;
518
+ } else {
519
+ $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
520
+ }
521
+ }
522
+
523
+ $pos = iconv_strrpos($haystack, $needle, $encoding);
524
+
525
+ return false !== $pos ? $offset + $pos : false;
526
+ }
527
+
528
+ public static function mb_str_split($string, $split_length = 1, $encoding = null)
529
+ {
530
+ if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
531
+ trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
532
+
533
+ return null;
534
+ }
535
+
536
+ if ($split_length < 1) {
537
+ trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
538
+
539
+ return false;
540
+ }
541
+
542
+ if (null === $encoding) {
543
+ $encoding = mb_internal_encoding();
544
+ }
545
+
546
+ $result = array();
547
+ $length = mb_strlen($string, $encoding);
548
+
549
+ for ($i = 0; $i < $length; $i += $split_length) {
550
+ $result[] = mb_substr($string, $i, $split_length, $encoding);
551
+ }
552
+
553
+ return $result;
554
+ }
555
+
556
+ public static function mb_strtolower($s, $encoding = null)
557
+ {
558
+ return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
559
+ }
560
+
561
+ public static function mb_strtoupper($s, $encoding = null)
562
+ {
563
+ return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
564
+ }
565
+
566
+ public static function mb_substitute_character($c = null)
567
+ {
568
+ if (0 === strcasecmp($c, 'none')) {
569
+ return true;
570
+ }
571
+
572
+ return null !== $c ? false : 'none';
573
+ }
574
+
575
+ public static function mb_substr($s, $start, $length = null, $encoding = null)
576
+ {
577
+ $encoding = self::getEncoding($encoding);
578
+ if ('CP850' === $encoding || 'ASCII' === $encoding) {
579
+ return (string) substr($s, $start, null === $length ? 2147483647 : $length);
580
+ }
581
+
582
+ if ($start < 0) {
583
+ $start = iconv_strlen($s, $encoding) + $start;
584
+ if ($start < 0) {
585
+ $start = 0;
586
+ }
587
+ }
588
+
589
+ if (null === $length) {
590
+ $length = 2147483647;
591
+ } elseif ($length < 0) {
592
+ $length = iconv_strlen($s, $encoding) + $length - $start;
593
+ if ($length < 0) {
594
+ return '';
595
+ }
596
+ }
597
+
598
+ return (string) iconv_substr($s, $start, $length, $encoding);
599
+ }
600
+
601
+ public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
602
+ {
603
+ $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
604
+ $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
605
+
606
+ return self::mb_strpos($haystack, $needle, $offset, $encoding);
607
+ }
608
+
609
+ public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
610
+ {
611
+ $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
612
+
613
+ return self::getSubpart($pos, $part, $haystack, $encoding);
614
+ }
615
+
616
+ public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
617
+ {
618
+ $encoding = self::getEncoding($encoding);
619
+ if ('CP850' === $encoding || 'ASCII' === $encoding) {
620
+ return strrchr($haystack, $needle, $part);
621
+ }
622
+ $needle = self::mb_substr($needle, 0, 1, $encoding);
623
+ $pos = iconv_strrpos($haystack, $needle, $encoding);
624
+
625
+ return self::getSubpart($pos, $part, $haystack, $encoding);
626
+ }
627
+
628
+ public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
629
+ {
630
+ $needle = self::mb_substr($needle, 0, 1, $encoding);
631
+ $pos = self::mb_strripos($haystack, $needle, $encoding);
632
+
633
+ return self::getSubpart($pos, $part, $haystack, $encoding);
634
+ }
635
+
636
+ public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
637
+ {
638
+ $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
639
+ $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
640
+
641
+ return self::mb_strrpos($haystack, $needle, $offset, $encoding);
642
+ }
643
+
644
+ public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
645
+ {
646
+ $pos = strpos($haystack, $needle);
647
+ if (false === $pos) {
648
+ return false;
649
+ }
650
+ if ($part) {
651
+ return substr($haystack, 0, $pos);
652
+ }
653
+
654
+ return substr($haystack, $pos);
655
+ }
656
+
657
+ public static function mb_get_info($type = 'all')
658
+ {
659
+ $info = array(
660
+ 'internal_encoding' => self::$internalEncoding,
661
+ 'http_output' => 'pass',
662
+ 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
663
+ 'func_overload' => 0,
664
+ 'func_overload_list' => 'no overload',
665
+ 'mail_charset' => 'UTF-8',
666
+ 'mail_header_encoding' => 'BASE64',
667
+ 'mail_body_encoding' => 'BASE64',
668
+ 'illegal_chars' => 0,
669
+ 'encoding_translation' => 'Off',
670
+ 'language' => self::$language,
671
+ 'detect_order' => self::$encodingList,
672
+ 'substitute_character' => 'none',
673
+ 'strict_detection' => 'Off',
674
+ );
675
+
676
+ if ('all' === $type) {
677
+ return $info;
678
+ }
679
+ if (isset($info[$type])) {
680
+ return $info[$type];
681
+ }
682
+
683
+ return false;
684
+ }
685
+
686
+ public static function mb_http_input($type = '')
687
+ {
688
+ return false;
689
+ }
690
+
691
+ public static function mb_http_output($encoding = null)
692
+ {
693
+ return null !== $encoding ? 'pass' === $encoding : 'pass';
694
+ }
695
+
696
+ public static function mb_strwidth($s, $encoding = null)
697
+ {
698
+ $encoding = self::getEncoding($encoding);
699
+
700
+ if ('UTF-8' !== $encoding) {
701
+ $s = iconv($encoding, 'UTF-8//IGNORE', $s);
702
+ }
703
+
704
+ $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
705
+
706
+ return ($wide << 1) + iconv_strlen($s, 'UTF-8');
707
+ }
708
+
709
+ public static function mb_substr_count($haystack, $needle, $encoding = null)
710
+ {
711
+ return substr_count($haystack, $needle);
712
+ }
713
+
714
+ public static function mb_output_handler($contents, $status)
715
+ {
716
+ return $contents;
717
+ }
718
+
719
+ public static function mb_chr($code, $encoding = null)
720
+ {
721
+ if (0x80 > $code %= 0x200000) {
722
+ $s = \chr($code);
723
+ } elseif (0x800 > $code) {
724
+ $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
725
+ } elseif (0x10000 > $code) {
726
+ $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
727
+ } else {
728
+ $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
729
+ }
730
+
731
+ if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
732
+ $s = mb_convert_encoding($s, $encoding, 'UTF-8');
733
+ }
734
+
735
+ return $s;
736
+ }
737
+
738
+ public static function mb_ord($s, $encoding = null)
739
+ {
740
+ if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
741
+ $s = mb_convert_encoding($s, 'UTF-8', $encoding);
742
+ }
743
+
744
+ if (1 === \strlen($s)) {
745
+ return \ord($s);
746
+ }
747
+
748
+ $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
749
+ if (0xF0 <= $code) {
750
+ return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
751
+ }
752
+ if (0xE0 <= $code) {
753
+ return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
754
+ }
755
+ if (0xC0 <= $code) {
756
+ return (($code - 0xC0) << 6) + $s[2] - 0x80;
757
+ }
758
+
759
+ return $code;
760
+ }
761
+
762
+ private static function getSubpart($pos, $part, $haystack, $encoding)
763
+ {
764
+ if (false === $pos) {
765
+ return false;
766
+ }
767
+ if ($part) {
768
+ return self::mb_substr($haystack, 0, $pos, $encoding);
769
+ }
770
+
771
+ return self::mb_substr($haystack, $pos, null, $encoding);
772
+ }
773
+
774
+ private static function html_encoding_callback(array $m)
775
+ {
776
+ $i = 1;
777
+ $entities = '';
778
+ $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
779
+
780
+ while (isset($m[$i])) {
781
+ if (0x80 > $m[$i]) {
782
+ $entities .= \chr($m[$i++]);
783
+ continue;
784
+ }
785
+ if (0xF0 <= $m[$i]) {
786
+ $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
787
+ } elseif (0xE0 <= $m[$i]) {
788
+ $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
789
+ } else {
790
+ $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
791
+ }
792
+
793
+ $entities .= '&#'.$c.';';
794
+ }
795
+
796
+ return $entities;
797
+ }
798
+
799
+ private static function title_case(array $s)
800
+ {
801
+ return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
802
+ }
803
+
804
+ private static function getData($file)
805
+ {
806
+ if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
807
+ return require $file;
808
+ }
809
+
810
+ return false;
811
+ }
812
+
813
+ private static function getEncoding($encoding)
814
+ {
815
+ if (null === $encoding) {
816
+ return self::$internalEncoding;
817
+ }
818
+
819
+ $encoding = strtoupper($encoding);
820
+
821
+ if ('8BIT' === $encoding || 'BINARY' === $encoding) {
822
+ return 'CP850';
823
+ }
824
+ if ('UTF8' === $encoding) {
825
+ return 'UTF-8';
826
+ }
827
+
828
+ return $encoding;
829
+ }
830
+ }
lib/polyfill-mbstring/Resources/unidata/lowerCase.php ADDED
@@ -0,0 +1,1096 @@