Switch the following XMLRPC api calls to support an optional number of posts.

blogger.getRecentPosts
metaWeblog.getRecentPosts
mt.getRecentPostTitles

git-svn-id: https://develop.svn.wordpress.org/trunk@16256 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2010-11-09 10:16:23 +00:00
parent 29da3d7730
commit e2379fdd7e
1 changed files with 16 additions and 6 deletions

View File

@ -1762,17 +1762,21 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
// $args[0] = appkey - ignored
$blog_ID = (int) $args[1]; /* though we don't use it yet */
$username = $args[2];
$password = $args[3];
$num_posts = $args[4];
if ( isset( $args[4] ) )
$query = array( 'numberposts' => absint( $args[4] ) );
else
$query = array();
if ( !$user = $this->login($username, $password) )
return $this->error;
do_action('xmlrpc_call', 'blogger.getRecentPosts');
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts( $query );
if ( !$posts_list ) {
$this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
@ -2682,14 +2686,17 @@ class wp_xmlrpc_server extends IXR_Server {
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$num_posts = (int) $args[3];
if ( isset( $args[3] ) )
$query = array( 'numberposts' => absint( $args[3] ) );
else
$query = array();
if ( !$user = $this->login($username, $password) )
return $this->error;
do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts( $query );
if ( !$posts_list )
return array( );
@ -2914,14 +2921,17 @@ class wp_xmlrpc_server extends IXR_Server {
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$num_posts = (int) $args[3];
if ( isset( $args[3] ) )
$query = array( 'numberposts' => absint( $args[3] ) );
else
$query = array();
if ( !$user = $this->login($username, $password) )
return $this->error;
do_action('xmlrpc_call', 'mt.getRecentPostTitles');
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts( $query );
if ( !$posts_list ) {
$this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));