WordPress.org

Plugin Directory

Changeset 548544


Ignore:
Timestamp:
05/24/12 15:02:10 (23 months ago)
Author:
maxcutler
Message:

Version 0.8.2 release.

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

Legend:

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

    r547780 r548544  
    4848        $new_methods['wp.getTaxonomy']      = array( &$this, 'wp_getTaxonomy' ); 
    4949        $new_methods['wp.getTaxonomies']    = array( &$this, 'wp_getTaxonomies' ); 
     50 
     51        global $wp_version; 
     52        $version_bits = explode( '-', $wp_version ); 
     53        $version = $version_bits[0]; 
     54        if ( $version < 3.4 ) { 
     55            // for pre-3.4, explicitly override the core implementation. 
     56            $methods['wp.getMediaItem'] = array( &$this, 'wxm_wp_getMediaItem' ); 
     57            $methods['wp.getMediaLibrary'] = array( &$this, 'wxm_wp_getMediaLibrary' ); 
     58        } 
    5059 
    5160        // array_merge will take the values defined in later arguments, so 
     
    20292038        return array_merge( $wp34_options, $options ); 
    20302039    } 
     2040 
     2041    // need to totally replace these old implementations 
     2042    function wxm_wp_getMediaItem($args) { 
     2043        $this->escape($args); 
     2044 
     2045        $blog_id        = (int) $args[0]; 
     2046        $username       = $args[1]; 
     2047        $password       = $args[2]; 
     2048        $attachment_id  = (int) $args[3]; 
     2049 
     2050        if ( !$user = $this->login($username, $password) ) 
     2051            return $this->error; 
     2052 
     2053        if ( !current_user_can( 'upload_files' ) ) 
     2054            return new IXR_Error( 403, __( 'You are not allowed to upload files to this site.' ) ); 
     2055 
     2056        do_action('xmlrpc_call', 'wp.getMediaItem'); 
     2057 
     2058        if ( ! $attachment = get_post($attachment_id) ) 
     2059            return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 
     2060 
     2061        return $this->_prepare_media_item( $attachment ); 
     2062    } 
     2063 
     2064    function wxm_wp_getMediaLibrary($args) { 
     2065        $this->escape($args); 
     2066 
     2067        $blog_id    = (int) $args[0]; 
     2068        $username   = $args[1]; 
     2069        $password   = $args[2]; 
     2070        $struct     = isset( $args[3] ) ? $args[3] : array() ; 
     2071 
     2072        if ( !$user = $this->login($username, $password) ) 
     2073            return $this->error; 
     2074 
     2075        if ( !current_user_can( 'upload_files' ) ) 
     2076            return new IXR_Error( 401, __( 'Sorry, you cannot upload files.' ) ); 
     2077 
     2078        do_action('xmlrpc_call', 'wp.getMediaLibrary'); 
     2079 
     2080        $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; 
     2081        $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; 
     2082        $offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ; 
     2083        $number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ; 
     2084 
     2085        $attachments = get_posts( array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type ) ); 
     2086 
     2087        $attachments_struct = array(); 
     2088 
     2089        foreach ($attachments as $attachment ) 
     2090            $attachments_struct[] = $this->_prepare_media_item( $attachment ); 
     2091 
     2092        return $attachments_struct; 
     2093    } 
    20312094} 
    20322095 
  • xml-rpc-modernization/trunk/readme.txt

    r547780 r548544  
    4949== Changelog == 
    5050 
     51= 0.8.2 = 
     52* Added 'attachment_id' to wp.getMediaLibrary and wp.getMediaItem to match 3.4 core. 
     53 
    5154= 0.8.1 = 
    5255* Fixed broken 'number' filter parameter behavior for wp.getPosts. 
  • xml-rpc-modernization/trunk/wp-xmlrpc-modernization.php

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