diff --git src/wp-includes/media.php src/wp-includes/media.php
index dbc9c7d..e80baab 100644
|
|
function gallery_shortcode( $attr ) { |
1699 | 1699 | if ( is_feed() ) { |
1700 | 1700 | $output = "\n"; |
1701 | 1701 | foreach ( $attachments as $att_id => $attachment ) { |
1702 | | $output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n"; |
| 1702 | if ( ! empty( $atts['link'] ) ) { |
| 1703 | if( 'none' === $atts['link'] ) { |
| 1704 | $output .= wp_get_attachment_image( $att_id, $atts['size'], false, $attr ); |
| 1705 | } else { |
| 1706 | $output .= wp_get_attachment_link( $att_id, $atts['size'], false ); |
| 1707 | } |
| 1708 | } else { |
| 1709 | $output .= wp_get_attachment_link( $att_id, $atts['size'], true ); |
| 1710 | } |
| 1711 | $output .= "\n"; |
1703 | 1712 | } |
1704 | 1713 | return $output; |
1705 | 1714 | } |
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 392c039..9dc6a49 100644
|
|
EOF; |
2062 | 2062 | $attachment_id = wp_insert_attachment( $data, '', 0 ); |
2063 | 2063 | $this->assertSame( 0, $attachment_id ); |
2064 | 2064 | } |
| 2065 | |
| 2066 | /** |
| 2067 | * @ticket 22101 |
| 2068 | */ |
| 2069 | function test_gallery_shortcode_when_is_feed_true() { |
| 2070 | |
| 2071 | $this->go_to( '/?feed=rss2' ); |
| 2072 | |
| 2073 | // Default: Links to image attachment page url |
| 2074 | $actual = gallery_shortcode( array( |
| 2075 | 'ids' => self::$large_id, |
| 2076 | ) ); |
| 2077 | $this->assertContains( '?attachment_id=', $actual ); |
| 2078 | |
| 2079 | // File: Links to image file url |
| 2080 | $actual = gallery_shortcode( array( |
| 2081 | 'ids' => self::$large_id, |
| 2082 | 'link' => 'file', |
| 2083 | ) ); |
| 2084 | $this->assertTrue( 2 == substr_count( $actual, '.png' ) ); |
| 2085 | |
| 2086 | // None: Does not link |
| 2087 | $actual = gallery_shortcode( array( |
| 2088 | 'ids' => self::$large_id, |
| 2089 | 'link' => 'none', |
| 2090 | ) ); |
| 2091 | $this->assertFalse( strpos( $actual, '<a ' ) ); |
| 2092 | } |
| 2093 | |
2065 | 2094 | } |
2066 | 2095 | |
2067 | 2096 | /** |