diff --git src/wp-includes/feed-atom-comments.php src/wp-includes/feed-atom-comments.php
index 3bf0521574..49e5ca0764 100644
|
|
do_action( 'rss_tag_pre', 'atom-comments' ); |
43 | 43 | </title> |
44 | 44 | <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle> |
45 | 45 | |
46 | | <?php $date = get_last_build_date(); ?> |
47 | | <updated><?php echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' ); ?></updated> |
| 46 | <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated> |
48 | 47 | |
49 | 48 | <?php if ( is_singular() ) { ?> |
50 | 49 | <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php comments_link_feed(); ?>" /> |
diff --git src/wp-includes/feed-atom.php src/wp-includes/feed-atom.php
index 16e9157b7f..bce41086be 100644
|
|
do_action( 'rss_tag_pre', 'atom' ); |
30 | 30 | <title type="text"><?php wp_title_rss(); ?></title> |
31 | 31 | <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle> |
32 | 32 | |
33 | | <?php $date = get_last_build_date(); ?> |
34 | | <updated><?php echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' ); ?></updated> |
| 33 | <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated> |
35 | 34 | |
36 | 35 | <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" /> |
37 | 36 | <id><?php bloginfo( 'atom_url' ); ?></id> |
diff --git src/wp-includes/feed-rdf.php src/wp-includes/feed-rdf.php
index 708893245f..861425ae30 100644
|
|
do_action( 'rss_tag_pre', 'rdf' ); |
33 | 33 | <title><?php wp_title_rss(); ?></title> |
34 | 34 | <link><?php bloginfo_rss( 'url' ); ?></link> |
35 | 35 | <description><?php bloginfo_rss( 'description' ); ?></description> |
36 | | <dc:date> |
37 | | <?php |
38 | | $date = get_last_build_date(); |
39 | | echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' ); |
40 | | ?> |
41 | | </dc:date> |
| 36 | <dc:date><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?> </dc:date> |
42 | 37 | <sy:updatePeriod> |
43 | 38 | <?php |
44 | 39 | /** This filter is documented in wp-includes/feed-rss2.php */ |
diff --git src/wp-includes/feed-rss.php src/wp-includes/feed-rss.php
index 06d5f66a60..0b58d5f0ee 100644
|
|
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '> |
14 | 14 | <title><?php wp_title_rss(); ?></title> |
15 | 15 | <link><?php bloginfo_rss( 'url' ); ?></link> |
16 | 16 | <description><?php bloginfo_rss( 'description' ); ?></description> |
17 | | <lastBuildDate> |
18 | | <?php |
19 | | $date = get_last_build_date(); |
20 | | echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date ) : date( 'D, d M Y H:i:s +0000' ); |
21 | | ?> |
22 | | </lastBuildDate> |
| 17 | <lastBuildDate><?php echo get_feed_build_date( 'D, d M Y H:i:s +0000' ); ?></lastBuildDate> |
23 | 18 | <docs>http://backend.userland.com/rss092</docs> |
24 | 19 | <language><?php bloginfo_rss( 'language' ); ?></language> |
25 | 20 | |
diff --git src/wp-includes/feed-rss2-comments.php src/wp-includes/feed-rss2-comments.php
index c736bebccd..f8ba016b23 100644
|
|
do_action( 'rss_tag_pre', 'rss2-comments' ); |
49 | 49 | <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
50 | 50 | <link><?php ( is_single() ) ? the_permalink_rss() : bloginfo_rss( 'url' ); ?></link> |
51 | 51 | <description><?php bloginfo_rss( 'description' ); ?></description> |
52 | | <lastBuildDate> |
53 | | <?php |
54 | | $date = get_last_build_date(); |
55 | | echo $date ? mysql2date( 'r', $date, false ) : date( 'r' ); |
56 | | ?> |
57 | | </lastBuildDate> |
| 52 | <lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> |
58 | 53 | <sy:updatePeriod> |
59 | 54 | <?php |
60 | 55 | /** This filter is documented in wp-includes/feed-rss2.php */ |
diff --git src/wp-includes/feed-rss2.php src/wp-includes/feed-rss2.php
index d7ddccabe0..1ba7707561 100644
|
|
do_action( 'rss_tag_pre', 'rss2' ); |
42 | 42 | <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
43 | 43 | <link><?php bloginfo_rss( 'url' ); ?></link> |
44 | 44 | <description><?php bloginfo_rss( 'description' ); ?></description> |
45 | | <lastBuildDate> |
46 | | <?php |
47 | | $date = get_last_build_date(); |
48 | | echo $date ? mysql2date( 'r', $date, false ) : date( 'r' ); |
49 | | ?> |
50 | | </lastBuildDate> |
| 45 | <lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> |
51 | 46 | <language><?php bloginfo_rss( 'language' ); ?></language> |
52 | 47 | <sy:updatePeriod> |
53 | 48 | <?php |
diff --git src/wp-includes/feed.php src/wp-includes/feed.php
index f8662b3055..c5348a3398 100644
|
|
function self_link() { |
638 | 638 | } |
639 | 639 | |
640 | 640 | /* |
641 | | * Get the timestamp of the most recently modified post from WP_Query. |
642 | | * |
643 | | * If viewing a comment feed, the date of the most recently modified |
644 | | * comment will be returned. |
645 | | * |
646 | | * @global WP_Query $wp_query The global WP_Query object. |
647 | | * |
648 | | * @since 5.2.0 |
649 | | * |
650 | | * @return string The timestamp. |
651 | | */ |
652 | | function get_last_build_date() { |
| 641 | * Get the timestamp of the most recently modified post from WP_Query. |
| 642 | * |
| 643 | * If viewing a comment feed, the date of the most recently modified |
| 644 | * comment will be returned. |
| 645 | * |
| 646 | * @global WP_Query $wp_query The global WP_Query object. |
| 647 | * |
| 648 | * @since 5.2.0 |
| 649 | * |
| 650 | * @param string $format Format of the date to return, passed to mysql2date. |
| 651 | * |
| 652 | * @return string The timestamp. |
| 653 | */ |
| 654 | function get_feed_build_date( $format ) { |
653 | 655 | global $wp_query; |
654 | 656 | |
655 | 657 | if ( empty( $wp_query ) || ! $wp_query->have_posts() ) { |
… |
… |
function get_last_build_date() { |
669 | 671 | $modified_times = array_merge( $modified_times, $comment_times ); |
670 | 672 | } |
671 | 673 | |
672 | | // Determine the maximum modified time. |
673 | | $max_modified_time = max( $modified_times ); |
| 674 | if ( empty( $modified_times ) ) { |
| 675 | $max_modified_time = date( $format ); |
| 676 | } else { |
| 677 | // Determine the maximum modified time. |
| 678 | $max_modified_time = max( |
| 679 | array_map( |
| 680 | function ( $time ) { |
| 681 | return mysql2date( $format, $time, false ); |
| 682 | }, |
| 683 | $modified_times |
| 684 | ) |
| 685 | ); |
| 686 | } |
674 | 687 | |
675 | 688 | /** |
676 | 689 | * Filters the date the last post or comment in the query was modified. |
677 | 690 | * |
678 | 691 | * @since 5.2.0 |
679 | 692 | * |
680 | | * @param string $max_modified_times Date the last post or comment was modified in the query. |
| 693 | * @param string $max_modified_time Date the last post or comment was modified in the query. |
| 694 | * @param string $format The date format requested in get_feed_build_date. |
681 | 695 | */ |
682 | | return apply_filters( 'get_last_build_date', $max_modified_time ); |
| 696 | return apply_filters( 'get_feed_build_date', $max_modified_time, $format ); |
683 | 697 | } |
684 | 698 | |
685 | 699 | /** |