Make WordPress Core

Changeset 28923


Ignore:
Timestamp:
06/30/2014 11:15:33 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Pass $url parameter to wp_embed_defaults() and 'embed_defaults' filter.

props wpsmith, sabreuse, jacobdubail.
fixes #20151.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-oembed.php

    r28846 r28923  
    278278     */
    279279    public function fetch( $provider, $url, $args = '' ) {
    280         $args = wp_parse_args( $args, wp_embed_defaults() );
     280        $args = wp_parse_args( $args, wp_embed_defaults( $url ) );
    281281
    282282        $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider );
  • trunk/src/wp-includes/class-wp-embed.php

    r28919 r28923  
    157157
    158158        $rawattr = $attr;
    159         $attr = wp_parse_args( $attr, wp_embed_defaults() );
     159        $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );
    160160
    161161        // kses converts & into & and we need to undo this
  • trunk/src/wp-includes/media.php

    r28901 r28923  
    20832083 * @since 2.9.0
    20842084 *
     2085 * @param string $url Optional. The URL that should be embedded. Default empty.
     2086 *
    20852087 * @return array Default embed parameters.
    20862088 */
    2087 function wp_embed_defaults() {
     2089function wp_embed_defaults( $url = '' ) {
    20882090    if ( ! empty( $GLOBALS['content_width'] ) )
    20892091        $width = (int) $GLOBALS['content_width'];
     
    20992101     * @since 2.9.0
    21002102     *
    2101      * @param int $width  Width of the embed in pixels.
    2102      * @param int $height Height of the embed in pixels.
    2103      */
    2104     return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
     2103     * @param int    $width  Width of the embed in pixels.
     2104     * @param int    $height Height of the embed in pixels.
     2105     * @param string $url    The URL that should be embedded.
     2106     */
     2107    return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
    21052108}
    21062109
Note: See TracChangeset for help on using the changeset viewer.