Advanced Ads - Version 1.8.19

Version Description

  • delayed Ad Health checks for hidden AdSense ads
  • added fix for WooCommerce store page to work with Specific Pages condition
  • prepared for more AMP features in next update of Responsive add-on
Download this release

Release Info

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

Code changes from version 1.8.18 to 1.8.19

admin/includes/class-overview-widgets.php CHANGED
@@ -71,22 +71,37 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
71
 
72
  $_notice = 'nl_free_addons';
73
  if ( ! $is_subscribed ) {
74
- ?><h3><?php _e( 'Join the newsletter for more benefits', 'advanced-ads' ); ?></h3>
75
- <ul>
76
- <li><?php _e( 'Get 2 free add-ons', 'advanced-ads' ); ?></li>
77
- <li><?php _e( 'Get the first steps and more tutorials to your inbox', 'advanced-ads' ); ?></li>
78
- <li><?php _e( 'How to earn more with AdSense', 'advanced-ads' ); ?></li>
79
- </ul>
80
- <div class="advads-admin-notice">
81
- <button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Join now', 'advanced-ads'); ?></button>
82
- </div><?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
- // link to manage ads
86
- if ( $is_subscribed && count( $recent_ads ) > 0 ) :
87
- echo '<p><a class="button button-secondary" href="' . admin_url( 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) .
88
- '">' . __( 'Manage your ads', 'advanced-ads' ) . '</a></p>';
89
- endif;
90
 
91
  /*$_notice = 'nl_adsense';
92
  if ( ! isset($options['closed'][ $_notice ] ) ) {
71
 
72
  $_notice = 'nl_free_addons';
73
  if ( ! $is_subscribed ) {
74
+ ?><h3><?php _e( 'Join the newsletter for more benefits', 'advanced-ads' ); ?></h3>
75
+ <ul>
76
+ <li><?php _e( 'Get 2 free add-ons', 'advanced-ads' ); ?></li>
77
+ <li><?php _e( 'Get the first steps and more tutorials to your inbox', 'advanced-ads' ); ?></li>
78
+ <li><?php _e( 'How to earn more with AdSense', 'advanced-ads' ); ?></li>
79
+ </ul>
80
+ <div class="advads-admin-notice">
81
+ <button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Join now', 'advanced-ads'); ?></button>
82
+ </div><?php
83
+ } elseif ( count( $recent_ads ) > 3
84
+ && ! isset($options[ 'closed' ][ 'review' ] ) ){
85
+ /**
86
+ * ask for a review if the review message was not closed before
87
+ */
88
+ ?><div class="advads-admin-notice" data-notice="review">
89
+ <p><?php _e( 'Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review.', 'advanced-ads' ); ?>
90
+ <p><span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">
91
+ <?php _e( 'Sure, I’ll rate the plugin', 'advanced-ads' ); ?></a></strong>
92
+ &nbsp;&nbsp;<span class="dashicons dashicons-smiley"></span>&nbsp;<a href="javascript:void(0)" target=_"blank" class="advads-notice-dismiss">
93
+ <?php _e( 'I already did', 'advanced-ads' ); ?></a>
94
+ </p>
95
+ </div><?php
96
+ } elseif ( count( $recent_ads ) > 0 ){
97
+ // link to manage ads
98
+ echo '<p><a class="button button-secondary" href="' . admin_url( 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) .
99
+ '">' . __( 'Manage your ads', 'advanced-ads' ) . '</a></p>';
100
  }
101
 
102
+ if ( $is_subscribed ) {
103
+ ?><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/pro-bundle/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-bundle" target="_blank"><?php _e( 'Get the Pro Bundle', 'advanced-ads' ); ?></a><?php
104
+ }
 
 
105
 
106
  /*$_notice = 'nl_adsense';
107
  if ( ! isset($options['closed'][ $_notice ] ) ) {
admin/includes/notices.php CHANGED
@@ -52,7 +52,7 @@ $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
52
  'type' => 'info',
53
  'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
54
  . '<p>' . sprintf(__( 'You’ve successfully <strong>created %s ads using Advanced Ads</strong>.', 'advanced-ads' ), Advanced_Ads::get_number_of_ads() ) . '</p>'
55
- . '<p>' . __( 'If you share my passion and find Advanced Ads useful then please help spreading the word with a review.', 'advanced-ads' ) . '</p>'
56
  . '<p><em>Thomas & Team</em></p>'
57
  . '<p>'
58
  . '<span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I’ll rate the plugin', 'advanced-ads' ) . '</a></strong>'
52
  'type' => 'info',
53
  'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
54
  . '<p>' . sprintf(__( 'You’ve successfully <strong>created %s ads using Advanced Ads</strong>.', 'advanced-ads' ), Advanced_Ads::get_number_of_ads() ) . '</p>'
55
+ . '<p>' . __( 'Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review.', 'advanced-ads' ) . '</p>'
56
  . '<p><em>Thomas & Team</em></p>'
57
  . '<p>'
58
  . '<span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I’ll rate the plugin', 'advanced-ads' ) . '</a></strong>'
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.18
16
  * Author: Thomas Maier
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, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.8.18' );
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.19
16
  * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.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.19' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/display-conditions.php CHANGED
@@ -802,6 +802,15 @@ class Advanced_Ads_Display_Conditions {
802
  }
803
  }
804
 
 
 
 
 
 
 
 
 
 
805
  if( empty( $ad_options['wp_the_query']['is_singular'] ) ){
806
  if( 'is_not' === $operator ){
807
  return true;
802
  }
803
  }
804
 
805
+ /**
806
+ * WooCommerce Store page fix
807
+ * since WooCommerce changes the post ID of the static page selected to be the product overview page, we need to get the original page id from the WC options
808
+ */
809
+ if ( function_exists( 'is_shop' ) && is_shop() && isset( $options['value'] ) && is_array( $options['value'] ) ) {
810
+ $post_id = get_option( 'woocommerce_shop_page_id' );
811
+ return self::can_display_ids($post_id, $options['value'], $operator);
812
+ }
813
+
814
  if( empty( $ad_options['wp_the_query']['is_singular'] ) ){
815
  if( 'is_not' === $operator ){
816
  return true;
classes/frontend_checks.php CHANGED
@@ -426,7 +426,10 @@ class Advanced_Ads_Frontend_Checks {
426
 
427
  <?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
428
  // show warning if AdSense ad is hidden
429
- advanced_ads_ready( function() {
 
 
 
430
  if ( window.jQuery ) {
431
  var advads_ad_health_check_adsense_hidden_ids = [];
432
  jQuery('ins.adsbygoogle').each( function(){
@@ -448,7 +451,7 @@ class Advanced_Ads_Frontend_Checks {
448
  }
449
  }
450
  }
451
- });
452
 
453
  // highlight AdSense QuickStart ads 3 seconds after site loaded
454
  setTimeout( function(){
426
 
427
  <?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
428
  // show warning if AdSense ad is hidden
429
+ setTimeout( function(){
430
+ advanced_ads_ready( advads_highlight_hidden_adsense );
431
+ }, 2000 );
432
+ function advads_highlight_hidden_adsense(){
433
  if ( window.jQuery ) {
434
  var advads_ad_health_check_adsense_hidden_ids = [];
435
  jQuery('ins.adsbygoogle').each( function(){
451
  }
452
  }
453
  }
454
+ };
455
 
456
  // highlight AdSense QuickStart ads 3 seconds after site loaded
457
  setTimeout( function(){
modules/gadsense/admin/views/adsense-ad-parameters.php CHANGED
@@ -83,4 +83,4 @@ if( $pub_id_errors ) : ?>
83
  <input name="ad-layout-key" id="ad-layout-key" value="<?php echo isset( $layout_key ) ? $layout_key : ''; ?>"/>
84
  </div>
85
  <hr/>
86
- <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content );
83
  <input name="ad-layout-key" id="ad-layout-key" value="<?php echo isset( $layout_key ) ? $layout_key : ''; ?>"/>
84
  </div>
85
  <hr/>
86
+ <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content, $ad );
public/class-advanced-ads.php CHANGED
@@ -278,6 +278,18 @@ class Advanced_Ads {
278
  define( 'ADVADS_ADS_DISABLED', true );
279
  }
280
  };
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
 
283
  /**
278
  define( 'ADVADS_ADS_DISABLED', true );
279
  }
280
  };
281
+
282
+ /**
283
+ * check if ads are disabled on WooCommerce shop page (and currently on shop page)
284
+ * since WooCommerce changes the post ID of the static page selected to be the product overview page, we need to get the original page id from the WC options
285
+ */
286
+ if ( function_exists( 'is_shop' ) && is_shop() ) {
287
+ $shop_id = get_option( 'woocommerce_shop_page_id' );
288
+ $shop_ad_options = get_post_meta( absint( $shop_id ), '_advads_ad_settings', true );
289
+ if ( ! empty( $shop_ad_options['disable_ads'] ) ) {
290
+ define( 'ADVADS_ADS_DISABLED', true );
291
+ }
292
+ }
293
  }
294
 
295
  /**
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.9
7
  Requires PHP: 5.2
8
- Stable tag: 1.8.18
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -230,6 +230,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
230
 
231
  == Changelog ==
232
 
 
 
 
 
 
 
233
  = 1.8.18 =
234
 
235
  * fixed bug when old version of [Tracking](https://wpadvancedads.com/add-ons/tracking/) was running
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.2
8
+ Stable tag: 1.8.19
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
230
 
231
  == Changelog ==
232
 
233
+ = 1.8.19 =
234
+
235
+ * delayed Ad Health checks for hidden AdSense ads
236
+ * added fix for WooCommerce store page to work with Specific Pages condition
237
+ * prepared for more AMP features in next update of Responsive add-on
238
+
239
  = 1.8.18 =
240
 
241
  * fixed bug when old version of [Tracking](https://wpadvancedads.com/add-ons/tracking/) was running