Call shortcode functions directly. props kovshenin, fixes #24505.

git-svn-id: http://core.svn.wordpress.org/trunk@24547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-03 20:19:00 +00:00
parent 585eda125a
commit 6500a24719
2 changed files with 32 additions and 12 deletions

View File

@ -2357,7 +2357,7 @@ function edit_form_image_editor( $post ) {
<?php
elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'audio/' ) ):
echo do_shortcode( '[audio src="' . $att_url . '"]' );
echo wp_audio_shortcode( array( 'src' => $att_url ) );
elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'video/' ) ):
@ -2369,12 +2369,15 @@ function edit_form_image_editor( $post ) {
if ( $h && $w < $meta['width'] )
$h = round( ( $meta['height'] * $w ) / $meta['width'] );
$shortcode = sprintf( '[video src="%s"%s%s]',
$att_url,
empty( $meta['width'] ) ? '' : sprintf( ' width="%d"', $w ),
empty( $meta['height'] ) ? '' : sprintf( ' height="%d"', $h )
);
echo do_shortcode( $shortcode );
$attr = array( 'src' => $att_url );
if ( ! empty( $meta['width' ] ) )
$attr['width'] = $w;
if ( ! empty( $meta['height'] ) )
$attr['height'] = $h;
echo wp_video_shortcode( $attr );
endif; ?>
</div>

View File

@ -2070,7 +2070,16 @@ function get_the_post_format_media( $type, &$post = null, $limit = 0 ) {
$embed = reset( $embeds );
if ( 0 === strpos( $embed, 'http' ) ) {
if ( strstr( $embed, home_url() ) ) {
$post->format_content[ $cache_key ] = do_shortcode( sprintf( '[%s src="%s"]', $type, $embed ) );
$format_content = '';
$attr = array( 'src' => $embed );
if ( 'audio' == $type )
$format_content = wp_audio_shortcode( $attr );
elseif ( 'video' == $type )
$format_content = wp_video_shortcode( $attr );
$post->format_content[ $cache_key ] = $format_content;
} else {
$post->format_content[ $cache_key ] = $wp_embed->autoembed( $embed );
}
@ -2084,8 +2093,16 @@ function get_the_post_format_media( $type, &$post = null, $limit = 0 ) {
if ( ! empty( $medias ) ) {
$media = reset( $medias );
$url = wp_get_attachment_url( $media->ID );
$shortcode = sprintf( '[%s src="%s"]', $type, $url );
$post->format_content[ $cache_key ] = do_shortcode( $shortcode );
$format_content = '';
$attr = array( 'src' => $url );
if ( 'audio' == $type )
$format_content = wp_audio_shortcode( $attr );
elseif ( 'video' == $type )
$format_content = wp_video_shortcode( $attr );
$post->format_content[ $cache_key ] = $format_content;
return $post->format_content[ $cache_key ];
}
@ -2164,7 +2181,7 @@ function get_content_images( $content, $html = true, $limit = 0 ) {
if ( 'caption' === $shortcode[2] ) {
$captions[] = $shortcode[0];
if ( $html )
$tags[] = do_shortcode( $shortcode[0] );
$tags[] = do_shortcode_tag( $shortcode );
}
if ( $limit > 0 && count( $tags ) >= $limit )
@ -2410,7 +2427,7 @@ function get_the_post_format_image( $attached_size = 'full', &$post = null ) {
foreach ( $urls as $url ) {
if ( strstr( $shortcode[0], $url ) ) {
if ( ! $matched )
$matched = do_shortcode( $shortcode[0] );
$matched = do_shortcode_tag( $shortcode );
// $content = str_replace( $shortcode[0], '', $content, $count );
}
}