From 6d8ccb9e36d88271dbf4217609577da98a4ff92c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Sep 2013 21:19:20 +0000 Subject: [PATCH] Replace non-functional 'wp_audio_shortcode_handler' and 'wp_video_shortcode_handler' filters with 'wp_audio_shortcode_override' and 'wp_video_shortcode_override'. props ericlewis, SergeyBiryukov. fixes #25313. git-svn-id: https://develop.svn.wordpress.org/trunk@25484 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 10b09d62ad..39fe08c8b4 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -882,6 +882,19 @@ function wp_audio_shortcode( $attr ) { static $instances = 0; $instances++; + /** + * Override the default audio shortcode. + * + * @since 3.7.0 + * + * @param null Empty variable to be replaced with shortcode markup. + * @param array $attr Attributes of the shortcode. + * @param int $instances Unique numeric ID of this audio shortcode instance. + */ + $html = apply_filters( 'wp_audio_shortcode_override', null, $attr, $instances ); + if ( null !== $html ) + return $html; + $audio = null; $default_types = wp_get_audio_extensions(); @@ -975,7 +988,7 @@ function wp_audio_shortcode( $attr ) { return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library ); } -add_shortcode( 'audio', apply_filters( 'wp_audio_shortcode_handler', 'wp_audio_shortcode' ) ); +add_shortcode( 'audio', 'wp_audio_shortcode' ); /** * Return a filtered list of WP-supported video formats @@ -1005,6 +1018,19 @@ function wp_video_shortcode( $attr ) { static $instances = 0; $instances++; + /** + * Override the default video shortcode. + * + * @since 3.7.0 + * + * @param null Empty variable to be replaced with shortcode markup. + * @param array $attr Attributes of the shortcode. + * @param int $instances Unique numeric ID of this video shortcode instance. + */ + $html = apply_filters( 'wp_video_shortcode_override', null, $attr, $instances ); + if ( null !== $html ) + return $html; + $video = null; $default_types = wp_get_video_extensions(); @@ -1119,7 +1145,7 @@ function wp_video_shortcode( $attr ) { $html = sprintf( '
%s
', $width, $html ); return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library ); } -add_shortcode( 'video', apply_filters( 'wp_video_shortcode_handler', 'wp_video_shortcode' ) ); +add_shortcode( 'video', 'wp_video_shortcode' ); /** * Display previous image link that has the same post parent.