Version Description
Download this release
Release Info
| Developer | danielbachhuber |
| Plugin | |
| Version | 2.6.5 |
| Comparing to | |
| See all releases | |
Code changes from version 2.6.4 to 2.6.5
- CONTRIBUTING.md +13 -0
- plugin.php +3 -13
- readme.txt +19 -3
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- wprp.backups.php +2 -14
- wprp.hm.backup.php +8 -2
- wprp.log.php +13 -7
- wprp.plugins.php +12 -144
- wprp.themes.php +2 -57
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Contribution guidelines ##
|
| 2 |
+
|
| 3 |
+
## Workflow ##
|
| 4 |
+
|
| 5 |
+
* Develop on a feature branch and send a pull request for review.
|
| 6 |
+
* Assign the pull request to one of the following contacts:
|
| 7 |
+
* Primary: Daniel Bachhuber [@danielbachhuber](https://github.com/danielbachhuber)
|
| 8 |
+
* Secondary:
|
| 9 |
+
|
| 10 |
+
## Coding Standards ##
|
| 11 |
+
|
| 12 |
+
Please follow these recommendations
|
| 13 |
+
[http://codex.wordpress.org/WordPress_Coding_Standards](http://codex.wordpress.org/WordPress_Coding_Standards)
|
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>. <strong>Deactivate to clear your API Key.</strong>
|
| 6 |
-
Version: 2.6.
|
| 7 |
Author: Human Made Limited
|
| 8 |
Author URI: http://hmn.md/
|
| 9 |
*/
|
|
@@ -62,18 +62,6 @@ if ( version_compare( get_bloginfo( 'version' ), '3.1', '>=' ) ) {
|
|
| 62 |
|
| 63 |
}
|
| 64 |
|
| 65 |
-
// Don't include when doing a core update
|
| 66 |
-
if ( empty( $_GET['action'] ) || $_GET['action'] != 'do-core-upgrade' ) :
|
| 67 |
-
|
| 68 |
-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
| 69 |
-
|
| 70 |
-
// Custom upgrader skins
|
| 71 |
-
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-plugin-upgrader-skin.php';
|
| 72 |
-
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
|
| 73 |
-
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-core-upgrader-skin.php';
|
| 74 |
-
|
| 75 |
-
endif;
|
| 76 |
-
|
| 77 |
/**
|
| 78 |
* Get a needed URL on the WP Remote site
|
| 79 |
*
|
|
@@ -177,6 +165,8 @@ function _wprp_upgrade_core() {
|
|
| 177 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
| 178 |
include_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
| 179 |
include_once ( ABSPATH . 'wp-includes/update.php' );
|
|
|
|
|
|
|
| 180 |
|
| 181 |
// check for filesystem access
|
| 182 |
if ( ! _wpr_check_filesystem_access() )
|
| 3 |
/*
|
| 4 |
Plugin Name: WP Remote
|
| 5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
|
| 6 |
+
Version: 2.6.5
|
| 7 |
Author: Human Made Limited
|
| 8 |
Author URI: http://hmn.md/
|
| 9 |
*/
|
| 62 |
|
| 63 |
}
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
/**
|
| 66 |
* Get a needed URL on the WP Remote site
|
| 67 |
*
|
| 165 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
| 166 |
include_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
| 167 |
include_once ( ABSPATH . 'wp-includes/update.php' );
|
| 168 |
+
require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
| 169 |
+
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-core-upgrader-skin.php';
|
| 170 |
|
| 171 |
// check for filesystem access
|
| 172 |
if ( ! _wpr_check_filesystem_access() )
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: humanmade, willmot, joehoyle, danielbachhuber, mattheu, pauldewouters, cuvelier, tcrsavage
|
| 3 |
Tags: wpremote, remote administration, multiple wordpress
|
| 4 |
Requires at least: 3.0
|
| 5 |
-
Tested up to: 3.
|
| 6 |
-
Stable tag: 2.6.
|
| 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 |
|
|
@@ -29,8 +29,20 @@ You can email us at support@wpremote.com for support.
|
|
| 29 |
2. Activate the plugin.
|
| 30 |
3. Sign up for an account at wpremote.com and add your site.
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
== Changelog ==
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
#### 2.6.4 (2 October 2013)
|
| 35 |
|
| 36 |
* Misc API improvements for Premium.
|
|
@@ -134,4 +146,8 @@ You can email us at support@wpremote.com for support.
|
|
| 134 |
|
| 135 |
* Start keeping a changelog of plugin changes
|
| 136 |
* Pass home_url, site_url and admin_url to WP Remote instead of guessing at them, fixes issues with the urls being wrong for non-standard WordPress installs
|
| 137 |
-
* Better error message when you have the wrong API key entered.
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
Contributors: humanmade, willmot, joehoyle, danielbachhuber, mattheu, pauldewouters, cuvelier, tcrsavage
|
| 3 |
Tags: wpremote, remote administration, multiple wordpress
|
| 4 |
Requires at least: 3.0
|
| 5 |
+
Tested up to: 3.7
|
| 6 |
+
Stable tag: 2.6.5
|
| 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 |
|
| 29 |
2. Activate the plugin.
|
| 30 |
3. Sign up for an account at wpremote.com and add your site.
|
| 31 |
|
| 32 |
+
== Screenshots ==
|
| 33 |
+
|
| 34 |
+
1. The WP Remote dashboard at wpremote.com
|
| 35 |
+
2. See all of the plugins and themes needing update across all Sites in one view.
|
| 36 |
+
3. Download nightly Automatic Backups (Premium feature).
|
| 37 |
+
|
| 38 |
== Changelog ==
|
| 39 |
|
| 40 |
+
#### 2.6.5 (23 October 2013)
|
| 41 |
+
|
| 42 |
+
* Incorporated a more reliable plugin re-activation process after update.
|
| 43 |
+
* Bug fix: Properly delete backup folders for failed backups. Users may want to look inside of `/wp-content/` for any folders named as `*-backups`. If they were created by WP Remote, they can be safely deleted.
|
| 44 |
+
* Bug fix: Log the proper fields in history when a new user is created.
|
| 45 |
+
|
| 46 |
#### 2.6.4 (2 October 2013)
|
| 47 |
|
| 48 |
* Misc API improvements for Premium.
|
| 146 |
|
| 147 |
* Start keeping a changelog of plugin changes
|
| 148 |
* Pass home_url, site_url and admin_url to WP Remote instead of guessing at them, fixes issues with the urls being wrong for non-standard WordPress installs
|
| 149 |
+
* Better error message when you have the wrong API key entered.
|
| 150 |
+
|
| 151 |
+
## Contribution guidelines ##
|
| 152 |
+
|
| 153 |
+
see https://github.com/humanmade/WP-Remote-WordPress-Plugin/blob/master/CONTRIBUTING.md
|
screenshot-1.png
CHANGED
|
Binary file
|
screenshot-2.png
ADDED
|
Binary file
|
screenshot-3.png
ADDED
|
Binary file
|
wprp.backups.php
CHANGED
|
@@ -147,19 +147,7 @@ class WPRP_Backups extends WPRP_HM_Backup {
|
|
| 147 |
*/
|
| 148 |
public function cleanup() {
|
| 149 |
|
| 150 |
-
$
|
| 151 |
-
|
| 152 |
-
// Remove any .zip files
|
| 153 |
-
foreach ( $zips as $zip )
|
| 154 |
-
unlink( $zip );
|
| 155 |
-
|
| 156 |
-
if ( file_exists( trailingslashit( $this->get_path() ) . 'index.html' ) )
|
| 157 |
-
unlink( trailingslashit( $this->get_path() ) . 'index.html' );
|
| 158 |
-
|
| 159 |
-
if ( file_exists( trailingslashit( $this->get_path() ) . '.htaccess' ) )
|
| 160 |
-
unlink( trailingslashit( $this->get_path() ) . '.htaccess' );
|
| 161 |
-
|
| 162 |
-
rmdir( $this->get_path() );
|
| 163 |
|
| 164 |
delete_option( 'wprp_backup_path' );
|
| 165 |
|
|
@@ -325,7 +313,7 @@ class WPRP_Backups extends WPRP_HM_Backup {
|
|
| 325 |
$contents[] = '';
|
| 326 |
$contents[] = '<IfModule mod_rewrite.c>';
|
| 327 |
$contents[] = 'RewriteEngine On';
|
| 328 |
-
$contents[] = 'RewriteCond %{QUERY_STRING} !key=' .
|
| 329 |
$contents[] = 'RewriteRule (.*) - [F]';
|
| 330 |
$contents[] = '</IfModule>';
|
| 331 |
$contents[] = '';
|
| 147 |
*/
|
| 148 |
public function cleanup() {
|
| 149 |
|
| 150 |
+
$this->rmdir_recursive( $this->get_path() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
delete_option( 'wprp_backup_path' );
|
| 153 |
|
| 313 |
$contents[] = '';
|
| 314 |
$contents[] = '<IfModule mod_rewrite.c>';
|
| 315 |
$contents[] = 'RewriteEngine On';
|
| 316 |
+
$contents[] = 'RewriteCond %{QUERY_STRING} !key=' . $this->key();
|
| 317 |
$contents[] = 'RewriteRule (.*) - [F]';
|
| 318 |
$contents[] = '</IfModule>';
|
| 319 |
$contents[] = '';
|
wprp.hm.backup.php
CHANGED
|
@@ -170,6 +170,10 @@ class WPRP_HM_Backup {
|
|
| 170 |
if ( array_intersect( array( 'shell_exec', 'escapeshellarg', 'escapeshellcmd' ), array_map( 'trim', explode( ',', @ini_get( 'disable_functions' ) ) ) ) )
|
| 171 |
return false;
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
// Can we issue a simple echo command?
|
| 174 |
if ( ! @shell_exec( 'echo backupwordpress' ) )
|
| 175 |
return false;
|
|
@@ -501,7 +505,8 @@ class WPRP_HM_Backup {
|
|
| 501 |
'/Program Files/MySQL/MySQL Server 5.4/bin/mysqldump',
|
| 502 |
'/Program Files/MySQL/MySQL Server 5.1/bin/mysqldump',
|
| 503 |
'/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump',
|
| 504 |
-
'/Program Files/MySQL/MySQL Server 4.1/bin/mysqldump'
|
|
|
|
| 505 |
);
|
| 506 |
|
| 507 |
// Find the one which works
|
|
@@ -562,7 +567,8 @@ class WPRP_HM_Backup {
|
|
| 562 |
|
| 563 |
// List of possible zip locations
|
| 564 |
$zip_locations = array(
|
| 565 |
-
'/usr/bin/zip'
|
|
|
|
| 566 |
);
|
| 567 |
|
| 568 |
// Find the one which works
|
| 170 |
if ( array_intersect( array( 'shell_exec', 'escapeshellarg', 'escapeshellcmd' ), array_map( 'trim', explode( ',', @ini_get( 'disable_functions' ) ) ) ) )
|
| 171 |
return false;
|
| 172 |
|
| 173 |
+
// Functions can also be disabled via suhosin
|
| 174 |
+
if ( array_intersect( array( 'shell_exec', 'escapeshellarg', 'escapeshellcmd' ), array_map( 'trim', explode( ',', @ini_get( 'suhosin.executor.func.blacklist' ) ) ) ) )
|
| 175 |
+
return false;
|
| 176 |
+
|
| 177 |
// Can we issue a simple echo command?
|
| 178 |
if ( ! @shell_exec( 'echo backupwordpress' ) )
|
| 179 |
return false;
|
| 505 |
'/Program Files/MySQL/MySQL Server 5.4/bin/mysqldump',
|
| 506 |
'/Program Files/MySQL/MySQL Server 5.1/bin/mysqldump',
|
| 507 |
'/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump',
|
| 508 |
+
'/Program Files/MySQL/MySQL Server 4.1/bin/mysqldump',
|
| 509 |
+
'/opt/local/bin/mysqldump',
|
| 510 |
);
|
| 511 |
|
| 512 |
// Find the one which works
|
| 567 |
|
| 568 |
// List of possible zip locations
|
| 569 |
$zip_locations = array(
|
| 570 |
+
'/usr/bin/zip',
|
| 571 |
+
'/opt/local/bin/zip',
|
| 572 |
);
|
| 573 |
|
| 574 |
// Find the one which works
|
wprp.log.php
CHANGED
|
@@ -51,22 +51,25 @@ class WPRP_Log {
|
|
| 51 |
|
| 52 |
public function action_user_register( $user_id ) {
|
| 53 |
|
| 54 |
-
$
|
| 55 |
|
| 56 |
// we are only interested in administators
|
| 57 |
-
if ( ! array_intersect( $
|
| 58 |
return;
|
| 59 |
|
| 60 |
$this->add_item( array(
|
| 61 |
-
'type'
|
| 62 |
-
'action'
|
| 63 |
-
'
|
|
|
|
|
|
|
|
|
|
| 64 |
));
|
| 65 |
}
|
| 66 |
|
| 67 |
public function action_profile_updated( $user_id, $old_user_data ) {
|
| 68 |
|
| 69 |
-
$user_data =
|
| 70 |
|
| 71 |
// we are only interested in administators
|
| 72 |
if ( ! array_intersect( $user_data->roles, array( 'administrator' ) ) )
|
|
@@ -79,6 +82,7 @@ class WPRP_Log {
|
|
| 79 |
'action' => 'email-update',
|
| 80 |
'old_email' => $old_user_data->user_email,
|
| 81 |
'new_email' => $user_data->user_email,
|
|
|
|
| 82 |
));
|
| 83 |
}
|
| 84 |
|
|
@@ -86,6 +90,7 @@ class WPRP_Log {
|
|
| 86 |
$this->add_item( array(
|
| 87 |
'type' => 'user',
|
| 88 |
'action' => 'password-update',
|
|
|
|
| 89 |
));
|
| 90 |
}
|
| 91 |
}
|
|
@@ -96,7 +101,8 @@ class WPRP_Log {
|
|
| 96 |
'type' => 'theme',
|
| 97 |
'action' => 'switch',
|
| 98 |
'old_theme' => $old_theme,
|
| 99 |
-
'new_theme' => $new_theme
|
|
|
|
| 100 |
));
|
| 101 |
}
|
| 102 |
|
| 51 |
|
| 52 |
public function action_user_register( $user_id ) {
|
| 53 |
|
| 54 |
+
$new_user = get_user_by( 'id', $user_id );
|
| 55 |
|
| 56 |
// we are only interested in administators
|
| 57 |
+
if ( ! array_intersect( $new_user->roles, array( 'administrator' ) ) )
|
| 58 |
return;
|
| 59 |
|
| 60 |
$this->add_item( array(
|
| 61 |
+
'type' => 'user',
|
| 62 |
+
'action' => 'create',
|
| 63 |
+
'user_login' => $new_user->user_login,
|
| 64 |
+
'display_name' => $new_user->display_name,
|
| 65 |
+
'role' => $new_user->roles[0],
|
| 66 |
+
/** remote_user is added in the `add_item()` method **/
|
| 67 |
));
|
| 68 |
}
|
| 69 |
|
| 70 |
public function action_profile_updated( $user_id, $old_user_data ) {
|
| 71 |
|
| 72 |
+
$user_data = get_user_by( 'id', $user_id );
|
| 73 |
|
| 74 |
// we are only interested in administators
|
| 75 |
if ( ! array_intersect( $user_data->roles, array( 'administrator' ) ) )
|
| 82 |
'action' => 'email-update',
|
| 83 |
'old_email' => $old_user_data->user_email,
|
| 84 |
'new_email' => $user_data->user_email,
|
| 85 |
+
/** remote_user is added in the `add_item()` method **/
|
| 86 |
));
|
| 87 |
}
|
| 88 |
|
| 90 |
$this->add_item( array(
|
| 91 |
'type' => 'user',
|
| 92 |
'action' => 'password-update',
|
| 93 |
+
/** remote_user is added in the `add_item()` method **/
|
| 94 |
));
|
| 95 |
}
|
| 96 |
}
|
| 101 |
'type' => 'theme',
|
| 102 |
'action' => 'switch',
|
| 103 |
'old_theme' => $old_theme,
|
| 104 |
+
'new_theme' => $new_theme,
|
| 105 |
+
/** remote_user is added in the `add_item()` method **/
|
| 106 |
));
|
| 107 |
}
|
| 108 |
|
wprp.plugins.php
CHANGED
|
@@ -9,9 +9,6 @@ function _wprp_get_plugins() {
|
|
| 9 |
|
| 10 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
| 11 |
|
| 12 |
-
// Disabled 10/2/13 because buggy all the time
|
| 13 |
-
// _wpr_add_non_extend_plugin_support_filter();
|
| 14 |
-
|
| 15 |
// Get all plugins
|
| 16 |
$plugins = get_plugins();
|
| 17 |
|
|
@@ -74,12 +71,12 @@ function _wprp_get_plugins() {
|
|
| 74 |
function _wprp_update_plugin( $plugin ) {
|
| 75 |
|
| 76 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
|
|
|
|
|
|
| 77 |
|
| 78 |
if ( ! _wprp_supports_plugin_upgrade() )
|
| 79 |
return array( 'status' => 'error', 'error' => 'WordPress version too old for plugin upgrades' );
|
| 80 |
|
| 81 |
-
_wpr_add_non_extend_plugin_support_filter();
|
| 82 |
-
|
| 83 |
// check for filesystem access
|
| 84 |
if ( ! _wpr_check_filesystem_access() )
|
| 85 |
return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );
|
|
@@ -97,52 +94,22 @@ function _wprp_update_plugin( $plugin ) {
|
|
| 97 |
$data = ob_get_contents();
|
| 98 |
ob_clean();
|
| 99 |
|
| 100 |
-
if (
|
| 101 |
-
return array( 'status' => 'error', 'error' => 'file_permissions_error' );
|
| 102 |
-
|
| 103 |
-
elseif ( is_wp_error( $result ) )
|
| 104 |
-
return array( 'status' => 'error', 'error' => $result->get_error_code() );
|
| 105 |
-
|
| 106 |
-
if ( $skin->error )
|
| 107 |
-
return array( 'status' => 'error', 'error' => $skin->error );
|
| 108 |
-
|
| 109 |
-
// If the plugin was activited, we have to re-activate it
|
| 110 |
-
if ( $is_active ) {
|
| 111 |
-
|
| 112 |
-
// we can not use the "normal" way or lazy activating, as thet requires wpremote to be activated
|
| 113 |
-
if ( strpos( $plugin, 'wpremote' ) !== false ) {
|
| 114 |
-
activate_plugin( $plugin, '', false, true );
|
| 115 |
-
return array( 'status' => 'success' );
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
// we do a remote request to activate, as we don't want to kill any installs
|
| 119 |
-
$data = array( 'actions' => array( 'activate_plugin' ), 'plugin' => $plugin, 'timestamp' => (string) time() );
|
| 120 |
-
|
| 121 |
-
list( $hash ) = WPR_API_Request::generate_hashes( $data );
|
| 122 |
-
|
| 123 |
-
$data['wpr_verify_key'] = $hash;
|
| 124 |
-
|
| 125 |
-
$args = array( 'body' => $data );
|
| 126 |
-
|
| 127 |
-
$request = wp_remote_post( get_bloginfo( 'url' ), $args );
|
| 128 |
|
| 129 |
-
|
| 130 |
-
return array( 'status' => 'error', 'error' => $request->get_error_code() );
|
| 131 |
-
}
|
| 132 |
|
| 133 |
-
|
| 134 |
|
| 135 |
-
|
| 136 |
-
return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate.' );
|
| 137 |
|
| 138 |
-
|
| 139 |
|
| 140 |
-
|
| 141 |
-
return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation request returned no response' );
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
|
|
|
| 146 |
|
| 147 |
return array( 'status' => 'success' );
|
| 148 |
}
|
|
@@ -266,102 +233,3 @@ function _wprp_supports_plugin_upgrade() {
|
|
| 266 |
return class_exists( 'Plugin_Upgrader' );
|
| 267 |
|
| 268 |
}
|
| 269 |
-
|
| 270 |
-
function _wpr_add_non_extend_plugin_support_filter() {
|
| 271 |
-
add_filter( 'pre_set_site_transient_update_plugins', '_wpr_add_non_extend_plugin_support' );
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
function _wpr_add_non_extend_plugin_support( $value ) {
|
| 275 |
-
|
| 276 |
-
foreach( $non_extend_list = _wprp_get_non_extend_plugins_data() as $key => $anon_function ) {
|
| 277 |
-
|
| 278 |
-
if ( ( $returned = call_user_func( $non_extend_list[$key] ) ) )
|
| 279 |
-
$value->response[$returned->plugin_location] = $returned;
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
return $value;
|
| 283 |
-
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
function _wprp_get_non_extend_plugins_data() {
|
| 288 |
-
|
| 289 |
-
return array(
|
| 290 |
-
'gravity_forms' => '_wpr_get_gravity_form_plugin_data',
|
| 291 |
-
'backupbuddy' => '_wpr_get_backupbuddy_plugin_data',
|
| 292 |
-
'tribe_events_pro' => '_wpr_get_tribe_events_pro_plugin_data'
|
| 293 |
-
);
|
| 294 |
-
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
-
function _wpr_get_gravity_form_plugin_data() {
|
| 298 |
-
|
| 299 |
-
if ( ! class_exists('GFCommon') || ! method_exists( 'GFCommon', 'get_version_info' ) || ! method_exists( 'RGForms', 'premium_update_push' ) )
|
| 300 |
-
return false;
|
| 301 |
-
|
| 302 |
-
$version_data = GFCommon::get_version_info();
|
| 303 |
-
$gravity_forms_update = RGForms::premium_update_push( array() );
|
| 304 |
-
$plugin_data = reset( $gravity_forms_update );
|
| 305 |
-
|
| 306 |
-
if ( empty( $version_data['url'] ) || empty( $version_data['is_valid_key'] ) || empty( $plugin_data['new_version'] ) || empty( $plugin_data['PluginURI'] ) || empty( $plugin_data['slug'] ) )
|
| 307 |
-
return false;
|
| 308 |
-
|
| 309 |
-
return (object) array(
|
| 310 |
-
'plugin_location' => $plugin_data['slug'], //Not in standard structure but don't forget to include it!
|
| 311 |
-
'id' => 999999999,
|
| 312 |
-
'slug' => 'gravityforms',
|
| 313 |
-
'url' => $plugin_data['PluginURI'],
|
| 314 |
-
'package' => $version_data['url'],
|
| 315 |
-
'new_version' => $version_data['version']
|
| 316 |
-
);
|
| 317 |
-
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
function _wpr_get_backupbuddy_plugin_data() {
|
| 321 |
-
|
| 322 |
-
if ( !class_exists('pb_backupbuddy') )
|
| 323 |
-
return false;
|
| 324 |
-
|
| 325 |
-
if ( ! file_exists( pb_backupbuddy::plugin_path() . '/pluginbuddy/lib/updater/updater.php' ) )
|
| 326 |
-
return false;
|
| 327 |
-
|
| 328 |
-
require_once( pb_backupbuddy::plugin_path() . '/pluginbuddy/lib/updater/updater.php' );
|
| 329 |
-
$preloader_class = 'pb_' . pb_backupbuddy::settings( 'slug' ) . '_updaterpreloader';
|
| 330 |
-
$updater_preloader = new $preloader_class( pb_backupbuddy::settings( 'slug' ) );
|
| 331 |
-
$updater_preloader->upgrader_register();
|
| 332 |
-
$updater_preloader->upgrader_select();
|
| 333 |
-
|
| 334 |
-
if ( !is_a( pb_backupbuddy::$_updater, 'pb_backupbuddy_updater' ) || !method_exists( pb_backupbuddy::$_updater, 'check_for_updates' ) )
|
| 335 |
-
return false;
|
| 336 |
-
|
| 337 |
-
$current_version = pb_backupbuddy::settings( 'version' );
|
| 338 |
-
$update_data = pb_backupbuddy::$_updater->check_for_updates();
|
| 339 |
-
|
| 340 |
-
if ( $update_data->key_status != 'ok' || version_compare( $update_data->new_version, $current_version, '<=' ) )
|
| 341 |
-
return false;
|
| 342 |
-
|
| 343 |
-
$update_data->plugin_location = plugin_basename( pb_backupbuddy::plugin_path() . '/backupbuddy.php' ); // needed in _wpr_add_non_extend_plugin_support()
|
| 344 |
-
|
| 345 |
-
return $update_data;
|
| 346 |
-
|
| 347 |
-
}
|
| 348 |
-
|
| 349 |
-
function _wpr_get_tribe_events_pro_plugin_data() {
|
| 350 |
-
|
| 351 |
-
if ( !class_exists( 'TribeEventsPro' ) || ! class_exists( 'PluginUpdateEngineChecker' ) )
|
| 352 |
-
return false;
|
| 353 |
-
|
| 354 |
-
$events = TribeEventsPro::instance();
|
| 355 |
-
$updater = new PluginUpdateEngineChecker( $events->updateUrl, $events->pluginSlug, array(), plugin_basename( $events->pluginPath . 'events-calendar-pro.php' ) );
|
| 356 |
-
$state = get_option( $updater->optionName );
|
| 357 |
-
|
| 358 |
-
if ( !is_a( $state->update, 'PluginUpdateUtility' ) )
|
| 359 |
-
return false;
|
| 360 |
-
|
| 361 |
-
if ( version_compare( $state->update->version, $updater->getInstalledVersion(), '<=' ) )
|
| 362 |
-
return false;
|
| 363 |
-
|
| 364 |
-
$update_data = $state->update->toWpFormat();
|
| 365 |
-
$update_data->plugin_location = $updater->pluginFile; // needed in _wpr_add_non_extend_plugin_support()
|
| 366 |
-
|
| 367 |
-
}
|
| 9 |
|
| 10 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
// Get all plugins
|
| 13 |
$plugins = get_plugins();
|
| 14 |
|
| 71 |
function _wprp_update_plugin( $plugin ) {
|
| 72 |
|
| 73 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
| 74 |
+
require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
| 75 |
+
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-plugin-upgrader-skin.php';
|
| 76 |
|
| 77 |
if ( ! _wprp_supports_plugin_upgrade() )
|
| 78 |
return array( 'status' => 'error', 'error' => 'WordPress version too old for plugin upgrades' );
|
| 79 |
|
|
|
|
|
|
|
| 80 |
// check for filesystem access
|
| 81 |
if ( ! _wpr_check_filesystem_access() )
|
| 82 |
return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );
|
| 94 |
$data = ob_get_contents();
|
| 95 |
ob_clean();
|
| 96 |
|
| 97 |
+
if ( ! empty( $skin->error ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
return array( 'status' => 'error', 'error' => $upgrader->strings[$skin->error] );
|
|
|
|
|
|
|
| 100 |
|
| 101 |
+
else if ( is_wp_error( $result ) )
|
| 102 |
|
| 103 |
+
return array( 'status' => 'error', 'error' => $result->get_error_code() );
|
|
|
|
| 104 |
|
| 105 |
+
else if ( ( ! $result && ! is_null( $result ) ) || $data )
|
| 106 |
|
| 107 |
+
return array( 'status' => 'error', 'error' => 'Unknown error updating plugin.' );
|
|
|
|
| 108 |
|
| 109 |
+
// If the plugin was activited, we have to re-activate it
|
| 110 |
+
// but if activate_plugin() fatals, then we'll just have to return 500
|
| 111 |
+
if ( $is_active )
|
| 112 |
+
activate_plugin( $plugin, '', false, true );
|
| 113 |
|
| 114 |
return array( 'status' => 'success' );
|
| 115 |
}
|
| 233 |
return class_exists( 'Plugin_Upgrader' );
|
| 234 |
|
| 235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wprp.themes.php
CHANGED
|
@@ -9,9 +9,6 @@ function _wprp_get_themes() {
|
|
| 9 |
|
| 10 |
require_once( ABSPATH . '/wp-admin/includes/theme.php' );
|
| 11 |
|
| 12 |
-
// Disabled 10/2/2013 because causes fatals all the time.
|
| 13 |
-
// _wpr_add_non_extend_theme_support_filter();
|
| 14 |
-
|
| 15 |
// Get all themes
|
| 16 |
if ( function_exists( 'wp_get_themes' ) )
|
| 17 |
$themes = wp_get_themes();
|
|
@@ -158,12 +155,12 @@ function _wprp_activate_theme( $theme ) {
|
|
| 158 |
function _wprp_update_theme( $theme ) {
|
| 159 |
|
| 160 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
|
|
|
|
|
|
| 161 |
|
| 162 |
if ( ! _wprp_supports_theme_upgrade() )
|
| 163 |
return array( 'status' => 'error', 'error' => 'WordPress version too old for theme upgrades' );
|
| 164 |
|
| 165 |
-
_wpr_add_non_extend_theme_support_filter();
|
| 166 |
-
|
| 167 |
// check for filesystem access
|
| 168 |
if ( ! _wpr_check_filesystem_access() )
|
| 169 |
return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );
|
|
@@ -240,55 +237,3 @@ function _wprp_supports_theme_upgrade() {
|
|
| 240 |
return class_exists( 'Theme_Upgrader' );
|
| 241 |
|
| 242 |
}
|
| 243 |
-
|
| 244 |
-
function _wpr_add_non_extend_theme_support_filter() {
|
| 245 |
-
add_filter( 'pre_set_site_transient_update_themes', '_wpr_add_non_extend_theme_support' );
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
function _wpr_add_non_extend_theme_support( $value ) {
|
| 249 |
-
|
| 250 |
-
foreach( $non_extend_list = _wprp_get_non_extend_themes_data() as $key => $anon_function ) {
|
| 251 |
-
|
| 252 |
-
if ( ( $returned = call_user_func( $non_extend_list[$key] ) ) )
|
| 253 |
-
$value->response[ $returned['Template'] ] = $returned;
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
-
return $value;
|
| 257 |
-
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
function _wprp_get_non_extend_themes_data() {
|
| 262 |
-
|
| 263 |
-
return array(
|
| 264 |
-
'pagelines' => '_wpr_get_pagelines_theme_data'
|
| 265 |
-
);
|
| 266 |
-
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
-
function _wpr_get_pagelines_theme_data() {
|
| 270 |
-
|
| 271 |
-
global $global_pagelines_settings;
|
| 272 |
-
|
| 273 |
-
if ( !class_exists( 'PageLinesUpdateCheck' ) )
|
| 274 |
-
return false;
|
| 275 |
-
|
| 276 |
-
if ( defined( 'PL_CORE_VERSION' ) )
|
| 277 |
-
$version = PL_CORE_VERSION;
|
| 278 |
-
elseif ( defined( 'CORE_VERSION' ) )
|
| 279 |
-
$version = CORE_VERSION;
|
| 280 |
-
else
|
| 281 |
-
return false;
|
| 282 |
-
|
| 283 |
-
$global_pagelines_settings['disable_updates'] = true; // prevent endless loop in PageLinesUpdateCheck::pagelines_theme_check_version()
|
| 284 |
-
$updater = new PageLinesUpdateCheck( $version );
|
| 285 |
-
$update_data = (array) maybe_unserialize( $updater->pagelines_theme_update_check() );
|
| 286 |
-
|
| 287 |
-
if ( $update_data && isset( $update_data['package'] ) && $update_data['package'] !== 'bad' ) {
|
| 288 |
-
$update_data['Template'] = 'pagelines'; // needed in _wpr_add_non_extend_theme_support()
|
| 289 |
-
return $update_data;
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
return false;
|
| 293 |
-
|
| 294 |
-
}
|
| 9 |
|
| 10 |
require_once( ABSPATH . '/wp-admin/includes/theme.php' );
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
// Get all themes
|
| 13 |
if ( function_exists( 'wp_get_themes' ) )
|
| 14 |
$themes = wp_get_themes();
|
| 155 |
function _wprp_update_theme( $theme ) {
|
| 156 |
|
| 157 |
include_once ( ABSPATH . 'wp-admin/includes/admin.php' );
|
| 158 |
+
require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
| 159 |
+
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
|
| 160 |
|
| 161 |
if ( ! _wprp_supports_theme_upgrade() )
|
| 162 |
return array( 'status' => 'error', 'error' => 'WordPress version too old for theme upgrades' );
|
| 163 |
|
|
|
|
|
|
|
| 164 |
// check for filesystem access
|
| 165 |
if ( ! _wpr_check_filesystem_access() )
|
| 166 |
return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );
|
| 237 |
return class_exists( 'Theme_Upgrader' );
|
| 238 |
|
| 239 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
