Ticket #27292: 27292.diff
| File 27292.diff, 1.9 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/media.php
745 745 746 746 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); 747 747 748 return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 749 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 748 $html5 = current_theme_supports( 'html5', 'caption' ); 749 $itemtag = $html5 ? 'figure' : 'div'; 750 $captiontag = $html5 ? 'figcaption' : 'p'; 751 752 return "<$itemtag " . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 753 . do_shortcode( $content ) . "<$captiontag " . 'class="wp-caption-text">' . $atts['caption'] . "</$captiontag></$itemtag>"; 750 754 } 751 755 752 756 add_shortcode('gallery', 'gallery_shortcode'); -
tests/phpunit/tests/media.php
108 108 $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) ); 109 109 } 110 110 111 function test_new_img_caption_shortcode_new_format_html5() { 112 add_theme_support( 'html5', array( 'caption' ) ); 113 $result = img_caption_shortcode( 114 array( 'width' => 20 ), 115 $this->img_content . $this->html_content 116 ); 117 $img_preg = preg_quote( $this->img_content ); 118 $content_preg = preg_quote( $this->html_content ); 119 120 $this->assertEquals( 1, preg_match( "~^<figure [^>]+>{$img_preg}<figcaption [^>]+>{$content_preg}</figcaption></figure>$~", $result ) ); 121 remove_theme_support( 'html5' ); 122 } 123 111 124 function test_add_remove_oembed_provider() { 112 125 wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' ); 113 126 $this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );