Changeset 16484
- Timestamp:
- 11/19/2010 01:57:05 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r16438 r16484 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 … … 1602 1603 return $attachments_struct; 1603 1604 } 1605 1606 /** 1607 * Retrives a list of post formats used by the site 1608 * 1609 * @since 3.1 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]; 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 return get_post_format_strings(); 1629 } 1604 1630 1605 1631 /* Blogger API functions. … … 2083 2109 if ( !current_user_can( $cap ) ) 2084 2110 return new IXR_Error( 401, $error_message ); 2111 2112 // Check for a valid post format if one was given 2113 if ( isset( $content_struct['wp_post_format'] ) ) { 2114 $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); 2115 if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { 2116 return new IXR_Error( 404, __( 'Invalid post format' ) ); 2117 } 2118 } 2085 2119 2086 2120 // Let WordPress generate the post_name (slug) unless … … 2267 2301 2268 2302 $this->attach_uploads( $post_ID, $post_content ); 2303 2304 // Handle post formats if assigned, value is validated earlier 2305 // in this function 2306 if ( isset( $content_struct['wp_post_format'] ) ) 2307 wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); 2269 2308 2270 2309 logIO('O', "Posted ! ID: $post_ID"); … … 2358 2397 if ( !current_user_can( $cap ) ) 2359 2398 return new IXR_Error( 401, $error_message ); 2399 2400 // Check for a valid post format if one was given 2401 if ( isset( $content_struct['wp_post_format'] ) ) { 2402 $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); 2403 if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { 2404 return new IXR_Error( 404, __( 'Invalid post format' ) ); 2405 } 2406 } 2360 2407 2361 2408 $postdata = wp_get_single_post($post_ID, ARRAY_A); … … 2553 2600 2554 2601 $this->attach_uploads( $ID, $post_content ); 2602 2603 // Handle post formats if assigned, validation is handled 2604 // earlier in this function 2605 if ( isset( $content_struct['wp_post_format'] ) ) 2606 wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); 2555 2607 2556 2608 logIO('O',"(MW) Edited ! ID: $post_ID"); … … 2620 2672 if ( $postdata['post_status'] === 'future' ) 2621 2673 $postdata['post_status'] = 'publish'; 2674 2675 // Get post format 2676 $post_format = get_post_format( $post_ID ); 2677 if ( empty( $post_format ) ) 2678 $post_format = 'default'; 2622 2679 2623 2680 $sticky = false; … … 2661 2718 'post_status' => $postdata['post_status'], 2662 2719 'custom_fields' => $this->get_custom_fields($post_ID), 2720 'wp_post_format' => $post_format, 2663 2721 'sticky' => $sticky 2664 2722 ); … … 2741 2799 if ( $entry['post_status'] === 'future' ) 2742 2800 $entry['post_status'] = 'publish'; 2801 2802 // Get post format 2803 $post_format = get_post_format( $entry['ID'] ); 2804 if ( empty( $post_format ) ) 2805 $post_format = 'default'; 2743 2806 2744 2807 $struct[] = array( … … 2764 2827 'date_created_gmt' => new IXR_Date($post_date_gmt), 2765 2828 'post_status' => $entry['post_status'], 2766 'custom_fields' => $this->get_custom_fields($entry['ID']) 2829 'custom_fields' => $this->get_custom_fields($entry['ID']), 2830 'wp_post_format' => $post_format 2767 2831 ); 2768 2832
Note: See TracChangeset
for help on using the changeset viewer.