Changeset 12096 for trunk/wp-includes/class-oembed.php
- Timestamp:
- 10/23/2009 07:33:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-oembed.php
r12042 r12096 34 34 */ 35 35 function __construct() { 36 // List out some popular sites , mainly ones that don't have discovery tags in their <head>37 // The WP_Embed class disables discovery for non-unfiltered_html users, 38 // so only providers in this array will be used for them.36 // List out some popular sites that support oEmbed. 37 // The WP_Embed class disables discovery for non-unfiltered_html users, so only providers in this array will be used for them. 38 // Add to this list using the wp_oembed_add_provider() function 39 39 $this->providers = apply_filters( 'oembed_providers', array( 40 'http://*.youtube.com/watch*' => 'http://www.youtube.com/oembed', 41 'http://youtube.com/watch*' => 'http://www.youtube.com/oembed', 42 'http://blip.tv/file/*' => 'http://blip.tv/oembed/', 43 'http://*.flickr.com/*' => 'http://www.flickr.com/services/oembed/', 44 'http://www.hulu.com/watch/*' => 'http://www.hulu.com/api/oembed.{format}', 45 'http://*.viddler.com/*' => 'http://lab.viddler.com/services/oembed/', 46 'http://qik.com/*' => 'http://qik.com/api/oembed.{format}', 47 'http://*.revision3.com/*' => 'http://revision3.com/api/oembed/', 48 49 // Vimeo uses the discovery <link>, so leave this commented to use it as a discovery test 50 //'http://www.vimeo.com/*' => 'http://www.vimeo.com/api/oembed.{format}', 40 'http://www.youtube.com/watch*' => array( 'http://www.youtube.com/oembed', false ), 41 'http://blip.tv/file/*' => array( 'http://blip.tv/oembed/', false ), 42 '#http://(www\.)?vimeo\.com/.*#i' => array( 'http://www.vimeo.com/api/oembed.{format}', true ), 43 'http://*.flickr.com/*' => array( 'http://www.flickr.com/services/oembed/', false ), 44 'http://www.hulu.com/watch/*' => array( 'http://www.hulu.com/api/oembed.{format}', false ), 45 'http://*.viddler.com/*' => array( 'http://lab.viddler.com/services/oembed/', false ), 46 'http://qik.com/*' => array( 'http://qik.com/api/oembed.{format}', false ), 47 'http://*.revision3.com/*' => array( 'http://revision3.com/api/oembed/', false ), 51 48 ) ); 52 49 } … … 69 66 $args['discover'] = true; 70 67 71 foreach ( $this->providers as $matchmask => $providerurl ) { 68 foreach ( $this->providers as $matchmask => $data ) { 69 list( $providerurl, $regex ) = $data; 70 72 71 // Turn the asterisk-type provider URLs into regex 73 $regex = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; 74 75 if ( preg_match( $regex, $url ) ) { 72 if ( !$regex ) 73 $matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; 74 75 if ( preg_match( $matchmask, $url ) ) { 76 76 $provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML 77 77 break;
Note: See TracChangeset
for help on using the changeset viewer.