The WP Remote WordPress Plugin - Version 0.1

Version Description

Download this release

Release Info

Developer willmot
Plugin Icon 128x128 The WP Remote WordPress Plugin
Version 0.1
Comparing to
See all releases

Version 0.1

Files changed (2) hide show
  1. plugin.php +74 -0
  2. readme.txt +12 -0
plugin.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: WP Remote
5
+ Description: Extends the functionality of <a href="http://www.wpremote.com">WP Remote</a>.
6
+ Version: 0.1
7
+ Author: willmot
8
+ Author URI: http://humanmade.co.uk/
9
+ */
10
+
11
+ function wpr_attach_new_xmlrpc($methods) {
12
+
13
+ if( !isset( $methods['wp.getPluginList'] ) ) {
14
+ $methods['wp.getPluginList'] = 'wpr_get_plugin_list';
15
+ }
16
+
17
+ return $methods;
18
+ }
19
+
20
+ add_action('xmlrpc_methods', 'wpr_attach_new_xmlrpc');
21
+
22
+ function wpr_get_plugin_list( $args ) {
23
+
24
+ $blog_id = (int) $args[0];
25
+ $username = $args[1];
26
+ $password = $args[2];
27
+
28
+ //check if xmlrpc is enabled
29
+ if ( !get_option( 'enable_xmlrpc' ) ) {
30
+ return new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
31
+ }
32
+
33
+ //authenticate the user
34
+ $user = wp_authenticate($username, $password);
35
+
36
+ if (is_wp_error($user)) {
37
+ return new IXR_Error(403, __('Bad login/pass combination.'));
38
+ }
39
+
40
+ set_current_user( $user->ID );
41
+
42
+ //don't allow anyone to get them via xml rpc
43
+ if ( !current_user_can( 'activate_plugins' ) ) {
44
+ return new IXR_Error( 401, __( 'Sorry, you cannot manage plugins.' ) );
45
+ }
46
+
47
+ do_action( 'xmlrpc_call', 'wp.getPluginList' );
48
+
49
+ $plugins = get_plugins( );
50
+ $current = get_transient( 'update_plugins' );
51
+
52
+ foreach ( (array) $plugins as $plugin_file => $plugin ) {
53
+ $new_version = $current->response[$plugin_file]->new_version;
54
+
55
+ if ( is_plugin_active( $plugin_file ) ) {
56
+ $plugins[$plugin_file]['active'] = true;
57
+ } else {
58
+ $plugins[$plugin_file]['active'] = false;
59
+ }
60
+
61
+ if ( $new_version ) {
62
+ $plugins[$plugin_file]['latest_version'] = $new_version;
63
+ } else {
64
+ $plugins[$plugin_file]['latest_version'] = $plugin['Version'];
65
+ }
66
+ }
67
+
68
+ return $plugins;
69
+
70
+
71
+ }
72
+
73
+
74
+ ?>
readme.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === The WP Remote WordPress Plugin ===
2
+ Contributors: willmot, joehoyle
3
+ Tags: wpremote, remote, xmlrpc
4
+ Requires at least: 2.7
5
+ Tested up to: 2.9
6
+ Stable tag: 0.1
7
+
8
+ Adds extra functionality for use with WP Remote
9
+
10
+ == Description ==
11
+
12
+ The WP Remote WordPress Plugin adds some extra features to WordPress for the use with [WP Remote](http://www.wpremote.com/)