Make WordPress Core

Changeset 39613


Ignore:
Timestamp:
12/16/2016 06:38:10 AM (8 years ago)
Author:
dd32
Message:

Feeds: Do not translate the lastBuildDate field in RSS feeds.

Props stevenkword, dd32.
Fixes #39141

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed-atom-comments.php

    r39323 r39613  
    4444    <updated><?php
    4545        $date = get_lastcommentmodified( 'GMT' );
    46         echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' );
     46        echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
    4747    ?></updated>
    4848
  • trunk/src/wp-includes/feed-atom.php

    r38925 r39613  
    3333    <updated><?php
    3434        $date = get_lastpostmodified( 'GMT' );
    35         echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' );
     35        echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
    3636    ?></updated>
    3737
  • trunk/src/wp-includes/feed-rss2-comments.php

    r39323 r39613  
    5050    <lastBuildDate><?php
    5151        $date = get_lastcommentmodified( 'GMT' );
    52         echo $date ? mysql2date( 'r', $date ) : date( 'r' );
     52        echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
    5353    ?></lastBuildDate>
    5454    <sy:updatePeriod><?php
  • trunk/src/wp-includes/feed-rss2.php

    r38925 r39613  
    4545    <lastBuildDate><?php
    4646        $date = get_lastpostmodified( 'GMT' );
    47         echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date ) : date( 'D, d M Y H:i:s +0000' );
     47        echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date, false ) : date( 'D, d M Y H:i:s +0000' );
    4848    ?></lastBuildDate>
    4949    <language><?php bloginfo_rss( 'language' ); ?></language>
  • trunk/tests/phpunit/tests/feed/rss2.php

    r38929 r39613  
    137137
    138138    /**
     139     * Test that translated feeds have a valid listed date.
     140     * @group 39141
     141     */
     142    function test_channel_pubdate_element_translated() {
     143        $original_locale = $GLOBALS['wp_locale'];
     144        /* @var WP_Locale $locale */
     145        $locale = clone $GLOBALS['wp_locale'];
     146
     147        $locale->weekday[2] = 'Tuesday_Translated';
     148        $locale->weekday_abbrev[ 'Tuesday_Translated' ] = 'Tue_Translated';
     149
     150        $GLOBALS['wp_locale'] = $locale;
     151
     152        $this->go_to( '/?feed=rss2' );
     153        $feed = $this->do_rss2();
     154
     155        // Restore original locale.
     156        $GLOBALS['wp_locale'] = $original_locale;
     157
     158        $xml = xml_to_array( $feed );
     159
     160        // Verify the date is untranslated.
     161        $pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' );
     162        $this->assertNotContains( 'Tue_Translated', $pubdate[0]['content'] );
     163    }
     164
     165    /**
    139166     * @ticket UT32
    140167     */
Note: See TracChangeset for help on using the changeset viewer.