Advanced Ads - Version 1.25.0

Version Description

  • show ad label event when ad wrapper is now shown
  • add filter advanced-ads-ajax-ad-select-arguments to modify arguments of AJAX ad selection
  • display ads on BuddyPress pages when no ads allowed on 404 pages
  • Ad blocker fix: do not copy assets from "vendor" and "lib" folders
  • Ad blocker fix: compare assets based on filemtime instead of filesize
  • bump minimal require WP core version to 4.9
  • allow to add a replacement for AdSense page-level code
Download this release

Release Info

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

Code changes from version 1.24.2 to 1.25.0

admin/assets/css/admin.css CHANGED
@@ -283,16 +283,15 @@ fieldset.advads-group-add-ad { margin-top: 1em; }
283
  .advads-placements-new-form .advads-error-message { display: none; }
284
  .advads-placements-table { min-width: 80%; border-collapse: collapse; background: #fff; }
285
  .advads-placements-table > tbody > tr { border-top: 1px solid #ddd; }
286
- .advads-placements-table tbody tr td:first-child { width: 70px; }
287
- .advads-placements-table tbody tr td:nth-child(2) { width: 140px; }
288
- .advads-placements-table tbody tr td:nth-child(2) { font-size: 1.2em; }
289
  .advads-placements-table tbody tr td:last-child { width: 70px; }
290
  .advads-placements-table th { margin: 0; padding: 10px; text-align: left; vertical-align: top; }
291
  .advads-placements-table.widefat tbody th { font-weight: bold; }
292
  .advads-placements-table th span { font-weight: normal; }
293
  .advads-placements-table td { margin: 0; padding: 20px 10px; text-align: left; vertical-align: top; }
294
- .advads-placements-table img { height: 50px; }
295
- .advads-placements-table .usage-link { cursor: pointer; }
296
  .advads-placements-table .advads-usage { margin-bottom: 20px; }
297
  .advads-placements-table .advads-usage input { width: 100%; }
298
  .advads-placements-table-options { text-align: right; }
@@ -300,9 +299,28 @@ fieldset.advads-group-add-ad { margin-top: 1em; }
300
  .advads-placements-table ol { margin: 0.5em 0; list-style-position: inside; }
301
  th.advads-placement-sortable { cursor: pointer; }
302
  th.advads-placement-sortable a { display: block; overflow: hidden; }
303
- .advads-placement-sorting-indicator { display: inline-block; visibility: hidden; width: 10px; height: 4px; }
304
- .advads-placement-sorting-indicator:before { content: "\f142"; font: normal 20px/1 dashicons; speak: none; display: inline-block; padding: 0; top: 0; left: -1px; color: #444; position: relative; vertical-align: middle; text-decoration: none !important; color: #444; }
305
- th.advads-placement-sorted .advads-placement-sorting-indicator, th:hover span.advads-placement-sorting-indicator, th:focus span.advads-placement-sorting-indicator { visibility: visible; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
 
307
  /**
308
  GENERAL ELEMENTS
@@ -320,6 +338,13 @@ tr:hover .on-hover { display: block; }
320
  .advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
321
  .advads-spinner { float: none; visibility: visible; }
322
  .advads-wide-input { width: 30em; }
 
 
 
 
 
 
 
323
 
324
  /**
325
  WELCOME PANEL
@@ -409,6 +434,94 @@ tr:hover .on-hover { display: block; }
409
  .advads-settings-tab-main-form textarea { resize: both; }
410
  .advads-settings-tab-main-form .description + label { display: block; margin-top: 12px; }
411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  /**
413
  - SUPPORT PAGE
414
  -*/
@@ -614,7 +727,61 @@ tr.advads-clickable-row:hover{
614
  .advads-option-table-responsive tbody td { display: table-cell; }
615
  .advads-option-table-responsive tbody td:before { display: none; }
616
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
 
619
  /**
620
  MODULE ACTIVATION
283
  .advads-placements-new-form .advads-error-message { display: none; }
284
  .advads-placements-table { min-width: 80%; border-collapse: collapse; background: #fff; }
285
  .advads-placements-table > tbody > tr { border-top: 1px solid #ddd; }
286
+ .advads-placements-table tbody tr td:first-child { width: 200px; }
287
+ .advads-placements-table .advads-placement-name { font-size: 1.2em; }
 
288
  .advads-placements-table tbody tr td:last-child { width: 70px; }
289
  .advads-placements-table th { margin: 0; padding: 10px; text-align: left; vertical-align: top; }
290
  .advads-placements-table.widefat tbody th { font-weight: bold; }
291
  .advads-placements-table th span { font-weight: normal; }
292
  .advads-placements-table td { margin: 0; padding: 20px 10px; text-align: left; vertical-align: top; }
293
+ .advads-placements-table img { height: 70px; margin-bottom: 5px; }
294
+ .advads-placements-table .usage-link, .advads-placements-table .usage-modal-link { cursor: pointer; }
295
  .advads-placements-table .advads-usage { margin-bottom: 20px; }
296
  .advads-placements-table .advads-usage input { width: 100%; }
297
  .advads-placements-table-options { text-align: right; }
299
  .advads-placements-table ol { margin: 0.5em 0; list-style-position: inside; }
300
  th.advads-placement-sortable { cursor: pointer; }
301
  th.advads-placement-sortable a { display: block; overflow: hidden; }
302
+ .advads-placement-sorting-indicator { display: inline-block; visibility: hidden; width: 8px; height: 4px; }
303
+ .advads-placement-sorting-indicator:before { content: "\f142"; font: normal 20px/1 dashicons; speak: none; display: inline-block; padding: 0; top: 0; left: -7px; color: #444; position: relative; vertical-align: middle; text-decoration: none !important; color: #444; }
304
+ :is(a.advads-placement-sorted, th a:hover, th a:focus) .advads-placement-sorting-indicator {
305
+ visibility: visible;
306
+ }
307
+ a.advads-placement-sorted {
308
+ cursor: default;
309
+ pointer-events: none;
310
+ text-decoration: none;
311
+ color: grey;
312
+ }
313
+ .advads_search_placement_name {
314
+ vertical-align: middle;
315
+ }
316
+ .advads-placement-conditions h4 {
317
+ margin-top: 0;
318
+ margin-bottom: 5px;
319
+ }
320
+ .advads-placement-conditions h4+ul {
321
+ margin-top: 0;
322
+ margin-bottom: 18px;
323
+ }
324
 
325
  /**
326
  GENERAL ELEMENTS
338
  .advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
339
  .advads-spinner { float: none; visibility: visible; }
340
  .advads-wide-input { width: 30em; }
341
+ .row-actions span a {
342
+ white-space: nowrap;
343
+ display: inline-block;
344
+ }
345
+ .row-actions span a:first-letter, .advads-placement-conditions li:first-letter {
346
+ text-transform: uppercase;
347
+ }
348
 
349
  /**
350
  WELCOME PANEL
434
  .advads-settings-tab-main-form textarea { resize: both; }
435
  .advads-settings-tab-main-form .description + label { display: block; margin-top: 12px; }
436
 
437
+ /**
438
+ - MODAL
439
+ */
440
+ .advads-modal {
441
+ display: none;
442
+ position: fixed;
443
+ z-index: -1;
444
+ left: 0;
445
+ top: 0;
446
+ width: 100%;
447
+ height: 100%;
448
+ overflow: auto;
449
+ background-color: rgba(0, 0, 0, 0.4);
450
+ opacity: 0;
451
+ pointer-events: none;
452
+ -webkit-transition: opacity 400ms ease-in;
453
+ -moz-transition: opacity 400ms ease-in;
454
+ transition: opacity 400ms ease-in;
455
+ }
456
+ .advads-modal:target {
457
+ display: table;
458
+ opacity: 1;
459
+ pointer-events: auto;
460
+ z-index: 9999;
461
+ }
462
+ .advads-modal-content {
463
+ background-color: #fefefe;
464
+ border: 1px solid #888;
465
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
466
+ animation-name: advads-modal-animatetop;
467
+ animation-duration: 0.4s;
468
+ position: relative;
469
+ margin: 0 auto;
470
+ height: 100%;
471
+ padding: 1em;
472
+ padding-bottom: 0;
473
+ overflow-y: scroll;
474
+ -webkit-overflow-scrolling: touch;
475
+ }
476
+ .advads-modal-header {
477
+ padding: 2px 16px;
478
+ border-bottom: 1px solid #e2e2e2;
479
+ color: white;
480
+ }
481
+ .advads-modal-body {
482
+ padding: 16px 16px;
483
+ }
484
+ .advads-modal-footer {
485
+ padding: 2px 16px;
486
+ padding-bottom: 1em;
487
+ border-top: 1px solid #e2e2e2;
488
+ color: white;
489
+ background-color: white;
490
+ position: sticky;
491
+ bottom: 0;
492
+ }
493
+ @keyframes advads-modal-animatetop {
494
+ from {
495
+ top: -300px;
496
+ opacity: 0
497
+ }
498
+ to {
499
+ top: 0;
500
+ opacity: 1
501
+ }
502
+ }
503
+ .advads-modal-close {
504
+ color: #aaa;
505
+ float: right;
506
+ font-size: 28px;
507
+ font-weight: bold;
508
+ line-height: 50px;
509
+ text-decoration: none;
510
+ }
511
+ .advads-modal-close:hover,
512
+ .advads-modal-close:focus {
513
+ color: black;
514
+ text-decoration: none;
515
+ cursor: pointer;
516
+ }
517
+ a.advads-modal-close-background {
518
+ width: 100%;
519
+ height: 100%;
520
+ position: absolute;
521
+ text-indent: -9999em;
522
+ cursor: default;
523
+ }
524
+
525
  /**
526
  - SUPPORT PAGE
527
  -*/
727
  .advads-option-table-responsive tbody td { display: table-cell; }
728
  .advads-option-table-responsive tbody td:before { display: none; }
729
  }
730
+ @media (min-width: 1200px) {
731
+ .advads-placements-table .advads-placement-name {
732
+ font-size: 1.2em;
733
+ width: calc(97% - 70px);
734
+ display: inline-block;
735
+ vertical-align: top;
736
+ }
737
+ .advads-placements-table img {
738
+ height: auto;
739
+ width: 65px;
740
+ margin-right: 3%;
741
+ display: inline-block;
742
+ }
743
+ .advads-placements-table .advads-placement-type {text-align: left;}
744
+ }
745
+ @media (min-width: 60em) {
746
+ .advads-modal-content {
747
+ height: 75%;
748
+ margin: 5% auto;
749
+ max-height: 57em;
750
+ max-width: 66em;
751
+ width: 85%;
752
+ }
753
+ }
754
+ @media screen and (max-width: 500px) {
755
+ .advads-placements-table .advads-option > span {
756
+ float: none;
757
+ width: 100%;
758
+ margin-bottom: 15px;
759
+ }
760
+ .advads-placements-table .advads-option > span + div {
761
+ margin-left: 0;
762
+ }
763
+ }
764
 
765
+ @media screen and (max-width: 782px) {
766
+ .advads-placements-table.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary~td:not(.check-column) {
767
+ padding-left: 10px;
768
+ }
769
+ .advads-placements-show-options {
770
+ text-align: center;
771
+ }
772
+ .advads-mobile-hidden {
773
+ display: none !important;
774
+ }
775
+ .advads-option > span + div select {
776
+ margin-bottom: 15px;
777
+ }
778
+ .advads-modal-content .advads-option > div label {
779
+ display: block;
780
+ margin-left: 0;
781
+ margin-bottom: 5px;
782
+ padding-top: 5px;
783
+ }
784
+ }
785
 
786
  /**
787
  MODULE ACTIVATION
admin/assets/js/admin.js CHANGED
@@ -146,6 +146,91 @@ jQuery( document ).ready( function ( $ ) {
146
  }
147
  } )
148
  } )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  // display placement settings form
150
  $( '.advads-placements-table a.advads-placement-options-link' ).on( 'click', function ( e ) {
151
  e.preventDefault()
@@ -405,7 +490,7 @@ jQuery( document ).ready( function ( $ ) {
405
  * PLACEMENTS
406
  */
407
  // show image tooltips
408
- $( '.advads-placements-new-form .advads-placement-type' ).advads_tooltip( {
409
  content: function () {
410
  return jQuery( this ).find( '.advads-placement-description' ).html()
411
  }
146
  }
147
  } )
148
  } )
149
+
150
+ /**
151
+ * Logic for placement list
152
+ */
153
+ // filter placement by type
154
+ jQuery( '.advads_filter_placement_type' ).on( 'change', function () {
155
+ var selectedValue = jQuery( this ).val();
156
+ if ( selectedValue === '0' ) {
157
+ jQuery( '.advads-placements-table tbody > tr' ).show();
158
+ } else {
159
+ jQuery( '.advads-placements-table tbody > tr' ).each( function () {
160
+ if ( jQuery( this ).data( 'type' ) !== selectedValue ) {
161
+ jQuery( this ).hide();
162
+ } else {
163
+ jQuery( this ).show();
164
+ }
165
+ } );
166
+ }
167
+ } );
168
+
169
+ // search placement by name
170
+ jQuery( '.advads_search_placement_name' ).on( 'keyup', function () {
171
+ jQuery( '.advads_filter_placement_type option[value=\'0\']' ).attr( 'selected', true );
172
+ var value = this.value;
173
+ jQuery( '.advads-placements-table' ).find( 'tr' ).each( function ( index ) {
174
+ if ( ! index ) {
175
+ return;
176
+ }
177
+ var name = jQuery( this ).data( 'name' );
178
+ if ( typeof name !== 'undefined' ) {
179
+ jQuery( this ).toggle( name.toLowerCase().indexOf( value.toLowerCase() ) !== - 1 );
180
+ }
181
+ } );
182
+ } );
183
+
184
+ jQuery( '.advads-modal-close-action' ).on( 'click', function () {
185
+ // Change url hash, so that the modal doesn't load after refresh again.
186
+ window.location.hash = '#close';
187
+ jQuery( '#advanced-ads-placements-form' ).submit();
188
+ } );
189
+
190
+ jQuery( '.advads-delete-tag' ).each( function () {
191
+ jQuery( this ).on( 'click', function () {
192
+ var r = confirm( 'Wirklich löschen?' );
193
+ if ( r === true ) {
194
+ var row = jQuery( this ).parents( '.advanced-ads-placement-row' );
195
+ row.find( '.advads-placements-item-delete' ).prop( 'checked', true );
196
+ row.data( 'touched', true );
197
+ jQuery( '#advanced-ads-placements-form' ).submit();
198
+ }
199
+ } );
200
+ } );
201
+
202
+ // sort placement by type or name
203
+ jQuery( '.advads-sort' ).on( 'click', function ( e ) {
204
+ var sort = jQuery( this );
205
+ var order = sort.data( 'order' );
206
+ var table = jQuery( '.advads-placements-table' );
207
+ var rows = jQuery( '> tbody > tr', table );
208
+ var links = jQuery( '> thead th > a', table );
209
+ links.each( function () {
210
+ jQuery( this ).removeClass( 'advads-placement-sorted' );
211
+ } );
212
+ sort.addClass( 'advads-placement-sorted' );
213
+ rows.sort( function ( a, b ) {
214
+ var keyA = jQuery( a ).data( order );
215
+ var keyB = jQuery( b ).data( order );
216
+ return ( keyA.localeCompare( keyB ) );
217
+ } );
218
+ jQuery.each( rows, function ( index, row ) {
219
+ table.append( row );
220
+ } );
221
+ sort.data( 'order', order );
222
+ var state = {order: order};
223
+ var url = window.location.pathname + window.location.search;
224
+
225
+ if ( url.indexOf( 'orderby=' ) !== - 1 ) {
226
+ url = url.replace( /\borderby=[0-9a-zA-Z_@.#+-]{1,50}\b/, 'orderby=' + order );
227
+ } else {
228
+ url += '&orderby=' + order;
229
+ }
230
+ window.history.replaceState( state, document.title, url );
231
+ e.preventDefault();
232
+ } );
233
+
234
  // display placement settings form
235
  $( '.advads-placements-table a.advads-placement-options-link' ).on( 'click', function ( e ) {
236
  e.preventDefault()
490
  * PLACEMENTS
491
  */
492
  // show image tooltips
493
+ $( '.advanced-ads_page_advanced-ads-placements .advads-placement-type' ).advads_tooltip( {
494
  content: function () {
495
  return jQuery( this ).find( '.advads-placement-description' ).html()
496
  }
admin/class-advanced-ads-admin.php CHANGED
@@ -53,7 +53,7 @@ class Advanced_Ads_Admin {
53
  * settings page and menu.
54
  */
55
  private function __construct() {
56
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
57
  new Advanced_Ads_Ad_Ajax_Callbacks();
58
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded_ajax' ) );
59
  } else {
53
  * settings page and menu.
54
  */
55
  private function __construct() {
56
+ if ( wp_doing_ajax() ) {
57
  new Advanced_Ads_Ad_Ajax_Callbacks();
58
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded_ajax' ) );
59
  } else {
admin/includes/class-ad-network.php CHANGED
@@ -99,7 +99,7 @@ abstract class Advanced_Ads_Ad_Network {
99
  add_filter( 'advanced-ads-ad-types', array( $this, 'register_ad_type_callback' ) );
100
 
101
  if ( is_admin() ) {
102
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
103
  // we need add all the actions for our ajax calls here.
104
  // our ajax method that will trigger an update of the ad units of this network.
105
  add_action( 'wp_ajax_advanced_ads_get_ad_units_' . $this->identifier, array( $this, 'update_external_ad_units' ) );
@@ -463,4 +463,4 @@ abstract class Advanced_Ads_Ad_Network {
463
  * @return array the data, that will be passed to the base javascript file containing the AdvancedAdsAdNetwork class
464
  */
465
  abstract public function append_javascript_data( &$data );
466
- }
99
  add_filter( 'advanced-ads-ad-types', array( $this, 'register_ad_type_callback' ) );
100
 
101
  if ( is_admin() ) {
102
+ if ( wp_doing_ajax() ) {
103
  // we need add all the actions for our ajax calls here.
104
  // our ajax method that will trigger an update of the ad units of this network.
105
  add_action( 'wp_ajax_advanced_ads_get_ad_units_' . $this->identifier, array( $this, 'update_external_ad_units' ) );
463
  * @return array the data, that will be passed to the base javascript file containing the AdvancedAdsAdNetwork class
464
  */
465
  abstract public function append_javascript_data( &$data );
466
+ }
admin/includes/class-licenses.php CHANGED
@@ -12,6 +12,13 @@ class Advanced_Ads_Admin_Licenses {
12
  */
13
  protected static $instance = null;
14
 
 
 
 
 
 
 
 
15
  /**
16
  * Advanced_Ads_Admin_Licenses constructor.
17
  */
@@ -32,6 +39,8 @@ class Advanced_Ads_Admin_Licenses {
32
 
33
  // check for add-on updates.
34
  add_action( 'admin_init', array( $this, 'add_on_updater' ), 1 );
 
 
35
  }
36
 
37
  /**
@@ -54,7 +63,6 @@ class Advanced_Ads_Admin_Licenses {
54
  * @since 1.7.12
55
  */
56
  public function check_plugin_licenses() {
57
-
58
  if ( is_multisite() ) {
59
  return;
60
  }
@@ -113,7 +121,6 @@ class Advanced_Ads_Admin_Licenses {
113
  * @since 1.2.0
114
  */
115
  public function activate_license( $addon = '', $plugin_name = '', $options_slug = '', $license_key = '' ) {
116
-
117
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
118
  return __( 'Error while trying to register the license. Please contact support.', 'advanced-ads' );
119
  }
@@ -150,7 +157,7 @@ class Advanced_Ads_Admin_Licenses {
150
 
151
  // Call the custom API.
152
  $response = wp_remote_post(
153
- ADVADS_URL,
154
  array(
155
  'timeout' => 15,
156
  'sslverify' => false,
@@ -197,12 +204,12 @@ class Advanced_Ads_Admin_Licenses {
197
  'license_not_activable' => __( 'This is the bundle license key.', 'advanced-ads' ),
198
  'item_name_mismatch' => __( 'This is not the correct key for this add-on.', 'advanced-ads' ),
199
  'no_activations_left' => __( 'There are no activations left.', 'advanced-ads' )
200
- . ' '
201
- . sprintf( // translators: %1$s is a starting link tag, %2$s is the closing one.
202
- __( 'You can manage activations in %1$syour account%2$s.', 'advanced-ads' ),
203
- '<a href="' . ADVADS_URL . 'account/" target="_blank">',
204
- '</a>'
205
- ),
206
  );
207
  $error = isset( $errors[ $license_data->error ] ) ? $errors[ $license_data->error ] : $license_data->error;
208
  if ( 'expired' === $license_data->error ) {
@@ -271,7 +278,6 @@ class Advanced_Ads_Admin_Licenses {
271
  * @deprecated since version 1.7.2 because it only checks if a key is valid, not if the url registered with that key
272
  */
273
  public function check_license( $license_key = '', $plugin_name = '', $options_slug = '' ) {
274
-
275
  if ( has_filter( 'advanced_ads_license_' . $options_slug ) ) {
276
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
277
  }
@@ -315,7 +321,6 @@ class Advanced_Ads_Admin_Licenses {
315
  * @since 1.6.11
316
  */
317
  public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
318
-
319
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
320
  return __( 'Error while trying to disable the license. Please contact support.', 'advanced-ads' );
321
  }
@@ -334,7 +339,7 @@ class Advanced_Ads_Admin_Licenses {
334
  );
335
  // send the remote request.
336
  $response = wp_remote_post(
337
- ADVADS_URL,
338
  array(
339
  'body' => $api_params,
340
  'timeout' => 15,
@@ -388,14 +393,12 @@ class Advanced_Ads_Admin_Licenses {
388
  * @since 1.6.15
389
  */
390
  public function get_licenses() {
391
-
392
  $licenses = array();
393
 
394
  if ( is_multisite() ) {
395
  // if multisite, get option from main blog.
396
  global $current_site;
397
  $licenses = get_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', array() );
398
-
399
  } else {
400
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
401
  }
@@ -411,7 +414,6 @@ class Advanced_Ads_Admin_Licenses {
411
  * @since 1.7.2
412
  */
413
  public function save_licenses( $licenses = array() ) {
414
-
415
  if ( is_multisite() ) {
416
  // if multisite, get option from main blog.
417
  global $current_site;
@@ -430,7 +432,6 @@ class Advanced_Ads_Admin_Licenses {
430
  * @since 1.6.15
431
  */
432
  public function get_license_status( $slug = '' ) {
433
-
434
  $status = false;
435
 
436
  if ( is_multisite() ) {
@@ -458,43 +459,67 @@ class Advanced_Ads_Admin_Licenses {
458
  ARRAY_FILTER_USE_KEY
459
  );
460
 
461
-
462
  return array() !== $valid && max( array_count_values( $valid ) ) > 1;
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  /**
466
  * Get license expired value of an add-on
467
  *
468
  * @param string $slug slug of the add-on.
469
  *
470
- * @return string $date expiry date of an add-on
471
  * @since 1.6.15
472
  */
473
  public function get_license_expires( $slug = '' ) {
474
-
475
- $date = false;
476
-
477
  if ( is_multisite() ) {
478
- // if multisite, get option from main blog.
479
  global $current_site;
480
- $date = get_blog_option( $current_site->blog_id, $slug . '-license-expires', false );
481
- } else {
482
- $date = get_option( $slug . '-license-expires', false );
483
  }
484
 
485
- return $date;
486
  }
487
 
488
 
489
  /**
490
- * Add-on updater
491
- *
492
- * @since 1.5.7
493
  */
494
  public function add_on_updater() {
495
 
496
- // ignore, if not main blog.
497
- if ( ( is_multisite() && ! is_main_site() ) ) {
498
  return;
499
  }
500
 
@@ -513,7 +538,6 @@ class Advanced_Ads_Admin_Licenses {
513
  return;
514
  }
515
 
516
- // load license keys.
517
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
518
 
519
  foreach ( $add_ons as $_add_on_key => $_add_on ) {
@@ -524,37 +548,25 @@ class Advanced_Ads_Admin_Licenses {
524
  if ( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ) {
525
  // remove license status.
526
  delete_option( $_add_on['options_slug'] . '-license-status' );
527
- continue;
528
- }
529
-
530
- // check status.
531
- if ( $this->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
532
- continue;
533
  }
534
 
535
  // retrieve our license key.
536
  $license_key = isset( $licenses[ $_add_on_key ] ) ? $licenses[ $_add_on_key ] : '';
537
 
538
- // setup the updater.
539
- if ( $license_key ) {
540
-
541
- // register filter to set EDD transient to 86,400 seconds (day) instead of 3,600 (hours).
542
- $slug = basename( $_add_on['path'], '.php' );
543
- $transient_key = md5( serialize( $slug . $license_key ) );
544
-
545
- add_filter( 'pre_update_option_' . $transient_key, array( $this, 'set_expiration_of_update_option' ) );
546
-
547
- new ADVADS_SL_Plugin_Updater(
548
- ADVADS_URL,
549
- $_add_on['path'],
550
- array(
551
- 'version' => $_add_on['version'],
552
- 'license' => $license_key,
553
- 'item_name' => $_add_on['name'],
554
- 'author' => 'Advanced Ads',
555
- )
556
- );
557
- }
558
  }
559
  }
560
 
@@ -567,7 +579,6 @@ class Advanced_Ads_Admin_Licenses {
567
  * @since 1.7.14
568
  */
569
  public function set_expiration_of_update_option( $value ) {
570
-
571
  $value['timeout'] = time() + 86400;
572
 
573
  return $value;
@@ -585,7 +596,6 @@ class Advanced_Ads_Admin_Licenses {
585
  * @todo check if this is still working.
586
  */
587
  public function addon_upgrade_filter( $reply, $package, $updater ) {
588
-
589
  if ( isset( $updater->skin->plugin ) ) {
590
  $plugin_file = $updater->skin->plugin;
591
  } elseif ( isset( $updater->skin->plugin_info['Name'] ) ) {
@@ -599,7 +609,7 @@ class Advanced_Ads_Admin_Licenses {
599
  if ( isset( $plugin_file ) && $plugin_file ) {
600
  // hides the download url, but makes debugging harder.
601
  // $updater->strings['downloading_package'] = __( 'Downloading updated version...', 'advanced-ads' );
602
- //$updater->skin->feedback( 'downloading_package' );
603
 
604
  // if AJAX; show direct update link as first possible solution.
605
  if ( defined( 'DOING_AJAX' ) ) {
@@ -608,14 +618,8 @@ class Advanced_Ads_Admin_Licenses {
608
  } else {
609
  $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), ADVADS_URL . 'manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
610
  }
611
-
612
  }
613
 
614
- /*$res = $updater->fs_connect( array( WP_CONTENT_DIR ) );
615
- if ( ! $res ) {
616
- return new WP_Error( 'no_credentials', __( "Error! Can't connect to filesystem", 'advanced-ads' ) );
617
- }*/
618
-
619
  return $reply;
620
  }
621
 
@@ -627,7 +631,6 @@ class Advanced_Ads_Admin_Licenses {
627
  * @return array array with the add-on data
628
  */
629
  private function get_installed_add_on_by_name( $name = '' ) {
630
-
631
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
632
 
633
  if ( is_array( $add_ons ) ) {
@@ -658,10 +661,14 @@ class Advanced_Ads_Admin_Licenses {
658
  // check expiry date.
659
  $expiry_date = self::get_instance()->get_license_expires( $_add_on['options_slug'] );
660
 
661
- if ( ( $expiry_date && strtotime( $expiry_date ) > time() )
662
- || 'valid' === $status
663
- || 'lifetime' === $expiry_date ) {
664
-
 
 
 
 
665
  return true;
666
  }
667
  }
@@ -669,5 +676,89 @@ class Advanced_Ads_Admin_Licenses {
669
  return false;
670
  }
671
 
 
 
 
 
 
 
 
 
 
 
 
672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  }
12
  */
13
  protected static $instance = null;
14
 
15
+ /**
16
+ * License API endpoint URL
17
+ *
18
+ * @const string
19
+ */
20
+ const API_ENDPOINT = ADVADS_URL . 'license-api/';
21
+
22
  /**
23
  * Advanced_Ads_Admin_Licenses constructor.
24
  */
39
 
40
  // check for add-on updates.
41
  add_action( 'admin_init', array( $this, 'add_on_updater' ), 1 );
42
+ // react on API update checks
43
+ add_action( 'http_api_debug', array( $this, 'update_license_after_version_info' ), 10, 5 );
44
  }
45
 
46
  /**
63
  * @since 1.7.12
64
  */
65
  public function check_plugin_licenses() {
 
66
  if ( is_multisite() ) {
67
  return;
68
  }
121
  * @since 1.2.0
122
  */
123
  public function activate_license( $addon = '', $plugin_name = '', $options_slug = '', $license_key = '' ) {
 
124
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
125
  return __( 'Error while trying to register the license. Please contact support.', 'advanced-ads' );
126
  }
157
 
158
  // Call the custom API.
159
  $response = wp_remote_post(
160
+ self::API_ENDPOINT,
161
  array(
162
  'timeout' => 15,
163
  'sslverify' => false,
204
  'license_not_activable' => __( 'This is the bundle license key.', 'advanced-ads' ),
205
  'item_name_mismatch' => __( 'This is not the correct key for this add-on.', 'advanced-ads' ),
206
  'no_activations_left' => __( 'There are no activations left.', 'advanced-ads' )
207
+ . '&nbsp;'
208
+ . sprintf( // translators: %1$s is a starting link tag, %2$s is the closing one.
209
+ __( 'You can manage activations in %1$syour account%2$s.', 'advanced-ads' ),
210
+ '<a href="' . ADVADS_URL . 'account/" target="_blank">',
211
+ '</a>'
212
+ ),
213
  );
214
  $error = isset( $errors[ $license_data->error ] ) ? $errors[ $license_data->error ] : $license_data->error;
215
  if ( 'expired' === $license_data->error ) {
278
  * @deprecated since version 1.7.2 because it only checks if a key is valid, not if the url registered with that key
279
  */
280
  public function check_license( $license_key = '', $plugin_name = '', $options_slug = '' ) {
 
281
  if ( has_filter( 'advanced_ads_license_' . $options_slug ) ) {
282
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
283
  }
321
  * @since 1.6.11
322
  */
323
  public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
 
324
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
325
  return __( 'Error while trying to disable the license. Please contact support.', 'advanced-ads' );
326
  }
339
  );
340
  // send the remote request.
341
  $response = wp_remote_post(
342
+ self::API_ENDPOINT,
343
  array(
344
  'body' => $api_params,
345
  'timeout' => 15,
393
  * @since 1.6.15
394
  */
395
  public function get_licenses() {
 
396
  $licenses = array();
397
 
398
  if ( is_multisite() ) {
399
  // if multisite, get option from main blog.
400
  global $current_site;
401
  $licenses = get_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', array() );
 
402
  } else {
403
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
404
  }
414
  * @since 1.7.2
415
  */
416
  public function save_licenses( $licenses = array() ) {
 
417
  if ( is_multisite() ) {
418
  // if multisite, get option from main blog.
419
  global $current_site;
432
  * @since 1.6.15
433
  */
434
  public function get_license_status( $slug = '' ) {
 
435
  $status = false;
436
 
437
  if ( is_multisite() ) {
459
  ARRAY_FILTER_USE_KEY
460
  );
461
 
 
462
  return array() !== $valid && max( array_count_values( $valid ) ) > 1;
463
  }
464
 
465
+ /**
466
+ * Return the licence expiry time if it is equal for more than one add-on. That indicates it is likely an All Access license
467
+ *
468
+ * @return string|null
469
+ */
470
+ public function get_probably_all_access_expiry() {
471
+ /**
472
+ * Get expiry dates of all add-ons.
473
+ *
474
+ * @param string $key Add-on key.
475
+ *
476
+ * @return string|false the expiration date or false.
477
+ */
478
+ $expiry_counts = array_count_values( array_map( function( $key ) {
479
+ return $this->get_license_expires( ADVADS_SLUG . '-' . $key );
480
+ }, array_keys( array_filter( $this->get_licenses() ) ) ) );
481
+ /**
482
+ * Remove all licenses that are used only once.
483
+ *
484
+ * @param int $count the count from array_count_values_above
485
+ *
486
+ * @return bool whether the count is greater 1
487
+ */
488
+ $all_access = array_filter( $expiry_counts, function( $count ) {
489
+ return $count > 1;
490
+ } );
491
+
492
+ // if there is an item in $all_access we can assume this is from All Access and return the expiry date.
493
+ return empty( $all_access ) ? null : key( $all_access );
494
+ }
495
+
496
  /**
497
  * Get license expired value of an add-on
498
  *
499
  * @param string $slug slug of the add-on.
500
  *
501
+ * @return string $date expiry date of an add-on, empty string if no option exists
502
  * @since 1.6.15
503
  */
504
  public function get_license_expires( $slug = '' ) {
505
+ // if multisite, get option from main blog.
 
 
506
  if ( is_multisite() ) {
 
507
  global $current_site;
508
+
509
+ return get_blog_option( $current_site->blog_id, $slug . '-license-expires', '' );
 
510
  }
511
 
512
+ return get_option( $slug . '-license-expires', '' );
513
  }
514
 
515
 
516
  /**
517
+ * Register the Updater class for every add-on, which includes getting version information
 
 
518
  */
519
  public function add_on_updater() {
520
 
521
+ // ignore, if not main blog or if updater was disabled
522
+ if ( ( is_multisite() && ! is_main_site() ) || ! apply_filters( 'advanced-ads-add-ons-updater', true ) ) {
523
  return;
524
  }
525
 
538
  return;
539
  }
540
 
 
541
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
542
 
543
  foreach ( $add_ons as $_add_on_key => $_add_on ) {
548
  if ( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ) {
549
  // remove license status.
550
  delete_option( $_add_on['options_slug'] . '-license-status' );
 
 
 
 
 
 
551
  }
552
 
553
  // retrieve our license key.
554
  $license_key = isset( $licenses[ $_add_on_key ] ) ? $licenses[ $_add_on_key ] : '';
555
 
556
+ // by default, EDD looks every 3 hours for updates. The following code block changes that to 24 hours. set_expiration_of_update_option delivers that value.
557
+ $option_key = 'pre_update_option_edd_sl_' . md5( serialize( basename( $_add_on['path'], '.php' ) . $license_key ) );
558
+ add_filter( $option_key, array( $this, 'set_expiration_of_update_option' ) );
559
+
560
+ new ADVADS_SL_Plugin_Updater(
561
+ self::API_ENDPOINT,
562
+ $_add_on['path'],
563
+ array(
564
+ 'version' => $_add_on['version'],
565
+ 'license' => $license_key,
566
+ 'item_name' => $_add_on['name'],
567
+ 'author' => 'Advanced Ads',
568
+ )
569
+ );
 
 
 
 
 
 
570
  }
571
  }
572
 
579
  * @since 1.7.14
580
  */
581
  public function set_expiration_of_update_option( $value ) {
 
582
  $value['timeout'] = time() + 86400;
583
 
584
  return $value;
596
  * @todo check if this is still working.
597
  */
598
  public function addon_upgrade_filter( $reply, $package, $updater ) {
 
599
  if ( isset( $updater->skin->plugin ) ) {
600
  $plugin_file = $updater->skin->plugin;
601
  } elseif ( isset( $updater->skin->plugin_info['Name'] ) ) {
609
  if ( isset( $plugin_file ) && $plugin_file ) {
610
  // hides the download url, but makes debugging harder.
611
  // $updater->strings['downloading_package'] = __( 'Downloading updated version...', 'advanced-ads' );
612
+ // $updater->skin->feedback( 'downloading_package' );
613
 
614
  // if AJAX; show direct update link as first possible solution.
615
  if ( defined( 'DOING_AJAX' ) ) {
618
  } else {
619
  $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), ADVADS_URL . 'manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
620
  }
 
621
  }
622
 
 
 
 
 
 
623
  return $reply;
624
  }
625
 
631
  * @return array array with the add-on data
632
  */
633
  private function get_installed_add_on_by_name( $name = '' ) {
 
634
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
635
 
636
  if ( is_array( $add_ons ) ) {
661
  // check expiry date.
662
  $expiry_date = self::get_instance()->get_license_expires( $_add_on['options_slug'] );
663
 
664
+ if (
665
+ (
666
+ $expiry_date
667
+ && strtotime( $expiry_date ) > time()
668
+ )
669
+ || 'valid' === $status
670
+ || 'lifetime' === $expiry_date
671
+ ) {
672
  return true;
673
  }
674
  }
676
  return false;
677
  }
678
 
679
+ /**
680
+ * Update the license status based on information retrieved from the version info check
681
+ *
682
+ * @param array|WP_Error $response HTTP response or WP_Error object.
683
+ * @param string $context Context under which the hook is fired.
684
+ * @param string $class HTTP transport used.
685
+ * @param array $parsed_args HTTP request arguments.
686
+ * @param string $url The request URL.
687
+ * @return array|WP_Error
688
+ */
689
+ public function update_license_after_version_info( $response, $context, $class, $parsed_args, $url ) {
690
 
691
+ // bail if this call is not from our version check or returns an issue
692
+ if ( $url !== self::API_ENDPOINT
693
+ || (
694
+ empty( $parsed_args['body']['edd_action'] )
695
+ || 'get_version' !== $parsed_args['body']['edd_action']
696
+ )
697
+ || is_wp_error( $response )
698
+ ) {
699
+ return $response;
700
+ }
701
+
702
+ $params = json_decode( wp_remote_retrieve_body( $response ) );
703
+ // return if no name is given to identify the plugin that needs update
704
+ if ( empty( $params->name ) ) {
705
+ return $response;
706
+ }
707
+
708
+ $new_license_status = null;
709
+ $new_expiry_date = null;
710
+
711
+ // Some of the conditions could happen at the same time, though due to different conditions in EDD we are safer to have multiple checks
712
+ if ( isset( $params->valid_until ) ) {
713
+ if ( 'invalid' === $params->valid_until ) {
714
+ $new_license_status = 'invalid';
715
+ }
716
+ if ( 'lifetime' === $params->valid_until ) {
717
+ $new_license_status = 'valid';
718
+ $new_expiry_date = 'lifetime';
719
+ }
720
+ // license is timestamp
721
+ if ( is_int( $params->valid_until ) ) {
722
+ $new_expiry_date = (int) $params->valid_until;
723
+ if ( time() < $params->valid_until ) {
724
+ $new_license_status = 'valid';
725
+ }
726
+ }
727
+ } elseif ( empty( $params->download_link ) || empty( $params->package ) || isset( $params->msg ) ) {
728
+ // if either of these two parameters is missing then the user does not have a valid license according to our store
729
+ // if there is a "msg" parameter then the license did also not work for another reason
730
+ $new_license_status = 'invalid';
731
+ }
732
+
733
+ if ( ! $new_license_status && ! $new_expiry_date ) {
734
+ return $response;
735
+ }
736
+
737
+ $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
738
+
739
+ // look for the add-on with the appropriate license key
740
+ foreach ( $add_ons as $_add_on_key => $_add_on ) {
741
+ // identify the add-on based on the name
742
+ if ( ! isset( $add_on['name'] ) || $params->name !== $add_on['name'] ) {
743
+ continue;
744
+ }
745
+
746
+ $options_slug = $_add_on['options_slug'];
747
+
748
+ if ( $new_license_status ) {
749
+ update_option( $options_slug . '-license-status', $new_license_status, false );
750
+ }
751
+ if ( $new_expiry_date ) {
752
+ if ( 'lifetime' !== $new_expiry_date ) {
753
+ $new_expiry_date = gmdate( 'Y-m-d 23:59:49', $new_expiry_date );
754
+ }
755
+ update_option( $options_slug . '-license-expires', $new_expiry_date, false );
756
+ }
757
+
758
+ // return with the first match since there should only be one plugin per name
759
+ return $response;
760
+ }
761
+
762
+ return $response;
763
+ }
764
  }
admin/includes/class-list-filters.php CHANGED
@@ -59,7 +59,7 @@ class Advanced_Ads_Ad_List_Filters {
59
  * Constructs the unique instance.
60
  */
61
  private function __construct() {
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 );
59
  * Constructs the unique instance.
60
  */
61
  private function __construct() {
62
+ if ( is_admin() && ! wp_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 );
admin/includes/class-overview-widgets.php CHANGED
@@ -31,9 +31,10 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
31
  // initiate i18n notice.
32
  new Yoast_I18n_WordPressOrg_v3(
33
  array(
34
- 'textdomain' => 'advanced-ads',
35
- 'plugin_name' => 'Advanced Ads',
36
- 'hook' => 'advanced-ads-overview-below-support',
 
37
  )
38
  );
39
 
@@ -82,21 +83,18 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
82
  * @param callable $callback function that fills the box with the desired content.
83
  */
84
  public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ) {
85
-
86
  ob_start();
87
  call_user_func( array( 'Advanced_Ads_Overview_Widgets_Callbacks', $callback ) );
88
  do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
89
  $content = ob_get_clean();
90
 
91
  include ADVADS_BASE_PATH . 'admin/views/overview-widget.php';
92
-
93
  }
94
 
95
  /**
96
  * Render Ad Health notices widget
97
  */
98
  public static function render_notices() {
99
-
100
  Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget();
101
  ?><script>jQuery( document ).ready( function(){ advads_ad_health_maybe_remove_list(); });</script>
102
  <?php
@@ -108,7 +106,6 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
108
  * Render next steps widget
109
  */
110
  public static function render_next_steps() {
111
-
112
  $primary_taken = false;
113
 
114
  $model = Advanced_Ads::get_instance()->get_model();
@@ -224,7 +221,6 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
224
  }
225
 
226
  do_action( 'advanced-ads-overview-below-support' );
227
-
228
  }
229
 
230
  /**
@@ -449,11 +445,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
449
  * @param bool $hide_activated if true, hide activated add-ons.
450
  */
451
  public static function render_addons( $hide_activated = false ) {
452
-
453
- $link = ADVADS_URL . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons';
454
- ?>
455
- <p><a href="<?php echo esc_url( $link ); ?>" target="_blank"><?php echo esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ); ?></a></p>
456
- <?php
457
 
458
  $caching_used = Advanced_Ads_Checks::cache();
459
 
@@ -560,12 +556,6 @@ endif;
560
  'link' => ADVADS_URL . 'add-ons/google-ad-manager/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
561
  'order' => 5,
562
  ),
563
- 'geo' => array(
564
- 'title' => 'Geo Targeting',
565
- 'desc' => __( 'Target visitors with ads that match their geo location and make more money with regional campaigns.', 'advanced-ads' ),
566
- 'link' => ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
567
- 'order' => 5,
568
- ),
569
  'sticky' => array(
570
  'title' => 'Sticky ads',
571
  'desc' => __( 'Increase click rates on your ads by placing them in sticky positions above, next or below your site.', 'advanced-ads' ),
@@ -578,6 +568,12 @@ endif;
578
  'link' => ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
579
  'order' => 5,
580
  ),
 
 
 
 
 
 
581
  'selling' => array(
582
  'title' => 'Selling Ads',
583
  'desc' => __( 'Earn more money and let advertisers pay for ad space directly on the frontend of your site.', 'advanced-ads' ),
@@ -809,7 +805,7 @@ endif;
809
  }
810
  }
811
 
812
- // only show All Access Pitch if less than 2 add-ons exist.
813
  if ( $installed_pro_plugins < 2 ) {
814
  $add_ons['bundle'] = array(
815
  'title' => 'All Access',
@@ -821,6 +817,22 @@ endif;
821
  );
822
  }
823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  // allow add-ons to manipulate the output.
825
  $add_ons = apply_filters( 'advanced-ads-overview-add-ons', $add_ons );
826
 
31
  // initiate i18n notice.
32
  new Yoast_I18n_WordPressOrg_v3(
33
  array(
34
+ 'textdomain' => 'advanced-ads',
35
+ 'plugin_name' => 'Advanced Ads',
36
+ 'hook' => 'advanced-ads-overview-below-support',
37
+ 'glotpress_logo' => false, // disables the plugin icon so we don’t need to keep up with potential changes.
38
  )
39
  );
40
 
83
  * @param callable $callback function that fills the box with the desired content.
84
  */
85
  public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ) {
 
86
  ob_start();
87
  call_user_func( array( 'Advanced_Ads_Overview_Widgets_Callbacks', $callback ) );
88
  do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
89
  $content = ob_get_clean();
90
 
91
  include ADVADS_BASE_PATH . 'admin/views/overview-widget.php';
 
92
  }
93
 
94
  /**
95
  * Render Ad Health notices widget
96
  */
97
  public static function render_notices() {
 
98
  Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget();
99
  ?><script>jQuery( document ).ready( function(){ advads_ad_health_maybe_remove_list(); });</script>
100
  <?php
106
  * Render next steps widget
107
  */
108
  public static function render_next_steps() {
 
109
  $primary_taken = false;
110
 
111
  $model = Advanced_Ads::get_instance()->get_model();
221
  }
222
 
223
  do_action( 'advanced-ads-overview-below-support' );
 
224
  }
225
 
226
  /**
445
  * @param bool $hide_activated if true, hide activated add-ons.
446
  */
447
  public static function render_addons( $hide_activated = false ) {
448
+ if ( ! $hide_activated ) :
449
+ ?>
450
+ <p><a href="<?php echo esc_url( ADVADS_URL ) . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons'; ?>" target="_blank"><?php echo esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ); ?></a></p>
451
+ <?php
452
+ endif;
453
 
454
  $caching_used = Advanced_Ads_Checks::cache();
455
 
556
  'link' => ADVADS_URL . 'add-ons/google-ad-manager/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
557
  'order' => 5,
558
  ),
 
 
 
 
 
 
559
  'sticky' => array(
560
  'title' => 'Sticky ads',
561
  'desc' => __( 'Increase click rates on your ads by placing them in sticky positions above, next or below your site.', 'advanced-ads' ),
568
  'link' => ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
569
  'order' => 5,
570
  ),
571
+ 'geo' => array(
572
+ 'title' => 'Geo Targeting',
573
+ 'desc' => __( 'Target visitors with ads that match their geo location and make more money with regional campaigns.', 'advanced-ads' ),
574
+ 'link' => ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
575
+ 'order' => 5,
576
+ ),
577
  'selling' => array(
578
  'title' => 'Selling Ads',
579
  'desc' => __( 'Earn more money and let advertisers pay for ad space directly on the frontend of your site.', 'advanced-ads' ),
805
  }
806
  }
807
 
808
+ // show All Access Pitch if less than 2 add-ons exist.
809
  if ( $installed_pro_plugins < 2 ) {
810
  $add_ons['bundle'] = array(
811
  'title' => 'All Access',
817
  );
818
  }
819
 
820
+ $all_access_expiry = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access_expiry();
821
+ // show All Access long-term pitch if less than 2 add-ons exist or All Access license is expiring within next 12 month or already expired
822
+ if (
823
+ $installed_pro_plugins < 2
824
+ || ( $all_access_expiry && ( time() + YEAR_IN_SECONDS ) > strtotime( $all_access_expiry ) )
825
+ ) {
826
+ $add_ons['long_term'] = array(
827
+ 'title' => 'All Access long-term',
828
+ 'desc' => __( 'A one-time payment for four years of support and updates. The package saves you up to 70% compared to individually purchasing our add-ons.', 'advanced-ads' ),
829
+ 'link' => ADVADS_URL . 'add-ons/all-access-long-term/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
830
+ 'link_title' => __( 'Get full access', 'advanced-ads' ),
831
+ 'link_primary' => true,
832
+ 'order' => 1,
833
+ );
834
+ }
835
+
836
  // allow add-ons to manipulate the output.
837
  $add_ons = apply_filters( 'advanced-ads-overview-add-ons', $add_ons );
838
 
admin/views/ad-list-no-ads.php CHANGED
@@ -5,11 +5,21 @@
5
  </button>
6
  </div>
7
  <script>
8
- (function ($) {
9
- var $videoLink = $('#advads-first-ad-video-link');
10
- $videoLink.click(function () {
11
- $('<br class="clear"/><br/><iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/A5jKAzqyWwA?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>').appendTo('#advads-first-ad-links');
12
- })
13
- .children('.dashicons').css('line-height', $videoLink.css('line-height'));
14
- })(jQuery)
 
 
 
 
 
 
 
 
 
15
  </script>
 
5
  </button>
6
  </div>
7
  <script>
8
+ ( function ( $ ) {
9
+ var $videoLink = $( '#advads-first-ad-video-link' );
10
+ var wpLang = '<?php echo esc_html( get_locale() ); ?>';
11
+ var buttonClicked = false;
12
+ $videoLink.click( function () {
13
+ if ( ! buttonClicked ) {
14
+ if ( wpLang === 'de_DE' ) {
15
+ $( '<br class="clear"/><br/><iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/Gd09nf1dNwY?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>' ).appendTo( '#advads-first-ad-links' );
16
+ } else {
17
+ $( '<br class="clear"/><br/><iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/nfybYz8ayXQ?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>' ).appendTo( '#advads-first-ad-links' );
18
+ }
19
+ buttonClicked = ! buttonClicked;
20
+ }
21
+ } )
22
+ .children( '.dashicons' ).css( 'line-height', $videoLink.css( 'line-height' ) );
23
+ } )( jQuery );
24
  </script>
25
+
admin/views/conditions/display-conditions-list.php CHANGED
@@ -40,7 +40,7 @@
40
  echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
41
  if ( $show_or_force_warning ) {
42
  ?>
43
- <p class="advads-error-message">
44
  <?php
45
  esc_attr_e( 'Forced to OR.', 'advanced-ads' );
46
  echo '&nbsp;<a target="_blank" href="' . esc_url( ADVADS_URL ) . 'manual/display-conditions#manual-combining-multiple-conditions">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
40
  echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
41
  if ( $show_or_force_warning ) {
42
  ?>
43
+ <p class="advads-error-message" style="display:block;">
44
  <?php
45
  esc_attr_e( 'Forced to OR.', 'advanced-ads' );
46
  echo '&nbsp;<a target="_blank" href="' . esc_url( ADVADS_URL ) . 'manual/display-conditions#manual-combining-multiple-conditions">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
admin/views/modal.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Advanced Ads - Backend modal
4
+ *
5
+ * @var string $modal_slug Unique slug that can be addressed by a link or button.
6
+ * @var string $modal_content The modal content. May contain HTML.
7
+ * @var string $modal_title The modal title.
8
+ * @var string $close_action Adds another close button that can trigger an action.
9
+ */
10
+ $modal_slug = isset( $modal_slug ) ? $modal_slug : '';
11
+ $modal_content = isset( $modal_content ) ? $modal_content : '';
12
+ $modal_title = isset( $modal_title ) ? $modal_title : '';
13
+ $close_action = isset( $close_action ) ? $close_action : '';
14
+ ?>
15
+
16
+ <div id="modal-<?php echo esc_attr( $modal_slug ); ?>" class="advads-modal"
17
+ data-modal-id="<?php echo esc_attr( $modal_slug ); ?>">
18
+ <a href="#close" class="advads-modal-close-background">Close</a>
19
+ <div class="advads-modal-content">
20
+ <div class="advads-modal-header">
21
+ <a href="#close" class="advads-modal-close">&times;</a>
22
+ <h2>
23
+ <?php
24
+ echo esc_html( $modal_title );
25
+ ?>
26
+ </h2>
27
+ </div>
28
+ <div class="advads-modal-body">
29
+ <?php
30
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- modal content may contain any kind of custom html
31
+ echo $modal_content;
32
+ ?>
33
+ </div>
34
+ <div class="advads-modal-footer">
35
+ <div class="tablenav bottom">
36
+ <a href="#close" type="button" title="<?php esc_html_e( 'Close', 'advanced-ads' ); ?>"
37
+ class="button button-secondary advads-modal-close"><?php esc_html_e( 'Close', 'advanced-ads' ); ?></a>
38
+ <?php if ( $close_action ) : ?>
39
+ <a href="#close" type="button" title="<?php esc_attr_e( 'Close and save', 'advanced-ads' ); ?>"
40
+ class="button button-primary advads-modal-close-action">
41
+ <?php
42
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
43
+ echo $close_action;
44
+ ?>
45
+ </a>
46
+ <?php endif; ?>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
admin/views/placements-inline-css.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Render inline css option for placements.
4
+ *
5
+ * @var string $_placement_slug slug of the current placement.
6
+ * @var string $_placement Placement with all options.
7
+ */
8
+ $inline_css = isset( $_placement['options']['inline-css'] ) ? $_placement['options']['inline-css'] : '';
9
+ ?>
10
+ <input type="text" value="<?php echo esc_attr( $inline_css ); ?>" name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][options][inline-css]"/>
admin/views/placements.php CHANGED
@@ -5,372 +5,480 @@ defined( 'ABSPATH' ) || exit;
5
  *
6
  * @var array $placement_types placement types.
7
  */
8
- ?><div class="wrap">
9
- <?php
10
- if ( isset( $_GET['message'] ) ) :
11
- if ( 'error' === $_GET['message'] ) :
12
- ?>
13
- <div id="message" class="error"><p><?php esc_html_e( 'Couldn’t create the new placement. Please check your form field and whether the name is already in use.', 'advanced-ads' ); ?></p></div>
14
- <?php
15
- elseif ( 'updated' === $_GET['message'] ) :
16
- ?>
17
- <div id="message" class="updated"><p><?php esc_html_e( 'Placements updated', 'advanced-ads' ); ?></p></div>
18
- <?php
19
- endif;
20
- ?>
21
- <?php endif; ?>
 
 
22
  <h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1>
23
  <a href="#" class="page-title-action" title="<?php esc_html_e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');">
24
- <?php esc_html_e( 'New Placement', 'advanced-ads' ); ?>
25
  </a>
26
 
27
  <hr class="wp-header-end">
28
 
29
  <p class="description"><?php esc_html_e( 'Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates.', 'advanced-ads' ); ?></p>
30
  <p class="description">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  <?php
32
- printf(
33
- wp_kses(
34
- // translators: %s is a URL.
35
- __( 'See also the manual for more information on <a href="%s">placements</a>.', 'advanced-ads' ),
36
- array(
37
- 'a' => array(
38
- 'href' => array(),
39
- ),
40
- )
41
- ),
42
- esc_url( ADVADS_URL ) . 'manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements'
43
- );
44
- ?>
45
- </p>
46
- <?php
47
 
48
- // add placement form.
49
- require_once ADVADS_BASE_PATH . 'admin/views/placement-form.php';
50
 
51
- if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
52
- do_action( 'advanced-ads-placements-list-before', $placements );
53
- ?>
 
54
  <h2><?php esc_html_e( 'Placements', 'advanced-ads' ); ?></h2>
55
  <form method="POST" action="" id="advanced-ads-placements-form">
56
 
57
- <?php
58
- $columns = array(
59
- array(
60
- 'key' => 'type',
61
- 'display_name' => esc_html__( 'Type', 'advanced-ads' ),
62
- 'sortable' => true,
63
- ),
64
- array(
65
- 'key' => 'name',
66
- 'display_name' => esc_html__( 'Name', 'advanced-ads' ),
67
- 'sortable' => true,
68
- ),
69
- array(
70
- 'key' => 'options',
71
- 'display_name' => esc_html__( 'Options', 'advanced-ads' ),
72
- ),
73
- );
74
- ?>
75
- <table class="widefat advads-placements-table striped">
76
- <thead>
77
- <tr>
78
- <?php
79
- foreach ( $columns as $column ) {
80
- $class = '';
81
- $column_display_name = $column['display_name'];
82
-
83
- if ( ! empty( $column['sortable'] ) ) {
84
- $column_display_name = $column_display_name
85
- . '<span class="advads-placement-sorting-indicator"></span>';
86
-
87
- if ( $orderby === $column['key'] ) {
88
- $class = 'class="advads-placement-sorted"';
89
- } else {
90
- $class = 'class="advads-placement-sortable"';
91
-
92
- $column_display_name = '<a href="' . esc_url( add_query_arg( array( 'orderby' => $column['key'] ) ) ) . '">'
93
- . $column_display_name
94
- . '</a>';
95
- }
96
- }
97
-
98
- echo "<th $class>$column_display_name</th>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
99
- }
100
 
101
- do_action( 'advanced-ads-placements-list-column-header' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
102
- ?>
103
- <th></th>
104
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  </thead>
106
  <tbody>
107
- <?php
108
- // Sort placements.
109
- $placements = Advanced_Ads_Placements::sort( $placements, $orderby );
110
-
111
- foreach ( $placements as $_placement_slug => $_placement ) :
112
- $type_missing = false;
113
- if ( isset( $_placement['type'] ) && ! isset( $placement_types[ $_placement['type'] ] ) ) {
114
- $missed_type = $_placement['type'];
115
- $_placement['type'] = 'default';
116
- $type_missing = true;
117
- }
118
- ?>
119
- <tr id="single-placement-<?php echo esc_attr( $_placement_slug ); ?>" class="advanced-ads-placement-row">
120
- <td>
121
- <?php
122
- if ( $type_missing ) : // type is not given.
123
- ?>
124
- <p class="advads-error-message">
125
- <?php
126
- printf(
127
- wp_kses(
128
- // translators: %s is the name of a placement.
129
- __( 'Placement type "%s" is missing and was reset to "default".<br/>Please check if the responsible add-on is activated.', 'advanced-ads' ),
130
- array(
131
- 'br' => array(),
132
- )
133
- ),
134
- esc_html( $missed_type )
135
- );
136
- ?>
137
- </p>
138
- <?php
139
- elseif ( isset( $_placement['type'] ) ) :
140
- if ( isset( $placement_types[ $_placement['type'] ]['image'] ) ) :
141
- ?>
142
- <img src="<?php echo esc_url( $placement_types[ $_placement['type'] ]['image'] ); ?>"
143
- title="<?php echo esc_attr( $placement_types[ $_placement['type'] ]['title'] ); ?>"
144
- alt="<?php echo esc_attr( $placement_types[ $_placement['type'] ]['title'] ); ?>"/>
145
- <?php
146
- else :
147
- echo esc_html( $placement_types[ $_placement['type'] ]['title'] );
148
- endif;
149
- else :
150
- __( 'default', 'advanced-ads' );
151
- endif;
152
- ?>
153
- </td>
154
- <td><?php echo esc_html( $_placement['name'] ); ?><br/>
155
  <?php
156
- if ( ! isset( $_placement['type'] ) || 'default' === $_placement['type'] ) :
157
- $_placement['type'] = 'default';
158
- ?>
159
- <a class="usage-link"><?php esc_html_e( 'show usage', 'advanced-ads' ); ?></a>
160
- <?php
161
- endif;
162
- ?>
163
- </td>
164
- <td class="advads-placements-table-options">
165
- <input type="hidden" class="advads-placement-slug" value="<?php echo esc_attr( $_placement_slug ); ?>"/>
166
- <?php if ( ! isset( $_placement['type'] ) || 'default' === $_placement['type'] ) : ?>
167
- <div class="hidden advads-usage">
168
- <label><?php esc_html_e( 'shortcode', 'advanced-ads' ); ?>
169
- <code><input type="text" onclick="this.select();" value='[the_ad_placement id="<?php echo esc_attr( $_placement_slug ); ?>"]'/></code>
170
- </label>
171
- <label><?php esc_html_e( 'template (PHP)', 'advanced-ads' ); ?>
172
- <code><input type="text" onclick="this.select();" value="if( function_exists('the_ad_placement') ) { the_ad_placement('<?php echo esc_attr( $_placement_slug ); ?>'); }"/></code>
173
- </label>
174
- </div>
175
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
- <?php do_action( 'advanced-ads-placement-options-before', $_placement_slug, $_placement ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
- <?php
180
- ob_start();
181
-
182
- // get the currently selected item
183
- $placement_item_array = explode( '_', $_placement['item'] );
184
- $placement_item_type = is_array( $placement_item_array ) && isset( $placement_item_array[0] ) ? $placement_item_array[0] : null;
185
- $placement_item_id = is_array( $placement_item_array ) && isset( $placement_item_array[1] ) ? $placement_item_array[1] : null;
186
-
187
- include ADVADS_BASE_PATH . 'admin/views/placements-item.php';
188
- $item_option_content = ob_get_clean();
189
-
190
- Advanced_Ads_Admin_Options::render_option(
191
- 'placement-item',
192
- __( 'Item', 'advanced-ads' ),
193
- $item_option_content
194
- );
195
- ?>
196
  <?php
197
- switch ( $_placement['type'] ) :
198
- case 'post_content':
199
- $option_index = isset( $_placement['options']['index'] ) ? absint( max( 1, (int) $_placement['options']['index'] ) ) : 1;
200
- $option_tag = isset( $_placement['options']['tag'] ) ? $_placement['options']['tag'] : 'p';
201
-
202
- // Automatically select the 'custom' option.
203
- if ( ! empty( $_COOKIE['advads_frontend_picker'] ) ) {
204
- $option_tag = ( $_COOKIE['advads_frontend_picker'] === $_placement_slug ) ? 'custom' : $option_tag;
205
- }
206
-
207
- $option_xpath = isset( $_placement['options']['xpath'] ) ? stripslashes( $_placement['options']['xpath'] ) : '';
208
- $positions = array(
209
- 'after' => __( 'after', 'advanced-ads' ),
210
- 'before' => __( 'before', 'advanced-ads' ),
211
- );
212
- ob_start();
213
- include ADVADS_BASE_PATH . 'admin/views/placements-content-index.php';
214
- if ( ! defined( 'AAP_VERSION' ) ) {
215
- include ADVADS_BASE_PATH . 'admin/views/upgrades/repeat-the-position.php';
216
- }
217
-
218
- do_action( 'advanced-ads-placement-post-content-position', $_placement_slug, $_placement );
219
- $option_content = ob_get_clean();
220
-
221
- Advanced_Ads_Admin_Options::render_option(
222
- 'placement-content-injection-index',
223
- __( 'position', 'advanced-ads' ),
224
- $option_content
225
- );
226
-
227
- if ( ! extension_loaded( 'dom' ) ) :
228
- ?>
229
- <p><span class="advads-error-message"><?php esc_html_e( 'Important Notice', 'advanced-ads' ); ?>: </span>
230
- <?php
231
- printf(
232
- // translators: %s is a name of a module.
233
- esc_html__( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ),
234
- 'dom (php_xml)'
235
- );
236
- ?>
237
- </p>
238
- <?php
239
- endif;
240
- break;
241
- endswitch;
242
- do_action( 'advanced-ads-placement-options-after', $_placement_slug, $_placement );
243
- ob_start();
244
-
245
- if ( 'header' !== $_placement['type'] ) :
246
- $type_options = isset( $placement_types[ $_placement['type'] ]['options'] ) ? $placement_types[ $_placement['type'] ]['options'] : array();
247
-
248
- if ( ! isset( $type_options['placement-ad-label'] ) || $type_options['placement-ad-label'] ) {
249
- $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default';
250
- $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default';
251
- $_clearfix = ! empty( $_placement['options']['placement_clearfix'] );
252
-
253
- ob_start();
254
- include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php';
255
- if ( ! empty( $placement_types[ $_placement['type'] ]['options']['show_position'] ) ) :
256
- include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php';
257
- endif;
258
- $option_content = ob_get_clean();
259
-
260
- Advanced_Ads_Admin_Options::render_option(
261
- 'placement-ad-label',
262
- __( 'ad label', 'advanced-ads' ),
263
- $option_content
264
- );
265
- }
266
-
267
-
268
- // show Pro features if Pro is not actiavated.
269
- if ( ! defined( 'AAP_VERSION' ) ) {
270
- // Display Conditions for placements.
271
- Advanced_Ads_Admin_Options::render_option(
272
- 'placement-display-conditions',
273
- __( 'Display Conditions', 'advanced-ads' ),
274
- 'is_pro_pitch',
275
- __( 'Use display conditions for placements.', 'advanced-ads' ) .
276
- ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
277
- );
278
-
279
- // Visitor Condition for placements.
280
- Advanced_Ads_Admin_Options::render_option(
281
- 'placement-visitor-conditions',
282
- __( 'Visitor Conditions', 'advanced-ads' ),
283
- 'is_pro_pitch',
284
- __( 'Use visitor conditions for placements.', 'advanced-ads' ) .
285
- ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
286
- );
287
-
288
- // Minimum Content Length.
289
- Advanced_Ads_Admin_Options::render_option(
290
- 'placement-content-minimum-length',
291
- __( 'Minimum Content Length', 'advanced-ads' ),
292
- 'is_pro_pitch',
293
- __( 'Minimum length of content before automatically injected ads are allowed in them.', 'advanced-ads' )
294
- );
295
-
296
- // Words Between Ads.
297
- Advanced_Ads_Admin_Options::render_option(
298
- 'placement-skip-paragraph',
299
- __( 'Words Between Ads', 'advanced-ads' ),
300
- 'is_pro_pitch',
301
- __( 'A minimum amount of words between automatically injected ads.', 'advanced-ads' )
302
- );
303
- }
304
-
305
- endif;
306
 
307
- do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement );
308
- $advanced_options = ob_get_clean();
309
- if ( $advanced_options ) :
310
- ?>
311
- <a class="advads-toggle-link advads-placement-options-link" data-placement="<?php echo esc_attr( $_placement_slug ); ?>"><?php esc_html_e( 'show all options', 'advanced-ads' ); ?></a>
312
- <?php
313
- // phpcs:ignore
314
- $hidden = ( isset( $_POST['advads-last-edited-placement'] ) && $_placement_slug === $_POST['advads-last-edited-placement'] ) ? '' : ' hidden';
315
- // phpcs:ignore ?>
316
- <div class="advads-placements-advanced-options advads-placements-advanced-options-<?php echo esc_attr( $_placement_slug ); echo esc_attr( $hidden ); ?>">
317
- <?php
318
- // phpcs:ignore
319
- echo $advanced_options;
320
- ?>
321
- </div>
322
- <?php
323
- endif;
324
- // information after options.
325
- if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) :
326
- ?>
327
- <br/><p>
328
  <?php
329
  printf(
330
  wp_kses(
331
- // translators: %s is a URL.
332
- __( 'Tutorial: <a href="%s" target="_blank">How to place visible ads in the header of your website</a>.', 'advanced-ads' ),
333
  array(
334
- 'a' => array(
335
- 'href' => array(),
336
- 'target' => array(),
337
- ),
338
  )
339
  ),
340
- esc_url( ADVADS_URL ) . 'place-ads-in-website-header/#utm_source=advanced-ads&utm_medium=link&utm_campaign=header-ad-tutorial'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  );
342
  ?>
343
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  <?php
345
- endif;
 
 
346
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  ?>
348
- </td>
349
- <?php do_action( 'advanced-ads-placements-list-column', $_placement_slug, $_placement ); ?>
350
- <td>
351
- <input type="checkbox" id="advads-placements-item-delete-<?php echo esc_attr( $_placement_slug ); ?>" name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][delete]" value="1"/>
352
- <label for="advads-placements-item-delete-<?php echo esc_attr( $_placement_slug ); ?>"><?php echo esc_html_x( 'delete', 'checkbox to remove placement', 'advanced-ads' ); ?></label>
353
- </td>
354
- </tr>
355
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  </tbody>
357
  </table>
358
  <div class="tablenav bottom">
359
- <input type="submit" id="advads-save-placements-button" class="button button-primary" value="<?php esc_html_e( 'Save Placements', 'advanced-ads' ); ?>"/>
360
- <?php wp_nonce_field( 'advads-placement', 'advads_placement', true ); ?>
361
- <button type="button" title="<?php esc_html_e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');">
362
- <?php
363
- esc_html_e( 'New Placement', 'advanced-ads' );
364
- ?>
365
- </button>
366
- <?php do_action( 'advanced-ads-placements-list-buttons', $placements ); ?>
367
- </div>
368
- <input type="hidden" name="advads-last-edited-placement" id="advads-last-edited-placement" value="0"/>
369
  </form>
370
- <?php
371
- include ADVADS_BASE_PATH . 'admin/views/frontend-picker-script.php';
372
- do_action( 'advanced-ads-placements-list-after', $placements );
373
- endif;
374
 
375
- ?>
376
  </div>
5
  *
6
  * @var array $placement_types placement types.
7
  */
8
+
9
+ $quick_actions = array();
10
+ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag">' . __( 'Delete', 'advanced-ads' ) . '</a>';
11
+
12
+ ?>
13
+ <div class="wrap">
14
+
15
+ <?php
16
+ if ( isset( $_GET['message'] ) ) :
17
+ if ( $_GET['message'] === 'error' ) :
18
+ ?>
19
+ <div id="message" class="error"><p><?php esc_html_e( 'Couldn’t create the new placement. Please check your form field and whether the name is already in use.', 'advanced-ads' ); ?></p></div>
20
+ <?php elseif ( $_GET['message'] === 'updated' ) : ?>
21
+ <div id="message" class="updated"><p><?php esc_html_e( 'Placements updated', 'advanced-ads' ); ?></p></div>
22
+ <?php endif; ?>
23
+ <?php endif; ?>
24
  <h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1>
25
  <a href="#" class="page-title-action" title="<?php esc_html_e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');">
26
+ <?php esc_html_e( 'New Placement', 'advanced-ads' ); ?>
27
  </a>
28
 
29
  <hr class="wp-header-end">
30
 
31
  <p class="description"><?php esc_html_e( 'Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates.', 'advanced-ads' ); ?></p>
32
  <p class="description">
33
+ <?php
34
+ printf(
35
+ wp_kses(
36
+ // Translators: %s is a URL.
37
+ __( 'See also the manual for more information on <a href="%s">placements</a>.', 'advanced-ads' ),
38
+ array(
39
+ 'a' => array(
40
+ 'href' => array(),
41
+ ),
42
+ )
43
+ ),
44
+ esc_url( ADVADS_URL ) . 'manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements'
45
+ );
46
+ ?>
47
+ </p>
48
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ // Add placement form.
51
+ require_once ADVADS_BASE_PATH . 'admin/views/placement-form.php';
52
 
53
+ if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
54
+ $existing_types = array_unique( array_column( $placements, 'type' ) );
55
+ do_action( 'advanced-ads-placements-list-before', $placements );
56
+ ?>
57
  <h2><?php esc_html_e( 'Placements', 'advanced-ads' ); ?></h2>
58
  <form method="POST" action="" id="advanced-ads-placements-form">
59
 
60
+ <?php
61
+ $columns = array(
62
+ array(
63
+ 'key' => 'type_name',
64
+ 'display_name' => esc_html__( 'Type', 'advanced-ads' ) . ' / ' . esc_html__( 'Name', 'advanced-ads' ),
65
+ 'custom_sort' => true,
66
+ ),
67
+ array(
68
+ 'key' => 'options',
69
+ 'display_name' => esc_html__( 'Output', 'advanced-ads' ),
70
+ ),
71
+ array(
72
+ 'key' => 'conditons',
73
+ 'display_name' => esc_html__( 'Delivery', 'advanced-ads' ),
74
+ ),
75
+ );
76
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
+ <?php if ( isset( $placement_types ) && ! empty( $placement_types ) ) : ?>
79
+ <div class="tablenav top">
80
+ <select class="advads_filter_placement_type">
81
+ <option value="0"><?php esc_html_e( '- show all types -', 'advanced_ads' ); ?></option>
82
+ <?php foreach ( $placement_types as $type_name => $placement_type ) : ?>
83
+ <?php if ( in_array( $type_name, $existing_types, true ) ) : ?>
84
+ <option value="<?php echo esc_attr( $type_name ); ?>"><?php echo esc_html( $placement_type['title'] ); ?></option>
85
+ <?php endif; ?>
86
+ <?php endforeach; ?>
87
+ </select>
88
+ <input type="text" class="advads_search_placement_name" placeholder="<?php esc_html_e( 'filter by name', 'advanced_ads' ); ?>"/>
89
+ </div>
90
+ <?php endif; ?>
91
+
92
+ <table class="wp-list-table advads-placements-table widefat striped posts">
93
+ <thead>
94
+ <tr>
95
+ <?php
96
+ foreach ( $columns as $column ) {
97
+ $class = '';
98
+ $column_display_name = $column['display_name'];
99
+
100
+ if ( $column['key'] === 'type_name' ) :
101
+ list ( $order_type, $name ) = explode( '/', $column_display_name );
102
+
103
+ printf( '<th class="column-primary"><a href="#" class="advads-sort ' . ( $orderby === 'type' ? 'advads-placement-sorted' : '' ) . '"
104
+ data-order="type" data-dir="asc">%1$s %2$s</a> / <a href="#" class="advads-sort ' . ( $orderby === 'name' ? 'advads-placement-sorted' : '' ) . '"
105
+ data-order="name" data-dir="asc" style="margin-left:9px;">%3$s %2$s<a/></th>', esc_html( $order_type ), '<span class="advads-placement-sorting-indicator"></span>', esc_html( $name ) );
106
+ else :
107
+ echo '<th>' . esc_html( $column_display_name ) . '</th>';
108
+ endif;
109
+
110
+ if ( false && ! empty( $column['custom_sort'] ) ) :
111
+ $column_display_name = '<a href="#" class="advads-sort"
112
+ data-order="name" data-dir="asc">
113
+ ' . $column_display_name . '
114
+ <span class="advads-placement-sorting-indicator"></span></a>';
115
+ endif;
116
+ }
117
+
118
+ do_action( 'advanced-ads-placements-list-column-header' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
119
+ ?>
120
+ </tr>
121
  </thead>
122
  <tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  <?php
124
+ // Sort placements.
125
+ $placements = Advanced_Ads_Placements::sort( $placements, $orderby );
126
+ $display_conditions = Advanced_Ads_Display_Conditions::get_instance();
127
+ $visitor_conditions = Advanced_Ads_Visitor_Conditions::get_instance();
128
+
129
+ foreach ( $placements as $_placement_slug => $_placement ) :
130
+ $type_missing = false;
131
+ if ( isset( $_placement['type'] ) && ! isset( $placement_types[ $_placement['type'] ] ) ) {
132
+ $missed_type = $_placement['type'];
133
+ $_placement['type'] = 'default';
134
+ $type_missing = true;
135
+ }
136
+ if ( ! isset( $_placement['type'] ) || $_placement['type'] === 'default' ) {
137
+ $_placement['type'] = 'default';
138
+ $quick_actions['usage'] = '<a href="#modal-' . esc_attr( $_placement_slug ) . '-usage" class="usage-modal-link">' . esc_html__( 'show usage', 'advanced-ads' ) . '</a>';
139
+ }
140
+
141
+ ob_start();
142
+
143
+ do_action( 'advanced-ads-placement-options-before-advanced', $_placement_slug, $_placement );
144
+
145
+ if ( $_placement['type'] !== 'header' ) :
146
+ $type_options = isset( $placement_types[ $_placement['type'] ]['options'] ) ? $placement_types[ $_placement['type'] ]['options'] : array();
147
+
148
+ if ( ! isset( $type_options['placement-ad-label'] ) || $type_options['placement-ad-label'] ) {
149
+ $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default';
150
+ $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default';
151
+ $_clearfix = ! empty( $_placement['options']['placement_clearfix'] );
152
+
153
+ ob_start();
154
+ include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php';
155
+ if ( ! empty( $placement_types[ $_placement['type'] ]['options']['show_position'] ) ) :
156
+ include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php';
157
+ endif;
158
+ $option_content = ob_get_clean();
159
+
160
+ Advanced_Ads_Admin_Options::render_option(
161
+ 'placement-ad-label',
162
+ __( 'ad label', 'advanced-ads' ),
163
+ $option_content
164
+ );
165
+ }
166
 
167
+ // Renders inline css option.
168
+ ob_start();
169
+ include ADVADS_BASE_PATH . 'admin/views/placements-inline-css.php';
170
+ $option_content = ob_get_clean();
171
+
172
+ Advanced_Ads_Admin_Options::render_option(
173
+ 'placement-inline-css',
174
+ __( 'Inline CSS', 'advanced-ads' ),
175
+ $option_content
176
+ );
177
+
178
+ // Show Pro features if Pro is not actiavated.
179
+ if ( ! defined( 'AAP_VERSION' ) ) {
180
+ // Display Conditions for placements.
181
+ Advanced_Ads_Admin_Options::render_option(
182
+ 'placement-display-conditions',
183
+ __( 'Display Conditions', 'advanced-ads' ),
184
+ 'is_pro_pitch',
185
+ __( 'Use display conditions for placements.', 'advanced-ads' ) .
186
+ ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
187
+ );
188
+
189
+ // Visitor Condition for placements.
190
+ Advanced_Ads_Admin_Options::render_option(
191
+ 'placement-visitor-conditions',
192
+ __( 'Visitor Conditions', 'advanced-ads' ),
193
+ 'is_pro_pitch',
194
+ __( 'Use visitor conditions for placements.', 'advanced-ads' ) .
195
+ ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
196
+ );
197
+
198
+ // Minimum Content Length.
199
+ Advanced_Ads_Admin_Options::render_option(
200
+ 'placement-content-minimum-length',
201
+ __( 'Minimum Content Length', 'advanced-ads' ),
202
+ 'is_pro_pitch',
203
+ __( 'Minimum length of content before automatically injected ads are allowed in them.', 'advanced-ads' )
204
+ );
205
+
206
+ // Words Between Ads.
207
+ Advanced_Ads_Admin_Options::render_option(
208
+ 'placement-skip-paragraph',
209
+ __( 'Words Between Ads', 'advanced-ads' ),
210
+ 'is_pro_pitch',
211
+ __( 'A minimum amount of words between automatically injected ads.', 'advanced-ads' )
212
+ );
213
+ }
214
+ endif;
215
+ do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement );
216
+ $advanced_options = ob_get_clean();
217
+ ?>
218
 
219
+ <tr id="single-placement-<?php echo esc_attr( $_placement_slug ); ?>"
220
+ class="advanced-ads-placement-row"
221
+ data-type="<?php echo esc_attr( $_placement['type'] ); ?>"
222
+ data-typename="<?php echo esc_html( $placement_types[ $_placement['type'] ]['title'] ); ?>"
223
+ data-name="<?php echo esc_html( $_placement['name'] ); ?>">
224
+ <td class="column-primary">
225
+ <?php if ( $advanced_options ) : ?>
 
 
 
 
 
 
 
 
 
 
226
  <?php
227
+ $modal_slug = esc_attr( $_placement_slug );
228
+ $modal_content = $advanced_options;
229
+ $modal_title = esc_html__( 'Options', 'advanced-ads' );
230
+ $close_action = esc_html__( 'Close and save', 'advanced-ads' );
231
+ include ADVADS_BASE_PATH . 'admin/views/modal.php';
232
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
+ <?php endif; ?>
235
+ <?php if ( $type_missing ) : // Type is not given. ?>
236
+ <p class="advads-error-message">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  <?php
238
  printf(
239
  wp_kses(
240
+ // Translators: %s is the name of a placement.
241
+ __( 'Placement type "%s" is missing and was reset to "default".<br/>Please check if the responsible add-on is activated.', 'advanced-ads' ),
242
  array(
243
+ 'br' => array(),
 
 
 
244
  )
245
  ),
246
+ esc_html( $missed_type )
247
+ );
248
+ ?>
249
+ </p>
250
+ <?php elseif ( isset( $_placement['type'] ) ) : ?>
251
+ <div class="advads-placement-type">
252
+ <?php if ( isset( $placement_types[ $_placement['type'] ]['image'] ) ) : ?>
253
+ <img src="<?php echo esc_url( $placement_types[ $_placement['type'] ]['image'] ); ?>"
254
+ alt="<?php echo esc_attr( $placement_types[ $_placement['type'] ]['title'] ); ?>"/>
255
+ <p class="advads-placement-description">
256
+ <strong><?php echo esc_html__( 'Type', 'advanced-ads' ) . ': ' . esc_html( $placement_types[ $_placement['type'] ]['title'] ); ?></strong>
257
+ </p>
258
+ <div class="advads-placement-name">
259
+ <a href="#modal-<?php echo esc_attr( $_placement_slug ); ?>" style="cursor: pointer;"
260
+ class="row-title"
261
+ data-placement="<?php echo esc_attr( $_placement_slug ); ?>"><?php echo esc_html( $_placement['name'] ); ?></a><br/>
262
+ </div>
263
+ <?php else : ?>
264
+ <?php echo esc_html( $placement_types[ $_placement['type'] ]['title'] ); ?>
265
+ <?php endif; ?>
266
+ </div>
267
+ <?php else : ?>
268
+ <?php __( 'default', 'advanced-ads' ); ?>
269
+ <?php endif; ?>
270
+ <div class="row-actions">
271
+ <span class="edit">
272
+ <a href="#modal-<?php echo esc_attr( $_placement_slug ); ?>" style="cursor: pointer;"
273
+ class=""
274
+ data-placement="<?php echo esc_attr( $_placement_slug ); ?>"><?php esc_html_e( 'Edit', 'advanced-ads' ); ?></a> |
275
+ </span>
276
+ <?php $last_key = array_search( end( $quick_actions ), $quick_actions, true ); ?>
277
+ <?php foreach ( $quick_actions as $quick_action => $action_link ) : ?>
278
+ <span class='<?php echo esc_attr( $quick_action ); ?> '>
279
+ <?php
280
+ echo wp_kses(
281
+ $action_link,
282
+ array(
283
+ 'a' => array(
284
+ 'class' => array(),
285
+ 'href' => array(),
286
+ 'style' => 'cursor: pointer',
287
+ ),
288
+ )
289
  );
290
  ?>
291
+ </span>
292
+ <?php if ( $quick_action !== $last_key ) : ?>
293
+ <span class="separator"> | </span>
294
+ <?php endif; ?>
295
+ <?php endforeach; ?>
296
+ </div>
297
+ <button type="button" class="toggle-row"><span class="screen-reader-text">Mehr Details anzeigen</span></button>
298
+ <input type="hidden" class="advads-placement-slug" value="<?php echo esc_attr( $_placement_slug ); ?>"/>
299
+ <?php if ( ! isset( $_placement['type'] ) || $_placement['type'] === 'default' ) : ?>
300
+ <div id="modal-<?php echo esc_attr( $_placement_slug ); ?>-usage" class="advads-modal">
301
+ <a href="#close" class="advads-modal-close-background">Close</a>
302
+ <div class="advads-modal-content">
303
+ <div class="advads-modal-header">
304
+ <a href="#close" class="advads-modal-close">&times;</a>
305
+ <h2><?php esc_html_e( 'Usage', 'advanced-ads' ); ?></h2>
306
+ </div>
307
+ <div class="advads-modal-body">
308
+ <div class="advads-usage">
309
+ <h2><?php esc_html_e( 'shortcode', 'advanced-ads' ); ?></h2>
310
+ <code><input type="text" onclick="this.select();"
311
+ value='[the_ad_placement id="<?php echo esc_attr( $_placement_slug ); ?>"]'/></code>
312
+ <h2><?php esc_html_e( 'template (PHP)', 'advanced-ads' ); ?></h2>
313
+ <code><input type="text" onclick="this.select();"
314
+ value="if( function_exists('the_ad_placement') ) { the_ad_placement('<?php echo esc_attr( $_placement_slug ); ?>'); }"/></code>
315
+ </div>
316
+ </div>
317
+ <div class="advads-modal-footer">
318
+ <div class="tablenav bottom">
319
+ <a href="#close" type="button" title="<?php esc_html_e( 'Close', 'advanced-ads' ); ?>"
320
+ class="button button-secondary advads-modal-close"><?php esc_html_e( 'Close', 'advanced-ads' ); ?></a>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </div>
325
+ <?php endif; ?>
326
+ </td>
327
+ <td class="advads-placements-table-options">
328
+ <?php do_action( 'advanced-ads-placement-options-before', $_placement_slug, $_placement ); ?>
329
+
330
+ <?php
331
+ ob_start();
332
+
333
+ // Get the currently selected item.
334
+ $placement_item_array = explode( '_', $_placement['item'] );
335
+ $placement_item_type = is_array( $placement_item_array ) && isset( $placement_item_array[0] ) ? $placement_item_array[0] : null;
336
+ $placement_item_id = is_array( $placement_item_array ) && isset( $placement_item_array[1] ) ? $placement_item_array[1] : null;
337
+
338
+ include ADVADS_BASE_PATH . 'admin/views/placements-item.php';
339
+ $item_option_content = ob_get_clean();
340
+
341
+ Advanced_Ads_Admin_Options::render_option(
342
+ 'placement-item',
343
+ __( 'Item', 'advanced-ads' ),
344
+ $item_option_content
345
+ );
346
+ switch ( $_placement['type'] ) :
347
+ case 'post_content':
348
+ $option_index = isset( $_placement['options']['index'] ) ? absint( max( 1, (int) $_placement['options']['index'] ) ) : 1;
349
+ $option_tag = isset( $_placement['options']['tag'] ) ? $_placement['options']['tag'] : 'p';
350
+
351
+ // Automatically select the 'custom' option.
352
+ if ( ! empty( $_COOKIE['advads_frontend_picker'] ) ) {
353
+ $option_tag = ( $_COOKIE['advads_frontend_picker'] === $_placement_slug ) ? 'custom' : $option_tag;
354
+ }
355
+
356
+ $option_xpath = isset( $_placement['options']['xpath'] ) ? stripslashes( $_placement['options']['xpath'] ) : '';
357
+ $positions = array(
358
+ 'after' => __( 'after', 'advanced-ads' ),
359
+ 'before' => __( 'before', 'advanced-ads' ),
360
+ );
361
+ ob_start();
362
+ include ADVADS_BASE_PATH . 'admin/views/placements-content-index.php';
363
+ if ( ! defined( 'AAP_VERSION' ) ) {
364
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/repeat-the-position.php';
365
+ }
366
+
367
+ do_action( 'advanced-ads-placement-post-content-position', $_placement_slug, $_placement );
368
+ $option_content = ob_get_clean();
369
+
370
+ Advanced_Ads_Admin_Options::render_option(
371
+ 'placement-content-injection-index',
372
+ __( 'position', 'advanced-ads' ),
373
+ $option_content
374
+ );
375
+
376
+ if ( ! extension_loaded( 'dom' ) ) :
377
+ ?>
378
+ <p><span class="advads-error-message"><?php esc_html_e( 'Important Notice', 'advanced-ads' ); ?>: </span>
379
+ <?php
380
+ printf(
381
+ // Translators: %s is a name of a module.
382
+ esc_html__( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ),
383
+ 'dom (php_xml)'
384
+ );
385
+ ?>
386
+ </p>
387
+ <?php endif; ?>
388
  <?php
389
+ break;
390
+ endswitch;
391
+ do_action( 'advanced-ads-placement-options-after', $_placement_slug, $_placement );
392
 
393
+ // Information after options.
394
+ if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) :
395
+ ?>
396
+ <br/><p>
397
+ <?php
398
+ printf(
399
+ wp_kses(
400
+ // Translators: %s is a URL.
401
+ __( 'Tutorial: <a href="%s" target="_blank">How to place visible ads in the header of your website</a>.', 'advanced-ads' ),
402
+ array(
403
+ 'a' => array(
404
+ 'href' => array(),
405
+ 'target' => array(),
406
+ ),
407
+ )
408
+ ),
409
+ esc_url( ADVADS_URL ) . 'place-ads-in-website-header/#utm_source=advanced-ads&utm_medium=link&utm_campaign=header-ad-tutorial'
410
+ );
411
  ?>
412
+ </p>
413
+ <?php endif; ?>
414
+ <div class="advads-placements-show-options">
415
+ <a href="#modal-<?php echo esc_attr( $_placement_slug ); ?>" style="cursor: pointer;"
416
+ data-placement="<?php echo esc_attr( $_placement_slug ); ?>"><?php esc_html_e( 'show all options', 'advanced-ads' ); ?></a>
417
+ </div>
418
+ </td>
419
+ <td class="advads-placement-conditions">
420
+ <?php if ( ! empty( $_placement['options']['placement_conditions']['display'] ) ) : ?>
421
+ <h4><?php echo esc_html__( 'Display Conditions', 'advanced-ads' ); ?></h4>
422
+ <ul>
423
+ <?php foreach ( $_placement['options']['placement_conditions']['display'] as $condition ) : ?>
424
+ <li><?php echo esc_html( $display_conditions->conditions[ $condition['type'] ]['label'] ); ?></li>
425
+ <?php endforeach; ?>
426
+ </ul>
427
+ <?php endif; ?>
428
+ <?php if ( ! empty( $_placement['options']['placement_conditions']['visitors'] ) ) : ?>
429
+ <h4><?php echo esc_html__( 'Visitor Conditions', 'advanced-ads' ); ?></h4>
430
+ <ul>
431
+ <?php foreach ( $_placement['options']['placement_conditions']['visitors'] as $condition ) : ?>
432
+ <li><?php echo esc_html( $visitor_conditions->conditions[ $condition['type'] ]['label'] ); ?></li>
433
+ <?php endforeach; ?>
434
+ </ul>
435
+ <?php endif; ?>
436
+ <?php if ( $advanced_options ) : ?>
437
+ <a href="#modal-<?php echo esc_attr( $_placement_slug ); ?>" style="cursor: pointer;"
438
+ data-placement="<?php echo esc_attr( $_placement_slug ); ?>" class="advads-mobile-hidden"><?php esc_html_e( 'edit conditions', 'advanced-ads' ); ?></a>
439
+ <?php
440
+ // phpcs:ignore
441
+ $hidden = ( isset( $_POST['advads-last-edited-placement'] ) && $_placement_slug === $_POST['advads-last-edited-placement'] ) ? '' : ' hidden';
442
+ // phpcs:ignore
443
+ ?>
444
+ <div class="advads-placements-advanced-options advads-placements-advanced-options-
445
+ <?php
446
+ echo esc_attr( $_placement_slug );
447
+ echo esc_attr( $hidden );
448
+ ?>
449
+ ">
450
+ </div>
451
+ <?php endif; ?>
452
+ </td>
453
+ <?php do_action( 'advanced-ads-placements-list-column', $_placement_slug, $_placement ); ?>
454
+ <td class="hidden">
455
+ <input type="checkbox"
456
+ id="advads-placements-item-delete-<?php echo esc_attr( $_placement_slug ); ?>"
457
+ class="advads-placements-item-delete"
458
+ name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][delete]"
459
+ value="1"/>
460
+ <label for="advads-placements-item-delete-<?php echo esc_attr( $_placement_slug ); ?>"><?php echo esc_html_x( 'delete', 'checkbox to remove placement', 'advanced-ads' ); ?></label>
461
+ </td>
462
+ </tr>
463
+ <?php endforeach; ?>
464
  </tbody>
465
  </table>
466
  <div class="tablenav bottom">
467
+ <input type="submit" id="advads-save-placements-button" class="button button-primary" value="<?php esc_html_e( 'Save Placements', 'advanced-ads' ); ?>"/>
468
+ <?php wp_nonce_field( 'advads-placement', 'advads_placement', true ); ?>
469
+ <button type="button" title="<?php esc_html_e( 'Create a new placement', 'advanced-ads' ); ?>" class="button button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');">
470
+ <?php
471
+ esc_html_e( 'New Placement', 'advanced-ads' );
472
+ ?>
473
+ </button>
474
+ <?php do_action( 'advanced-ads-placements-list-buttons', $placements ); ?>
475
+ </div>
476
+ <input type="hidden" name="advads-last-edited-placement" id="advads-last-edited-placement" value="0"/>
477
  </form>
478
+ <?php
479
+ include ADVADS_BASE_PATH . 'admin/views/frontend-picker-script.php';
480
+ do_action( 'advanced-ads-placements-list-after', $placements );
481
+ endif;
482
 
483
+ ?>
484
  </div>
admin/views/settings/license/section.php CHANGED
@@ -1,17 +1,8 @@
1
- <p><?php printf(
2
- wp_kses(
3
- // translators: %s is a URL.
4
- __( 'Enter license keys for our powerful <a href="%s" target="_blank">add-ons</a>.', 'advanced-ads' ),
5
- array(
6
- 'a' => array(
7
- 'href' => array(),
8
- 'target' => array(),
9
- ),
10
- )
11
- ),
12
- esc_url( ADVADS_URL . 'add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' )
13
- );
14
- ?> <?php
15
  printf(
16
  wp_kses(
17
  // translators: %s is a URL.
@@ -26,5 +17,5 @@ printf(
26
  esc_url( ADVADS_URL . 'manual/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' )
27
  );
28
  ?>
29
- </p>
30
  <input type="hidden" id="advads-licenses-ajax-referrer" value="<?php echo esc_attr( wp_create_nonce( 'advads_ajax_license_nonce' ) ); ?>"/>
1
+ <p>
2
+ <a href="<?php echo esc_url( ADVADS_URL ) . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses-install-add-ons'; ?>" target="_blank">
3
+ <?php echo esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ); ?>
4
+ </a>
5
+ <?php
 
 
 
 
 
 
 
 
 
6
  printf(
7
  wp_kses(
8
  // translators: %s is a URL.
17
  esc_url( ADVADS_URL . 'manual/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' )
18
  );
19
  ?>
20
+ </p>
21
  <input type="hidden" id="advads-licenses-ajax-referrer" value="<?php echo esc_attr( wp_create_nonce( 'advads_ajax_license_nonce' ) ); ?>"/>
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.24.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.24.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.25.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.25.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/EDD_SL_Plugin_Updater.php CHANGED
@@ -566,6 +566,12 @@ class ADVADS_SL_Plugin_Updater {
566
 
567
  $cache = get_option( $cache_key );
568
 
 
 
 
 
 
 
569
  if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
570
  return false; // Cache is expired
571
  }
566
 
567
  $cache = get_option( $cache_key );
568
 
569
+ // Remove cache when WordPress’ "force-update" option is used through Dashboard > Updates
570
+ if ( ! empty( $_GET['force-check'] ) ) {
571
+ delete_option( $cache_key );
572
+ return false;
573
+ }
574
+
575
  if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
576
  return false; // Cache is expired
577
  }
classes/ad-ajax.php CHANGED
@@ -42,6 +42,7 @@ class Advanced_Ads_Ajax {
42
  * Simple wp ajax interface for ad selection.
43
  */
44
  public function advads_ajax_ad_select() {
 
45
  // Set proper header.
46
  header( 'Content-Type: application/json; charset: utf-8' );
47
 
@@ -121,6 +122,14 @@ class Advanced_Ads_Ajax {
121
  );
122
  }
123
 
 
 
 
 
 
 
 
 
124
  $advads = Advanced_Ads::get_instance();
125
  $previous_ads = $advads->current_ads;
126
 
42
  * Simple wp ajax interface for ad selection.
43
  */
44
  public function advads_ajax_ad_select() {
45
+ add_filter( 'advanced-ads-output-inline-css', '__return_false' );
46
  // Set proper header.
47
  header( 'Content-Type: application/json; charset: utf-8' );
48
 
122
  );
123
  }
124
 
125
+ /**
126
+ * Filters the received arguments before passing them to to ads/groups/placements.
127
+ *
128
+ * @param array $arguments Existing arguments.
129
+ * @param array $request Request data.
130
+ */
131
+ $arguments = apply_filters( 'advanced-ads-ajax-ad-select-arguments', $arguments, $request );
132
+
133
  $advads = Advanced_Ads::get_instance();
134
  $previous_ads = $advads->current_ads;
135
 
classes/ad-health-notices.php CHANGED
@@ -230,7 +230,7 @@ class Advanced_Ads_Ad_Health_Notices {
230
  }
231
 
232
  // don’t run on AJAX calls.
233
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
234
  return;
235
  }
236
 
230
  }
231
 
232
  // don’t run on AJAX calls.
233
+ if ( wp_doing_ajax() ) {
234
  return;
235
  }
236
 
classes/ad.php CHANGED
@@ -163,6 +163,8 @@ class Advanced_Ads_Ad {
163
  $id = absint( $id );
164
  $this->id = $id;
165
  $this->args = is_array( $args ) ? $args : array();
 
 
166
 
167
  // whether the ad will be tracked.
168
  $this->global_output = isset( $this->args['global_output'] ) ? (bool) $this->args['global_output'] : true;
@@ -919,9 +921,21 @@ class Advanced_Ads_Ad {
919
  protected function add_wrapper( $ad_content = '' ) {
920
  $wrapper_options = apply_filters( 'advanced-ads-output-wrapper-options', $this->wrapper, $this );
921
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  if ( ( ! isset( $this->output['wrapper-id'] ) || '' === $this->output['wrapper-id'] )
923
  && array() === $wrapper_options || ! is_array( $wrapper_options ) ) {
924
- return $ad_content;
925
  }
926
 
927
  // create unique id if not yet given.
@@ -930,15 +944,6 @@ class Advanced_Ads_Ad {
930
  $this->wrapper['id'] = $wrapper_options['id'];
931
  }
932
 
933
- if ( $this->label && ! empty( $wrapper_options['style']['height'] ) ) {
934
- // Create another wrapper so that the label does not reduce the height of the ad wrapper.
935
- $height = array( 'style' => array( 'height' => $wrapper_options['style']['height'] ) );
936
- unset( $wrapper_options['style']['height'] );
937
- $ad_content = '<div' . Advanced_Ads_Utils::build_html_attributes( $height ) . '>'
938
- . $ad_content
939
- . '</div>';
940
- }
941
-
942
  // add edit button for users with the appropriate rights.
943
  if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
944
  ob_start();
@@ -946,8 +951,6 @@ class Advanced_Ads_Ad {
946
  $ad_content = ob_get_clean() . $ad_content;
947
  }
948
 
949
-
950
-
951
  // build the box
952
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
953
  $wrapper .= $this->label;
163
  $id = absint( $id );
164
  $this->id = $id;
165
  $this->args = is_array( $args ) ? $args : array();
166
+ // Run constructor to check early if ajax cache busting already created inline css.
167
+ Advanced_Ads_Inline_Css::get_instance();
168
 
169
  // whether the ad will be tracked.
170
  $this->global_output = isset( $this->args['global_output'] ) ? (bool) $this->args['global_output'] : true;
921
  protected function add_wrapper( $ad_content = '' ) {
922
  $wrapper_options = apply_filters( 'advanced-ads-output-wrapper-options', $this->wrapper, $this );
923
 
924
+ if ( $this->label && ! empty( $wrapper_options['style']['height'] ) ) {
925
+ // Create another wrapper so that the label does not reduce the height of the ad wrapper.
926
+ $height = array( 'style' => array( 'height' => $wrapper_options['style']['height'] ) );
927
+ unset( $wrapper_options['style']['height'] );
928
+ $ad_content = '<div' . Advanced_Ads_Utils::build_html_attributes( $height ) . '>' . $ad_content . '</div>';
929
+ }
930
+
931
+ // Adds inline css to the wrapper.
932
+ if ( ! empty( $this->options['inline-css'] ) ) {
933
+ $wrapper_options = Advanced_Ads_Inline_Css::get_instance()->add_css( $wrapper_options, $this->options['inline-css'] );
934
+ }
935
+
936
  if ( ( ! isset( $this->output['wrapper-id'] ) || '' === $this->output['wrapper-id'] )
937
  && array() === $wrapper_options || ! is_array( $wrapper_options ) ) {
938
+ return $this->label . $ad_content;
939
  }
940
 
941
  // create unique id if not yet given.
944
  $this->wrapper['id'] = $wrapper_options['id'];
945
  }
946
 
 
 
 
 
 
 
 
 
 
947
  // add edit button for users with the appropriate rights.
948
  if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
949
  ob_start();
951
  $ad_content = ob_get_clean() . $ad_content;
952
  }
953
 
 
 
954
  // build the box
955
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
956
  $wrapper .= $this->label;
classes/ad_group.php CHANGED
@@ -251,6 +251,11 @@ class Advanced_Ads_Group {
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
@@ -601,8 +606,6 @@ class Advanced_Ads_Group {
601
  private function create_wrapper() {
602
  $this->wrapper = array();
603
 
604
-
605
-
606
  if ( $this->ad_args['is_top_level'] ) {
607
  // Add label.
608
  $placement_state = isset( $this->ad_args['ad_label'] ) ? $this->ad_args['ad_label'] : 'default';
251
 
252
  $output_string = implode( '', $output_array );
253
 
254
+ // Adds inline css to the wrapper.
255
+ if ( ! empty( $this->ad_args['inline-css'] ) ) {
256
+ $this->wrapper = Advanced_Ads_Inline_Css::get_instance()->add_css( $this->wrapper, $this->ad_args['inline-css'] );
257
+ }
258
+
259
  if ( ! $this->is_head_placement && $this->wrapper !== array() ) {
260
  $output_string = '<div' . Advanced_Ads_Utils::build_html_attributes( $this->wrapper ) . '>'
261
  . $this->label
606
  private function create_wrapper() {
607
  $this->wrapper = array();
608
 
 
 
609
  if ( $this->ad_args['is_top_level'] ) {
610
  // Add label.
611
  $placement_state = isset( $this->ad_args['ad_label'] ) ? $this->ad_args['ad_label'] : 'default';
classes/ad_type_image.php CHANGED
@@ -98,7 +98,7 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract {
98
  // override image sizes with the sizes given in ad options, but in frontend only
99
  if (
100
  ! is_admin()
101
- || ( defined( 'DOING_AJAX' ) && DOING_AJAX )
102
  ) {
103
  $width = isset( $ad->width ) ? absint( $ad->width ) : $width;
104
  $height = isset( $ad->height ) ? absint( $ad->height ) : $height;
98
  // override image sizes with the sizes given in ad options, but in frontend only
99
  if (
100
  ! is_admin()
101
+ || wp_doing_ajax()
102
  ) {
103
  $width = isset( $ad->width ) ? absint( $ad->width ) : $width;
104
  $height = isset( $ad->height ) ? absint( $ad->height ) : $height;
classes/frontend_checks.php CHANGED
@@ -21,7 +21,7 @@ class Advanced_Ads_Frontend_Checks {
21
  // Wait until other plugins (for example Elementor) have disabled admin bar using `show_admin_bar` filter.
22
  add_action( 'template_redirect', array( $this, 'init' ), 11 );
23
 
24
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
25
  add_filter( 'advanced-ads-ad-output', array( $this, 'after_ad_output' ), 10, 2 );
26
  }
27
  }
@@ -842,10 +842,6 @@ class Advanced_Ads_Frontend_Checks {
842
  return;
843
  }
844
  var autoads_ads = document.querySelectorAll('.google-auto-placed');
845
- var autoads_code_enabled = document.querySelectorAll('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found:not(.hidden)').length;
846
- <?php /* jQuery( '<p class="advads-autoads-hint" style="background-color:#0085ba;color:#fff;font-size:0.8em;padding:5px;"><?php
847
- printf(__( 'This ad was automatically placed here by AdSense. <a href="%s" target="_blank" style="color:#fff;border-color:#fff;">Click here to learn more</a>.', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-auto-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=frontend-autoads-ads' );
848
- ?></p>' ).prependTo( autoads_ads ); */ ?>
849
  // show Auto Ads warning in Ad Health bar if relevant
850
  if( autoads_ads.length ){
851
  var advads_autoads_link = document.querySelector( '#wp-admin-bar-advanced_ads_autoads_displayed.hidden' );
@@ -1162,4 +1158,3 @@ class Advanced_Ads_Frontend_Checks {
1162
  return false;
1163
  }
1164
  }
1165
-
21
  // Wait until other plugins (for example Elementor) have disabled admin bar using `show_admin_bar` filter.
22
  add_action( 'template_redirect', array( $this, 'init' ), 11 );
23
 
24
+ if ( wp_doing_ajax() ) {
25
  add_filter( 'advanced-ads-ad-output', array( $this, 'after_ad_output' ), 10, 2 );
26
  }
27
  }
842
  return;
843
  }
844
  var autoads_ads = document.querySelectorAll('.google-auto-placed');
 
 
 
 
845
  // show Auto Ads warning in Ad Health bar if relevant
846
  if( autoads_ads.length ){
847
  var advads_autoads_link = document.querySelector( '#wp-admin-bar-advanced_ads_autoads_displayed.hidden' );
1158
  return false;
1159
  }
1160
  }
 
classes/inline-css.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles Advanced Ads Inline CSS settings.
5
+ */
6
+ class Advanced_Ads_Inline_Css {
7
+ /**
8
+ * Singleton instance of the plugin
9
+ *
10
+ * @var self
11
+ */
12
+ protected static $instance;
13
+
14
+ /**
15
+ * Module options
16
+ *
17
+ * @var array
18
+ */
19
+ protected $options;
20
+
21
+ /**
22
+ * Holds the state if inline css should be outputted or not.
23
+ *
24
+ * @var bool
25
+ */
26
+ protected $add_inline_css;
27
+
28
+ /**
29
+ * Initialize the module
30
+ */
31
+ private function __construct() {
32
+ $this->options();
33
+
34
+ /**
35
+ * Filters the state if inline css should be outputted or not.
36
+ * Ajax CB container could have added inline css already.
37
+ *
38
+ * Set to false if an addon output inline css before the main plugin.
39
+ *
40
+ * @param bool Contains the state.
41
+ */
42
+ $this->add_inline_css = apply_filters( 'advanced-ads-output-inline-css', true );
43
+ if ( ! $this->add_inline_css ) {
44
+ return;
45
+ }
46
+
47
+ // Add inline css to the tcf container.
48
+ if ( ! empty( $this->options['enabled'] ) && $this->options['enabled'] === 'on' && $this->options['consent-method'] === 'iab_tcf_20' ) {
49
+ add_filter( 'advanced-ads-output-final', array( $this, 'add_tcf_container' ), 20, 2 );
50
+ $this->add_inline_css = false;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Adds inline css.
56
+ *
57
+ * @param array $wrapper Add wrapper array.
58
+ * @param string $css Custom inline css.
59
+ *
60
+ * @return array
61
+ */
62
+ public function add_css( $wrapper, $css ) {
63
+ $this->add_inline_css = apply_filters( 'advanced-ads-output-inline-css', $this->add_inline_css );
64
+ if ( ! $this->add_inline_css ) {
65
+ return $wrapper;
66
+ }
67
+
68
+ $styles = $this->get_styles_by_string( $css );
69
+ $wrapper['style'] = empty( $wrapper['style'] ) ? $styles : array_merge( $wrapper['style'], $styles );
70
+ $this->add_inline_css = false;
71
+
72
+ return $wrapper;
73
+ }
74
+
75
+ /**
76
+ * Extend TCF output with a container containing inline css.
77
+ *
78
+ * @param string $output The output string.
79
+ * @param Advanced_Ads_Ad $ad The ad object.
80
+ *
81
+ * @return string
82
+ */
83
+ public function add_tcf_container( $output, Advanced_Ads_Ad $ad ) {
84
+ return sprintf(
85
+ '<div class="tcf-container" style="' . $ad->options()['inline-css'] . '">%s</div>',
86
+ $output
87
+ );
88
+ }
89
+
90
+ /**
91
+ * Reformats css styles string to array.
92
+ *
93
+ * @param string $string CSS-Style.
94
+ *
95
+ * @return array
96
+ */
97
+ private function get_styles_by_string( $string ) {
98
+ $chunks = array_chunk( preg_split( '/[:;]/', $string ), 2 );
99
+
100
+ return array_combine( array_filter( array_column( $chunks, 0 ) ), array_filter( array_column( $chunks, 1 ) ) );
101
+ }
102
+
103
+ /**
104
+ * Return TCF options.
105
+ *
106
+ * @return array
107
+ */
108
+ public function options() {
109
+ if ( isset( $this->options ) ) {
110
+ return $this->options;
111
+ }
112
+
113
+ $this->options = get_option( Advanced_Ads_Privacy::OPTION_KEY, array() );
114
+ if ( isset( $this->options['enabled'] ) && empty( $this->options['consent-method'] ) ) {
115
+ $this->options['enabled'] = false;
116
+ }
117
+
118
+ return $this->options;
119
+ }
120
+
121
+ /**
122
+ * Return an instance of Advanced_Ads_Inline_Css
123
+ *
124
+ * @return self
125
+ */
126
+ public static function get_instance() {
127
+ // If the single instance hasn't been set, set it now.
128
+ if ( self::$instance === null ) {
129
+ self::$instance = new self();
130
+ }
131
+
132
+ return self::$instance;
133
+ }
134
+ }
classes/plugin.php CHANGED
@@ -220,21 +220,17 @@ class Advanced_Ads_Plugin {
220
  }
221
 
222
  ob_start();
223
- // @formatter:off
224
  ?>
225
  <script>
226
  <?php
227
- if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
228
- readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
229
- } else {
230
- ?>
231
- advanced_ads_ready=function(){var fns=[],listener,doc=typeof document==="object"&&document,hack=doc&&doc.documentElement.doScroll,domContentLoaded="DOMContentLoaded",loaded=doc&&(hack?/^loaded|^c/:/^loaded|^i|^c/).test(doc.readyState);if(!loaded&&doc){listener=function(){doc.removeEventListener(domContentLoaded,listener);window.removeEventListener("load",listener);loaded=1;while(listener=fns.shift())listener()};doc.addEventListener(domContentLoaded,listener);window.addEventListener("load",listener)}return function(fn){loaded?setTimeout(fn,0):fns.push(fn)}}();
232
- <?php
233
- }
234
  ?>
235
  </script>
236
  <?php
237
- // @formatter:on
238
  // escaping would break our HTML here.
239
  // phpcs:ignore
240
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
220
  }
221
 
222
  ob_start();
 
223
  ?>
224
  <script>
225
  <?php
226
+ readfile( sprintf(
227
+ '%spublic/assets/js/ready%s.js',
228
+ ADVADS_BASE_PATH,
229
+ defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'
230
+ ) );
 
 
231
  ?>
232
  </script>
233
  <?php
 
234
  // escaping would break our HTML here.
235
  // phpcs:ignore
236
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
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.24.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-04-15T09:46:33+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"
@@ -93,14 +93,14 @@ msgid "Support"
93
  msgstr ""
94
 
95
  #: admin/class-advanced-ads-admin.php:394
96
- #: admin/includes/class-overview-widgets.php:71
97
  msgid "Add-Ons"
98
  msgstr ""
99
 
100
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
101
  #. translators: %s is a URL.
102
  #: admin/class-advanced-ads-admin.php:665
103
- #: admin/includes/class-overview-widgets.php:194
104
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
105
  msgstr ""
106
 
@@ -115,9 +115,9 @@ msgid "Plugins that are known to cause (partial) problems: <strong>%1$s</strong>
115
  msgstr ""
116
 
117
  #. translators: %s is a list of PHP extensions.
118
- #. translators: %s is a name of a module.
119
  #: admin/includes/ad-health-notices.php:54
120
- #: admin/views/placements.php:233
121
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
122
  msgstr ""
123
 
@@ -303,18 +303,21 @@ msgid "Display ads with the highest ad weight first"
303
  msgstr ""
304
 
305
  #: admin/includes/class-ad-groups-list.php:339
 
306
  #: modules/import-export/classes/import.php:150
307
  #: modules/import-export/classes/import.php:190
308
  #: modules/import-export/classes/import.php:579
309
- #: public/class-advanced-ads.php:791
310
  msgid "Edit"
311
  msgstr ""
312
 
313
  #: admin/includes/class-ad-groups-list.php:340
 
314
  msgid "Usage"
315
  msgstr ""
316
 
317
  #: admin/includes/class-ad-groups-list.php:349
 
318
  msgid "Delete"
319
  msgstr ""
320
 
@@ -446,69 +449,69 @@ msgid "Pro Feature"
446
  msgstr ""
447
 
448
  #: admin/includes/class-admin-upgrades.php:105
449
- #: admin/includes/class-overview-widgets.php:559
450
  msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
451
  msgstr ""
452
 
453
  #. Translators: 1: add-on name 2: admin URL to license page
454
- #: admin/includes/class-licenses.php:95
455
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
456
  msgstr ""
457
 
458
- #: admin/includes/class-licenses.php:118
459
  msgid "Error while trying to register the license. Please contact support."
460
  msgstr ""
461
 
462
- #: admin/includes/class-licenses.php:123
463
  #: admin/views/setting-license.php:85
464
  msgid "Please enter a valid license key"
465
  msgstr ""
466
 
467
- #: admin/includes/class-licenses.php:180
468
  msgid "License couldn’t be activated. Please try again later."
469
  msgstr ""
470
 
471
- #: admin/includes/class-licenses.php:197
472
  msgid "This is the bundle license key."
473
  msgstr ""
474
 
475
- #: admin/includes/class-licenses.php:198
476
  msgid "This is not the correct key for this add-on."
477
  msgstr ""
478
 
479
- #: admin/includes/class-licenses.php:199
480
  msgid "There are no activations left."
481
  msgstr ""
482
 
483
  #. translators: %1$s is a starting link tag, %2$s is the closing one.
484
- #: admin/includes/class-licenses.php:202
485
  msgid "You can manage activations in %1$syour account%2$s."
486
  msgstr ""
487
 
488
  #. translators: %s is a string containing information about the issue.
489
- #: admin/includes/class-licenses.php:216
490
  msgid "License is invalid. Reason: %s"
491
  msgstr ""
492
 
493
  #. translators: %s is a list of server information like IP address. Just keep it as is.
494
- #: admin/includes/class-licenses.php:256
495
  msgid "Your request was blocked by our firewall. Please send us the following information to unblock you: %s."
496
  msgstr ""
497
 
498
- #: admin/includes/class-licenses.php:320
499
  msgid "Error while trying to disable the license. Please contact support."
500
  msgstr ""
501
 
502
- #: admin/includes/class-licenses.php:355
503
- #: admin/includes/class-licenses.php:378
504
  msgid "License couldn’t be deactivated. Please try again later."
505
  msgstr ""
506
 
507
- #: admin/includes/class-licenses.php:607
508
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
509
  msgstr ""
510
 
511
- #: admin/includes/class-licenses.php:609
512
  msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
513
  msgstr ""
514
 
@@ -543,19 +546,19 @@ msgstr ""
543
  #: classes/widget.php:129
544
  #: modules/gutenberg/includes/class-gutenberg.php:79
545
  #: modules/import-export/views/page.php:23
546
- #: public/class-advanced-ads.php:787
547
  msgid "Ads"
548
  msgstr ""
549
 
550
  #: admin/includes/class-menu.php:112
551
- #: public/class-advanced-ads.php:790
552
  msgid "Add New Ad"
553
  msgstr ""
554
 
555
  #: admin/includes/class-menu.php:113
556
  #: admin/views/ad-group-list-ads.php:36
557
- #: public/class-advanced-ads.php:789
558
- #: public/class-advanced-ads.php:793
559
  msgid "New Ad"
560
  msgstr ""
561
 
@@ -573,7 +576,7 @@ msgstr ""
573
 
574
  #: admin/includes/class-menu.php:132
575
  #: admin/includes/class-shortcode-creator.php:198
576
- #: admin/views/placements.php:54
577
  #: classes/widget.php:115
578
  #: modules/gutenberg/includes/class-gutenberg.php:81
579
  #: modules/import-export/views/page.php:25
@@ -608,7 +611,7 @@ msgid "Ad Type"
608
  msgstr ""
609
 
610
  #: admin/includes/class-meta-box.php:74
611
- #: admin/includes/class-overview-widgets.php:64
612
  msgid "AdSense Earnings"
613
  msgstr ""
614
 
@@ -622,13 +625,15 @@ msgid "Layout / Output"
622
  msgstr ""
623
 
624
  #: admin/includes/class-meta-box.php:104
625
- #: admin/views/placements.php:273
 
626
  #: classes/ad-debug.php:152
627
  msgid "Display Conditions"
628
  msgstr ""
629
 
630
  #: admin/includes/class-meta-box.php:112
631
- #: admin/views/placements.php:282
 
632
  #: classes/ad-debug.php:239
633
  msgid "Visitor Conditions"
634
  msgstr ""
@@ -644,7 +649,7 @@ msgstr ""
644
  #: admin/includes/class-meta-box.php:201
645
  #: admin/includes/class-meta-box.php:220
646
  #: admin/includes/class-meta-box.php:225
647
- #: admin/includes/class-overview-widgets.php:182
648
  #: admin/views/ad-main-metabox.php:25
649
  #: admin/views/ad-output-metabox.php:61
650
  #: admin/views/settings/general/custom-label.php:10
@@ -658,7 +663,7 @@ msgid "Video"
658
  msgstr ""
659
 
660
  #: admin/includes/class-meta-box.php:256
661
- #: admin/includes/class-overview-widgets.php:60
662
  msgid "Disable"
663
  msgstr ""
664
 
@@ -707,198 +712,204 @@ msgstr ""
707
  msgid "Please check your email (%1$s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href=\"%2$s\" target=\"_blank\">this form</a> to sign up."
708
  msgstr ""
709
 
710
- #: admin/includes/class-overview-widgets.php:48
711
  msgid "Next steps"
712
  msgstr ""
713
 
714
- #: admin/includes/class-overview-widgets.php:54
715
  msgid "Manual and Support"
716
  msgstr ""
717
 
718
- #: admin/includes/class-overview-widgets.php:118
719
  #: admin/views/notices/welcome-panel.php:15
720
  msgid "Create your first ad"
721
  msgstr ""
722
 
723
- #: admin/includes/class-overview-widgets.php:121
724
  #: modules/gadsense/admin/views/adsense-account.php:71
725
  #: modules/gadsense/admin/views/adsense-account.php:93
726
  msgid "Connect to AdSense"
727
  msgstr ""
728
 
729
- #: admin/includes/class-overview-widgets.php:132
730
  msgid "Join the newsletter for more benefits"
731
  msgstr ""
732
 
733
- #: admin/includes/class-overview-widgets.php:134
734
  msgid "Get 2 free add-ons"
735
  msgstr ""
736
 
737
- #: admin/includes/class-overview-widgets.php:135
738
  msgid "Get the first steps and more tutorials to your inbox"
739
  msgstr ""
740
 
741
- #: admin/includes/class-overview-widgets.php:136
742
  msgid "How to earn more with AdSense"
743
  msgstr ""
744
 
745
- #: admin/includes/class-overview-widgets.php:141
746
  msgid "Join now"
747
  msgstr ""
748
 
749
- #: admin/includes/class-overview-widgets.php:153
750
  msgid "Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review."
751
  msgstr ""
752
 
753
- #: admin/includes/class-overview-widgets.php:155
754
  msgid "Sure, I’ll rate the plugin"
755
  msgstr ""
756
 
757
- #: admin/includes/class-overview-widgets.php:157
758
  msgid "I already did"
759
  msgstr ""
760
 
761
- #: admin/includes/class-overview-widgets.php:164
762
  msgid "Manage your ads"
763
  msgstr ""
764
 
765
- #: admin/includes/class-overview-widgets.php:170
766
  msgid "Get the All Access pass"
767
  msgstr ""
768
 
769
- #: admin/includes/class-overview-widgets.php:186
770
  msgid "FAQ and Support"
771
  msgstr ""
772
 
773
  #. translators: %s is the number of hidden notices.
774
  #. translators: %s includes a number and markup like <span class="count">6</span>.
775
- #: admin/includes/class-overview-widgets.php:218
776
  #: admin/views/overview-notices.php:33
777
  msgid "Show %s hidden notices"
778
  msgstr ""
779
 
780
- #: admin/includes/class-overview-widgets.php:455
 
781
  msgid "How to install and activate an add-on."
782
  msgstr ""
783
 
784
- #: admin/includes/class-overview-widgets.php:462
785
  msgid "The solution for professional websites."
786
  msgstr ""
787
 
788
- #: admin/includes/class-overview-widgets.php:471
789
  #: admin/views/upgrades/pro-tab.php:7
790
  msgid "support for cached sites"
791
  msgstr ""
792
 
793
  #. translators: %s is the name of another plugin.
794
- #: admin/includes/class-overview-widgets.php:487
795
- #: admin/includes/class-overview-widgets.php:499
796
- #: admin/includes/class-overview-widgets.php:511
797
- #: admin/includes/class-overview-widgets.php:523
798
  msgid "integrates with <strong>%s</strong>"
799
  msgstr ""
800
 
801
- #: admin/includes/class-overview-widgets.php:528
802
  msgid "click fraud protection, lazy load, ad-block ads"
803
  msgstr ""
804
 
805
- #: admin/includes/class-overview-widgets.php:529
806
  #: admin/views/upgrades/pro-tab.php:8
807
  msgid "11 more display and visitor conditions"
808
  msgstr ""
809
 
810
- #: admin/includes/class-overview-widgets.php:530
811
  #: admin/views/upgrades/pro-tab.php:9
812
  msgid "6 more placements"
813
  msgstr ""
814
 
815
- #: admin/includes/class-overview-widgets.php:531
816
  #: admin/views/upgrades/pro-tab.php:10
817
  msgid "placement tests for ad optimization"
818
  msgstr ""
819
 
820
- #: admin/includes/class-overview-widgets.php:532
821
  #: admin/views/upgrades/pro-tab.php:11
822
  msgid "ad grids and many more advanced features"
823
  msgstr ""
824
 
825
- #: admin/includes/class-overview-widgets.php:547
826
  msgid "Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks."
827
  msgstr ""
828
 
829
- #: admin/includes/class-overview-widgets.php:553
830
  msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
831
  msgstr ""
832
 
833
- #: admin/includes/class-overview-widgets.php:565
834
- msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
835
- msgstr ""
836
-
837
- #: admin/includes/class-overview-widgets.php:571
838
  msgid "Increase click rates on your ads by placing them in sticky positions above, next or below your site."
839
  msgstr ""
840
 
841
- #: admin/includes/class-overview-widgets.php:577
842
  msgid "Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it."
843
  msgstr ""
844
 
845
- #: admin/includes/class-overview-widgets.php:583
 
 
 
 
846
  msgid "Earn more money and let advertisers pay for ad space directly on the frontend of your site."
847
  msgstr ""
848
 
849
- #: admin/includes/class-overview-widgets.php:589
850
  msgid "Create a beautiful and simple slider from your ads to show more information on less space."
851
  msgstr ""
852
 
853
- #: admin/includes/class-overview-widgets.php:595
854
  msgid "Place AdSense In-feed ads between posts on homepage, category, and archive pages."
855
  msgstr ""
856
 
857
- #: admin/includes/class-overview-widgets.php:598
858
- #: admin/includes/class-overview-widgets.php:788
859
- #: admin/includes/class-overview-widgets.php:804
860
  msgid "Install now"
861
  msgstr ""
862
 
863
- #: admin/includes/class-overview-widgets.php:616
864
- #: admin/includes/class-overview-widgets.php:634
865
- #: admin/includes/class-overview-widgets.php:659
866
- #: admin/includes/class-overview-widgets.php:677
867
- #: admin/includes/class-overview-widgets.php:695
868
- #: admin/includes/class-overview-widgets.php:713
869
- #: admin/includes/class-overview-widgets.php:731
870
- #: admin/includes/class-overview-widgets.php:749
871
- #: admin/includes/class-overview-widgets.php:767
872
  msgid "Activate now"
873
  msgstr ""
874
 
875
- #: admin/includes/class-overview-widgets.php:642
876
  msgid "Visit your ad statistics"
877
  msgstr ""
878
 
879
- #: admin/includes/class-overview-widgets.php:784
880
  msgid "Use Genesis specific ad positions."
881
  msgstr ""
882
 
883
- #: admin/includes/class-overview-widgets.php:800
884
  msgid "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
885
  msgstr ""
886
 
887
- #: admin/includes/class-overview-widgets.php:816
888
  msgid "Our best deal with all add-ons included."
889
  msgstr ""
890
 
891
- #: admin/includes/class-overview-widgets.php:818
 
892
  msgid "Get full access"
893
  msgstr ""
894
 
895
- #: admin/includes/class-overview-widgets.php:834
 
 
 
 
896
  #: admin/views/conditions/ad-display-metabox.php:37
897
  #: admin/views/conditions/ad-visitor-metabox.php:37
898
  msgid "Visit the manual"
899
  msgstr ""
900
 
901
- #: admin/includes/class-overview-widgets.php:837
902
  msgid "Get this add-on"
903
  msgstr ""
904
 
@@ -1144,7 +1155,7 @@ msgstr ""
1144
  #: classes/ad-debug.php:118
1145
  #: classes/ad-debug.php:167
1146
  #: classes/ad-debug.php:169
1147
- #: public/class-advanced-ads.php:788
1148
  msgid "Ad"
1149
  msgstr ""
1150
 
@@ -1158,7 +1169,7 @@ msgid "add"
1158
  msgstr ""
1159
 
1160
  #: admin/views/ad-group-list-form-row.php:31
1161
- #: admin/views/placements.php:66
1162
  #: modules/gadsense/admin/views/external-ads-list.php:41
1163
  #: modules/gadsense/admin/views/external-ads-list.php:51
1164
  #: modules/privacy/admin/views/setting-general.php:44
@@ -1166,7 +1177,8 @@ msgid "Name"
1166
  msgstr ""
1167
 
1168
  #: admin/views/ad-group-list-form-row.php:56
1169
- #: admin/views/placements.php:61
 
1170
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
1171
  msgid "Type"
1172
  msgstr ""
@@ -1195,7 +1207,7 @@ msgstr ""
1195
 
1196
  #: admin/views/ad-group-list-row.php:22
1197
  #: admin/views/ad-info.php:7
1198
- #: admin/views/placements.php:168
1199
  msgid "shortcode"
1200
  msgstr ""
1201
 
@@ -1356,7 +1368,7 @@ msgstr ""
1356
  #: admin/views/placements-ad-label-position.php:13
1357
  #: admin/views/placements-ad-label.php:9
1358
  #: admin/views/placements-ad-label.php:11
1359
- #: admin/views/placements.php:150
1360
  #: modules/gadsense/includes/class-network-adsense.php:323
1361
  msgid "default"
1362
  msgstr ""
@@ -1686,6 +1698,18 @@ msgstr ""
1686
  msgid "There is an error in your AdSense setup."
1687
  msgstr ""
1688
 
 
 
 
 
 
 
 
 
 
 
 
 
1689
  #: admin/views/notices/adblock.php:4
1690
  msgid "Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup."
1691
  msgstr ""
@@ -1944,119 +1968,135 @@ msgstr ""
1944
  msgid "The ad is not translated into %s"
1945
  msgstr ""
1946
 
1947
- #: admin/views/placements.php:13
1948
  msgid "Couldn’t create the new placement. Please check your form field and whether the name is already in use."
1949
  msgstr ""
1950
 
1951
- #: admin/views/placements.php:17
1952
  msgid "Placements updated"
1953
  msgstr ""
1954
 
1955
- #: admin/views/placements.php:23
1956
- #: admin/views/placements.php:361
1957
  msgid "Create a new placement"
1958
  msgstr ""
1959
 
1960
- #: admin/views/placements.php:24
1961
- #: admin/views/placements.php:363
1962
  msgid "New Placement"
1963
  msgstr ""
1964
 
1965
- #: admin/views/placements.php:29
1966
  msgid "Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates."
1967
  msgstr ""
1968
 
1969
- #. translators: %s is a URL.
1970
- #: admin/views/placements.php:35
1971
  msgid "See also the manual for more information on <a href=\"%s\">placements</a>."
1972
  msgstr ""
1973
 
1974
- #: admin/views/placements.php:71
1975
- #: modules/import-export/views/page.php:26
1976
- msgid "Options"
1977
  msgstr ""
1978
 
1979
- #. translators: %s is the name of a placement.
1980
- #: admin/views/placements.php:129
1981
- msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
1982
  msgstr ""
1983
 
1984
- #: admin/views/placements.php:159
1985
  msgid "show usage"
1986
  msgstr ""
1987
 
1988
- #: admin/views/placements.php:171
1989
- msgid "template (PHP)"
1990
  msgstr ""
1991
 
1992
- #: admin/views/placements.php:192
1993
- msgid "Item"
1994
  msgstr ""
1995
 
1996
- #: admin/views/placements.php:209
1997
- msgid "after"
1998
  msgstr ""
1999
 
2000
- #: admin/views/placements.php:210
2001
- msgid "before"
 
2002
  msgstr ""
2003
 
2004
- #: admin/views/placements.php:223
2005
- msgid "position"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2006
  msgstr ""
2007
 
2008
  #: admin/views/placements.php:229
2009
- msgid "Important Notice"
 
2010
  msgstr ""
2011
 
2012
- #: admin/views/placements.php:262
2013
- msgid "ad label"
 
2014
  msgstr ""
2015
 
2016
- #: admin/views/placements.php:275
2017
- msgid "Use display conditions for placements."
2018
  msgstr ""
2019
 
2020
- #: admin/views/placements.php:276
2021
- #: admin/views/placements.php:285
2022
- msgid "The free version provides conditions on the ad edit page."
2023
  msgstr ""
2024
 
2025
- #: admin/views/placements.php:284
2026
- msgid "Use visitor conditions for placements."
2027
  msgstr ""
2028
 
2029
- #: admin/views/placements.php:291
2030
- msgid "Minimum Content Length"
2031
  msgstr ""
2032
 
2033
- #: admin/views/placements.php:293
2034
- msgid "Minimum length of content before automatically injected ads are allowed in them."
2035
  msgstr ""
2036
 
2037
- #: admin/views/placements.php:299
2038
- msgid "Words Between Ads"
2039
  msgstr ""
2040
 
2041
- #: admin/views/placements.php:301
2042
- msgid "A minimum amount of words between automatically injected ads."
 
2043
  msgstr ""
2044
 
2045
- #: admin/views/placements.php:311
2046
  msgid "show all options"
2047
  msgstr ""
2048
 
2049
- #. translators: %s is a URL.
2050
- #: admin/views/placements.php:332
2051
- msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2052
  msgstr ""
2053
 
2054
- #: admin/views/placements.php:352
2055
  msgctxt "checkbox to remove placement"
2056
  msgid "delete"
2057
  msgstr ""
2058
 
2059
- #: admin/views/placements.php:359
2060
  msgid "Save Placements"
2061
  msgstr ""
2062
 
@@ -2235,12 +2275,7 @@ msgid "Clean up all data related to Advanced Ads when removing the plugin."
2235
  msgstr ""
2236
 
2237
  #. translators: %s is a URL.
2238
- #: admin/views/settings/license/section.php:4
2239
- msgid "Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-ons</a>."
2240
- msgstr ""
2241
-
2242
- #. translators: %s is a URL.
2243
- #: admin/views/settings/license/section.php:18
2244
  msgid "See also <a href=\"%s\" target=\"_blank\">Issues and questions about licenses</a>."
2245
  msgstr ""
2246
 
@@ -2464,7 +2499,7 @@ msgid "main query"
2464
  msgstr ""
2465
 
2466
  #: classes/ad-debug.php:121
2467
- #: public/class-advanced-ads.php:752
2468
  msgctxt "ad group singular name"
2469
  msgid "Ad Group"
2470
  msgstr ""
@@ -2475,7 +2510,7 @@ msgstr ""
2475
 
2476
  #. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
2477
  #: classes/ad-health-notices.php:865
2478
- #: modules/gadsense/includes/class-mapi.php:1688
2479
  msgid "Learn more about AdSense account issues %1$shere%2$s."
2480
  msgstr ""
2481
 
@@ -3011,81 +3046,81 @@ msgstr ""
3011
  msgid "the following code is used for automatic error detection and only visible to admins"
3012
  msgstr ""
3013
 
3014
- #: classes/frontend_checks.php:880
3015
- #: classes/frontend_checks.php:895
3016
  msgid "Hi %s"
3017
  msgstr ""
3018
 
3019
- #: classes/frontend_checks.php:880
3020
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3021
  msgstr ""
3022
 
3023
- #: classes/frontend_checks.php:880
3024
- #: classes/frontend_checks.php:895
3025
  msgid "Is that correct?"
3026
  msgstr ""
3027
 
3028
- #: classes/frontend_checks.php:882
3029
  msgid "All is fine"
3030
  msgstr ""
3031
 
3032
- #: classes/frontend_checks.php:883
3033
  msgid "Something is off"
3034
  msgstr ""
3035
 
3036
- #: classes/frontend_checks.php:885
3037
- #: classes/frontend_checks.php:900
3038
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3039
  msgstr ""
3040
 
3041
- #: classes/frontend_checks.php:895
3042
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3043
  msgstr ""
3044
 
3045
- #: classes/frontend_checks.php:897
3046
  msgid "This is fine"
3047
  msgstr ""
3048
 
3049
- #: classes/frontend_checks.php:898
3050
  msgid "I expected something else"
3051
  msgstr ""
3052
 
3053
- #: classes/frontend_checks.php:903
3054
- #: classes/frontend_checks.php:911
3055
  msgid "Just click on your problem to learn more from our knowledge base."
3056
  msgstr ""
3057
 
3058
- #: classes/frontend_checks.php:904
3059
  msgid "I want to disable AdSense Auto ads"
3060
  msgstr ""
3061
 
3062
- #: classes/frontend_checks.php:905
3063
- #: classes/frontend_checks.php:912
3064
  msgid "I don’t see any Auto ads"
3065
  msgstr ""
3066
 
3067
- #: classes/frontend_checks.php:906
3068
  msgid "I only see blank space"
3069
  msgstr ""
3070
 
3071
- #: classes/frontend_checks.php:907
3072
  msgid "I want to change the position of the ads"
3073
  msgstr ""
3074
 
3075
- #: classes/frontend_checks.php:908
3076
  #: modules/gadsense/includes/class-network-adsense.php:226
3077
  msgid "Display Auto ads only on specific pages"
3078
  msgstr ""
3079
 
3080
- #: classes/frontend_checks.php:913
3081
  msgid "How to look for the Auto ads code"
3082
  msgstr ""
3083
 
3084
- #: classes/frontend_checks.php:914
3085
  msgid "I have another question or problem"
3086
  msgstr ""
3087
 
3088
- #: classes/frontend_checks.php:917
3089
  msgid "Closing the message"
3090
  msgstr ""
3091
 
@@ -3195,39 +3230,39 @@ msgstr ""
3195
  msgid "Individual Posts, Pages and Public Post Types"
3196
  msgstr ""
3197
 
3198
- #: modules/ad-blocker/admin/admin.php:96
3199
  msgid "Ad blocker fix"
3200
  msgstr ""
3201
 
3202
- #: modules/ad-blocker/admin/admin.php:150
3203
- #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:382
3204
  msgid "Unable to connect to the filesystem. Please confirm your credentials."
3205
  msgstr ""
3206
 
3207
- #: modules/ad-blocker/admin/admin.php:165
3208
  msgid "The asset folder was rebuilt successfully"
3209
  msgstr ""
3210
 
3211
- #: modules/ad-blocker/admin/admin.php:226
3212
  msgid "There is no writable upload folder"
3213
  msgstr ""
3214
 
3215
- #: modules/ad-blocker/admin/admin.php:255
3216
  msgid "Unable to rename \"%s\" directory"
3217
  msgstr ""
3218
 
3219
- #: modules/ad-blocker/admin/admin.php:271
3220
- #: modules/ad-blocker/admin/admin.php:284
3221
- #: modules/ad-blocker/admin/admin.php:301
3222
  msgid "Unable to copy assets to the \"%s\" directory"
3223
  msgstr ""
3224
 
3225
- #: modules/ad-blocker/admin/admin.php:334
3226
- #: modules/ad-blocker/admin/admin.php:419
3227
  msgid "We do not have direct write access to the \"%s\" directory"
3228
  msgstr ""
3229
 
3230
- #: modules/ad-blocker/admin/admin.php:430
3231
  msgid "Unable to copy files to %s"
3232
  msgstr ""
3233
 
@@ -3317,19 +3352,19 @@ msgstr ""
3317
  msgid "If your site is located on a subdomain, you need to add the following line to the ads.txt file of the root domain: %s"
3318
  msgstr ""
3319
 
3320
- #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:355
3321
  msgid "The ads.txt is now managed with Advanced Ads."
3322
  msgstr ""
3323
 
3324
- #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:400
3325
  msgid "Not the main blog"
3326
  msgstr ""
3327
 
3328
- #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:429
3329
  msgid "Could not delete the existing ads.txt file"
3330
  msgstr ""
3331
 
3332
- #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:432
3333
  msgid "Could not find the existing ads.txt file"
3334
  msgstr ""
3335
 
@@ -3731,58 +3766,58 @@ msgstr ""
3731
  msgid "This ad code is from a different AdSense Account"
3732
  msgstr ""
3733
 
3734
- #: modules/gadsense/includes/class-mapi.php:987
3735
  msgid "Invalid response body while retrieving account alerts"
3736
  msgstr ""
3737
 
3738
- #: modules/gadsense/includes/class-mapi.php:996
3739
  msgid "error while retrieving account alerts"
3740
  msgstr ""
3741
 
3742
- #: modules/gadsense/includes/class-mapi.php:1167
3743
  msgid "No token provided. Token data needed to get account details."
3744
  msgstr ""
3745
 
3746
- #: modules/gadsense/includes/class-mapi.php:1231
3747
  msgid "An error occurred while requesting account details."
3748
  msgstr ""
3749
 
3750
- #: modules/gadsense/includes/class-mapi.php:1456
3751
  #: modules/gadsense/includes/class-network-adsense.php:516
3752
  msgctxt "AdSense ad type"
3753
  msgid "Matched Content"
3754
  msgstr ""
3755
 
3756
- #: modules/gadsense/includes/class-mapi.php:1459
3757
  #: modules/gadsense/includes/class-network-adsense.php:517
3758
  msgctxt "AdSense ad type"
3759
  msgid "In-article"
3760
  msgstr ""
3761
 
3762
- #: modules/gadsense/includes/class-mapi.php:1461
3763
  #: modules/gadsense/includes/class-network-adsense.php:518
3764
  msgctxt "AdSense ad type"
3765
  msgid "In-feed"
3766
  msgstr ""
3767
 
3768
- #: modules/gadsense/includes/class-mapi.php:1466
3769
  #: modules/gadsense/includes/class-network-adsense.php:519
3770
  msgctxt "AdSense ad type"
3771
  msgid "Display"
3772
  msgstr ""
3773
 
3774
- #: modules/gadsense/includes/class-mapi.php:1468
3775
  #: modules/gadsense/includes/class-network-adsense.php:520
3776
  msgctxt "AdSense ad type"
3777
  msgid "Link"
3778
  msgstr ""
3779
 
3780
- #: modules/gadsense/includes/class-mapi.php:1655
3781
  msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
3782
  msgstr ""
3783
 
3784
  #. translators: 1:A link to the settings page translators: 2:The name of an ad network
3785
- #: modules/gadsense/includes/class-mapi.php:1742
3786
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3787
  msgstr ""
3788
 
@@ -3961,8 +3996,8 @@ msgstr ""
3961
 
3962
  #: modules/import-export/classes/XmlEncoder.php:61
3963
  #: modules/import-export/classes/XmlEncoder.php:64
3964
- #: modules/import-export/classes/XmlEncoder.php:193
3965
- #: modules/import-export/classes/XmlEncoder.php:196
3966
  msgid "The %s extension(s) is not loaded"
3967
  msgstr ""
3968
 
@@ -3971,22 +4006,17 @@ msgctxt "import_export"
3971
  msgid "The data must be an array"
3972
  msgstr ""
3973
 
3974
- #: modules/import-export/classes/XmlEncoder.php:103
3975
- msgctxt "import_export"
3976
- msgid "The key %s is not valid"
3977
- msgstr ""
3978
-
3979
- #: modules/import-export/classes/XmlEncoder.php:149
3980
  msgctxt "import_export"
3981
  msgid "An unexpected value could not be serialized: %s"
3982
  msgstr ""
3983
 
3984
- #: modules/import-export/classes/XmlEncoder.php:201
3985
  msgctxt "import_export"
3986
  msgid "Invalid XML data, it can not be empty"
3987
  msgstr ""
3988
 
3989
- #: modules/import-export/classes/XmlEncoder.php:223
3990
  msgctxt "import_export"
3991
  msgid "XML error: %s"
3992
  msgstr ""
@@ -4000,7 +4030,7 @@ msgid "When you click the button below Advanced Ads will create an XML file for
4000
  msgstr ""
4001
 
4002
  #: modules/import-export/views/page.php:24
4003
- #: public/class-advanced-ads.php:761
4004
  msgid "Groups"
4005
  msgstr ""
4006
 
@@ -4103,85 +4133,85 @@ msgstr ""
4103
  msgid "Install %1$sAdvanced Ads Pro%2$s to reload the ads instantly without an additional page request."
4104
  msgstr ""
4105
 
4106
- #: public/class-advanced-ads.php:417
4107
  msgid "Advanced Ads Error following:"
4108
  msgstr ""
4109
 
4110
  #. translators: %s is an error message generated by the plugin.
4111
- #: public/class-advanced-ads.php:421
4112
  msgid "Advanced Ads Error: %s"
4113
  msgstr ""
4114
 
4115
- #: public/class-advanced-ads.php:751
4116
  msgctxt "ad group general name"
4117
  msgid "Ad Groups & Rotations"
4118
  msgstr ""
4119
 
4120
- #: public/class-advanced-ads.php:753
4121
  msgid "Search Ad Groups"
4122
  msgstr ""
4123
 
4124
- #: public/class-advanced-ads.php:754
4125
  msgid "All Ad Groups"
4126
  msgstr ""
4127
 
4128
- #: public/class-advanced-ads.php:755
4129
  msgid "Parent Ad Groups"
4130
  msgstr ""
4131
 
4132
- #: public/class-advanced-ads.php:756
4133
  msgid "Parent Ad Groups:"
4134
  msgstr ""
4135
 
4136
- #: public/class-advanced-ads.php:757
4137
  msgid "Edit Ad Group"
4138
  msgstr ""
4139
 
4140
- #: public/class-advanced-ads.php:758
4141
  msgid "Update Ad Group"
4142
  msgstr ""
4143
 
4144
- #: public/class-advanced-ads.php:759
4145
  msgid "Add New Ad Group"
4146
  msgstr ""
4147
 
4148
- #: public/class-advanced-ads.php:760
4149
  msgid "New Ad Groups Name"
4150
  msgstr ""
4151
 
4152
- #: public/class-advanced-ads.php:762
4153
  msgid "No Ad Group found"
4154
  msgstr ""
4155
 
4156
- #: public/class-advanced-ads.php:792
4157
  msgid "Edit Ad"
4158
  msgstr ""
4159
 
4160
- #: public/class-advanced-ads.php:794
4161
  msgid "View"
4162
  msgstr ""
4163
 
4164
- #: public/class-advanced-ads.php:795
4165
  msgid "View the Ad"
4166
  msgstr ""
4167
 
4168
- #: public/class-advanced-ads.php:796
4169
  msgid "Search Ads"
4170
  msgstr ""
4171
 
4172
- #: public/class-advanced-ads.php:797
4173
  msgid "No Ads found"
4174
  msgstr ""
4175
 
4176
- #: public/class-advanced-ads.php:798
4177
  msgid "No Ads found in Trash"
4178
  msgstr ""
4179
 
4180
- #: public/class-advanced-ads.php:799
4181
  msgid "Parent Ad"
4182
  msgstr ""
4183
 
4184
- #: public/class-advanced-ads.php:969
4185
  msgctxt "label above ads"
4186
  msgid "Advertisements"
4187
  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.25.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: 2021-06-03T10:29:44+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"
93
  msgstr ""
94
 
95
  #: admin/class-advanced-ads-admin.php:394
96
+ #: admin/includes/class-overview-widgets.php:72
97
  msgid "Add-Ons"
98
  msgstr ""
99
 
100
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
101
  #. translators: %s is a URL.
102
  #: admin/class-advanced-ads-admin.php:665
103
+ #: admin/includes/class-overview-widgets.php:191
104
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
105
  msgstr ""
106
 
115
  msgstr ""
116
 
117
  #. translators: %s is a list of PHP extensions.
118
+ #. Translators: %s is a name of a module.
119
  #: admin/includes/ad-health-notices.php:54
120
+ #: admin/views/placements.php:382
121
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
122
  msgstr ""
123
 
303
  msgstr ""
304
 
305
  #: admin/includes/class-ad-groups-list.php:339
306
+ #: admin/views/placements.php:274
307
  #: modules/import-export/classes/import.php:150
308
  #: modules/import-export/classes/import.php:190
309
  #: modules/import-export/classes/import.php:579
310
+ #: public/class-advanced-ads.php:792
311
  msgid "Edit"
312
  msgstr ""
313
 
314
  #: admin/includes/class-ad-groups-list.php:340
315
+ #: admin/views/placements.php:305
316
  msgid "Usage"
317
  msgstr ""
318
 
319
  #: admin/includes/class-ad-groups-list.php:349
320
+ #: admin/views/placements.php:10
321
  msgid "Delete"
322
  msgstr ""
323
 
449
  msgstr ""
450
 
451
  #: admin/includes/class-admin-upgrades.php:105
452
+ #: admin/includes/class-overview-widgets.php:555
453
  msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
454
  msgstr ""
455
 
456
  #. Translators: 1: add-on name 2: admin URL to license page
457
+ #: admin/includes/class-licenses.php:103
458
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
459
  msgstr ""
460
 
461
+ #: admin/includes/class-licenses.php:125
462
  msgid "Error while trying to register the license. Please contact support."
463
  msgstr ""
464
 
465
+ #: admin/includes/class-licenses.php:130
466
  #: admin/views/setting-license.php:85
467
  msgid "Please enter a valid license key"
468
  msgstr ""
469
 
470
+ #: admin/includes/class-licenses.php:187
471
  msgid "License couldn’t be activated. Please try again later."
472
  msgstr ""
473
 
474
+ #: admin/includes/class-licenses.php:204
475
  msgid "This is the bundle license key."
476
  msgstr ""
477
 
478
+ #: admin/includes/class-licenses.php:205
479
  msgid "This is not the correct key for this add-on."
480
  msgstr ""
481
 
482
+ #: admin/includes/class-licenses.php:206
483
  msgid "There are no activations left."
484
  msgstr ""
485
 
486
  #. translators: %1$s is a starting link tag, %2$s is the closing one.
487
+ #: admin/includes/class-licenses.php:209
488
  msgid "You can manage activations in %1$syour account%2$s."
489
  msgstr ""
490
 
491
  #. translators: %s is a string containing information about the issue.
492
+ #: admin/includes/class-licenses.php:223
493
  msgid "License is invalid. Reason: %s"
494
  msgstr ""
495
 
496
  #. translators: %s is a list of server information like IP address. Just keep it as is.
497
+ #: admin/includes/class-licenses.php:263
498
  msgid "Your request was blocked by our firewall. Please send us the following information to unblock you: %s."
499
  msgstr ""
500
 
501
+ #: admin/includes/class-licenses.php:325
502
  msgid "Error while trying to disable the license. Please contact support."
503
  msgstr ""
504
 
505
+ #: admin/includes/class-licenses.php:360
506
+ #: admin/includes/class-licenses.php:383
507
  msgid "License couldn’t be deactivated. Please try again later."
508
  msgstr ""
509
 
510
+ #: admin/includes/class-licenses.php:617
511
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
512
  msgstr ""
513
 
514
+ #: admin/includes/class-licenses.php:619
515
  msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
516
  msgstr ""
517
 
546
  #: classes/widget.php:129
547
  #: modules/gutenberg/includes/class-gutenberg.php:79
548
  #: modules/import-export/views/page.php:23
549
+ #: public/class-advanced-ads.php:788
550
  msgid "Ads"
551
  msgstr ""
552
 
553
  #: admin/includes/class-menu.php:112
554
+ #: public/class-advanced-ads.php:791
555
  msgid "Add New Ad"
556
  msgstr ""
557
 
558
  #: admin/includes/class-menu.php:113
559
  #: admin/views/ad-group-list-ads.php:36
560
+ #: public/class-advanced-ads.php:790
561
+ #: public/class-advanced-ads.php:794
562
  msgid "New Ad"
563
  msgstr ""
564
 
576
 
577
  #: admin/includes/class-menu.php:132
578
  #: admin/includes/class-shortcode-creator.php:198
579
+ #: admin/views/placements.php:57
580
  #: classes/widget.php:115
581
  #: modules/gutenberg/includes/class-gutenberg.php:81
582
  #: modules/import-export/views/page.php:25
611
  msgstr ""
612
 
613
  #: admin/includes/class-meta-box.php:74
614
+ #: admin/includes/class-overview-widgets.php:65
615
  msgid "AdSense Earnings"
616
  msgstr ""
617
 
625
  msgstr ""
626
 
627
  #: admin/includes/class-meta-box.php:104
628
+ #: admin/views/placements.php:183
629
+ #: admin/views/placements.php:421
630
  #: classes/ad-debug.php:152
631
  msgid "Display Conditions"
632
  msgstr ""
633
 
634
  #: admin/includes/class-meta-box.php:112
635
+ #: admin/views/placements.php:192
636
+ #: admin/views/placements.php:429
637
  #: classes/ad-debug.php:239
638
  msgid "Visitor Conditions"
639
  msgstr ""
649
  #: admin/includes/class-meta-box.php:201
650
  #: admin/includes/class-meta-box.php:220
651
  #: admin/includes/class-meta-box.php:225
652
+ #: admin/includes/class-overview-widgets.php:179
653
  #: admin/views/ad-main-metabox.php:25
654
  #: admin/views/ad-output-metabox.php:61
655
  #: admin/views/settings/general/custom-label.php:10
663
  msgstr ""
664
 
665
  #: admin/includes/class-meta-box.php:256
666
+ #: admin/includes/class-overview-widgets.php:61
667
  msgid "Disable"
668
  msgstr ""
669
 
712
  msgid "Please check your email (%1$s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href=\"%2$s\" target=\"_blank\">this form</a> to sign up."
713
  msgstr ""
714
 
715
+ #: admin/includes/class-overview-widgets.php:49
716
  msgid "Next steps"
717
  msgstr ""
718
 
719
+ #: admin/includes/class-overview-widgets.php:55
720
  msgid "Manual and Support"
721
  msgstr ""
722
 
723
+ #: admin/includes/class-overview-widgets.php:115
724
  #: admin/views/notices/welcome-panel.php:15
725
  msgid "Create your first ad"
726
  msgstr ""
727
 
728
+ #: admin/includes/class-overview-widgets.php:118
729
  #: modules/gadsense/admin/views/adsense-account.php:71
730
  #: modules/gadsense/admin/views/adsense-account.php:93
731
  msgid "Connect to AdSense"
732
  msgstr ""
733
 
734
+ #: admin/includes/class-overview-widgets.php:129
735
  msgid "Join the newsletter for more benefits"
736
  msgstr ""
737
 
738
+ #: admin/includes/class-overview-widgets.php:131
739
  msgid "Get 2 free add-ons"
740
  msgstr ""
741
 
742
+ #: admin/includes/class-overview-widgets.php:132
743
  msgid "Get the first steps and more tutorials to your inbox"
744
  msgstr ""
745
 
746
+ #: admin/includes/class-overview-widgets.php:133
747
  msgid "How to earn more with AdSense"
748
  msgstr ""
749
 
750
+ #: admin/includes/class-overview-widgets.php:138
751
  msgid "Join now"
752
  msgstr ""
753
 
754
+ #: admin/includes/class-overview-widgets.php:150
755
  msgid "Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review."
756
  msgstr ""
757
 
758
+ #: admin/includes/class-overview-widgets.php:152
759
  msgid "Sure, I’ll rate the plugin"
760
  msgstr ""
761
 
762
+ #: admin/includes/class-overview-widgets.php:154
763
  msgid "I already did"
764
  msgstr ""
765
 
766
+ #: admin/includes/class-overview-widgets.php:161
767
  msgid "Manage your ads"
768
  msgstr ""
769
 
770
+ #: admin/includes/class-overview-widgets.php:167
771
  msgid "Get the All Access pass"
772
  msgstr ""
773
 
774
+ #: admin/includes/class-overview-widgets.php:183
775
  msgid "FAQ and Support"
776
  msgstr ""
777
 
778
  #. translators: %s is the number of hidden notices.
779
  #. translators: %s includes a number and markup like <span class="count">6</span>.
780
+ #: admin/includes/class-overview-widgets.php:215
781
  #: admin/views/overview-notices.php:33
782
  msgid "Show %s hidden notices"
783
  msgstr ""
784
 
785
+ #: admin/includes/class-overview-widgets.php:450
786
+ #: admin/views/settings/license/section.php:3
787
  msgid "How to install and activate an add-on."
788
  msgstr ""
789
 
790
+ #: admin/includes/class-overview-widgets.php:458
791
  msgid "The solution for professional websites."
792
  msgstr ""
793
 
794
+ #: admin/includes/class-overview-widgets.php:467
795
  #: admin/views/upgrades/pro-tab.php:7
796
  msgid "support for cached sites"
797
  msgstr ""
798
 
799
  #. translators: %s is the name of another plugin.
800
+ #: admin/includes/class-overview-widgets.php:483
801
+ #: admin/includes/class-overview-widgets.php:495
802
+ #: admin/includes/class-overview-widgets.php:507
803
+ #: admin/includes/class-overview-widgets.php:519
804
  msgid "integrates with <strong>%s</strong>"
805
  msgstr ""
806
 
807
+ #: admin/includes/class-overview-widgets.php:524
808
  msgid "click fraud protection, lazy load, ad-block ads"
809
  msgstr ""
810
 
811
+ #: admin/includes/class-overview-widgets.php:525
812
  #: admin/views/upgrades/pro-tab.php:8
813
  msgid "11 more display and visitor conditions"
814
  msgstr ""
815
 
816
+ #: admin/includes/class-overview-widgets.php:526
817
  #: admin/views/upgrades/pro-tab.php:9
818
  msgid "6 more placements"
819
  msgstr ""
820
 
821
+ #: admin/includes/class-overview-widgets.php:527
822
  #: admin/views/upgrades/pro-tab.php:10
823
  msgid "placement tests for ad optimization"
824
  msgstr ""
825
 
826
+ #: admin/includes/class-overview-widgets.php:528
827
  #: admin/views/upgrades/pro-tab.php:11
828
  msgid "ad grids and many more advanced features"
829
  msgstr ""
830
 
831
+ #: admin/includes/class-overview-widgets.php:543
832
  msgid "Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks."
833
  msgstr ""
834
 
835
+ #: admin/includes/class-overview-widgets.php:549
836
  msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
837
  msgstr ""
838
 
839
+ #: admin/includes/class-overview-widgets.php:561
 
 
 
 
840
  msgid "Increase click rates on your ads by placing them in sticky positions above, next or below your site."
841
  msgstr ""
842
 
843
+ #: admin/includes/class-overview-widgets.php:567
844
  msgid "Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it."
845
  msgstr ""
846
 
847
+ #: admin/includes/class-overview-widgets.php:573
848
+ msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
849
+ msgstr ""
850
+
851
+ #: admin/includes/class-overview-widgets.php:579
852
  msgid "Earn more money and let advertisers pay for ad space directly on the frontend of your site."
853
  msgstr ""
854
 
855
+ #: admin/includes/class-overview-widgets.php:585
856
  msgid "Create a beautiful and simple slider from your ads to show more information on less space."
857
  msgstr ""
858
 
859
+ #: admin/includes/class-overview-widgets.php:591
860
  msgid "Place AdSense In-feed ads between posts on homepage, category, and archive pages."
861
  msgstr ""
862
 
863
+ #: admin/includes/class-overview-widgets.php:594
864
+ #: admin/includes/class-overview-widgets.php:784
865
+ #: admin/includes/class-overview-widgets.php:800
866
  msgid "Install now"
867
  msgstr ""
868
 
869
+ #: admin/includes/class-overview-widgets.php:612
870
+ #: admin/includes/class-overview-widgets.php:630
871
+ #: admin/includes/class-overview-widgets.php:655
872
+ #: admin/includes/class-overview-widgets.php:673
873
+ #: admin/includes/class-overview-widgets.php:691
874
+ #: admin/includes/class-overview-widgets.php:709
875
+ #: admin/includes/class-overview-widgets.php:727
876
+ #: admin/includes/class-overview-widgets.php:745
877
+ #: admin/includes/class-overview-widgets.php:763
878
  msgid "Activate now"
879
  msgstr ""
880
 
881
+ #: admin/includes/class-overview-widgets.php:638
882
  msgid "Visit your ad statistics"
883
  msgstr ""
884
 
885
+ #: admin/includes/class-overview-widgets.php:780
886
  msgid "Use Genesis specific ad positions."
887
  msgstr ""
888
 
889
+ #: admin/includes/class-overview-widgets.php:796
890
  msgid "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
891
  msgstr ""
892
 
893
+ #: admin/includes/class-overview-widgets.php:812
894
  msgid "Our best deal with all add-ons included."
895
  msgstr ""
896
 
897
+ #: admin/includes/class-overview-widgets.php:814
898
+ #: admin/includes/class-overview-widgets.php:830
899
  msgid "Get full access"
900
  msgstr ""
901
 
902
+ #: admin/includes/class-overview-widgets.php:828
903
+ msgid "A one-time payment for four years of support and updates. The package saves you up to 70% compared to individually purchasing our add-ons."
904
+ msgstr ""
905
+
906
+ #: admin/includes/class-overview-widgets.php:846
907
  #: admin/views/conditions/ad-display-metabox.php:37
908
  #: admin/views/conditions/ad-visitor-metabox.php:37
909
  msgid "Visit the manual"
910
  msgstr ""
911
 
912
+ #: admin/includes/class-overview-widgets.php:849
913
  msgid "Get this add-on"
914
  msgstr ""
915
 
1155
  #: classes/ad-debug.php:118
1156
  #: classes/ad-debug.php:167
1157
  #: classes/ad-debug.php:169
1158
+ #: public/class-advanced-ads.php:789
1159
  msgid "Ad"
1160
  msgstr ""
1161
 
1169
  msgstr ""
1170
 
1171
  #: admin/views/ad-group-list-form-row.php:31
1172
+ #: admin/views/placements.php:64
1173
  #: modules/gadsense/admin/views/external-ads-list.php:41
1174
  #: modules/gadsense/admin/views/external-ads-list.php:51
1175
  #: modules/privacy/admin/views/setting-general.php:44
1177
  msgstr ""
1178
 
1179
  #: admin/views/ad-group-list-form-row.php:56
1180
+ #: admin/views/placements.php:64
1181
+ #: admin/views/placements.php:256
1182
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
1183
  msgid "Type"
1184
  msgstr ""
1207
 
1208
  #: admin/views/ad-group-list-row.php:22
1209
  #: admin/views/ad-info.php:7
1210
+ #: admin/views/placements.php:309
1211
  msgid "shortcode"
1212
  msgstr ""
1213
 
1368
  #: admin/views/placements-ad-label-position.php:13
1369
  #: admin/views/placements-ad-label.php:9
1370
  #: admin/views/placements-ad-label.php:11
1371
+ #: admin/views/placements.php:268
1372
  #: modules/gadsense/includes/class-network-adsense.php:323
1373
  msgid "default"
1374
  msgstr ""
1698
  msgid "There is an error in your AdSense setup."
1699
  msgstr ""
1700
 
1701
+ #: admin/views/modal.php:36
1702
+ #: admin/views/modal.php:37
1703
+ #: admin/views/placements.php:319
1704
+ #: admin/views/placements.php:320
1705
+ msgid "Close"
1706
+ msgstr ""
1707
+
1708
+ #: admin/views/modal.php:39
1709
+ #: admin/views/placements.php:230
1710
+ msgid "Close and save"
1711
+ msgstr ""
1712
+
1713
  #: admin/views/notices/adblock.php:4
1714
  msgid "Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup."
1715
  msgstr ""
1968
  msgid "The ad is not translated into %s"
1969
  msgstr ""
1970
 
1971
+ #: admin/views/placements.php:19
1972
  msgid "Couldn’t create the new placement. Please check your form field and whether the name is already in use."
1973
  msgstr ""
1974
 
1975
+ #: admin/views/placements.php:21
1976
  msgid "Placements updated"
1977
  msgstr ""
1978
 
1979
+ #: admin/views/placements.php:25
1980
+ #: admin/views/placements.php:469
1981
  msgid "Create a new placement"
1982
  msgstr ""
1983
 
1984
+ #: admin/views/placements.php:26
1985
+ #: admin/views/placements.php:471
1986
  msgid "New Placement"
1987
  msgstr ""
1988
 
1989
+ #: admin/views/placements.php:31
1990
  msgid "Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates."
1991
  msgstr ""
1992
 
1993
+ #. Translators: %s is a URL.
1994
+ #: admin/views/placements.php:37
1995
  msgid "See also the manual for more information on <a href=\"%s\">placements</a>."
1996
  msgstr ""
1997
 
1998
+ #: admin/views/placements.php:69
1999
+ msgid "Output"
 
2000
  msgstr ""
2001
 
2002
+ #: admin/views/placements.php:73
2003
+ msgid "Delivery"
 
2004
  msgstr ""
2005
 
2006
+ #: admin/views/placements.php:138
2007
  msgid "show usage"
2008
  msgstr ""
2009
 
2010
+ #: admin/views/placements.php:162
2011
+ msgid "ad label"
2012
  msgstr ""
2013
 
2014
+ #: admin/views/placements.php:174
2015
+ msgid "Inline CSS"
2016
  msgstr ""
2017
 
2018
+ #: admin/views/placements.php:185
2019
+ msgid "Use display conditions for placements."
2020
  msgstr ""
2021
 
2022
+ #: admin/views/placements.php:186
2023
+ #: admin/views/placements.php:195
2024
+ msgid "The free version provides conditions on the ad edit page."
2025
  msgstr ""
2026
 
2027
+ #: admin/views/placements.php:194
2028
+ msgid "Use visitor conditions for placements."
2029
+ msgstr ""
2030
+
2031
+ #: admin/views/placements.php:201
2032
+ msgid "Minimum Content Length"
2033
+ msgstr ""
2034
+
2035
+ #: admin/views/placements.php:203
2036
+ msgid "Minimum length of content before automatically injected ads are allowed in them."
2037
+ msgstr ""
2038
+
2039
+ #: admin/views/placements.php:209
2040
+ msgid "Words Between Ads"
2041
+ msgstr ""
2042
+
2043
+ #: admin/views/placements.php:211
2044
+ msgid "A minimum amount of words between automatically injected ads."
2045
  msgstr ""
2046
 
2047
  #: admin/views/placements.php:229
2048
+ #: modules/import-export/views/page.php:26
2049
+ msgid "Options"
2050
  msgstr ""
2051
 
2052
+ #. Translators: %s is the name of a placement.
2053
+ #: admin/views/placements.php:241
2054
+ msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
2055
  msgstr ""
2056
 
2057
+ #: admin/views/placements.php:312
2058
+ msgid "template (PHP)"
2059
  msgstr ""
2060
 
2061
+ #: admin/views/placements.php:343
2062
+ msgid "Item"
 
2063
  msgstr ""
2064
 
2065
+ #: admin/views/placements.php:358
2066
+ msgid "after"
2067
  msgstr ""
2068
 
2069
+ #: admin/views/placements.php:359
2070
+ msgid "before"
2071
  msgstr ""
2072
 
2073
+ #: admin/views/placements.php:372
2074
+ msgid "position"
2075
  msgstr ""
2076
 
2077
+ #: admin/views/placements.php:378
2078
+ msgid "Important Notice"
2079
  msgstr ""
2080
 
2081
+ #. Translators: %s is a URL.
2082
+ #: admin/views/placements.php:401
2083
+ msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2084
  msgstr ""
2085
 
2086
+ #: admin/views/placements.php:416
2087
  msgid "show all options"
2088
  msgstr ""
2089
 
2090
+ #: admin/views/placements.php:438
2091
+ msgid "edit conditions"
 
2092
  msgstr ""
2093
 
2094
+ #: admin/views/placements.php:460
2095
  msgctxt "checkbox to remove placement"
2096
  msgid "delete"
2097
  msgstr ""
2098
 
2099
+ #: admin/views/placements.php:467
2100
  msgid "Save Placements"
2101
  msgstr ""
2102
 
2275
  msgstr ""
2276
 
2277
  #. translators: %s is a URL.
2278
+ #: admin/views/settings/license/section.php:9
 
 
 
 
 
2279
  msgid "See also <a href=\"%s\" target=\"_blank\">Issues and questions about licenses</a>."
2280
  msgstr ""
2281
 
2499
  msgstr ""
2500
 
2501
  #: classes/ad-debug.php:121
2502
+ #: public/class-advanced-ads.php:753
2503
  msgctxt "ad group singular name"
2504
  msgid "Ad Group"
2505
  msgstr ""
2510
 
2511
  #. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
2512
  #: classes/ad-health-notices.php:865
2513
+ #: modules/gadsense/includes/class-mapi.php:1702
2514
  msgid "Learn more about AdSense account issues %1$shere%2$s."
2515
  msgstr ""
2516
 
3046
  msgid "the following code is used for automatic error detection and only visible to admins"
3047
  msgstr ""
3048
 
3049
+ #: classes/frontend_checks.php:876
3050
+ #: classes/frontend_checks.php:891
3051
  msgid "Hi %s"
3052
  msgstr ""
3053
 
3054
+ #: classes/frontend_checks.php:876
3055
  msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
3056
  msgstr ""
3057
 
3058
+ #: classes/frontend_checks.php:876
3059
+ #: classes/frontend_checks.php:891
3060
  msgid "Is that correct?"
3061
  msgstr ""
3062
 
3063
+ #: classes/frontend_checks.php:878
3064
  msgid "All is fine"
3065
  msgstr ""
3066
 
3067
+ #: classes/frontend_checks.php:879
3068
  msgid "Something is off"
3069
  msgstr ""
3070
 
3071
+ #: classes/frontend_checks.php:881
3072
+ #: classes/frontend_checks.php:896
3073
  msgid "PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you."
3074
  msgstr ""
3075
 
3076
+ #: classes/frontend_checks.php:891
3077
  msgid "Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this page</strong>."
3078
  msgstr ""
3079
 
3080
+ #: classes/frontend_checks.php:893
3081
  msgid "This is fine"
3082
  msgstr ""
3083
 
3084
+ #: classes/frontend_checks.php:894
3085
  msgid "I expected something else"
3086
  msgstr ""
3087
 
3088
+ #: classes/frontend_checks.php:899
3089
+ #: classes/frontend_checks.php:907
3090
  msgid "Just click on your problem to learn more from our knowledge base."
3091
  msgstr ""
3092
 
3093
+ #: classes/frontend_checks.php:900
3094
  msgid "I want to disable AdSense Auto ads"
3095
  msgstr ""
3096
 
3097
+ #: classes/frontend_checks.php:901
3098
+ #: classes/frontend_checks.php:908
3099
  msgid "I don’t see any Auto ads"
3100
  msgstr ""
3101
 
3102
+ #: classes/frontend_checks.php:902
3103
  msgid "I only see blank space"
3104
  msgstr ""
3105
 
3106
+ #: classes/frontend_checks.php:903
3107
  msgid "I want to change the position of the ads"
3108
  msgstr ""
3109
 
3110
+ #: classes/frontend_checks.php:904
3111
  #: modules/gadsense/includes/class-network-adsense.php:226
3112
  msgid "Display Auto ads only on specific pages"
3113
  msgstr ""
3114
 
3115
+ #: classes/frontend_checks.php:909
3116
  msgid "How to look for the Auto ads code"
3117
  msgstr ""
3118
 
3119
+ #: classes/frontend_checks.php:910
3120
  msgid "I have another question or problem"
3121
  msgstr ""
3122
 
3123
+ #: classes/frontend_checks.php:913
3124
  msgid "Closing the message"
3125
  msgstr ""
3126
 
3230
  msgid "Individual Posts, Pages and Public Post Types"
3231
  msgstr ""
3232
 
3233
+ #: modules/ad-blocker/admin/admin.php:98
3234
  msgid "Ad blocker fix"
3235
  msgstr ""
3236
 
3237
+ #: modules/ad-blocker/admin/admin.php:152
3238
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:381
3239
  msgid "Unable to connect to the filesystem. Please confirm your credentials."
3240
  msgstr ""
3241
 
3242
+ #: modules/ad-blocker/admin/admin.php:167
3243
  msgid "The asset folder was rebuilt successfully"
3244
  msgstr ""
3245
 
3246
+ #: modules/ad-blocker/admin/admin.php:228
3247
  msgid "There is no writable upload folder"
3248
  msgstr ""
3249
 
3250
+ #: modules/ad-blocker/admin/admin.php:257
3251
  msgid "Unable to rename \"%s\" directory"
3252
  msgstr ""
3253
 
3254
+ #: modules/ad-blocker/admin/admin.php:273
3255
+ #: modules/ad-blocker/admin/admin.php:286
3256
+ #: modules/ad-blocker/admin/admin.php:303
3257
  msgid "Unable to copy assets to the \"%s\" directory"
3258
  msgstr ""
3259
 
3260
+ #: modules/ad-blocker/admin/admin.php:336
3261
+ #: modules/ad-blocker/admin/admin.php:421
3262
  msgid "We do not have direct write access to the \"%s\" directory"
3263
  msgstr ""
3264
 
3265
+ #: modules/ad-blocker/admin/admin.php:432
3266
  msgid "Unable to copy files to %s"
3267
  msgstr ""
3268
 
3352
  msgid "If your site is located on a subdomain, you need to add the following line to the ads.txt file of the root domain: %s"
3353
  msgstr ""
3354
 
3355
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:354
3356
  msgid "The ads.txt is now managed with Advanced Ads."
3357
  msgstr ""
3358
 
3359
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:399
3360
  msgid "Not the main blog"
3361
  msgstr ""
3362
 
3363
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:428
3364
  msgid "Could not delete the existing ads.txt file"
3365
  msgstr ""
3366
 
3367
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:431
3368
  msgid "Could not find the existing ads.txt file"
3369
  msgstr ""
3370
 
3766
  msgid "This ad code is from a different AdSense Account"
3767
  msgstr ""
3768
 
3769
+ #: modules/gadsense/includes/class-mapi.php:996
3770
  msgid "Invalid response body while retrieving account alerts"
3771
  msgstr ""
3772
 
3773
+ #: modules/gadsense/includes/class-mapi.php:1005
3774
  msgid "error while retrieving account alerts"
3775
  msgstr ""
3776
 
3777
+ #: modules/gadsense/includes/class-mapi.php:1176
3778
  msgid "No token provided. Token data needed to get account details."
3779
  msgstr ""
3780
 
3781
+ #: modules/gadsense/includes/class-mapi.php:1240
3782
  msgid "An error occurred while requesting account details."
3783
  msgstr ""
3784
 
3785
+ #: modules/gadsense/includes/class-mapi.php:1470
3786
  #: modules/gadsense/includes/class-network-adsense.php:516
3787
  msgctxt "AdSense ad type"
3788
  msgid "Matched Content"
3789
  msgstr ""
3790
 
3791
+ #: modules/gadsense/includes/class-mapi.php:1473
3792
  #: modules/gadsense/includes/class-network-adsense.php:517
3793
  msgctxt "AdSense ad type"
3794
  msgid "In-article"
3795
  msgstr ""
3796
 
3797
+ #: modules/gadsense/includes/class-mapi.php:1475
3798
  #: modules/gadsense/includes/class-network-adsense.php:518
3799
  msgctxt "AdSense ad type"
3800
  msgid "In-feed"
3801
  msgstr ""
3802
 
3803
+ #: modules/gadsense/includes/class-mapi.php:1480
3804
  #: modules/gadsense/includes/class-network-adsense.php:519
3805
  msgctxt "AdSense ad type"
3806
  msgid "Display"
3807
  msgstr ""
3808
 
3809
+ #: modules/gadsense/includes/class-mapi.php:1482
3810
  #: modules/gadsense/includes/class-network-adsense.php:520
3811
  msgctxt "AdSense ad type"
3812
  msgid "Link"
3813
  msgstr ""
3814
 
3815
+ #: modules/gadsense/includes/class-mapi.php:1669
3816
  msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
3817
  msgstr ""
3818
 
3819
  #. translators: 1:A link to the settings page translators: 2:The name of an ad network
3820
+ #: modules/gadsense/includes/class-mapi.php:1756
3821
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3822
  msgstr ""
3823
 
3996
 
3997
  #: modules/import-export/classes/XmlEncoder.php:61
3998
  #: modules/import-export/classes/XmlEncoder.php:64
3999
+ #: modules/import-export/classes/XmlEncoder.php:191
4000
+ #: modules/import-export/classes/XmlEncoder.php:194
4001
  msgid "The %s extension(s) is not loaded"
4002
  msgstr ""
4003
 
4006
  msgid "The data must be an array"
4007
  msgstr ""
4008
 
4009
+ #: modules/import-export/classes/XmlEncoder.php:147
 
 
 
 
 
4010
  msgctxt "import_export"
4011
  msgid "An unexpected value could not be serialized: %s"
4012
  msgstr ""
4013
 
4014
+ #: modules/import-export/classes/XmlEncoder.php:199
4015
  msgctxt "import_export"
4016
  msgid "Invalid XML data, it can not be empty"
4017
  msgstr ""
4018
 
4019
+ #: modules/import-export/classes/XmlEncoder.php:221
4020
  msgctxt "import_export"
4021
  msgid "XML error: %s"
4022
  msgstr ""
4030
  msgstr ""
4031
 
4032
  #: modules/import-export/views/page.php:24
4033
+ #: public/class-advanced-ads.php:762
4034
  msgid "Groups"
4035
  msgstr ""
4036
 
4133
  msgid "Install %1$sAdvanced Ads Pro%2$s to reload the ads instantly without an additional page request."
4134
  msgstr ""
4135
 
4136
+ #: public/class-advanced-ads.php:418
4137
  msgid "Advanced Ads Error following:"
4138
  msgstr ""
4139
 
4140
  #. translators: %s is an error message generated by the plugin.
4141
+ #: public/class-advanced-ads.php:422
4142
  msgid "Advanced Ads Error: %s"
4143
  msgstr ""
4144
 
4145
+ #: public/class-advanced-ads.php:752
4146
  msgctxt "ad group general name"
4147
  msgid "Ad Groups & Rotations"
4148
  msgstr ""
4149
 
4150
+ #: public/class-advanced-ads.php:754
4151
  msgid "Search Ad Groups"
4152
  msgstr ""
4153
 
4154
+ #: public/class-advanced-ads.php:755
4155
  msgid "All Ad Groups"
4156
  msgstr ""
4157
 
4158
+ #: public/class-advanced-ads.php:756
4159
  msgid "Parent Ad Groups"
4160
  msgstr ""
4161
 
4162
+ #: public/class-advanced-ads.php:757
4163
  msgid "Parent Ad Groups:"
4164
  msgstr ""
4165
 
4166
+ #: public/class-advanced-ads.php:758
4167
  msgid "Edit Ad Group"
4168
  msgstr ""
4169
 
4170
+ #: public/class-advanced-ads.php:759
4171
  msgid "Update Ad Group"
4172
  msgstr ""
4173
 
4174
+ #: public/class-advanced-ads.php:760
4175
  msgid "Add New Ad Group"
4176
  msgstr ""
4177
 
4178
+ #: public/class-advanced-ads.php:761
4179
  msgid "New Ad Groups Name"
4180
  msgstr ""
4181
 
4182
+ #: public/class-advanced-ads.php:763
4183
  msgid "No Ad Group found"
4184
  msgstr ""
4185
 
4186
+ #: public/class-advanced-ads.php:793
4187
  msgid "Edit Ad"
4188
  msgstr ""
4189
 
4190
+ #: public/class-advanced-ads.php:795
4191
  msgid "View"
4192
  msgstr ""
4193
 
4194
+ #: public/class-advanced-ads.php:796
4195
  msgid "View the Ad"
4196
  msgstr ""
4197
 
4198
+ #: public/class-advanced-ads.php:797
4199
  msgid "Search Ads"
4200
  msgstr ""
4201
 
4202
+ #: public/class-advanced-ads.php:798
4203
  msgid "No Ads found"
4204
  msgstr ""
4205
 
4206
+ #: public/class-advanced-ads.php:799
4207
  msgid "No Ads found in Trash"
4208
  msgstr ""
4209
 
4210
+ #: public/class-advanced-ads.php:800
4211
  msgid "Parent Ad"
4212
  msgstr ""
4213
 
4214
+ #: public/class-advanced-ads.php:970
4215
  msgctxt "label above ads"
4216
  msgid "Advertisements"
4217
  msgstr ""
lib/composer/autoload_classmap.php CHANGED
@@ -41,6 +41,7 @@ return array(
41
  'Advanced_Ads_Frontend_Notices' => $baseDir . '/classes/frontend-notices.php',
42
  'Advanced_Ads_Group' => $baseDir . '/classes/ad_group.php',
43
  'Advanced_Ads_Groups_List' => $baseDir . '/admin/includes/class-ad-groups-list.php',
 
44
  'Advanced_Ads_Model' => $baseDir . '/classes/ad-model.php',
45
  'Advanced_Ads_Overview_Widgets_Callbacks' => $baseDir . '/admin/includes/class-overview-widgets.php',
46
  'Advanced_Ads_Placements' => $baseDir . '/classes/ad_placements.php',
41
  'Advanced_Ads_Frontend_Notices' => $baseDir . '/classes/frontend-notices.php',
42
  'Advanced_Ads_Group' => $baseDir . '/classes/ad_group.php',
43
  'Advanced_Ads_Groups_List' => $baseDir . '/admin/includes/class-ad-groups-list.php',
44
+ 'Advanced_Ads_Inline_Css' => $baseDir . '/classes/inline-css.php',
45
  'Advanced_Ads_Model' => $baseDir . '/classes/ad-model.php',
46
  'Advanced_Ads_Overview_Widgets_Callbacks' => $baseDir . '/admin/includes/class-overview-widgets.php',
47
  'Advanced_Ads_Placements' => $baseDir . '/classes/ad_placements.php',
lib/composer/autoload_static.php CHANGED
@@ -42,6 +42,7 @@ class ComposerStaticInit_advanced_ads
42
  'Advanced_Ads_Frontend_Notices' => __DIR__ . '/../..' . '/classes/frontend-notices.php',
43
  'Advanced_Ads_Group' => __DIR__ . '/../..' . '/classes/ad_group.php',
44
  'Advanced_Ads_Groups_List' => __DIR__ . '/../..' . '/admin/includes/class-ad-groups-list.php',
 
45
  'Advanced_Ads_Model' => __DIR__ . '/../..' . '/classes/ad-model.php',
46
  'Advanced_Ads_Overview_Widgets_Callbacks' => __DIR__ . '/../..' . '/admin/includes/class-overview-widgets.php',
47
  'Advanced_Ads_Placements' => __DIR__ . '/../..' . '/classes/ad_placements.php',
42
  'Advanced_Ads_Frontend_Notices' => __DIR__ . '/../..' . '/classes/frontend-notices.php',
43
  'Advanced_Ads_Group' => __DIR__ . '/../..' . '/classes/ad_group.php',
44
  'Advanced_Ads_Groups_List' => __DIR__ . '/../..' . '/admin/includes/class-ad-groups-list.php',
45
+ 'Advanced_Ads_Inline_Css' => __DIR__ . '/../..' . '/classes/inline-css.php',
46
  'Advanced_Ads_Model' => __DIR__ . '/../..' . '/classes/ad-model.php',
47
  'Advanced_Ads_Overview_Widgets_Callbacks' => __DIR__ . '/../..' . '/admin/includes/class-overview-widgets.php',
48
  'Advanced_Ads_Placements' => __DIR__ . '/../..' . '/classes/ad_placements.php',
modules/ad-blocker/admin/admin.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
- class Advanced_Ads_Ad_Blocker_Admin
3
- {
 
 
4
  /**
5
  * Singleton instance of the plugin
6
  *
@@ -23,11 +25,11 @@ class Advanced_Ads_Ad_Blocker_Admin
23
  protected $search_file_pattern = '/(css|js|png|gif)$/';
24
 
25
  /**
26
- * Pattern to exclide directories from search. The string does not contain 'vendor/composer' or '/admin/' or /node_modules/
27
  *
28
  * @var string
29
  */
30
- protected $exclude_dir_pattern = '/(vendor\/composer|\/admin\/|\/node_modules\/)/';
31
 
32
  /**
33
  * Array, containing path information on the currently configured uploads directory
@@ -116,14 +118,14 @@ class Advanced_Ads_Ad_Blocker_Admin
116
  *
117
  * @param str $_setting_tab_id - id of the tab
118
  */
119
- public function add_asset_rebuild_form_wrap( $_setting_tab_id ) {
120
  if ( $_setting_tab_id == 'general' ) {
121
  $advads_options = Advanced_Ads::get_instance()->options();
122
  $use_adblocker = isset( $advads_options['use-adblocker'] );
123
  ?>
124
  <div id="advads-adblocker-wrapper" <?php if ( ! $use_adblocker ) { echo 'style="display:none"'; } ?>>
125
- <?php
126
- // not ajax yet, print the form
127
  $button_attrs = array( 'disabled' => 'disabled', 'autocomplete' => 'off' );
128
  include ADVADS_AB_BASE_PATH . 'admin/views/rebuild_form.php';
129
  ?>
@@ -178,7 +180,7 @@ class Advanced_Ads_Ad_Blocker_Admin
178
  // at this point we do not need ftp/ssh credentials anymore
179
  $form_post_fields = array_intersect_key( $_POST, array( 'advads_ab_assign_new_folder' => false ) );
180
 
181
- $this->create_dummy_plugin( $form_post_fields );
182
 
183
  if ( $error_messages = $this->error_messages->get_error_messages() ) {
184
  foreach ( $error_messages as $error_message ) {
@@ -208,7 +210,7 @@ class Advanced_Ads_Ad_Blocker_Admin
208
  }
209
 
210
  return $this->options;
211
- }
212
 
213
 
214
  /**
@@ -258,31 +260,31 @@ class Advanced_Ads_Ad_Blocker_Admin
258
  }
259
  $new_options['folder_name'] = $new_options_error['folder_name'] = $new_folder_name;
260
 
261
- }
262
 
263
  $is_rebuild_needed = count( $this->get_assets() );
264
 
265
  // we have an error while the method is being executed
266
- update_option( ADVADS_AB_SLUG, $new_options_error );
267
-
268
  if ( $is_rebuild_needed ) {
269
  $lookup_table = $this->copy_assets( $new_options['folder_name'], $need_assign_new_name );
270
  if ( ! $lookup_table ) {
271
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
272
- $this->error_messages->add( 'create_dummy_3', $message);
273
  return false;
274
  }
275
  $new_options['lookup_table'] = $lookup_table;
276
  }
277
-
278
  } else {
279
  // we have an error while the method is being executed
280
- update_option( ADVADS_AB_SLUG, $new_options_error );
281
- // old folder does not exist, let's create it
282
- $lookup_table = $this->copy_assets( $new_options['folder_name'] );
283
  if ( ! $lookup_table ) {
284
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
285
- $this->error_messages->add( 'create_dummy_4', $message);
286
  return false;
287
  }
288
  $new_options['lookup_table'] = $lookup_table;
@@ -296,10 +298,10 @@ class Advanced_Ads_Ad_Blocker_Admin
296
  // we have an error while the method is being executed
297
  update_option( ADVADS_AB_SLUG, $new_options_error );
298
  // Copy the assets
299
- $lookup_table = $this->copy_assets( $new_options['folder_name'] );
300
  if ( ! $lookup_table ) {
301
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
302
- $this->error_messages->add( 'create_dummy_5', $message);
303
  return false;
304
  }
305
  $new_options['lookup_table'] = $lookup_table;
@@ -310,11 +312,11 @@ class Advanced_Ads_Ad_Blocker_Admin
310
  }
311
 
312
  /**
313
- * Copy all assets (JS/CSS) to the magic directory
314
  *
315
- * @param string $folder_name destination folder
316
- * @param bool $need_assign_new_name true if we need to assign new random names to assets
317
- * @return bool/array - bool false on failure, array lookup table on success
318
  */
319
  public function copy_assets( $folder_name, $need_assign_new_name = false ) {
320
  global $wp_filesystem;
@@ -351,8 +353,8 @@ class Advanced_Ads_Ad_Blocker_Admin
351
  }
352
 
353
 
354
- // lookup_table contains associations between the original path of the asset and it path within our magic folder
355
- // i.e: [advanced-ads-layer/admin/assets/css/admin.css] => array( path => /12/34/56/78/1347107783.css, size => 99 )
356
  $assets = $this->get_assets();
357
  if ( $need_assign_new_name ) {
358
  $lookup_table = array();
@@ -365,7 +367,7 @@ class Advanced_Ads_Ad_Blocker_Admin
365
  $not_rename_assets = array( 'public', 'assets', 'js', 'css', 'fancybox', 'advanced.js', 'jquery.fancybox-1.3.4.css' );
366
 
367
  // Loop through all the found assets
368
- foreach( $assets as $file => $filesize ) {
369
  if ( ! file_exists( $file ) ) {
370
  continue;
371
  }
@@ -425,7 +427,7 @@ class Advanced_Ads_Ad_Blocker_Admin
425
 
426
  $file_normalized = Advanced_Ads_Filesystem::get_instance()->normalize_path( trailingslashit( dirname( $file ) ) ) . basename( $file );
427
 
428
- // Copy the file to our new magic directory
429
  if ( ! $wp_filesystem->copy( $file_normalized, $new_abs_file, true, FS_CHMOD_FILE ) ) {
430
  $message = sprintf( __( 'Unable to copy files to %s', 'advanced-ads' ), $asset_path_normalized );
431
  $this->error_messages->add( 'copy_assets_5', $message);
@@ -433,8 +435,8 @@ class Advanced_Ads_Ad_Blocker_Admin
433
  }
434
 
435
  $lookup_table[ $first_cleanup ] = array(
436
- 'path' => $new_rel_file,
437
- 'size' => $filesize,
438
  );
439
  }
440
 
@@ -444,8 +446,8 @@ class Advanced_Ads_Ad_Blocker_Admin
444
  /**
445
  * This function recursively searches for assets
446
  *
447
- * @param string $dir The directory to search in
448
- * @return array with pairs: abs_filename => size
449
  */
450
  public function recursive_search_assets( $dir ) {
451
  $assets = array();
@@ -457,7 +459,7 @@ class Advanced_Ads_Ad_Blocker_Admin
457
  $assets = array_merge( $assets, $this->recursive_search_assets( $file ) );
458
  }
459
  elseif ( is_file( $file ) && preg_match( $this->search_file_pattern, $file ) ) {
460
- $assets[$file] = @filesize( $file );
461
  }
462
  }
463
  }
@@ -466,7 +468,7 @@ class Advanced_Ads_Ad_Blocker_Admin
466
  }
467
 
468
  /**
469
- * Returns new or modified assets and their sizes
470
  *
471
  * @return array
472
  */
@@ -480,14 +482,14 @@ class Advanced_Ads_Ad_Blocker_Admin
480
  $asset_path = trailingslashit( trailingslashit( $this->upload_dir['basedir'] ) . $this->options['folder_name'] ) ;
481
  $new_files = array();
482
 
483
- foreach ( $new_files_info as $abs_file => $size ) {
484
  $rel_file = str_replace( WP_PLUGIN_DIR , '', $abs_file );
485
 
486
- if ( ! isset( $this->options['lookup_table'][$rel_file]['size'] ) ||
487
- $this->options['lookup_table'][$rel_file]['size'] !== $size ||
488
  ! file_exists( $asset_path . $this->options['lookup_table'][$rel_file]['path'] )
489
  ) {
490
- $new_files[$abs_file] = $size;
491
  }
492
  }
493
 
1
  <?php
2
+ /**
3
+ * Ad blocker admin functionality.
4
+ */
5
+ class Advanced_Ads_Ad_Blocker_Admin {
6
  /**
7
  * Singleton instance of the plugin
8
  *
25
  protected $search_file_pattern = '/(css|js|png|gif)$/';
26
 
27
  /**
28
+ * Pattern to exclide directories from search. The string does not contain '/vendor/' or '/lib/' or '/admin/' or /node_modules/
29
  *
30
  * @var string
31
  */
32
+ protected $exclude_dir_pattern = '/(\/vendor\/|\/lib\/|\/admin\/|\/node_modules\/)/';
33
 
34
  /**
35
  * Array, containing path information on the currently configured uploads directory
118
  *
119
  * @param str $_setting_tab_id - id of the tab
120
  */
121
+ public function add_asset_rebuild_form_wrap( $_setting_tab_id ) {
122
  if ( $_setting_tab_id == 'general' ) {
123
  $advads_options = Advanced_Ads::get_instance()->options();
124
  $use_adblocker = isset( $advads_options['use-adblocker'] );
125
  ?>
126
  <div id="advads-adblocker-wrapper" <?php if ( ! $use_adblocker ) { echo 'style="display:none"'; } ?>>
127
+ <?php
128
+ // not ajax yet, print the form
129
  $button_attrs = array( 'disabled' => 'disabled', 'autocomplete' => 'off' );
130
  include ADVADS_AB_BASE_PATH . 'admin/views/rebuild_form.php';
131
  ?>
180
  // at this point we do not need ftp/ssh credentials anymore
181
  $form_post_fields = array_intersect_key( $_POST, array( 'advads_ab_assign_new_folder' => false ) );
182
 
183
+ $this->create_dummy_plugin( $form_post_fields );
184
 
185
  if ( $error_messages = $this->error_messages->get_error_messages() ) {
186
  foreach ( $error_messages as $error_message ) {
210
  }
211
 
212
  return $this->options;
213
+ }
214
 
215
 
216
  /**
260
  }
261
  $new_options['folder_name'] = $new_options_error['folder_name'] = $new_folder_name;
262
 
263
+ }
264
 
265
  $is_rebuild_needed = count( $this->get_assets() );
266
 
267
  // we have an error while the method is being executed
268
+ update_option( ADVADS_AB_SLUG, $new_options_error );
269
+
270
  if ( $is_rebuild_needed ) {
271
  $lookup_table = $this->copy_assets( $new_options['folder_name'], $need_assign_new_name );
272
  if ( ! $lookup_table ) {
273
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
274
+ $this->error_messages->add( 'create_dummy_3', $message);
275
  return false;
276
  }
277
  $new_options['lookup_table'] = $lookup_table;
278
  }
279
+
280
  } else {
281
  // we have an error while the method is being executed
282
+ update_option( ADVADS_AB_SLUG, $new_options_error );
283
+ // old folder does not exist, let's create it
284
+ $lookup_table = $this->copy_assets( $new_options['folder_name'] );
285
  if ( ! $lookup_table ) {
286
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
287
+ $this->error_messages->add( 'create_dummy_4', $message);
288
  return false;
289
  }
290
  $new_options['lookup_table'] = $lookup_table;
298
  // we have an error while the method is being executed
299
  update_option( ADVADS_AB_SLUG, $new_options_error );
300
  // Copy the assets
301
+ $lookup_table = $this->copy_assets( $new_options['folder_name'] );
302
  if ( ! $lookup_table ) {
303
  $message = sprintf( __( 'Unable to copy assets to the "%s" directory', 'advanced-ads' ), $new_options['folder_name'] );
304
+ $this->error_messages->add( 'create_dummy_5', $message);
305
  return false;
306
  }
307
  $new_options['lookup_table'] = $lookup_table;
312
  }
313
 
314
  /**
315
+ * Copy all assets (JS/CSS) to the magic directory.
316
  *
317
+ * @param string $folder_name Destination folder.
318
+ * @param bool $need_assign_new_name True if we need to assign new random names to assets.
319
+ * @return bool/array Bool false on failure, array lookup table on success.
320
  */
321
  public function copy_assets( $folder_name, $need_assign_new_name = false ) {
322
  global $wp_filesystem;
353
  }
354
 
355
 
356
+ // Lookup_table contains associations between the original path of the asset and it path within our magic folder.
357
+ // I.e: [advanced-ads-layer/admin/assets/css/admin.css] => array( path => /12/34/56/78/1347107783.css, mtime => 99 ).
358
  $assets = $this->get_assets();
359
  if ( $need_assign_new_name ) {
360
  $lookup_table = array();
367
  $not_rename_assets = array( 'public', 'assets', 'js', 'css', 'fancybox', 'advanced.js', 'jquery.fancybox-1.3.4.css' );
368
 
369
  // Loop through all the found assets
370
+ foreach ( $assets as $file => $filemtime ) {
371
  if ( ! file_exists( $file ) ) {
372
  continue;
373
  }
427
 
428
  $file_normalized = Advanced_Ads_Filesystem::get_instance()->normalize_path( trailingslashit( dirname( $file ) ) ) . basename( $file );
429
 
430
+ // Copy the file to our new magic directory,
431
  if ( ! $wp_filesystem->copy( $file_normalized, $new_abs_file, true, FS_CHMOD_FILE ) ) {
432
  $message = sprintf( __( 'Unable to copy files to %s', 'advanced-ads' ), $asset_path_normalized );
433
  $this->error_messages->add( 'copy_assets_5', $message);
435
  }
436
 
437
  $lookup_table[ $first_cleanup ] = array(
438
+ 'path' => $new_rel_file,
439
+ 'mtime' => $filemtime,
440
  );
441
  }
442
 
446
  /**
447
  * This function recursively searches for assets
448
  *
449
+ * @param string $dir The directory to search in.
450
+ * @return Array with pairs: abs_filename => mtime.
451
  */
452
  public function recursive_search_assets( $dir ) {
453
  $assets = array();
459
  $assets = array_merge( $assets, $this->recursive_search_assets( $file ) );
460
  }
461
  elseif ( is_file( $file ) && preg_match( $this->search_file_pattern, $file ) ) {
462
+ $assets[ $file ] = @filemtime( $file );
463
  }
464
  }
465
  }
468
  }
469
 
470
  /**
471
+ * Returns new or modified assets and their mtimes.
472
  *
473
  * @return array
474
  */
482
  $asset_path = trailingslashit( trailingslashit( $this->upload_dir['basedir'] ) . $this->options['folder_name'] ) ;
483
  $new_files = array();
484
 
485
+ foreach ( $new_files_info as $abs_file => $mtime ) {
486
  $rel_file = str_replace( WP_PLUGIN_DIR , '', $abs_file );
487
 
488
+ if ( ! isset( $this->options['lookup_table'][ $rel_file ]['mtime'] ) ||
489
+ $this->options['lookup_table'][ $rel_file ]['mtime'] !== $mtime ||
490
  ! file_exists( $asset_path . $this->options['lookup_table'][$rel_file]['path'] )
491
  ) {
492
+ $new_files[ $abs_file ] = $mtime;
493
  }
494
  }
495
 
modules/ad-blocker/main.php CHANGED
@@ -5,7 +5,7 @@ function advanced_ads_load_adblocker() {
5
 
6
  // only load if not already existing (maybe included from another plugin)
7
  if ( defined( 'ADVADS_AB_BASE_PATH' ) ) {
8
- return ;
9
  }
10
 
11
  // load basic path to the plugin
@@ -15,14 +15,10 @@ function advanced_ads_load_adblocker() {
15
 
16
  Advanced_Ads_Ad_Blocker::get_instance();
17
 
18
- $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
19
-
20
- if ( is_admin() && ! $is_ajax ) {
21
  Advanced_Ads_Ad_Blocker_Admin::get_instance();
22
  }
23
  }
24
  }
25
 
26
  add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_load_adblocker' );
27
-
28
-
5
 
6
  // only load if not already existing (maybe included from another plugin)
7
  if ( defined( 'ADVADS_AB_BASE_PATH' ) ) {
8
+ return;
9
  }
10
 
11
  // load basic path to the plugin
15
 
16
  Advanced_Ads_Ad_Blocker::get_instance();
17
 
18
+ if ( is_admin() && ! wp_doing_ajax() ) {
 
 
19
  Advanced_Ads_Ad_Blocker_Admin::get_instance();
20
  }
21
  }
22
  }
23
 
24
  add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_load_adblocker' );
 
 
modules/adblock-finder/main.php CHANGED
@@ -2,10 +2,8 @@
2
 
3
  class_exists( 'Advanced_Ads', false ) || exit();
4
 
5
- $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
6
-
7
  if ( ! is_admin() ) {
8
  new Advanced_Ads_Adblock_Finder;
9
- } elseif ( ! $is_ajax ) {
10
  new Advanced_Ads_Adblock_Finder_Admin;
11
- }
2
 
3
  class_exists( 'Advanced_Ads', false ) || exit();
4
 
 
 
5
  if ( ! is_admin() ) {
6
  new Advanced_Ads_Adblock_Finder;
7
+ } elseif ( ! wp_doing_ajax() ) {
8
  new Advanced_Ads_Adblock_Finder_Admin;
9
+ }
modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php CHANGED
@@ -290,11 +290,10 @@ class Advanced_Ads_Ads_Txt_Admin {
290
  }
291
 
292
  $url = $url ? $url : home_url( '/' );
293
- $is_ajax = defined( 'DOING_AJAX') && DOING_AJAX;
294
  $key = self::get_transient_key();
295
  $transient = get_transient( $key );
296
 
297
- if ( ! $is_ajax || ! doing_action( self::ACTION ) ) {
298
  return isset( $transient[ $func ] ) ? $transient[ $func ] : null;
299
  }
300
 
@@ -450,5 +449,3 @@ class Advanced_Ads_Ads_Txt_Admin {
450
  }
451
 
452
  }
453
-
454
-
290
  }
291
 
292
  $url = $url ? $url : home_url( '/' );
 
293
  $key = self::get_transient_key();
294
  $transient = get_transient( $key );
295
 
296
+ if ( ! wp_doing_ajax() || ! doing_action( self::ACTION ) ) {
297
  return isset( $transient[ $func ] ) ? $transient[ $func ] : null;
298
  }
299
 
449
  }
450
 
451
  }
 
 
modules/gadsense/includes/class-mapi.php CHANGED
@@ -929,6 +929,7 @@ class Advanced_Ads_AdSense_MAPI {
929
  if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
930
  die;
931
  }
 
932
  $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
933
  if ( false !== wp_verify_nonce( $nonce, 'mapi-alerts' ) ) {
934
  $account = stripslashes( $_POST['account'] );
@@ -936,9 +937,17 @@ class Advanced_Ads_AdSense_MAPI {
936
 
937
  // the account exists.
938
  if ( isset( $options['accounts'][ $account ] ) && self::has_token( $account ) ) {
939
- $access_token = $this->get_access_token( $account );
940
  $url = str_replace( 'PUBID', $account, self::ALERTS_URL );
941
 
 
 
 
 
 
 
 
 
942
  // the token is valid.
943
  if ( ! isset( $access_token['msg'] ) ) {
944
  $headers = array(
@@ -1358,11 +1367,15 @@ class Advanced_Ads_AdSense_MAPI {
1358
  if ( array() === $alerts && $has_token ) {
1359
  $refresh_alerts = true;
1360
  }
1361
- if ( $has_token && is_array( $alerts ) && isset( $alerts['lastCheck'] ) ) {
1362
- // check weekly for alerts.
1363
- if ( time() > absint( $alerts['lastCheck'] ) + 3600 * 24 * 7 ) {
1364
  $refresh_alerts = true;
1365
  }
 
 
 
 
1366
  }
1367
  if ( $refresh_alerts ) {
1368
  $nonce = wp_create_nonce( 'mapi-alerts' );
@@ -1381,6 +1394,7 @@ class Advanced_Ads_AdSense_MAPI {
1381
  action: 'advads-mapi-get-alerts',
1382
  account: '<?php echo wp_strip_all_tags( $adsense_id ); ?>',
1383
  nonce: '<?php echo wp_strip_all_tags( $nonce ); ?>',
 
1384
  },
1385
  success:function(response, status, XHR){
1386
  if ( 'undefined' != typeof response.alerts ) {
929
  if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
930
  die;
931
  }
932
+
933
  $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
934
  if ( false !== wp_verify_nonce( $nonce, 'mapi-alerts' ) ) {
935
  $account = stripslashes( $_POST['account'] );
937
 
938
  // the account exists.
939
  if ( isset( $options['accounts'][ $account ] ) && self::has_token( $account ) ) {
940
+ $access_token = self::get_access_token( $account );
941
  $url = str_replace( 'PUBID', $account, self::ALERTS_URL );
942
 
943
+ if ( isset( $_POST['inlineAttempt'] ) ) {
944
+ if ( ! is_array( $options['accounts'][ $account ]['alerts'] ) ) {
945
+ $options['accounts'][ $account ]['alerts'] = array();
946
+ }
947
+ $options['accounts'][ $account ]['alerts']['inlineAttempt'] = time();
948
+ update_option( self::OPTNAME, $options );
949
+ }
950
+
951
  // the token is valid.
952
  if ( ! isset( $access_token['msg'] ) ) {
953
  $headers = array(
1367
  if ( array() === $alerts && $has_token ) {
1368
  $refresh_alerts = true;
1369
  }
1370
+ if ( $has_token && is_array( $alerts ) ) {
1371
+ // Check weekly for alerts.
1372
+ if ( isset( $alerts['lastCheck'] ) && time() > absint( $alerts['lastCheck'] ) + DAY_IN_SECONDS * 7 ) {
1373
  $refresh_alerts = true;
1374
  }
1375
+ // Only try to get the alerts in the background once a day.
1376
+ if ( isset( $alerts['inlineAttempt'] ) && time() < $alerts['inlineAttempt'] + DAY_IN_SECONDS ) {
1377
+ $refresh_alerts = false;
1378
+ }
1379
  }
1380
  if ( $refresh_alerts ) {
1381
  $nonce = wp_create_nonce( 'mapi-alerts' );
1394
  action: 'advads-mapi-get-alerts',
1395
  account: '<?php echo wp_strip_all_tags( $adsense_id ); ?>',
1396
  nonce: '<?php echo wp_strip_all_tags( $nonce ); ?>',
1397
+ inlineAttempt: 1,
1398
  },
1399
  success:function(response, status, XHR){
1400
  if ( 'undefined' != typeof response.alerts ) {
modules/gadsense/main.php CHANGED
@@ -12,7 +12,7 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
12
  Advanced_Ads_AdSense_MAPI::get_instance();
13
  }
14
 
15
- if ( ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) && is_admin() ) {
16
  Advanced_Ads_AdSense_Admin::get_instance();
17
  } else {
18
  Advanced_Ads_AdSense_Public::get_instance();
@@ -22,4 +22,4 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
22
  $network->register();
23
  }
24
  add_action( 'advanced-ads-plugin-loaded', 'gadsense_init' );
25
- }
12
  Advanced_Ads_AdSense_MAPI::get_instance();
13
  }
14
 
15
+ if ( ! wp_doing_ajax() && is_admin() ) {
16
  Advanced_Ads_AdSense_Admin::get_instance();
17
  } else {
18
  Advanced_Ads_AdSense_Public::get_instance();
22
  $network->register();
23
  }
24
  add_action( 'advanced-ads-plugin-loaded', 'gadsense_init' );
25
+ }
modules/gadsense/public/public.php CHANGED
@@ -98,6 +98,33 @@ class Advanced_Ads_AdSense_Public {
98
  );
99
  $script_src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  // inject page-level header code.
102
  include GADSENSE_BASE_PATH . 'public/templates/page-level.php';
103
  }
98
  );
99
  $script_src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
100
 
101
+ /**
102
+ * Allows to override the page-level code.
103
+ *
104
+ * The Pro add-on uses this filter to inject a drop-in replacement for the page-level header code.
105
+ *
106
+ * @param string $code Existing page level code.
107
+ * @param array $parameters {
108
+ * Parameters of the AdSense code.
109
+ *
110
+ * @type string $client_id The Google AdSense client ID.
111
+ * @type bool $top_anchor AdSense anchor ad on top of pages.
112
+ * @type string $top_anchor_code The code for top anchor ads.
113
+ * @type string $script_src AdSense script url.
114
+ * }
115
+ */
116
+ $custom_code = apply_filters(
117
+ 'advanced-ads-gadsense-page-level-code',
118
+ '',
119
+ compact( array( 'client_id', 'top_anchor', 'top_anchor_code', 'script_src' ) )
120
+ );
121
+
122
+ if ( $custom_code ) {
123
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the snippet has already been escaped.
124
+ echo $custom_code;
125
+ return;
126
+ }
127
+
128
  // inject page-level header code.
129
  include GADSENSE_BASE_PATH . 'public/templates/page-level.php';
130
  }
modules/import-export/classes/XmlEncoder.php CHANGED
@@ -99,8 +99,6 @@ class Advanced_Ads_XmlEncoder
99
  $append = $this->appendNode($parentNode, $data, 'item', $key);
100
  } elseif ( $this->isElementNameValid($key) ) {
101
  $append = $this->appendNode($parentNode, $data, $key);
102
- } else {
103
- throw new UnexpectedValueException( sprintf( _x( 'The key %s is not valid', 'import_export', 'advanced-ads' ), $key ) );
104
  }
105
  }
106
 
@@ -322,4 +320,4 @@ class Advanced_Ads_XmlEncoder
322
  return $text;
323
  }
324
 
325
- }
99
  $append = $this->appendNode($parentNode, $data, 'item', $key);
100
  } elseif ( $this->isElementNameValid($key) ) {
101
  $append = $this->appendNode($parentNode, $data, $key);
 
 
102
  }
103
  }
104
 
320
  return $text;
321
  }
322
 
323
+ }
public/assets/js/ready.js CHANGED
@@ -1,27 +1,30 @@
1
  /**
2
- * based on domready (c) Dustin Diaz 2014 - License MIT
3
- * https://github.com/ded/domready
4
- */
5
- advanced_ads_ready = ( function() {
6
- var fns = [], listener
7
- , doc = typeof document === 'object' && document
8
- , hack = doc && doc.documentElement.doScroll
9
- , domContentLoaded = 'DOMContentLoaded'
10
- , loaded = doc && (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState)
 
11
 
12
- if (!loaded && doc){
13
- listener = function () {
14
- doc.removeEventListener(domContentLoaded, listener)
15
- window.removeEventListener( "load", listener );
16
- loaded = 1
17
- while (listener = fns.shift()) listener()
 
 
 
 
 
 
18
  }
19
-
20
- doc.addEventListener(domContentLoaded, listener )
21
- window.addEventListener( 'load', listener );
22
- }
23
 
24
- return function (fn) {
25
- loaded ? setTimeout(fn, 0) : fns.push(fn)
26
- }
27
  } )();
1
  /**
2
+ * Based on domready (c) Dustin Diaz 2014 - License MIT
3
+ * https://github.com/ded/domready
4
+ */
5
+ advanced_ads_ready = ( function () {
6
+ var fns = [],
7
+ listener,
8
+ doc = typeof document === 'object' && document,
9
+ hack = doc && doc.documentElement.doScroll,
10
+ domContentLoaded = 'DOMContentLoaded',
11
+ loaded = doc && ( hack ? /^loaded|^c/ : /^loaded|^i|^c/ ).test( doc.readyState );
12
 
13
+ if ( ! loaded && doc ) {
14
+ listener = function () {
15
+ doc.removeEventListener( domContentLoaded, listener );
16
+ window.removeEventListener( 'load', listener );
17
+ loaded = 1;
18
+ while ( listener = fns.shift() ) {
19
+ listener();
20
+ }
21
+ };
22
+
23
+ doc.addEventListener( domContentLoaded, listener );
24
+ window.addEventListener( 'load', listener );
25
  }
 
 
 
 
26
 
27
+ return function ( fn ) {
28
+ loaded ? setTimeout( fn, 0 ) : fns.push( fn );
29
+ };
30
  } )();
public/assets/js/ready.min.js ADDED
@@ -0,0 +1 @@
 
1
+ advanced_ads_ready=function(){var e,t=[],n="object"==typeof document&&document,d=n&&n.documentElement.doScroll,o="DOMContentLoaded",a=n&&(d?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return!a&&n&&(e=function(){for(n.removeEventListener(o,e),window.removeEventListener("load",e),a=1;e=t.shift();)e()},n.addEventListener(o,e),window.addEventListener("load",e)),function(e){a?setTimeout(e,0):t.push(e)}}();
public/class-advanced-ads.php CHANGED
@@ -152,7 +152,7 @@ class Advanced_Ads {
152
  add_action( 'init', array( $this, 'wp_init' ) );
153
 
154
  // only when not doing ajax.
155
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
156
  Advanced_Ads_Ajax::get_instance();
157
  }
158
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
@@ -200,7 +200,8 @@ class Advanced_Ads {
200
  */
201
  public function wp_plugins_loaded() {
202
  // register hook for global constants.
203
- add_action( 'wp', array( $this, 'set_disabled_constant' ) );
 
204
  add_action( 'rest_api_init', array( $this, 'set_disabled_constant' ) );
205
 
206
  // setup default ad types.
@@ -502,7 +503,7 @@ class Advanced_Ads {
502
  // Check if ads are disabled in secondary queries.
503
  if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
504
  // this function was called by ajax (in secondary query).
505
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
506
  return $content;
507
  }
508
  // get out of wp_router_page post type if ads are disabled in secondary queries.
@@ -649,7 +650,7 @@ class Advanced_Ads {
649
 
650
  // check if ads are disabled in secondary queries.
651
  // and this is not main query and this is not ajax (because main query does not exist in ajax but ad needs to be shown).
652
- if ( ! empty( $options['disabled-ads']['secondary'] ) && ! $this->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
653
  return false;
654
  }
655
 
152
  add_action( 'init', array( $this, 'wp_init' ) );
153
 
154
  // only when not doing ajax.
155
+ if ( wp_doing_ajax() ) {
156
  Advanced_Ads_Ajax::get_instance();
157
  }
158
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
200
  */
201
  public function wp_plugins_loaded() {
202
  // register hook for global constants.
203
+ // Wait until BuddyPress assigns `WP_Query->is_404` back to `false`.
204
+ add_action( 'template_redirect', array( $this, 'set_disabled_constant' ), 11 );
205
  add_action( 'rest_api_init', array( $this, 'set_disabled_constant' ) );
206
 
207
  // setup default ad types.
503
  // Check if ads are disabled in secondary queries.
504
  if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
505
  // this function was called by ajax (in secondary query).
506
+ if ( wp_doing_ajax() ) {
507
  return $content;
508
  }
509
  // get out of wp_router_page post type if ads are disabled in secondary queries.
650
 
651
  // check if ads are disabled in secondary queries.
652
  // and this is not main query and this is not ajax (because main query does not exist in ajax but ad needs to be shown).
653
+ if ( ! empty( $options['disabled-ads']['secondary'] ) && ! $this->is_main_query() && ! wp_doing_ajax() ) {
654
  return false;
655
  }
656
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Advanced Ads – Ad Manager & AdSense ===
2
  Contributors: webzunft, advancedads
3
  Tags: ads, ad manager, ad rotation, adsense, banner
4
- Requires at least: 4.6
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
- Stable tag: 1.24.2
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.24.2 =
321
 
322
  - fix authenticated (i.e. logged-in) DOM-based XSS vulnerability while creating jQuery object from user input in Safari and IE
1
  === Advanced Ads – Ad Manager & AdSense ===
2
  Contributors: webzunft, advancedads
3
  Tags: ads, ad manager, ad rotation, adsense, banner
4
+ Requires at least: 4.9
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
+ Stable tag: 1.25.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.25.0 =
321
+
322
+ - show ad label event when ad wrapper is now shown
323
+ - add filter `advanced-ads-ajax-ad-select-arguments` to modify arguments of AJAX ad selection
324
+ - display ads on BuddyPress pages when no ads allowed on 404 pages
325
+ - Ad blocker fix: do not copy assets from "vendor" and "lib" folders
326
+ - Ad blocker fix: compare assets based on `filemtime` instead of `filesize`
327
+ - bump minimal require WP core version to 4.9
328
+ - allow to add a replacement for AdSense page-level code
329
+
330
  = 1.24.2 =
331
 
332
  - fix authenticated (i.e. logged-in) DOM-based XSS vulnerability while creating jQuery object from user input in Safari and IE