Advanced Ads - Version 1.21.0

Version Description

  • enable Position options for Sidebar placements
  • increased default weight for ads imported to a group from 1 to 5 which is mostly relevant when selling ads to existing placements
  • Ad Health: added body classes that explain plugin behavior at given moment
  • ads.txt: prevented converting special characters into HTML entities
  • show ad overview list even if all ads were moved to trash
  • fixed error when specific ACF function does not exist
  • fixed option to disable ads also on the "Posts page" as set in the WordPress Reading settings
Download this release

Release Info

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

Code changes from version 1.20.3 to 1.21.0

admin/assets/css/admin.css CHANGED
@@ -610,6 +610,13 @@ tr.advads-clickable-row:hover{
610
  .advads-option-table tbody td { display: table-cell; }
611
  .advads-option-table tbody td:before { display: none; }
612
  }
 
 
 
 
 
 
 
613
 
614
 
615
  /**
610
  .advads-option-table tbody td { display: table-cell; }
611
  .advads-option-table tbody td:before { display: none; }
612
  }
613
+ @media screen and (min-width: 1150px) {
614
+ /* tables */
615
+ .advads-option-table-responsive { width:100%; }
616
+ .advads-option-table-responsive thead { display: table-header-group; }
617
+ .advads-option-table-responsive tbody td { display: table-cell; }
618
+ .advads-option-table-responsive tbody td:before { display: none; }
619
+ }
620
 
621
 
622
  /**
admin/assets/js/admin.js CHANGED
@@ -1267,6 +1267,7 @@ if ( ! window.AdvancedAdsAdmin.AdImporter ) window.AdvancedAdsAdmin.AdImporter =
1267
  AdvancedAdsAdmin.AdImporter.refreshAds()
1268
  }
1269
  }
 
1270
  AdvancedAdsAdmin.AdImporter.resizeAdListHeader()
1271
  },
1272
  /**
@@ -1333,13 +1334,17 @@ if ( ! window.AdvancedAdsAdmin.AdImporter ) window.AdvancedAdsAdmin.AdImporter =
1333
  AdvancedAdsAdmin.AdImporter.adNetwork.updateAdFromList( slotId )
1334
  break
1335
  case 'toggleidle':
1336
- AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle = ! AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle
1337
- AdvancedAdsAdmin.AdImporter.toggleIdleAds( AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle )
1338
- const $inactiveNotice = jQuery('#mapi-notice-inactive');
1339
- if ($inactiveNotice.length) {
1340
- $inactiveNotice.toggle(AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle);
 
 
 
 
 
1341
  }
1342
- break;
1343
  default:
1344
  }
1345
  } )
@@ -1468,7 +1473,7 @@ if ( ! window.AdvancedAdsAdmin.AdImporter ) window.AdvancedAdsAdmin.AdImporter =
1468
  */
1469
  refreshAds: function () {
1470
  const adNetwork = AdvancedAdsAdmin.AdImporter.adNetwork
1471
- jQuery( '#mapi-loading-overlay' ).css( 'display', 'block' )
1472
  jQuery.ajax( {
1473
  type: 'post',
1474
  url: ajaxurl,
1267
  AdvancedAdsAdmin.AdImporter.refreshAds()
1268
  }
1269
  }
1270
+ jQuery( '#wpwrap' ).trigger( 'advads-mapi-adlist-opened' );
1271
  AdvancedAdsAdmin.AdImporter.resizeAdListHeader()
1272
  },
1273
  /**
1334
  AdvancedAdsAdmin.AdImporter.adNetwork.updateAdFromList( slotId )
1335
  break
1336
  case 'toggleidle':
1337
+ if ( 'undefined' != typeof AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction && 'function' == typeof AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction( 'toggleidle' ) ) {
1338
+ AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction( 'toggleidle' )( ev, this );
1339
+ } else {
1340
+ AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle = ! AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle
1341
+ AdvancedAdsAdmin.AdImporter.toggleIdleAds( AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle )
1342
+ const $inactiveNotice = jQuery( '#mapi-notice-inactive' );
1343
+ if ( $inactiveNotice.length ) {
1344
+ $inactiveNotice.toggle( AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle );
1345
+ }
1346
+ break;
1347
  }
 
1348
  default:
1349
  }
1350
  } )
1473
  */
1474
  refreshAds: function () {
1475
  const adNetwork = AdvancedAdsAdmin.AdImporter.adNetwork
1476
+ jQuery( '#mapi-loading-overlay' ).css( 'display', 'block' );
1477
  jQuery.ajax( {
1478
  type: 'post',
1479
  url: ajaxurl,
admin/includes/class-list-filters.php CHANGED
@@ -268,20 +268,26 @@ class Advanced_Ads_Ad_List_Filters {
268
  * @return mixed
269
  */
270
  public function orderby_filter( $orderby, $the_query ) {
 
 
 
 
 
271
  if ( ! function_exists( 'get_current_screen' ) ) {
272
- return;
273
  }
 
274
  $scr = get_current_screen();
275
- global $wpdb;
 
 
 
276
 
277
- // execute only on the first query.
278
- if ( ! $scr ) {
279
- // and only on the ad list page.
280
- $request = wp_unslash( $_REQUEST );
281
- $server = wp_unslash( $_SERVER );
282
- if ( false !== strpos( $server['PHP_SELF'], 'edit.php' ) && isset( $request['post_type'] ) && Advanced_Ads::POST_TYPE_SLUG === $request['post_type'] ) {
283
- $orderby = 'post_title ASC';
284
- }
285
  }
286
 
287
  return $orderby;
@@ -296,10 +302,21 @@ class Advanced_Ads_Ad_List_Filters {
296
  * @return array with posts
297
  */
298
  public function post_results( $posts, $the_query ) {
 
 
 
 
 
299
  if ( ! function_exists( 'get_current_screen' ) ) {
300
  return $posts;
301
  }
302
 
 
 
 
 
 
 
303
  // If for some reason, requested posts are not ads, abort everything.
304
  if ( count( $posts ) && isset( $_REQUEST['post_type'] ) && Advanced_Ads::POST_TYPE_SLUG === $_REQUEST['post_type'] ) {
305
  if ( Advanced_Ads::POST_TYPE_SLUG !== $posts[0]->post_type ) {
@@ -307,29 +324,9 @@ class Advanced_Ads_Ad_List_Filters {
307
  }
308
  }
309
 
310
- $new_posts = $posts;
311
- $scr = get_current_screen();
312
-
313
- // execute only on the first query.
314
- if ( ! $scr ) {
315
- // if there are already some records, don't re-execute. Prevents bug with plugins making early extra query.
316
- if ( count( $this->all_ads ) ) {
317
- return $posts;
318
- }
319
- // and only on the ad list page.
320
- $request = wp_unslash( $_REQUEST );
321
- $server = wp_unslash( $_SERVER );
322
- if ( false !== strpos( $server['PHP_SELF'], 'edit.php' ) && isset( $request['post_type'] ) && Advanced_Ads::POST_TYPE_SLUG === $request['post_type'] ) {
323
- $this->collect_all_ads( $posts );
324
- }
325
-
326
- return $posts;
327
- }
328
-
329
- // edit only on ad list page.
330
- if ( 'edit-advanced_ads' !== $scr->id ) {
331
- return $posts;
332
- }
333
 
334
  // the new post list.
335
  if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
@@ -340,12 +337,6 @@ class Advanced_Ads_Ad_List_Filters {
340
  $new_posts = $this->ad_filters( $this->all_ads, $the_query );
341
  }
342
 
343
- // re-collect data from the search results.
344
- if ( isset( $_REQUEST['s'] ) && '' !== $_REQUEST['s'] ) {
345
- $this->collect_all_ads( $posts );
346
- $new_posts = $this->ad_filters( $this->all_ads, $the_query );
347
- }
348
-
349
  $per_page = $the_query->query_vars['posts_per_page'] ? $the_query->query_vars['posts_per_page'] : 20;
350
 
351
  if ( $per_page < count( $new_posts ) ) {
268
  * @return mixed
269
  */
270
  public function orderby_filter( $orderby, $the_query ) {
271
+ // Execute only in the main query.
272
+ if ( ! $the_query->is_main_query() ) {
273
+ return $orderby;
274
+ }
275
+
276
  if ( ! function_exists( 'get_current_screen' ) ) {
277
+ return $orderby;
278
  }
279
+
280
  $scr = get_current_screen();
281
+ // Execute only in the ad list page.
282
+ if ( ! $scr || 'edit-advanced_ads' !== $scr->id ) {
283
+ return $orderby;
284
+ }
285
 
286
+ $request = wp_unslash( $_REQUEST );
287
+ $server = wp_unslash( $_SERVER );
288
+ // If for some reason, requested posts are not ads, abort everything.
289
+ if ( false !== strpos( $server['PHP_SELF'], 'edit.php' ) && isset( $request['post_type'] ) && Advanced_Ads::POST_TYPE_SLUG === $request['post_type'] ) {
290
+ $orderby = 'post_title ASC';
 
 
 
291
  }
292
 
293
  return $orderby;
302
  * @return array with posts
303
  */
304
  public function post_results( $posts, $the_query ) {
305
+ // Execute only in the main query.
306
+ if ( ! $the_query->is_main_query() ) {
307
+ return $posts;
308
+ }
309
+
310
  if ( ! function_exists( 'get_current_screen' ) ) {
311
  return $posts;
312
  }
313
 
314
+ $scr = get_current_screen();
315
+ // Execute only in the ad list page.
316
+ if ( ! $scr || 'edit-advanced_ads' !== $scr->id ) {
317
+ return $posts;
318
+ }
319
+
320
  // If for some reason, requested posts are not ads, abort everything.
321
  if ( count( $posts ) && isset( $_REQUEST['post_type'] ) && Advanced_Ads::POST_TYPE_SLUG === $_REQUEST['post_type'] ) {
322
  if ( Advanced_Ads::POST_TYPE_SLUG !== $posts[0]->post_type ) {
324
  }
325
  }
326
 
327
+ $request = wp_unslash( $_REQUEST );
328
+ $server = wp_unslash( $_SERVER );
329
+ $this->collect_all_ads( $posts );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
 
331
  // the new post list.
332
  if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
337
  $new_posts = $this->ad_filters( $this->all_ads, $the_query );
338
  }
339
 
 
 
 
 
 
 
340
  $per_page = $the_query->query_vars['posts_per_page'] ? $the_query->query_vars['posts_per_page'] : 20;
341
 
342
  if ( $per_page < count( $new_posts ) ) {
admin/includes/class-menu.php CHANGED
@@ -52,8 +52,9 @@ class Advanced_Ads_Admin_Menu {
52
  */
53
  public function add_plugin_admin_menu() {
54
 
55
- // get number of ads including those in trash.
56
  $has_ads = Advanced_Ads::get_number_of_ads();
 
 
57
 
58
  // get number of Ad Health notices.
59
  $notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
52
  */
53
  public function add_plugin_admin_menu() {
54
 
 
55
  $has_ads = Advanced_Ads::get_number_of_ads();
56
+ // get number of ads including those in trash.
57
+ $has_ads = Advanced_Ads::get_number_of_ads( array( 'any', 'trash' ) );
58
 
59
  // get number of Ad Health notices.
60
  $notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
admin/includes/class-notices.php CHANGED
@@ -322,14 +322,14 @@ class Advanced_Ads_Admin_Notices {
322
  return;
323
  }
324
 
325
- // register Black Friday 2019 deals.
326
- if ( time() > 1574985600 &&
327
- time() <= 1575374400 && Advanced_Ads_Admin::get_instance()->screen_belongs_to_advanced_ads() ) {
328
  $options = $this->options();
329
  $closed = isset( $options['closed'] ) ? $options['closed'] : array();
330
 
331
- if ( ! isset( $closed['bf2019'] ) ) {
332
- $this->notices[] = 'bf2019';
333
  }
334
  }
335
 
322
  return;
323
  }
324
 
325
+ // register Black Friday 2020 deals.
326
+ if ( time() > 1606392000 &&
327
+ time() <= 1606824000 && Advanced_Ads_Admin::get_instance()->screen_belongs_to_advanced_ads() ) {
328
  $options = $this->options();
329
  $closed = isset( $options['closed'] ) ? $options['closed'] : array();
330
 
331
+ if ( ! isset( $closed['bf2020'] ) ) {
332
+ $this->notices[] = 'bf2020';
333
  }
334
  }
335
 
admin/includes/notices.php CHANGED
@@ -56,13 +56,13 @@ $advanced_ads_admin_notices = apply_filters(
56
  . '</p></div>',
57
  'global' => false,
58
  ),
59
- // Black Friday 2019 promotion.
60
- 'bf2019' => array(
61
  'type' => 'info',
62
  'text' => sprintf(
63
  // translators: %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
64
  __( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ),
65
- ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2019#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2019'
66
  ),
67
  'global' => true,
68
  ),
56
  . '</p></div>',
57
  'global' => false,
58
  ),
59
+ // Black Friday 2020 promotion.
60
+ 'bf2020' => array(
61
  'type' => 'info',
62
  'text' => sprintf(
63
  // translators: %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
64
  __( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ),
65
+ ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2020#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2020'
66
  ),
67
  'global' => true,
68
  ),
admin/views/notices/info.php CHANGED
@@ -1,9 +1,16 @@
1
  <div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
3
- <a href="<?= add_query_arg( [
4
- 'action' => 'advads-close-notice',
5
- 'notice' => $_notice,
6
- 'nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
7
- 'redirect' => $_SERVER['REQUEST_URI'],
8
- ], admin_url( 'admin-ajax.php' ) ); ?>" class="notice-dismiss"><span class="screen-reader-text"><?= __( 'Dismiss this notice.' ); ?></span></a>
 
 
 
 
 
 
 
9
  </div>
1
  <div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
3
+ <a href="
4
+ <?php
5
+ add_query_arg(
6
+ array(
7
+ 'action' => 'advads-close-notice',
8
+ 'notice' => $_notice,
9
+ 'nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
10
+ 'redirect' => $_SERVER['REQUEST_URI'],
11
+ ),
12
+ admin_url( 'admin-ajax.php' )
13
+ );
14
+ ?>
15
+ " class="notice-dismiss"><span class="screen-reader-text"><?php esc_html__( 'Dismiss this notice.' ); ?></span></a>
16
  </div>
admin/views/support.php CHANGED
@@ -8,6 +8,7 @@
8
  <ul>
9
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual/ads-not-showing-up/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Ads not showing up', 'advanced-ads' ); ?></a></li>
10
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Purchase & Licenses', 'advanced-ads' ); ?></a></li>
 
11
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual-category/troubleshooting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'General Issues', 'advanced-ads' ); ?></a></li>
12
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual-category/add-on-issues/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Issues with Add-Ons', 'advanced-ads' ); ?></a></li>
13
  </ul>
8
  <ul>
9
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual/ads-not-showing-up/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Ads not showing up', 'advanced-ads' ); ?></a></li>
10
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Purchase & Licenses', 'advanced-ads' ); ?></a></li>
11
+ <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual/issues-after-updates/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Issues after updating', 'advanced-ads' ); ?></a></li>
12
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual-category/troubleshooting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'General Issues', 'advanced-ads' ); ?></a></li>
13
  <li><a href="<?php echo esc_url( ADVADS_URL ); ?>manual-category/add-on-issues/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Issues with Add-Ons', 'advanced-ads' ); ?></a></li>
14
  </ul>
advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.20.3
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.20.3' );
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.21.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.21.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/ad.php CHANGED
@@ -910,12 +910,9 @@ class Advanced_Ads_Ad {
910
  // Create another wrapper so that the label does not reduce the height of the ad wrapper.
911
  $height = array( 'style' => array( 'height' => $wrapper_options['style']['height'] ) );
912
  unset( $wrapper_options['style']['height'] );
913
- $ad_content = $this->label
914
- . '<div' . Advanced_Ads_Utils::build_html_attributes( $height ) . '>'
915
  . $ad_content
916
  . '</div>';
917
- } else {
918
- $ad_content = $this->label . $ad_content;
919
  }
920
 
921
  // add edit button for users with the appropriate rights.
@@ -929,6 +926,7 @@ class Advanced_Ads_Ad {
929
 
930
  // build the box
931
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
 
932
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
933
  $wrapper .= $ad_content;
934
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-after-content', '', $this );
910
  // Create another wrapper so that the label does not reduce the height of the ad wrapper.
911
  $height = array( 'style' => array( 'height' => $wrapper_options['style']['height'] ) );
912
  unset( $wrapper_options['style']['height'] );
913
+ $ad_content = '<div' . Advanced_Ads_Utils::build_html_attributes( $height ) . '>'
 
914
  . $ad_content
915
  . '</div>';
 
 
916
  }
917
 
918
  // add edit button for users with the appropriate rights.
926
 
927
  // build the box
928
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
929
+ $wrapper .= $this->label;
930
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
931
  $wrapper .= $ad_content;
932
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-after-content', '', $this );
classes/ad_group.php CHANGED
@@ -187,7 +187,7 @@ class Advanced_Ads_Group {
187
  * Control the output of the group by type and amount of ads
188
  *
189
  * @since 1.4.8
190
- * @param array/null ordered_ad_ids ordered ids of the ads that belong to the group
191
  * @return str $output output of ad(s) by ad
192
  */
193
  public function output( $ordered_ad_ids = false ) {
@@ -237,23 +237,24 @@ class Advanced_Ads_Group {
237
  $advads->current_ads[] = array('type' => 'group', 'id' => $this->id, 'title' => $this->name);
238
  }
239
 
240
- if ( $output === array() || ! is_array( $output ) ){
241
  return '';
242
  }
243
-
244
  // filter grouped ads output
245
  $output_array = apply_filters( 'advanced-ads-group-output-array', $output, $this );
246
-
247
  // make sure the right format comes through the filter
248
- if ( $output_array === array() || ! is_array( $output_array ) ){
249
  return '';
250
  }
251
-
252
  $output_string = implode( '', $output_array );
253
 
254
  if ( ! $this->is_head_placement && $this->wrapper !== array() ) {
255
  $output_string = '<div' . Advanced_Ads_Utils::build_html_attributes( $this->wrapper ) . '>'
256
  . $this->label
 
257
  . $output_string
258
  . apply_filters( 'advanced-ads-output-wrapper-after-content-group', '', $this )
259
  . '</div>';
@@ -311,7 +312,7 @@ class Advanced_Ads_Group {
311
  }
312
 
313
  return apply_filters( 'advanced-ads-group-output-ad-ids', $ordered_ad_ids, $this->type, $ads, $weights, $this );
314
- }
315
 
316
  /**
317
  * Return all ads from this group
@@ -545,7 +546,7 @@ class Advanced_Ads_Group {
545
  private function update_ad_weights(){
546
  $ads = $this->get_all_ads();
547
  $weights = $this->get_ad_weights();
548
-
549
  $new_weights = array();
550
  // use only ads assigned to the group
551
  foreach ( $ads as $_ad ){
@@ -580,7 +581,7 @@ class Advanced_Ads_Group {
580
 
581
  return $sanitized_weights;
582
  }
583
-
584
  /**
585
  * Delete all the ad weights for a group by id
586
  *
@@ -635,18 +636,18 @@ class Advanced_Ads_Group {
635
  $this->wrapper['id'] = $prefix . mt_rand();
636
  }
637
  }
638
-
639
  /**
640
- * Calculate the number of available weights for a group depending on
641
- * number of ads and default value
642
- *
643
- * @param int $num_ads number of ads in the group
644
- * @since 1.8.22
645
  *
646
  * @return max weight used in group settings
647
  */
648
  public static function get_max_ad_weight( $num_ads = 1 ){
649
-
650
  // use default if lower than default.
651
  $num_ads = absint( $num_ads );
652
 
@@ -656,6 +657,6 @@ class Advanced_Ads_Group {
656
  // allow users to manipulate max ad weight
657
  return apply_filters( 'advanced-ads-max-ad-weight', $max_weight, $num_ads );
658
  }
659
-
660
 
661
  }
187
  * Control the output of the group by type and amount of ads
188
  *
189
  * @since 1.4.8
190
+ * @param array/null $ordered_ad_ids Ordered ids of the ads that belong to the group.
191
  * @return str $output output of ad(s) by ad
192
  */
193
  public function output( $ordered_ad_ids = false ) {
237
  $advads->current_ads[] = array('type' => 'group', 'id' => $this->id, 'title' => $this->name);
238
  }
239
 
240
+ if ( $output === array() || ! is_array( $output ) ) {
241
  return '';
242
  }
243
+
244
  // filter grouped ads output
245
  $output_array = apply_filters( 'advanced-ads-group-output-array', $output, $this );
246
+
247
  // make sure the right format comes through the filter
248
+ if ( $output_array === array() || ! is_array( $output_array ) ) {
249
  return '';
250
  }
251
+
252
  $output_string = implode( '', $output_array );
253
 
254
  if ( ! $this->is_head_placement && $this->wrapper !== array() ) {
255
  $output_string = '<div' . Advanced_Ads_Utils::build_html_attributes( $this->wrapper ) . '>'
256
  . $this->label
257
+ . apply_filters( 'advanced-ads-output-wrapper-before-content-group', '', $this )
258
  . $output_string
259
  . apply_filters( 'advanced-ads-output-wrapper-after-content-group', '', $this )
260
  . '</div>';
312
  }
313
 
314
  return apply_filters( 'advanced-ads-group-output-ad-ids', $ordered_ad_ids, $this->type, $ads, $weights, $this );
315
+ }
316
 
317
  /**
318
  * Return all ads from this group
546
  private function update_ad_weights(){
547
  $ads = $this->get_all_ads();
548
  $weights = $this->get_ad_weights();
549
+
550
  $new_weights = array();
551
  // use only ads assigned to the group
552
  foreach ( $ads as $_ad ){
581
 
582
  return $sanitized_weights;
583
  }
584
+
585
  /**
586
  * Delete all the ad weights for a group by id
587
  *
636
  $this->wrapper['id'] = $prefix . mt_rand();
637
  }
638
  }
639
+
640
  /**
641
+ * Calculate the number of available weights for a group depending on
642
+ * number of ads and default value.
643
+ *
644
+ * @param int $num_ads Number of ads in the group.
645
+ * @since 1.8.22
646
  *
647
  * @return max weight used in group settings
648
  */
649
  public static function get_max_ad_weight( $num_ads = 1 ){
650
+
651
  // use default if lower than default.
652
  $num_ads = absint( $num_ads );
653
 
657
  // allow users to manipulate max ad weight
658
  return apply_filters( 'advanced-ads-max-ad-weight', $max_weight, $num_ads );
659
  }
660
+
661
 
662
  }
classes/ad_placements.php CHANGED
@@ -108,6 +108,7 @@ class Advanced_Ads_Placements {
108
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/widget.png',
109
  'order' => 50,
110
  'options' => array(
 
111
  'show_lazy_load' => true,
112
  'amp' => true,
113
  ),
108
  'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/widget.png',
109
  'order' => 50,
110
  'options' => array(
111
+ 'show_position' => true,
112
  'show_lazy_load' => true,
113
  'amp' => true,
114
  ),
classes/compatibility.php CHANGED
@@ -304,6 +304,11 @@ class Advanced_Ads_Compatibility {
304
  */
305
  public function advanced_custom_fields_box( $meta_boxes ) {
306
 
 
 
 
 
 
307
  // load ACF field groups dedicated to the Advanced Ads post type
308
  $groups = acf_get_field_groups( array( 'post_type' => Advanced_Ads::POST_TYPE_SLUG ) );
309
 
304
  */
305
  public function advanced_custom_fields_box( $meta_boxes ) {
306
 
307
+ // fixes an issue reported when ACF class exists, but this function does not
308
+ if ( ! function_exists( 'acf_get_field_groups' ) ) {
309
+ return $meta_boxes;
310
+ }
311
+
312
  // load ACF field groups dedicated to the Advanced Ads post type
313
  $groups = acf_get_field_groups( array( 'post_type' => Advanced_Ads::POST_TYPE_SLUG ) );
314
 
classes/frontend_checks.php CHANGED
@@ -18,6 +18,9 @@ class Advanced_Ads_Frontend_Checks {
18
  add_action( 'init', array( $this, 'init' ) );
19
  }
20
 
 
 
 
21
  public function init() {
22
  $enabled = false;
23
 
@@ -34,6 +37,10 @@ class Advanced_Ads_Frontend_Checks {
34
  $enabled = true;
35
  }
36
 
 
 
 
 
37
  if ( $enabled || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
38
  add_filter( 'advanced-ads-ad-output', array( $this, 'after_ad_output' ), 10, 2 );
39
  }
@@ -149,19 +156,6 @@ class Advanced_Ads_Frontend_Checks {
149
  if ( ! empty( $post->ID ) ) {
150
  $ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
151
 
152
- if ( ! empty( $ad_settings['disable_ads'] ) ) {
153
- $nodes[] = array( 'type' => 1, 'data' => array(
154
- 'parent' => 'advanced_ads_ad_health',
155
- 'id' => 'advanced_ads_ad_health_disabled_on_page',
156
- 'title' => __( 'Ads are disabled on this page', 'advanced-ads' ),
157
- 'href' => get_edit_post_link( $post->ID ) . '#advads-ad-settings',
158
- 'meta' => array(
159
- 'class' => 'advanced_ads_ad_health_warning',
160
- 'target' => '_blank'
161
- )
162
- ) );
163
- }
164
-
165
  if ( ! empty( $ad_settings['disable_the_content'] ) ) {
166
  $nodes[] = array( 'type' => 1, 'data' => array(
167
  'parent' => 'advanced_ads_ad_health',
@@ -188,7 +182,26 @@ class Advanced_Ads_Frontend_Checks {
188
  }
189
  }
190
 
191
- if ( ! empty( $options['disabled-ads']['all'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  $nodes[] = array( 'type' => 1, 'data' => array(
193
  'parent' => 'advanced_ads_ad_health',
194
  'id' => 'advanced_ads_ad_health_no_all',
@@ -201,20 +214,23 @@ class Advanced_Ads_Frontend_Checks {
201
  ) );
202
  }
203
 
204
- if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
205
- $nodes[] = array( 1, array(
206
- 'parent' => 'advanced_ads_ad_health',
207
- 'id' => 'advanced_ads_ad_health_no_404',
208
- 'title' => __( 'Ads are disabled on 404 pages', 'advanced-ads' ),
209
- 'href' => admin_url( 'admin.php?page=advanced-ads-settings' ),
210
- 'meta' => array(
211
- 'class' => 'advanced_ads_ad_health_warning',
212
- 'target' => '_blank'
213
- )
214
- ) );
 
 
 
215
  }
216
 
217
- if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ){
218
  $nodes[] = array( 'type' => 1, 'data' => array(
219
  'parent' => 'advanced_ads_ad_health',
220
  'id' => 'advanced_ads_ad_health_no_archive',
@@ -379,6 +395,46 @@ class Advanced_Ads_Frontend_Checks {
379
  $this->add_footer_nodes( $wp_admin_bar, $issues );
380
  }
381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  /**
383
  * Count visible notices and warnings.
384
  *
18
  add_action( 'init', array( $this, 'init' ) );
19
  }
20
 
21
+ /**
22
+ * Ad Health init.
23
+ */
24
  public function init() {
25
  $enabled = false;
26
 
37
  $enabled = true;
38
  }
39
 
40
+ if ( Advanced_Ads_Ad_Health_Notices::notices_enabled() ) {
41
+ add_action( 'body_class', array( $this, 'body_class' ) );
42
+ }
43
+
44
  if ( $enabled || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
45
  add_filter( 'advanced-ads-ad-output', array( $this, 'after_ad_output' ), 10, 2 );
46
  }
156
  if ( ! empty( $post->ID ) ) {
157
  $ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  if ( ! empty( $ad_settings['disable_the_content'] ) ) {
160
  $nodes[] = array( 'type' => 1, 'data' => array(
161
  'parent' => 'advanced_ads_ad_health',
182
  }
183
  }
184
 
185
+ $disabled_reason = Advanced_Ads::get_instance()->disabled_reason;
186
+ $disabled_id = Advanced_Ads::get_instance()->disabled_id;
187
+
188
+ if ( 'page' === $disabled_reason && $disabled_id ) {
189
+ $nodes[] = array(
190
+ 'type' => 1,
191
+ 'data' => array(
192
+ 'parent' => 'advanced_ads_ad_health',
193
+ 'id' => 'advanced_ads_ad_health_disabled_on_page',
194
+ 'title' => __( 'Ads are disabled on this page', 'advanced-ads' ),
195
+ 'href' => get_edit_post_link( $disabled_id ) . '#advads-ad-settings',
196
+ 'meta' => array(
197
+ 'class' => 'advanced_ads_ad_health_warning',
198
+ 'target' => '_blank',
199
+ ),
200
+ ),
201
+ );
202
+ }
203
+
204
+ if ( 'all' === $disabled_reason ) {
205
  $nodes[] = array( 'type' => 1, 'data' => array(
206
  'parent' => 'advanced_ads_ad_health',
207
  'id' => 'advanced_ads_ad_health_no_all',
214
  ) );
215
  }
216
 
217
+ if ( '404' === $disabled_reason ) {
218
+ $nodes[] = array(
219
+ 'type' => 1,
220
+ 'data' => array(
221
+ 'parent' => 'advanced_ads_ad_health',
222
+ 'id' => 'advanced_ads_ad_health_no_404',
223
+ 'title' => __( 'Ads are disabled on 404 pages', 'advanced-ads' ),
224
+ 'href' => admin_url( 'admin.php?page=advanced-ads-settings' ),
225
+ 'meta' => array(
226
+ 'class' => 'advanced_ads_ad_health_warning',
227
+ 'target' => '_blank',
228
+ ),
229
+ ),
230
+ );
231
  }
232
 
233
+ if ( 'archive' === $disabled_reason ) {
234
  $nodes[] = array( 'type' => 1, 'data' => array(
235
  'parent' => 'advanced_ads_ad_health',
236
  'id' => 'advanced_ads_ad_health_no_archive',
395
  $this->add_footer_nodes( $wp_admin_bar, $issues );
396
  }
397
 
398
+
399
+ /**
400
+ * Add classes to the `body` tag.
401
+ *
402
+ * @param string[] $classes Array of existing class names.
403
+ * @return string[] $classes Array of existing and new class names.
404
+ */
405
+ public function body_class( $classes ) {
406
+ $aa_classes = array(
407
+ 'aa-prefix-' . Advanced_Ads_Plugin::get_instance()->get_frontend_prefix(),
408
+ );
409
+
410
+ $disabled_reason = Advanced_Ads::get_instance()->disabled_reason;
411
+ if ( $disabled_reason ) {
412
+ $aa_classes[] = 'aa-disabled-' . esc_attr( $disabled_reason );
413
+ }
414
+
415
+ global $post;
416
+ if ( ! empty( $post->ID ) ) {
417
+ $ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
418
+ if ( ! empty( $ad_settings['disable_the_content'] ) ) {
419
+ $aa_classes[] = 'aa-disabled-content';
420
+ }
421
+ }
422
+
423
+ $aa_classes = apply_filters( 'advanced-ads-body-classes', $aa_classes );
424
+
425
+ if ( ! is_array( $classes ) ) {
426
+ $classes = array();
427
+ }
428
+ if ( ! is_array( $aa_classes ) ) {
429
+ $aa_classes = array();
430
+ }
431
+
432
+ return array_merge( $classes, $aa_classes );
433
+ }
434
+
435
+
436
+
437
+
438
  /**
439
  * Count visible notices and warnings.
440
  *
languages/advanced-ads.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Advanced Ads plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Advanced Ads 1.20.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-10-23T08:57:18+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
@@ -86,8 +86,8 @@ msgid "Hide inactive ads"
86
  msgstr ""
87
 
88
  #: admin/class-advanced-ads-admin.php:398
89
- #: admin/includes/class-menu.php:156
90
- #: admin/includes/class-menu.php:159
91
  #: admin/views/settings.php:29
92
  msgid "Support"
93
  msgstr ""
@@ -127,7 +127,7 @@ msgid "Ads are disabled for all or some pages. See \"disabled ads\" in <a href=\
127
  msgstr ""
128
 
129
  #: admin/includes/ad-health-notices.php:72
130
- #: admin/views/support.php:57
131
  msgid "Advanced Ads related constants enabled"
132
  msgstr ""
133
 
@@ -159,29 +159,29 @@ msgstr ""
159
 
160
  #. translators: %s is empty here, but the string will be followed by a name of an ad unit.
161
  #: admin/includes/ad-health-notices.php:121
162
- #: classes/frontend_checks.php:247
163
  msgid "Visible ads should not use the Header placement: %s"
164
  msgstr ""
165
 
166
  #: admin/includes/ad-health-notices.php:135
167
- #: classes/frontend_checks.php:261
168
  msgid "AdSense violation"
169
  msgstr ""
170
 
171
  #: admin/includes/ad-health-notices.php:136
172
- #: classes/frontend_checks.php:262
173
  msgid "Ad is hidden"
174
  msgstr ""
175
 
176
  #: admin/includes/ad-health-notices.php:145
177
  #: classes/ad-debug.php:272
178
- #: classes/frontend_checks.php:234
179
  msgid "Your website is using HTTPS, but the ad code contains HTTP and might not work."
180
  msgstr ""
181
 
182
  #: admin/includes/ad-health-notices.php:158
183
  #: admin/includes/ad-health-notices.php:165
184
- #: modules/gadsense/includes/class-mapi.php:89
185
  msgid "Last AdSense account connection attempt failed."
186
  msgstr ""
187
 
@@ -309,10 +309,10 @@ msgid "Display ads with the highest ad weight first"
309
  msgstr ""
310
 
311
  #: admin/includes/class-ad-groups-list.php:339
312
- #: modules/import-export/classes/import.php:146
313
- #: modules/import-export/classes/import.php:186
314
- #: modules/import-export/classes/import.php:564
315
- #: public/class-advanced-ads.php:755
316
  msgid "Edit"
317
  msgstr ""
318
 
@@ -431,7 +431,7 @@ msgid "You don’t have access to ads. Please deactivate and re-enable Advanced
431
  msgstr ""
432
 
433
  #: admin/includes/class-ad-type.php:917
434
- #: classes/frontend_checks.php:451
435
  msgid "Get help"
436
  msgstr ""
437
 
@@ -532,15 +532,15 @@ msgstr ""
532
  msgid "any expiry date"
533
  msgstr ""
534
 
535
- #: admin/includes/class-menu.php:66
536
- #: admin/includes/class-menu.php:89
537
- #: admin/includes/class-menu.php:100
538
  #: admin/includes/class-menu.php:101
 
539
  msgid "Overview"
540
  msgstr ""
541
 
542
- #: admin/includes/class-menu.php:80
543
  #: admin/includes/class-menu.php:81
 
544
  #: admin/includes/class-shortcode-creator.php:101
545
  #: admin/views/ad-group-list-form-row.php:91
546
  #: admin/views/ad-group-list-header.php:16
@@ -549,35 +549,35 @@ msgstr ""
549
  #: classes/widget.php:129
550
  #: modules/gutenberg/includes/class-gutenberg.php:79
551
  #: modules/import-export/views/page.php:23
552
- #: public/class-advanced-ads.php:751
553
  msgid "Ads"
554
  msgstr ""
555
 
556
- #: admin/includes/class-menu.php:112
557
- #: public/class-advanced-ads.php:754
558
  msgid "Add New Ad"
559
  msgstr ""
560
 
561
- #: admin/includes/class-menu.php:113
562
  #: admin/views/ad-group-list-ads.php:36
563
- #: public/class-advanced-ads.php:753
564
- #: public/class-advanced-ads.php:757
565
  msgid "New Ad"
566
  msgstr ""
567
 
568
- #: admin/includes/class-menu.php:121
569
  msgid "Ad Groups & Rotations"
570
  msgstr ""
571
 
572
- #: admin/includes/class-menu.php:122
573
  msgid "Groups & Rotation"
574
  msgstr ""
575
 
576
- #: admin/includes/class-menu.php:131
577
  msgid "Ad Placements"
578
  msgstr ""
579
 
580
- #: admin/includes/class-menu.php:132
581
  #: admin/includes/class-shortcode-creator.php:115
582
  #: admin/views/placements.php:54
583
  #: classes/widget.php:115
@@ -586,26 +586,26 @@ msgstr ""
586
  msgid "Placements"
587
  msgstr ""
588
 
589
- #: admin/includes/class-menu.php:140
590
  msgid "Advanced Ads Settings"
591
  msgstr ""
592
 
593
- #: admin/includes/class-menu.php:141
594
  msgid "Settings"
595
  msgstr ""
596
 
597
- #: admin/includes/class-menu.php:176
598
- #: admin/includes/class-menu.php:180
599
  #: admin/includes/class-settings.php:272
600
  msgid "Licenses"
601
  msgstr ""
602
 
603
- #: admin/includes/class-menu.php:283
604
- #: admin/includes/class-menu.php:308
605
  msgid "Sorry, you are not allowed to access this feature."
606
  msgstr ""
607
 
608
- #: admin/includes/class-menu.php:295
609
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
610
  msgstr ""
611
 
@@ -934,7 +934,7 @@ msgid "Priority of content injection filter"
934
  msgstr ""
935
 
936
  #: admin/includes/class-settings.php:163
937
- #: classes/ad_placements.php:1017
938
  msgid "Disable level limitation"
939
  msgstr ""
940
 
@@ -1159,7 +1159,7 @@ msgstr ""
1159
  #: classes/ad-debug.php:118
1160
  #: classes/ad-debug.php:167
1161
  #: classes/ad-debug.php:169
1162
- #: public/class-advanced-ads.php:752
1163
  msgid "Ad"
1164
  msgstr ""
1165
 
@@ -2153,7 +2153,7 @@ msgid "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">he
2153
  msgstr ""
2154
 
2155
  #: admin/views/settings/general/block-bots.php:5
2156
- #: classes/frontend_checks.php:114
2157
  msgid "You look like a bot"
2158
  msgstr ""
2159
 
@@ -2298,28 +2298,32 @@ msgid "Purchase & Licenses"
2298
  msgstr ""
2299
 
2300
  #: admin/views/support.php:11
2301
- msgid "General Issues"
2302
  msgstr ""
2303
 
2304
  #: admin/views/support.php:12
 
 
 
 
2305
  msgid "Issues with Add-Ons"
2306
  msgstr ""
2307
 
2308
- #: admin/views/support.php:14
2309
  msgid "Use the following form to search for solutions in the manual on wpadvancedads.com"
2310
  msgstr ""
2311
 
2312
- #: admin/views/support.php:17
2313
  msgid "search"
2314
  msgstr ""
2315
 
2316
  #. translators: %s is a URL.
2317
- #: admin/views/support.php:25
2318
  msgid "Take a look at more common issues or contact us directly through the <a href=\"%s\" target=\"_blank\">support page</a>."
2319
  msgstr ""
2320
 
2321
  #. translators: %s is a URL.
2322
- #: admin/views/support.php:43
2323
  msgid "Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href=\"%s\" target=\"_blank\">support forum</a> for individual help."
2324
  msgstr ""
2325
 
@@ -2485,7 +2489,7 @@ msgid "main query"
2485
  msgstr ""
2486
 
2487
  #: classes/ad-debug.php:121
2488
- #: public/class-advanced-ads.php:716
2489
  msgctxt "ad group singular name"
2490
  msgid "Ad Group"
2491
  msgstr ""
@@ -2496,7 +2500,7 @@ msgstr ""
2496
 
2497
  #. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
2498
  #: classes/ad-health-notices.php:865
2499
- #: modules/gadsense/includes/class-mapi.php:1513
2500
  msgid "Learn more about AdSense account issues %1$shere%2$s."
2501
  msgstr ""
2502
 
@@ -2550,76 +2554,76 @@ msgid "Create a sidebar widget with an ad. Can be placed and used like any other
2550
  msgstr ""
2551
 
2552
  #. translators: %s is an html tag.
2553
- #: classes/ad_placements.php:299
2554
  msgid "paragraph (%s)"
2555
  msgstr ""
2556
 
2557
  #. translators: %s is an html tag.
2558
- #: classes/ad_placements.php:301
2559
  msgid "paragraph without image (%s)"
2560
  msgstr ""
2561
 
2562
  #. translators: %s is an html tag.
2563
- #: classes/ad_placements.php:303
2564
  msgid "headline 2 (%s)"
2565
  msgstr ""
2566
 
2567
  #. translators: %s is an html tag.
2568
- #: classes/ad_placements.php:305
2569
  msgid "headline 3 (%s)"
2570
  msgstr ""
2571
 
2572
  #. translators: %s is an html tag.
2573
- #: classes/ad_placements.php:307
2574
  msgid "headline 4 (%s)"
2575
  msgstr ""
2576
 
2577
  #. translators: %s is an html tag.
2578
- #: classes/ad_placements.php:309
2579
  msgid "any headline (%s)"
2580
  msgstr ""
2581
 
2582
  #. translators: %s is an html tag.
2583
- #: classes/ad_placements.php:311
2584
  msgid "image (%s)"
2585
  msgstr ""
2586
 
2587
  #. translators: %s is an html tag.
2588
- #: classes/ad_placements.php:313
2589
  msgid "table (%s)"
2590
  msgstr ""
2591
 
2592
  #. translators: %s is an html tag.
2593
- #: classes/ad_placements.php:315
2594
  msgid "list item (%s)"
2595
  msgstr ""
2596
 
2597
  #. translators: %s is an html tag.
2598
- #: classes/ad_placements.php:317
2599
  msgid "quote (%s)"
2600
  msgstr ""
2601
 
2602
  #. translators: %s is an html tag.
2603
- #: classes/ad_placements.php:319
2604
  msgid "iframe (%s)"
2605
  msgstr ""
2606
 
2607
  #. translators: %s is an html tag.
2608
- #: classes/ad_placements.php:321
2609
  msgid "container (%s)"
2610
  msgstr ""
2611
 
2612
- #: classes/ad_placements.php:323
2613
  msgid "any element"
2614
  msgstr ""
2615
 
2616
- #: classes/ad_placements.php:325
2617
  msgctxt "for the \"custom\" content placement option"
2618
  msgid "custom"
2619
  msgstr ""
2620
 
2621
  #. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
2622
- #: classes/ad_placements.php:1016
2623
  msgid "Set <em>%s</em> to show more ads"
2624
  msgstr ""
2625
 
@@ -2940,165 +2944,165 @@ msgstr ""
2940
  msgid "Unable to locate needed folder (%s)."
2941
  msgstr ""
2942
 
2943
- #: classes/frontend_checks.php:100
2944
  msgid "Random AdSense ads"
2945
  msgstr ""
2946
 
2947
- #: classes/frontend_checks.php:128
2948
  msgid "Ad blocker enabled"
2949
  msgstr ""
2950
 
2951
- #: classes/frontend_checks.php:140
2952
  msgid "<em>%s</em> filter does not exist"
2953
  msgstr ""
2954
 
2955
- #: classes/frontend_checks.php:156
2956
- msgid "Ads are disabled on this page"
2957
- msgstr ""
2958
-
2959
- #: classes/frontend_checks.php:169
2960
  msgid "Ads are disabled in the content of this page"
2961
  msgstr ""
2962
 
2963
- #: classes/frontend_checks.php:181
2964
  msgid "the current post ID is 0 "
2965
  msgstr ""
2966
 
2967
- #: classes/frontend_checks.php:195
2968
- msgid "Ads are disabled on all pages"
2969
  msgstr ""
2970
 
2971
  #: classes/frontend_checks.php:208
 
 
 
 
2972
  msgid "Ads are disabled on 404 pages"
2973
  msgstr ""
2974
 
2975
- #: classes/frontend_checks.php:221
2976
  msgid "Ads are disabled on non singular pages"
2977
  msgstr ""
2978
 
2979
- #: classes/frontend_checks.php:235
2980
  msgid "Ad IDs: %s"
2981
  msgstr ""
2982
 
2983
- #: classes/frontend_checks.php:263
2984
  msgid "IDs: %s"
2985
  msgstr ""
2986
 
2987
- #: classes/frontend_checks.php:276
2988
  msgid "The following responsive AdSense ads are not showing up: %s"
2989
  msgstr ""
2990
 
2991
- #: classes/frontend_checks.php:290
2992
  msgid "Consent not given"
2993
  msgstr ""
2994
 
2995
- #: classes/frontend_checks.php:306
2996
  msgid "Enable TCF integration"
2997
  msgstr ""
2998
 
2999
- #: classes/frontend_checks.php:319
3000
  msgid "Debug Google Ad Manager"
3001
  msgstr ""
3002
 
3003
- #: classes/frontend_checks.php:330
3004
  msgid "Auto ads code found"
3005
  msgstr ""
3006
 
3007
- #: classes/frontend_checks.php:342
3008
  msgid "highlight ads"
3009
  msgstr ""
3010
 
3011
- #: classes/frontend_checks.php:409
3012
  msgid "Ad Health"
3013
  msgstr ""
3014
 
3015
- #: classes/frontend_checks.php:423
3016
  msgid "Show %d more notifications"
3017
  msgstr ""
3018
 
3019
- #: classes/frontend_checks.php:440
3020
  msgid "Everything is fine"
3021
  msgstr ""
3022
 
3023
- #: classes/frontend_checks.php:508
3024
  msgid "the following code is used for automatic error detection and only visible to admins"
3025
  msgstr ""
3026
 
3027
- #: classes/frontend_checks.php:826
3028
- #: classes/frontend_checks.php:841
3029
  msgid "Hi %s"
3030
  msgstr ""
3031
 
3032
- #: classes/frontend_checks.php:826
3033
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3034
  msgstr ""
3035
 
3036
- #: classes/frontend_checks.php:826
3037
- #: classes/frontend_checks.php:841
3038
  msgid "Is that correct?"
3039
  msgstr ""
3040
 
3041
- #: classes/frontend_checks.php:828
3042
  msgid "All is fine"
3043
  msgstr ""
3044
 
3045
- #: classes/frontend_checks.php:829
3046
  msgid "Something is off"
3047
  msgstr ""
3048
 
3049
- #: classes/frontend_checks.php:831
3050
- #: classes/frontend_checks.php:846
3051
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3052
  msgstr ""
3053
 
3054
- #: classes/frontend_checks.php:841
3055
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3056
  msgstr ""
3057
 
3058
- #: classes/frontend_checks.php:843
3059
  msgid "This is fine"
3060
  msgstr ""
3061
 
3062
- #: classes/frontend_checks.php:844
3063
  msgid "I expected something else"
3064
  msgstr ""
3065
 
3066
- #: classes/frontend_checks.php:849
3067
- #: classes/frontend_checks.php:857
3068
  msgid "Just click on your problem to learn more from our knowledge base."
3069
  msgstr ""
3070
 
3071
- #: classes/frontend_checks.php:850
3072
  msgid "I want to disable AdSense Auto ads"
3073
  msgstr ""
3074
 
3075
- #: classes/frontend_checks.php:851
3076
- #: classes/frontend_checks.php:858
3077
  msgid "I don’t see any Auto ads"
3078
  msgstr ""
3079
 
3080
- #: classes/frontend_checks.php:852
3081
  msgid "I only see blank space"
3082
  msgstr ""
3083
 
3084
- #: classes/frontend_checks.php:853
3085
  msgid "I want to change the position of the ads"
3086
  msgstr ""
3087
 
3088
- #: classes/frontend_checks.php:854
3089
  #: modules/gadsense/includes/class-network-adsense.php:228
3090
  msgid "Display Auto ads only on specific pages"
3091
  msgstr ""
3092
 
3093
- #: classes/frontend_checks.php:859
3094
  msgid "How to look for the Auto ads code"
3095
  msgstr ""
3096
 
3097
- #: classes/frontend_checks.php:860
3098
  msgid "I have another question or problem"
3099
  msgstr ""
3100
 
3101
- #: classes/frontend_checks.php:863
3102
  msgid "Closing the message"
3103
  msgstr ""
3104
 
@@ -3687,107 +3691,110 @@ msgstr ""
3687
  msgid "Auto"
3688
  msgstr ""
3689
 
3690
- #: modules/gadsense/includes/class-mapi.php:338
3691
  msgid "Error while retrieving ad code for \"%s\"."
3692
  msgstr ""
3693
 
3694
- #: modules/gadsense/includes/class-mapi.php:365
3695
  msgid "Invalid response while retrieving ad code for \"%s\"."
3696
  msgstr ""
3697
 
3698
- #: modules/gadsense/includes/class-mapi.php:406
 
 
3699
  msgid "Error while retrieving adUnits list for \"%s\"."
3700
  msgstr ""
3701
 
3702
- #: modules/gadsense/includes/class-mapi.php:413
 
3703
  msgid "Invalid response while retrieving adUnits list for \"%s\"."
3704
  msgstr ""
3705
 
3706
- #: modules/gadsense/includes/class-mapi.php:421
3707
  msgid "Reason:"
3708
  msgstr ""
3709
 
3710
- #: modules/gadsense/includes/class-mapi.php:422
3711
  msgid "Message:"
3712
  msgstr ""
3713
 
3714
  #. translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
3715
- #: modules/gadsense/includes/class-mapi.php:437
3716
  msgid "The account \"%1$s\" does not seem to have any ad units. Please create some %2$shere%3$s."
3717
  msgstr ""
3718
 
3719
- #: modules/gadsense/includes/class-mapi.php:499
3720
  msgid "It seems that some changes have been made in the Advanced Ads settings. Please refresh this page."
3721
  msgstr ""
3722
 
3723
- #: modules/gadsense/includes/class-mapi.php:506
3724
  msgid "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
3725
  msgstr ""
3726
 
3727
- #: modules/gadsense/includes/class-mapi.php:548
3728
  msgid "error while renewing access token for \"%s\""
3729
  msgstr ""
3730
 
3731
- #: modules/gadsense/includes/class-mapi.php:573
3732
  msgid "invalid response received while renewing access token for \"%s\""
3733
  msgstr ""
3734
 
3735
- #: modules/gadsense/includes/class-mapi.php:642
3736
  msgid "This ad code is from a different AdSense Account"
3737
  msgstr ""
3738
 
3739
- #: modules/gadsense/includes/class-mapi.php:867
3740
  msgid "Invalid response body while retrieving account alerts"
3741
  msgstr ""
3742
 
3743
- #: modules/gadsense/includes/class-mapi.php:876
3744
  msgid "error while retrieving account alerts"
3745
  msgstr ""
3746
 
3747
- #: modules/gadsense/includes/class-mapi.php:1031
3748
  msgid "No token provided. Token data needed to get account details."
3749
  msgstr ""
3750
 
3751
- #: modules/gadsense/includes/class-mapi.php:1095
3752
  msgid "An error occurred while requesting account details."
3753
  msgstr ""
3754
 
3755
- #: modules/gadsense/includes/class-mapi.php:1320
3756
  #: modules/gadsense/includes/class-network-adsense.php:509
3757
  msgctxt "AdSense ad type"
3758
  msgid "Matched Content"
3759
  msgstr ""
3760
 
3761
- #: modules/gadsense/includes/class-mapi.php:1323
3762
  #: modules/gadsense/includes/class-network-adsense.php:510
3763
  msgctxt "AdSense ad type"
3764
  msgid "In-article"
3765
  msgstr ""
3766
 
3767
- #: modules/gadsense/includes/class-mapi.php:1325
3768
  #: modules/gadsense/includes/class-network-adsense.php:511
3769
  msgctxt "AdSense ad type"
3770
  msgid "In-feed"
3771
  msgstr ""
3772
 
3773
- #: modules/gadsense/includes/class-mapi.php:1330
3774
  #: modules/gadsense/includes/class-network-adsense.php:512
3775
  msgctxt "AdSense ad type"
3776
  msgid "Display"
3777
  msgstr ""
3778
 
3779
- #: modules/gadsense/includes/class-mapi.php:1332
3780
  #: modules/gadsense/includes/class-network-adsense.php:513
3781
  msgctxt "AdSense ad type"
3782
  msgid "Link"
3783
  msgstr ""
3784
 
3785
- #: modules/gadsense/includes/class-mapi.php:1480
3786
  msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
3787
  msgstr ""
3788
 
3789
  #. translators: 1:A link to the settings page translators: 2:The name of an ad network
3790
- #: modules/gadsense/includes/class-mapi.php:1567
3791
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3792
  msgstr ""
3793
 
@@ -3886,83 +3893,83 @@ msgstr ""
3886
  msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
3887
  msgstr ""
3888
 
3889
- #: modules/import-export/classes/import.php:66
3890
  msgid "Please enter XML content"
3891
  msgstr ""
3892
 
3893
- #: modules/import-export/classes/import.php:147
3894
- #: modules/import-export/classes/import.php:565
3895
  msgid "New attachment created <em>%s</em> %s"
3896
  msgstr ""
3897
 
3898
- #: modules/import-export/classes/import.php:179
3899
  msgid "Failed to import <em>%s</em>"
3900
  msgstr ""
3901
 
3902
- #: modules/import-export/classes/import.php:187
3903
  msgid "New ad created: <em>%s</em> %s"
3904
  msgstr ""
3905
 
3906
- #: modules/import-export/classes/import.php:230
3907
  msgid "Assigned terms: <em>%s</em>, to post: <em>%s</em>"
3908
  msgstr ""
3909
 
3910
- #: modules/import-export/classes/import.php:292
3911
  msgid "New group created, id: <em>%s</em>, name: <em>%s</em>"
3912
  msgstr ""
3913
 
3914
- #: modules/import-export/classes/import.php:294
3915
  msgid "Failed to import taxonomy: <em>%s</em>, term: <em>%s</em>"
3916
  msgstr ""
3917
 
3918
- #: modules/import-export/classes/import.php:359
3919
  msgid "Placement <em>%s</em> created"
3920
  msgstr ""
3921
 
3922
- #: modules/import-export/classes/import.php:476
3923
  msgid "Option was updated: <em>%s</em>"
3924
  msgstr ""
3925
 
3926
- #: modules/import-export/classes/import.php:479
3927
  msgid "Option already exists: <em>%s</em>"
3928
  msgstr ""
3929
 
3930
- #: modules/import-export/classes/import.php:501
3931
  msgid "Failed to create import directory <em>%s</em>"
3932
  msgstr ""
3933
 
3934
- #: modules/import-export/classes/import.php:506
3935
  msgid "Import directory is not writable: <em>%s</em>"
3936
  msgstr ""
3937
 
3938
- #: modules/import-export/classes/import.php:514
3939
  msgid "File is empty, uploads are disabled or post_max_size is smaller than upload_max_filesize in php.ini"
3940
  msgstr ""
3941
 
3942
- #: modules/import-export/classes/import.php:524
3943
  msgid "Failed to upload file, error: <em>%s</em>"
3944
  msgstr ""
3945
 
3946
- #: modules/import-export/classes/import.php:529
3947
  msgid "File is empty."
3948
  msgstr ""
3949
 
3950
- #: modules/import-export/classes/import.php:534
3951
  msgid "The file could not be created: <em>%s</em>. This is probably a permissions problem"
3952
  msgstr ""
3953
 
3954
- #: modules/import-export/classes/import.php:607
3955
  msgid "Invalid filetype <em>%s</em>"
3956
  msgstr ""
3957
 
3958
- #: modules/import-export/classes/import.php:612
3959
- #: modules/import-export/classes/import.php:619
3960
  #: modules/import-export/classes/import.php:627
 
3961
  #: modules/import-export/classes/import.php:642
 
3962
  msgid "Error getting remote image <em>%s</em>"
3963
  msgstr ""
3964
 
3965
- #: modules/import-export/classes/import.php:636
3966
  msgid "Zero size file downloaded <em>%s</em>"
3967
  msgstr ""
3968
 
@@ -4007,7 +4014,7 @@ msgid "When you click the button below Advanced Ads will create an XML file for
4007
  msgstr ""
4008
 
4009
  #: modules/import-export/views/page.php:24
4010
- #: public/class-advanced-ads.php:725
4011
  msgid "Groups"
4012
  msgstr ""
4013
 
@@ -4110,85 +4117,85 @@ msgstr ""
4110
  msgid "Install %1$sAdvanced Ads Pro%2$s to reload the ads instantly without an additional page request."
4111
  msgstr ""
4112
 
4113
- #: public/class-advanced-ads.php:381
4114
  msgid "Advanced Ads Error following:"
4115
  msgstr ""
4116
 
4117
  #. translators: %s is an error message generated by the plugin.
4118
- #: public/class-advanced-ads.php:385
4119
  msgid "Advanced Ads Error: %s"
4120
  msgstr ""
4121
 
4122
- #: public/class-advanced-ads.php:715
4123
  msgctxt "ad group general name"
4124
  msgid "Ad Groups & Rotations"
4125
  msgstr ""
4126
 
4127
- #: public/class-advanced-ads.php:717
4128
  msgid "Search Ad Groups"
4129
  msgstr ""
4130
 
4131
- #: public/class-advanced-ads.php:718
4132
  msgid "All Ad Groups"
4133
  msgstr ""
4134
 
4135
- #: public/class-advanced-ads.php:719
4136
  msgid "Parent Ad Groups"
4137
  msgstr ""
4138
 
4139
- #: public/class-advanced-ads.php:720
4140
  msgid "Parent Ad Groups:"
4141
  msgstr ""
4142
 
4143
- #: public/class-advanced-ads.php:721
4144
  msgid "Edit Ad Group"
4145
  msgstr ""
4146
 
4147
- #: public/class-advanced-ads.php:722
4148
  msgid "Update Ad Group"
4149
  msgstr ""
4150
 
4151
- #: public/class-advanced-ads.php:723
4152
  msgid "Add New Ad Group"
4153
  msgstr ""
4154
 
4155
- #: public/class-advanced-ads.php:724
4156
  msgid "New Ad Groups Name"
4157
  msgstr ""
4158
 
4159
- #: public/class-advanced-ads.php:726
4160
  msgid "No Ad Group found"
4161
  msgstr ""
4162
 
4163
- #: public/class-advanced-ads.php:756
4164
  msgid "Edit Ad"
4165
  msgstr ""
4166
 
4167
- #: public/class-advanced-ads.php:758
4168
  msgid "View"
4169
  msgstr ""
4170
 
4171
- #: public/class-advanced-ads.php:759
4172
  msgid "View the Ad"
4173
  msgstr ""
4174
 
4175
- #: public/class-advanced-ads.php:760
4176
  msgid "Search Ads"
4177
  msgstr ""
4178
 
4179
- #: public/class-advanced-ads.php:761
4180
  msgid "No Ads found"
4181
  msgstr ""
4182
 
4183
- #: public/class-advanced-ads.php:762
4184
  msgid "No Ads found in Trash"
4185
  msgstr ""
4186
 
4187
- #: public/class-advanced-ads.php:763
4188
  msgid "Parent Ad"
4189
  msgstr ""
4190
 
4191
- #: public/class-advanced-ads.php:932
4192
  msgctxt "label above ads"
4193
  msgid "Advertisements"
4194
  msgstr ""
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.21.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-11-17T09:52:18+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
86
  msgstr ""
87
 
88
  #: admin/class-advanced-ads-admin.php:398
89
+ #: admin/includes/class-menu.php:157
90
+ #: admin/includes/class-menu.php:160
91
  #: admin/views/settings.php:29
92
  msgid "Support"
93
  msgstr ""
127
  msgstr ""
128
 
129
  #: admin/includes/ad-health-notices.php:72
130
+ #: admin/views/support.php:58
131
  msgid "Advanced Ads related constants enabled"
132
  msgstr ""
133
 
159
 
160
  #. translators: %s is empty here, but the string will be followed by a name of an ad unit.
161
  #: admin/includes/ad-health-notices.php:121
162
+ #: classes/frontend_checks.php:263
163
  msgid "Visible ads should not use the Header placement: %s"
164
  msgstr ""
165
 
166
  #: admin/includes/ad-health-notices.php:135
167
+ #: classes/frontend_checks.php:277
168
  msgid "AdSense violation"
169
  msgstr ""
170
 
171
  #: admin/includes/ad-health-notices.php:136
172
+ #: classes/frontend_checks.php:278
173
  msgid "Ad is hidden"
174
  msgstr ""
175
 
176
  #: admin/includes/ad-health-notices.php:145
177
  #: classes/ad-debug.php:272
178
+ #: classes/frontend_checks.php:250
179
  msgid "Your website is using HTTPS, but the ad code contains HTTP and might not work."
180
  msgstr ""
181
 
182
  #: admin/includes/ad-health-notices.php:158
183
  #: admin/includes/ad-health-notices.php:165
184
+ #: modules/gadsense/includes/class-mapi.php:93
185
  msgid "Last AdSense account connection attempt failed."
186
  msgstr ""
187
 
309
  msgstr ""
310
 
311
  #: admin/includes/class-ad-groups-list.php:339
312
+ #: modules/import-export/classes/import.php:150
313
+ #: modules/import-export/classes/import.php:190
314
+ #: modules/import-export/classes/import.php:579
315
+ #: public/class-advanced-ads.php:791
316
  msgid "Edit"
317
  msgstr ""
318
 
431
  msgstr ""
432
 
433
  #: admin/includes/class-ad-type.php:917
434
+ #: classes/frontend_checks.php:507
435
  msgid "Get help"
436
  msgstr ""
437
 
532
  msgid "any expiry date"
533
  msgstr ""
534
 
535
+ #: admin/includes/class-menu.php:67
536
+ #: admin/includes/class-menu.php:90
 
537
  #: admin/includes/class-menu.php:101
538
+ #: admin/includes/class-menu.php:102
539
  msgid "Overview"
540
  msgstr ""
541
 
 
542
  #: admin/includes/class-menu.php:81
543
+ #: admin/includes/class-menu.php:82
544
  #: admin/includes/class-shortcode-creator.php:101
545
  #: admin/views/ad-group-list-form-row.php:91
546
  #: admin/views/ad-group-list-header.php:16
549
  #: classes/widget.php:129
550
  #: modules/gutenberg/includes/class-gutenberg.php:79
551
  #: modules/import-export/views/page.php:23
552
+ #: public/class-advanced-ads.php:787
553
  msgid "Ads"
554
  msgstr ""
555
 
556
+ #: admin/includes/class-menu.php:113
557
+ #: public/class-advanced-ads.php:790
558
  msgid "Add New Ad"
559
  msgstr ""
560
 
561
+ #: admin/includes/class-menu.php:114
562
  #: admin/views/ad-group-list-ads.php:36
563
+ #: public/class-advanced-ads.php:789
564
+ #: public/class-advanced-ads.php:793
565
  msgid "New Ad"
566
  msgstr ""
567
 
568
+ #: admin/includes/class-menu.php:122
569
  msgid "Ad Groups & Rotations"
570
  msgstr ""
571
 
572
+ #: admin/includes/class-menu.php:123
573
  msgid "Groups & Rotation"
574
  msgstr ""
575
 
576
+ #: admin/includes/class-menu.php:132
577
  msgid "Ad Placements"
578
  msgstr ""
579
 
580
+ #: admin/includes/class-menu.php:133
581
  #: admin/includes/class-shortcode-creator.php:115
582
  #: admin/views/placements.php:54
583
  #: classes/widget.php:115
586
  msgid "Placements"
587
  msgstr ""
588
 
589
+ #: admin/includes/class-menu.php:141
590
  msgid "Advanced Ads Settings"
591
  msgstr ""
592
 
593
+ #: admin/includes/class-menu.php:142
594
  msgid "Settings"
595
  msgstr ""
596
 
597
+ #: admin/includes/class-menu.php:177
598
+ #: admin/includes/class-menu.php:181
599
  #: admin/includes/class-settings.php:272
600
  msgid "Licenses"
601
  msgstr ""
602
 
603
+ #: admin/includes/class-menu.php:284
604
+ #: admin/includes/class-menu.php:309
605
  msgid "Sorry, you are not allowed to access this feature."
606
  msgstr ""
607
 
608
+ #: admin/includes/class-menu.php:296
609
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
610
  msgstr ""
611
 
934
  msgstr ""
935
 
936
  #: admin/includes/class-settings.php:163
937
+ #: classes/ad_placements.php:1018
938
  msgid "Disable level limitation"
939
  msgstr ""
940
 
1159
  #: classes/ad-debug.php:118
1160
  #: classes/ad-debug.php:167
1161
  #: classes/ad-debug.php:169
1162
+ #: public/class-advanced-ads.php:788
1163
  msgid "Ad"
1164
  msgstr ""
1165
 
2153
  msgstr ""
2154
 
2155
  #: admin/views/settings/general/block-bots.php:5
2156
+ #: classes/frontend_checks.php:121
2157
  msgid "You look like a bot"
2158
  msgstr ""
2159
 
2298
  msgstr ""
2299
 
2300
  #: admin/views/support.php:11
2301
+ msgid "Issues after updating"
2302
  msgstr ""
2303
 
2304
  #: admin/views/support.php:12
2305
+ msgid "General Issues"
2306
+ msgstr ""
2307
+
2308
+ #: admin/views/support.php:13
2309
  msgid "Issues with Add-Ons"
2310
  msgstr ""
2311
 
2312
+ #: admin/views/support.php:15
2313
  msgid "Use the following form to search for solutions in the manual on wpadvancedads.com"
2314
  msgstr ""
2315
 
2316
+ #: admin/views/support.php:18
2317
  msgid "search"
2318
  msgstr ""
2319
 
2320
  #. translators: %s is a URL.
2321
+ #: admin/views/support.php:26
2322
  msgid "Take a look at more common issues or contact us directly through the <a href=\"%s\" target=\"_blank\">support page</a>."
2323
  msgstr ""
2324
 
2325
  #. translators: %s is a URL.
2326
+ #: admin/views/support.php:44
2327
  msgid "Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href=\"%s\" target=\"_blank\">support forum</a> for individual help."
2328
  msgstr ""
2329
 
2489
  msgstr ""
2490
 
2491
  #: classes/ad-debug.php:121
2492
+ #: public/class-advanced-ads.php:752
2493
  msgctxt "ad group singular name"
2494
  msgid "Ad Group"
2495
  msgstr ""
2500
 
2501
  #. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
2502
  #: classes/ad-health-notices.php:865
2503
+ #: modules/gadsense/includes/class-mapi.php:1615
2504
  msgid "Learn more about AdSense account issues %1$shere%2$s."
2505
  msgstr ""
2506
 
2554
  msgstr ""
2555
 
2556
  #. translators: %s is an html tag.
2557
+ #: classes/ad_placements.php:300
2558
  msgid "paragraph (%s)"
2559
  msgstr ""
2560
 
2561
  #. translators: %s is an html tag.
2562
+ #: classes/ad_placements.php:302
2563
  msgid "paragraph without image (%s)"
2564
  msgstr ""
2565
 
2566
  #. translators: %s is an html tag.
2567
+ #: classes/ad_placements.php:304
2568
  msgid "headline 2 (%s)"
2569
  msgstr ""
2570
 
2571
  #. translators: %s is an html tag.
2572
+ #: classes/ad_placements.php:306
2573
  msgid "headline 3 (%s)"
2574
  msgstr ""
2575
 
2576
  #. translators: %s is an html tag.
2577
+ #: classes/ad_placements.php:308
2578
  msgid "headline 4 (%s)"
2579
  msgstr ""
2580
 
2581
  #. translators: %s is an html tag.
2582
+ #: classes/ad_placements.php:310
2583
  msgid "any headline (%s)"
2584
  msgstr ""
2585
 
2586
  #. translators: %s is an html tag.
2587
+ #: classes/ad_placements.php:312
2588
  msgid "image (%s)"
2589
  msgstr ""
2590
 
2591
  #. translators: %s is an html tag.
2592
+ #: classes/ad_placements.php:314
2593
  msgid "table (%s)"
2594
  msgstr ""
2595
 
2596
  #. translators: %s is an html tag.
2597
+ #: classes/ad_placements.php:316
2598
  msgid "list item (%s)"
2599
  msgstr ""
2600
 
2601
  #. translators: %s is an html tag.
2602
+ #: classes/ad_placements.php:318
2603
  msgid "quote (%s)"
2604
  msgstr ""
2605
 
2606
  #. translators: %s is an html tag.
2607
+ #: classes/ad_placements.php:320
2608
  msgid "iframe (%s)"
2609
  msgstr ""
2610
 
2611
  #. translators: %s is an html tag.
2612
+ #: classes/ad_placements.php:322
2613
  msgid "container (%s)"
2614
  msgstr ""
2615
 
2616
+ #: classes/ad_placements.php:324
2617
  msgid "any element"
2618
  msgstr ""
2619
 
2620
+ #: classes/ad_placements.php:326
2621
  msgctxt "for the \"custom\" content placement option"
2622
  msgid "custom"
2623
  msgstr ""
2624
 
2625
  #. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
2626
+ #: classes/ad_placements.php:1017
2627
  msgid "Set <em>%s</em> to show more ads"
2628
  msgstr ""
2629
 
2944
  msgid "Unable to locate needed folder (%s)."
2945
  msgstr ""
2946
 
2947
+ #: classes/frontend_checks.php:107
2948
  msgid "Random AdSense ads"
2949
  msgstr ""
2950
 
2951
+ #: classes/frontend_checks.php:135
2952
  msgid "Ad blocker enabled"
2953
  msgstr ""
2954
 
2955
+ #: classes/frontend_checks.php:147
2956
  msgid "<em>%s</em> filter does not exist"
2957
  msgstr ""
2958
 
2959
+ #: classes/frontend_checks.php:163
 
 
 
 
2960
  msgid "Ads are disabled in the content of this page"
2961
  msgstr ""
2962
 
2963
+ #: classes/frontend_checks.php:175
2964
  msgid "the current post ID is 0 "
2965
  msgstr ""
2966
 
2967
+ #: classes/frontend_checks.php:194
2968
+ msgid "Ads are disabled on this page"
2969
  msgstr ""
2970
 
2971
  #: classes/frontend_checks.php:208
2972
+ msgid "Ads are disabled on all pages"
2973
+ msgstr ""
2974
+
2975
+ #: classes/frontend_checks.php:223
2976
  msgid "Ads are disabled on 404 pages"
2977
  msgstr ""
2978
 
2979
+ #: classes/frontend_checks.php:237
2980
  msgid "Ads are disabled on non singular pages"
2981
  msgstr ""
2982
 
2983
+ #: classes/frontend_checks.php:251
2984
  msgid "Ad IDs: %s"
2985
  msgstr ""
2986
 
2987
+ #: classes/frontend_checks.php:279
2988
  msgid "IDs: %s"
2989
  msgstr ""
2990
 
2991
+ #: classes/frontend_checks.php:292
2992
  msgid "The following responsive AdSense ads are not showing up: %s"
2993
  msgstr ""
2994
 
2995
+ #: classes/frontend_checks.php:306
2996
  msgid "Consent not given"
2997
  msgstr ""
2998
 
2999
+ #: classes/frontend_checks.php:322
3000
  msgid "Enable TCF integration"
3001
  msgstr ""
3002
 
3003
+ #: classes/frontend_checks.php:335
3004
  msgid "Debug Google Ad Manager"
3005
  msgstr ""
3006
 
3007
+ #: classes/frontend_checks.php:346
3008
  msgid "Auto ads code found"
3009
  msgstr ""
3010
 
3011
+ #: classes/frontend_checks.php:358
3012
  msgid "highlight ads"
3013
  msgstr ""
3014
 
3015
+ #: classes/frontend_checks.php:465
3016
  msgid "Ad Health"
3017
  msgstr ""
3018
 
3019
+ #: classes/frontend_checks.php:479
3020
  msgid "Show %d more notifications"
3021
  msgstr ""
3022
 
3023
+ #: classes/frontend_checks.php:496
3024
  msgid "Everything is fine"
3025
  msgstr ""
3026
 
3027
+ #: classes/frontend_checks.php:564
3028
  msgid "the following code is used for automatic error detection and only visible to admins"
3029
  msgstr ""
3030
 
3031
+ #: classes/frontend_checks.php:882
3032
+ #: classes/frontend_checks.php:897
3033
  msgid "Hi %s"
3034
  msgstr ""
3035
 
3036
+ #: classes/frontend_checks.php:882
3037
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3038
  msgstr ""
3039
 
3040
+ #: classes/frontend_checks.php:882
3041
+ #: classes/frontend_checks.php:897
3042
  msgid "Is that correct?"
3043
  msgstr ""
3044
 
3045
+ #: classes/frontend_checks.php:884
3046
  msgid "All is fine"
3047
  msgstr ""
3048
 
3049
+ #: classes/frontend_checks.php:885
3050
  msgid "Something is off"
3051
  msgstr ""
3052
 
3053
+ #: classes/frontend_checks.php:887
3054
+ #: classes/frontend_checks.php:902
3055
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3056
  msgstr ""
3057
 
3058
+ #: classes/frontend_checks.php:897
3059
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3060
  msgstr ""
3061
 
3062
+ #: classes/frontend_checks.php:899
3063
  msgid "This is fine"
3064
  msgstr ""
3065
 
3066
+ #: classes/frontend_checks.php:900
3067
  msgid "I expected something else"
3068
  msgstr ""
3069
 
3070
+ #: classes/frontend_checks.php:905
3071
+ #: classes/frontend_checks.php:913
3072
  msgid "Just click on your problem to learn more from our knowledge base."
3073
  msgstr ""
3074
 
3075
+ #: classes/frontend_checks.php:906
3076
  msgid "I want to disable AdSense Auto ads"
3077
  msgstr ""
3078
 
3079
+ #: classes/frontend_checks.php:907
3080
+ #: classes/frontend_checks.php:914
3081
  msgid "I don’t see any Auto ads"
3082
  msgstr ""
3083
 
3084
+ #: classes/frontend_checks.php:908
3085
  msgid "I only see blank space"
3086
  msgstr ""
3087
 
3088
+ #: classes/frontend_checks.php:909
3089
  msgid "I want to change the position of the ads"
3090
  msgstr ""
3091
 
3092
+ #: classes/frontend_checks.php:910
3093
  #: modules/gadsense/includes/class-network-adsense.php:228
3094
  msgid "Display Auto ads only on specific pages"
3095
  msgstr ""
3096
 
3097
+ #: classes/frontend_checks.php:915
3098
  msgid "How to look for the Auto ads code"
3099
  msgstr ""
3100
 
3101
+ #: classes/frontend_checks.php:916
3102
  msgid "I have another question or problem"
3103
  msgstr ""
3104
 
3105
+ #: classes/frontend_checks.php:919
3106
  msgid "Closing the message"
3107
  msgstr ""
3108
 
3691
  msgid "Auto"
3692
  msgstr ""
3693
 
3694
+ #: modules/gadsense/includes/class-mapi.php:342
3695
  msgid "Error while retrieving ad code for \"%s\"."
3696
  msgstr ""
3697
 
3698
+ #: modules/gadsense/includes/class-mapi.php:369
3699
  msgid "Invalid response while retrieving ad code for \"%s\"."
3700
  msgstr ""
3701
 
3702
+ #. translators: the publisher ID.
3703
+ #: modules/gadsense/includes/class-mapi.php:424
3704
+ #: modules/gadsense/includes/class-mapi.php:509
3705
  msgid "Error while retrieving adUnits list for \"%s\"."
3706
  msgstr ""
3707
 
3708
+ #. translators: %s is the publisher ID.
3709
+ #: modules/gadsense/includes/class-mapi.php:435
3710
  msgid "Invalid response while retrieving adUnits list for \"%s\"."
3711
  msgstr ""
3712
 
3713
+ #: modules/gadsense/includes/class-mapi.php:443
3714
  msgid "Reason:"
3715
  msgstr ""
3716
 
3717
+ #: modules/gadsense/includes/class-mapi.php:444
3718
  msgid "Message:"
3719
  msgstr ""
3720
 
3721
  #. translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
3722
+ #: modules/gadsense/includes/class-mapi.php:461
3723
  msgid "The account \"%1$s\" does not seem to have any ad units. Please create some %2$shere%3$s."
3724
  msgstr ""
3725
 
3726
+ #: modules/gadsense/includes/class-mapi.php:600
3727
  msgid "It seems that some changes have been made in the Advanced Ads settings. Please refresh this page."
3728
  msgstr ""
3729
 
3730
+ #: modules/gadsense/includes/class-mapi.php:607
3731
  msgid "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
3732
  msgstr ""
3733
 
3734
+ #: modules/gadsense/includes/class-mapi.php:649
3735
  msgid "error while renewing access token for \"%s\""
3736
  msgstr ""
3737
 
3738
+ #: modules/gadsense/includes/class-mapi.php:674
3739
  msgid "invalid response received while renewing access token for \"%s\""
3740
  msgstr ""
3741
 
3742
+ #: modules/gadsense/includes/class-mapi.php:743
3743
  msgid "This ad code is from a different AdSense Account"
3744
  msgstr ""
3745
 
3746
+ #: modules/gadsense/includes/class-mapi.php:968
3747
  msgid "Invalid response body while retrieving account alerts"
3748
  msgstr ""
3749
 
3750
+ #: modules/gadsense/includes/class-mapi.php:977
3751
  msgid "error while retrieving account alerts"
3752
  msgstr ""
3753
 
3754
+ #: modules/gadsense/includes/class-mapi.php:1133
3755
  msgid "No token provided. Token data needed to get account details."
3756
  msgstr ""
3757
 
3758
+ #: modules/gadsense/includes/class-mapi.php:1197
3759
  msgid "An error occurred while requesting account details."
3760
  msgstr ""
3761
 
3762
+ #: modules/gadsense/includes/class-mapi.php:1422
3763
  #: modules/gadsense/includes/class-network-adsense.php:509
3764
  msgctxt "AdSense ad type"
3765
  msgid "Matched Content"
3766
  msgstr ""
3767
 
3768
+ #: modules/gadsense/includes/class-mapi.php:1425
3769
  #: modules/gadsense/includes/class-network-adsense.php:510
3770
  msgctxt "AdSense ad type"
3771
  msgid "In-article"
3772
  msgstr ""
3773
 
3774
+ #: modules/gadsense/includes/class-mapi.php:1427
3775
  #: modules/gadsense/includes/class-network-adsense.php:511
3776
  msgctxt "AdSense ad type"
3777
  msgid "In-feed"
3778
  msgstr ""
3779
 
3780
+ #: modules/gadsense/includes/class-mapi.php:1432
3781
  #: modules/gadsense/includes/class-network-adsense.php:512
3782
  msgctxt "AdSense ad type"
3783
  msgid "Display"
3784
  msgstr ""
3785
 
3786
+ #: modules/gadsense/includes/class-mapi.php:1434
3787
  #: modules/gadsense/includes/class-network-adsense.php:513
3788
  msgctxt "AdSense ad type"
3789
  msgid "Link"
3790
  msgstr ""
3791
 
3792
+ #: modules/gadsense/includes/class-mapi.php:1582
3793
  msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
3794
  msgstr ""
3795
 
3796
  #. translators: 1:A link to the settings page translators: 2:The name of an ad network
3797
+ #: modules/gadsense/includes/class-mapi.php:1669
3798
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3799
  msgstr ""
3800
 
3893
  msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
3894
  msgstr ""
3895
 
3896
+ #: modules/import-export/classes/import.php:70
3897
  msgid "Please enter XML content"
3898
  msgstr ""
3899
 
3900
+ #: modules/import-export/classes/import.php:151
3901
+ #: modules/import-export/classes/import.php:580
3902
  msgid "New attachment created <em>%s</em> %s"
3903
  msgstr ""
3904
 
3905
+ #: modules/import-export/classes/import.php:183
3906
  msgid "Failed to import <em>%s</em>"
3907
  msgstr ""
3908
 
3909
+ #: modules/import-export/classes/import.php:191
3910
  msgid "New ad created: <em>%s</em> %s"
3911
  msgstr ""
3912
 
3913
+ #: modules/import-export/classes/import.php:234
3914
  msgid "Assigned terms: <em>%s</em>, to post: <em>%s</em>"
3915
  msgstr ""
3916
 
3917
+ #: modules/import-export/classes/import.php:296
3918
  msgid "New group created, id: <em>%s</em>, name: <em>%s</em>"
3919
  msgstr ""
3920
 
3921
+ #: modules/import-export/classes/import.php:298
3922
  msgid "Failed to import taxonomy: <em>%s</em>, term: <em>%s</em>"
3923
  msgstr ""
3924
 
3925
+ #: modules/import-export/classes/import.php:363
3926
  msgid "Placement <em>%s</em> created"
3927
  msgstr ""
3928
 
3929
+ #: modules/import-export/classes/import.php:491
3930
  msgid "Option was updated: <em>%s</em>"
3931
  msgstr ""
3932
 
3933
+ #: modules/import-export/classes/import.php:494
3934
  msgid "Option already exists: <em>%s</em>"
3935
  msgstr ""
3936
 
3937
+ #: modules/import-export/classes/import.php:516
3938
  msgid "Failed to create import directory <em>%s</em>"
3939
  msgstr ""
3940
 
3941
+ #: modules/import-export/classes/import.php:521
3942
  msgid "Import directory is not writable: <em>%s</em>"
3943
  msgstr ""
3944
 
3945
+ #: modules/import-export/classes/import.php:529
3946
  msgid "File is empty, uploads are disabled or post_max_size is smaller than upload_max_filesize in php.ini"
3947
  msgstr ""
3948
 
3949
+ #: modules/import-export/classes/import.php:539
3950
  msgid "Failed to upload file, error: <em>%s</em>"
3951
  msgstr ""
3952
 
3953
+ #: modules/import-export/classes/import.php:544
3954
  msgid "File is empty."
3955
  msgstr ""
3956
 
3957
+ #: modules/import-export/classes/import.php:549
3958
  msgid "The file could not be created: <em>%s</em>. This is probably a permissions problem"
3959
  msgstr ""
3960
 
3961
+ #: modules/import-export/classes/import.php:622
3962
  msgid "Invalid filetype <em>%s</em>"
3963
  msgstr ""
3964
 
 
 
3965
  #: modules/import-export/classes/import.php:627
3966
+ #: modules/import-export/classes/import.php:634
3967
  #: modules/import-export/classes/import.php:642
3968
+ #: modules/import-export/classes/import.php:657
3969
  msgid "Error getting remote image <em>%s</em>"
3970
  msgstr ""
3971
 
3972
+ #: modules/import-export/classes/import.php:651
3973
  msgid "Zero size file downloaded <em>%s</em>"
3974
  msgstr ""
3975
 
4014
  msgstr ""
4015
 
4016
  #: modules/import-export/views/page.php:24
4017
+ #: public/class-advanced-ads.php:761
4018
  msgid "Groups"
4019
  msgstr ""
4020
 
4117
  msgid "Install %1$sAdvanced Ads Pro%2$s to reload the ads instantly without an additional page request."
4118
  msgstr ""
4119
 
4120
+ #: public/class-advanced-ads.php:417
4121
  msgid "Advanced Ads Error following:"
4122
  msgstr ""
4123
 
4124
  #. translators: %s is an error message generated by the plugin.
4125
+ #: public/class-advanced-ads.php:421
4126
  msgid "Advanced Ads Error: %s"
4127
  msgstr ""
4128
 
4129
+ #: public/class-advanced-ads.php:751
4130
  msgctxt "ad group general name"
4131
  msgid "Ad Groups & Rotations"
4132
  msgstr ""
4133
 
4134
+ #: public/class-advanced-ads.php:753
4135
  msgid "Search Ad Groups"
4136
  msgstr ""
4137
 
4138
+ #: public/class-advanced-ads.php:754
4139
  msgid "All Ad Groups"
4140
  msgstr ""
4141
 
4142
+ #: public/class-advanced-ads.php:755
4143
  msgid "Parent Ad Groups"
4144
  msgstr ""
4145
 
4146
+ #: public/class-advanced-ads.php:756
4147
  msgid "Parent Ad Groups:"
4148
  msgstr ""
4149
 
4150
+ #: public/class-advanced-ads.php:757
4151
  msgid "Edit Ad Group"
4152
  msgstr ""
4153
 
4154
+ #: public/class-advanced-ads.php:758
4155
  msgid "Update Ad Group"
4156
  msgstr ""
4157
 
4158
+ #: public/class-advanced-ads.php:759
4159
  msgid "Add New Ad Group"
4160
  msgstr ""
4161
 
4162
+ #: public/class-advanced-ads.php:760
4163
  msgid "New Ad Groups Name"
4164
  msgstr ""
4165
 
4166
+ #: public/class-advanced-ads.php:762
4167
  msgid "No Ad Group found"
4168
  msgstr ""
4169
 
4170
+ #: public/class-advanced-ads.php:792
4171
  msgid "Edit Ad"
4172
  msgstr ""
4173
 
4174
+ #: public/class-advanced-ads.php:794
4175
  msgid "View"
4176
  msgstr ""
4177
 
4178
+ #: public/class-advanced-ads.php:795
4179
  msgid "View the Ad"
4180
  msgstr ""
4181
 
4182
+ #: public/class-advanced-ads.php:796
4183
  msgid "Search Ads"
4184
  msgstr ""
4185
 
4186
+ #: public/class-advanced-ads.php:797
4187
  msgid "No Ads found"
4188
  msgstr ""
4189
 
4190
+ #: public/class-advanced-ads.php:798
4191
  msgid "No Ads found in Trash"
4192
  msgstr ""
4193
 
4194
+ #: public/class-advanced-ads.php:799
4195
  msgid "Parent Ad"
4196
  msgstr ""
4197
 
4198
+ #: public/class-advanced-ads.php:968
4199
  msgctxt "label above ads"
4200
  msgid "Advertisements"
4201
  msgstr ""
modules/ads-txt/public/class-advanced-ads-ads-txt-public.php CHANGED
@@ -21,7 +21,9 @@ class Advanced_Ads_Ads_Txt_Public {
21
  $content = $this->prepare_frontend_output();
22
  if ( $content ) {
23
  header( 'Content-Type: text/plain; charset=utf-8' );
 
24
  echo $content;
 
25
  exit;
26
  }
27
  }
@@ -44,7 +46,6 @@ class Advanced_Ads_Ads_Txt_Public {
44
 
45
  if ( $content ) {
46
  $content = self::TOP . "\n" . $content;
47
- $content = esc_html( $content );
48
  return $content;
49
  }
50
 
21
  $content = $this->prepare_frontend_output();
22
  if ( $content ) {
23
  header( 'Content-Type: text/plain; charset=utf-8' );
24
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
25
  echo $content;
26
+
27
  exit;
28
  }
29
  }
46
 
47
  if ( $content ) {
48
  $content = self::TOP . "\n" . $content;
 
49
  return $content;
50
  }
51
 
modules/gadsense/admin/assets/js/adsense.js CHANGED
@@ -71,6 +71,7 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
71
  nonce: AdsenseMAPI.nonce,
72
  action: 'advanced_ads_get_ad_units_adsense',
73
  account: gadsenseData.pubId,
 
74
  };
75
  }
76
 
@@ -671,6 +672,17 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
671
  } catch (ex) {}
672
  }
673
 
 
 
 
 
 
 
 
 
 
 
 
674
  this.onSelected();
675
  }
676
 
@@ -818,6 +830,16 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
818
 
819
  }
820
 
 
 
 
 
 
 
 
 
 
 
821
  }
822
 
823
  window.Advanced_Ads_Adsense_Helper = window.Advanced_Ads_Adsense_Helper || {
71
  nonce: AdsenseMAPI.nonce,
72
  action: 'advanced_ads_get_ad_units_adsense',
73
  account: gadsenseData.pubId,
74
+ inactive: ! this.hideIdle,
75
  };
76
  }
77
 
672
  } catch (ex) {}
673
  }
674
 
675
+ jQuery( '#wpwrap' ).on(
676
+ 'advads-mapi-adlist-opened',
677
+ function (ev) {
678
+ if (jQuery( '#mapi-table-wrap tbody tr' ).length != jQuery( '#mapi-table-wrap tbody tr[data-active="1"]' ).length) {
679
+ // idle ads are present in the table. Adjust AdNetwork and AdImporter default values accordingly.
680
+ that.hideIdle = false;
681
+ window.AdvancedAdsAdmin.AdImporter.toggleIdleAds( false );
682
+ }
683
+ }
684
+ );
685
+
686
  this.onSelected();
687
  }
688
 
830
 
831
  }
832
 
833
+ getMapiAction(action) {
834
+ var that = this;
835
+ if ('toggleidle' == action) {
836
+ return function(ev, el){
837
+ that.hideIdle = ! that.hideIdle;
838
+ AdvancedAdsAdmin.AdImporter.refreshAds();
839
+ }
840
+ }
841
+ return null;
842
+ }
843
  }
844
 
845
  window.Advanced_Ads_Adsense_Helper = window.Advanced_Ads_Adsense_Helper || {
modules/gadsense/includes/class-mapi.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  class Advanced_Ads_AdSense_MAPI {
3
 
4
  const OPTNAME = 'advanced-ads-adsense-mapi';
@@ -382,81 +386,178 @@ class Advanced_Ads_AdSense_MAPI {
382
  }
383
 
384
  /**
385
- * Get/Update ad unit list for a given client
386
- *
387
- * @return [bool]|[array] TRUE on success, error info (as array) if an error occurred.
 
388
  */
389
- public static function get_ad_units( $account ) {
390
  $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
391
- $url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $account . '/adclients/ca-' . $account . '/adunits?includeInactive=true';
392
- $access_token = self::get_access_token( $account );
393
-
 
 
 
 
 
 
 
394
  $options = self::get_option();
395
-
 
 
 
 
 
396
  if ( ! isset( $access_token['msg'] ) ) {
397
  $headers = array(
398
  'Authorization' => 'Bearer ' . $access_token,
399
  );
400
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
401
  self::log( 'Get ad units list for ca-' . $account );
402
-
403
  if ( is_wp_error( $response ) ) {
 
404
  return array(
405
  'status' => false,
406
  'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
407
  'raw' => $response->get_error_message(),
408
  );
 
409
  } else {
410
- $adUnits = json_decode( $response['body'], true );
411
-
412
- if ( null === $adUnits || ! isset( $adUnits['kind'] ) || 'adsense#adUnits' !== $adUnits['kind'] ) {
413
- $error_message = sprintf( esc_html__( 'Invalid response while retrieving adUnits list for "%s".', 'advanced-ads' ), $account );
414
- // check the response for errors and display them for better problem solving
415
- if ($adUnits && isset($adUnits['error']) && isset($adUnits['error']['errors']) && count($adUnits['error']['errors'])) {
416
- foreach ($adUnits['error']['errors'] as $err) {
417
- $hint = self::get_adsense_error_hint($err['reason']);
418
- if ($hint) {
419
- $error_message .= "<p class=\"description\">$hint</p>";
420
- }
421
- $error_message .= '<p class="description">' . __('Reason:', 'advanced-ads') . ' "' . $err['reason'] . '"<br>';
422
- $error_message .= __('Message:', 'advanced-ads') . ' "' . $err['message'] . '"</p>';
423
- }
424
- }
 
 
 
425
 
426
  return array(
427
  'status' => false,
428
  'msg' => $error_message,
429
  'raw' => $response['body'],
430
  );
431
- } else {
432
- if ( ! isset( $adUnits['items'] ) ) {
433
- return array(
434
- 'status' => false,
435
- 'msg' => sprintf(
436
- // translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
437
- esc_html__( 'The account "%1$s" does not seem to have any ad units. Please create some %2$shere%3$s.', 'advanced-ads' ),
438
- $account,
439
- '<a href="https://www.google.com/adsense/new/u/0/'.$account.'/main/myads-viewall-adunits?product=SELF_SERVICE_CONTENT_ADS" target="_blank">',
440
- '</a>' ),
441
- 'raw' => $response['body'],
442
- );
443
- } else {
444
- $new_adUnits = array();
445
- foreach ( $adUnits['items'] as $item ) {
446
- $new_adUnits[ $item['id'] ] = $item;
447
- }
448
- $options['accounts'][ $account ]['ad_units'] = $new_adUnits;
449
- update_option( self::OPTNAME, $options );
450
- return true;
451
- }
452
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  }
454
  } else {
455
  // return the original error info
456
  return $access_token;
457
  }
458
  }
459
-
460
  /**
461
  * Get the appropriate access token (default one or from user's Google app). Update it if needed.
462
  *
@@ -924,27 +1025,28 @@ class Advanced_Ads_AdSense_MAPI {
924
  * Get / Update the ad unit list for a given ad client. The corresponding <select /> input used in the ad selector is passed as a fied of an array
925
  */
926
  public function ajax_get_adUnits() {
927
- if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
928
- die;
929
- }
930
  $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
931
- if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) && isset($_POST['account'])) {
932
- $account = stripslashes( $_POST['account'] );
933
- $units = self::get_ad_units( $account );
934
-
 
935
  if ( true === $units ) {
936
  $options = self::get_option();
937
  $ad_units = $options['accounts'][ $account ]['ad_units'];
938
-
939
  ob_start();
940
  Advanced_Ads_AdSense_Admin::get_mapi_ad_selector();
941
  $ad_selector = ob_get_clean();
942
-
943
  $response = array(
944
  'status' => true,
945
  'html' => $ad_selector,
946
  );
947
-
948
  /**
949
  * Add quota info for default API creds
950
  */
@@ -965,7 +1067,7 @@ class Advanced_Ads_AdSense_MAPI {
965
  }
966
  die;
967
  }
968
-
969
  /**
970
  * Save account and token after account selection MCN.
971
  */
1
  <?php
2
+
3
+ /**
4
+ * AdSense Management API class.
5
+ */
6
  class Advanced_Ads_AdSense_MAPI {
7
 
8
  const OPTNAME = 'advanced-ads-adsense-mapi';
386
  }
387
 
388
  /**
389
+ * Get/Update ad unit list for a given client
390
+ *
391
+ * @param [string] $account The publisher ID.
392
+ * @param [bool] $inactive Whether to include inactive ads.
393
  */
394
+ public static function get_ad_units( $account, $inactive = false ) {
395
  $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
396
+ $url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $account . '/adclients/ca-' . $account . '/adunits';
397
+
398
+ if ( true === $inactive ) {
399
+ $url .= '?includeInactive=true';
400
+ } else {
401
+ $url .= '?includeInactive=false';
402
+ }
403
+
404
+ $access_token = self::get_access_token( $account );
405
+
406
  $options = self::get_option();
407
+
408
+ $per_page = 350;
409
+ $page = 1;
410
+
411
+ $url .= '&maxResults=' . $per_page;
412
+
413
  if ( ! isset( $access_token['msg'] ) ) {
414
  $headers = array(
415
  'Authorization' => 'Bearer ' . $access_token,
416
  );
417
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
418
  self::log( 'Get ad units list for ca-' . $account );
419
+
420
  if ( is_wp_error( $response ) ) {
421
+
422
  return array(
423
  'status' => false,
424
  'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
425
  'raw' => $response->get_error_message(),
426
  );
427
+
428
  } else {
429
+
430
+ $resp_body = json_decode( $response['body'], true );
431
+
432
+ if ( null === $resp_body || ! isset( $resp_body['kind'] ) || 'adsense#adUnits' !== $resp_body['kind'] ) {
433
+
434
+ // translators: %s is the publisher ID.
435
+ $error_message = sprintf( esc_html__( 'Invalid response while retrieving adUnits list for "%s".', 'advanced-ads' ), $account );
436
+ // check the response for errors and display them for better problem solving.
437
+ if ( $resp_body && isset( $resp_body['error'] ) && isset( $resp_body['error']['errors'] ) && count( $resp_body['error']['errors'] ) ) {
438
+ foreach ( $resp_body['error']['errors'] as $err ) {
439
+ $hint = self::get_adsense_error_hint( $err['reason'] );
440
+ if ( $hint ) {
441
+ $error_message .= "<p class=\"description\">$hint</p>";
442
+ }
443
+ $error_message .= '<p class="description">' . __( 'Reason:', 'advanced-ads' ) . ' "' . $err['reason'] . '"<br>';
444
+ $error_message .= __( 'Message:', 'advanced-ads' ) . ' "' . $err['message'] . '"</p>';
445
+ }
446
+ }
447
 
448
  return array(
449
  'status' => false,
450
  'msg' => $error_message,
451
  'raw' => $response['body'],
452
  );
453
+
454
+ } else {
455
+
456
+ if ( ! isset( $resp_body['items'] ) ) {
457
+ return array(
458
+ 'status' => false,
459
+ 'msg' => sprintf(
460
+ // translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
461
+ esc_html__( 'The account "%1$s" does not seem to have any ad units. Please create some %2$shere%3$s.', 'advanced-ads' ),
462
+ $account,
463
+ '<a href="https://www.google.com/adsense/new/u/0/' . $account . '/main/myads-viewall-adunits?product=SELF_SERVICE_CONTENT_ADS" target="_blank">',
464
+ '</a>'
465
+ ),
466
+ 'raw' => $response['body'],
467
+ );
468
+
469
+ } else {
470
+
471
+ /**
472
+ * There are more than $per_page items in the account.
473
+ */
474
+ if ( isset( $resp_body['nextPageToken'] ) ) {
475
+
476
+ $page_token = $resp_body['nextPageToken'];
477
+
478
+ $new_ad_units = array();
479
+ foreach ( $resp_body['items'] as $item ) {
480
+ $new_ad_units[ $item['id'] ] = $item;
481
+ }
482
+
483
+ // While there is a next page of results do . . .
484
+ while ( $page_token ) {
485
+
486
+ $access_token = self::get_access_token( $account );
487
+
488
+ if ( isset( $access_token['msg'] ) ) {
489
+ // return the original error info.
490
+ return $access_token;
491
+ }
492
+
493
+ $next_url = $url . '&pageToken=' . urlencode( $page_token );
494
+ $headers = array(
495
+ 'Authorization' => 'Bearer ' . $access_token,
496
+ );
497
+ $response = wp_remote_get( $next_url, array( 'headers' => $headers ) );
498
+ self::log( 'Get ad units list for ca-' . $account . ' page ' . $page );
499
+ $page++;
500
+
501
+ if ( is_wp_error( $response ) ) {
502
+
503
+ /**
504
+ * An error occurred. Abort.
505
+ */
506
+ return array(
507
+ 'status' => false,
508
+ // translators: the publisher ID.
509
+ 'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
510
+ 'raw' => $response->get_error_message(),
511
+ );
512
+
513
+ } else {
514
+
515
+ $resp_body = json_decode( $response['body'], true );
516
+ if ( isset( $resp_body['nextPageToken'] ) ) {
517
+
518
+ // There is still a next page.
519
+ $page_token = $resp_body['nextPageToken'];
520
+
521
+ } else {
522
+
523
+ // No more page to load, exit the WHILE loop.
524
+ $page_token = false;
525
+
526
+ }
527
+
528
+ // Add items from this page into the final result.
529
+ foreach ( $resp_body['items'] as $item ) {
530
+ $new_ad_units[ $item['id'] ] = $item;
531
+ }
532
+ }
533
+ }
534
+
535
+ $options['accounts'][ $account ]['ad_units'] = $new_ad_units;
536
+ update_option( self::OPTNAME, $options );
537
+ return true;
538
+
539
+ } else {
540
+
541
+ // Results fit into a single page (of $per_page items).
542
+ $new_ad_units = array();
543
+ foreach ( $resp_body['items'] as $item ) {
544
+ $new_ad_units[ $item['id'] ] = $item;
545
+ }
546
+
547
+ $options['accounts'][ $account ]['ad_units'] = $new_ad_units;
548
+ update_option( self::OPTNAME, $options );
549
+ return true;
550
+
551
+ }
552
+ }
553
+ }
554
  }
555
  } else {
556
  // return the original error info
557
  return $access_token;
558
  }
559
  }
560
+
561
  /**
562
  * Get the appropriate access token (default one or from user's Google app). Update it if needed.
563
  *
1025
  * Get / Update the ad unit list for a given ad client. The corresponding <select /> input used in the ad selector is passed as a fied of an array
1026
  */
1027
  public function ajax_get_adUnits() {
1028
+ if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
1029
+ die;
1030
+ }
1031
  $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
1032
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) && isset( $_POST['account'] ) ) {
1033
+ $account = stripslashes( $_POST['account'] );
1034
+ $inactive = ( isset( $_POST['inactive'] ) && 'true' === stripslashes( $_POST['inactive'] ) ) ? true : false;
1035
+ $units = self::get_ad_units( $account, $inactive );
1036
+
1037
  if ( true === $units ) {
1038
  $options = self::get_option();
1039
  $ad_units = $options['accounts'][ $account ]['ad_units'];
1040
+
1041
  ob_start();
1042
  Advanced_Ads_AdSense_Admin::get_mapi_ad_selector();
1043
  $ad_selector = ob_get_clean();
1044
+
1045
  $response = array(
1046
  'status' => true,
1047
  'html' => $ad_selector,
1048
  );
1049
+
1050
  /**
1051
  * Add quota info for default API creds
1052
  */
1067
  }
1068
  die;
1069
  }
1070
+
1071
  /**
1072
  * Save account and token after account selection MCN.
1073
  */
modules/import-export/classes/import.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  class Advanced_Ads_Import {
3
  /**
4
  * @var Advanced_Ads_Export
@@ -50,12 +54,12 @@ class Advanced_Ads_Import {
50
  * Manages stages of the XML import process
51
  */
52
  public function dispatch() {
53
- if ( ! isset( $_POST['_wpnonce'] )
54
  || ! wp_verify_nonce( $_POST['_wpnonce'], 'advads-import' )
55
  || ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ) {
56
  return;
57
  }
58
-
59
  if ( ! isset( $_POST['import_type'] ) ) {
60
  return;
61
  }
@@ -308,7 +312,7 @@ class Advanced_Ads_Import {
308
  /**
309
  * Create new placements based on import information
310
  *
311
- * @param array $decoded decoded XML
312
  */
313
  private function import_placements( &$decoded ) {
314
  if ( isset( $decoded['placements'] ) && is_array( $decoded['placements'] ) ) {
@@ -388,7 +392,18 @@ class Advanced_Ads_Import {
388
 
389
  if ( term_exists( absint( $_item_existing[1] ), Advanced_Ads::AD_GROUP_TAXONOMY ) ) {
390
  wp_set_post_terms( $found, $_item_existing[1], Advanced_Ads::AD_GROUP_TAXONOMY, true );
391
- $advads_ad_weights[ $_item_existing[1] ][ $found ] = 1;
 
 
 
 
 
 
 
 
 
 
 
392
  update_option( 'advads-ad-weights', $advads_ad_weights );
393
  // new placement key => old placement key
394
  $this->imported_data['placements'][ $placement_key_uniq ] = $placement_key_uniq;
1
  <?php
2
+
3
+ /**
4
+ * Class Advanced_Ads_Import
5
+ */
6
  class Advanced_Ads_Import {
7
  /**
8
  * @var Advanced_Ads_Export
54
  * Manages stages of the XML import process
55
  */
56
  public function dispatch() {
57
+ if ( ! isset( $_POST['_wpnonce'] )
58
  || ! wp_verify_nonce( $_POST['_wpnonce'], 'advads-import' )
59
  || ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ) {
60
  return;
61
  }
62
+
63
  if ( ! isset( $_POST['import_type'] ) ) {
64
  return;
65
  }
312
  /**
313
  * Create new placements based on import information
314
  *
315
+ * @param array $decoded decoded XML.
316
  */
317
  private function import_placements( &$decoded ) {
318
  if ( isset( $decoded['placements'] ) && is_array( $decoded['placements'] ) ) {
392
 
393
  if ( term_exists( absint( $_item_existing[1] ), Advanced_Ads::AD_GROUP_TAXONOMY ) ) {
394
  wp_set_post_terms( $found, $_item_existing[1], Advanced_Ads::AD_GROUP_TAXONOMY, true );
395
+
396
+ /**
397
+ * By default, a new add added to a group receives the weight of 5
398
+ * so that users could set the weight of existing ads either higher or lower
399
+ * depending on whether they want to show the new ad with a higher weight or not.
400
+ * This is especially useful with Selling Ads to replace an existing ad in a group
401
+ * with a newly sold one
402
+ *
403
+ * Advanced users could use the `advanced-ads-import-default-group-weight` filter
404
+ * to manipulate the value
405
+ */
406
+ $advads_ad_weights[ $_item_existing[1] ][ $found ] = apply_filters( 'advanced-ads-import-default-group-weight', 5 );
407
  update_option( 'advads-ad-weights', $advads_ad_weights );
408
  // new placement key => old placement key
409
  $this->imported_data['placements'][ $placement_key_uniq ] = $placement_key_uniq;
public/class-advanced-ads.php CHANGED
@@ -122,9 +122,23 @@ class Advanced_Ads {
122
  /**
123
  * Save number of ads
124
  *
125
- * @var int
126
  */
127
- private $number_of_ads = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  /**
130
  * Initialize frontend features
@@ -272,33 +286,33 @@ class Advanced_Ads {
272
 
273
  // check if ads are disabled completely.
274
  if ( ! empty( $options['disabled-ads']['all'] ) ) {
275
- define( 'ADVADS_ADS_DISABLED', true );
276
  return;
277
  }
278
 
279
  // Check if ads are disabled in REST API.
280
  if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
281
  if ( ! empty( $options['disabled-ads']['rest-api'] ) ) {
282
- define( 'ADVADS_ADS_DISABLED', true );
283
  }
284
  return;
285
  }
286
 
287
  // check if ads are disabled from 404 pages.
288
  if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
289
- define( 'ADVADS_ADS_DISABLED', true );
290
  return;
291
  }
292
 
293
  // check if ads are disabled from non singular pages (often = archives).
294
  if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ) {
295
- define( 'ADVADS_ADS_DISABLED', true );
296
  return;
297
  }
298
 
299
  // check if ads are disabled in Feed.
300
  if ( $wp_the_query->is_feed() && ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ) {
301
- define( 'ADVADS_ADS_DISABLED', true );
302
  return;
303
  }
304
 
@@ -307,7 +321,17 @@ class Advanced_Ads {
307
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
308
 
309
  if ( ! empty( $post_ad_options['disable_ads'] ) ) {
310
- define( 'ADVADS_ADS_DISABLED', true );
 
 
 
 
 
 
 
 
 
 
311
  return;
312
  }
313
  };
@@ -320,7 +344,7 @@ class Advanced_Ads {
320
  $shop_id = get_option( 'woocommerce_shop_page_id' );
321
  $shop_ad_options = get_post_meta( absint( $shop_id ), '_advads_ad_settings', true );
322
  if ( ! empty( $shop_ad_options['disable_ads'] ) ) {
323
- define( 'ADVADS_ADS_DISABLED', true );
324
  return;
325
  }
326
  }
@@ -333,18 +357,30 @@ class Advanced_Ads {
333
  $user = wp_get_current_user();
334
 
335
  if ( $hide_for_roles && is_user_logged_in() && is_array( $user->roles ) && array_intersect( $hide_for_roles, $user->roles ) ) {
336
- define( 'ADVADS_ADS_DISABLED', true );
337
  return;
338
  }
339
 
340
  // check bots if option is enabled.
341
  if ( ( isset( $options['block-bots'] ) && $options['block-bots']
342
  && ! $this->is_cache_bot() && $this->is_bot() ) ) {
343
- define( 'ADVADS_ADS_DISABLED', true );
344
  return;
345
  }
346
  }
347
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  /**
349
  * Return the plugin slug.
350
  *
@@ -944,14 +980,15 @@ class Advanced_Ads {
944
  * @return int number of ads.
945
  */
946
  public static function get_number_of_ads( $post_status = 'any' ) {
 
947
  // query number of ads only, if not retrieved, yet.
948
- if ( self::get_instance()->number_of_ads === false ) {
949
  $args = array( 'post_status' => $post_status );
950
  $recent_ads = self::get_instance()->get_model()->get_ads( $args );
951
- self::get_instance()->number_of_ads = count( $recent_ads );
952
  }
953
 
954
- return self::get_instance()->number_of_ads;
955
  }
956
 
957
  /**
122
  /**
123
  * Save number of ads
124
  *
125
+ * @var array
126
  */
127
+ private $number_of_ads = array();
128
+
129
+ /**
130
+ * Reason why are disabled.
131
+ *
132
+ * @var string
133
+ */
134
+ public $disabled_reason = null;
135
+
136
+ /**
137
+ * Identifier that supplement the disabled reason.
138
+ *
139
+ * @var int|string
140
+ */
141
+ public $disabled_id = null;
142
 
143
  /**
144
  * Initialize frontend features
286
 
287
  // check if ads are disabled completely.
288
  if ( ! empty( $options['disabled-ads']['all'] ) ) {
289
+ $this->disable_ads( 'all' );
290
  return;
291
  }
292
 
293
  // Check if ads are disabled in REST API.
294
  if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
295
  if ( ! empty( $options['disabled-ads']['rest-api'] ) ) {
296
+ $this->disable_ads();
297
  }
298
  return;
299
  }
300
 
301
  // check if ads are disabled from 404 pages.
302
  if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
303
+ $this->disable_ads( '404' );
304
  return;
305
  }
306
 
307
  // check if ads are disabled from non singular pages (often = archives).
308
  if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ) {
309
+ $this->disable_ads( 'archive' );
310
  return;
311
  }
312
 
313
  // check if ads are disabled in Feed.
314
  if ( $wp_the_query->is_feed() && ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ) {
315
+ $this->disable_ads();
316
  return;
317
  }
318
 
321
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
322
 
323
  if ( ! empty( $post_ad_options['disable_ads'] ) ) {
324
+ $this->disable_ads( 'page', $post->ID );
325
+ return;
326
+ }
327
+ };
328
+
329
+ // "Posts page" set on the WordPress Reading settings page.
330
+ if ( $wp_the_query->is_posts_page ) {
331
+ $post_ad_options = get_post_meta( $wp_the_query->queried_object_id, '_advads_ad_settings', true );
332
+
333
+ if ( ! empty( $post_ad_options['disable_ads'] ) ) {
334
+ $this->disable_ads( 'page', $wp_the_query->queried_object_id );
335
  return;
336
  }
337
  };
344
  $shop_id = get_option( 'woocommerce_shop_page_id' );
345
  $shop_ad_options = get_post_meta( absint( $shop_id ), '_advads_ad_settings', true );
346
  if ( ! empty( $shop_ad_options['disable_ads'] ) ) {
347
+ $this->disable_ads( 'page', $shop_id );
348
  return;
349
  }
350
  }
357
  $user = wp_get_current_user();
358
 
359
  if ( $hide_for_roles && is_user_logged_in() && is_array( $user->roles ) && array_intersect( $hide_for_roles, $user->roles ) ) {
360
+ $this->disable_ads();
361
  return;
362
  }
363
 
364
  // check bots if option is enabled.
365
  if ( ( isset( $options['block-bots'] ) && $options['block-bots']
366
  && ! $this->is_cache_bot() && $this->is_bot() ) ) {
367
+ $this->disable_ads();
368
  return;
369
  }
370
  }
371
 
372
+ /**
373
+ * Disable ads.
374
+ *
375
+ * @param string $reason Reason why are disabled.
376
+ * @param int|string $id Identifier that supplement the disabled reason.
377
+ */
378
+ private function disable_ads( $reason = null, $id = null ) {
379
+ define( 'ADVADS_ADS_DISABLED', true );
380
+ $this->disabled_reason = $reason;
381
+ $this->disabled_id = $id;
382
+ }
383
+
384
  /**
385
  * Return the plugin slug.
386
  *
980
  * @return int number of ads.
981
  */
982
  public static function get_number_of_ads( $post_status = 'any' ) {
983
+ $key = md5( serialize( $post_status ) );
984
  // query number of ads only, if not retrieved, yet.
985
+ if ( ! isset( self::get_instance()->number_of_ads[ $key ] ) ) {
986
  $args = array( 'post_status' => $post_status );
987
  $recent_ads = self::get_instance()->get_model()->get_ads( $args );
988
+ self::get_instance()->number_of_ads[ $key ] = count( $recent_ads );
989
  }
990
 
991
+ return self::get_instance()->number_of_ads[ $key ];
992
  }
993
 
994
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 1.20.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -317,6 +317,16 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
317
 
318
  == Changelog ==
319
 
 
 
 
 
 
 
 
 
 
 
320
  = 1.20.3 =
321
 
322
  - whitelist field groups created by Advanced Custom Fields on the ad edit page
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 1.21.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
317
 
318
  == Changelog ==
319
 
320
+ = 1.21.0 =
321
+
322
+ - enable Position options for Sidebar placements
323
+ - increased default weight for ads imported to a group from 1 to 5 which is mostly relevant when selling ads to existing placements
324
+ - Ad Health: added body classes that explain plugin behavior at given moment
325
+ - ads.txt: prevented converting special characters into HTML entities
326
+ - show ad overview list even if all ads were moved to trash
327
+ - fixed error when specific ACF function does not exist
328
+ - fixed option to disable ads also on the "Posts page" as set in the WordPress Reading settings
329
+
330
  = 1.20.3 =
331
 
332
  - whitelist field groups created by Advanced Custom Fields on the ad edit page