Media: Convert concatenation in img_caption_shortcode() to sprintf() for clarity.

See #34595.
Built from https://develop.svn.wordpress.org/trunk@42690


git-svn-id: http://core.svn.wordpress.org/trunk@42518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-02-11 14:17:30 +00:00
parent 7a8e4bcb1b
commit 8df00f0354
2 changed files with 23 additions and 5 deletions

View File

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

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-42689'; $wp_version = '5.0-alpha-42690';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.