Make WordPress Core

Changeset 12852 for trunk/xmlrpc.php


Ignore:
Timestamp:
01/26/2010 08:15:43 PM (17 years ago)
Author:
ryan
Message:

Integrate wpmu_blogger_getUsersBlogs() directly into xmlrpc.php. see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xmlrpc.php

    r12752 r12852  
    453453                $password = $args[1];
    454454
    455                 if ( !$user = $this->login($username, $password) ) {
    456                         return $this->error;
    457                 }
     455                if ( !$user = $this->login($username, $password) )
     456                        return $this->error;
     457
    458458
    459459                do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
     
    15471547         */
    15481548        function blogger_getUsersBlogs($args) {
     1549                if ( is_multisite() )
     1550                        return _multisite_getUsersBlogs($args);
    15491551
    15501552                $this->escape($args);
     
    15691571
    15701572                return array($struct);
     1573        }
     1574
     1575        /**
     1576         * Private function for retrieving a users blogs for multisite setups
     1577         *
     1578         * @access protected
     1579         */
     1580        function _multisite_getUsersBlogs($args) {
     1581                global $current_blog;
     1582                $domain = $current_blog->domain;
     1583                $path = $current_blog->path . 'xmlrpc.php';
     1584                $protocol = is_ssl() ? 'https' : 'http';
     1585
     1586                $rpc = new IXR_Client("$protocol://{$domain}{$path}");
     1587                $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
     1588                $blogs = $rpc->getResponse();
     1589
     1590                if ( isset($blogs['faultCode']) )
     1591                        return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
     1592
     1593                if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
     1594                        return $blogs;
     1595                } else {
     1596                        foreach ( (array) $blogs as $blog ) {
     1597                                if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
     1598                                        return array($blog);
     1599                        }
     1600                        return array();
     1601                }
    15711602        }
    15721603
     
    21072138                if ( $post_more )
    21082139                        $post_content = $post_content . "<!--more-->" . $post_more;
    2109  
     2140
    21102141                $to_ping = $content_struct['mt_tb_ping_urls'];
    21112142                if ( is_array($to_ping) )
Note: See TracChangeset for help on using the changeset viewer.