Make WordPress Core


Ignore:
Timestamp:
07/03/2013 08:19:00 PM (12 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r24400 r24547  
    20712071        if ( 0 === strpos( $embed, 'http' ) ) {
    20722072            if ( strstr( $embed, home_url() ) ) {
    2073                 $post->format_content[ $cache_key ] = do_shortcode( sprintf( '[%s src="%s"]', $type, $embed ) );
     2073
     2074                $format_content = '';
     2075                $attr = array( 'src' => $embed );
     2076
     2077                if ( 'audio' == $type )
     2078                    $format_content = wp_audio_shortcode( $attr );
     2079                elseif ( 'video' == $type )
     2080                    $format_content = wp_video_shortcode( $attr );
     2081
     2082                $post->format_content[ $cache_key ] = $format_content;
    20742083            } else {
    20752084                $post->format_content[ $cache_key ] = $wp_embed->autoembed( $embed );
     
    20852094        $media = reset( $medias );
    20862095        $url = wp_get_attachment_url( $media->ID );
    2087         $shortcode = sprintf( '[%s src="%s"]', $type, $url );
    2088         $post->format_content[ $cache_key ] = do_shortcode( $shortcode );
     2096
     2097        $format_content = '';
     2098        $attr = array( 'src' => $url );
     2099
     2100        if ( 'audio' == $type )
     2101            $format_content = wp_audio_shortcode( $attr );
     2102        elseif ( 'video' == $type )
     2103            $format_content = wp_video_shortcode( $attr );
     2104
     2105        $post->format_content[ $cache_key ] = $format_content;
    20892106        return $post->format_content[ $cache_key ];
    20902107    }
     
    21652182                $captions[] = $shortcode[0];
    21662183                if ( $html )
    2167                     $tags[] = do_shortcode( $shortcode[0] );
     2184                    $tags[] = do_shortcode_tag( $shortcode );
    21682185            }
    21692186
     
    24112428                        if ( strstr( $shortcode[0], $url ) ) {
    24122429                            if ( ! $matched )
    2413                                 $matched = do_shortcode( $shortcode[0] );
     2430                                $matched = do_shortcode_tag( $shortcode );
    24142431                            // $content = str_replace( $shortcode[0], '', $content, $count );
    24152432                        }
Note: See TracChangeset for help on using the changeset viewer.