Make WordPress Core


Ignore:
Timestamp:
07/10/2023 10:36:06 PM (2 years ago)
Author:
audrasjb
Message:

Docs: Replace multiple single line comments with multi-line comments.

This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179], [56180].

Props costdev, audrasjb.
See #58459.

File:
1 edited

Legend:

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

    r56132 r56191  
    137137        $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );
    138138
    139         // Pattern-based replacements of characters.
    140         // Sort the remaining patterns into several arrays for performance tuning.
     139        /*
     140         * Pattern-based replacements of characters.
     141         * Sort the remaining patterns into several arrays for performance tuning.
     142         */
    141143        $dynamic_characters   = array(
    142144            'apos'  => array(),
     
    341343                        $pos = strrpos( $sentence, "$flag." );
    342344                    } else {
    343                         // When all else fails, make the rightmost candidate a closing quote.
    344                         // This is most likely to be problematic in the context of bug #18549.
     345                        /*
     346                         * When all else fails, make the rightmost candidate a closing quote.
     347                         * This is most likely to be problematic in the context of bug #18549.
     348                         */
    345349                        $pos = strrpos( $sentence, $flag );
    346350                    }
     
    977981
    978982    if ( ! $double_encode ) {
    979         // Guarantee every &entity; is valid, convert &garbage; into &garbage;
    980         // This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
     983        /*
     984         * Guarantee every &entity; is valid, convert &garbage; into &amp;garbage;
     985         * This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
     986         */
    981987        $text = wp_kses_normalize_entities( $text, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
    982988    }
     
    16021608    if ( seems_utf8( $text ) ) {
    16031609
    1604         // Unicode sequence normalization from NFD (Normalization Form Decomposed)
    1605         // to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
     1610        /*
     1611         * Unicode sequence normalization from NFD (Normalization Form Decomposed)
     1612         * to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
     1613         */
    16061614        if ( function_exists( 'normalizer_is_normalized' )
    16071615            && function_exists( 'normalizer_normalize' )
     
    18181826            // GBP (Pound) sign.
    18191827            '£' => '',
    1820             // Vowels with diacritic (Vietnamese).
    1821             // Unmarked.
     1828            // Vowels with diacritic (Vietnamese). Unmarked.
    18221829            'Ơ' => 'O',
    18231830            'ơ' => 'o',
     
    26622669            }
    26632670        } else { // Begin tag.
    2664             if ( $has_self_closer ) { // If it presents itself as a self-closing tag...
    2665                 // ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such
    2666                 // and immediately close it with a closing tag (the tag will encapsulate no text as a result).
     2671            if ( $has_self_closer ) {
     2672                /*
     2673                 * If it presents itself as a self-closing tag, but it isn't a known single-entity self-closing tag,
     2674                 * then don't let it be treated as such and immediately close it with a closing tag.
     2675                 * The tag will encapsulate no text as a result.
     2676                 */
    26672677                if ( ! $is_single_tag ) {
    26682678                    $attributes = trim( substr( $attributes, 0, -1 ) ) . "></$tag";
    26692679                }
    2670             } elseif ( $is_single_tag ) { // Else if it's a known single-entity tag but it doesn't close itself, do so.
     2680            } elseif ( $is_single_tag ) {
     2681                // Else if it's a known single-entity tag but it doesn't close itself, do so.
    26712682                $pre_attribute_ws = ' ';
    26722683                $attributes      .= '/';
    2673             } else { // It's not a single-entity tag.
    2674                 // If the top of the stack is the same as the tag we want to push, close previous tag.
     2684            } else {
     2685                /*
     2686                 * It's not a single-entity tag.
     2687                 * If the top of the stack is the same as the tag we want to push, close previous tag.
     2688                 */
    26752689                if ( $stacksize > 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) {
    26762690                    $tagqueue = '</' . array_pop( $tagstack ) . '>';
     
    29262940
    29272941    if ( ')' === $matches[3] && strpos( $url, '(' ) ) {
    2928         // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it,
    2929         // add the closing parenthesis to the URL. Then we can let the parenthesis balancer do its thing below.
     2942        /*
     2943         * If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it,
     2944         * add the closing parenthesis to the URL. Then we can let the parenthesis balancer do its thing below.
     2945         */
    29302946        $url   .= $matches[3];
    29312947        $suffix = '';
     
    31073123                (\)?)                                          # 3: Trailing closing parenthesis (for parethesis balancing post processing).
    31083124            ~xS';
    3109             // The regex is a non-anchored pattern and does not have a single fixed starting character.
    3110             // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
     3125            /*
     3126             * The regex is a non-anchored pattern and does not have a single fixed starting character.
     3127             * Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
     3128             */
    31113129
    31123130            $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
     
    35573575    list( $local, $domain ) = explode( '@', $email, 2 );
    35583576
    3559     // LOCAL PART
    3560     // Test for invalid characters.
     3577    /*
     3578     * LOCAL PART
     3579     * Test for invalid characters.
     3580     */
    35613581    if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
    35623582        /** This filter is documented in wp-includes/formatting.php */
     
    35643584    }
    35653585
    3566     // DOMAIN PART
    3567     // Test for sequences of periods.
     3586    /*
     3587     * DOMAIN PART
     3588     * Test for sequences of periods.
     3589     */
    35683590    if ( preg_match( '/\.{2,}/', $domain ) ) {
    35693591        /** This filter is documented in wp-includes/formatting.php */
     
    37673789    list( $local, $domain ) = explode( '@', $email, 2 );
    37683790
    3769     // LOCAL PART
    3770     // Test for invalid characters.
     3791    /*
     3792     * LOCAL PART
     3793     * Test for invalid characters.
     3794     */
    37713795    $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
    37723796    if ( '' === $local ) {
     
    37753799    }
    37763800
    3777     // DOMAIN PART
    3778     // Test for sequences of periods.
     3801    /*
     3802     * DOMAIN PART
     3803     * Test for sequences of periods.
     3804     */
    37793805    $domain = preg_replace( '/\.{2,}/', '', $domain );
    37803806    if ( '' === $domain ) {
Note: See TracChangeset for help on using the changeset viewer.