| 1706 | /** |
| 1707 | * Retrieve a taxonomy |
| 1708 | * |
| 1709 | * @uses get_taxonomy() |
| 1710 | * @param array $args Method parameters. Contains: |
| 1711 | * - int $blog_id |
| 1712 | * - string $username |
| 1713 | * - string $password |
| 1714 | * - string $taxonomy_name |
| 1715 | * @return array contains: |
| 1716 | * - 'labels' |
| 1717 | * - 'cap' |
| 1718 | * - 'hierarchical' |
| 1719 | * - 'object_type' |
| 1720 | */ |
| 1721 | function wp_getTaxonomy( $args ) { |
| 1722 | |
| 1723 | $this->escape( $args ); |
| 1724 | |
| 1725 | $blog_ID = (int) $args[0]; |
| 1726 | $username = $args[1]; |
| 1727 | $password = $args[2]; |
| 1728 | $taxonomy_name = $args[3]; |
| 1729 | |
| 1730 | if ( ! $user = $this->login( $username, $password ) ) |
| 1731 | return $this->error; |
| 1732 | |
| 1733 | $taxonomy_names = get_taxonomies('','names'); |
| 1734 | |
| 1735 | if( ! in_array( $taxonomy_name, $taxonomy_names ) ) |
| 1736 | return new IXR_Error( 403, __( 'The taxonomy type specified is not valid' ) ); |
| 1737 | |
| 1738 | $taxonomy = get_taxonomy( $taxonomy_name ); |
| 1739 | |
| 1740 | //capability check |
| 1741 | if( ! current_user_can( $taxonomy->cap->edit_terms ) ) |
| 1742 | return new IXR_Error( 401, __( 'Sorry, You are not allowed to edit this post type' ) ); |
| 1743 | |
| 1744 | $taxonomy = (array)$taxonomy; |
| 1745 | |
| 1746 | $taxonomy_type_data = array( |
| 1747 | 'labels' => $taxonomy['labels'], |
| 1748 | 'cap' => $taxonomy['cap'], |
| 1749 | 'hierarchical' => $taxonomy['hierarchical'], |
| 1750 | 'object_type' => $taxonomy['object_type'], |
| 1751 | ); |
| 1752 | |
| 1753 | return $taxonomy_type_data; |
| 1754 | |
| 1755 | } |
| 1756 | |