| | 1706 | /** |
| | 1707 | * Prepares taxonomy data for return in an XML-RPC object |
| | 1708 | * |
| | 1709 | * @param array|object $taxonomy The unprepared taxonomy data |
| | 1710 | * @return array The prepared taxonomy data |
| | 1711 | */ |
| | 1712 | function prepare_taxonomy( $taxonomy ) { |
| | 1713 | $_taxonomy = (array) $taxonomy; |
| | 1714 | |
| | 1715 | unset( |
| | 1716 | $_taxonomy['update_count_callback'] |
| | 1717 | ); |
| | 1718 | |
| | 1719 | return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy ); |
| | 1720 | } |
| | 1721 | |
| | 1722 | /** |
| | 1723 | * Retrieve a taxonomy |
| | 1724 | * |
| | 1725 | * @uses get_taxonomy() |
| | 1726 | * @param array $args Method parameters. Contains: |
| | 1727 | * - int $blog_id |
| | 1728 | * - string $username |
| | 1729 | * - string $password |
| | 1730 | * - string $taxonomy_name |
| | 1731 | * @return array (@see get_taxonomy()) |
| | 1732 | */ |
| | 1733 | function wp_getTaxonomy( $args ) { |
| | 1734 | $this->escape( $args ); |
| | 1735 | |
| | 1736 | $blog_id = (int) $args[0]; |
| | 1737 | $username = $args[1]; |
| | 1738 | $password = $args[2]; |
| | 1739 | $taxonomy_name = $args[3]; |
| | 1740 | |
| | 1741 | if ( ! $user = $this->login( $username, $password ) ) |
| | 1742 | return $this->error; |
| | 1743 | |
| | 1744 | do_action( 'xmlrpc_call', 'wp.getTaxonomy' ); |
| | 1745 | |
| | 1746 | if( ! taxonomy_exists( $taxonomy_name ) ) |
| | 1747 | return new IXR_Error( 403, __( 'The taxonomy type specified is not valid' ) ); |
| | 1748 | |
| | 1749 | $taxonomy = get_taxonomy( $taxonomy_name ); |
| | 1750 | |
| | 1751 | if( ! current_user_can( $taxonomy->cap->edit_terms ) ) |
| | 1752 | return new IXR_Error( 401, __( 'Sorry, You are not allowed to edit this post type' ) ); |
| | 1753 | |
| | 1754 | return $this->prepare_taxonomy( $taxonomy ); |
| | 1755 | } |
| | 1756 | |