Skip to content

Commit 1ac78cc

Browse files
authored
Improve image block lightbox escaping (#51061)
* Improve the image block lightbox escaping.
1 parent 62f2353 commit 1ac78cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/block-library/src/image/index.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ function render_block_core_image( $attributes, $content ) {
6868
'</div>';
6969
$body_content = preg_replace( '/<img[^>]+>/', $button, $content );
7070

71-
$background_color = wp_get_global_styles( array( 'color', 'background' ) );
71+
$background_color = esc_attr( wp_get_global_styles( array( 'color', 'background' ) ) );
7272
$close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="30" height="30" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>';
7373

74-
$dialog_label = $alt_attribute ? $alt_attribute : __( 'Image' );
74+
$dialog_label = $alt_attribute ? esc_attr( $alt_attribute ) : esc_attr__( 'Image' );
7575

76-
$close_button_label = __( 'Close' );
76+
$close_button_label = esc_attr__( 'Close' );
7777

7878
return
7979
<<<HTML

0 commit comments

Comments
 (0)