Fix some mangled HTML in image format posts compat.

props SergeyBiryukov. fixes #24147.

git-svn-id: https://develop.svn.wordpress.org/trunk@24062 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2013-04-22 21:01:03 +00:00
parent 9c59e3a187
commit e3eda04c70
1 changed files with 11 additions and 6 deletions

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(