WordPress.org

Make WordPress Core

Ticket #53359: 53359.diff

File 53359.diff, 13.9 KB (added by kapilpaul, 3 months ago)

Patch for PHPCS fixing in bundled themes.

  • src/wp-content/themes/twentyeleven/functions.php

    diff --git a/src/wp-content/themes/twentyeleven/functions.php b/src/wp-content/themes/twentyeleven/functions.php
    index a26db9eba9..e34e357fd0 100644
    a b if ( ! function_exists( 'twentyeleven_header_style' ) ) : 
    322322                $text_color = get_header_textcolor();
    323323
    324324                // If no custom options for text are set, let's bail.
    325                 if ( HEADER_TEXTCOLOR == $text_color ) {
     325                if ( HEADER_TEXTCOLOR === $text_color ) {
    326326                        return;
    327327                }
    328328
    if ( ! function_exists( 'twentyeleven_admin_header_style' ) ) : 
    386386        }
    387387                <?php
    388388                // If the user has set a custom color for the text, use that.
    389                 if ( get_header_textcolor() != HEADER_TEXTCOLOR ) :
     389                if ( get_header_textcolor() !== HEADER_TEXTCOLOR ) :
    390390                        ?>
    391391        #site-title a,
    392392        #site-description {
    if ( ! function_exists( 'twentyeleven_comment' ) ) : 
    724724                                        <?php
    725725                                        $avatar_size = 68;
    726726
    727                                         if ( '0' != $comment->comment_parent ) {
     727                                        if ( '0' !== $comment->comment_parent ) {
    728728                                                $avatar_size = 39;
    729729                                        }
    730730
    if ( ! function_exists( 'twentyeleven_comment' ) ) : 
    756756                                        }
    757757                                        ?>
    758758
    759                                         <?php if ( '0' == $comment->comment_approved ) : ?>
     759                                        <?php if ( '0' === $comment->comment_approved ) : ?>
    760760                                        <em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
    761761                                        <br />
    762762                                        <?php endif; ?>
  • src/wp-content/themes/twentyeleven/image.php

    diff --git a/src/wp-content/themes/twentyeleven/image.php b/src/wp-content/themes/twentyeleven/image.php
    index 097ff19cc3..a727ea147a 100644
    a b get_header(); ?> 
    7070                                        )
    7171                                );
    7272                                foreach ( $attachments as $k => $attachment ) {
    73                                         if ( $attachment->ID == $post->ID ) {
     73                                        if ( $attachment->ID === $post->ID ) {
    7474                                                break;
    7575                                        }
    7676                                }
  • src/wp-content/themes/twentyeleven/inc/block-patterns.php

    diff --git a/src/wp-content/themes/twentyeleven/inc/block-patterns.php b/src/wp-content/themes/twentyeleven/inc/block-patterns.php
    index a1f7920fa9..f7513d47f9 100644
    a b  
    1010 * @since Twenty Eleven 1.0
    1111 */
    1212
    13  /**
     13/**
    1414 * Register Block Pattern Category.
    1515 */
    1616if ( function_exists( 'register_block_pattern_category' ) ) {
  • src/wp-content/themes/twentyeleven/inc/theme-options.php

    diff --git a/src/wp-content/themes/twentyeleven/inc/theme-options.php b/src/wp-content/themes/twentyeleven/inc/theme-options.php
    index 78be3b5aad..a1addb5359 100644
    a b function twentyeleven_print_link_color_style() { 
    447447        $default_options = twentyeleven_get_default_theme_options();
    448448
    449449        // Don't do anything if the current link color is the default.
    450         if ( $default_options['link_color'] == $link_color ) {
     450        if ( $default_options['link_color'] === $link_color ) {
    451451                return;
    452452        }
    453453        ?>
  • src/wp-content/themes/twentyeleven/showcase.php

    diff --git a/src/wp-content/themes/twentyeleven/showcase.php b/src/wp-content/themes/twentyeleven/showcase.php
    index 041054b8ae..9f330df90b 100644
    a b get_header(); ?> 
    154154                                                        while ( $featured->have_posts() ) :
    155155                                                                $featured->the_post();
    156156                                                                $counter_slider++;
    157                                                                 if ( 1 == $counter_slider ) {
     157                                                                if ( 1 === $counter_slider ) {
    158158                                                                        $class = ' class="active"';
    159159                                                                } else {
    160160                                                                        $class = '';
  • src/wp-content/themes/twentyfifteen/inc/custom-header.php

    diff --git a/src/wp-content/themes/twentyfifteen/inc/custom-header.php b/src/wp-content/themes/twentyfifteen/inc/custom-header.php
    index bf8655a73f..a09bb6b445 100644
    a b add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); 
    5858function twentyfifteen_hex2rgb( $color ) {
    5959        $color = trim( $color, '#' );
    6060
    61         if ( strlen( $color ) == 3 ) {
     61        if ( strlen( $color ) === 3 ) {
    6262                $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
    6363                $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
    6464                $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
    65         } elseif ( strlen( $color ) == 6 ) {
     65        } elseif ( strlen( $color ) === 6 ) {
    6666                $r = hexdec( substr( $color, 0, 2 ) );
    6767                $g = hexdec( substr( $color, 2, 2 ) );
    6868                $b = hexdec( substr( $color, 4, 2 ) );
  • src/wp-content/themes/twentyfourteen/functions.php

    diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php
    index f39296b1ba..9d63002cfb 100644
    a b if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : 
    461461                // If there is more than 1 attachment in a gallery...
    462462                if ( count( $attachment_ids ) > 1 ) {
    463463                        foreach ( $attachment_ids as $idx => $attachment_id ) {
    464                                 if ( $attachment_id == $post->ID ) {
     464                                if ( $attachment_id === $post->ID ) {
    465465                                        $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
    466466                                        break;
    467467                                }
  • src/wp-content/themes/twentyfourteen/inc/block-patterns.php

    diff --git a/src/wp-content/themes/twentyfourteen/inc/block-patterns.php b/src/wp-content/themes/twentyfourteen/inc/block-patterns.php
    index 13232e77da..5d653007e5 100644
    a b  
    1010 * @since Twenty Fourteen 3.2
    1111 */
    1212
    13  /**
     13/**
    1414 * Register Block Pattern Category.
    1515 */
    1616if ( function_exists( 'register_block_pattern_category' ) ) {
  • src/wp-content/themes/twentyfourteen/inc/custom-header.php

    diff --git a/src/wp-content/themes/twentyfourteen/inc/custom-header.php b/src/wp-content/themes/twentyfourteen/inc/custom-header.php
    index 7fb590db7d..aaef31b51d 100644
    a b if ( ! function_exists( 'twentyfourteen_header_style' ) ) : 
    8282                }
    8383                        <?php
    8484                        // If the user has set a custom color for the text, use that.
    85                 elseif ( get_theme_support( 'custom-header', 'default-text-color' ) != $text_color ) :
     85                elseif ( get_theme_support( 'custom-header', 'default-text-color' ) !== $text_color ) :
    8686                        ?>
    8787                .site-title a {
    8888                        color: #<?php echo esc_attr( $text_color ); ?>;
  • src/wp-content/themes/twentyfourteen/inc/featured-content.php

    diff --git a/src/wp-content/themes/twentyfourteen/inc/featured-content.php b/src/wp-content/themes/twentyfourteen/inc/featured-content.php
    index da8b76f715..ed7c661c42 100644
    a b class Featured_Content { 
    262262        public static function delete_post_tag( $tag_id ) {
    263263                $settings = self::get_setting();
    264264
    265                 if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
     265                if ( empty( $settings['tag-id'] ) || $tag_id !== $settings['tag-id'] ) {
    266266                        return;
    267267                }
    268268
  • src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php

    diff --git a/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php b/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php
    index 3e02cf542f..13308c013c 100644
    a b class TwentyNineteen_Walker_Comment extends Walker_Comment { 
    3636                                                $comment_author_url = get_comment_author_url( $comment );
    3737                                                $comment_author     = get_comment_author( $comment );
    3838                                                $avatar             = get_avatar( $comment, $args['avatar_size'] );
    39                                                 if ( 0 != $args['avatar_size'] ) {
     39                                                if ( 0 !== $args['avatar_size'] ) {
    4040                                                        if ( empty( $comment_author_url ) ) {
    4141                                                                echo $avatar;
    4242                                                        } else {
    class TwentyNineteen_Walker_Comment extends Walker_Comment { 
    9999                                        }
    100100                                        ?>
    101101
    102                                         <?php if ( '0' == $comment->comment_approved ) : ?>
     102                                        <?php if ( '0' === $comment->comment_approved ) : ?>
    103103                                        <p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
    104104                                        <?php endif; ?>
    105105
  • src/wp-content/themes/twentynineteen/comments.php

    diff --git a/src/wp-content/themes/twentynineteen/comments.php b/src/wp-content/themes/twentynineteen/comments.php
    index d00ac46118..f36c963ffd 100644
    a b $discussion = twentynineteen_get_discussion_data(); 
    3535                                _e( 'Leave a comment', 'twentynineteen' );
    3636                        }
    3737                } else {
    38                         if ( '1' == $discussion->responses ) {
     38                        if ( '1' === $discussion->responses ) {
    3939                                /* translators: %s: Post title. */
    4040                                printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
    4141                        } else {
  • src/wp-content/themes/twentyten/functions.php

    diff --git a/src/wp-content/themes/twentyten/functions.php b/src/wp-content/themes/twentyten/functions.php
    index efa7e5f8f9..b5797b6a05 100644
    a b if ( ! function_exists( 'twentyten_comment' ) ) : 
    439439                                }
    440440                                ?>
    441441
    442                                 <?php if ( '0' == $comment->comment_approved ) : ?>
     442                                <?php if ( '0' === $comment->comment_approved ) : ?>
    443443                        <em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
    444444                        <br />
    445445                        <?php endif; ?>
  • src/wp-content/themes/twentyten/loop-attachment.php

    diff --git a/src/wp-content/themes/twentyten/loop-attachment.php b/src/wp-content/themes/twentyten/loop-attachment.php
    index 50622f768d..05eab25097 100644
    a b if ( have_posts() ) { 
    100100                                )
    101101                        );
    102102                        foreach ( $attachments as $k => $attachment ) {
    103                                 if ( $attachment->ID == $post->ID ) {
     103                                if ( $attachment->ID === $post->ID ) {
    104104                                        break;
    105105                                }
    106106                        }
  • src/wp-content/themes/twentythirteen/functions.php

    diff --git a/src/wp-content/themes/twentythirteen/functions.php b/src/wp-content/themes/twentythirteen/functions.php
    index 52af8a05cb..0c71361734 100644
    a b if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) : 
    594594                // If there is more than 1 attachment in a gallery...
    595595                if ( count( $attachment_ids ) > 1 ) {
    596596                        foreach ( $attachment_ids as $idx => $attachment_id ) {
    597                                 if ( $attachment_id == $post->ID ) {
     597                                if ( $attachment_id === $post->ID ) {
    598598                                        $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
    599599                                        break;
    600600                                }
  • src/wp-content/themes/twentythirteen/image.php

    diff --git a/src/wp-content/themes/twentythirteen/image.php b/src/wp-content/themes/twentythirteen/image.php
    index 7372018cb6..3b9c974c51 100644
    a b get_header(); ?> 
    2929                                        /* translators: 1: Date, 2: Date, 3, Parent permalink, 4, Post title, 5: Post title. */
    3030                                        $published_text = __( '<span class="attachment-meta">Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Go to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );
    3131                                        $post_title     = get_the_title( $post->post_parent );
    32                                         if ( empty( $post_title ) || 0 == $post->post_parent ) {
     32
     33                                        if ( empty( $post_title ) || 0 === $post->post_parent ) {
    3334                                                $published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
    3435                                        }
    3536
  • src/wp-content/themes/twentythirteen/inc/custom-header.php

    diff --git a/src/wp-content/themes/twentythirteen/inc/custom-header.php b/src/wp-content/themes/twentythirteen/inc/custom-header.php
    index 7bbb50ec35..b87eaa058f 100644
    a b function twentythirteen_header_style() { 
    9090        $text_color   = get_header_textcolor();
    9191
    9292        // If no custom options for text are set, let's bail.
    93         if ( empty( $header_image ) && get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) {
     93        if ( empty( $header_image ) && get_theme_support( 'custom-header', 'default-text-color' ) === $text_color ) {
    9494                return;
    9595        }
    9696
    function twentythirteen_header_style() { 
    136136                endif;
    137137
    138138                // If the user has set a custom color for the text, use that.
    139                 elseif ( get_theme_support( 'custom-header', 'default-text-color' ) != $text_color ) :
     139                elseif ( get_theme_support( 'custom-header', 'default-text-color' ) !== $text_color ) :
    140140                        ?>
    141141                .site-title,
    142142                .site-description {
  • src/wp-content/themes/twentytwelve/functions.php

    diff --git a/src/wp-content/themes/twentytwelve/functions.php b/src/wp-content/themes/twentytwelve/functions.php
    index a4df147cb2..2be0df9903 100644
    a b if ( ! function_exists( 'twentytwelve_comment' ) ) : 
    460460                                }
    461461                                ?>
    462462
    463                                 <?php if ( '0' == $comment->comment_approved ) : ?>
     463                                <?php if ( '0' === $comment->comment_approved ) : ?>
    464464                                <p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
    465465                                <?php endif; ?>
    466466
  • src/wp-content/themes/twentytwelve/image.php

    diff --git a/src/wp-content/themes/twentytwelve/image.php b/src/wp-content/themes/twentytwelve/image.php
    index ef704a0045..824ae46093 100644
    a b get_header(); ?> 
    7070                                )
    7171                        );
    7272                        foreach ( $attachments as $k => $attachment ) :
    73                                 if ( $attachment->ID == $post->ID ) {
     73                                if ( $attachment->ID === $post->ID ) {
    7474                                        break;
    7575                                }
    7676                        endforeach;
  • src/wp-content/themes/twentytwelve/inc/custom-header.php

    diff --git a/src/wp-content/themes/twentytwelve/inc/custom-header.php b/src/wp-content/themes/twentytwelve/inc/custom-header.php
    index 693883ca7a..84b3556c24 100644
    a b function twentytwelve_header_style() { 
    7171        $text_color = get_header_textcolor();
    7272
    7373        // If no custom options for text are set, let's bail.
    74         if ( get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) {
     74        if ( get_theme_support( 'custom-header', 'default-text-color' ) === $text_color ) {
    7575                return;
    7676        }
    7777