diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 3077f2b60d..10ac24000d 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -962,7 +962,7 @@ function current_user_can( $capability ) {
/**
* Whether author of supplied post has capability or role.
*
- * @since 2.9
+ * @since 2.9.0
*
* @param int|object $post Post ID or post object.
* @param string $capability Capability or role name.
diff --git a/wp-includes/class-oembed.php b/wp-includes/class-oembed.php
index d2885a9711..101973f052 100644
--- a/wp-includes/class-oembed.php
+++ b/wp-includes/class-oembed.php
@@ -37,12 +37,14 @@ class WP_oEmbed {
// The WP_Embed class disables discovery for non-unfiltered_html users,
// so only providers in this array will be used for them.
$this->providers = apply_filters( 'oembed_providers', array(
+ 'http://*.youtube.com/watch*' => 'http://www.youtube.com/oembed',
+ 'http://youtube.com/watch*' => 'http://www.youtube.com/oembed',
'http://blip.tv/file/*' => 'http://blip.tv/oembed/',
'http://*.flickr.com/*' => 'http://www.flickr.com/services/oembed/',
+ 'http://www.hulu.com/watch/*' => 'http://www.hulu.com/api/oembed.{format}',
'http://*.viddler.com/*' => 'http://lab.viddler.com/services/oembed/',
'http://qik.com/*' => 'http://qik.com/api/oembed.{format}',
'http://*.revision3.com/*' => 'http://revision3.com/api/oembed/',
- 'http://www.hulu.com/watch/*' => 'http://www.hulu.com/api/oembed.{format}',
// Vimeo uses the discovery , so leave this commented to use it as a discovery test
//'http://www.vimeo.com/*' => 'http://www.vimeo.com/api/oembed.{format}',
diff --git a/wp-includes/default-embeds.php b/wp-includes/default-embeds.php
index e3c938c6d0..55d0fb4cb0 100644
--- a/wp-includes/default-embeds.php
+++ b/wp-includes/default-embeds.php
@@ -7,32 +7,6 @@
* @subpackage Embeds
*/
-/**
- * The YouTube.com embed handler callback. YouTube does not support oEmbed and we want to provide extra customization.
- *
- * @see WP_Embed::register_handler()
- * @see WP_Embed::shortcode()
- *
- * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
- * @param array $attr Embed attributes.
- * @param string $url The original URL that was matched by the regex.
- * @param array $rawattr The original unmodified attributes.
- * @return string The embed HTML.
- */
-function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) {
- // If the user supplied a fixed width AND height, use it
- if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
- $width = (int) $rawattr['width'];
- $height = (int) $rawattr['height'];
- } else {
- list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );
- }
-
- return apply_filters( 'embed_youtube', '', $matches, $attr, $url, $rawattr );
-}
-wp_embed_register_handler( 'youtube', '#http://(www.youtube|youtube|[A-Za-z]{2}.youtube)\.com/(watch\?v=|w/\?v=|\?v=)([\w-]+)(.*?)#i', 'wp_embed_handler_youtube' );
-
-
/**
* The Google Video embed handler callback. Google Video does not support oEmbed.
*
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 71d5cdad84..69c5acede2 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -2358,7 +2358,6 @@ function sanitize_option($option, $value) {
case 'medium_size_h':
case 'large_size_w':
case 'large_size_h':
- //case 'embed_size_w':
case 'embed_size_h':
case 'default_post_edit_rows':
case 'mailserver_port':
@@ -2375,6 +2374,11 @@ function sanitize_option($option, $value) {
$value = absint( $value );
break;
+ case 'embed_size_w':
+ if ( '' !== $value )
+ $value = absint( $value );
+ break;
+
case 'posts_per_page':
case 'posts_per_rss':
$value = (int) $value;
diff --git a/wp-includes/media.php b/wp-includes/media.php
index 23baea1f68..cf671c469a 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -1134,6 +1134,7 @@ $wp_embed = new WP_Embed();
/**
* Register an embed handler. This function should probably only be used for sites that do not support oEmbed.
*
+ * @since 2.9.0
* @see WP_Embed::register_handler()
*/
function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {
@@ -1144,6 +1145,7 @@ function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {
/**
* Unregister a previously registered embed handler.
*
+ * @since 2.9.0
* @see WP_Embed::unregister_handler()
*/
function wp_embed_unregister_handler( $id, $priority = 10 ) {
@@ -1154,6 +1156,8 @@ function wp_embed_unregister_handler( $id, $priority = 10 ) {
/**
* Create default array of embed parameters.
*
+ * @since 2.9.0
+ *
* @return array Default embed parameters.
*/
function wp_embed_defaults() {
@@ -1177,6 +1181,7 @@ function wp_embed_defaults() {
/**
* Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
*
+ * @since 2.9.0
* @uses wp_constrain_dimensions() This function passes the widths and the heights.
*
* @param int $example_width The width of an example embed.
@@ -1197,6 +1202,7 @@ function wp_expand_dimensions( $example_width, $example_height, $max_width, $max
/**
* Attempts to fetch the embed HTML for a provided URL using oEmbed.
*
+ * @since 2.9.0
* @see WP_oEmbed
*
* @uses _wp_oembed_get_object()
@@ -1211,3 +1217,20 @@ function wp_oembed_get( $url, $args = '' ) {
$oembed = _wp_oembed_get_object();
return $oembed->get_html( $url, $args );
}
+
+/**
+ * Adds a URL format and oEmbed provider URL pair.
+ *
+ * @since 2.9.0
+ * @see WP_oEmbed
+ *
+ * @uses _wp_oembed_get_object()
+ *
+ * @param string $format The format of URL that this provider can handle. Use asterisks as wildcards.
+ * @param string $provider The URL to the oEmbed provider.
+ */
+function wp_oembed_add_provider( $format, $provider ) {
+ require_once( 'class-oembed.php' );
+ $oembed = _wp_oembed_get_object();
+ $oembed->providers[$format] = $provider;
+}