Make WordPress Core

Ticket #10789: xmlrpc.diff

File xmlrpc.diff, 1.8 KB (added by joehoyle, 15 years ago)

Moved $version out of if statement for clarity

  • xmlrpc.php

     
    154154                        'wp.editComment'                => 'this:wp_editComment',
    155155                        'wp.newComment'                 => 'this:wp_newComment',
    156156                        'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
     157                        'wp.getPluginList'              => 'this:wp_getPluginList',
    157158
    158159                        // Blogger API
    159160                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
     
    15791580                //Now return the updated values
    15801581                return $this->_getOptions($option_names);
    15811582        }
     1583       
     1584        /**
     1585         * Retrieve plugin list and information.
     1586         *
     1587         * @param array $args Method parameters.
     1588         *
     1589         * @since 2.9
     1590         *
     1591         * @return array
     1592         */
     1593        function wp_getPluginList( $args ) {
     1594       
     1595                $this->escape($args);
    15821596
     1597                $blog_id                                = (int) $args[0];
     1598                $username                               = $args[1];
     1599                $password                               = $args[2];
     1600
     1601                if ( !$user = $this->login($username, $password) ) {
     1602                        return $this->error;
     1603                }
     1604
     1605                if( !current_user_can( 'activate_plugins' ) )
     1606                        return new IXR_Error( 401, __( 'Sorry, you cannot manage plugins.' ) );
     1607
     1608                do_action('xmlrpc_call', 'wp.getPluginList');
     1609               
     1610                $plugins = get_plugins();
     1611                $current = get_transient( 'update_plugins' );
     1612               
     1613                foreach( (array) $plugins as $plugin_file => $plugin ) {
     1614                        $new_version = $current->response[$plugin_file]->new_version
     1615                       
     1616                        if( is_plugin_active( $plugin_file ) )
     1617                                $plugins[$plugin_file]['active'] = true;
     1618                        else
     1619                                $plugins[$plugin_file]['active'] = false;
     1620                        if( $new_version )
     1621                                $plugins[$plugin_file]['latest_version'] = $new_version;
     1622                        else
     1623                                $plugins[$plugin_file]['latest_version'] = $plugin['Version'];
     1624                }
     1625               
     1626                return $plugins;
     1627               
     1628        }
     1629
    15831630        /* Blogger API functions.
    15841631         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
    15851632         */