Ticket #26642: 26642.diff
| File 26642.diff, 3.2 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/media.php
701 701 * @param string $content The image element, possibly wrapped in a hyperlink. 702 702 */ 703 703 $output = apply_filters( 'img_caption_shortcode', '', $attr, $content ); 704 if ( $output != '' )704 if ( '' != $output ) { 705 705 return $output; 706 } 706 707 707 708 $atts = shortcode_atts( array( 708 709 'id' => '', … … 712 713 ), $attr, 'caption' ); 713 714 714 715 $atts['width'] = (int) $atts['width']; 715 if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) 716 if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) { 716 717 return $content; 718 } 717 719 718 if ( ! empty( $atts['id'] ) ) 720 if ( ! empty( $atts['id'] ) ) { 719 721 $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; 722 } 720 723 721 $caption_width = 10 + $atts['width']; 724 if ( current_theme_supports( 'html5', 'caption' ) ) { 725 $output = '<figure ' . $atts['id'] . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">' 726 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; 722 727 723 /** 724 * Filter the width of an image's caption. 725 * 726 * By default, the caption is 10 pixels greater than the width of the image, 727 * to prevent post content from running up against a floated image. 728 * 729 * @since 3.7.0 730 * 731 * @see img_caption_shortcode() 732 * 733 * @param int $caption_width Width of the caption in pixels. To remove this inline style, 734 * return zero. 735 * @param array $atts Attributes of the caption shortcode. 736 * @param string $content The image element, possibly wrapped in a hyperlink. 737 */ 738 $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content ); 728 } else { 729 $caption_width = 10 + $atts['width']; 739 730 740 $style = ''; 741 if ( $caption_width ) 742 $style = 'style="width: ' . (int) $caption_width . 'px" '; 731 /** 732 * Filter the width of an image's caption. 733 * 734 * By default, the caption is 10 pixels greater than the width of the image, 735 * to prevent post content from running up against a floated image. 736 * 737 * @since 3.7.0 738 * 739 * @see img_caption_shortcode() 740 * 741 * @param int $caption_width Width of the caption in pixels. To remove this inline style, 742 * return zero. 743 * @param array $atts Attributes of the caption shortcode. 744 * @param string $content The image element, possibly wrapped in a hyperlink. 745 */ 746 $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content ); 743 747 744 return '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">' 745 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 748 $style = ''; 749 if ( $caption_width ) { 750 $style = 'style="width: ' . (int) $caption_width . 'px" '; 751 } 752 753 $output = '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">' 754 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 755 } 756 757 return $output; 746 758 } 747 759 748 760 add_shortcode('gallery', 'gallery_shortcode');
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)