Changeset 34261 for trunk/src/wp-includes/media.php
- Timestamp:
- 09/17/2015 06:03:11 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r34258 r34261 910 910 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); 911 911 912 if ( current_theme_supports( 'html5', 'caption' ) ) { 913 return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">' 914 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; 915 } 916 917 $caption_width = 10 + $atts['width']; 912 $html5 = current_theme_supports( 'html5', 'caption' ); 913 // HTML5 captions never added the extra 10px to the image width 914 $width = $html5 ? $atts['width'] : ( 10 + $atts['width'] ); 918 915 919 916 /** … … 927 924 * @see img_caption_shortcode() 928 925 * 929 * @param int $ caption_widthWidth of the caption in pixels. To remove this inline style,930 * 931 * @param array $atts 932 * @param string $content 933 */ 934 $caption_width = apply_filters( 'img_caption_shortcode_width', $ caption_width, $atts, $content );926 * @param int $width Width of the caption in pixels. To remove this inline style, 927 * return zero. 928 * @param array $atts Attributes of the caption shortcode. 929 * @param string $content The image element, possibly wrapped in a hyperlink. 930 */ 931 $caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content ); 935 932 936 933 $style = ''; … … 938 935 $style = 'style="width: ' . (int) $caption_width . 'px" '; 939 936 940 return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 941 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 937 $html = ''; 938 if ( $html5 ) { 939 $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 940 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; 941 } else { 942 $html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 943 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 944 } 945 946 return $html; 942 947 } 943 948 … … 2779 2784 2780 2785 $attached_file = get_attached_file( $attachment->ID ); 2781 2786 2782 2787 if ( isset( $meta['filesize'] ) ) { 2783 2788 $bytes = $meta['filesize'];
Note: See TracChangeset
for help on using the changeset viewer.