Integrate wpmu_blogger_getUsersBlogs() directly into xmlrpc.php. see #11644
git-svn-id: http://svn.automattic.com/wordpress/trunk@12852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
37
xmlrpc.php
37
xmlrpc.php
@@ -452,9 +452,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$username = $args[0];
|
||||
$password = $args[1];
|
||||
|
||||
if ( !$user = $this->login($username, $password) ) {
|
||||
if ( !$user = $this->login($username, $password) )
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
||||
do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
|
||||
|
||||
@@ -1546,6 +1546,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
* @return array
|
||||
*/
|
||||
function blogger_getUsersBlogs($args) {
|
||||
if ( is_multisite() )
|
||||
return _multisite_getUsersBlogs($args);
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
@@ -1570,6 +1572,35 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return array($struct);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private function for retrieving a users blogs for multisite setups
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function _multisite_getUsersBlogs($args) {
|
||||
global $current_blog;
|
||||
$domain = $current_blog->domain;
|
||||
$path = $current_blog->path . 'xmlrpc.php';
|
||||
$protocol = is_ssl() ? 'https' : 'http';
|
||||
|
||||
$rpc = new IXR_Client("$protocol://{$domain}{$path}");
|
||||
$rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
|
||||
$blogs = $rpc->getResponse();
|
||||
|
||||
if ( isset($blogs['faultCode']) )
|
||||
return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
|
||||
|
||||
if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
|
||||
return $blogs;
|
||||
} else {
|
||||
foreach ( (array) $blogs as $blog ) {
|
||||
if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
|
||||
return array($blog);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve user's data.
|
||||
*
|
||||
@@ -2106,7 +2137,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
if ( $post_more )
|
||||
$post_content = $post_content . "<!--more-->" . $post_more;
|
||||
|
||||
|
||||
$to_ping = $content_struct['mt_tb_ping_urls'];
|
||||
if ( is_array($to_ping) )
|
||||
$to_ping = implode(' ', $to_ping);
|
||||
|
||||
Reference in New Issue
Block a user