From 2b08bfb954ebf4a6d983ea038debf06723f94175 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 11 Feb 2018 14:16:43 +0000 Subject: [PATCH] Media: Convert concatenation in `img_caption_shortcode()` to `sprintf()` for clarity. See #34595. git-svn-id: https://develop.svn.wordpress.org/trunk@42690 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 7bfda66f1c..24c370769d 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1589,11 +1589,29 @@ function img_caption_shortcode( $attr, $content = null ) { } if ( $html5 ) { - $html = '
' - . do_shortcode( $content ) . '
' . $atts['caption'] . '
'; + $html = sprintf( + '
%s%s
', + $atts['id'], + $style, + esc_attr( $class ), + do_shortcode( $content ), + sprintf( + '
%s
', + $atts['caption'] + ) + ); } else { - $html = '
' - . do_shortcode( $content ) . '

' . $atts['caption'] . '

'; + $html = sprintf( + '
%s%s
', + $atts['id'], + $style, + esc_attr( $class ), + do_shortcode( $content ), + sprintf( + '

%s

', + $atts['caption'] + ) + ); } return $html;