Changeset 37709
- Timestamp:
- 06/15/2016 11:31:12 AM (8 years ago)
- Location:
- branches/4.5
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-includes/class-oembed.php
r37069 r37709 316 316 */ 317 317 public function get_html( $url, $args = '' ) { 318 /** 319 * Filters the oEmbed result before any HTTP requests are made. 320 * 321 * This allows one to short-circuit the default logic, perhaps by 322 * replacing it with a routine that is more optimal for your setup. 323 * 324 * Passing a non-null value to the filter will effectively short-circuit retrieval, 325 * returning the passed value instead. 326 * 327 * @since 4.5.3 328 * 329 * @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. Default null. 330 * @param string $url The URL to the content that should be attempted to be embedded. 331 * @param array $args Optional. Arguments, usually passed from a shortcode. Default empty. 332 */ 333 $pre = apply_filters( 'pre_oembed_result', null, $url, $args ); 334 335 if ( null !== $pre ) { 336 return $pre; 337 } 338 318 339 $provider = $this->get_provider( $url, $args ); 319 340 320 if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) ) 321 return false; 341 if ( ! $provider || false === $data = $this->fetch( $provider, $url, $args ) ) { 342 return false; 343 } 322 344 323 345 /** -
branches/4.5/src/wp-includes/default-filters.php
r36915 r37709 477 477 add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 ); 478 478 add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 ); 479 add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 ); 479 480 480 481 unset( $filter, $action ); -
branches/4.5/src/wp-includes/embed.php
r36923 r37709 1080 1080 echo apply_filters( 'embed_site_title_html', $site_title ); 1081 1081 } 1082 1083 /** 1084 * Filters the oEmbed result before any HTTP requests are made. 1085 * 1086 * If the URL belongs to the current site, the result is fetched directly instead of 1087 * going through the oEmbed discovery process. 1088 * 1089 * @since 4.5.3 1090 * 1091 * @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. Default null. 1092 * @param string $url The URL that should be inspected for discovery `<link>` tags. 1093 * @param array $args oEmbed remote get arguments. 1094 * @return null|string The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. 1095 * Null if the URL does not belong to the current site. 1096 */ 1097 function wp_filter_pre_oembed_result( $result, $url, $args ) { 1098 $post_id = url_to_postid( $url ); 1099 1100 /** This filter is documented in wp-includes/class-wp-oembed-controller.php */ 1101 $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); 1102 1103 $width = isset( $args['width'] ) ? $args['width'] : 0; 1104 1105 $data = get_oembed_response_data( $post_id, $width ); 1106 $data = _wp_oembed_get_object()->data2html( (object) $data, $url ); 1107 1108 if ( ! $data ) { 1109 return $result; 1110 } 1111 1112 return $data; 1113 }
Note: See TracChangeset
for help on using the changeset viewer.