Google Pagespeed Insights - Version 4.0.3

Version Description

  • Bugfix loading screenshots 'filmstrip' images broken
Download this release

Release Info

Developer mattkeys
Plugin Icon 128x128 Google Pagespeed Insights
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.0 to 4.0.3

assets/js/details.js CHANGED
@@ -42,35 +42,46 @@
42
  var passedAudits = 0,
43
  hasScreenshots = false;
44
  $.each( GPI_Details.page_reports, function ( index, audit ) {
45
- var type = audit.rule_blocks.details.type,
46
- mode = audit.rule_blocks.score_display_mode,
47
- data = {
48
- key : audit.rule_key,
49
- name : audit.rule_name,
50
- description : audit.rule_blocks.description,
51
- details : audit.rule_blocks.details,
52
- displayValue : audit.rule_blocks.display_value,
53
- type : type,
54
- strings : GPI_Details.strings,
55
- publicPath : GPI_Details.public_path
56
- };
57
-
58
- var audits = wp.template( 'audits-' + type );
59
-
60
- if ( 'screenshot-thumbnails' == audit.rule_key ) {
61
- $('#screenshots').append( audits( data ) );
62
- hasScreenshots = true;
63
- } else if ( 'opportunity' == type && 0.9 > audit.rule_score ) {
64
- $('#opportunities').append( audits( data ) );
65
- } else if ( 'opportunity' != type && 0.9 > audit.rule_score ) {
66
- $('#diagnostics').append( audits( data ) );
67
- } else if ( 'informative' == mode || 'not_applicable' == mode ) {
68
- $('#diagnostics').append( audits( data ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  } else {
70
- $('#passed_audits').append( audits( data ) );
71
- passedAudits++;
72
  }
73
-
74
  });
75
 
76
  if ( ! $('#opportunities').children().length ) {
42
  var passedAudits = 0,
43
  hasScreenshots = false;
44
  $.each( GPI_Details.page_reports, function ( index, audit ) {
45
+ if ( 'undefined' !== typeof audit.rule_blocks.details ) {
46
+ var type = audit.rule_blocks.details.type,
47
+ mode = audit.rule_blocks.score_display_mode,
48
+ data = {
49
+ key : audit.rule_key,
50
+ name : audit.rule_name,
51
+ description : audit.rule_blocks.description,
52
+ details : audit.rule_blocks.details,
53
+ displayValue : audit.rule_blocks.display_value,
54
+ type : type,
55
+ strings : GPI_Details.strings,
56
+ publicPath : GPI_Details.public_path
57
+ };
58
+
59
+ allowedTypes = [ 'criticalrequestchain', 'filmstrip', 'opportunity', 'table', 'statistics', 'diagnostic' ];
60
+
61
+ if ( -1 !== $.inArray( type, allowedTypes ) ) {
62
+ var audits = wp.template( 'audits-' + type );
63
+
64
+ if ( 'screenshot-thumbnails' == audit.rule_key ) {
65
+ $('#screenshots').append( audits( data ) );
66
+ hasScreenshots = true;
67
+ } else if ( 'diagnostic' == type ) {
68
+ $('#diagnostics').append( audits( data ) );
69
+ } else if ( 'opportunity' == type && 0.9 > audit.rule_score ) {
70
+ $('#opportunities').append( audits( data ) );
71
+ } else if ( 'opportunity' != type && 0.9 > audit.rule_score ) {
72
+ $('#diagnostics').append( audits( data ) );
73
+ } else if ( 'informative' == mode || 'not_applicable' == mode ) {
74
+ $('#diagnostics').append( audits( data ) );
75
+ } else {
76
+ $('#passed_audits').append( audits( data ) );
77
+ passedAudits++;
78
+ }
79
+ } else {
80
+ console.log( 'No template for report type: ' + type );
81
+ }
82
  } else {
83
+ console.log( 'Rule Key: "' + audit.rule_key + '" has insuffient information for display' );
 
84
  }
 
85
  });
86
 
87
  if ( ! $('#opportunities').children().length ) {
assets/js/templates/details/audits-diagnostic.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/html" id="tmpl-audits-diagnostic">
2
+ <h3>{{data.name}} <span class="toggle"></span><span class="right">{{data.displayValue}}</span></h3>
3
+ <div class="details">
4
+ <p class="description">
5
+ {{{data.description}}}
6
+ </p>
7
+ <# for (i = 0; i < data.details.items.length; i++ ) { #>
8
+ <table class="audits">
9
+ <tbody>
10
+ <# for ( var key in data.details.items[ i ] ) {
11
+ #>
12
+ <tr>
13
+ <td>{{key}}</td>
14
+ <td>{{data.details.items[ i ][ key ]}}</td>
15
+ </tr>
16
+ <#
17
+ } #>
18
+ </tbody>
19
+ </table>
20
+ <# } #>
21
+ </div>
22
+ </script>
assets/js/templates/details/audits-filmstrip.php CHANGED
@@ -2,7 +2,7 @@
2
  <p class="description">{{{data.description}}}</p>
3
  <div class="details">
4
  <# for (i = 0; i < data.details.items.length; i++ ) { #>
5
- <div><img src="data:image/png;base64, {{data.details.items[ i ].data}}" title="{{data.details.items[ i ].timing}} ms" alt="{{data.details.items[ i ].timing}} ms" /></div>
6
  <# } #>
7
  </div>
8
  </script>
2
  <p class="description">{{{data.description}}}</p>
3
  <div class="details">
4
  <# for (i = 0; i < data.details.items.length; i++ ) { #>
5
+ <div><img src="{{data.details.items[ i ].data}}" title="{{data.details.items[ i ].timing}} ms" alt="{{data.details.items[ i ].timing}} ms" /></div>
6
  <# } #>
7
  </div>
8
  </script>
assets/js/templates/details/audits-opportunity.php CHANGED
@@ -4,7 +4,7 @@
4
  <p class="description">
5
  {{{data.description}}}
6
  </p>
7
- <# if ( 'uses-optimized-images' == data.key ) { #>
8
  <div class="shortpixel_box" id="optimize_images">
9
  <img class="shortpixel_robot" src="{{data.publicPath}}/assets/images/shortpixel.png" alt="{{data.strings.shortpixel.title}}" />
10
  <h2>{{data.strings.shortpixel.title}}</h2>
4
  <p class="description">
5
  {{{data.description}}}
6
  </p>
7
+ <# if ( 'uses-webp-images' == data.key || 'uses-optimized-images' == data.key ) { #>
8
  <div class="shortpixel_box" id="optimize_images">
9
  <img class="shortpixel_robot" src="{{data.publicPath}}/assets/images/shortpixel.png" alt="{{data.strings.shortpixel.title}}" />
10
  <h2>{{data.strings.shortpixel.title}}</h2>
classes/class-GPI-Admin.php CHANGED
@@ -26,7 +26,6 @@ class GPI_Admin
26
  $this->strategy = ( isset( $_GET['strategy'] ) ) ? sanitize_text_field( $_GET['strategy'] ) : $this->gpi_ui_options['view_preference'];
27
 
28
  add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
29
- add_action( 'in_plugin_update_message-google-pagespeed-insights/google-pagespeed-insights.php', array( $this, 'plugin_update_message' ), 10, 2 );
30
  add_action( 'admin_init', array( $this, 'upgrade_check' ), 10 );
31
  add_action( 'pre_uninstall_plugin', array( $this, 'backup_addon_tables' ), 10, 1 );
32
  add_action( 'deleted_plugin', array( $this, 'restore_addon_tables' ), 10, 2 );
@@ -67,18 +66,6 @@ class GPI_Admin
67
  return $links;
68
  }
69
 
70
- public function plugin_update_message( $plugin_data, $response )
71
- {
72
- if ( empty( $plugin_data['update'] ) ) {
73
- return;
74
- }
75
-
76
- if ( version_compare( $plugin_data['new_version'], '4.0.0', '>=' ) && version_compare( $plugin_data['Version'], '4.0.0', '<' ) ) {
77
- $message = __( 'IMPORTANT: This is a major update. Reports run with previous versions of this plugin are incompatible with the latest version of the Pagespeed API, and will be removed during this update.', 'gpagespeedi' );
78
- echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>' . $message . '</strong> ';
79
- }
80
- }
81
-
82
  public function upgrade_check()
83
  {
84
  if ( ! isset( $this->gpi_options['version'] ) || version_compare( $this->gpi_options['version'], GPI_VERSION, '<' ) ) {
@@ -344,8 +331,8 @@ class GPI_Admin
344
  switch ( $render ) {
345
  case 'details':
346
  include_once GPI_DIRECTORY . '/assets/js/templates/details/statistics.php';
347
- include_once GPI_DIRECTORY . '/assets/js/templates/details/legend.php';
348
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-opportunity.php';
 
349
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-table.php';
350
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-criticalrequestchain.php';
351
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-filmstrip.php';
26
  $this->strategy = ( isset( $_GET['strategy'] ) ) ? sanitize_text_field( $_GET['strategy'] ) : $this->gpi_ui_options['view_preference'];
27
 
28
  add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
 
29
  add_action( 'admin_init', array( $this, 'upgrade_check' ), 10 );
30
  add_action( 'pre_uninstall_plugin', array( $this, 'backup_addon_tables' ), 10, 1 );
31
  add_action( 'deleted_plugin', array( $this, 'restore_addon_tables' ), 10, 2 );
66
  return $links;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  public function upgrade_check()
70
  {
71
  if ( ! isset( $this->gpi_options['version'] ) || version_compare( $this->gpi_options['version'], GPI_VERSION, '<' ) ) {
331
  switch ( $render ) {
332
  case 'details':
333
  include_once GPI_DIRECTORY . '/assets/js/templates/details/statistics.php';
 
334
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-opportunity.php';
335
+ include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-diagnostic.php';
336
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-table.php';
337
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-criticalrequestchain.php';
338
  include_once GPI_DIRECTORY . '/assets/js/templates/details/audits-filmstrip.php';
google-pagespeed-insights.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Pagespeed Insights
4
  Plugin URI: http://mattkeys.me
5
  Description: Google Pagespeed Insights
6
  Author: Matt Keys
7
- Version: 4.0.0
8
  Author URI: http://mattkeys.me
9
  */
10
 
@@ -45,7 +45,7 @@ if ( ! defined( 'GPI_BASENAME' ) ) {
45
 
46
  // Internal version number
47
  if ( ! defined( 'GPI_VERSION' ) ) {
48
- define( 'GPI_VERSION', '4.0.0' );
49
  }
50
 
51
  if ( is_admin() ) {
4
  Plugin URI: http://mattkeys.me
5
  Description: Google Pagespeed Insights
6
  Author: Matt Keys
7
+ Version: 4.0.3
8
  Author URI: http://mattkeys.me
9
  */
10
 
45
 
46
  // Internal version number
47
  if ( ! defined( 'GPI_VERSION' ) ) {
48
+ define( 'GPI_VERSION', '4.0.3' );
49
  }
50
 
51
  if ( is_admin() ) {
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: mattkeys
3
  Tags: SEO, performance, speed, page speed, search engine optimization, pagespeed, google page speed, pagespeed insights, google pagespeed insights
4
  Requires at least: 3.6
5
- Tested up to: 5.0
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -136,6 +136,15 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
 
 
 
 
139
  = 4.0.0 =
140
  * NOTICE: This upgrade will remove any existing reports or snapshots created by older versions of this plugin as they are not compatible with the newest version of the pagespeed API (v5)
141
  * Migrating to the latest version of the Google Pagespeed Insights API (v5). This comes with pretty big changes to reporting and is incompatible with reports generated from previous versions of the API (and this plugin)
@@ -217,50 +226,14 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
217
 
218
  == Upgrade Notice ==
219
 
220
- = 4.0.0 =
221
- * NOTICE: This upgrade will remove any existing reports or snapshots created by older versions of this plugin as they are not compatible with the newest version of the pagespeed API (v5)
222
-
223
- = 3.0.5 =
224
- * Fixed PHP warning when saving settings
225
-
226
- = 3.0.4 =
227
- * Fixed bug where WordPress heartbeat API filter function failed to return properly
228
- * Added additional options for max runtime to support scenarios where even 60 seconds was over the server max run time
229
-
230
- = 3.0.3 =
231
- * Fixed bug where Maximum Script Run Time option could not be set to "No Limit" after previously being set to a higher value
232
-
233
- = 3.0.2 =
234
- * Fixed bug introduced in v3.0.1 effecting servers running PHP 5.4 where a PHP error is produced while trying to perform actions in the plugin like saving options
235
-
236
- = 3.0.1 =
237
- * Added snapshot comments to the view snapshot / compare snapshot templates
238
- * Fixed bug with snapshot report type label reading 'both' when it should read either desktop or mobile
239
- * Fixed bug with snapshot report description label not loading translatable string
240
- * Fixed bug preventing snapshot comments from being displayed in snapshots list table
241
- * Improved hardening against authenticated XSS attacks
242
- * Improved adherence to WordPress coding standards and best practices
243
-
244
- = 3.0.0 =
245
- * Includes all previously "premium" functionality for free. This includes report snapshots, snapshot comparison tool, custom URL reporting, and scheduled report checks.
246
- * Added in URL hotlinking in report details for paths to assets (images/scripts/etc)
247
-
248
- = 2.0.3 =
249
- * Updating to latest google api php library 2.2.0 to resolve issues with PHP 7.1
250
 
251
- = 2.0.2 =
252
- * Fixed bug which improperly returned WP Cron schedules on cron_schedules filter
253
 
254
- = 2.0.1 =
255
- * Removed phpseclib unit tests from Google PHP API library to avoid false-positive with WordFence
256
 
257
- = 2.0.0 =
258
- * Major rewrite for better compatibility and performance
259
- * Updated to the latest Google Pagespeed Insights API verison and library
260
- * Fixed issues with bulk installers not generating DB tables
261
- * Consolidated scan methods to a single more reliable method inspired by WP cron
262
- * Better identify, communicate, and resolve issues with environments that have difficulties with scanning pages or API errors
263
- * Improved API error logging
264
- * Added 'abort scan' functionality to cancel an in-progress scan
265
- * Added 'Maximum Script Run Time' option to advanced configuration to allow scans to run in shorter intervals for web hosts which have script timeouts that cannot be overridden
266
- * Update the codebase to adhere better to WordPress coding standards and best practices
2
  Contributors: mattkeys
3
  Tags: SEO, performance, speed, page speed, search engine optimization, pagespeed, google page speed, pagespeed insights, google pagespeed insights
4
  Requires at least: 3.6
5
+ Tested up to: 5.9
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
136
 
137
  == Changelog ==
138
 
139
+ = 4.0.3 =
140
+ * Bugfix loading screenshots 'filmstrip' images broken
141
+
142
+ = 4.0.2 =
143
+ * Bugfix google has introduced a couple new report types that were not handled by JS templating in this plugin. Added support for the new type and also tried to more gracefully handle this issue if/when this happens again in the future.
144
+
145
+ = 4.0.1 =
146
+ * Bugfix removed reference to 'legend' template file that was deleted in v4.0.0 and was causing PHP warnings
147
+
148
  = 4.0.0 =
149
  * NOTICE: This upgrade will remove any existing reports or snapshots created by older versions of this plugin as they are not compatible with the newest version of the pagespeed API (v5)
150
  * Migrating to the latest version of the Google Pagespeed Insights API (v5). This comes with pretty big changes to reporting and is incompatible with reports generated from previous versions of the API (and this plugin)
226
 
227
  == Upgrade Notice ==
228
 
229
+ = 4.0.3 =
230
+ * Bugfix loading screenshots 'filmstrip' images broken
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
+ = 4.0.2 =
233
+ * Bugfix google has introduced a couple new report types that were not handled by JS templating in this plugin. Added support for the new type and also tried to more gracefully handle this issue if/when this happens again in the future.
234
 
235
+ = 4.0.1 =
236
+ * Bugfix removed reference to 'legend' template file that was deleted in v4.0.0 and was causing PHP warnings
237
 
238
+ = 4.0.0 =
239
+ * NOTICE: This upgrade will remove any existing reports or snapshots created by older versions of this plugin as they are not compatible with the newest version of the pagespeed API (v5)