From 31cf12d5e1bc89f2b7c22531ddf3f2042781e63f Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 25 Apr 2013 03:52:05 +0000 Subject: [PATCH] Fix issue with [embed] in post_format_compat. props kovshenin. fixes #24070. git-svn-id: https://develop.svn.wordpress.org/trunk@24083 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/media.php | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index f135703ac4..8bc2e4423a 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1365,9 +1365,7 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { * @return string The embed HTML. */ function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { - $audio = $url; - if ( shortcode_exists( 'audio' ) ) - $audio = do_shortcode( '[audio src="' . $url . '" /]' ); + $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) ); return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); } @@ -1384,23 +1382,21 @@ function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { */ function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) { $dimensions = ''; - $video = $url; - if ( shortcode_exists( 'video' ) ) { - if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) { - $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] ); - $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); - } elseif ( strstr( $url, home_url() ) ) { - $id = attachment_url_to_postid( $url ); - if ( ! empty( $id ) ) { - $meta = wp_get_attachment_metadata( $id ); - if ( ! empty( $meta['width'] ) ) - $dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] ); - if ( ! empty( $meta['height'] ) ) - $dimensions .= sprintf( 'height="%d" ', (int) $meta['height'] ); - } + if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) { + $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] ); + $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); + } elseif ( strstr( $url, home_url() ) ) { + $id = attachment_url_to_postid( $url ); + if ( ! empty( $id ) ) { + $meta = wp_get_attachment_metadata( $id ); + if ( ! empty( $meta['width'] ) ) + $dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] ); + if ( ! empty( $meta['height'] ) ) + $dimensions .= sprintf( 'height="%d" ', (int) $meta['height'] ); } - $video = do_shortcode( '[video ' . $dimensions . 'src="' . $url . '" /]' ); } + + $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) ); return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); }