Ticket #10337: 10337.youtubeoembedandtweaks.patch
File 10337.youtubeoembedandtweaks.patch, 6.2 KB (added by , 14 years ago) |
---|
-
wp-includes/capabilities.php
962 962 /** 963 963 * Whether author of supplied post has capability or role. 964 964 * 965 * @since 2.9 965 * @since 2.9.0 966 966 * 967 967 * @param int|object $post Post ID or post object. 968 968 * @param string $capability Capability or role name. -
wp-includes/class-oembed.php
37 37 // The WP_Embed class disables discovery for non-unfiltered_html users, 38 38 // so only providers in this array will be used for them. 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', 40 42 'http://blip.tv/file/*' => 'http://blip.tv/oembed/', 41 43 'http://*.flickr.com/*' => 'http://www.flickr.com/services/oembed/', 44 'http://www.hulu.com/watch/*' => 'http://www.hulu.com/api/oembed.{format}', 42 45 'http://*.viddler.com/*' => 'http://lab.viddler.com/services/oembed/', 43 46 'http://qik.com/*' => 'http://qik.com/api/oembed.{format}', 44 47 'http://*.revision3.com/*' => 'http://revision3.com/api/oembed/', 45 'http://www.hulu.com/watch/*' => 'http://www.hulu.com/api/oembed.{format}',46 48 47 49 // Vimeo uses the discovery <link>, so leave this commented to use it as a discovery test 48 50 //'http://www.vimeo.com/*' => 'http://www.vimeo.com/api/oembed.{format}', -
wp-includes/default-embeds.php
8 8 */ 9 9 10 10 /** 11 * The YouTube.com embed handler callback. YouTube does not support oEmbed and we want to provide extra customization.12 *13 * @see WP_Embed::register_handler()14 * @see WP_Embed::shortcode()15 *16 * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.17 * @param array $attr Embed attributes.18 * @param string $url The original URL that was matched by the regex.19 * @param array $rawattr The original unmodified attributes.20 * @return string The embed HTML.21 */22 function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) {23 // If the user supplied a fixed width AND height, use it24 if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {25 $width = (int) $rawattr['width'];26 $height = (int) $rawattr['height'];27 } else {28 list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );29 }30 31 return apply_filters( 'embed_youtube', '<object width="' . esc_attr($width) . '" height="' . esc_attr($height) . '"><param name="movie" value="http://www.youtube.com/v/' . esc_attr($matches[3]) . '&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . esc_attr($matches[3]) . '&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '"></embed></object>', $matches, $attr, $url, $rawattr );32 }33 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' );34 35 36 /**37 11 * The Google Video embed handler callback. Google Video does not support oEmbed. 38 12 * 39 13 * @see WP_Embed::register_handler() -
wp-includes/formatting.php
2358 2358 case 'medium_size_h': 2359 2359 case 'large_size_w': 2360 2360 case 'large_size_h': 2361 //case 'embed_size_w':2362 2361 case 'embed_size_h': 2363 2362 case 'default_post_edit_rows': 2364 2363 case 'mailserver_port': … … 2375 2374 $value = absint( $value ); 2376 2375 break; 2377 2376 2377 case 'embed_size_w': 2378 if ( '' !== $value ) 2379 $value = absint( $value ); 2380 break; 2381 2378 2382 case 'posts_per_page': 2379 2383 case 'posts_per_rss': 2380 2384 $value = (int) $value; -
wp-includes/media.php
1134 1134 /** 1135 1135 * Register an embed handler. This function should probably only be used for sites that do not support oEmbed. 1136 1136 * 1137 * @since 2.9.0 1137 1138 * @see WP_Embed::register_handler() 1138 1139 */ 1139 1140 function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) { … … 1144 1145 /** 1145 1146 * Unregister a previously registered embed handler. 1146 1147 * 1148 * @since 2.9.0 1147 1149 * @see WP_Embed::unregister_handler() 1148 1150 */ 1149 1151 function wp_embed_unregister_handler( $id, $priority = 10 ) { … … 1154 1156 /** 1155 1157 * Create default array of embed parameters. 1156 1158 * 1159 * @since 2.9.0 1160 * 1157 1161 * @return array Default embed parameters. 1158 1162 */ 1159 1163 function wp_embed_defaults() { … … 1177 1181 /** 1178 1182 * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height. 1179 1183 * 1184 * @since 2.9.0 1180 1185 * @uses wp_constrain_dimensions() This function passes the widths and the heights. 1181 1186 * 1182 1187 * @param int $example_width The width of an example embed. … … 1197 1202 /** 1198 1203 * Attempts to fetch the embed HTML for a provided URL using oEmbed. 1199 1204 * 1205 * @since 2.9.0 1200 1206 * @see WP_oEmbed 1201 1207 * 1202 1208 * @uses _wp_oembed_get_object() … … 1211 1217 $oembed = _wp_oembed_get_object(); 1212 1218 return $oembed->get_html( $url, $args ); 1213 1219 } 1220 1221 /** 1222 * Adds a URL format and oEmbed provider URL pair. 1223 * 1224 * @since 2.9.0 1225 * @see WP_oEmbed 1226 * 1227 * @uses _wp_oembed_get_object() 1228 * 1229 * @param string $format The format of URL that this provider can handle. Use asterisks as wildcards. 1230 * @param string $provider The URL to the oEmbed provider. 1231 */ 1232 function wp_oembed_addprovider( $format, $provider ) { 1233 require_once( 'class-oembed.php' ); 1234 $oembed = _wp_oembed_get_object(); 1235 $oembed->providers[$format] = $provider; 1236 }