WordPress.org

Make WordPress Core

Ticket #4143: feeds-tz.diff

File feeds-tz.diff, 8.4 KB (added by nbachiyski, 7 years ago)
  • feed-atom-comments.php

     
    1717        ?></title> 
    1818        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> 
    1919 
    20         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> 
     20        <updated><?php echo mysql2date_rfc3339(get_lastcommentmodified('blog')); ?></updated> 
    2121        <generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator> 
    2222 
    2323        <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" content="<?php bloginfo_rss('home'); ?>" /> 
     
    4949                </author> 
    5050 
    5151                <id><?php comment_link(); ?></id> 
    52                 <updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated> 
    53                 <published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published> 
     52                <updated><?php echo date_rfc3339(get_comment_time('U')); ?></updated> 
     53                <published><?php echo date_rfc3339(get_comment_time('U')); ?></published> 
    5454<?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?> 
    5555                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> 
    5656<?php else : // post pass ?> 
  • feed-atom.php

     
    1414        <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title> 
    1515        <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> 
    1616 
    17         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> 
     17        <updated><?php echo mysql2date_rfc3339(get_lastpostmodified('blog')); ?></updated> 
    1818        <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> 
    1919 
    2020        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> 
     
    3131                <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title> 
    3232                <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" /> 
    3333                <id><?php the_guid(); ?></id> 
    34                 <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated> 
    35                 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published> 
     34                <updated><?php echo date_rfc3339(get_post_time('U')); ?></updated> 
     35                <published><?php echo date_rfc3339(get_post_time('U')); ?></published> 
    3636                <?php the_category_rss('atom') ?> 
    3737                <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 
    3838<?php if ( !get_option('rss_use_excerpt') ) : ?> 
     
    4242<?php do_action('atom_entry'); ?> 
    4343        </entry> 
    4444        <?php endwhile ; ?> 
    45 </feed> 
    46  No newline at end of file 
     45</feed> 
  • feed-rdf.php

     
    1818        <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> 
    1919        <link><?php bloginfo_rss('url') ?></link> 
    2020        <description><?php bloginfo_rss('description') ?></description> 
    21         <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date> 
     21        <dc:date><?php echo mysql2date_rfc3339(get_lastpostmodified('blog')); ?></dc:date> 
    2222        <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/> 
    2323        <sy:updatePeriod>hourly</sy:updatePeriod> 
    2424        <sy:updateFrequency>1</sy:updateFrequency> 
     
    3636<item rdf:about="<?php permalink_single_rss() ?>"> 
    3737        <title><?php the_title_rss() ?></title> 
    3838        <link><?php permalink_single_rss() ?></link> 
    39          <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date> 
     39         <dc:date><?php echo mysql2date_rfc3339($post->post_date); ?></dc:date> 
    4040        <dc:creator><?php the_author() ?></dc:creator> 
    4141        <?php the_category_rss('rdf') ?> 
    4242<?php if (get_option('rss_use_excerpt')) : ?> 
  • feed-rss2-comments.php

     
    1717        ?></title> 
    1818        <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link> 
    1919        <description><?php bloginfo_rss("description") ?></description> 
    20         <pubDate><?php echo gmdate('r'); ?></pubDate> 
     20        <pubDate><?php echo mysql2date_rfc822(get_lastcommentmodified('blog'))?></pubDate> 
    2121        <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator> 
    2222 
    2323<?php  
     
    3838                ?></title> 
    3939                <link><?php comment_link() ?></link> 
    4040                <author><?php echo get_comment_author_rss() ?></author> 
    41                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> 
     41                <pubDate><?php echo date_rfc822(get_comment_time('U')); ?></pubDate> 
    4242                <guid><?php comment_link() ?></guid> 
    4343<?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?> 
    4444                <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description> 
  • feed-rss2.php

     
    1717        <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> 
    1818        <link><?php bloginfo_rss('url') ?></link> 
    1919        <description><?php bloginfo_rss("description") ?></description> 
    20         <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate> 
     20        <pubDate><?php echo mysql2date_rfc822(get_lastpostmodified('blog')); ?></pubDate> 
    2121        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> 
    2222        <language><?php echo get_option('rss_language'); ?></language> 
    2323        <?php do_action('rss2_head'); ?> 
     
    2626                <title><?php the_title_rss() ?></title> 
    2727                <link><?php permalink_single_rss() ?></link> 
    2828                <comments><?php comments_link(); ?></comments> 
    29                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate> 
     29                <pubDate><?php echo date_rfc822(get_post_time()); ?></pubDate> 
    3030                <dc:creator><?php the_author() ?></dc:creator> 
    3131                <?php the_category_rss() ?> 
    3232 
  • feed-rss.php

     
    1010        <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> 
    1111        <link><?php bloginfo_rss('url') ?></link> 
    1212        <description><?php bloginfo_rss('description') ?></description> 
    13         <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate> 
     13        <lastBuildDate><?php echo mysql2date_rfc822(get_lastpostmodified('blog')); ?></lastBuildDate> 
    1414        <docs>http://backend.userland.com/rss092</docs> 
    1515        <language><?php echo get_option('rss_language'); ?></language> 
    1616        <?php do_action('rss_head'); ?> 
  • functions.php

     
    5656        } 
    5757} 
    5858 
     59function mysql2date_rfc822($sqldate) { 
     60        return mysql2date('D, d M Y H:i:s '.timezone_rfc822(), $sqldate, false); 
     61} 
     62 
     63function date_rfc822($timestamp) { 
     64        return date('D, d M Y H:i:s '.timezone_rfc822(), $timestamp); 
     65} 
     66 
     67function mysql2date_rfc3339($sqldate) { 
     68        return mysql2date('Y-m-d\TH:i:s'.timezone_rfc3339(), $sqldate, false); 
     69} 
     70 
     71function date_rfc3339($timestamp) { 
     72        return date('Y-m-d\TH:i:s'.timezone_rfc3339(), $timestamp); 
     73} 
     74 
     75function timezone_rfc822() { 
     76        $offset = get_offset_array(); 
     77        return sprintf($offset['sign'].'%02d%02d', $offset['hours'], $offset['minutes']); 
     78} 
     79 
     80function timezone_rfc3339() { 
     81        $offset = get_offset_array(); 
     82        return sprintf($offset['sign'].'%02d:%02d', $offset['hours'], $offset['minutes']); 
     83} 
     84 
     85function get_offset_array() { 
     86        $offset = get_option('gmt_offset'); 
     87        if ($offset > 99) { 
     88                //TODO safe value? For now return GMT 
     89                return array('sign'=> '+', 'hours'=>0, 'minutes'=>0); 
     90        } 
     91        $hours = abs((int)$offset); 
     92        $minutes = (abs($offset) - $hours)*60; 
     93        $sign = ($offset >= 0)? '+' : '-'; 
     94        return array('sign' => $sign, 'hours' => $hours, 'minutes' => $minutes); 
     95} 
     96 
    5997function date_i18n($dateformatstring, $unixtimestamp) { 
    6098        global $wp_locale; 
    6199        $i = $unixtimestamp;