From 2f700ddbf2a3115c1bb94e0d0719f30e5b0f909a Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Thu, 8 Oct 2015 23:09:23 +0000 Subject: [PATCH] Embeds: Combine the `oembed_minwidth` and `oembed_maxwidth` filters into one, similar to how the existing `oembed_defaults` works for width and height. See #32522. See #34227. Built from https://develop.svn.wordpress.org/trunk@34972 git-svn-id: http://core.svn.wordpress.org/trunk@34937 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/embed-functions.php | 29 ++++++++++++++--------------- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/wp-includes/embed-functions.php b/wp-includes/embed-functions.php index 263123740e..1db32f0265 100644 --- a/wp-includes/embed-functions.php +++ b/wp-includes/embed-functions.php @@ -524,27 +524,26 @@ function get_oembed_response_data( $post = null, $width ) { } /** - * Filter the allowed minimum width for the oEmbed response. + * Filter the allowed minimum and maximum widths for the oEmbed response. * * @since 4.4.0 * - * @param int $width The minimum width. Defaults to 200. - */ - $minwidth = apply_filters( 'oembed_minwidth', 200 ); - - /** - * Filter the allowed maximum width for the oEmbed response. + * @param array $min_max_width { + * Minimum and maximum widths for the oEmbed response. * - * @since 4.4.0 - * - * @param int $width The maximum width. Defaults to 600. + * @type int $min Minimum width. Default 200. + * @type int $max Maximum width. Default 600. + * } */ - $maxwidth = apply_filters( 'oembed_maxwidth', 600 ); + $min_max_width = apply_filters( 'oembed_min_max_width', array( + 'min' => 200, + 'max' => 600 + ) ); - if ( $width < $minwidth ) { - $width = $minwidth; - } else if ( $width > $maxwidth ) { - $width = $maxwidth; + if ( $width < $min_max_width['min'] ) { + $width = $min_max_width['min']; + } elseif ( $width > $min_max_width['max'] ) { + $width = $min_max_width['max']; } $height = ceil( $width / 16 * 9 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index d1b6ca63ce..b47ff5ecdd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34971'; +$wp_version = '4.4-alpha-34972'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.