Fix some mangled HTML in image format posts compat.

props SergeyBiryukov. fixes #24147.

git-svn-id: http://core.svn.wordpress.org/trunk@24062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-04-22 21:01:03 +00:00
parent 644b8c619d
commit 8ec637b13d

View File

@ -380,12 +380,17 @@ function post_formats_compat( $content, $id = 0 ) {
$image = is_numeric( $meta['image'] ) ? wp_get_attachment_url( $meta['image'] ) : $meta['image'];
if ( ! empty( $image ) && ! stristr( $content, $image ) ) {
$image_html = sprintf(
'<img %ssrc="%s" alt="" />',
empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ),
$image
);
if ( empty( $meta['url'] ) ) {
if ( false === strpos( $image, '<a ' ) ) {
$image_html = sprintf(
'<img %ssrc="%s" alt="" />',
empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ),
$image
);
} else {
$image_html = $image;
}
if ( empty( $meta['url'] ) || false !== strpos( $image, '<a ' ) ) {
$format_output .= $image_html;
} else {
$format_output .= sprintf(