Make WordPress Core

Ticket #45424: 45424.17.patch

File 45424.17.patch, 3.0 KB (added by allancole, 7 years ago)

Add missing text domain and escaping to comment author text. More info here: https://github.com/WordPress/twentynineteen/pull/274

  • 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 */
     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                                                }
     57
     58                                                printf(
     59                                                        /* translators: %s: comment author link */
     60                                                        wp_kses(
    6061                                                                __( '%s <span class="screen-reader-text says">says:</span>', 'twentynineteen' ),
    61                                                                 sprintf( '<span class="fn">%s</span>', $comment_author )
    62                                                         );
     62                                                                array(
     63                                                                        'span' => array(
     64                                                                                'class' => array(),
     65                                                                        ),
     66                                                                )
     67                                                        ),
     68                                                        '<b class="fn">' . get_comment_author_link( $comment ) . '</b>'
     69                                                );
    6370
    64                                                         if ( ! empty( $comment_author_url ) ) {
    65                                                                 echo '</a>';
    66                                                         }
     71                                                if ( ! empty( $comment_author_url ) ) {
     72                                                        echo '</a>';
     73                                                }
    6774                                                ?>
    6875                                        </div><!-- .comment-author -->
    6976
     
    110117                        ?>
    111118                <?php
    112119        }
    113 
    114120}