From cd0bbd830cddea539bef31b1ed5cb7b1c1a95bbd Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 25 Apr 2013 02:18:49 +0000 Subject: [PATCH] Fix mangled image output in compat function. props wonderboymusic. see #24175. git-svn-id: http://core.svn.wordpress.org/trunk@24078 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 2 +- wp-includes/post-formats.php | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 09e06308c8..42a9825dc6 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -2428,7 +2428,7 @@ function get_the_post_format_image( $attached_size = 'full', &$post = null ) { // wrap image in if ( ! empty( $meta['url'] ) ) $image = sprint( $link_fmt, $image ); - } elseif ( has_shortcode( $meta['image'], 'gallery' ) ) { + } elseif ( has_shortcode( $meta['image'], 'caption' ) ) { // wrap in if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], ' in + if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], ']+>)#', + sprintf( '$1', esc_url( $meta['url'] ) ), + $meta['image'] + ); + } + $format_output .= do_shortcode( $meta['image'] ); + } else { + + if ( is_numeric( $meta['image'] ) ) { + $image = wp_get_attachment_image( absint( $meta['image'] ), 'full' ); + } elseif ( ! preg_match( '#<[^>]+>#', $meta['image'] ) ) { + // not HTML, assume URL + $image = sprintf( '', empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ), - $image + esc_url( $meta['image'] ) ); } else { - $image_html = $image; + // assume HTML + $image = $meta['image']; } - if ( empty( $meta['url'] ) || false !== strpos( $image, '%s', esc_url( $meta['url'] ), - $image_html + $image ); + } else { + $format_output .= $image; } } }