Advanced Ads - Version 1.30.3

Version Description

  • Fix: properly output HTML attributes for TCF 2.0 script tag
  • Fix: centralize and normalize Ad Group weight calculation
  • Fix: escape closing HTML tags for ads injected into main content which use document.write
  • Fix: add CSS class for hidden elements on medium and wider screens
Download this release

Release Info

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

Code changes from version 1.30.2 to 1.30.3

.phpcs.xml CHANGED
@@ -7,6 +7,16 @@
7
  <exclude-pattern>lib/*</exclude-pattern>
8
  <exclude-pattern>classes/EDD_SL_Plugin_Updater.php</exclude-pattern>
9
 
 
 
 
 
 
 
 
 
 
 
10
  <!-- RULE -->
11
  <rule ref="./vendor/advanced-ads/build-tools/src/AdvancedAds/"/>
12
  </ruleset>
7
  <exclude-pattern>lib/*</exclude-pattern>
8
  <exclude-pattern>classes/EDD_SL_Plugin_Updater.php</exclude-pattern>
9
 
10
+ <rule ref="WordPress.WP.I18n">
11
+ <properties>
12
+ <property name="text_domain" type="array">
13
+ <element value="advanced-ads"/>
14
+ </property>
15
+ </properties>
16
+ </rule>
17
+
18
+ <config name="minimum_supported_wp_version" value="4.9"/>
19
+
20
  <!-- RULE -->
21
  <rule ref="./vendor/advanced-ads/build-tools/src/AdvancedAds/"/>
22
  </ruleset>
admin/assets/css/admin.css CHANGED
@@ -420,8 +420,6 @@ body.rtl #mapi-archived-ads { left: 78px; right:auto; }
420
  .advads-tab input[type="checkbox"] { margin-right: 8px; }
421
  .advads-tab .form-table th, .advads-tab, .advads-tab .form-table td { padding-top: 15px; padding-bottom: 30px; vertical-align: top; }
422
  .advads-tab.active { display: block; }
423
- .advads-license-activate-active { color: #46b450; }
424
- .advads-license-activate-error { color: #dc3232; }
425
  .advads-license-activate-error a { color: inherit; }
426
  .advads-tab-sub-menu ul { overflow: hidden; }
427
  .advads-tab-sub-menu ul li { float: left; padding-right: 0.5em; }
@@ -668,6 +666,9 @@ li:hover > .advads-help:before {
668
  }
669
 
670
  /* Inline Notifications */
 
 
 
671
  .advads-notice-inline:before {
672
  font-family: dashicons;
673
  color: #0474A2;
@@ -866,6 +867,10 @@ tr.advads-clickable-row:hover{
866
  .advads-option-table thead { display: table-header-group; }
867
  .advads-option-table tbody td, .advads-option-table tfoot th { display: table-cell; }
868
  .advads-option-table tbody td:before, .advads-option-table tfoot th:before { display: none; }
 
 
 
 
869
  }
870
  @media screen and (min-width: 1150px) {
871
  /* tables */
420
  .advads-tab input[type="checkbox"] { margin-right: 8px; }
421
  .advads-tab .form-table th, .advads-tab, .advads-tab .form-table td { padding-top: 15px; padding-bottom: 30px; vertical-align: top; }
422
  .advads-tab.active { display: block; }
 
 
423
  .advads-license-activate-error a { color: inherit; }
424
  .advads-tab-sub-menu ul { overflow: hidden; }
425
  .advads-tab-sub-menu ul li { float: left; padding-right: 0.5em; }
666
  }
667
 
668
  /* Inline Notifications */
669
+ span.advads-notice-inline {
670
+ display: inline-block;
671
+ }
672
  .advads-notice-inline:before {
673
  font-family: dashicons;
674
  color: #0474A2;
867
  .advads-option-table thead { display: table-header-group; }
868
  .advads-option-table tbody td, .advads-option-table tfoot th { display: table-cell; }
869
  .advads-option-table tbody td:before, .advads-option-table tfoot th:before { display: none; }
870
+ .advads-option-table .advads-hide-above-medium-screen {
871
+ display: none;
872
+ }
873
+
874
  }
875
  @media screen and (min-width: 1150px) {
876
  /* tables */
admin/class-advanced-ads-admin.php CHANGED
@@ -390,7 +390,7 @@ class Advanced_Ads_Admin {
390
  array_unshift( $links, $support_link );
391
 
392
  // add link to add-ons.
393
- $extend_link = '<a href="' . ADVADS_URL . 'add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page" target="_blank">' . __( 'Add-Ons', 'advanced-ads' ) . '</a>';
394
  array_unshift( $links, $extend_link );
395
 
396
  return $links;
390
  array_unshift( $links, $support_link );
391
 
392
  // add link to add-ons.
393
+ $extend_link = '<a href="' . ADVADS_URL . 'add-ons/?utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page" target="_blank">' . __( 'Add-Ons', 'advanced-ads' ) . '</a>';
394
  array_unshift( $links, $extend_link );
395
 
396
  return $links;
admin/includes/class-ad-groups-list.php CHANGED
@@ -108,11 +108,9 @@ class Advanced_Ads_Groups_List {
108
  * @param Advanced_Ads_Group $group the ad group object.
109
  */
110
  public function render_form_row( Advanced_Ads_Group $group ) {
111
-
112
  // query ads.
113
- $ads = $this->get_ads( $group );
114
-
115
- $weights = $group->get_ad_weights();
116
  $ad_form_rows = $weights;
117
  arsort( $ad_form_rows );
118
  $max_weight = Advanced_Ads_Group::get_max_ad_weight( $ads->post_count );
@@ -153,7 +151,7 @@ class Advanced_Ads_Groups_List {
153
  */
154
  public function render_ads_list( Advanced_Ads_Group $group ) {
155
  $ads = $this->get_ads( $group );
156
- $weights = $group->get_ad_weights();
157
  $published_ads = array_map( static function( WP_Post $post ) {
158
  return $post->ID;
159
  }, array_filter( $ads->posts, static function( WP_Post $post ) {
@@ -269,22 +267,18 @@ class Advanced_Ads_Groups_List {
269
  /**
270
  * Get ads for this group
271
  *
272
- * @param object $group group object.
273
  *
274
- * @return object $ads WP_Query result with ads for this group.
275
  */
276
  public function get_ads( $group ) {
277
- $args = array(
278
  'post_type' => $this->post_type,
279
  'post_status' => array( 'publish', 'pending', 'future', 'private' ),
280
  'taxonomy' => $group->taxonomy,
281
  'term' => $group->slug,
282
  'posts_per_page' => - 1,
283
- );
284
-
285
- $ads = new WP_Query( $args );
286
-
287
- return $ads;
288
  }
289
 
290
  /**
108
  * @param Advanced_Ads_Group $group the ad group object.
109
  */
110
  public function render_form_row( Advanced_Ads_Group $group ) {
 
111
  // query ads.
112
+ $ads = $this->get_ads( $group );
113
+ $weights = $group->get_ad_weights( wp_list_pluck( $ads->posts, 'ID' ) );
 
114
  $ad_form_rows = $weights;
115
  arsort( $ad_form_rows );
116
  $max_weight = Advanced_Ads_Group::get_max_ad_weight( $ads->post_count );
151
  */
152
  public function render_ads_list( Advanced_Ads_Group $group ) {
153
  $ads = $this->get_ads( $group );
154
+ $weights = $group->get_ad_weights( wp_list_pluck( $ads->posts, 'ID' ) );
155
  $published_ads = array_map( static function( WP_Post $post ) {
156
  return $post->ID;
157
  }, array_filter( $ads->posts, static function( WP_Post $post ) {
267
  /**
268
  * Get ads for this group
269
  *
270
+ * @param Advanced_Ads_Group $group group object.
271
  *
272
+ * @return WP_Query
273
  */
274
  public function get_ads( $group ) {
275
+ return new WP_Query( array(
276
  'post_type' => $this->post_type,
277
  'post_status' => array( 'publish', 'pending', 'future', 'private' ),
278
  'taxonomy' => $group->taxonomy,
279
  'term' => $group->slug,
280
  'posts_per_page' => - 1,
281
+ ) );
 
 
 
 
282
  }
283
 
284
  /**
admin/views/setting-license.php CHANGED
@@ -88,8 +88,8 @@ if ( '' === trim( $license_key ) ) {
88
  }
89
  ?>
90
  &nbsp;
91
- <span class="advads-license-activate-active" <?php echo ( ! $show_active ) ? 'style="display: none;"' : ''; ?>><?php esc_html_e( 'active', 'advanced-ads' ); ?></span>
92
- <span class="advads-license-activate-error" <?php echo ( ! $errortext ) ? 'style="display: none;"' : ''; ?>>
93
  <?php
94
  // phpcs:ignore
95
  echo $errortext;
88
  }
89
  ?>
90
  &nbsp;
91
+ <span class="advads-license-activate-active advads-notice-inline advads-check" <?php echo ( ! $show_active ) ? 'style="display: none;"' : ''; ?>><?php esc_html_e( 'active', 'advanced-ads' ); ?></span>
92
+ <span class="advads-license-activate-error advads-notice-inline advads-error" <?php echo ( ! $errortext ) ? 'style="display: none;"' : ''; ?>>
93
  <?php
94
  // phpcs:ignore
95
  echo $errortext;
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.30.2
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.30.2' );
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.30.3
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.30.3' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/ad_group.php CHANGED
@@ -88,7 +88,7 @@ class Advanced_Ads_Group {
88
  /**
89
  * Containing ad weights
90
  */
91
- private $ad_weights = 0;
92
 
93
  /**
94
  * Array with post type objects (ads)
@@ -186,14 +186,13 @@ class Advanced_Ads_Group {
186
  /**
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 string $output output of ad(s) by ad
 
192
  */
193
- public function output( $ordered_ad_ids = false ) {
194
- // if $ordered_ad_ids was not passed to the function, load it
195
- $ordered_ad_ids = ( $ordered_ad_ids === false ) ? $this->get_ordered_ad_ids() : $ordered_ad_ids;
196
- if ( $ordered_ad_ids === null ) {
197
  return '';
198
  }
199
 
@@ -286,27 +285,9 @@ class Advanced_Ads_Group {
286
  if ( ! is_array( $ads ) ) {
287
  return array();
288
  }
289
- $ad_ids = array_keys( $ads );
290
 
291
  // get ad weights serving as an order here
292
- $weights = $this->get_ad_weights();
293
- asort($weights);
294
-
295
- // add ads whose weight has not yet been saved with the default value.
296
- if ( count( $ad_ids ) > count( $weights ) ) {
297
- foreach ( $ad_ids as $ad_id ) {
298
- if ( ! array_key_exists( $ad_id, $weights ) ) {
299
- $weights[ $ad_id ] = self::MAX_AD_GROUP_DEFAULT_WEIGHT;
300
- }
301
- }
302
- }
303
-
304
- // remove ads with 0 ad weight and unavailable ads (e.g. drafts).
305
- foreach ( $weights as $ad_id => $ad_weight ) {
306
- if ( $ad_weight === 0 || ! in_array( $ad_id, $ad_ids, true ) ) {
307
- unset( $weights[ $ad_id ] );
308
- }
309
- }
310
 
311
  // order ads based on group type
312
  if ( $this->type === 'ordered' ) {
@@ -394,24 +375,26 @@ class Advanced_Ads_Group {
394
  }
395
 
396
  /**
397
- * Shuffle ads based on ad weight
398
  *
 
 
 
 
399
  * @since 1.0.0
400
- * @param arr $ads array with ad objects
401
- * @param arr $weights ad weights
402
- * @return arr $shuffled_ads shuffled array with ad ids
403
  */
404
- public function shuffle_ads($ads, $weights) {
405
-
406
  // get a random ad for every ad there is
407
  $shuffled_ads = array();
408
  // while non-zero weights are set select random next
409
- while ( null !== $random_ad_id = $this->get_random_ad_by_weight( $weights ) ) {
 
410
  // remove chosen ad from weights array
411
- unset($weights[$random_ad_id]);
412
  // put random ad into shuffled array
413
- if ( ! empty($ads[$random_ad_id]) ) {
414
- $shuffled_ads[] = $random_ad_id; }
 
415
  }
416
 
417
  return $shuffled_ads;
@@ -448,11 +431,13 @@ class Advanced_Ads_Group {
448
  }
449
 
450
  /**
451
- * Get random ad by ad weight
452
  *
453
  * @since 1.0.0
454
- * @param array $ad_weights e.g. array(A => 2, B => 3, C => 5)
455
  * @source applied with fix for order http://stackoverflow.com/a/11872928/904614
 
 
456
  */
457
  private function get_random_ad_by_weight(array $ad_weights) {
458
 
@@ -460,39 +445,56 @@ class Advanced_Ads_Group {
460
  // ads might have a weight of zero (0); to avoid mt_rand fail assume that at least 1 is set.
461
  $max = array_sum( $ad_weights );
462
  if ( $max < 1 ) {
463
- return ;
464
  }
465
 
466
  $rand = mt_rand( 1, $max );
467
-
468
- foreach ( $ad_weights as $ad_id => $_weight ) {
469
- $rand -= $_weight;
470
  if ( $rand <= 0 ) {
471
  return $ad_id;
472
  }
473
  }
 
 
474
  }
475
 
476
  /**
477
  * Get weights of ads in this group
478
  *
479
- * @since 1.0.0
 
 
480
  */
481
- public function get_ad_weights() {
482
- // load and save ad weights if not yet set
483
- if ( $this->ad_weights == 0 ) {
484
- $weights = get_option( 'advads-ad-weights', array() );
485
- if ( isset($weights[$this->id]) ) {
486
- $this->ad_weights = $weights[$this->id];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  }
488
  }
489
 
490
- // return ad weights ordered by weight
491
- if(!is_array($this->ad_weights)) {
492
- return array();
493
- } else {
494
- return $this->ad_weights;
495
- }
496
  }
497
 
498
  /**
88
  /**
89
  * Containing ad weights
90
  */
91
+ private $ad_weights;
92
 
93
  /**
94
  * Array with post type objects (ads)
186
  /**
187
  * Control the output of the group by type and amount of ads
188
  *
189
+ * @param array $ordered_ad_ids Ordered ids of the ads that belong to the group.
190
+ *
191
  * @return string $output output of ad(s) by ad
192
+ * @since 1.4.8
193
  */
194
+ public function output( $ordered_ad_ids ) {
195
+ if ( empty( $ordered_ad_ids ) ) {
 
 
196
  return '';
197
  }
198
 
285
  if ( ! is_array( $ads ) ) {
286
  return array();
287
  }
 
288
 
289
  // get ad weights serving as an order here
290
+ $weights = $this->get_ad_weights( array_keys( $ads ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
 
292
  // order ads based on group type
293
  if ( $this->type === 'ordered' ) {
375
  }
376
 
377
  /**
378
+ * Shuffle ads based on ad weight.
379
  *
380
+ * @param array $ads ad objects.
381
+ * @param array $weights ad weights, indexed by ad id.
382
+ *
383
+ * @return array
384
  * @since 1.0.0
 
 
 
385
  */
386
+ public function shuffle_ads( $ads, $weights ) {
 
387
  // get a random ad for every ad there is
388
  $shuffled_ads = array();
389
  // while non-zero weights are set select random next
390
+ // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition -- prevents code duplication.
391
+ while ( null !== ( $random_ad_id = $this->get_random_ad_by_weight( $weights ) ) ) {
392
  // remove chosen ad from weights array
393
+ unset( $weights[ $random_ad_id ] );
394
  // put random ad into shuffled array
395
+ if ( ! empty( $ads[ $random_ad_id ] ) ) {
396
+ $shuffled_ads[] = $random_ad_id;
397
+ }
398
  }
399
 
400
  return $shuffled_ads;
431
  }
432
 
433
  /**
434
+ * Get random ad by ad weight.
435
  *
436
  * @since 1.0.0
437
+ * @param array $ad_weights Indexed by ad_id [int $ad_id => int $weight].
438
  * @source applied with fix for order http://stackoverflow.com/a/11872928/904614
439
+ *
440
+ * @return null|int
441
  */
442
  private function get_random_ad_by_weight(array $ad_weights) {
443
 
445
  // ads might have a weight of zero (0); to avoid mt_rand fail assume that at least 1 is set.
446
  $max = array_sum( $ad_weights );
447
  if ( $max < 1 ) {
448
+ return null;
449
  }
450
 
451
  $rand = mt_rand( 1, $max );
452
+ foreach ( $ad_weights as $ad_id => $weight ) {
453
+ $rand -= $weight;
 
454
  if ( $rand <= 0 ) {
455
  return $ad_id;
456
  }
457
  }
458
+
459
+ return null;
460
  }
461
 
462
  /**
463
  * Get weights of ads in this group
464
  *
465
+ * @param array $ad_ids Ids of ads assigned to this group.
466
+ *
467
+ * @return array
468
  */
469
+ public function get_ad_weights( $ad_ids = array() ) {
470
+ if ( is_array( $this->ad_weights ) ) {
471
+ return $this->ad_weights;
472
+ }
473
+
474
+ $weights = get_option( 'advads-ad-weights', array() );
475
+ $this->ad_weights = array();
476
+ if ( array_key_exists( $this->id, $weights ) ) {
477
+ $this->ad_weights = $weights[ $this->id ];
478
+ }
479
+ asort( $this->ad_weights );
480
+
481
+ // add ads whose weight has not yet been saved with the default value.
482
+ if ( count( $ad_ids ) > count( $this->ad_weights ) ) {
483
+ foreach ( $ad_ids as $ad_id ) {
484
+ if ( ! array_key_exists( $ad_id, $this->ad_weights ) ) {
485
+ $this->ad_weights[ $ad_id ] = self::MAX_AD_GROUP_DEFAULT_WEIGHT;
486
+ }
487
+ }
488
+ }
489
+
490
+ // remove ads with 0 ad weight and unavailable ads (e.g. drafts).
491
+ foreach ( $this->ad_weights as $ad_id => $ad_weight ) {
492
+ if ( $ad_weight === 0 || ! in_array( $ad_id, $ad_ids, true ) ) {
493
+ unset( $this->ad_weights[ $ad_id ] );
494
  }
495
  }
496
 
497
+ return $this->ad_weights;
 
 
 
 
 
498
  }
499
 
500
  /**
classes/ad_placements.php CHANGED
@@ -803,7 +803,8 @@ class Advanced_Ads_Placements {
803
  * @return string ad content.
804
  */
805
  private static function filter_ad_content( $ad_content, $tag_name, $options ) {
806
- $plugin_options = Advanced_Ads::get_instance()->options();
 
807
 
808
  // Inject placeholder.
809
  $id = count( self::$ads_for_placeholders );
@@ -813,9 +814,8 @@ class Advanced_Ads_Placements {
813
  'type' => $options['before'] ? 'before' : 'after',
814
  'ad' => $ad_content,
815
  );
816
- $ad_content = '%advads_placeholder_' . $id . '%';
817
 
818
- return $ad_content;
819
  }
820
 
821
  /**
@@ -1255,4 +1255,3 @@ class Advanced_Ads_Placements {
1255
 
1256
 
1257
  }
1258
-
803
  * @return string ad content.
804
  */
805
  private static function filter_ad_content( $ad_content, $tag_name, $options ) {
806
+ // Replace `</` with `<\/` in ad content when placed within `document.write()` to prevent code from breaking.
807
+ $ad_content = preg_replace( '#(document.write.+)</(.*)#', '$1<\/$2', $ad_content );
808
 
809
  // Inject placeholder.
810
  $id = count( self::$ads_for_placeholders );
814
  'type' => $options['before'] ? 'before' : 'after',
815
  'ad' => $ad_content,
816
  );
 
817
 
818
+ return '%advads_placeholder_' . $id . '%';
819
  }
820
 
821
  /**
1255
 
1256
 
1257
  }
 
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.30.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-11-16T10:04:17+01: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"
@@ -249,69 +249,69 @@ msgstr ""
249
  msgid "Learn how."
250
  msgstr ""
251
 
252
- #: admin/includes/class-ad-groups-list.php:178
253
  msgid "Ad weight"
254
  msgstr ""
255
 
256
  #. translators: %s is a date.
257
- #: admin/includes/class-ad-groups-list.php:190
258
  #: admin/views/ad-list-timing-column.php:21
259
  msgid "starts %s"
260
  msgstr ""
261
 
262
  #. translators: %s is a date.
263
  #. translators: %s is a time and date string.
264
- #: admin/includes/class-ad-groups-list.php:211
265
  #: admin/views/ad-list-timing-column.php:59
266
  msgid "expires %s"
267
  msgstr ""
268
 
269
  #. translators: %s is a date.
270
  #. translators: %s is a time and date string.
271
- #: admin/includes/class-ad-groups-list.php:214
272
  #: admin/views/ad-list-timing-column.php:70
273
  msgid "<strong>expired</strong> %s"
274
  msgstr ""
275
 
276
  #. translators: %d is a number.
277
- #: admin/includes/class-ad-groups-list.php:231
278
  msgid "show %d more ads"
279
  msgstr ""
280
 
281
- #: admin/includes/class-ad-groups-list.php:235
282
  msgid "all published ads are displayed"
283
  msgstr ""
284
 
285
  #. translators: %d is a number.
286
- #: admin/includes/class-ad-groups-list.php:238
287
  msgid "up to %d ads displayed"
288
  msgstr ""
289
 
290
- #: admin/includes/class-ad-groups-list.php:241
291
  msgid "No ads assigned"
292
  msgstr ""
293
 
294
- #: admin/includes/class-ad-groups-list.php:243
295
  msgid "Add some"
296
  msgstr ""
297
 
298
- #: admin/includes/class-ad-groups-list.php:321
299
  msgid "Random ads"
300
  msgstr ""
301
 
302
- #: admin/includes/class-ad-groups-list.php:322
303
  msgid "Display random ads based on ad weight"
304
  msgstr ""
305
 
306
- #: admin/includes/class-ad-groups-list.php:325
307
  msgid "Ordered ads"
308
  msgstr ""
309
 
310
- #: admin/includes/class-ad-groups-list.php:326
311
  msgid "Display ads with the highest ad weight first"
312
  msgstr ""
313
 
314
- #: admin/includes/class-ad-groups-list.php:345
315
  #: admin/views/placements.php:275
316
  #: modules/import-export/classes/import.php:153
317
  #: modules/import-export/classes/import.php:193
@@ -320,27 +320,27 @@ msgstr ""
320
  msgid "Edit"
321
  msgstr ""
322
 
323
- #: admin/includes/class-ad-groups-list.php:346
324
  #: admin/views/placements.php:306
325
  msgid "Usage"
326
  msgstr ""
327
 
328
- #: admin/includes/class-ad-groups-list.php:355
329
  #: admin/views/placements.php:10
330
  msgid "Delete"
331
  msgstr ""
332
 
333
- #: admin/includes/class-ad-groups-list.php:377
334
- #: admin/includes/class-ad-groups-list.php:447
335
  msgid "Invalid Ad Group"
336
  msgstr ""
337
 
338
- #: admin/includes/class-ad-groups-list.php:382
339
- #: admin/includes/class-ad-groups-list.php:452
340
  msgid "You don’t have permission to change the ad groups"
341
  msgstr ""
342
 
343
- #: admin/includes/class-ad-groups-list.php:416
344
  msgid "No ad group created"
345
  msgstr ""
346
 
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.30.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: 2021-12-01T09:40:52+01: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"
249
  msgid "Learn how."
250
  msgstr ""
251
 
252
+ #: admin/includes/class-ad-groups-list.php:176
253
  msgid "Ad weight"
254
  msgstr ""
255
 
256
  #. translators: %s is a date.
257
+ #: admin/includes/class-ad-groups-list.php:188
258
  #: admin/views/ad-list-timing-column.php:21
259
  msgid "starts %s"
260
  msgstr ""
261
 
262
  #. translators: %s is a date.
263
  #. translators: %s is a time and date string.
264
+ #: admin/includes/class-ad-groups-list.php:209
265
  #: admin/views/ad-list-timing-column.php:59
266
  msgid "expires %s"
267
  msgstr ""
268
 
269
  #. translators: %s is a date.
270
  #. translators: %s is a time and date string.
271
+ #: admin/includes/class-ad-groups-list.php:212
272
  #: admin/views/ad-list-timing-column.php:70
273
  msgid "<strong>expired</strong> %s"
274
  msgstr ""
275
 
276
  #. translators: %d is a number.
277
+ #: admin/includes/class-ad-groups-list.php:229
278
  msgid "show %d more ads"
279
  msgstr ""
280
 
281
+ #: admin/includes/class-ad-groups-list.php:233
282
  msgid "all published ads are displayed"
283
  msgstr ""
284
 
285
  #. translators: %d is a number.
286
+ #: admin/includes/class-ad-groups-list.php:236
287
  msgid "up to %d ads displayed"
288
  msgstr ""
289
 
290
+ #: admin/includes/class-ad-groups-list.php:239
291
  msgid "No ads assigned"
292
  msgstr ""
293
 
294
+ #: admin/includes/class-ad-groups-list.php:241
295
  msgid "Add some"
296
  msgstr ""
297
 
298
+ #: admin/includes/class-ad-groups-list.php:315
299
  msgid "Random ads"
300
  msgstr ""
301
 
302
+ #: admin/includes/class-ad-groups-list.php:316
303
  msgid "Display random ads based on ad weight"
304
  msgstr ""
305
 
306
+ #: admin/includes/class-ad-groups-list.php:319
307
  msgid "Ordered ads"
308
  msgstr ""
309
 
310
+ #: admin/includes/class-ad-groups-list.php:320
311
  msgid "Display ads with the highest ad weight first"
312
  msgstr ""
313
 
314
+ #: admin/includes/class-ad-groups-list.php:339
315
  #: admin/views/placements.php:275
316
  #: modules/import-export/classes/import.php:153
317
  #: modules/import-export/classes/import.php:193
320
  msgid "Edit"
321
  msgstr ""
322
 
323
+ #: admin/includes/class-ad-groups-list.php:340
324
  #: admin/views/placements.php:306
325
  msgid "Usage"
326
  msgstr ""
327
 
328
+ #: admin/includes/class-ad-groups-list.php:349
329
  #: admin/views/placements.php:10
330
  msgid "Delete"
331
  msgstr ""
332
 
333
+ #: admin/includes/class-ad-groups-list.php:371
334
+ #: admin/includes/class-ad-groups-list.php:441
335
  msgid "Invalid Ad Group"
336
  msgstr ""
337
 
338
+ #: admin/includes/class-ad-groups-list.php:376
339
+ #: admin/includes/class-ad-groups-list.php:446
340
  msgid "You don’t have permission to change the ad groups"
341
  msgstr ""
342
 
343
+ #: admin/includes/class-ad-groups-list.php:410
344
  msgid "No ad group created"
345
  msgstr ""
346
 
modules/privacy/classes/class-privacy.php CHANGED
@@ -92,12 +92,12 @@ class Advanced_Ads_Privacy {
92
 
93
  // convert the data-attributes array into a string.
94
  $attributes_string = '';
95
- array_walk( $data_attributes, function( $value, $key ) use ( &$attributes_string ) {
96
- $attributes_string .= sprintf( 'data-%s="%s"', sanitize_key( $key ), esc_attr( $value ) );
97
  } );
98
 
99
  return sprintf(
100
- '<script type="text/plain" data-tcf="waiting-for-consent" %s>%s</script>',
101
  $attributes_string,
102
  // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- we need to obfuscate the html (and maybe decode it in JS).
103
  base64_encode( $output )
92
 
93
  // convert the data-attributes array into a string.
94
  $attributes_string = '';
95
+ array_walk( $data_attributes, static function( $value, $key ) use ( &$attributes_string ) {
96
+ $attributes_string .= sprintf( ' data-%s="%s"', sanitize_key( $key ), esc_attr( $value ) );
97
  } );
98
 
99
  return sprintf(
100
+ '<script type="text/plain" data-tcf="waiting-for-consent"%s>%s</script>',
101
  $attributes_string,
102
  // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- we need to obfuscate the html (and maybe decode it in JS).
103
  base64_encode( $output )
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 1.30.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -322,6 +322,13 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
322
 
323
  == Changelog ==
324
 
 
 
 
 
 
 
 
325
  = 1.30.2 =
326
 
327
  - Fix: prevent applying array functions to boolean in `Advanced_Ads_Group`
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 1.30.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
322
 
323
  == Changelog ==
324
 
325
+ = 1.30.3 =
326
+
327
+ - Fix: properly output HTML attributes for TCF 2.0 script tag
328
+ - Fix: centralize and normalize Ad Group weight calculation
329
+ - Fix: escape closing HTML tags for ads injected into main content which use document.write
330
+ - Fix: add CSS class for hidden elements on medium and wider screens
331
+
332
  = 1.30.2 =
333
 
334
  - Fix: prevent applying array functions to boolean in `Advanced_Ads_Group`