Plugin Directory

Changeset 543520


Ignore:
Timestamp:
05/12/2012 08:40:19 PM (14 years ago)
Author:
maxcutler
Message:

Version 0.8 release.

Location:
xml-rpc-modernization/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • xml-rpc-modernization/trunk/class-wp-xmlrpc-server-ext.php

    r510787 r543520  
    33include_once( ABSPATH . WPINC . '/class-IXR.php' );
    44include_once( ABSPATH . WPINC . '/class-wp-xmlrpc-server.php' );
     5include_once( ABSPATH . WPINC . '/post-thumbnail-template.php' );
    56
    67class wp_xmlrpc_server_ext extends wp_xmlrpc_server {
     
    89    function __construct() {
    910        // hook filter to add the new methods after the existing ones are added in the parent constructor
    10         add_filter( 'xmlrpc_methods' , array( &$this, 'xmlrpc_methods' ) );
     11        add_filter( 'xmlrpc_methods' , array( &$this, 'wxm_xmlrpc_methods' ) );
     12
     13        // patch wp.uploadFile to return ID
     14        add_filter( 'wp_handle_upload', array( &$this, 'wxm_handle_upload' ) );
     15
     16        // add new options
     17        add_filter( 'xmlrpc_blog_options', array( &$this, 'wxm_blog_options' ) );
    1118
    1219        parent::__construct();
    1320    }
    1421
    15     function xmlrpc_methods( $methods ) {
     22    function wxm_xmlrpc_methods( $methods ) {
    1623        $new_methods = array();
    1724
     
    3037        $new_methods['wp.getPost']          = array( &$this, 'wp_getPost' );
    3138        $new_methods['wp.getPosts']         = array( &$this, 'wp_getPosts' );
    32         $new_methods['wp.getPostTerms']     = array( &$this, 'wp_getPostTerms' );
    33         $new_methods['wp.setPostTerms']     = array( &$this, 'wp_setPostTerms' );
    3439        $new_methods['wp.getPostType']      = array( &$this, 'wp_getPostType' );
    3540        $new_methods['wp.getPostTypes']     = array( &$this, 'wp_getPostTypes' );
     
    5156    }
    5257
     58    function __call( $method, $args ) {
     59        // depending on the version of WordPress, some methods in this class are already defined
     60        // by the parent class. to avoid overriding the core versions, all methods in this class are
     61        // namespaced. however, if the parent class is missing some methods, we intercept the call
     62        // here and instead pass to the namespaced plugin version.
     63        $wxm_method = 'wxm_' . ltrim( $method, "_" );
     64        if ( method_exists( $this, $wxm_method ) )
     65            return call_user_func_array( array( $this, $wxm_method ), $args );
     66
     67        throw new Exception ( 'Call to undefined class method: ' . $method );
     68    }
     69
     70    /**
     71     * Checks if the method received at least the minimum number of arguments.
     72     *
     73     * @param string|array $args Sanitize single string or array of strings.
     74     * @param int $count Minimum number of arguments.
     75     * @return boolean if $args contains at least $count arguments.
     76     */
     77    protected function wxm_minimum_args( $args, $count ) {
     78        if ( count( $args ) < $count ) {
     79            $this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
     80            return false;
     81        }
     82
     83        return true;
     84    }
     85
    5386    /**
    5487     * Prepares user data for return in an XML-RPC object.
     
    6093     * @return array The prepared user data
    6194     */
    62     protected function _prepare_user( $user, $fields ) {
     95    protected function wxm_prepare_user( $user, $fields ) {
    6396        $contact_methods = _wp_get_user_contactmethods();
    6497
     
    98131        }
    99132
    100         return apply_filters( 'xmlrpc__prepare_user', $_user, $user, $fields );
     133        return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields );
    101134    }
    102135
     
    109142     * @return IXR_Date
    110143     */
    111     protected function _convert_date( $date ) {
     144    protected function wxm_convert_date( $date ) {
    112145        if ( $date === '0000-00-00 00:00:00' ) {
    113146            return new IXR_Date( '00000000T00:00:00Z' );
     
    117150
    118151    /**
     152     * Convert a WordPress gmt date string to an IXR_Date object.
     153     *
     154     * @access protected
     155     *
     156     * @param $date
     157     * @return IXR_Date
     158     */
     159    protected function wxm_convert_date_gmt( $date_gmt, $date ) {
     160        if ( $date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00' ) {
     161            return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) );
     162        }
     163        return $this->_convert_date( $date_gmt );
     164    }
     165
     166    /**
    119167     * Prepares post data for return in an XML-RPC object.
    120168     *
     
    122170     *
    123171     * @param array $post The unprepared post data
    124      * @param array $fields The subset of post fields to return
     172     * @param array $fields The subset of post type fields to return
    125173     * @return array The prepared post data
    126174     */
    127     protected function _prepare_post( $post, $fields ) {
     175    protected function wxm_prepare_post( $post, $fields ) {
    128176        // holds the data for this post. built up based on $fields
    129177        $_post = array( 'post_id' => strval( $post['ID'] ) );
     
    133181            'post_title'        => $post['post_title'],
    134182            'post_date'         => $this->_convert_date( $post['post_date'] ),
    135             'post_date_gmt'     => $this->_convert_date( $post['post_date_gmt'] ),
     183            'post_date_gmt'     => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ),
    136184            'post_modified'     => $this->_convert_date( $post['post_modified'] ),
    137             'post_modified_gmt' => $this->_convert_date( $post['post_modified_gmt'] ),
     185            'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ),
    138186            'post_status'       => $post['post_status'],
    139187            'post_type'         => $post['post_type'],
     
    147195            'ping_status'       => $post['ping_status'],
    148196            'sticky'            => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ),
    149             'featured_image'    => get_post_meta( $post['ID'], '_thumbnail_id', true ),
    150197        );
     198
     199        // Thumbnail
     200        $post_fields['post_thumbnail'] = array();
     201        $thumbnail_id = get_post_thumbnail_id( $post['ID'] );
     202        if ( $thumbnail_id ) {
     203            $thumbnail_size = current_theme_supports('post-thumbnail') ? 'post-thumbnail' : 'thumbnail';
     204            $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size );
     205        }
    151206
    152207        // Consider future posts as published
     
    176231                $_post['terms'][] = $this->_prepare_term( $term );
    177232            }
    178         }
    179 
    180         // backward compatiblity
    181         if ( $all_taxonomy_fields || in_array( 'tags', $fields ) ) {
    182             $tagnames = array();
    183             $tags = wp_get_post_tags( $post['ID'] );
    184             if ( ! empty( $tags ) ) {
    185                 foreach ( $tags as $tag ) {
    186                     $tagnames[] = $tag->name;
    187                 }
    188                 $tagnames = implode( ', ', $tagnames );
    189             } else {
    190                 $tagnames = '';
    191             }
    192             $_post['tags'] = $tagnames;
    193         }
    194 
    195         // backward compatiblity
    196         if ( $all_taxonomy_fields || in_array( 'categories', $fields ) ) {
    197             $categories = array();
    198             $catids = wp_get_post_categories( $post['ID'] );
    199             foreach ( $catids as $catid ) {
    200                 $categories[] = get_cat_name( $catid );
    201             }
    202             $_post['categories'] = $categories;
    203233        }
    204234
     
    217247        }
    218248
    219         return apply_filters( 'xmlrpc__prepare_post', $_post, $post, $fields );
     249        return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
    220250    }
    221251
     
    224254     *
    225255     * @access protected
    226     .*
    227      * @param array|object $taxonomy The unprepared taxonomy data
     256     *
     257     * @param object $taxonomy The unprepared taxonomy data
     258     * @param array $fields The subset of taxonomy fields to return
    228259     * @return array The prepared taxonomy data
    229260     */
    230     protected function _prepare_taxonomy( $taxonomy ) {
    231         $_taxonomy = (array) $taxonomy;
    232 
    233         unset( $_taxonomy['update_count_callback'] );
    234 
    235         return apply_filters( 'xmlrpc__prepare_taxonomy', $_taxonomy, $taxonomy );
     261    protected function wxm_prepare_taxonomy( $taxonomy, $fields ) {
     262        $_taxonomy = array(
     263            'name' => $taxonomy->name,
     264            'label' => $taxonomy->label,
     265            'hierarchical' => (bool) $taxonomy->hierarchical,
     266            'public' => (bool) $taxonomy->public,
     267            'show_ui' => (bool) $taxonomy->show_ui,
     268            '_builtin' => (bool) $taxonomy->_builtin,
     269        );
     270
     271        if ( in_array( 'labels', $fields ) )
     272            $_taxonomy['labels'] = (array) $taxonomy->labels;
     273
     274        if ( in_array( 'cap', $fields ) )
     275            $_taxonomy['cap'] = (array) $taxonomy->cap;
     276
     277        if ( in_array( 'object_type', $fields ) )
     278            $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
     279
     280        return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
    236281    }
    237282
     
    240285     *
    241286     * @access protected
    242     .*
     287     *
    243288     * @param array|object $term The unprepared term data
    244289     * @return array The prepared term data
    245290     */
    246     protected function _prepare_term( $term ) {
     291    protected function wxm_prepare_term( $term ) {
    247292        $_term = $term;
    248293        if ( ! is_array( $_term) )
    249294            $_term = get_object_vars( $_term );
    250295
    251         return apply_filters( 'xmlrpc__prepare_term', $_term, $term );
    252     }
    253 
    254     /**
    255      * Prepares post type data for return in an XML-RPC object.
     296        // For Intergers which may be largeer than XMLRPC supports ensure we return strings.
     297        $_term['term_id'] = strval( $_term['term_id'] );
     298        $_term['term_group'] = strval( $_term['term_group'] );
     299        $_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] );
     300        $_term['parent'] = strval( $_term['parent'] );
     301
     302        // Count we are happy to return as an Integer because people really shouldn't use Terms that much.
     303        $_term['count'] = intval( $_term['count'] );
     304
     305        return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
     306    }
     307
     308    /**
     309     * Get all the post type features
     310     *
     311     * @param string $post_type The post type
     312     * @return array
     313     */
     314    private function wxm_get_all_post_type_supports( $post_type ) {
     315        if ( function_exists( 'get_all_post_type_supports' ) )
     316            return get_all_post_type_supports( $post_type );
     317
     318        global $_wp_post_type_features;
     319
     320        if ( isset( $_wp_post_type_features[$post_type] ) )
     321            return $_wp_post_type_features[$post_type];
     322
     323        return array();
     324    }
     325
     326    /**
     327     * Prepares post data for return in an XML-RPC object.
    256328     *
    257329     * @access protected
    258330     *
    259      * @param array|object $post_type The unprepared post type data
     331     * @param object $post_type Post type object
     332     * @param array $fields The subset of post fields to return
    260333     * @return array The prepared post type data
    261334     */
    262     protected function _prepare_post_type( $post_type ) {
    263         $_post_type = (array) $post_type;
    264 
    265         $_post_type['taxonomies'] = get_object_taxonomies( $_post_type['name'] );
    266 
    267         return apply_filters( 'xmlrpc__prepare_post_type', $_post_type, $post_type );
     335    protected function wxm_prepare_post_type( $post_type, $fields ) {
     336        $_post_type = array(
     337            'name' => $post_type->name,
     338            'label' => $post_type->label,
     339            'hierarchical' => (bool) $post_type->hierarchical,
     340            'public' => (bool) $post_type->public,
     341            'show_ui' => (bool) $post_type->show_ui,
     342            '_builtin' => (bool) $post_type->_builtin,
     343            'has_archive' => (bool) $post_type->has_archive,
     344            'supports' => $this->wxm_get_all_post_type_supports( $post_type->name ),
     345        );
     346
     347        if ( in_array( 'labels', $fields ) ) {
     348            $_post_type['labels'] = (array) $post_type->labels;
     349        }
     350
     351        if ( in_array( 'cap', $fields ) ) {
     352            $_post_type['cap'] = (array) $post_type->cap;
     353            $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap;
     354        }
     355
     356        if ( in_array( 'menu', $fields ) ) {
     357            $_post_type['menu_position'] = (int) $post_type->menu_position;
     358            $_post_type['menu_icon'] = $post_type->menu_icon;
     359            $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
     360        }
     361
     362        if ( in_array( 'taxonomies', $fields ) )
     363            $_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
     364
     365        return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );
     366    }
     367
     368    /**
     369     * Prepares media item data for return in an XML-RPC object.
     370     *
     371     * @access protected
     372     *
     373     * @param object $media_item The unprepared media item data
     374     * @param string $thumbnail_size The image size to use for the thumbnail URL
     375     * @return array The prepared media item data
     376     */
     377    protected function wxm_prepare_media_item( $media_item, $thumbnail_size='thumbnail' ) {
     378        $_media_item = array(
     379            'attachment_id'    => strval( $media_item->ID ),
     380            'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
     381            'parent'           => $media_item->post_parent,
     382            'link'             => wp_get_attachment_url( $media_item->ID ),
     383            'title'            => $media_item->post_title,
     384            'caption'          => $media_item->post_excerpt,
     385            'description'      => $media_item->post_content,
     386            'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
     387        );
     388
     389        $thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
     390        if ( $thumbnail_src )
     391            $_media_item['thumbnail'] = $thumbnail_src[0];
     392        else
     393            $_media_item['thumbnail'] = $_media_item['link'];
     394
     395        return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size );
    268396    }
    269397
     
    285413     *      - 'first_name'
    286414     *      - 'last_name'
    287      *      - 'website'
     415     *      - 'url'
     416     *      - 'display_name'
     417     *      - 'nickname'
     418     *      - 'nicename'
     419     *      - 'bio'
    288420     *  - boolean $send_mail optional. Defaults to false
    289421     * @return int user_id
    290422     */
    291     function wp_newUser( $args ) {
     423    function wxm_wp_newUser( $args ) {
     424        if ( ! $this->minimum_args( $args, 4 ) )
     425            return $this->error;
     426
    292427        $this->escape( $args );
    293428
     
    344479            $user_data['user_url'] = $content_struct['url'];
    345480
     481        if ( isset( $content_struct['display_name'] ) )
     482            $user_data['display_name'] = $content_struct['display_name'];
     483
     484        if ( isset( $content_struct['nickname'] ) )
     485            $user_data['nickname'] = $content_struct['nickname'];
     486
     487        if ( isset( $content_struct['nicename'] ) )
     488            $user_data['user_nicename'] = $content_struct['nicename'];
     489
     490        if ( isset( $content_struct['bio'] ) )
     491            $user_data['description'] = $content_struct['bio'];
     492
    346493        $user_id = wp_insert_user( $user_data );
    347494
     
    350497
    351498        if ( ! $user_id )
    352             return new IXR_Error( 500, __( 'Sorry, the new user failed.' ) );
     499            return new IXR_Error( 500, __( 'Sorry, the new user creation failed.' ) );
    353500
    354501        if ( $send_mail ) {
     
    375522     *      - 'website'
    376523     *      - 'role'
     524     *      - 'display_name'
    377525     *      - 'nickname'
    378526     *      - 'nicename'
     
    383531     * @return bool True, on success.
    384532     */
    385     function wp_editUser( $args ) {
     533    function wxm_wp_editUser( $args ) {
     534        if ( ! $this->minimum_args( $args, 5 ) )
     535            return $this->error;
     536
    386537        $this->escape( $args );
    387538
     
    443594            $user_data['user_url'] = $content_struct['url'];
    444595
     596        if ( isset( $content_struct['display_name'] ) )
     597            $user_data['display_name'] = $content_struct['display_name'];
     598
    445599        if ( isset( $content_struct['nickname'] ) )
    446600            $user_data['nickname'] = $content_struct['nickname'];
     
    471625
    472626        if ( ! $result )
    473             return new IXR_Error( 500, __( 'Sorry, the user cannot be updated. Something wrong happened.' ) );
     627            return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
    474628
    475629        return true;
     
    487641     * @return True when user is deleted.
    488642     */
    489     function wp_deleteUser( $args ) {
     643    function wxm_wp_deleteUser( $args ) {
     644        if ( ! $this->minimum_args( $args, 4 ) )
     645            return $this->error;
     646
    490647        $this->escape( $args );
    491648
     
    557714     *  - 'user_contacts'
    558715     */
    559     function wp_getUser( $args ) {
     716    function wxm_wp_getUser( $args ) {
     717        if ( ! $this->minimum_args( $args, 4 ) )
     718            return $this->error;
     719
    560720        $this->escape( $args );
    561721
     
    608768     * @return array users data
    609769     */
    610     function wp_getUsers( $args ) {
     770    function wxm_wp_getUsers( $args ) {
     771        if ( ! $this->minimum_args( $args, 3 ) )
     772            return $this->error;
     773
    611774        $this->escape( $args );
    612775
     
    665828     * @return array (@see wp_getUser)
    666829     */
    667     function wp_getUserInfo( $args ) {
     830    function wxm_wp_getUserInfo( $args ) {
     831        if ( ! $this->minimum_args( $args, 3 ) )
     832            return $this->error;
     833
    668834        $this->escape( $args );
    669835
     
    710876     *      - ping_status - can be 'open' | 'closed'
    711877     *      - sticky
    712      *      - featured_image - ID of a media item to use as the featured image
     878     *      - post_thumbnail - ID of a media item to use as the post thumbnail/featured image
    713879     *      - custom_fields - array, with each element containing 'key' and 'value'
    714880     *      - terms - array, with taxonomy names as keys and arrays of term IDs as values
     
    718884     * @return string post_id
    719885     */
    720     function wp_newPost( $args ) {
     886    function wxm_wp_newPost( $args ) {
     887        if ( ! $this->minimum_args( $args, 4 ) )
     888            return $this->error;
     889
    721890        $this->escape( $args );
    722891
     
    739908     * Helper method for filtering out elements from an array.
    740909     */
    741     function _is_greater_than_one( $count ){
     910    function wxm_is_greater_than_one( $count ) {
    742911        return $count > 1;
    743912    }
     
    746915     * Helper method for wp_newPost and wp_editPost, containing shared logic.
    747916     */
    748     function _insert_post( $user, $content_struct ) {
     917    protected function wxm_insert_post( $user, $content_struct ) {
    749918        $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
    750             'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '', 'sticky' => 0 );
     919            'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
    751920
    752921        $post_data = wp_parse_args( $content_struct, $defaults );
    753922
    754923        $post_type = get_post_type_object( $post_data['post_type'] );
    755         if ( ! ( (bool) $post_type ) )
     924        if ( ! $post_type )
    756925            return new IXR_Error( 403, __( 'Invalid post type' ) );
    757926
    758         $update = false;
    759         if ( ! empty( $post_data[ 'ID' ] ) )
    760             $update = true;
     927        $update = ! empty( $post_data['ID'] );
    761928
    762929        if ( $update ) {
    763             if ( ! current_user_can( $post_type->cap->edit_post, $post_data[ 'ID' ] ) )
     930            if ( ! get_post( $post_data['ID'] ) )
     931                return new IXR_Error( 401, __( 'Invalid post ID.' ) );
     932            if ( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) )
    764933                return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
     934            if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
     935                return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
    765936        } else {
    766937            if ( ! current_user_can( $post_type->cap->edit_posts ) )
     
    774945            case 'private':
    775946                if ( ! current_user_can( $post_type->cap->publish_posts ) )
    776                     return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ));
     947                    return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
    777948                break;
    778949            case 'publish':
    779950            case 'future':
    780951                if ( ! current_user_can( $post_type->cap->publish_posts ) )
    781                     return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ));
     952                    return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
    782953                break;
    783954            default:
    784955                $post_data['post_status'] = 'draft';
    785             break;
     956                break;
    786957        }
    787958
     
    802973        }
    803974
    804         if ( isset( $post_data['comment_status'] ) ) {
    805             if ( ! post_type_supports( $post_data['post_type'], 'comments' ) || ( $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' ) ) {
    806                 unset( $post_data['comment_status'] );
    807             }
    808         }
    809 
    810         if ( isset( $post_data['ping_status'] ) ) {
    811             if ( ! post_type_supports( $post_data['post_type'], 'trackbacks' ) || ( $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' ) ) {
    812                 unset( $post_data['ping_status'] );
    813             }
    814         }
     975        if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' )
     976            unset( $post_data['comment_status'] );
     977
     978        if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' )
     979            unset( $post_data['ping_status'] );
    815980
    816981        // Do some timestamp voodoo
    817982        if ( ! empty( $post_data['post_date_gmt'] ) ) {
    818983            // We know this is supposed to be GMT, so we're going to slap that Z on there by force
    819             $dateCreated = str_replace( 'Z', '', $post_data['post_date_gmt']->getIso() ) . 'Z';
     984            $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z';
    820985        } elseif ( ! empty( $post_data['post_date'] ) ) {
    821986            $dateCreated = $post_data['post_date']->getIso();
     
    827992        }
    828993
    829         if ( ! isset( $post_data['ID'] ) ) {
     994        if ( ! isset( $post_data['ID'] ) )
    830995            $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
    831         }
    832996        $post_ID = $post_data['ID'];
    833997
    834         $sticky = $post_data['sticky'] ? true : false;
    835 
    836         if ( $post_data['post_type'] == 'post' && $sticky == true ) {
    837             if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
    838                 return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
    839 
    840             if ( $post_data['post_status'] != 'publish' )
    841                 return new IXR_Error( 401, __( 'Only published posts can be made sticky.' ) );
    842 
    843             stick_post( $post_ID );
    844         }
    845 
    846         if ( isset ( $post_data['featured_image'] ) ) {
     998        if ( $post_data['post_type'] == 'post' ) {
     999            // Private and password-protected posts cannot be stickied.
     1000            if ( $post_data['post_status'] == 'private' || ! empty( $post_data['post_password'] ) ) {
     1001                // Error if the client tried to stick the post, otherwise, silently unstick.
     1002                if ( ! empty( $post_data['sticky'] ) )
     1003                    return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
     1004                if ( $update )
     1005                    unstick_post( $post_ID );
     1006            } elseif ( isset( $post_data['sticky'] ) )  {
     1007                if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
     1008                    return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
     1009                if ( $post_data['sticky'] )
     1010                    stick_post( $post_ID );
     1011                else
     1012                    unstick_post( $post_ID );
     1013            }
     1014        }
     1015
     1016        if ( isset( $post_data['post_thumbnail'] ) ) {
    8471017            // empty value deletes, non-empty value adds/updates
    848             if ( empty( $post_data['featured_image'] ) ) {
    849                 delete_post_meta( $post_ID, '_thumbnail_id' );
    850             }
    851             else {
    852                 $image = get_post( intval( $post_data['featured_image'] ), ARRAY_A );
    853                 if ( empty($image['ID'] ) )
    854                     return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
    855                 update_post_meta( $post_ID, '_thumbnail_id', $image['ID'] );
    856             }
    857             unset( $content_struct['featured_image'] );
    858         }
    859 
    860         if ( isset ( $post_data['custom_fields'] ) && post_type_supports( $post_data['post_type'], 'custom-fields' ) ) {
     1018            if ( ! $post_data['post_thumbnail'] )
     1019                delete_post_thumbnail( $post_ID );
     1020            elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) )
     1021                return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
     1022            unset( $content_struct['post_thumbnail'] );
     1023        }
     1024
     1025        if ( isset( $post_data['custom_fields'] ) )
    8611026            $this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
    862         }
    8631027
    8641028        if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
     
    9121076
    9131077                        // filter out non-ambiguous term names
    914                         $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one' ) );
     1078                        $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one') );
    9151079
    9161080                        $ambiguous_terms = array_keys( $ambiguous_tax_term_counts );
     
    9431107
    9441108            $post_data['tax_input'] = $terms;
    945             unset( $post_data['terms'] );
    946             unset( $post_data['terms_names'] );
     1109            unset( $post_data['terms'], $post_data['terms_names'] );
    9471110        } else {
    9481111            // do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
    949             unset( $post_data['tax_input'] );
     1112            unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
    9501113        }
    9511114
     
    9921155     * @return true on success
    9931156     */
    994     function wp_editPost( $args ) {
     1157    function wxm_wp_editPost( $args ) {
     1158        if ( ! $this->minimum_args( $args, 5 ) )
     1159            return $this->error;
     1160
    9951161        $this->escape( $args );
    9961162
    997         $blog_id        = (int) $args[0]; // we will support this in the near future
     1163        $blog_id        = (int) $args[0];
    9981164        $username       = $args[1];
    9991165        $password       = $args[2];
     
    10061172        do_action( 'xmlrpc_call', 'wp.editPost' );
    10071173
    1008         // User Capabilities are checked in _insert_post.
    1009 
    10101174        $post = get_post( $post_id, ARRAY_A );
    10111175
    1012         if ( empty( $post["ID"] ) )
     1176        if ( empty( $post['ID'] ) )
    10131177            return new IXR_Error( 404, __( 'Invalid post ID.' ) );
    10141178
     
    10441208     * @return true on success
    10451209     */
    1046     function wp_deletePost( $args ) {
     1210    function wxm_wp_deletePost( $args ) {
     1211        if ( ! $this->minimum_args( $args, 4 ) )
     1212            return $this->error;
     1213
    10471214        $this->escape( $args );
    10481215
     
    11151282     *  - 'enclosure'
    11161283     */
    1117     function wp_getPost( $args ) {
     1284    function wxm_wp_getPost( $args ) {
     1285        if ( ! $this->minimum_args( $args, 4 ) )
     1286            return $this->error;
     1287
    11181288        $this->escape( $args );
    11191289
     
    11351305        $post = wp_get_single_post( $post_id, ARRAY_A );
    11361306
    1137         if ( empty( $post["ID"] ) )
     1307        if ( empty( $post['ID'] ) )
    11381308            return new IXR_Error( 404, __( 'Invalid post ID.' ) );
    11391309
     
    11651335     *  - array   $filter optional
    11661336     *  - array   $fields optional
    1167      * @return array cntains a collection of posts.
    1168      */
    1169     function wp_getPosts( $args ) {
     1337     * @return array contains a collection of posts.
     1338     */
     1339    function wxm_wp_getPosts( $args ) {
     1340        if ( ! $this->minimum_args( $args, 3 ) )
     1341            return $this->error;
     1342
    11701343        $this->escape( $args );
    11711344
     
    12171390
    12181391        if ( ! $posts_list )
    1219             return array( );
     1392            return array();
    12201393
    12211394        // holds all the posts data
     
    12341407
    12351408    /**
    1236      * Retrieve post terms.
    1237      *
    1238      * The optional $group_by_taxonomy parameter specifies whether
    1239      * the returned array should have terms grouped by taxonomy or
    1240      * a flat list.
    1241      *
    1242      * @uses wp_get_object_terms()
    1243      * @param array $args Method parameters. Contains:
    1244      *  - int     $blog_id
    1245      *  - string  $username
    1246      *  - string  $password
    1247      *  - int     $post_id
    1248      *  - bool    $group_by_taxonomy optional
    1249      * @return array term data
    1250      */
    1251     function wp_getPostTerms( $args ) {
    1252         $this->escape( $args );
    1253 
    1254         $blog_id            = (int) $args[0];
    1255         $username           = $args[1];
    1256         $password           = $args[2];
    1257         $post_id            = (int) $args[3];
    1258         $group_by_taxonomy        = isset( $args[4] ) ? $args[4] : true;
    1259 
    1260         if ( ! $user = $this->login( $username, $password ) )
    1261             return $this->error;
    1262 
    1263         do_action( 'xmlrpc_call', 'wp.getPostTerms' );
    1264 
    1265         $post = wp_get_single_post( $post_id, ARRAY_A );
    1266         if ( empty( $post['ID'] ) )
    1267             return new IXR_Error( 404, __( 'Invalid post ID.' ) );
    1268 
    1269         $post_type = get_post_type_object( $post['post_type'] );
    1270 
    1271         if ( ! current_user_can( $post_type->cap->edit_post , $post_id ) )
    1272             return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
    1273 
    1274         $taxonomies = get_taxonomies( '' );
    1275 
    1276         $terms = wp_get_object_terms( $post_id , $taxonomies );
    1277 
    1278         if ( is_wp_error( $terms ) )
    1279             return new IXR_Error( 500 , $terms->get_error_message() );
    1280 
    1281         $struct = array();
    1282 
    1283         foreach ( $terms as $term ) {
    1284             if ( $group_by_taxonomy ) {
    1285                 $taxonomy = $term->taxonomy;
    1286 
    1287                 if ( ! array_key_exists( $taxonomy, $struct ) )
    1288                     $struct[$taxonomy] = array();
    1289 
    1290                 $struct[$taxonomy][] = $this->prepare_term( $term );
    1291             }
    1292             else {
    1293                 $struct[] = $this->prepare_term( $term );
    1294             }
    1295         }
    1296 
    1297         return $struct;
    1298     }
    1299 
    1300     /**
    1301      * Set post terms.
    1302      *
    1303      * @uses wp_set_object_terms()
    1304      * @param array $args Method parameters. Contains:
    1305      *  - int     $blog_id
    1306      *  - string  $username
    1307      *  - string  $password
    1308      *  - int     $post_id
    1309      *  - array   $content_struct contains term_ids with taxonomy as keys
    1310      *  - bool    $append
    1311      * @return boolean true
    1312      */
    1313     function wp_setPostTerms( $args ) {
    1314         $this->escape( $args );
    1315 
    1316         $blog_id            = (int) $args[0];
    1317         $username           = $args[1];
    1318         $password           = $args[2];
    1319         $post_ID            = (int) $args[3];
    1320         $content_struct     = $args[4];
    1321         $append             = $args[5] ? true : false;
    1322 
    1323         if ( ! $user = $this->login( $username, $password ) )
    1324             return $this->error;
    1325 
    1326         do_action( 'xmlrpc_call', 'wp.setPostTerms' );
    1327 
    1328         $post = wp_get_single_post( $post_ID, ARRAY_A );
    1329         if ( empty( $post['ID'] ) )
    1330             return new IXR_Error( 404, __( 'Invalid post ID.' ) );
    1331 
    1332         $post_type = get_post_type_object( $post['post_type'] );
    1333 
    1334         if ( ! current_user_can( $post_type->cap->edit_post , $post_ID ) )
    1335             return new IXR_Error( 401, __( 'Sorry, You are not allowed to edit this post.' ) );
    1336 
    1337         $post_type_taxonomies = get_object_taxonomies( $post['post_type'] );
    1338 
    1339         $taxonomies = array_keys( $content_struct );
    1340 
    1341         // validating term ids
    1342         foreach ( $taxonomies as $taxonomy ) {
    1343             if ( ! in_array( $taxonomy , $post_type_taxonomies ) )
    1344                 return new IXR_Error( 401, __( 'Sorry, one of the given taxonomy is not supported by the post type.' ) );
    1345 
    1346             $term_ids = $content_struct[$taxonomy];
    1347             foreach ( $term_ids as $term_id ) {
    1348 
    1349                 $term = get_term( $term_id, $taxonomy );
    1350 
    1351                 if ( is_wp_error( $term ) )
    1352                     return new IXR_Error( 500, $term->get_error_message() );
    1353 
    1354                 if ( ! $term )
    1355                     return new IXR_Error( 403, __( 'Invalid term ID' ) );
    1356             }
    1357         }
    1358 
    1359         foreach ( $taxonomies as $taxonomy ) {
    1360             $term_ids = $content_struct[$taxonomy];
    1361             $term_ids = array_map( 'intval', $term_ids );
    1362             $term_ids = array_unique( $term_ids );
    1363             wp_set_object_terms( $post_ID , $term_ids, $taxonomy , $append );
    1364         }
    1365 
    1366         return true;
    1367     }
    1368 
    1369     /**
    1370      * Retrieve a post type.
     1409     * Retrieves a post type
    13711410     *
    13721411     * @uses get_post_type_object()
     
    13761415     *  - string  $password
    13771416     *  - string  $post_type_name
     1417     *  - array   $fields
    13781418     * @return array contains:
    13791419     *  - 'labels'
     
    13851425     *  - 'menu_position'
    13861426     *  - 'taxonomies'
    1387      */
    1388     function wp_getPostType( $args ) {
     1427     *  - 'supports'
     1428     */
     1429    function wxm_wp_getPostType( $args ) {
     1430        if ( ! $this->minimum_args( $args, 4 ) )
     1431            return $this->error;
     1432
    13891433        $this->escape( $args );
    13901434
     
    13941438        $post_type_name = $args[3];
    13951439
    1396         if ( ! $user = $this->login( $username, $password ) )
     1440        if ( isset( $args[4] ) )
     1441            $fields = $args[4];
     1442        else
     1443            $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
     1444
     1445        if ( !$user = $this->login( $username, $password ) )
    13971446            return $this->error;
    13981447
    13991448        do_action( 'xmlrpc_call', 'wp.getPostType' );
    14001449
    1401         if ( ! post_type_exists( $post_type_name ) )
     1450        if( ! post_type_exists( $post_type_name ) )
    14021451            return new IXR_Error( 403, __( 'Invalid post type.' ) );
    14031452
    14041453        $post_type = get_post_type_object( $post_type_name );
    14051454
    1406         if ( ! current_user_can( $post_type->cap->edit_posts ) )
     1455        if( ! current_user_can( $post_type->cap->edit_posts ) )
    14071456            return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
    14081457
    1409         return $this->_prepare_post_type( $post_type );
    1410     }
    1411 
    1412     /**
    1413      * Retrieve all post types.
     1458        return $this->_prepare_post_type( $post_type, $fields );
     1459    }
     1460
     1461    /**
     1462     * Retrieves a post types
    14141463     *
    14151464     * @uses get_post_types()
     
    14181467     *  - string  $username
    14191468     *  - string  $password
     1469     *  - array   $filter
     1470     *  - array   $fields
    14201471     * @return array
    14211472     */
    1422     function wp_getPostTypes( $args ) {
     1473    function wxm_wp_getPostTypes( $args ) {
     1474        if ( ! $this->minimum_args( $args, 3 ) )
     1475            return $this->error;
     1476
    14231477        $this->escape( $args );
    14241478
     
    14261480        $username           = $args[1];
    14271481        $password           = $args[2];
     1482        $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
     1483
     1484        if ( isset( $args[4] ) )
     1485            $fields = $args[4];
     1486        else
     1487            $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
    14281488
    14291489        if ( ! $user = $this->login( $username, $password ) )
     
    14321492        do_action( 'xmlrpc_call', 'wp.getPostTypes' );
    14331493
    1434         $post_types = get_post_types( '', 'objects' );
     1494        $post_types = get_post_types( $filter, 'objects' );
    14351495
    14361496        $struct = array();
    14371497
    1438         foreach ( $post_types as $post_type ) {
    1439             if ( ! current_user_can( $post_type->cap->edit_posts ) )
     1498        foreach( $post_types as $post_type ) {
     1499            if( ! current_user_can( $post_type->cap->edit_posts ) )
    14401500                continue;
    14411501
    1442             $struct[] = $this->_prepare_post_type( $post_type );
     1502            $struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields );
    14431503        }
    14441504
     
    14641524     * @return string term_id
    14651525     */
    1466     function wp_newTerm( $args ) {
     1526    function wxm_wp_newTerm( $args ) {
     1527        if ( ! $this->minimum_args( $args, 4 ) )
     1528            return $this->error;
     1529
    14671530        $this->escape( $args );
    14681531
     
    15461609     * @return bool True, on success.
    15471610     */
    1548     function wp_editTerm( $args ) {
     1611    function wxm_wp_editTerm( $args ) {
     1612        if ( ! $this->minimum_args( $args, 5 ) )
     1613            return $this->error;
     1614
    15491615        $this->escape( $args );
    15501616
     
    16331699     * @return boolean|IXR_Error If it suceeded true else a reason why not
    16341700     */
    1635     function wp_deleteTerm( $args ) {
     1701    function wxm_wp_deleteTerm( $args ) {
     1702        if ( ! $this->minimum_args( $args, 5 ) )
     1703            return $this->error;
     1704
    16361705        $this->escape( $args );
    16371706
     
    16391708        $username           = $args[1];
    16401709        $password           = $args[2];
    1641         $taxonomy_name      = $args[3];
     1710        $taxonomy           = $args[3];
    16421711        $term_id            = (int) $args[4];
    16431712
     
    16471716        do_action( 'xmlrpc_call', 'wp.deleteTerm' );
    16481717
    1649         if ( ! taxonomy_exists( $taxonomy_name ) )
     1718        if ( ! taxonomy_exists( $taxonomy ) )
    16501719            return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
    16511720
    1652         $taxonomy = get_taxonomy( $taxonomy_name );
     1721        $taxonomy = get_taxonomy( $taxonomy );
    16531722
    16541723        if ( ! current_user_can( $taxonomy->cap->delete_terms ) )
    16551724            return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );
    16561725
    1657         $term = get_term( $term_id, $taxonomy_name );
     1726        $term = get_term( $term_id, $taxonomy->name );
    16581727
    16591728        if ( is_wp_error( $term ) )
     
    16631732            return new IXR_Error( 404, __( 'Invalid term ID.' ) );
    16641733
    1665         $result = wp_delete_term( $term_id, $taxonomy_name );
     1734        $result = wp_delete_term( $term_id, $taxonomy->name );
    16661735
    16671736        if ( is_wp_error( $result ) )
     
    16821751     *  - string  $username
    16831752     *  - string  $password
    1684      *  - string  $taxonomy_name
     1753     *  - string  $taxonomy
    16851754     *  - string  $term_id
    16861755     * @return array contains:
     
    16951764     *  - 'count'
    16961765     */
    1697     function wp_getTerm( $args ) {
     1766    function wxm_wp_getTerm( $args ) {
     1767        if ( ! $this->minimum_args( $args, 5 ) )
     1768            return $this->error;
     1769
    16981770        $this->escape( $args );
    16991771
     
    17011773        $username           = $args[1];
    17021774        $password           = $args[2];
    1703         $taxonomy_name      = $args[3];
     1775        $taxonomy           = $args[3];
    17041776        $term_id            = (int) $args[4];
    17051777
     
    17091781        do_action( 'xmlrpc_call', 'wp.getTerm' );
    17101782
    1711         if ( ! taxonomy_exists( $taxonomy_name ) )
     1783        if ( ! taxonomy_exists( $taxonomy ) )
    17121784            return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
    17131785
    1714         $taxonomy = get_taxonomy( $taxonomy_name );
     1786        $taxonomy = get_taxonomy( $taxonomy );
    17151787
    17161788        if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
    17171789            return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
    17181790
    1719         $term = get_term( $term_id , $taxonomy_name, ARRAY_A );
     1791        $term = get_term( $term_id , $taxonomy->name, ARRAY_A );
    17201792
    17211793        if ( is_wp_error( $term ) )
     
    17391811     *  - string  $username
    17401812     *  - string  $password
    1741      *  - string  $taxonomy_name
     1813     *  - string  $taxonomy
    17421814     *  - array   $filter optional
    17431815     * @return array terms
    17441816     */
    1745     function wp_getTerms( $args ) {
     1817    function wxm_wp_getTerms( $args ) {
     1818        if ( ! $this->minimum_args( $args, 4 ) )
     1819            return $this->error;
     1820
    17461821        $this->escape( $args );
    17471822
     
    17491824        $username       = $args[1];
    17501825        $password       = $args[2];
    1751         $taxonomy_name  = $args[3];
     1826        $taxonomy       = $args[3];
    17521827        $filter         = isset( $args[4] ) ? $args[4] : array();
    17531828
     
    17571832        do_action( 'xmlrpc_call', 'wp.getTerms' );
    17581833
    1759         if ( ! taxonomy_exists( $taxonomy_name ) )
     1834        if ( ! taxonomy_exists( $taxonomy ) )
    17601835            return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
    17611836
    1762         $taxonomy = get_taxonomy( $taxonomy_name );
     1837        $taxonomy = get_taxonomy( $taxonomy );
    17631838
    17641839        if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
     
    17881863            $query['search'] = $filter['search'];
    17891864
    1790         $terms = get_terms( $taxonomy_name, $query );
     1865        $terms = get_terms( $taxonomy->name, $query );
    17911866
    17921867        if ( is_wp_error( $terms ) )
     
    18101885     *  - string  $username
    18111886     *  - string  $password
    1812      *  - string  $taxonomy_name
     1887     *  - string  $taxonomy
    18131888     * @return array (@see get_taxonomy())
    18141889     */
    1815     function wp_getTaxonomy( $args ) {
     1890    function wxm_wp_getTaxonomy( $args ) {
     1891        if ( ! $this->minimum_args( $args, 4 ) )
     1892            return $this->error;
     1893
    18161894        $this->escape( $args );
    18171895
     
    18191897        $username       = $args[1];
    18201898        $password       = $args[2];
    1821         $taxonomy_name  = $args[3];
     1899        $taxonomy       = $args[3];
     1900
     1901        if ( isset( $args[4] ) )
     1902            $fields = $args[4];
     1903        else
     1904            $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
    18221905
    18231906        if ( ! $user = $this->login( $username, $password ) )
     
    18261909        do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
    18271910
    1828         if ( ! taxonomy_exists( $taxonomy_name ) )
     1911        if ( ! taxonomy_exists( $taxonomy ) )
    18291912            return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
    18301913
    1831         $taxonomy = get_taxonomy( $taxonomy_name );
     1914        $taxonomy = get_taxonomy( $taxonomy );
    18321915
    18331916        if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
    18341917            return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
    18351918
    1836         return $this->_prepare_taxonomy( $taxonomy );
     1919        return $this->_prepare_taxonomy( $taxonomy, $fields );
    18371920    }
    18381921
     
    18471930     * @return array taxonomies
    18481931     */
    1849     function wp_getTaxonomies( $args ) {
     1932    function wxm_wp_getTaxonomies( $args ) {
     1933        if ( ! $this->minimum_args( $args, 3 ) )
     1934            return $this->error;
     1935
    18501936        $this->escape( $args );
    18511937
     
    18531939        $username           = $args[1];
    18541940        $password           = $args[2];
     1941        $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
     1942
     1943        if ( isset( $args[4] ) )
     1944            $fields = $args[4];
     1945        else
     1946            $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
    18551947
    18561948        if ( ! $user = $this->login( $username, $password ) )
     
    18591951        do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
    18601952
    1861         $taxonomies = get_taxonomies( '', 'objects' );
     1953        $taxonomies = get_taxonomies( $filter, 'objects' );
    18621954
    18631955        // holds all the taxonomy data
     
    18691961                continue;
    18701962
    1871             $struct[] = $this->_prepare_taxonomy( $taxonomy );
     1963            $struct[] = $this->_prepare_taxonomy( $taxonomy, $fields );
    18721964        }
    18731965
    18741966        return $struct;
    18751967    }
     1968
     1969    function wxm_handle_upload( $struct ) {
     1970        $attachment_id = url_to_postid( $struct['url'] );
     1971        $struct['id'] = $attachment_id;
     1972        return $struct;
     1973    }
     1974
     1975    function wxm_blog_options( $options ) {
     1976        $wp34_options = array(
     1977            // Read only options
     1978            'image_default_link_type' => array(
     1979                'desc'          => __( 'Image default link type' ),
     1980                'readonly'      => true,
     1981                'option'        => 'image_default_link_type'
     1982            ),
     1983            'image_default_size' => array(
     1984                'desc'          => __( 'Image default size' ),
     1985                'readonly'      => true,
     1986                'option'        => 'image_default_size'
     1987            ),
     1988            'image_default_align' => array(
     1989                'desc'          => __( 'Image default align' ),
     1990                'readonly'      => true,
     1991                'option'        => 'image_default_align'
     1992            ),
     1993            'template'          => array(
     1994                'desc'          => __( 'Template' ),
     1995                'readonly'      => true,
     1996                'option'        => 'template'
     1997            ),
     1998            'stylesheet'        => array(
     1999                'desc'          => __( 'Stylesheet' ),
     2000                'readonly'      => true,
     2001                'option'        => 'stylesheet'
     2002            ),
     2003            'post_thumbnail'    => array(
     2004                'desc'          => __('Post Thumbnail'),
     2005                'readonly'      => true,
     2006                'value'         => current_theme_supports( 'post-thumbnails' )
     2007            ),
     2008
     2009            // Updatable options
     2010            'default_comment_status' => array(
     2011                'desc'          => __( 'Allow people to post comments on new articles' ),
     2012                'readonly'      => false,
     2013                'option'        => 'default_comment_status'
     2014            ),
     2015            'default_ping_status' => array(
     2016                'desc'          => __( 'Allow link notifications from other blogs (pingbacks and trackbacks)' ),
     2017                'readonly'      => false,
     2018                'option'        => 'default_ping_status'
     2019            )
     2020        );
     2021
     2022        return array_merge( $wp34_options, $options );
     2023    }
    18762024}
    18772025
  • xml-rpc-modernization/trunk/readme.txt

    r510787 r543520  
    55Tested up to: 3.4
    66Stable tag: trunk
     7License: GPLv2 or later
     8License URI: http://www.gnu.org/licenses/gpl-2.0.html
    79
    810This plugin updates the WordPress XML-RPC API to leverage the latest features of WordPress
     
    1113== Description ==
    1214
    13 This plugin updates the WordPress XML-RPC API to leverage the latest features of WordPress
    14 and move beyond the historical Blogger/metaWeblog/MT APIs.
     15This plugin brings XML-RPC API enhancements from the WordPress 3.4 release to previous versions
     16of WordPress (3.3 and earlier). It also adds new user management methods.
    1517
    1618It is derived from Prasath Nadarajah's GSoC '11 project to expand WordPress' web services,
    1719although the exposed API methods are not compatible (different parameter names/types/orders).
    1820
    19 WARNING: This plugin is still experimental, use in production at your own risk.
     21= Methods =
    2022
    21 = Methods =
     23New Methods:
    2224
    2325* wp.newUser - create a new user
     
    2729* wp.getUsers - retrieve a list of users
    2830* wp.getUserInfo - get information about the requesting user
     31
     323.4 Methods for pre-3.4 sites:
     33
    2934* wp.newPost - create a new post (of any post type)
    3035* wp.editPost - edit a post (of any post type)
     
    3439* wp.getPostType - get information about a specific post type
    3540* wp.getPostTypes - get a list of registered post types
    36 * wp.getPostTerms - get terms associated with a post
    37 * wp.setPostTerms - set terms associated with a post
    3841* wp.getTaxonomy - get information about a specific taxonomy
    3942* wp.getTaxonomies  - get a list of registered taxonomies
     
    4548
    4649== Changelog ==
     50
     51= 0.8 =
     52* Alignment with WordPress core progress (RC1).
     53* Removed wp.getPostTerms and wp.setPostTerms.
     54* Added 'id' to wp.uploadFile return value.
     55* Added new options for wp.getOptions and wp.setOptions to match 3.4 core.
     56* Added minimum argument count guards to users methods.
     57* Added additional fields to wp.newUser and wp.editUser.
    4758
    4859= 0.7.5 =
  • xml-rpc-modernization/trunk/wp-xmlrpc-modernization.php

    r510787 r543520  
    44 * Plugin Name: wp-xmlrpc-modernization
    55 * Description: This plugin extends the basic XML-RPC API exposed by WordPress. Derived from GSoC '11 project.
    6  * Version: 0.7.5
     6 * Version: 0.8
    77 * Author: Max Cutler
    88 * Author URI: http://www.maxcutler.com
Note: See TracChangeset for help on using the changeset viewer.