PHP Compatibility Checker - Version 1.1.2

Version Description

  • Fixed issue with WordPress notices breaking the plugin header.
  • Changed the way we send and parse JSON.
  • You can now restart an in progress scan.
  • Updated download.js to v4.2 for better Safari compatibility.
Download this release

Release Info

Developer wpengine
Plugin Icon 128x128 PHP Compatibility Checker
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === PHP Compatibility Checker ===
2
- Contributors: wpengine, octalmage, stevenkword, taylor4484
3
  Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
4
- Requires at least: 3.0.1
5
  Tested up to: 4.5
6
- Stable tag: 1.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -112,6 +112,12 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
115
  = 1.1.1 =
116
  - Fixed bug with active job display.
117
  - Updated progress bar calculation.
@@ -147,6 +153,8 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
147
 
148
  == Upgrade Notice ==
149
 
150
- = 1.1.1 =
151
- - Fixed bug with active job display.
152
- - Updated progress bar calculation.
 
 
1
  === PHP Compatibility Checker ===
2
+ Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross
3
  Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
4
+ Requires at least: 3.5
5
  Tested up to: 4.5
6
+ Stable tag: 1.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
112
 
113
  == Changelog ==
114
 
115
+ = 1.1.2 =
116
+ - Fixed issue with WordPress notices breaking the plugin header.
117
+ - Changed the way we send and parse JSON.
118
+ - You can now restart an in progress scan.
119
+ - Updated download.js to v4.2 for better Safari compatibility.
120
+
121
  = 1.1.1 =
122
  - Fixed bug with active job display.
123
  - Updated progress bar calculation.
153
 
154
  == Upgrade Notice ==
155
 
156
+ = 1.1.2 =
157
+ - Fixed issue with WordPress notices breaking the plugin header.
158
+ - Changed the way we send and parse JSON.
159
+ - You can now restart an in progress scan.
160
+ - Updated download.js to v4.2 for better Safari compatibility.
src/js/download.min.js CHANGED
@@ -1,2 +1,2 @@
1
- //download.js v3.1, by dandavis; 2008-2015. [CCBY2] see http://danml.com/download.html for tests/usage
2
- (function(f,a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():f.download=a()})(this,function(){return function(f,a,b){function n(l){var a=l.split(/[:;,]/);l=a[1];var a=("base64"==a[2]?atob:decodeURIComponent)(a.pop()),c=a.length,b=0,d=new Uint8Array(c);for(b;b<c;++b)d[b]=a.charCodeAt(b);return new g([d],{type:l})}function k(a,b){if("download"in d)return d.href=a,d.setAttribute("download",m),d.innerHTML="downloading...",h.body.appendChild(d),setTimeout(function(){d.click(),h.body.removeChild(d),!0===b&&setTimeout(function(){e.URL.revokeObjectURL(d.href)},250)},66),!0;if("undefined"!=typeof safari)return a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream"),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=h.createElement("iframe");h.body.appendChild(c),b||(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){h.body.removeChild(c)},333)}var e=window;b=b||"application/octet-stream";var c=f,h=document,d=h.createElement("a");f=function(a){return String(a)};var g=e.Blob||e.MozBlob||e.WebKitBlob||f,g=g.call?g.bind(e):Blob,m=a||"download";"true"===String(this)&&(c=[c,b],b=c[0],c=c[1]);if(String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(n(c),m):k(c);a=c instanceof g?c:new g([c],{type:b});if(navigator.msSaveBlob)return navigator.msSaveBlob(a,m);if(e.URL)k(e.URL.createObjectURL(a),!0);else{if("string"==typeof a||a.constructor===f)try{return k("data:"+b+";base64,"+e.btoa(a))}catch(p){return k("data:"+b+","+encodeURIComponent(a))}b=new FileReader,b.onload=function(a){k(this.result)},b.readAsDataURL(a)}return!0}});
1
+ //download.js v4.2, by dandavis; 2008-2016. [CCBY2] see http://danml.com/download.html for tests/usage
2
+ (function(r,k){"function"==typeof define&&define.amd?define([],k):"object"==typeof exports?module.exports=k():r.download=k()})(this,function(){return function k(a,b,g){function q(p){var a=p.split(/[:;,]/);p=a[1];var a=("base64"==a[2]?atob:decodeURIComponent)(a.pop()),d=a.length,b=0,c=new Uint8Array(d);for(b;b<d;++b)c[b]=a.charCodeAt(b);return new f([c],{type:p})}function l(a,b){if("download"in d)return d.href=a,d.setAttribute("download",m),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout(function(){d.click(),document.body.removeChild(d),!0===b&&setTimeout(function(){e.URL.revokeObjectURL(d.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return a=a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream"),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=document.createElement("iframe");document.body.appendChild(c),b||(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){document.body.removeChild(c)},333)}var e=window,c=g||"application/octet-stream",h=!b&&!g&&a,d=document.createElement("a");g=function(a){return String(a)};var f=e.Blob||e.MozBlob||e.WebKitBlob||g,m=b||"download",f=f.call?f.bind(e):Blob;"true"===String(this)&&(a=[a,c],c=a[0],a=a[1]);if(h&&2048>h.length&&(m=h.split("/").pop().split("?")[0],d.href=h,-1!==d.href.indexOf(h))){var n=new XMLHttpRequest;return n.open("GET",h,!0),n.responseType="blob",n.onload=function(a){k(a.target.response,m,"application/octet-stream")},setTimeout(function(){n.send()},0),n}if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(a)){if(!(2096103.424<a.length&&f!==g))return navigator.msSaveBlob?navigator.msSaveBlob(q(a),m):l(a);a=q(a),c=a.type||"application/octet-stream"}b=a instanceof f?a:new f([a],{type:c});if(navigator.msSaveBlob)return navigator.msSaveBlob(b,m);if(e.URL)l(e.URL.createObjectURL(b),!0);else{if("string"==typeof b||b.constructor===g)try{return l("data:"+c+";base64,"+e.btoa(b))}catch(p){return l("data:"+c+","+encodeURIComponent(b))}c=new FileReader,c.onload=function(a){l(this.result)},c.readAsDataURL(b)}return!0}});
src/js/run.js CHANGED
@@ -30,14 +30,7 @@ jQuery( document ).ready(function($) {
30
  $( '#runButton' ).on( 'click', function() {
31
  // Unselect button so it's not highlighted.
32
  $( '#runButton' ).blur();
33
- // If run button is disabled, don't run test.
34
- if ( $( '#runButton' ).hasClass( 'button-primary-disabled' ) ) {
35
- alert( 'Scan is already running!' );
36
- return;
37
- }
38
 
39
- // Disable run button.
40
- $( '#runButton' ).addClass( 'button-primary-disabled' );
41
  // Show the ajax spinner.
42
  $( '.spinner' ).show();
43
  // Empty the results textarea.
@@ -70,15 +63,7 @@ function checkStatus() {
70
  };
71
 
72
  var obj;
73
- jQuery.post( ajaxurl, data, function( response ) {
74
- try {
75
- obj = JSON.parse( response );
76
- } catch(e) {
77
- // If response wasn't JSON something is wrong.
78
- alert( "Error: " + e + "\nResponse: " + response );
79
- return;
80
- }
81
-
82
  /*
83
  * Status false: the test is not running and has not been run yet
84
  * Status 1: the test is currently running
@@ -91,10 +76,8 @@ function checkStatus() {
91
  }
92
 
93
  if ( '1' === obj.status ) {
94
- jQuery( '#runButton' ).addClass( 'button-primary-disabled' );
95
  jQuery( '.spinner' ).show();
96
  } else {
97
- jQuery( '#runButton' ).removeClass( 'button-primary-disabled' );
98
  jQuery( '.spinner' ).hide();
99
  }
100
 
@@ -121,6 +104,15 @@ function checkStatus() {
121
  checkStatus();
122
  }, 5000);
123
  }
 
 
 
 
 
 
 
 
 
124
  });
125
  }
126
  /**
30
  $( '#runButton' ).on( 'click', function() {
31
  // Unselect button so it's not highlighted.
32
  $( '#runButton' ).blur();
 
 
 
 
 
33
 
 
 
34
  // Show the ajax spinner.
35
  $( '.spinner' ).show();
36
  // Empty the results textarea.
63
  };
64
 
65
  var obj;
66
+ jQuery.post( ajaxurl, data, function( obj ) {
 
 
 
 
 
 
 
 
67
  /*
68
  * Status false: the test is not running and has not been run yet
69
  * Status 1: the test is currently running
76
  }
77
 
78
  if ( '1' === obj.status ) {
 
79
  jQuery( '.spinner' ).show();
80
  } else {
 
81
  jQuery( '.spinner' ).hide();
82
  }
83
 
104
  checkStatus();
105
  }, 5000);
106
  }
107
+ }, 'json' ).fail(function ( xhr, status, error )
108
+ {
109
+ // Server responded correctly, but the response wasn't valid.
110
+ if ( 200 === xhr.status ) {
111
+ alert( "Error: " + error + "\nResponse: " + xhr.responseText );
112
+ }
113
+ else { // Server didn't respond correctly.
114
+ alert( "Error: " + error + "\nStatus: " + xhr.status );
115
+ }
116
  });
117
  }
118
  /**
src/wpephpcompat.php CHANGED
@@ -40,7 +40,7 @@ class WPEPHPCompat {
40
  public $test_version = null;
41
 
42
  /**
43
- * Summary.
44
  *
45
  * @since 1.0.0
46
  * @access public
@@ -49,7 +49,7 @@ class WPEPHPCompat {
49
  public $only_active = null;
50
 
51
  /**
52
- * Summary.
53
  *
54
  * @since 1.0.0
55
  * @access public
@@ -177,7 +177,10 @@ class WPEPHPCompat {
177
  // Close the connection to the browser.
178
  $this->close_connection("started");
179
 
180
- // Kill cron after a configurable timeout.
 
 
 
181
  set_time_limit( ( $timeout > 5 ? $timeout - 5 : $timeout ) );
182
  }
183
 
@@ -273,6 +276,7 @@ class WPEPHPCompat {
273
  // Default ignored list.
274
  $ignored = array(
275
  '*/tests/*', // No reason to scan tests.
 
276
  '*/node_modules/*', // Commonly used for development but not in production.
277
  '*/tmp/*', // Temporary files.
278
  );
40
  public $test_version = null;
41
 
42
  /**
43
+ * Scan only active plugins or all?
44
  *
45
  * @since 1.0.0
46
  * @access public
49
  public $only_active = null;
50
 
51
  /**
52
+ * The base directory for the plugin.
53
  *
54
  * @since 1.0.0
55
  * @access public
177
  // Close the connection to the browser.
178
  $this->close_connection("started");
179
 
180
+ /**
181
+ * Kill cron after a configurable timeout.
182
+ * Subtract 5 from the timeout if we can to avoid race conditions.
183
+ */
184
  set_time_limit( ( $timeout > 5 ? $timeout - 5 : $timeout ) );
185
  }
186
 
276
  // Default ignored list.
277
  $ignored = array(
278
  '*/tests/*', // No reason to scan tests.
279
+ '*/test/*', // Another common test directory.
280
  '*/node_modules/*', // Commonly used for development but not in production.
281
  '*/tmp/*', // Temporary files.
282
  );
wpengine-phpcompat.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: PHP Compatibility Checker
4
  Plugin URI: https://wpengine.com
5
  Description: Make sure your plugins and themes are compatible with newer PHP versions.
6
  Author: WP Engine
7
- Version: 1.1.1
8
  Author URI: https://wpengine.com
9
  */
10
 
@@ -142,9 +142,7 @@ class WPEngine_PHPCompat {
142
  $wpephpc = new \WPEPHPCompat( __DIR__ );
143
  $wpephpc->clean_after_scan();
144
  }
145
-
146
- echo json_encode( $to_encode );
147
- wp_die();
148
  }
149
  }
150
 
@@ -230,7 +228,7 @@ class WPEngine_PHPCompat {
230
  <input type="checkbox" id="developermode" name="developermode" value="yes">Developer mode
231
  </div>
232
  <br><br>
233
- <h3 class="title">Scan Options</h3>
234
  <table class="form-table">
235
  <tbody>
236
  <tr>
@@ -300,4 +298,3 @@ class WPEngine_PHPCompat {
300
  }
301
  // Register the WPEngine_PHPCompat instance
302
  WPEngine_PHPCompat::init();
303
-
4
  Plugin URI: https://wpengine.com
5
  Description: Make sure your plugins and themes are compatible with newer PHP versions.
6
  Author: WP Engine
7
+ Version: 1.1.2
8
  Author URI: https://wpengine.com
9
  */
10
 
142
  $wpephpc = new \WPEPHPCompat( __DIR__ );
143
  $wpephpc->clean_after_scan();
144
  }
145
+ wp_send_json( $to_encode );
 
 
146
  }
147
  }
148
 
228
  <input type="checkbox" id="developermode" name="developermode" value="yes">Developer mode
229
  </div>
230
  <br><br>
231
+ <h3 class="title clear">Scan Options</h3>
232
  <table class="form-table">
233
  <tbody>
234
  <tr>
298
  }
299
  // Register the WPEngine_PHPCompat instance
300
  WPEngine_PHPCompat::init();