WordPress.org

Make WordPress Core

Changeset 12852


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

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-default-filters.php

    r12851 r12852  
    33add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' );
    44add_action ( 'init', 'maybe_add_existing_user_to_blog' );
    5 add_filter ( 'xmlrpc_methods', 'attach_wpmu_xmlrpc' );
    65add_filter ( 'wp_authenticate_user', 'wordpressmu_authenticate_siteadmin', 10, 2 );
    76add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
  • trunk/wp-includes/ms-functions.php

    r12851 r12852  
    17901790}
    17911791
    1792 /*
    1793 XMLRPC getUsersBlogs() for a multiblog environment
    1794 http://trac.mu.wordpress.org/attachment/ticket/551/xmlrpc-mu.php
    1795 */
    1796 function wpmu_blogger_getUsersBlogs( $args ) {
    1797     global $current_blog;
    1798     $domain = $current_blog->domain;
    1799     $path = $current_blog->path . 'xmlrpc.php';
    1800 
    1801     $rpc = new IXR_Client("http://{$domain}{$path}");
    1802     $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
    1803     $blogs = $rpc->getResponse();
    1804 
    1805     if ( isset($blogs['faultCode']) )
    1806         return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
    1807 
    1808     if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
    1809         return $blogs;
    1810     } else {
    1811         foreach ( (array) $blogs as $blog ) {
    1812             if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
    1813                 return array($blog);
    1814         }
    1815         return array();
    1816     }
    1817 }
    1818 
    1819 function attach_wpmu_xmlrpc( $methods ) {
    1820     $methods['blogger.getUsersBlogs'] = 'wpmu_blogger_getUsersBlogs';
    1821     return $methods;
    1822 }
    1823 
    18241792function mu_locale( $locale ) {
    18251793    if ( defined('WP_INSTALLING') == false ) {
  • 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.