Make WordPress Core

Ticket #45424: 45424.15.1.patch

File 45424.15.1.patch, 6.6 KB (added by allancole, 7 years ago)

Fixes some minor code quality issues and adds a few files missing from the previous patch. More info here: https://github.com/WordPress/twentynineteen/pull/237

  • src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php

     
    3333                                <footer class="comment-meta">
    3434                                        <div class="comment-author vcard">
    3535                                                <?php
    36                                                         $comment_author_link = get_comment_author_link( $comment );
    37                                                         $comment_author_url  = get_comment_author_url( $comment );
    38                                                         $comment_author      = get_comment_author( $comment );
    39                                                         $avatar              = get_avatar( $comment, $args['avatar_size'] );
    40                                                         if ( 0 != $args['avatar_size'] ) {
    41                                                                 if ( empty( $comment_author_url ) ) {
    42                                                                         echo $avatar;
    43                                                                 } else {
    44                                                                         printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url );
    45                                                                         echo $avatar;
    46                                                                 }
    47                                                         }
     36                                                $comment_author_link = get_comment_author_link( $comment );
     37                                                $comment_author_url  = get_comment_author_url( $comment );
     38                                                $comment_author      = get_comment_author( $comment );
     39                                                $avatar              = get_avatar( $comment, $args['avatar_size'] );
    4840
    49                                                         /*
    50                                                          * Using the `check` icon instead of `check_circle`, since we can't add a
    51                                                          * fill color to the inner check shape when in circle form.
    52                                                          */
    53                                                         if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
    54                                                                 /* translators: %s: SVG Icon */
    55                                                                 printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
     41                                                if ( 0 != $args['avatar_size'] ) {
     42                                                        if ( empty( $comment_author_url ) ) {
     43                                                                echo $avatar;
     44                                                        } else {
     45                                                                printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url );
     46                                                                echo $avatar;
    5647                                                        }
     48                                                }
    5749
    58                                                         printf(
    59                                                                 /* translators: %s: comment author link */
    60                                                                 __( '%s <span class="screen-reader-text says">says:</span>', 'twentynineteen' ),
    61                                                                 sprintf( '<span class="fn">%s</span>', $comment_author )
    62                                                         );
     50                                                /*
     51                                                 * Using the `check` icon instead of `check_circle`, since we can't add a
     52                                                 * fill color to the inner check shape when in circle form.
     53                                                 */
     54                                                if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
     55                                                        printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
     56                                                }
    6357
    64                                                         if ( ! empty( $comment_author_url ) ) {
    65                                                                 echo '</a>';
    66                                                         }
     58                                                printf(
     59                                                        /* translators: %s: comment author link */
     60                                                        __( '%s <span class="screen-reader-text says">says:</span>', 'twentynineteen' ),
     61                                                        sprintf( '<span class="fn">%s</span>', $comment_author )
     62                                                );
     63
     64                                                if ( ! empty( $comment_author_url ) ) {
     65                                                        echo '</a>';
     66                                                }
    6767                                                ?>
    6868                                        </div><!-- .comment-author -->
    6969
     
    110110                        ?>
    111111                <?php
    112112        }
    113 
    114113}
  • src/wp-content/themes/twentynineteen/comments.php

     
    2828        <div class="<?php echo $discussion->responses > 0 ? 'comments-title-wrap' : 'comments-title-wrap no-responses'; ?>">
    2929                <h2 class="comments-title">
    3030                <?php
    31                         if ( comments_open() ) {
    32                                 if ( have_comments() ) {
    33                                         _e( 'Join the Conversation', 'twentynineteen' );
    34                                 } else {
    35                                         _e( 'Leave a comment', 'twentynineteen' );
    36                                 }
     31                if ( comments_open() ) {
     32                        if ( have_comments() ) {
     33                                _e( 'Join the Conversation', 'twentynineteen' );
    3734                        } else {
    38                                 if ( '1' == $discussion->responses ) {
    39                                         /* translators: %s: post title */
    40                                         printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
    41                                 } else {
    42                                         printf(
    43                                                 /* translators: 1: number of comments, 2: post title */
    44                                                 _nx(
    45                                                         '%1$s reply on &ldquo;%2$s&rdquo;',
    46                                                         '%1$s replies on &ldquo;%2$s&rdquo;',
    47                                                         $discussion->responses,
    48                                                         'comments title',
    49                                                         'twentynineteen'
    50                                                 ),
    51                                                 number_format_i18n( $discussion->responses ),
    52                                                 get_the_title()
    53                                         );
    54                                 }
     35                                _e( 'Leave a comment', 'twentynineteen' );
    5536                        }
     37                } else {
     38                        if ( '1' == $discussion->responses ) {
     39                                /* translators: %s: post title */
     40                                printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
     41                        } else {
     42                                printf(
     43                                        /* translators: 1: number of comments, 2: post title */
     44                                        _nx(
     45                                                '%1$s reply on &ldquo;%2$s&rdquo;',
     46                                                '%1$s replies on &ldquo;%2$s&rdquo;',
     47                                                $discussion->responses,
     48                                                'comments title',
     49                                                'twentynineteen'
     50                                        ),
     51                                        number_format_i18n( $discussion->responses ),
     52                                        get_the_title()
     53                                );
     54                        }
     55                }
    5656                ?>
    5757                </h2><!-- .comments-title -->
    5858                <?php
    5959                        // Only show discussion meta information when comments are open and available.
    60                         if ( have_comments() && comments_open() ) {
     60                if ( have_comments() && comments_open() ) {
    6161                        get_template_part( 'template-parts/post/discussion', 'meta' );
    62                         }
     62                }
    6363                ?>
    6464        </div><!-- .comments-title-flex -->
    6565        <?php
  • src/wp-content/themes/twentynineteen/template-parts/post/author-bio.php

     
    1010if ( (bool) get_the_author_meta( 'description' ) ) : ?>
    1111<div class="author-bio">
    1212        <h2 class="author-title">
    13                 <span class="author-heading"><?php echo esc_html( sprintf( __( 'Published by %s', 'twentynineteen' ), get_the_author() ) ); ?></span>
     13                <span class="author-heading">
     14                        <?php
     15                        printf(
     16                                /* translators: %s: post author */
     17                                __( 'Published by %s', 'twentynineteen' ),
     18                                esc_html( get_the_author() )
     19                        );
     20                        ?>
     21                </span>
    1422        </h2>
    1523        <p class="author-description">
    1624                <?php the_author_meta( 'description' ); ?>
  • src/wp-content/themes/twentynineteen/template-parts/post/discussion-meta.php

     
    1717} else {
    1818        $meta_label = __( 'No comments', 'twentynineteen' );
    1919}
    20 
    2120?>
    2221
    2322<div class="discussion-meta">