Make WordPress Core

Changeset 34972


Ignore:
Timestamp:
10/08/2015 11:08:40 PM (9 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed-functions.php

    r34971 r34972  
    525525
    526526    /**
    527      * Filter the allowed minimum width for the oEmbed response.
     527     * Filter the allowed minimum and maximum widths for the oEmbed response.
    528528     *
    529529     * @since 4.4.0
    530530     *
    531      * @param int $width The minimum width. Defaults to 200.
    532      */
    533     $minwidth = apply_filters( 'oembed_minwidth', 200 );
    534 
    535     /**
    536      * Filter the allowed maximum width for the oEmbed response.
    537      *
    538      * @since 4.4.0
    539      *
    540      * @param int $width The maximum width. Defaults to 600.
    541      */
    542     $maxwidth = apply_filters( 'oembed_maxwidth', 600 );
    543 
    544     if ( $width < $minwidth ) {
    545         $width = $minwidth;
    546     } else if ( $width > $maxwidth ) {
    547         $width = $maxwidth;
     531     * @param array $min_max_width {
     532     *     Minimum and maximum widths for the oEmbed response.
     533     *
     534     *     @type int $min Minimum width. Default 200.
     535     *     @type int $max Maximum width. Default 600.
     536     * }
     537     */
     538    $min_max_width = apply_filters( 'oembed_min_max_width', array(
     539        'min' => 200,
     540        'max' => 600
     541    ) );
     542
     543    if ( $width < $min_max_width['min'] ) {
     544        $width = $min_max_width['min'];
     545    } elseif ( $width > $min_max_width['max'] ) {
     546        $width = $min_max_width['max'];
    548547    }
    549548
Note: See TracChangeset for help on using the changeset viewer.