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

props wpsmith, sabreuse, jacobdubail.
fixes #20151.
Built from https://develop.svn.wordpress.org/trunk@28923


git-svn-id: http://core.svn.wordpress.org/trunk@28722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-06-30 11:16:15 +00:00
parent c8d8610a15
commit f799048057
3 changed files with 9 additions and 6 deletions

View File

@ -277,7 +277,7 @@ class WP_oEmbed {
* @return bool|object False on failure, otherwise the result in the form of an object.
*/
public function fetch( $provider, $url, $args = '' ) {
$args = wp_parse_args( $args, wp_embed_defaults() );
$args = wp_parse_args( $args, wp_embed_defaults( $url ) );
$provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider );
$provider = add_query_arg( 'maxheight', (int) $args['height'], $provider );

View File

@ -156,7 +156,7 @@ class WP_Embed {
return '';
$rawattr = $attr;
$attr = wp_parse_args( $attr, wp_embed_defaults() );
$attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );
// kses converts & into & and we need to undo this
// See http://core.trac.wordpress.org/ticket/11311

View File

@ -2082,9 +2082,11 @@ function wp_embed_unregister_handler( $id, $priority = 10 ) {
*
* @since 2.9.0
*
* @param string $url Optional. The URL that should be embedded. Default empty.
*
* @return array Default embed parameters.
*/
function wp_embed_defaults() {
function wp_embed_defaults( $url = '' ) {
if ( ! empty( $GLOBALS['content_width'] ) )
$width = (int) $GLOBALS['content_width'];
@ -2100,8 +2102,9 @@ function wp_embed_defaults() {
*
* @param int $width Width of the embed in pixels.
* @param int $height Height of the embed in pixels.
* @param string $url The URL that should be embedded.
*/
return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
}
/**