Changeset 33470
- Timestamp:
- 07/29/2015 12:01:22 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-embed.php
r33469 r33470 130 130 */ 131 131 public function shortcode( $attr, $url = '' ) { 132 // This filter can be used to output custom HTML instead of allowing oEmbed to run.133 $custom = apply_filters( 'wp_embed_shortcode_custom', false, $attr, $url );134 if ( false !== $custom ) {135 return $custom;136 }137 138 132 $post = get_post(); 139 133 -
trunk/tests/phpunit/tests/media.php
r33469 r33470 656 656 * @ticket 33016 657 657 */ 658 function filter_wp_embed_shortcode_custom( $c ustom, $attr, $url ) {658 function filter_wp_embed_shortcode_custom( $content, $url ) { 659 659 if ( 'https://www.example.com/?video=1' == $url ) { 660 $c ustom = "<iframe src='$url'></iframe>";660 $content = '@embed URL was replaced@'; 661 661 } 662 return $c ustom;662 return $content; 663 663 } 664 664 … … 668 668 function test_oembed_explicit_media_link() { 669 669 global $wp_embed; 670 add_filter( ' wp_embed_shortcode_custom', array( $this, 'filter_wp_embed_shortcode_custom' ), 10, 3);670 add_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10, 2 ); 671 671 672 672 $content = <<<EOF … … 675 675 676 676 $expected = <<<EOF 677 <iframe src='https://www.example.com/?video=1'></iframe> 677 @embed URL was replaced@ 678 678 EOF; 679 679 … … 687 687 myvar = 'Hello world 688 688 https://www.example.com/?video=1 689 do n't break this';689 do not break this'; 690 690 // ]]> 691 691 </script> … … 695 695 $this->assertEquals( $content, $result ); 696 696 697 remove_filter( ' wp_embed_shortcode_custom', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 );697 remove_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 ); 698 698 } 699 699 }
Note: See TracChangeset
for help on using the changeset viewer.