Make WordPress Core

Ticket #18441: wp.getTerm.patch

File wp.getTerm.patch, 2.8 KB (added by nprasath002, 14 years ago)
  • class-wp-xmlrpc-server.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: /var/www/GSoC/wordtrunk/wp-includes
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    6464                        'wp.getMediaItem'               => 'this:wp_getMediaItem',
    6565                        'wp.getMediaLibrary'    => 'this:wp_getMediaLibrary',
    6666                        'wp.getPostFormats'     => 'this:wp_getPostFormats',
     67                        'wp.getTerm'            => 'this:wp_getTerm',
    6768
    6869                        // Blogger API
    6970                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
     
    17021703                return $formats;
    17031704        }
    17041705
     1706        /**
     1707         * Retrieve a term
     1708         *
     1709         * @uses get_term()
     1710         * @param array $args Method parameters. Contains:
     1711         *  - int     $blog_id
     1712         *  - string  $username
     1713         *  - string  $password
     1714         *  - int     $term_id
     1715         *  - array   $content_struct contains:
     1716         *      - 'taxonomy'
     1717         * @return array contains:
     1718         *  - 'term_id'
     1719         *  - 'name'
     1720         *  - 'slug'
     1721         *  - 'term_group'
     1722         *  - 'term_taxonomy_id'
     1723         *  - 'taxonomy'
     1724         *  - 'description'
     1725         *  - 'parent'
     1726         *  - 'count'
     1727         */
     1728        function wp_getTerm( $args ) {
     1729
     1730                $this->escape( $args );
     1731
     1732                $blog_ID            = (int) $args[0];
     1733                $username           = $args[1];
     1734                $password           = $args[2];
     1735                $term_ID            = (int)$args[3];
     1736                $content_struct     = $args[4];
     1737
     1738                if ( ! $user = $this->login( $username, $password ) )
     1739                        return $this->error;
     1740
     1741                if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
     1742                        return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
     1743
     1744                $taxonomy = get_taxonomy( $content_struct['taxonomy'] );
     1745
     1746                if( ! current_user_can( $taxonomy->cap->assign_terms ) )
     1747                        return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy' ) );
     1748
     1749                $term = get_term( $term_ID , $content_struct['taxonomy'] );
     1750
     1751                if ( is_wp_error( $term ) )
     1752                            return new IXR_Error(500, $term->get_error_message());
     1753
     1754                if ( ! $term )
     1755                            return new IXR_Error(500, __('The term ID does not exists'));
     1756
     1757                return $term;
     1758
     1759        }
     1760       
    17051761        /* Blogger API functions.
    17061762         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
    17071763         */