Feeds: Do not translate the lastBuildDate
field in RSS feeds.
Props stevenkword, dd32. Fixes #39141 git-svn-id: https://develop.svn.wordpress.org/trunk@39613 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0abe687fe8
commit
939e806ef1
@ -43,7 +43,7 @@ do_action( 'rss_tag_pre', 'atom-comments' );
|
||||
|
||||
<updated><?php
|
||||
$date = get_lastcommentmodified( 'GMT' );
|
||||
echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' );
|
||||
echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
|
||||
?></updated>
|
||||
|
||||
<?php if ( is_singular() ) { ?>
|
||||
|
@ -32,7 +32,7 @@ do_action( 'rss_tag_pre', 'atom' );
|
||||
|
||||
<updated><?php
|
||||
$date = get_lastpostmodified( 'GMT' );
|
||||
echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' );
|
||||
echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
|
||||
?></updated>
|
||||
|
||||
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url') ?>" />
|
||||
|
@ -49,7 +49,7 @@ do_action( 'rss_tag_pre', 'rss2-comments' );
|
||||
<description><?php bloginfo_rss("description") ?></description>
|
||||
<lastBuildDate><?php
|
||||
$date = get_lastcommentmodified( 'GMT' );
|
||||
echo $date ? mysql2date( 'r', $date ) : date( 'r' );
|
||||
echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
|
||||
?></lastBuildDate>
|
||||
<sy:updatePeriod><?php
|
||||
/** This filter is documented in wp-includes/feed-rss2.php */
|
||||
|
@ -44,7 +44,7 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||
<description><?php bloginfo_rss("description") ?></description>
|
||||
<lastBuildDate><?php
|
||||
$date = get_lastpostmodified( 'GMT' );
|
||||
echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date ) : date( 'D, d M Y H:i:s +0000' );
|
||||
echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date, false ) : date( 'D, d M Y H:i:s +0000' );
|
||||
?></lastBuildDate>
|
||||
<language><?php bloginfo_rss( 'language' ); ?></language>
|
||||
<sy:updatePeriod><?php
|
||||
|
@ -135,6 +135,33 @@ class Tests_Feeds_RSS2 extends WP_UnitTestCase {
|
||||
$this->assertEquals( strtotime( get_lastpostmodified() ), strtotime( $pubdate[0]['content'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that translated feeds have a valid listed date.
|
||||
* @group 39141
|
||||
*/
|
||||
function test_channel_pubdate_element_translated() {
|
||||
$original_locale = $GLOBALS['wp_locale'];
|
||||
/* @var WP_Locale $locale */
|
||||
$locale = clone $GLOBALS['wp_locale'];
|
||||
|
||||
$locale->weekday[2] = 'Tuesday_Translated';
|
||||
$locale->weekday_abbrev[ 'Tuesday_Translated' ] = 'Tue_Translated';
|
||||
|
||||
$GLOBALS['wp_locale'] = $locale;
|
||||
|
||||
$this->go_to( '/?feed=rss2' );
|
||||
$feed = $this->do_rss2();
|
||||
|
||||
// Restore original locale.
|
||||
$GLOBALS['wp_locale'] = $original_locale;
|
||||
|
||||
$xml = xml_to_array( $feed );
|
||||
|
||||
// Verify the date is untranslated.
|
||||
$pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' );
|
||||
$this->assertNotContains( 'Tue_Translated', $pubdate[0]['content'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket UT32
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user