a3 Lazy Load - Version 1.9.3

Version Description

  • This is a maintenance upgrade to fix a potentially fatal error conflict with sites running PHP 7.3 plus compatibility with WordPress 5.2.2
Download this release

Release Info

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

Code changes from version 1.9.2 to 1.9.3

a3-lazy-load.php CHANGED
@@ -2,15 +2,15 @@
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: 1.9.2
6
  Author: a3rev Software
7
  Author URI: https://a3rev.com/
8
  Requires at least: 4.0
9
- Tested up to: 5.0.2
10
  Text Domain: a3-lazy-load
11
  Domain Path: /languages
12
  WC requires at least: 2.0.0
13
- WC tested up to: 3.5.3
14
  License: GPLv2 or later
15
  Copyright © 2011 a3 Revolution Software Development team
16
  a3 Revolution Software Development team
@@ -32,7 +32,7 @@ define('A3_LAZY_LOAD_CSS_URL', A3_LAZY_LOAD_URL . '/assets/css');
32
  define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
33
 
34
  define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
35
- define( 'A3_LAZY_VERSION', '1.9.2' );
36
  define( 'A3_LAZY_LOAD_G_FONTS', false );
37
 
38
  /**
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: 1.9.3
6
  Author: a3rev Software
7
  Author URI: https://a3rev.com/
8
  Requires at least: 4.0
9
+ Tested up to: 5.2.2
10
  Text Domain: a3-lazy-load
11
  Domain Path: /languages
12
  WC requires at least: 2.0.0
13
+ WC tested up to: 3.6.4
14
  License: GPLv2 or later
15
  Copyright © 2011 a3 Revolution Software Development team
16
  a3 Revolution Software Development team
32
  define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
33
 
34
  define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
35
+ define( 'A3_LAZY_VERSION', '1.9.3' );
36
  define( 'A3_LAZY_LOAD_G_FONTS', false );
37
 
38
  /**
admin/admin-interface.php CHANGED
@@ -350,45 +350,21 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
350
  if ( in_array( $value['type'], array( 'row', 'column', 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue;
351
  if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue;
352
  if ( ! isset( $value['default'] ) ) $value['default'] = '';
353
-
354
- switch ( $value['type'] ) {
355
-
356
  // Array textfields
357
- case 'array_textfields' :
358
- if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break;
359
-
360
- foreach ( $value['ids'] as $text_field ) {
361
- if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
362
- if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
363
-
364
- // Do not include when it's separate option
365
- if ( isset( $text_field['separate_option'] ) && $text_field['separate_option'] != false ) continue;
366
-
367
- // Remove [, ] characters from id argument
368
- if ( strstr( $text_field['id'], '[' ) ) {
369
- parse_str( esc_attr( $text_field['id'] ), $option_array );
370
 
371
- // Option name is first key
372
- $option_keys = array_keys( $option_array );
373
- $first_key = current( $option_keys );
374
-
375
- $id_attribute = $first_key;
376
- } else {
377
- $id_attribute = esc_attr( $text_field['id'] );
378
- }
379
-
380
- $default_settings[$id_attribute] = $text_field['default'];
381
- }
382
 
383
- break;
384
-
385
- default :
386
  // Do not include when it's separate option
387
- if ( isset( $value['separate_option'] ) && $value['separate_option'] != false ) break;
388
 
389
  // Remove [, ] characters from id argument
390
- if ( strstr( $value['id'], '[' ) ) {
391
- parse_str( esc_attr( $value['id'] ), $option_array );
392
 
393
  // Option name is first key
394
  $option_keys = array_keys( $option_array );
@@ -396,17 +372,34 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
396
 
397
  $id_attribute = $first_key;
398
  } else {
399
- $id_attribute = esc_attr( $value['id'] );
400
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
 
402
- // Backward compatibility to old settings don't have line_height option for typography
403
- if ( 'typography' == $value['type'] && ! isset( $value['default']['line_height'] ) ) {
404
- $value['default']['line_height'] = '1.4em';
405
- }
406
 
407
- $default_settings[$id_attribute] = $value['default'];
408
-
409
- break;
410
  }
411
  }
412
 
@@ -617,136 +610,67 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
617
 
618
  // Get the option name
619
  $option_value = null;
620
-
621
- switch ( $value['type'] ) {
622
-
623
- // Checkbox type
624
- case 'checkbox' :
625
- case 'onoff_checkbox' :
626
- case 'switcher_checkbox' :
627
 
628
- if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1;
629
- if ( ! isset( $value['unchecked_value'] ) ) $value['unchecked_value'] = 0;
630
-
631
- if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
632
- if ( $key != false ) {
633
- if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
634
- $option_value = $value['checked_value'];
635
- } else {
636
- $option_value = $value['unchecked_value'];
637
- }
638
  } else {
639
- if ( isset( $_POST[ $id_attribute ] ) ) {
640
- $option_value = $value['checked_value'];
641
- } else {
642
- $option_value = $value['unchecked_value'];
643
- }
644
- }
645
-
646
  } else {
647
- if ( $key != false ) {
648
- if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) {
649
- $option_value = $value['checked_value'];
650
- } else {
651
- $option_value = $value['unchecked_value'];
652
- }
653
  } else {
654
- if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) {
655
- $option_value = $value['checked_value'];
656
- } else {
657
- $option_value = $value['unchecked_value'];
658
- }
659
  }
660
  }
661
-
662
- break;
663
-
664
- // Array textfields
665
- case 'array_textfields' :
666
- if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break;
667
-
668
- foreach ( $value['ids'] as $text_field ) {
669
- if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
670
- if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
671
 
672
- // Remove [, ] characters from id argument
673
- $key = false;
674
- if ( strstr( $text_field['id'], '[' ) ) {
675
- parse_str( esc_attr( $text_field['id'] ), $option_array );
676
-
677
- // Option name is first key
678
- $option_keys = array_keys( $option_array );
679
- $first_key = current( $option_keys );
680
-
681
- $id_attribute = $first_key;
682
-
683
- $key = key( $option_array[ $id_attribute ] );
684
  } else {
685
- $id_attribute = esc_attr( $text_field['id'] );
686
- }
687
-
688
- // Get the option name
689
- $option_value = null;
690
-
691
- if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
692
- if ( $key != false ) {
693
- if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
694
- $option_value = $_POST[ $id_attribute ][ $key ];
695
- } else {
696
- $option_value = '';
697
- }
698
- } else {
699
- if ( isset( $_POST[ $id_attribute ] ) ) {
700
- $option_value = $_POST[ $id_attribute ];
701
- } else {
702
- $option_value = '';
703
- }
704
- }
705
-
706
  } else {
707
- if ( $key != false ) {
708
- if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) {
709
- $option_value = $_POST[ $option_name ][ $id_attribute ][ $key ];
710
- } else {
711
- $option_value = '';
712
- }
713
- } else {
714
- if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) {
715
- $option_value = $_POST[ $option_name ][ $id_attribute ];
716
- } else {
717
- $option_value = '';
718
- }
719
- }
720
  }
721
-
722
- // Set Default value if this field is required and has default value and option value is empty
723
- if ( isset ( $text_field['required'] ) && $text_field['required'] && empty( $option_value ) && ! empty( $text_field['default'] ) ) {
724
- $option_value = $text_field['default'];
725
- }
726
-
727
- if ( strstr( $text_field['id'], '[' ) ) {
728
- // Set keys and value
729
- $key = key( $option_array[ $id_attribute ] );
 
 
 
 
730
 
731
- $update_options[ $id_attribute ][ $key ] = $option_value;
732
-
733
- if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
734
- $update_separate_options[ $id_attribute ][ $key ] = $option_value;
735
- }
736
-
737
- } else {
738
- $update_options[ $id_attribute ] = $option_value;
739
 
740
- if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
741
- $update_separate_options[ $id_attribute ] = $option_value;
742
- }
743
- }
 
744
  }
745
 
746
- break;
747
-
748
- // Other types
749
- default :
750
  if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
751
  if ( $key != false ) {
752
  if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
@@ -778,56 +702,108 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
778
  }
779
  }
780
 
781
- // Just for Color type
782
- if ( 'color' == $value['type'] && '' == trim( $option_value ) ) {
783
- $option_value = 'transparent';
784
  }
785
- // Just for Background Color type
786
- elseif ( 'bg_color' == $value['type'] && '' == trim( $option_value['color'] ) ) {
787
- $option_value['color'] = 'transparent';
788
- } elseif ( 'upload' == $value['type'] ) {
789
- // Uploader: Set key and value for attachment id of upload type
790
- if ( strstr( $value['id'], '[' ) ) {
791
- $key = key( $option_array[ $id_attribute ] );
792
-
793
- if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
794
- if ( isset( $_POST[ $id_attribute ][ $key . '_attachment_id' ] ) ) {
795
- $attachment_id = $_POST[ $id_attribute ][ $key . '_attachment_id' ];
796
- } else {
797
- $attachment_id = 0;
798
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
 
800
- $update_separate_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
801
  } else {
802
- if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ] ) ) {
803
- $attachment_id = $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ];
804
- } else {
805
- $attachment_id = 0;
806
- }
807
 
808
- $update_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id;
 
 
 
 
 
809
  }
 
 
 
 
 
 
 
 
 
 
 
810
  } else {
811
- if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
812
- if ( isset( $_POST[ $id_attribute . '_attachment_id' ] ) ) {
813
- $attachment_id = $_POST[ $id_attribute . '_attachment_id' ];
814
- } else {
815
- $attachment_id = 0;
816
- }
817
- $update_separate_options[ $id_attribute . '_attachment_id' ] = $attachment_id;
818
  } else {
819
- if ( isset( $_POST[ $option_name ][ $id_attribute . '_attachment_id' ] ) ) {
820
- $attachment_id = $_POST[ $option_name ][ $id_attribute . '_attachment_id' ];
821
- } else {
822
- $attachment_id = 0;
823
- }
824
- $update_options[ $id_attribute . '_attachment_id' ] = $attachment_id;
825
  }
 
826
  }
827
  }
828
-
829
- break;
830
-
831
  }
832
 
833
  if ( !in_array( $value['type'], array( 'array_textfields' ) ) ) {
@@ -907,12 +883,10 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
907
  if ( ! isset( $value['type'] ) ) continue;
908
  if ( in_array( $value['type'], array( 'row', 'column', 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue;
909
  if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue;
910
-
911
- switch ( $value['type'] ) {
912
-
913
  // Array textfields
914
- case 'array_textfields' :
915
- if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break;
916
 
917
  foreach ( $value['ids'] as $text_field ) {
918
  if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
@@ -925,15 +899,10 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
925
  }
926
  if ( $text_field['free_version'] ) unset( $default_settings[ $text_field['id']] );
927
  }
928
-
929
- break;
930
-
931
- default :
932
- if ( ! isset( $value['default'] ) ) $value['default'] = '';
933
- if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false;
934
- if ( $value['free_version'] ) unset( $default_settings[ $value['id']] );
935
-
936
- break;
937
  }
938
  }
939
 
@@ -956,86 +925,25 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
956
 
957
  // For way it has an option name
958
  if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false;
959
-
960
- switch ( $value['type'] ) {
961
-
962
  // Array textfields
963
- case 'array_textfields' :
964
- if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break;
965
-
966
- foreach ( $value['ids'] as $text_field ) {
967
- if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
968
- if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
969
- if ( ! isset( $text_field['free_version'] ) ) {
970
- if ( ! isset( $value['free_version'] ) )
971
- $text_field['free_version'] = false;
972
- else
973
- $text_field['free_version'] = $value['free_version'];
974
- }
975
-
976
- // Remove [, ] characters from id argument
977
- $key = false;
978
- if ( strstr( $text_field['id'], '[' ) ) {
979
- parse_str( esc_attr( $text_field['id'] ), $option_array );
980
-
981
- // Option name is first key
982
- $option_keys = array_keys( $option_array );
983
- $first_key = current( $option_keys );
984
 
985
- $id_attribute = $first_key;
986
-
987
- $key = key( $option_array[ $id_attribute ] );
988
- } else {
989
- $id_attribute = esc_attr( $text_field['id'] );
990
- }
991
-
992
- if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
993
- if ( $reset && $text_field['free_version'] && !$free_version ) {
994
- if ( $key != false ) {
995
- $current_settings = get_option( $id_attribute, array() );
996
- if ( ! is_array( $current_settings) ) {
997
- $current_settings = array();
998
- }
999
- $current_settings[$key] = $text_field['default'];
1000
- update_option( $id_attribute, $current_settings );
1001
- } else {
1002
- update_option( $id_attribute, $text_field['default'] );
1003
- }
1004
- } elseif ( $reset && !$text_field['free_version'] ) {
1005
- if ( $key != false ) {
1006
- $current_settings = get_option( $id_attribute, array() );
1007
- if ( ! is_array( $current_settings) ) {
1008
- $current_settings = array();
1009
- }
1010
- $current_settings[$key] = $text_field['default'];
1011
- update_option( $id_attribute, $current_settings );
1012
- } else {
1013
- update_option( $id_attribute, $text_field['default'] );
1014
- }
1015
- } else {
1016
- if ( $key != false ) {
1017
- $current_settings = get_option( $id_attribute, array() );
1018
- if ( ! is_array( $current_settings) ) {
1019
- $current_settings = array();
1020
- }
1021
- if ( ! isset( $current_settings[$key] ) ) {
1022
- $current_settings[$key] = $text_field['default'];
1023
- update_option( $id_attribute, $current_settings );
1024
- }
1025
- } else {
1026
- add_option( $id_attribute, $text_field['default'] );
1027
- }
1028
- }
1029
- }
1030
  }
1031
-
1032
- break;
1033
-
1034
- default :
1035
  // Remove [, ] characters from id argument
1036
  $key = false;
1037
- if ( strstr( $value['id'], '[' ) ) {
1038
- parse_str( esc_attr( $value['id'] ), $option_array );
1039
 
1040
  // Option name is first key
1041
  $option_keys = array_keys( $option_array );
@@ -1045,49 +953,103 @@ class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
1045
 
1046
  $key = key( $option_array[ $id_attribute ] );
1047
  } else {
1048
- $id_attribute = esc_attr( $value['id'] );
1049
  }
1050
 
1051
  if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
1052
- if ( $reset && $value['free_version'] && !$free_version ) {
1053
  if ( $key != false ) {
1054
  $current_settings = get_option( $id_attribute, array() );
1055
  if ( ! is_array( $current_settings) ) {
1056
  $current_settings = array();
1057
  }
1058
- $current_settings[$key] = $value['default'];
1059
  update_option( $id_attribute, $current_settings );
1060
  } else {
1061
- update_option( $id_attribute, $value['default'] );
1062
  }
1063
- } elseif ( $reset && !$value['free_version'] ) {
1064
  if ( $key != false ) {
1065
  $current_settings = get_option( $id_attribute, array() );
1066
  if ( ! is_array( $current_settings) ) {
1067
  $current_settings = array();
1068
  }
1069
- $current_settings[$key] = $value['default'];
1070
  update_option( $id_attribute, $current_settings );
1071
  } else {
1072
- update_option( $id_attribute, $value['default'] );
1073
  }
1074
  } else {
1075
  if ( $key != false ) {
1076
- $current_settings = get_option( $id_attribute, array() );
1077
- if ( ! is_array( $current_settings) ) {
1078
- $current_settings = array();
1079
- }
1080
- if ( ! isset( $current_settings[$key] ) ) {
1081
- $current_settings[$key] = $value['default'];
1082
- update_option( $id_attribute, $current_settings );
1083
- }
1084
  } else {
1085
- add_option( $id_attribute, $value['default'] );
1086
  }
1087
  }
1088
  }
1089
-
1090
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1091
  }
1092
 
1093
  }
350
  if ( in_array( $value['type'], array( 'row', 'column', 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue;
351
  if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue;
352
  if ( ! isset( $value['default'] ) ) $value['default'] = '';
353
+
354
+ if ( 'array_textfields' === $value['type'] ) {
 
355
  // Array textfields
356
+ if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
357
 
358
+ foreach ( $value['ids'] as $text_field ) {
359
+ if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
360
+ if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
 
 
 
 
 
 
 
 
361
 
 
 
 
362
  // Do not include when it's separate option
363
+ if ( isset( $text_field['separate_option'] ) && $text_field['separate_option'] != false ) continue;
364
 
365
  // Remove [, ] characters from id argument
366
+ if ( strstr( $text_field['id'], '[' ) ) {
367
+ parse_str( esc_attr( $text_field['id'] ), $option_array );
368
 
369
  // Option name is first key
370
  $option_keys = array_keys( $option_array );
372
 
373
  $id_attribute = $first_key;
374
  } else {
375
+ $id_attribute = esc_attr( $text_field['id'] );
376
  }
377
+
378
+ $default_settings[$id_attribute] = $text_field['default'];
379
+ }
380
+ } else {
381
+ // Do not include when it's separate option
382
+ if ( isset( $value['separate_option'] ) && $value['separate_option'] != false ) continue;
383
+
384
+ // Remove [, ] characters from id argument
385
+ if ( strstr( $value['id'], '[' ) ) {
386
+ parse_str( esc_attr( $value['id'] ), $option_array );
387
+
388
+ // Option name is first key
389
+ $option_keys = array_keys( $option_array );
390
+ $first_key = current( $option_keys );
391
+
392
+ $id_attribute = $first_key;
393
+ } else {
394
+ $id_attribute = esc_attr( $value['id'] );
395
+ }
396
 
397
+ // Backward compatibility to old settings don't have line_height option for typography
398
+ if ( 'typography' == $value['type'] && ! isset( $value['default']['line_height'] ) ) {
399
+ $value['default']['line_height'] = '1.4em';
400
+ }
401
 
402
+ $default_settings[$id_attribute] = $value['default'];
 
 
403
  }
404
  }
405
 
610
 
611
  // Get the option name
612
  $option_value = null;
613
+
614
+ if ( in_array( $value['type'], array( 'checkbox', 'onoff_checkbox', 'switcher_checkbox' ) ) ) {
615
+ if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1;
616
+ if ( ! isset( $value['unchecked_value'] ) ) $value['unchecked_value'] = 0;
 
 
 
617
 
618
+ if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
619
+ if ( $key != false ) {
620
+ if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
621
+ $option_value = $value['checked_value'];
 
 
 
 
 
 
622
  } else {
623
+ $option_value = $value['unchecked_value'];
624
+ }
 
 
 
 
 
625
  } else {
626
+ if ( isset( $_POST[ $id_attribute ] ) ) {
627
+ $option_value = $value['checked_value'];
 
 
 
 
628
  } else {
629
+ $option_value = $value['unchecked_value'];
 
 
 
 
630
  }
631
  }
 
 
 
 
 
 
 
 
 
 
632
 
633
+ } else {
634
+ if ( $key != false ) {
635
+ if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) {
636
+ $option_value = $value['checked_value'];
 
 
 
 
 
 
 
 
637
  } else {
638
+ $option_value = $value['unchecked_value'];
639
+ }
640
+ } else {
641
+ if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) {
642
+ $option_value = $value['checked_value'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  } else {
644
+ $option_value = $value['unchecked_value'];
 
 
 
 
 
 
 
 
 
 
 
 
645
  }
646
+ }
647
+ }
648
+ } elseif ( 'array_textfields' === $value['type'] ) {
649
+ if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) continue;
650
+
651
+ foreach ( $value['ids'] as $text_field ) {
652
+ if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
653
+ if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
654
+
655
+ // Remove [, ] characters from id argument
656
+ $key = false;
657
+ if ( strstr( $text_field['id'], '[' ) ) {
658
+ parse_str( esc_attr( $text_field['id'] ), $option_array );
659
 
660
+ // Option name is first key
661
+ $option_keys = array_keys( $option_array );
662
+ $first_key = current( $option_keys );
 
 
 
 
 
663
 
664
+ $id_attribute = $first_key;
665
+
666
+ $key = key( $option_array[ $id_attribute ] );
667
+ } else {
668
+ $id_attribute = esc_attr( $text_field['id'] );
669
  }
670
 
671
+ // Get the option name
672
+ $option_value = null;
673
+
 
674
  if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
675
  if ( $key != false ) {
676
  if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
702
  }
703
  }
704
 
705
+ // Set Default value if this field is required and has default value and option value is empty
706
+ if ( isset ( $text_field['required'] ) && $text_field['required'] && empty( $option_value ) && ! empty( $text_field['default'] ) ) {
707
+ $option_value = $text_field['default'];
708
  }
709
+
710
+ if ( strstr( $text_field['id'], '[' ) ) {
711
+ // Set keys and value
712
+ $key = key( $option_array[ $id_attribute ] );
713
+
714
+ $update_options[ $id_attribute ][ $key ] = $option_value;
715
+
716
+ if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
717
+ $update_separate_options[ $id_attribute ][ $key ] = $option_value;
718
+ }
719
+
720
+ } else {
721
+ $update_options[ $id_attribute ] = $option_value;
722
+
723
+ if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
724
+ $update_separate_options[ $id_attribute ] = $option_value;
725
+ }
726
+ }
727
+ }
728
+ } else {
729
+ if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
730
+ if ( $key != false ) {
731
+ if ( isset( $_POST[ $id_attribute ][ $key ] ) ) {
732
+ $option_value = $_POST[ $id_attribute ][ $key ];
733
+ } else {
734
+ $option_value = '';
735
+ }
736
+ } else {
737
+ if ( isset( $_POST[ $id_attribute ] ) ) {
738
+ $option_value = $_POST[ $id_attribute ];
739
+ } else {
740
+ $option_value = '';
741
+ }
742
+ }
743
+
744
+ } else {
745
+ if ( $key != false ) {
746
+ if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) {
747
+ $option_value = $_POST[ $option_name ][ $id_attribute ][ $key ];
748
+ } else {
749
+ $option_value = '';
750
+ }
751
+ } else {
752
+ if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) {
753
+ $option_value = $_POST[ $option_name ][ $id_attribute ];
754
+ } else {
755
+ $option_value = '';
756
+ }
757
+ }
758
+ }
759
 
760
+ // Just for Color type
761
+ if ( 'color' == $value['type'] && '' == trim( $option_value ) ) {
762
+ $option_value = 'transparent';
763
+ }
764
+ // Just for Background Color type
765
+ elseif ( 'bg_color' == $value['type'] && '' == trim( $option_value['color'] ) ) {
766
+ $option_value['color'] = 'transparent';
767
+ } elseif ( 'upload' == $value['type'] ) {
768
+ // Uploader: Set key and value for attachment id of upload type
769
+ if ( strstr( $value['id'], '[' ) ) {
770
+ $key = key( $option_array[ $id_attribute ] );
771
+
772
+ if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
773
+ if ( isset( $_POST[ $id_attribute ][ $key . '_attachment_id' ] ) ) {
774
+ $attachment_id = $_POST[ $id_attribute ][ $key . '_attachment_id' ];
775
  } else {
776
+ $attachment_id = 0;
777
+ }
 
 
 
778
 
779
+ $update_separate_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id;
780
+ } else {
781
+ if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ] ) ) {
782
+ $attachment_id = $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ];
783
+ } else {
784
+ $attachment_id = 0;
785
  }
786
+
787
+ $update_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id;
788
+ }
789
+ } else {
790
+ if ( trim( $option_name ) != '' && $value['separate_option'] != false ) {
791
+ if ( isset( $_POST[ $id_attribute . '_attachment_id' ] ) ) {
792
+ $attachment_id = $_POST[ $id_attribute . '_attachment_id' ];
793
+ } else {
794
+ $attachment_id = 0;
795
+ }
796
+ $update_separate_options[ $id_attribute . '_attachment_id' ] = $attachment_id;
797
  } else {
798
+ if ( isset( $_POST[ $option_name ][ $id_attribute . '_attachment_id' ] ) ) {
799
+ $attachment_id = $_POST[ $option_name ][ $id_attribute . '_attachment_id' ];
 
 
 
 
 
800
  } else {
801
+ $attachment_id = 0;
 
 
 
 
 
802
  }
803
+ $update_options[ $id_attribute . '_attachment_id' ] = $attachment_id;
804
  }
805
  }
806
+ }
 
 
807
  }
808
 
809
  if ( !in_array( $value['type'], array( 'array_textfields' ) ) ) {
883
  if ( ! isset( $value['type'] ) ) continue;
884
  if ( in_array( $value['type'], array( 'row', 'column', 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue;
885
  if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue;
886
+
887
+ if ( 'array_textfields' === $value['type'] ) {
 
888
  // Array textfields
889
+ if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) continue;
 
890
 
891
  foreach ( $value['ids'] as $text_field ) {
892
  if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
899
  }
900
  if ( $text_field['free_version'] ) unset( $default_settings[ $text_field['id']] );
901
  }
902
+ } else {
903
+ if ( ! isset( $value['default'] ) ) $value['default'] = '';
904
+ if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false;
905
+ if ( $value['free_version'] ) unset( $default_settings[ $value['id']] );
 
 
 
 
 
906
  }
907
  }
908
 
925
 
926
  // For way it has an option name
927
  if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false;
928
+
929
+ if ( 'array_textfields' === $value['type'] ) {
 
930
  // Array textfields
931
+ if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
932
 
933
+ foreach ( $value['ids'] as $text_field ) {
934
+ if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue;
935
+ if ( ! isset( $text_field['default'] ) ) $text_field['default'] = '';
936
+ if ( ! isset( $text_field['free_version'] ) ) {
937
+ if ( ! isset( $value['free_version'] ) )
938
+ $text_field['free_version'] = false;
939
+ else
940
+ $text_field['free_version'] = $value['free_version'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
941
  }
942
+
 
 
 
943
  // Remove [, ] characters from id argument
944
  $key = false;
945
+ if ( strstr( $text_field['id'], '[' ) ) {
946
+ parse_str( esc_attr( $text_field['id'] ), $option_array );
947
 
948
  // Option name is first key
949
  $option_keys = array_keys( $option_array );
953
 
954
  $key = key( $option_array[ $id_attribute ] );
955
  } else {
956
+ $id_attribute = esc_attr( $text_field['id'] );
957
  }
958
 
959
  if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
960
+ if ( $reset && $text_field['free_version'] && !$free_version ) {
961
  if ( $key != false ) {
962
  $current_settings = get_option( $id_attribute, array() );
963
  if ( ! is_array( $current_settings) ) {
964
  $current_settings = array();
965
  }
966
+ $current_settings[$key] = $text_field['default'];
967
  update_option( $id_attribute, $current_settings );
968
  } else {
969
+ update_option( $id_attribute, $text_field['default'] );
970
  }
971
+ } elseif ( $reset && !$text_field['free_version'] ) {
972
  if ( $key != false ) {
973
  $current_settings = get_option( $id_attribute, array() );
974
  if ( ! is_array( $current_settings) ) {
975
  $current_settings = array();
976
  }
977
+ $current_settings[$key] = $text_field['default'];
978
  update_option( $id_attribute, $current_settings );
979
  } else {
980
+ update_option( $id_attribute, $text_field['default'] );
981
  }
982
  } else {
983
  if ( $key != false ) {
984
+ $current_settings = get_option( $id_attribute, array() );
985
+ if ( ! is_array( $current_settings) ) {
986
+ $current_settings = array();
987
+ }
988
+ if ( ! isset( $current_settings[$key] ) ) {
989
+ $current_settings[$key] = $text_field['default'];
990
+ update_option( $id_attribute, $current_settings );
991
+ }
992
  } else {
993
+ add_option( $id_attribute, $text_field['default'] );
994
  }
995
  }
996
  }
997
+ }
998
+ } else {
999
+ // Remove [, ] characters from id argument
1000
+ $key = false;
1001
+ if ( strstr( $value['id'], '[' ) ) {
1002
+ parse_str( esc_attr( $value['id'] ), $option_array );
1003
+
1004
+ // Option name is first key
1005
+ $option_keys = array_keys( $option_array );
1006
+ $first_key = current( $option_keys );
1007
+
1008
+ $id_attribute = $first_key;
1009
+
1010
+ $key = key( $option_array[ $id_attribute ] );
1011
+ } else {
1012
+ $id_attribute = esc_attr( $value['id'] );
1013
+ }
1014
+
1015
+ if ( trim( $option_name ) == '' || $value['separate_option'] != false ) {
1016
+ if ( $reset && $value['free_version'] && !$free_version ) {
1017
+ if ( $key != false ) {
1018
+ $current_settings = get_option( $id_attribute, array() );
1019
+ if ( ! is_array( $current_settings) ) {
1020
+ $current_settings = array();
1021
+ }
1022
+ $current_settings[$key] = $value['default'];
1023
+ update_option( $id_attribute, $current_settings );
1024
+ } else {
1025
+ update_option( $id_attribute, $value['default'] );
1026
+ }
1027
+ } elseif ( $reset && !$value['free_version'] ) {
1028
+ if ( $key != false ) {
1029
+ $current_settings = get_option( $id_attribute, array() );
1030
+ if ( ! is_array( $current_settings) ) {
1031
+ $current_settings = array();
1032
+ }
1033
+ $current_settings[$key] = $value['default'];
1034
+ update_option( $id_attribute, $current_settings );
1035
+ } else {
1036
+ update_option( $id_attribute, $value['default'] );
1037
+ }
1038
+ } else {
1039
+ if ( $key != false ) {
1040
+ $current_settings = get_option( $id_attribute, array() );
1041
+ if ( ! is_array( $current_settings) ) {
1042
+ $current_settings = array();
1043
+ }
1044
+ if ( ! isset( $current_settings[$key] ) ) {
1045
+ $current_settings[$key] = $value['default'];
1046
+ update_option( $id_attribute, $current_settings );
1047
+ }
1048
+ } else {
1049
+ add_option( $id_attribute, $value['default'] );
1050
+ }
1051
+ }
1052
+ }
1053
  }
1054
 
1055
  }
admin/includes/uploader/class-uploader.php CHANGED
@@ -37,7 +37,7 @@ class A3_Lazy_Load_Uploader extends A3_Lazy_Load_Admin_UI
37
  if ( is_admin() ) {
38
 
39
  // include scripts to Admin UI Interface
40
- add_action( $this->plugin_name . '_init_scripts', array( $this, 'uploader_js' ) );
41
 
42
  // include styles to Admin UI Interface
43
  add_action( $this->plugin_name . '_init_styles', array( $this, 'uploader_style' ) );
@@ -53,6 +53,10 @@ class A3_Lazy_Load_Uploader extends A3_Lazy_Load_Admin_UI
53
  return $this->admin_uploader_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
54
  }
55
 
 
 
 
 
56
  /*-----------------------------------------------------------------------------------*/
57
  /* Include Uploader Script */
58
  /*-----------------------------------------------------------------------------------*/
37
  if ( is_admin() ) {
38
 
39
  // include scripts to Admin UI Interface
40
+ add_action( $this->plugin_name . '_init_scripts', array( $this, 'uploader_script' ) );
41
 
42
  // include styles to Admin UI Interface
43
  add_action( $this->plugin_name . '_init_styles', array( $this, 'uploader_style' ) );
53
  return $this->admin_uploader_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
54
  }
55
 
56
+ public function uploader_script() {
57
+ add_action( 'admin_enqueue_scripts', array( $this, 'uploader_js' ) );
58
+ }
59
+
60
  /*-----------------------------------------------------------------------------------*/
61
  /* Include Uploader Script */
62
  /*-----------------------------------------------------------------------------------*/
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: a3rev, a3rev Software, nguyencongtuan
3
  Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
4
  Requires at least: 4.5
5
- Tested up to: 5.0.2
6
- Stable tag: 1.9.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -194,6 +194,10 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
194
 
195
  == Changelog ==
196
 
 
 
 
 
197
  = 1.9.2 - 2019/01/02 =
198
  * This maintenance update is for compatibility with WordPress 5.0.2 and PHP 7.3. It also includes performance updates to the plugin framework.
199
  * Tweak - Test for compatibility with WordPress 5.0.2 and WordPress 4.9.9
@@ -418,6 +422,9 @@ Filter tags to add to class name of theme to exclude lazy load on images or vide
418
 
419
  == Upgrade Notice ==
420
 
 
 
 
421
  = 1.9.2 =
422
  This maintenance update is for compatibility with WordPress 5.0.2 and PHP 7.3. It also includes performance updates to the plugin framework.
423
 
2
  Contributors: a3rev, a3rev Software, nguyencongtuan
3
  Tags: a3 lazy load, Lazy Loading , image lazy load, lazyload
4
  Requires at least: 4.5
5
+ Tested up to: 5.2.2
6
+ Stable tag: 1.9.3
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
194
 
195
  == Changelog ==
196
 
197
+ = 1.9.3 - 2019/06/29 =
198
+ * This is a maintenance upgrade to fix a potentially fatal error conflict with sites running PHP 7.3 plus compatibility with WordPress 5.2.2
199
+ * Fix - PHP warning continue targeting switch is equivalent to break for compatibility on PHP 7.3
200
+
201
  = 1.9.2 - 2019/01/02 =
202
  * This maintenance update is for compatibility with WordPress 5.0.2 and PHP 7.3. It also includes performance updates to the plugin framework.
203
  * Tweak - Test for compatibility with WordPress 5.0.2 and WordPress 4.9.9
422
 
423
  == Upgrade Notice ==
424
 
425
+ = 1.9.3 =
426
+ * This is a maintenance upgrade to fix a potentially fatal error conflict with sites running PHP 7.3 plus compatibility with WordPress 5.2.2
427
+
428
  = 1.9.2 =
429
  This maintenance update is for compatibility with WordPress 5.0.2 and PHP 7.3. It also includes performance updates to the plugin framework.
430