Skip to content

Commit

Permalink
Escaping improvements for Slideshow block bullets.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonrabb committed Sep 30, 2019
1 parent e4c02de commit 80e89e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions extensions/blocks/slideshow/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ function jetpack_slideshow_block_bullets( $ids = array(), $block_ordinal = 0 ) {
$buttons = array_map(
function( $index ) {
return sprintf(
'<button option="%s" class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide %s" %s></button>',
esc_attr( $index ),
( $index + 1 ),
'<button option="%d" class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="%s %d" %s></button>',
absint( $index ),
esc_attr__( 'Go to slide', 'jetpack' ),
absint( $index + 1 ),
0 === $index ? 'selected' : ''
);
},
Expand Down

1 comment on commit 80e89e1

@jeherve
Copy link
Member

@jeherve jeherve commented on 80e89e1 Oct 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ideal, as in some languages the number may come before or within the "Go to slide" string. Do you think we could build that string earlier in another sprintf and then add it to the button at once, so translators can translate "Go to slide %d"?

Please sign in to comment.