Advanced Ads - Version 1.8.11

Version Description

  • added option to make AdSense background transparent
  • only show missing the_content filter warning if relevant
  • show Ad Health warning if current user looks like a bot
  • fixed showing correct group type options
Download this release

Release Info

Developer webzunft
Plugin Icon 128x128 Advanced Ads
Version 1.8.11
Comparing to
See all releases

Code changes from version 1.8.10 to 1.8.11

admin/assets/css/admin.css CHANGED
@@ -335,6 +335,7 @@ tr:hover .on-hover { display: block; }
335
  - GENERAL
336
  -*/
337
  .advads-error-message { color: red !important; }
 
338
  .advads-success-message { color: green !important; }
339
  .advads-hidden { display: none; }
340
  .advads-loader { display: block; width: 43px; height: 11px; background: url(../img/loader.gif) no-repeat; }
335
  - GENERAL
336
  -*/
337
  .advads-error-message { color: red !important; }
338
+ .advads-error-message a { color: red; text-decoration: underline; }
339
  .advads-success-message { color: green !important; }
340
  .advads-hidden { display: none; }
341
  .advads-loader { display: block; width: 43px; height: 11px; background: url(../img/loader.gif) no-repeat; }
admin/assets/js/admin.js CHANGED
@@ -289,12 +289,18 @@ jQuery( document ).ready(function ($) {
289
  });
290
  function advads_show_group_options( el ){
291
  // first, hide all options except title and type
292
- el.parents('.advads-ad-group-form').find('.advads-option:not(.static)').hide();
293
- var current_type = el.val();
294
-
295
- // now, show only the ones corresponding with the group type
296
- el.parents('.advads-ad-group-form').find( '.advads-group-type-' + current_type ).show();
 
 
 
 
297
  }
 
 
298
  advads_show_group_options( $( '.advads-ad-group-type input:checked' ) );
299
  // group page: hide ads if more than 4 – than only show 3
300
  $('.advads-ad-group-list-ads').each( function(){
289
  });
290
  function advads_show_group_options( el ){
291
  // first, hide all options except title and type
292
+ // iterate through all elements
293
+ el.each( function(){
294
+ var _this = jQuery( this );
295
+ _this.parents('.advads-ad-group-form').find('.advads-option:not(.static)').hide();
296
+ var current_type = _this.val();
297
+
298
+ // now, show only the ones corresponding with the group type
299
+ _this.parents('.advads-ad-group-form').find( '.advads-group-type-' + current_type ).show();
300
+ });
301
  }
302
+ // set default group options for earch group
303
+
304
  advads_show_group_options( $( '.advads-ad-group-type input:checked' ) );
305
  // group page: hide ads if more than 4 – than only show 3
306
  $('.advads-ad-group-list-ads').each( function(){
admin/includes/class-overview-widgets.php CHANGED
@@ -227,9 +227,14 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
227
  $add_ons['tracking']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-tracking/tracking.php&amp', 'activate-plugin_advanced-ads-tracking/tracking.php' );
228
  $add_ons['tracking']['link_title'] = __( 'Activate now', 'advanced-ads' );
229
  $installed_pro_plugins++;
230
- } elseif( class_exists( 'Advanced_Ads_Tracking_Plugin') ) {
231
  $add_ons['tracking']['link'] = ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
232
- $add_ons['tracking']['desc'] = '<a href="' . admin_url( '/admin.php?page=advanced-ads-stats' ) . '">' . __('Visit your ad stats', 'advanced-ads') . '</a>';
 
 
 
 
 
233
  $add_ons['tracking']['installed'] = true;
234
  $add_ons['tracking']['order'] = 20;
235
  $installed_pro_plugins++;
227
  $add_ons['tracking']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=advanced-ads-tracking/tracking.php&amp', 'activate-plugin_advanced-ads-tracking/tracking.php' );
228
  $add_ons['tracking']['link_title'] = __( 'Activate now', 'advanced-ads' );
229
  $installed_pro_plugins++;
230
+ } elseif( class_exists( 'Advanced_Ads_Tracking_Plugin', false ) ) {
231
  $add_ons['tracking']['link'] = ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
232
+ if( 'ga' !== Advanced_Ads_Tracking_Plugin::get_instance ()->get_tracking_method() ){
233
+ // don’t show Tracking link if Analytics method is enabled
234
+ $add_ons['tracking']['desc'] = '<a href="' . admin_url( '/admin.php?page=advanced-ads-stats' ) . '">' . __('Visit your ad stats', 'advanced-ads') . '</a>';
235
+ } else {
236
+ $add_ons['tracking']['desc'] = '';
237
+ }
238
  $add_ons['tracking']['installed'] = true;
239
  $add_ons['tracking']['order'] = 20;
240
  $installed_pro_plugins++;
admin/views/ad-visitor-metabox.php CHANGED
@@ -56,7 +56,9 @@ endif;
56
  <select>
57
  <option value=""><?php _e( '-- choose a condition --', 'advanced-ads' ); ?></option>
58
  <?php foreach ( $visitor_conditions as $_condition_id => $_condition ) : ?>
59
- <option value="<?php echo $_condition_id; ?>"<?php disabled( 1, isset( $_condition['disabled']) ) ?>><?php echo $_condition['label']; ?></option>
 
 
60
  <?php endforeach; ?>
61
  </select>
62
  <button type="button" class="button"><?php _e( 'add', 'advanced-ads' ); ?></button>
56
  <select>
57
  <option value=""><?php _e( '-- choose a condition --', 'advanced-ads' ); ?></option>
58
  <?php foreach ( $visitor_conditions as $_condition_id => $_condition ) : ?>
59
+ <?php if( empty( $_condition['disabled'] ) ) : ?>
60
+ <option value="<?php echo $_condition_id; ?>"><?php echo $_condition['label']; ?></option>
61
+ <?php endif; ?>
62
  <?php endforeach; ?>
63
  </select>
64
  <button type="button" class="button"><?php _e( 'add', 'advanced-ads' ); ?></button>
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.8.10
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.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, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.8.10' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.8.11
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.8.11' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad_placements.php CHANGED
@@ -47,19 +47,19 @@ class Advanced_Ads_Placements {
47
  'title' => __( 'Before Content', 'advanced-ads' ),
48
  'description' => __( 'Injected before the post content.', 'advanced-ads' ),
49
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-before.png',
50
- 'options' => array( 'show_position' => true, 'show_lazy_load' => true )
51
  ),
52
  'post_bottom' => array(
53
  'title' => __( 'After Content', 'advanced-ads' ),
54
  'description' => __( 'Injected after the post content.', 'advanced-ads' ),
55
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-after.png',
56
- 'options' => array( 'show_position' => true, 'show_lazy_load' => true )
57
  ),
58
  'post_content' => array(
59
  'title' => __( 'Content', 'advanced-ads' ),
60
  'description' => __( 'Injected into the content. You can choose the paragraph after which the ad content is displayed.', 'advanced-ads' ),
61
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-within.png',
62
- 'options' => array( 'show_position' => true, 'show_lazy_load' => true )
63
  ),
64
  'sidebar_widget' => array(
65
  'title' => __( 'Sidebar Widget', 'advanced-ads' ),
@@ -509,24 +509,8 @@ class Advanced_Ads_Placements {
509
  // check if there are more elements without limitation
510
  $all_items = $xpath->query( '//' . $tag );
511
  if( $paragraph_id <= $all_items->length ){
512
-
513
- // add item to ad health
514
- global $wp_admin_bar;
515
- if( $wp_admin_bar instanceof WP_Admin_Bar ){
516
- $wp_admin_bar->add_node( array(
517
- 'parent' => 'advanced_ads_ad_health',
518
- 'id' => 'advanced_ads_ad_health_the_content_not_enough_elements',
519
- 'title' => sprintf(__( 'Set <em>%s</em> to show more ads', 'advanced-ads' ), __('Disable level limitation', 'advanced-ads' ) ),
520
- 'href' => admin_url( '/admin.php?page=advanced-ads-settings#top#general' ),
521
- 'meta' => array(
522
- 'class' => 'advanced_ads_ad_health_warning',
523
- 'target' => '_blank'
524
- )
525
- ) );
526
-
527
- // manipulate $display_fine
528
- add_filter( 'advanced-ads-ad-health-display-fine', '__return_false' );
529
- }
530
  }
531
  }
532
 
@@ -549,7 +533,27 @@ class Advanced_Ads_Placements {
549
 
550
  return $content;
551
  }
552
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  /**
554
  * check if the placement can be displayed
555
  *
47
  'title' => __( 'Before Content', 'advanced-ads' ),
48
  'description' => __( 'Injected before the post content.', 'advanced-ads' ),
49
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-before.png',
50
+ 'options' => array( 'show_position' => true, 'show_lazy_load' => true, 'uses_the_content' => true )
51
  ),
52
  'post_bottom' => array(
53
  'title' => __( 'After Content', 'advanced-ads' ),
54
  'description' => __( 'Injected after the post content.', 'advanced-ads' ),
55
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-after.png',
56
+ 'options' => array( 'show_position' => true, 'show_lazy_load' => true, 'uses_the_content' => true )
57
  ),
58
  'post_content' => array(
59
  'title' => __( 'Content', 'advanced-ads' ),
60
  'description' => __( 'Injected into the content. You can choose the paragraph after which the ad content is displayed.', 'advanced-ads' ),
61
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-within.png',
62
+ 'options' => array( 'show_position' => true, 'show_lazy_load' => true, 'uses_the_content' => true )
63
  ),
64
  'sidebar_widget' => array(
65
  'title' => __( 'Sidebar Widget', 'advanced-ads' ),
509
  // check if there are more elements without limitation
510
  $all_items = $xpath->query( '//' . $tag );
511
  if( $paragraph_id <= $all_items->length ){
512
+ // add a warning to ad health
513
+ add_filter( 'advanced-ads-ad-health-nodes', array( 'Advanced_Ads_Placements', 'add_ad_health_node' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
514
  }
515
  }
516
 
533
 
534
  return $content;
535
  }
536
+
537
+ /**
538
+ * Add a warning to 'Ad health'.
539
+ *
540
+ * @param array $nodes.
541
+ * @return array $nodes.
542
+ */
543
+ public static function add_ad_health_node( $nodes ) {
544
+ $nodes[] = array( 'type' => 1, 'data' => array(
545
+ 'parent' => 'advanced_ads_ad_health',
546
+ 'id' => 'advanced_ads_ad_health_the_content_not_enough_elements',
547
+ 'title' => sprintf(__( 'Set <em>%s</em> to show more ads', 'advanced-ads' ), __('Disable level limitation', 'advanced-ads' ) ),
548
+ 'href' => admin_url( '/admin.php?page=advanced-ads-settings#top#general' ),
549
+ 'meta' => array(
550
+ 'class' => 'advanced_ads_ad_health_warning',
551
+ 'target' => '_blank'
552
+ )
553
+ ) );
554
+ return $nodes;
555
+ }
556
+
557
  /**
558
  * check if the placement can be displayed
559
  *
classes/frontend_checks.php CHANGED
@@ -51,16 +51,10 @@ class Advanced_Ads_Frontend_Checks {
51
  global $wp_the_query, $post, $wp_scripts;
52
 
53
  $options = Advanced_Ads_Plugin::get_instance()->options();
54
- $display_fine = true;
55
 
56
  // load AdSense related options
57
  $adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
58
 
59
- $wp_admin_bar->add_node( array(
60
- 'id' => 'advanced_ads_ad_health',
61
- 'title' => __( 'Ad Health', 'advanced-ads' ),
62
- ) );
63
-
64
  // check if jQuery is loaded in the header
65
  // Hidden, will be shown using js.
66
  // message removed after we fixed all issues we know of
@@ -78,7 +72,7 @@ class Advanced_Ads_Frontend_Checks {
78
  // check if AdSense loads QuickStart ads
79
  // Hidden, will be shown using js.
80
  if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
81
- $wp_admin_bar->add_node( array(
82
  'parent' => 'advanced_ads_ad_health',
83
  'id' => 'advanced_ads_quickstart_displayed',
84
  'title' => __( 'Random AdSense ads', 'advanced-ads' ),
@@ -89,10 +83,24 @@ class Advanced_Ads_Frontend_Checks {
89
  )
90
  ) );
91
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  // check if an ad blocker is enabled
94
  // Hidden, will be shown using js.
95
- $wp_admin_bar->add_node( array(
96
  'parent' => 'advanced_ads_ad_health',
97
  'id' => 'advanced_ads_ad_health_adblocker_enabled',
98
  'title' => __( 'Ad blocker enabled', 'advanced-ads' ),
@@ -104,26 +112,33 @@ class Advanced_Ads_Frontend_Checks {
104
  ) );
105
 
106
  if ( $wp_the_query->is_singular() ) {
107
-
108
  if ( ! $this->did_the_content ) {
109
- $wp_admin_bar->add_node( array(
110
- 'parent' => 'advanced_ads_ad_health',
111
- 'id' => 'advanced_ads_ad_health_the_content_not_invoked',
112
- 'title' => sprintf( __( '<em>%s</em> filter does not exist', 'advanced-ads' ), 'the_content' ),
113
- 'href' => 'https://wpadvancedads.com/manual/ads-not-showing-up/#frontend-issues-the-content-filter',
114
- 'meta' => array(
115
- 'class' => 'advanced_ads_ad_health_warning',
116
- 'target' => '_blank'
117
- )
118
- ) );
119
- $display_fine = false;
 
 
 
 
 
 
 
 
120
  }
121
 
122
  if ( ! empty( $post->ID ) ) {
123
  $ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
124
 
125
  if ( ! empty( $ad_settings['disable_ads'] ) ) {
126
- $wp_admin_bar->add_node( array(
127
  'parent' => 'advanced_ads_ad_health',
128
  'id' => 'advanced_ads_ad_health_disabled_on_page',
129
  'title' => __( 'Ads are disabled on this page', 'advanced-ads' ),
@@ -133,11 +148,10 @@ class Advanced_Ads_Frontend_Checks {
133
  'target' => '_blank'
134
  )
135
  ) );
136
- $display_fine = false;
137
  }
138
 
139
  if ( ! empty( $ad_settings['disable_the_content'] ) ) {
140
- $wp_admin_bar->add_node( array(
141
  'parent' => 'advanced_ads_ad_health',
142
  'id' => 'advanced_ads_ad_health_disabled_in_content',
143
  'title' => __( 'Ads are disabled in the content of this page', 'advanced-ads' ),
@@ -147,10 +161,9 @@ class Advanced_Ads_Frontend_Checks {
147
  'target' => '_blank'
148
  )
149
  ) );
150
- $display_fine = false;
151
  }
152
  } else {
153
- $wp_admin_bar->add_node( array(
154
  'parent' => 'advanced_ads_ad_health',
155
  'id' => 'advanced_ads_ad_health_post_zero',
156
  'title' => __( 'the current post ID is 0 ', 'advanced-ads' ),
@@ -160,12 +173,11 @@ class Advanced_Ads_Frontend_Checks {
160
  'target' => '_blank'
161
  )
162
  ) );
163
- $display_fine = false;
164
  }
165
  }
166
 
167
  if ( ! empty( $options['disabled-ads']['all'] ) ) {
168
- $wp_admin_bar->add_node( array(
169
  'parent' => 'advanced_ads_ad_health',
170
  'id' => 'advanced_ads_ad_health_no_all',
171
  'title' => __( 'Ads are disabled on all pages', 'advanced-ads' ),
@@ -175,11 +187,10 @@ class Advanced_Ads_Frontend_Checks {
175
  'target' => '_blank'
176
  )
177
  ) );
178
- $display_fine = false;
179
  }
180
 
181
  if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
182
- $wp_admin_bar->add_node( array(
183
  'parent' => 'advanced_ads_ad_health',
184
  'id' => 'advanced_ads_ad_health_no_404',
185
  'title' => __( 'Ads are disabled on 404 pages', 'advanced-ads' ),
@@ -189,11 +200,10 @@ class Advanced_Ads_Frontend_Checks {
189
  'target' => '_blank'
190
  )
191
  ) );
192
- $display_fine = false;
193
  }
194
 
195
  if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ){
196
- $wp_admin_bar->add_node( array(
197
  'parent' => 'advanced_ads_ad_health',
198
  'id' => 'advanced_ads_ad_health_no_archive',
199
  'title' => __( 'Ads are disabled on non singular pages', 'advanced-ads' ),
@@ -203,11 +213,10 @@ class Advanced_Ads_Frontend_Checks {
203
  'target' => '_blank'
204
  )
205
  ) );
206
- $display_fine = false;
207
  }
208
 
209
  if ( ! extension_loaded( 'dom' ) ) {
210
- $wp_admin_bar->add_node( array(
211
  'parent' => 'advanced_ads_ad_health',
212
  'id' => 'advanced_ads_ad_health_no_dom_document',
213
  'title' => sprintf( __( 'The %s extension(s) is not loaded', 'advanced-ads' ), 'dom' ),
@@ -217,10 +226,9 @@ class Advanced_Ads_Frontend_Checks {
217
  'target' => '_blank'
218
  )
219
  ) );
220
- $display_fine = false;
221
  }
222
 
223
- $wp_admin_bar->add_node( array(
224
  'parent' => 'advanced_ads_ad_health',
225
  'id' => 'advanced_ads_ad_health_has_http',
226
  'title' => sprintf( '%s %s',
@@ -236,7 +244,7 @@ class Advanced_Ads_Frontend_Checks {
236
 
237
  // warn if an AdSense ad seems to be hidden
238
  if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
239
- $wp_admin_bar->add_node( array(
240
  'parent' => 'advanced_ads_ad_health',
241
  'id' => 'advanced_ads_ad_health_hidden_adsense',
242
  'title' => sprintf( '%s: %s. %s',
@@ -252,21 +260,7 @@ class Advanced_Ads_Frontend_Checks {
252
  ) );
253
  }
254
 
255
- $display_fine = apply_filters( 'advanced-ads-ad-health-display-fine', $display_fine );
256
-
257
- if ( $display_fine ) {
258
- $wp_admin_bar->add_node( array(
259
- 'parent' => 'advanced_ads_ad_health',
260
- 'id' => 'advanced_ads_ad_health_fine',
261
- 'title' => __( 'Everything is fine', 'advanced-ads' ),
262
- 'href' => false,
263
- 'meta' => array(
264
- 'target' => '_blank',
265
- )
266
- ) );
267
- }
268
-
269
- $wp_admin_bar->add_node( array(
270
  'parent' => 'advanced_ads_ad_health',
271
  'id' => 'advanced_ads_ad_health_debug_dfp',
272
  'title' => __( 'debug DFP ads', 'advanced-ads' ),
@@ -277,11 +271,61 @@ class Advanced_Ads_Frontend_Checks {
277
  )
278
  ) );
279
 
280
- $wp_admin_bar->add_node( array(
281
  'parent' => 'advanced_ads_ad_health',
282
  'id' => 'advanced_ads_ad_health_highlight_ads',
283
  'title' => sprintf( '<label style="color: inherit;"><input id="advanced_ads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'advanced-ads' ) )
284
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  }
286
 
287
  /**
51
  global $wp_the_query, $post, $wp_scripts;
52
 
53
  $options = Advanced_Ads_Plugin::get_instance()->options();
 
54
 
55
  // load AdSense related options
56
  $adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
57
 
 
 
 
 
 
58
  // check if jQuery is loaded in the header
59
  // Hidden, will be shown using js.
60
  // message removed after we fixed all issues we know of
72
  // check if AdSense loads QuickStart ads
73
  // Hidden, will be shown using js.
74
  if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
75
+ $nodes[] = array( 'type' => 2, 'data' => array(
76
  'parent' => 'advanced_ads_ad_health',
77
  'id' => 'advanced_ads_quickstart_displayed',
78
  'title' => __( 'Random AdSense ads', 'advanced-ads' ),
83
  )
84
  ) );
85
  }
86
+
87
+ // check if current user was identified as a bot
88
+ if( Advanced_Ads::get_instance()->is_bot() ) {
89
+ $nodes[] = array( 'type' => 1, 'data' => array(
90
+ 'parent' => 'advanced_ads_ad_health',
91
+ 'id' => 'advanced_ads_user_is_bot',
92
+ 'title' => __( 'You look like a bot', 'advanced-ads' ),
93
+ 'href' => ADVADS_URL . 'manual/ad-health/#look-like-bot',
94
+ 'meta' => array(
95
+ 'class' => 'advanced_ads_ad_health_warning',
96
+ 'target' => '_blank'
97
+ )
98
+ ) );
99
+ }
100
 
101
  // check if an ad blocker is enabled
102
  // Hidden, will be shown using js.
103
+ $nodes[] = array( 'type' => 2, 'data' => array(
104
  'parent' => 'advanced_ads_ad_health',
105
  'id' => 'advanced_ads_ad_health_adblocker_enabled',
106
  'title' => __( 'Ad blocker enabled', 'advanced-ads' ),
112
  ) );
113
 
114
  if ( $wp_the_query->is_singular() ) {
 
115
  if ( ! $this->did_the_content ) {
116
+ $placements = Advanced_Ads::get_ad_placements_array();
117
+ $placement_types = Advanced_Ads_Placements::get_placement_types();
118
+ // Find a placement that depends on 'the_content' filter.
119
+ foreach ( $placements as $placement ) {
120
+ if ( isset ( $placement['type'] )
121
+ && ! empty( $placement_types[ $placement['type'] ]['options']['uses_the_content'] ) ) {
122
+ $nodes[] = array( 'type' => 1, 'data' => array(
123
+ 'parent' => 'advanced_ads_ad_health',
124
+ 'id' => 'advanced_ads_ad_health_the_content_not_invoked',
125
+ 'title' => sprintf( __( '<em>%s</em> filter does not exist', 'advanced-ads' ), 'the_content' ),
126
+ 'href' => 'https://wpadvancedads.com/manual/ads-not-showing-up/#frontend-issues-the-content-filter',
127
+ 'meta' => array(
128
+ 'class' => 'advanced_ads_ad_health_warning',
129
+ 'target' => '_blank'
130
+ )
131
+ ) );
132
+ break;
133
+ }
134
+ }
135
  }
136
 
137
  if ( ! empty( $post->ID ) ) {
138
  $ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
139
 
140
  if ( ! empty( $ad_settings['disable_ads'] ) ) {
141
+ $nodes[] = array( 'type' => 1, 'data' => array(
142
  'parent' => 'advanced_ads_ad_health',
143
  'id' => 'advanced_ads_ad_health_disabled_on_page',
144
  'title' => __( 'Ads are disabled on this page', 'advanced-ads' ),
148
  'target' => '_blank'
149
  )
150
  ) );
 
151
  }
152
 
153
  if ( ! empty( $ad_settings['disable_the_content'] ) ) {
154
+ $nodes[] = array( 'type' => 1, 'data' => array(
155
  'parent' => 'advanced_ads_ad_health',
156
  'id' => 'advanced_ads_ad_health_disabled_in_content',
157
  'title' => __( 'Ads are disabled in the content of this page', 'advanced-ads' ),
161
  'target' => '_blank'
162
  )
163
  ) );
 
164
  }
165
  } else {
166
+ $nodes[] = array( 'type' => 1, 'data' => array(
167
  'parent' => 'advanced_ads_ad_health',
168
  'id' => 'advanced_ads_ad_health_post_zero',
169
  'title' => __( 'the current post ID is 0 ', 'advanced-ads' ),
173
  'target' => '_blank'
174
  )
175
  ) );
 
176
  }
177
  }
178
 
179
  if ( ! empty( $options['disabled-ads']['all'] ) ) {
180
+ $nodes[] = array( 'type' => 1, 'data' => array(
181
  'parent' => 'advanced_ads_ad_health',
182
  'id' => 'advanced_ads_ad_health_no_all',
183
  'title' => __( 'Ads are disabled on all pages', 'advanced-ads' ),
187
  'target' => '_blank'
188
  )
189
  ) );
 
190
  }
191
 
192
  if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
193
+ $nodes[] = array( 1, array(
194
  'parent' => 'advanced_ads_ad_health',
195
  'id' => 'advanced_ads_ad_health_no_404',
196
  'title' => __( 'Ads are disabled on 404 pages', 'advanced-ads' ),
200
  'target' => '_blank'
201
  )
202
  ) );
 
203
  }
204
 
205
  if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ){
206
+ $nodes[] = array( 'type' => 1, 'data' => array(
207
  'parent' => 'advanced_ads_ad_health',
208
  'id' => 'advanced_ads_ad_health_no_archive',
209
  'title' => __( 'Ads are disabled on non singular pages', 'advanced-ads' ),
213
  'target' => '_blank'
214
  )
215
  ) );
 
216
  }
217
 
218
  if ( ! extension_loaded( 'dom' ) ) {
219
+ $nodes[] = array( 'type' => 1, 'data' => array(
220
  'parent' => 'advanced_ads_ad_health',
221
  'id' => 'advanced_ads_ad_health_no_dom_document',
222
  'title' => sprintf( __( 'The %s extension(s) is not loaded', 'advanced-ads' ), 'dom' ),
226
  'target' => '_blank'
227
  )
228
  ) );
 
229
  }
230
 
231
+ $nodes[] = array( 'type' => 2, 'data' => array(
232
  'parent' => 'advanced_ads_ad_health',
233
  'id' => 'advanced_ads_ad_health_has_http',
234
  'title' => sprintf( '%s %s',
244
 
245
  // warn if an AdSense ad seems to be hidden
246
  if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
247
+ $nodes[] = array( 'type' => 2, 'data' => array(
248
  'parent' => 'advanced_ads_ad_health',
249
  'id' => 'advanced_ads_ad_health_hidden_adsense',
250
  'title' => sprintf( '%s: %s. %s',
260
  ) );
261
  }
262
 
263
+ $nodes[] = array( 'type' => 3, 'data' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  'parent' => 'advanced_ads_ad_health',
265
  'id' => 'advanced_ads_ad_health_debug_dfp',
266
  'title' => __( 'debug DFP ads', 'advanced-ads' ),
271
  )
272
  ) );
273
 
274
+ $nodes[] = array( 'type' => 3, 'data' => array(
275
  'parent' => 'advanced_ads_ad_health',
276
  'id' => 'advanced_ads_ad_health_highlight_ads',
277
  'title' => sprintf( '<label style="color: inherit;"><input id="advanced_ads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'advanced-ads' ) )
278
  ) );
279
+
280
+ /**
281
+ * Add new node.
282
+ *
283
+ * @param array $node An array that contains:
284
+ * 'type' => 1 - warning, 2 - hidden warning that will be shown using JS, 3 - info message
285
+ * 'data': @see WP_Admin_Bar->add_node
286
+ * @param obj $wp_admin_bar
287
+ */
288
+ $nodes = apply_filters( 'advanced-ads-ad-health-nodes', $nodes );
289
+ usort( $nodes, array( $this, 'sort_nodes' ) );
290
+
291
+ $wp_admin_bar->add_node( array(
292
+ 'id' => 'advanced_ads_ad_health',
293
+ 'title' => __( 'Ad Health', 'advanced-ads' ),
294
+ ) );
295
+
296
+ $display_fine = true;
297
+
298
+ foreach ( $nodes as $node ) {
299
+ if ( ! isset( $node['type'] ) || ! isset( $node['data'] ) ) { continue; }
300
+ if ( $node['type'] === 1 ) { $display_fine = false; }
301
+ $wp_admin_bar->add_node( $node['data'] );
302
+ }
303
+
304
+ if ( $display_fine ) {
305
+ $wp_admin_bar->add_node( array(
306
+ 'parent' => 'advanced_ads_ad_health',
307
+ 'id' => 'advanced_ads_ad_health_fine',
308
+ 'title' => __( 'Everything is fine', 'advanced-ads' ),
309
+ 'href' => false,
310
+ 'meta' => array(
311
+ 'target' => '_blank',
312
+ )
313
+ ) );
314
+ }
315
+
316
+ }
317
+
318
+ /**
319
+ * Sort nodes.
320
+ */
321
+ function sort_nodes( $a, $b ) {
322
+ if ( ! isset( $a['type'] ) || ! isset( $b['type'] ) ) {
323
+ return 0;
324
+ }
325
+ if ( $a['type'] == $b['type'] ) {
326
+ return 0;
327
+ }
328
+ return ( $a['type'] < $b['type'] ) ? -1 : 1;
329
  }
330
 
331
  /**
modules/gadsense/admin/admin.php CHANGED
@@ -162,6 +162,14 @@ class Advanced_Ads_AdSense_Admin {
162
  'advanced_ads_adsense_setting_section'
163
  );
164
 
 
 
 
 
 
 
 
 
165
  // hook for additional settings from add-ons
166
  do_action( 'advanced-ads-adsense-settings-init', $hook );
167
  }
@@ -243,6 +251,17 @@ class Advanced_Ads_AdSense_Admin {
243
  <p class="description"><?php printf(__( 'Our <a href="%s" target="_blank">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-quickstart/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-quickstart-ads' ); ?></p><?php
244
  }
245
 
 
 
 
 
 
 
 
 
 
 
 
246
  /**
247
  * sanitize adsense settings
248
  *
162
  'advanced_ads_adsense_setting_section'
163
  );
164
 
165
+ add_settings_field(
166
+ 'adsense-background',
167
+ __( 'Transparent background', 'advanced-ads' ),
168
+ array( $this, 'render_settings_adsense_background' ),
169
+ $hook,
170
+ 'advanced_ads_adsense_setting_section'
171
+ );
172
+
173
  // hook for additional settings from add-ons
174
  do_action( 'advanced-ads-adsense-settings-init', $hook );
175
  }
251
  <p class="description"><?php printf(__( 'Our <a href="%s" target="_blank">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-quickstart/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-quickstart-ads' ); ?></p><?php
252
  }
253
 
254
+ /**
255
+ * Render transparent background setting.
256
+ */
257
+ public function render_settings_adsense_background() {
258
+ $options = $this->data->get_options();
259
+ $background = $options['background'];
260
+
261
+ ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[background]" value="1" <?php checked( $background ); ?> />
262
+ <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
263
+ }
264
+
265
  /**
266
  * sanitize adsense settings
267
  *
modules/gadsense/includes/class-gadsense-data.php CHANGED
@@ -29,6 +29,9 @@ class Advanced_Ads_AdSense_Data {
29
  $options['page-level-enabled'] = false;
30
 
31
  }
 
 
 
32
 
33
  $this->options = $options;
34
 
29
  $options['page-level-enabled'] = false;
30
 
31
  }
32
+ if ( ! isset( $options['background'] ) ) {
33
+ $options['background'] = false;
34
+ }
35
 
36
  $this->options = $options;
37
 
modules/gadsense/public/public.php CHANGED
@@ -19,12 +19,20 @@ class Advanced_Ads_AdSense_Public {
19
  }
20
 
21
  /**
22
- * inject page-level header code
23
- *
24
- * @since 1.6.9
25
  */
26
  public function inject_header(){
27
  $options = $this->data->get_options();
 
 
 
 
 
 
 
 
 
 
28
  $pub_id = trim( $this->data->get_adsense_id() );
29
 
30
  if( ! defined( 'ADVADS_ADS_DISABLED' ) && $pub_id && isset( $options['page-level-enabled'] ) && $options['page-level-enabled'] ){
19
  }
20
 
21
  /**
22
+ * Print data in the head tag on the front end.
 
 
23
  */
24
  public function inject_header(){
25
  $options = $this->data->get_options();
26
+
27
+ // Inject CSS to make AdSense background transparent.
28
+ if ( ! empty( $options['background'] ) ) {
29
+ echo '<style>ins.adsbygoogle { background-color: transparent; }</style>';
30
+ }
31
+ /**
32
+ * inject page-level header code
33
+ *
34
+ * @since 1.6.9
35
+ */
36
  $pub_id = trim( $this->data->get_adsense_id() );
37
 
38
  if( ! defined( 'ADVADS_ADS_DISABLED' ) && $pub_id && isset( $options['page-level-enabled'] ) && $options['page-level-enabled'] ){
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, ad
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
  Requires PHP: 5.2
8
- Stable tag: 1.8.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -102,12 +102,14 @@ Placements to insert ads in pre-defined positions in your theme and content. [Li
102
  * hide AdSense advertisements on 404 pages by default (to comply with AdSense terms)
103
  * insert AdSense verification, Page-Level ads and QuickStart code
104
  * Ad Health integration and AdSense violation checks
 
105
  * assistant for exact sizes of responsive ads with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
106
 
107
  = ad blocker =
108
 
109
  * basic features to prevent ad blocks from being removed by AdBlock and others
110
  * prevent ad blockers from breaking sites where plugin scripts are running
 
111
 
112
  Learn more on the [plugin homepage](https://wpadvancedads.com).
113
 
@@ -115,7 +117,7 @@ Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese, Vie
115
 
116
  > <strong>Add-Ons</strong>
117
  >
118
- > * [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/) – powerful tools for ad optimizations: cache-busting, more placements, etc.
119
  > * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles.
120
  > * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on geo location of the visitor
121
  > * [Tracking](https://wpadvancedads.com/add-ons/tracking/) – ad tracking and statistics
@@ -206,6 +208,13 @@ There is a dedicated Flash ad type in [Pro](https://wpadvancedads.com/add-ons/ad
206
  Yes. It works out of the box with all site builders that allow shortcodes or widgets, like SiteOrigin, Beaver Builder, Visual Composer, and others.
207
  There is also a [free add-on to support Visual Composer](https://wordpress.org/plugins/ads-for-visual-composer/).
208
 
 
 
 
 
 
 
 
209
  = I am a developer. Can I customize the plugin? =
210
 
211
  Yes. Advanced Ads is based on WordPress standards and therefore easily customizable using either WordPress hooks or the ones we defined [here](https://wpadvancedads.com/codex/).
@@ -220,6 +229,13 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
220
 
221
  == Changelog ==
222
 
 
 
 
 
 
 
 
223
  = 1.8.10 =
224
 
225
  * added Ad Health warning if ads are disabled in the frontend
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
  Requires PHP: 5.2
8
+ Stable tag: 1.8.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
102
  * hide AdSense advertisements on 404 pages by default (to comply with AdSense terms)
103
  * insert AdSense verification, Page-Level ads and QuickStart code
104
  * Ad Health integration and AdSense violation checks
105
+ * option to make the AdSense background transparent
106
  * assistant for exact sizes of responsive ads with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
107
 
108
  = ad blocker =
109
 
110
  * basic features to prevent ad blocks from being removed by AdBlock and others
111
  * prevent ad blockers from breaking sites where plugin scripts are running
112
+ * show alternative content to ad block users with [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
113
 
114
  Learn more on the [plugin homepage](https://wpadvancedads.com).
115
 
117
 
118
  > <strong>Add-Ons</strong>
119
  >
120
+ > * [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/) – powerful tools for ad optimizations: cache-busting, more placements, lazy load, ad blocker module, click fraud, and more
121
  > * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles.
122
  > * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on geo location of the visitor
123
  > * [Tracking](https://wpadvancedads.com/add-ons/tracking/) – ad tracking and statistics
208
  Yes. It works out of the box with all site builders that allow shortcodes or widgets, like SiteOrigin, Beaver Builder, Visual Composer, and others.
209
  There is also a [free add-on to support Visual Composer](https://wordpress.org/plugins/ads-for-visual-composer/).
210
 
211
+ = Will ads show up for ad block users? =
212
+
213
+ Visitors who have any ad blocker (e.g., AdBlock Plus) enabled won’t see ads from known external sources (e.g., AdSense).
214
+ You can still monetize those spots with custom content.
215
+
216
+ Read more about ad blockers and the features Advanced Ads has to deal with them [on this page](https://wpadvancedads.com/manual/ad-blockers/).
217
+
218
  = I am a developer. Can I customize the plugin? =
219
 
220
  Yes. Advanced Ads is based on WordPress standards and therefore easily customizable using either WordPress hooks or the ones we defined [here](https://wpadvancedads.com/codex/).
229
 
230
  == Changelog ==
231
 
232
+ = 1.8.11 =
233
+
234
+ * added option to make AdSense background transparent
235
+ * only show missing the_content filter warning if relevant
236
+ * show Ad Health warning if current user looks like a bot
237
+ * fixed showing correct group type options
238
+
239
  = 1.8.10 =
240
 
241
  * added Ad Health warning if ads are disabled in the frontend