Changeset 24083
- Timestamp:
- 04/25/2013 03:52:05 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r24079 r24083 1366 1366 */ 1367 1367 function 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 ) ); 1371 1369 return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); 1372 1370 } … … 1385 1383 function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) { 1386 1384 $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 ) ); 1404 1400 return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); 1405 1401 }
Note: See TracChangeset
for help on using the changeset viewer.