| | 1706 | /** |
| | 1707 | * Retrieves a post types |
| | 1708 | * |
| | 1709 | * @uses get_post_types() |
| | 1710 | * @param array $args Method parameters. Contains: |
| | 1711 | * - int $blog_id |
| | 1712 | * - string $username |
| | 1713 | * - string $password |
| | 1714 | * @return array |
| | 1715 | */ |
| | 1716 | function wp_getPostTypes( $args ) { |
| | 1717 | |
| | 1718 | $this->escape( $args ); |
| | 1719 | |
| | 1720 | $blog_ID = (int) $args[0]; |
| | 1721 | $username = $args[1]; |
| | 1722 | $password = $args[2]; |
| | 1723 | |
| | 1724 | if ( ! $user = $this->login( $username, $password ) ) |
| | 1725 | return $this->error; |
| | 1726 | |
| | 1727 | $post_types = get_post_types( '','objects' ); |
| | 1728 | |
| | 1729 | $struct = array(); |
| | 1730 | |
| | 1731 | foreach( $post_types as $post_type ) { |
| | 1732 | |
| | 1733 | // capability check for post_types |
| | 1734 | if( ! current_user_can( $post_type->cap->edit_posts ) ) |
| | 1735 | continue; |
| | 1736 | |
| | 1737 | $post_type = (array)$post_type; |
| | 1738 | |
| | 1739 | $post_type_data = array( |
| | 1740 | 'labels' => $post_type['labels'], |
| | 1741 | 'description' => $post_type['description'], |
| | 1742 | 'capability_type' => $post_type['capability_type'], |
| | 1743 | 'cap' => $post_type['cap'], |
| | 1744 | 'map_meta_cap' => $post_type['map_meta_cap'], |
| | 1745 | 'hierarchical' => $post_type['hierarchical'], |
| | 1746 | 'menu_position' => $post_type['menu_position'], |
| | 1747 | 'taxonomies' => get_object_taxonomies( $post_type['name'] ), |
| | 1748 | ); |
| | 1749 | |
| | 1750 | $struct[ $post_type['name'] ] = $post_type_data; |
| | 1751 | |
| | 1752 | } |
| | 1753 | |
| | 1754 | return $struct; |
| | 1755 | |
| | 1756 | } |
| | 1757 | |