The WP Remote WordPress Plugin - Version 2.1.0

Version Description

Download this release

Release Info

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

Code changes from version 2.0.9 to 2.1.0

Files changed (4) hide show
  1. plugin.php +1 -1
  2. readme.txt +2 -5
  3. wprp.api.php +7 -1
  4. wprp.plugins.php +36 -5
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: WP Remote
5
  Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. Deactivate to clear your API Key.
6
- Version: 2.0.9
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  */
3
  /*
4
  Plugin Name: WP Remote
5
  Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. Deactivate to clear your API Key.
6
+ Version: 2.1.0
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  */
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: humanmade, joehoyle, mattheu, tcrsavage, willmot
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 2.9
5
  Tested up to: 3.3.1
6
- Stable tag: 2.0.9
7
 
8
  WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
9
 
@@ -17,10 +17,7 @@ The WP Remote WordPress Plugin works with [WP Remote](https://wpremote.com/) to
17
  * Track the WordPress version each site is running and easily update.
18
  * Track all your plugins and themes 1 click update them.
19
  * Free to use and you can track an unlimited number of sites.
20
-
21
- = Coming Soon =
22
-
23
- * Backups
24
 
25
  = Support =
26
 
3
  Tags: wpremote, remote administration, multiple wordpress
4
  Requires at least: 2.9
5
  Tested up to: 3.3.1
6
+ Stable tag: 2.1.0
7
 
8
  WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
9
 
17
  * Track the WordPress version each site is running and easily update.
18
  * Track all your plugins and themes 1 click update them.
19
  * Free to use and you can track an unlimited number of sites.
20
+ * Backups of your database and files
 
 
 
21
 
22
  = Support =
23
 
wprp.api.php CHANGED
@@ -53,7 +53,13 @@ foreach( $actions as $action => $value ) {
53
  $actions[$action] = _wprp_upgrade_plugin( (string) $_GET['plugin'] );
54
 
55
  break;
56
-
 
 
 
 
 
 
57
  case 'get_themes' :
58
 
59
  $actions[$action] = _wprp_supports_theme_upgrade() ? _wprp_get_themes() : 'not-implemented';
53
  $actions[$action] = _wprp_upgrade_plugin( (string) $_GET['plugin'] );
54
 
55
  break;
56
+
57
+ case 'activate_plugin' :
58
+
59
+ $actions[$action] = _wprp_activate_plugin( (string) $_GET['plugin'] );
60
+
61
+ break;
62
+
63
  case 'get_themes' :
64
 
65
  $actions[$action] = _wprp_supports_theme_upgrade() ? _wprp_get_themes() : 'not-implemented';
wprp.plugins.php CHANGED
@@ -95,16 +95,47 @@ function _wprp_upgrade_plugin( $plugin ) {
95
  return array( 'status' => 'error', 'error' => $skin->error );
96
 
97
  // If the plugin was activited, we have to re-activate it
98
- // @todo Shouldn't this use activate_plugin?
99
  if ( $is_active ) {
100
- $current = get_option( 'active_plugins', array() );
101
- $current[] = plugin_basename( trim( $plugin ) );;
102
- sort( $current );
103
- update_option('active_plugins', $current );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  return array( 'status' => 'success' );
 
 
 
 
 
 
 
107
 
 
 
 
 
108
  }
109
 
110
  /**
95
  return array( 'status' => 'error', 'error' => $skin->error );
96
 
97
  // If the plugin was activited, we have to re-activate it
 
98
  if ( $is_active ) {
99
+
100
+ // we do a remote request to activate, as we don;t want to kill any installs
101
+ $url = add_query_arg( 'wpr_api_key', $_GET['wpr_api_key'], get_bloginfo( 'url' ) );
102
+ $url = add_query_arg( 'actions', 'activate_plugin', $url );
103
+ $url = add_query_arg( 'plugin', $plugin, $url );
104
+
105
+ $request = wp_remote_get( $url );
106
+
107
+ if ( is_wp_error( $request ) ) {
108
+ return array( 'status' => 'error', 'error' => $request->get_error_code() );
109
+ }
110
+
111
+ $body = wp_remote_retrieve_body( $request );
112
+
113
+
114
+ if ( ! $json = @json_decode( $body ) )
115
+ return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate.' );
116
+
117
+ $json = $json->activate_plugin;
118
+
119
+ if ( empty( $json->status ) )
120
+ return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned no response' );
121
+
122
+ if ( $json->status != 'success' )
123
+ return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned response: ' . $json->status );
124
  }
125
 
126
  return array( 'status' => 'success' );
127
+ }
128
+
129
+ function _wprp_activate_plugin( $plugin ) {
130
+
131
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
132
+
133
+ $result = activate_plugin( $plugin );
134
 
135
+ if ( is_wp_error( $result ) )
136
+ return array( 'status' => 'error', 'error' => $result->get_error_code() );
137
+
138
+ return array( 'status' => 'success' );
139
  }
140
 
141
  /**