Make WordPress Core

Changeset 24083


Ignore:
Timestamp:
04/25/2013 03:52:05 AM (12 years ago)
Author:
markjaquith
Message:

Fix issue with [embed] in post_format_compat.

props kovshenin. fixes #24070.

File:
1 edited

Legend:

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

    r24079 r24083  
    13661366 */
    13671367function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
    1368     $audio = $url;
    1369     if ( shortcode_exists( 'audio' ) )
    1370         $audio = do_shortcode( '[audio src="' . $url . '" /]' );
     1368    $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
    13711369    return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
    13721370}
     
    13851383function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) {
    13861384    $dimensions = '';
    1387     $video = $url;
    1388     if ( shortcode_exists( 'video' ) ) {
    1389         if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
    1390             $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] );
    1391             $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
    1392         } elseif ( strstr( $url, home_url() ) ) {
    1393             $id = attachment_url_to_postid( $url );
    1394             if ( ! empty( $id ) ) {
    1395                 $meta = wp_get_attachment_metadata( $id );
    1396                 if ( ! empty( $meta['width'] ) )
    1397                     $dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] );
    1398                 if ( ! empty( $meta['height'] ) )
    1399                     $dimensions .= sprintf( 'height="%d" ', (int) $meta['height'] );
    1400             }
    1401         }
    1402         $video = do_shortcode( '[video ' . $dimensions . 'src="' . $url . '" /]' );
    1403     }
     1385    if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
     1386        $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] );
     1387        $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
     1388    } elseif ( strstr( $url, home_url() ) ) {
     1389        $id = attachment_url_to_postid( $url );
     1390        if ( ! empty( $id ) ) {
     1391            $meta = wp_get_attachment_metadata( $id );
     1392            if ( ! empty( $meta['width'] ) )
     1393                $dimensions .= sprintf( 'width="%d" ', (int) $meta['width'] );
     1394            if ( ! empty( $meta['height'] ) )
     1395                $dimensions .= sprintf( 'height="%d" ', (int) $meta['height'] );
     1396        }
     1397    }
     1398
     1399    $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
    14041400    return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
    14051401}
Note: See TracChangeset for help on using the changeset viewer.