ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Symfony\Polyfill\Mbstring\Mbstring Class Reference

Partial mbstring implementation in PHP, iconv based, UTF-8 centric. More...

+ Collaboration diagram for Symfony\Polyfill\Mbstring\Mbstring:

Static Public Member Functions

static mb_convert_encoding ($s, $toEncoding, $fromEncoding=null)
 
static mb_convert_variables ($toEncoding, $fromEncoding, &$a=null, &$b=null, &$c=null, &$d=null, &$e=null, &$f=null)
 
static mb_decode_mimeheader ($s)
 
static mb_encode_mimeheader ($s, $charset=null, $transferEncoding=null, $linefeed=null, $indent=null)
 
static mb_decode_numericentity ($s, $convmap, $encoding=null)
 
static mb_encode_numericentity ($s, $convmap, $encoding=null, $is_hex=false)
 
static mb_convert_case ($s, $mode, $encoding=null)
 
static mb_internal_encoding ($encoding=null)
 
static mb_language ($lang=null)
 
static mb_list_encodings ()
 
static mb_encoding_aliases ($encoding)
 
static mb_check_encoding ($var=null, $encoding=null)
 
static mb_detect_encoding ($str, $encodingList=null, $strict=false)
 
static mb_detect_order ($encodingList=null)
 
static mb_strlen ($s, $encoding=null)
 
static mb_strpos ($haystack, $needle, $offset=0, $encoding=null)
 
static mb_strrpos ($haystack, $needle, $offset=0, $encoding=null)
 
static mb_str_split ($string, $split_length=1, $encoding=null)
 
static mb_strtolower ($s, $encoding=null)
 
static mb_strtoupper ($s, $encoding=null)
 
static mb_substitute_character ($c=null)
 
static mb_substr ($s, $start, $length=null, $encoding=null)
 
static mb_stripos ($haystack, $needle, $offset=0, $encoding=null)
 
static mb_stristr ($haystack, $needle, $part=false, $encoding=null)
 
static mb_strrchr ($haystack, $needle, $part=false, $encoding=null)
 
static mb_strrichr ($haystack, $needle, $part=false, $encoding=null)
 
static mb_strripos ($haystack, $needle, $offset=0, $encoding=null)
 
static mb_strstr ($haystack, $needle, $part=false, $encoding=null)
 
static mb_get_info ($type='all')
 
static mb_http_input ($type='')
 
static mb_http_output ($encoding=null)
 
static mb_strwidth ($s, $encoding=null)
 
static mb_substr_count ($haystack, $needle, $encoding=null)
 
static mb_output_handler ($contents, $status)
 
static mb_chr ($code, $encoding=null)
 
static mb_ord ($s, $encoding=null)
 

Data Fields

const MB_CASE_FOLD = PHP_INT_MAX
 

Static Private Member Functions

static getSubpart ($pos, $part, $haystack, $encoding)
 
static html_encoding_callback (array $m)
 
static title_case (array $s)
 
static getData ($file)
 
static getEncoding ($encoding)
 

Static Private Attributes

static $encodingList = array('ASCII', 'UTF-8')
 
static $language = 'neutral'
 
static $internalEncoding = 'UTF-8'
 
static $caseFold
 

Detailed Description

Partial mbstring implementation in PHP, iconv based, UTF-8 centric.

Implemented:

  • mb_chr - Returns a specific character from its Unicode code point
  • mb_convert_encoding - Convert character encoding
  • mb_convert_variables - Convert character code in variable(s)
  • mb_decode_mimeheader - Decode string in MIME header field
  • mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED
  • mb_decode_numericentity - Decode HTML numeric string reference to character
  • mb_encode_numericentity - Encode character to HTML numeric string reference
  • mb_convert_case - Perform case folding on a string
  • mb_detect_encoding - Detect character encoding
  • mb_get_info - Get internal settings of mbstring
  • mb_http_input - Detect HTTP input character encoding
  • mb_http_output - Set/Get HTTP output character encoding
  • mb_internal_encoding - Set/Get internal character encoding
  • mb_list_encodings - Returns an array of all supported encodings
  • mb_ord - Returns the Unicode code point of a character
  • mb_output_handler - Callback function converts character encoding in output buffer
  • mb_scrub - Replaces ill-formed byte sequences with substitute characters
  • mb_strlen - Get string length
  • mb_strpos - Find position of first occurrence of string in a string
  • mb_strrpos - Find position of last occurrence of a string in a string
  • mb_str_split - Convert a string to an array
  • mb_strtolower - Make a string lowercase
  • mb_strtoupper - Make a string uppercase
  • mb_substitute_character - Set/Get substitution character
  • mb_substr - Get part of string
  • mb_stripos - Finds position of first occurrence of a string within another, case insensitive
  • mb_stristr - Finds first occurrence of a string within another, case insensitive
  • mb_strrchr - Finds the last occurrence of a character in a string within another
  • mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
  • mb_strripos - Finds position of last occurrence of a string within another, case insensitive
  • mb_strstr - Finds first occurrence of a string within another
  • mb_strwidth - Return width of string
  • mb_substr_count - Count the number of substring occurrences

Not implemented:

  • mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
  • mb_ereg_* - Regular expression with multibyte support
  • mb_parse_str - Parse GET/POST/COOKIE data and set global variable
  • mb_preferred_mime_name - Get MIME charset string
  • mb_regex_encoding - Returns current encoding for multibyte regex as string
  • mb_regex_set_options - Set/Get the default options for mbregex functions
  • mb_send_mail - Send encoded mail
  • mb_split - Split multibyte string using regular expression
  • mb_strcut - Get part of string
  • mb_strimwidth - Get truncated string with specified width
Author
Nicolas Grekas p@tch.nosp@m.work.nosp@m..com

Definition at line 68 of file Mbstring.php.

Member Function Documentation

◆ getData()

static Symfony\Polyfill\Mbstring\Mbstring::getData (   $file)
staticprivate

Definition at line 803 of file Mbstring.php.

804 {
805 if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
806 return require $file;
807 }
808
809 return false;
810 }

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case().

+ Here is the caller graph for this function:

◆ getEncoding()

static Symfony\Polyfill\Mbstring\Mbstring::getEncoding (   $encoding)
staticprivate

◆ getSubpart()

static Symfony\Polyfill\Mbstring\Mbstring::getSubpart (   $pos,
  $part,
  $haystack,
  $encoding 
)
staticprivate

Definition at line 761 of file Mbstring.php.

762 {
763 if (false === $pos) {
764 return false;
765 }
766 if ($part) {
767 return self::mb_substr($haystack, 0, $pos, $encoding);
768 }
769
770 return self::mb_substr($haystack, $pos, null, $encoding);
771 }
static mb_substr($s, $start, $length=null, $encoding=null)
Definition: Mbstring.php:574

References Symfony\Polyfill\Mbstring\Mbstring\mb_substr().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_stristr(), Symfony\Polyfill\Mbstring\Mbstring\mb_strrchr(), and Symfony\Polyfill\Mbstring\Mbstring\mb_strrichr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_encoding_callback()

static Symfony\Polyfill\Mbstring\Mbstring::html_encoding_callback ( array  $m)
staticprivate

Definition at line 773 of file Mbstring.php.

774 {
775 $i = 1;
776 $entities = '';
777 $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
778
779 while (isset($m[$i])) {
780 if (0x80 > $m[$i]) {
781 $entities .= \chr($m[$i++]);
782 continue;
783 }
784 if (0xF0 <= $m[$i]) {
785 $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
786 } elseif (0xE0 <= $m[$i]) {
787 $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
788 } else {
789 $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
790 }
791
792 $entities .= '&#'.$c.';';
793 }
794
795 return $entities;
796 }
$i
Definition: disco.tpl.php:19

References $c, $i, and $m.

◆ mb_check_encoding()

static Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding (   $var = null,
  $encoding = null 
)
static

Definition at line 400 of file Mbstring.php.

401 {
402 if (null === $encoding) {
403 if (null === $var) {
404 return false;
405 }
406 $encoding = self::$internalEncoding;
407 }
408
409 return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
410 }
static mb_detect_encoding($str, $encodingList=null, $strict=false)
Definition: Mbstring.php:412

References Symfony\Polyfill\Mbstring\Mbstring\$internalEncoding, and Symfony\Polyfill\Mbstring\Mbstring\mb_detect_encoding().

+ Here is the call graph for this function:

◆ mb_chr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_chr (   $code,
  $encoding = null 
)
static

Definition at line 718 of file Mbstring.php.

719 {
720 if (0x80 > $code %= 0x200000) {
721 $s = \chr($code);
722 } elseif (0x800 > $code) {
723 $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
724 } elseif (0x10000 > $code) {
725 $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
726 } else {
727 $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
728 }
729
730 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
731 $s = mb_convert_encoding($s, $encoding, 'UTF-8');
732 }
733
734 return $s;
735 }
static mb_convert_encoding($s, $toEncoding, $fromEncoding=null)
Definition: Mbstring.php:80
$code
Definition: example_050.php:99
$s
Definition: pwgen.php:45

References $code, $s, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_encoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_decode_numericentity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_convert_case()

static Symfony\Polyfill\Mbstring\Mbstring::mb_convert_case (   $s,
  $mode,
  $encoding = null 
)
static

Definition at line 272 of file Mbstring.php.

273 {
274 $s = (string) $s;
275 if ('' === $s) {
276 return '';
277 }
278
279 $encoding = self::getEncoding($encoding);
280
281 if ('UTF-8' === $encoding) {
282 $encoding = null;
283 if (!preg_match('//u', $s)) {
284 $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
285 }
286 } else {
287 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
288 }
289
290 if (MB_CASE_TITLE == $mode) {
291 static $titleRegexp = null;
292 if (null === $titleRegexp) {
293 $titleRegexp = self::getData('titleCaseRegexp');
294 }
295 $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
296 } else {
297 if (MB_CASE_UPPER == $mode) {
298 static $upper = null;
299 if (null === $upper) {
300 $upper = self::getData('upperCase');
301 }
302 $map = $upper;
303 } else {
304 if (self::MB_CASE_FOLD === $mode) {
305 $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
306 }
307
308 static $lower = null;
309 if (null === $lower) {
310 $lower = self::getData('lowerCase');
311 }
312 $map = $lower;
313 }
314
315 static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
316
317 $i = 0;
318 $len = \strlen($s);
319
320 while ($i < $len) {
321 $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
322 $uchr = substr($s, $i, $ulen);
323 $i += $ulen;
324
325 if (isset($map[$uchr])) {
326 $uchr = $map[$uchr];
327 $nlen = \strlen($uchr);
328
329 if ($nlen == $ulen) {
330 $nlen = $i;
331 do {
332 $s[--$nlen] = $uchr[--$ulen];
333 } while ($ulen);
334 } else {
335 $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
336 $len += $nlen - $ulen;
337 $i += $nlen - $ulen;
338 }
339 }
340 }
341 }
342
343 if (null === $encoding) {
344 return $s;
345 }
346
347 return iconv('UTF-8', $encoding.'//IGNORE', $s);
348 }

References $i, $map, $s, Symfony\Polyfill\Mbstring\Mbstring\getData(), and Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_stripos(), Symfony\Polyfill\Mbstring\Mbstring\mb_strripos(), Symfony\Polyfill\Mbstring\Mbstring\mb_strtolower(), Symfony\Polyfill\Mbstring\Mbstring\mb_strtoupper(), and Symfony\Polyfill\Mbstring\Mbstring\title_case().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_convert_encoding()

static Symfony\Polyfill\Mbstring\Mbstring::mb_convert_encoding (   $s,
  $toEncoding,
  $fromEncoding = null 
)
static

Definition at line 80 of file Mbstring.php.

81 {
82 if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
83 $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
84 } else {
85 $fromEncoding = self::getEncoding($fromEncoding);
86 }
87
88 $toEncoding = self::getEncoding($toEncoding);
89
90 if ('BASE64' === $fromEncoding) {
91 $s = base64_decode($s);
92 $fromEncoding = $toEncoding;
93 }
94
95 if ('BASE64' === $toEncoding) {
96 return base64_encode($s);
97 }
98
99 if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
100 if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
101 $fromEncoding = 'Windows-1252';
102 }
103 if ('UTF-8' !== $fromEncoding) {
104 $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
105 }
106
107 return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
108 }
109
110 if ('HTML-ENTITIES' === $fromEncoding) {
111 $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
112 $fromEncoding = 'UTF-8';
113 }
114
115 return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
116 }

References $s, Symfony\Polyfill\Mbstring\Mbstring\getEncoding(), and Symfony\Polyfill\Mbstring\Mbstring\mb_detect_encoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_chr(), Symfony\Polyfill\Mbstring\Mbstring\mb_convert_variables(), and Symfony\Polyfill\Mbstring\Mbstring\mb_ord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_convert_variables()

static Symfony\Polyfill\Mbstring\Mbstring::mb_convert_variables (   $toEncoding,
  $fromEncoding,
$a = null,
$b = null,
$c = null,
$d = null,
$e = null,
$f = null 
)
static

Definition at line 118 of file Mbstring.php.

119 {
120 $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
121
122 $ok = true;
123 array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
124 if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
125 $ok = false;
126 }
127 });
128
129 return $ok ? $fromEncoding : false;
130 }
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $c, $d, $f, $ok, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_encoding().

+ Here is the call graph for this function:

◆ mb_decode_mimeheader()

static Symfony\Polyfill\Mbstring\Mbstring::mb_decode_mimeheader (   $s)
static

Definition at line 132 of file Mbstring.php.

133 {
134 return iconv_mime_decode($s, 2, self::$internalEncoding);
135 }

References $s.

◆ mb_decode_numericentity()

static Symfony\Polyfill\Mbstring\Mbstring::mb_decode_numericentity (   $s,
  $convmap,
  $encoding = null 
)
static

Definition at line 142 of file Mbstring.php.

143 {
144 if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
145 trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
146
147 return null;
148 }
149
150 if (!\is_array($convmap) || !$convmap) {
151 return false;
152 }
153
154 if (null !== $encoding && !\is_scalar($encoding)) {
155 trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
156
157 return ''; // Instead of null (cf. mb_encode_numericentity).
158 }
159
160 $s = (string) $s;
161 if ('' === $s) {
162 return '';
163 }
164
165 $encoding = self::getEncoding($encoding);
166
167 if ('UTF-8' === $encoding) {
168 $encoding = null;
169 if (!preg_match('//u', $s)) {
170 $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
171 }
172 } else {
173 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
174 }
175
176 $cnt = floor(\count($convmap) / 4) * 4;
177
178 for ($i = 0; $i < $cnt; $i += 4) {
179 // collector_decode_htmlnumericentity ignores $convmap[$i + 3]
180 $convmap[$i] += $convmap[$i + 2];
181 $convmap[$i + 1] += $convmap[$i + 2];
182 }
183
184 $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
185 $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
186 for ($i = 0; $i < $cnt; $i += 4) {
187 if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
188 return Mbstring::mb_chr($c - $convmap[$i + 2]);
189 }
190 }
191
192 return $m[0];
193 }, $s);
194
195 if (null === $encoding) {
196 return $s;
197 }
198
199 return iconv('UTF-8', $encoding.'//IGNORE', $s);
200 }
static mb_chr($code, $encoding=null)
Definition: Mbstring.php:718

References $c, $i, $m, $s, Symfony\Polyfill\Mbstring\Mbstring\getEncoding(), and Symfony\Polyfill\Mbstring\Mbstring\mb_chr().

+ Here is the call graph for this function:

◆ mb_detect_encoding()

static Symfony\Polyfill\Mbstring\Mbstring::mb_detect_encoding (   $str,
  $encodingList = null,
  $strict = false 
)
static

Definition at line 412 of file Mbstring.php.

413 {
414 if (null === $encodingList) {
416 } else {
417 if (!\is_array($encodingList)) {
418 $encodingList = array_map('trim', explode(',', $encodingList));
419 }
420 $encodingList = array_map('strtoupper', $encodingList);
421 }
422
423 foreach ($encodingList as $enc) {
424 switch ($enc) {
425 case 'ASCII':
426 if (!preg_match('/[\x80-\xFF]/', $str)) {
427 return $enc;
428 }
429 break;
430
431 case 'UTF8':
432 case 'UTF-8':
433 if (preg_match('//u', $str)) {
434 return 'UTF-8';
435 }
436 break;
437
438 default:
439 if (0 === strncmp($enc, 'ISO-8859-', 9)) {
440 return $enc;
441 }
442 }
443 }
444
445 return false;
446 }

References Symfony\Polyfill\Mbstring\Mbstring\$encodingList.

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_check_encoding(), and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_encoding().

+ Here is the caller graph for this function:

◆ mb_detect_order()

static Symfony\Polyfill\Mbstring\Mbstring::mb_detect_order (   $encodingList = null)
static

Definition at line 448 of file Mbstring.php.

449 {
450 if (null === $encodingList) {
451 return self::$encodingList;
452 }
453
454 if (!\is_array($encodingList)) {
455 $encodingList = array_map('trim', explode(',', $encodingList));
456 }
457 $encodingList = array_map('strtoupper', $encodingList);
458
459 foreach ($encodingList as $enc) {
460 switch ($enc) {
461 default:
462 if (strncmp($enc, 'ISO-8859-', 9)) {
463 return false;
464 }
465 // no break
466 case 'ASCII':
467 case 'UTF8':
468 case 'UTF-8':
469 }
470 }
471
472 self::$encodingList = $encodingList;
473
474 return true;
475 }

References Symfony\Polyfill\Mbstring\Mbstring\$encodingList.

◆ mb_encode_mimeheader()

static Symfony\Polyfill\Mbstring\Mbstring::mb_encode_mimeheader (   $s,
  $charset = null,
  $transferEncoding = null,
  $linefeed = null,
  $indent = null 
)
static

Definition at line 137 of file Mbstring.php.

138 {
139 trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
140 }

◆ mb_encode_numericentity()

static Symfony\Polyfill\Mbstring\Mbstring::mb_encode_numericentity (   $s,
  $convmap,
  $encoding = null,
  $is_hex = false 
)
static

Definition at line 202 of file Mbstring.php.

203 {
204 if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
205 trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
206
207 return null;
208 }
209
210 if (!\is_array($convmap) || !$convmap) {
211 return false;
212 }
213
214 if (null !== $encoding && !\is_scalar($encoding)) {
215 trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
216
217 return null; // Instead of '' (cf. mb_decode_numericentity).
218 }
219
220 if (null !== $is_hex && !\is_scalar($is_hex)) {
221 trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
222
223 return null;
224 }
225
226 $s = (string) $s;
227 if ('' === $s) {
228 return '';
229 }
230
231 $encoding = self::getEncoding($encoding);
232
233 if ('UTF-8' === $encoding) {
234 $encoding = null;
235 if (!preg_match('//u', $s)) {
236 $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
237 }
238 } else {
239 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
240 }
241
242 static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
243
244 $cnt = floor(\count($convmap) / 4) * 4;
245 $i = 0;
246 $len = \strlen($s);
247 $result = '';
248
249 while ($i < $len) {
250 $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
251 $uchr = substr($s, $i, $ulen);
252 $i += $ulen;
253 $c = self::mb_ord($uchr);
254
255 for ($j = 0; $j < $cnt; $j += 4) {
256 if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
257 $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
258 $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
259 continue 2;
260 }
261 }
262 $result .= $uchr;
263 }
264
265 if (null === $encoding) {
266 return $result;
267 }
268
269 return iconv('UTF-8', $encoding.'//IGNORE', $result);
270 }
$result
static mb_ord($s, $encoding=null)
Definition: Mbstring.php:737

References $c, $i, $result, $s, Symfony\Polyfill\Mbstring\Mbstring\getEncoding(), and Symfony\Polyfill\Mbstring\Mbstring\mb_ord().

+ Here is the call graph for this function:

◆ mb_encoding_aliases()

static Symfony\Polyfill\Mbstring\Mbstring::mb_encoding_aliases (   $encoding)
static

Definition at line 389 of file Mbstring.php.

390 {
391 switch (strtoupper($encoding)) {
392 case 'UTF8':
393 case 'UTF-8':
394 return array('utf8');
395 }
396
397 return false;
398 }

◆ mb_get_info()

static Symfony\Polyfill\Mbstring\Mbstring::mb_get_info (   $type = 'all')
static

Definition at line 656 of file Mbstring.php.

657 {
658 $info = array(
659 'internal_encoding' => self::$internalEncoding,
660 'http_output' => 'pass',
661 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
662 'func_overload' => 0,
663 'func_overload_list' => 'no overload',
664 'mail_charset' => 'UTF-8',
665 'mail_header_encoding' => 'BASE64',
666 'mail_body_encoding' => 'BASE64',
667 'illegal_chars' => 0,
668 'encoding_translation' => 'Off',
669 'language' => self::$language,
670 'detect_order' => self::$encodingList,
671 'substitute_character' => 'none',
672 'strict_detection' => 'Off',
673 );
674
675 if ('all' === $type) {
676 return $info;
677 }
678 if (isset($info[$type])) {
679 return $info[$type];
680 }
681
682 return false;
683 }
$info
Definition: index.php:5
$type

References $info, $language, and $type.

◆ mb_http_input()

static Symfony\Polyfill\Mbstring\Mbstring::mb_http_input (   $type = '')
static

Definition at line 685 of file Mbstring.php.

686 {
687 return false;
688 }

◆ mb_http_output()

static Symfony\Polyfill\Mbstring\Mbstring::mb_http_output (   $encoding = null)
static

Definition at line 690 of file Mbstring.php.

691 {
692 return null !== $encoding ? 'pass' === $encoding : 'pass';
693 }

◆ mb_internal_encoding()

static Symfony\Polyfill\Mbstring\Mbstring::mb_internal_encoding (   $encoding = null)
static

Definition at line 350 of file Mbstring.php.

351 {
352 if (null === $encoding) {
354 }
355
356 $encoding = self::getEncoding($encoding);
357
358 if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
359 self::$internalEncoding = $encoding;
360
361 return true;
362 }
363
364 return false;
365 }

References Symfony\Polyfill\Mbstring\Mbstring\$internalEncoding, and Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_str_split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_language()

static Symfony\Polyfill\Mbstring\Mbstring::mb_language (   $lang = null)
static

Definition at line 367 of file Mbstring.php.

368 {
369 if (null === $lang) {
370 return self::$language;
371 }
372
373 switch ($lang = strtolower($lang)) {
374 case 'uni':
375 case 'neutral':
377
378 return true;
379 }
380
381 return false;
382 }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349

References $lang, $language, and Symfony\Polyfill\Mbstring\Mbstring\$language.

◆ mb_list_encodings()

static Symfony\Polyfill\Mbstring\Mbstring::mb_list_encodings ( )
static

Definition at line 384 of file Mbstring.php.

385 {
386 return array('UTF-8');
387 }

◆ mb_ord()

static Symfony\Polyfill\Mbstring\Mbstring::mb_ord (   $s,
  $encoding = null 
)
static

Definition at line 737 of file Mbstring.php.

738 {
739 if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
740 $s = mb_convert_encoding($s, 'UTF-8', $encoding);
741 }
742
743 if (1 === \strlen($s)) {
744 return \ord($s);
745 }
746
747 $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
748 if (0xF0 <= $code) {
749 return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
750 }
751 if (0xE0 <= $code) {
752 return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
753 }
754 if (0xC0 <= $code) {
755 return (($code - 0xC0) << 6) + $s[2] - 0x80;
756 }
757
758 return $code;
759 }

References $code, $s, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_encoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_encode_numericentity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_output_handler()

static Symfony\Polyfill\Mbstring\Mbstring::mb_output_handler (   $contents,
  $status 
)
static

Definition at line 713 of file Mbstring.php.

714 {
715 return $contents;
716 }

◆ mb_str_split()

static Symfony\Polyfill\Mbstring\Mbstring::mb_str_split (   $string,
  $split_length = 1,
  $encoding = null 
)
static

Definition at line 527 of file Mbstring.php.

528 {
529 if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
530 trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
531
532 return null;
533 }
534
535 if ($split_length < 1) {
536 trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
537
538 return false;
539 }
540
541 if (null === $encoding) {
542 $encoding = mb_internal_encoding();
543 }
544
545 $result = array();
546 $length = mb_strlen($string, $encoding);
547
548 for ($i = 0; $i < $length; $i += $split_length) {
549 $result[] = mb_substr($string, $i, $split_length, $encoding);
550 }
551
552 return $result;
553 }
static mb_internal_encoding($encoding=null)
Definition: Mbstring.php:350
static mb_strlen($s, $encoding=null)
Definition: Mbstring.php:477

References $i, $result, Symfony\Polyfill\Mbstring\Mbstring\mb_internal_encoding(), Symfony\Polyfill\Mbstring\Mbstring\mb_strlen(), and Symfony\Polyfill\Mbstring\Mbstring\mb_substr().

+ Here is the call graph for this function:

◆ mb_stripos()

static Symfony\Polyfill\Mbstring\Mbstring::mb_stripos (   $haystack,
  $needle,
  $offset = 0,
  $encoding = null 
)
static

Definition at line 600 of file Mbstring.php.

601 {
602 $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
603 $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
604
605 return self::mb_strpos($haystack, $needle, $offset, $encoding);
606 }
static mb_strpos($haystack, $needle, $offset=0, $encoding=null)
Definition: Mbstring.php:487
static mb_convert_case($s, $mode, $encoding=null)
Definition: Mbstring.php:272

References Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case(), and Symfony\Polyfill\Mbstring\Mbstring\mb_strpos().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_stristr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_stristr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_stristr (   $haystack,
  $needle,
  $part = false,
  $encoding = null 
)
static

Definition at line 608 of file Mbstring.php.

609 {
610 $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
611
612 return self::getSubpart($pos, $part, $haystack, $encoding);
613 }
static mb_stripos($haystack, $needle, $offset=0, $encoding=null)
Definition: Mbstring.php:600
static getSubpart($pos, $part, $haystack, $encoding)
Definition: Mbstring.php:761

References Symfony\Polyfill\Mbstring\Mbstring\getSubpart(), and Symfony\Polyfill\Mbstring\Mbstring\mb_stripos().

+ Here is the call graph for this function:

◆ mb_strlen()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strlen (   $s,
  $encoding = null 
)
static

Definition at line 477 of file Mbstring.php.

478 {
479 $encoding = self::getEncoding($encoding);
480 if ('CP850' === $encoding || 'ASCII' === $encoding) {
481 return \strlen($s);
482 }
483
484 return @iconv_strlen($s, $encoding);
485 }

References $s, and Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_str_split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_strpos()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strpos (   $haystack,
  $needle,
  $offset = 0,
  $encoding = null 
)
static

Definition at line 487 of file Mbstring.php.

488 {
489 $encoding = self::getEncoding($encoding);
490 if ('CP850' === $encoding || 'ASCII' === $encoding) {
491 return strpos($haystack, $needle, $offset);
492 }
493
494 $needle = (string) $needle;
495 if ('' === $needle) {
496 trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
497
498 return false;
499 }
500
501 return iconv_strpos($haystack, $needle, $offset, $encoding);
502 }

References Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_stripos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_strrchr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strrchr (   $haystack,
  $needle,
  $part = false,
  $encoding = null 
)
static

Definition at line 615 of file Mbstring.php.

616 {
617 $encoding = self::getEncoding($encoding);
618 if ('CP850' === $encoding || 'ASCII' === $encoding) {
619 return strrchr($haystack, $needle, $part);
620 }
621 $needle = self::mb_substr($needle, 0, 1, $encoding);
622 $pos = iconv_strrpos($haystack, $needle, $encoding);
623
624 return self::getSubpart($pos, $part, $haystack, $encoding);
625 }

References Symfony\Polyfill\Mbstring\Mbstring\getEncoding(), Symfony\Polyfill\Mbstring\Mbstring\getSubpart(), and Symfony\Polyfill\Mbstring\Mbstring\mb_substr().

+ Here is the call graph for this function:

◆ mb_strrichr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strrichr (   $haystack,
  $needle,
  $part = false,
  $encoding = null 
)
static

Definition at line 627 of file Mbstring.php.

628 {
629 $needle = self::mb_substr($needle, 0, 1, $encoding);
630 $pos = self::mb_strripos($haystack, $needle, $encoding);
631
632 return self::getSubpart($pos, $part, $haystack, $encoding);
633 }
static mb_strripos($haystack, $needle, $offset=0, $encoding=null)
Definition: Mbstring.php:635

References Symfony\Polyfill\Mbstring\Mbstring\getSubpart(), Symfony\Polyfill\Mbstring\Mbstring\mb_strripos(), and Symfony\Polyfill\Mbstring\Mbstring\mb_substr().

+ Here is the call graph for this function:

◆ mb_strripos()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strripos (   $haystack,
  $needle,
  $offset = 0,
  $encoding = null 
)
static

Definition at line 635 of file Mbstring.php.

636 {
637 $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
638 $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
639
640 return self::mb_strrpos($haystack, $needle, $offset, $encoding);
641 }
static mb_strrpos($haystack, $needle, $offset=0, $encoding=null)
Definition: Mbstring.php:504

References Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case(), and Symfony\Polyfill\Mbstring\Mbstring\mb_strrpos().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_strrichr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_strrpos()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strrpos (   $haystack,
  $needle,
  $offset = 0,
  $encoding = null 
)
static

Definition at line 504 of file Mbstring.php.

505 {
506 $encoding = self::getEncoding($encoding);
507 if ('CP850' === $encoding || 'ASCII' === $encoding) {
508 return strrpos($haystack, $needle, $offset);
509 }
510
511 if ($offset != (int) $offset) {
512 $offset = 0;
513 } elseif ($offset = (int) $offset) {
514 if ($offset < 0) {
515 $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
516 $offset = 0;
517 } else {
518 $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
519 }
520 }
521
522 $pos = iconv_strrpos($haystack, $needle, $encoding);
523
524 return false !== $pos ? $offset + $pos : false;
525 }

References Symfony\Polyfill\Mbstring\Mbstring\getEncoding(), and Symfony\Polyfill\Mbstring\Mbstring\mb_substr().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_strripos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_strstr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strstr (   $haystack,
  $needle,
  $part = false,
  $encoding = null 
)
static

Definition at line 643 of file Mbstring.php.

644 {
645 $pos = strpos($haystack, $needle);
646 if (false === $pos) {
647 return false;
648 }
649 if ($part) {
650 return substr($haystack, 0, $pos);
651 }
652
653 return substr($haystack, $pos);
654 }

◆ mb_strtolower()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strtolower (   $s,
  $encoding = null 
)
static

Definition at line 555 of file Mbstring.php.

556 {
557 return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
558 }

References $s, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case().

+ Here is the call graph for this function:

◆ mb_strtoupper()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strtoupper (   $s,
  $encoding = null 
)
static

Definition at line 560 of file Mbstring.php.

561 {
562 return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
563 }

References $s, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case().

+ Here is the call graph for this function:

◆ mb_strwidth()

static Symfony\Polyfill\Mbstring\Mbstring::mb_strwidth (   $s,
  $encoding = null 
)
static

Definition at line 695 of file Mbstring.php.

696 {
697 $encoding = self::getEncoding($encoding);
698
699 if ('UTF-8' !== $encoding) {
700 $s = iconv($encoding, 'UTF-8//IGNORE', $s);
701 }
702
703 $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);
704
705 return ($wide << 1) + iconv_strlen($s, 'UTF-8');
706 }

References $s, and Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

+ Here is the call graph for this function:

◆ mb_substitute_character()

static Symfony\Polyfill\Mbstring\Mbstring::mb_substitute_character (   $c = null)
static

Definition at line 565 of file Mbstring.php.

566 {
567 if (0 === strcasecmp($c, 'none')) {
568 return true;
569 }
570
571 return null !== $c ? false : 'none';
572 }

References $c.

◆ mb_substr()

static Symfony\Polyfill\Mbstring\Mbstring::mb_substr (   $s,
  $start,
  $length = null,
  $encoding = null 
)
static

Definition at line 574 of file Mbstring.php.

575 {
576 $encoding = self::getEncoding($encoding);
577 if ('CP850' === $encoding || 'ASCII' === $encoding) {
578 return (string) substr($s, $start, null === $length ? 2147483647 : $length);
579 }
580
581 if ($start < 0) {
582 $start = iconv_strlen($s, $encoding) + $start;
583 if ($start < 0) {
584 $start = 0;
585 }
586 }
587
588 if (null === $length) {
589 $length = 2147483647;
590 } elseif ($length < 0) {
591 $length = iconv_strlen($s, $encoding) + $length - $start;
592 if ($length < 0) {
593 return '';
594 }
595 }
596
597 return (string) iconv_substr($s, $start, $length, $encoding);
598 }
$start
Definition: bench.php:8

References $s, $start, and Symfony\Polyfill\Mbstring\Mbstring\getEncoding().

Referenced by Symfony\Polyfill\Mbstring\Mbstring\getSubpart(), Symfony\Polyfill\Mbstring\Mbstring\mb_str_split(), Symfony\Polyfill\Mbstring\Mbstring\mb_strrchr(), Symfony\Polyfill\Mbstring\Mbstring\mb_strrichr(), and Symfony\Polyfill\Mbstring\Mbstring\mb_strrpos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mb_substr_count()

static Symfony\Polyfill\Mbstring\Mbstring::mb_substr_count (   $haystack,
  $needle,
  $encoding = null 
)
static

Definition at line 708 of file Mbstring.php.

709 {
710 return substr_count($haystack, $needle);
711 }

◆ title_case()

static Symfony\Polyfill\Mbstring\Mbstring::title_case ( array  $s)
staticprivate

Definition at line 798 of file Mbstring.php.

799 {
800 return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
801 }

References $s, and Symfony\Polyfill\Mbstring\Mbstring\mb_convert_case().

+ Here is the call graph for this function:

Field Documentation

◆ $caseFold

Symfony\Polyfill\Mbstring\Mbstring::$caseFold
staticprivate
Initial value:
= array(
array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'),
)

Definition at line 75 of file Mbstring.php.

◆ $encodingList

Symfony\Polyfill\Mbstring\Mbstring::$encodingList = array('ASCII', 'UTF-8')
staticprivate

◆ $internalEncoding

Symfony\Polyfill\Mbstring\Mbstring::$internalEncoding = 'UTF-8'
staticprivate

◆ $language

Symfony\Polyfill\Mbstring\Mbstring::$language = 'neutral'
staticprivate

Definition at line 73 of file Mbstring.php.

Referenced by Symfony\Polyfill\Mbstring\Mbstring\mb_language().

◆ MB_CASE_FOLD

const Symfony\Polyfill\Mbstring\Mbstring::MB_CASE_FOLD = PHP_INT_MAX

Definition at line 70 of file Mbstring.php.


The documentation for this class was generated from the following file: