Skip to content

Commit

Permalink
Merge pull request #679 from WebDevStudios/feature/add-more-escaping
Browse files Browse the repository at this point in the history
Add more escaping
  • Loading branch information
Greg Rickaby authored Jun 16, 2021
2 parents 342d67d + 7ae9a73 commit 7603282
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/* translators: the number of comments */
esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', '_s' ) ),
number_format_i18n( get_comments_number() ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XSS OK.
'<span>' . get_the_title() . '</span>' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XSS OK.
'<span>' . wp_kses_post( get_the_title() ) . '</span>' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XSS OK.
);
?>
</h3>
Expand Down
4 changes: 2 additions & 2 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function _s_entry_footer() {
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', '_s' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
wp_kses_post( get_the_title( '<span class="screen-reader-text">"', '"</span>', false ) )
),
'<span class="edit-link">',
'</span>'
Expand Down Expand Up @@ -255,7 +255,7 @@ function _s_get_the_title( $args = [] ) {
$args = wp_parse_args( $args, $defaults );

// Trim the title.
return wp_trim_words( get_the_title( get_the_ID() ), $args['length'], $args['more'] );
return wp_kses_post( wp_trim_words( get_the_title( get_the_ID() ), $args['length'], $args['more'] ) );
}

/**
Expand Down
23 changes: 21 additions & 2 deletions template-parts/content-password-protected.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,27 @@

<div class="entry-content">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo get_the_password_form();
echo wp_kses(
get_the_password_form(),
[
'p' => [],
'label' => [
'for' => [],
],
'form' => [
'action' => [],
'class' => [],
'method' => [],
],
'input' => [
'id' => [],
'name' => [],
'size' => [],
'type' => [],
'value' => [],
],
]
);
?>
</div><!-- .entry-content -->

Expand Down

0 comments on commit 7603282

Please sign in to comment.