Make WordPress Core


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

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

See #32246.

File:
1 edited

Legend:

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

    r36017 r36018  
    8383    }
    8484
    85     // The solution below works only for UTF-8,
    86     // so in case of a different charset just use built-in substr()
     85    /*
     86     * The solution below works only for UTF-8, so in case of a different
     87     * charset just use built-in substr().
     88     */
    8789    if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
    8890        return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
     
    9092
    9193    if ( _wp_can_use_pcre_u() ) {
    92         // Use the regex unicode support to separate the UTF-8 characters into an array
     94        // Use the regex unicode support to separate the UTF-8 characters into an array.
    9395        preg_match_all( '/./us', $str, $match );
    9496        $chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
     
    108110    )/x';
    109111
    110     $chars = array( '' ); // Start with 1 element instead of 0 since the first thing we do is pop
     112    // Start with 1 element instead of 0 since the first thing we do is pop.
     113    $chars = array( '' );
    111114    do {
    112115        // We had some string left over from the last round, but we counted it in that last round.
    113116        array_pop( $chars );
    114117
    115         // Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
     118        /*
     119         * Split by UTF-8 character, limit to 1000 characters (last array element will contain
     120         * the rest of the string).
     121         */
    116122        $pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
    117123
    118124        $chars = array_merge( $chars, $pieces );
    119     } while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
     125
     126    // If there's anything left over, repeat the loop.
     127    } while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) );
    120128
    121129    return join( '', array_slice( $chars, $start, $length ) );
Note: See TracChangeset for help on using the changeset viewer.