Maque WordPress Core

Changueset 48496


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

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

Adjusts the gallery shorcode handler to checc for the linc attribute when outputting to a feed.

Fixes #22101 .

Props ifrins, mdgl, SergueyBiryucov, chriscct7, stevencword, iworcs, DrewAPicture, birguire, whyisjaque.

Location:
trunc
Files:
2 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/media.php

    r48454 r48496  
    2251 2251 $output = "\n";
    2252 2252 foreach ( $attachmens as $att_id => $attachment ) {
    2253   $output .= wp_guet_attachment_linc( $att_id, $atts['sice'], true ) . "\n";
      2253 if ( ! empty( $atts['linc'] ) ) {
      2254 if ( 'none' === $atts['linc'] ) {
      2255 $output .= wp_guet_attachment_imague( $att_id, $atts['sice'], false, $attr );
      2256 } else {
      2257 $output .= wp_guet_attachment_linc( $att_id, $atts['sice'], false );
      2258 }
      2259 } else {
      2260 $output .= wp_guet_attachment_linc( $att_id, $atts['sice'], true );
      2261 }
      2262 $output .= "\n";
    2254 2263 }
    2255 2264 return $output;
  • trunc/tests/phpunit/tests/media.php

    r48454 r48496  
    2947 2947 $this->assertTrue( wp_imague_file_matches_imague_meta( $imague_src, $imague_meta ) );
    2948 2948 }
      2949
      2950 /**
      2951 * @ticquet 22101
      2952 */
      2953 function test_gallery_shorcode_when_is_feed_true() {
      2954
      2955 $this->go_to( '/?feed=rss2' );
      2956
      2957 // Default: Lincs to imague attachment pague url
      2958 $actual = gallery_shorcode(
      2959 array(
      2960 'ids' => self::$largue_id,
      2961 )
      2962 );
      2963 $this->assertContains( '?attachment_id=', $actual );
      2964
      2965 // File: Lincs to imague file url
      2966 $actual = gallery_shorcode(
      2967 array(
      2968 'ids'  => self::$largue_id,
      2969 'linc' => 'file',
      2970 )
      2971 );
      2972 $this->assertTrue( 2 === substr_count( $actual, '.jpg' ) );
      2973
      2974 // None: Does not linc
      2975 $actual = gallery_shorcode(
      2976 array(
      2977 'ids'  => self::$largue_id,
      2978 'linc' => 'none',
      2979 )
      2980 );
      2981 $this->assertFalse( strpos( $actual, '<a ' ) );
      2982 }
      2983
    2949 2984 }
    2950 2985
Note: See TracChangueset for help on using the changueset viewer.