WP Rollback - Version 1.3

Version Description

  • Tested compatibility with WordPress 4.4 and verified as working; bumped up compatibility
  • Fix: Trying to get property of non-object warning - https://github.com/WordImpress/WP-Rollback/issues/20
  • Improvement: Better version sorting now using usort & version_compare - https://github.com/WordImpress/WP-Rollback/issues/16
Download this release

Release Info

Developer webdevmattcrom
Plugin Icon 128x128 WP Rollback
Version 1.3
Comparing to
See all releases

Code changes from version 1.2.4 to 1.3

assets/css/wp-rollback.css CHANGED
@@ -6,11 +6,11 @@
6
  max-width: 805px;
7
  }
8
 
9
- .wpr-content-wrap h2 {
10
  padding: 0 0 15px 0;
11
  }
12
 
13
- .wpr-content-wrap h2 img {
14
  width: 40px;
15
  position: relative;
16
  top: 11px;
@@ -68,12 +68,6 @@
68
  .wpr-rollback-disabled.magnific-popup.button-primary {
69
  opacity: 0.6;
70
  cursor: default;
71
- background: #B5B5B5;
72
- border-color: #6B6B6B;
73
- -webkit-box-shadow: inset 0 1px 0 rgba(249, 251, 252, 0.5), 0 1px 0 rgba( 0, 0, 0, 0.15 );
74
- box-shadow: inset 0 1px 0 rgba(249, 251, 252, 0.5), 0 1px 0 rgba( 0, 0, 0, 0.15 );
75
- color: #777;
76
- text-decoration: none;
77
  }
78
 
79
  .button-primary {
6
  max-width: 805px;
7
  }
8
 
9
+ .wpr-content-wrap h1 {
10
  padding: 0 0 15px 0;
11
  }
12
 
13
+ .wpr-content-wrap h1 img {
14
  width: 40px;
15
  position: relative;
16
  top: 11px;
68
  .wpr-rollback-disabled.magnific-popup.button-primary {
69
  opacity: 0.6;
70
  cursor: default;
 
 
 
 
 
 
71
  }
72
 
73
  .button-primary {
includes/rollback-menu.php CHANGED
@@ -20,9 +20,9 @@ $plugins = get_plugins();
20
 
21
  <div class="wpr-content-wrap">
22
 
23
- <h2>
24
  <img src="<?php echo WP_ROLLBACK_PLUGIN_URL; ?>/assets/images/wprb-icon-final.svg" onerror="this.onerror=null; this.src='<?php echo WP_ROLLBACK_PLUGIN_URL; ?>/assets/images/wprb-logo.png'"><?php _e( 'WP Rollback', 'wpr' ); ?>
25
- </h2>
26
 
27
  <p><?php echo apply_filters( 'wpr_rollback_description', sprintf( __( 'Please select which %1$s version you would like to rollback to from the releases listed below. You currently have version %2$s installed of %3$s.', 'wpr' ), '<span class="type">' . ( $theme_rollback == true ? __( 'theme', 'wpr' ) : __( 'plugin', 'wpr' ) ) . '</span>', '<span class="current-version">' . esc_html( $args['current_version'] ) . '</span>', '<span class="rollback-name">' . esc_html( $args['rollback_name'] ) . '</span>' ) ); ?></p>
28
 
20
 
21
  <div class="wpr-content-wrap">
22
 
23
+ <h1>
24
  <img src="<?php echo WP_ROLLBACK_PLUGIN_URL; ?>/assets/images/wprb-icon-final.svg" onerror="this.onerror=null; this.src='<?php echo WP_ROLLBACK_PLUGIN_URL; ?>/assets/images/wprb-logo.png'"><?php _e( 'WP Rollback', 'wpr' ); ?>
25
+ </h1>
26
 
27
  <p><?php echo apply_filters( 'wpr_rollback_description', sprintf( __( 'Please select which %1$s version you would like to rollback to from the releases listed below. You currently have version %2$s installed of %3$s.', 'wpr' ), '<span class="type">' . ( $theme_rollback == true ? __( 'theme', 'wpr' ) : __( 'plugin', 'wpr' ) ) . '</span>', '<span class="current-version">' . esc_html( $args['current_version'] ) . '</span>', '<span class="rollback-name">' . esc_html( $args['rollback_name'] ) . '</span>' ) ); ?></p>
28
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Rollback ===
2
  Contributors: wordimpress, dlocc, drrobotnik, webdevmattcrom
3
  Tags: rollback, revert, downgrade, version, plugins, themes, version, versions, backup, backups, revision, revisions
4
- Requires at least: 3.8
5
  Donate Link: https://wordimpress.com
6
- Tested up to: 4.2.3
7
- Stable tag: 1.2.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -65,11 +65,9 @@ Automatic updates should work like a charm; as always though, ensure you backup
65
  = Is this plugin safe to use? =
66
  Short answer = Yes. Longer answer = It depends on how you use it.
67
 
68
- WP Rollback is completely safe because all it does is take publicly available versions of the plugins you already have on your site and install the version that you designate. There is no other kinds of trickery or fancy offsite calls or anything.
69
 
70
- **BUT!!!**
71
-
72
- It depends on you. We absolutely do NOT recommend rolling back any plugins or themes on a live site. Test the rollback locally first, have backups, use all the best practice tools available to you. This is intended to make rolling back easier, that's all.
73
 
74
  = Why isn't there a rollback button next to X plugin or theme? =
75
 
@@ -87,6 +85,10 @@ The documentation for this plugin is located on our [Github Wiki](https://github
87
 
88
  Yes! All strings are internationalized and ready to be translated. Simply use the languages/wp-rollback.pot file and your favorite translation tool. Once finished, please reach out to us on the WordPress.org forums or better yet, submit a pull request on the [Github Repo](https://github.com/WordImpress/WP-Rollback/).
89
 
 
 
 
 
90
  == Screenshots ==
91
 
92
  1. The Rollback link on the Plugins page.
@@ -109,6 +111,11 @@ This is the first version of this plugin. It is a tool for your convenience. Rol
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
112
  = 1.2.4 =
113
  * New: Portuguese translations added
114
  * Fix: Limit HTTP requests to Plugin page only #17 @see: https://wordpress.org/support/topic/great-plugin-but-small-issue?replies=5 and https://wordpress.org/support/topic/great-plugin-but-small-issue?replies=1#post-7234287
1
  === WP Rollback ===
2
  Contributors: wordimpress, dlocc, drrobotnik, webdevmattcrom
3
  Tags: rollback, revert, downgrade, version, plugins, themes, version, versions, backup, backups, revision, revisions
4
+ Requires at least: 4.0
5
  Donate Link: https://wordimpress.com
6
+ Tested up to: 4.5
7
+ Stable tag: 1.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
65
  = Is this plugin safe to use? =
66
  Short answer = Yes. Longer answer = It depends on how you use it.
67
 
68
+ WP Rollback is completely safe because all it does is take publicly available versions of the plugins you already have on your site and install the version that you designate. There is no other kinds of trickery or fancy offsite calls or anything. BUT!!!
69
 
70
+ Safety largely depends on you. The WordPress website admin. We absolutely do NOT recommend rolling back any plugins or themes on a live site. Test the rollback locally first, have backups, use all the best practice tools available to you. This is intended to make rolling back easier, that's all.
 
 
71
 
72
  = Why isn't there a rollback button next to X plugin or theme? =
73
 
85
 
86
  Yes! All strings are internationalized and ready to be translated. Simply use the languages/wp-rollback.pot file and your favorite translation tool. Once finished, please reach out to us on the WordPress.org forums or better yet, submit a pull request on the [Github Repo](https://github.com/WordImpress/WP-Rollback/).
87
 
88
+ = Did this plugin with WordCamp Orange County's Plugin-Palooza? =
89
+
90
+ Heck yes it did! The WordImpress team took home the gold.
91
+
92
  == Screenshots ==
93
 
94
  1. The Rollback link on the Plugins page.
111
 
112
  == Changelog ==
113
 
114
+ = 1.3 =
115
+ * Tested compatibility with WordPress 4.4 and verified as working; bumped up compatibility
116
+ * Fix: Trying to get property of non-object warning - https://github.com/WordImpress/WP-Rollback/issues/20
117
+ * Improvement: Better version sorting now using usort & version_compare - https://github.com/WordImpress/WP-Rollback/issues/16
118
+
119
  = 1.2.4 =
120
  * New: Portuguese translations added
121
  * Fix: Limit HTTP requests to Plugin page only #17 @see: https://wordpress.org/support/topic/great-plugin-but-small-issue?replies=5 and https://wordpress.org/support/topic/great-plugin-but-small-issue?replies=1#post-7234287
wp-rollback.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Rollback (or forward) any WordPress.org plugin or theme like a boss.
6
  * Author: WordImpress
7
  * Author URI: http://wordimpress.com
8
- * Version: 1.2.4
9
  * Text Domain: wpr
10
  * Domain Path: languages
11
  *
@@ -85,7 +85,7 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
85
  self::$instance->setup_constants();
86
 
87
  //Only setup plugin rollback on specific page
88
- if(isset($_GET['plugin_file']) && $_GET['page'] == 'wp-rollback') {
89
  self::$instance->setup_plugin_vars();
90
  }
91
 
@@ -207,7 +207,7 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
207
  wp_localize_script( 'wp_rollback_themes_script', 'wpr_vars', array(
208
  'ajaxurl' => admin_url(),
209
  'ajax_loader' => admin_url( 'images/spinner.gif' ),
210
- 'nonce' => wp_create_nonce( 'wpr_rollback_nonce' ),
211
  'text_rollback_label' => __( 'Rollback', 'wpr' ),
212
  'text_not_rollbackable' => __( 'No Rollback Available: This is a non-WordPress.org theme.', 'wpr' ),
213
  'text_loading_rollback' => __( 'Loading...', 'wpr' ),
@@ -293,7 +293,6 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
293
  ) );
294
 
295
 
296
-
297
  $args = wp_parse_args( $_GET, $defaults );
298
 
299
  if ( ! empty( $args['plugin_version'] ) ) {
@@ -402,6 +401,10 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
402
 
403
  $versions_html = '';
404
 
 
 
 
 
405
  //Loop through versions and output in a radio list
406
  foreach ( $this->versions as $version ) {
407
 
@@ -440,8 +443,9 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
440
 
441
  $plugin_file = WP_PLUGIN_DIR . '/' . $_GET['plugin_file'];
442
 
443
- if( !file_exists( $plugin_file ) )
444
  wp_die( 'Plugin you\'re referencing does not exist.' );
 
445
 
446
  $plugin_data = get_plugin_data( $plugin_file, false, false );
447
 
@@ -523,7 +527,7 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
523
  $rollback_url = add_query_arg( apply_filters( 'wpr_plugin_query_args', array(
524
  'current_version' => urlencode( $plugin_data['Version'] ),
525
  'rollback_name' => urlencode( $plugin_data['Name'] ),
526
- '_wpnonce' => wp_create_nonce( 'wpr_rollback_nonce' )
527
  ) ), $rollback_url );
528
  }
529
 
@@ -674,7 +678,11 @@ if ( ! class_exists( 'WP Rollback' ) ) : /**
674
  function wpr_prepare_themes_js( $prepared_themes ) {
675
  $themes = array();
676
  $wp_themes = get_site_transient( 'rollback_themes' );
677
- $rollbacks = $wp_themes->response;
 
 
 
 
678
 
679
  foreach ( $prepared_themes as $key => $value ) {
680
  $themes[ $key ] = $prepared_themes[ $key ];
5
  * Description: Rollback (or forward) any WordPress.org plugin or theme like a boss.
6
  * Author: WordImpress
7
  * Author URI: http://wordimpress.com
8
+ * Version: 1.3
9
  * Text Domain: wpr
10
  * Domain Path: languages
11
  *
85
  self::$instance->setup_constants();
86
 
87
  //Only setup plugin rollback on specific page
88
+ if ( isset( $_GET['plugin_file'] ) && $_GET['page'] == 'wp-rollback' ) {
89
  self::$instance->setup_plugin_vars();
90
  }
91
 
207
  wp_localize_script( 'wp_rollback_themes_script', 'wpr_vars', array(
208
  'ajaxurl' => admin_url(),
209
  'ajax_loader' => admin_url( 'images/spinner.gif' ),
210
+ 'nonce' => wp_create_nonce( 'wpr_rollback_nonce' ),
211
  'text_rollback_label' => __( 'Rollback', 'wpr' ),
212
  'text_not_rollbackable' => __( 'No Rollback Available: This is a non-WordPress.org theme.', 'wpr' ),
213
  'text_loading_rollback' => __( 'Loading...', 'wpr' ),
293
  ) );
294
 
295
 
 
296
  $args = wp_parse_args( $_GET, $defaults );
297
 
298
  if ( ! empty( $args['plugin_version'] ) ) {
401
 
402
  $versions_html = '';
403
 
404
+ usort( $this->versions, 'version_compare' );
405
+
406
+ $this->versions = array_reverse($this->versions);
407
+
408
  //Loop through versions and output in a radio list
409
  foreach ( $this->versions as $version ) {
410
 
443
 
444
  $plugin_file = WP_PLUGIN_DIR . '/' . $_GET['plugin_file'];
445
 
446
+ if ( ! file_exists( $plugin_file ) ) {
447
  wp_die( 'Plugin you\'re referencing does not exist.' );
448
+ }
449
 
450
  $plugin_data = get_plugin_data( $plugin_file, false, false );
451
 
527
  $rollback_url = add_query_arg( apply_filters( 'wpr_plugin_query_args', array(
528
  'current_version' => urlencode( $plugin_data['Version'] ),
529
  'rollback_name' => urlencode( $plugin_data['Name'] ),
530
+ '_wpnonce' => wp_create_nonce( 'wpr_rollback_nonce' )
531
  ) ), $rollback_url );
532
  }
533
 
678
  function wpr_prepare_themes_js( $prepared_themes ) {
679
  $themes = array();
680
  $wp_themes = get_site_transient( 'rollback_themes' );
681
+
682
+ if ( is_object( $wp_themes ) ) {
683
+ $rollbacks = $wp_themes->response;
684
+ }
685
+
686
 
687
  foreach ( $prepared_themes as $key => $value ) {
688
  $themes[ $key ] = $prepared_themes[ $key ];