| | 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 | |