WordPress.org

Plugin Directory

Changeset 502038


Ignore:
Timestamp:
02/08/12 05:11:26 (2 years ago)
Author:
maxcutler
Message:

Version 0.7.1 release.

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

Legend:

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

    r500648 r502038  
    102102     * Prepares post data for return in an XML-RPC object. 
    103103     * 
     104     * @access private 
     105     * 
    104106     * @param array $post The unprepared post data 
    105107     * @param array $fields The subset of post fields to return 
    106108     * @return array The prepared post data 
    107109     */ 
    108     function prepare_post( $post, $fields ) { 
     110    function _prepare_post( $post, $fields ) { 
    109111        // holds the data for this post. built up based on $fields 
    110112        $_post = array( 'post_id' => $post['ID'] ); 
     
    197199        } 
    198200 
    199         return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields ); 
     201        return apply_filters( 'xmlrpc__prepare_post', $_post, $post, $fields ); 
    200202    } 
    201203 
     
    708710 
    709711    /* 
     712     * Helper method for filtering out elements from an array. 
     713     */ 
     714    function _is_greater_than_one( $count ){ 
     715        return $count > 1; 
     716    } 
     717 
     718    /* 
    710719     * Helper method for wp_newPost and wp_editPost, containing shared logic. 
    711720     */ 
     
    768777 
    769778        // Do some timestamp voodoo 
    770         if ( ! empty( $post_data['post_date_gmt'] ) ) 
    771             $dateCreated = str_replace( 'Z', '', $post_data['post_date_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force 
    772         elseif ( ! empty( $post_data['post_date'] ) ) 
     779        if ( ! empty( $post_data['post_date_gmt'] ) ) { 
     780            // We know this is supposed to be GMT, so we're going to slap that Z on there by force 
     781            $dateCreated = str_replace( 'Z', '', $post_data['post_date_gmt']->getIso() ) . 'Z'; 
     782        } elseif ( ! empty( $post_data['post_date'] ) ) { 
    773783            $dateCreated = $post_data['post_date']->getIso(); 
     784        } 
    774785 
    775786        if ( ! empty( $dateCreated ) ) { 
     
    812823                foreach ( $taxonomies as $taxonomy ) { 
    813824                    if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) 
    814                         return new IXR_Error( 401, __( 'Sorry, one of the given taxonomy is not supported by the post type.' ) ); 
     825                        return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); 
    815826 
    816827                    if( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) 
     
    835846                foreach ( $taxonomies as $taxonomy ) { 
    836847                    if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) 
    837                         return new IXR_Error( 401, __( 'Sorry, one of the given taxonomy is not supported by the post type.' ) ); 
     848                        return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); 
    838849 
    839850                    if( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) 
     
    849860 
    850861                        // filter out non-ambiguous term names 
    851                         $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, function( $count ){ 
    852                             return $count > 1; 
    853                         } ); 
     862                        $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one' ) ); 
    854863 
    855864                        $ambiguous_terms = array_keys( $ambiguous_tax_term_counts ); 
     
    859868                    foreach ( $term_names as $term_name ) { 
    860869                        if ( in_array( $term_name, $ambiguous_terms ) ) 
    861                             return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarhical taxonomy. Please use term ID instead.' ) ); 
     870                            return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) ); 
    862871 
    863872                        $term = get_term_by( 'name', $term_name, $taxonomy ); 
     
    946955 
    947956        do_action( 'xmlrpc_call', 'wp.editPost' ); 
     957 
     958        // User Capabilities are checked in _wp_insertPost. 
    948959 
    949960        $post = get_post( $post_id, ARRAY_A ); 
     
    10811092            return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 
    10821093 
    1083         return $this->prepare_post( $post, $fields ); 
     1094        return $this->_prepare_post( $post, $fields ); 
    10841095    } 
    10851096 
     
    11681179                continue; 
    11691180 
    1170             $struct[] = $this->prepare_post( $post, $fields ); 
     1181            $struct[] = $this->_prepare_post( $post, $fields ); 
    11711182        } 
    11721183 
  • xml-rpc-modernization/trunk/readme.txt

    r500648 r502038  
    4646== Changelog == 
    4747 
     48= 0.7.1 = 
     49* PHP 5.2.x compatibility fix. 
     50* Typo corrections. 
     51* Alignment with WordPress core version of post methods. 
     52 
    4853= 0.7 = 
    4954* Added wp.newPost, wp.editPost, and wp.deletePost methods. 
  • xml-rpc-modernization/trunk/wp-xmlrpc-modernization.php

    r500648 r502038  
    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 
     6 * Version: 0.7.1 
    77 * Author: Max Cutler 
    88 * Author URI: http://www.maxcutler.com 
Note: See TracChangeset for help on using the changeset viewer.