Async JavaScript - Version 2.17.09.31

Version Description

  • FIX: Sanitise all $_REQUEST
  • MOD: Remove notices
Download this release

Release Info

Developer cloughit
Plugin Icon 128x128 Async JavaScript
Version 2.17.09.31
Comparing to
See all releases

Code changes from version 2.17.09.30 to 2.17.09.31

Files changed (2) hide show
  1. async-javascript.php +8 -59
  2. readme.txt +6 -1
async-javascript.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
  Plugin Name: Async JavaScript
5
  Plugin URI: https://cloughit.com.au/product/async-javascript/
6
  Description: Async JavaScript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
- Version: 2.17.09.30
8
  Author: Clough I.T. Solutions
9
  Author URI: http://www.cloughit.com.au/
10
  Text Domain: async-javascript
@@ -26,7 +26,7 @@ function aj_admin_init() {
26
  define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
27
  define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
28
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
29
- define( 'AJ_VERSION', '2.17.09.30' );
30
  require_once( AJ_PLUGIN_DIR . 'lib/gtmetrix/class.Services_WTF_Test.php' );
31
  }
32
  /**
@@ -184,39 +184,6 @@ function aj_dashboard_widget() {
184
  </div>
185
  <?php
186
  }
187
- /**
188
- * async_javascript_upgrade_notice()
189
- *
190
- * Show notices
191
- *
192
- */
193
- add_action( 'admin_notices', 'async_javascript_upgrade_notice' );
194
- function async_javascript_upgrade_notice() {
195
- if ( is_admin() && current_user_can( 'manage_options' ) ) {
196
- $options = array(
197
- 'timeout' => 10, //seconds
198
- 'headers' => array(
199
- 'Accept' => 'application/json',
200
- )
201
- );
202
- $aj_notice_url = 'https://cloughit.com.au/wordpress-plugins/async-javascript/aj-upgrade-notice.json';
203
- $aj_notice_json = wp_remote_get( $aj_notice_url, $options );
204
- if ( is_array( $aj_notice_json ) && ! is_wp_error( $aj_notice_json ) ) {
205
- $body = wp_remote_retrieve_body( $aj_notice_json );
206
- $aj_notice = json_decode( $body );
207
- $aj_upgrade_notice = get_option( 'aj_upgrade_notice' );
208
- if ( !is_null( $aj_notice ) && false !== $aj_upgrade_notice && $aj_upgrade_notice != $aj_notice->notice_id ) {
209
- $exp = strtotime( $aj_notice->expire );
210
- $title = $aj_notice->title != '' ? '<string><em>' . stripslashes( $aj_notice->title ) . '</em></strong>' : '';
211
- $message = stripslashes( $aj_notice->message );
212
- $time = current_time( 'timestamp', 1 );
213
- if ( $time < $exp ) {
214
- echo '<div class="notice notice-info is-dismissible aj-upgrade-notice" data-id="' . $aj_notice->notice_id . '">' . $title . $message . '</div>';
215
- }
216
- }
217
- }
218
- }
219
- }
220
  /**
221
  * async_javascript_menu()
222
  *
@@ -995,24 +962,6 @@ function my_autoptimize_defer( $defer ) {
995
  }
996
  }
997
  }
998
- /**
999
- * async_javascript_dismiss_upgrade()
1000
- *
1001
- * Dismiss notices
1002
- *
1003
- */
1004
- add_action( 'wp_ajax_async_javascript_dismiss_upgrade', 'async_javascript_dismiss_upgrade' );
1005
- function async_javascript_dismiss_upgrade() {
1006
- $notice_id = isset( $_REQUEST['notice_id'] ) && $_REQUEST['notice_id'] != '' ? $_REQUEST['notice_id'] : '';
1007
- update_option( 'aj_upgrade_notice', $notice_id );
1008
- die();
1009
- }
1010
- /**
1011
- * async_javascript_dismiss_upgrade()
1012
- *
1013
- * Ajax function for Async JavaScript
1014
- *
1015
- */
1016
  function aj_steps() {
1017
  check_ajax_referer( 'aj_nonce', 'security' );
1018
  $aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
@@ -1028,7 +977,7 @@ function aj_steps() {
1028
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1029
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1030
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1031
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1032
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1033
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1034
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
@@ -1075,7 +1024,7 @@ function aj_steps() {
1075
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1076
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1077
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1078
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1079
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1080
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1081
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
@@ -1122,7 +1071,7 @@ function aj_steps() {
1122
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1123
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1124
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1125
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1126
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1127
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1128
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
@@ -1169,7 +1118,7 @@ function aj_steps() {
1169
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1170
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1171
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1172
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1173
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1174
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1175
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
@@ -1216,7 +1165,7 @@ function aj_steps() {
1216
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1217
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1218
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1219
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1220
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1221
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1222
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
@@ -1318,7 +1267,7 @@ function aj_steps() {
1318
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1319
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1320
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1321
- $site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
1322
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1323
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1324
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
4
  Plugin Name: Async JavaScript
5
  Plugin URI: https://cloughit.com.au/product/async-javascript/
6
  Description: Async JavaScript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
+ Version: 2.17.09.31
8
  Author: Clough I.T. Solutions
9
  Author URI: http://www.cloughit.com.au/
10
  Text Domain: async-javascript
26
  define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
27
  define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
28
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
29
+ define( 'AJ_VERSION', '2.17.09.31' );
30
  require_once( AJ_PLUGIN_DIR . 'lib/gtmetrix/class.Services_WTF_Test.php' );
31
  }
32
  /**
184
  </div>
185
  <?php
186
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  /**
188
  * async_javascript_menu()
189
  *
962
  }
963
  }
964
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
965
  function aj_steps() {
966
  check_ajax_referer( 'aj_nonce', 'security' );
967
  $aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
977
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
978
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
979
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
980
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
981
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
982
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
983
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
1024
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1025
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1026
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1027
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
1028
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1029
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1030
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
1071
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1072
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1073
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1074
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
1075
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1076
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1077
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
1118
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1119
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1120
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1121
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
1122
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1123
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1124
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
1165
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1166
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1167
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1168
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
1169
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1170
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1171
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
1267
  $aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
1268
  $aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
1269
  $aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
1270
+ $site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
1271
  update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
1272
  update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
1273
  update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.cloughit.com.au/donate/ (coming soon)
4
  Tags: async,javascript,google,pagespeed,js,speed,performance,boost,render,blocking,above-the-fold
5
  Requires at least: 2.8
6
  Tested up to: 4.8.2
7
- Stable tag: 2.17.09.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,6 +101,11 @@ Coming soon!
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
104
  = 2.17.09.30 =
105
 
106
  * FIX: Sanitise all $_GET and all $_POST
4
  Tags: async,javascript,google,pagespeed,js,speed,performance,boost,render,blocking,above-the-fold
5
  Requires at least: 2.8
6
  Tested up to: 4.8.2
7
+ Stable tag: 2.17.09.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  == Changelog ==
103
 
104
+ = 2.17.09.31 =
105
+
106
+ * FIX: Sanitise all $_REQUEST
107
+ * MOD: Remove notices
108
+
109
  = 2.17.09.30 =
110
 
111
  * FIX: Sanitise all $_GET and all $_POST