Make WordPress Core


Ignore:
Timestamp:
09/29/2015 04:04:16 AM (10 years ago)
Author:
wonderboymusic
Message:

XML-RPC: calculate the proper offset for GMT in wp.newPost, mw.newPost, and mw.editPost when post_date is set, wp.editComment when comment_date is set. post|comment_date is assumed to be GMT. This is only true if the timezone string for the site matches GMT.

Adds unit tests for each.

Props smerriman, justdaiv, wonderboymusic.
Fixes #30429.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r34603 r34681  
    13251325
    13261326        if ( ! empty( $dateCreated ) ) {
    1327             $post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
    1328             $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
     1327            $post_data['post_date'] = iso8601_to_datetime( $dateCreated );
     1328            $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
    13291329        }
    13301330
     
    33963396            // We know this is supposed to be GMT, so we're going to slap that Z on there by force
    33973397            $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
    3398             $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
    3399             $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
     3398            $comment_date = iso8601_to_datetime( $dateCreated );
     3399            $comment_date_gmt = get_gmt_from_date( $comment_date );
    34003400        }
    34013401
     
    49614961
    49624962        if ( !empty( $dateCreated ) ) {
    4963             $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
    4964             $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
     4963            $post_date = iso8601_to_datetime( $dateCreated );
     4964            $post_date_gmt = get_gmt_from_date( $post_date );
    49654965        } else {
    49664966            $post_date = '';
     
    53155315
    53165316        if ( !empty( $dateCreated ) ) {
    5317             $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
    5318             $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
     5317            $post_date = iso8601_to_datetime( $dateCreated );
     5318            $post_date_gmt = get_gmt_from_date( $post_date, 'GMT' );
    53195319        } else {
    53205320            $post_date     = $postdata['post_date'];
Note: See TracChangeset for help on using the changeset viewer.