Expose the post modified date (in blog TZ and GMT) via XML-RPC

Props ocollet
Fixes #19027


git-svn-id: https://develop.svn.wordpress.org/trunk@19883 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joseph Scott 2012-02-08 23:25:11 +00:00
parent 8d80cff84d
commit 42ed9afd4c
1 changed files with 16 additions and 4 deletions

View File

@ -3392,10 +3392,14 @@ class wp_xmlrpc_server extends IXR_Server {
if ($postdata['post_date'] != '') { if ($postdata['post_date'] != '') {
$post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false); $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false); $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
$post_modified = mysql2date('Ymd\TH:i:s', $postdata['post_modified'], false);
$post_modified_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_modified_gmt'], false);
// For drafts use the GMT version of the post date // For drafts use the GMT version of the post date
if ( $postdata['post_status'] == 'draft' ) if ( $postdata['post_status'] == 'draft' ) {
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' ); $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
$post_modified_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_modified'] ), 'Ymd\TH:i:s' );
}
$categories = array(); $categories = array();
$catids = wp_get_post_categories($post_ID); $catids = wp_get_post_categories($post_ID);
@ -3471,7 +3475,9 @@ class wp_xmlrpc_server extends IXR_Server {
'post_status' => $postdata['post_status'], 'post_status' => $postdata['post_status'],
'custom_fields' => $this->get_custom_fields($post_ID), 'custom_fields' => $this->get_custom_fields($post_ID),
'wp_post_format' => $post_format, 'wp_post_format' => $post_format,
'sticky' => $sticky 'sticky' => $sticky,
'date_modified' => new IXR_Date( $post_modified ),
'date_modified_gmt' => new IXR_Date( $post_modified_gmt )
); );
if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure; if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
@ -3518,10 +3524,14 @@ class wp_xmlrpc_server extends IXR_Server {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
$post_modified = mysql2date('Ymd\TH:i:s', $entry['post_modified'], false);
$post_modified_gmt = mysql2date('Ymd\TH:i:s', $entry['post_modified_gmt'], false);
// For drafts use the GMT version of the date // For drafts use the GMT version of the date
if ( $entry['post_status'] == 'draft' ) if ( $entry['post_status'] == 'draft' ) {
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
$post_modified_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_modified'] ), 'Ymd\TH:i:s' );
}
$categories = array(); $categories = array();
$catids = wp_get_post_categories($entry['ID']); $catids = wp_get_post_categories($entry['ID']);
@ -3580,7 +3590,9 @@ class wp_xmlrpc_server extends IXR_Server {
'date_created_gmt' => new IXR_Date($post_date_gmt), 'date_created_gmt' => new IXR_Date($post_date_gmt),
'post_status' => $entry['post_status'], 'post_status' => $entry['post_status'],
'custom_fields' => $this->get_custom_fields($entry['ID']), 'custom_fields' => $this->get_custom_fields($entry['ID']),
'wp_post_format' => $post_format 'wp_post_format' => $post_format,
'date_modified' => new IXR_Date( $post_modified ),
'date_modified_gmt' => new IXR_Date( $post_modified_gmt )
); );
} }