<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20632] trunk/wp-includes/class-wp-xmlrpc-server.php: Clean up the XML-RPC 3.4 methods with regards to consistency and future compatibility.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20632">20632</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-04-28 18:48:10 +0000 (Sat, 28 Apr 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean up the XML-RPC 3.4 methods with regards to consistency and future compatibility.
 * Limit returned taxonomy and post type objects to a specific type-cast whitelist of fields.
 * Add $filter and $fields to wp.getTaxonomies to match the functionality of wp.getPostTypes.
 * Prevent the post type from being chnaged in _insert_post().
 * Don't check post_type_supports() in _insert_post().
 * Align handling of sticky posts with those of core.
 * Force tags and categories to go through terms and terms_names, rather than tags_input and post_category.
fixes <a href="http://core.trac.wordpress.org/ticket/20566">#20566</a>. props nacin, maxcutler.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpxmlrpcserverphp">trunk/wp-includes/class-wp-xmlrpc-server.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-xmlrpc-server.php (20631 => 20632)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-xmlrpc-server.php        2012-04-27 23:13:39 UTC (rev 20631)
+++ trunk/wp-includes/class-wp-xmlrpc-server.php        2012-04-28 18:48:10 UTC (rev 20632)
</span><span class="lines">@@ -495,15 +495,29 @@
</span><span class="cx">          *
</span><span class="cx">          * @access protected
</span><span class="cx">          *
</span><del>-         * @param array|object $taxonomy The unprepared taxonomy data
</del><ins>+         * @param object $taxonomy The unprepared taxonomy data
</ins><span class="cx">          * @return array The prepared taxonomy data
</span><span class="cx">          */
</span><del>-        protected function _prepare_taxonomy( $taxonomy ) {
-                $_taxonomy = (array) $taxonomy;
</del><ins>+        protected function _prepare_taxonomy( $taxonomy, $fields ) {
+                $_taxonomy = array(
+                        'name' =&gt; $taxonmy-&gt;name,
+                        'label' =&gt; $taxonomy-&gt;label,
+                        'hierarchical' =&gt; (bool) $taxonomy-&gt;hierarchical,
+                        'public' =&gt; (bool) $taxonomy-&gt;public,
+                        'show_ui' =&gt; (bool) $taxonomy-&gt;show_ui,
+                        '_builtin' =&gt; (bool) $taxnomy-&gt;_builtin,
+                );
</ins><span class="cx"> 
</span><del>-                unset( $_taxonomy['update_count_callback'] );
</del><ins>+                if ( in_array( 'labels', $fields ) )
+                        $_taxonomy['labels'] = (array) $taxonomy-&gt;labels;
</ins><span class="cx"> 
</span><del>-                return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy );
</del><ins>+                if ( in_array( 'capabilities', $fields ) )
+                        $_taxonomy['cap'] = (array) $post_type-&gt;cap;
+
+                if ( in_array( 'object_types', $fields ) )
+                        $_taxonomy['taxonomies'] = array_unique( (array) $taxonomy-&gt;object_type );
+
+                return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -652,54 +666,39 @@
</span><span class="cx">          *
</span><span class="cx">          * @access protected
</span><span class="cx">          *
</span><del>-         * @param array|object $post_type The unprepared post type data
</del><ins>+         * @param object $post_type Post type object
</ins><span class="cx">          * @param array $fields The subset of post fields to return
</span><span class="cx">          * @return array The prepared post type data
</span><span class="cx">          */
</span><del>-        protected function _prepare_post_type( $post_type, $fields ) {
-                $post_type = (array) $post_type;
-
</del><ins>+        public function _prepare_post_type( $post_type, $fields ) {
</ins><span class="cx">                 $_post_type = array(
</span><del>-                        'name' =&gt; $post_type['name'],
-                        'label' =&gt; $post_type['label'],
-                        'description' =&gt; $post_type['description'],
-                        'hierarchical' =&gt; $post_type['hierarchical'],
-                        'public' =&gt; $post_type['public'],
-                        '_builtin' =&gt; $post_type['_builtin'],
-                        'supports' =&gt; get_all_post_type_supports( $post_type['name'] )
</del><ins>+                        'name' =&gt; $post_type-&gt;name,
+                        'label' =&gt; $post_type-&gt;label,
+                        'hierarchical' =&gt; (bool) $post_type-&gt;hierarchical,
+                        'public' =&gt; (bool) $post_type-&gt;public,
+                        'show_ui' =&gt; (bool) $post_type-&gt;show_ui,
+                        '_builtin' =&gt; (bool) $post_type-&gt;_builtin,
+                        'has_archive' =&gt; (bool) $post_type-&gt;has_archive,
+                        'supports' =&gt; get_all_post_type_supports( $post_type-&gt;name ),
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 if ( in_array( 'labels', $fields ) ) {
</span><del>-                        $_post_type['labels'] = (array) $post_type['labels'];
</del><ins>+                        $_post_type['labels'] = (array) $post_type-&gt;labels;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( in_array( 'capabilities', $fields ) ) {
</span><del>-                        $_post_type['cap'] = (array) $post_type['cap'];
-                        $_post_type['capability_type'] = $post_type['capability_type'];
-                        $_post_type['map_meta_cap'] = $post_type['map_meta_cap'];
</del><ins>+                        $_post_type['cap'] = (array) $post_type-&gt;cap;
+                        $_post_type['map_meta_cap'] = (bool) $post_type-&gt;map_meta_cap;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( in_array( 'admin', $fields ) ) {
-                        $_post_type['publicly_queryable'] = $post_type['publicly_queryable'];
-                        $_post_type['exclude_from_search'] = $post_type['exclude_from_search'];
-                        $_post_type['_edit_link'] = $post_type['_edit_link'];
-                        $_post_type['rewrite'] = $post_type['rewrite'];
-                        $_post_type['has_archive'] = $post_type['has_archive'];
-                        $_post_type['query_var'] = $post_type['query_var'];
-                }
-
</del><span class="cx">                 if ( in_array( 'menu', $fields ) ) {
</span><del>-                        $_post_type['show_ui'] = $post_type['show_ui'];
-                        $_post_type['menu_position'] = $post_type['menu_position'];
-                        $_post_type['menu_icon'] = $post_type['menu_icon'];
-                        $_post_type['show_in_nav_menus'] = $post_type['show_in_nav_menus'];
-                        $_post_type['show_in_menu'] = $post_type['show_in_menu'];
-                        $_post_type['show_in_admin_bar'] = $post_type['show_in_admin_bar'];
</del><ins>+                        $_post_type['menu_position'] = (int) $post_type-&gt;menu_position;
+                        $_post_type['menu_icon'] = $post_type-&gt;menu_icon;
+                        $_post_type['show_in_menu'] = (bool) $post_type-&gt;show_in_menu;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( in_array( 'taxonomies', $fields ) ) {
-                        $_post_type['taxonomies'] = get_object_taxonomies( $_post_type['name'] );
-                }
</del><ins>+                if ( in_array( 'taxonomies', $fields ) )
+                        $_post_type['taxonomies'] = get_object_taxonomies( $_post_type-&gt;name, 'names' );
</ins><span class="cx"> 
</span><span class="cx">                 return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );
</span><span class="cx">         }
</span><span class="lines">@@ -737,6 +736,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Create a new post for any registered post type.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses wp_insert_post()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -784,31 +785,35 @@
</span><span class="cx"> 
</span><span class="cx">         /*
</span><span class="cx">          * Helper method for filtering out elements from an array.
</span><ins>+         *
+         * @since 3.4.0
</ins><span class="cx">          */
</span><del>-        function _is_greater_than_one( $count ){
</del><ins>+        function _is_greater_than_one( $count ) {
</ins><span class="cx">                 return $count &gt; 1;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /*
</span><span class="cx">          * Helper method for wp_newPost and wp_editPost, containing shared logic.
</span><ins>+         *
+         * @since 3.4.0
</ins><span class="cx">          */
</span><del>-        function _insert_post( $user, $content_struct ) {
</del><ins>+        protected function _insert_post( $user, $content_struct ) {
</ins><span class="cx">                 $defaults = array( 'post_status' =&gt; 'draft', 'post_type' =&gt; 'post', 'post_author' =&gt; 0,
</span><del>-                        'post_password' =&gt; '', 'post_excerpt' =&gt; '', 'post_content' =&gt; '', 'post_title' =&gt; '', 'sticky' =&gt; 0 );
</del><ins>+                        'post_password' =&gt; '', 'post_excerpt' =&gt; '', 'post_content' =&gt; '', 'post_title' =&gt; '' );
</ins><span class="cx"> 
</span><span class="cx">                 $post_data = wp_parse_args( $content_struct, $defaults );
</span><span class="cx"> 
</span><span class="cx">                 $post_type = get_post_type_object( $post_data['post_type'] );
</span><del>-                if ( ! ( (bool) $post_type ) )
</del><ins>+                if ( ! $post_type )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'Invalid post type' ) );
</span><span class="cx"> 
</span><del>-                $update = false;
-                if ( ! empty( $post_data[ 'ID' ] ) )
-                        $update = true;
</del><ins>+                $update = ! empty( $post_data['ID'] );
</ins><span class="cx"> 
</span><span class="cx">                 if ( $update ) {
</span><del>-                        if ( ! current_user_can( $post_type-&gt;cap-&gt;edit_post, $post_data[ 'ID' ] ) )
</del><ins>+                        if ( ! current_user_can( $post_type-&gt;cap-&gt;edit_post, $post_data['ID'] ) )
</ins><span class="cx">                                 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
</span><ins>+                        if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
+                                return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
</ins><span class="cx">                 } else {
</span><span class="cx">                         if ( ! current_user_can( $post_type-&gt;cap-&gt;edit_posts ) )
</span><span class="cx">                                 return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
</span><span class="lines">@@ -820,12 +825,12 @@
</span><span class="cx">                                 break;
</span><span class="cx">                         case 'private':
</span><span class="cx">                                 if ( ! current_user_can( $post_type-&gt;cap-&gt;publish_posts ) )
</span><del>-                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ));
</del><ins>+                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case 'publish':
</span><span class="cx">                         case 'future':
</span><span class="cx">                                 if ( ! current_user_can( $post_type-&gt;cap-&gt;publish_posts ) )
</span><del>-                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ));
</del><ins>+                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
</ins><span class="cx">                                 break;
</span><span class="cx">                         default:
</span><span class="cx">                                 $post_data['post_status'] = 'draft';
</span><span class="lines">@@ -848,22 +853,16 @@
</span><span class="cx">                         $post_data['post_author'] = $user-&gt;ID;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( isset( $post_data['comment_status'] ) ) {
-                        if ( ! post_type_supports( $post_data['post_type'], 'comments' ) || ( $post_data['comment_status'] != 'open' &amp;&amp; $post_data['comment_status'] != 'closed' ) ) {
-                                unset( $post_data['comment_status'] );
-                        }
-                }
</del><ins>+                if ( isset( $post_data['comment_status'] ) &amp;&amp; $post_data['comment_status'] != 'open' &amp;&amp; $post_data['comment_status'] != 'closed' )
+                        unset( $post_data['comment_status'] );
</ins><span class="cx"> 
</span><del>-                if ( isset( $post_data['ping_status'] ) ) {
-                        if ( ! post_type_supports( $post_data['post_type'], 'trackbacks' ) || ( $post_data['ping_status'] != 'open' &amp;&amp; $post_data['ping_status'] != 'closed' ) ) {
-                                unset( $post_data['ping_status'] );
-                        }
-                }
</del><ins>+                if ( isset( $post_data['ping_status'] ) &amp;&amp; $post_data['ping_status'] != 'open' &amp;&amp; $post_data['ping_status'] != 'closed' )
+                        unset( $post_data['ping_status'] );
</ins><span class="cx"> 
</span><span class="cx">                 // Do some timestamp voodoo
</span><span class="cx">                 if ( ! empty( $post_data['post_date_gmt'] ) ) {
</span><span class="cx">                         // We know this is supposed to be GMT, so we're going to slap that Z on there by force
</span><del>-                        $dateCreated = str_replace( 'Z', '', $post_data['post_date_gmt']-&gt;getIso() ) . 'Z';
</del><ins>+                        $dateCreated = rtrim( $post_data['post_date_gmt']-&gt;getIso(), 'Z' ) . 'Z';
</ins><span class="cx">                 } elseif ( ! empty( $post_data['post_date'] ) ) {
</span><span class="cx">                         $dateCreated = $post_data['post_date']-&gt;getIso();
</span><span class="cx">                 }
</span><span class="lines">@@ -873,38 +872,39 @@
</span><span class="cx">                         $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( ! isset( $post_data['ID'] ) ) {
</del><ins>+                if ( ! isset( $post_data['ID'] ) )
</ins><span class="cx">                         $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )-&gt;ID;
</span><del>-                }
</del><span class="cx">                 $post_ID = $post_data['ID'];
</span><span class="cx"> 
</span><del>-                $sticky = $post_data['sticky'] ? true : false;
-
-                if ( $post_data['post_type'] == 'post' &amp;&amp; $sticky == true ) {
-                        if ( ! current_user_can( $post_type-&gt;cap-&gt;edit_others_posts ) )
-                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
-
-                        if ( $post_data['post_status'] != 'publish' )
-                                return new IXR_Error( 401, __( 'Only published posts can be made sticky.' ) );
-
-                        stick_post( $post_ID );
</del><ins>+                if ( $post_data['post_type'] == 'post' ) {
+                        // Private and password-protected posts cannot be stickied.
+                        if ( $post_data['status'] == 'private' || ! empty( $post_data['post_password'] ) ) {
+                                // Error if the client tried to stick the post, otherwise, silently unstick.
+                                if ( ! empty( $post_data['sticky'] ) )
+                                        return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
+                                if ( $update )
+                                        unstick_post( $post_ID );
+                        } elseif ( isset( $post_data['sticky'] ) )  {
+                                if ( ! current_user_can( $post_type-&gt;cap-&gt;edit_others_posts ) )
+                                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
+                                if ( $post_data['sticky'] )
+                                        stick_post( $post_ID );
+                                else
+                                        unstick_post( $post_ID );
+                        }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( isset ( $post_data['post_thumbnail'] ) ) {
</del><ins>+                if ( isset( $post_data['post_thumbnail'] ) ) {
</ins><span class="cx">                         // empty value deletes, non-empty value adds/updates
</span><del>-                        if ( empty( $post_data['post_thumbnail'] ) ) {
</del><ins>+                        if ( ! $post_data['post_thumbnail'] )
</ins><span class="cx">                                 delete_post_thumbnail( $post_ID );
</span><del>-                        }
-                        else {
-                                if ( set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) === false )
</del><ins>+                        elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) )
</ins><span class="cx">                                         return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
</span><del>-                        }
</del><span class="cx">                         unset( $content_struct['post_thumbnail'] );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( isset ( $post_data['custom_fields'] ) &amp;&amp; post_type_supports( $post_data['post_type'], 'custom-fields' ) ) {
</del><ins>+                if ( isset( $post_data['custom_fields'] ) )
</ins><span class="cx">                         $this-&gt;set_custom_fields( $post_ID, $post_data['custom_fields'] );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
</span><span class="cx">                         $post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' );
</span><span class="lines">@@ -987,11 +987,10 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         $post_data['tax_input'] = $terms;
</span><del>-                        unset( $post_data['terms'] );
-                        unset( $post_data['terms_names'] );
</del><ins>+                        unset( $post_data['terms'], $post_data['terms_names'] );
</ins><span class="cx">                 } else {
</span><span class="cx">                         // do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
</span><del>-                        unset( $post_data['tax_input'] );
</del><ins>+                        unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( isset( $post_data['post_format'] ) ) {
</span><span class="lines">@@ -1024,6 +1023,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Edit a post for any registered post type.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * The $content_struct parameter only needs to contain fields that
</span><span class="cx">          * should be changed. All other fields will retain their existing values.
</span><span class="cx">          *
</span><span class="lines">@@ -1039,7 +1040,7 @@
</span><span class="cx">         function wp_editPost( $args ) {
</span><span class="cx">                 $this-&gt;escape( $args );
</span><span class="cx"> 
</span><del>-                $blog_id        = (int) $args[0]; // we will support this in the near future
</del><ins>+                $blog_id        = (int) $args[0];
</ins><span class="cx">                 $username       = $args[1];
</span><span class="cx">                 $password       = $args[2];
</span><span class="cx">                 $post_id        = (int) $args[3];
</span><span class="lines">@@ -1050,11 +1051,9 @@
</span><span class="cx"> 
</span><span class="cx">                 do_action( 'xmlrpc_call', 'wp.editPost' );
</span><span class="cx"> 
</span><del>-                // User Capabilities are checked in _insert_post.
-
</del><span class="cx">                 $post = get_post( $post_id, ARRAY_A );
</span><span class="cx"> 
</span><del>-                if ( empty( $post[&quot;ID&quot;] ) )
</del><ins>+                if ( empty( $post['ID'] ) )
</ins><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx"> 
</span><span class="cx">                 // convert the date field back to IXR form
</span><span class="lines">@@ -1080,6 +1079,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Delete a post for any registered post type.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses wp_delete_post()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1120,6 +1121,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve a post.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * The optional $fields parameter specifies what fields will be included
</span><span class="cx">          * in the response array. This should be a list of field names. 'post_id' will
</span><span class="cx">          * always be included in the response regardless of the value of $fields.
</span><span class="lines">@@ -1179,7 +1182,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $post = wp_get_single_post( $post_id, ARRAY_A );
</span><span class="cx"> 
</span><del>-                if ( empty( $post[&quot;ID&quot;] ) )
</del><ins>+                if ( empty( $post['ID'] ) )
</ins><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx"> 
</span><span class="cx">                 $post_type = get_post_type_object( $post['post_type'] );
</span><span class="lines">@@ -1192,6 +1195,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve posts.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * The optional $filter parameter modifies the query used to retrieve posts.
</span><span class="cx">          * Accepted keys are 'post_type', 'post_status', 'number', 'offset',
</span><span class="cx">          * 'orderby', and 'order'.
</span><span class="lines">@@ -1209,7 +1214,7 @@
</span><span class="cx">          *  - string  $password
</span><span class="cx">          *  - array   $filter optional
</span><span class="cx">          *  - array   $fields optional
</span><del>-         * @return array cntains a collection of posts.
</del><ins>+         * @return array contains a collection of posts.
</ins><span class="cx">          */
</span><span class="cx">         function wp_getPosts( $args ) {
</span><span class="cx">                 $this-&gt;escape( $args );
</span><span class="lines">@@ -1280,6 +1285,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Create a new term.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses wp_insert_term()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1361,6 +1368,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Edit a term.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses wp_update_term()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1455,6 +1464,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Delete a term.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses wp_delete_term()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1508,6 +1519,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve a term.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses get_term()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1562,6 +1575,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve all terms for a taxonomy.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * The optional $filter parameter modifies the query used to retrieve terms.
</span><span class="cx">          * Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'.
</span><span class="cx">          *
</span><span class="lines">@@ -1636,6 +1651,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve a taxonomy.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses get_taxonomy()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1652,6 +1669,11 @@
</span><span class="cx">                 $password       = $args[2];
</span><span class="cx">                 $taxonomy       = $args[3];
</span><span class="cx"> 
</span><ins>+                if ( isset( $args[4] ) )
+                        $fields = $args[4];
+                else
+                        $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'capabilities', 'object_types' ), 'wp.getTaxonomy' );
+
</ins><span class="cx">                 if ( ! $user = $this-&gt;login( $username, $password ) )
</span><span class="cx">                         return $this-&gt;error;
</span><span class="cx"> 
</span><span class="lines">@@ -1665,12 +1687,14 @@
</span><span class="cx">                 if ( ! current_user_can( $taxonomy-&gt;cap-&gt;assign_terms ) )
</span><span class="cx">                         return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
</span><span class="cx"> 
</span><del>-                return $this-&gt;_prepare_taxonomy( $taxonomy );
</del><ins>+                return $this-&gt;_prepare_taxonomy( $taxonomy, $fields );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * Retrieve all taxonomies.
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses get_taxonomies()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -1684,13 +1708,19 @@
</span><span class="cx">                 $blog_id            = (int) $args[0];
</span><span class="cx">                 $username           = $args[1];
</span><span class="cx">                 $password           = $args[2];
</span><ins>+                $filter             = isset( $args[3] ) ? $args[3] : array( 'public' =&gt; true );
</ins><span class="cx"> 
</span><ins>+                if ( isset( $args[4] ) )
+                        $fields = $args[4];
+                else
+                        $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'capabilities', 'object_types' ), 'wp.getTaxonomies' );
+
</ins><span class="cx">                 if ( ! $user = $this-&gt;login( $username, $password ) )
</span><span class="cx">                         return $this-&gt;error;
</span><span class="cx"> 
</span><span class="cx">                 do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
</span><span class="cx"> 
</span><del>-                $taxonomies = get_taxonomies( array(), 'objects' );
</del><ins>+                $taxonomies = get_taxonomies( $filter, 'objects' );
</ins><span class="cx"> 
</span><span class="cx">                 // holds all the taxonomy data
</span><span class="cx">                 $struct = array();
</span><span class="lines">@@ -1700,7 +1730,7 @@
</span><span class="cx">                         if ( ! current_user_can( $taxonomy-&gt;cap-&gt;assign_terms ) )
</span><span class="cx">                                 continue;
</span><span class="cx"> 
</span><del>-                        $struct[] = $this-&gt;_prepare_taxonomy( $taxonomy );
</del><ins>+                        $struct[] = $this-&gt;_prepare_taxonomy( $taxonomy, $fields );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 return $struct;
</span><span class="lines">@@ -2063,7 +2093,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * Get list of all tags
</span><span class="cx">          *
</span><del>-         * @since 2.7
</del><ins>+         * @since 2.7.0
</ins><span class="cx">          *
</span><span class="cx">          * @param array $args Method parameters.
</span><span class="cx">          * @return array
</span><span class="lines">@@ -2469,7 +2499,8 @@
</span><span class="cx"> 
</span><span class="cx">                 // Do some timestamp voodoo
</span><span class="cx">                 if ( !empty( $content_struct['date_created_gmt'] ) ) {
</span><del>-                        $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']-&gt;getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
</del><ins>+                        // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+                        $dateCreated = rtrim( $post_data['post_date_gmt']-&gt;getIso(), 'Z' ) . 'Z';
</ins><span class="cx">                         $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
</span><span class="cx">                         $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
</span><span class="cx">                 }
</span><span class="lines">@@ -2957,6 +2988,8 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieves a post type
</span><span class="cx">          *
</span><ins>+         * @since 3.4.0
+         *
</ins><span class="cx">          * @uses get_post_type_object()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          *  - int     $blog_id
</span><span class="lines">@@ -2983,10 +3016,10 @@
</span><span class="cx">                 $password       = $args[2];
</span><span class="cx">                 $post_type_name = $args[3];
</span><span class="cx"> 
</span><del>-                if ( isset( $args[4] ) ) 
-                        $fields = $args[4]; 
-                else 
-                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostType' ); 
</del><ins>+                if ( isset( $args[4] ) )
+                        $fields = $args[4];
+                else
+                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostType' );
</ins><span class="cx"> 
</span><span class="cx">                 if ( !$user = $this-&gt;login( $username, $password ) )
</span><span class="cx">                         return $this-&gt;error;
</span><span class="lines">@@ -3007,7 +3040,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * Retrieves a post types
</span><span class="cx">          *
</span><del>-         * @access private
</del><ins>+         * @since 3.4.0
</ins><span class="cx">          *
</span><span class="cx">          * @uses get_post_types()
</span><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="lines">@@ -3024,12 +3057,12 @@
</span><span class="cx">                 $blog_id            = (int) $args[0];
</span><span class="cx">                 $username           = $args[1];
</span><span class="cx">                 $password           = $args[2];
</span><del>-                $filter             = isset( $args[3] ) ? $args[3] : array( 'public' =&gt; true ); 
</del><ins>+                $filter             = isset( $args[3] ) ? $args[3] : array( 'public' =&gt; true );
</ins><span class="cx"> 
</span><del>-                if ( isset( $args[4] ) ) 
-                        $fields = $args[4]; 
-                else 
-                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostTypes' ); 
</del><ins>+                if ( isset( $args[4] ) )
+                        $fields = $args[4];
+                else
+                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostTypes' );
</ins><span class="cx"> 
</span><span class="cx">                 if ( ! $user = $this-&gt;login( $username, $password ) )
</span><span class="cx">                         return $this-&gt;error;
</span><span class="lines">@@ -3529,7 +3562,7 @@
</span><span class="cx">         function mw_newPost($args) {
</span><span class="cx">                 $this-&gt;escape($args);
</span><span class="cx"> 
</span><del>-                $blog_ID     = (int) $args[0]; // we will support this in the near future
</del><ins>+                $blog_ID     = (int) $args[0];
</ins><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx">                 $content_struct = $args[3];
</span><span class="lines">@@ -3726,7 +3759,8 @@
</span><span class="cx"> 
</span><span class="cx">                 // Do some timestamp voodoo
</span><span class="cx">                 if ( !empty( $content_struct['date_created_gmt'] ) )
</span><del>-                        $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']-&gt;getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
</del><ins>+                        // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+                        $dateCreated = rtrim( $post_data['post_date_gmt']-&gt;getIso(), 'Z' ) . 'Z';
</ins><span class="cx">                 elseif ( !empty( $content_struct['dateCreated']) )
</span><span class="cx">                         $dateCreated = $content_struct['dateCreated']-&gt;getIso();
</span><span class="cx"> 
</span><span class="lines">@@ -4044,7 +4078,8 @@
</span><span class="cx"> 
</span><span class="cx">                 // Do some timestamp voodoo
</span><span class="cx">                 if ( !empty( $content_struct['date_created_gmt'] ) )
</span><del>-                        $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']-&gt;getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
</del><ins>+                        // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+                        $dateCreated = rtrim( $post_data['post_date_gmt']-&gt;getIso(), 'Z' ) . 'Z';
</ins><span class="cx">                 elseif ( !empty( $content_struct['dateCreated']) )
</span><span class="cx">                         $dateCreated = $content_struct['dateCreated']-&gt;getIso();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>