Ticket #15405: XMLRPCpostformats.2.diff
| File XMLRPCpostformats.2.diff, 3.5 KB (added by ericmann, 3 years ago) |
|---|
-
class-wp-xmlrpc-server.php
63 63 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList', 64 64 'wp.getMediaItem' => 'this:wp_getMediaItem', 65 65 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', 66 'wp.getPostFormats' => 'this:wp_getPostFormats', 66 67 67 68 // Blogger API 68 69 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', … … 1602 1603 return $attachments_struct; 1603 1604 } 1604 1605 1606 /** 1607 * Retrives a list of post formats used by the site 1608 * 1609 * @since 3.1.0 1610 * 1611 * @param array $args Method parameters. Contains: 1612 * - blog_id 1613 * - username 1614 * - password 1615 * @return array 1616 */ 1617 function wp_getPostFormats($args) { 1618 $this->escape($args); 1619 1620 $blog_ID = (int) $args[0]; // we will support this in the near future 1621 $username = $args[1]; 1622 $password = $args[2]; 1623 1624 if ( !$user = $this->login($username, $password) ) 1625 return $this->error; 1626 1627 do_action('xmlrpc_call', 'wp.getPostFormats'); 1628 1629 $strings = get_post_format_strings(); 1630 1631 return $strings; 1632 } 1633 1605 1634 /* Blogger API functions. 1606 1635 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ 1607 1636 */ … … 2266 2301 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2267 2302 2268 2303 $this->attach_uploads( $post_ID, $post_content ); 2304 2305 // Handle post formats if assigned 2306 if ( isset($content_struct["wp_post_format"]) ) { 2307 $format = sanitize_key( $content_struct["wp_post_format"] ); 2308 wp_set_post_terms( $post_ID, array('post-format-' . $format), 'post_format' ); 2309 } 2269 2310 2270 2311 logIO('O', "Posted ! ID: $post_ID"); 2271 2312 … … 2552 2593 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2553 2594 2554 2595 $this->attach_uploads( $ID, $post_content ); 2596 2597 // Handle post formats if assigned 2598 if ( isset($content_struct["wp_post_format"]) ) { 2599 $format = sanitize_key( $content_struct["wp_post_format"] ); 2600 wp_set_post_terms( $post_ID, array('post-format-' . $format), 'post_format' ); 2601 } 2555 2602 2556 2603 logIO('O',"(MW) Edited ! ID: $post_ID"); 2557 2604 … … 2619 2666 // Consider future posts as published 2620 2667 if ( $postdata['post_status'] === 'future' ) 2621 2668 $postdata['post_status'] = 'publish'; 2669 2670 // Get post format 2671 $post_format = get_post_format( $post_ID ); 2622 2672 2623 2673 $sticky = false; 2624 2674 if ( is_sticky( $post_ID ) ) … … 2660 2710 'date_created_gmt' => new IXR_Date($post_date_gmt), 2661 2711 'post_status' => $postdata['post_status'], 2662 2712 'custom_fields' => $this->get_custom_fields($post_ID), 2713 'wp_post_format' => $post_format, 2663 2714 'sticky' => $sticky 2664 2715 ); 2665 2716 … … 2740 2791 // Consider future posts as published 2741 2792 if ( $entry['post_status'] === 'future' ) 2742 2793 $entry['post_status'] = 'publish'; 2794 2795 // Get post format 2796 $post_format = get_post_format( $entry['ID'] ); 2743 2797 2744 2798 $struct[] = array( 2745 2799 'dateCreated' => new IXR_Date($post_date), … … 2763 2817 'wp_author_display_name' => $author->display_name, 2764 2818 'date_created_gmt' => new IXR_Date($post_date_gmt), 2765 2819 'post_status' => $entry['post_status'], 2766 'custom_fields' => $this->get_custom_fields($entry['ID']) 2820 'custom_fields' => $this->get_custom_fields($entry['ID']), 2821 'wp_post_format' => $post_format 2767 2822 ); 2768 2823 2769 2824 }
