| 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 taxonomies |
| 1724 | * |
| 1725 | * @uses get_taxonomies() |
| 1726 | * @param array $args Method parameters. Contains: |
| 1727 | * - int $blog_id |
| 1728 | * - string $username |
| 1729 | * - string $password |
| 1730 | * @return array taxonomies |
| 1731 | */ |
| 1732 | function wp_getTaxonomies($args) { |
| 1733 | $this->escape( $args ); |
| 1734 | |
| 1735 | $blog_id = (int) $args[0]; |
| 1736 | $username = $args[1]; |
| 1737 | $password = $args[2]; |
| 1738 | |
| 1739 | if ( ! $user = $this->login( $username, $password ) ) |
| 1740 | return $this->error; |
| 1741 | |
| 1742 | do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); |
| 1743 | |
| 1744 | $taxonomies = get_taxonomies( '', 'objects' ); |
| 1745 | |
| 1746 | // holds all the taxonomy data |
| 1747 | $struct = array(); |
| 1748 | |
| 1749 | foreach( $taxonomies as $taxonomy ) { |
| 1750 | // capability check for post_types |
| 1751 | if( ! current_user_can( $taxonomy->cap->edit_terms ) ) |
| 1752 | continue; |
| 1753 | |
| 1754 | $struct[ $taxonomy->name ] = $this->prepare_taxonomy( $taxonomy ); |
| 1755 | } |
| 1756 | |
| 1757 | return $struct; |
| 1758 | } |
| 1759 | |