Fix issue with [embed] in post_format_compat.

props kovshenin. fixes #24070.

git-svn-id: http://core.svn.wordpress.org/trunk@24083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-04-25 03:52:05 +00:00
parent 759b3f5e82
commit 254ea5ad54
1 changed files with 14 additions and 18 deletions

View File

@ -1365,9 +1365,7 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
* @return string The embed HTML. * @return string The embed HTML.
*/ */
function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
$audio = $url; $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
if ( shortcode_exists( 'audio' ) )
$audio = do_shortcode( '[audio src="' . $url . '" /]' );
return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); 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 ) { function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) {
$dimensions = ''; $dimensions = '';
$video = $url; if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
if ( shortcode_exists( 'video' ) ) { $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] );
if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) { $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
$dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] ); } elseif ( strstr( $url, home_url() ) ) {
$dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); $id = attachment_url_to_postid( $url );
} elseif ( strstr( $url, home_url() ) ) { if ( ! empty( $id ) ) {
$id = attachment_url_to_postid( $url ); $meta = wp_get_attachment_metadata( $id );
if ( ! empty( $id ) ) { if ( ! empty( $meta['width'] ) )
$meta = wp_get_attachment_metadata( $id ); $dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] );
if ( ! empty( $meta['width'] ) ) if ( ! empty( $meta['height'] ) )
$dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] ); $dimensions .= sprintf( 'height="%d" ', (int) $meta['height'] );
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 ); return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
} }