# 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.
|
|
|
|
| 64 | 64 | 'wp.getMediaItem' => 'this:wp_getMediaItem', |
| 65 | 65 | 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', |
| 66 | 66 | 'wp.getPostFormats' => 'this:wp_getPostFormats', |
| | 67 | 'wp.deletePost' => 'this:wp_deletePost', |
| 67 | 68 | |
| 68 | 69 | // Blogger API |
| 69 | 70 | 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', |
| … |
… |
|
| 1702 | 1703 | return $formats; |
| 1703 | 1704 | } |
| 1704 | 1705 | |
| | 1706 | /** |
| | 1707 | * Delete a post |
| | 1708 | * |
| | 1709 | * @uses wp_delete_post() |
| | 1710 | * @param array $args Method parameters. Contains: |
| | 1711 | * - int $post_ids |
| | 1712 | * - string $username |
| | 1713 | * - string $password |
| | 1714 | * @return array post_ids |
| | 1715 | */ |
| | 1716 | function wp_deletePost( $args ) { |
| | 1717 | |
| | 1718 | $this->escape( $args ); |
| | 1719 | |
| | 1720 | $post_IDs = $args[0]; // this could be an array |
| | 1721 | $username = $args[1]; |
| | 1722 | $password = $args[2]; |
| | 1723 | |
| | 1724 | |
| | 1725 | if ( ! $user = $this->login( $username, $password ) ) |
| | 1726 | return $this->error; |
| | 1727 | |
| | 1728 | if( ! is_array( $post_IDs ) ) |
| | 1729 | $post_IDs = array( (int)$post_IDs ); |
| | 1730 | |
| | 1731 | foreach ( $post_IDs as $post_ID ) { |
| | 1732 | |
| | 1733 | $post_ID = (int)$post_ID; |
| | 1734 | |
| | 1735 | $post = wp_get_single_post( $post_ID, ARRAY_A ); |
| | 1736 | if ( empty( $post["ID"] ) ) |
| | 1737 | return new IXR_Error( 404, __( 'One of the post ID is invalid.' ) ); |
| | 1738 | |
| | 1739 | $post_type = get_post_type_object( $post['post_type'] ); |
| | 1740 | if( ! current_user_can( $post_type->cap->delete_post, $post_ID ) ) |
| | 1741 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete one of the posts.' )); |
| | 1742 | |
| | 1743 | } |
| | 1744 | |
| | 1745 | // this holds all the id of deleted posts and return it |
| | 1746 | $deleted_posts = array(); |
| | 1747 | |
| | 1748 | foreach( $post_IDs as $post_ID ) { |
| | 1749 | |
| | 1750 | $result = wp_delete_post( $post_ID ); |
| | 1751 | if ( $result ) |
| | 1752 | $deleted_posts[] = $post_ID; |
| | 1753 | |
| | 1754 | } |
| | 1755 | |
| | 1756 | return $deleted_posts; |
| | 1757 | |
| | 1758 | } |
| | 1759 | |
| 1705 | 1760 | /* Blogger API functions. |
| 1706 | 1761 | * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ |
| 1707 | 1762 | */ |