Make WordPress Core


Ignore:
Timestamp:
07/16/2020 09:29:05 PM (6 years ago)
Author:
whyisjake
Message:

Feeds: Ensure that galleries can be output as a list of links in feeds.

Adjusts the gallery shortcode handler to check for the link attribute when outputting to a feed.

Fixes #22101.

Props ifrins, mdgl, SergeyBiryukov, chriscct7, stevenkword, iworks, DrewAPicture, birgire, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r48454 r48496  
    29472947                $this->assertTrue( wp_image_file_matches_image_meta( $image_src, $image_meta ) );
    29482948        }
     2949
     2950                /**
     2951                 * @ticket 22101
     2952                 */
     2953        function test_gallery_shortcode_when_is_feed_true() {
     2954
     2955                $this->go_to( '/?feed=rss2' );
     2956
     2957                // Default: Links to image attachment page url
     2958                $actual = gallery_shortcode(
     2959                        array(
     2960                                'ids' => self::$large_id,
     2961                        )
     2962                );
     2963                $this->assertContains( '?attachment_id=', $actual );
     2964
     2965                // File: Links to image file url
     2966                $actual = gallery_shortcode(
     2967                        array(
     2968                                'ids'  => self::$large_id,
     2969                                'link' => 'file',
     2970                        )
     2971                );
     2972                $this->assertTrue( 2 === substr_count( $actual, '.jpg' ) );
     2973
     2974                // None: Does not link
     2975                $actual = gallery_shortcode(
     2976                        array(
     2977                                'ids'  => self::$large_id,
     2978                                'link' => 'none',
     2979                        )
     2980                );
     2981                $this->assertFalse( strpos( $actual, '<a ' ) );
     2982        }
     2983
    29492984}
    29502985
Note: See TracChangeset for help on using the changeset viewer.