Docs: Fix inline comment syntax in `_mb_strlen()`, an internal compat method for `mb_strlen()`.
See #32246. Built from https://develop.svn.wordpress.org/trunk@36020 git-svn-id: http://core.svn.wordpress.org/trunk@35985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
87786b4373
commit
c10ec122ca
|
@ -168,14 +168,16 @@ function _mb_strlen( $str, $encoding = null ) {
|
|||
$encoding = get_option( 'blog_charset' );
|
||||
}
|
||||
|
||||
// The solution below works only for UTF-8,
|
||||
// so in case of a different charset just use built-in strlen()
|
||||
/*
|
||||
* The solution below works only for UTF-8, so in case of a different charset
|
||||
* just use built-in strlen().
|
||||
*/
|
||||
if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
|
||||
return strlen( $str );
|
||||
}
|
||||
|
||||
if ( _wp_can_use_pcre_u() ) {
|
||||
// Use the regex unicode support to separate the UTF-8 characters into an array
|
||||
// Use the regex unicode support to separate the UTF-8 characters into an array.
|
||||
preg_match_all( '/./us', $str, $match );
|
||||
return count( $match[0] );
|
||||
}
|
||||
|
@ -192,19 +194,25 @@ function _mb_strlen( $str, $encoding = null ) {
|
|||
| \xF4[\x80-\x8F][\x80-\xBF]{2}
|
||||
)/x';
|
||||
|
||||
$count = 1; // Start at 1 instead of 0 since the first thing we do is decrement
|
||||
// Start at 1 instead of 0 since the first thing we do is decrement.
|
||||
$count = 1;
|
||||
do {
|
||||
// We had some string left over from the last round, but we counted it in that last round.
|
||||
$count--;
|
||||
|
||||
// Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
|
||||
/*
|
||||
* Split by UTF-8 character, limit to 1000 characters (last array element will contain
|
||||
* the rest of the string).
|
||||
*/
|
||||
$pieces = preg_split( $regex, $str, 1000 );
|
||||
|
||||
// Increment
|
||||
// Increment.
|
||||
$count += count( $pieces );
|
||||
} while ( $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
|
||||
|
||||
// Fencepost: preg_split() always returns one extra item in the array
|
||||
// If there's anything left over, repeat the loop.
|
||||
} while ( $str = array_pop( $pieces ) );
|
||||
|
||||
// Fencepost: preg_split() always returns one extra item in the array.
|
||||
return --$count;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36019';
|
||||
$wp_version = '4.5-alpha-36020';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue