Skip to content

Commit 5405ccb

Browse files
committed
Coding Standards: Remove phpcs:ignore annotations for sniffs not checked in this repository
The `phpcs.xml.dist` configuration uses the `WordPress-Core` standard. These annotations reference sniffs that are part of `WordPress-Extra`, which is not included: - `WordPress.Security.EscapeOutput` - `WordPress.Security.NonceVerification` - `WordPress.WP.AlternativeFunctions` - `WordPress.PHP.DevelopmentFunctions` - `WordPress.PHP.IniSet` Some of these annotations were carried over from upstream theme repositories or external plugins. If in the future there is a decision to add `WordPress-Extra`, I think it makes sense to evaluate each error/warning to decide what should be ignored and what should not.
1 parent e0072c2 commit 5405ccb

22 files changed

Lines changed: 32 additions & 35 deletions

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function html5_comment( $comment, $depth, $args ) {
3737
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
3838

3939
?>
40-
<<?php echo $tag; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
40+
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
4141
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
4242
<footer class="comment-meta">
4343
<div class="comment-author vcard">
@@ -49,7 +49,7 @@ protected function html5_comment( $comment, $depth, $args ) {
4949
if ( empty( $comment_author_url ) ) {
5050
echo wp_kses_post( $avatar );
5151
} else {
52-
printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped --Escaped in https://developer.wordpress.org/reference/functions/get_comment_author_url/
52+
printf( '<a href="%s" rel="external nofollow" class="url">', $comment_author_url );
5353
echo wp_kses_post( $avatar );
5454
}
5555
}
@@ -131,7 +131,7 @@ protected function html5_comment( $comment, $depth, $args ) {
131131

132132
<?php
133133
if ( $comment_reply_link ) {
134-
echo $comment_reply_link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Link is escaped in https://developer.wordpress.org/reference/functions/get_comment_reply_link/
134+
echo $comment_reply_link;
135135
}
136136
if ( $by_post_author ) {
137137
echo '<span class="by-post-author">' . __( 'By Post Author', 'twentytwenty' ) . '</span>';

src/wp-content/themes/twentytwenty/comments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
}
8686
?>
8787

88-
<nav class="comments-pagination pagination<?php echo $pagination_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>" aria-label="<?php esc_attr_e( 'Comments', 'twentytwenty' ); ?>">
88+
<nav class="comments-pagination pagination<?php echo $pagination_classes; ?>" aria-label="<?php esc_attr_e( 'Comments', 'twentytwenty' ); ?>">
8989
<?php echo wp_kses_post( $comment_pagination ); ?>
9090
</nav>
9191

src/wp-content/themes/twentytwenty/inc/custom-css.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function twentytwenty_generate_css( $selector, $style, $value, $prefix = '', $su
3838

3939
if ( $display ) {
4040

41-
echo $return; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;)
41+
echo $return;
4242

4343
}
4444

src/wp-content/themes/twentytwenty/inc/svg-icons.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @param string $color Color code.
1919
*/
2020
function twentytwenty_the_theme_svg( $svg_name, $group = 'ui', $color = '' ) {
21-
echo twentytwenty_get_theme_svg( $svg_name, $group, $color ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_theme_svg().
21+
echo twentytwenty_get_theme_svg( $svg_name, $group, $color );
2222
}
2323
}
2424

src/wp-content/themes/twentytwenty/inc/template-tags.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function twentytwenty_site_logo( $args = array(), $display = true ) {
9898
return $html;
9999
}
100100

101-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
101+
echo $html;
102102
}
103103

104104
/**
@@ -135,7 +135,7 @@ function twentytwenty_site_description( $display = true ) {
135135
return $html;
136136
}
137137

138-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
138+
echo $html;
139139
}
140140

141141
/**
@@ -201,7 +201,7 @@ function twentytwenty_filter_comment_reply_link( $link ) {
201201
*/
202202
function twentytwenty_the_post_meta( $post_id = null, $location = 'single-top' ) {
203203

204-
echo twentytwenty_get_post_meta( $post_id, $location ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_post_meta().
204+
echo twentytwenty_get_post_meta( $post_id, $location );
205205
}
206206

207207
/**

src/wp-content/themes/twentytwenty/searchform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"';
2424
}
2525
?>
26-
<form role="search" <?php echo $twentytwenty_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
26+
<form role="search" <?php echo $twentytwenty_aria_label; ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
2727
<label for="<?php echo esc_attr( $twentytwenty_unique_id ); ?>">
2828
<span class="screen-reader-text">
2929
<?php

src/wp-content/themes/twentytwenty/template-parts/content-cover.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
$color_overlay_classes .= ' opacity-' . $color_overlay_opacity;
4545
?>
4646

47-
<div class="cover-header <?php echo $cover_header_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>"<?php echo $cover_header_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>>
47+
<div class="cover-header <?php echo $cover_header_classes; ?>"<?php echo $cover_header_style; ?>>
4848
<div class="cover-header-inner-wrapper screen-height">
4949
<div class="cover-header-inner">
50-
<div class="cover-color-overlay color-accent<?php echo esc_attr( $color_overlay_classes ); ?>"<?php echo $color_overlay_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>></div>
50+
<div class="cover-color-overlay color-accent<?php echo esc_attr( $color_overlay_classes ); ?>"<?php echo $color_overlay_style; ?>></div>
5151

5252
<header class="entry-header has-text-align-center">
5353
<div class="entry-header-inner section-inner medium">

src/wp-content/themes/twentytwenty/template-parts/entry-header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
if ( has_excerpt() && is_singular() ) {
6565
?>
6666

67-
<div class="intro-text section-inner max-percentage<?php echo $intro_text_width; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
67+
<div class="intro-text section-inner max-percentage<?php echo $intro_text_width; ?>">
6868
<?php the_excerpt(); ?>
6969
</div>
7070

src/wp-content/themes/twentytwenty/template-parts/featured-image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<figure class="featured-media">
2121

22-
<div class="featured-media-inner section-inner<?php echo $featured_media_inner_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
22+
<div class="featured-media-inner section-inner<?php echo $featured_media_inner_classes; ?>">
2323

2424
<?php
2525
the_post_thumbnail();

src/wp-content/themes/twentytwenty/template-parts/footer-menus-widgets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
if ( $has_footer_menu || $has_social_menu ) {
3333
?>
34-
<div class="footer-top<?php echo $footer_top_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
34+
<div class="footer-top<?php echo $footer_top_classes; ?>">
3535
<?php if ( $has_footer_menu ) { ?>
3636

3737
<nav aria-label="<?php esc_attr_e( 'Footer', 'twentytwenty' ); ?>" class="footer-menu-wrapper">

0 commit comments

Comments
 (0)