Google Pagespeed Insights - Version 4.0.4

Version Description

  • Bugfix improperly escaped data (xss security issue)
  • Rename plugin to "Insights from Google PageSpeed"
Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.4

classes/class-GPI-Actions.php CHANGED
@@ -108,7 +108,7 @@ class GPI_Actions
108
  break;
109
 
110
  case 'set_view_preference':
111
- $new_strategy = isset( $_GET['strategy'] ) ? $_GET['strategy'] : false;
112
  if ( 'mobile' == $new_strategy || 'desktop' == $new_strategy ) {
113
  do_action( 'gpi_update_option', 'view_preference', $new_strategy, 'gpagespeedi_ui_options' );
114
  }
@@ -117,7 +117,7 @@ class GPI_Actions
117
  case 'reports_update':
118
  delete_option( 'gpagespeedi_upgrade_recheck_required' );
119
  do_action( 'run_gpi', true );
120
- $action_message = __( 'Successfully initiated Google Pagespeed Insights to recheck all reports. Full plugin functionality will be restored after all pages have been rechecked.', 'gpagespeedi' );
121
  break;
122
 
123
  case apply_filters( 'gpi_custom_actions', $this->action ):
108
  break;
109
 
110
  case 'set_view_preference':
111
+ $new_strategy = isset( $_GET['strategy'] ) ? sanitize_text_field( $_GET['strategy'] ) : false;
112
  if ( 'mobile' == $new_strategy || 'desktop' == $new_strategy ) {
113
  do_action( 'gpi_update_option', 'view_preference', $new_strategy, 'gpagespeedi_ui_options' );
114
  }
117
  case 'reports_update':
118
  delete_option( 'gpagespeedi_upgrade_recheck_required' );
119
  do_action( 'run_gpi', true );
120
+ $action_message = __( 'Successfully initiated Insights from Google PageSpeed to recheck all reports. Full plugin functionality will be restored after all pages have been rechecked.', 'gpagespeedi' );
121
  break;
122
 
123
  case apply_filters( 'gpi_custom_actions', $this->action ):
classes/class-GPI-Admin.php CHANGED
@@ -25,6 +25,10 @@ class GPI_Admin
25
  $this->gpi_ui_options = get_option( 'gpagespeedi_ui_options' );
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 );
@@ -125,38 +129,38 @@ class GPI_Admin
125
  {
126
  ?>
127
  <div class="notice notice-error is-dismissible">
128
- <p><?php _e( 'The plugin "Google Pagespeed Insights Addon" has automatically been deactivated. As of v3.0 Google Pagespeed Insights now includes all "addon" functionality for free. The "Google Pagespeed Insights Addon" can be uninstalled from the plugins page.', 'gpagespeedi' ); ?></p>
129
  </div>
130
  <?php
131
  }
132
 
133
  public function google_pageinsights_menu()
134
  {
135
- $this->gpi_management_page = add_management_page( 'Google Pagespeed Insights', 'Pagespeed Insights', 'manage_options', 'google-pagespeed-insights', array( $this, 'render_admin_page' ) );
136
  }
137
 
138
  public function render_admin_page()
139
  {
140
- $admin_page = ( isset( $_GET['render'] ) ) ? sanitize_text_field( $_GET['render'] ) : 'report-list';
141
  ?>
142
  <div class="wrap">
143
  <h2>
144
- <?php _e( 'Google Pagespeed Insights', 'gpagespeedi' ); ?>
145
  <div class="global-actions">
146
  <?php
147
  if ( $worker_status = apply_filters( 'gpi_check_status', false ) ) :
148
  if ( ! get_option( 'gpi_abort_scan' ) ) :
149
  ?>
150
- <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>&amp;action=abort-scan" class="button-gpi abort"><?php _e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
151
  <?php
152
  else :
153
  ?>
154
- <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>" class="button-gpi abort" disabled><?php _e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
155
  <?php
156
  endif;
157
  elseif ( $this->gpi_options['google_developer_key'] ) :
158
  ?>
159
- <a id="start_scan" href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>&amp;action=start-scan" class="button-gpi run"><?php _e( 'Start Reporting', 'gpagespeedi' ); ?></a>
160
  <input type="checkbox" name="recheck_all_pages" id="recheck_all_pages" />
161
  <label for="recheck_all_pages"><?php _e( 'Recheck All', 'gpagespeedi' ); ?> <span class="tooltip" title="<?php _e( 'Ignore last checked date to generate new reports for all pages', 'gpagespeedi' ); ?>">(?)</span></label>
162
  <?php
@@ -170,7 +174,10 @@ class GPI_Admin
170
  <?php include GPI_DIRECTORY . '/templates/parts/navigation.php'; ?>
171
  <?php
172
  $template_directory = apply_filters( 'gpi_template_directory', GPI_DIRECTORY, $admin_page );
173
- include $template_directory . '/templates/' . $admin_page . '.php';
 
 
 
174
  ?>
175
  </div>
176
  <?php
@@ -184,7 +191,7 @@ class GPI_Admin
184
  ?>
185
  <div id="message" class="updated">
186
  <p>
187
- <?php _e( 'Google Pagespeed Insights for Wordpress has been activated. It can be accessed via Tools', 'gpagespeedi' ); ?> -> <a href="<?php echo admin_url('/tools.php?page=google-pagespeed-insights&render=options'); ?>">Pagespeed Insights</a>
188
  </p>
189
  </div>
190
  <?php
@@ -228,7 +235,7 @@ class GPI_Admin
228
  'recheck_url' => wp_nonce_url( $recheck_url, 'gpi-single-recheck' ),
229
  'public_path' => GPI_PUBLIC_PATH,
230
  'strings' => array(
231
- 'old_format_notice' => sprintf( __( 'Google Pagespeed Insights for WordPress has detected an outdated format in this report due to an update in version %s of this plugin. Some report features are unavailable. Please recheck results to resolve this problem.', 'gpagespeedi' ), '4.0' ),
232
  'insufficient_field_data' => __( 'The Chrome User Experience Report <a href="https://developers.google.com/speed/docs/insights/about#faq" target="_blank">does not have sufficient real-world speed data</a> for this page.', 'gpagespeedi' ),
233
  'FCP' => __( 'First Contentful Paint', 'gpagespeedi' ),
234
  'FID' => __( 'First Input Delay', 'gpagespeedi' ),
@@ -239,7 +246,7 @@ class GPI_Admin
239
  ),
240
  'shortpixel' => array(
241
  'title' => __( 'Auto-Optimize Images', 'gpagespeedi' ),
242
- 'description' => __( 'Unoptimized images are often one of the <strong>biggest</strong> negative factors in pagespeed scores. Google Pagespeed Insights for WordPress has partnered with ShortPixel to provide an easy and affordable solution to <em>automatically</em> optimize all images.', 'gpagespeedi' ),
243
  'signup_desc' => __( 'Sign up using the button below and receive <strong>150 free image optimization credits</strong>.', 'gpagespeedi' ),
244
  'signup_btn' => __( 'Free Sign Up', 'gpagespeedi' )
245
  )
@@ -266,7 +273,7 @@ class GPI_Admin
266
  'average_score' => __( 'Average Score', 'gpagespeedi' ),
267
  'best_performing' => __( 'View Best Performing', 'gpagespeedi' ),
268
  'worst_performing' => __( 'View Worst Performing', 'gpagespeedi' ),
269
- 'old_format_notice' => __( 'Google Pagespeed Insights for WordPress has detected an outdated format in one or more reports due to an update in version 2.0 of this plugin. Some report features are unavailable. Please force recheck all reports from the options page to resolve this problem.', 'gpagespeedi' )
270
  )
271
  )
272
  );
@@ -291,8 +298,8 @@ class GPI_Admin
291
  'worst_performing' => __( 'View Worst Performing', 'gpagespeedi' )
292
  ),
293
  'comments' => array(
294
- 'snapshot' => isset( $snapshot_data['snapshot']['comment'] ) ? sanitize_text_field( $snapshot_data['snapshot']['comment'] ) : false,
295
- 'compare' => isset( $snapshot_data['compare']['comment'] ) ? sanitize_text_field( $snapshot_data['compare']['comment'] ) : false
296
  )
297
  );
298
 
25
  $this->gpi_ui_options = get_option( 'gpagespeedi_ui_options' );
26
  $this->strategy = ( isset( $_GET['strategy'] ) ) ? sanitize_text_field( $_GET['strategy'] ) : $this->gpi_ui_options['view_preference'];
27
 
28
+ if ( 'desktop' != $this->strategy && 'mobile' != $this->strategy ) {
29
+ $this->strategy = 'desktop';
30
+ }
31
+
32
  add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
33
  add_action( 'admin_init', array( $this, 'upgrade_check' ), 10 );
34
  add_action( 'pre_uninstall_plugin', array( $this, 'backup_addon_tables' ), 10, 1 );
129
  {
130
  ?>
131
  <div class="notice notice-error is-dismissible">
132
+ <p><?php _e( 'The plugin "Google Pagespeed Insights Addon" has automatically been deactivated. As of v3.0 Insights from Google PageSpeed now includes all "addon" functionality for free. The "Google Pagespeed Insights Addon" can be uninstalled from the plugins page.', 'gpagespeedi' ); ?></p>
133
  </div>
134
  <?php
135
  }
136
 
137
  public function google_pageinsights_menu()
138
  {
139
+ $this->gpi_management_page = add_management_page( 'Insights from Google PageSpeed', 'Pagespeed Insights', 'manage_options', 'google-pagespeed-insights', array( $this, 'render_admin_page' ) );
140
  }
141
 
142
  public function render_admin_page()
143
  {
144
+ $admin_page = ( isset( $_GET['render'] ) ) ? esc_attr( $_GET['render'] ) : 'report-list';
145
  ?>
146
  <div class="wrap">
147
  <h2>
148
+ <?php _e( 'Insights from Google PageSpeed', 'gpagespeedi' ); ?>
149
  <div class="global-actions">
150
  <?php
151
  if ( $worker_status = apply_filters( 'gpi_check_status', false ) ) :
152
  if ( ! get_option( 'gpi_abort_scan' ) ) :
153
  ?>
154
+ <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>&amp;action=abort-scan" class="button-gpi abort"><?php _e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
155
  <?php
156
  else :
157
  ?>
158
+ <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>" class="button-gpi abort" disabled><?php _e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
159
  <?php
160
  endif;
161
  elseif ( $this->gpi_options['google_developer_key'] ) :
162
  ?>
163
+ <a id="start_scan" href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=<?php echo $admin_page; ?>&amp;action=start-scan" class="button-gpi run"><?php _e( 'Start Reporting', 'gpagespeedi' ); ?></a>
164
  <input type="checkbox" name="recheck_all_pages" id="recheck_all_pages" />
165
  <label for="recheck_all_pages"><?php _e( 'Recheck All', 'gpagespeedi' ); ?> <span class="tooltip" title="<?php _e( 'Ignore last checked date to generate new reports for all pages', 'gpagespeedi' ); ?>">(?)</span></label>
166
  <?php
174
  <?php include GPI_DIRECTORY . '/templates/parts/navigation.php'; ?>
175
  <?php
176
  $template_directory = apply_filters( 'gpi_template_directory', GPI_DIRECTORY, $admin_page );
177
+
178
+ if ( in_array( $admin_page, [ 'add-custom-urls-bulk', 'add-custom-urls', 'custom-urls', 'details', 'ignored-urls', 'logs', 'options', 'report-list', 'snapshots', 'summary', 'view-snapshot' ] ) ) {
179
+ include $template_directory . '/templates/' . $admin_page . '.php';
180
+ }
181
  ?>
182
  </div>
183
  <?php
191
  ?>
192
  <div id="message" class="updated">
193
  <p>
194
+ <?php _e( 'Insights from Google PageSpeed has been activated. It can be accessed via Tools', 'gpagespeedi' ); ?> -> <a href="<?php echo admin_url('/tools.php?page=google-pagespeed-insights&render=options'); ?>">Pagespeed Insights</a>
195
  </p>
196
  </div>
197
  <?php
235
  'recheck_url' => wp_nonce_url( $recheck_url, 'gpi-single-recheck' ),
236
  'public_path' => GPI_PUBLIC_PATH,
237
  'strings' => array(
238
+ 'old_format_notice' => sprintf( __( 'Insights from Google PageSpeed has detected an outdated format in this report due to an update in version %s of this plugin. Some report features are unavailable. Please recheck results to resolve this problem.', 'gpagespeedi' ), '4.0' ),
239
  'insufficient_field_data' => __( 'The Chrome User Experience Report <a href="https://developers.google.com/speed/docs/insights/about#faq" target="_blank">does not have sufficient real-world speed data</a> for this page.', 'gpagespeedi' ),
240
  'FCP' => __( 'First Contentful Paint', 'gpagespeedi' ),
241
  'FID' => __( 'First Input Delay', 'gpagespeedi' ),
246
  ),
247
  'shortpixel' => array(
248
  'title' => __( 'Auto-Optimize Images', 'gpagespeedi' ),
249
+ 'description' => __( 'Unoptimized images are often one of the <strong>biggest</strong> negative factors in pagespeed scores. Insights from Google PageSpeed has partnered with ShortPixel to provide an easy and affordable solution to <em>automatically</em> optimize all images.', 'gpagespeedi' ),
250
  'signup_desc' => __( 'Sign up using the button below and receive <strong>150 free image optimization credits</strong>.', 'gpagespeedi' ),
251
  'signup_btn' => __( 'Free Sign Up', 'gpagespeedi' )
252
  )
273
  'average_score' => __( 'Average Score', 'gpagespeedi' ),
274
  'best_performing' => __( 'View Best Performing', 'gpagespeedi' ),
275
  'worst_performing' => __( 'View Worst Performing', 'gpagespeedi' ),
276
+ 'old_format_notice' => __( 'Insights from Google PageSpeed has detected an outdated format in one or more reports due to an update in version 2.0 of this plugin. Some report features are unavailable. Please force recheck all reports from the options page to resolve this problem.', 'gpagespeedi' )
277
  )
278
  )
279
  );
298
  'worst_performing' => __( 'View Worst Performing', 'gpagespeedi' )
299
  ),
300
  'comments' => array(
301
+ 'snapshot' => isset( $snapshot_data['snapshot']['comment'] ) ? esc_textarea( $snapshot_data['snapshot']['comment'] ) : false,
302
+ 'compare' => isset( $snapshot_data['compare']['comment'] ) ? esc_textarea( $snapshot_data['compare']['comment'] ) : false
303
  )
304
  );
305
 
classes/class-GPI-List-Table.php CHANGED
@@ -147,11 +147,11 @@ class GPI_List_Table extends WP_List_Table
147
  switch( $pagetype )
148
  {
149
  case 'ignored-urls':
150
- _e( 'No Ignored URLs found. A URL can be ignored from the <a href="?page=' . sanitize_text_field( $_REQUEST['page'] ) . '&render=report-list">Report List</a> page if you would like to remove it from report pages', 'gpagespeedi' );
151
  break;
152
 
153
  case 'snapshots':
154
- _e( 'No Snapshots found. Snapshots can be created from the', 'gpagespeedi' ) . ' ' . '<a href="?page=' . sanitize_text_field( $_REQUEST['page'] ) . '&render=summary">' . __( 'Report Summary', 'gpagespeedi' ) . '</a>' . ' ' . __( 'page', 'gpagespeedi' ) . '.';
155
  break;
156
 
157
  case 'custom-urls':
@@ -178,7 +178,7 @@ class GPI_List_Table extends WP_List_Table
178
  _e( 'No Pagespeed Reports Found. Google Pagespeed may still be checking your pages. If problems persist, see the following possible solutions:', 'gpagespeedi' );
179
  ?>
180
  <ol class="no-items">
181
- <li><?php _e( 'Make sure that you have entered your Google API key on the ', 'gpagespeedi' );?><a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=options"><?php _e( 'Options', 'gpagespeedi' ); ?></a> <?php _e( 'page', 'gpagespeedi' ); ?>.</li>
182
  <li><?php _e( 'Make sure that you have enabled "PageSpeed Insights API" from the Services page of the ', 'gpagespeedi' );?><a href="https://code.google.com/apis/console/"> <?php _e( 'Google Console', 'gpagespeedi' ); ?></a>.</li>
183
  <li><?php _e( 'Make sure that your URLs are publicly accessible', 'gpagespeedi' ); ?>.</li>
184
  </ol>
@@ -216,11 +216,11 @@ class GPI_List_Table extends WP_List_Table
216
  return $formatted_time;
217
 
218
  case 'type':
219
- return sanitize_text_field( $item[ $column_name ] );
220
 
221
  case 'custom_url':
222
  $actions = array(
223
- 'delete' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', sanitize_text_field( $_REQUEST['page'] ), 'custom-urls', 'delete', $item['ID'] ),
224
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
225
  );
226
 
@@ -237,8 +237,8 @@ class GPI_List_Table extends WP_List_Table
237
  $date = date( 'M d, Y - h:i a', $date );
238
 
239
  $actions = array(
240
- 'delete' => sprintf( '?page=%s&render=%s&action=%s&snapshot_id=%s' ,sanitize_text_field( $_REQUEST['page'] ), 'snapshots', 'delete-snapshot', $item['ID'] ),
241
- 'view' => sprintf( '<a href="?page=%s&render=%s&snapshot_id=%s">%s</a>' , sanitize_text_field( $_REQUEST['page'] ), 'view-snapshot', $item['ID'], __( 'View Snapshot', 'gpagespeedi' ) )
242
  );
243
 
244
  $nonced_url = wp_nonce_url( $actions['delete'], 'bulk-gpi_page_reports' );
@@ -246,7 +246,7 @@ class GPI_List_Table extends WP_List_Table
246
 
247
 
248
  return sprintf( '<a href="?page=%1$s&render=%2$s&snapshot_id=%3$s">%4$s</a> %5$s',
249
- sanitize_text_field( $_REQUEST['page'] ),
250
  'view-snapshot',
251
  $item['ID'],
252
  $date,
@@ -259,13 +259,13 @@ class GPI_List_Table extends WP_List_Table
259
  $filter_replace = array( '', '', __( 'All Custom Post Types', 'gpagespeedi' ), __( 'All Custom URLs', 'gpagespeedi' ), __( 'All Reports', 'gpagespeedi' ), __( 'Pages', 'gpagespeedi' ), __( 'Posts', 'gpagespeedi' ), __( 'Categories', 'gpagespeedi' ) );
260
  $cleaned_filter = str_replace( $filter_search, $filter_replace, $filter );
261
 
262
- return sanitize_text_field( $cleaned_filter );
263
 
264
  case apply_filters( 'gpi_custom_column', false, $column_name ):
265
  return apply_filters( 'gpi_custom_column_config', $column_name, $item );
266
 
267
  default:
268
- return sanitize_text_field( $item[ $column_name ] );
269
  }
270
  }
271
 
@@ -274,9 +274,9 @@ class GPI_List_Table extends WP_List_Table
274
  $cleaned_url = $this->strip_domain( $item['URL'] );
275
 
276
  $actions = array(
277
- 'view_details' => sprintf( '<a href="?page=%s&render=%s&page_id=%s">%s</a>', sanitize_text_field( $_REQUEST['page'] ), 'details', $item['ID'], __( 'Details', 'gpagespeedi' ) ),
278
- 'ignore' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', sanitize_text_field( $_REQUEST['page'] ), 'report-list', 'ignore', $item['ID'] ),
279
- 'delete_report' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', sanitize_text_field( $_REQUEST['page'] ), 'report-list', 'delete_report', $item['ID'] ),
280
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
281
  );
282
 
@@ -286,7 +286,7 @@ class GPI_List_Table extends WP_List_Table
286
  return sprintf( '<a href="?page=%3$s&render=%4$s&page_id=%5$s">%1$s</a> %2$s',
287
  $cleaned_url,
288
  $this->row_actions( $actions ),
289
- sanitize_text_field( $_REQUEST['page'] ),
290
  'details',
291
  $item['ID']
292
  );
@@ -297,8 +297,8 @@ class GPI_List_Table extends WP_List_Table
297
  $cleaned_url = $this->strip_domain( $item['URL'] );
298
 
299
  $actions = array(
300
- 'reactivate' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', sanitize_text_field( $_REQUEST['page'] ), 'ignored-urls', 'reactivate', $item['ID'] ),
301
- 'delete_blacklist' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', sanitize_text_field( $_REQUEST['page'] ), 'ignored-urls', 'delete_blacklist', $item['ID'] ),
302
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
303
  );
304
 
@@ -477,7 +477,7 @@ class GPI_List_Table extends WP_List_Table
477
  break;
478
 
479
  default:
480
- if ( $filter == 'all' || $filter == 'custom_posts' || $filter == 'custom_urls' ) {
481
  $sortable_columns = array(
482
  'desktop_score' => array( 'desktop_score', false ),
483
  'mobile_score' => array( 'mobile_score', false ),
@@ -600,8 +600,8 @@ class GPI_List_Table extends WP_List_Table
600
  ?>
601
 
602
  <?php if ( 'custom-urls' == $_GET['render'] ) : ?>
603
- <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=add-custom-urls" class="button-secondary"><?php _e( 'Add New URLs', 'gpagespeedi' ); ?></a>
604
- <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=add-custom-urls-bulk" class="button-secondary"><?php _e( 'Bulk Upload New URLs', 'gpagespeedi' ); ?></a>
605
  <?php endif; ?>
606
 
607
  <?php do_action( 'gpi_after_tablenav', sanitize_text_field( $_GET['render'] ) ); ?>
147
  switch( $pagetype )
148
  {
149
  case 'ignored-urls':
150
+ _e( 'No Ignored URLs found. A URL can be ignored from the <a href="?page=' . esc_attr( $_REQUEST['page'] ) . '&render=report-list">Report List</a> page if you would like to remove it from report pages', 'gpagespeedi' );
151
  break;
152
 
153
  case 'snapshots':
154
+ _e( 'No Snapshots found. Snapshots can be created from the', 'gpagespeedi' ) . ' ' . '<a href="?page=' . esc_attr( $_REQUEST['page'] ) . '&render=summary">' . __( 'Report Summary', 'gpagespeedi' ) . '</a>' . ' ' . __( 'page', 'gpagespeedi' ) . '.';
155
  break;
156
 
157
  case 'custom-urls':
178
  _e( 'No Pagespeed Reports Found. Google Pagespeed may still be checking your pages. If problems persist, see the following possible solutions:', 'gpagespeedi' );
179
  ?>
180
  <ol class="no-items">
181
+ <li><?php _e( 'Make sure that you have entered your Google API key on the ', 'gpagespeedi' );?><a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=options"><?php _e( 'Options', 'gpagespeedi' ); ?></a> <?php _e( 'page', 'gpagespeedi' ); ?>.</li>
182
  <li><?php _e( 'Make sure that you have enabled "PageSpeed Insights API" from the Services page of the ', 'gpagespeedi' );?><a href="https://code.google.com/apis/console/"> <?php _e( 'Google Console', 'gpagespeedi' ); ?></a>.</li>
183
  <li><?php _e( 'Make sure that your URLs are publicly accessible', 'gpagespeedi' ); ?>.</li>
184
  </ol>
216
  return $formatted_time;
217
 
218
  case 'type':
219
+ return esc_attr( $item[ $column_name ] );
220
 
221
  case 'custom_url':
222
  $actions = array(
223
+ 'delete' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', esc_attr( $_REQUEST['page'] ), 'custom-urls', 'delete', $item['ID'] ),
224
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
225
  );
226
 
237
  $date = date( 'M d, Y - h:i a', $date );
238
 
239
  $actions = array(
240
+ 'delete' => sprintf( '?page=%s&render=%s&action=%s&snapshot_id=%s' ,esc_attr( $_REQUEST['page'] ), 'snapshots', 'delete-snapshot', $item['ID'] ),
241
+ 'view' => sprintf( '<a href="?page=%s&render=%s&snapshot_id=%s">%s</a>' , esc_attr( $_REQUEST['page'] ), 'view-snapshot', $item['ID'], __( 'View Snapshot', 'gpagespeedi' ) )
242
  );
243
 
244
  $nonced_url = wp_nonce_url( $actions['delete'], 'bulk-gpi_page_reports' );
246
 
247
 
248
  return sprintf( '<a href="?page=%1$s&render=%2$s&snapshot_id=%3$s">%4$s</a> %5$s',
249
+ esc_attr( $_REQUEST['page'] ),
250
  'view-snapshot',
251
  $item['ID'],
252
  $date,
259
  $filter_replace = array( '', '', __( 'All Custom Post Types', 'gpagespeedi' ), __( 'All Custom URLs', 'gpagespeedi' ), __( 'All Reports', 'gpagespeedi' ), __( 'Pages', 'gpagespeedi' ), __( 'Posts', 'gpagespeedi' ), __( 'Categories', 'gpagespeedi' ) );
260
  $cleaned_filter = str_replace( $filter_search, $filter_replace, $filter );
261
 
262
+ return esc_attr( $cleaned_filter );
263
 
264
  case apply_filters( 'gpi_custom_column', false, $column_name ):
265
  return apply_filters( 'gpi_custom_column_config', $column_name, $item );
266
 
267
  default:
268
+ return esc_attr( $item[ $column_name ] );
269
  }
270
  }
271
 
274
  $cleaned_url = $this->strip_domain( $item['URL'] );
275
 
276
  $actions = array(
277
+ 'view_details' => sprintf( '<a href="?page=%s&render=%s&page_id=%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'details', $item['ID'], __( 'Details', 'gpagespeedi' ) ),
278
+ 'ignore' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', esc_attr( $_REQUEST['page'] ), 'report-list', 'ignore', $item['ID'] ),
279
+ 'delete_report' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', esc_attr( $_REQUEST['page'] ), 'report-list', 'delete_report', $item['ID'] ),
280
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
281
  );
282
 
286
  return sprintf( '<a href="?page=%3$s&render=%4$s&page_id=%5$s">%1$s</a> %2$s',
287
  $cleaned_url,
288
  $this->row_actions( $actions ),
289
+ esc_attr( $_REQUEST['page'] ),
290
  'details',
291
  $item['ID']
292
  );
297
  $cleaned_url = $this->strip_domain( $item['URL'] );
298
 
299
  $actions = array(
300
+ 'reactivate' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', esc_attr( $_REQUEST['page'] ), 'ignored-urls', 'reactivate', $item['ID'] ),
301
+ 'delete_blacklist' => sprintf( '?page=%s&render=%s&action=%s&page_id=%s', esc_attr( $_REQUEST['page'] ), 'ignored-urls', 'delete_blacklist', $item['ID'] ),
302
  'visit' => sprintf( '<a href="%s" target="_blank">%s</a>', $item['URL'], __( 'View URL', 'gpagespeedi' ) )
303
  );
304
 
477
  break;
478
 
479
  default:
480
+ if ( 'all' == $filter || 'custom_posts' == $filter || 'custom_urls' == $filter ) {
481
  $sortable_columns = array(
482
  'desktop_score' => array( 'desktop_score', false ),
483
  'mobile_score' => array( 'mobile_score', false ),
600
  ?>
601
 
602
  <?php if ( 'custom-urls' == $_GET['render'] ) : ?>
603
+ <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=add-custom-urls" class="button-secondary"><?php _e( 'Add New URLs', 'gpagespeedi' ); ?></a>
604
+ <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=add-custom-urls-bulk" class="button-secondary"><?php _e( 'Bulk Upload New URLs', 'gpagespeedi' ); ?></a>
605
  <?php endif; ?>
606
 
607
  <?php do_action( 'gpi_after_tablenav', sanitize_text_field( $_GET['render'] ) ); ?>
documentation/index.html CHANGED
@@ -1,7 +1,7 @@
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
  <head lang="en">
3
  <meta http-equiv="content-type" content="text/html;charset=utf-8">
4
- <title>Google Pagespeed Insights for Wordpress Documentation</title>
5
  <!-- Framework CSS -->
6
  <link rel="stylesheet" href="assets/blueprint-css/screen.css" type="text/css" media="screen, projection">
7
  <link rel="stylesheet" href="assets/blueprint-css/print.css" type="text/css" media="print">
@@ -17,14 +17,14 @@
17
  <body>
18
  <div class="container">
19
 
20
- <h3 class="center alt">Google Pagespeed Insights for Wordpress v2.x Documentation by Matt Keys</h3>
21
 
22
  <hr>
23
 
24
- <h1 class="center">Google Pagespeed Insights for Wordpress</h1>
25
 
26
  <br />
27
- <img src="assets/images/feature-image-large.jpg" alt="Google Pagespeed Insights for Wordpress" />
28
  <br />
29
 
30
  <div class="borderTop">
@@ -40,7 +40,7 @@
40
  </div><!-- end div .span-6 -->
41
 
42
  <div class="span-12 last">
43
- <p class="prepend-top append-0">Thank you for downloading Google Pagespeed Insights for Wordpress. If you have any questions that are beyond the scope of this help file, please visit <a href="http://mattkeys.me">mattkeys.me</a>. Thanks so much!</p>
44
  </div>
45
  </div><!-- end div .borderTop -->
46
 
@@ -66,17 +66,17 @@
66
 
67
  <p>Google Pagespeed Insights is a tool that empowers you to make decisions that increase the performance of your website by expanding on the existing technology of Google Pagespeeds recommendations for current industry best practices for desktop and mobile web performance.</p>
68
 
69
- <p>Through the addition of advanced data visualization, tagging, filtering, and snapshot technology, Google Pagespeed Insights for WordPress provides a comprehensive solution for any webmaster looking to increase their site performance, search engine ranking, and visitors browsing experience.</p>
70
 
71
  <hr>
72
 
73
  <h3 id="installation"><strong>B) Installation</strong> - <a href="#toc">top</a></h3>
74
- <p>To install Google Pagespeed Insights for Wordpress:</p>
75
 
76
  <ol>
77
  <li>Login to your Wordpress Admin page (usually http://yourdomain.com/wp-admin)</li>
78
  <li>Navigate to the Plugins screen and then click the "Add New" button</li>
79
- <li>Click on the "Upload" link near the top of the page and browse for the Google Pagespeed Insights for Wordpress zip file</li>
80
  <li>Upload the file, and click "Activate Plugin" after the installation completes</li>
81
  <li>Congratulations, installation is complete!</li>
82
  </ol>
@@ -95,7 +95,7 @@
95
  <li>Create a new project</li>
96
  <li>Enable the PageSpeed Insights API</li>
97
  <li>Create an API Key</li>
98
- <li>Paste the API Key into the Google PageSpeed Insights for WordPress options page</li>
99
  </ol>
100
 
101
  <p>Below I will provide a more in depth step by step guide based on the current version Google API Console; <strong><em>but know that depending on when you are reading this guide, things may not look the way they do in my screenshots anymore, and in priciple you should be looking to follow the 5 basic steps outlined above.</em></strong></p>
@@ -127,7 +127,7 @@
127
  <p>Google will give you the option the restrict usage of your API Key. Be careful that you do not accidently add a restriction that will block your site form using this key. This is one of the most common causes for scans not running properly when people ask for support. I recommend that you first try the plugin without any restrictions to make sure that it is working as expected, and then consider adding restrictions if desired.</p>
128
  </li>
129
  <li>
130
- <p>Paste your API key into the Google Pagespeed Insights plugin, and Save.</p>
131
  <div style="text-align:center"><img style="border: 1px solid #ccc;" src="assets/images/console_7.png" alt="" /></div>
132
  </li>
133
  </ol>
@@ -151,7 +151,7 @@
151
  <h4 style="font-weight: bold;">Scheduling and URL Configuration:</h4>
152
 
153
  <ol>
154
- <li><strong>Automatically re-check Pagespeed Insights scores using a schedule</strong>: Schedule the Google Pagespeed Insights plugin to automatically find new pages, and recheck existing pages.</li>
155
  <li><strong>Recheck Schedule</strong>: Recheck Schedule can be set to Daily, Weekly, Bi-Monthly, and Monthly.</li>
156
  <li><strong>Configure which types of URLs to check</strong>: Choices include: Pages, Posts, Category Indexes, Custom URLs, Custom Post Types</li>
157
  </ol>
@@ -166,7 +166,7 @@
166
  <img src="assets/images/report_list.png" alt="Report List" /></li>
167
  <br />
168
 
169
- <p>Once you have configured the options, Google Pagespeed Insights for Wordpress will start generating reports for your pages. Click on the "Report List" tab to view a list of all page reports.</p>
170
 
171
  <p>If you do not see any reports listed, wait a bit and refresh the page. If problems persist, please see the troubleshooting section.</p>
172
 
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
  <head lang="en">
3
  <meta http-equiv="content-type" content="text/html;charset=utf-8">
4
+ <title>Insights from Google PageSpeed Documentation</title>
5
  <!-- Framework CSS -->
6
  <link rel="stylesheet" href="assets/blueprint-css/screen.css" type="text/css" media="screen, projection">
7
  <link rel="stylesheet" href="assets/blueprint-css/print.css" type="text/css" media="print">
17
  <body>
18
  <div class="container">
19
 
20
+ <h3 class="center alt">Insights from Google PageSpeed v2.x Documentation by Matt Keys</h3>
21
 
22
  <hr>
23
 
24
+ <h1 class="center">Insights from Google PageSpeed</h1>
25
 
26
  <br />
27
+ <img src="assets/images/feature-image-large.jpg" alt="Insights from Google PageSpeed" />
28
  <br />
29
 
30
  <div class="borderTop">
40
  </div><!-- end div .span-6 -->
41
 
42
  <div class="span-12 last">
43
+ <p class="prepend-top append-0">Thank you for downloading Insights from Google PageSpeed. If you have any questions that are beyond the scope of this help file, please visit <a href="http://mattkeys.me">mattkeys.me</a>. Thanks so much!</p>
44
  </div>
45
  </div><!-- end div .borderTop -->
46
 
66
 
67
  <p>Google Pagespeed Insights is a tool that empowers you to make decisions that increase the performance of your website by expanding on the existing technology of Google Pagespeeds recommendations for current industry best practices for desktop and mobile web performance.</p>
68
 
69
+ <p>Through the addition of advanced data visualization, tagging, filtering, and snapshot technology, Insights from Google PageSpeed provides a comprehensive solution for any webmaster looking to increase their site performance, search engine ranking, and visitors browsing experience.</p>
70
 
71
  <hr>
72
 
73
  <h3 id="installation"><strong>B) Installation</strong> - <a href="#toc">top</a></h3>
74
+ <p>To install Insights from Google PageSpeed:</p>
75
 
76
  <ol>
77
  <li>Login to your Wordpress Admin page (usually http://yourdomain.com/wp-admin)</li>
78
  <li>Navigate to the Plugins screen and then click the "Add New" button</li>
79
+ <li>Click on the "Upload" link near the top of the page and browse for the Insights from Google PageSpeed zip file</li>
80
  <li>Upload the file, and click "Activate Plugin" after the installation completes</li>
81
  <li>Congratulations, installation is complete!</li>
82
  </ol>
95
  <li>Create a new project</li>
96
  <li>Enable the PageSpeed Insights API</li>
97
  <li>Create an API Key</li>
98
+ <li>Paste the API Key into the Insights from Google PageSpeed options page</li>
99
  </ol>
100
 
101
  <p>Below I will provide a more in depth step by step guide based on the current version Google API Console; <strong><em>but know that depending on when you are reading this guide, things may not look the way they do in my screenshots anymore, and in priciple you should be looking to follow the 5 basic steps outlined above.</em></strong></p>
127
  <p>Google will give you the option the restrict usage of your API Key. Be careful that you do not accidently add a restriction that will block your site form using this key. This is one of the most common causes for scans not running properly when people ask for support. I recommend that you first try the plugin without any restrictions to make sure that it is working as expected, and then consider adding restrictions if desired.</p>
128
  </li>
129
  <li>
130
+ <p>Paste your API key into the Insights from Google PageSpeed plugin, and Save.</p>
131
  <div style="text-align:center"><img style="border: 1px solid #ccc;" src="assets/images/console_7.png" alt="" /></div>
132
  </li>
133
  </ol>
151
  <h4 style="font-weight: bold;">Scheduling and URL Configuration:</h4>
152
 
153
  <ol>
154
+ <li><strong>Automatically re-check Pagespeed Insights scores using a schedule</strong>: Schedule the Insights from Google PageSpeed plugin to automatically find new pages, and recheck existing pages.</li>
155
  <li><strong>Recheck Schedule</strong>: Recheck Schedule can be set to Daily, Weekly, Bi-Monthly, and Monthly.</li>
156
  <li><strong>Configure which types of URLs to check</strong>: Choices include: Pages, Posts, Category Indexes, Custom URLs, Custom Post Types</li>
157
  </ol>
166
  <img src="assets/images/report_list.png" alt="Report List" /></li>
167
  <br />
168
 
169
+ <p>Once you have configured the options, Insights from Google PageSpeed will start generating reports for your pages. Click on the "Report List" tab to view a list of all page reports.</p>
170
 
171
  <p>If you do not see any reports listed, wait a bit and refresh the page. If problems persist, please see the troubleshooting section.</p>
172
 
google-pagespeed-insights.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
- Plugin Name: Google Pagespeed Insights
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
 
1
  <?php
2
  /*
3
+ Plugin Name: Insights from Google PageSpeed
4
  Plugin URI: http://mattkeys.me
5
+ Description: Get insights from the Google Pagespeed API right in your WordPress dashboard
6
  Author: Matt Keys
7
+ Version: 4.0.4
8
  Author URI: http://mattkeys.me
9
  */
10
 
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Google Pagespeed Insights ===
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
@@ -7,13 +7,13 @@ Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Use Google Pagespeed Insights to increase your sites performance, your search engine ranking, and your visitors browsing experience.
11
 
12
  == Description ==
13
 
14
  Google Pagespeed Insights is a tool that empowers you to make decisions that increase the performance of your website. Recommendations from Google Pagespeed are based upon current industry best practices for desktop and mobile web performance.
15
 
16
- Through the addition of advanced data visualization, tagging, filtering, and snapshot technology, Google Pagespeed Insights for WordPress provides a comprehensive solution for any webmaster looking to increase their site performance, their search engine ranking, and their visitors browsing experience.
17
 
18
  = Detailed Page Reporting =
19
 
@@ -21,13 +21,13 @@ Sort your page reports by their Page Speed Score to prioritize the largest areas
21
 
22
  = Report Summaries =
23
 
24
- Report Summaries are a powerful and exclusive feature of Google Pagespeed Insights for WordPress. Summaries display your average Page Score, largest areas for improvement across ALL reports, as well as best and lowest performing pages. Report summaries can be filtered to narrow results by: Pages, Posts, Categories, Custom URLs, and Custom Post Types.
25
 
26
  Using Report Summaries allows you to ‘zoom out’ from the page-level and better understand the big picture of your sites performance.
27
 
28
  = Desktop and Mobile Page Reports =
29
 
30
- Best practices for site performance differ greatly between Desktop and Mobile device usage. Configure Google Pagespeed Insights for WordPress to generate Desktop reports, Mobile reports, or both!
31
 
32
  Toggle back and forth between report types to see specific suggestions for improving the performance and experience on each platform.
33
 
@@ -51,7 +51,7 @@ Custom URLs can be tagged and filtered in Report Summaries. Take Report Snapshot
51
 
52
  = Scheduled Report Checks =
53
 
54
- Configure Google Pagespeed Insights for WordPress to automatically recheck your site on a Daily, Weekly, Bi-Monthly, or Monthly basis.
55
 
56
  With each scan, any new pages or posts will be discovered, and existing reports will be updated to reflect any changes to your site, as well as any changes in the Pagespeed recommendations.
57
 
@@ -66,7 +66,7 @@ With each scan, any new pages or posts will be discovered, and existing reports
66
 
67
  1. Login to your WordPress Admin page (usually http://yourdomain.com/wp-admin)
68
  2. Navigate to the Plugins screen and then click the "Add New" button
69
- 3. Click on the "Upload" link near the top of the page and browse for the Google Pagespeed Insights for WordPress zip file
70
  4. Upload the file, and click "Activate Plugin" after the installation completes
71
  5. Congratulations, installation is complete; proceed to configuration.
72
 
@@ -79,7 +79,7 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
79
  1. Navigate to https://code.google.com/apis/console
80
  2. Login with your Google Account (Create a Google account if you do not have one)
81
  3. Create a new API Key and enable the Google Pagespeed Insights API* (see note about restrictions)
82
- 4. Paste your API Key into the Options page of Google Pagespeed Insights for WordPress
83
 
84
  * Try first creating the API key without any 'restrictions'. In my testing there seems to be a bug with using restricitons with the Pagespeed API.
85
 
@@ -136,6 +136,10 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
136
 
137
  == Changelog ==
138
 
 
 
 
 
139
  = 4.0.3 =
140
  * Bugfix loading screenshots 'filmstrip' images broken
141
 
@@ -226,6 +230,10 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
226
 
227
  == Upgrade Notice ==
228
 
 
 
 
 
229
  = 4.0.3 =
230
  * Bugfix loading screenshots 'filmstrip' images broken
231
 
1
+ === Insights from Google PageSpeed ===
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
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Use Insights from Google PageSpeed to increase your sites performance, your search engine ranking, and your visitors browsing experience.
11
 
12
  == Description ==
13
 
14
  Google Pagespeed Insights is a tool that empowers you to make decisions that increase the performance of your website. Recommendations from Google Pagespeed are based upon current industry best practices for desktop and mobile web performance.
15
 
16
+ Through the addition of advanced data visualization, tagging, filtering, and snapshot technology, Insights from Google PageSpeed provides a comprehensive solution for any webmaster looking to increase their site performance, their search engine ranking, and their visitors browsing experience.
17
 
18
  = Detailed Page Reporting =
19
 
21
 
22
  = Report Summaries =
23
 
24
+ Report Summaries are a powerful and exclusive feature of Insights from Google PageSpeed. Summaries display your average Page Score, largest areas for improvement across ALL reports, as well as best and lowest performing pages. Report summaries can be filtered to narrow results by: Pages, Posts, Categories, Custom URLs, and Custom Post Types.
25
 
26
  Using Report Summaries allows you to ‘zoom out’ from the page-level and better understand the big picture of your sites performance.
27
 
28
  = Desktop and Mobile Page Reports =
29
 
30
+ Best practices for site performance differ greatly between Desktop and Mobile device usage. Configure Insights from Google PageSpeed to generate Desktop reports, Mobile reports, or both!
31
 
32
  Toggle back and forth between report types to see specific suggestions for improving the performance and experience on each platform.
33
 
51
 
52
  = Scheduled Report Checks =
53
 
54
+ Configure Insights from Google PageSpeed to automatically recheck your site on a Daily, Weekly, Bi-Monthly, or Monthly basis.
55
 
56
  With each scan, any new pages or posts will be discovered, and existing reports will be updated to reflect any changes to your site, as well as any changes in the Pagespeed recommendations.
57
 
66
 
67
  1. Login to your WordPress Admin page (usually http://yourdomain.com/wp-admin)
68
  2. Navigate to the Plugins screen and then click the "Add New" button
69
+ 3. Click on the "Upload" link near the top of the page and browse for the Insights from Google PageSpeed zip file
70
  4. Upload the file, and click "Activate Plugin" after the installation completes
71
  5. Congratulations, installation is complete; proceed to configuration.
72
 
79
  1. Navigate to https://code.google.com/apis/console
80
  2. Login with your Google Account (Create a Google account if you do not have one)
81
  3. Create a new API Key and enable the Google Pagespeed Insights API* (see note about restrictions)
82
+ 4. Paste your API Key into the Options page of Insights from Google PageSpeed
83
 
84
  * Try first creating the API key without any 'restrictions'. In my testing there seems to be a bug with using restricitons with the Pagespeed API.
85
 
136
 
137
  == Changelog ==
138
 
139
+ = 4.0.4 =
140
+ * Bugfix improperly escaped data (xss security issue)
141
+ * Rename plugin to "Insights from Google PageSpeed"
142
+
143
  = 4.0.3 =
144
  * Bugfix loading screenshots 'filmstrip' images broken
145
 
230
 
231
  == Upgrade Notice ==
232
 
233
+ = 4.0.4 =
234
+ * Bugfix improperly escaped data (xss security issue)
235
+ * Rename plugin to "Insights from Google PageSpeed"
236
+
237
  = 4.0.3 =
238
  * Bugfix loading screenshots 'filmstrip' images broken
239
 
templates/add-custom-urls-bulk.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  ?>
11
 
12
  <form method="post" action="" enctype="multipart/form-data">
13
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
14
  <input type="hidden" name="render" value="add-custom-urls-bulk" />
15
  <input type="hidden" name="action" value="add-custom-urls-bulk" />
16
 
10
  ?>
11
 
12
  <form method="post" action="" enctype="multipart/form-data">
13
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
14
  <input type="hidden" name="render" value="add-custom-urls-bulk" />
15
  <input type="hidden" name="action" value="add-custom-urls-bulk" />
16
 
templates/add-custom-urls.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  ?>
11
 
12
  <form method="post" action="">
13
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
14
  <input type="hidden" name="render" value="add-custom-urls" />
15
  <input type="hidden" name="action" value="add-custom-urls" />
16
 
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  </div>
23
  <div class="padded">
24
 
25
- <p><?php _e( 'Add any valid URL, even from sites outside of WordPress. Enter up to 10 URLs below. If you need to enter a lot of URLs check out the', 'gpagespeedi' ); ?> <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ) ;?>&amp;render=add-custom-urls-bulk"><?php _e( 'Bulk URL uploader', 'gpagespeedi' ); ?></a>.</p>
26
 
27
  <table class="form-table">
28
  <tbody>
10
  ?>
11
 
12
  <form method="post" action="">
13
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
14
  <input type="hidden" name="render" value="add-custom-urls" />
15
  <input type="hidden" name="action" value="add-custom-urls" />
16
 
22
  </div>
23
  <div class="padded">
24
 
25
+ <p><?php _e( 'Add any valid URL, even from sites outside of WordPress. Enter up to 10 URLs below. If you need to enter a lot of URLs check out the', 'gpagespeedi' ); ?> <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ) ;?>&amp;render=add-custom-urls-bulk"><?php _e( 'Bulk URL uploader', 'gpagespeedi' ); ?></a>.</p>
26
 
27
  <table class="form-table">
28
  <tbody>
templates/custom-urls.php CHANGED
@@ -14,7 +14,7 @@ $GPI_List_Table->prepare_items();
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="custom-urls" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="custom-urls" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
templates/ignored-urls.php CHANGED
@@ -14,7 +14,7 @@ $GPI_List_Table->prepare_items();
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="ignored-urls" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="ignored-urls" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
templates/options.php CHANGED
@@ -235,7 +235,7 @@ if ( ! defined( 'ABSPATH' ) ) {
235
  <input type="checkbox" name="log_api_errors" id="log_api_errors" <?php checked( $this->gpi_options['log_api_errors'] ); ?>/>
236
  <label for="log_api_errors"><?php _e( 'Log API Exceptions', 'gpagespeedi' ); ?></label>
237
  </p>
238
- <p class="description"><?php _e( 'API error logs will be stored for up to 7 days.', 'gpagespeedi' ); ?> <a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&amp;render=logs"><?php _e( 'View Logs', 'gpagespeedi' ); ?></a></p>
239
 
240
  <p><label for="sleep_time"><?php _e( 'Delete Data', 'gpagespeedi' ); ?>:</label></p>
241
  <select name="purge_all_data" id="purge_all_data">
235
  <input type="checkbox" name="log_api_errors" id="log_api_errors" <?php checked( $this->gpi_options['log_api_errors'] ); ?>/>
236
  <label for="log_api_errors"><?php _e( 'Log API Exceptions', 'gpagespeedi' ); ?></label>
237
  </p>
238
+ <p class="description"><?php _e( 'API error logs will be stored for up to 7 days.', 'gpagespeedi' ); ?> <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&amp;render=logs"><?php _e( 'View Logs', 'gpagespeedi' ); ?></a></p>
239
 
240
  <p><label for="sleep_time"><?php _e( 'Delete Data', 'gpagespeedi' ); ?>:</label></p>
241
  <select name="purge_all_data" id="purge_all_data">
templates/parts/messages.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
9
 
10
- $page = sanitize_text_field( $_REQUEST['page'] );
11
 
12
  ?>
13
 
@@ -15,20 +15,20 @@ $page = sanitize_text_field( $_REQUEST['page'] );
15
  <div id="gpi-upgrade-notice">
16
  <div class="inner">
17
  <div class="gpi-icon logo">
18
- <img src="<?php echo GPI_PUBLIC_PATH; ?>assets/images/icon.svg" width="144px" height="100px" alt="Google Pagespeed Insights for WordPress" />
19
  </div>
20
  <div class="content">
21
  <h2>
22
  <?php _e( 'Report Updates Required', 'gpagespeedi' ); ?>
23
  </h2>
24
  <p>
25
- <?php _e( 'Thank you for updating to the latest version of Google Pagespeed Insights for WordPress!', 'gpagespeedi' ); ?>
26
  </p>
27
  <p>
28
  <?php echo __( 'Version', 'gpagespeedi' ) . ' ' . GPI_VERSION . ' ' . __( 'requires some updates to the way Pagespeed reports are stored to take advantage of the latest plugin updates. You will notice some missing report functionality until all pages have been rechecked.', 'gpagespeedi' ); ?>
29
  </p>
30
  <p>
31
- <a href="<?php echo admin_url( 'tools.php?page=google-pagespeed-insights&amp;render=' . sanitize_text_field( $_GET['render'] ) . '&amp;action=reports_update' ); ?>" class="button button-primary"><?php _e( 'Recheck Pagespeed Reports Now', 'gpagespeedi' ); ?></a>
32
  </p>
33
  </div>
34
  </div>
7
  exit;
8
  }
9
 
10
+ $page = esc_attr( $_REQUEST['page'] );
11
 
12
  ?>
13
 
15
  <div id="gpi-upgrade-notice">
16
  <div class="inner">
17
  <div class="gpi-icon logo">
18
+ <img src="<?php echo GPI_PUBLIC_PATH; ?>assets/images/icon.svg" width="144px" height="100px" alt="Insights from Google PageSpeed" />
19
  </div>
20
  <div class="content">
21
  <h2>
22
  <?php _e( 'Report Updates Required', 'gpagespeedi' ); ?>
23
  </h2>
24
  <p>
25
+ <?php _e( 'Thank you for updating to the latest version of Insights from Google PageSpeed!', 'gpagespeedi' ); ?>
26
  </p>
27
  <p>
28
  <?php echo __( 'Version', 'gpagespeedi' ) . ' ' . GPI_VERSION . ' ' . __( 'requires some updates to the way Pagespeed reports are stored to take advantage of the latest plugin updates. You will notice some missing report functionality until all pages have been rechecked.', 'gpagespeedi' ); ?>
29
  </p>
30
  <p>
31
+ <a href="<?php echo admin_url( 'tools.php?page=google-pagespeed-insights&amp;render=' . esc_attr( $_GET['render'] ) . '&amp;action=reports_update' ); ?>" class="button button-primary"><?php _e( 'Recheck Pagespeed Reports Now', 'gpagespeedi' ); ?></a>
32
  </p>
33
  </div>
34
  </div>
templates/parts/navigation.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
9
 
10
- $page = sanitize_text_field( $_REQUEST['page'] );
11
 
12
  ?>
13
 
7
  exit;
8
  }
9
 
10
+ $page = esc_attr( $_REQUEST['page'] );
11
 
12
  ?>
13
 
templates/report-list.php CHANGED
@@ -14,7 +14,7 @@ $GPI_List_Table->prepare_items();
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="report-list" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="report-list" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
templates/snapshots.php CHANGED
@@ -14,7 +14,7 @@ $GPI_List_Table->prepare_items();
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="snapshots" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
14
  ?>
15
 
16
  <form id="reports-filter" action="" method="get">
17
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
18
  <input type="hidden" name="render" value="snapshots" />
19
 
20
  <?php $GPI_List_Table->display(); ?>
templates/summary.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  <div class="tablenav top">
13
  <div class="alignleft actions">
14
  <form method="get" action="" id="filter" name="filter">
15
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
16
  <input type="hidden" name="render" value="summary" />
17
  <select name="filter" id="filter">
18
  <?php
@@ -50,7 +50,7 @@ if ( ! defined( 'ABSPATH' ) ) {
50
  </div>
51
  <div class="alignleft actions">
52
  <form method="post" action="" id="savesnapshot" name="savesnapshot">
53
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
54
  <input type="hidden" name="render" value="summary" />
55
  <input type="hidden" name="action" value="save-snapshot" />
56
  <input type="text" name="comment" placeholder="<?php _e( 'Report Description', 'gpagespeedi' ); ?>" value="" />
@@ -116,12 +116,12 @@ if ( ! defined( 'ABSPATH' ) ) {
116
  </p>
117
  <ol class="no-items">
118
  <?php if ( isset( $current_filter ) && $current_filter != 'all' ) : ?>
119
- <li><?php _e( 'There may not be any results for the "' . $current_filter . '" filter. Try another filter.', 'gpagespeedi' ); ?></li>
120
  <?php endif; ?>
121
  <?php if ( $this->gpi_options['strategy'] == 'both' ) : ?>
122
  <li><?php echo __( 'There may not be any', 'gpagespeedi' ) . ' ' . $this->gpi_ui_options['view_preference'] . ' ' . __( 'reports completed yet.', 'gpagespeedi' ) . ' ' . __( 'Try switching the report mode.', 'gpagespeedi' ); ?></li>
123
  <?php endif; ?>
124
- <li><?php _e( 'Make sure that you have entered your Google API key on the ', 'gpagespeedi' );?><a href="?page=<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>&render=options"><?php _e( 'Options', 'gpagespeedi' ); ?></a> <?php _e( 'page', 'gpagespeedi' ); ?>.</li>
125
  <li><?php _e( 'Make sure that you have enabled "PageSpeed Insights API" from the Services page of the ', 'gpagespeedi' );?><a href="https://code.google.com/apis/console/"><?php _e( 'Google Console', 'gpagespeedi' ); ?></a>.</li>
126
  <li><?php _e( 'Make sure that your URLs are publicly accessible', 'gpagespeedi' ); ?>.</li>
127
  </ol>
12
  <div class="tablenav top">
13
  <div class="alignleft actions">
14
  <form method="get" action="" id="filter" name="filter">
15
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
16
  <input type="hidden" name="render" value="summary" />
17
  <select name="filter" id="filter">
18
  <?php
50
  </div>
51
  <div class="alignleft actions">
52
  <form method="post" action="" id="savesnapshot" name="savesnapshot">
53
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
54
  <input type="hidden" name="render" value="summary" />
55
  <input type="hidden" name="action" value="save-snapshot" />
56
  <input type="text" name="comment" placeholder="<?php _e( 'Report Description', 'gpagespeedi' ); ?>" value="" />
116
  </p>
117
  <ol class="no-items">
118
  <?php if ( isset( $current_filter ) && $current_filter != 'all' ) : ?>
119
+ <li><?php _e( 'There may not be any results for the "' . esc_html( $current_filter ) . '" filter. Try another filter.', 'gpagespeedi' ); ?></li>
120
  <?php endif; ?>
121
  <?php if ( $this->gpi_options['strategy'] == 'both' ) : ?>
122
  <li><?php echo __( 'There may not be any', 'gpagespeedi' ) . ' ' . $this->gpi_ui_options['view_preference'] . ' ' . __( 'reports completed yet.', 'gpagespeedi' ) . ' ' . __( 'Try switching the report mode.', 'gpagespeedi' ); ?></li>
123
  <?php endif; ?>
124
+ <li><?php _e( 'Make sure that you have entered your Google API key on the ', 'gpagespeedi' );?><a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>&render=options"><?php _e( 'Options', 'gpagespeedi' ); ?></a> <?php _e( 'page', 'gpagespeedi' ); ?>.</li>
125
  <li><?php _e( 'Make sure that you have enabled "PageSpeed Insights API" from the Services page of the ', 'gpagespeedi' );?><a href="https://code.google.com/apis/console/"><?php _e( 'Google Console', 'gpagespeedi' ); ?></a>.</li>
126
  <li><?php _e( 'Make sure that your URLs are publicly accessible', 'gpagespeedi' ); ?>.</li>
127
  </ol>
templates/view-snapshot.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  <div class="toolbar">
13
  <div class="left">
14
  <form method="get" action="" name="filter">
15
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
16
  <input type="hidden" name="render" value="view-snapshot" />
17
  <div class="tablenav top snapshots">
18
  <select name="snapshot_id">
@@ -36,7 +36,7 @@ if ( ! defined( 'ABSPATH' ) ) {
36
  <?php if ( count( $similar_snapshots ) >= 2 ) : ?>
37
  <div class="right">
38
  <form method="get" action="" name="filter">
39
- <input type="hidden" name="page" value="<?php echo sanitize_text_field( $_REQUEST['page'] ); ?>" />
40
  <input type="hidden" name="render" value="view-snapshot" />
41
  <input type="hidden" name="snapshot_id" value="<?php echo intval( $_GET['snapshot_id'] ); ?>" />
42
  <div class="tablenav top snapshots">
12
  <div class="toolbar">
13
  <div class="left">
14
  <form method="get" action="" name="filter">
15
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
16
  <input type="hidden" name="render" value="view-snapshot" />
17
  <div class="tablenav top snapshots">
18
  <select name="snapshot_id">
36
  <?php if ( count( $similar_snapshots ) >= 2 ) : ?>
37
  <div class="right">
38
  <form method="get" action="" name="filter">
39
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
40
  <input type="hidden" name="render" value="view-snapshot" />
41
  <input type="hidden" name="snapshot_id" value="<?php echo intval( $_GET['snapshot_id'] ); ?>" />
42
  <div class="tablenav top snapshots">