a3 Lazy Load - Version 2.4.9

Version Description

This is a maintenance release for compatibility with WordPress major version 5.9

Download this release

Release Info

Developer a3rev
Plugin Icon 128x128 a3 Lazy Load
Version 2.4.9
Comparing to
See all releases

Code changes from version 2.4.8 to 2.4.9

a3-lazy-load.php CHANGED
@@ -2,11 +2,11 @@
2
  /*
3
  Plugin Name: a3 Lazy Load
4
  Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
5
- Version: 2.4.8
6
  Author: a3rev Software
7
  Author URI: https://a3rev.com/
8
- Requires at least: 5.0
9
- Tested up to: 5.8
10
  Text Domain: a3-lazy-load
11
  Domain Path: /languages
12
  License: GPLv2 or later
@@ -31,7 +31,7 @@ define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
31
 
32
  define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
33
  define( 'A3_LAZY_LOAD_PREFIX', 'a3_lazy_load_' );
34
- define( 'A3_LAZY_VERSION', '2.4.8' );
35
  define( 'A3_LAZY_LOAD_G_FONTS', false );
36
 
37
  use \A3Rev\LazyLoad\FrameWork;
2
  /*
3
  Plugin Name: a3 Lazy Load
4
  Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
5
+ Version: 2.4.9
6
  Author: a3rev Software
7
  Author URI: https://a3rev.com/
8
+ Requires at least: 5.6
9
+ Tested up to: 5.9
10
  Text Domain: a3-lazy-load
11
  Domain Path: /languages
12
  License: GPLv2 or later
31
 
32
  define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
33
  define( 'A3_LAZY_LOAD_PREFIX', 'a3_lazy_load_' );
34
+ define( 'A3_LAZY_VERSION', '2.4.9' );
35
  define( 'A3_LAZY_LOAD_G_FONTS', false );
36
 
37
  use \A3Rev\LazyLoad\FrameWork;
admin/admin-interface.php CHANGED
@@ -235,6 +235,49 @@ class Admin_Interface extends Admin_UI
235
  );
236
  echo json_encode( $response_data );
237
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
 
240
  }
@@ -1458,7 +1501,7 @@ class Admin_Interface extends Admin_UI
1458
  $description = $tip = '';
1459
  }
1460
 
1461
- if ( $description && in_array( $value['type'], array( 'manual_check_version', 'ajax_submit', 'ajax_multi_submit', 'textarea', 'radio', 'onoff_radio', 'typography', 'border', 'border_styles', 'array_textfields', 'wp_editor', 'upload' ) ) ) {
1462
  $description = '<div class="desc" style="margin-bottom:5px;">' . wptexturize( $description ) . '</div>';
1463
  } elseif ( $description ) {
1464
  $description = '<span class="description" style="margin-left:5px;">' . wptexturize( $description ) . '</span>';
@@ -1882,7 +1925,13 @@ class Admin_Interface extends Admin_UI
1882
 
1883
  <div>&nbsp;</div>
1884
  <div class="a3rev-ui-google-api-key-container" style="<?php if( 1 != $google_api_key_enable ) { echo 'display: none;'; } ?>">
1885
- <div class="a3rev-ui-google-api-key-description"><?php echo sprintf( __( "Enter your existing Google Fonts API Key below. Don't have a key? Visit <a href='%s' target='_blank'>Google Developer API</a> to create a key", 'a3-lazy-load' ), 'https://developers.google.com/fonts/docs/developer_api#APIKey' ); ?></div>
 
 
 
 
 
 
1886
  <div class="a3rev-ui-google-api-key-inside
1887
  <?php
1888
  if ( $GLOBALS[$this->plugin_prefix.'fonts_face']->is_valid_google_api_key() ) {
@@ -1893,17 +1942,23 @@ class Admin_Interface extends Admin_UI
1893
  ?>
1894
  ">
1895
  <input
 
1896
  name="<?php echo esc_attr( $this->google_api_key_option ); ?>"
1897
  id="<?php echo esc_attr( $this->google_api_key_option ); ?>"
1898
  type="text"
1899
  style="<?php echo esc_attr( $value['css'] ); ?>"
1900
  value="<?php echo esc_attr( $google_api_key ); ?>"
1901
- class="a3rev-ui-text a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?> <?php echo esc_attr( $value['class'] ); ?>"
1902
- placeholder="<?php echo __( 'Google Fonts API Key', 'a3-lazy-load' ); ?>"
1903
  <?php echo implode( ' ', $custom_attributes ); // XSS ok ?>
1904
  />
1905
- <p class="a3rev-ui-google-valid-key-message"><?php echo __( 'Your Google API Key is valid and automatic font updates are enabled.', 'a3-lazy-load' ); ?></p>
1906
- <p class="a3rev-ui-google-unvalid-key-message"><?php echo __( 'Please enter a valid Google API Key.', 'a3-lazy-load' ); ?></p>
 
 
 
 
 
1907
  </div>
1908
  </div>
1909
  </td>
@@ -1938,7 +1993,13 @@ class Admin_Interface extends Admin_UI
1938
 
1939
  <div>&nbsp;</div>
1940
  <div class="a3rev-ui-google-api-key-container" style="<?php if( 1 != $google_map_api_key_enable ) { echo 'display: none;'; } ?>">
1941
- <div class="a3rev-ui-google-api-key-description"><?php echo sprintf( __( "Enter your existing Google Map API Key below. Don't have a key? Visit <a href='%s' target='_blank'>Google Maps API</a> to create a key", 'a3-lazy-load' ), 'https://developers.google.com/maps/documentation/javascript/get-api-key' ); ?></div>
 
 
 
 
 
 
1942
  <div class="a3rev-ui-google-api-key-inside
1943
  <?php
1944
  if ( $this->is_valid_google_map_api_key() ) {
@@ -1949,6 +2010,7 @@ class Admin_Interface extends Admin_UI
1949
  ?>
1950
  ">
1951
  <input
 
1952
  name="<?php echo esc_attr( $this->google_map_api_key_option ); ?>"
1953
  id="<?php echo esc_attr( $this->google_map_api_key_option ); ?>"
1954
  type="text"
@@ -1958,8 +2020,13 @@ class Admin_Interface extends Admin_UI
1958
  placeholder="<?php echo __( 'Google Map API Key', 'a3-lazy-load' ); ?>"
1959
  <?php echo implode( ' ', $custom_attributes ); // XSS ok ?>
1960
  />
1961
- <p class="a3rev-ui-google-valid-key-message"><?php echo __( 'Your Google API Key is valid and automatic font updates are enabled.', 'a3-lazy-load' ); ?></p>
1962
- <p class="a3rev-ui-google-unvalid-key-message"><?php echo __( 'Please enter a valid Google API Key.', 'a3-lazy-load' ); ?></p>
 
 
 
 
 
1963
  </div>
1964
  </div>
1965
  </td>
235
  );
236
  echo json_encode( $response_data );
237
  break;
238
+
239
+ case 'validate_google_api_key':
240
+ $g_key = sanitize_text_field( $_REQUEST['g_key'] );
241
+ $g_key_type = sanitize_text_field( $_REQUEST['g_key_type'] );
242
+
243
+ $is_valid = false;
244
+ if ( ! empty( $g_key ) ) {
245
+ if ( 'font' == $g_key_type ) {
246
+ $response_fonts = $GLOBALS[$this->plugin_prefix.'fonts_face']->validate_google_api_key( $g_key );
247
+ if ( ! isset( $response_fonts['error'] ) ) {
248
+ $is_valid = true;
249
+ }
250
+
251
+ if ( $is_valid ) {
252
+ $google_api_key_status = 'valid';
253
+ } else {
254
+ $google_api_key_status = 'invalid';
255
+ }
256
+
257
+ //caching google api status for 24 hours
258
+ set_transient( $this->google_api_key_option . '_status', $google_api_key_status, 86400 );
259
+
260
+ update_option( $this->google_api_key_option . '_enable', 1 );
261
+ update_option( $this->google_api_key_option, trim( $g_key ) );
262
+ } else {
263
+ $is_valid = $this->validate_google_map_api_key( $g_key );
264
+ update_option( $this->google_map_api_key_option . '_enable', 1 );
265
+ update_option( $this->google_map_api_key_option, trim( $g_key ) );
266
+ }
267
+ }
268
+
269
+ if ( $is_valid ) {
270
+ $is_valid = 1;
271
+ } else {
272
+ $is_valid = 0;
273
+ }
274
+
275
+ $response_data = array(
276
+ 'is_valid' => $is_valid,
277
+ );
278
+ echo json_encode( $response_data );
279
+
280
+ break;
281
  }
282
 
283
  }
1501
  $description = $tip = '';
1502
  }
1503
 
1504
+ if ( $description && in_array( $value['type'], array( 'manual_check_version', 'ajax_submit', 'ajax_multi_submit', 'textarea', 'radio', 'onoff_radio', 'typography', 'border', 'border_styles', 'array_textfields', 'wp_editor', 'upload', 'google_api_key', 'google_map_api_key' ) ) ) {
1505
  $description = '<div class="desc" style="margin-bottom:5px;">' . wptexturize( $description ) . '</div>';
1506
  } elseif ( $description ) {
1507
  $description = '<span class="description" style="margin-left:5px;">' . wptexturize( $description ) . '</span>';
1925
 
1926
  <div>&nbsp;</div>
1927
  <div class="a3rev-ui-google-api-key-container" style="<?php if( 1 != $google_api_key_enable ) { echo 'display: none;'; } ?>">
1928
+ <?php
1929
+ if ( ! empty( $description ) ) {
1930
+ echo $description; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */
1931
+ } else {
1932
+ ?>
1933
+ <div class="a3rev-ui-google-api-key-description"><?php echo sprintf( __( "Enter your existing Google Fonts API Key below. Don't have a key? Visit <a href='%s' target='_blank'>Google Developer API</a> to create a key" ), 'https://developers.google.com/fonts/docs/developer_api#APIKey' ); ?></div>
1934
+ <?php } ?>
1935
  <div class="a3rev-ui-google-api-key-inside
1936
  <?php
1937
  if ( $GLOBALS[$this->plugin_prefix.'fonts_face']->is_valid_google_api_key() ) {
1942
  ?>
1943
  ">
1944
  <input
1945
+ data-type="font"
1946
  name="<?php echo esc_attr( $this->google_api_key_option ); ?>"
1947
  id="<?php echo esc_attr( $this->google_api_key_option ); ?>"
1948
  type="text"
1949
  style="<?php echo esc_attr( $value['css'] ); ?>"
1950
  value="<?php echo esc_attr( $google_api_key ); ?>"
1951
+ class="a3rev-ui-text a3rev-ui-google-api-key a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?> <?php echo esc_attr( $value['class'] ); ?>"
1952
+ placeholder="<?php echo __( 'Google Fonts API Key' ); ?>"
1953
  <?php echo implode( ' ', $custom_attributes ); // XSS ok ?>
1954
  />
1955
+ <button
1956
+ name="<?php echo esc_attr( $this->google_api_key_option ); ?>_validate_bt"
1957
+ id="<?php echo esc_attr( $this->google_api_key_option ); ?>_validate_bt"
1958
+ type="button"
1959
+ class="a3rev-ui-google-api-key-validate-button a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>-button"><?php echo __( 'Validate' ); ?></button>
1960
+ <p class="a3rev-ui-google-valid-key-message"><?php echo __( 'Your Google API Key is valid and automatic font updates are enabled.' ); ?></p>
1961
+ <p class="a3rev-ui-google-unvalid-key-message"><?php echo __( 'Please enter a valid Google API Key.' ); ?></p>
1962
  </div>
1963
  </div>
1964
  </td>
1993
 
1994
  <div>&nbsp;</div>
1995
  <div class="a3rev-ui-google-api-key-container" style="<?php if( 1 != $google_map_api_key_enable ) { echo 'display: none;'; } ?>">
1996
+ <?php
1997
+ if ( ! empty( $description ) ) {
1998
+ echo $description; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */
1999
+ } else {
2000
+ ?>
2001
+ <div class="a3rev-ui-google-api-key-description" style="margin-bottom:5px;"><?php echo sprintf( __( "Enter your Google Maps API Key and save changes, or go to <a href='%s' target='_blank'>Google Maps API</a> to create a new key. The key must have the Geocoding API, Maps Embed API and Maps JavaScript API as a minimum." ), 'https://developers.google.com/maps/documentation/javascript/get-api-key' ); ?></div>
2002
+ <?php } ?>
2003
  <div class="a3rev-ui-google-api-key-inside
2004
  <?php
2005
  if ( $this->is_valid_google_map_api_key() ) {
2010
  ?>
2011
  ">
2012
  <input
2013
+ data-type="map"
2014
  name="<?php echo esc_attr( $this->google_map_api_key_option ); ?>"
2015
  id="<?php echo esc_attr( $this->google_map_api_key_option ); ?>"
2016
  type="text"
2020
  placeholder="<?php echo __( 'Google Map API Key', 'a3-lazy-load' ); ?>"
2021
  <?php echo implode( ' ', $custom_attributes ); // XSS ok ?>
2022
  />
2023
+ <button
2024
+ name="<?php echo esc_attr( $this->google_map_api_key_option ); ?>_validate_bt"
2025
+ id="<?php echo esc_attr( $this->google_map_api_key_option ); ?>_validate_bt"
2026
+ type="button"
2027
+ class="a3rev-ui-google-api-key-validate-button a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>-button"><?php echo __( 'Validate' ); ?></button>
2028
+ <p class="a3rev-ui-google-valid-key-message"><?php echo __( 'Your Google API Key is valid.' ); ?></p>
2029
+ <p class="a3rev-ui-google-unvalid-key-message"><?php echo __( 'Please enter a valid Google API Key.' ); ?></p>
2030
  </div>
2031
  </div>
2032
  </td>
admin/admin-ui.php CHANGED
@@ -33,7 +33,7 @@ class Admin_UI
33
  * You must change to correct plugin name that you are working
34
  */
35
 
36
- public $framework_version = '2.4.1';
37
  public $plugin_name = A3_LAZY_LOAD_KEY;
38
  public $plugin_path = A3_LAZY_LOAD_NAME;
39
  public $google_api_key_option = '';
@@ -132,40 +132,50 @@ class Admin_UI
132
  }
133
 
134
  if ( ! $google_map_api_key_status ) {
135
- $respone_api = wp_remote_get( "https://maps.googleapis.com/maps/api/geocode/json?address=Australia&key=" . trim( $this->google_map_api_key ),
136
- array(
137
- 'sslverify' => false,
138
- 'timeout' => 45
139
- )
140
- );
141
-
142
- $response_map = array();
143
-
144
- // Check it is a valid request
145
- if ( ! is_wp_error( $respone_api ) ) {
146
-
147
- $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body'];
148
- $response_map = json_decode( $json_string, true );
149
-
150
- // Make sure that the valid response from google is not an error message
151
- if ( ! isset( $response_map['error_message'] ) ) {
152
- $google_map_api_key_status = 'valid';
153
- } else {
154
- $google_map_api_key_status = 'invalid';
155
- }
156
-
157
- } else {
158
- $google_map_api_key_status = 'invalid';
159
- }
160
 
161
- //caching google map api status for 24 hours
162
- set_transient( $this->google_map_api_key_option . '_status', $google_map_api_key_status, 86400 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
- if ( 'valid' == $google_map_api_key_status ) {
166
- $is_valid = true;
 
 
167
  }
168
 
 
 
169
  }
170
 
171
  return $is_valid;
@@ -179,12 +189,9 @@ class Admin_UI
179
  update_option( $this->google_map_api_key_option . '_enable', 1 );
180
 
181
  $option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) );
 
182
 
183
- $old_google_map_api_key_option = get_option( $this->google_map_api_key_option );
184
-
185
- if ( 1 != $old_google_map_api_key_enable || $option_value != $old_google_map_api_key_option ) {
186
-
187
- update_option( $this->google_map_api_key_option, $option_value );
188
 
189
  // Clear cached of google map api key status
190
  delete_transient( $this->google_map_api_key_option . '_status' );
33
  * You must change to correct plugin name that you are working
34
  */
35
 
36
+ public $framework_version = '2.5.0';
37
  public $plugin_name = A3_LAZY_LOAD_KEY;
38
  public $plugin_path = A3_LAZY_LOAD_NAME;
39
  public $google_api_key_option = '';
132
  }
133
 
134
  if ( ! $google_map_api_key_status ) {
135
+ $is_valid = $this->validate_google_map_api_key( $this->google_map_api_key );
136
+ } elseif ( 'valid' == $google_map_api_key_status ) {
137
+ $is_valid = true;
138
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
+ }
141
+
142
+ return $is_valid;
143
+ }
144
+
145
+ public function validate_google_map_api_key( $g_key = '' ) {
146
+ $g_key = trim( $g_key );
147
+ $is_valid = false;
148
+
149
+ if ( ! empty( $g_key ) ) {
150
+ $respone_api = wp_remote_get( "https://maps.googleapis.com/maps/api/geocode/json?address=Australia&key=" . $g_key,
151
+ array(
152
+ 'sslverify' => false,
153
+ 'timeout' => 45
154
+ )
155
+ );
156
+
157
+ $response_map = array();
158
+
159
+ // Check it is a valid request
160
+ if ( ! is_wp_error( $respone_api ) ) {
161
+
162
+ $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body']; // @codingStandardsIgnoreLine // phpcs:ignore
163
+ $response_map = json_decode( $json_string, true );
164
+
165
+ // Make sure that the valid response from google is not an error message
166
+ if ( ! isset( $response_map['error_message'] ) ) {
167
+ $is_valid = true;
168
+ }
169
  }
170
 
171
+ if ( $is_valid ) {
172
+ $google_map_api_key_status = 'valid';
173
+ } else {
174
+ $google_map_api_key_status = 'invalid';
175
  }
176
 
177
+ //caching google map api status for 24 hours
178
+ set_transient( $this->google_map_api_key_option . '_status', $google_map_api_key_status, 86400 );
179
  }
180
 
181
  return $is_valid;
189
  update_option( $this->google_map_api_key_option . '_enable', 1 );
190
 
191
  $option_value = trim( sanitize_text_field( $_POST[ $this->google_map_api_key_option ] ) );
192
+ update_option( $this->google_map_api_key_option, $option_value );
193
 
194
+ if ( 1 != $old_google_map_api_key_enable ) {
 
 
 
 
195
 
196
  // Clear cached of google map api key status
197
  delete_transient( $this->google_map_api_key_option . '_status' );
admin/assets/css/admin-ui-style.css CHANGED
@@ -260,6 +260,16 @@
260
  .a3rev_panel_container .a3rev-ui-google-valid-key .a3rev-ui-google-valid-key-message,
261
  .a3rev_panel_container .a3rev-ui-google-unvalid-key .a3rev-ui-google-unvalid-key-message { display: block; }
262
 
 
 
 
 
 
 
 
 
 
 
263
  /* Manual Check New Version Control */
264
  .a3rev_panel_container .a3rev-ui-version-checking { display: none; margin-top: 6px; background-image: url('../images/loading-bottom.gif'); background-repeat: no-repeat; background-size: 100% auto; width: 16px; height: 16px; }
265
  .a3rev_panel_container .a3rev-ui-check-version-message { font-size: 13px; }
@@ -274,6 +284,7 @@
274
  margin-bottom: 6px;
275
  position: relative;
276
  }
 
277
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button,
278
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button {
279
  border-radius: 5px;
@@ -288,10 +299,12 @@
288
  box-sizing: border-box;
289
  margin-bottom: 5px;
290
  }
 
291
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button:hover,
292
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button:hover {
293
  background: #f4741b;
294
  }
 
295
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button.disabled,
296
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button.disabled {
297
  background: #999;
260
  .a3rev_panel_container .a3rev-ui-google-valid-key .a3rev-ui-google-valid-key-message,
261
  .a3rev_panel_container .a3rev-ui-google-unvalid-key .a3rev-ui-google-unvalid-key-message { display: block; }
262
 
263
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.validating,
264
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.validating:hover {
265
+ animation: progress-bar 1s infinite linear;
266
+ -ms-animation: progress-bar 1s infinite linear;
267
+ -moz-animation: progress-bar 1s infinite linear;
268
+ -webkit-animation: progress-bar 1s infinite linear;
269
+ background: rgba(0, 0, 0, 0) repeating-linear-gradient(-45deg, #0077ff, #0077ff 10px, #c3defd 10px, #c3defd 24px) repeat scroll 0 0 / 68px 68px;
270
+ transition: width 2s ease 0.1s;
271
+ }
272
+
273
  /* Manual Check New Version Control */
274
  .a3rev_panel_container .a3rev-ui-version-checking { display: none; margin-top: 6px; background-image: url('../images/loading-bottom.gif'); background-repeat: no-repeat; background-size: 100% auto; width: 16px; height: 16px; }
275
  .a3rev_panel_container .a3rev-ui-check-version-message { font-size: 13px; }
284
  margin-bottom: 6px;
285
  position: relative;
286
  }
287
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button,
288
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button,
289
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button {
290
  border-radius: 5px;
299
  box-sizing: border-box;
300
  margin-bottom: 5px;
301
  }
302
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button:hover,
303
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button:hover,
304
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button:hover {
305
  background: #f4741b;
306
  }
307
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.disabled,
308
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button.disabled,
309
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button.disabled {
310
  background: #999;
admin/assets/css/admin-ui-style.min.css CHANGED
@@ -105,6 +105,9 @@
105
  .a3rev_panel_container .a3rev-ui-google-valid-key .a3rev-ui-google-valid-key-message,
106
  .a3rev_panel_container .a3rev-ui-google-unvalid-key .a3rev-ui-google-unvalid-key-message{display:block;}
107
 
 
 
 
108
  /* Manual Check New Version Control */
109
  .a3rev_panel_container .a3rev-ui-version-checking{display:none;margin-top:6px;background-image:url('../images/loading-bottom.gif');background-repeat:no-repeat;background-size:100% auto;width:16px;height:16px;}
110
  .a3rev_panel_container .a3rev-ui-check-version-message{font-size:13px;}
@@ -116,10 +119,13 @@
116
  /* Ajax Submit Control */
117
  .a3rev_panel_container .a3rev-ui-ajax_submit-control,
118
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control{margin-bottom:6px;position:relative;}
 
119
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button,
120
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button{border-radius:5px;border:none;background:#2186fa;color:#fff;font-size:16px;padding:8px 15px;transition:all 0.5s ease 0.1s;cursor:pointer;height:40px;box-sizing:border-box;margin-bottom:5px;}
 
121
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button:hover,
122
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button:hover{background:#f4741b;}
 
123
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button.disabled,
124
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button.disabled{background:#999;cursor:default;}
125
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-successed,
105
  .a3rev_panel_container .a3rev-ui-google-valid-key .a3rev-ui-google-valid-key-message,
106
  .a3rev_panel_container .a3rev-ui-google-unvalid-key .a3rev-ui-google-unvalid-key-message{display:block;}
107
 
108
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.validating,
109
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.validating:hover{animation: progress-bar 1s infinite linear;-ms-animation: progress-bar 1s infinite linear;-moz-animation: progress-bar 1s infinite linear;-webkit-animation: progress-bar 1s infinite linear;background: rgba(0, 0, 0, 0) repeating-linear-gradient(-45deg, #0077ff, #0077ff 10px, #c3defd 10px, #c3defd 24px) repeat scroll 0 0 / 68px 68px;transition: width 2s ease 0.1s;}
110
+
111
  /* Manual Check New Version Control */
112
  .a3rev_panel_container .a3rev-ui-version-checking{display:none;margin-top:6px;background-image:url('../images/loading-bottom.gif');background-repeat:no-repeat;background-size:100% auto;width:16px;height:16px;}
113
  .a3rev_panel_container .a3rev-ui-check-version-message{font-size:13px;}
119
  /* Ajax Submit Control */
120
  .a3rev_panel_container .a3rev-ui-ajax_submit-control,
121
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control{margin-bottom:6px;position:relative;}
122
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button,
123
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button,
124
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button{border-radius:5px;border:none;background:#2186fa;color:#fff;font-size:16px;padding:8px 15px;transition:all 0.5s ease 0.1s;cursor:pointer;height:40px;box-sizing:border-box;margin-bottom:5px;}
125
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button:hover,
126
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button:hover,
127
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button:hover{background:#f4741b;}
128
+ .a3rev_panel_container .a3rev-ui-google-api-key-container .a3rev-ui-google-api-key-validate-button.disabled,
129
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-button.disabled,
130
  .a3rev_panel_container .a3rev-ui-ajax_multi_submit-control .a3rev-ui-ajax_multi_submit-button.disabled{background:#999;cursor:default;}
131
  .a3rev_panel_container .a3rev-ui-ajax_submit-control .a3rev-ui-ajax_submit-successed,
admin/assets/js/admin-ui-script.js CHANGED
@@ -350,6 +350,41 @@
350
  }
351
  });
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  /* Apply Ajax Submit */
354
  $(document).on( 'click', '.a3rev-ui-ajax_submit-button', function(){
355
  var bt_ajax_submit = $(this);
350
  }
351
  });
352
 
353
+ /* Apply Validate Google API Key Submit */
354
+ $(document).on( 'click', '.a3rev-ui-google-api-key-validate-button', function(){
355
+ var bt_validate = $(this);
356
+ var g_api_key_container = $(this).parents('.a3rev-ui-google-api-key-inside');
357
+ var g_api_key_field = g_api_key_container.children('.a3rev-ui-google-api-key');
358
+ var g_api_key = g_api_key_field.val();
359
+ var g_api_key_type = g_api_key_field.data('type');
360
+ if ( ! bt_validate.hasClass('validating') && '' != g_api_key ) {
361
+ bt_validate.addClass('validating');
362
+ g_api_key_container.removeClass('a3rev-ui-google-valid-key a3rev-ui-google-unvalid-key');
363
+
364
+ var check_data = {
365
+ action: a3_admin_ui_script_params.plugin + '_a3_admin_ui_event',
366
+ type: 'validate_google_api_key',
367
+ g_key: g_api_key,
368
+ g_key_type: g_api_key_type,
369
+ security: a3_admin_ui_script_params.security
370
+ };
371
+
372
+ $.post( a3_admin_ui_script_params.ajax_url, check_data, function(response){
373
+ bt_validate.removeClass('validating');
374
+
375
+ // Get response
376
+ data = JSON.parse( response );
377
+ if ( 0 == data.is_valid ) {
378
+ g_api_key_container.removeClass('a3rev-ui-google-valid-key');
379
+ g_api_key_container.addClass('a3rev-ui-google-unvalid-key');
380
+ } else {
381
+ g_api_key_container.addClass('a3rev-ui-google-valid-key');
382
+ g_api_key_container.removeClass('a3rev-ui-google-unvalid-key');
383
+ }
384
+ });
385
+ }
386
+ });
387
+
388
  /* Apply Ajax Submit */
389
  $(document).on( 'click', '.a3rev-ui-ajax_submit-button', function(){
390
  var bt_ajax_submit = $(this);
admin/includes/fonts_face.php CHANGED
@@ -419,6 +419,29 @@ class Fonts_Face extends Admin_UI
419
 
420
  }
421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  public function is_valid_google_api_key( $cache=true ) {
423
  $is_valid = false;
424
 
@@ -438,29 +461,18 @@ class Fonts_Face extends Admin_UI
438
  }
439
 
440
  if ( ! $google_api_key_status ) {
441
- $respone_api = wp_remote_get( "https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=" . trim( $this->google_api_key ),
442
- array(
443
- 'sslverify' => false,
444
- 'timeout' => 45
445
- )
446
- );
447
 
448
  $font_list = array();
449
- $response_fonts = array();
450
 
451
  // Check it is a valid request
452
- if ( ! is_wp_error( $respone_api ) ) {
453
-
454
- $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body'];
455
- $response_fonts = json_decode( $json_string, true );
456
-
457
  // Make sure that the valid response from google is not an error message
458
  if ( ! isset( $response_fonts['error'] ) ) {
459
  $google_api_key_status = 'valid';
460
  } else {
461
  $google_api_key_status = 'invalid';
462
  }
463
-
464
  } else {
465
  $google_api_key_status = 'invalid';
466
  }
@@ -470,7 +482,7 @@ class Fonts_Face extends Admin_UI
470
  $response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
471
  $webfonts = wp_remote_retrieve_body( $response );
472
  if ( ! empty( $webfonts ) ) {
473
- $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
474
  $response_fonts = json_decode( $json_string, true );
475
  }
476
  }
@@ -524,7 +536,7 @@ class Fonts_Face extends Admin_UI
524
  $response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
525
  $webfonts = wp_remote_retrieve_body( $response );
526
  if ( ! empty( $webfonts ) ) {
527
- $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts;
528
  $response_fonts = json_decode( $json_string, true );
529
  }
530
  }
419
 
420
  }
421
 
422
+ public function validate_google_api_key( $g_key = '' ) {
423
+ $g_key = trim( $g_key );
424
+ $response_fonts = array();
425
+
426
+ if ( ! empty( $g_key ) ) {
427
+ $respone_api = wp_remote_get( "https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=" . $g_key,
428
+ array(
429
+ 'sslverify' => false,
430
+ 'timeout' => 45
431
+ )
432
+ );
433
+
434
+ // Check it is a valid request
435
+ if ( ! is_wp_error( $respone_api ) ) {
436
+
437
+ $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $respone_api['body'] ) : $respone_api['body']; // @codingStandardsIgnoreLine // phpcs:ignore
438
+ $response_fonts = json_decode( $json_string, true );
439
+ }
440
+ }
441
+
442
+ return $response_fonts;
443
+ }
444
+
445
  public function is_valid_google_api_key( $cache=true ) {
446
  $is_valid = false;
447
 
461
  }
462
 
463
  if ( ! $google_api_key_status ) {
 
 
 
 
 
 
464
 
465
  $font_list = array();
466
+ $response_fonts = $this->validate_google_api_key( $this->google_api_key );
467
 
468
  // Check it is a valid request
469
+ if ( ! empty( $response_fonts ) ) {
 
 
 
 
470
  // Make sure that the valid response from google is not an error message
471
  if ( ! isset( $response_fonts['error'] ) ) {
472
  $google_api_key_status = 'valid';
473
  } else {
474
  $google_api_key_status = 'invalid';
475
  }
 
476
  } else {
477
  $google_api_key_status = 'invalid';
478
  }
482
  $response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
483
  $webfonts = wp_remote_retrieve_body( $response );
484
  if ( ! empty( $webfonts ) ) {
485
+ $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts; // @codingStandardsIgnoreLine // phpcs:ignore
486
  $response_fonts = json_decode( $json_string, true );
487
  }
488
  }
536
  $response = wp_remote_get( $this->admin_plugin_url() . '/assets/webfonts/webfonts.json', array( 'timeout' => 120 ) );
537
  $webfonts = wp_remote_retrieve_body( $response );
538
  if ( ! empty( $webfonts ) ) {
539
+ $json_string = version_compare( PHP_VERSION, '7.4', '>=' ) || get_magic_quotes_gpc() ? stripslashes( $webfonts ) : $webfonts; // @codingStandardsIgnoreLine // phpcs:ignore
540
  $response_fonts = json_decode( $json_string, true );
541
  }
542
  }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === a3 Lazy Load ===
2
  Contributors: a3rev, a3rev Software, nguyencongtuan
3
  Tags: a3 lazy load, Lazy Loading, image lazy load, lazyload
4
- Requires at least: 5.0
5
- Tested up to: 5.8
6
- Stable tag: 2.4.8
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -16,9 +16,9 @@ a3 Lazy Load is a Mobile Oriented, very simple to use plugin that will speed up
16
  a3 Lazy Load is inspired by and powered by the ressio [Lazy-Load-xt JavaScript](https://github.com/ressio/lazy-load-xt).
17
 
18
 
19
- = 100% COMPATABLE WITH WORDPRESS 5.7 =
20
 
21
- WordPress 5.5 introduced lazy loading for all images uploaded to a sites media library and 5.7 introduces Core lazy load for iframes. a3 Lazy Load Image options work side-by-side with these, but then enhances it by lazy loading all the images loaded from outside of the media library, or on older browsers that do not support the new WP attribute and any iframes or videos that are not lazy loaded by WordPress.
22
 
23
  = IMAGE LAZY LOAD =
24
 
@@ -136,9 +136,8 @@ Want to add a new language to a3 Lazy Load? Great! You can contribute via [trans
136
 
137
  = Minimum Requirements =
138
 
139
- * WordPress 5.0 or greater
140
- * PHP version 7.0.0 or greater
141
- * MySQL version 5.6 or greater OR MariaDB version 10.0 or greater
142
 
143
  == Frequently Asked Questions ==
144
 
@@ -199,6 +198,11 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
202
  = 2.4.8 - 2021/11/20 =
203
  * This maintenance release has check for compatibility with PHP 8.x
204
  * Tweak - Test for compatibility with PHP 8.x
@@ -587,6 +591,9 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
587
 
588
  == Upgrade Notice ==
589
 
 
 
 
590
  = 2.4.8 =
591
  * This maintenance release has check for compatibility with PHP 8.x
592
 
1
  === a3 Lazy Load ===
2
  Contributors: a3rev, a3rev Software, nguyencongtuan
3
  Tags: a3 lazy load, Lazy Loading, image lazy load, lazyload
4
+ Requires at least: 5.6
5
+ Tested up to: 5.9
6
+ Stable tag: 2.4.9
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
16
  a3 Lazy Load is inspired by and powered by the ressio [Lazy-Load-xt JavaScript](https://github.com/ressio/lazy-load-xt).
17
 
18
 
19
+ = 100% COMPATABLE WITH WORDPRESS 5.9 =
20
 
21
+ WordPress 5.5 introduced lazy loading for all images uploaded to a sites media library and 5.7 introduces Core lazy load for iframes and 5.9 contains performance enhancements. a3 Lazy Load Image options work side-by-side with these, but then enhances it by lazy loading all the images loaded from outside of the media library, or on older browsers that do not support the new WP attribute and any iframes or videos that are not lazy loaded by WordPress.
22
 
23
  = IMAGE LAZY LOAD =
24
 
136
 
137
  = Minimum Requirements =
138
 
139
+ * PHP version 7.4 or greater is recommended
140
+ * MySQL version 5.6 or greater is recommended
 
141
 
142
  == Frequently Asked Questions ==
143
 
198
 
199
  == Changelog ==
200
 
201
+ = 2.4.9 - 2022/01/21 =
202
+ * This is a maintenance release for compatibility with WordPress major version 5.9
203
+ * Tweak - Test for compatibility with WordPress 5.9
204
+ * Framework - Update a3rev Plugin Framework to version 2.5.0
205
+
206
  = 2.4.8 - 2021/11/20 =
207
  * This maintenance release has check for compatibility with PHP 8.x
208
  * Tweak - Test for compatibility with PHP 8.x
591
 
592
  == Upgrade Notice ==
593
 
594
+ = 2.4.9 =
595
+ This is a maintenance release for compatibility with WordPress major version 5.9
596
+
597
  = 2.4.8 =
598
  * This maintenance release has check for compatibility with PHP 8.x
599