Changeset 20153
- Timestamp:
- 03/08/2012 11:19:53 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r20137 r20153 517 517 518 518 /** 519 * Convert a WordPress date string to an IXR_Date object. 520 * 521 * @access protected 522 * 523 * @param $date 524 * @return IXR_Date 525 */ 526 protected function _convert_date( $date ) { 527 if ( $date === '0000-00-00 00:00:00' ) { 528 return new IXR_Date( '00000000T00:00:00Z' ); 529 } 530 return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) ); 531 } 532 533 /** 519 534 * Prepares post data for return in an XML-RPC object. 520 535 * … … 527 542 protected function _prepare_post( $post, $fields ) { 528 543 // holds the data for this post. built up based on $fields 529 $_post = array( 'post_id' => $post['ID']);544 $_post = array( 'post_id' => strval( $post['ID'] ) ); 530 545 531 546 // prepare common post fields 532 547 $post_fields = array( 533 548 'post_title' => $post['post_title'], 534 'post_date' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_date'], false )),535 'post_date_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_date_gmt'], false )),536 'post_modified' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_modified'], false )),537 'post_modified_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_modified_gmt'], false )),549 'post_date' => $this->_convert_date( $post['post_date'] ), 550 'post_date_gmt' => $this->_convert_date( $post['post_date_gmt'] ), 551 'post_modified' => $this->_convert_date( $post['post_modified'] ), 552 'post_modified_gmt' => $this->_convert_date( $post['post_modified_gmt'] ), 538 553 'post_status' => $post['post_status'], 539 554 'post_type' => $post['post_type'], … … 930 945 931 946 // convert the date field back to IXR form 932 $post['post_date'] = new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_date'], false ));947 $post['post_date'] = $this->_convert_date( $post['post_date'] ); 933 948 934 949 // ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct, … … 937 952 unset( $post['post_date_gmt'] ); 938 953 else 939 $post['post_date_gmt'] = new IXR_Date( mysql2date( 'Ymd\TH:i:s', $post['post_date_gmt'], false ));954 $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); 940 955 941 956 $this->escape( $post );
Note: See TracChangeset
for help on using the changeset viewer.