Advanced Ads - Version 1.21.1

Version Description

  • fixed pagination on the ad list page
  • fix Google AdSense non-personalized ads
Download this release

Release Info

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

Code changes from version 1.21.0 to 1.21.1

admin/assets/css/admin.css CHANGED
@@ -411,6 +411,7 @@ tr:hover .on-hover { display: block; }
411
  #advads-settings-hide-by-user-role { -webkit-columns: 200px 5; /* Chrome, Safari, Opera */ -moz-columns: 200px 5; /* Firefox */ columns: 200px 5; column-gap: 10px; }
412
  #advads-settings-hide-by-user-role label { display: block; }
413
  .advads-settings-tab-main-form textarea { resize: both; }
 
414
 
415
  /**
416
  - SUPPORT PAGE
411
  #advads-settings-hide-by-user-role { -webkit-columns: 200px 5; /* Chrome, Safari, Opera */ -moz-columns: 200px 5; /* Firefox */ columns: 200px 5; column-gap: 10px; }
412
  #advads-settings-hide-by-user-role label { display: block; }
413
  .advads-settings-tab-main-form textarea { resize: both; }
414
+ .advads-settings-tab-main-form .description + label { display: block; margin-top: 12px; }
415
 
416
  /**
417
  - SUPPORT PAGE
admin/includes/class-list-filters.php CHANGED
@@ -62,6 +62,7 @@ class Advanced_Ads_Ad_List_Filters {
62
  if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
63
  add_filter( 'posts_results', array( $this, 'post_results' ), 10, 2 );
64
  add_filter( 'posts_orderby', array( $this, 'orderby_filter' ), 10, 2 );
 
65
  }
66
  }
67
 
@@ -283,14 +284,33 @@ class Advanced_Ads_Ad_List_Filters {
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;
 
 
 
 
 
 
 
 
 
 
294
  }
295
 
296
  /**
@@ -317,15 +337,6 @@ class Advanced_Ads_Ad_List_Filters {
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 ) {
323
- return $posts;
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.
62
  if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
63
  add_filter( 'posts_results', array( $this, 'post_results' ), 10, 2 );
64
  add_filter( 'posts_orderby', array( $this, 'orderby_filter' ), 10, 2 );
65
+ add_filter( 'post_limits', array( $this, 'limit_filter' ), 10, 2 );
66
  }
67
  }
68
 
284
  return $orderby;
285
  }
286
 
287
+ return 'post_title ASC';
288
+ }
289
+
290
+ /**
291
+ * Remove limits because we need to get all ads.
292
+ *
293
+ * @param string $limits The LIMIT clause of the query.
294
+ * @param WP_Query $the_query the current WP_Query object.
295
+ * @return string $limits The LIMIT clause of the query.
296
+ */
297
+ public function limit_filter( $limits, $the_query ) {
298
+ // Execute only in the main query.
299
+ if ( ! $the_query->is_main_query() ) {
300
+ return $limits;
301
  }
302
 
303
+ if ( ! function_exists( 'get_current_screen' ) ) {
304
+ return $limits;
305
+ }
306
+
307
+ $scr = get_current_screen();
308
+ // Execute only in the ad list page.
309
+ if ( ! $scr || 'edit-advanced_ads' !== $scr->id ) {
310
+ return $limits;
311
+ }
312
+
313
+ return '';
314
  }
315
 
316
  /**
337
  return $posts;
338
  }
339
 
 
 
 
 
 
 
 
 
 
340
  $this->collect_all_ads( $posts );
341
 
342
  // the new post list.
admin/includes/class-menu.php CHANGED
@@ -52,7 +52,6 @@ class Advanced_Ads_Admin_Menu {
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
 
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( array( 'any', 'trash' ) );
57
 
admin/views/settings/general/custom-label.php CHANGED
@@ -4,9 +4,10 @@
4
  <input id="advads-custom-label" type="text" value="<?php echo esc_html( $label ); ?>"
5
  name="<?php echo esc_attr( ADVADS_SLUG ); ?>[custom-label][text]"/>
6
  </fieldset>
7
- <p class="description"><?php esc_html_e( 'Displayed above ads.', 'advanced-ads' ); ?>&nbsp;<a target="_blank" href="<?php echo esc_url( ADVADS_URL . 'manual/advertisement-label/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-advertisement-label' ); ?>">
8
- <?php
9
- esc_html_e( 'Manual', 'advanced-ads' );
10
- ?>
11
- </a>
 
12
  </p>
4
  <input id="advads-custom-label" type="text" value="<?php echo esc_html( $label ); ?>"
5
  name="<?php echo esc_attr( ADVADS_SLUG ); ?>[custom-label][text]"/>
6
  </fieldset>
7
+ <p class="description"><?php esc_html_e( 'Displayed above ads.', 'advanced-ads' ); ?>&nbsp;
8
+ <a target="_blank" href="<?php echo esc_url( ADVADS_URL . 'manual/advertisement-label/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-advertisement-label' ); ?>">
9
+ <?php
10
+ esc_html_e( 'Manual', 'advanced-ads' );
11
+ ?>
12
+ </a>
13
  </p>
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.21.0
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.21.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.21.1
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.1' );
43
 
44
  // Autoloading, modules and functions.
45
 
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.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,8 +86,8 @@ msgid "Hide inactive ads"
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 ""
@@ -518,29 +518,29 @@ msgstr ""
518
  msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
519
  msgstr ""
520
 
521
- #: admin/includes/class-list-filters.php:142
522
  #: modules/gadsense/admin/admin.php:73
523
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:109
524
  msgid "Responsive"
525
  msgstr ""
526
 
527
- #: admin/includes/class-list-filters.php:151
528
  msgid "expired"
529
  msgstr ""
530
 
531
- #: admin/includes/class-list-filters.php:155
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
@@ -553,31 +553,31 @@ msgstr ""
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,26 +586,26 @@ msgstr ""
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
 
@@ -653,7 +653,7 @@ msgstr ""
653
  #: admin/includes/class-overview-widgets.php:182
654
  #: admin/views/ad-main-metabox.php:25
655
  #: admin/views/ad-output-metabox.php:61
656
- #: admin/views/settings/general/custom-label.php:9
657
  #: modules/ads-txt/admin/views/setting-create.php:11
658
  #: modules/privacy/admin/views/setting-general.php:34
659
  msgid "Manual"
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.1\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-19T08:51:38+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:156
90
+ #: admin/includes/class-menu.php:159
91
  #: admin/views/settings.php:29
92
  msgid "Support"
93
  msgstr ""
518
  msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
519
  msgstr ""
520
 
521
+ #: admin/includes/class-list-filters.php:143
522
  #: modules/gadsense/admin/admin.php:73
523
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:109
524
  msgid "Responsive"
525
  msgstr ""
526
 
527
+ #: admin/includes/class-list-filters.php:152
528
  msgid "expired"
529
  msgstr ""
530
 
531
+ #: admin/includes/class-list-filters.php:156
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
553
  msgid "Ads"
554
  msgstr ""
555
 
556
+ #: admin/includes/class-menu.php:112
557
  #: public/class-advanced-ads.php:790
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:789
564
  #: public/class-advanced-ads.php:793
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
  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
 
653
  #: admin/includes/class-overview-widgets.php:182
654
  #: admin/views/ad-main-metabox.php:25
655
  #: admin/views/ad-output-metabox.php:61
656
+ #: admin/views/settings/general/custom-label.php:10
657
  #: modules/ads-txt/admin/views/setting-create.php:11
658
  #: modules/privacy/admin/views/setting-general.php:34
659
  msgid "Manual"
modules/gadsense/public/public.php CHANGED
@@ -45,7 +45,7 @@ class Advanced_Ads_AdSense_Public {
45
  $privacy = Advanced_Ads_Privacy::get_instance();
46
  $privacy_options = $privacy->options();
47
  $privacy_enabled = $privacy->get_state() !== 'not_needed';
48
- $npa_enabled = ( isset( $privacy_options['method'] ) && $privacy_options['method'] === 'custom' ) && ! empty( $privacy_options['show-non-personalized-adsense'] );
49
 
50
  // Show non-personalized Adsense ads if non-personalized ads are enabled and consent was not given.
51
  if ( $privacy_enabled && $npa_enabled ) {
45
  $privacy = Advanced_Ads_Privacy::get_instance();
46
  $privacy_options = $privacy->options();
47
  $privacy_enabled = $privacy->get_state() !== 'not_needed';
48
+ $npa_enabled = ( ! empty( $privacy_options['enabled'] ) && $privacy_options['consent-method'] === 'custom' ) && ! empty( $privacy_options['show-non-personalized-adsense'] );
49
 
50
  // Show non-personalized Adsense ads if non-personalized ads are enabled and consent was not given.
51
  if ( $privacy_enabled && $npa_enabled ) {
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.21.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -317,6 +317,11 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
317
 
318
  == Changelog ==
319
 
 
 
 
 
 
320
  = 1.21.0 =
321
 
322
  - enable Position options for Sidebar placements
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 1.21.1
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.1 =
321
+
322
+ - fixed pagination on the ad list page
323
+ - fix Google AdSense non-personalized ads
324
+
325
  = 1.21.0 =
326
 
327
  - enable Position options for Sidebar placements