mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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
This commit is contained in:
parent
60f86d2865
commit
2f700ddbf2
@ -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 );
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user