Advanced Ads - Version 1.20.0

Version Description

  • integrate with TCF 2.0 compatible consent management platforms, e.g., Quantcast Choices
  • improve timezone methods Advanced_Ads_Utils::get_wp_timezone() and Advanced_Ads_Utils::get_timezone_name()
  • Divi theme: made content injection work with the "Unlimited ad injection" setting disabled
  • added missing spaces to image ad tags to fix Cache-Busting issue
  • made ad centering work when right and left margin are set
  • add ad health check if __tcfapi responds but the privacy module is either not enabled or not set to TCF 2.0
Download this release

Release Info

Developer advancedads
Plugin Icon 128x128 Advanced Ads
Version 1.20.0
Comparing to
See all releases

Code changes from version 1.20.0-rc.2 to 1.20.0

advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.20.0-rc.2
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.20.0-rc.2' );
43
 
44
  // Autoloading, modules and functions.
45
 
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.20.0
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.20.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/ad-ajax.php CHANGED
@@ -220,7 +220,8 @@ class Advanced_Ads_Ajax {
220
  }
221
 
222
  // if privacy module is not active, we can display.
223
- $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
 
224
  if ( ! isset( $privacy_options['enabled'] ) ) {
225
  return true;
226
  }
@@ -231,7 +232,7 @@ class Advanced_Ads_Ajax {
231
  }
232
  // Don't display ad if tcf is used and the consent state is anything different than accepted.
233
  if ( $privacy_options['consent-method'] === 'iab_tcf_20' && $consent_state !== 'accepted' ) {
234
- return in_array( $ad->type, array( 'image', 'dummy' ), true );
235
  }
236
 
237
  return true;
220
  }
221
 
222
  // if privacy module is not active, we can display.
223
+ $privacy = Advanced_Ads_Privacy::get_instance();
224
+ $privacy_options = $privacy->options();
225
  if ( ! isset( $privacy_options['enabled'] ) ) {
226
  return true;
227
  }
232
  }
233
  // Don't display ad if tcf is used and the consent state is anything different than accepted.
234
  if ( $privacy_options['consent-method'] === 'iab_tcf_20' && $consent_state !== 'accepted' ) {
235
+ return ! $privacy->ad_type_needs_consent( $ad->type );
236
  }
237
 
238
  return true;
classes/ad.php CHANGED
@@ -836,14 +836,10 @@ class Advanced_Ads_Ad {
836
  $wrapper['style']['float'] = 'right';
837
  break;
838
  case 'center':
839
- if ( ! empty( $this->output['add_wrapper_sizes'] ) ) {
840
- $wrapper['style']['margin-left'] = 'auto';
841
- $wrapper['style']['margin-right'] = 'auto';
842
 
843
- if ( $use_placement_pos ) {
844
- $wrapper['style']['text-align'] = 'center';
845
- }
846
- } else {
847
  $wrapper['style']['text-align'] = 'center';
848
  }
849
 
@@ -866,13 +862,13 @@ class Advanced_Ads_Ad {
866
  if ( ! empty( $this->output['margin']['top'] ) ) {
867
  $wrapper['style']['margin-top'] = intval( $this->output['margin']['top'] ) . 'px';
868
  }
869
- if ( ! empty( $this->output['margin']['right'] ) ) {
870
  $wrapper['style']['margin-right'] = intval( $this->output['margin']['right'] ) . 'px';
871
  }
872
  if ( ! empty( $this->output['margin']['bottom'] ) ) {
873
  $wrapper['style']['margin-bottom'] = intval( $this->output['margin']['bottom'] ) . 'px';
874
  }
875
- if ( ! empty( $this->output['margin']['left'] ) ) {
876
  $wrapper['style']['margin-left'] = intval( $this->output['margin']['left'] ) . 'px';
877
  }
878
 
836
  $wrapper['style']['float'] = 'right';
837
  break;
838
  case 'center':
839
+ $wrapper['style']['margin-left'] = 'auto';
840
+ $wrapper['style']['margin-right'] = 'auto';
 
841
 
842
+ if ( empty( $this->output['add_wrapper_sizes'] ) || $use_placement_pos ) {
 
 
 
843
  $wrapper['style']['text-align'] = 'center';
844
  }
845
 
862
  if ( ! empty( $this->output['margin']['top'] ) ) {
863
  $wrapper['style']['margin-top'] = intval( $this->output['margin']['top'] ) . 'px';
864
  }
865
+ if ( empty( $wrapper['style']['margin-right'] ) && ! empty( $this->output['margin']['right'] ) ) {
866
  $wrapper['style']['margin-right'] = intval( $this->output['margin']['right'] ) . 'px';
867
  }
868
  if ( ! empty( $this->output['margin']['bottom'] ) ) {
869
  $wrapper['style']['margin-bottom'] = intval( $this->output['margin']['bottom'] ) . 'px';
870
  }
871
+ if ( empty( $wrapper['style']['margin-left'] ) && ! empty( $this->output['margin']['left'] ) ) {
872
  $wrapper['style']['margin-left'] = intval( $this->output['margin']['left'] ) . 'px';
873
  }
874
 
classes/ad_type_dummy.php CHANGED
@@ -60,7 +60,13 @@ class Advanced_Ads_Ad_Type_Dummy extends Advanced_Ads_Ad_Type_Abstract{
60
  * @return string static image content.
61
  */
62
  public function prepare_output( $ad ) {
63
- $img = '<img src="' . ADVADS_BASE_URL . 'public/assets/img/dummy.jpg" width="300" height="250"/>';
 
 
 
 
 
 
64
  $url = ( isset( $ad->url ) ) ? esc_url( $ad->url ) : '';
65
  if ( ! defined( 'AAT_VERSION' ) && $url ) {
66
  // get general target setting.
60
  * @return string static image content.
61
  */
62
  public function prepare_output( $ad ) {
63
+ $style = '';
64
+ if ( isset( $ad->output['position'] ) && 'center' === $ad->output['position'] ) {
65
+ $style .= 'display: inline-block;';
66
+ }
67
+ $style = '' !== $style ? 'style="' . $style . '"' : '';
68
+ $img = sprintf( '<img src="%s" width="300" height="250" alt="" %s />', esc_url( ADVADS_BASE_URL . 'public/assets/img/dummy.jpg' ), $style );
69
+
70
  $url = ( isset( $ad->url ) ) ? esc_url( $ad->url ) : '';
71
  if ( ! defined( 'AAT_VERSION' ) && $url ) {
72
  // get general target setting.
classes/frontend_checks.php CHANGED
@@ -282,8 +282,8 @@ class Advanced_Ads_Frontend_Checks {
282
  ) );
283
 
284
  // warn if consent was not given
285
- $privacy_state = Advanced_Ads_Privacy::get_instance()->get_state();
286
- if( 'not_needed' !== $privacy_state ) {
287
  $nodes[] = array( 'type' => 2, 'data' => array(
288
  'parent' => 'advanced_ads_ad_health',
289
  'id' => 'advanced_ads_ad_health_consent_missing',
@@ -296,6 +296,23 @@ class Advanced_Ads_Frontend_Checks {
296
  ) );
297
  }
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  $nodes[] = array( 'type' => 3, 'data' => array(
300
  'parent' => 'advanced_ads_ad_health',
301
  'id' => 'advanced_ads_ad_health_gam_debug',
@@ -550,9 +567,8 @@ class Advanced_Ads_Frontend_Checks {
550
  var fine_item = document.getElementById( 'wp-admin-bar-advanced_ads_ad_health_fine' );
551
  } catch ( e ) { return; }
552
 
 
553
  if ( warning_count ) {
554
- var header = document.querySelector( '#wp-admin-bar-advanced_ads_ad_health > a' );
555
-
556
  if ( fine_item ) {
557
  // Hide 'fine' item.
558
  fine_item.className += ' hidden';
@@ -563,6 +579,17 @@ class Advanced_Ads_Frontend_Checks {
563
  // add class
564
  header.className += ' advads-adminbar-is-warnings';
565
  }
 
 
 
 
 
 
 
 
 
 
 
566
  }
567
  },
568
 
@@ -871,8 +898,8 @@ class Advanced_Ads_Frontend_Checks {
871
  /**
872
  * Code to check if current user gave consent to show ads
873
  */
874
- $privacy_state = Advanced_Ads_Privacy::get_instance()->get_state();
875
- if ( 'not_needed' !== $privacy_state ) :
876
  ?>
877
  document.addEventListener('advanced_ads_privacy', function (event) {
878
  var advads_consent_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_consent_missing');
@@ -889,6 +916,34 @@ class Advanced_Ads_Frontend_Checks {
889
 
890
  advanced_ads_frontend_checks.showCount();
891
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
892
  <?php endif; ?>
893
  /**
894
  * show Google Ad Manager debug link in Ad Health
282
  ) );
283
 
284
  // warn if consent was not given
285
+ $privacy = Advanced_Ads_Privacy::get_instance();
286
+ if ( 'not_needed' !== $privacy->get_state() ) {
287
  $nodes[] = array( 'type' => 2, 'data' => array(
288
  'parent' => 'advanced_ads_ad_health',
289
  'id' => 'advanced_ads_ad_health_consent_missing',
296
  ) );
297
  }
298
 
299
+ $privacy_options = $privacy->options();
300
+ if ( ( empty( $privacy_options['enabled'] ) || $privacy_options['consent-method'] !== 'iab_tcf_20' ) ) {
301
+ $nodes[] = array(
302
+ 'type' => 2,
303
+ 'data' => array(
304
+ 'parent' => 'advanced_ads_ad_health',
305
+ 'id' => 'advanced_ads_ad_health_privacy_disabled',
306
+ 'title' => __( 'Enable TCF integration', 'advanced-ads' ),
307
+ 'href' => admin_url( 'admin.php?page=advanced-ads-settings#top#privacy' ),
308
+ 'meta' => array(
309
+ 'class' => 'hidden advanced_ads_ad_health_warning advanced_ads_ad_health_privacy_disabled',
310
+ 'target' => '_blank',
311
+ ),
312
+ ),
313
+ );
314
+ }
315
+
316
  $nodes[] = array( 'type' => 3, 'data' => array(
317
  'parent' => 'advanced_ads_ad_health',
318
  'id' => 'advanced_ads_ad_health_gam_debug',
567
  var fine_item = document.getElementById( 'wp-admin-bar-advanced_ads_ad_health_fine' );
568
  } catch ( e ) { return; }
569
 
570
+ var header = document.querySelector( '#wp-admin-bar-advanced_ads_ad_health > a' );
571
  if ( warning_count ) {
 
 
572
  if ( fine_item ) {
573
  // Hide 'fine' item.
574
  fine_item.className += ' hidden';
579
  // add class
580
  header.className += ' advads-adminbar-is-warnings';
581
  }
582
+ } else {
583
+ // Show 'fine' item.
584
+ if ( fine_item ) {
585
+ fine_item.classList.remove('hidden');
586
+ }
587
+
588
+ // Remove counter.
589
+ if ( header ) {
590
+ header.innerHTML = header.innerHTML.replace(/<span class="advanced-ads-issue-counter">\d*<\/span>/, '');
591
+ header.classList.remove('advads-adminbar-is-warnings');
592
+ }
593
  }
594
  },
595
 
898
  /**
899
  * Code to check if current user gave consent to show ads
900
  */
901
+ $privacy = Advanced_Ads_Privacy::get_instance();
902
+ if ( 'not_needed' !== $privacy->get_state() ) :
903
  ?>
904
  document.addEventListener('advanced_ads_privacy', function (event) {
905
  var advads_consent_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_consent_missing');
916
 
917
  advanced_ads_frontend_checks.showCount();
918
  });
919
+ <?php
920
+ endif;
921
+ $privacy_options = $privacy->options();
922
+ if (
923
+ ( empty( $privacy_options['enabled'] ) || $privacy_options['consent-method'] !== 'iab_tcf_20' )
924
+ && (bool) apply_filters( 'advanced-ads-ad-health-show-tcf-notice', true )
925
+ ) :
926
+ ?>
927
+ var count = 0,
928
+ tcfapiInterval = setInterval(function () {
929
+ if (++count === 600) {
930
+ clearInterval(tcfapiInterval);
931
+ }
932
+ if (typeof window.__tcfapi === 'undefined') {
933
+ return;
934
+ }
935
+ clearInterval(tcfapiInterval);
936
+
937
+ var advads_privacy_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_privacy_disabled');
938
+
939
+ if (!advads_privacy_link) {
940
+ return;
941
+ }
942
+
943
+ advads_privacy_link.classList.remove('hidden');
944
+
945
+ advanced_ads_frontend_checks.showCount();
946
+ }, 100);
947
  <?php endif; ?>
948
  /**
949
  * show Google Ad Manager debug link in Ad Health
languages/advanced-ads.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Advanced Ads plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Advanced Ads 1.20.0-rc.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-09-11T17:21:48+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
@@ -431,7 +431,7 @@ msgid "You don’t have access to ads. Please deactivate and re-enable Advanced
431
  msgstr ""
432
 
433
  #: admin/includes/class-ad-type.php:917
434
- #: classes/frontend_checks.php:434
435
  msgid "Get help"
436
  msgstr ""
437
 
@@ -2991,109 +2991,113 @@ msgstr ""
2991
  msgid "Consent not given"
2992
  msgstr ""
2993
 
2994
- #: classes/frontend_checks.php:302
 
 
 
 
2995
  msgid "Debug Google Ad Manager"
2996
  msgstr ""
2997
 
2998
- #: classes/frontend_checks.php:313
2999
  msgid "Auto ads code found"
3000
  msgstr ""
3001
 
3002
- #: classes/frontend_checks.php:325
3003
  msgid "highlight ads"
3004
  msgstr ""
3005
 
3006
- #: classes/frontend_checks.php:392
3007
  msgid "Ad Health"
3008
  msgstr ""
3009
 
3010
- #: classes/frontend_checks.php:406
3011
  msgid "Show %d more notifications"
3012
  msgstr ""
3013
 
3014
- #: classes/frontend_checks.php:423
3015
  msgid "Everything is fine"
3016
  msgstr ""
3017
 
3018
- #: classes/frontend_checks.php:491
3019
  msgid "the following code is used for automatic error detection and only visible to admins"
3020
  msgstr ""
3021
 
3022
- #: classes/frontend_checks.php:799
3023
- #: classes/frontend_checks.php:814
3024
  msgid "Hi %s"
3025
  msgstr ""
3026
 
3027
- #: classes/frontend_checks.php:799
3028
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3029
  msgstr ""
3030
 
3031
- #: classes/frontend_checks.php:799
3032
- #: classes/frontend_checks.php:814
3033
  msgid "Is that correct?"
3034
  msgstr ""
3035
 
3036
- #: classes/frontend_checks.php:801
3037
  msgid "All is fine"
3038
  msgstr ""
3039
 
3040
- #: classes/frontend_checks.php:802
3041
  msgid "Something is off"
3042
  msgstr ""
3043
 
3044
- #: classes/frontend_checks.php:804
3045
- #: classes/frontend_checks.php:819
3046
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3047
  msgstr ""
3048
 
3049
- #: classes/frontend_checks.php:814
3050
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3051
  msgstr ""
3052
 
3053
- #: classes/frontend_checks.php:816
3054
  msgid "This is fine"
3055
  msgstr ""
3056
 
3057
- #: classes/frontend_checks.php:817
3058
  msgid "I expected something else"
3059
  msgstr ""
3060
 
3061
- #: classes/frontend_checks.php:822
3062
- #: classes/frontend_checks.php:830
3063
  msgid "Just click on your problem to learn more from our knowledge base."
3064
  msgstr ""
3065
 
3066
- #: classes/frontend_checks.php:823
3067
  msgid "I want to disable AdSense Auto ads"
3068
  msgstr ""
3069
 
3070
- #: classes/frontend_checks.php:824
3071
- #: classes/frontend_checks.php:831
3072
  msgid "I don’t see any Auto ads"
3073
  msgstr ""
3074
 
3075
- #: classes/frontend_checks.php:825
3076
  msgid "I only see blank space"
3077
  msgstr ""
3078
 
3079
- #: classes/frontend_checks.php:826
3080
  msgid "I want to change the position of the ads"
3081
  msgstr ""
3082
 
3083
- #: classes/frontend_checks.php:827
3084
  #: modules/gadsense/includes/class-network-adsense.php:256
3085
  msgid "Display Auto ads only on specific pages"
3086
  msgstr ""
3087
 
3088
- #: classes/frontend_checks.php:832
3089
  msgid "How to look for the Auto ads code"
3090
  msgstr ""
3091
 
3092
- #: classes/frontend_checks.php:833
3093
  msgid "I have another question or problem"
3094
  msgstr ""
3095
 
3096
- #: classes/frontend_checks.php:836
3097
  msgid "Closing the message"
3098
  msgstr ""
3099
 
@@ -3431,16 +3435,22 @@ msgstr ""
3431
  msgid "Get a free AdSense account"
3432
  msgstr ""
3433
 
3434
- #: modules/gadsense/admin/views/adsense-account.php:151
 
 
 
 
 
 
3435
  msgid "How to choose specific positions for AdSense ad units"
3436
  msgstr ""
3437
 
3438
  #. translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
3439
- #: modules/gadsense/admin/views/adsense-account.php:155
3440
  msgid "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
3441
  msgstr ""
3442
 
3443
- #: modules/gadsense/admin/views/adsense-account.php:163
3444
  #: modules/gadsense/admin/views/external-ads-links.php:38
3445
  msgid "Can not connect AdSense account. PHP version is too low."
3446
  msgstr ""
@@ -4040,8 +4050,9 @@ msgstr ""
4040
  msgid "Cookie"
4041
  msgstr ""
4042
 
4043
- #: modules/privacy/admin/admin.php:112
4044
- msgid "TCF v2.0 integration (Quantcast, euconsent-v2, ...)"
 
4045
  msgstr ""
4046
 
4047
  #: modules/privacy/admin/views/setting-ad-ignore-consent.php:10
2
  # This file is distributed under the same license as the Advanced Ads plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Advanced Ads 1.20.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-09-16T09:45:03+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
431
  msgstr ""
432
 
433
  #: admin/includes/class-ad-type.php:917
434
+ #: classes/frontend_checks.php:451
435
  msgid "Get help"
436
  msgstr ""
437
 
2991
  msgid "Consent not given"
2992
  msgstr ""
2993
 
2994
+ #: classes/frontend_checks.php:306
2995
+ msgid "Enable TCF integration"
2996
+ msgstr ""
2997
+
2998
+ #: classes/frontend_checks.php:319
2999
  msgid "Debug Google Ad Manager"
3000
  msgstr ""
3001
 
3002
+ #: classes/frontend_checks.php:330
3003
  msgid "Auto ads code found"
3004
  msgstr ""
3005
 
3006
+ #: classes/frontend_checks.php:342
3007
  msgid "highlight ads"
3008
  msgstr ""
3009
 
3010
+ #: classes/frontend_checks.php:409
3011
  msgid "Ad Health"
3012
  msgstr ""
3013
 
3014
+ #: classes/frontend_checks.php:423
3015
  msgid "Show %d more notifications"
3016
  msgstr ""
3017
 
3018
+ #: classes/frontend_checks.php:440
3019
  msgid "Everything is fine"
3020
  msgstr ""
3021
 
3022
+ #: classes/frontend_checks.php:508
3023
  msgid "the following code is used for automatic error detection and only visible to admins"
3024
  msgstr ""
3025
 
3026
+ #: classes/frontend_checks.php:826
3027
+ #: classes/frontend_checks.php:841
3028
  msgid "Hi %s"
3029
  msgstr ""
3030
 
3031
+ #: classes/frontend_checks.php:826
3032
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3033
  msgstr ""
3034
 
3035
+ #: classes/frontend_checks.php:826
3036
+ #: classes/frontend_checks.php:841
3037
  msgid "Is that correct?"
3038
  msgstr ""
3039
 
3040
+ #: classes/frontend_checks.php:828
3041
  msgid "All is fine"
3042
  msgstr ""
3043
 
3044
+ #: classes/frontend_checks.php:829
3045
  msgid "Something is off"
3046
  msgstr ""
3047
 
3048
+ #: classes/frontend_checks.php:831
3049
+ #: classes/frontend_checks.php:846
3050
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3051
  msgstr ""
3052
 
3053
+ #: classes/frontend_checks.php:841
3054
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3055
  msgstr ""
3056
 
3057
+ #: classes/frontend_checks.php:843
3058
  msgid "This is fine"
3059
  msgstr ""
3060
 
3061
+ #: classes/frontend_checks.php:844
3062
  msgid "I expected something else"
3063
  msgstr ""
3064
 
3065
+ #: classes/frontend_checks.php:849
3066
+ #: classes/frontend_checks.php:857
3067
  msgid "Just click on your problem to learn more from our knowledge base."
3068
  msgstr ""
3069
 
3070
+ #: classes/frontend_checks.php:850
3071
  msgid "I want to disable AdSense Auto ads"
3072
  msgstr ""
3073
 
3074
+ #: classes/frontend_checks.php:851
3075
+ #: classes/frontend_checks.php:858
3076
  msgid "I don’t see any Auto ads"
3077
  msgstr ""
3078
 
3079
+ #: classes/frontend_checks.php:852
3080
  msgid "I only see blank space"
3081
  msgstr ""
3082
 
3083
+ #: classes/frontend_checks.php:853
3084
  msgid "I want to change the position of the ads"
3085
  msgstr ""
3086
 
3087
+ #: classes/frontend_checks.php:854
3088
  #: modules/gadsense/includes/class-network-adsense.php:256
3089
  msgid "Display Auto ads only on specific pages"
3090
  msgstr ""
3091
 
3092
+ #: classes/frontend_checks.php:859
3093
  msgid "How to look for the Auto ads code"
3094
  msgstr ""
3095
 
3096
+ #: classes/frontend_checks.php:860
3097
  msgid "I have another question or problem"
3098
  msgstr ""
3099
 
3100
+ #: classes/frontend_checks.php:863
3101
  msgid "Closing the message"
3102
  msgstr ""
3103
 
3435
  msgid "Get a free AdSense account"
3436
  msgstr ""
3437
 
3438
+ #. translators: %1$s is an opening a tag, %2$s is the closing one
3439
+ #: modules/gadsense/admin/views/adsense-account.php:104
3440
+ #: modules/gadsense/admin/views/adsense-account.php:195
3441
+ msgid "See all %1$srecommended ad networks%2$s."
3442
+ msgstr ""
3443
+
3444
+ #: modules/gadsense/admin/views/adsense-account.php:169
3445
  msgid "How to choose specific positions for AdSense ad units"
3446
  msgstr ""
3447
 
3448
  #. translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
3449
+ #: modules/gadsense/admin/views/adsense-account.php:177
3450
  msgid "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
3451
  msgstr ""
3452
 
3453
+ #: modules/gadsense/admin/views/adsense-account.php:209
3454
  #: modules/gadsense/admin/views/external-ads-links.php:38
3455
  msgid "Can not connect AdSense account. PHP version is too low."
3456
  msgstr ""
4050
  msgid "Cookie"
4051
  msgstr ""
4052
 
4053
+ #. translators: %s is a string with various CMPs (companies) that support the TCF standard
4054
+ #: modules/privacy/admin/admin.php:114
4055
+ msgid "TCF v2.0 integration (e.g., %s)"
4056
  msgstr ""
4057
 
4058
  #: modules/privacy/admin/views/setting-ad-ignore-consent.php:10
modules/gadsense/admin/views/adsense-account.php CHANGED
@@ -50,7 +50,7 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
50
  </div>
51
  <div id="mapi-connect-errors">
52
  <?php if ( !empty( $mapi_options['connect_error'] ) ) {
53
-
54
  echo '<p>';
55
  if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
56
  echo $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
@@ -61,7 +61,7 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
61
  echo is_rtl()? 'left' : 'right';
62
  echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
63
  echo '</p>';
64
-
65
  }
66
  ?>
67
  </div>
@@ -96,6 +96,24 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
96
  <div class="widget-col">
97
  <h3><?php _e( "No, I still don't have an AdSense account", 'advanced-ads' ) ?></h3>
98
  <a class="button button-secondary" target="_blank" href="<?php echo Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  </div>
100
  </div>
101
  <style type="text/css">
@@ -119,7 +137,7 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
119
  #auto-adsense-settings-div:after {
120
  display: block;
121
  content: "";
122
- clear: left;
123
  }
124
  #auto-adsense-settings-div .widget-col:first-child {
125
  margin-right: 20px;
@@ -135,9 +153,9 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
135
  right: -10px;
136
  background: #ffffff;
137
  color: #cccccc;
138
- font-size: 20px;
139
  }
140
- @media screen and (max-width: 1199px) {
141
  #auto-adsense-settings-div .widget-col { float: none; margin-right: 0; }
142
  #auto-adsense-settings-div .widget-col:first-child { margin: 0px 0px 20px 0px; padding: 0px 0px 20px 0px; border-bottom: 1px solid #cccccc; border-right: 0; }
143
  #auto-adsense-settings-div .widget-col:first-child:after { top: auto; right: auto; bottom: -10px; left: 20px; display: inline-block; padding: 0px 5px 0px 5px; }
@@ -151,14 +169,42 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
151
  esc_attr_e( 'How to choose specific positions for AdSense ad units', 'advanced-ads' ); ?></a>
152
  </p><?php
153
  else : ?>
154
- <p><?php // translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
155
- printf(__( 'Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s.', 'advanced-ads' ),
156
- '<a href="' . ADVADS_URL . 'adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check" target="_blank">',
157
- '</a>',
158
- '<a href="https://wordpress.org/support/plugin/advanced-ads/#new-post" target="_blank">',
159
- '</a>'
 
 
 
 
 
 
 
 
 
 
 
160
  ); ?></p>
161
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  <?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
163
  <p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ) ?></p>
164
  <?php endif; ?>
50
  </div>
51
  <div id="mapi-connect-errors">
52
  <?php if ( !empty( $mapi_options['connect_error'] ) ) {
53
+
54
  echo '<p>';
55
  if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
56
  echo $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
61
  echo is_rtl()? 'left' : 'right';
62
  echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
63
  echo '</p>';
64
+
65
  }
66
  ?>
67
  </div>
96
  <div class="widget-col">
97
  <h3><?php _e( "No, I still don't have an AdSense account", 'advanced-ads' ) ?></h3>
98
  <a class="button button-secondary" target="_blank" href="<?php echo Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' ); ?></a>
99
+ <p>
100
+ <?php
101
+ printf(
102
+ wp_kses(
103
+ // translators: %1$s is an opening a tag, %2$s is the closing one
104
+ __( 'See all %1$srecommended ad networks%2$s.', 'advanced-ads' ),
105
+ array(
106
+ 'a' => array(
107
+ 'href' => array(),
108
+ 'target' => array(),
109
+ ),
110
+ )
111
+ ),
112
+ '<a href="' . esc_url( ADVADS_URL ) . ' recommended-ad-networks/#utm_source=advanced-ads&utm_medium=link&utm_campaign=recommendations" target="_blank">',
113
+ '</a>'
114
+ );
115
+ ?>
116
+ </p>
117
  </div>
118
  </div>
119
  <style type="text/css">
137
  #auto-adsense-settings-div:after {
138
  display: block;
139
  content: "";
140
+ clear: left;
141
  }
142
  #auto-adsense-settings-div .widget-col:first-child {
143
  margin-right: 20px;
153
  right: -10px;
154
  background: #ffffff;
155
  color: #cccccc;
156
+ font-size: 20px;
157
  }
158
+ @media screen and (max-width: 1199px) {
159
  #auto-adsense-settings-div .widget-col { float: none; margin-right: 0; }
160
  #auto-adsense-settings-div .widget-col:first-child { margin: 0px 0px 20px 0px; padding: 0px 0px 20px 0px; border-bottom: 1px solid #cccccc; border-right: 0; }
161
  #auto-adsense-settings-div .widget-col:first-child:after { top: auto; right: auto; bottom: -10px; left: 20px; display: inline-block; padding: 0px 5px 0px 5px; }
169
  esc_attr_e( 'How to choose specific positions for AdSense ad units', 'advanced-ads' ); ?></a>
170
  </p><?php
171
  else : ?>
172
+ <p>
173
+ <?php
174
+ printf(
175
+ wp_kses(
176
+ // translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
177
+ __( 'Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s.', 'advanced-ads' ),
178
+ array(
179
+ 'a' => array(
180
+ 'href' => array(),
181
+ 'target' => array(),
182
+ ),
183
+ )
184
+ ),
185
+ '<a href="' . esc_url( ADVADS_URL ) . 'adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check" target="_blank">',
186
+ '</a>',
187
+ '<a href="https://wordpress.org/support/plugin/advanced-ads/#new-post" target="_blank">',
188
+ '</a>'
189
  ); ?></p>
190
+ <p>
191
+ <?php
192
+ printf(
193
+ wp_kses(
194
+ // translators: %1$s is an opening a tag, %2$s is the closing one
195
+ __( 'See all %1$srecommended ad networks%2$s.', 'advanced-ads' ),
196
+ array(
197
+ 'a' => array(
198
+ 'href' => array(),
199
+ 'target' => array(),
200
+ ),
201
+ )
202
+ ),
203
+ '<a href="' . esc_url( ADVADS_URL ) . ' recommended-ad-networks/#utm_source=advanced-ads&utm_medium=link&utm_campaign=recommendations" target="_blank">',
204
+ '</a>'
205
+ );
206
+ ?>
207
+ </p><?php endif; ?>
208
  <?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
209
  <p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ) ?></p>
210
  <?php endif; ?>
modules/gadsense/includes/class-network-adsense.php CHANGED
@@ -224,13 +224,13 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network {
224
  esc_attr_e( 'Insert the AdSense header code used for verification and the Auto Ads feature.', 'advanced-ads' );
225
  if ( ! empty( $options['adsense-id'] ) ) :
226
  ?>
227
- &nbsp;<a href="https://www.google.com/adsense/new/u/0/<?php echo esc_attr( $options['adsense-id'] ); ?>/myads/auto-ads" target="_blank">
228
- <?php
229
- /**
230
- * Translators: this is the text for a link to a sub-page in an AdSense account
231
- */
232
- esc_attr_e( 'Adjust Auto ads options', 'advanced-ads' );
233
- ?>
234
  </a>
235
  <?php
236
  endif;
224
  esc_attr_e( 'Insert the AdSense header code used for verification and the Auto Ads feature.', 'advanced-ads' );
225
  if ( ! empty( $options['adsense-id'] ) ) :
226
  ?>
227
+ &nbsp<a href="https://www.google.com/adsense/new/u/0/<?php echo esc_attr( $options['adsense-id'] ); ?>/myads/auto-ads" target="_blank">
228
+ <?php
229
+ /**
230
+ * Translators: this is the text for a link to a sub-page in an AdSense account
231
+ */
232
+ esc_attr_e( 'Adjust Auto ads options', 'advanced-ads' );
233
+ ?>
234
  </a>
235
  <?php
236
  endif;
modules/privacy/admin/admin.php CHANGED
@@ -109,7 +109,11 @@ class Advanced_Ads_Privacy_Admin {
109
  'manual_url' => ADVADS_URL . 'manual/ad-cookie-consent/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab',
110
  ),
111
  'iab_tcf_20' => array(
112
- 'label' => __( 'TCF v2.0 integration (Quantcast, euconsent-v2, ...)', 'advanced-ads' ),
 
 
 
 
113
  'manual_url' => ADVADS_URL . 'manual/tcf-consent-wordpress/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab',
114
  ),
115
  );
@@ -156,17 +160,17 @@ class Advanced_Ads_Privacy_Admin {
156
  return;
157
  }
158
 
159
- $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
 
160
  // module is not enabled.
161
  if ( ! isset( $privacy_options['enabled'] ) ) {
162
  return;
163
  }
164
 
165
  // Don't add override option if the ad is adsense and tcf is enabled, or if the ad is image or dummy.
166
- if (
167
- ( $ad->type === 'adsense' && $privacy_options['consent-method'] === 'iab_tcf_20' )
168
- || in_array( $ad->type, array( 'image', 'dummy' ), true )
169
- ) {
170
  return;
171
  }
172
 
109
  'manual_url' => ADVADS_URL . 'manual/ad-cookie-consent/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab',
110
  ),
111
  'iab_tcf_20' => array(
112
+ 'label' => sprintf(
113
+ // translators: %s is a string with various CMPs (companies) that support the TCF standard
114
+ __( 'TCF v2.0 integration (e.g., %s)', 'advanced-ads' ),
115
+ 'Quantcast Choices'
116
+ ),
117
  'manual_url' => ADVADS_URL . 'manual/tcf-consent-wordpress/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab',
118
  ),
119
  );
160
  return;
161
  }
162
 
163
+ $privacy = Advanced_Ads_Privacy::get_instance();
164
+ $privacy_options = $privacy->options();
165
  // module is not enabled.
166
  if ( ! isset( $privacy_options['enabled'] ) ) {
167
  return;
168
  }
169
 
170
  // Don't add override option if the ad is adsense and tcf is enabled, or if the ad is image or dummy.
171
+ $skip_option = ( $ad->type === 'adsense' && $privacy_options['consent-method'] === 'iab_tcf_20' ) || ! $privacy->ad_type_needs_consent( $ad->type );
172
+
173
+ if ( (bool) apply_filters( 'advanced-ads-ad-privacy-hide-ignore-consent', $skip_option, $ad, $privacy_options ) ) {
 
174
  return;
175
  }
176
 
modules/privacy/classes/class-privacy.php CHANGED
@@ -37,7 +37,7 @@ class Advanced_Ads_Privacy {
37
  add_filter( 'advanced-ads-activate-advanced-js', '__return_true' );
38
 
39
  if ( $this->options['consent-method'] === 'iab_tcf_20' ) {
40
- add_filter( 'advanced-ads-output-final', array( $this, 'encode_final_ad_output' ), 10, 2 );
41
  }
42
  }
43
  }
@@ -50,17 +50,29 @@ class Advanced_Ads_Privacy {
50
  *
51
  * @return string
52
  */
53
- public function encode_final_ad_output( $output, Advanced_Ads_Ad $ad ) {
54
  if (
55
  advads_is_amp()
56
- // Never encode image or dummy ads.
57
- || in_array( $ad->type, array( 'image', 'dummy' ), true )
58
  // Consent is overridden, and this is not an AdSense ad, don't encode it.
59
  || ( $ad->type !== 'adsense' && isset( $ad->options()['privacy']['ignore-consent'] ) )
60
  ) {
61
  return $output;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  return sprintf(
65
  '<script type="text/plain" data-tcf="waiting-for-consent" data-id="%d" data-bid="%s" %s>%s</script>',
66
  $ad->id,
@@ -71,6 +83,17 @@ class Advanced_Ads_Privacy {
71
  );
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
74
  /**
75
  * Return an instance of Advanced_Ads_Privacy
76
  *
@@ -145,6 +168,17 @@ class Advanced_Ads_Privacy {
145
  return $this->get_state() !== 'unknown';
146
  }
147
 
 
 
 
 
 
 
 
 
 
 
 
148
  /**
149
  * Check if consent is not needed or was given by the user.
150
  *
37
  add_filter( 'advanced-ads-activate-advanced-js', '__return_true' );
38
 
39
  if ( $this->options['consent-method'] === 'iab_tcf_20' ) {
40
+ add_filter( 'advanced-ads-output-final', array( $this, 'final_ad_output' ), 10, 2 );
41
  }
42
  }
43
  }
50
  *
51
  * @return string
52
  */
53
+ public function final_ad_output( $output, Advanced_Ads_Ad $ad ) {
54
  if (
55
  advads_is_amp()
56
+ // Never encode image, dummy or group ads.
57
+ || ! $this->ad_type_needs_consent( $ad->type )
58
  // Consent is overridden, and this is not an AdSense ad, don't encode it.
59
  || ( $ad->type !== 'adsense' && isset( $ad->options()['privacy']['ignore-consent'] ) )
60
  ) {
61
  return $output;
62
  }
63
 
64
+ return $this->encode_ad( $output, $ad );
65
+ }
66
+
67
+ /**
68
+ * Encode the ad output.
69
+ *
70
+ * @param string $output The output string.
71
+ * @param Advanced_Ads_Ad $ad The ad object.
72
+ *
73
+ * @return string
74
+ */
75
+ public function encode_ad( $output, Advanced_Ads_Ad $ad ) {
76
  return sprintf(
77
  '<script type="text/plain" data-tcf="waiting-for-consent" data-id="%d" data-bid="%s" %s>%s</script>',
78
  $ad->id,
83
  );
84
  }
85
 
86
+ /**
87
+ * Check if the current ad output is encoded.
88
+ *
89
+ * @param string $output The ad output.
90
+ *
91
+ * @return bool
92
+ */
93
+ public function is_ad_output_encoded( $output ) {
94
+ return (bool) strpos( $output, 'data-tcf="waiting-for-consent"' );
95
+ }
96
+
97
  /**
98
  * Return an instance of Advanced_Ads_Privacy
99
  *
168
  return $this->get_state() !== 'unknown';
169
  }
170
 
171
+ /**
172
+ * Check whether this ad_type needs consent.
173
+ *
174
+ * @param string $type The ad type.
175
+ *
176
+ * @return bool
177
+ */
178
+ public function ad_type_needs_consent( $type ) {
179
+ return ! in_array( $type, array( 'image', 'dummy', 'group' ), true );
180
+ }
181
+
182
  /**
183
  * Check if consent is not needed or was given by the user.
184
  *
public/assets/js/advanced.js CHANGED
@@ -1 +1 @@
1
- advads={supports_localstorage:function(){"use strict";try{return window&&void 0!==window.localStorage?(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0):!1}catch(e){return!1}},max_per_session:function(e,t){var a=1;if(void 0!==t&&0!==parseInt(t)||(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;a+=parseInt(this.get_cookie(e))}return this.set_cookie(e,a),!1},count_up:function(e,t){var a=1;this.cookie_exists(e)&&(a+=parseInt(this.get_cookie(e))),this.set_cookie(e,a)},set_cookie_exists:function(e){return!!get_cookie(e)||(set_cookie(e,"",0),!1)},get_cookie:function(e){for(var t,a,o=document.cookie.split(";"),n=0;n<o.length;n++)if(t=o[n].substr(0,o[n].indexOf("=")),a=o[n].substr(o[n].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return unescape(a)},set_cookie:function(e,t,a,o,n,r){var i=null==a?null:24*a*60*60;this.set_cookie_sec(e,t,i,o,n,r)},set_cookie_sec:function(e,t,a,o,n,r){var i=new Date;i.setSeconds(i.getSeconds()+parseInt(a)),document.cookie=e+"="+escape(t)+(null==a?"":"; expires="+i.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==r?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t},move:function(e,t,a){var o=jQuery(e),n=t;if(void 0===a&&(a={}),void 0===a.css&&(a.css={}),void 0===a.method&&(a.method="prependTo"),""===t&&void 0!==a.target)switch(a.target){case"wrapper":var r="left";void 0!==a.offset&&(r=a.offset),t=this.find_wrapper(e,r)}switch(1<(t=void 0===a.moveintohidden?jQuery(t).filter(":visible"):jQuery(t)).length&&console.log("Advanced Ads: element '"+n+"' found "+t.length+" times."),a.method){case"insertBefore":o.insertBefore(t);break;case"insertAfter":o.insertAfter(t);break;case"appendTo":o.appendTo(t);break;case"prependTo":o.prependTo(t);break;default:o.prependTo(t)}},set_parent_relative:function(e,t){var t=void 0!==t?t:{},a=jQuery(e).parent();t.use_grandparent&&(a=a.parent()),"static"!==a.css("position")&&""!==a.css("position")||a.css("position","relative")},fix_element:function(e,t){var t=void 0!==t?t:{},a=jQuery(e);t.use_grandparent?this.set_parent_relative(a.parent()):this.set_parent_relative(a),t.is_invisible&&a.show();var o,n=parseInt(a.offset().top),r=parseInt(a.offset().left);t.is_invisible&&a.hide(),"left"===t.offset?(o=jQuery(window).width()-r-a.outerWidth(),a.css("position","fixed").css("top",n+"px").css("right",o+"px").css("left","")):a.css("position","fixed").css("top",n+"px").css("left",r+"px").css("right","")},find_wrapper:function(o,n){var r;return jQuery("body").children().each(function(e,t){if(t.id!==o.substring(1)){var a=jQuery(t);if("right"===n&&a.offset().left+jQuery(a).width()<jQuery(window).width()||"left"===n&&0<a.offset().left)return"static"!==a.css("position")&&""!==a.css("position")||a.css("position","relative"),r=t,!1}}),r},center_fixed_element:function(e){var t=jQuery(e),a=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",a+"px")},center_vertically:function(e){var t=jQuery(e),a=jQuery(window).height()/2-parseInt(t.css("height"))/2;"fixed"!==t.css("position")&&(a-=topoffset=parseInt(t.offset().top)),t.css("top",a+"px")},close:function(e){jQuery(e).remove()},wait_for_images:function(n,r){var i=0,s=[];n.find('img[src][src!=""]').each(function(){s.push(this.src)}),0===s.length&&r.call(n),jQuery.each(s,function(e,t){var a=new Image;a.src=t;var o="load error";jQuery(a).one(o,function e(t){if(jQuery(this).off(o,e),++i==s.length)return r.call(n[0]),!1})})},privacy:{state:"unknown",state_executed:!1,get_state:function(){if("unknown"!==window.advads_options.privacy.state)return advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(window.advads_options.privacy.state,!1)),advads.privacy.state;advads.privacy.state_executed=!0;var t=0,a=setInterval(function(){switch(600===t&&clearInterval(a),window.advads_options.privacy["consent-method"]){case"custom":var e=new RegExp(window.advads_options.privacy["custom-cookie-name"]+"=.*?"+window.advads_options.privacy["custom-cookie-value"]+"[^;]*");null!==document.cookie.match(e)&&(clearInterval(a),"accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",!0));break;case"iab_tcf_20":if(void 0===window.__tcfapi)return;clearInterval(a),window.__tcfapi("addEventListener",2,function(e,t){if(t&&("tcloaded"===e.eventStatus||"useractioncomplete"===e.eventStatus)){var a="useractioncomplete"===e.eventStatus;if(!e.gdprApplies)return void("not_needed"!==advads.privacy.state&&advads.privacy.dispatch_event("not_needed",a));if(e.purpose.consents[1])return void("accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",a));"rejected"!==advads.privacy.state&&advads.privacy.dispatch_event("rejected",a)}})}t++},100);return advads.privacy.state},is_adsense_npa_enabled:function(){return!window.advads_options||!window.advads_options.privacy||!(!window.advads_options.privacy["show-non-personalized-adsense"]||"custom"!==window.advads_options.privacy["consent-method"])},dispatch_event:function(e,t){var a=advads.privacy.state;advads.privacy.state=e,console.log({state:e,previousState:a,userAction:t}),document.dispatchEvent(new CustomEvent("advanced_ads_privacy",{detail:{state:e,previousState:a,userAction:t}}))},is_ad_decoded:function(e){return null===document.querySelector('script[data-tcf="waiting-for-consent"][data-id="'+e+'"]')},decode_ad:function(e,t){t="boolean"!=typeof t||t;var a=decodeURIComponent(Array.prototype.map.call(atob(e.textContent),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));if(!t)return a;e.replaceWith(document.createRange().createContextualFragment(a))}}},(window.advanced_ads_ready||jQuery(document).ready).call(null,function(){advads.privacy.get_state()}),document.addEventListener("advanced_ads_privacy",function(e){"accepted"!==e.detail.state&&"not_needed"!==e.detail.state||e.detail.userAction||"loading"===document.readyState||document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"]').forEach(advads.privacy.decode_ad)}),jQuery(document).ready(function(){var i,s,d,c;!advads.supports_localstorage()||!localStorage.getItem("advads_frontend_picker")||window.advads_options.blog_id&&localStorage.getItem("advads_frontend_blog_id")&&window.advads_options.blog_id!==localStorage.getItem("advads_frontend_blog_id")||localStorage.getItem("advads_frontend_starttime")&&parseInt(localStorage.getItem("advads_frontend_starttime"),10)<(new Date).getTime()-27e5&&(localStorage.removeItem("advads_frontend_action"),localStorage.removeItem("advads_frontend_element"),localStorage.removeItem("advads_frontend_picker"),localStorage.removeItem("advads_prev_url"),localStorage.removeItem("advads_frontend_pathtype"),localStorage.removeItem("advads_frontend_boundary"),localStorage.removeItem("advads_frontend_blog_id"),localStorage.removeItem("advads_frontend_starttime"),!void advads.set_cookie("advads_frontend_picker","",-1))||(s=jQuery("<div id='advads-picker-overlay'>"),d=[document.body,document.documentElement,document],s.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),"true"===localStorage.getItem("advads_frontend_boundary")&&jQuery("body").css("cursor","not-allowed"),window.advads.is_boundary_reached=function(e){if("true"!==localStorage.getItem("advads_frontend_boundary"))return!1;$advads_picker_cur=jQuery(e);var t=jQuery(".advads-frontend-picker-boundary-helper");return $boundaries=t.parent(),$boundaries.css("cursor","pointer"),$advads_picker_cur.is($boundaries)||!$advads_picker_cur.closest($boundaries).length},c="xpath"===localStorage.getItem("advads_frontend_pathtype")?"getXPath":"getPath",jQuery(document).mousemove(function(e){if(e.target!==i){if(~d.indexOf(e.target))return i=null,void s.hide();var t=jQuery(e.target),a=t.offset(),o=t.outerWidth(),n=t.outerHeight();i=e.target;var r=jQuery(i)[c]();r&&(console.log(r),s.css({top:a.top,left:a.left,width:o,height:n}).show())}}),jQuery(document).click(function(e){var t=jQuery(i)[c]();advads.is_boundary_reached(i)||(localStorage.setItem("advads_frontend_element",t),window.location=localStorage.getItem("advads_prev_url"))}))}),jQuery.fn.extend({getPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("html"))return"html > "+e;if(3===t)return e;var a=this.get(0).nodeName.toLowerCase(),o=this.attr("id"),n=this.attr("class");return t+=1,void 0===o||/\d/.test(o)?void 0!==n&&(n=n.split(/[\s\n]+/),(n=jQuery.grep(n,function(e,t){return!/\d/.test(e)})).length&&(a+="."+n.slice(0,2).join("."))):a+="#"+o,this.siblings(a).length&&(a+=":eq("+this.siblings(a).addBack().not("#advads-picker-overlay").index(this)+")"),""===e?this.parent().getPath(a,t):this.parent().getPath(a+" > "+e,t)},getXPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("body")||3===t)return e;if(advads.is_boundary_reached(this))return e;var a,o=this.get(0).nodeName.toLowerCase(),n=o,r=this.attr("id"),i=this.attr("class"),s=[];if(void 0!==r&&!/\d/.test(r))return n+'[@id and id="'+r+'"]/'+e;if(void 0!==i&&(i=i.split(/[\s\n]+/),(i=jQuery.grep(i,function(e,t){return!/\d/.test(e)})).length)){t+=1;for(var s=i.slice(0,2),d=[],c=0;c<s.length;c++)d.push('(@class and contains(concat(" ", normalize-space(@class), " "), " '+s[c]+' "))');n+="["+d.join(" and ")+"]"}return(a=s.length?this.siblings(o+"."+s.join(".")):this.siblings(o)).length&&(n+="["+a.addBack().not("#advads-picker-overlay").index(this)+"]"),""===e?this.parent().getXPath(n,t):this.parent().getXPath(n+"/"+e,t)}});
1
+ advads={supports_localstorage:function(){"use strict";try{return window&&void 0!==window.localStorage?(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0):!1}catch(e){return!1}},max_per_session:function(e,t){var a=1;if(void 0!==t&&0!==parseInt(t)||(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;a+=parseInt(this.get_cookie(e))}return this.set_cookie(e,a),!1},count_up:function(e,t){var a=1;this.cookie_exists(e)&&(a+=parseInt(this.get_cookie(e))),this.set_cookie(e,a)},set_cookie_exists:function(e){return!!get_cookie(e)||(set_cookie(e,"",0),!1)},get_cookie:function(e){for(var t,a,o=document.cookie.split(";"),n=0;n<o.length;n++)if(t=o[n].substr(0,o[n].indexOf("=")),a=o[n].substr(o[n].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))===e)return unescape(a)},set_cookie:function(e,t,a,o,n,r){var i=null==a?null:24*a*60*60;this.set_cookie_sec(e,t,i,o,n,r)},set_cookie_sec:function(e,t,a,o,n,r){var i=new Date;i.setSeconds(i.getSeconds()+parseInt(a)),document.cookie=e+"="+escape(t)+(null==a?"":"; expires="+i.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==r?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t},move:function(e,t,a){var o=jQuery(e),n=t;if(void 0===a&&(a={}),void 0===a.css&&(a.css={}),void 0===a.method&&(a.method="prependTo"),""===t&&void 0!==a.target)switch(a.target){case"wrapper":var r="left";void 0!==a.offset&&(r=a.offset),t=this.find_wrapper(e,r)}switch(1<(t=void 0===a.moveintohidden?jQuery(t).filter(":visible"):jQuery(t)).length&&console.log("Advanced Ads: element '"+n+"' found "+t.length+" times."),a.method){case"insertBefore":o.insertBefore(t);break;case"insertAfter":o.insertAfter(t);break;case"appendTo":o.appendTo(t);break;case"prependTo":o.prependTo(t);break;default:o.prependTo(t)}},set_parent_relative:function(e,t){var t=void 0!==t?t:{},a=jQuery(e).parent();t.use_grandparent&&(a=a.parent()),"static"!==a.css("position")&&""!==a.css("position")||a.css("position","relative")},fix_element:function(e,t){var t=void 0!==t?t:{},a=jQuery(e);t.use_grandparent?this.set_parent_relative(a.parent()):this.set_parent_relative(a),t.is_invisible&&a.show();var o,n=parseInt(a.offset().top),r=parseInt(a.offset().left);t.is_invisible&&a.hide(),"left"===t.offset?(o=jQuery(window).width()-r-a.outerWidth(),a.css("position","fixed").css("top",n+"px").css("right",o+"px").css("left","")):a.css("position","fixed").css("top",n+"px").css("left",r+"px").css("right","")},find_wrapper:function(o,n){var r;return jQuery("body").children().each(function(e,t){if(t.id!==o.substring(1)){var a=jQuery(t);if("right"===n&&a.offset().left+jQuery(a).width()<jQuery(window).width()||"left"===n&&0<a.offset().left)return"static"!==a.css("position")&&""!==a.css("position")||a.css("position","relative"),r=t,!1}}),r},center_fixed_element:function(e){var t=jQuery(e),a=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",a+"px")},center_vertically:function(e){var t=jQuery(e),a=jQuery(window).height()/2-parseInt(t.css("height"))/2;"fixed"!==t.css("position")&&(a-=topoffset=parseInt(t.offset().top)),t.css("top",a+"px")},close:function(e){jQuery(e).remove()},wait_for_images:function(n,r){var i=0,s=[];n.find('img[src][src!=""]').each(function(){s.push(this.src)}),0===s.length&&r.call(n),jQuery.each(s,function(e,t){var a=new Image;a.src=t;var o="load error";jQuery(a).one(o,function e(t){if(jQuery(this).off(o,e),++i==s.length)return r.call(n[0]),!1})})},privacy:{state:"unknown",state_executed:!1,get_state:function(){if("unknown"!==window.advads_options.privacy.state)return advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(window.advads_options.privacy.state,!1)),advads.privacy.state;advads.privacy.state_executed=!0;var t=0,a=setInterval(function(){switch(600===t&&clearInterval(a),window.advads_options.privacy["consent-method"]){case"custom":var e=new RegExp(window.advads_options.privacy["custom-cookie-name"]+"=.*?"+window.advads_options.privacy["custom-cookie-value"]+"[^;]*");null!==document.cookie.match(e)&&(clearInterval(a),"accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",!0));break;case"iab_tcf_20":if(void 0===window.__tcfapi)return;clearInterval(a),window.__tcfapi("addEventListener",2,function(e,t){if(t&&("tcloaded"===e.eventStatus||"useractioncomplete"===e.eventStatus)){var a="useractioncomplete"===e.eventStatus;if(!e.gdprApplies)return void("not_needed"!==advads.privacy.state&&advads.privacy.dispatch_event("not_needed",a));if(e.purpose.consents[1])return void("accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",a));"rejected"!==advads.privacy.state&&advads.privacy.dispatch_event("rejected",a)}})}t++},100);return advads.privacy.state},is_adsense_npa_enabled:function(){return!window.advads_options||!window.advads_options.privacy||!(!window.advads_options.privacy["show-non-personalized-adsense"]||"custom"!==window.advads_options.privacy["consent-method"])},dispatch_event:function(e,t){var a=advads.privacy.state;advads.privacy.state=e,document.dispatchEvent(new CustomEvent("advanced_ads_privacy",{detail:{state:e,previousState:a,userAction:t}}))},is_ad_decoded:function(e){return null===document.querySelector('script[data-tcf="waiting-for-consent"][data-id="'+e+'"]')},decode_ad:function(e,t){t="boolean"!=typeof t||t;var a=decodeURIComponent(Array.prototype.map.call(atob(e.textContent),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));if(!t)return a;e.replaceWith(document.createRange().createContextualFragment(a))}}},(window.advanced_ads_ready||jQuery(document).ready).call(null,function(){advads.privacy.get_state()}),document.addEventListener("advanced_ads_privacy",function(e){"accepted"!==e.detail.state&&"not_needed"!==e.detail.state||e.detail.userAction||"loading"===document.readyState||document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"]').forEach(advads.privacy.decode_ad)}),jQuery(document).ready(function(){var i,s,d,c;!advads.supports_localstorage()||!localStorage.getItem("advads_frontend_picker")||window.advads_options.blog_id&&localStorage.getItem("advads_frontend_blog_id")&&window.advads_options.blog_id!==localStorage.getItem("advads_frontend_blog_id")||localStorage.getItem("advads_frontend_starttime")&&parseInt(localStorage.getItem("advads_frontend_starttime"),10)<(new Date).getTime()-27e5&&(localStorage.removeItem("advads_frontend_action"),localStorage.removeItem("advads_frontend_element"),localStorage.removeItem("advads_frontend_picker"),localStorage.removeItem("advads_prev_url"),localStorage.removeItem("advads_frontend_pathtype"),localStorage.removeItem("advads_frontend_boundary"),localStorage.removeItem("advads_frontend_blog_id"),localStorage.removeItem("advads_frontend_starttime"),!void advads.set_cookie("advads_frontend_picker","",-1))||(s=jQuery("<div id='advads-picker-overlay'>"),d=[document.body,document.documentElement,document],s.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),"true"===localStorage.getItem("advads_frontend_boundary")&&jQuery("body").css("cursor","not-allowed"),window.advads.is_boundary_reached=function(e){if("true"!==localStorage.getItem("advads_frontend_boundary"))return!1;$advads_picker_cur=jQuery(e);var t=jQuery(".advads-frontend-picker-boundary-helper");return $boundaries=t.parent(),$boundaries.css("cursor","pointer"),$advads_picker_cur.is($boundaries)||!$advads_picker_cur.closest($boundaries).length},c="xpath"===localStorage.getItem("advads_frontend_pathtype")?"getXPath":"getPath",jQuery(document).mousemove(function(e){if(e.target!==i){if(~d.indexOf(e.target))return i=null,void s.hide();var t=jQuery(e.target),a=t.offset(),o=t.outerWidth(),n=t.outerHeight();i=e.target;var r=jQuery(i)[c]();r&&(console.log(r),s.css({top:a.top,left:a.left,width:o,height:n}).show())}}),jQuery(document).click(function(e){var t=jQuery(i)[c]();advads.is_boundary_reached(i)||(localStorage.setItem("advads_frontend_element",t),window.location=localStorage.getItem("advads_prev_url"))}))}),jQuery.fn.extend({getPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("html"))return"html > "+e;if(3===t)return e;var a=this.get(0).nodeName.toLowerCase(),o=this.attr("id"),n=this.attr("class");return t+=1,void 0===o||/\d/.test(o)?void 0!==n&&(n=n.split(/[\s\n]+/),(n=jQuery.grep(n,function(e,t){return!/\d/.test(e)})).length&&(a+="."+n.slice(0,2).join("."))):a+="#"+o,this.siblings(a).length&&(a+=":eq("+this.siblings(a).addBack().not("#advads-picker-overlay").index(this)+")"),""===e?this.parent().getPath(a,t):this.parent().getPath(a+" > "+e,t)},getXPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("body")||3===t)return e;if(advads.is_boundary_reached(this))return e;var a,o=this.get(0).nodeName.toLowerCase(),n=o,r=this.attr("id"),i=this.attr("class"),s=[];if(void 0!==r&&!/\d/.test(r))return n+'[@id and id="'+r+'"]/'+e;if(void 0!==i&&(i=i.split(/[\s\n]+/),(i=jQuery.grep(i,function(e,t){return!/\d/.test(e)})).length)){t+=1;for(var s=i.slice(0,2),d=[],c=0;c<s.length;c++)d.push('(@class and contains(concat(" ", normalize-space(@class), " "), " '+s[c]+' "))');n+="["+d.join(" and ")+"]"}return(a=s.length?this.siblings(o+"."+s.join(".")):this.siblings(o)).length&&(n+="["+a.addBack().not("#advads-picker-overlay").index(this)+"]"),""===e?this.parent().getXPath(n,t):this.parent().getXPath(n+"/"+e,t)}});
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 1.19.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -182,6 +182,7 @@ Advanced Ads integrates with plenty of other plugins:
182
  - bbPress – [How to show ads on bbPress pages?](https://wpadvancedads.com/ads-in-bbpress/)
183
  - Cookie Consent, Borlabs Cookies, Complianz and other content manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
184
  - Paid Memberships Pro – [How to manage ads on membership sites running Paid Memberships Pro](https://wpadvancedads.com/paid-memberships-pro/)
 
185
 
186
  == Installation ==
187
 
@@ -224,14 +225,15 @@ To get started, just take a look at
224
 
225
  = What about my users’ privacy and GDPR? =
226
 
227
- Advanced Ads itself does neither save personal information (e.g., an IP address) in your database nor cookies in the visitor’s browser.
228
 
229
- The plugin comes with Privacy settings which help you to gather consent from users before showing ads to them. This works for any ads managed with the plugin, including AdSense Auto ads.
 
230
 
231
- Once you enable the Privacy module in the plugin settings, Advanced Ads blockes all ads until the user gives their consent. You can disable that check for individual ads as well (e.g., for image ads).
232
- You can also deliver non-personalized AdSense ads when that is legally allowed in your area before the consent is given.
233
 
234
- See also [GDPR support](https://wpadvancedads.com/manual/ad-cookie-consent/).
235
 
236
  You can learn more about how Advanced Ads and its add-ons handles data and privacy of your visitors [on this page](https://wpadvancedads.com/manual/privacy-information-for-users/).
237
 
@@ -315,12 +317,14 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
315
 
316
  == Changelog ==
317
 
318
- = untagged =
319
 
 
320
  - improve timezone methods `Advanced_Ads_Utils::get_wp_timezone()` and `Advanced_Ads_Utils::get_timezone_name()`
321
  - Divi theme: made content injection work with the "Unlimited ad injection" setting disabled
322
  - added missing spaces to image ad tags to fix Cache-Busting issue
323
- - integrate with TCF 2.0 compatible consent management platforms
 
324
 
325
  = 1.19.1 =
326
 
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 1.20.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
182
  - bbPress – [How to show ads on bbPress pages?](https://wpadvancedads.com/ads-in-bbpress/)
183
  - Cookie Consent, Borlabs Cookies, Complianz and other content manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
184
  - Paid Memberships Pro – [How to manage ads on membership sites running Paid Memberships Pro](https://wpadvancedads.com/paid-memberships-pro/)
185
+ - IAB TCF 2.0 consent – hide ads until users give their consent. Integrating with any CMP, Quantcast Choices, iubenda, Google Funding Choices, cookiebot, etc.
186
 
187
  == Installation ==
188
 
225
 
226
  = What about my users’ privacy and GDPR? =
227
 
228
+ The plugin comes with Privacy settings that help you gather consent from users before showing ads to them. The feature works for any ads managed with the plugin, including AdSense Auto ads.
229
 
230
+ Once you enable one of the Privacy options, Advanced Ads blocks ads that need consent until it is given. You can disable that check for individual ads as well (e.g., for image ads).
231
+ You can also deliver non-personalized AdSense ads when that is legally allowed in your area.
232
 
233
+ - [Cookie consent integration](https://wpadvancedads.com/manual/ad-cookie-consent/).
234
+ - [IAB TCF 2.0 integration](https://wpadvancedads.com/manual/tcf-consent-wordpress/).
235
 
236
+ Advanced Ads itself does neither save personal information (e.g., an IP address) in your database nor cookies in the visitor’s browser.
237
 
238
  You can learn more about how Advanced Ads and its add-ons handles data and privacy of your visitors [on this page](https://wpadvancedads.com/manual/privacy-information-for-users/).
239
 
317
 
318
  == Changelog ==
319
 
320
+ = 1.20.0 =
321
 
322
+ - integrate with TCF 2.0 compatible consent management platforms, e.g., Quantcast Choices
323
  - improve timezone methods `Advanced_Ads_Utils::get_wp_timezone()` and `Advanced_Ads_Utils::get_timezone_name()`
324
  - Divi theme: made content injection work with the "Unlimited ad injection" setting disabled
325
  - added missing spaces to image ad tags to fix Cache-Busting issue
326
+ - made ad centering work when right and left margin are set
327
+ - add ad health check if __tcfapi responds but the privacy module is either not enabled or not set to TCF 2.0
328
 
329
  = 1.19.1 =
330