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
This commit is contained in:
Sergey Biryukov 2018-02-11 14:16:43 +00:00
parent 5e9067e8b9
commit 2b08bfb954
1 changed files with 22 additions and 4 deletions

View File

@ -1589,11 +1589,29 @@ function img_caption_shortcode( $attr, $content = null ) {
}
if ( $html5 ) {
$html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
$html = sprintf(
'<figure %s%sclass="%s">%s%s</figure>',
$atts['id'],
$style,
esc_attr( $class ),
do_shortcode( $content ),
sprintf(
'<figcaption class="wp-caption-text">%s</figcaption>',
$atts['caption']
)
);
} else {
$html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
$html = sprintf(
'<div %s%sclass="%s">%s%s</div>',
$atts['id'],
$style,
esc_attr( $class ),
do_shortcode( $content ),
sprintf(
'<p class="wp-caption-text">%s</p>',
$atts['caption']
)
);
}
return $html;