From e618b986bf1896333ee04f412e9fa22f5218e7da Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Wed, 2 Jul 2014 00:19:15 +0000 Subject: [PATCH] Introduce an annotated list of oEmbed providers, their flavors, whether they support SSL, and when they were added to the `oembed_providers` filter docs. See #28507. Fixes #28372. Built from https://develop.svn.wordpress.org/trunk@28949 git-svn-id: http://core.svn.wordpress.org/trunk@28746 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-oembed.php | 68 ++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/wp-includes/class-oembed.php b/wp-includes/class-oembed.php index 381d3d0d8f..8f63325561 100644 --- a/wp-includes/class-oembed.php +++ b/wp-includes/class-oembed.php @@ -24,10 +24,72 @@ class WP_oEmbed { /** * Constructor * - * @uses apply_filters() Filters a list of pre-defined oEmbed providers. + * @since 2.9.0 */ public function __construct() { - $providers = array( + /** + * Filter the list of oEmbed providers. + * + * Discovery is disabled for users lacking the unfiltered_html capability. + * Only providers in this array will be used for those users. + * + * Supported providers: + * + * | ------------ | -------------------- | ----- | ------------------ | + * | Provider | Flavor | SSL | Since | + * | ------------ | -------------------- | ----- | ------------------ | + * | Blip | blip.tv | | 2.9.0 | + * | Dailymotion | dailymotion.com | Yes | 2.9.0 | + * | Flickr | flickr.com | Yes | 2.9.0 | + * | Hulu | hulu.com | Yes | 2.9.0 | + * | Photobucket | photobucket.com | | 2.9.0 | + * | Qik | qik.com | | 2.9.0 (deprecated) | + * | Revision3 | revision3.com | | 2.9.0 | + * | Scribd | scribd.com | Yes | 2.9.0 | + * | Viddler | viddler.com | | 2.9.0 (deprecated) | + * | Vimeo | vimeo.com | Yes | 2.9.0 | + * | WordPress.tv | wordpress.tv | | 2.9.0 | + * | YouTube | youtube.com/watch | Both | 2.9.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Funny or Die | funnyordie.com | Yes | 3.0.0 | + * | Polldaddy | polldaddy.com | Yes | 3.0.0 | + * | SmugMug | smugmug.com | Yes | 3.0.0 | + * | YouTube | youtu.be | Both | 3.0.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Twitter | twitter.com | Yes | 3.4.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Instagram | instagram.com | | 3.5.0 | + * | Instagram | instagr.am | | 3.5.0 | + * | Slideshare | slideshare.net | Yes | 3.5.0 | + * | SoundCloud | soundcloud.com | Yes | 3.5.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Dailymotion | dai.ly | | 3.6.0 | + * | Flickr | flic.kr | Yes | 3.6.0 | + * | Rdio | rdio.com | Yes | 3.6.0 | + * | Rdio | rd.io | Yes | 3.6.0 | + * | Spotify | spotify.com | Yes | 3.6.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Imgur | imgur.com | Yes | 3.9.0 | + * | Meetup.com | meetup.com | Yes | 3.9.0 | + * | Meetup.com | meetu.ps | Yes | 3.9.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * | Animoto | animoto.com | Yes | 4.0.0 | + * | Animoto | video214.com | Yes | 4.0.0 | + * | CollegeHumor | collegehumor.com | Yes | 4.0.0 | + * | Issuu | issuu.com | Yes | 4.0.0 | + * | Mixcloud | mixcloud.com | Yes | 4.0.0 | + * | Polldaddy | poll.fm | Yes | 4.0.0 | + * | TED | ted.com | Yes | 4.0.0 | + * | YouTube | youtube.com/playlist | Both | 4.0.0 | + * | ------------ | -------------------- | ----- | ------------------ | + * + * @see wp_oembed_add_provider() + * + * @since 2.9.0 + * + * @param array $providers An array of popular oEmbed providers. + */ + $providers = apply_filters( 'oembed_providers', array( '#http://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ), '#https://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ), '#http://(www\.)?youtube\.com/playlist.*#i' => array( 'http://www.youtube.com/oembed', true ), @@ -64,7 +126,7 @@ class WP_oEmbed { '#https?://(www\.)?mixcloud\.com/.*#i' => array( 'http://www.mixcloud.com/oembed', true ), '#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'http://www.ted.com/talks/oembed.{format}', true ), '#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'http://animoto.com/oembeds/create', true ), - ); + ) ); if ( ! empty( self::$early_providers['add'] ) ) { foreach ( self::$early_providers['add'] as $format => $data ) {