Make WordPress Core

Changeset 36020


Ignore:
Timestamp:
12/19/2015 04:58:59 AM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Fix inline comment syntax in _mb_strlen(), an internal compat method for mb_strlen().

See #32246.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/compat.php

    r36019 r36020  
    169169    }
    170170
    171     // The solution below works only for UTF-8,
    172     // so in case of a different charset just use built-in strlen()
     171    /*
     172     * The solution below works only for UTF-8, so in case of a different charset
     173     * just use built-in strlen().
     174     */
    173175    if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
    174176        return strlen( $str );
     
    176178
    177179    if ( _wp_can_use_pcre_u() ) {
    178         // Use the regex unicode support to separate the UTF-8 characters into an array
     180        // Use the regex unicode support to separate the UTF-8 characters into an array.
    179181        preg_match_all( '/./us', $str, $match );
    180182        return count( $match[0] );
     
    193195    )/x';
    194196
    195     $count = 1; // Start at 1 instead of 0 since the first thing we do is decrement
     197    // Start at 1 instead of 0 since the first thing we do is decrement.
     198    $count = 1;
    196199    do {
    197200        // We had some string left over from the last round, but we counted it in that last round.
    198201        $count--;
    199202
    200         // Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
     203        /*
     204         * Split by UTF-8 character, limit to 1000 characters (last array element will contain
     205         * the rest of the string).
     206         */
    201207        $pieces = preg_split( $regex, $str, 1000 );
    202208
    203         // Increment
     209        // Increment.
    204210        $count += count( $pieces );
    205     } while ( $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
    206 
    207     // Fencepost: preg_split() always returns one extra item in the array
     211
     212    // If there's anything left over, repeat the loop.
     213    } while ( $str = array_pop( $pieces ) );
     214
     215    // Fencepost: preg_split() always returns one extra item in the array.
    208216    return --$count;
    209217}
Note: See TracChangeset for help on using the changeset viewer.