Advanced Ads - Version 1.27.0

Version Description

  • Improvement: prevent issues with functionality from other plugins that delay JavaScript execution (WP Rocket, Complianz, et al.).
  • Improvement: unify the layout of the Next buttons in the ad Wizard
  • Improvement: add the updated AdSense code. Added a filter to continue using the old AdSense code. Learn more
  • Improvement: update Ad Block Counter to work with Google Analytics 4 properties
  • Fix: ensure Ad Admin can save AdSense, Privacy, and License settings
  • Fix: prevent error when "Remove data on uninstall" option is set due to uninitialised constants
  • Fix: ad edit button for ads delivered using groups
  • Fix: improve compatibility with PHP 8 by removing default values from required function parameters
Download this release

Release Info

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

Code changes from version 1.26.0 to 1.27.0

Files changed (39) hide show
  1. admin/includes/class-ad-network.php +13 -0
  2. admin/includes/class-ad-type.php +2 -3
  3. admin/includes/class-admin-upgrades.php +57 -2
  4. admin/includes/class-menu.php +0 -7
  5. admin/includes/class-overview-widgets.php +1 -1
  6. admin/includes/class-settings.php +36 -1
  7. admin/views/ad-info-bottom.php +11 -6
  8. admin/views/conditions/display-conditions-list.php +23 -11
  9. advanced-ads.php +2 -2
  10. classes/ad.php +12 -7
  11. classes/ad_group.php +1 -1
  12. classes/compatibility.php +62 -7
  13. classes/display-conditions.php +9 -9
  14. classes/frontend_checks.php +1 -23
  15. classes/plugin.php +26 -12
  16. classes/visitor-conditions.php +1 -1
  17. languages/advanced-ads.pot +116 -102
  18. modules/ad-blocker/main.php +17 -17
  19. modules/adblock-finder/admin/admin.php +8 -1
  20. modules/adblock-finder/admin/views/setting-ga.php +24 -2
  21. modules/adblock-finder/public/adblocker-enabled.js +53 -0
  22. modules/adblock-finder/public/adblocker-enabled.min.js +1 -0
  23. modules/adblock-finder/public/ga-adblock-counter.js +49 -0
  24. modules/adblock-finder/public/ga-adblock-counter.min.js +1 -0
  25. modules/adblock-finder/public/public.php +33 -22
  26. modules/adblock-finder/public/script.js +0 -101
  27. modules/adblock-finder/public/script.min.js +0 -1
  28. modules/gadsense/includes/class-ad-type-adsense.php +22 -2
  29. modules/gadsense/public/public.php +9 -1
  30. modules/gadsense/public/templates/page-level.php +12 -11
  31. modules/privacy/admin/admin.php +13 -0
  32. public/assets/js/advanced.js +2 -12
  33. public/assets/js/advanced.min.js +1 -1
  34. public/assets/js/ready-queue.js +9 -0
  35. public/assets/js/ready-queue.min.js +1 -0
  36. public/assets/js/ready.js +21 -25
  37. public/assets/js/ready.min.js +1 -1
  38. public/class-advanced-ads.php +15 -9
  39. readme.txt +12 -1
admin/includes/class-ad-network.php CHANGED
@@ -174,6 +174,19 @@ abstract class Advanced_Ads_Ad_Network {
174
  array( $this, 'sanitize_settings_callback' )
175
  );
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  // add a new section.
178
  add_settings_section(
179
  $this->settings_section_id,
174
  array( $this, 'sanitize_settings_callback' )
175
  );
176
 
177
+ /**
178
+ * Allow Ad Admin to save AdSense options.
179
+ *
180
+ * @param array $settings Array with allowed options.
181
+ *
182
+ * @return array
183
+ */
184
+ add_filter( 'advanced-ads-ad-admin-options', function( $options ) {
185
+ $options[] = ADVADS_SLUG . '-' . $this->identifier;
186
+
187
+ return $options;
188
+ } );
189
+
190
  // add a new section.
191
  add_settings_section(
192
  $this->settings_section_id,
admin/includes/class-ad-type.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
- defined( 'ABSPATH' ) || exit;
3
 
4
  /**
5
  * Class Advanced_Ads_Admin_Ad_Type
@@ -754,12 +753,12 @@ class Advanced_Ads_Admin_Ad_Type {
754
  /**
755
  * Add information below the ad edit form
756
  *
757
- * @param object $post WordPress Post object.
758
  *
759
  * @since 1.7.3
760
  */
761
  public function edit_form_end( $post ) {
762
- if ( ! isset( $post->post_type ) || $post->post_type !== $this->post_type ) {
763
  return;
764
  }
765
 
1
  <?php
 
2
 
3
  /**
4
  * Class Advanced_Ads_Admin_Ad_Type
753
  /**
754
  * Add information below the ad edit form
755
  *
756
+ * @param WP_Post $post WordPress Post object.
757
  *
758
  * @since 1.7.3
759
  */
760
  public function edit_form_end( $post ) {
761
+ if ( $post->post_type !== $this->post_type ) {
762
  return;
763
  }
764
 
admin/includes/class-admin-upgrades.php CHANGED
@@ -16,6 +16,10 @@ class Advanced_Ads_Admin_Upgrades {
16
  add_filter( 'advanced-ads-ad-notices', array( $this, 'ad_notices' ), 10, 3 );
17
  // Show AMP options on ad edit page of AdSense ads.
18
  add_action( 'advanced-ads-gadsense-extra-ad-param', array( $this, 'adsense_type_amp_options' ) );
 
 
 
 
19
  }
20
 
21
  /**
@@ -56,7 +60,6 @@ class Advanced_Ads_Admin_Upgrades {
56
  * @param string $utm_campaign utm_campaign value to attach to the URL.
57
  */
58
  public static function upgrade_link( $title = '', $url = '', $utm_campaign = '' ) {
59
-
60
  $title = ! empty( $title ) ? $title : __( 'Upgrade', 'advanced-ads' );
61
  $url = ! empty( $url ) ? $url : ADVADS_URL . 'add-ons/';
62
  $utm_parameter_base = '#utm_source=advanced-ads&utm_medium=link&utm_campaign=';
@@ -75,7 +78,6 @@ class Advanced_Ads_Admin_Upgrades {
75
  * @deprecated use upgrade_link()
76
  */
77
  public static function pro_feature_link( $utm_campaign = '' ) {
78
-
79
  self::upgrade_link(
80
  __( 'Pro Feature', 'advanced-ads' ),
81
  ADVADS_URL . 'add-ons/advanced-ads-pro/',
@@ -118,4 +120,57 @@ class Advanced_Ads_Admin_Upgrades {
118
  include ADVADS_BASE_PATH . 'admin/views/upgrades/adsense-amp.php';
119
  }
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
16
  add_filter( 'advanced-ads-ad-notices', array( $this, 'ad_notices' ), 10, 3 );
17
  // Show AMP options on ad edit page of AdSense ads.
18
  add_action( 'advanced-ads-gadsense-extra-ad-param', array( $this, 'adsense_type_amp_options' ) );
19
+ // Add Duplicate link to ad overview list.
20
+ add_filter( 'post_row_actions', array( $this, 'render_duplicate_link' ), 10, 2 );
21
+ // Add Duplicate link to post submit box.
22
+ add_action( 'post_submitbox_start', array( $this, 'render_duplicate_link_in_submit_box' ) );
23
  }
24
 
25
  /**
60
  * @param string $utm_campaign utm_campaign value to attach to the URL.
61
  */
62
  public static function upgrade_link( $title = '', $url = '', $utm_campaign = '' ) {
 
63
  $title = ! empty( $title ) ? $title : __( 'Upgrade', 'advanced-ads' );
64
  $url = ! empty( $url ) ? $url : ADVADS_URL . 'add-ons/';
65
  $utm_parameter_base = '#utm_source=advanced-ads&utm_medium=link&utm_campaign=';
78
  * @deprecated use upgrade_link()
79
  */
80
  public static function pro_feature_link( $utm_campaign = '' ) {
 
81
  self::upgrade_link(
82
  __( 'Pro Feature', 'advanced-ads' ),
83
  ADVADS_URL . 'add-ons/advanced-ads-pro/',
120
  include ADVADS_BASE_PATH . 'admin/views/upgrades/adsense-amp.php';
121
  }
122
  }
123
+
124
+ /**
125
+ * Add the link to action list for post_row_actions
126
+ *
127
+ * @param array $actions list of existing actions.
128
+ * @param WP_Post $post Post object.
129
+ *
130
+ * @return array with actions.
131
+ */
132
+ public function render_duplicate_link( $actions, $post ) {
133
+ if (
134
+ ! defined( 'AAP_VERSION' )
135
+ && Advanced_Ads::POST_TYPE_SLUG === $post->post_type
136
+ && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) )
137
+ ) {
138
+ $actions['copy-ad'] = $this->create_duplicate_link();
139
+ }
140
+
141
+ return $actions;
142
+ }
143
+
144
+ /**
145
+ * Add the link to the submit box on the ad edit screen.
146
+ */
147
+ public function render_duplicate_link_in_submit_box() {
148
+ global $post;
149
+ if (
150
+ ! defined( 'AAP_VERSION' )
151
+ && $post->filter === 'edit' // only for already saved ads.
152
+ && Advanced_Ads::POST_TYPE_SLUG === $post->post_type
153
+ && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) )
154
+ ) {
155
+ ?>
156
+ <div>
157
+ <?php echo wp_kses_post( $this->create_duplicate_link() ); ?>
158
+ </div>
159
+ <?php
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Generate text and upgrade link for the Duplicate function
165
+ */
166
+ public function create_duplicate_link() {
167
+ ob_start();
168
+ self::upgrade_link( null, ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=1742', 'duplicate-ad' );
169
+
170
+ return sprintf(
171
+ '%1$s (%2$s)',
172
+ esc_html__( 'Duplicate', 'advanced-ads' ),
173
+ trim( ob_get_clean() )
174
+ );
175
+ }
176
  }
admin/includes/class-menu.php CHANGED
@@ -182,13 +182,6 @@ class Advanced_Ads_Admin_Menu {
182
  }
183
  }
184
 
185
- add_filter(
186
- 'option_page_capability_' . ADVADS_SLUG,
187
- function () {
188
- return Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' );
189
- }
190
- );
191
-
192
  /**
193
  * Allows extensions to insert sub menu pages.
194
  *
182
  }
183
  }
184
 
 
 
 
 
 
 
 
185
  /**
186
  * Allows extensions to insert sub menu pages.
187
  *
admin/includes/class-overview-widgets.php CHANGED
@@ -82,7 +82,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
82
  * @param string $position context in which to show the box.
83
  * @param callable $callback function that fills the box with the desired content.
84
  */
85
- public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ) {
86
  ob_start();
87
  call_user_func( array( 'Advanced_Ads_Overview_Widgets_Callbacks', $callback ) );
88
  do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
82
  * @param string $position context in which to show the box.
83
  * @param callable $callback function that fills the box with the desired content.
84
  */
85
+ public static function add_meta_box( $id, $title, $position, $callback ) {
86
  ob_start();
87
  call_user_func( array( 'Advanced_Ads_Overview_Widgets_Callbacks', $callback ) );
88
  do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
admin/includes/class-settings.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
- defined( 'ABSPATH' ) || exit;
3
 
4
  /**
5
  * Class Advanced_Ads_Admin_Settings
@@ -18,6 +17,9 @@ class Advanced_Ads_Admin_Settings {
18
  private function __construct() {
19
  // settings handling.
20
  add_action( 'admin_init', array( $this, 'settings_init' ) );
 
 
 
21
  }
22
 
23
  /**
@@ -108,6 +110,19 @@ class Advanced_Ads_Admin_Settings {
108
  // register license settings.
109
  register_setting( ADVADS_SLUG . '-licenses', ADVADS_SLUG . '-licenses' );
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  add_settings_section(
112
  'advanced_ads_settings_license_section',
113
  '',
@@ -248,6 +263,26 @@ class Advanced_Ads_Admin_Settings {
248
  do_action( 'advanced-ads-settings-init', $hook );
249
  }
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  /**
252
  * Add license tab
253
  *
1
  <?php
 
2
 
3
  /**
4
  * Class Advanced_Ads_Admin_Settings
17
  private function __construct() {
18
  // settings handling.
19
  add_action( 'admin_init', array( $this, 'settings_init' ) );
20
+
21
+ // add ad admin capabilities for settings.
22
+ add_action( 'admin_init', array( $this, 'settings_capabilities' ), 20 );
23
  }
24
 
25
  /**
110
  // register license settings.
111
  register_setting( ADVADS_SLUG . '-licenses', ADVADS_SLUG . '-licenses' );
112
 
113
+ /**
114
+ * Allow Ad Admin to save license settings..
115
+ *
116
+ * @param array $settings Array with allowed options.
117
+ *
118
+ * @return array
119
+ */
120
+ add_filter( 'advanced-ads-ad-admin-options', function( $options ) {
121
+ $options[] = ADVADS_SLUG . '-licenses';
122
+
123
+ return $options;
124
+ } );
125
+
126
  add_settings_section(
127
  'advanced_ads_settings_license_section',
128
  '',
263
  do_action( 'advanced-ads-settings-init', $hook );
264
  }
265
 
266
+ /**
267
+ * Make sure ad admin can save options.
268
+ * Add a filter on `admin_init` priority 20 to allow other modules/add-ons to add their options.
269
+ * Filter option_page_capability_ with the appropriate slug in return to allow the Ad Admin user role to save these settings/options.
270
+ */
271
+ public function settings_capabilities() {
272
+ $ad_admin_options = array( ADVADS_SLUG );
273
+ /**
274
+ * Filters all options that the Ad Admin Role should have access to.
275
+ *
276
+ * @param array $ad_admin_options Array with option names.
277
+ */
278
+ $ad_admin_options = apply_filters( 'advanced-ads-ad-admin-options', $ad_admin_options );
279
+ foreach ( $ad_admin_options as $ad_admin_option ) {
280
+ add_filter( 'option_page_capability_' . $ad_admin_option, function() {
281
+ return Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' );
282
+ } );
283
+ }
284
+ }
285
+
286
  /**
287
  * Add license tab
288
  *
admin/views/ad-info-bottom.php CHANGED
@@ -7,16 +7,21 @@
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
  * @copyright since 2013 Thomas Maier, Advanced Ads GmbH
 
 
10
  */
11
 
12
  ?><div id="advads-wizard-controls" class="hidden">
13
  <button type="button" id="advads-wizard-controls-prev" class="button button-secondary button-large"><span class="dashicons dashicons-controls-back"></span>&nbsp;<?php echo esc_attr_x( 'previous', 'wizard navigation', 'advanced-ads' ); ?></button>
14
- <input type="submit" id="advads-wizard-controls-save" class="button button-primary button-large" value="
15
- <?php
16
- // display different message depending on a new ad (filter = raw) or existing one.
17
- echo ( isset( $post->filter ) && 'raw' === $post->filter ) ? esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' ) : esc_attr_x( 'save', 'wizard navigation', 'advanced-ads' );
18
- ?>
19
- "/>
 
 
 
20
  <button type="button" id="advads-wizard-controls-next" class="button button-primary button-large"><?php echo esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' ); ?>&nbsp;<span class="dashicons dashicons-controls-forward"></span></button>
21
  <p><a href="javascript:void(0)" class="advads-stop-wizard"><?php esc_attr_e( 'Stop Wizard and show all options', 'advanced-ads' ); ?></a></p>
22
  </div>
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
  * @copyright since 2013 Thomas Maier, Advanced Ads GmbH
10
+ *
11
+ * @var WP_Post $post The ad WP post object.
12
  */
13
 
14
  ?><div id="advads-wizard-controls" class="hidden">
15
  <button type="button" id="advads-wizard-controls-prev" class="button button-secondary button-large"><span class="dashicons dashicons-controls-back"></span>&nbsp;<?php echo esc_attr_x( 'previous', 'wizard navigation', 'advanced-ads' ); ?></button>
16
+ <button id="advads-wizard-controls-save" class="button button-primary button-large">
17
+ <?php
18
+ // display different message depending on a new ad (filter = raw) or an existing one.
19
+ echo $post->filter === 'raw'
20
+ ? esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' )
21
+ : esc_attr_x( 'save', 'wizard navigation', 'advanced-ads' );
22
+ ?>
23
+ <span class="dashicons dashicons-controls-forward"></span>
24
+ </button>
25
  <button type="button" id="advads-wizard-controls-next" class="button button-primary button-large"><?php echo esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' ); ?>&nbsp;<span class="dashicons dashicons-controls-forward"></span></button>
26
  <p><a href="javascript:void(0)" class="advads-stop-wizard"><?php esc_attr_e( 'Stop Wizard and show all options', 'advanced-ads' ); ?></a></p>
27
  </div>
admin/views/conditions/display-conditions-list.php CHANGED
@@ -5,10 +5,12 @@
5
  $i = 0;
6
  if ( is_array( $set_conditions ) ) :
7
  foreach ( $set_conditions as $_index => $_options ) :
8
- $show_or_force_warning = false;
 
9
  // get type attribute from previous option format.
10
  $_options['type'] = isset( $_options['type'] ) ? $_options['type'] : $_index;
11
  $connector = ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
 
12
  if ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['metabox'] ) ) {
13
  $metabox = $conditions[ $_options['type'] ]['metabox'];
14
  } else {
@@ -23,14 +25,19 @@
23
  */
24
  $tax = ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['taxonomy'] ) ) ? $conditions[ $_options['type'] ]['taxonomy'] : false;
25
  $last_tax = ( isset( $set_conditions[ $last_index ]['type'] ) && isset( $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] ) ) ? $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] : false;
26
- if ( $tax && $last_tax && $last_tax === $tax
27
- && ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] )
28
- && 'is' === $_options['operator'] && 'is' === $set_conditions[ $last_index ]['operator']
29
- && $_options['type'] !== $set_conditions[ $last_index ]['type'] ) {
30
-
 
31
  $show_or_force_warning = true;
32
  }
33
 
 
 
 
 
34
  if ( $i > 0 ) :
35
 
36
  ?>
@@ -38,12 +45,17 @@
38
  <td colspan="3">
39
  <?php
40
  echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
41
- if ( $show_or_force_warning ) {
42
  ?>
43
- <p class="advads-error-message" style="display:block;">
44
  <?php
45
- esc_attr_e( 'Forced to OR.', 'advanced-ads' );
46
- echo '&nbsp;<a target="_blank" href="' . esc_url( ADVADS_URL ) . 'manual/display-conditions#manual-combining-multiple-conditions">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
 
 
 
 
 
47
  ?>
48
  </p>
49
  <?php
@@ -71,4 +83,4 @@
71
  endif;
72
  ?>
73
  </tbody>
74
- </table>
5
  $i = 0;
6
  if ( is_array( $set_conditions ) ) :
7
  foreach ( $set_conditions as $_index => $_options ) :
8
+ $show_or_force_warning = false;
9
+ $show_is_not_or_warning = false;
10
  // get type attribute from previous option format.
11
  $_options['type'] = isset( $_options['type'] ) ? $_options['type'] : $_index;
12
  $connector = ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
13
+ $operator = ! isset( $_options['operator'] ) || $_options['operator'] !== 'is_not' ? 'is' : 'is_not';
14
  if ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['metabox'] ) ) {
15
  $metabox = $conditions[ $_options['type'] ]['metabox'];
16
  } else {
25
  */
26
  $tax = ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['taxonomy'] ) ) ? $conditions[ $_options['type'] ]['taxonomy'] : false;
27
  $last_tax = ( isset( $set_conditions[ $last_index ]['type'] ) && isset( $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] ) ) ? $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] : false;
28
+ if (
29
+ $tax && $last_tax && $last_tax === $tax
30
+ && ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] )
31
+ && 'is' === $operator && 'is' === $set_conditions[ $last_index ]['operator']
32
+ && $_options['type'] !== $set_conditions[ $last_index ]['type']
33
+ ) {
34
  $show_or_force_warning = true;
35
  }
36
 
37
+ if ( 'is_not' === $operator && 'or' === $connector && 'is_not' === $set_conditions[ $last_index ]['operator'] ) {
38
+ $show_is_not_or_warning = true;
39
+ }
40
+
41
  if ( $i > 0 ) :
42
 
43
  ?>
45
  <td colspan="3">
46
  <?php
47
  echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
48
+ if ( $show_or_force_warning || $show_is_not_or_warning ) {
49
  ?>
50
+ <p class="advads-error-message" style="display: block;">
51
  <?php
52
+ if ( $show_or_force_warning ) {
53
+ esc_attr_e( 'Forced to OR.', 'advanced-ads' );
54
+ echo '&nbsp;<a target="_blank" href="' . esc_url( ADVADS_URL ) . 'manual/display-conditions#manual-combining-multiple-conditions">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
55
+ } else {
56
+ esc_attr_e( 'The ad might always show due to OR and "is not". Better use AND.', 'advanced-ads' );
57
+ echo '&nbsp;<a target="_blank" href="' . esc_url( ADVADS_URL ) . 'manual/display-conditions/#Combining_conditions_with_AND_and_OR">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
58
+ }
59
  ?>
60
  </p>
61
  <?php
83
  endif;
84
  ?>
85
  </tbody>
86
+ </table>
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.26.0
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.26.0' );
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.27.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.27.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/ad.php CHANGED
@@ -940,6 +940,18 @@ class Advanced_Ads_Ad {
940
  $wrapper_options = $this->inline_css->add_css( $wrapper_options, $this->options['inline-css'], $this->global_output );
941
  }
942
 
 
 
 
 
 
 
 
 
 
 
 
 
943
  if ( ( ! isset( $this->output['wrapper-id'] ) || '' === $this->output['wrapper-id'] )
944
  && array() === $wrapper_options || ! is_array( $wrapper_options ) ) {
945
  return $this->label . $ad_content;
@@ -951,13 +963,6 @@ class Advanced_Ads_Ad {
951
  $this->wrapper['id'] = $wrapper_options['id'];
952
  }
953
 
954
- // add edit button for users with the appropriate rights.
955
- if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
956
- ob_start();
957
- include ADVADS_BASE_PATH . 'public/views/ad-edit-bar.php';
958
- $ad_content = ob_get_clean() . $ad_content;
959
- }
960
-
961
  // build the box
962
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
963
  $wrapper .= $this->label;
940
  $wrapper_options = $this->inline_css->add_css( $wrapper_options, $this->options['inline-css'], $this->global_output );
941
  }
942
 
943
+ if (
944
+ ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' )
945
+ // Add edit button for users with the appropriate rights.
946
+ && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) )
947
+ // We need a wrapper. Check if at least the placement wrapper exists.
948
+ && ! empty( $this->args['placement_type'] )
949
+ ) {
950
+ ob_start();
951
+ include ADVADS_BASE_PATH . 'public/views/ad-edit-bar.php';
952
+ $ad_content = trim( ob_get_clean() ) . $ad_content;
953
+ }
954
+
955
  if ( ( ! isset( $this->output['wrapper-id'] ) || '' === $this->output['wrapper-id'] )
956
  && array() === $wrapper_options || ! is_array( $wrapper_options ) ) {
957
  return $this->label . $ad_content;
963
  $this->wrapper['id'] = $wrapper_options['id'];
964
  }
965
 
 
 
 
 
 
 
 
966
  // build the box
967
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
968
  $wrapper .= $this->label;
classes/ad_group.php CHANGED
@@ -403,7 +403,7 @@ class Advanced_Ads_Group {
403
  * @param arr $weights ad weights
404
  * @return arr $shuffled_ads shuffled array with ad ids
405
  */
406
- public function shuffle_ads($ads = array(), $weights) {
407
 
408
  // get a random ad for every ad there is
409
  $shuffled_ads = array();
403
  * @param arr $weights ad weights
404
  * @return arr $shuffled_ads shuffled array with ad ids
405
  */
406
+ public function shuffle_ads($ads, $weights) {
407
 
408
  // get a random ad for every ad there is
409
  $shuffled_ads = array();
classes/compatibility.php CHANGED
@@ -3,6 +3,12 @@
3
  * Compatibility fixes with other plugins.
4
  */
5
  class Advanced_Ads_Compatibility {
 
 
 
 
 
 
6
 
7
  /**
8
  * Advanced_Ads_Compatibility constructor.
@@ -20,9 +26,9 @@ class Advanced_Ads_Compatibility {
20
  1
21
  );
22
  }
23
- if ( defined( 'WP_ROCKET_VERSION' ) ) {
24
- add_filter( 'rocket_excluded_inline_js_content', array( $this, 'exclude_inline_js' ) );
25
- }
26
  // WPML.
27
  add_filter( 'wpml_admin_language_switcher_active_languages', array( $this, 'wpml_language_switcher' ) );
28
  // WordPress SEO by Yoast.
@@ -41,6 +47,11 @@ class Advanced_Ads_Compatibility {
41
  // Check if Verification code & Auto ads ads can be displayed.
42
  add_filter( 'advanced-ads-can-display-ads-in-header', array( $this, 'borlabs_cookie_can_add_auto_ads_code' ), 10 );
43
  }
 
 
 
 
 
44
  }
45
 
46
  /**
@@ -64,13 +75,33 @@ class Advanced_Ads_Compatibility {
64
  * and outputted into the footer. This is needed because WP Rocket does not output all
65
  * the code that depends on this function into the footer.
66
  *
67
- * @param array $pattern Patterns to match in inline JS content.
 
68
  * @return array
69
  */
70
- public function exclude_inline_js( $pattern ) {
71
- $pattern[] = 'advanced_ads_ready';
 
72
 
73
- return $pattern;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  /**
@@ -323,4 +354,28 @@ class Advanced_Ads_Compatibility {
323
 
324
  return $meta_boxes;
325
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
3
  * Compatibility fixes with other plugins.
4
  */
5
  class Advanced_Ads_Compatibility {
6
+ /**
7
+ * Array that holds strings that should not be optimized by other plugins.
8
+ *
9
+ * @var array
10
+ */
11
+ private $critical_inline_js;
12
 
13
  /**
14
  * Advanced_Ads_Compatibility constructor.
26
  1
27
  );
28
  }
29
+ // WP Rocket
30
+ add_filter( 'rocket_excluded_inline_js_content', array( $this, 'rocket_exclude_inline_js' ) );
31
+ add_filter( 'rocket_delay_js_exclusions', array( $this, 'rocket_exclude_inline_js' ) );
32
  // WPML.
33
  add_filter( 'wpml_admin_language_switcher_active_languages', array( $this, 'wpml_language_switcher' ) );
34
  // WordPress SEO by Yoast.
47
  // Check if Verification code & Auto ads ads can be displayed.
48
  add_filter( 'advanced-ads-can-display-ads-in-header', array( $this, 'borlabs_cookie_can_add_auto_ads_code' ), 10 );
49
  }
50
+
51
+ // Make sure inline JS in head is executed when Complianz is set to block JS.
52
+ add_filter( 'cmplz_script_class', array( $this, 'complianz_exclude_inline_js' ), 10, 2 );
53
+
54
+ $this->critical_inline_js = $this->critical_inline_js();
55
  }
56
 
57
  /**
75
  * and outputted into the footer. This is needed because WP Rocket does not output all
76
  * the code that depends on this function into the footer.
77
  *
78
+ * @param array $exclusions Patterns to match in inline JS content.
79
+ *
80
  * @return array
81
  */
82
+ public function rocket_exclude_inline_js( $exclusions ) {
83
+ return array_merge( $exclusions, $this->critical_inline_js );
84
+ }
85
 
86
+ /**
87
+ * Prevent Complianz from suppressing our head inline script.
88
+ *
89
+ * @param string $class the class Complianz adds to the script, `cmplz-script` for prevented scripts, `cmplz-native` for allowed.
90
+ * @param string $total_match the script string.
91
+ *
92
+ * @return string
93
+ */
94
+ public function complianz_exclude_inline_js( $class, $total_match ) {
95
+ if ( $class === 'cmplz-native' ) {
96
+ return $class;
97
+ }
98
+ foreach ( $this->critical_inline_js as $critical_inline_js ) {
99
+ if ( strpos( $total_match, $critical_inline_js ) !== false ) {
100
+ return 'cmplz-native';
101
+ }
102
+ }
103
+
104
+ return $class;
105
  }
106
 
107
  /**
354
 
355
  return $meta_boxes;
356
  }
357
+
358
+ /**
359
+ * Get an array of strings to exclude when plugins "optimize" JS.
360
+ *
361
+ * @return array
362
+ */
363
+ private function critical_inline_js() {
364
+ $frontend_prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
365
+ $default = array(
366
+ sprintf( 'id="%sready"', $frontend_prefix ),
367
+ );
368
+ /**
369
+ * Filters an array of strings of (inline) JavaScript "identifiers" that should not be "optimized"/delayed etc.
370
+ *
371
+ * @param array $default Array of excluded patterns.
372
+ */
373
+ $exclusions = apply_filters( 'advanced-ads-compatibility-critical-inline-js', $default, $frontend_prefix );
374
+
375
+ if ( ! is_array( $exclusions ) ) {
376
+ $exclusions = $default;
377
+ }
378
+
379
+ return $exclusions;
380
+ }
381
  }
classes/display-conditions.php CHANGED
@@ -312,7 +312,7 @@ class Advanced_Ads_Display_Conditions {
312
  * @return string HTML for connector option.
313
  * @since 1.7.0.4
314
  */
315
- public static function render_connector_option( $index = 0, $value = 'or', $form_name ) {
316
 
317
  $label = ( 'or' === $value ) ? __( 'or', 'advanced-ads' ) : __( 'and', 'advanced-ads' );
318
 
@@ -842,7 +842,7 @@ class Advanced_Ads_Display_Conditions {
842
  *
843
  * @return bool true if can be displayed
844
  */
845
- public static function check_post_type( $options = array(), Advanced_Ads_Ad $ad ) {
846
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) ) {
847
  return false;
848
  }
@@ -873,7 +873,7 @@ class Advanced_Ads_Display_Conditions {
873
  *
874
  * @return bool true if can be displayed
875
  */
876
- public static function check_author( $options = array(), Advanced_Ads_Ad $ad ) {
877
 
878
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) ) {
879
  return false;
@@ -904,7 +904,7 @@ class Advanced_Ads_Display_Conditions {
904
  *
905
  * @return bool true if can be displayed
906
  */
907
- public static function check_taxonomies( $options = array(), Advanced_Ads_Ad $ad ) {
908
 
909
  if ( ! isset( $options['value'] ) ) {
910
  return false;
@@ -958,7 +958,7 @@ class Advanced_Ads_Display_Conditions {
958
  *
959
  * @return bool true if can be displayed
960
  */
961
- public static function check_taxonomy_archive( $options = array(), Advanced_Ads_Ad $ad ) {
962
 
963
  if ( ! isset( $options['value'] ) ) {
964
  return false;
@@ -992,7 +992,7 @@ class Advanced_Ads_Display_Conditions {
992
  *
993
  * @return bool true if can be displayed
994
  */
995
- public static function check_taxonomy( $options = array(), Advanced_Ads_Ad $ad ) {
996
 
997
  if ( ! isset( $options['value'] ) ) {
998
  return false;
@@ -1026,7 +1026,7 @@ class Advanced_Ads_Display_Conditions {
1026
  *
1027
  * @return bool true if can be displayed
1028
  */
1029
- public static function check_post_ids( $options = array(), Advanced_Ads_Ad $ad ) {
1030
 
1031
  if ( isset( $options['operator'] ) && 'is_not' === $options['operator'] ) {
1032
  $operator = 'is_not';
@@ -1080,7 +1080,7 @@ class Advanced_Ads_Display_Conditions {
1080
  *
1081
  * @return bool true if can be displayed
1082
  */
1083
- public static function check_general( $options = array(), Advanced_Ads_Ad $ad ) {
1084
 
1085
  // display by default.
1086
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) || ! count( $options['value'] ) ) {
@@ -1141,7 +1141,7 @@ class Advanced_Ads_Display_Conditions {
1141
  *
1142
  * @return bool true if can be displayed
1143
  */
1144
- public static function check_content_age( $options = array(), Advanced_Ads_Ad $ad ) {
1145
  global $post;
1146
 
1147
  $operator = ( isset( $options['operator'] ) && 'younger_than' === $options['operator'] ) ? 'younger_than' : 'older_than';
312
  * @return string HTML for connector option.
313
  * @since 1.7.0.4
314
  */
315
+ public static function render_connector_option( $index, $value, $form_name ) {
316
 
317
  $label = ( 'or' === $value ) ? __( 'or', 'advanced-ads' ) : __( 'and', 'advanced-ads' );
318
 
842
  *
843
  * @return bool true if can be displayed
844
  */
845
+ public static function check_post_type( $options, Advanced_Ads_Ad $ad ) {
846
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) ) {
847
  return false;
848
  }
873
  *
874
  * @return bool true if can be displayed
875
  */
876
+ public static function check_author( $options, Advanced_Ads_Ad $ad ) {
877
 
878
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) ) {
879
  return false;
904
  *
905
  * @return bool true if can be displayed
906
  */
907
+ public static function check_taxonomies( $options, Advanced_Ads_Ad $ad ) {
908
 
909
  if ( ! isset( $options['value'] ) ) {
910
  return false;
958
  *
959
  * @return bool true if can be displayed
960
  */
961
+ public static function check_taxonomy_archive( $options, Advanced_Ads_Ad $ad ) {
962
 
963
  if ( ! isset( $options['value'] ) ) {
964
  return false;
992
  *
993
  * @return bool true if can be displayed
994
  */
995
+ public static function check_taxonomy( $options, Advanced_Ads_Ad $ad ) {
996
 
997
  if ( ! isset( $options['value'] ) ) {
998
  return false;
1026
  *
1027
  * @return bool true if can be displayed
1028
  */
1029
+ public static function check_post_ids( $options, Advanced_Ads_Ad $ad ) {
1030
 
1031
  if ( isset( $options['operator'] ) && 'is_not' === $options['operator'] ) {
1032
  $operator = 'is_not';
1080
  *
1081
  * @return bool true if can be displayed
1082
  */
1083
+ public static function check_general( $options, Advanced_Ads_Ad $ad ) {
1084
 
1085
  // display by default.
1086
  if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) || ! count( $options['value'] ) ) {
1141
  *
1142
  * @return bool true if can be displayed
1143
  */
1144
+ public static function check_content_age( $options, Advanced_Ads_Ad $ad ) {
1145
  global $post;
1146
 
1147
  $operator = ( isset( $options['operator'] ) && 'younger_than' === $options['operator'] ) ? 'younger_than' : 'older_than';
classes/frontend_checks.php CHANGED
@@ -341,18 +341,6 @@ class Advanced_Ads_Frontend_Checks {
341
  )
342
  ) );
343
 
344
- // search for AdSense Verification and Auto ads code.
345
- $nodes[] = array( 'type' => 3, 'data' => array(
346
- 'parent' => 'advanced_ads_ad_health',
347
- 'id' => 'advanced_ads_ad_health_auto_ads_found',
348
- 'title' => __( 'Auto ads code found', 'advanced-ads' ),
349
- 'href' => ADVADS_URL . 'manual/ad-health/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adhealth-adsense-auto-ads-found#Auto_ads_code_found',
350
- 'meta' => array(
351
- 'class' => 'hidden advanced_ads_ad_health_auto_ads_found',
352
- 'target' => '_blank',
353
- ),
354
- ) );
355
-
356
  // link to highlight ads and jump from one ad to the next.
357
  $nodes[] = array( 'type' => 3, 'amp' => false, 'data' => array(
358
  'parent' => 'advanced_ads_ad_health',
@@ -829,7 +817,6 @@ class Advanced_Ads_Frontend_Checks {
829
  // show hint if AdSense Auto ads are enabled
830
  setTimeout( function(){
831
  advanced_ads_ready( advanced_ads_frontend_checks.advads_highlight_hidden_adsense );
832
- advanced_ads_ready( advads_highlight_adsense_auto_ads );
833
  }, 2000 );
834
 
835
  // highlight AdSense Auto Ads ads 3 seconds after site loaded
@@ -852,15 +839,6 @@ class Advanced_Ads_Frontend_Checks {
852
  }
853
  }
854
 
855
- // inform the user that AdSense Auto ads code was found
856
- function advads_highlight_adsense_auto_ads() {
857
- if (window.jQuery) {
858
- if (/script[^>]+data-ad-client|enable_page_level_ads:\s*true/.test(jQuery('head').html())) {
859
- var advads_autoads_code_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found');
860
- advads_autoads_code_link.className = advads_autoads_code_link.className.replace('hidden', '');
861
- }
862
- }
863
- }
864
  // show notice
865
  // @param notice
866
  function advads_frontend_notice( notice = '' ){
@@ -1030,7 +1008,7 @@ class Advanced_Ads_Frontend_Checks {
1030
  * @param obj $ad Advanced_Ads_Ad
1031
  * @return str $content ad content
1032
  */
1033
- public function after_ad_output( $content = '', Advanced_Ads_Ad $ad ) {
1034
  if ( ! isset( $ad->args['frontend-check'] ) ) { return $content; }
1035
 
1036
  if ( advads_is_amp() ) {
341
  )
342
  ) );
343
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  // link to highlight ads and jump from one ad to the next.
345
  $nodes[] = array( 'type' => 3, 'amp' => false, 'data' => array(
346
  'parent' => 'advanced_ads_ad_health',
817
  // show hint if AdSense Auto ads are enabled
818
  setTimeout( function(){
819
  advanced_ads_ready( advanced_ads_frontend_checks.advads_highlight_hidden_adsense );
 
820
  }, 2000 );
821
 
822
  // highlight AdSense Auto Ads ads 3 seconds after site loaded
839
  }
840
  }
841
 
 
 
 
 
 
 
 
 
 
842
  // show notice
843
  // @param notice
844
  function advads_frontend_notice( notice = '' ){
1008
  * @param obj $ad Advanced_Ads_Ad
1009
  * @return str $content ad content
1010
  */
1011
+ public function after_ad_output( $content, Advanced_Ads_Ad $ad ) {
1012
  if ( ! isset( $ad->args['frontend-check'] ) ) { return $content; }
1013
 
1014
  if ( advads_is_amp() ) {
classes/plugin.php CHANGED
@@ -59,7 +59,7 @@ class Advanced_Ads_Plugin {
59
  register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
60
  register_uninstall_hook( ADVADS_BASE, array( 'Advanced_Ads_Plugin', 'uninstall' ) );
61
 
62
- add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ), 10 );
63
  add_action( 'init', array( $this, 'run_upgrades' ), 9 );
64
  }
65
 
@@ -100,6 +100,8 @@ class Advanced_Ads_Plugin {
100
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
101
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
102
  add_action( 'wp_head', array( $this, 'print_head_scripts' ), 7 );
 
 
103
 
104
  // add short codes.
105
  add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
@@ -200,13 +202,6 @@ class Advanced_Ads_Plugin {
200
  * Print public-facing JavaScript in the HTML head.
201
  */
202
  public function print_head_scripts() {
203
- /**
204
- * Usage example in add-ons:
205
- * ( window.advanced_ads_ready || jQuery( document ).ready ).call( null, function() {
206
- * // Called when DOM is ready.
207
- * } );
208
- */
209
-
210
  $short_url = self::get_short_url();
211
  $attribution = '<!-- ' . $short_url . ' is managing ads with Advanced Ads%1$s%2$s -->';
212
  $version = self::is_new_user( 1585224000 ) ? ' ' . ADVADS_VERSION : '';
@@ -221,7 +216,7 @@ class Advanced_Ads_Plugin {
221
 
222
  ob_start();
223
  ?>
224
- <script>
225
  <?php
226
  readfile( sprintf(
227
  '%spublic/assets/js/ready%s.js',
@@ -231,10 +226,27 @@ class Advanced_Ads_Plugin {
231
  ?>
232
  </script>
233
  <?php
234
- // escaping would break our HTML here.
235
- // phpcs:ignore
236
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
 
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
 
240
  /**
@@ -644,7 +656,6 @@ class Advanced_Ads_Plugin {
644
 
645
  // Delete assets (main blog).
646
  Advanced_Ads_Ad_Blocker_Admin::get_instance()->clear_assets();
647
- delete_option( ADVADS_AB_SLUG );
648
  }
649
 
650
  }
@@ -701,6 +712,9 @@ class Advanced_Ads_Plugin {
701
  $base_widget_id = Advanced_Ads_Widget::get_base_id();
702
  delete_option( 'widget_' . $base_widget_id );
703
 
 
 
 
704
  do_action( 'advanced-ads-uninstall' );
705
 
706
  wp_cache_flush();
59
  register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
60
  register_uninstall_hook( ADVADS_BASE, array( 'Advanced_Ads_Plugin', 'uninstall' ) );
61
 
62
+ add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ), 20 );
63
  add_action( 'init', array( $this, 'run_upgrades' ), 9 );
64
  }
65
 
100
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
101
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
102
  add_action( 'wp_head', array( $this, 'print_head_scripts' ), 7 );
103
+ // higher priority to make sure other scripts are printed before.
104
+ add_action( 'wp_footer', array( $this, 'print_footer_scripts' ), 100 );
105
 
106
  // add short codes.
107
  add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
202
  * Print public-facing JavaScript in the HTML head.
203
  */
204
  public function print_head_scripts() {
 
 
 
 
 
 
 
205
  $short_url = self::get_short_url();
206
  $attribution = '<!-- ' . $short_url . ' is managing ads with Advanced Ads%1$s%2$s -->';
207
  $version = self::is_new_user( 1585224000 ) ? ' ' . ADVADS_VERSION : '';
216
 
217
  ob_start();
218
  ?>
219
+ <script id="<?php echo esc_attr( $this->get_frontend_prefix() ); ?>ready">
220
  <?php
221
  readfile( sprintf(
222
  '%spublic/assets/js/ready%s.js',
226
  ?>
227
  </script>
228
  <?php
229
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaping would break the HTML
 
230
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
231
+ }
232
 
233
+ /**
234
+ * Print inline scripts in wp_footer.
235
+ */
236
+ public function print_footer_scripts() {
237
+ if ( advads_is_amp() ) {
238
+ return;
239
+ }
240
+
241
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaping would break the HTML
242
+ echo Advanced_Ads_Utils::get_inline_asset(
243
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- we're getting the contents of a local file
244
+ sprintf( '<script>%s</script>', file_get_contents( sprintf(
245
+ '%spublic/assets/js/ready-queue%s.js',
246
+ ADVADS_BASE_PATH,
247
+ defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'
248
+ ) ) )
249
+ );
250
  }
251
 
252
  /**
656
 
657
  // Delete assets (main blog).
658
  Advanced_Ads_Ad_Blocker_Admin::get_instance()->clear_assets();
 
659
  }
660
 
661
  }
712
  $base_widget_id = Advanced_Ads_Widget::get_base_id();
713
  delete_option( 'widget_' . $base_widget_id );
714
 
715
+ // Ad blocker disquise.
716
+ delete_option( ADVADS_AB_SLUG );
717
+
718
  do_action( 'advanced-ads-uninstall' );
719
 
720
  wp_cache_flush();
classes/visitor-conditions.php CHANGED
@@ -306,7 +306,7 @@ class Advanced_Ads_Visitor_Conditions {
306
  *
307
  * @since 1.7.0.4
308
  */
309
- public static function render_connector_option( $index = 0, $value = 'or', $form_name ) {
310
 
311
  $label = ( 'or' === $value ) ? __( 'or', 'advanced-ads' ) : __( 'and', 'advanced-ads' );
312
 
306
  *
307
  * @since 1.7.0.4
308
  */
309
+ public static function render_connector_option( $index, $value, $form_name ) {
310
 
311
  $label = ( 'or' === $value ) ? __( 'or', 'advanced-ads' ) : __( 'and', 'advanced-ads' );
312
 
languages/advanced-ads.pot CHANGED
@@ -1,17 +1,17 @@
1
  # Copyright (C) 2021 Thomas Maier, Advanced Ads GmbH
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.26.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: 2021-07-21T10:55:09+02: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"
16
 
17
  #. Plugin Name of the plugin
@@ -339,124 +339,128 @@ msgstr ""
339
  msgid "No ad group created"
340
  msgstr ""
341
 
342
- #: admin/includes/class-ad-type.php:270
343
- #: admin/includes/class-ad-type.php:276
344
  msgid "Ad Details"
345
  msgstr ""
346
 
347
- #: admin/includes/class-ad-type.php:271
348
- #: admin/includes/class-ad-type.php:277
349
  msgid "Ad Planning"
350
  msgstr ""
351
 
352
- #: admin/includes/class-ad-type.php:272
353
- #: admin/includes/class-ad-type.php:278
354
  msgid "Ad Shortcode"
355
  msgstr ""
356
 
357
  #. translators: %s is the number of ads.
358
- #: admin/includes/class-ad-type.php:442
359
  msgid "%s ad updated."
360
  msgid_plural "%s ads updated."
361
  msgstr[0] ""
362
  msgstr[1] ""
363
 
364
  #. translators: %s is the number of ads.
365
- #: admin/includes/class-ad-type.php:444
366
  msgid "%s ad not updated, somebody is editing it."
367
  msgid_plural "%s ads not updated, somebody is editing them."
368
  msgstr[0] ""
369
  msgstr[1] ""
370
 
371
  #. translators: %s is the number of ads.
372
- #: admin/includes/class-ad-type.php:446
373
  msgid "%s ad permanently deleted."
374
  msgid_plural "%s ads permanently deleted."
375
  msgstr[0] ""
376
  msgstr[1] ""
377
 
378
  #. translators: %s is the number of ads.
379
- #: admin/includes/class-ad-type.php:448
380
  msgid "%s ad moved to the Trash."
381
  msgid_plural "%s ads moved to the Trash."
382
  msgstr[0] ""
383
  msgstr[1] ""
384
 
385
  #. translators: %s is the number of ads.
386
- #: admin/includes/class-ad-type.php:450
387
  msgid "%s ad restored from the Trash."
388
  msgid_plural "%s ads restored from the Trash."
389
  msgstr[0] ""
390
  msgstr[1] ""
391
 
392
  #. Translators: %s is the time the ad was first saved.
393
- #: admin/includes/class-ad-type.php:660
394
  msgid "Ad created on %s"
395
  msgstr ""
396
 
 
397
  #: admin/includes/class-ad-type.php:852
398
- #: admin/includes/class-ad-type.php:853
399
  msgid "Ad updated."
400
  msgstr ""
401
 
402
  #. translators: %s: date and time of the revision
403
- #: admin/includes/class-ad-type.php:854
404
  msgid "Ad restored to revision from %s"
405
  msgstr ""
406
 
 
407
  #: admin/includes/class-ad-type.php:855
408
- #: admin/includes/class-ad-type.php:856
409
  msgid "Ad saved."
410
  msgstr ""
411
 
412
- #: admin/includes/class-ad-type.php:857
413
  msgid "Ad submitted."
414
  msgstr ""
415
 
416
  #. translators: %1$s is a date.
417
- #: admin/includes/class-ad-type.php:860
418
  msgid "Ad scheduled for: <strong>%1$s</strong>."
419
  msgstr ""
420
 
421
  #. translators: Publish box date format, see http://php.net/date.
422
- #: admin/includes/class-ad-type.php:862
423
  msgid "M j, Y @ G:i"
424
  msgstr ""
425
 
426
- #: admin/includes/class-ad-type.php:864
427
  msgid "Ad draft updated."
428
  msgstr ""
429
 
430
- #: admin/includes/class-ad-type.php:920
431
  msgid "You don’t have access to ads. Please deactivate and re-enable Advanced Ads again to fix this."
432
  msgstr ""
433
 
434
- #: admin/includes/class-ad-type.php:921
435
- #: classes/frontend_checks.php:515
436
  msgid "Get help"
437
  msgstr ""
438
 
439
- #: admin/includes/class-admin-upgrades.php:33
440
  msgid "Load ad units directly from your Google Ad Manager account."
441
  msgstr ""
442
 
443
- #: admin/includes/class-admin-upgrades.php:43
444
  msgid "Ads that are visible on Accelerated Mobile Pages."
445
  msgstr ""
446
 
447
- #: admin/includes/class-admin-upgrades.php:60
448
  msgid "Upgrade"
449
  msgstr ""
450
 
451
- #: admin/includes/class-admin-upgrades.php:80
452
  msgid "Pro Feature"
453
  msgstr ""
454
 
455
- #: admin/includes/class-admin-upgrades.php:105
456
  #: admin/includes/class-overview-widgets.php:555
457
  msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
458
  msgstr ""
459
 
 
 
 
 
460
  #. Translators: 1: add-on name 2: admin URL to license page
461
  #: admin/includes/class-licenses.php:103
462
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
@@ -602,16 +606,16 @@ msgstr ""
602
 
603
  #: admin/includes/class-menu.php:176
604
  #: admin/includes/class-menu.php:180
605
- #: admin/includes/class-settings.php:263
606
  msgid "Licenses"
607
  msgstr ""
608
 
609
- #: admin/includes/class-menu.php:283
610
- #: admin/includes/class-menu.php:308
611
  msgid "Sorry, you are not allowed to access this feature."
612
  msgstr ""
613
 
614
- #: admin/includes/class-menu.php:295
615
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
616
  msgstr ""
617
 
@@ -629,7 +633,7 @@ msgid "Ad Parameters"
629
  msgstr ""
630
 
631
  #: admin/includes/class-meta-box.php:96
632
- #: admin/includes/class-settings.php:69
633
  msgid "Layout / Output"
634
  msgstr ""
635
 
@@ -922,86 +926,86 @@ msgstr ""
922
  msgid "Get this add-on"
923
  msgstr ""
924
 
925
- #: admin/includes/class-settings.php:53
926
  msgid "Admin"
927
  msgstr ""
928
 
929
- #: admin/includes/class-settings.php:61
930
- #: admin/includes/class-settings.php:131
931
  msgid "Disable ads"
932
  msgstr ""
933
 
934
- #: admin/includes/class-settings.php:77
935
  msgid "Content injection"
936
  msgstr ""
937
 
938
- #: admin/includes/class-settings.php:139
939
  msgid "Hide ads for user roles"
940
  msgstr ""
941
 
942
- #: admin/includes/class-settings.php:147
943
  msgid "Unlimited ad injection"
944
  msgstr ""
945
 
946
- #: admin/includes/class-settings.php:155
947
  msgid "Priority of content injection filter"
948
  msgstr ""
949
 
950
- #: admin/includes/class-settings.php:163
951
  #: classes/ad_placements.php:1018
952
  msgid "Disable level limitation"
953
  msgstr ""
954
 
955
- #: admin/includes/class-settings.php:171
956
  msgid "Hide ads from bots"
957
  msgstr ""
958
 
959
- #: admin/includes/class-settings.php:180
960
  msgid "Disable ads for post types"
961
  msgstr ""
962
 
963
- #: admin/includes/class-settings.php:189
964
  msgid "Disable Ad Health and other notices"
965
  msgstr ""
966
 
967
- #: admin/includes/class-settings.php:197
968
  msgid "ID prefix"
969
  msgstr ""
970
 
971
- #: admin/includes/class-settings.php:205
972
  msgid "Allow editors to manage ads"
973
  msgstr ""
974
 
975
- #: admin/includes/class-settings.php:213
976
  msgid "Ad label"
977
  msgstr ""
978
 
979
- #: admin/includes/class-settings.php:222
980
  msgid "Open links in a new window"
981
  msgstr ""
982
 
983
- #: admin/includes/class-settings.php:230
984
  msgid "Use advanced JavaScript"
985
  msgstr ""
986
 
987
- #: admin/includes/class-settings.php:240
988
  msgid "Delete data on uninstall"
989
  msgstr ""
990
 
991
- #: admin/includes/class-settings.php:282
992
  msgid "Pro"
993
  msgstr ""
994
 
995
- #: admin/includes/class-settings.php:300
996
  #: admin/views/upgrades/tracking.php:2
997
  msgid "Tracking"
998
  msgstr ""
999
 
1000
- #: admin/includes/class-settings.php:346
1001
  msgid "Are you missing something?"
1002
  msgstr ""
1003
 
1004
- #: admin/includes/class-settings.php:522
1005
  msgctxt "label before ads"
1006
  msgid "Advertisements"
1007
  msgstr ""
@@ -1276,23 +1280,23 @@ msgstr ""
1276
  msgid "Reach out to <a href=\"%s\">support</a> to get help."
1277
  msgstr ""
1278
 
1279
- #: admin/views/ad-info-bottom.php:13
1280
  msgctxt "wizard navigation"
1281
  msgid "previous"
1282
  msgstr ""
1283
 
1284
- #: admin/views/ad-info-bottom.php:17
1285
  #: admin/views/ad-info-bottom.php:20
 
1286
  msgctxt "wizard navigation"
1287
  msgid "next"
1288
  msgstr ""
1289
 
1290
- #: admin/views/ad-info-bottom.php:17
1291
  msgctxt "wizard navigation"
1292
  msgid "save"
1293
  msgstr ""
1294
 
1295
- #: admin/views/ad-info-bottom.php:21
1296
  #: admin/views/ad-info-top.php:27
1297
  msgid "Stop Wizard and show all options"
1298
  msgstr ""
@@ -1603,15 +1607,20 @@ msgstr ""
1603
  msgid "If you want to display the ad everywhere, don't do anything here. "
1604
  msgstr ""
1605
 
1606
- #: admin/views/conditions/display-conditions-list.php:45
1607
  msgid "Forced to OR."
1608
  msgstr ""
1609
 
1610
- #: admin/views/conditions/display-conditions-list.php:46
 
1611
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:120
1612
  msgid "manual"
1613
  msgstr ""
1614
 
 
 
 
 
1615
  #. translators: %s is a name of a taxonomy.
1616
  #: admin/views/conditions/no-option.php:10
1617
  msgctxt "Error message shown when no terms exists for display condition; placeholder is taxonomy label."
@@ -3032,104 +3041,100 @@ msgid "Debug Google Ad Manager"
3032
  msgstr ""
3033
 
3034
  #: classes/frontend_checks.php:348
3035
- msgid "Auto ads code found"
3036
- msgstr ""
3037
-
3038
- #: classes/frontend_checks.php:360
3039
  msgid "highlight ads"
3040
  msgstr ""
3041
 
3042
- #: classes/frontend_checks.php:473
3043
  msgid "Ad Health"
3044
  msgstr ""
3045
 
3046
- #: classes/frontend_checks.php:487
3047
  msgid "Show %d more notifications"
3048
  msgstr ""
3049
 
3050
- #: classes/frontend_checks.php:504
3051
  msgid "Everything is fine"
3052
  msgstr ""
3053
 
3054
- #: classes/frontend_checks.php:572
3055
  msgid "the following code is used for automatic error detection and only visible to admins"
3056
  msgstr ""
3057
 
3058
- #: classes/frontend_checks.php:876
3059
- #: classes/frontend_checks.php:891
3060
  msgid "Hi %s"
3061
  msgstr ""
3062
 
3063
- #: classes/frontend_checks.php:876
3064
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3065
  msgstr ""
3066
 
3067
- #: classes/frontend_checks.php:876
3068
- #: classes/frontend_checks.php:891
3069
  msgid "Is that correct?"
3070
  msgstr ""
3071
 
3072
- #: classes/frontend_checks.php:878
3073
  msgid "All is fine"
3074
  msgstr ""
3075
 
3076
- #: classes/frontend_checks.php:879
3077
  msgid "Something is off"
3078
  msgstr ""
3079
 
3080
- #: classes/frontend_checks.php:881
3081
- #: classes/frontend_checks.php:896
3082
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3083
  msgstr ""
3084
 
3085
- #: classes/frontend_checks.php:891
3086
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3087
  msgstr ""
3088
 
3089
- #: classes/frontend_checks.php:893
3090
  msgid "This is fine"
3091
  msgstr ""
3092
 
3093
- #: classes/frontend_checks.php:894
3094
  msgid "I expected something else"
3095
  msgstr ""
3096
 
3097
- #: classes/frontend_checks.php:899
3098
- #: classes/frontend_checks.php:907
3099
  msgid "Just click on your problem to learn more from our knowledge base."
3100
  msgstr ""
3101
 
3102
- #: classes/frontend_checks.php:900
3103
  msgid "I want to disable AdSense Auto ads"
3104
  msgstr ""
3105
 
3106
- #: classes/frontend_checks.php:901
3107
- #: classes/frontend_checks.php:908
3108
  msgid "I don’t see any Auto ads"
3109
  msgstr ""
3110
 
3111
- #: classes/frontend_checks.php:902
3112
  msgid "I only see blank space"
3113
  msgstr ""
3114
 
3115
- #: classes/frontend_checks.php:903
3116
  msgid "I want to change the position of the ads"
3117
  msgstr ""
3118
 
3119
- #: classes/frontend_checks.php:904
3120
  #: modules/gadsense/includes/class-network-adsense.php:226
3121
  msgid "Display Auto ads only on specific pages"
3122
  msgstr ""
3123
 
3124
- #: classes/frontend_checks.php:909
3125
  msgid "How to look for the Auto ads code"
3126
  msgstr ""
3127
 
3128
- #: classes/frontend_checks.php:910
3129
  msgid "I have another question or problem"
3130
  msgstr ""
3131
 
3132
- #: classes/frontend_checks.php:913
3133
  msgid "Closing the message"
3134
  msgstr ""
3135
 
@@ -3319,18 +3324,27 @@ msgstr ""
3319
  msgid "Learn how to display alternative content to ad block users <a href=\"%s\" target=\"_blank\">in the manual</a>."
3320
  msgstr ""
3321
 
3322
- #: modules/adblock-finder/admin/admin.php:16
3323
  msgid "Ad Blocker"
3324
  msgstr ""
3325
 
3326
- #: modules/adblock-finder/admin/admin.php:23
3327
  msgid "Ad blocker counter"
3328
  msgstr ""
3329
 
3330
- #: modules/adblock-finder/admin/views/setting-ga.php:2
 
 
 
 
3331
  msgid "Want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them."
3332
  msgstr ""
3333
 
 
 
 
 
 
3334
  #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:192
3335
  msgid "The ads.txt file cannot be placed because the URL contains a subdirectory. You need to make the file available at %s"
3336
  msgstr ""
@@ -4074,20 +4088,20 @@ msgstr ""
4074
  msgid "Privacy"
4075
  msgstr ""
4076
 
4077
- #: modules/privacy/admin/admin.php:75
4078
  msgid "Enable Privacy module"
4079
  msgstr ""
4080
 
4081
- #: modules/privacy/admin/admin.php:105
4082
  msgid "Show all ads even without consent"
4083
  msgstr ""
4084
 
4085
- #: modules/privacy/admin/admin.php:108
4086
  msgid "Cookie"
4087
  msgstr ""
4088
 
4089
  #. translators: %s is a string with various CMPs (companies) that support the TCF standard
4090
- #: modules/privacy/admin/admin.php:114
4091
  msgid "TCF v2.0 integration (e.g., %s)"
4092
  msgstr ""
4093
 
@@ -4219,7 +4233,7 @@ msgstr ""
4219
  msgid "Parent Ad"
4220
  msgstr ""
4221
 
4222
- #: public/class-advanced-ads.php:972
4223
  msgctxt "label above ads"
4224
  msgid "Advertisements"
4225
  msgstr ""
1
  # Copyright (C) 2021 Thomas Maier, Advanced Ads GmbH
2
+ # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Advanced Ads 1.27.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: 2021-08-24T09:19:55+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: advanced-ads\n"
16
 
17
  #. Plugin Name of the plugin
339
  msgid "No ad group created"
340
  msgstr ""
341
 
342
+ #: admin/includes/class-ad-type.php:269
343
+ #: admin/includes/class-ad-type.php:275
344
  msgid "Ad Details"
345
  msgstr ""
346
 
347
+ #: admin/includes/class-ad-type.php:270
348
+ #: admin/includes/class-ad-type.php:276
349
  msgid "Ad Planning"
350
  msgstr ""
351
 
352
+ #: admin/includes/class-ad-type.php:271
353
+ #: admin/includes/class-ad-type.php:277
354
  msgid "Ad Shortcode"
355
  msgstr ""
356
 
357
  #. translators: %s is the number of ads.
358
+ #: admin/includes/class-ad-type.php:441
359
  msgid "%s ad updated."
360
  msgid_plural "%s ads updated."
361
  msgstr[0] ""
362
  msgstr[1] ""
363
 
364
  #. translators: %s is the number of ads.
365
+ #: admin/includes/class-ad-type.php:443
366
  msgid "%s ad not updated, somebody is editing it."
367
  msgid_plural "%s ads not updated, somebody is editing them."
368
  msgstr[0] ""
369
  msgstr[1] ""
370
 
371
  #. translators: %s is the number of ads.
372
+ #: admin/includes/class-ad-type.php:445
373
  msgid "%s ad permanently deleted."
374
  msgid_plural "%s ads permanently deleted."
375
  msgstr[0] ""
376
  msgstr[1] ""
377
 
378
  #. translators: %s is the number of ads.
379
+ #: admin/includes/class-ad-type.php:447
380
  msgid "%s ad moved to the Trash."
381
  msgid_plural "%s ads moved to the Trash."
382
  msgstr[0] ""
383
  msgstr[1] ""
384
 
385
  #. translators: %s is the number of ads.
386
+ #: admin/includes/class-ad-type.php:449
387
  msgid "%s ad restored from the Trash."
388
  msgid_plural "%s ads restored from the Trash."
389
  msgstr[0] ""
390
  msgstr[1] ""
391
 
392
  #. Translators: %s is the time the ad was first saved.
393
+ #: admin/includes/class-ad-type.php:659
394
  msgid "Ad created on %s"
395
  msgstr ""
396
 
397
+ #: admin/includes/class-ad-type.php:851
398
  #: admin/includes/class-ad-type.php:852
 
399
  msgid "Ad updated."
400
  msgstr ""
401
 
402
  #. translators: %s: date and time of the revision
403
+ #: admin/includes/class-ad-type.php:853
404
  msgid "Ad restored to revision from %s"
405
  msgstr ""
406
 
407
+ #: admin/includes/class-ad-type.php:854
408
  #: admin/includes/class-ad-type.php:855
 
409
  msgid "Ad saved."
410
  msgstr ""
411
 
412
+ #: admin/includes/class-ad-type.php:856
413
  msgid "Ad submitted."
414
  msgstr ""
415
 
416
  #. translators: %1$s is a date.
417
+ #: admin/includes/class-ad-type.php:859
418
  msgid "Ad scheduled for: <strong>%1$s</strong>."
419
  msgstr ""
420
 
421
  #. translators: Publish box date format, see http://php.net/date.
422
+ #: admin/includes/class-ad-type.php:861
423
  msgid "M j, Y @ G:i"
424
  msgstr ""
425
 
426
+ #: admin/includes/class-ad-type.php:863
427
  msgid "Ad draft updated."
428
  msgstr ""
429
 
430
+ #: admin/includes/class-ad-type.php:919
431
  msgid "You don’t have access to ads. Please deactivate and re-enable Advanced Ads again to fix this."
432
  msgstr ""
433
 
434
+ #: admin/includes/class-ad-type.php:920
435
+ #: classes/frontend_checks.php:503
436
  msgid "Get help"
437
  msgstr ""
438
 
439
+ #: admin/includes/class-admin-upgrades.php:37
440
  msgid "Load ad units directly from your Google Ad Manager account."
441
  msgstr ""
442
 
443
+ #: admin/includes/class-admin-upgrades.php:47
444
  msgid "Ads that are visible on Accelerated Mobile Pages."
445
  msgstr ""
446
 
447
+ #: admin/includes/class-admin-upgrades.php:63
448
  msgid "Upgrade"
449
  msgstr ""
450
 
451
+ #: admin/includes/class-admin-upgrades.php:82
452
  msgid "Pro Feature"
453
  msgstr ""
454
 
455
+ #: admin/includes/class-admin-upgrades.php:107
456
  #: admin/includes/class-overview-widgets.php:555
457
  msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
458
  msgstr ""
459
 
460
+ #: admin/includes/class-admin-upgrades.php:172
461
+ msgid "Duplicate"
462
+ msgstr ""
463
+
464
  #. Translators: 1: add-on name 2: admin URL to license page
465
  #: admin/includes/class-licenses.php:103
466
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
606
 
607
  #: admin/includes/class-menu.php:176
608
  #: admin/includes/class-menu.php:180
609
+ #: admin/includes/class-settings.php:298
610
  msgid "Licenses"
611
  msgstr ""
612
 
613
+ #: admin/includes/class-menu.php:276
614
+ #: admin/includes/class-menu.php:301
615
  msgid "Sorry, you are not allowed to access this feature."
616
  msgstr ""
617
 
618
+ #: admin/includes/class-menu.php:288
619
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
620
  msgstr ""
621
 
633
  msgstr ""
634
 
635
  #: admin/includes/class-meta-box.php:96
636
+ #: admin/includes/class-settings.php:71
637
  msgid "Layout / Output"
638
  msgstr ""
639
 
926
  msgid "Get this add-on"
927
  msgstr ""
928
 
929
+ #: admin/includes/class-settings.php:55
930
  msgid "Admin"
931
  msgstr ""
932
 
933
+ #: admin/includes/class-settings.php:63
934
+ #: admin/includes/class-settings.php:146
935
  msgid "Disable ads"
936
  msgstr ""
937
 
938
+ #: admin/includes/class-settings.php:79
939
  msgid "Content injection"
940
  msgstr ""
941
 
942
+ #: admin/includes/class-settings.php:154
943
  msgid "Hide ads for user roles"
944
  msgstr ""
945
 
946
+ #: admin/includes/class-settings.php:162
947
  msgid "Unlimited ad injection"
948
  msgstr ""
949
 
950
+ #: admin/includes/class-settings.php:170
951
  msgid "Priority of content injection filter"
952
  msgstr ""
953
 
954
+ #: admin/includes/class-settings.php:178
955
  #: classes/ad_placements.php:1018
956
  msgid "Disable level limitation"
957
  msgstr ""
958
 
959
+ #: admin/includes/class-settings.php:186
960
  msgid "Hide ads from bots"
961
  msgstr ""
962
 
963
+ #: admin/includes/class-settings.php:195
964
  msgid "Disable ads for post types"
965
  msgstr ""
966
 
967
+ #: admin/includes/class-settings.php:204
968
  msgid "Disable Ad Health and other notices"
969
  msgstr ""
970
 
971
+ #: admin/includes/class-settings.php:212
972
  msgid "ID prefix"
973
  msgstr ""
974
 
975
+ #: admin/includes/class-settings.php:220
976
  msgid "Allow editors to manage ads"
977
  msgstr ""
978
 
979
+ #: admin/includes/class-settings.php:228
980
  msgid "Ad label"
981
  msgstr ""
982
 
983
+ #: admin/includes/class-settings.php:237
984
  msgid "Open links in a new window"
985
  msgstr ""
986
 
987
+ #: admin/includes/class-settings.php:245
988
  msgid "Use advanced JavaScript"
989
  msgstr ""
990
 
991
+ #: admin/includes/class-settings.php:255
992
  msgid "Delete data on uninstall"
993
  msgstr ""
994
 
995
+ #: admin/includes/class-settings.php:317
996
  msgid "Pro"
997
  msgstr ""
998
 
999
+ #: admin/includes/class-settings.php:335
1000
  #: admin/views/upgrades/tracking.php:2
1001
  msgid "Tracking"
1002
  msgstr ""
1003
 
1004
+ #: admin/includes/class-settings.php:381
1005
  msgid "Are you missing something?"
1006
  msgstr ""
1007
 
1008
+ #: admin/includes/class-settings.php:557
1009
  msgctxt "label before ads"
1010
  msgid "Advertisements"
1011
  msgstr ""
1280
  msgid "Reach out to <a href=\"%s\">support</a> to get help."
1281
  msgstr ""
1282
 
1283
+ #: admin/views/ad-info-bottom.php:15
1284
  msgctxt "wizard navigation"
1285
  msgid "previous"
1286
  msgstr ""
1287
 
 
1288
  #: admin/views/ad-info-bottom.php:20
1289
+ #: admin/views/ad-info-bottom.php:25
1290
  msgctxt "wizard navigation"
1291
  msgid "next"
1292
  msgstr ""
1293
 
1294
+ #: admin/views/ad-info-bottom.php:21
1295
  msgctxt "wizard navigation"
1296
  msgid "save"
1297
  msgstr ""
1298
 
1299
+ #: admin/views/ad-info-bottom.php:26
1300
  #: admin/views/ad-info-top.php:27
1301
  msgid "Stop Wizard and show all options"
1302
  msgstr ""
1607
  msgid "If you want to display the ad everywhere, don't do anything here. "
1608
  msgstr ""
1609
 
1610
+ #: admin/views/conditions/display-conditions-list.php:53
1611
  msgid "Forced to OR."
1612
  msgstr ""
1613
 
1614
+ #: admin/views/conditions/display-conditions-list.php:54
1615
+ #: admin/views/conditions/display-conditions-list.php:57
1616
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:120
1617
  msgid "manual"
1618
  msgstr ""
1619
 
1620
+ #: admin/views/conditions/display-conditions-list.php:56
1621
+ msgid "The ad might always show due to OR and \"is not\". Better use AND."
1622
+ msgstr ""
1623
+
1624
  #. translators: %s is a name of a taxonomy.
1625
  #: admin/views/conditions/no-option.php:10
1626
  msgctxt "Error message shown when no terms exists for display condition; placeholder is taxonomy label."
3041
  msgstr ""
3042
 
3043
  #: classes/frontend_checks.php:348
 
 
 
 
3044
  msgid "highlight ads"
3045
  msgstr ""
3046
 
3047
+ #: classes/frontend_checks.php:461
3048
  msgid "Ad Health"
3049
  msgstr ""
3050
 
3051
+ #: classes/frontend_checks.php:475
3052
  msgid "Show %d more notifications"
3053
  msgstr ""
3054
 
3055
+ #: classes/frontend_checks.php:492
3056
  msgid "Everything is fine"
3057
  msgstr ""
3058
 
3059
+ #: classes/frontend_checks.php:560
3060
  msgid "the following code is used for automatic error detection and only visible to admins"
3061
  msgstr ""
3062
 
3063
+ #: classes/frontend_checks.php:854
3064
+ #: classes/frontend_checks.php:869
3065
  msgid "Hi %s"
3066
  msgstr ""
3067
 
3068
+ #: classes/frontend_checks.php:854
3069
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3070
  msgstr ""
3071
 
3072
+ #: classes/frontend_checks.php:854
3073
+ #: classes/frontend_checks.php:869
3074
  msgid "Is that correct?"
3075
  msgstr ""
3076
 
3077
+ #: classes/frontend_checks.php:856
3078
  msgid "All is fine"
3079
  msgstr ""
3080
 
3081
+ #: classes/frontend_checks.php:857
3082
  msgid "Something is off"
3083
  msgstr ""
3084
 
3085
+ #: classes/frontend_checks.php:859
3086
+ #: classes/frontend_checks.php:874
3087
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3088
  msgstr ""
3089
 
3090
+ #: classes/frontend_checks.php:869
3091
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3092
  msgstr ""
3093
 
3094
+ #: classes/frontend_checks.php:871
3095
  msgid "This is fine"
3096
  msgstr ""
3097
 
3098
+ #: classes/frontend_checks.php:872
3099
  msgid "I expected something else"
3100
  msgstr ""
3101
 
3102
+ #: classes/frontend_checks.php:877
3103
+ #: classes/frontend_checks.php:885
3104
  msgid "Just click on your problem to learn more from our knowledge base."
3105
  msgstr ""
3106
 
3107
+ #: classes/frontend_checks.php:878
3108
  msgid "I want to disable AdSense Auto ads"
3109
  msgstr ""
3110
 
3111
+ #: classes/frontend_checks.php:879
3112
+ #: classes/frontend_checks.php:886
3113
  msgid "I don’t see any Auto ads"
3114
  msgstr ""
3115
 
3116
+ #: classes/frontend_checks.php:880
3117
  msgid "I only see blank space"
3118
  msgstr ""
3119
 
3120
+ #: classes/frontend_checks.php:881
3121
  msgid "I want to change the position of the ads"
3122
  msgstr ""
3123
 
3124
+ #: classes/frontend_checks.php:882
3125
  #: modules/gadsense/includes/class-network-adsense.php:226
3126
  msgid "Display Auto ads only on specific pages"
3127
  msgstr ""
3128
 
3129
+ #: classes/frontend_checks.php:887
3130
  msgid "How to look for the Auto ads code"
3131
  msgstr ""
3132
 
3133
+ #: classes/frontend_checks.php:888
3134
  msgid "I have another question or problem"
3135
  msgstr ""
3136
 
3137
+ #: classes/frontend_checks.php:891
3138
  msgid "Closing the message"
3139
  msgstr ""
3140
 
3324
  msgid "Learn how to display alternative content to ad block users <a href=\"%s\" target=\"_blank\">in the manual</a>."
3325
  msgstr ""
3326
 
3327
+ #: modules/adblock-finder/admin/admin.php:20
3328
  msgid "Ad Blocker"
3329
  msgstr ""
3330
 
3331
+ #: modules/adblock-finder/admin/admin.php:27
3332
  msgid "Ad blocker counter"
3333
  msgstr ""
3334
 
3335
+ #: modules/adblock-finder/admin/views/setting-ga.php:9
3336
+ msgid "Google Analytics Tracking ID"
3337
+ msgstr ""
3338
+
3339
+ #: modules/adblock-finder/admin/views/setting-ga.php:14
3340
  msgid "Want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them."
3341
  msgstr ""
3342
 
3343
+ #. translators: 1: is an example id for Universal Analytics <code>UA-123456-1</code>, 2: is an example id for GA4 '<code>G-A12BC3D456</code>'
3344
+ #: modules/adblock-finder/admin/views/setting-ga.php:19
3345
+ msgid "%1$s for Universal Analytics or %2$s for Google Analytics 4."
3346
+ msgstr ""
3347
+
3348
  #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:192
3349
  msgid "The ads.txt file cannot be placed because the URL contains a subdirectory. You need to make the file available at %s"
3350
  msgstr ""
4088
  msgid "Privacy"
4089
  msgstr ""
4090
 
4091
+ #: modules/privacy/admin/admin.php:88
4092
  msgid "Enable Privacy module"
4093
  msgstr ""
4094
 
4095
+ #: modules/privacy/admin/admin.php:118
4096
  msgid "Show all ads even without consent"
4097
  msgstr ""
4098
 
4099
+ #: modules/privacy/admin/admin.php:121
4100
  msgid "Cookie"
4101
  msgstr ""
4102
 
4103
  #. translators: %s is a string with various CMPs (companies) that support the TCF standard
4104
+ #: modules/privacy/admin/admin.php:127
4105
  msgid "TCF v2.0 integration (e.g., %s)"
4106
  msgstr ""
4107
 
4233
  msgid "Parent Ad"
4234
  msgstr ""
4235
 
4236
+ #: public/class-advanced-ads.php:978
4237
  msgctxt "label above ads"
4238
  msgid "Advertisements"
4239
  msgstr ""
modules/ad-blocker/main.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
 
3
- function advanced_ads_load_adblocker() {
4
- if ( class_exists( 'Advanced_Ads', false ) ) {
 
 
5
 
6
- // only load if not already existing (maybe included from another plugin)
7
- if ( defined( 'ADVADS_AB_BASE_PATH' ) ) {
8
- return;
9
- }
10
 
11
- // load basic path to the plugin
12
- define( 'ADVADS_AB_BASE_PATH', plugin_dir_path( __FILE__ ) );
13
- // general and global slug, e.g. to store options in WP, textdomain
14
- define( 'ADVADS_AB_SLUG', 'advanced-ads-ab-module' );
15
 
16
- Advanced_Ads_Ad_Blocker::get_instance();
 
 
 
 
17
 
18
- if ( is_admin() && ! wp_doing_ajax() ) {
19
- Advanced_Ads_Ad_Blocker_Admin::get_instance();
20
- }
21
  }
22
  }
23
-
24
- add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_load_adblocker' );
1
+ <?php //phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols -- the sniff does not accept calling add_action and declaring the callback in the same file
2
 
3
+ // Only load if not already existing (maybe included from another plugin).
4
+ if ( defined( 'ADVADS_AB_BASE_PATH' ) ) {
5
+ return;
6
+ }
7
 
8
+ // load basic path to the plugin
9
+ define( 'ADVADS_AB_BASE_PATH', plugin_dir_path( __FILE__ ) );
10
+ // general and global slug, e.g. to store options in WP, textdomain
11
+ define( 'ADVADS_AB_SLUG', 'advanced-ads-ab-module' );
12
 
13
+ add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_load_adblocker' );
 
 
 
14
 
15
+ /**
16
+ * Load ad blocker functionality.
17
+ */
18
+ function advanced_ads_load_adblocker() {
19
+ Advanced_Ads_Ad_Blocker::get_instance();
20
 
21
+ if ( is_admin() && ! wp_doing_ajax() ) {
22
+ Advanced_Ads_Ad_Blocker_Admin::get_instance();
 
23
  }
24
  }
 
 
modules/adblock-finder/admin/admin.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  class Advanced_Ads_Adblock_Finder_Admin {
3
  public function __construct() {
4
  // Add module settings to Advanced Ads settings page.
@@ -29,9 +33,12 @@ class Advanced_Ads_Adblock_Finder_Admin {
29
 
30
  public function render_settings_section_callback() {}
31
 
 
 
 
32
  public function render_settings_ga() {
33
  $options = Advanced_Ads::get_instance()->options();
34
- $UID = isset( $options['ga-UID'] ) ? $options['ga-UID'] : '';
35
 
36
  include dirname( __FILE__ ) . '/views/setting-ga.php';
37
  }
1
  <?php
2
+
3
+ /**
4
+ * Class Advanced_Ads_Adblock_Finder_Admin
5
+ */
6
  class Advanced_Ads_Adblock_Finder_Admin {
7
  public function __construct() {
8
  // Add module settings to Advanced Ads settings page.
33
 
34
  public function render_settings_section_callback() {}
35
 
36
+ /**
37
+ * Render input for the Google Analytics Tracking ID.
38
+ */
39
  public function render_settings_ga() {
40
  $options = Advanced_Ads::get_instance()->options();
41
+ $ga_uid = isset( $options['ga-UID'] ) ? $options['ga-UID'] : '';
42
 
43
  include dirname( __FILE__ ) . '/views/setting-ga.php';
44
  }
modules/adblock-finder/admin/views/setting-ga.php CHANGED
@@ -1,2 +1,24 @@
1
- <input type="text" name="<?php echo ADVADS_SLUG ?>[ga-UID]" value="<?php echo esc_attr( $UID ); ?>" />
2
- <p class="description"><?php _e( 'Want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them.', 'advanced-ads' ); ?>&nbsp;<code>(UA-123456-1)</code></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Input for Google Analytics property ID.
4
+ *
5
+ * @var string $ga_uid Google Analytics property ID
6
+ */
7
+ ?>
8
+ <label>
9
+ <?php esc_html_e( 'Google Analytics Tracking ID', 'advanced-ads' ); ?><br/>
10
+ <input type="text" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[ga-UID]" value="<?php echo esc_attr( $ga_uid ); ?>"/>
11
+ </label>
12
+
13
+ <p class="description">
14
+ <?php esc_html_e( 'Want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them.', 'advanced-ads' ); ?>
15
+ <br>
16
+ <?php
17
+ printf(
18
+ /* translators: 1: is an example id for Universal Analytics <code>UA-123456-1</code>, 2: is an example id for GA4 '<code>G-A12BC3D456</code>' */
19
+ esc_html__( '%1$s for Universal Analytics or %2$s for Google Analytics 4.', 'advanced-ads' ),
20
+ '<code>UA-123456-1</code>',
21
+ '<code>G-A12BC3D456</code>'
22
+ );
23
+ ?>
24
+ </p>
modules/adblock-finder/public/adblocker-enabled.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Check if an ad blocker is enabled.
3
+ *
4
+ * @param {function} callback A callback function that is executed after the check has been done.
5
+ * The 'is_enabled' (bool) variable is passed as the callback's first argument.
6
+ */
7
+ window.advanced_ads_check_adblocker = ( function ( callback ) {
8
+ var pending_callbacks = [];
9
+ var is_enabled = null;
10
+
11
+ function RAF( RAF_callback ) {
12
+ var fn = window.requestAnimationFrame
13
+ || window.mozRequestAnimationFrame
14
+ || window.webkitRequestAnimationFrame
15
+ || function ( RAF_callback ) {
16
+ return setTimeout( RAF_callback, 16 );
17
+ };
18
+
19
+ fn.call( window, RAF_callback );
20
+ }
21
+
22
+ RAF( function () {
23
+ // Create a bait.
24
+ var ad = document.createElement( 'div' );
25
+ ad.innerHTML = '&nbsp;';
26
+ ad.setAttribute( 'class', 'ad_unit ad-unit text-ad text_ad pub_300x250' );
27
+ ad.setAttribute( 'style', 'width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;' );
28
+ document.body.appendChild( ad );
29
+
30
+ RAF( function () {
31
+ var styles = window.getComputedStyle && window.getComputedStyle( ad );
32
+ var moz_binding = styles && styles.getPropertyValue( '-moz-binding' );
33
+
34
+ is_enabled = ( styles && styles.getPropertyValue( 'display' ) === 'none' )
35
+ || ( typeof moz_binding === 'string' && moz_binding.indexOf( 'about:' ) !== - 1 );
36
+
37
+ // Call pending callbacks.
38
+ for ( var i = 0, length = pending_callbacks.length; i < length; i ++ ) {
39
+ pending_callbacks[i]( is_enabled );
40
+ }
41
+ pending_callbacks = [];
42
+ } );
43
+ } );
44
+
45
+ return function ( callback ) {
46
+ if ( is_enabled === null ) {
47
+ pending_callbacks.push( callback );
48
+ return;
49
+ }
50
+ // Run the callback immediately
51
+ callback( is_enabled );
52
+ };
53
+ }() );
modules/adblock-finder/public/adblocker-enabled.min.js ADDED
@@ -0,0 +1 @@
 
1
+ window.advanced_ads_check_adblocker=function(t){var n=[],e=null;function i(t){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)}).call(window,t)}return i((function(){var t=document.createElement("div");t.innerHTML="&nbsp;",t.setAttribute("class","ad_unit ad-unit text-ad text_ad pub_300x250"),t.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;"),document.body.appendChild(t),i((function(){var i=window.getComputedStyle&&window.getComputedStyle(t),o=i&&i.getPropertyValue("-moz-binding");e=i&&"none"===i.getPropertyValue("display")||"string"==typeof o&&-1!==o.indexOf("about:");for(var a=0,r=n.length;a<r;a++)n[a](e);n=[]}))})),function(t){null!==e?t(e):n.push(t)}}();
modules/adblock-finder/public/ga-adblock-counter.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function AdvAdsAdBlockCounterGA( UID ) {
2
+ this.UID = UID;
3
+ this.analyticsObject = typeof gtag === 'function';
4
+
5
+ var self = this;
6
+
7
+ this.count = function () {
8
+ gtag( 'event', 'AdBlock', {
9
+ 'event_category': 'Advanced Ads',
10
+ 'event_label': 'Yes',
11
+ 'non_interaction': true,
12
+ 'send_to': self.UID
13
+ } );
14
+ };
15
+
16
+ // pseudo-constructor
17
+ ( function () {
18
+ if ( ! self.analyticsObject ) {
19
+ // No one has requested gtag.js at this point, require it.
20
+ var script = document.createElement( 'script' );
21
+ script.src = 'https://www.googletagmanager.com/gtag/js?id=' + UID;
22
+ script.async = true;
23
+
24
+ document.body.appendChild( script );
25
+
26
+ window.dataLayer = window.dataLayer || [];
27
+ window.gtag = function () {
28
+ dataLayer.push( arguments );
29
+ };
30
+ self.analyticsObject = true;
31
+ gtag( 'js', new Date() );
32
+ }
33
+
34
+ var config = {'send_page_view': false, 'transport_type': 'beacon'};
35
+ if ( window.advanced_ads_ga_anonymIP ) {
36
+ config.anonymize_ip = true;
37
+ }
38
+ gtag( 'config', UID, config );
39
+ } )();
40
+
41
+ return this;
42
+ }
43
+
44
+ advanced_ads_check_adblocker( function ( is_enabled ) {
45
+ // Send data to Google Analytics if an ad blocker was detected.
46
+ if ( is_enabled ) {
47
+ new AdvAdsAdBlockCounterGA( advanced_ads_ga_UID ).count();
48
+ }
49
+ } );
modules/adblock-finder/public/ga-adblock-counter.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function AdvAdsAdBlockCounterGA(t){this.UID=t,this.analyticsObject="function"==typeof gtag;var n=this;return this.count=function(){gtag("event","AdBlock",{event_category:"Advanced Ads",event_label:"Yes",non_interaction:!0,send_to:n.UID})},function(){if(!n.analyticsObject){var e=document.createElement("script");e.src="https://www.googletagmanager.com/gtag/js?id="+t,e.async=!0,document.body.appendChild(e),window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},n.analyticsObject=!0,gtag("js",new Date)}var a={send_page_view:!1,transport_type:"beacon"};window.advanced_ads_ga_anonymIP&&(a.anonymize_ip=!0),gtag("config",t,a)}(),this}window.advanced_ads_check_adblocker=function(t){var n=[],e=null;function a(t){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)}).call(window,t)}return a((function(){var t=document.createElement("div");t.innerHTML="&nbsp;",t.setAttribute("class","ad_unit ad-unit text-ad text_ad pub_300x250"),t.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;"),document.body.appendChild(t),a((function(){var a=window.getComputedStyle&&window.getComputedStyle(t),o=a&&a.getPropertyValue("-moz-binding");e=a&&"none"===a.getPropertyValue("display")||"string"==typeof o&&-1!==o.indexOf("about:");for(var i=0,d=n.length;i<d;i++)n[i](e);n=[]}))})),function(t){null!==e?t(e):n.push(t)}}(),advanced_ads_check_adblocker((function(t){t&&new AdvAdsAdBlockCounterGA(advanced_ads_ga_UID).count()}));
modules/adblock-finder/public/public.php CHANGED
@@ -1,39 +1,50 @@
1
  <?php
2
 
 
 
 
3
  class Advanced_Ads_Adblock_Finder {
4
 
 
 
 
5
  public function __construct() {
6
  add_action( 'wp_footer', array( $this, 'print_adblock_check_js' ), 9 );
7
  }
8
 
 
 
 
 
 
 
9
  public function print_adblock_check_js() {
10
  if ( advads_is_amp() ) {
11
  return;
12
  }
13
 
14
- $options = Advanced_Ads::get_instance()->options();
 
15
 
16
- $pro_options = get_option( 'advanced-ads-pro' );
17
- $ads_for_adblockers_enabled = defined( 'AAP_SLUG' ) && ! empty( $pro_options['ads-for-adblockers']['enabled'] );
18
-
19
- if ( ! empty( $options['ga-UID'] ) || $ads_for_adblockers_enabled ) {
20
- ?><script>
21
- var advanced_ads_ga_UID = <?php echo ! empty( $options['ga-UID'] ) ? "'" . esc_js( $options['ga-UID'] ). "'" : 'false' ?>;
22
- var advanced_ads_ga_anonymIP = <?php
23
-
24
- if ( defined( 'ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP' ) ) {
25
- echo "false;\n";
26
- } else {
27
- echo "true;\n";
28
- }
29
-
30
- if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && current_user_can( 'manage_options' ) ) {
31
- readfile( dirname( __FILE__ ) . '/script.js' );
32
- } else {
33
- readfile( dirname( __FILE__ ) . '/script.min.js' );
34
- }
35
-
36
- ?></script><?php
37
  }
38
  }
39
  }
1
  <?php
2
 
3
+ /**
4
+ * Class Advanced_Ads_Adblock_Finder
5
+ */
6
  class Advanced_Ads_Adblock_Finder {
7
 
8
+ /**
9
+ * Advanced_Ads_Adblock_Finder constructor.
10
+ */
11
  public function __construct() {
12
  add_action( 'wp_footer', array( $this, 'print_adblock_check_js' ), 9 );
13
  }
14
 
15
+ /**
16
+ * Print the appropriate script into wp_footer.
17
+ *
18
+ * Don't print anything on AMP pages.
19
+ * Print minimal script if Advanced Ads Pro module "Ads for ad blockers" is active.
20
+ */
21
  public function print_adblock_check_js() {
22
  if ( advads_is_amp() ) {
23
  return;
24
  }
25
 
26
+ $options = Advanced_Ads::get_instance()->options();
27
+ $minified = ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG;
28
 
29
+ // if ad blocker counter is active.
30
+ if ( ! empty( $options['ga-UID'] ) ) {
31
+ printf(
32
+ '<script>(function(){var advanced_ads_ga_UID="%s",advanced_ads_ga_anonymIP=!!%d;%s})();</script>',
33
+ esc_attr( $options['ga-UID'] ),
34
+ esc_attr( ! defined( 'ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP' ) || ! ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP ),
35
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped,WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- escaping could break the script and we're getting the contents of a local file
36
+ $minified
37
+ ? file_get_contents( __DIR__ . '/ga-adblock-counter.min.js' )
38
+ : file_get_contents( __DIR__ . '/adblocker-enabled.js' ) . file_get_contents( __DIR__ . '/ga-adblock-counter.js' )
39
+ // phpcs:enable
40
+ );
41
+ } elseif ( defined( 'AAP_SLUG' ) && ! empty( get_option( 'advanced-ads-pro' )['ads-for-adblockers']['enabled'] ) ) {
42
+ // if Advanced Ads Pro module "Ads for ad blockers" is active but no tracking.
43
+ printf(
44
+ '<script>%s</script>',
45
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped,WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- escaping could break the script and we're getting the contents of a local file
46
+ file_get_contents( __DIR__ . '/adblocker-enabled' . ( $minified ? '.min' : '' ) . '.js' )
47
+ );
 
 
48
  }
49
  }
50
  }
modules/adblock-finder/public/script.js DELETED
@@ -1,101 +0,0 @@
1
- /**
2
- * Check if an ad blocker is enabled.
3
- *
4
- * @param {function} callback A callback function that is executed after the check has been done.
5
- * The 'is_enabled' (bool) variable is passed as the callback's first argument.
6
- */
7
- ;advanced_ads_check_adblocker = ( function( callback ) {
8
- var pending_callbacks = [];
9
- var is_enabled = null;
10
-
11
- function RAF( RAF_callback ) {
12
- var fn = window.requestAnimationFrame
13
- || window.mozRequestAnimationFrame
14
- || window.webkitRequestAnimationFrame
15
- || function( RAF_callback ) { return setTimeout( RAF_callback, 16 ); };
16
-
17
- fn.call( window, RAF_callback );
18
- }
19
-
20
- RAF( function() {
21
- // Create a bait.
22
- var ad = document.createElement( 'div' );
23
- ad.innerHTML = '&nbsp;';
24
- ad.setAttribute( 'class', 'ad_unit ad-unit text-ad text_ad pub_300x250' );
25
- ad.setAttribute( 'style', 'width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;' );
26
- document.body.appendChild( ad );
27
-
28
- RAF( function() {
29
- var styles = window.getComputedStyle && window.getComputedStyle( ad );
30
- var moz_binding = styles && styles.getPropertyValue( '-moz-binding' );
31
-
32
- is_enabled = ( styles && styles.getPropertyValue( 'display' ) === 'none' )
33
- || ( typeof moz_binding === 'string' && moz_binding.indexOf( 'about:' ) !== -1 );
34
-
35
- // Call pending callbacks.
36
- for ( var i = 0; i < pending_callbacks.length; i++ ) {
37
- pending_callbacks[ i ]( is_enabled );
38
- }
39
- pending_callbacks = [];
40
- } );
41
- } );
42
-
43
- return function( callback ) {
44
- if ( is_enabled === null ) {
45
- pending_callbacks.push( callback );
46
- return;
47
- }
48
- // Run the callback immediately
49
- callback( is_enabled );
50
- }
51
- }());
52
-
53
- (function() {
54
- var advadsTracker = function( name, UID ) {
55
- this.name = name;
56
- this.UID = UID;
57
- this.analyticsObject = null;
58
- var that = this;
59
- var data = {
60
- hitType: 'event',
61
- eventCategory: 'Advanced Ads',
62
- eventAction: 'AdBlock',
63
- eventLabel: 'Yes',
64
- nonInteraction: true,
65
- transport: 'beacon'
66
- };
67
-
68
- /**
69
- * check if someone has already requested the analytics.js and created a GoogleAnalyticsObject
70
- */
71
- this.analyticsObject = ( 'string' == typeof( GoogleAnalyticsObject ) && 'function' == typeof( window[GoogleAnalyticsObject] ) )? window[GoogleAnalyticsObject] : false;
72
-
73
- if ( false === this.analyticsObject ) {
74
- // No one has requested analytics.js at this point. Require it
75
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
76
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
77
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
78
- })(window,document,'script','https://www.google-analytics.com/analytics.js','_advads_ga');
79
-
80
- _advads_ga( 'create', that.UID, 'auto', this.name );
81
- if ( advanced_ads_ga_anonymIP ) {
82
- _advads_ga( 'set', 'anonymizeIp', true );
83
- }
84
- _advads_ga( that.name + '.send', data );
85
- } else {
86
- // someone has already created a variable, use it to avoid conflicts.
87
- window.console && window.console.log( "Advanced Ads Analytics >> using other's variable named `" + GoogleAnalyticsObject + "`" );
88
- window[GoogleAnalyticsObject]( 'create', that.UID, 'auto', this.name );
89
- window[GoogleAnalyticsObject]( 'set', 'anonymizeIp', true );
90
- window[GoogleAnalyticsObject]( that.name + '.send', data );
91
- }
92
- }
93
-
94
- advanced_ads_check_adblocker( function( is_enabled ) {
95
- // Send data to Google Analytics if an ad blocker was detected.
96
- if ( is_enabled && 'string' === typeof advanced_ads_ga_UID && advanced_ads_ga_UID ) {
97
- new advadsTracker( 'advadsTracker', advanced_ads_ga_UID );
98
- }
99
- } );
100
- }());
101
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/adblock-finder/public/script.min.js DELETED
@@ -1 +0,0 @@
1
- advanced_ads_check_adblocker=function(t){function e(t){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)}).call(window,t)}var n=[],a=null;return e(function(){var t=document.createElement("div");t.innerHTML="&nbsp;",t.setAttribute("class","ad_unit ad-unit text-ad text_ad pub_300x250"),t.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;"),document.body.appendChild(t),e(function(){var e=window.getComputedStyle&&window.getComputedStyle(t),o=e&&e.getPropertyValue("-moz-binding");a=e&&"none"===e.getPropertyValue("display")||"string"==typeof o&&-1!==o.indexOf("about:");for(var i=0;i<n.length;i++)n[i](a);n=[]})}),function(t){if(null===a)return void n.push(t);t(a)}}(),function(){var t=function(t,e){this.name=t,this.UID=e,this.analyticsObject=null;var n=this,a={hitType:"event",eventCategory:"Advanced Ads",eventAction:"AdBlock",eventLabel:"Yes",nonInteraction:!0,transport:"beacon"};this.analyticsObject="string"==typeof GoogleAnalyticsObject&&"function"==typeof window[GoogleAnalyticsObject]&&window[GoogleAnalyticsObject],!1===this.analyticsObject?(!function(t,e,n,a,o,i,d){t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=1*new Date,i=e.createElement(n),d=e.getElementsByTagName(n)[0],i.async=1,i.src="https://www.google-analytics.com/analytics.js",d.parentNode.insertBefore(i,d)}(window,document,"script",0,"_advads_ga"),_advads_ga("create",n.UID,"auto",this.name),advanced_ads_ga_anonymIP&&_advads_ga("set","anonymizeIp",!0),_advads_ga(n.name+".send",a)):(window.console&&window.console.log("Advanced Ads Analytics >> using other's variable named `"+GoogleAnalyticsObject+"`"),window[GoogleAnalyticsObject]("create",n.UID,"auto",this.name),window[GoogleAnalyticsObject]("set","anonymizeIp",!0),window[GoogleAnalyticsObject](n.name+".send",a))};advanced_ads_check_adblocker(function(e){e&&"string"==typeof advanced_ads_ga_UID&&advanced_ads_ga_UID&&new t("advadsTracker",advanced_ads_ga_UID)})}();
 
modules/gadsense/includes/class-ad-type-adsense.php CHANGED
@@ -236,7 +236,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
236
 
237
  // build static normal content ads first.
238
  if ( $is_static_normal_content ) {
239
- $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
240
  $output .= '<ins class="adsbygoogle" ';
241
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
242
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
@@ -282,6 +282,26 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
282
  ( false !== stripos( $content, 'google_ad_client' ) || false !== stripos( $content, 'data-ad-client' ) );
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  /**
286
  * @param string $output Current ad unit code.
287
  * @param string $pub_id AdSense publisher ID.
@@ -311,7 +331,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
311
  $format = 'auto';
312
  }
313
 
314
- $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
315
  $output .= '<ins class="adsbygoogle" ';
316
  $output .= 'style="' . $style . '" ';
317
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
236
 
237
  // build static normal content ads first.
238
  if ( $is_static_normal_content ) {
239
+ $output .= $this->get_script_tag( $pub_id );
240
  $output .= '<ins class="adsbygoogle" ';
241
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
242
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
282
  ( false !== stripos( $content, 'google_ad_client' ) || false !== stripos( $content, 'data-ad-client' ) );
283
  }
284
 
285
+ /**
286
+ * Build AdSense script tag.
287
+ *
288
+ * @param string $pub_id AdSense publisher ID.
289
+ *
290
+ * @return string
291
+ */
292
+ protected function get_script_tag( $pub_id ) {
293
+ return sprintf(
294
+ // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript -- don't allow any changes on Google AdSense code.
295
+ '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js%s" crossorigin="anonymous"></script>',
296
+ /**
297
+ * Filter the output of the publisher ID appended to the AdSense JavaScript Code.
298
+ *
299
+ * @param boolean
300
+ */
301
+ apply_filters( 'advanced-ads-adsense-publisher-id', true ) ? '?client=ca-' . $pub_id : ''
302
+ );
303
+ }
304
+
305
  /**
306
  * @param string $output Current ad unit code.
307
  * @param string $pub_id AdSense publisher ID.
331
  $format = 'auto';
332
  }
333
 
334
+ $output .= $this->get_script_tag( $pub_id );
335
  $output .= '<ins class="adsbygoogle" ';
336
  $output .= 'style="' . $style . '" ';
337
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
modules/gadsense/public/public.php CHANGED
@@ -96,7 +96,15 @@ class Advanced_Ads_AdSense_Public {
96
  });',
97
  esc_attr( $client_id )
98
  );
99
- $script_src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
 
 
 
 
 
 
 
 
100
 
101
  /**
102
  * Allows to override the page-level code.
96
  });',
97
  esc_attr( $client_id )
98
  );
99
+ /**
100
+ * Filter the output of the publisher ID appended to the AdSense JavaScript Code.
101
+ *
102
+ * @param boolean
103
+ */
104
+ $add_publisher_id = apply_filters( 'advanced-ads-adsense-publisher-id', true );
105
+ $script_src = add_query_arg( array(
106
+ 'client' => $add_publisher_id ? esc_attr( $client_id ) : false,
107
+ ), 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' );
108
 
109
  /**
110
  * Allows to override the page-level code.
modules/gadsense/public/templates/page-level.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Output auto ads enabled code in head
4
  *
5
- * @var bool $privacy_enabled Whether to wait for user consent.
6
- * @var bool $npa_enabled Whether to show non-personalized ads.
7
- * @var string $client_id The Google AdSense client ID.
8
- * @var bool $top_anchor AdSense anchor ad on top of pages.
9
- * @var string $top_anchor_code The code for top anchor ads.
10
- * @var string $script_src AdSense script url.
 
11
  */
12
-
13
  if ( $privacy_enabled ) : ?>
14
  <script>
15
  (function () {
@@ -28,12 +28,13 @@ if ( $privacy_enabled ) : ?>
28
  first = document.getElementsByTagName('script')[0];
29
 
30
  script.async = true;
 
31
  script.src = '<?php echo esc_url( $script_src ); ?>';
32
  <?php
33
  if ( $top_anchor ) {
34
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- relevant user input has already been escaped.
35
  echo $top_anchor_code;
36
- } else {
37
  printf( 'script.dataset.adClient = "%s";', esc_attr( $client_id ) );
38
  }
39
  ?>
@@ -45,7 +46,6 @@ if ( $privacy_enabled ) : ?>
45
  <?php
46
  return;
47
  endif;
48
-
49
  // Privacy not enabled.
50
  // phpcs:disable WordPress.WP.EnqueuedResources
51
  if ( $top_anchor ) {
@@ -56,9 +56,10 @@ if ( $top_anchor ) {
56
  $top_anchor_code
57
  );
58
  } else {
 
59
  printf(
60
- '<script data-ad-client="%s" async src="%s"></script>',
61
- esc_attr( $client_id ),
62
  esc_url( $script_src )
63
  );
64
  }
2
  /**
3
  * Output auto ads enabled code in head
4
  *
5
+ * @var bool $privacy_enabled Whether to wait for user consent.
6
+ * @var bool $npa_enabled Whether to show non-personalized ads.
7
+ * @var string $client_id The Google AdSense client ID.
8
+ * @var bool $top_anchor AdSense anchor ad on top of pages.
9
+ * @var string $top_anchor_code The code for top anchor ads.
10
+ * @var string $script_src AdSense script url.
11
+ * @var bool $add_publisher_id Whether to add the publisher ID to the AdSense JavaScript URL.
12
  */
 
13
  if ( $privacy_enabled ) : ?>
14
  <script>
15
  (function () {
28
  first = document.getElementsByTagName('script')[0];
29
 
30
  script.async = true;
31
+ script.crossOrigin = 'anonymous';
32
  script.src = '<?php echo esc_url( $script_src ); ?>';
33
  <?php
34
  if ( $top_anchor ) {
35
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- relevant user input has already been escaped.
36
  echo $top_anchor_code;
37
+ } elseif ( ! $add_publisher_id ) {
38
  printf( 'script.dataset.adClient = "%s";', esc_attr( $client_id ) );
39
  }
40
  ?>
46
  <?php
47
  return;
48
  endif;
 
49
  // Privacy not enabled.
50
  // phpcs:disable WordPress.WP.EnqueuedResources
51
  if ( $top_anchor ) {
56
  $top_anchor_code
57
  );
58
  } else {
59
+ // Don't add the data-ad-client attribute when the publisher ID is appended to the script URL.
60
  printf(
61
+ '<script %s async src="%s" crossorigin="anonymous"></script>',
62
+ ! $add_publisher_id ? 'data-ad-client="' . esc_attr( $client_id ) . '"' : '',
63
  esc_url( $script_src )
64
  );
65
  }
modules/privacy/admin/admin.php CHANGED
@@ -63,6 +63,19 @@ class Advanced_Ads_Privacy_Admin {
63
  public function settings_init() {
64
  register_setting( ADVADS_PRIVACY_SLUG, Advanced_Ads_Privacy::OPTION_KEY, array( $this, 'sanitize_settings' ) );
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  add_settings_section(
67
  ADVADS_PRIVACY_SLUG . '_settings_section',
68
  '',
63
  public function settings_init() {
64
  register_setting( ADVADS_PRIVACY_SLUG, Advanced_Ads_Privacy::OPTION_KEY, array( $this, 'sanitize_settings' ) );
65
 
66
+ /**
67
+ * Allow Ad Admin to save privacy options.
68
+ *
69
+ * @param array $settings Array with allowed options.
70
+ *
71
+ * @return array
72
+ */
73
+ add_filter( 'advanced-ads-ad-admin-options', function( $options ) {
74
+ $options[] = ADVADS_PRIVACY_SLUG;
75
+
76
+ return $options;
77
+ } );
78
+
79
  add_settings_section(
80
  ADVADS_PRIVACY_SLUG . '_settings_section',
81
  '',
public/assets/js/advanced.js CHANGED
@@ -620,13 +620,7 @@ advads = {
620
  userAction: userAction
621
  } );
622
 
623
- // DOM is ready.
624
- if ( document.readyState !== 'loading' ) {
625
- return fire_event();
626
- }
627
-
628
- // If DOM is still loading, wait for it to be interactive/complete.
629
- document.addEventListener( 'readystatechange', fire_event, {once: true} );
630
  },
631
  /**
632
  * Check if ad is decoded.
@@ -660,11 +654,7 @@ advads = {
660
  }
661
  };
662
 
663
- (
664
- window.advanced_ads_ready || jQuery( document ).ready
665
- ).call( null, function () {
666
- advads.privacy.get_state();
667
- } );
668
 
669
  document.addEventListener( 'advanced_ads_privacy', function ( event ) {
670
  if (
620
  userAction: userAction
621
  } );
622
 
623
+ window.advanced_ads_ready_queue.push( fire_event );
 
 
 
 
 
 
624
  },
625
  /**
626
  * Check if ad is decoded.
654
  }
655
  };
656
 
657
+ window.advanced_ads_ready_queue.push( advads.privacy.get_state );
 
 
 
 
658
 
659
  document.addEventListener( 'advanced_ads_privacy', function ( event ) {
660
  if (
public/assets/js/advanced.min.js CHANGED
@@ -1 +1 @@
1
- !function(){if("function"!=typeof window.CustomEvent){window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var a=document.createEvent("CustomEvent");return a.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),a}}function e(){var e,t=this.parentNode,a=arguments.length;if(t)for(a||t.removeChild(this);a--;)"object"!=typeof(e=arguments[a])?e=this.ownerDocument.createTextNode(e):e.parentNode&&e.parentNode.removeChild(e),a?t.insertBefore(e,this.nextSibling):t.replaceChild(e,this)}Element.prototype.replaceWith||(Element.prototype.replaceWith=e),CharacterData.prototype.replaceWith||(CharacterData.prototype.replaceWith=e),DocumentType.prototype.replaceWith||(DocumentType.prototype.replaceWith=e),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){var a,o=this.length;for(t=t||window,a=0;a<o;a++)e.call(t,this[a],a,this)})}(),advads={supports_localstorage:function(){"use strict";try{return!(!window||void 0===window.localStorage)&&(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0)}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){var t,a,o,n=document.cookie.split(";");for(t=0;t<n.length;t++)if(a=n[t].substr(0,n[t].indexOf("=")),o=n[t].substr(n[t].indexOf("=")+1),(a=a.replace(/^\s+|\s+$/g,""))===e)return unescape(o)},set_cookie:function(e,t,a,o,n,i){var r=null==a?null:24*a*60*60;this.set_cookie_sec(e,t,r,o,n,i)},set_cookie_sec:function(e,t,a,o,n,i){var r=new Date;r.setSeconds(r.getSeconds()+parseInt(a)),document.cookie=e+"="+escape(t)+(null==a?"":"; expires="+r.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==i?"":"; 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);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 n="left";void 0!==a.offset&&(n=a.offset),t=this.find_wrapper(e,n)}switch((t=void 0===a.moveintohidden?jQuery(t).filter(":visible"):jQuery(t)).length>1&&t.length,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){t=void 0!==t?t:{};var 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){t=void 0!==t?t:{};var a=jQuery(e);t.use_grandparent?this.set_parent_relative(a.parent()):this.set_parent_relative(a),t.is_invisible&&a.show();var o=parseInt(a.offset().top),n=parseInt(a.offset().left);if(t.is_invisible&&a.hide(),"left"===t.offset){var i=jQuery(window).width()-n-a.outerWidth();a.css("position","fixed").css("top",o+"px").css("right",i+"px").css("left","")}else a.css("position","fixed").css("top",o+"px").css("left",n+"px").css("right","")},find_wrapper:function(e,t){var a;return jQuery("body").children().each((function(o,n){if(n.id!==e.substring(1)){var i=jQuery(n);if("right"===t&&i.offset().left+jQuery(i).width()<jQuery(window).width()||"left"===t&&i.offset().left>0)return"static"!==i.css("position")&&""!==i.css("position")||i.css("position","relative"),a=n,!1}})),a},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(e,t){var a=0,o=[];e.find('img[src][src!=""]').each((function(){o.push(this.src)})),0===o.length&&t.call(e),jQuery.each(o,(function(n,i){var r=new Image;r.src=i;var s="load error";jQuery(r).one(s,(function n(i){if(jQuery(this).off(s,n),++a==o.length)return t.call(e[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;if("custom"===window.advads_options.privacy["consent-method"]){var e=new RegExp(window.advads_options.privacy["custom-cookie-name"]+"=.*?"+window.advads_options.privacy["custom-cookie-value"]+"[^;]*");advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(null!==document.cookie.match(e)?"accepted":"unknown",!0))}advads.privacy.state_executed=!0;var t=0,a=setInterval((function(){switch(600==++t&&clearInterval(a),window.advads_options.privacy["consent-method"]){case"custom":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||null===e.eventStatus&&void 0!==window.googlefc&&(void 0!==e.purpose||!e.gdprApplies))){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)}}))}}),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,o=function(){document.dispatchEvent(new CustomEvent("advanced_ads_privacy",{detail:{state:e,previousState:a,userAction:t}}))};if(advads.privacy.state=e,"loading"!==document.readyState)return o();document.addEventListener("readystatechange",o,{once:!0})},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(){if(!(!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"),advads.set_cookie("advads_frontend_picker","",-1),1))){var e,t=jQuery("<div id='advads-picker-overlay'>"),a=[document.body,document.documentElement,document];if(t.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},"xpath"===localStorage.getItem("advads_frontend_pathtype"))var o="getXPath";else o="getPath";jQuery(document).mousemove((function(n){if(n.target!==e){if(~a.indexOf(n.target))return e=null,void t.hide();var i=jQuery(n.target),r=i.offset(),s=i.outerWidth(),d=i.outerHeight();e=n.target;var c=jQuery(e)[o]();c&&t.css({top:r.top,left:r.left,width:s,height:d}).show()}})),jQuery(document).click((function(t){var a=jQuery(e)[o]();advads.is_boundary_reached(e)||(localStorage.setItem("advads_frontend_element",a),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=this.get(0).nodeName.toLowerCase(),o=a,n=this.attr("id"),i=this.attr("class"),r=[];if(void 0!==n&&!/\d/.test(n))return o+'[@id and id="'+n+'"]/'+e;if(void 0!==i&&(i=i.split(/[\s\n]+/),(i=jQuery.grep(i,(function(e,t){return!/\d/.test(e)}))).length)){t+=1;r=i.slice(0,2);for(var s=[],d=0;d<r.length;d++)s.push('(@class and contains(concat(" ", normalize-space(@class), " "), " '+r[d]+' "))');o+="["+s.join(" and ")+"]"}if(r.length)var c=this.siblings(a+"."+r.join("."));else c=this.siblings(a);c.length&&(o+="["+c.addBack().not("#advads-picker-overlay").index(this)+"]");return""===e?this.parent().getXPath(o,t):this.parent().getXPath(o+"/"+e,t)}});
1
+ !function(){if("function"!=typeof window.CustomEvent){window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var a=document.createEvent("CustomEvent");return a.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),a}}function e(){var e,t=this.parentNode,a=arguments.length;if(t)for(a||t.removeChild(this);a--;)"object"!=typeof(e=arguments[a])?e=this.ownerDocument.createTextNode(e):e.parentNode&&e.parentNode.removeChild(e),a?t.insertBefore(e,this.nextSibling):t.replaceChild(e,this)}Element.prototype.replaceWith||(Element.prototype.replaceWith=e),CharacterData.prototype.replaceWith||(CharacterData.prototype.replaceWith=e),DocumentType.prototype.replaceWith||(DocumentType.prototype.replaceWith=e),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){var a,o=this.length;for(t=t||window,a=0;a<o;a++)e.call(t,this[a],a,this)})}(),advads={supports_localstorage:function(){"use strict";try{return!(!window||void 0===window.localStorage)&&(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0)}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){var t,a,o,n=document.cookie.split(";");for(t=0;t<n.length;t++)if(a=n[t].substr(0,n[t].indexOf("=")),o=n[t].substr(n[t].indexOf("=")+1),(a=a.replace(/^\s+|\s+$/g,""))===e)return unescape(o)},set_cookie:function(e,t,a,o,n,i){var r=null==a?null:24*a*60*60;this.set_cookie_sec(e,t,r,o,n,i)},set_cookie_sec:function(e,t,a,o,n,i){var r=new Date;r.setSeconds(r.getSeconds()+parseInt(a)),document.cookie=e+"="+escape(t)+(null==a?"":"; expires="+r.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==i?"":"; 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);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 n="left";void 0!==a.offset&&(n=a.offset),t=this.find_wrapper(e,n)}switch((t=void 0===a.moveintohidden?jQuery(t).filter(":visible"):jQuery(t)).length>1&&t.length,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){t=void 0!==t?t:{};var 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){t=void 0!==t?t:{};var a=jQuery(e);t.use_grandparent?this.set_parent_relative(a.parent()):this.set_parent_relative(a),t.is_invisible&&a.show();var o=parseInt(a.offset().top),n=parseInt(a.offset().left);if(t.is_invisible&&a.hide(),"left"===t.offset){var i=jQuery(window).width()-n-a.outerWidth();a.css("position","fixed").css("top",o+"px").css("right",i+"px").css("left","")}else a.css("position","fixed").css("top",o+"px").css("left",n+"px").css("right","")},find_wrapper:function(e,t){var a;return jQuery("body").children().each((function(o,n){if(n.id!==e.substring(1)){var i=jQuery(n);if("right"===t&&i.offset().left+jQuery(i).width()<jQuery(window).width()||"left"===t&&i.offset().left>0)return"static"!==i.css("position")&&""!==i.css("position")||i.css("position","relative"),a=n,!1}})),a},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(e,t){var a=0,o=[];e.find('img[src][src!=""]').each((function(){o.push(this.src)})),0===o.length&&t.call(e),jQuery.each(o,(function(n,i){var r=new Image;r.src=i;var s="load error";jQuery(r).one(s,(function n(i){if(jQuery(this).off(s,n),++a==o.length)return t.call(e[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;if("custom"===window.advads_options.privacy["consent-method"]){var e=new RegExp(window.advads_options.privacy["custom-cookie-name"]+"=.*?"+window.advads_options.privacy["custom-cookie-value"]+"[^;]*");advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(null!==document.cookie.match(e)?"accepted":"unknown",!0))}advads.privacy.state_executed=!0;var t=0,a=setInterval((function(){switch(600==++t&&clearInterval(a),window.advads_options.privacy["consent-method"]){case"custom":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||null===e.eventStatus&&void 0!==window.googlefc&&(void 0!==e.purpose||!e.gdprApplies))){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)}}))}}),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,window.advanced_ads_ready_queue.push((function(){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_queue.push(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(){if(!(!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"),advads.set_cookie("advads_frontend_picker","",-1),1))){var e,t=jQuery("<div id='advads-picker-overlay'>"),a=[document.body,document.documentElement,document];if(t.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},"xpath"===localStorage.getItem("advads_frontend_pathtype"))var o="getXPath";else o="getPath";jQuery(document).mousemove((function(n){if(n.target!==e){if(~a.indexOf(n.target))return e=null,void t.hide();var i=jQuery(n.target),r=i.offset(),s=i.outerWidth(),d=i.outerHeight();e=n.target;var c=jQuery(e)[o]();c&&t.css({top:r.top,left:r.left,width:s,height:d}).show()}})),jQuery(document).click((function(t){var a=jQuery(e)[o]();advads.is_boundary_reached(e)||(localStorage.setItem("advads_frontend_element",a),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=this.get(0).nodeName.toLowerCase(),o=a,n=this.attr("id"),i=this.attr("class"),r=[];if(void 0!==n&&!/\d/.test(n))return o+'[@id and id="'+n+'"]/'+e;if(void 0!==i&&(i=i.split(/[\s\n]+/),(i=jQuery.grep(i,(function(e,t){return!/\d/.test(e)}))).length)){t+=1;r=i.slice(0,2);for(var s=[],d=0;d<r.length;d++)s.push('(@class and contains(concat(" ", normalize-space(@class), " "), " '+r[d]+' "))');o+="["+s.join(" and ")+"]"}if(r.length)var c=this.siblings(a+"."+r.join("."));else c=this.siblings(a);c.length&&(o+="["+c.addBack().not("#advads-picker-overlay").index(this)+"]");return""===e?this.parent().getXPath(o,t):this.parent().getXPath(o+"/"+e,t)}});
public/assets/js/ready-queue.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ window.advanced_ads_ready_queue = window.advanced_ads_ready_queue || [];
2
+
3
+ // replace native push method with our advanced_ads_ready function; do this early to prevent race condition between pushing and the loop.
4
+ advanced_ads_ready_queue.push = window.advanced_ads_ready;
5
+
6
+ // handle all callbacks that have been added to the queue previously.
7
+ for ( var i = 0, length = advanced_ads_ready_queue.length; i < length; i ++ ) {
8
+ advanced_ads_ready( advanced_ads_ready_queue[i] );
9
+ }
public/assets/js/ready-queue.min.js ADDED
@@ -0,0 +1 @@
 
1
+ window.advanced_ads_ready_queue=window.advanced_ads_ready_queue||[],advanced_ads_ready_queue.push=window.advanced_ads_ready;for(var i=0,length=advanced_ads_ready_queue.length;i<length;i++)advanced_ads_ready(advanced_ads_ready_queue[i]);
public/assets/js/ready.js CHANGED
@@ -1,30 +1,26 @@
1
  /**
2
- * Based on domready (c) Dustin Diaz 2014 - License MIT
3
- * https://github.com/ded/domready
 
 
4
  */
5
- advanced_ads_ready = ( function () {
6
- var fns = [],
7
- listener,
8
- doc = typeof document === 'object' && document,
9
- hack = doc && doc.documentElement.doScroll,
10
- domContentLoaded = 'DOMContentLoaded',
11
- loaded = doc && ( hack ? /^loaded|^c/ : /^loaded|^i|^c/ ).test( doc.readyState );
12
-
13
- if ( ! loaded && doc ) {
14
- listener = function () {
15
- doc.removeEventListener( domContentLoaded, listener );
16
- window.removeEventListener( 'load', listener );
17
- loaded = 1;
18
- while ( listener = fns.shift() ) {
19
- listener();
20
- }
21
- };
22
 
23
- doc.addEventListener( domContentLoaded, listener );
24
- window.addEventListener( 'load', listener );
 
 
25
  }
 
 
 
 
 
 
 
26
 
27
- return function ( fn ) {
28
- loaded ? setTimeout( fn, 0 ) : fns.push( fn );
29
- };
30
- } )();
1
  /**
2
+ * Wait for the page to be ready before firing JS.
3
+ *
4
+ * @param {function} callback - A callable function to be executed.
5
+ * @param {string} [requestedState=complete] - document.readyState to wait for. Defaults to 'complete', can be 'interactive'.
6
  */
7
+ window.advanced_ads_ready = function ( callback, requestedState ) {
8
+ requestedState = requestedState || 'complete';
9
+ var checkState = function ( state ) {
10
+ return requestedState === 'interactive' ? state !== 'loading' : state === 'complete';
11
+ };
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ // If we have reached the correct state, fire the callback.
14
+ if ( checkState( document.readyState ) ) {
15
+ callback();
16
+ return;
17
  }
18
+ // We are not yet in the correct state, attach an event handler, only fire once if the requested state is 'interactive'.
19
+ document.addEventListener( 'readystatechange', function ( event ) {
20
+ if ( checkState( event.target.readyState ) ) {
21
+ callback();
22
+ }
23
+ }, {once: requestedState === 'interactive'} );
24
+ };
25
 
26
+ window.advanced_ads_ready_queue = window.advanced_ads_ready_queue || [];
 
 
 
public/assets/js/ready.min.js CHANGED
@@ -1 +1 @@
1
- advanced_ads_ready=function(){var e,t=[],n="object"==typeof document&&document,d=n&&n.documentElement.doScroll,o="DOMContentLoaded",a=n&&(d?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return!a&&n&&(e=function(){for(n.removeEventListener(o,e),window.removeEventListener("load",e),a=1;e=t.shift();)e()},n.addEventListener(o,e),window.addEventListener("load",e)),function(e){a?setTimeout(e,0):t.push(e)}}();
1
+ window.advanced_ads_ready=function(e,a){a=a||"complete";var d=function(e){return"interactive"===a?"loading"!==e:"complete"===e};d(document.readyState)?e():document.addEventListener("readystatechange",(function(a){d(a.target.readyState)&&e()}),{once:"interactive"===a})},window.advanced_ads_ready_queue=window.advanced_ads_ready_queue||[];
public/class-advanced-ads.php CHANGED
@@ -868,17 +868,23 @@ class Advanced_Ads {
868
  public function custom_header_code(){
869
  if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
870
  ?><style>
871
- div.advads-edit-bar{position:relative;top:0;left:0;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
872
  @keyframes advads-edit-appear {
873
- 0% {opacity: 0.0;pointer-events: none;}
874
  66% {opacity: 0.0;}
875
- 100% {opacity: 1.0;}
876
- }
877
- a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;}
878
- a.advads-edit-button span{top:10px;line-height:25px;margin-left:-5px;width:26px;height:26px;border-radius:13px;border:solid 1px #0074a2;background:#fff}
879
- :hover > div.advads-edit-bar {display: block;}
880
- :hover > div.advads-edit-bar ~ div.advads-edit-bar {display: none;}</style>
881
- <?php
 
 
 
 
 
 
882
  }
883
  }
884
 
868
  public function custom_header_code(){
869
  if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
870
  ?><style>
871
+ div.advads-edit-bar{position:absolute;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
872
  @keyframes advads-edit-appear {
873
+ 0% {opacity: 0.0;pointer-events: none;}
874
  66% {opacity: 0.0;}
875
+ 100% {opacity: 1.0;}
876
+ }
877
+ a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;}
878
+ a.advads-edit-button span{top:10px;line-height:25px;margin-left:-5px;width:26px;height:26px;border-radius:13px;border:solid 1px #0074a2;background:#fff}
879
+ <?php
880
+ printf(
881
+ 'div[class^="%s"]:hover > div.advads-edit-bar {display: inline-block; vertical-align: top;}',
882
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
883
+ Advanced_Ads_Plugin::get_instance()->get_frontend_prefix()
884
+ );
885
+ ?>
886
+ </style>
887
+ <?php
888
  }
889
  }
890
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 1.26.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -322,6 +322,17 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
322
 
323
  == Changelog ==
324
 
 
 
 
 
 
 
 
 
 
 
 
325
  = 1.26.0 =
326
 
327
  - overwrite existing options when importing new options
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 1.27.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
322
 
323
  == Changelog ==
324
 
325
+ = 1.27.0 =
326
+
327
+ - Improvement: prevent issues with functionality from other plugins that delay JavaScript execution (WP Rocket, Complianz, et al.).
328
+ - Improvement: unify the layout of the Next buttons in the ad Wizard
329
+ - Improvement: add the updated AdSense code. Added a filter to continue using the old AdSense code. [Learn more](https://wpadvancedads.com/adsense-crossorigin-attribute-performance)
330
+ - Improvement: update Ad Block Counter to work with Google Analytics 4 properties
331
+ - Fix: ensure Ad Admin can save AdSense, Privacy, and License settings
332
+ - Fix: prevent error when "Remove data on uninstall" option is set due to uninitialised constants
333
+ - Fix: ad edit button for ads delivered using groups
334
+ - Fix: improve compatibility with PHP 8 by removing default values from required function parameters
335
+
336
  = 1.26.0 =
337
 
338
  - overwrite existing options when importing new options