Make WordPress Core

Ticket #18442: wp.getTerms.patch

File wp.getTerms.patch, 2.5 KB (added by nprasath002, 12 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.getTerms'           => 'this:wp_getTerms',
    6768
    6869                        // Blogger API
    6970                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
     
    17021703                return $formats;
    17031704        }
    17041705
     1706        /**
     1707         * Retrieve terms
     1708         *
     1709         * @uses get_terms()
     1710         * @param array $args Method parameters. Contains:
     1711         *  - int     $blog_id
     1712         *  - string  $username
     1713         *  - string  $password
     1714         *  - array   $content_struct contains:
     1715         *      - 'taxonomy'
     1716         * @return array terms
     1717         */
     1718        function wp_getTerms($args) {
     1719
     1720                $this->escape( $args );
     1721
     1722                $blog_ID            = (int) $args[0];
     1723                $username           = $args[1];
     1724                $password           = $args[2];
     1725                $content_struct     = $args[3];
     1726
     1727                if ( ! $user = $this->login( $username, $password ) )
     1728                        return $this->error;
     1729
     1730                if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
     1731                        return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
     1732
     1733                $taxonomy = get_taxonomy( $content_struct['taxonomy'] );
     1734
     1735                if( ! current_user_can( $taxonomy->cap->assign_terms ) )
     1736                        return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy' ) );
     1737
     1738                $terms = get_terms( $content_struct['taxonomy'] , array('get' => 'all') );
     1739
     1740                if ( is_wp_error( $terms ) )
     1741                            return new IXR_Error(500, $term->get_error_message());
     1742
     1743                if ( ! $terms )
     1744                            return new IXR_Error(500, __('The term ID does not exists'));
     1745
     1746                return $terms;
     1747
     1748        }
     1749       
    17051750        /* Blogger API functions.
    17061751         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
    17071752         */