Skip to content
Browse files

Use the [audio] and [video] shortcodes for hybrid_audio_attachment() …

…and hybrid_video_attachment(), which are legacy functions that are rarely used. Maybe they'll get some use now. It's nice to see WP catching up and doing something about this. Yay!
  • Loading branch information...
1 parent bf0c4e9 commit 1becfb794a6bfc9ee31be1d6a3950f91b9189762 @justintadlock committed Aug 1, 2013
Showing with 2 additions and 21 deletions.
  1. +2 −21 functions/media.php
View
23 functions/media.php
@@ -121,14 +121,7 @@ function hybrid_text_attachment( $mime = '', $file = '' ) {
* @return string
*/
function hybrid_audio_attachment( $mime = '', $file = '' ) {
- $embed_defaults = wp_embed_defaults();
- $audio = '<object type="' . esc_attr( $mime ) . '" class="player audio" data="' . esc_url( $file ) . '" width="' . esc_attr( $embed_defaults['width'] ) . '" height="' . esc_attr( $embed_defaults['height'] ) . '">';
- $audio .= '<param name="src" value="' . esc_url( $file ) . '" />';
- $audio .= '<param name="autostart" value="false" />';
- $audio .= '<param name="controller" value="true" />';
- $audio .= '</object>';
-
- return $audio;
+ return do_shortcode( '[audio src="' . esc_url( $file ) . '"]' );
}
/**
@@ -141,19 +134,7 @@ function hybrid_audio_attachment( $mime = '', $file = '' ) {
* @return string
*/
function hybrid_video_attachment( $mime = false, $file = false ) {
- $embed_defaults = wp_embed_defaults();
-
- if ( $mime == 'video/asf' )
- $mime = 'video/x-ms-wmv';
-
- $video = '<object type="' . esc_attr( $mime ) . '" class="player video" data="' . esc_url( $file ) . '" width="' . esc_attr( $embed_defaults['width'] ) . '" height="' . esc_attr( $embed_defaults['height'] ) . '">';
- $video .= '<param name="src" value="' . esc_url( $file ) . '" />';
- $video .= '<param name="autoplay" value="false" />';
- $video .= '<param name="allowfullscreen" value="true" />';
- $video .= '<param name="controller" value="true" />';
- $video .= '</object>';
-
- return $video;
+ return do_shortcode( '[video src="' . esc_url( $file ) . '"]' );
}
?>

0 comments on commit 1becfb7

Please sign in to comment.
Something went wrong with that request. Please try again.