Make WordPress Core

Ticket #10789: xmlrpc.php.diff

File xmlrpc.php.diff, 1.8 KB (added by josephscott, 15 years ago)
  • 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
     1609                do_action( 'xmlrpc_call', 'wp.getPluginList' );
     1610               
     1611                $plugins = get_plugins( );
     1612                $current = get_transient( 'update_plugins' );
     1613               
     1614                foreach ( (array) $plugins as $plugin_file => $plugin ) {
     1615                        $new_version = $current->response[$plugin_file]->new_version;
     1616                       
     1617                        if ( is_plugin_active( $plugin_file ) ) {
     1618                                $plugins[$plugin_file]['active'] = true;
     1619                        } else {
     1620                                $plugins[$plugin_file]['active'] = false;
     1621                        }
     1622
     1623                        if ( $new_version ) {
     1624                                $plugins[$plugin_file]['latest_version'] = $new_version;
     1625                        } else {
     1626                                $plugins[$plugin_file]['latest_version'] = $plugin['Version'];
     1627                        }
     1628                }
     1629               
     1630                return $plugins;
     1631               
     1632        }
     1633
    15831634        /* Blogger API functions.
    15841635         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
    15851636         */