Ticket #21221: 21221.3.diff
File 21221.3.diff, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/media.php
313 313 list( $img_src, $width, $height ) = image_downsize($id, $size); 314 314 $hwstring = image_hwstring($width, $height); 315 315 316 $title = $title ? 'title="' . esc_attr( $title) . '" ' : '';316 $title = $title ? 'title="' . esc_attr( wptexturize( $title ) ) . '" ' : ''; 317 317 318 318 $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id; 319 319 … … 329 329 */ 330 330 $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size ); 331 331 332 $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr( $alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';332 $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr( wptexturize( $alt ) ) . '" ' . $title . $hwstring . 'class="' . $class . '" />'; 333 333 334 334 /** 335 335 * Filter the HTML content for the image tag. … … 745 745 $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption 746 746 if ( empty($default_attr['alt']) ) 747 747 $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title 748 $default_attr['alt'] = wptexturize( $default_attr['alt'] ); 748 749 749 750 $attr = wp_parse_args($attr, $default_attr); 750 751 -
tests/phpunit/tests/formatting/WPTexturize.php
1837 1837 ), 1838 1838 ); 1839 1839 } 1840 1841 /** 1842 * @ticket 21221 1843 * @dataProvider data_image_title_tags 1844 */ 1845 1846 function test_image_alt_tag( $input, $output) { 1847 1848 $image = get_image_tag( 1 , $input, 'title', 'left' ); 1849 return $this->assertEquals( '<img src="" alt="'. $output.'" title="title" class="alignleft size-medium wp-image-1" />' , $image ); 1850 1851 } 1852 1853 /** 1854 * @ticket 21221 1855 * @dataProvider data_image_title_tags 1856 */ 1857 1858 function test_image_title_tag( $input, $output) { 1859 1860 $image = get_image_tag( 1 , 'alt', $input, 'left' ); 1861 return $this->assertEquals( '<img src="" alt="alt" title="'. $output.'" class="alignleft size-medium wp-image-1" />' , $image ); 1862 } 1863 1864 function data_image_title_tags() { 1865 return array_merge( 1866 $this->data_apos_before_digits(), 1867 $this->data_spaces_around_quotes(), 1868 $this->data_year_abbr() 1869 ); 1870 } 1840 1871 } 1872 No newline at end of file