Advanced Ads - Version 1.16

Version Description

  • moved all users to the new content injection logic and removed opt-out option
  • use new Auto ads code for everyone who didnt enable the "Disable top anchor ads" option
  • hide "Disable top anchor ads" option to users who didnt enable it
  • the Ad Admin user role can now also save the plugin settings
  • hide Wizard for existing ads
  • removed warning about WP Autoterms plugin after a fix by the plugin authors
  • some work for Conditions to improve compatibility with an upcoming Pro feature
  • fixed multiple wrappers occurred as result of using nested ads
  • fixed missing index issue on 404 pages for logged-in admins
  • fixed AJAX/PHP error 403 on Settings page
  • fixed layout issue that happened when "If>So Dynamic Content" plugin was active
Download this release

Release Info

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

Code changes from version 1.15 to 1.16

admin/assets/css/admin.css CHANGED
@@ -117,14 +117,14 @@ h2.hndle .advads-hndlelinks a + a, #advads_overview_adsense_stats .advads-hndlel
117
  height: 20em;
118
  }
119
 
120
- .post-type-advanced_ads #advanced-ad-conditions {
121
  text-align: left;
122
  }
123
  .post-type-advanced_ads h5 { font-size: 1.2em; margin: 1em 0 .5em; }
124
- .post-type-advanced_ads .advads-conditions-table label { margin-right: 1em; }
125
- .post-type-advanced_ads .advads-conditions-table td, .post-type-advanced_ads .advads-conditions-table th { padding: 10px 0 10px 10px; }
126
- .post-type-advanced_ads .advads-conditions-table .advanced-ads-display-condition-set label { float: left; margin-right: -1px; }
127
- .post-type-advanced_ads .advads-conditions-table .ui-widget { font-size: inherit; }
128
  #advads-visitor-conditions-new select,
129
  .advads-conditions-new select { text-transform: capitalize; }
130
  .advads-display-conditions-remove + h5 { display: inline-block; margin-top: 0; margin-left: 1em; }
@@ -144,13 +144,13 @@ select + .advads-conditions-single { display: inline-block; }
144
  .advads-conditions-table .advads-conditions-connector .advads-error-message { display: none; }
145
 
146
  .post-type-advanced_ads #advads-ad-content-plain { width: 100%; }
147
- .post-type-advanced_ads .advads-conditions-single th { vertical-align: top; }
148
- .post-type-advanced_ads .advads-conditions-single { margin: 0; padding: 0 10px 0 0; line-height: 1em; }
149
- .post-type-advanced_ads select + .advads-conditions-single { padding-left: 10px }
150
- .post-type-advanced_ads .advads-conditions-single.disabled { display: none; opacity: .5; }
151
- .post-type-advanced_ads .advads-conditions-table .advads-conditions-single.advads-buttonset label { margin: 0 -1px .3em 0; padding: 0 .5em; background: #f7f7f7; height: 26px; line-height: 26px; color: #555; border: 1px solid #ccc; border-radius: 0; font-family: inherit; box-shadow: none; }
152
- .post-type-advanced_ads .advads-conditions-single.advads-buttonset label span { margin: 0; padding: 0; line-height: inherit; }
153
- .post-type-advanced_ads .advads-conditions-postid-buttons { padding: 0 10px; }
154
  .advads-conditions-postids-show-search { margin-left: .5em !important; }
155
  .advads-conditions-postids-list li { background: #F1F1F1; padding: 3px; }
156
  .advads-conditions-postids-list .remove { margin-right: 1em; font-size: .9em; }
@@ -160,7 +160,7 @@ select + .advads-conditions-single { display: inline-block; }
160
  .advads-buttonset label span { margin: 0; padding: 0; }
161
 
162
  .advads-buttonset .ui-state-active,
163
- .advads-buttonset .ui-button.ui-state-active { border-color: #0074a2 !important; background: #2ea2cc !important; color: #fff !important; box-shadow: none; }
164
 
165
  #ad-display-box .advads-conditions-terms-show-search { height: 22px; line-height: 22px; font-weight: bold; font-size: 1.5em; }
166
  .advads-conditions-terms-search { display: none; }
@@ -175,12 +175,12 @@ select + .advads-conditions-single { display: inline-block; }
175
  /* option lists */
176
  .advads-option-list { overflow: hidden; }
177
  .advads-option-list > .label { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; color: #444; text-align: left; font-size: 100%; }
178
- .advads-option-list > .label + div { display: block; float: left; padding: 10px; }
179
  .advads-option-list > hr { clear: both; float: none; display: block; }
180
 
181
  .advads-option { clear: both; float: none; display: block; overflow: hidden; }
182
  .advads-option > span { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; }
183
- .advads-option > span + div { padding: 10px; overflow: hidden; }
184
  .advads-option > span + div > label + input[type="radio"] { margin-left: 1em; }
185
  .advads-option > span + div label + label { margin-left: 1em; }
186
  .advads-option > span + div ul { margin: 0; }
@@ -197,7 +197,7 @@ select + .advads-conditions-single { display: inline-block; }
197
  #advads-exp-timestampdiv { padding-top: 5px; line-height: 23px; }
198
  #advads-exp-timestampdiv p { margin: 8px 0 6px; }
199
  #advads-exp-timestampdiv input { border-width: 1px; border-style: solid; }
200
- #advads-exp-timestampdiv select { height: 21px; line-height: 14px; padding: 0; vertical-align: top; font-size: 12px; }
201
  #advads-exp-aa, #advads-exp-jj, #advads-exp-hh, #advads-exp-mn { padding: 1px; font-size: 12px; }
202
  #advads-exp-jj, #advads-exp-hh, #advads-exp-mn { width: 2em; }
203
  #advads-exp-aa { width: 3.4em; }
@@ -312,7 +312,8 @@ tr:hover .on-hover { display: block; }
312
  WELCOME PANEL
313
  */
314
  .advads-admin-notice[data-notice="nl_intro"] { border: 4px solid #0073aa; }
315
- .advads-admin-notice button.notice-dismiss:before { color: #0073aa !important; } /* needed, because some other CSS seems to override it into white */
 
316
  #aa-welcome-panel h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.2; }
317
  #aa-welcome-panel h3 { margin: 1.33em 0; font-size: 16px; }
318
  #aa-welcome-panel li { font-size: 14px; }
@@ -322,7 +323,7 @@ tr:hover .on-hover { display: block; }
322
  #aa-welcome-panel .aa-welcome-panel-column { width: 32%; min-width: 200px; float: left; }
323
  #aa-welcome-panel .aa-welcome-panel-column:first-child { width: 36%; }
324
  #aa-welcome-panel .aa-welcome-panel-column ul { margin: 0.8em 1em 1em 0; }
325
- #aa-welcome-panel .aa-welcome-panel-column li { line-height: 16px; list-style-type: none; padding: 0 0 8px; }
326
  #aa-welcome-panel .aa-welcome-panel-starter-setup p { max-width: 300px; }
327
  .aa-welcome-panel-column p { margin-top: 7px; color: #444; }
328
  .aa-welcome-panel-column .button { margin-left: 0; }
@@ -370,8 +371,8 @@ tr:hover .on-hover { display: block; }
370
  /**
371
  - SUPPORT PAGE
372
  -*/
373
- .advads-support-form input { width: 300px; height: 1.5em; line-height: 1.5em; font-size: 1.5em; border: 1px solid #0085ba; border-radius: 5px; }
374
- .advads-support-form input.button { width: 100px; height: 1.5em; line-height: 1.5em; font-size: 1.5em; border: 1px solid #0085ba; border-radius: 5px; }
375
 
376
  /**
377
  - PLUGIN LIST
@@ -458,8 +459,8 @@ tr:hover .on-hover { display: block; }
458
  }
459
 
460
  /* Pro Pitch List */
461
- .advads-pro-pitch { max-width: 500px; float: left; padding: 1em; margin-right: 1em; line-height: 2em; font-size: 14px; text-transform: capitalize; }
462
- .advads-pro-pitch .dashicons { line-height: 1.4em; }
463
  #advads-tracking-pitch .advads-pro-pitch { float: none; }
464
 
465
  /* manual link without underline (e.g., when icon is used )*/
@@ -533,3 +534,7 @@ div#advads-gadsense-box{
533
  tr.advads-clickable-row:hover{
534
  cursor: pointer;
535
  }
 
 
 
 
117
  height: 20em;
118
  }
119
 
120
+ #advanced-ad-conditions {
121
  text-align: left;
122
  }
123
  .post-type-advanced_ads h5 { font-size: 1.2em; margin: 1em 0 .5em; }
124
+ .advads-conditions-table label { margin-right: 1em; }
125
+ .advads-conditions-table td, .advads-conditions-table th { padding: 10px 0 10px 10px; }
126
+ .advads-conditions-table .advanced-ads-display-condition-set label { float: left; margin-right: -1px; }
127
+ .advads-conditions-table .ui-widget { font-size: inherit; }
128
  #advads-visitor-conditions-new select,
129
  .advads-conditions-new select { text-transform: capitalize; }
130
  .advads-display-conditions-remove + h5 { display: inline-block; margin-top: 0; margin-left: 1em; }
144
  .advads-conditions-table .advads-conditions-connector .advads-error-message { display: none; }
145
 
146
  .post-type-advanced_ads #advads-ad-content-plain { width: 100%; }
147
+ .advads-conditions-single th { vertical-align: top; }
148
+ .advads-conditions-single { margin: 0; padding: 0 10px 0 0; line-height: 1em; }
149
+ select + .advads-conditions-single { padding-left: 10px }
150
+ .advads-conditions-single.disabled { display: none; opacity: .5; }
151
+ .advads-conditions-table .advads-conditions-single.advads-buttonset label { margin: 0 -1px .3em 0; padding: 0 .5em; background: #f7f7f7; height: 26px; line-height: 26px; color: #555; border: 1px solid #ccc; border-radius: 0; font-family: inherit; box-shadow: none; }
152
+ .advads-conditions-single.advads-buttonset label span { margin: 0; padding: 0; line-height: inherit; }
153
+ .advads-conditions-postid-buttons { padding: 0 10px; }
154
  .advads-conditions-postids-show-search { margin-left: .5em !important; }
155
  .advads-conditions-postids-list li { background: #F1F1F1; padding: 3px; }
156
  .advads-conditions-postids-list .remove { margin-right: 1em; font-size: .9em; }
160
  .advads-buttonset label span { margin: 0; padding: 0; }
161
 
162
  .advads-buttonset .ui-state-active,
163
+ .advads-buttonset .ui-button.ui-state-active { border-color: #0074a2 !important; background: #2ea2cc !important; color: #fff !important; box-shadow: none; border: 0; }
164
 
165
  #ad-display-box .advads-conditions-terms-show-search { height: 22px; line-height: 22px; font-weight: bold; font-size: 1.5em; }
166
  .advads-conditions-terms-search { display: none; }
175
  /* option lists */
176
  .advads-option-list { overflow: hidden; }
177
  .advads-option-list > .label { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; color: #444; text-align: left; font-size: 100%; }
178
+ .advads-option-list > .label + div { display: block; float: left; padding: 10px; max-width: calc(100% - (10em + 40px)); }
179
  .advads-option-list > hr { clear: both; float: none; display: block; }
180
 
181
  .advads-option { clear: both; float: none; display: block; overflow: hidden; }
182
  .advads-option > span { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; }
183
+ .advads-option > span + div { padding: 10px; overflow: hidden; margin-left: 10em; }
184
  .advads-option > span + div > label + input[type="radio"] { margin-left: 1em; }
185
  .advads-option > span + div label + label { margin-left: 1em; }
186
  .advads-option > span + div ul { margin: 0; }
197
  #advads-exp-timestampdiv { padding-top: 5px; line-height: 23px; }
198
  #advads-exp-timestampdiv p { margin: 8px 0 6px; }
199
  #advads-exp-timestampdiv input { border-width: 1px; border-style: solid; }
200
+ #advads-exp-timestampdiv select { height: 21px; line-height: 1.1667; padding: 0; vertical-align: top; font-size: 12px; }
201
  #advads-exp-aa, #advads-exp-jj, #advads-exp-hh, #advads-exp-mn { padding: 1px; font-size: 12px; }
202
  #advads-exp-jj, #advads-exp-hh, #advads-exp-mn { width: 2em; }
203
  #advads-exp-aa { width: 3.4em; }
312
  WELCOME PANEL
313
  */
314
  .advads-admin-notice[data-notice="nl_intro"] { border: 4px solid #0073aa; }
315
+ .advads-admin-notice .notice-dismiss:before { color: #0073aa !important; } /* needed, because some other CSS seems to override it into white */
316
+ .advads-admin-notice .notice-dismiss { text-decoration: none; }
317
  #aa-welcome-panel h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.2; }
318
  #aa-welcome-panel h3 { margin: 1.33em 0; font-size: 16px; }
319
  #aa-welcome-panel li { font-size: 14px; }
323
  #aa-welcome-panel .aa-welcome-panel-column { width: 32%; min-width: 200px; float: left; }
324
  #aa-welcome-panel .aa-welcome-panel-column:first-child { width: 36%; }
325
  #aa-welcome-panel .aa-welcome-panel-column ul { margin: 0.8em 1em 1em 0; }
326
+ #aa-welcome-panel .aa-welcome-panel-column li { line-height: 1.14; list-style-type: none; padding: 0 0 8px; }
327
  #aa-welcome-panel .aa-welcome-panel-starter-setup p { max-width: 300px; }
328
  .aa-welcome-panel-column p { margin-top: 7px; color: #444; }
329
  .aa-welcome-panel-column .button { margin-left: 0; }
371
  /**
372
  - SUPPORT PAGE
373
  -*/
374
+ .advads-support-form input { width: 300px; height: 1.5em; line-height: 1; font-size: 1.5em; border: 1px solid #0085ba; border-radius: 5px; }
375
+ .advads-support-form input.button { width: 100px; height: 1.5em; line-height: 1; font-size: 1.5em; border: 1px solid #0085ba; border-radius: 5px; }
376
 
377
  /**
378
  - PLUGIN LIST
459
  }
460
 
461
  /* Pro Pitch List */
462
+ .advads-pro-pitch { max-width: 500px; float: left; padding: 1em; margin-right: 1em; line-height: 2; font-size: 14px; text-transform: capitalize; }
463
+ .advads-pro-pitch .dashicons { line-height: 1.4; }
464
  #advads-tracking-pitch .advads-pro-pitch { float: none; }
465
 
466
  /* manual link without underline (e.g., when icon is used )*/
534
  tr.advads-clickable-row:hover{
535
  cursor: pointer;
536
  }
537
+
538
+ /* Set max-width for wide select elements */
539
+ .advads-conditions-select-wrap { display: inline-block; max-width: 100%; }
540
+ .advads-conditions-select-wrap select { width: 100%; }
admin/assets/js/admin-global.js CHANGED
@@ -7,8 +7,13 @@ jQuery( document ).ready(function () {
7
  * ADMIN NOTICES
8
  */
9
  // close button
 
 
 
 
10
  // .advads-notice-dismiss class can be used to add a custom close button (e.g., link)
11
- jQuery(document).on('click', '.advads-admin-notice button.notice-dismiss, .advads-admin-notice .advads-notice-dismiss', function(){
 
12
  var messagebox = jQuery(this).parents('.advads-admin-notice');
13
  if( messagebox.attr('data-notice') === undefined) return;
14
 
@@ -37,28 +42,39 @@ jQuery( document ).ready(function () {
37
  messagebox.fadeOut();
38
  });
39
  });
40
- // autoresponder button
41
- jQuery('.advads-notices-button-subscribe').click(function(){
42
- if(this.dataset.notice === undefined) return;
43
- var messagebox = jQuery(this).parents('.advads-admin-notice');
44
- messagebox.find('p').append( '<span class="spinner advads-spinner"></span>' );
45
 
46
- var query = {
47
- action: 'advads-subscribe-notice',
48
- notice: this.dataset.notice,
49
- nonce: advadsglobal.ajax_nonce
50
- };
51
- // send and close message
52
- jQuery.post(ajaxurl, query, function (r) {
53
- if(r === '1'){
54
- messagebox.fadeOut();
55
- } else {
56
- messagebox.find('p').html(r);
57
- messagebox.removeClass('updated').addClass('error');
58
  }
59
- });
 
 
 
 
 
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  });
 
62
  /**
63
  * Functions for Ad Health Notifications in the backend
64
  */
@@ -266,7 +282,7 @@ function advads_display_ad_health_notices(){
266
  function advads_push_notice( key, attr = '' ){
267
 
268
  var query = {
269
- action: 'advads-ad-health-notice-push',
270
  key: key,
271
  attr: attr,
272
  nonce: advadsglobal.ajax_nonce
@@ -335,4 +351,4 @@ function advads_ad_health_reload_show_link(){
335
  } else {
336
  show_link.show();
337
  }
338
- }
7
  * ADMIN NOTICES
8
  */
9
  // close button
10
+ // remove duplicate close buttons
11
+ jQuery(window).on('load', function () {
12
+ jQuery('a.notice-dismiss').next('button.notice-dismiss').remove();
13
+ });
14
  // .advads-notice-dismiss class can be used to add a custom close button (e.g., link)
15
+ jQuery(document).on('click', '.advads-admin-notice .notice-dismiss, .advads-notice-dismiss', function(event){
16
+ event.preventDefault();
17
  var messagebox = jQuery(this).parents('.advads-admin-notice');
18
  if( messagebox.attr('data-notice') === undefined) return;
19
 
42
  messagebox.fadeOut();
43
  });
44
  });
 
 
 
 
 
45
 
46
+ // autoresponder button
47
+ jQuery('.advads-notices-button-subscribe').on('click', function () {
48
+ if (this.dataset.notice === undefined) {
49
+ return;
 
 
 
 
 
 
 
 
50
  }
51
+ var messageboxes = jQuery(this).parents('.advads-admin-notice');
52
+ if (!messageboxes.length) {
53
+ return;
54
+ }
55
+ var $messagebox = jQuery(messageboxes[0]);
56
+ jQuery('<span class="spinner advads-spinner"></span>').insertAfter(this);
57
 
58
+ var query = {
59
+ action: 'advads-subscribe-notice',
60
+ notice: this.dataset.notice,
61
+ nonce: advadsglobal.ajax_nonce
62
+ };
63
+ // send and replace with server message
64
+ jQuery.post(ajaxurl, query)
65
+ .success(function (response) {
66
+ $messagebox.children('p').html(response.data.message);
67
+ $messagebox.addClass('notice-success notice');
68
+ })
69
+ .fail(function (response) {
70
+ $messagebox.children('p').html(response.responseJSON.data.message);
71
+ $messagebox.addClass('notice-error notice');
72
+ })
73
+ .always(function () {
74
+ $messagebox.removeClass('notice-info');
75
+ });
76
  });
77
+
78
  /**
79
  * Functions for Ad Health Notifications in the backend
80
  */
282
  function advads_push_notice( key, attr = '' ){
283
 
284
  var query = {
285
+ action: 'advads-ad-health-notice-push-adminui',
286
  key: key,
287
  attr: attr,
288
  nonce: advadsglobal.ajax_nonce
351
  } else {
352
  show_link.show();
353
  }
354
+ }
admin/assets/js/admin.js CHANGED
@@ -580,7 +580,10 @@ jQuery( document ).ready( function ( $ ) {
580
 
581
  // Find Adsense Auto Ads inside ad content.
582
  var ad_content = jQuery( 'textarea[name=advanced_ad\\[content\\]]' ).html()
583
- if ( ad_content && ad_content.indexOf( 'enable_page_level_ads' ) !== -1 ) {
 
 
 
584
  advads_show_adsense_auto_ads_warning()
585
  }
586
 
580
 
581
  // Find Adsense Auto Ads inside ad content.
582
  var ad_content = jQuery( 'textarea[name=advanced_ad\\[content\\]]' ).html()
583
+ if (
584
+ (ad_content && ad_content.indexOf('enable_page_level_ads') !== -1)
585
+ || /script[^>]+data-ad-client=/.test(ad_content)
586
+ ) {
587
  advads_show_adsense_auto_ads_warning()
588
  }
589
 
admin/includes/class-ad-type.php CHANGED
@@ -758,15 +758,8 @@ class Advanced_Ads_Admin_Ad_Type {
758
 
759
  global $post;
760
 
761
- // disable wizard for already existing ads.
762
- $options = Advanced_Ads_Plugin::get_instance()->internal_options();
763
- $installed = isset( $options['installed'] ) ? $options['installed'] : 0;
764
- if ( 'edit' === $post->filter && Advanced_Ads_Plugin::get_group_by_url( null, 'b' ) && $installed > 1573128000 ) {
765
- return false;
766
- }
767
-
768
- // true if the wizard was never started or closed.
769
- return ( ( ! $hide_wizard && 'edit' !== $post->filter ) || 'false' === $hide_wizard ) ? true : false;
770
  }
771
 
772
  /**
758
 
759
  global $post;
760
 
761
+ // true the ad already exists, if the wizard was never started or closed.
762
+ return ( 'edit' !== $post->filter && ( ! $hide_wizard || 'false' === $hide_wizard ) ) ? true : false;
 
 
 
 
 
 
 
763
  }
764
 
765
  /**
admin/includes/class-licenses.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- defined( 'ABSPATH' ) || exit;
3
 
4
  /**
5
- * handle add-on licenses
6
  */
7
  class Advanced_Ads_Admin_Licenses {
8
  /**
@@ -12,533 +12,582 @@ class Advanced_Ads_Admin_Licenses {
12
  */
13
  protected static $instance = null;
14
 
 
 
 
15
  private function __construct() {
16
  if ( ! defined( 'DOING_AJAX' ) ) {
17
  add_action( 'load-plugins.php', array( $this, 'check_plugin_licenses' ) );
18
  }
19
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
20
-
21
- // todo: check if this is loaded late enough and all add-ons are registered already
22
- add_filter( 'upgrader_pre_download', array( $this, 'addon_upgrade_filter' ), 10, 3 );
23
  }
24
-
25
  /**
26
- * actions and filter available after all plugins are initialized
27
  */
28
  public function wp_plugins_loaded() {
29
-
30
- // check for add-on updates
31
- add_action( 'admin_init', array($this, 'add_on_updater'), 1 );
32
  }
33
 
34
  /**
35
  * Return an instance of this class.
36
  *
37
- * @return object A single instance of this class.
38
  */
39
  public static function get_instance() {
40
  // If the single instance hasn't been set, set it now.
41
- if ( null == self::$instance ) {
42
- self::$instance = new self;
43
  }
44
 
45
  return self::$instance;
46
  }
47
-
48
  /**
49
- * initiate plugin checks
50
- *
51
  * @since 1.7.12
52
  */
53
- public function check_plugin_licenses(){
54
-
55
- if( is_multisite() ){
56
  return;
57
  }
58
 
59
- // gather all add-on plugin files
60
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
61
- foreach( $add_ons as $_add_on ){
62
-
63
- // check license status
64
- if( $this->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
65
- // register warning
66
  $plugin_file = plugin_basename( $_add_on['path'] );
67
- add_action( 'after_plugin_row_' . $plugin_file, array( $this, 'add_plugin_list_license_notice'), 10, 3 );
68
  }
69
  }
70
  }
71
-
72
  /**
73
- * add a row below add-ons with an invalid license on the plugin list
74
- *
75
- * @since 1.7.12
76
  * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
77
  * @param array $plugin_data An array of plugin data.
78
- * @param string $status Status of the plugin. Defaults are 'All', 'Active',
79
  * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
80
  * 'Drop-ins', 'Search'.
 
 
81
  * @todo make this work on multisite as well
82
  */
83
- public function add_plugin_list_license_notice( $plugin_file, $plugin_data, $status ){
84
-
85
- echo '<tr class="advads-plugin-update-tr plugin-update-tr active"><td class="plugin-update colspanchange" colspan="3"><div class="update-message notice inline notice-warning notice-alt"><p>'
86
- . sprintf( __( '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>.', 'advanced-ads' ), $plugin_data['Title'], admin_url( 'admin.php?page=advanced-ads-settings#top#licenses' ) )
87
- . '</p></div></td></tr>';
 
 
88
 
89
- }
90
-
91
 
92
  /**
93
- * save license key
 
 
 
 
 
94
  *
 
95
  * @since 1.2.0
96
- * @param string $addon string with addon identifier
97
  */
98
  public function activate_license( $addon = '', $plugin_name = '', $options_slug = '', $license_key = '' ) {
99
 
100
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
101
  return __( 'Error while trying to register the license. Please contact support.', 'advanced-ads' );
102
  }
103
-
104
  $license_key = esc_attr( trim( $license_key ) );
105
- if ( '' == $license_key ) {
106
  return __( 'Please enter a valid license key', 'advanced-ads' );
107
  }
108
-
109
- if ( has_filter( 'advanced_ads_license_'. $options_slug ) ) {
110
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
111
  }
112
-
113
  /**
114
- * we need to remove the mltlngg_get_url_translated filter added by Multilanguage by BestWebSoft, https://wordpress.org/plugins/multilanguage/
115
  * it causes the URL to look much different than it originally is
116
  * we are adding it again later
117
- *
118
  */
119
  remove_filter( 'home_url', 'mltlngg_get_url_translated' );
120
-
121
  $api_params = array(
122
- 'edd_action'=> 'activate_license',
123
- 'license' => $license_key,
124
- 'item_name' => urlencode( $plugin_name ),
125
- 'url' => home_url()
126
  );
127
-
128
  /**
129
- * re-add the filter removed from above
130
  */
131
  if ( function_exists( 'mltlngg_get_url_translated' ) ) {
132
  add_filter( 'home_url', 'mltlngg_get_url_translated' );
133
  }
134
-
135
  // Call the custom API.
136
- $response = wp_remote_post( ADVADS_URL, array(
137
- 'timeout' => 15,
138
- 'sslverify' => false,
139
- 'body' => $api_params
140
- ) );
141
-
142
- // show license debug output if constant is set
143
- if( defined( 'ADVANCED_ADS_SHOW_LICENSE_RESPONSE' ) ){
 
 
 
144
  return '<pre>' . print_r( $response, true ) . '</pre>';
145
  }
146
-
147
  /**
148
- * send the user to our support when his request is blocked by our firewall
149
  */
150
- if( $error = $this->blocked_by_firewall( $response) ){
151
  return $error;
152
  }
153
 
154
  if ( is_wp_error( $response ) ) {
155
  $body = wp_remote_retrieve_body( $response );
156
- if ( $body ){
157
- return $body;
158
  } else {
159
- // return print_r($response, true);
160
- $curl = curl_version();
161
- return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' ) . " (cURL {$curl['version']})";
162
  }
163
- }
164
 
165
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
166
- // save license status
167
- if( !empty( $license_data->license ) ){
168
- update_option($options_slug . '-license-status', $license_data->license, false);
169
- }
170
- if( !empty( $license_data->expires ) ){
171
- update_option($options_slug . '-license-expires', $license_data->expires, false);
172
- }
173
-
174
- // display activation problem
175
- if( !empty( $license_data->error )) {
176
- // user friendly texts for errors
177
- $errors = array(
178
- 'license_not_activable' => __( 'This is the bundle license key.', 'advanced-ads' ),
179
- 'item_name_mismatch' => __( 'This is not the correct key for this add-on.', 'advanced-ads' ),
180
- 'no_activations_left' => __( 'There are no activations left.', 'advanced-ads' )
181
- );
182
- $error = isset( $errors[ $license_data->error ] ) ? $errors[ $license_data->error ] : $license_data->error;
183
- if( 'expired' === $license_data->error ){
184
- return 'ex';
185
- } else {
186
- if( isset($errors[ $license_data->error ] ) ) {
187
- return $error;
188
  } else {
189
- return sprintf( __( 'License is invalid. Reason: %s', 'advanced-ads' ), $error);
 
 
 
 
 
 
 
 
190
  }
191
- }
192
  } else {
193
- // reset license_expires admin notification
194
- Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_expires' ); // this one is no longer added, but we keep the check here in case it is still in the queue for some users
195
- Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_expired' ); // this one is no longer added, but we keep the check here in case it is still in the queue for some users
196
- Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_invalid' );
197
- // save license key
198
- $licenses = $this->get_licenses();
199
- $licenses[ $addon ] = $license_key;
200
- $this->save_licenses( $licenses );
201
  }
202
 
203
  return 1;
204
  }
205
-
206
  /**
207
- * check if a request was blocked by our firewall
208
  */
209
- public function blocked_by_firewall( $response ){
210
  $response_code = wp_remote_retrieve_response_code( $response );
211
- if( '403' == $response_code ){
212
- $blocked_information = '–';
213
- if( isset( $response['body'] ) ){
214
- // look for the IP address in this line: `<td><span>95.90.238.103</span></td>`
215
- $pattern = '/<span>([.0-9]*)<\/span>/';
216
- $matches = array();
217
- preg_match( $pattern, $response['body'], $matches );
218
- $ip = isset( $matches[ 1 ] ) ? $matches[ 1 ] : '–';
219
- $blocked_information = 'IP: ' . $ip;
220
- }
221
-
222
- // translators: %s is a list of server information like IP address. Just keep it as is.
223
- return sprintf( __( 'Your request was blocked by our firewall. Please send us the following information to unblock you: %s.', 'advanced-ads' ), $blocked_information );
224
- }
225
-
226
  return false;
227
  }
228
-
229
  /**
230
- * check if a specific license key was already activated for the current page
231
- *
232
- * @since 1.6.17
 
 
 
233
  * @return bool true if already activated
 
234
  * @deprecated since version 1.7.2 because it only checks if a key is valid, not if the url registered with that key
235
  */
236
- public function check_license( $license_key = '', $plugin_name = '', $options_slug = '' ){
237
-
238
- if ( has_filter( 'advanced_ads_license_'. $options_slug ) ) {
239
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
240
  }
241
-
242
  $api_params = array(
243
  'edd_action' => 'check_license',
244
- 'license' => $license_key,
245
- 'item_name' => urlencode( $plugin_name )
246
  );
247
- $response = wp_remote_get( add_query_arg( $api_params, ADVADS_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
248
  if ( is_wp_error( $response ) ) {
249
  return false;
250
  }
251
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
252
-
253
- // if this license is still valid
254
- if( $license_data->license == 'valid' ) {
255
- update_option($options_slug . '-license-expires', $license_data->expires, false);
256
- update_option($options_slug . '-license-status', $license_data->license, false);
257
-
258
  return true;
259
  }
 
260
  return false;
261
- }
262
-
263
  /**
264
- * deactivate license key
265
  *
 
 
 
 
 
266
  * @since 1.6.11
267
- * @param string $addon string with addon identifier
268
  */
269
  public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
270
 
271
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
272
  return __( 'Error while trying to disable the license. Please contact support.', 'advanced-ads' );
273
- }
274
 
275
- $licenses = $this->get_licenses();
276
- $license_key = isset($licenses[$addon]) ? $licenses[$addon] : '';
277
 
278
- if ( has_filter( 'advanced_ads_license_'. $options_slug ) ) {
279
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
280
  }
281
 
282
  $api_params = array(
283
  'edd_action' => 'deactivate_license',
284
  'license' => $license_key,
285
- 'item_name' => urlencode( $plugin_name )
 
 
 
 
 
 
 
 
 
286
  );
287
- // Send the remote request
288
- $response = wp_remote_post( ADVADS_URL, array(
289
- 'body' => $api_params,
290
- 'timeout' => 15,
291
- 'sslverify' => false,
292
- ) );
293
-
294
- // show license debug output if constant is set
295
- if( defined( 'ADVANCED_ADS_SHOW_LICENSE_RESPONSE' ) ){
296
  return '<pre>' . print_r( $response, true ) . '</pre>';
297
  }
298
-
299
  if ( is_wp_error( $response ) ) {
300
  $body = wp_remote_retrieve_body( $response );
301
- if ( $body ){
302
- return $body;
303
  } else {
304
- return __( 'License couldn’t be deactivated. Please try again later.', 'advanced-ads' );
305
  }
306
  }
307
 
308
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
309
-
310
  /**
311
- * send the user to our support when his request is blocked by our firewall
312
  */
313
- if( $error = $this->blocked_by_firewall( $response) ){
314
  return $error;
315
  }
316
-
317
- // save license status
318
-
319
- // remove data
320
- if( 'deactivated' === $license_data->license ) {
321
- delete_option( $options_slug . '-license-status' );
322
- delete_option( $options_slug . '-license-expires' );
323
- } elseif( 'failed' === $license_data->license ) {
324
- update_option($options_slug . '-license-expires', $license_data->expires, false);
325
- update_option($options_slug . '-license-status', $license_data->license, false);
326
- return 'ex';
327
  } else {
328
- return __( 'License couldn’t be deactivated. Please try again later.', 'advanced-ads' );
329
  }
330
 
331
  return 1;
332
  }
333
-
334
  /**
335
- * get license keys for all add-ons
336
- *
 
337
  * @since 1.6.15
338
- * @return arr $licenses licenses
339
  */
340
- public function get_licenses(){
341
-
342
- $licenses = array();
343
-
344
- if( is_multisite() ){
345
- // if multisite, get option from main blog
346
- global $current_site;
347
- $licenses = get_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', array() );
348
-
349
- } else {
350
- $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
351
- }
352
-
353
- return $licenses;
354
  }
355
-
356
  /**
357
- * save license keys for all add-ons
358
- *
 
 
359
  * @since 1.7.2
360
- * @return arr $licenses licenses
361
  */
362
- public function save_licenses( $licenses = array() ){
363
-
364
- if( is_multisite() ){
365
- // if multisite, get option from main blog
366
- global $current_site;
367
- update_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', $licenses );
368
- } else {
369
- update_option( ADVADS_SLUG . '-licenses', $licenses );
370
- }
371
  }
372
-
373
  /**
374
- * get license status of an add-on
375
- *
 
 
 
376
  * @since 1.6.15
377
- * @param str $slug slug of the add-on
378
- * @return str $status license status, e.g. "valid" or "invalid"
379
  */
380
- public function get_license_status( $slug = '' ){
381
-
382
- $status = false;
383
-
384
- if( is_multisite() ){
385
- // if multisite, get option from main blog
386
- global $current_site;
387
- $status = get_blog_option( $current_site->blog_id, $slug . '-license-status', false);
388
- } else {
389
- $status = get_option( $slug . '-license-status', false);
390
- }
391
-
392
- return $status;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  }
394
-
395
  /**
396
- * get license expired value of an add-on
397
- *
 
 
 
398
  * @since 1.6.15
399
- * @param str $slug slug of the add-on
400
- * @return str $date expiry date of an add-on
401
  */
402
- public function get_license_expires( $slug = '' ){
403
-
404
- $date = false;
405
-
406
- if( is_multisite() ){
407
- // if multisite, get option from main blog
408
- global $current_site;
409
- $date = get_blog_option( $current_site->blog_id, $slug . '-license-expires', false);
410
- } else {
411
- $date = get_option( $slug . '-license-expires', false);
412
- }
413
-
414
- return $date;
415
  }
416
-
417
-
418
- /*
419
- * add-on updater
420
  *
421
  * @since 1.5.7
422
- */
423
- public function add_on_updater(){
424
-
425
- // ignore, if not main blog
426
- if( ( is_multisite() && ! is_main_site() ) ){
427
- return;
428
  }
429
 
430
  /**
431
- * list of registered add ons
432
  * contains:
433
- * name
434
- * version
435
- * path
436
- * options_slug
437
- * short option slug (=key)
438
  */
439
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
440
 
441
- if( $add_ons === array() ) {
442
- return;
443
  }
444
-
445
- // load license keys
446
- $licenses = get_option(ADVADS_SLUG . '-licenses', array());
447
 
448
- foreach( $add_ons as $_add_on_key => $_add_on ){
 
 
 
449
 
450
- // check if a license expired over time
451
  $expiry_date = $this->get_license_expires( $_add_on['options_slug'] );
452
- $now = time();
453
- if( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ){
454
- // remove license status
455
  delete_option( $_add_on['options_slug'] . '-license-status' );
456
  continue;
457
  }
458
 
459
- // check status
460
- if( $this->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
461
  continue;
462
  }
463
 
464
- // retrieve our license key
465
- $license_key = isset($licenses[$_add_on_key]) ? $licenses[$_add_on_key] : '';
466
 
467
- // setup the updater
468
- if( $license_key ){
469
-
470
- // register filter to set EDD transient to 86,400 seconds (day) instead of 3,600 (hours)
471
- $slug = basename( $_add_on['path'], '.php' );
472
  $transient_key = md5( serialize( $slug . $license_key ) );
473
-
474
- // add_filter( 'expiration_of_transient_' . $transient_key, array( $this, 'set_expiration_of_update_transient' ) );
475
  add_filter( 'pre_update_option_' . $transient_key, array( $this, 'set_expiration_of_update_option' ) );
476
-
477
- new ADVADS_SL_Plugin_Updater( ADVADS_URL, $_add_on['path'], array(
478
- 'version' => $_add_on['version'],
479
- 'license' => $license_key,
480
- 'item_name' => $_add_on['name'],
481
- 'author' => 'Thomas Maier'
482
- )
 
 
 
483
  );
484
  }
485
  }
486
- }
487
-
488
  /**
489
- * set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
490
- *
491
  * @deprecated since version 1.7.14 – not using transient anymore, but option
492
  */
493
- public function set_expiration_of_update_transient( $expiration ){
494
 
495
  return 86400;
496
  }
497
-
498
  /**
499
- * set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
500
- *
 
501
  * @since 1.7.14
502
  */
503
- public function set_expiration_of_update_option( $value ){
504
 
505
  $value['timeout'] = time() + 86400;
506
-
507
  return $value;
508
  }
509
-
510
  /**
511
- * add custom messages to plugin updater
512
- *
513
- * @param type $reply
514
- * @param type $package
515
- * @param type $updater
516
- * @return type
 
 
 
517
  */
518
  public function addon_upgrade_filter( $reply, $package, $updater ) {
519
-
520
- if( isset( $updater->skin->plugin ) ){
521
- $plugin_file = $updater->skin->plugin;
522
- } elseif ( isset( $updater->skin->plugin_info['Name'] ) ){
523
- $add_on = $this->get_installed_add_on_by_name( $updater->skin->plugin_info['Name'] );
524
- $plugin_file = plugin_basename( $add_on['path'] );
525
- }
526
-
527
- if( isset( $plugin_file ) && $plugin_file ){
528
- // hides the download url, but makes debugging harder
529
- // $updater->strings['downloading_package'] = __( 'Downloading updated version...', 'advanced-ads' );
530
- //$updater->skin->feedback( 'downloading_package' );
531
-
532
- // if AJAX; show direct update link as first possible solution
533
- if( defined( 'DOING_AJAX' ) ){
534
- $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
535
- $updater->strings['download_failed'] = sprintf(__( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
536
- } else {
537
- $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' );
538
- }
539
-
540
- }
541
-
542
  /*$res = $updater->fs_connect( array( WP_CONTENT_DIR ) );
543
  if ( ! $res ) {
544
  return new WP_Error( 'no_credentials', __( "Error! Can't connect to filesystem", 'advanced-ads' ) );
@@ -546,48 +595,50 @@ class Advanced_Ads_Admin_Licenses {
546
 
547
  return $reply;
548
  }
549
-
550
  /**
551
- * search if a name is in the add-on array and return the add-on data of it
552
- *
553
- * @param str $name name of an add-on
554
- * @return arr array with the add-on data
 
555
  */
556
- private function get_installed_add_on_by_name( $name = '' ){
557
-
558
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
559
-
560
- if( is_array( $add_ons ) ) {
561
- foreach ( $add_ons as $key => $_add_on ) {
562
- if ($_add_on['name'] === $name ) {
563
- return $_add_on;
 
564
  }
565
- }
566
  }
 
567
  return null;
568
  }
569
-
570
  /**
571
- * check if any license is valid
572
  * can be used to display information for any Pro user only, like link to direct support
573
  */
574
- public static function any_license_valid(){
575
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
576
-
577
- if( $add_ons === array() ) {
578
  return false;
579
  }
580
 
581
- foreach( $add_ons as $_add_on ){
582
- $status = Advanced_Ads_Admin_Licenses::get_instance()->get_license_status( $_add_on['options_slug'] );
 
 
 
583
 
584
- // check expiry date
585
- $expiry_date = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $_add_on['options_slug'] );
 
586
 
587
- if( ( $expiry_date && strtotime( $expiry_date ) > time() )
588
- || 'valid' === $status
589
- || 'lifetime' === $expiry_date ){
590
-
591
  return true;
592
  }
593
  }
@@ -596,4 +647,4 @@ class Advanced_Ads_Admin_Licenses {
596
  }
597
 
598
 
599
- }
1
  <?php
2
+ defined( 'ABSPATH' ) || exit;
3
 
4
  /**
5
+ * Handle add-on licenses
6
  */
7
  class Advanced_Ads_Admin_Licenses {
8
  /**
12
  */
13
  protected static $instance = null;
14
 
15
+ /**
16
+ * Advanced_Ads_Admin_Licenses constructor.
17
+ */
18
  private function __construct() {
19
  if ( ! defined( 'DOING_AJAX' ) ) {
20
  add_action( 'load-plugins.php', array( $this, 'check_plugin_licenses' ) );
21
  }
22
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
23
+
24
+ // todo: check if this is loaded late enough and all add-ons are registered already.
25
+ add_filter( 'upgrader_pre_download', array( $this, 'addon_upgrade_filter' ), 10, 3 );
26
  }
27
+
28
  /**
29
+ * Actions and filter available after all plugins are initialized
30
  */
31
  public function wp_plugins_loaded() {
32
+
33
+ // check for add-on updates.
34
+ add_action( 'admin_init', array( $this, 'add_on_updater' ), 1 );
35
  }
36
 
37
  /**
38
  * Return an instance of this class.
39
  *
40
+ * @return self object A single instance of this class.
41
  */
42
  public static function get_instance() {
43
  // If the single instance hasn't been set, set it now.
44
+ if ( null === self::$instance ) {
45
+ self::$instance = new self();
46
  }
47
 
48
  return self::$instance;
49
  }
50
+
51
  /**
52
+ * Initiate plugin checks
53
+ *
54
  * @since 1.7.12
55
  */
56
+ public function check_plugin_licenses() {
57
+
58
+ if ( is_multisite() ) {
59
  return;
60
  }
61
 
62
+ // gather all add-on plugin files.
63
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
64
+ foreach ( $add_ons as $_add_on ) {
65
+
66
+ // check license status.
67
+ if ( $this->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
68
+ // register warning.
69
  $plugin_file = plugin_basename( $_add_on['path'] );
70
+ add_action( 'after_plugin_row_' . $plugin_file, array( $this, 'add_plugin_list_license_notice' ), 10, 3 );
71
  }
72
  }
73
  }
74
+
75
  /**
76
+ * Add a row below add-ons with an invalid license on the plugin list
77
+ *
 
78
  * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
79
  * @param array $plugin_data An array of plugin data.
80
+ * @param string $status Status of the plugin. Defaults are 'All', 'Active',
81
  * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
82
  * 'Drop-ins', 'Search'.
83
+ *
84
+ * @since 1.7.12
85
  * @todo make this work on multisite as well
86
  */
87
+ public function add_plugin_list_license_notice( $plugin_file, $plugin_data, $status ) {
88
+
89
+ echo '<tr class="advads-plugin-update-tr plugin-update-tr active"><td class="plugin-update colspanchange" colspan="3"><div class="update-message notice inline notice-warning notice-alt"><p>'
90
+ . sprintf( __( '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>.', 'advanced-ads' ), $plugin_data['Title'], admin_url( 'admin.php?page=advanced-ads-settings#top#licenses' ) )
91
+ . '</p></div></td></tr>';
92
+
93
+ }
94
 
 
 
95
 
96
  /**
97
+ * Save license key
98
+ *
99
+ * @param string $addon string with add-on identifier.
100
+ * @param string $plugin_name name of the add-on.
101
+ * @param string $options_slug slug of the option in the database.
102
+ * @param string $license_key license key.
103
  *
104
+ * @return string
105
  * @since 1.2.0
 
106
  */
107
  public function activate_license( $addon = '', $plugin_name = '', $options_slug = '', $license_key = '' ) {
108
 
109
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
110
  return __( 'Error while trying to register the license. Please contact support.', 'advanced-ads' );
111
  }
112
+
113
  $license_key = esc_attr( trim( $license_key ) );
114
+ if ( '' === $license_key ) {
115
  return __( 'Please enter a valid license key', 'advanced-ads' );
116
  }
117
+
118
+ if ( has_filter( 'advanced_ads_license_' . $options_slug ) ) {
119
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
120
  }
121
+
122
  /**
123
+ * We need to remove the mltlngg_get_url_translated filter added by Multilanguage by BestWebSoft, https://wordpress.org/plugins/multilanguage/
124
  * it causes the URL to look much different than it originally is
125
  * we are adding it again later
 
126
  */
127
  remove_filter( 'home_url', 'mltlngg_get_url_translated' );
128
+
129
  $api_params = array(
130
+ 'edd_action' => 'activate_license',
131
+ 'license' => $license_key,
132
+ 'item_name' => urlencode( $plugin_name ),
133
+ 'url' => home_url(),
134
  );
135
+
136
  /**
137
+ * Re-add the filter removed from above
138
  */
139
  if ( function_exists( 'mltlngg_get_url_translated' ) ) {
140
  add_filter( 'home_url', 'mltlngg_get_url_translated' );
141
  }
142
+
143
  // Call the custom API.
144
+ $response = wp_remote_post(
145
+ ADVADS_URL,
146
+ array(
147
+ 'timeout' => 15,
148
+ 'sslverify' => false,
149
+ 'body' => $api_params,
150
+ )
151
+ );
152
+
153
+ // show license debug output if constant is set.
154
+ if ( defined( 'ADVANCED_ADS_SHOW_LICENSE_RESPONSE' ) ) {
155
  return '<pre>' . print_r( $response, true ) . '</pre>';
156
  }
157
+
158
  /**
159
+ * Send the user to our support when his request is blocked by our firewall
160
  */
161
+ if ( $error = $this->blocked_by_firewall( $response ) ) {
162
  return $error;
163
  }
164
 
165
  if ( is_wp_error( $response ) ) {
166
  $body = wp_remote_retrieve_body( $response );
167
+ if ( $body ) {
168
+ return $body;
169
  } else {
170
+ $curl = curl_version();
171
+
172
+ return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' ) . " (cURL {$curl['version']})";
173
  }
174
+ }
175
 
176
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
177
+ // save license status.
178
+ if ( ! empty( $license_data->license ) ) {
179
+ update_option( $options_slug . '-license-status', $license_data->license, false );
180
+ }
181
+ if ( ! empty( $license_data->expires ) ) {
182
+ update_option( $options_slug . '-license-expires', $license_data->expires, false );
183
+ }
184
+
185
+ // display activation problem.
186
+ if ( ! empty( $license_data->error ) ) {
187
+ // user friendly texts for errors.
188
+ $errors = array(
189
+ 'license_not_activable' => __( 'This is the bundle license key.', 'advanced-ads' ),
190
+ 'item_name_mismatch' => __( 'This is not the correct key for this add-on.', 'advanced-ads' ),
191
+ 'no_activations_left' => __( 'There are no activations left.', 'advanced-ads' ),
192
+ );
193
+ $error = isset( $errors[ $license_data->error ] ) ? $errors[ $license_data->error ] : $license_data->error;
194
+ if ( 'expired' === $license_data->error ) {
195
+ return 'ex';
 
 
 
196
  } else {
197
+ if ( isset( $errors[ $license_data->error ] ) ) {
198
+ return $error;
199
+ } else {
200
+ return sprintf(
201
+ // translators: %s is a string containing information about the issue.
202
+ __( 'License is invalid. Reason: %s', 'advanced-ads' ),
203
+ $error
204
+ );
205
+ }
206
  }
 
207
  } else {
208
+ // reset license_expires admin notification.
209
+ Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_expires' ); // this one is no longer added, but we keep the check here in case it is still in the queue for some users.
210
+ Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_expired' ); // this one is no longer added, but we keep the check here in case it is still in the queue for some users.
211
+ Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'license_invalid' );
212
+ // save license key.
213
+ $licenses = $this->get_licenses();
214
+ $licenses[ $addon ] = $license_key;
215
+ $this->save_licenses( $licenses );
216
  }
217
 
218
  return 1;
219
  }
220
+
221
  /**
222
+ * Check if a request was blocked by our firewall
223
  */
224
+ public function blocked_by_firewall( $response ) {
225
  $response_code = wp_remote_retrieve_response_code( $response );
226
+ if ( '403' == $response_code ) {
227
+ $blocked_information = '–';
228
+ if ( isset( $response['body'] ) ) {
229
+ // look for the IP address in this line: `<td><span>95.90.238.103</span></td>`.
230
+ $pattern = '/<span>([.0-9]*)<\/span>/';
231
+ $matches = array();
232
+ preg_match( $pattern, $response['body'], $matches );
233
+ $ip = isset( $matches[1] ) ? $matches[1] : '–';
234
+ $blocked_information = 'IP: ' . $ip;
235
+ }
236
+
237
+ // translators: %s is a list of server information like IP address. Just keep it as is.
238
+ return sprintf( __( 'Your request was blocked by our firewall. Please send us the following information to unblock you: %s.', 'advanced-ads' ), $blocked_information );
239
+ }
240
+
241
  return false;
242
  }
243
+
244
  /**
245
+ * Check if a specific license key was already activated for the current page
246
+ *
247
+ * @param string $license_key license key.
248
+ * @param string $plugin_name name of the add-on.
249
+ * @param string $options_slug slug of the option in the database.
250
+ *
251
  * @return bool true if already activated
252
+ * @since 1.6.17
253
  * @deprecated since version 1.7.2 because it only checks if a key is valid, not if the url registered with that key
254
  */
255
+ public function check_license( $license_key = '', $plugin_name = '', $options_slug = '' ) {
256
+
257
+ if ( has_filter( 'advanced_ads_license_' . $options_slug ) ) {
258
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
259
  }
260
+
261
  $api_params = array(
262
  'edd_action' => 'check_license',
263
+ 'license' => $license_key,
264
+ 'item_name' => urlencode( $plugin_name ),
265
  );
266
+ $response = wp_remote_get( add_query_arg( $api_params, ADVADS_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
267
  if ( is_wp_error( $response ) ) {
268
  return false;
269
  }
270
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
271
+
272
+ // if this license is still valid.
273
+ if ( 'valid' === $license_data->license ) {
274
+ update_option( $options_slug . '-license-expires', $license_data->expires, false );
275
+ update_option( $options_slug . '-license-status', $license_data->license, false );
276
+
277
  return true;
278
  }
279
+
280
  return false;
281
+ }
282
+
283
  /**
284
+ * Deactivate license key
285
  *
286
+ * @param string $addon string with add-on identifier.
287
+ * @param string $plugin_name name of the add-on.
288
+ * @param string $options_slug slug of the option in the database.
289
+ *
290
+ * @return string
291
  * @since 1.6.11
 
292
  */
293
  public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
294
 
295
  if ( '' === $addon || '' === $plugin_name || '' === $options_slug ) {
296
  return __( 'Error while trying to disable the license. Please contact support.', 'advanced-ads' );
297
+ }
298
 
299
+ $licenses = $this->get_licenses();
300
+ $license_key = isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : '';
301
 
302
+ if ( has_filter( 'advanced_ads_license_' . $options_slug ) ) {
303
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
304
  }
305
 
306
  $api_params = array(
307
  'edd_action' => 'deactivate_license',
308
  'license' => $license_key,
309
+ 'item_name' => urlencode( $plugin_name ),
310
+ );
311
+ // send the remote request.
312
+ $response = wp_remote_post(
313
+ ADVADS_URL,
314
+ array(
315
+ 'body' => $api_params,
316
+ 'timeout' => 15,
317
+ 'sslverify' => false,
318
+ )
319
  );
320
+
321
+ // show license debug output if constant is set.
322
+ if ( defined( 'ADVANCED_ADS_SHOW_LICENSE_RESPONSE' ) ) {
 
 
 
 
 
 
323
  return '<pre>' . print_r( $response, true ) . '</pre>';
324
  }
325
+
326
  if ( is_wp_error( $response ) ) {
327
  $body = wp_remote_retrieve_body( $response );
328
+ if ( $body ) {
329
+ return $body;
330
  } else {
331
+ return __( 'License couldn’t be deactivated. Please try again later.', 'advanced-ads' );
332
  }
333
  }
334
 
335
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
336
+
337
  /**
338
+ * Send the user to our support when his request is blocked by our firewall
339
  */
340
+ if ( $error = $this->blocked_by_firewall( $response ) ) {
341
  return $error;
342
  }
343
+
344
+ // remove data.
345
+ if ( 'deactivated' === $license_data->license ) {
346
+ delete_option( $options_slug . '-license-status' );
347
+ delete_option( $options_slug . '-license-expires' );
348
+ } elseif ( 'failed' === $license_data->license ) {
349
+ update_option( $options_slug . '-license-expires', $license_data->expires, false );
350
+ update_option( $options_slug . '-license-status', $license_data->license, false );
351
+
352
+ return 'ex';
 
353
  } else {
354
+ return __( 'License couldn’t be deactivated. Please try again later.', 'advanced-ads' );
355
  }
356
 
357
  return 1;
358
  }
359
+
360
  /**
361
+ * Get license keys for all add-ons
362
+ *
363
+ * @return string[]
364
  * @since 1.6.15
 
365
  */
366
+ public function get_licenses() {
367
+
368
+ $licenses = array();
369
+
370
+ if ( is_multisite() ) {
371
+ // if multisite, get option from main blog.
372
+ global $current_site;
373
+ $licenses = get_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', array() );
374
+
375
+ } else {
376
+ $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
377
+ }
378
+
379
+ return $licenses;
380
  }
381
+
382
  /**
383
+ * Save license keys for all add-ons
384
+ *
385
+ * @param array $licenses licenses.
386
+ *
387
  * @since 1.7.2
 
388
  */
389
+ public function save_licenses( $licenses = array() ) {
390
+
391
+ if ( is_multisite() ) {
392
+ // if multisite, get option from main blog.
393
+ global $current_site;
394
+ update_blog_option( $current_site->blog_id, ADVADS_SLUG . '-licenses', $licenses );
395
+ } else {
396
+ update_option( ADVADS_SLUG . '-licenses', $licenses );
397
+ }
398
  }
399
+
400
  /**
401
+ * Get license status of an add-on
402
+ *
403
+ * @param string $slug slug of the add-on.
404
+ *
405
+ * @return string $status license status, e.g. "valid" or "invalid"
406
  * @since 1.6.15
 
 
407
  */
408
+ public function get_license_status( $slug = '' ) {
409
+
410
+ $status = false;
411
+
412
+ if ( is_multisite() ) {
413
+ // if multisite, get option from main blog.
414
+ global $current_site;
415
+ $status = get_blog_option( $current_site->blog_id, $slug . '-license-status', false );
416
+ } else {
417
+ $status = get_option( $slug . '-license-status', false );
418
+ }
419
+
420
+ return $status;
421
+ }
422
+
423
+ /**
424
+ * If two or more add-ons use the same valid license this is probably an all-access customer
425
+ *
426
+ * @return bool
427
+ */
428
+ public function get_probably_all_access() {
429
+ $valid = array_filter( $this->get_licenses(), function ( $key ) {
430
+ return $this->get_license_status( ADVADS_SLUG . '-' . $key );
431
+ }, ARRAY_FILTER_USE_KEY );
432
+
433
+
434
+ return array() !== $valid && max( array_count_values( $valid ) ) > 1;
435
  }
436
+
437
  /**
438
+ * Get license expired value of an add-on
439
+ *
440
+ * @param string $slug slug of the add-on.
441
+ *
442
+ * @return string $date expiry date of an add-on
443
  * @since 1.6.15
 
 
444
  */
445
+ public function get_license_expires( $slug = '' ) {
446
+
447
+ $date = false;
448
+
449
+ if ( is_multisite() ) {
450
+ // if multisite, get option from main blog.
451
+ global $current_site;
452
+ $date = get_blog_option( $current_site->blog_id, $slug . '-license-expires', false );
453
+ } else {
454
+ $date = get_option( $slug . '-license-expires', false );
455
+ }
456
+
457
+ return $date;
458
  }
459
+
460
+
461
+ /**
462
+ * Add-on updater
463
  *
464
  * @since 1.5.7
465
+ */
466
+ public function add_on_updater() {
467
+
468
+ // ignore, if not main blog.
469
+ if ( ( is_multisite() && ! is_main_site() ) ) {
470
+ return;
471
  }
472
 
473
  /**
474
+ * List of registered add ons
475
  * contains:
476
+ * name
477
+ * version
478
+ * path
479
+ * options_slug
480
+ * short option slug (=key)
481
  */
482
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
483
 
484
+ if ( array() === $add_ons ) {
485
+ return;
486
  }
 
 
 
487
 
488
+ // load license keys.
489
+ $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
490
+
491
+ foreach ( $add_ons as $_add_on_key => $_add_on ) {
492
 
493
+ // check if a license expired over time.
494
  $expiry_date = $this->get_license_expires( $_add_on['options_slug'] );
495
+ $now = time();
496
+ if ( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ) {
497
+ // remove license status.
498
  delete_option( $_add_on['options_slug'] . '-license-status' );
499
  continue;
500
  }
501
 
502
+ // check status.
503
+ if ( $this->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
504
  continue;
505
  }
506
 
507
+ // retrieve our license key.
508
+ $license_key = isset( $licenses[ $_add_on_key ] ) ? $licenses[ $_add_on_key ] : '';
509
 
510
+ // setup the updater.
511
+ if ( $license_key ) {
512
+
513
+ // register filter to set EDD transient to 86,400 seconds (day) instead of 3,600 (hours).
514
+ $slug = basename( $_add_on['path'], '.php' );
515
  $transient_key = md5( serialize( $slug . $license_key ) );
516
+
 
517
  add_filter( 'pre_update_option_' . $transient_key, array( $this, 'set_expiration_of_update_option' ) );
518
+
519
+ new ADVADS_SL_Plugin_Updater(
520
+ ADVADS_URL,
521
+ $_add_on['path'],
522
+ array(
523
+ 'version' => $_add_on['version'],
524
+ 'license' => $license_key,
525
+ 'item_name' => $_add_on['name'],
526
+ 'author' => 'Thomas Maier',
527
+ )
528
  );
529
  }
530
  }
531
+ }
532
+
533
  /**
534
+ * Set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
535
+ *
536
  * @deprecated since version 1.7.14 – not using transient anymore, but option
537
  */
538
+ public function set_expiration_of_update_transient( $expiration ) {
539
 
540
  return 86400;
541
  }
542
+
543
  /**
544
+ * Set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
545
+ *
546
+ * @return integer
547
  * @since 1.7.14
548
  */
549
+ public function set_expiration_of_update_option( $value ) {
550
 
551
  $value['timeout'] = time() + 86400;
552
+
553
  return $value;
554
  }
555
+
556
  /**
557
+ * Add custom messages to plugin updater
558
+ *
559
+ * @param string $reply
560
+ * @param string $package
561
+ * @param string $updater
562
+ *
563
+ * @return string
564
+ *
565
+ * @todo check if this is still working.
566
  */
567
  public function addon_upgrade_filter( $reply, $package, $updater ) {
568
+
569
+ if ( isset( $updater->skin->plugin ) ) {
570
+ $plugin_file = $updater->skin->plugin;
571
+ } elseif ( isset( $updater->skin->plugin_info['Name'] ) ) {
572
+ $add_on = $this->get_installed_add_on_by_name( $updater->skin->plugin_info['Name'] );
573
+ $plugin_file = plugin_basename( $add_on['path'] );
574
+ }
575
+
576
+ if ( isset( $plugin_file ) && $plugin_file ) {
577
+ // hides the download url, but makes debugging harder
578
+ // $updater->strings['downloading_package'] = __( 'Downloading updated version...', 'advanced-ads' );
579
+ //$updater->skin->feedback( 'downloading_package' );
580
+
581
+ // if AJAX; show direct update link as first possible solution
582
+ if ( defined( 'DOING_AJAX' ) ) {
583
+ $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
584
+ $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
585
+ } else {
586
+ $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' );
587
+ }
588
+
589
+ }
590
+
591
  /*$res = $updater->fs_connect( array( WP_CONTENT_DIR ) );
592
  if ( ! $res ) {
593
  return new WP_Error( 'no_credentials', __( "Error! Can't connect to filesystem", 'advanced-ads' ) );
595
 
596
  return $reply;
597
  }
598
+
599
  /**
600
+ * Search if a name is in the add-on array and return the add-on data of it
601
+ *
602
+ * @param string $name name of an add-on.
603
+ *
604
+ * @return array array with the add-on data
605
  */
606
+ private function get_installed_add_on_by_name( $name = '' ) {
607
+
608
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
609
+
610
+ if ( is_array( $add_ons ) ) {
611
+ foreach ( $add_ons as $key => $_add_on ) {
612
+ if ( $_add_on['name'] === $name ) {
613
+ return $_add_on;
614
+ }
615
  }
 
616
  }
617
+
618
  return null;
619
  }
620
+
621
  /**
622
+ * Check if any license is valid
623
  * can be used to display information for any Pro user only, like link to direct support
624
  */
625
+ public static function any_license_valid() {
626
  $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
627
+
628
+ if ( array() === $add_ons ) {
629
  return false;
630
  }
631
 
632
+ foreach ( $add_ons as $_add_on ) {
633
+ $status = self::get_instance()->get_license_status( $_add_on['options_slug'] );
634
+
635
+ // check expiry date.
636
+ $expiry_date = self::get_instance()->get_license_expires( $_add_on['options_slug'] );
637
 
638
+ if ( ( $expiry_date && strtotime( $expiry_date ) > time() )
639
+ || 'valid' === $status
640
+ || 'lifetime' === $expiry_date ) {
641
 
 
 
 
 
642
  return true;
643
  }
644
  }
647
  }
648
 
649
 
650
+ }
admin/includes/class-menu.php CHANGED
@@ -136,7 +136,10 @@ class Advanced_Ads_Admin_Menu {
136
  );
137
  }
138
  }
139
-
 
 
 
140
 
141
  // allows extensions to insert sub menu pages
142
  do_action( 'advanced-ads-submenu-pages', $this->plugin_slug );
@@ -277,4 +280,4 @@ class Advanced_Ads_Admin_Menu {
277
  }
278
  }
279
 
280
- }
136
  );
137
  }
138
  }
139
+
140
+ add_filter( 'option_page_capability_' . ADVADS_SLUG, function () {
141
+ return Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' );
142
+ } );
143
 
144
  // allows extensions to insert sub menu pages
145
  do_action( 'advanced-ads-submenu-pages', $this->plugin_slug );
280
  }
281
  }
282
 
283
+ }
admin/includes/class-meta-box.php CHANGED
@@ -242,7 +242,10 @@ class Advanced_Ads_Admin_Meta_Boxes {
242
  }
243
 
244
  if ( 'ad-parameters-box' === $box['id'] && Advanced_Ads_Ad_Type_Adsense::content_is_adsense( $ad->content ) && in_array( $ad->type, array( 'plain', 'content' ) ) ) {
245
- if ( false === strpos( $ad->content, 'enable_page_level_ads' ) ) {
 
 
 
246
  $adsense_auto_ads = Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled();
247
  $warnings[] = array(
248
  'class' => 'advads-adsense-found-in-content error',
242
  }
243
 
244
  if ( 'ad-parameters-box' === $box['id'] && Advanced_Ads_Ad_Type_Adsense::content_is_adsense( $ad->content ) && in_array( $ad->type, array( 'plain', 'content' ) ) ) {
245
+ if (
246
+ false === strpos( $ad->content, 'enable_page_level_ads' )
247
+ && ! preg_match( '/script[^>]+data-ad-client=/', $ad->content )
248
+ ) {
249
  $adsense_auto_ads = Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled();
250
  $warnings[] = array(
251
  'class' => 'advads-adsense-found-in-content error',
admin/includes/class-overview-widgets.php CHANGED
@@ -122,9 +122,14 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
122
  <li><?php _e( 'How to earn more with AdSense', 'advanced-ads' ); ?></li>
123
  </ul>
124
  <div class="advads-admin-notice">
125
- <button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Join now', 'advanced-ads'); ?></button>
126
- </div><?php
127
- } elseif ( count( $recent_ads ) > 3
 
 
 
 
 
128
  && ! isset($options[ 'closed' ][ 'review' ] ) ){
129
  /**
130
  * ask for a review if the review message was not closed before
@@ -142,8 +147,9 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
142
  echo '<p><a class="button button-secondary" href="' . admin_url( 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) .
143
  '">' . __( 'Manage your ads', 'advanced-ads' ) . '</a></p>';
144
  }
145
-
146
- if ( $is_subscribed ) {
 
147
  ?><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-bundle" target="_blank"><?php _e( 'Get the All Access pass', 'advanced-ads' ); ?></a><?php
148
  }
149
 
122
  <li><?php _e( 'How to earn more with AdSense', 'advanced-ads' ); ?></li>
123
  </ul>
124
  <div class="advads-admin-notice">
125
+ <p>
126
+ <button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>">
127
+ <?php _e( 'Join now', 'advanced-ads' ); ?>
128
+ </button>
129
+ </p>
130
+ </div>
131
+ <?php
132
+ } elseif ( count( $recent_ads ) > 3
133
  && ! isset($options[ 'closed' ][ 'review' ] ) ){
134
  /**
135
  * ask for a review if the review message was not closed before
147
  echo '<p><a class="button button-secondary" href="' . admin_url( 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) .
148
  '">' . __( 'Manage your ads', 'advanced-ads' ) . '</a></p>';
149
  }
150
+
151
+ $all_access = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access();
152
+ if ( $is_subscribed && ! $all_access ) {
153
  ?><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-bundle" target="_blank"><?php _e( 'Get the All Access pass', 'advanced-ads' ); ?></a><?php
154
  }
155
 
admin/includes/class-settings.php CHANGED
@@ -162,14 +162,6 @@ class Advanced_Ads_Admin_Settings {
162
  $hook,
163
  'advanced_ads_setting_section_injection'
164
  );
165
- // Add setting fields to enable new content injection.
166
- add_settings_field(
167
- 'content-injection-new',
168
- __( 'Use new injection logic', 'advanced-ads' ),
169
- array( $this, 'render_settings_content_injection_new' ),
170
- $hook,
171
- 'advanced_ads_setting_section_injection'
172
- );
173
  // add setting fields for hiding ads from bots.
174
  add_settings_field(
175
  'block-bots',
@@ -508,23 +500,6 @@ class Advanced_Ads_Admin_Settings {
508
  echo '<p class="description">' . __( 'Advanced Ads ignores paragraphs and other elements in containers when injecting ads into the post content. Check this option to ignore this limitation and ads might show up again.', 'advanced-ads' ) . '</p>';
509
  }
510
 
511
- /**
512
- * Render setting fields to enable new content injection.
513
- *
514
- * @since untagged
515
- */
516
- public function render_settings_content_injection_new() {
517
- $checked = ( Advanced_Ads_Placements::is_new_content_injection() ) ? 1 : 0;
518
-
519
- echo '<input id="advanced-ads-content-injection-new" type="checkbox" value="1" name="' . ADVADS_SLUG . '[content-injection-new]" ' . checked( $checked, 1, false ) . '>';
520
-
521
- echo '<p class="description">' . sprintf(
522
- // translators: %1$s is a starting <a> tag and %2$s a closing one.
523
- __( 'Enable the new more stable injection logic. Please report any issues %1$shere%2$s.', 'advanced-ads' ), '<a href="'
524
- . ADVADS_URL . 'support" target="_blank"> ', '</a>' ) . '</p>';
525
-
526
- }
527
-
528
  /**
529
  * render setting for blocking bots
530
  *
@@ -569,7 +544,7 @@ class Advanced_Ads_Admin_Settings {
569
 
570
  echo '<input id="advanced-ads-disabled-notices" type="checkbox" value="1" name="' . ADVADS_SLUG . '[disable-notices]" ' . checked( $checked, 1, false ) . '>';
571
  echo '<p class="description">' . sprintf(
572
- // translators: %1$s is a starting <a> tag and %2$s a closing one
573
  __( 'Disable %1$sAd Health%2$s in frontend and backend, warnings and internal notices like tips, tutorials, email newsletters and update notices.', 'advanced-ads' ), '<a href="'
574
  . ADVADS_URL . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-ad-health" target="_blank"> ', '</a>' ) . '</p>';
575
  }
162
  $hook,
163
  'advanced_ads_setting_section_injection'
164
  );
 
 
 
 
 
 
 
 
165
  // add setting fields for hiding ads from bots.
166
  add_settings_field(
167
  'block-bots',
500
  echo '<p class="description">' . __( 'Advanced Ads ignores paragraphs and other elements in containers when injecting ads into the post content. Check this option to ignore this limitation and ads might show up again.', 'advanced-ads' ) . '</p>';
501
  }
502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  /**
504
  * render setting for blocking bots
505
  *
544
 
545
  echo '<input id="advanced-ads-disabled-notices" type="checkbox" value="1" name="' . ADVADS_SLUG . '[disable-notices]" ' . checked( $checked, 1, false ) . '>';
546
  echo '<p class="description">' . sprintf(
547
+ // translators: %1$s is a starting <a> tag and %2$s a closing one.
548
  __( 'Disable %1$sAd Health%2$s in frontend and backend, warnings and internal notices like tips, tutorials, email newsletters and update notices.', 'advanced-ads' ), '<a href="'
549
  . ADVADS_URL . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-ad-health" target="_blank"> ', '</a>' ) . '</p>';
550
  }
admin/views/ad-parameters-size.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <span class="label"><?php _e( 'size', 'advanced-ads' ); ?></span>
2
  <div id="advanced-ads-ad-parameters-size">
3
  <label><?php _e( 'width', 'advanced-ads' ); ?><input type="number" value="<?php echo isset( $ad->width ) ? $ad->width : 0; ?>" name="advanced_ad[width]">px</label>
1
+ <?php
2
+
3
+ // don’t show sizes for Google Ad Manager ads.
4
+ if ( 'gam' == $type->ID ) {
5
+ return;
6
+ }
7
+
8
+ ?>
9
  <span class="label"><?php _e( 'size', 'advanced-ads' ); ?></span>
10
  <div id="advanced-ads-ad-parameters-size">
11
  <label><?php _e( 'width', 'advanced-ads' ); ?><input type="number" value="<?php echo isset( $ad->width ) ? $ad->width : 0; ?>" name="advanced_ad[width]">px</label>
admin/views/conditions/condition-author.php CHANGED
@@ -7,16 +7,17 @@
7
  $_val = 0;
8
  }
9
  $author_name = $_author->display_name;
 
10
  ?><label class="button ui-button"
11
- for="advads-conditions-<?php echo absint( $index ); ?>-<?php echo absint( $_author->ID ); ?>">
12
  <?php echo esc_attr( $author_name ); ?>
13
  </label><input type="checkbox"
14
- id="advads-conditions-<?php echo absint( $index ); ?>-<?php echo absint( $_author->ID ); ?>"
15
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
16
  value="<?php echo absint( $_author->ID ); ?>"><?php
17
  }
 
18
  ?>
19
- <p class="advads-conditions-not-selected advads-error-message"><?php esc_html_x( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p>
20
  </div>
21
  <?php
22
  if ( count( $authors ) >= $max_authors ) :
7
  $_val = 0;
8
  }
9
  $author_name = $_author->display_name;
10
+ $field_id = 'advads-conditions-' . absint( $_author->ID ) . $rand;
11
  ?><label class="button ui-button"
12
+ for="<?php echo $field_id; ?>">
13
  <?php echo esc_attr( $author_name ); ?>
14
  </label><input type="checkbox"
15
+ id="<?php echo $field_id; ?>"
16
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
17
  value="<?php echo absint( $_author->ID ); ?>"><?php
18
  }
19
+ include ADVADS_BASE_PATH . 'admin/views/conditions/not-selected.php';
20
  ?>
 
21
  </div>
22
  <?php
23
  if ( count( $authors ) >= $max_authors ) :
admin/views/conditions/no-option.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var WP_Taxonomy $taxonomy
4
+ */
5
+ ?>
6
+ <p class="advads-conditions-not-selected advads-error-message">
7
+ <?php printf( _x( 'No %s found on your site.', 'Error message shown when no terms exists for display condition; placeholder is taxonomy label.', 'advanced-ads' ), $taxonomy->label ); ?>
8
+ </p>
admin/views/conditions/not-selected.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <p class="advads-conditions-not-selected advads-error-message">
2
+ <?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?>
3
+ </p>
admin/views/notices/info.php CHANGED
@@ -1,3 +1,9 @@
1
  <div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
 
 
 
 
 
 
3
  </div>
1
  <div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
3
+ <a href="<?= add_query_arg( [
4
+ 'action' => 'advads-close-notice',
5
+ 'notice' => $_notice,
6
+ 'nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
7
+ 'redirect' => $_SERVER['REQUEST_URI'],
8
+ ], admin_url( 'admin-ajax.php' ) ); ?>" class="notice-dismiss"><span class="screen-reader-text"><?= __( 'Dismiss this notice.' ); ?></span></a>
9
  </div>
admin/views/notices/welcome-panel.php CHANGED
@@ -19,13 +19,6 @@ try {
19
  target="_blank"><?php esc_attr_e( 'First ad tutorial', 'advanced-ads' ); ?></a></li>
20
  </ul>
21
  </div>
22
- <?php
23
- $options = Advanced_Ads_Plugin::get_instance()->internal_options();
24
- $installed = isset( $options['installed'] ) ? $options['installed'] : 0;
25
- $showed_basic_setup = false;
26
- if ( ! $number_of_ads && Advanced_Ads_Plugin::get_group_by_url( null, 'a' ) && $installed > 1573128000 ) :
27
- $showed_basic_setup = true;
28
- ?>
29
  <div class="aa-welcome-panel-column aa-welcome-panel-starter-setup aa-welcome-panel-last">
30
  <h3><?php esc_attr_e( 'One-Click Setup', 'advanced-ads' ); ?></h3>
31
  <?php
@@ -37,7 +30,6 @@ try {
37
  class="button button-primary"><?php esc_attr_e( 'Create 2 test ads', 'advanced-ads' ); ?></a>
38
  <p class="description"><?php esc_attr_e( 'Click to place two ads in the content of your site which are visible to you only.', 'advanced-ads' ); ?></p>
39
  </div>
40
- <?php endif; ?>
41
  <div class="aa-welcome-panel-column">
42
  <h3><?php esc_attr_e( 'AdSense Options', 'advanced-ads' ); ?></h3>
43
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ); ?>"
@@ -52,21 +44,5 @@ try {
52
  </li>
53
  </ul>
54
  </div>
55
- <?php
56
- if ( ! $showed_basic_setup ) :
57
- ?>
58
- <div class="aa-welcome-panel-column aa-welcome-panel-last">
59
- <h3><?php esc_attr_e( 'Get help', 'advanced-ads' ); ?></h3>
60
- <ul>
61
- <li>
62
- <a href="<?php echo esc_url( ADVADS_URL ); ?>manual/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-manual"
63
- target="_blank"><?php esc_attr_e( 'Manual', 'advanced-ads' ); ?></a>
64
- </li>
65
- <li>
66
- <a href="<?php echo esc_url( ADVADS_URL ); ?>support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-support"
67
- target="_blank"><?php esc_attr_e( 'Reach out for help', 'advanced-ads' ); ?></a></li>
68
- </ul>
69
- </div>
70
- <?php endif; ?>
71
  </div>
72
  </div>
19
  target="_blank"><?php esc_attr_e( 'First ad tutorial', 'advanced-ads' ); ?></a></li>
20
  </ul>
21
  </div>
 
 
 
 
 
 
 
22
  <div class="aa-welcome-panel-column aa-welcome-panel-starter-setup aa-welcome-panel-last">
23
  <h3><?php esc_attr_e( 'One-Click Setup', 'advanced-ads' ); ?></h3>
24
  <?php
30
  class="button button-primary"><?php esc_attr_e( 'Create 2 test ads', 'advanced-ads' ); ?></a>
31
  <p class="description"><?php esc_attr_e( 'Click to place two ads in the content of your site which are visible to you only.', 'advanced-ads' ); ?></p>
32
  </div>
 
33
  <div class="aa-welcome-panel-column">
34
  <h3><?php esc_attr_e( 'AdSense Options', 'advanced-ads' ); ?></h3>
35
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ); ?>"
44
  </li>
45
  </ul>
46
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  </div>
48
  </div>
admin/views/placement-injection-top.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  // show quick injection options
3
  // check if the ad code contains the AdSense verification and Auto ads code
4
- $is_page_level_ad_in_code_field = isset( $ad->type ) && 'plain' === $ad->type && strpos( $ad->content, 'enable_page_level_ads' );
5
 
6
  if ( isset( $_GET['message'] ) && 6 === $_GET['message'] ) : ?>
7
  <div id="advads-ad-injection-box" class="advads-ad-metabox postbox">
1
  <?php
2
  // show quick injection options
3
  // check if the ad code contains the AdSense verification and Auto ads code
4
+ $is_page_level_ad_in_code_field = ( isset( $ad->type ) && 'plain' === $ad->type && strpos( $ad->content, 'enable_page_level_ads' ) ) || preg_match( '/script[^>]+data-ad-client=/', $ad->content );
5
 
6
  if ( isset( $_GET['message'] ) && 6 === $_GET['message'] ) : ?>
7
  <div id="advads-ad-injection-box" class="advads-ad-metabox postbox">
admin/views/placements.php CHANGED
@@ -135,11 +135,6 @@ if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
135
  $option_content
136
  );
137
 
138
- if ( ! function_exists( 'mb_convert_encoding' ) ) :
139
- ?>
140
- <p><span class="advads-error-message"><?php _e( 'Important Notice', 'advanced-ads' ); ?>: </span><?php _e( 'Your server is missing an extension. This might break the content injection.<br/>Ignore this warning if everything works fine or else ask your hosting provider to enable <em>mbstring</em>.', 'advanced-ads' ); ?></p>
141
- <?php
142
- endif;
143
  if ( ! extension_loaded( 'dom' ) ) :
144
  ?>
145
  <p><span class="advads-error-message"><?php _e( 'Important Notice', 'advanced-ads' ); ?>: </span><?php printf( __( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ), 'dom (php_xml)' ); ?></p>
135
  $option_content
136
  );
137
 
 
 
 
 
 
138
  if ( ! extension_loaded( 'dom' ) ) :
139
  ?>
140
  <p><span class="advads-error-message"><?php _e( 'Important Notice', 'advanced-ads' ); ?>: </span><?php printf( __( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ), 'dom (php_xml)' ); ?></p>
advanced-ads.php CHANGED
@@ -6,14 +6,14 @@
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
- * @copyright 2013-2019 Thomas Maier, webgilde GmbH
10
  *
11
  * @wordpress-plugin
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.15
16
- * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
19
  * Domain Path: /languages
@@ -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.15' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
+ * @copyright 2013-2019 Thomas Maier, Advanced Ads GmbH
10
  *
11
  * @wordpress-plugin
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.16
16
+ * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
19
  * Domain Path: /languages
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.16' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad.php CHANGED
@@ -185,6 +185,7 @@ class Advanced_Ads_Ad {
185
  $this->status = $_data->post_status;
186
  $this->expiry_date = $this->options( 'expiry_date' );
187
  $this->is_head_placement = isset( $this->args['placement_type'] ) && $this->args['placement_type'] === 'header';
 
188
 
189
  // load content based on ad type
190
  $this->content = $this->type_obj->load_content( $_data );
@@ -518,7 +519,7 @@ class Advanced_Ads_Ad {
518
  return;
519
  }
520
 
521
- update_post_meta( $ad_id, sefl::$options_meta_field, $options );
522
  }
523
 
524
  /**
@@ -711,7 +712,7 @@ class Advanced_Ads_Ad {
711
  $position = ! empty( $this->output['position'] ) ? $this->output['position'] : '';
712
  $use_placement_pos = false;
713
 
714
- if ( ! isset( $this->args['previous_method'] ) || 'group' !== $this->args['previous_method'] ) {
715
  if ( isset($this->output['class'] ) && is_array( $this->output['class'] ) ) {
716
  $wrapper['class'] = $this->output['class'];
717
  }
185
  $this->status = $_data->post_status;
186
  $this->expiry_date = $this->options( 'expiry_date' );
187
  $this->is_head_placement = isset( $this->args['placement_type'] ) && $this->args['placement_type'] === 'header';
188
+ $this->args['is_top_level'] = ! isset( $this->args['is_top_level'] );
189
 
190
  // load content based on ad type
191
  $this->content = $this->type_obj->load_content( $_data );
519
  return;
520
  }
521
 
522
+ update_post_meta( $ad_id, self::$options_meta_field, $options );
523
  }
524
 
525
  /**
712
  $position = ! empty( $this->output['position'] ) ? $this->output['position'] : '';
713
  $use_placement_pos = false;
714
 
715
+ if ( $this->args['is_top_level'] ) {
716
  if ( isset($this->output['class'] ) && is_array( $this->output['class'] ) ) {
717
  $wrapper['class'] = $this->output['class'];
718
  }
classes/ad_ajax_callbacks.php CHANGED
@@ -37,7 +37,7 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
37
  add_action( 'wp_ajax_advads-save-hide-wizard-state', array( $this, 'save_wizard_state' ) );
38
  add_action( 'wp_ajax_advads-adsense-enable-pla', array( $this, 'adsense_enable_pla' ) );
39
  add_action( 'wp_ajax_advads-ad-health-notice-display', array( $this, 'ad_health_notice_display' ) );
40
- add_action( 'wp_ajax_advads-ad-health-notice-push', array( $this, 'ad_health_notice_push' ) );
41
  add_action( 'wp_ajax_advads-ad-health-notice-hide', array( $this, 'ad_health_notice_hide' ) );
42
  add_action( 'wp_ajax_advads-ad-health-notice-unignore', array( $this, 'ad_health_notice_unignore' ) );
43
  add_action( 'wp_ajax_advads-ad-health-notice-solved', array( $this, 'ad_health_notice_solved' ) );
@@ -178,25 +178,30 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
178
  die();
179
  }
180
 
181
- /**
182
- * close a notice for good
183
- *
184
- * @since 1.5.3
185
- */
186
- public function close_notice(){
187
-
188
- check_ajax_referer('advanced-ads-admin-ajax-nonce', 'nonce');
189
-
190
- if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') )
191
- || empty( $_POST['notice'] )
 
192
  ) {
193
- die();
194
- }
 
 
 
 
 
 
 
 
195
 
196
- Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue($_POST['notice']);
197
- die();
198
- }
199
-
200
  /**
201
  * hide a notice for some time (7 days right now)
202
  *
@@ -216,24 +221,24 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
216
  die();
217
  }
218
 
219
- /**
220
- * subscribe to newsletter
221
- *
222
- * @since 1.5.3
223
- */
224
- public function subscribe(){
225
-
226
- check_ajax_referer('advanced-ads-admin-ajax-nonce', 'nonce');
227
-
228
- if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface') )
229
- || empty( $_POST['notice'] )
230
  ) {
231
- die();
232
- }
 
 
233
 
234
- echo Advanced_Ads_Admin_Notices::get_instance()->subscribe($_POST['notice']);
235
- die();
236
- }
237
 
238
  /**
239
  * activate license of an add-on
37
  add_action( 'wp_ajax_advads-save-hide-wizard-state', array( $this, 'save_wizard_state' ) );
38
  add_action( 'wp_ajax_advads-adsense-enable-pla', array( $this, 'adsense_enable_pla' ) );
39
  add_action( 'wp_ajax_advads-ad-health-notice-display', array( $this, 'ad_health_notice_display' ) );
40
+ add_action( 'wp_ajax_advads-ad-health-notice-push-adminui', array( $this, 'ad_health_notice_push' ) );
41
  add_action( 'wp_ajax_advads-ad-health-notice-hide', array( $this, 'ad_health_notice_hide' ) );
42
  add_action( 'wp_ajax_advads-ad-health-notice-unignore', array( $this, 'ad_health_notice_unignore' ) );
43
  add_action( 'wp_ajax_advads-ad-health-notice-solved', array( $this, 'ad_health_notice_solved' ) );
178
  die();
179
  }
180
 
181
+ /**
182
+ * close a notice for good
183
+ *
184
+ * @since 1.5.3
185
+ */
186
+ public function close_notice() {
187
+
188
+ check_ajax_referer( 'advanced-ads-admin-ajax-nonce', 'nonce' );
189
+
190
+ if (
191
+ ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) )
192
+ || empty( $_REQUEST['notice'] )
193
  ) {
194
+ die();
195
+ }
196
+
197
+ Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( $_REQUEST['notice'] );
198
+ if ( isset( $_REQUEST['redirect'] ) ) {
199
+ wp_safe_redirect( $_REQUEST['redirect'] );
200
+ exit();
201
+ }
202
+ die();
203
+ }
204
 
 
 
 
 
205
  /**
206
  * hide a notice for some time (7 days right now)
207
  *
221
  die();
222
  }
223
 
224
+ /**
225
+ * subscribe to newsletter
226
+ *
227
+ * @since 1.5.3
228
+ */
229
+ public function subscribe() {
230
+
231
+ check_ajax_referer( 'advanced-ads-admin-ajax-nonce', 'nonce' );
232
+
233
+ if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface' ) ) || empty( $_POST['notice'] )
 
234
  ) {
235
+ wp_send_json_error( [
236
+ 'message' => sprintf( __( 'An error occurred. Please use <a href="%s" target="_blank">this form</a> to sign up.', 'advanced-ads' ), 'http://eepurl.com/bk4z4P' ),
237
+ ], 400 );
238
+ }
239
 
240
+ wp_send_json_success( [ 'message' => Advanced_Ads_Admin_Notices::get_instance()->subscribe( $_POST['notice'] ) ] );
241
+ }
 
242
 
243
  /**
244
  * activate license of an add-on
classes/ad_group.php CHANGED
@@ -142,6 +142,7 @@ class Advanced_Ads_Group {
142
  $this->post_type = Advanced_Ads::POST_TYPE_SLUG;
143
  $this->ad_args = $ad_args;
144
  $this->is_head_placement = isset( $this->ad_args['placement_type'] ) && $this->ad_args['placement_type'] === 'header';
 
145
 
146
  $this->load_additional_attributes();
147
 
@@ -599,23 +600,26 @@ class Advanced_Ads_Group {
599
  $placement_state = isset( $this->ad_args['ad_label'] ) ? $this->ad_args['ad_label'] : 'default';
600
  $this->label = Advanced_Ads::get_instance()->get_label( $placement_state );
601
 
602
- // Add placement class.
603
- if ( isset( $this->ad_args['output']['class'] ) && is_array( $this->ad_args['output']['class'] ) ) {
604
- $this->wrapper['class'] = $this->ad_args['output']['class'];
605
- }
606
 
607
- if ( ! empty( $this->ad_args['placement_position'] ) ) {
608
- switch ( $this->ad_args['placement_position'] ) {
609
- case 'left' :
610
- $this->wrapper['style']['float'] = 'left';
611
- break;
612
- case 'right' :
613
- $this->wrapper['style']['float'] = 'right';
614
- break;
615
- case 'center' :
616
- // We don't know whether the 'add_wrapper_sizes' option exists.
617
- $this->wrapper['style']['text-align'] = 'center';
618
- break;
 
 
 
 
 
 
 
619
  }
620
  }
621
 
142
  $this->post_type = Advanced_Ads::POST_TYPE_SLUG;
143
  $this->ad_args = $ad_args;
144
  $this->is_head_placement = isset( $this->ad_args['placement_type'] ) && $this->ad_args['placement_type'] === 'header';
145
+ $this->ad_args['is_top_level'] = ! isset( $this->ad_args['is_top_level'] );
146
 
147
  $this->load_additional_attributes();
148
 
600
  $placement_state = isset( $this->ad_args['ad_label'] ) ? $this->ad_args['ad_label'] : 'default';
601
  $this->label = Advanced_Ads::get_instance()->get_label( $placement_state );
602
 
 
 
 
 
603
 
604
+ if ( $this->ad_args['is_top_level'] ) {
605
+ // Add placement class.
606
+ if ( isset( $this->ad_args['output']['class'] ) && is_array( $this->ad_args['output']['class'] ) ) {
607
+ $this->wrapper['class'] = $this->ad_args['output']['class'];
608
+ }
609
+
610
+ if ( ! empty( $this->ad_args['placement_position'] ) ) {
611
+ switch ( $this->ad_args['placement_position'] ) {
612
+ case 'left' :
613
+ $this->wrapper['style']['float'] = 'left';
614
+ break;
615
+ case 'right' :
616
+ $this->wrapper['style']['float'] = 'right';
617
+ break;
618
+ case 'center' :
619
+ // We don't know whether the 'add_wrapper_sizes' option exists.
620
+ $this->wrapper['style']['text-align'] = 'center';
621
+ break;
622
+ }
623
  }
624
  }
625
 
classes/ad_placements.php CHANGED
@@ -558,26 +558,8 @@ class Advanced_Ads_Placements {
558
  private static function get_content_to_load( $content, $wpCharset ) {
559
  $plugin_options = Advanced_Ads::get_instance()->options();
560
 
561
- if ( ! self::is_new_content_injection() ) {
562
- // -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
563
- // prevent messages from dom parser
564
- // check if mbstring exists
565
- if ( ! function_exists( 'mb_convert_encoding' ) ) {
566
- if ( $wpCharset === "UTF-8" ) {
567
- $content_to_load = htmlspecialchars_decode( htmlentities( $content, ENT_COMPAT, $wpCharset, false ) );
568
- } else {
569
- return;
570
- }
571
- } else {
572
- $content_to_load = mb_convert_encoding( $content, 'HTML-ENTITIES', $wpCharset );
573
- }
574
-
575
- $content_to_load = str_replace( array_keys( self::$replacements ), array_values( self::$replacements ), $content_to_load );
576
- } else {
577
- // Prevent removing closing tags in scripts.
578
- $content_to_load= preg_replace( '/<script.*?<\/script>/', '<!--\0-->', $content);
579
- }
580
-
581
 
582
  // check which priority the wpautop filter has; might have been disabled on purpose
583
  $wpautop_priority = has_filter( 'the_content', 'wpautop');
@@ -599,23 +581,15 @@ class Advanced_Ads_Placements {
599
  private static function filter_ad_content( $ad_content, $tag_name, $options ) {
600
  $plugin_options = Advanced_Ads::get_instance()->options();
601
 
602
- if ( ! self::is_new_content_injection() ) {
603
- // replace `</` with `<\/` in ad content when placed within `document.write()` to prevent code from breaking
604
- // source for this regex: http://stackoverflow.com/questions/17852537/preg-replace-only-specific-part-of-string
605
- $ad_content = preg_replace('#(document.write.+)</(.*)#', '$1<\/$2', $ad_content); // escapes all closing html tags
606
- // $ad_content = preg_replace('#(document.write.+)</sc(.*)#', '$1<\/sc$2', $ad_content); // only escapes closing </script> tags
607
- // $ad_content = preg_replace('#(document.write[^<^)]+)</sc(.*)#', '$1<\/sc$2', $ad_content); // too restrict, doesn’t work when beginning <script> tag is in the same line
608
- } else {
609
- //Inject placeholder.
610
- $id = count( self::$ads_for_placeholders );
611
- self::$ads_for_placeholders[] = array(
612
- 'id' => $id,
613
- 'tag' => $tag_name,
614
- 'type' => $options['before'] ? 'before' : 'after',
615
- 'ad' => $ad_content
616
- );
617
- $ad_content = '%advads_placeholder_' . $id . '%';
618
- }
619
 
620
  return $ad_content;
621
  }
@@ -629,27 +603,10 @@ class Advanced_Ads_Placements {
629
  */
630
  private static function prepare_output( $content, $content_orig ) {
631
  $plugin_options = Advanced_Ads::get_instance()->options();
632
- if ( ! self::is_new_content_injection() ) {
633
- // remove head and tail (required for dom parser but unwanted for content)
634
- $content = substr($content, stripos($content, '<body>') + 6);
635
- $content = str_replace(array('</body>', '</html>'), '', $content);
636
- $content = str_replace( array_values( self::$replacements ), array_keys( self::$replacements ), $content );
637
 
 
 
638
 
639
- // no fall-back desired: if there are too few paragraphs do nothing
640
-
641
- // fix shortcode quotes (malformed by backend editor)
642
- $matches = array();
643
- if (0 < preg_match_all('/\[[^]]+\]/Siu', $content, $matches, PREG_OFFSET_CAPTURE) && isset($matches[0])) {
644
- foreach ($matches[0] as $match) {
645
- $offset = $match[1];
646
- $content = substr($content, 0, $offset) . str_replace(array('“', '″', '&#8220;', '&quote;', '&#8243;'), '"', $match[0]) . substr($content, $offset + strlen($match[0]));
647
- }
648
- }
649
- } else {
650
- $content = self::inject_ads( $content, $content_orig, self::$ads_for_placeholders );
651
- self::$ads_for_placeholders = array();
652
- }
653
  return $content;
654
  }
655
 
@@ -851,15 +808,5 @@ class Advanced_Ads_Placements {
851
  return $result;
852
  }
853
 
854
- /**
855
- * Check if new content injection logic should be used.
856
- *
857
- * @return bool
858
- */
859
- public static function is_new_content_injection() {
860
- // Enabled for new users or those who enabled it.
861
- $plugin_options = Advanced_Ads::get_instance()->options();
862
- return ! $plugin_options || ! empty( $plugin_options['content-injection-new'] );
863
- }
864
  }
865
 
558
  private static function get_content_to_load( $content, $wpCharset ) {
559
  $plugin_options = Advanced_Ads::get_instance()->options();
560
 
561
+ // Prevent removing closing tags in scripts.
562
+ $content_to_load= preg_replace( '/<script.*?<\/script>/', '<!--\0-->', $content);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
 
564
  // check which priority the wpautop filter has; might have been disabled on purpose
565
  $wpautop_priority = has_filter( 'the_content', 'wpautop');
581
  private static function filter_ad_content( $ad_content, $tag_name, $options ) {
582
  $plugin_options = Advanced_Ads::get_instance()->options();
583
 
584
+ //Inject placeholder.
585
+ $id = count( self::$ads_for_placeholders );
586
+ self::$ads_for_placeholders[] = array(
587
+ 'id' => $id,
588
+ 'tag' => $tag_name,
589
+ 'type' => $options['before'] ? 'before' : 'after',
590
+ 'ad' => $ad_content
591
+ );
592
+ $ad_content = '%advads_placeholder_' . $id . '%';
 
 
 
 
 
 
 
 
593
 
594
  return $ad_content;
595
  }
603
  */
604
  private static function prepare_output( $content, $content_orig ) {
605
  $plugin_options = Advanced_Ads::get_instance()->options();
 
 
 
 
 
606
 
607
+ $content = self::inject_ads( $content, $content_orig, self::$ads_for_placeholders );
608
+ self::$ads_for_placeholders = array();
609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  return $content;
611
  }
612
 
808
  return $result;
809
  }
810
 
 
 
 
 
 
 
 
 
 
 
811
  }
812
 
classes/ad_type_image.php CHANGED
@@ -60,11 +60,15 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
60
  <?php $this->create_image_tag( $id, $ad ); ?>
61
  </div>
62
  <?php // don’t show if tracking plugin enabled
63
- if( ! defined( 'AAT_VERSION' )) : ?>
64
- <span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span>
65
  <div>
66
- <input type="url" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>" placeholder="<?php _e( 'Link to target site', 'advanced-ads' ); ?>" /></p>
67
- </div><hr/><?php
 
 
 
 
68
  endif;
69
  }
70
 
60
  <?php $this->create_image_tag( $id, $ad ); ?>
61
  </div>
62
  <?php // don’t show if tracking plugin enabled
63
+ if ( ! defined( 'AAT_VERSION' ) ) : ?>
64
+ <label for="advads-url" class="label"><?php _e( 'URL', 'advanced-ads' ); ?></label>
65
  <div>
66
+ <input type="url" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>" placeholder="<?php _e( 'https://www.example.com/', 'advanced-ads' ); ?>"/>
67
+ <p class="description">
68
+ <?php _e( 'Link to target site including http(s)', 'advanced-ads' ); ?>
69
+ </p>
70
+ </div>
71
+ <hr/><?php
72
  endif;
73
  }
74
 
classes/ad_type_plain.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Advanced Ads Plain Ad Type
4
  *
@@ -13,115 +14,134 @@
13
  * see ad-type-content.php for a better sample on ad type
14
  *
15
  */
16
- class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract{
17
 
18
  /**
19
  * ID - internal type of the ad type
20
- * *
21
  * @since 1.0.0
22
  */
23
  public $ID = 'plain';
24
 
25
  /**
26
- * set basic attributes
27
  *
28
  * @since 1.0.0
29
  */
30
  public function __construct() {
31
- $this->title = __( 'Plain Text and Code', 'advanced-ads' );
32
  $this->description = __( 'Any ad network, Amazon, customized AdSense codes, shortcodes, and code like JavaScript, HTML or PHP.', 'advanced-ads' );
33
- $this->parameters = array(
34
- 'content' => ''
35
  );
36
  }
37
 
38
  /**
39
- * output for the ad parameters metabox
40
  *
41
- * this will be loaded using ajax when changing the ad type radio buttons
42
  * echo the output right away here
43
  * name parameters must be in the "advanced_ads" array
44
  *
45
- * @param obj $ad ad object
 
46
  * @since 1.0.0
47
  */
48
- public function render_parameters($ad){
49
- // load content
50
- $content = (isset($ad->content)) ? $ad->content : '';
51
 
52
  ?><p class="description"><?php _e( 'Insert plain text or code into this field.', 'advanced-ads' ); ?></p>
53
- <textarea id="advads-ad-content-plain" cols="40" rows="10" name="advanced_ad[content]" onkeyup="Advanced_Ads_Admin.check_ad_source();"><?php echo esc_textarea( $content ); ?></textarea>
 
54
  <?php include ADVADS_BASE_PATH . 'admin/views/ad-info-after-textarea.php'; ?>
55
- <input type="hidden" name="advanced_ad[output][allow_php]" value="0"/>
56
-
57
- <?php
58
-
59
- $this->render_php_allow($ad);
60
- $this->render_shortcodes_allow( $ad );
61
- ?><script>jQuery( function() { Advanced_Ads_Admin.check_ad_source(); } );</script><?php
 
62
  }
63
-
64
  /**
65
- * render php output field
66
- *
67
- * @param $ad Advanced_Ads_Ad object
68
  */
69
- public function render_php_allow( $ad ){
70
- if( defined( 'ADVANCED_ADS_DISALLOW_PHP' ) ){
71
- return;
72
- }
73
-
74
- $content = (isset($ad->content)) ? $ad->content : '';
75
-
76
- // check if php is allowed
77
- if ( isset($ad->output['allow_php']) ){
78
- $allow_php = absint( $ad->output['allow_php'] );
79
- } else {
80
- /**
81
- * for compatibility for ads with php added prior to 1.3.18
82
- * check if there is php code in the content
83
- */
84
- if ( preg_match( '/\<\?php/', $content ) ){
85
- $allow_php = 1;
86
- } else {
87
- $allow_php = 0;
88
- }
89
- }
90
- ?>
91
- <label class="label" for="advads-parameters-php"><?php _e( 'Allow PHP', 'advanced-ads' ); ?></label>
92
- <div>
93
- <input id="advads-parameters-php" type="checkbox" name="advanced_ad[output][allow_php]" value="1" <?php checked( 1, $allow_php ); ?> onChange="Advanced_Ads_Admin.check_ad_source();"/><?php _e( 'Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)', 'advanced-ads' );
94
- ?><div class="advads-error-message" id="advads-parameters-php-warning" style="display:none;"><?php _e( 'No PHP tag detected in your code.', 'advanced-ads' );?> <?php _e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' );?></div></div><hr/><?php
95
-
 
 
 
 
 
 
96
  }
 
97
  /**
98
  * Render allow shortcodes field.
99
  *
100
- * @param $ad Advanced_Ads_Ad object
101
  */
102
- public function render_shortcodes_allow( $ad ){
103
  $allow_shortcodes = ! empty( $ad->output['allow_shortcodes'] );
104
  ?>
105
- <label class="label" for="advads-parameters-shortcodes"><?php _e( 'Allow shortcodes', 'advanced-ads' ); ?></label>
 
106
  <div>
107
- <input id="advads-parameters-shortcodes" type="checkbox" name="advanced_ad[output][allow_shortcodes]" value="1" <?php
108
- checked( 1, $allow_shortcodes ); ?> onChange="Advanced_Ads_Admin.check_ad_source();"/><?php _e( 'Execute shortcodes', 'advanced-ads' );
109
- ?><div class="advads-error-message" id="advads-parameters-shortcodes-warning" style="display:none;"><?php _e( 'No shortcode detected in your code.', 'advanced-ads' );?> <?php _e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' );?></div></div><hr/><?php
 
 
 
 
 
 
110
  }
111
 
112
  /**
113
- * prepare the ads frontend output
 
 
114
  *
115
- * @param obj $ad ad object
116
- * @return str $content ad content prepared for frontend output
117
  * @since 1.0.0
118
  */
119
- public function prepare_output($ad){
120
 
121
- // evaluate the code as php if setting was never saved or is allowed
122
- if ( ! defined( 'ADVANCED_ADS_DISALLOW_PHP' ) && ( ! isset($ad->output['allow_php']) || $ad->output['allow_php'] ) ){
123
  ob_start();
124
- eval('?>'.$ad->content);
 
125
  $content = ob_get_clean();
126
  } else {
127
  $content = $ad->content;
1
  <?php
2
+
3
  /**
4
  * Advanced Ads Plain Ad Type
5
  *
14
  * see ad-type-content.php for a better sample on ad type
15
  *
16
  */
17
+ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract {
18
 
19
  /**
20
  * ID - internal type of the ad type
21
+ *
22
  * @since 1.0.0
23
  */
24
  public $ID = 'plain';
25
 
26
  /**
27
+ * Set basic attributes
28
  *
29
  * @since 1.0.0
30
  */
31
  public function __construct() {
32
+ $this->title = __( 'Plain Text and Code', 'advanced-ads' );
33
  $this->description = __( 'Any ad network, Amazon, customized AdSense codes, shortcodes, and code like JavaScript, HTML or PHP.', 'advanced-ads' );
34
+ $this->parameters = array(
35
+ 'content' => '',
36
  );
37
  }
38
 
39
  /**
40
+ * Output for the ad parameters metabox
41
  *
42
+ * This will be loaded using ajax when changing the ad type radio buttons
43
  * echo the output right away here
44
  * name parameters must be in the "advanced_ads" array
45
  *
46
+ * @param object $ad Advanced_Ads_Ad.
47
+ *
48
  * @since 1.0.0
49
  */
50
+ public function render_parameters( $ad ) {
51
+ // load content.
52
+ $content = ( isset( $ad->content ) ) ? $ad->content : '';
53
 
54
  ?><p class="description"><?php _e( 'Insert plain text or code into this field.', 'advanced-ads' ); ?></p>
55
+ <textarea id="advads-ad-content-plain" cols="40" rows="10" name="advanced_ad[content]"
56
+ onkeyup="Advanced_Ads_Admin.check_ad_source();"><?php echo esc_textarea( $content ); ?></textarea>
57
  <?php include ADVADS_BASE_PATH . 'admin/views/ad-info-after-textarea.php'; ?>
58
+ <input type="hidden" name="advanced_ad[output][allow_php]" value="0"/>
59
+
60
+ <?php
61
+
62
+ $this->render_php_allow( $ad );
63
+ $this->render_shortcodes_allow( $ad );
64
+ ?>
65
+ <script>jQuery( function () { Advanced_Ads_Admin.check_ad_source() } )</script><?php
66
  }
67
+
68
  /**
69
+ * Render php output field
70
+ *
71
+ * @param object $ad Advanced_Ads_Ad object.
72
  */
73
+ public function render_php_allow( $ad ) {
74
+ if ( defined( 'ADVANCED_ADS_DISALLOW_PHP' ) ) {
75
+ return;
76
+ }
77
+
78
+ $content = ( isset( $ad->content ) ) ? $ad->content : '';
79
+
80
+ // check if php is allowed.
81
+ if ( isset( $ad->output['allow_php'] ) ) {
82
+ $allow_php = absint( $ad->output['allow_php'] );
83
+ } else {
84
+ /**
85
+ * For compatibility for ads with PHP added prior to 1.3.18
86
+ * check if there is php code in the content
87
+ */
88
+ if ( preg_match( '/\<\?php/', $content ) ) {
89
+ $allow_php = 1;
90
+ } else {
91
+ $allow_php = 0;
92
+ }
93
+ }
94
+ ?>
95
+ <label class="label" for="advads-parameters-php"><?php _e( 'Allow PHP', 'advanced-ads' ); ?></label>
96
+ <div>
97
+ <input id="advads-parameters-php" type="checkbox" name="advanced_ad[output][allow_php]"
98
+ value="1" <?php checked( 1, $allow_php ); ?>
99
+ onChange="Advanced_Ads_Admin.check_ad_source();"/><?php _e( 'Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)', 'advanced-ads' );
100
+ ?>
101
+ <div class="advads-error-message" id="advads-parameters-php-warning"
102
+ style="display:none;"><?php _e( 'No PHP tag detected in your code.', 'advanced-ads' ); ?><?php _e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' ); ?></div>
103
+ </div>
104
+ <hr/><?php
105
+
106
  }
107
+
108
  /**
109
  * Render allow shortcodes field.
110
  *
111
+ * @param object $ad Advanced_Ads_Ad object.
112
  */
113
+ public function render_shortcodes_allow( $ad ) {
114
  $allow_shortcodes = ! empty( $ad->output['allow_shortcodes'] );
115
  ?>
116
+ <label class="label"
117
+ for="advads-parameters-shortcodes"><?php _e( 'Allow shortcodes', 'advanced-ads' ); ?></label>
118
  <div>
119
+ <input id="advads-parameters-shortcodes" type="checkbox" name="advanced_ad[output][allow_shortcodes]"
120
+ value="1" <?php
121
+ checked( 1, $allow_shortcodes ); ?>
122
+ onChange="Advanced_Ads_Admin.check_ad_source();"/><?php _e( 'Execute shortcodes', 'advanced-ads' );
123
+ ?>
124
+ <div class="advads-error-message" id="advads-parameters-shortcodes-warning"
125
+ style="display:none;"><?php _e( 'No shortcode detected in your code.', 'advanced-ads' ); ?><?php _e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' ); ?></div>
126
+ </div>
127
+ <hr/><?php
128
  }
129
 
130
  /**
131
+ * Prepare the ads frontend output
132
+ *
133
+ * @param object $ad ad object.
134
  *
135
+ * @return string $content ad content prepared for frontend output.
 
136
  * @since 1.0.0
137
  */
138
+ public function prepare_output( $ad ) {
139
 
140
+ // evaluate the code as PHP if setting was never saved or is allowed.
141
+ if ( ! defined( 'ADVANCED_ADS_DISALLOW_PHP' ) && ( ! isset( $ad->output['allow_php'] ) || $ad->output['allow_php'] ) ) {
142
  ob_start();
143
+ // this code only runs if the "Allow PHP" option for plain text ads was enabled.
144
+ eval( '?>' . $ad->content );
145
  $content = ob_get_clean();
146
  } else {
147
  $content = $ad->content;
classes/checks.php CHANGED
@@ -217,9 +217,6 @@ class Advanced_Ads_Checks {
217
  if( class_exists( 'SimilarPosts', false ) ){ // Similar Posts, https://de.wordpress.org/plugins/similar-posts/.
218
  $conflicting_plugins[] = 'Similar Posts';
219
  }
220
- if( defined( 'WPAUTOTERMS_SLUG' ) ) { // https://wordpress.org/plugins/auto-terms-of-service-and-privacy-policy/.
221
- $conflicting_plugins[] = 'WP AutoTerms';
222
- }
223
 
224
  return $conflicting_plugins;
225
  }
@@ -334,9 +331,9 @@ class Advanced_Ads_Checks {
334
  */
335
  public static function jquery_ui_conflict(){
336
  ?>
337
- <script>// string from jquery-ui source code
338
  jQuery(document).ready(function(){
339
- var needle = 'var g="string"==typeof f,h=c.call(arguments,1)';
340
  if ( jQuery.fn.button.toString().indexOf( needle ) === -1 || jQuery.fn.tooltip.toString().indexOf( needle ) === -1 ) {
341
  advads_push_notice( 'jquery_ui_conflict' );
342
  }
217
  if( class_exists( 'SimilarPosts', false ) ){ // Similar Posts, https://de.wordpress.org/plugins/similar-posts/.
218
  $conflicting_plugins[] = 'Similar Posts';
219
  }
 
 
 
220
 
221
  return $conflicting_plugins;
222
  }
331
  */
332
  public static function jquery_ui_conflict(){
333
  ?>
334
+ <script>
335
  jQuery(document).ready(function(){
336
+ var needle = 'prior to initialization;' // A string from jquery-ui source code.
337
  if ( jQuery.fn.button.toString().indexOf( needle ) === -1 || jQuery.fn.tooltip.toString().indexOf( needle ) === -1 ) {
338
  advads_push_notice( 'jquery_ui_conflict' );
339
  }
classes/display-conditions.php CHANGED
@@ -146,8 +146,7 @@ class Advanced_Ads_Display_Conditions {
146
 
147
  // add tax type to label if we find it multiple times.
148
  if ( $tax_label_counts[ $_tax->label ] < 2 ) {
149
- $label = $_tax->label;
150
- $archive_label = $_tax->labels->singular_name;
151
  } else {
152
  $label = sprintf( '%s (%s)', $_tax->label, $_tax->name );
153
  $archive_label = sprintf( '%s (%s)', $_tax->labels->singular_name, $_tax->name );
@@ -343,6 +342,7 @@ class Advanced_Ads_Display_Conditions {
343
 
344
  // form name basis.
345
  $name = self::get_form_name_with_index( $form_name, $index );
 
346
 
347
  self::render_type_field( $options['type'], $name );
348
 
@@ -374,14 +374,15 @@ class Advanced_Ads_Display_Conditions {
374
  } else {
375
  $_label = sprintf( '%s (%s)', $_type->label, $_type_id );
376
  }
377
- ?><label class="button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id;
 
378
  ?>"><?php echo $_label ?></label><input type="checkbox"
379
- id="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id; ?>"
380
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
381
  value="<?php echo $_type_id; ?>"><?php
382
  }
 
383
  ?>
384
- <p class="advads-conditions-not-selected advads-error-message"><?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p>
385
  </div><?php
386
  }
387
 
@@ -410,6 +411,7 @@ class Advanced_Ads_Display_Conditions {
410
 
411
  // form name basis.
412
  $name = self::get_form_name_with_index( $form_name, $index );
 
413
 
414
  self::render_type_field( $options['type'], $name );
415
 
@@ -471,9 +473,14 @@ class Advanced_Ads_Display_Conditions {
471
 
472
  ?>
473
  <div class="advads-conditions-single advads-buttonset">
 
 
 
 
 
 
 
474
  <?php
475
- self::display_term_list( $taxonomy, $values, $name . '[value][]', $max_terms, $index );
476
- ?></div><?php
477
  }
478
 
479
  /**
@@ -492,6 +499,7 @@ class Advanced_Ads_Display_Conditions {
492
  $taxonomies = get_taxonomies( array( 'public' => 1 ), 'objects' );
493
 
494
  $name = self::get_form_name_with_index( $form_name, $index );
 
495
 
496
  // get values and select operator based on previous settings.
497
  $operator = ( isset( $options['operator'] ) && 'is_not' === $options['operator'] ) ? 'is_not' : 'is';
@@ -517,14 +525,16 @@ class Advanced_Ads_Display_Conditions {
517
  } else {
518
  $_label = sprintf( '%s (%s)', $_taxonomy->label, $_taxonomy_id );
519
  }
520
- ?><label class="button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_taxonomy_id;
 
 
521
  ?>"><?php echo $_label ?></label><input type="checkbox"
522
- id="advads-conditions-<?php echo $index; ?>-<?php echo $_taxonomy_id; ?>"
523
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
524
  value="<?php echo $_taxonomy_id; ?>"><?php
525
  endforeach;
 
526
  ?>
527
- <p class="advads-conditions-not-selected advads-error-message"><?php echo esc_attr_x( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p>
528
  </div>
529
  <?php
530
  }
@@ -547,6 +557,7 @@ class Advanced_Ads_Display_Conditions {
547
  'number' => $max_terms,
548
  )
549
  );
 
550
 
551
  if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) :
552
  // display search field if the term limit is reached.
@@ -579,16 +590,18 @@ class Advanced_Ads_Display_Conditions {
579
  ?>
580
  <div class="advads-conditions-terms-buttons advads-buttonset"><?php
581
  foreach ( $terms as $_term ) :
582
- $field_id = "advads-conditions-$index-$_term->term_id";
583
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $inputname; ?>"
584
  value="<?php echo $_term->term_id; ?>" <?php checked( in_array( $_term->term_id, $checked ), true );
585
  ?>><label for="<?php echo $field_id; ?>"><?php echo $_term->name; ?></label><?php
586
  endforeach;
 
587
  ?>
588
- <p class="advads-conditions-not-selected advads-error-message"><?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p>
589
  </div><?php
590
  endif;
591
  endif;
 
 
592
  }
593
 
594
  /**
@@ -677,16 +690,18 @@ class Advanced_Ads_Display_Conditions {
677
 
678
  self::render_type_field( $options['type'], $name );
679
 
 
680
  foreach ( $conditions as $_key => $_condition ) :
681
 
682
  // activate by default.
683
  $value = ( array() === $values || in_array( $_key, $values, true ) ) ? 1 : 0;
684
 
685
- $field_id = "advads-conditions-$index-$_key";
686
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $name; ?>[value][]"
687
  value="<?php echo $_key; ?>" <?php checked( 1, $value ); ?>><label
688
  for="<?php echo $field_id; ?>"><?php echo $_condition['label']; ?></label><?php
689
  endforeach;
 
690
  ?></div><?php
691
  return;
692
  }
146
 
147
  // add tax type to label if we find it multiple times.
148
  if ( $tax_label_counts[ $_tax->label ] < 2 ) {
149
+ $label = $archive_label = $_tax->label;
 
150
  } else {
151
  $label = sprintf( '%s (%s)', $_tax->label, $_tax->name );
152
  $archive_label = sprintf( '%s (%s)', $_tax->labels->singular_name, $_tax->name );
342
 
343
  // form name basis.
344
  $name = self::get_form_name_with_index( $form_name, $index );
345
+ $rand = md5( $name );
346
 
347
  self::render_type_field( $options['type'], $name );
348
 
374
  } else {
375
  $_label = sprintf( '%s (%s)', $_type->label, $_type_id );
376
  }
377
+ $field_id = "advads-conditions-$_type_id-$rand";
378
+ ?><label class="button" for="<?php echo $field_id;
379
  ?>"><?php echo $_label ?></label><input type="checkbox"
380
+ id="<?php echo $field_id; ?>"
381
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
382
  value="<?php echo $_type_id; ?>"><?php
383
  }
384
+ include ADVADS_BASE_PATH . 'admin/views/conditions/not-selected.php';
385
  ?>
 
386
  </div><?php
387
  }
388
 
411
 
412
  // form name basis.
413
  $name = self::get_form_name_with_index( $form_name, $index );
414
+ $rand = md5( $name );
415
 
416
  self::render_type_field( $options['type'], $name );
417
 
473
 
474
  ?>
475
  <div class="advads-conditions-single advads-buttonset">
476
+ <?php
477
+ $terms = self::display_term_list( $taxonomy, $values, $name . '[value][]', $max_terms, $index );
478
+ if ( empty( $terms ) ) {
479
+ include ADVADS_BASE_PATH . 'admin/views/conditions/no-option.php';
480
+ }
481
+ ?>
482
+ </div>
483
  <?php
 
 
484
  }
485
 
486
  /**
499
  $taxonomies = get_taxonomies( array( 'public' => 1 ), 'objects' );
500
 
501
  $name = self::get_form_name_with_index( $form_name, $index );
502
+ $rand = md5( $name );
503
 
504
  // get values and select operator based on previous settings.
505
  $operator = ( isset( $options['operator'] ) && 'is_not' === $options['operator'] ) ? 'is_not' : 'is';
525
  } else {
526
  $_label = sprintf( '%s (%s)', $_taxonomy->label, $_taxonomy_id );
527
  }
528
+
529
+ $field_id = "advads-conditions-$_taxonomy_id-$rand";
530
+ ?><label class="button" for="<?php echo $field_id
531
  ?>"><?php echo $_label ?></label><input type="checkbox"
532
+ id="<?php echo $field_id; ?>"
533
  name="<?php echo $name; ?>[value][]" <?php checked( $_val, 1 ); ?>
534
  value="<?php echo $_taxonomy_id; ?>"><?php
535
  endforeach;
536
+ include ADVADS_BASE_PATH . 'admin/views/conditions/not-selected.php';
537
  ?>
 
538
  </div>
539
  <?php
540
  }
557
  'number' => $max_terms,
558
  )
559
  );
560
+ $rand = md5( $inputname );
561
 
562
  if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) :
563
  // display search field if the term limit is reached.
590
  ?>
591
  <div class="advads-conditions-terms-buttons advads-buttonset"><?php
592
  foreach ( $terms as $_term ) :
593
+ $field_id = "advads-conditions-$_term->term_id-$rand";
594
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $inputname; ?>"
595
  value="<?php echo $_term->term_id; ?>" <?php checked( in_array( $_term->term_id, $checked ), true );
596
  ?>><label for="<?php echo $field_id; ?>"><?php echo $_term->name; ?></label><?php
597
  endforeach;
598
+ include ADVADS_BASE_PATH . 'admin/views/conditions/not-selected.php';
599
  ?>
 
600
  </div><?php
601
  endif;
602
  endif;
603
+
604
+ return $terms;
605
  }
606
 
607
  /**
690
 
691
  self::render_type_field( $options['type'], $name );
692
 
693
+ $rand = md5( $form_name );
694
  foreach ( $conditions as $_key => $_condition ) :
695
 
696
  // activate by default.
697
  $value = ( array() === $values || in_array( $_key, $values, true ) ) ? 1 : 0;
698
 
699
+ $field_id = "advads-conditions-$_key-$rand";
700
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $name; ?>[value][]"
701
  value="<?php echo $_key; ?>" <?php checked( 1, $value ); ?>><label
702
  for="<?php echo $field_id; ?>"><?php echo $_condition['label']; ?></label><?php
703
  endforeach;
704
+ include ADVADS_BASE_PATH . 'admin/views/conditions/not-selected.php';
705
  ?></div><?php
706
  return;
707
  }
classes/frontend_checks.php CHANGED
@@ -315,7 +315,7 @@ class Advanced_Ads_Frontend_Checks {
315
  'parent' => 'advanced_ads_ad_health',
316
  'id' => 'advanced_ads_ad_health_debug_dfp',
317
  'title' => __( 'debug DFP ads', 'advanced-ads' ),
318
- 'href' => esc_url( add_query_arg( 'googfc', '' ) ),
319
  'meta' => array(
320
  'class' => 'hidden advanced_ads_ad_health_debug_dfp_link',
321
  'target' => '_blank',
@@ -366,7 +366,9 @@ class Advanced_Ads_Frontend_Checks {
366
  $this->add_header_nodes( $wp_admin_bar, $issues, $notices );
367
 
368
  foreach ( $nodes as $node ) {
369
- $wp_admin_bar->add_node( $node['data'] );
 
 
370
  }
371
 
372
  $this->add_footer_nodes( $wp_admin_bar, $issues );
@@ -715,18 +717,17 @@ class Advanced_Ads_Frontend_Checks {
715
  advanced_ads_frontend_checks.showCount();
716
  }
717
  }
718
-
719
  // inform the user that AdSense Auto ads code was found
720
- function advads_highlight_adsense_auto_ads(){
721
- if ( window.jQuery ) {
722
- var auto_ads_pattern = /enable_page_level_ads: true/m
723
- if (auto_ads_pattern.exec(jQuery('head').text())) {
724
- var advads_autoads_code_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found');
725
- advads_autoads_code_link.className = advads_autoads_code_link.className.replace('hidden', '');
726
- }
727
- }
728
  }
729
- <?php endif;
730
  /**
731
  * code to check if current user gave consent to show ads
732
  */
@@ -761,7 +762,7 @@ class Advanced_Ads_Frontend_Checks {
761
  return $content;
762
  }
763
 
764
- // Allow DFP debugging by showing a link that points to the current URL with the 'googfc' parameter.
765
  if ( $ad->type === 'plain' && preg_match( '/gpt\.js/', $content ) ) {
766
  ob_start(); ?>
767
  <script>advanced_ads_ready( function() {
315
  'parent' => 'advanced_ads_ad_health',
316
  'id' => 'advanced_ads_ad_health_debug_dfp',
317
  'title' => __( 'debug DFP ads', 'advanced-ads' ),
318
+ 'href' => esc_url( add_query_arg( 'google_force_console', '1' ) ),
319
  'meta' => array(
320
  'class' => 'hidden advanced_ads_ad_health_debug_dfp_link',
321
  'target' => '_blank',
366
  $this->add_header_nodes( $wp_admin_bar, $issues, $notices );
367
 
368
  foreach ( $nodes as $node ) {
369
+ if ( isset( $node['data'] ) ) {
370
+ $wp_admin_bar->add_node( $node['data'] );
371
+ }
372
  }
373
 
374
  $this->add_footer_nodes( $wp_admin_bar, $issues );
717
  advanced_ads_frontend_checks.showCount();
718
  }
719
  }
720
+
721
  // inform the user that AdSense Auto ads code was found
722
+ function advads_highlight_adsense_auto_ads() {
723
+ if (window.jQuery) {
724
+ if (/script[^>]+data-ad-client|enable_page_level_ads:\s*true/.test(jQuery('head').html())) {
725
+ var advads_autoads_code_link = document.querySelector('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found');
726
+ advads_autoads_code_link.className = advads_autoads_code_link.className.replace('hidden', '');
727
+ }
728
+ }
 
729
  }
730
+ <?php endif;
731
  /**
732
  * code to check if current user gave consent to show ads
733
  */
762
  return $content;
763
  }
764
 
765
+ // Allow DFP debugging by showing a link that points to the current URL with the 'google_forec_console' parameter.
766
  if ( $ad->type === 'plain' && preg_match( '/gpt\.js/', $content ) ) {
767
  ob_start(); ?>
768
  <script>advanced_ads_ready( function() {
classes/plugin.php CHANGED
@@ -79,7 +79,7 @@ class Advanced_Ads_Plugin {
79
  *
80
  * @param Advanced_Ads_Model $model
81
  */
82
- public function set_model(Advanced_Ads_Model $model) {
83
  $this->model = $model;
84
  }
85
 
@@ -104,7 +104,7 @@ class Advanced_Ads_Plugin {
104
  add_action( 'admin_menu', array( $this, 'remove_taxonomy_menu_item' ) );
105
  // load widgets
106
  add_action( 'widgets_init', array( $this, 'widget_init' ) );
107
-
108
  // load display conditions
109
  Advanced_Ads_Display_Conditions::get_instance();
110
  new Advanced_Ads_Frontend_Checks;
@@ -142,11 +142,11 @@ class Advanced_Ads_Plugin {
142
  /**
143
  * Return the plugin slug.
144
  *
145
- * @since 1.0.0
146
  * @return Plugin slug variable.
 
147
  */
148
  public function get_plugin_slug() {
149
- return ADVADS_SLUG;
150
  }
151
 
152
  /**
@@ -159,9 +159,9 @@ class Advanced_Ads_Plugin {
159
  return;
160
  }
161
  // wp_enqueue_script( $this->get_plugin_slug() . '-plugin-script', plugins_url('assets/js/public.js', __FILE__), array('jquery'), ADVADS_VERSION);
162
- $options = $this->options();
163
  $activated_js = apply_filters( 'advanced-ads-activate-advanced-js', isset( $options['advanced-js'] ) );
164
- if ( $activated_js ){
165
  wp_enqueue_script( $this->get_plugin_slug() . '-advanced-js', ADVADS_BASE_URL . 'public/assets/js/advanced.js', array( 'jquery' ), ADVADS_VERSION );
166
  }
167
  }
@@ -178,29 +178,45 @@ class Advanced_Ads_Plugin {
178
  * // Called when DOM is ready.
179
  * } );
180
  */
181
-
182
- echo apply_filters( 'advanced-ads-attribution', sprintf( '<!-- managing ads with Advanced Ads – %s -->', ADVADS_URL ) );
183
 
184
  if ( advads_is_amp() ) {
185
  return;
186
  }
187
 
188
  ob_start();
189
- ?><script>
190
- <?php if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
191
- readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
192
- } else { ?>
193
- 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)}}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  <?php
195
- }
196
 
197
- // Output privacy options.
198
- $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
199
- if ( ! empty( $privacy_options['enabled'] ) ) {
200
- printf( '(advads_options = window.advads_options || {} )["privacy"] = %s;', json_encode( $privacy_options ) );
201
- }
202
 
203
- ?></script><?php
204
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
205
 
206
 
@@ -213,10 +229,11 @@ class Advanced_Ads_Plugin {
213
  /**
214
  * Fired when a new site is activated with a WPMU environment.
215
  *
 
 
216
  * @since 1.0.0
217
- * @param int $blog_id ID of the new blog.
218
  */
219
- public function activate_new_site($blog_id) {
220
 
221
  if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
222
  return;
@@ -261,19 +278,20 @@ class Advanced_Ads_Plugin {
261
  /**
262
  * Fired when the plugin is activated.
263
  *
264
- * @since 1.0.0
265
- * @param boolean $network_wide True if WPMU superadmin uses
266
  * "Network Activate" action, false if
267
  * WPMU is disabled or plugin is
268
  * activated on an individual blog.
 
 
269
  */
270
- public function activate($network_wide) {
271
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
272
 
273
  if ( $network_wide ) {
274
  // Get all blog ids
275
  global $wpdb;
276
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
277
  $original_blog_id = $wpdb->blogid;
278
 
279
  foreach ( $blog_ids as $blog_id ) {
@@ -293,21 +311,22 @@ class Advanced_Ads_Plugin {
293
  /**
294
  * Fired when the plugin is deactivated.
295
  *
296
- * @since 1.0.0
297
- * @param boolean $network_wide
298
  *
299
  * True if WPMU superadmin uses
300
  * "Network Deactivate" action, false if
301
  * WPMU is disabled or plugin is
302
  * deactivated on an individual blog.
 
 
303
  */
304
- public function deactivate($network_wide) {
305
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
306
 
307
  if ( $network_wide ) {
308
  // Get all blog ids
309
  global $wpdb;
310
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
311
  $original_blog_id = $wpdb->blogid;
312
 
313
  foreach ( $blog_ids as $blog_id ) {
@@ -350,12 +369,13 @@ class Advanced_Ads_Plugin {
350
  /**
351
  * shortcode to include ad in frontend
352
  *
353
- * @since 1.0.0
354
  * @param arr $atts
 
 
355
  */
356
- public function shortcode_display_ad($atts){
357
  $atts = is_array( $atts ) ? $atts : array();
358
- $id = isset($atts['id']) ? (int) $atts['id'] : 0;
359
  $atts = $this->prepare_shortcode_atts( $atts );
360
 
361
  // use the public available function here
@@ -365,12 +385,13 @@ class Advanced_Ads_Plugin {
365
  /**
366
  * shortcode to include ad from an ad group in frontend
367
  *
368
- * @since 1.0.0
369
  * @param arr $atts
 
 
370
  */
371
- public function shortcode_display_ad_group($atts){
372
  $atts = is_array( $atts ) ? $atts : array();
373
- $id = isset($atts['id']) ? (int) $atts['id'] : 0;
374
  $atts = $this->prepare_shortcode_atts( $atts );
375
 
376
  // use the public available function here
@@ -380,12 +401,13 @@ class Advanced_Ads_Plugin {
380
  /**
381
  * shortcode to display content of an ad placement in frontend
382
  *
383
- * @since 1.1.0
384
  * @param arr $atts
 
 
385
  */
386
- public function shortcode_display_ad_placement($atts){
387
  $atts = is_array( $atts ) ? $atts : array();
388
- $id = isset($atts['id']) ? (string) $atts['id'] : '';
389
  $atts = $this->prepare_shortcode_atts( $atts );
390
 
391
  // use the public available function here
@@ -396,6 +418,7 @@ class Advanced_Ads_Plugin {
396
  * Prepare shortcode attributes.
397
  *
398
  * @param array $atts array with strings
 
399
  * @return array
400
  */
401
  private function prepare_shortcode_atts( $atts ) {
@@ -406,9 +429,9 @@ class Advanced_Ads_Plugin {
406
  * Example: [ 'output__margin__top' => 1 ] => ['output']['margin']['top'] = 1
407
  */
408
  if ( ! defined( 'ADVANCED_ADS_DISABLE_CHANGE' ) || ! ADVANCED_ADS_DISABLE_CHANGE ) {
409
- foreach ( $atts as $attr => $data ) {
410
  $levels = explode( '__', $attr );
411
- $last = array_pop( $levels );
412
 
413
  $cur_lvl = &$result;
414
 
@@ -428,7 +451,7 @@ class Advanced_Ads_Plugin {
428
 
429
  // Ad type: 'content' and a shortcode inside.
430
  if ( isset( $atts['ad_args'] ) ) {
431
- $result = array_merge( $result, json_decode( urldecode( $atts['ad_args'] ) ,true) );
432
 
433
  }
434
 
@@ -436,27 +459,34 @@ class Advanced_Ads_Plugin {
436
  }
437
 
438
  /**
439
- * return plugin options
440
  * these are the options updated by the user
441
  *
442
- * @since 1.0.1
443
  * @return array $options
 
444
  * @todo parse default options
445
  */
446
  public function options() {
447
- // we can’t store options if WPML String Translations is enabled, or it would not translate the "Ad Label" option
448
- if ( ! isset( $this->options ) || class_exists('WPML_ST_String') ) {
449
  $this->options = get_option( ADVADS_SLUG, array() );
450
  }
451
 
 
 
 
 
 
 
452
  return $this->options;
453
  }
454
 
455
  /**
456
  * update plugin options (not for settings page, but if automatic options are needed)
457
  *
458
- * @since 1.5.1
459
  * @param array $options new options
 
 
460
  */
461
  public function update_options( array $options ) {
462
  // do not allow to clear options
@@ -472,31 +502,31 @@ class Advanced_Ads_Plugin {
472
  * return internal plugin options
473
  * these are options set by the plugin
474
  *
475
- * @since 1.0.1
476
  * @return array $options
 
477
  * @todo parse default options
478
  */
479
  public function internal_options() {
480
  if ( ! isset( $this->internal_options ) ) {
481
- $defaults = array(
482
- 'version' => ADVADS_VERSION,
483
- 'installed' => time(), // when was this installed
484
- );
485
- $this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
486
-
487
- // save defaults
488
- if($this->internal_options === array()){
489
- $this->internal_options = $defaults;
490
- $this->update_internal_options($this->internal_options);
491
-
492
- Advanced_Ads_Plugin::get_instance()->create_capabilities();
493
- }
494
-
495
- // for versions installed prior to 1.5.3 set installed date for now
496
- if( ! isset( $this->internal_options['installed'] )){
497
- $this->internal_options['installed'] = time();
498
- $this->update_internal_options($this->internal_options);
499
- }
500
  }
501
 
502
  return $this->internal_options;
@@ -505,8 +535,9 @@ class Advanced_Ads_Plugin {
505
  /**
506
  * update internal plugin options
507
  *
508
- * @since 1.5.1
509
  * @param array $options new internal options
 
 
510
  */
511
  public function update_internal_options( array $options ) {
512
  // do not allow to clear options
@@ -523,7 +554,7 @@ class Advanced_Ads_Plugin {
523
  *
524
  * @since 1.6.8.2
525
  */
526
- public function get_frontend_prefix(){
527
  if ( ! $this->frontend_prefix ) {
528
  $options = $this->options();
529
 
@@ -532,18 +563,19 @@ class Advanced_Ads_Plugin {
532
  // deprecated: keeps widgets working that previously received an id based on the front-prefix
533
  $frontend_prefix = esc_attr( $options['id-prefix'] );
534
  } else {
535
- $host = parse_url( get_home_url(), PHP_URL_HOST );
536
  $frontend_prefix = preg_match( '/[A-Za-z][A-Za-z0-9_]{4}/', $host, $result ) ? $result[0] . '-' : Advanced_Ads_Plugin::DEFAULT_FRONTEND_PREFIX;
537
  }
538
  } else {
539
  $frontend_prefix = esc_attr( $options['front-prefix'] );
540
  }
541
  /**
542
- * Applying the filter here makes sure that it is the same frontend prefix for all
543
  * calls on this page impression
544
  */
545
  $this->frontend_prefix = apply_filters( 'advanced-ads-frontend-prefix', $frontend_prefix );
546
  }
 
547
  return $this->frontend_prefix;
548
  }
549
 
@@ -552,31 +584,32 @@ class Advanced_Ads_Plugin {
552
  *
553
  * @since 1.6.10.2
554
  */
555
- public function get_content_injection_priority(){
556
  $options = $this->options();
557
 
558
  return isset( $options['content-injection-priority'] ) ? intval( $options['content-injection-priority'] ) : 100;
559
  }
560
-
561
  /**
562
  * returns the capability needed to perform an action
563
- *
564
- * @since 1.6.14
565
  * @param str $capability a capability to check, can be internal to Advanced Ads
 
566
  * @return str $capability a valid WordPress capability
 
567
  */
568
- public static function user_cap( $capability = 'manage_options' ){
569
-
570
  global $advanced_ads_capabilities;
571
-
572
  // admins can do everything
573
  // is also a fallback if no option or more specific capability is given
574
- if( current_user_can( 'manage_options' ) ){
575
  return 'manage_options';
576
  }
577
-
578
  return apply_filters( 'advanced-ads-capability', $capability );
579
-
580
  // check, if capability is mapped to an existing WP capability
581
  /*if( isset( $advanced_ads_capabilities[ $capability ] ) ){
582
  return apply_filters( 'advanced-ads-capability', $advanced_ads_capabilities[ $capability ], $capability );
@@ -584,7 +617,7 @@ class Advanced_Ads_Plugin {
584
  // if not, use 'manage_posts' capability
585
  return apply_filters( 'advanced-ads-capability', 'manage_options', $capability );
586
  }*/
587
-
588
  }
589
 
590
  /**
@@ -710,25 +743,25 @@ class Advanced_Ads_Plugin {
710
  * @return bool true if there is any add-on activated
711
  */
712
  public static function any_activated_add_on() {
713
- return ( defined( 'AAP_VERSION' ) // Advanced Ads Pro.
714
- || defined( 'AASA_VERSION' ) // Selling Ads.
715
- || defined( 'AAT_VERSION' ) // Tracking.
716
- || defined( 'AASADS_VERSION' ) // Sticky Ads.
717
- || defined( 'AAR_VERSION' ) // Responsive Ads.
718
- || defined( 'AAPLDS_VERSION' ) // PopUp and Layer Ads.
719
- || defined( 'AAGT_SLUG' ) // Geo-Targeting.
720
- );
721
  }
722
 
723
  /**
724
  * Get the correct support URL: wp.org for free users and website for those with any add-on installed
725
- *
726
- * @param string $utm add UTM parameter to the link leading to https://wpadvancedads.com, if given
727
  *
728
  * @return string URL.
729
  */
730
- static function support_url( $utm = '' ) {
731
-
732
  // return self::any_activated_add_on() ? ADVADS_URL . 'support/' .$utm : 'https://wordpress.org/support/plugin/advanced-ads#new-post';
733
  // $utm = empty( $utm ) ? '#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-support' : $utm;
734
  if ( self::any_activated_add_on() ) {
@@ -736,6 +769,7 @@ class Advanced_Ads_Plugin {
736
  } else {
737
  $url = ADVADS_URL . 'support/' . $utm . '-free-user';
738
  }
 
739
  return $url;
740
  }
741
 
@@ -751,7 +785,7 @@ class Advanced_Ads_Plugin {
751
 
752
  $url = empty( $url ) ? home_url() : $url;
753
 
754
- $code = intval( substr( md5( $url ), -1 ), 16 );
755
 
756
  switch ( $ex ) {
757
  case 'b':
@@ -764,4 +798,40 @@ class Advanced_Ads_Plugin {
764
  return $code & 1; // returns 1 or 0.
765
  }
766
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
767
  }
79
  *
80
  * @param Advanced_Ads_Model $model
81
  */
82
+ public function set_model( Advanced_Ads_Model $model ) {
83
  $this->model = $model;
84
  }
85
 
104
  add_action( 'admin_menu', array( $this, 'remove_taxonomy_menu_item' ) );
105
  // load widgets
106
  add_action( 'widgets_init', array( $this, 'widget_init' ) );
107
+
108
  // load display conditions
109
  Advanced_Ads_Display_Conditions::get_instance();
110
  new Advanced_Ads_Frontend_Checks;
142
  /**
143
  * Return the plugin slug.
144
  *
 
145
  * @return Plugin slug variable.
146
+ * @since 1.0.0
147
  */
148
  public function get_plugin_slug() {
149
+ return ADVADS_SLUG;
150
  }
151
 
152
  /**
159
  return;
160
  }
161
  // wp_enqueue_script( $this->get_plugin_slug() . '-plugin-script', plugins_url('assets/js/public.js', __FILE__), array('jquery'), ADVADS_VERSION);
162
+ $options = $this->options();
163
  $activated_js = apply_filters( 'advanced-ads-activate-advanced-js', isset( $options['advanced-js'] ) );
164
+ if ( $activated_js ) {
165
  wp_enqueue_script( $this->get_plugin_slug() . '-advanced-js', ADVADS_BASE_URL . 'public/assets/js/advanced.js', array( 'jquery' ), ADVADS_VERSION );
166
  }
167
  }
178
  * // Called when DOM is ready.
179
  * } );
180
  */
181
+
182
+ echo apply_filters( 'advanced-ads-attribution', sprintf( '<!-- managing ads with Advanced Ads – %s -->', ADVADS_URL ) );
183
 
184
  if ( advads_is_amp() ) {
185
  return;
186
  }
187
 
188
  ob_start();
189
+ ?>
190
+ <script>
191
+ <?php if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
192
+ readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
193
+ } else { ?>
194
+ advanced_ads_ready = function () {
195
+ var fns = [], listener, doc = typeof document === 'object' && document,
196
+ hack = doc && doc.documentElement.doScroll, domContentLoaded = 'DOMContentLoaded',
197
+ loaded = doc && (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test( doc.readyState )
198
+ if ( ! loaded && doc ) {
199
+ listener = function () {
200
+ doc.removeEventListener( domContentLoaded, listener )
201
+ window.removeEventListener( 'load', listener )
202
+ loaded = 1
203
+ while ( listener = fns.shift() ) listener()
204
+ }
205
+ doc.addEventListener( domContentLoaded, listener )
206
+ window.addEventListener( 'load', listener )
207
+ }
208
+ return function ( fn ) {loaded ? setTimeout( fn, 0 ) : fns.push( fn )}
209
+ }()
210
  <?php
211
+ }
212
 
213
+ // Output privacy options.
214
+ $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
215
+ if ( ! empty( $privacy_options['enabled'] ) ) {
216
+ printf( '(advads_options = window.advads_options || {} )["privacy"] = %s;', json_encode( $privacy_options ) );
217
+ }
218
 
219
+ ?></script><?php
220
  echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
221
 
222
 
229
  /**
230
  * Fired when a new site is activated with a WPMU environment.
231
  *
232
+ * @param int $blog_id ID of the new blog.
233
+ *
234
  * @since 1.0.0
 
235
  */
236
+ public function activate_new_site( $blog_id ) {
237
 
238
  if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
239
  return;
278
  /**
279
  * Fired when the plugin is activated.
280
  *
281
+ * @param boolean $network_wide True if WPMU superadmin uses
 
282
  * "Network Activate" action, false if
283
  * WPMU is disabled or plugin is
284
  * activated on an individual blog.
285
+ *
286
+ * @since 1.0.0
287
  */
288
+ public function activate( $network_wide ) {
289
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
290
 
291
  if ( $network_wide ) {
292
  // Get all blog ids
293
  global $wpdb;
294
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
295
  $original_blog_id = $wpdb->blogid;
296
 
297
  foreach ( $blog_ids as $blog_id ) {
311
  /**
312
  * Fired when the plugin is deactivated.
313
  *
314
+ * @param boolean $network_wide
 
315
  *
316
  * True if WPMU superadmin uses
317
  * "Network Deactivate" action, false if
318
  * WPMU is disabled or plugin is
319
  * deactivated on an individual blog.
320
+ *
321
+ * @since 1.0.0
322
  */
323
+ public function deactivate( $network_wide ) {
324
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
325
 
326
  if ( $network_wide ) {
327
  // Get all blog ids
328
  global $wpdb;
329
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
330
  $original_blog_id = $wpdb->blogid;
331
 
332
  foreach ( $blog_ids as $blog_id ) {
369
  /**
370
  * shortcode to include ad in frontend
371
  *
 
372
  * @param arr $atts
373
+ *
374
+ * @since 1.0.0
375
  */
376
+ public function shortcode_display_ad( $atts ) {
377
  $atts = is_array( $atts ) ? $atts : array();
378
+ $id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
379
  $atts = $this->prepare_shortcode_atts( $atts );
380
 
381
  // use the public available function here
385
  /**
386
  * shortcode to include ad from an ad group in frontend
387
  *
 
388
  * @param arr $atts
389
+ *
390
+ * @since 1.0.0
391
  */
392
+ public function shortcode_display_ad_group( $atts ) {
393
  $atts = is_array( $atts ) ? $atts : array();
394
+ $id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
395
  $atts = $this->prepare_shortcode_atts( $atts );
396
 
397
  // use the public available function here
401
  /**
402
  * shortcode to display content of an ad placement in frontend
403
  *
 
404
  * @param arr $atts
405
+ *
406
+ * @since 1.1.0
407
  */
408
+ public function shortcode_display_ad_placement( $atts ) {
409
  $atts = is_array( $atts ) ? $atts : array();
410
+ $id = isset( $atts['id'] ) ? (string) $atts['id'] : '';
411
  $atts = $this->prepare_shortcode_atts( $atts );
412
 
413
  // use the public available function here
418
  * Prepare shortcode attributes.
419
  *
420
  * @param array $atts array with strings
421
+ *
422
  * @return array
423
  */
424
  private function prepare_shortcode_atts( $atts ) {
429
  * Example: [ 'output__margin__top' => 1 ] => ['output']['margin']['top'] = 1
430
  */
431
  if ( ! defined( 'ADVANCED_ADS_DISABLE_CHANGE' ) || ! ADVANCED_ADS_DISABLE_CHANGE ) {
432
+ foreach ( $atts as $attr => $data ) {
433
  $levels = explode( '__', $attr );
434
+ $last = array_pop( $levels );
435
 
436
  $cur_lvl = &$result;
437
 
451
 
452
  // Ad type: 'content' and a shortcode inside.
453
  if ( isset( $atts['ad_args'] ) ) {
454
+ $result = array_merge( $result, json_decode( urldecode( $atts['ad_args'] ), true ) );
455
 
456
  }
457
 
459
  }
460
 
461
  /**
462
+ * Return plugin options
463
  * these are the options updated by the user
464
  *
 
465
  * @return array $options
466
+ * @since 1.0.1
467
  * @todo parse default options
468
  */
469
  public function options() {
470
+ // we can’t store options if WPML String Translations is enabled, or it would not translate the "Ad Label" option.
471
+ if ( ! isset( $this->options ) || class_exists( 'WPML_ST_String' ) ) {
472
  $this->options = get_option( ADVADS_SLUG, array() );
473
  }
474
 
475
+ // disable Ad Health by default for new users.
476
+ if ( ! isset( $this->options['disable-notices'] )
477
+ && self::show_to_new_users( 1575892800, 'b' ) ) {
478
+ $this->options['disable-notices'] = 1;
479
+ }
480
+
481
  return $this->options;
482
  }
483
 
484
  /**
485
  * update plugin options (not for settings page, but if automatic options are needed)
486
  *
 
487
  * @param array $options new options
488
+ *
489
+ * @since 1.5.1
490
  */
491
  public function update_options( array $options ) {
492
  // do not allow to clear options
502
  * return internal plugin options
503
  * these are options set by the plugin
504
  *
 
505
  * @return array $options
506
+ * @since 1.0.1
507
  * @todo parse default options
508
  */
509
  public function internal_options() {
510
  if ( ! isset( $this->internal_options ) ) {
511
+ $defaults = array(
512
+ 'version' => ADVADS_VERSION,
513
+ 'installed' => time(), // when was this installed
514
+ );
515
+ $this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
516
+
517
+ // save defaults
518
+ if ( $this->internal_options === array() ) {
519
+ $this->internal_options = $defaults;
520
+ $this->update_internal_options( $this->internal_options );
521
+
522
+ Advanced_Ads_Plugin::get_instance()->create_capabilities();
523
+ }
524
+
525
+ // for versions installed prior to 1.5.3 set installed date for now
526
+ if ( ! isset( $this->internal_options['installed'] ) ) {
527
+ $this->internal_options['installed'] = time();
528
+ $this->update_internal_options( $this->internal_options );
529
+ }
530
  }
531
 
532
  return $this->internal_options;
535
  /**
536
  * update internal plugin options
537
  *
 
538
  * @param array $options new internal options
539
+ *
540
+ * @since 1.5.1
541
  */
542
  public function update_internal_options( array $options ) {
543
  // do not allow to clear options
554
  *
555
  * @since 1.6.8.2
556
  */
557
+ public function get_frontend_prefix() {
558
  if ( ! $this->frontend_prefix ) {
559
  $options = $this->options();
560
 
563
  // deprecated: keeps widgets working that previously received an id based on the front-prefix
564
  $frontend_prefix = esc_attr( $options['id-prefix'] );
565
  } else {
566
+ $host = parse_url( get_home_url(), PHP_URL_HOST );
567
  $frontend_prefix = preg_match( '/[A-Za-z][A-Za-z0-9_]{4}/', $host, $result ) ? $result[0] . '-' : Advanced_Ads_Plugin::DEFAULT_FRONTEND_PREFIX;
568
  }
569
  } else {
570
  $frontend_prefix = esc_attr( $options['front-prefix'] );
571
  }
572
  /**
573
+ * Applying the filter here makes sure that it is the same frontend prefix for all
574
  * calls on this page impression
575
  */
576
  $this->frontend_prefix = apply_filters( 'advanced-ads-frontend-prefix', $frontend_prefix );
577
  }
578
+
579
  return $this->frontend_prefix;
580
  }
581
 
584
  *
585
  * @since 1.6.10.2
586
  */
587
+ public function get_content_injection_priority() {
588
  $options = $this->options();
589
 
590
  return isset( $options['content-injection-priority'] ) ? intval( $options['content-injection-priority'] ) : 100;
591
  }
592
+
593
  /**
594
  * returns the capability needed to perform an action
595
+ *
 
596
  * @param str $capability a capability to check, can be internal to Advanced Ads
597
+ *
598
  * @return str $capability a valid WordPress capability
599
+ * @since 1.6.14
600
  */
601
+ public static function user_cap( $capability = 'manage_options' ) {
602
+
603
  global $advanced_ads_capabilities;
604
+
605
  // admins can do everything
606
  // is also a fallback if no option or more specific capability is given
607
+ if ( current_user_can( 'manage_options' ) ) {
608
  return 'manage_options';
609
  }
610
+
611
  return apply_filters( 'advanced-ads-capability', $capability );
612
+
613
  // check, if capability is mapped to an existing WP capability
614
  /*if( isset( $advanced_ads_capabilities[ $capability ] ) ){
615
  return apply_filters( 'advanced-ads-capability', $advanced_ads_capabilities[ $capability ], $capability );
617
  // if not, use 'manage_posts' capability
618
  return apply_filters( 'advanced-ads-capability', 'manage_options', $capability );
619
  }*/
620
+
621
  }
622
 
623
  /**
743
  * @return bool true if there is any add-on activated
744
  */
745
  public static function any_activated_add_on() {
746
+ return ( defined( 'AAP_VERSION' ) // Advanced Ads Pro.
747
+ || defined( 'AASA_VERSION' ) // Selling Ads.
748
+ || defined( 'AAT_VERSION' ) // Tracking.
749
+ || defined( 'AASADS_VERSION' ) // Sticky Ads.
750
+ || defined( 'AAR_VERSION' ) // Responsive Ads.
751
+ || defined( 'AAPLDS_VERSION' ) // PopUp and Layer Ads.
752
+ || defined( 'AAGT_SLUG' ) // Geo-Targeting.
753
+ );
754
  }
755
 
756
  /**
757
  * Get the correct support URL: wp.org for free users and website for those with any add-on installed
758
+ *
759
+ * @param string $utm add UTM parameter to the link leading to https://wpadvancedads.com, if given.
760
  *
761
  * @return string URL.
762
  */
763
+ public static function support_url( $utm = '' ) {
764
+
765
  // return self::any_activated_add_on() ? ADVADS_URL . 'support/' .$utm : 'https://wordpress.org/support/plugin/advanced-ads#new-post';
766
  // $utm = empty( $utm ) ? '#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-support' : $utm;
767
  if ( self::any_activated_add_on() ) {
769
  } else {
770
  $url = ADVADS_URL . 'support/' . $utm . '-free-user';
771
  }
772
+
773
  return $url;
774
  }
775
 
785
 
786
  $url = empty( $url ) ? home_url() : $url;
787
 
788
+ $code = intval( substr( md5( $url ), - 1 ), 16 );
789
 
790
  switch ( $ex ) {
791
  case 'b':
798
  return $code & 1; // returns 1 or 0.
799
  }
800
  }
801
+
802
+ /**
803
+ * Check if user started after a given date
804
+ *
805
+ * @param integer $timestamp time stamp.
806
+ *
807
+ * @return bool true if user is added after timestamp.
808
+ */
809
+ public static function is_new_user( $timestamp = 0 ) {
810
+
811
+ $timestamp = absint( $timestamp );
812
+
813
+ $options = self::get_instance()->internal_options();
814
+ $installed = isset( $options['installed'] ) ? $options['installed'] : 0;
815
+
816
+ return ( $installed >= $timestamp );
817
+ }
818
+
819
+ /**
820
+ * Show stuff to new users only.
821
+ *
822
+ * @param integer $timestamp time after which to show whatever.
823
+ * @param string $group optional group.
824
+ *
825
+ * @return bool true if user enabled after given timestamp.
826
+ */
827
+ public static function show_to_new_users( $timestamp, $group = 'a' ) {
828
+
829
+ // allow admins to see the change in any case.
830
+ if ( current_user_can( self::user_cap( 'advanced_ads_manage_options' ) )
831
+ && isset( $_REQUEST['advads-ignore-timestamp'] ) ) {
832
+ return true;
833
+ }
834
+
835
+ return ( self::get_group_by_url( null, $group ) && self::is_new_user( $timestamp ) );
836
+ }
837
  }
includes/functions.php CHANGED
@@ -113,6 +113,7 @@ function advads_is_amp() {
113
  return ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
114
  || ( function_exists( 'is_wp_amp' ) && is_wp_amp() )
115
  || ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() )
 
116
  || isset( $_GET [ 'wpamp' ] );
117
  }
118
 
113
  return ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
114
  || ( function_exists( 'is_wp_amp' ) && is_wp_amp() )
115
  || ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() )
116
+ || ( function_exists( 'is_penci_amp' ) && is_penci_amp() )
117
  || isset( $_GET [ 'wpamp' ] );
118
  }
119
 
languages/advanced-ads.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
- "POT-Creation-Date: 2019-11-07 09:14+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
@@ -23,7 +23,7 @@ msgstr ""
23
  "X-Poedit-Basepath: ../\n"
24
  "X-Poedit-SearchPath-0: ."
25
 
26
- #: admin/class-advanced-ads-admin.php:232 classes/display-conditions.php:283
27
  #: classes/visitor-conditions.php:298
28
  #: modules/gadsense/admin/views/external-ads-links.php:17
29
  #: modules/gadsense/admin/views/external-ads-links.php:21
@@ -31,7 +31,7 @@ msgstr ""
31
  msgid "or"
32
  msgstr ""
33
 
34
- #: admin/class-advanced-ads-admin.php:233 classes/display-conditions.php:283
35
  #: classes/visitor-conditions.php:298
36
  msgid "and"
37
  msgstr ""
@@ -93,7 +93,7 @@ msgid "Add-Ons"
93
  msgstr ""
94
 
95
  #: admin/class-advanced-ads-admin.php:707
96
- #: admin/includes/class-overview-widgets.php:175
97
  #, php-format
98
  msgid ""
99
  "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
@@ -168,6 +168,13 @@ msgstr ""
168
  msgid "Learn more about AdSense account issues %1$shere%2$s."
169
  msgstr ""
170
 
 
 
 
 
 
 
 
171
  #: classes/ad_placements.php:36
172
  msgid "Manual Placement"
173
  msgstr ""
@@ -254,12 +261,12 @@ msgstr ""
254
  msgid "headline 4 (%s)"
255
  msgstr ""
256
 
257
- #: classes/ad_placements.php:808
258
  #, php-format
259
  msgid "Set <em>%s</em> to show more ads"
260
  msgstr ""
261
 
262
- #: classes/ad_placements.php:809 admin/includes/class-settings.php:160
263
  msgid "Disable level limitation"
264
  msgstr ""
265
 
@@ -324,57 +331,61 @@ msgid "edit"
324
  msgstr ""
325
 
326
  #: classes/ad_type_image.php:66
327
- msgid "Link to target site"
 
 
 
 
328
  msgstr ""
329
 
330
  #. $s is a size string like "728 x 90".
331
  #. This string shows up on the ad edit page of
332
  #. image ads if the size entered for the ad is
333
  #. different from the size of the uploaded image.
334
- #: classes/ad_type_image.php:201
335
  #, php-format
336
  msgid "Original size: %s"
337
  msgstr ""
338
 
339
- #: classes/ad_type_plain.php:31
340
  msgid "Plain Text and Code"
341
  msgstr ""
342
 
343
- #: classes/ad_type_plain.php:32
344
  msgid ""
345
  "Any ad network, Amazon, customized AdSense codes, shortcodes, and code like "
346
  "JavaScript, HTML or PHP."
347
  msgstr ""
348
 
349
- #: classes/ad_type_plain.php:52
350
  msgid "Insert plain text or code into this field."
351
  msgstr ""
352
 
353
- #: classes/ad_type_plain.php:91
354
  msgid "Allow PHP"
355
  msgstr ""
356
 
357
- #: classes/ad_type_plain.php:93
358
  msgid "Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)"
359
  msgstr ""
360
 
361
- #: classes/ad_type_plain.php:94
362
  msgid "No PHP tag detected in your code."
363
  msgstr ""
364
 
365
- #: classes/ad_type_plain.php:94 classes/ad_type_plain.php:109
366
  msgid "Uncheck this checkbox for improved performance."
367
  msgstr ""
368
 
369
- #: classes/ad_type_plain.php:105
370
  msgid "Allow shortcodes"
371
  msgstr ""
372
 
373
- #: classes/ad_type_plain.php:108
374
  msgid "Execute shortcodes"
375
  msgstr ""
376
 
377
- #: classes/ad_type_plain.php:109
378
  msgid "No shortcode detected in your code."
379
  msgstr ""
380
 
@@ -420,124 +431,117 @@ msgstr ""
420
  msgid "Display ads based on the taxonomy of an archive page."
421
  msgstr ""
422
 
423
- #: classes/display-conditions.php:165
424
  #, php-format
425
  msgid "archive: %s"
426
  msgstr ""
427
 
428
- #: classes/display-conditions.php:253
429
  msgid "parent page"
430
  msgstr ""
431
 
432
- #: classes/display-conditions.php:254
433
  msgid "post meta"
434
  msgstr ""
435
 
436
- #: classes/display-conditions.php:255
437
  msgid "page template"
438
  msgstr ""
439
 
440
- #: classes/display-conditions.php:256
441
  msgid "url parameters"
442
  msgstr ""
443
 
444
- #: classes/display-conditions.php:259
445
  msgid "accelerated mobile pages"
446
  msgstr ""
447
 
448
- #: classes/display-conditions.php:384 classes/display-conditions.php:527
449
- #: classes/display-conditions.php:588
450
- #: admin/views/conditions/condition-author.php:19
451
- msgctxt "Error message shown when no display condition term is selected"
452
- msgid "Please select some items."
453
- msgstr ""
454
-
455
- #: classes/display-conditions.php:573
456
  msgctxt "display the terms search field on ad edit page"
457
  msgid "add more terms"
458
  msgstr ""
459
 
460
- #: classes/display-conditions.php:577
461
  msgid "term name or id"
462
  msgstr ""
463
 
464
- #: classes/display-conditions.php:651
465
  msgid "title or id"
466
  msgstr ""
467
 
468
- #: classes/display-conditions.php:703 includes/array_ad_conditions.php:63
469
  msgid "Home Page"
470
  msgstr ""
471
 
472
- #: classes/display-conditions.php:704 includes/array_ad_conditions.php:64
473
  msgid "show on Home page"
474
  msgstr ""
475
 
476
- #: classes/display-conditions.php:708 includes/array_ad_conditions.php:68
477
  msgid "Singular Pages"
478
  msgstr ""
479
 
480
- #: classes/display-conditions.php:709 includes/array_ad_conditions.php:69
481
  msgid "show on singular pages/posts"
482
  msgstr ""
483
 
484
- #: classes/display-conditions.php:713 includes/array_ad_conditions.php:73
485
  msgid "Archive Pages"
486
  msgstr ""
487
 
488
- #: classes/display-conditions.php:714 includes/array_ad_conditions.php:74
489
  msgid "show on any type of archive page (category, tag, author and date)"
490
  msgstr ""
491
 
492
- #: classes/display-conditions.php:718 includes/array_ad_conditions.php:78
493
  msgid "Search Results"
494
  msgstr ""
495
 
496
- #: classes/display-conditions.php:719 includes/array_ad_conditions.php:79
497
  msgid "show on search result pages"
498
  msgstr ""
499
 
500
- #: classes/display-conditions.php:723 includes/array_ad_conditions.php:83
501
  msgid "404 Page"
502
  msgstr ""
503
 
504
- #: classes/display-conditions.php:724 includes/array_ad_conditions.php:84
505
  msgid "show on 404 error page"
506
  msgstr ""
507
 
508
- #: classes/display-conditions.php:728 includes/array_ad_conditions.php:88
509
  msgid "Attachment Pages"
510
  msgstr ""
511
 
512
- #: classes/display-conditions.php:729 includes/array_ad_conditions.php:89
513
  msgid "show on attachment pages"
514
  msgstr ""
515
 
516
- #: classes/display-conditions.php:733 includes/array_ad_conditions.php:93
517
  msgid "Secondary Queries"
518
  msgstr ""
519
 
520
- #: classes/display-conditions.php:734 includes/array_ad_conditions.php:94
521
  msgid "allow ads in secondary queries"
522
  msgstr ""
523
 
524
- #: classes/display-conditions.php:738
525
  msgid "RSS Feed"
526
  msgstr ""
527
 
528
- #: classes/display-conditions.php:739
529
  msgid "allow ads in RSS Feed"
530
  msgstr ""
531
 
532
- #: classes/display-conditions.php:774
533
  msgid "older than"
534
  msgstr ""
535
 
536
- #: classes/display-conditions.php:775
537
  msgid "younger than"
538
  msgstr ""
539
 
540
- #: classes/display-conditions.php:777
541
  msgid "days"
542
  msgstr ""
543
 
@@ -587,7 +591,7 @@ msgstr ""
587
  msgid "Random AdSense ads"
588
  msgstr ""
589
 
590
- #: classes/frontend_checks.php:109 admin/includes/class-settings.php:539
591
  msgid "You look like a bot"
592
  msgstr ""
593
 
@@ -668,25 +672,24 @@ msgstr ""
668
  msgid "Auto ads code found"
669
  msgstr ""
670
 
671
- #: classes/frontend_checks.php:402
672
  msgid "Ad Health"
673
  msgstr ""
674
 
675
- #: classes/frontend_checks.php:416
676
  #, php-format
677
  msgid "Show %d more notifications"
678
  msgstr ""
679
 
680
- #: classes/frontend_checks.php:433
681
  msgid "Everything is fine"
682
  msgstr ""
683
 
684
- #: classes/frontend_checks.php:444 admin/includes/class-ad-type.php:785
685
- #: admin/views/notices/welcome-panel.php:59
686
  msgid "Get help"
687
  msgstr ""
688
 
689
- #: classes/frontend_checks.php:501
690
  msgid ""
691
  "the following code is used for automatic error detection and only visible to "
692
  "admins"
@@ -954,7 +957,7 @@ msgid ""
954
  "<a href=\"%2$s\" target=\"_blank\">Learn more</a>."
955
  msgstr ""
956
 
957
- #: admin/includes/ad-health-notices.php:74 admin/views/placements.php:145
958
  #, php-format
959
  msgid ""
960
  "Missing PHP extensions could cause issues. Please ask your hosting provider "
@@ -1240,13 +1243,13 @@ msgstr ""
1240
  msgid "Ad draft updated."
1241
  msgstr ""
1242
 
1243
- #: admin/includes/class-ad-type.php:784
1244
  msgid ""
1245
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
1246
  "again to fix this."
1247
  msgstr ""
1248
 
1249
- #: admin/includes/class-licenses.php:86
1250
  #, php-format
1251
  msgid ""
1252
  "There might be a new version of %1$s. Please <strong>provide a valid license "
@@ -1254,57 +1257,57 @@ msgid ""
1254
  "this page</a>."
1255
  msgstr ""
1256
 
1257
- #: admin/includes/class-licenses.php:101
1258
  msgid "Error while trying to register the license. Please contact support."
1259
  msgstr ""
1260
 
1261
- #: admin/includes/class-licenses.php:106 admin/views/setting-license.php:60
1262
  msgid "Please enter a valid license key"
1263
  msgstr ""
1264
 
1265
- #: admin/includes/class-licenses.php:161
1266
  msgid "License couldn’t be activated. Please try again later."
1267
  msgstr ""
1268
 
1269
- #: admin/includes/class-licenses.php:178
1270
  msgid "This is the bundle license key."
1271
  msgstr ""
1272
 
1273
- #: admin/includes/class-licenses.php:179
1274
  msgid "This is not the correct key for this add-on."
1275
  msgstr ""
1276
 
1277
- #: admin/includes/class-licenses.php:180
1278
  msgid "There are no activations left."
1279
  msgstr ""
1280
 
1281
- #: admin/includes/class-licenses.php:189
1282
  #, php-format
1283
  msgid "License is invalid. Reason: %s"
1284
  msgstr ""
1285
 
1286
  #. %s is a list of server information like IP address. Just keep it as is.
1287
- #: admin/includes/class-licenses.php:223
1288
  #, php-format
1289
  msgid ""
1290
  "Your request was blocked by our firewall. Please send us the following "
1291
  "information to unblock you: %s."
1292
  msgstr ""
1293
 
1294
- #: admin/includes/class-licenses.php:272
1295
  msgid "Error while trying to disable the license. Please contact support."
1296
  msgstr ""
1297
 
1298
- #: admin/includes/class-licenses.php:304 admin/includes/class-licenses.php:328
1299
  msgid "License couldn’t be deactivated. Please try again later."
1300
  msgstr ""
1301
 
1302
- #: admin/includes/class-licenses.php:535
1303
  #, php-format
1304
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1305
  msgstr ""
1306
 
1307
- #: admin/includes/class-licenses.php:537
1308
  #, php-format
1309
  msgid ""
1310
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
@@ -1351,15 +1354,15 @@ msgid "Settings"
1351
  msgstr ""
1352
 
1353
  #: admin/includes/class-menu.php:131 admin/includes/class-menu.php:135
1354
- #: admin/includes/class-settings.php:277
1355
  msgid "Licenses"
1356
  msgstr ""
1357
 
1358
- #: admin/includes/class-menu.php:220 admin/includes/class-menu.php:247
1359
  msgid "Sorry, you are not allowed to access this feature."
1360
  msgstr ""
1361
 
1362
- #: admin/includes/class-menu.php:233
1363
  msgid ""
1364
  "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was "
1365
  "deleted?"
@@ -1391,9 +1394,8 @@ msgid "Ad Stats"
1391
  msgstr ""
1392
 
1393
  #: admin/includes/class-meta-box.php:153 admin/includes/class-meta-box.php:164
1394
- #: admin/includes/class-meta-box.php:169 admin/includes/class-settings.php:632
1395
  #: admin/views/ad-output-metabox.php:82
1396
- #: admin/views/notices/welcome-panel.php:63
1397
  #: modules/ads-txt/admin/views/setting-create.php:11
1398
  #: modules/privacy/admin/views/setting-enable.php:2
1399
  msgid "Manual"
@@ -1408,33 +1410,33 @@ msgstr ""
1408
  msgid "Disable"
1409
  msgstr ""
1410
 
1411
- #: admin/includes/class-meta-box.php:308
1412
  msgid "Ad Settings"
1413
  msgstr ""
1414
 
1415
- #: admin/includes/class-meta-box.php:410 admin/views/overview.php:6
1416
  msgid "Ads Dashboard"
1417
  msgstr ""
1418
 
1419
- #: admin/includes/class-meta-box.php:421
1420
  #, php-format
1421
  msgid "%d ads – <a href=\"%s\">manage</a> - <a href=\"%s\">new</a>"
1422
  msgstr ""
1423
 
1424
- #: admin/includes/class-meta-box.php:432
1425
  msgid "Get the tutorial via email"
1426
  msgstr ""
1427
 
1428
- #: admin/includes/class-meta-box.php:439
1429
  msgid "Get AdSense tips via email"
1430
  msgstr ""
1431
 
1432
- #: admin/includes/class-meta-box.php:446
1433
  msgid "Visit our blog for more articles about ad optimization"
1434
  msgstr ""
1435
 
1436
  #. %s is our URL
1437
- #: admin/includes/class-meta-box.php:499
1438
  msgid "Latest posts on wpadvancedads.com"
1439
  msgstr ""
1440
 
@@ -1493,187 +1495,187 @@ msgstr ""
1493
  msgid "How to earn more with AdSense"
1494
  msgstr ""
1495
 
1496
- #: admin/includes/class-overview-widgets.php:125
1497
  msgid "Join now"
1498
  msgstr ""
1499
 
1500
- #: admin/includes/class-overview-widgets.php:133
1501
  msgid ""
1502
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1503
  "help us with a review."
1504
  msgstr ""
1505
 
1506
- #: admin/includes/class-overview-widgets.php:135
1507
  msgid "Sure, I’ll rate the plugin"
1508
  msgstr ""
1509
 
1510
- #: admin/includes/class-overview-widgets.php:137
1511
  msgid "I already did"
1512
  msgstr ""
1513
 
1514
- #: admin/includes/class-overview-widgets.php:143
1515
  msgid "Manage your ads"
1516
  msgstr ""
1517
 
1518
- #: admin/includes/class-overview-widgets.php:147
1519
  msgid "Get the All Access pass"
1520
  msgstr ""
1521
 
1522
- #: admin/includes/class-overview-widgets.php:173
1523
  #, php-format
1524
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1525
  msgstr ""
1526
 
1527
- #: admin/includes/class-overview-widgets.php:174
1528
  #, php-format
1529
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1530
  msgstr ""
1531
 
1532
  #. %s includes a number and markup like <span class="count">6</span>.
1533
- #: admin/includes/class-overview-widgets.php:183
1534
  #: admin/views/overview-notices.php:17
1535
  #, php-format
1536
  msgid "Show %s hidden notices"
1537
  msgstr ""
1538
 
1539
- #: admin/includes/class-overview-widgets.php:361
1540
  msgid "How to install and activate an add-on."
1541
  msgstr ""
1542
 
1543
- #: admin/includes/class-overview-widgets.php:366
1544
  msgid "The solution for professional websites."
1545
  msgstr ""
1546
 
1547
- #: admin/includes/class-overview-widgets.php:369
1548
  #: admin/views/pitch-pro-tab.php:7
1549
  msgid "support for cached sites"
1550
  msgstr ""
1551
 
1552
- #: admin/includes/class-overview-widgets.php:372
1553
- #: admin/includes/class-overview-widgets.php:373
1554
- #: admin/includes/class-overview-widgets.php:374
1555
- #: admin/includes/class-overview-widgets.php:375
1556
  #, php-format
1557
  msgid "integrates with <strong>%s</strong>"
1558
  msgstr ""
1559
 
1560
- #: admin/includes/class-overview-widgets.php:376
1561
  msgid "click fraud protection, lazy load, ad-block ads"
1562
  msgstr ""
1563
 
1564
- #: admin/includes/class-overview-widgets.php:377
1565
  #: admin/views/pitch-pro-tab.php:8
1566
  msgid "11 more display and visitor conditions"
1567
  msgstr ""
1568
 
1569
- #: admin/includes/class-overview-widgets.php:378
1570
  #: admin/views/pitch-pro-tab.php:9
1571
  msgid "6 more placements"
1572
  msgstr ""
1573
 
1574
- #: admin/includes/class-overview-widgets.php:379
1575
  #: admin/views/pitch-pro-tab.php:10
1576
  msgid "placement tests for ad optimization"
1577
  msgstr ""
1578
 
1579
- #: admin/includes/class-overview-widgets.php:380
1580
  #: admin/views/pitch-pro-tab.php:11
1581
  msgid "ad grids and many more advanced features"
1582
  msgstr ""
1583
 
1584
- #: admin/includes/class-overview-widgets.php:387
1585
  msgid ""
1586
  "Analyze clicks and impressions of your ads locally or in Google Analytics, "
1587
  "share reports, and limit ads to a specific number of impressions or clicks."
1588
  msgstr ""
1589
 
1590
- #: admin/includes/class-overview-widgets.php:393
1591
  msgid ""
1592
  "Display ads based on the device or the size of your visitor’s browser, and "
1593
  "control ads on AMP pages."
1594
  msgstr ""
1595
 
1596
- #: admin/includes/class-overview-widgets.php:406
1597
  msgid ""
1598
  "Earn more money and let advertisers pay for ad space directly on the "
1599
  "frontend of your site."
1600
  msgstr ""
1601
 
1602
- #: admin/includes/class-overview-widgets.php:412
1603
  msgid ""
1604
  "Target visitors with ads that match their geo location and make more money "
1605
  "with regional campaigns."
1606
  msgstr ""
1607
 
1608
- #: admin/includes/class-overview-widgets.php:418
1609
  msgid ""
1610
  "Increase click rates on your ads by placing them in sticky positions above, "
1611
  "next or below your site."
1612
  msgstr ""
1613
 
1614
- #: admin/includes/class-overview-widgets.php:424
1615
  msgid ""
1616
  "Users will never miss an ad or other information in a PopUp. Choose when it "
1617
  "shows up and for how long a user can close it."
1618
  msgstr ""
1619
 
1620
- #: admin/includes/class-overview-widgets.php:430
1621
  msgid ""
1622
  "Create a beautiful and simple slider from your ads to show more information "
1623
  "on less space."
1624
  msgstr ""
1625
 
1626
- #: admin/includes/class-overview-widgets.php:436
1627
  msgid ""
1628
  "Place AdSense In-feed ads between posts on homepage, category, and archive "
1629
  "pages."
1630
  msgstr ""
1631
 
1632
- #: admin/includes/class-overview-widgets.php:439
1633
- #: admin/includes/class-overview-widgets.php:614
1634
- #: admin/includes/class-overview-widgets.php:630
1635
  msgid "Install now"
1636
  msgstr ""
1637
 
1638
- #: admin/includes/class-overview-widgets.php:457
1639
- #: admin/includes/class-overview-widgets.php:478
1640
- #: admin/includes/class-overview-widgets.php:503
1641
- #: admin/includes/class-overview-widgets.php:521
1642
- #: admin/includes/class-overview-widgets.php:539
1643
- #: admin/includes/class-overview-widgets.php:557
1644
- #: admin/includes/class-overview-widgets.php:575
1645
- #: admin/includes/class-overview-widgets.php:593
1646
  msgid "Activate now"
1647
  msgstr ""
1648
 
1649
- #: admin/includes/class-overview-widgets.php:486
1650
  msgid "Visit your ad stats"
1651
  msgstr ""
1652
 
1653
- #: admin/includes/class-overview-widgets.php:610
1654
  msgid "Use Genesis specific ad positions."
1655
  msgstr ""
1656
 
1657
- #: admin/includes/class-overview-widgets.php:626
1658
  msgid ""
1659
  "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
1660
  msgstr ""
1661
 
1662
- #: admin/includes/class-overview-widgets.php:642
1663
  msgid "Our best deal with all add-ons included."
1664
  msgstr ""
1665
 
1666
- #: admin/includes/class-overview-widgets.php:644
1667
  msgid "Get full access"
1668
  msgstr ""
1669
 
1670
- #: admin/includes/class-overview-widgets.php:658
1671
  #: admin/views/conditions/ad-display-metabox.php:38
1672
  #: admin/views/conditions/ad-visitor-metabox.php:38
1673
  msgid "Visit the manual"
1674
  msgstr ""
1675
 
1676
- #: admin/includes/class-overview-widgets.php:661
1677
  msgid "Get this add-on"
1678
  msgstr ""
1679
 
@@ -1702,86 +1704,82 @@ msgid "Priority of content injection filter"
1702
  msgstr ""
1703
 
1704
  #: admin/includes/class-settings.php:168
1705
- msgid "Use new injection logic"
1706
- msgstr ""
1707
-
1708
- #: admin/includes/class-settings.php:176
1709
  msgid "Hide ads from bots"
1710
  msgstr ""
1711
 
1712
- #: admin/includes/class-settings.php:185
1713
  msgid "Disable ads for post types"
1714
  msgstr ""
1715
 
1716
- #: admin/includes/class-settings.php:194
1717
  msgid "Disable Ad Health and other notices"
1718
  msgstr ""
1719
 
1720
- #: admin/includes/class-settings.php:202
1721
  msgid "ID prefix"
1722
  msgstr ""
1723
 
1724
- #: admin/includes/class-settings.php:210
1725
  msgid "Allow editors to manage ads"
1726
  msgstr ""
1727
 
1728
- #: admin/includes/class-settings.php:218
1729
  msgid "Ad label"
1730
  msgstr ""
1731
 
1732
- #: admin/includes/class-settings.php:227
1733
  msgid "Open links in a new window"
1734
  msgstr ""
1735
 
1736
- #: admin/includes/class-settings.php:235
1737
  msgid "Use advanced JavaScript"
1738
  msgstr ""
1739
 
1740
- #: admin/includes/class-settings.php:245
1741
  msgid "Delete data on uninstall"
1742
  msgstr ""
1743
 
1744
- #: admin/includes/class-settings.php:255
1745
  msgid "Disable shortcode button"
1746
  msgstr ""
1747
 
1748
- #: admin/includes/class-settings.php:294
1749
  msgid "Pro"
1750
  msgstr ""
1751
 
1752
- #: admin/includes/class-settings.php:310 admin/views/pitch-tracking.php:2
1753
  msgid "Tracking"
1754
  msgstr ""
1755
 
1756
- #: admin/includes/class-settings.php:358
1757
  #, php-format
1758
  msgid ""
1759
  "Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
1760
  "ons</a>."
1761
  msgstr ""
1762
 
1763
- #: admin/includes/class-settings.php:359
1764
  #, php-format
1765
  msgid ""
1766
  "See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
1767
  "licenses</a>."
1768
  msgstr ""
1769
 
1770
- #: admin/includes/class-settings.php:371
1771
  msgid "Are you missing something?"
1772
  msgstr ""
1773
 
1774
- #: admin/includes/class-settings.php:439
1775
  msgid "Choose the roles a user must have in order to not see any ads."
1776
  msgstr ""
1777
 
1778
- #: admin/includes/class-settings.php:453
1779
  msgid ""
1780
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1781
  "needs it."
1782
  msgstr ""
1783
 
1784
- #: admin/includes/class-settings.php:456
1785
  #, php-format
1786
  msgid ""
1787
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
@@ -1789,7 +1787,7 @@ msgid ""
1789
  "need features from this file."
1790
  msgstr ""
1791
 
1792
- #: admin/includes/class-settings.php:476
1793
  msgid ""
1794
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1795
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
@@ -1799,85 +1797,77 @@ msgid ""
1799
  "injection only in the first x posts on your archive pages."
1800
  msgstr ""
1801
 
1802
- #: admin/includes/class-settings.php:492
1803
  msgid ""
1804
  "Please check your post content. A priority of 10 and below might cause "
1805
  "issues (wpautop function might run twice)."
1806
  msgstr ""
1807
 
1808
- #: admin/includes/class-settings.php:494
1809
  msgid ""
1810
  "Play with this value in order to change the priority of the injected ads "
1811
  "compared to other auto injected elements in the post content."
1812
  msgstr ""
1813
 
1814
- #: admin/includes/class-settings.php:508
1815
  msgid ""
1816
  "Advanced Ads ignores paragraphs and other elements in containers when "
1817
  "injecting ads into the post content. Check this option to ignore this "
1818
  "limitation and ads might show up again."
1819
  msgstr ""
1820
 
1821
- #. %1$s is a starting <a> tag and %2$s a closing one.
1822
- #: admin/includes/class-settings.php:523
1823
- #, php-format
1824
- msgid ""
1825
- "Enable the new more stable injection logic. Please report any issues "
1826
- "%1$shere%2$s."
1827
- msgstr ""
1828
-
1829
- #: admin/includes/class-settings.php:541
1830
  msgid "Read this first"
1831
  msgstr ""
1832
 
1833
- #: admin/includes/class-settings.php:542
1834
  msgid "Hide ads from crawlers, bots and empty user agents."
1835
  msgstr ""
1836
 
1837
- #: admin/includes/class-settings.php:555
1838
  msgid "Pro feature"
1839
  msgstr ""
1840
 
1841
  #. %1$s is a starting <a> tag and %2$s a closing one
1842
- #: admin/includes/class-settings.php:573
1843
  #, php-format
1844
  msgid ""
1845
  "Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
1846
  "notices like tips, tutorials, email newsletters and update notices."
1847
  msgstr ""
1848
 
1849
- #: admin/includes/class-settings.php:591
1850
  msgid ""
1851
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1852
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1853
  "need to <strong>rewrite css rules afterwards</strong>."
1854
  msgstr ""
1855
 
1856
- #: admin/includes/class-settings.php:610
1857
  msgid "Allow editors to also manage and publish ads."
1858
  msgstr ""
1859
 
1860
- #: admin/includes/class-settings.php:611
1861
  #, php-format
1862
  msgid ""
1863
  "You can assign different ad-related roles on a user basis with <a "
1864
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1865
  msgstr ""
1866
 
1867
- #: admin/includes/class-settings.php:622
1868
  msgctxt "label before ads"
1869
  msgid "Advertisements"
1870
  msgstr ""
1871
 
1872
- #: admin/includes/class-settings.php:631
1873
  msgid "Displayed above ads."
1874
  msgstr ""
1875
 
1876
- #: admin/includes/class-settings.php:667
1877
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1878
  msgstr ""
1879
 
1880
- #: admin/includes/class-settings.php:680
1881
  msgid "Disable shortcode button in visual editor."
1882
  msgstr ""
1883
 
@@ -2251,7 +2241,7 @@ msgstr ""
2251
  #: admin/views/placements-ad-label-position.php:5
2252
  #: admin/views/placements-ad-label.php:1 admin/views/placements-ad-label.php:4
2253
  #: admin/views/placements.php:84
2254
- #: modules/gadsense/includes/class-network-adsense.php:236
2255
  msgid "default"
2256
  msgstr ""
2257
 
@@ -2325,19 +2315,19 @@ msgstr ""
2325
  msgid "Enable debug mode"
2326
  msgstr ""
2327
 
2328
- #: admin/views/ad-parameters-size.php:1
2329
  msgid "size"
2330
  msgstr ""
2331
 
2332
- #: admin/views/ad-parameters-size.php:3
2333
  msgid "width"
2334
  msgstr ""
2335
 
2336
- #: admin/views/ad-parameters-size.php:4
2337
  msgid "height"
2338
  msgstr ""
2339
 
2340
- #: admin/views/ad-parameters-size.php:12
2341
  msgid "reserve this space"
2342
  msgstr ""
2343
 
@@ -2706,11 +2696,11 @@ msgstr ""
2706
  msgid "Placements updated"
2707
  msgstr ""
2708
 
2709
- #: admin/views/placements.php:20 admin/views/placements.php:214
2710
  msgid "Create a new placement"
2711
  msgstr ""
2712
 
2713
- #: admin/views/placements.php:21 admin/views/placements.php:216
2714
  msgid "New Placement"
2715
  msgstr ""
2716
 
@@ -2754,38 +2744,31 @@ msgstr ""
2754
  msgid "position"
2755
  msgstr ""
2756
 
2757
- #: admin/views/placements.php:140 admin/views/placements.php:145
2758
- msgid "Important Notice"
2759
- msgstr ""
2760
-
2761
  #: admin/views/placements.php:140
2762
- msgid ""
2763
- "Your server is missing an extension. This might break the content injection."
2764
- "<br/>Ignore this warning if everything works fine or else ask your hosting "
2765
- "provider to enable <em>mbstring</em>."
2766
  msgstr ""
2767
 
2768
- #: admin/views/placements.php:167
2769
  msgid "ad label"
2770
  msgstr ""
2771
 
2772
- #: admin/views/placements.php:177
2773
  msgid "show all options"
2774
  msgstr ""
2775
 
2776
- #: admin/views/placements.php:196
2777
  #, php-format
2778
  msgid ""
2779
  "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the "
2780
  "header of your website</a>."
2781
  msgstr ""
2782
 
2783
- #: admin/views/placements.php:205
2784
  msgctxt "checkbox to remove placement"
2785
  msgid "delete"
2786
  msgstr ""
2787
 
2788
- #: admin/views/placements.php:212
2789
  msgid "Save Placements"
2790
  msgstr ""
2791
 
@@ -3010,7 +2993,7 @@ msgid ""
3010
  "websites."
3011
  msgstr ""
3012
 
3013
- #: admin/views/conditions/condition-author.php:27
3014
  #, php-format
3015
  msgid ""
3016
  "Only %d elements are displayed above. Use the <code>advanced-ads-admin-max-"
@@ -3078,6 +3061,19 @@ msgstr ""
3078
  msgid "manual"
3079
  msgstr ""
3080
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3081
  #: admin/views/conditions/visitor-conditions-form-top.php:4
3082
  msgid ""
3083
  "Visitor conditions limit the number of users who can see your ad. There is "
@@ -3130,40 +3126,36 @@ msgstr ""
3130
  msgid "First ad tutorial"
3131
  msgstr ""
3132
 
3133
- #: admin/views/notices/welcome-panel.php:30
3134
  msgid "One-Click Setup"
3135
  msgstr ""
3136
 
3137
- #: admin/views/notices/welcome-panel.php:37
3138
  msgid "Create 2 test ads"
3139
  msgstr ""
3140
 
3141
- #: admin/views/notices/welcome-panel.php:38
3142
  msgid ""
3143
  "Click to place two ads in the content of your site which are visible to you "
3144
  "only."
3145
  msgstr ""
3146
 
3147
- #: admin/views/notices/welcome-panel.php:42
3148
  msgid "AdSense Options"
3149
  msgstr ""
3150
 
3151
- #: admin/views/notices/welcome-panel.php:44
3152
  msgid "Import ads from AdSense"
3153
  msgstr ""
3154
 
3155
- #: admin/views/notices/welcome-panel.php:48
3156
  msgid "Setting up Auto ads"
3157
  msgstr ""
3158
 
3159
- #: admin/views/notices/welcome-panel.php:51
3160
  msgid "Setting up AdSense ads manually"
3161
  msgstr ""
3162
 
3163
- #: admin/views/notices/welcome-panel.php:67
3164
- msgid "Reach out for help"
3165
- msgstr ""
3166
-
3167
  #: modules/ad-blocker/admin/admin.php:96
3168
  msgid "Ad blocker fix"
3169
  msgstr ""
@@ -3312,25 +3304,25 @@ msgstr ""
3312
  msgid "Dummy Account Id"
3313
  msgstr ""
3314
 
3315
- #: modules/gadsense/includes/class-ad-type-adsense.php:35
3316
  msgid "AdSense ad"
3317
  msgstr ""
3318
 
3319
- #: modules/gadsense/includes/class-ad-type-adsense.php:36
3320
  msgid "Use ads from your Google AdSense account"
3321
  msgstr ""
3322
 
3323
- #: modules/gadsense/includes/class-ad-type-adsense.php:93
3324
  #: modules/gadsense/admin/views/adsense-account.php:83
3325
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3326
  msgstr ""
3327
 
3328
- #: modules/gadsense/includes/class-ad-type-adsense.php:134
3329
  msgid "Your AdSense Publisher ID is missing."
3330
  msgstr ""
3331
 
3332
  #. we replace AdSense code with a dummy ad code in the Customizer and Elementor since AdSense could cause them to break. This is the text within that dummy ad.
3333
- #: modules/gadsense/includes/class-ad-type-adsense.php:222
3334
  msgid "This will be an AdSense ad on your live site."
3335
  msgstr ""
3336
 
@@ -3441,65 +3433,65 @@ msgstr ""
3441
  msgid "Verification code & Auto ads"
3442
  msgstr ""
3443
 
3444
- #: modules/gadsense/includes/class-network-adsense.php:52
3445
  msgid "Auto ads"
3446
  msgstr ""
3447
 
3448
- #: modules/gadsense/includes/class-network-adsense.php:52
3449
  msgid "Disable top anchor ad"
3450
  msgstr ""
3451
 
3452
- #: modules/gadsense/includes/class-network-adsense.php:61
3453
  msgid "Disable stats"
3454
  msgstr ""
3455
 
3456
- #: modules/gadsense/includes/class-network-adsense.php:73
3457
  msgid "Limit to 3 ads"
3458
  msgstr ""
3459
 
3460
- #: modules/gadsense/includes/class-network-adsense.php:83
3461
  msgid "Disable violation warnings"
3462
  msgstr ""
3463
 
3464
- #: modules/gadsense/includes/class-network-adsense.php:91
3465
  msgid "Transparent background"
3466
  msgstr ""
3467
 
3468
- #: modules/gadsense/includes/class-network-adsense.php:99
3469
  msgid "Full width responsive ads on mobile"
3470
  msgstr ""
3471
 
3472
- #: modules/gadsense/includes/class-network-adsense.php:143
3473
  #, php-format
3474
  msgid "Limit to %d AdSense ads"
3475
  msgstr ""
3476
 
3477
- #: modules/gadsense/includes/class-network-adsense.php:147
3478
  msgid ""
3479
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3480
  "this setting to prevent too many AdSense ads to show accidentally on your "
3481
  "site."
3482
  msgstr ""
3483
 
3484
- #: modules/gadsense/includes/class-network-adsense.php:151
3485
  msgid ""
3486
  "Due to technical restrictions, the limit does not work on placements with "
3487
  "cache-busting enabled."
3488
  msgstr ""
3489
 
3490
- #: modules/gadsense/includes/class-network-adsense.php:163
3491
  msgid ""
3492
  "Enable this box if you don’t want Google Auto ads to place anchor ads at the "
3493
  "top of your page."
3494
  msgstr ""
3495
 
3496
- #: modules/gadsense/includes/class-network-adsense.php:176
3497
  msgid ""
3498
  "Enable this option to stop loading stats from AdSense into your WordPress "
3499
  "backend."
3500
  msgstr ""
3501
 
3502
- #: modules/gadsense/includes/class-network-adsense.php:191
3503
  #: modules/gadsense/admin/views/connect-adsense.php:37
3504
  msgid ""
3505
  "Insert the AdSense header code used for verification and the Auto Ads "
@@ -3507,30 +3499,30 @@ msgid ""
3507
  msgstr ""
3508
 
3509
  #. this is the text for a link to a sub-page in an AdSense account
3510
- #: modules/gadsense/includes/class-network-adsense.php:196
3511
  msgid "Adjust Auto ads options"
3512
  msgstr ""
3513
 
3514
- #: modules/gadsense/includes/class-network-adsense.php:198
3515
  #, php-format
3516
  msgid ""
3517
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3518
  "appear in random places</strong>."
3519
  msgstr ""
3520
 
3521
- #: modules/gadsense/includes/class-network-adsense.php:199
3522
  msgid "Display Auto ads only on specific pages"
3523
  msgstr ""
3524
 
3525
- #: modules/gadsense/includes/class-network-adsense.php:200
3526
  msgid "Auto ads on AMP pages"
3527
  msgstr ""
3528
 
3529
- #: modules/gadsense/includes/class-network-adsense.php:213
3530
  msgid "Disable warnings about potential violations of the AdSense terms."
3531
  msgstr ""
3532
 
3533
- #: modules/gadsense/includes/class-network-adsense.php:214
3534
  #, php-format
3535
  msgid ""
3536
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
@@ -3538,21 +3530,21 @@ msgid ""
3538
  "managed with Advanced Ads. Enable this option to remove these checks"
3539
  msgstr ""
3540
 
3541
- #: modules/gadsense/includes/class-network-adsense.php:225
3542
  msgid ""
3543
  "Enable this option in case your theme adds an unfortunate background color "
3544
  "to AdSense ads."
3545
  msgstr ""
3546
 
3547
- #: modules/gadsense/includes/class-network-adsense.php:237
3548
  msgid "enable"
3549
  msgstr ""
3550
 
3551
- #: modules/gadsense/includes/class-network-adsense.php:238
3552
  msgid "disable"
3553
  msgstr ""
3554
 
3555
- #: modules/gadsense/includes/class-network-adsense.php:243
3556
  #, php-format
3557
  msgid ""
3558
  "Whether your responsive ad unit may expand to <a href='%s' target='blank'>"
@@ -4146,5 +4138,5 @@ msgid "https://wpadvancedads.com"
4146
  msgstr ""
4147
 
4148
  #. Author of the plugin
4149
- msgid "Thomas Maier"
4150
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
+ "POT-Creation-Date: 2019-12-09 08:38+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
23
  "X-Poedit-Basepath: ../\n"
24
  "X-Poedit-SearchPath-0: ."
25
 
26
+ #: admin/class-advanced-ads-admin.php:232 classes/display-conditions.php:282
27
  #: classes/visitor-conditions.php:298
28
  #: modules/gadsense/admin/views/external-ads-links.php:17
29
  #: modules/gadsense/admin/views/external-ads-links.php:21
31
  msgid "or"
32
  msgstr ""
33
 
34
+ #: admin/class-advanced-ads-admin.php:233 classes/display-conditions.php:282
35
  #: classes/visitor-conditions.php:298
36
  msgid "and"
37
  msgstr ""
93
  msgstr ""
94
 
95
  #: admin/class-advanced-ads-admin.php:707
96
+ #: admin/includes/class-overview-widgets.php:181
97
  #, php-format
98
  msgid ""
99
  "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
168
  msgid "Learn more about AdSense account issues %1$shere%2$s."
169
  msgstr ""
170
 
171
+ #: classes/ad_ajax_callbacks.php:236
172
+ #, php-format
173
+ msgid ""
174
+ "An error occurred. Please use <a href=\"%s\" target=\"_blank\">this form</a> "
175
+ "to sign up."
176
+ msgstr ""
177
+
178
  #: classes/ad_placements.php:36
179
  msgid "Manual Placement"
180
  msgstr ""
261
  msgid "headline 4 (%s)"
262
  msgstr ""
263
 
264
+ #: classes/ad_placements.php:765
265
  #, php-format
266
  msgid "Set <em>%s</em> to show more ads"
267
  msgstr ""
268
 
269
+ #: classes/ad_placements.php:766 admin/includes/class-settings.php:160
270
  msgid "Disable level limitation"
271
  msgstr ""
272
 
331
  msgstr ""
332
 
333
  #: classes/ad_type_image.php:66
334
+ msgid "https://www.example.com/"
335
+ msgstr ""
336
+
337
+ #: classes/ad_type_image.php:68
338
+ msgid "Link to target site including http(s)"
339
  msgstr ""
340
 
341
  #. $s is a size string like "728 x 90".
342
  #. This string shows up on the ad edit page of
343
  #. image ads if the size entered for the ad is
344
  #. different from the size of the uploaded image.
345
+ #: classes/ad_type_image.php:205
346
  #, php-format
347
  msgid "Original size: %s"
348
  msgstr ""
349
 
350
+ #: classes/ad_type_plain.php:32
351
  msgid "Plain Text and Code"
352
  msgstr ""
353
 
354
+ #: classes/ad_type_plain.php:33
355
  msgid ""
356
  "Any ad network, Amazon, customized AdSense codes, shortcodes, and code like "
357
  "JavaScript, HTML or PHP."
358
  msgstr ""
359
 
360
+ #: classes/ad_type_plain.php:54
361
  msgid "Insert plain text or code into this field."
362
  msgstr ""
363
 
364
+ #: classes/ad_type_plain.php:95
365
  msgid "Allow PHP"
366
  msgstr ""
367
 
368
+ #: classes/ad_type_plain.php:99
369
  msgid "Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)"
370
  msgstr ""
371
 
372
+ #: classes/ad_type_plain.php:102
373
  msgid "No PHP tag detected in your code."
374
  msgstr ""
375
 
376
+ #: classes/ad_type_plain.php:102 classes/ad_type_plain.php:125
377
  msgid "Uncheck this checkbox for improved performance."
378
  msgstr ""
379
 
380
+ #: classes/ad_type_plain.php:117
381
  msgid "Allow shortcodes"
382
  msgstr ""
383
 
384
+ #: classes/ad_type_plain.php:122
385
  msgid "Execute shortcodes"
386
  msgstr ""
387
 
388
+ #: classes/ad_type_plain.php:125
389
  msgid "No shortcode detected in your code."
390
  msgstr ""
391
 
431
  msgid "Display ads based on the taxonomy of an archive page."
432
  msgstr ""
433
 
434
+ #: classes/display-conditions.php:164
435
  #, php-format
436
  msgid "archive: %s"
437
  msgstr ""
438
 
439
+ #: classes/display-conditions.php:252
440
  msgid "parent page"
441
  msgstr ""
442
 
443
+ #: classes/display-conditions.php:253
444
  msgid "post meta"
445
  msgstr ""
446
 
447
+ #: classes/display-conditions.php:254
448
  msgid "page template"
449
  msgstr ""
450
 
451
+ #: classes/display-conditions.php:255
452
  msgid "url parameters"
453
  msgstr ""
454
 
455
+ #: classes/display-conditions.php:258
456
  msgid "accelerated mobile pages"
457
  msgstr ""
458
 
459
+ #: classes/display-conditions.php:584
 
 
 
 
 
 
 
460
  msgctxt "display the terms search field on ad edit page"
461
  msgid "add more terms"
462
  msgstr ""
463
 
464
+ #: classes/display-conditions.php:588
465
  msgid "term name or id"
466
  msgstr ""
467
 
468
+ #: classes/display-conditions.php:664
469
  msgid "title or id"
470
  msgstr ""
471
 
472
+ #: classes/display-conditions.php:718 includes/array_ad_conditions.php:63
473
  msgid "Home Page"
474
  msgstr ""
475
 
476
+ #: classes/display-conditions.php:719 includes/array_ad_conditions.php:64
477
  msgid "show on Home page"
478
  msgstr ""
479
 
480
+ #: classes/display-conditions.php:723 includes/array_ad_conditions.php:68
481
  msgid "Singular Pages"
482
  msgstr ""
483
 
484
+ #: classes/display-conditions.php:724 includes/array_ad_conditions.php:69
485
  msgid "show on singular pages/posts"
486
  msgstr ""
487
 
488
+ #: classes/display-conditions.php:728 includes/array_ad_conditions.php:73
489
  msgid "Archive Pages"
490
  msgstr ""
491
 
492
+ #: classes/display-conditions.php:729 includes/array_ad_conditions.php:74
493
  msgid "show on any type of archive page (category, tag, author and date)"
494
  msgstr ""
495
 
496
+ #: classes/display-conditions.php:733 includes/array_ad_conditions.php:78
497
  msgid "Search Results"
498
  msgstr ""
499
 
500
+ #: classes/display-conditions.php:734 includes/array_ad_conditions.php:79
501
  msgid "show on search result pages"
502
  msgstr ""
503
 
504
+ #: classes/display-conditions.php:738 includes/array_ad_conditions.php:83
505
  msgid "404 Page"
506
  msgstr ""
507
 
508
+ #: classes/display-conditions.php:739 includes/array_ad_conditions.php:84
509
  msgid "show on 404 error page"
510
  msgstr ""
511
 
512
+ #: classes/display-conditions.php:743 includes/array_ad_conditions.php:88
513
  msgid "Attachment Pages"
514
  msgstr ""
515
 
516
+ #: classes/display-conditions.php:744 includes/array_ad_conditions.php:89
517
  msgid "show on attachment pages"
518
  msgstr ""
519
 
520
+ #: classes/display-conditions.php:748 includes/array_ad_conditions.php:93
521
  msgid "Secondary Queries"
522
  msgstr ""
523
 
524
+ #: classes/display-conditions.php:749 includes/array_ad_conditions.php:94
525
  msgid "allow ads in secondary queries"
526
  msgstr ""
527
 
528
+ #: classes/display-conditions.php:753
529
  msgid "RSS Feed"
530
  msgstr ""
531
 
532
+ #: classes/display-conditions.php:754
533
  msgid "allow ads in RSS Feed"
534
  msgstr ""
535
 
536
+ #: classes/display-conditions.php:789
537
  msgid "older than"
538
  msgstr ""
539
 
540
+ #: classes/display-conditions.php:790
541
  msgid "younger than"
542
  msgstr ""
543
 
544
+ #: classes/display-conditions.php:792
545
  msgid "days"
546
  msgstr ""
547
 
591
  msgid "Random AdSense ads"
592
  msgstr ""
593
 
594
+ #: classes/frontend_checks.php:109 admin/includes/class-settings.php:514
595
  msgid "You look like a bot"
596
  msgstr ""
597
 
672
  msgid "Auto ads code found"
673
  msgstr ""
674
 
675
+ #: classes/frontend_checks.php:404
676
  msgid "Ad Health"
677
  msgstr ""
678
 
679
+ #: classes/frontend_checks.php:418
680
  #, php-format
681
  msgid "Show %d more notifications"
682
  msgstr ""
683
 
684
+ #: classes/frontend_checks.php:435
685
  msgid "Everything is fine"
686
  msgstr ""
687
 
688
+ #: classes/frontend_checks.php:446 admin/includes/class-ad-type.php:778
 
689
  msgid "Get help"
690
  msgstr ""
691
 
692
+ #: classes/frontend_checks.php:503
693
  msgid ""
694
  "the following code is used for automatic error detection and only visible to "
695
  "admins"
957
  "<a href=\"%2$s\" target=\"_blank\">Learn more</a>."
958
  msgstr ""
959
 
960
+ #: admin/includes/ad-health-notices.php:74 admin/views/placements.php:140
961
  #, php-format
962
  msgid ""
963
  "Missing PHP extensions could cause issues. Please ask your hosting provider "
1243
  msgid "Ad draft updated."
1244
  msgstr ""
1245
 
1246
+ #: admin/includes/class-ad-type.php:777
1247
  msgid ""
1248
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
1249
  "again to fix this."
1250
  msgstr ""
1251
 
1252
+ #: admin/includes/class-licenses.php:90
1253
  #, php-format
1254
  msgid ""
1255
  "There might be a new version of %1$s. Please <strong>provide a valid license "
1257
  "this page</a>."
1258
  msgstr ""
1259
 
1260
+ #: admin/includes/class-licenses.php:110
1261
  msgid "Error while trying to register the license. Please contact support."
1262
  msgstr ""
1263
 
1264
+ #: admin/includes/class-licenses.php:115 admin/views/setting-license.php:60
1265
  msgid "Please enter a valid license key"
1266
  msgstr ""
1267
 
1268
+ #: admin/includes/class-licenses.php:172
1269
  msgid "License couldn’t be activated. Please try again later."
1270
  msgstr ""
1271
 
1272
+ #: admin/includes/class-licenses.php:189
1273
  msgid "This is the bundle license key."
1274
  msgstr ""
1275
 
1276
+ #: admin/includes/class-licenses.php:190
1277
  msgid "This is not the correct key for this add-on."
1278
  msgstr ""
1279
 
1280
+ #: admin/includes/class-licenses.php:191
1281
  msgid "There are no activations left."
1282
  msgstr ""
1283
 
1284
+ #: admin/includes/class-licenses.php:202
1285
  #, php-format
1286
  msgid "License is invalid. Reason: %s"
1287
  msgstr ""
1288
 
1289
  #. %s is a list of server information like IP address. Just keep it as is.
1290
+ #: admin/includes/class-licenses.php:238
1291
  #, php-format
1292
  msgid ""
1293
  "Your request was blocked by our firewall. Please send us the following "
1294
  "information to unblock you: %s."
1295
  msgstr ""
1296
 
1297
+ #: admin/includes/class-licenses.php:296
1298
  msgid "Error while trying to disable the license. Please contact support."
1299
  msgstr ""
1300
 
1301
+ #: admin/includes/class-licenses.php:331 admin/includes/class-licenses.php:354
1302
  msgid "License couldn’t be deactivated. Please try again later."
1303
  msgstr ""
1304
 
1305
+ #: admin/includes/class-licenses.php:584
1306
  #, php-format
1307
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1308
  msgstr ""
1309
 
1310
+ #: admin/includes/class-licenses.php:586
1311
  #, php-format
1312
  msgid ""
1313
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
1354
  msgstr ""
1355
 
1356
  #: admin/includes/class-menu.php:131 admin/includes/class-menu.php:135
1357
+ #: admin/includes/class-settings.php:269
1358
  msgid "Licenses"
1359
  msgstr ""
1360
 
1361
+ #: admin/includes/class-menu.php:223 admin/includes/class-menu.php:250
1362
  msgid "Sorry, you are not allowed to access this feature."
1363
  msgstr ""
1364
 
1365
+ #: admin/includes/class-menu.php:236
1366
  msgid ""
1367
  "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was "
1368
  "deleted?"
1394
  msgstr ""
1395
 
1396
  #: admin/includes/class-meta-box.php:153 admin/includes/class-meta-box.php:164
1397
+ #: admin/includes/class-meta-box.php:169 admin/includes/class-settings.php:607
1398
  #: admin/views/ad-output-metabox.php:82
 
1399
  #: modules/ads-txt/admin/views/setting-create.php:11
1400
  #: modules/privacy/admin/views/setting-enable.php:2
1401
  msgid "Manual"
1410
  msgid "Disable"
1411
  msgstr ""
1412
 
1413
+ #: admin/includes/class-meta-box.php:311
1414
  msgid "Ad Settings"
1415
  msgstr ""
1416
 
1417
+ #: admin/includes/class-meta-box.php:413 admin/views/overview.php:6
1418
  msgid "Ads Dashboard"
1419
  msgstr ""
1420
 
1421
+ #: admin/includes/class-meta-box.php:424
1422
  #, php-format
1423
  msgid "%d ads – <a href=\"%s\">manage</a> - <a href=\"%s\">new</a>"
1424
  msgstr ""
1425
 
1426
+ #: admin/includes/class-meta-box.php:435
1427
  msgid "Get the tutorial via email"
1428
  msgstr ""
1429
 
1430
+ #: admin/includes/class-meta-box.php:442
1431
  msgid "Get AdSense tips via email"
1432
  msgstr ""
1433
 
1434
+ #: admin/includes/class-meta-box.php:449
1435
  msgid "Visit our blog for more articles about ad optimization"
1436
  msgstr ""
1437
 
1438
  #. %s is our URL
1439
+ #: admin/includes/class-meta-box.php:502
1440
  msgid "Latest posts on wpadvancedads.com"
1441
  msgstr ""
1442
 
1495
  msgid "How to earn more with AdSense"
1496
  msgstr ""
1497
 
1498
+ #: admin/includes/class-overview-widgets.php:127
1499
  msgid "Join now"
1500
  msgstr ""
1501
 
1502
+ #: admin/includes/class-overview-widgets.php:138
1503
  msgid ""
1504
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1505
  "help us with a review."
1506
  msgstr ""
1507
 
1508
+ #: admin/includes/class-overview-widgets.php:140
1509
  msgid "Sure, I’ll rate the plugin"
1510
  msgstr ""
1511
 
1512
+ #: admin/includes/class-overview-widgets.php:142
1513
  msgid "I already did"
1514
  msgstr ""
1515
 
1516
+ #: admin/includes/class-overview-widgets.php:148
1517
  msgid "Manage your ads"
1518
  msgstr ""
1519
 
1520
+ #: admin/includes/class-overview-widgets.php:153
1521
  msgid "Get the All Access pass"
1522
  msgstr ""
1523
 
1524
+ #: admin/includes/class-overview-widgets.php:179
1525
  #, php-format
1526
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1527
  msgstr ""
1528
 
1529
+ #: admin/includes/class-overview-widgets.php:180
1530
  #, php-format
1531
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1532
  msgstr ""
1533
 
1534
  #. %s includes a number and markup like <span class="count">6</span>.
1535
+ #: admin/includes/class-overview-widgets.php:189
1536
  #: admin/views/overview-notices.php:17
1537
  #, php-format
1538
  msgid "Show %s hidden notices"
1539
  msgstr ""
1540
 
1541
+ #: admin/includes/class-overview-widgets.php:367
1542
  msgid "How to install and activate an add-on."
1543
  msgstr ""
1544
 
1545
+ #: admin/includes/class-overview-widgets.php:372
1546
  msgid "The solution for professional websites."
1547
  msgstr ""
1548
 
1549
+ #: admin/includes/class-overview-widgets.php:375
1550
  #: admin/views/pitch-pro-tab.php:7
1551
  msgid "support for cached sites"
1552
  msgstr ""
1553
 
1554
+ #: admin/includes/class-overview-widgets.php:378
1555
+ #: admin/includes/class-overview-widgets.php:379
1556
+ #: admin/includes/class-overview-widgets.php:380
1557
+ #: admin/includes/class-overview-widgets.php:381
1558
  #, php-format
1559
  msgid "integrates with <strong>%s</strong>"
1560
  msgstr ""
1561
 
1562
+ #: admin/includes/class-overview-widgets.php:382
1563
  msgid "click fraud protection, lazy load, ad-block ads"
1564
  msgstr ""
1565
 
1566
+ #: admin/includes/class-overview-widgets.php:383
1567
  #: admin/views/pitch-pro-tab.php:8
1568
  msgid "11 more display and visitor conditions"
1569
  msgstr ""
1570
 
1571
+ #: admin/includes/class-overview-widgets.php:384
1572
  #: admin/views/pitch-pro-tab.php:9
1573
  msgid "6 more placements"
1574
  msgstr ""
1575
 
1576
+ #: admin/includes/class-overview-widgets.php:385
1577
  #: admin/views/pitch-pro-tab.php:10
1578
  msgid "placement tests for ad optimization"
1579
  msgstr ""
1580
 
1581
+ #: admin/includes/class-overview-widgets.php:386
1582
  #: admin/views/pitch-pro-tab.php:11
1583
  msgid "ad grids and many more advanced features"
1584
  msgstr ""
1585
 
1586
+ #: admin/includes/class-overview-widgets.php:393
1587
  msgid ""
1588
  "Analyze clicks and impressions of your ads locally or in Google Analytics, "
1589
  "share reports, and limit ads to a specific number of impressions or clicks."
1590
  msgstr ""
1591
 
1592
+ #: admin/includes/class-overview-widgets.php:399
1593
  msgid ""
1594
  "Display ads based on the device or the size of your visitor’s browser, and "
1595
  "control ads on AMP pages."
1596
  msgstr ""
1597
 
1598
+ #: admin/includes/class-overview-widgets.php:412
1599
  msgid ""
1600
  "Earn more money and let advertisers pay for ad space directly on the "
1601
  "frontend of your site."
1602
  msgstr ""
1603
 
1604
+ #: admin/includes/class-overview-widgets.php:418
1605
  msgid ""
1606
  "Target visitors with ads that match their geo location and make more money "
1607
  "with regional campaigns."
1608
  msgstr ""
1609
 
1610
+ #: admin/includes/class-overview-widgets.php:424
1611
  msgid ""
1612
  "Increase click rates on your ads by placing them in sticky positions above, "
1613
  "next or below your site."
1614
  msgstr ""
1615
 
1616
+ #: admin/includes/class-overview-widgets.php:430
1617
  msgid ""
1618
  "Users will never miss an ad or other information in a PopUp. Choose when it "
1619
  "shows up and for how long a user can close it."
1620
  msgstr ""
1621
 
1622
+ #: admin/includes/class-overview-widgets.php:436
1623
  msgid ""
1624
  "Create a beautiful and simple slider from your ads to show more information "
1625
  "on less space."
1626
  msgstr ""
1627
 
1628
+ #: admin/includes/class-overview-widgets.php:442
1629
  msgid ""
1630
  "Place AdSense In-feed ads between posts on homepage, category, and archive "
1631
  "pages."
1632
  msgstr ""
1633
 
1634
+ #: admin/includes/class-overview-widgets.php:445
1635
+ #: admin/includes/class-overview-widgets.php:620
1636
+ #: admin/includes/class-overview-widgets.php:636
1637
  msgid "Install now"
1638
  msgstr ""
1639
 
1640
+ #: admin/includes/class-overview-widgets.php:463
1641
+ #: admin/includes/class-overview-widgets.php:484
1642
+ #: admin/includes/class-overview-widgets.php:509
1643
+ #: admin/includes/class-overview-widgets.php:527
1644
+ #: admin/includes/class-overview-widgets.php:545
1645
+ #: admin/includes/class-overview-widgets.php:563
1646
+ #: admin/includes/class-overview-widgets.php:581
1647
+ #: admin/includes/class-overview-widgets.php:599
1648
  msgid "Activate now"
1649
  msgstr ""
1650
 
1651
+ #: admin/includes/class-overview-widgets.php:492
1652
  msgid "Visit your ad stats"
1653
  msgstr ""
1654
 
1655
+ #: admin/includes/class-overview-widgets.php:616
1656
  msgid "Use Genesis specific ad positions."
1657
  msgstr ""
1658
 
1659
+ #: admin/includes/class-overview-widgets.php:632
1660
  msgid ""
1661
  "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
1662
  msgstr ""
1663
 
1664
+ #: admin/includes/class-overview-widgets.php:648
1665
  msgid "Our best deal with all add-ons included."
1666
  msgstr ""
1667
 
1668
+ #: admin/includes/class-overview-widgets.php:650
1669
  msgid "Get full access"
1670
  msgstr ""
1671
 
1672
+ #: admin/includes/class-overview-widgets.php:664
1673
  #: admin/views/conditions/ad-display-metabox.php:38
1674
  #: admin/views/conditions/ad-visitor-metabox.php:38
1675
  msgid "Visit the manual"
1676
  msgstr ""
1677
 
1678
+ #: admin/includes/class-overview-widgets.php:667
1679
  msgid "Get this add-on"
1680
  msgstr ""
1681
 
1704
  msgstr ""
1705
 
1706
  #: admin/includes/class-settings.php:168
 
 
 
 
1707
  msgid "Hide ads from bots"
1708
  msgstr ""
1709
 
1710
+ #: admin/includes/class-settings.php:177
1711
  msgid "Disable ads for post types"
1712
  msgstr ""
1713
 
1714
+ #: admin/includes/class-settings.php:186
1715
  msgid "Disable Ad Health and other notices"
1716
  msgstr ""
1717
 
1718
+ #: admin/includes/class-settings.php:194
1719
  msgid "ID prefix"
1720
  msgstr ""
1721
 
1722
+ #: admin/includes/class-settings.php:202
1723
  msgid "Allow editors to manage ads"
1724
  msgstr ""
1725
 
1726
+ #: admin/includes/class-settings.php:210
1727
  msgid "Ad label"
1728
  msgstr ""
1729
 
1730
+ #: admin/includes/class-settings.php:219
1731
  msgid "Open links in a new window"
1732
  msgstr ""
1733
 
1734
+ #: admin/includes/class-settings.php:227
1735
  msgid "Use advanced JavaScript"
1736
  msgstr ""
1737
 
1738
+ #: admin/includes/class-settings.php:237
1739
  msgid "Delete data on uninstall"
1740
  msgstr ""
1741
 
1742
+ #: admin/includes/class-settings.php:247
1743
  msgid "Disable shortcode button"
1744
  msgstr ""
1745
 
1746
+ #: admin/includes/class-settings.php:286
1747
  msgid "Pro"
1748
  msgstr ""
1749
 
1750
+ #: admin/includes/class-settings.php:302 admin/views/pitch-tracking.php:2
1751
  msgid "Tracking"
1752
  msgstr ""
1753
 
1754
+ #: admin/includes/class-settings.php:350
1755
  #, php-format
1756
  msgid ""
1757
  "Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
1758
  "ons</a>."
1759
  msgstr ""
1760
 
1761
+ #: admin/includes/class-settings.php:351
1762
  #, php-format
1763
  msgid ""
1764
  "See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
1765
  "licenses</a>."
1766
  msgstr ""
1767
 
1768
+ #: admin/includes/class-settings.php:363
1769
  msgid "Are you missing something?"
1770
  msgstr ""
1771
 
1772
+ #: admin/includes/class-settings.php:431
1773
  msgid "Choose the roles a user must have in order to not see any ads."
1774
  msgstr ""
1775
 
1776
+ #: admin/includes/class-settings.php:445
1777
  msgid ""
1778
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1779
  "needs it."
1780
  msgstr ""
1781
 
1782
+ #: admin/includes/class-settings.php:448
1783
  #, php-format
1784
  msgid ""
1785
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
1787
  "need features from this file."
1788
  msgstr ""
1789
 
1790
+ #: admin/includes/class-settings.php:468
1791
  msgid ""
1792
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1793
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
1797
  "injection only in the first x posts on your archive pages."
1798
  msgstr ""
1799
 
1800
+ #: admin/includes/class-settings.php:484
1801
  msgid ""
1802
  "Please check your post content. A priority of 10 and below might cause "
1803
  "issues (wpautop function might run twice)."
1804
  msgstr ""
1805
 
1806
+ #: admin/includes/class-settings.php:486
1807
  msgid ""
1808
  "Play with this value in order to change the priority of the injected ads "
1809
  "compared to other auto injected elements in the post content."
1810
  msgstr ""
1811
 
1812
+ #: admin/includes/class-settings.php:500
1813
  msgid ""
1814
  "Advanced Ads ignores paragraphs and other elements in containers when "
1815
  "injecting ads into the post content. Check this option to ignore this "
1816
  "limitation and ads might show up again."
1817
  msgstr ""
1818
 
1819
+ #: admin/includes/class-settings.php:516
 
 
 
 
 
 
 
 
1820
  msgid "Read this first"
1821
  msgstr ""
1822
 
1823
+ #: admin/includes/class-settings.php:517
1824
  msgid "Hide ads from crawlers, bots and empty user agents."
1825
  msgstr ""
1826
 
1827
+ #: admin/includes/class-settings.php:530
1828
  msgid "Pro feature"
1829
  msgstr ""
1830
 
1831
  #. %1$s is a starting <a> tag and %2$s a closing one
1832
+ #: admin/includes/class-settings.php:548
1833
  #, php-format
1834
  msgid ""
1835
  "Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
1836
  "notices like tips, tutorials, email newsletters and update notices."
1837
  msgstr ""
1838
 
1839
+ #: admin/includes/class-settings.php:566
1840
  msgid ""
1841
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1842
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1843
  "need to <strong>rewrite css rules afterwards</strong>."
1844
  msgstr ""
1845
 
1846
+ #: admin/includes/class-settings.php:585
1847
  msgid "Allow editors to also manage and publish ads."
1848
  msgstr ""
1849
 
1850
+ #: admin/includes/class-settings.php:586
1851
  #, php-format
1852
  msgid ""
1853
  "You can assign different ad-related roles on a user basis with <a "
1854
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1855
  msgstr ""
1856
 
1857
+ #: admin/includes/class-settings.php:597
1858
  msgctxt "label before ads"
1859
  msgid "Advertisements"
1860
  msgstr ""
1861
 
1862
+ #: admin/includes/class-settings.php:606
1863
  msgid "Displayed above ads."
1864
  msgstr ""
1865
 
1866
+ #: admin/includes/class-settings.php:642
1867
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1868
  msgstr ""
1869
 
1870
+ #: admin/includes/class-settings.php:655
1871
  msgid "Disable shortcode button in visual editor."
1872
  msgstr ""
1873
 
2241
  #: admin/views/placements-ad-label-position.php:5
2242
  #: admin/views/placements-ad-label.php:1 admin/views/placements-ad-label.php:4
2243
  #: admin/views/placements.php:84
2244
+ #: modules/gadsense/includes/class-network-adsense.php:239
2245
  msgid "default"
2246
  msgstr ""
2247
 
2315
  msgid "Enable debug mode"
2316
  msgstr ""
2317
 
2318
+ #: admin/views/ad-parameters-size.php:9
2319
  msgid "size"
2320
  msgstr ""
2321
 
2322
+ #: admin/views/ad-parameters-size.php:11
2323
  msgid "width"
2324
  msgstr ""
2325
 
2326
+ #: admin/views/ad-parameters-size.php:12
2327
  msgid "height"
2328
  msgstr ""
2329
 
2330
+ #: admin/views/ad-parameters-size.php:20
2331
  msgid "reserve this space"
2332
  msgstr ""
2333
 
2696
  msgid "Placements updated"
2697
  msgstr ""
2698
 
2699
+ #: admin/views/placements.php:20 admin/views/placements.php:209
2700
  msgid "Create a new placement"
2701
  msgstr ""
2702
 
2703
+ #: admin/views/placements.php:21 admin/views/placements.php:211
2704
  msgid "New Placement"
2705
  msgstr ""
2706
 
2744
  msgid "position"
2745
  msgstr ""
2746
 
 
 
 
 
2747
  #: admin/views/placements.php:140
2748
+ msgid "Important Notice"
 
 
 
2749
  msgstr ""
2750
 
2751
+ #: admin/views/placements.php:162
2752
  msgid "ad label"
2753
  msgstr ""
2754
 
2755
+ #: admin/views/placements.php:172
2756
  msgid "show all options"
2757
  msgstr ""
2758
 
2759
+ #: admin/views/placements.php:191
2760
  #, php-format
2761
  msgid ""
2762
  "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the "
2763
  "header of your website</a>."
2764
  msgstr ""
2765
 
2766
+ #: admin/views/placements.php:200
2767
  msgctxt "checkbox to remove placement"
2768
  msgid "delete"
2769
  msgstr ""
2770
 
2771
+ #: admin/views/placements.php:207
2772
  msgid "Save Placements"
2773
  msgstr ""
2774
 
2993
  "websites."
2994
  msgstr ""
2995
 
2996
+ #: admin/views/conditions/condition-author.php:28
2997
  #, php-format
2998
  msgid ""
2999
  "Only %d elements are displayed above. Use the <code>advanced-ads-admin-max-"
3061
  msgid "manual"
3062
  msgstr ""
3063
 
3064
+ #: admin/views/conditions/no-option.php:7
3065
+ #, php-format
3066
+ msgctxt ""
3067
+ "Error message shown when no terms exists for display condition; placeholder "
3068
+ "is taxonomy label."
3069
+ msgid "No %s found on your site."
3070
+ msgstr ""
3071
+
3072
+ #: admin/views/conditions/not-selected.php:2
3073
+ msgctxt "Error message shown when no display condition term is selected"
3074
+ msgid "Please select some items."
3075
+ msgstr ""
3076
+
3077
  #: admin/views/conditions/visitor-conditions-form-top.php:4
3078
  msgid ""
3079
  "Visitor conditions limit the number of users who can see your ad. There is "
3126
  msgid "First ad tutorial"
3127
  msgstr ""
3128
 
3129
+ #: admin/views/notices/welcome-panel.php:23
3130
  msgid "One-Click Setup"
3131
  msgstr ""
3132
 
3133
+ #: admin/views/notices/welcome-panel.php:30
3134
  msgid "Create 2 test ads"
3135
  msgstr ""
3136
 
3137
+ #: admin/views/notices/welcome-panel.php:31
3138
  msgid ""
3139
  "Click to place two ads in the content of your site which are visible to you "
3140
  "only."
3141
  msgstr ""
3142
 
3143
+ #: admin/views/notices/welcome-panel.php:34
3144
  msgid "AdSense Options"
3145
  msgstr ""
3146
 
3147
+ #: admin/views/notices/welcome-panel.php:36
3148
  msgid "Import ads from AdSense"
3149
  msgstr ""
3150
 
3151
+ #: admin/views/notices/welcome-panel.php:40
3152
  msgid "Setting up Auto ads"
3153
  msgstr ""
3154
 
3155
+ #: admin/views/notices/welcome-panel.php:43
3156
  msgid "Setting up AdSense ads manually"
3157
  msgstr ""
3158
 
 
 
 
 
3159
  #: modules/ad-blocker/admin/admin.php:96
3160
  msgid "Ad blocker fix"
3161
  msgstr ""
3304
  msgid "Dummy Account Id"
3305
  msgstr ""
3306
 
3307
+ #: modules/gadsense/includes/class-ad-type-adsense.php:33
3308
  msgid "AdSense ad"
3309
  msgstr ""
3310
 
3311
+ #: modules/gadsense/includes/class-ad-type-adsense.php:34
3312
  msgid "Use ads from your Google AdSense account"
3313
  msgstr ""
3314
 
3315
+ #: modules/gadsense/includes/class-ad-type-adsense.php:90
3316
  #: modules/gadsense/admin/views/adsense-account.php:83
3317
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3318
  msgstr ""
3319
 
3320
+ #: modules/gadsense/includes/class-ad-type-adsense.php:131
3321
  msgid "Your AdSense Publisher ID is missing."
3322
  msgstr ""
3323
 
3324
  #. we replace AdSense code with a dummy ad code in the Customizer and Elementor since AdSense could cause them to break. This is the text within that dummy ad.
3325
+ #: modules/gadsense/includes/class-ad-type-adsense.php:226
3326
  msgid "This will be an AdSense ad on your live site."
3327
  msgstr ""
3328
 
3433
  msgid "Verification code & Auto ads"
3434
  msgstr ""
3435
 
3436
+ #: modules/gadsense/includes/class-network-adsense.php:54
3437
  msgid "Auto ads"
3438
  msgstr ""
3439
 
3440
+ #: modules/gadsense/includes/class-network-adsense.php:54
3441
  msgid "Disable top anchor ad"
3442
  msgstr ""
3443
 
3444
+ #: modules/gadsense/includes/class-network-adsense.php:64
3445
  msgid "Disable stats"
3446
  msgstr ""
3447
 
3448
+ #: modules/gadsense/includes/class-network-adsense.php:76
3449
  msgid "Limit to 3 ads"
3450
  msgstr ""
3451
 
3452
+ #: modules/gadsense/includes/class-network-adsense.php:86
3453
  msgid "Disable violation warnings"
3454
  msgstr ""
3455
 
3456
+ #: modules/gadsense/includes/class-network-adsense.php:94
3457
  msgid "Transparent background"
3458
  msgstr ""
3459
 
3460
+ #: modules/gadsense/includes/class-network-adsense.php:102
3461
  msgid "Full width responsive ads on mobile"
3462
  msgstr ""
3463
 
3464
+ #: modules/gadsense/includes/class-network-adsense.php:146
3465
  #, php-format
3466
  msgid "Limit to %d AdSense ads"
3467
  msgstr ""
3468
 
3469
+ #: modules/gadsense/includes/class-network-adsense.php:150
3470
  msgid ""
3471
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3472
  "this setting to prevent too many AdSense ads to show accidentally on your "
3473
  "site."
3474
  msgstr ""
3475
 
3476
+ #: modules/gadsense/includes/class-network-adsense.php:154
3477
  msgid ""
3478
  "Due to technical restrictions, the limit does not work on placements with "
3479
  "cache-busting enabled."
3480
  msgstr ""
3481
 
3482
+ #: modules/gadsense/includes/class-network-adsense.php:166
3483
  msgid ""
3484
  "Enable this box if you don’t want Google Auto ads to place anchor ads at the "
3485
  "top of your page."
3486
  msgstr ""
3487
 
3488
+ #: modules/gadsense/includes/class-network-adsense.php:179
3489
  msgid ""
3490
  "Enable this option to stop loading stats from AdSense into your WordPress "
3491
  "backend."
3492
  msgstr ""
3493
 
3494
+ #: modules/gadsense/includes/class-network-adsense.php:194
3495
  #: modules/gadsense/admin/views/connect-adsense.php:37
3496
  msgid ""
3497
  "Insert the AdSense header code used for verification and the Auto Ads "
3499
  msgstr ""
3500
 
3501
  #. this is the text for a link to a sub-page in an AdSense account
3502
+ #: modules/gadsense/includes/class-network-adsense.php:199
3503
  msgid "Adjust Auto ads options"
3504
  msgstr ""
3505
 
3506
+ #: modules/gadsense/includes/class-network-adsense.php:201
3507
  #, php-format
3508
  msgid ""
3509
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3510
  "appear in random places</strong>."
3511
  msgstr ""
3512
 
3513
+ #: modules/gadsense/includes/class-network-adsense.php:202
3514
  msgid "Display Auto ads only on specific pages"
3515
  msgstr ""
3516
 
3517
+ #: modules/gadsense/includes/class-network-adsense.php:203
3518
  msgid "Auto ads on AMP pages"
3519
  msgstr ""
3520
 
3521
+ #: modules/gadsense/includes/class-network-adsense.php:216
3522
  msgid "Disable warnings about potential violations of the AdSense terms."
3523
  msgstr ""
3524
 
3525
+ #: modules/gadsense/includes/class-network-adsense.php:217
3526
  #, php-format
3527
  msgid ""
3528
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
3530
  "managed with Advanced Ads. Enable this option to remove these checks"
3531
  msgstr ""
3532
 
3533
+ #: modules/gadsense/includes/class-network-adsense.php:228
3534
  msgid ""
3535
  "Enable this option in case your theme adds an unfortunate background color "
3536
  "to AdSense ads."
3537
  msgstr ""
3538
 
3539
+ #: modules/gadsense/includes/class-network-adsense.php:240
3540
  msgid "enable"
3541
  msgstr ""
3542
 
3543
+ #: modules/gadsense/includes/class-network-adsense.php:241
3544
  msgid "disable"
3545
  msgstr ""
3546
 
3547
+ #: modules/gadsense/includes/class-network-adsense.php:246
3548
  #, php-format
3549
  msgid ""
3550
  "Whether your responsive ad unit may expand to <a href='%s' target='blank'>"
4138
  msgstr ""
4139
 
4140
  #. Author of the plugin
4141
+ msgid "Thomas Maier, Advanced Ads GmbH"
4142
  msgstr ""
modules/gadsense/admin/assets/js/adsense.js CHANGED
@@ -301,7 +301,7 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
301
  }
302
 
303
  /* Page-Level ad */
304
- if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 ) {
305
  theAd = { 'parse_message': 'pageLevelAd' };
306
  }
307
 
@@ -970,4 +970,4 @@ window.Advanced_Ads_Adsense_Helper = window.Advanced_Ads_Adsense_Helper || {
970
  });
971
  },
972
 
973
- };
301
  }
302
 
303
  /* Page-Level ad */
304
+ if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 || /script[^>]+data-ad-client=/.test( rawContent ) ) {
305
  theAd = { 'parse_message': 'pageLevelAd' };
306
  }
307
 
970
  });
971
  },
972
 
973
+ };
modules/gadsense/admin/assets/js/connect-adsense.js CHANGED
@@ -124,9 +124,12 @@
124
  nonce: AdsenseMAPI.nonce,
125
  account : details[ adsenseID ],
126
  'token_data': tokenData,
127
- autoads: $( '#mapi-autoads' ).prop( 'checked' ),
128
  };
129
 
 
 
 
 
130
  $.ajax({
131
  url: ajaxurl,
132
  type: 'post',
@@ -156,7 +159,7 @@
156
  };
157
  data['token_data'] = tokenData;
158
  if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
159
- data['autoads'] = true;
160
  }
161
 
162
  $.ajax({
124
  nonce: AdsenseMAPI.nonce,
125
  account : details[ adsenseID ],
126
  'token_data': tokenData,
 
127
  };
128
 
129
+ if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
130
+ data['autoads'] = 1;
131
+ }
132
+
133
  $.ajax({
134
  url: ajaxurl,
135
  type: 'post',
159
  };
160
  data['token_data'] = tokenData;
161
  if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
162
+ data['autoads'] = 1;
163
  }
164
 
165
  $.ajax({
modules/gadsense/includes/class-ad-type-adsense.php CHANGED
@@ -12,14 +12,12 @@
12
  * Class containing information about the adsense ad type
13
  *
14
  * see also includes/class-ad-type-abstract.php for basic object
15
- *
16
  */
17
  class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
18
 
19
  /**
20
  * ID - internal type of the ad type
21
- *
22
- * must be static so set your own ad type ID here
23
  * use slug like format, only lower case, underscores and hyphens
24
  *
25
  * @since 1.4
@@ -27,98 +25,97 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
27
  public $ID = 'adsense';
28
 
29
  /**
30
- * set basic attributes
31
  *
32
  * @since 1.4
33
  */
34
  public function __construct() {
35
- $this->title = __( 'AdSense ad', 'advanced-ads' );
36
  $this->description = __( 'Use ads from your Google AdSense account', 'advanced-ads' );
37
- $this->parameters = array(
38
- 'content' => ''
39
  );
40
  }
41
 
42
  /**
43
- * output for the ad parameters metabox
44
- *
45
  * this will be loaded using ajax when changing the ad type radio buttons
46
  * echo the output right away here
47
  * name parameters must be in the "advanced_ads" array
48
  *
49
- * @param obj $ad ad object
 
50
  * @since 1.4
51
  */
52
- public function render_parameters($ad) {
53
- {
54
- // THIS IS JUST A QUICK AND DIRTY HACK
55
- // TODO: create a dedicated method to handle this properly
56
- ?>
57
- <script>
58
- jQuery(function () {
59
- <?php
60
- $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
61
- $json_ad_codes = json_encode($mapi_options['ad_codes']);
62
- ?>
63
- const adsense = new AdvancedAdsNetworkAdsense(<?php echo $json_ad_codes?>);
64
- AdvancedAdsAdmin.AdImporter.setup(adsense);
65
- });
66
- </script>
67
- <?php
68
- }
69
 
70
  $options = $ad->options();
71
 
72
- $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
73
- $unit_id = '';
74
- $unit_pubid = '';
75
- $unit_code = '';
76
- $unit_type = 'responsive';
77
- $unit_width = 0;
78
- $unit_height = 0;
79
  $json_content = '';
80
- $unit_resize = '';
81
  $extra_params = array(
82
- 'default_width' => '',
83
  'default_height' => '',
84
- 'at_media' => array(),
85
  );
86
 
87
- $db = Advanced_Ads_AdSense_Data::get_instance();
88
  $pub_id = trim( $db->get_adsense_id( $ad ) );
89
 
90
  // check pub_id for errors
91
  $pub_id_errors = false;
92
- if( $pub_id !== '' && 0 !== strpos( $pub_id, 'pub-' ) ){
93
  $pub_id_errors = __( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' );
94
  }
95
 
96
- global $external_ad_unit_id, $use_dashicons, $closeable;
97
- $closeable = true;
98
- $use_dashicons = false;
99
- $external_ad_unit_id = "";
100
- if ( trim($content) !== '' ) {
101
 
102
  $json_content = stripslashes( $content );
103
 
104
  // get json content striped by slashes
105
  $content = json_decode( stripslashes( $content ) );
106
 
107
- if ( isset($content->unitType) ) {
108
  $content->json = $json_content;
109
- $unit_type = $content->unitType;
110
- $unit_code = $content->slotId;
111
- $unit_pubid = !empty( $content->pubId ) ? $content->pubId : $pub_id;
112
- $layout = isset( $content->layout ) ? $content->layout : '';
113
- $layout_key = isset( $content->layout_key ) ? $content->layout_key : '';
114
-
115
  if ( 'responsive' != $content->unitType && 'link-responsive' != $content->unitType && 'matched-content' != $content->unitType ) {
116
  // Normal ad unit
117
- $unit_width = $ad->width;
118
  $unit_height = $ad->height;
119
  } else {
120
  // Responsive && matched content
121
- $unit_resize = (isset($content->resize)) ? $content->resize : 'auto';
122
  if ( 'auto' != $unit_resize ) {
123
  $extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
124
  }
@@ -130,7 +127,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
130
  }
131
  }
132
 
133
- if( '' === trim( $pub_id ) && '' !== trim( $unit_code ) ){
134
  $pub_id_errors = __( 'Your AdSense Publisher ID is missing.', 'advanced-ads' );
135
  }
136
 
@@ -149,20 +146,24 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
149
  }
150
 
151
  /**
152
- * sanitize content field on save
153
  *
154
- * @param str $content ad content
155
- * @return str $content sanitized ad content
 
156
  * @since 1.0.0
157
  */
158
- public function sanitize_content($content = '') {
159
- return $content = wp_unslash( $content );
 
 
160
  }
161
 
162
  /**
163
  * Prepare the ads frontend output.
164
  *
165
  * @param object $ad ad object.
 
166
  * @return string $content ad content prepared for frontend output
167
  * @since 1.0.0
168
  */
@@ -170,28 +171,29 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
170
  global $gadsense;
171
 
172
  $content = json_decode( stripslashes( $ad->content ) );
173
-
174
- if( isset( $ad->args['wp_the_query']['is_404'] )
175
- && $ad->args['wp_the_query']['is_404']
176
- && ! defined( 'ADVADS_ALLOW_ADSENSE_ON_404' ) ){
177
- return '';
178
  }
179
-
180
- $output = '';
181
- $db = Advanced_Ads_AdSense_Data::get_instance();
182
- $pub_id = $db->get_adsense_id( $ad );
183
  $limit_per_page = $db->get_limit_per_page();
184
 
185
- if ( ! isset($content->unitType) || empty($pub_id) ) {
186
- return $output; }
187
- // deprecated since the adsbygoogle.js file is now always loaded
188
- if ( ! isset($gadsense['google_loaded']) || ! $gadsense['google_loaded'] ) {
 
189
  $gadsense['google_loaded'] = true;
190
  }
191
 
192
- //check if passive cb is used
193
  if ( isset( $gadsense['adsense_count'] ) ) {
194
- $gadsense['adsense_count']++;
195
  } else {
196
  $gadsense['adsense_count'] = 1;
197
  }
@@ -203,28 +205,30 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
203
 
204
  $is_static_normal_content = ! in_array( $content->unitType, array( 'responsive', 'link-responsive', 'matched-content', 'in-article', 'in-feed' ) );
205
 
206
- if ( Advanced_Ads_Utils::is_iframe() ) {
 
 
207
  $attrs = array(
208
  'style' => array(
209
- 'width' => ( $is_static_normal_content && $ad->width ) ? $ad->width . 'px' : '300px',
210
- 'height' => ( $is_static_normal_content && $ad->height ) ? $ad->height . 'px' : '125px',
211
- 'text-align' => 'center',
212
- 'display' => 'flex',
213
- 'align-items' => 'center',
214
  'justify-content' => 'center',
215
- 'background' => '#cccccc',
216
- 'color' => '#64655D'
217
- )
218
  );
219
 
220
  return '<div ' . Advanced_Ads_Utils::build_html_attributes( $attrs ) . '>'
221
- // translators: we replace AdSense code with a dummy ad code in the Customizer and Elementor since AdSense could cause them to break. This is the text within that dummy ad.
222
- . __( 'This will be an AdSense ad on your live site.', 'advanced-ads' )
223
- . '</div>';
224
  }
225
 
226
  $output = apply_filters( 'advanced-ads-gadsense-output', false, $ad, $pub_id, $content );
227
- if ( $output !== false ) {
228
  return $output;
229
  } elseif ( advads_is_amp() ) {
230
  // Prevent output on AMP pages.
@@ -233,16 +237,16 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
233
 
234
  $output = '';
235
 
236
- // build static normal content ads first
237
  if ( $is_static_normal_content ) {
238
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
239
  $output .= '<ins class="adsbygoogle" ';
240
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
241
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
242
  $output .= 'data-ad-slot="' . $content->slotId . '"';
243
- // ad type for static link unit
244
- if( 'link' == $content->unitType ){
245
- $output .= "\n" . 'data-ad-format="link"';
246
  }
247
  $output .= '></ins> ' . "\n";
248
  $output .= '<script> ' . "\n";
@@ -253,8 +257,8 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
253
  * The value of $ad->content->resize should be tested to format the output correctly
254
  */
255
  $unmodified = $output;
256
- $output = apply_filters( 'advanced-ads-gadsense-responsive-output', $output, $ad, $pub_id );
257
- if ( $unmodified == $output ) {
258
  /**
259
  * If the output has not been modified, perform a default responsive output.
260
  * A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
@@ -264,66 +268,70 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
264
  // Remove float setting if this is a responsive ad unit without custom sizes.
265
  unset( $ad->wrapper['style']['float'] );
266
  }
267
-
268
  }
269
 
270
  return $output;
271
  }
272
 
273
- /**
274
- * Check if a string looks like an AdSense ad code.
275
- *
276
- * @param string $content The string that need to be checked.
277
- *
278
- * @return boolean
279
- */
280
- public static function content_is_adsense( $content = '' ) {
281
- return false !== stripos( $content, 'googlesyndication.com' ) &&
282
- ( false !== stripos( $content, 'google_ad_client' ) || false !== stripos( $content, 'data-ad-client' ) );
283
- }
284
-
285
- protected function append_defaut_responsive_content(&$output, $pub_id, $content) {
 
 
 
 
 
286
  $format = '';
287
- $style = 'display:block;';
288
- switch( $content->unitType ){
289
- case 'matched-content' :
290
- $format = 'autorelaxed';
291
- break;
292
- case 'link-responsive' :
293
- $format = 'link';
294
- break;
295
- case 'in-feed' :
296
- $format = 'fluid';
297
- $layout_key = $content->layout_key;
298
- break;
299
- case 'in-article' :
300
- $format = 'fluid';
301
- $layout = 'in-article';
302
- $style = 'display:block; text-align:center;';
303
- break;
304
- default :
305
- $format = 'auto';
306
  }
307
-
308
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
309
  $output .= '<ins class="adsbygoogle" ';
310
- $output .= 'style="'. $style .'" ';
311
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
312
  $output .= 'data-ad-slot="' . $content->slotId . '" ' . "\n";
313
  $output .= isset( $layout ) ? 'data-ad-layout="' . $layout . '"' . "\n" : '';
314
  $output .= isset( $layout_key ) ? 'data-ad-layout-key="' . $layout_key . '"' . "\n" : '';
315
  $output .= 'data-ad-format="';
316
  $output .= $format;
317
-
318
  $options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
319
- $fw = !empty( $options['fullwidth-ads'] ) ? $options['fullwidth-ads'] : 'default';
320
- if ( 'default'!== $fw ) {
321
- $output .= 'enable' == $fw ? '" data-full-width-responsive="true' : '" data-full-width-responsive="false';
322
  }
323
-
324
  $output .= '"></ins>' . "\n";
325
  $output .= '<script> ' . "\n";
326
- $output .= apply_filters( 'advanced-ads-gadsense-responsive-adsbygoogle', '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n");
327
  $output .= '</script>' . "\n";
328
  }
329
 
12
  * Class containing information about the adsense ad type
13
  *
14
  * see also includes/class-ad-type-abstract.php for basic object
 
15
  */
16
  class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
17
 
18
  /**
19
  * ID - internal type of the ad type
20
+ * ust be static so set your own ad type ID here
 
21
  * use slug like format, only lower case, underscores and hyphens
22
  *
23
  * @since 1.4
25
  public $ID = 'adsense';
26
 
27
  /**
28
+ * Set basic attributes
29
  *
30
  * @since 1.4
31
  */
32
  public function __construct() {
33
+ $this->title = __( 'AdSense ad', 'advanced-ads' );
34
  $this->description = __( 'Use ads from your Google AdSense account', 'advanced-ads' );
35
+ $this->parameters = array(
36
+ 'content' => '',
37
  );
38
  }
39
 
40
  /**
41
+ * Output for the ad parameters metabox
 
42
  * this will be loaded using ajax when changing the ad type radio buttons
43
  * echo the output right away here
44
  * name parameters must be in the "advanced_ads" array
45
  *
46
+ * @param object $ad ad object.
47
+ *
48
  * @since 1.4
49
  */
50
+ public function render_parameters( $ad ) {
51
+ {
52
+ // TODO: THIS IS JUST A QUICK AND DIRTY HACK. Create a dedicated method to handle this properly.
53
+ ?>
54
+ <script>
55
+ jQuery( function () {
56
+ <?php
57
+ $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
58
+ $json_ad_codes = json_encode( $mapi_options['ad_codes'] );
59
+ ?>
60
+ const adsense = new AdvancedAdsNetworkAdsense(<?php echo $json_ad_codes?>)
61
+ AdvancedAdsAdmin.AdImporter.setup( adsense )
62
+ } )
63
+ </script>
64
+ <?php
65
+ }
 
66
 
67
  $options = $ad->options();
68
 
69
+ $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
70
+ $unit_id = '';
71
+ $unit_pubid = '';
72
+ $unit_code = '';
73
+ $unit_type = 'responsive';
74
+ $unit_width = 0;
75
+ $unit_height = 0;
76
  $json_content = '';
77
+ $unit_resize = '';
78
  $extra_params = array(
79
+ 'default_width' => '',
80
  'default_height' => '',
81
+ 'at_media' => array(),
82
  );
83
 
84
+ $db = Advanced_Ads_AdSense_Data::get_instance();
85
  $pub_id = trim( $db->get_adsense_id( $ad ) );
86
 
87
  // check pub_id for errors
88
  $pub_id_errors = false;
89
+ if ( $pub_id !== '' && 0 !== strpos( $pub_id, 'pub-' ) ) {
90
  $pub_id_errors = __( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' );
91
  }
92
 
93
+ global $external_ad_unit_id, $use_dashicons, $closeable;
94
+ $closeable = true;
95
+ $use_dashicons = false;
96
+ $external_ad_unit_id = "";
97
+ if ( trim( $content ) !== '' ) {
98
 
99
  $json_content = stripslashes( $content );
100
 
101
  // get json content striped by slashes
102
  $content = json_decode( stripslashes( $content ) );
103
 
104
+ if ( isset( $content->unitType ) ) {
105
  $content->json = $json_content;
106
+ $unit_type = $content->unitType;
107
+ $unit_code = $content->slotId;
108
+ $unit_pubid = ! empty( $content->pubId ) ? $content->pubId : $pub_id;
109
+ $layout = isset( $content->layout ) ? $content->layout : '';
110
+ $layout_key = isset( $content->layout_key ) ? $content->layout_key : '';
111
+
112
  if ( 'responsive' != $content->unitType && 'link-responsive' != $content->unitType && 'matched-content' != $content->unitType ) {
113
  // Normal ad unit
114
+ $unit_width = $ad->width;
115
  $unit_height = $ad->height;
116
  } else {
117
  // Responsive && matched content
118
+ $unit_resize = ( isset( $content->resize ) ) ? $content->resize : 'auto';
119
  if ( 'auto' != $unit_resize ) {
120
  $extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
121
  }
127
  }
128
  }
129
 
130
+ if ( '' === trim( $pub_id ) && '' !== trim( $unit_code ) ) {
131
  $pub_id_errors = __( 'Your AdSense Publisher ID is missing.', 'advanced-ads' );
132
  }
133
 
146
  }
147
 
148
  /**
149
+ * Sanitize content field on save
150
  *
151
+ * @param string $content ad content.
152
+ *
153
+ * @return string $content sanitized ad content
154
  * @since 1.0.0
155
  */
156
+ public function sanitize_content( $content = '' ) {
157
+ $content = wp_unslash( $content );
158
+
159
+ return $content;
160
  }
161
 
162
  /**
163
  * Prepare the ads frontend output.
164
  *
165
  * @param object $ad ad object.
166
+ *
167
  * @return string $content ad content prepared for frontend output
168
  * @since 1.0.0
169
  */
171
  global $gadsense;
172
 
173
  $content = json_decode( stripslashes( $ad->content ) );
174
+
175
+ if ( isset( $ad->args['wp_the_query']['is_404'] )
176
+ && $ad->args['wp_the_query']['is_404']
177
+ && ! defined( 'ADVADS_ALLOW_ADSENSE_ON_404' ) ) {
178
+ return '';
179
  }
180
+
181
+ $output = '';
182
+ $db = Advanced_Ads_AdSense_Data::get_instance();
183
+ $pub_id = $db->get_adsense_id( $ad );
184
  $limit_per_page = $db->get_limit_per_page();
185
 
186
+ if ( ! isset( $content->unitType ) || empty( $pub_id ) ) {
187
+ return $output;
188
+ }
189
+ // deprecated since the adsbygoogle.js file is now always loaded.
190
+ if ( ! isset( $gadsense['google_loaded'] ) || ! $gadsense['google_loaded'] ) {
191
  $gadsense['google_loaded'] = true;
192
  }
193
 
194
+ // check if passive cb is used.
195
  if ( isset( $gadsense['adsense_count'] ) ) {
196
+ $gadsense['adsense_count'] ++;
197
  } else {
198
  $gadsense['adsense_count'] = 1;
199
  }
205
 
206
  $is_static_normal_content = ! in_array( $content->unitType, array( 'responsive', 'link-responsive', 'matched-content', 'in-article', 'in-feed' ) );
207
 
208
+ // show placeholder for AdSense ads in Customizer and Elementor.
209
+ if ( ( ! Advanced_Ads_Plugin::is_new_user( 1575892800 ) || Advanced_Ads_Plugin::show_to_new_users( 1575547200, 'a' ) )
210
+ && Advanced_Ads_Utils::is_iframe() ) {
211
  $attrs = array(
212
  'style' => array(
213
+ 'width' => ( $is_static_normal_content && $ad->width ) ? $ad->width . 'px' : '300px',
214
+ 'height' => ( $is_static_normal_content && $ad->height ) ? $ad->height . 'px' : '125px',
215
+ 'text-align' => 'center',
216
+ 'display' => 'flex',
217
+ 'align-items' => 'center',
218
  'justify-content' => 'center',
219
+ 'background' => '#cccccc',
220
+ 'color' => '#64655D',
221
+ ),
222
  );
223
 
224
  return '<div ' . Advanced_Ads_Utils::build_html_attributes( $attrs ) . '>'
225
+ // translators: we replace AdSense code with a dummy ad code in the Customizer and Elementor since AdSense could cause them to break. This is the text within that dummy ad.
226
+ . __( 'This will be an AdSense ad on your live site.', 'advanced-ads' )
227
+ . '</div>';
228
  }
229
 
230
  $output = apply_filters( 'advanced-ads-gadsense-output', false, $ad, $pub_id, $content );
231
+ if ( false !== $output ) {
232
  return $output;
233
  } elseif ( advads_is_amp() ) {
234
  // Prevent output on AMP pages.
237
 
238
  $output = '';
239
 
240
+ // build static normal content ads first.
241
  if ( $is_static_normal_content ) {
242
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
243
  $output .= '<ins class="adsbygoogle" ';
244
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
245
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
246
  $output .= 'data-ad-slot="' . $content->slotId . '"';
247
+ // ad type for static link unit.
248
+ if ( 'link' === $content->unitType ) {
249
+ $output .= "\n" . 'data-ad-format="link"';
250
  }
251
  $output .= '></ins> ' . "\n";
252
  $output .= '<script> ' . "\n";
257
  * The value of $ad->content->resize should be tested to format the output correctly
258
  */
259
  $unmodified = $output;
260
+ $output = apply_filters( 'advanced-ads-gadsense-responsive-output', $output, $ad, $pub_id );
261
+ if ( $unmodified === $output ) {
262
  /**
263
  * If the output has not been modified, perform a default responsive output.
264
  * A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
268
  // Remove float setting if this is a responsive ad unit without custom sizes.
269
  unset( $ad->wrapper['style']['float'] );
270
  }
 
271
  }
272
 
273
  return $output;
274
  }
275
 
276
+ /**
277
+ * Check if a string looks like an AdSense ad code.
278
+ *
279
+ * @param string $content The string that need to be checked.
280
+ *
281
+ * @return boolean
282
+ */
283
+ public static function content_is_adsense( $content = '' ) {
284
+ return false !== stripos( $content, 'googlesyndication.com' ) &&
285
+ ( false !== stripos( $content, 'google_ad_client' ) || false !== stripos( $content, 'data-ad-client' ) );
286
+ }
287
+
288
+ /**
289
+ * @param $output
290
+ * @param $pub_id
291
+ * @param $content
292
+ */
293
+ protected function append_defaut_responsive_content( &$output, $pub_id, $content ) {
294
  $format = '';
295
+ $style = 'display:block;';
296
+ switch ( $content->unitType ) {
297
+ case 'matched-content':
298
+ $format = 'autorelaxed';
299
+ break;
300
+ case 'link-responsive':
301
+ $format = 'link';
302
+ break;
303
+ case 'in-feed':
304
+ $format = 'fluid';
305
+ $layout_key = $content->layout_key;
306
+ break;
307
+ case 'in-article':
308
+ $format = 'fluid';
309
+ $layout = 'in-article';
310
+ $style = 'display:block; text-align:center;';
311
+ break;
312
+ default:
313
+ $format = 'auto';
314
  }
315
+
316
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
317
  $output .= '<ins class="adsbygoogle" ';
318
+ $output .= 'style="' . $style . '" ';
319
  $output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
320
  $output .= 'data-ad-slot="' . $content->slotId . '" ' . "\n";
321
  $output .= isset( $layout ) ? 'data-ad-layout="' . $layout . '"' . "\n" : '';
322
  $output .= isset( $layout_key ) ? 'data-ad-layout-key="' . $layout_key . '"' . "\n" : '';
323
  $output .= 'data-ad-format="';
324
  $output .= $format;
325
+
326
  $options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
327
+ $fw = ! empty( $options['fullwidth-ads'] ) ? $options['fullwidth-ads'] : 'default';
328
+ if ( 'default' !== $fw ) {
329
+ $output .= 'enable' === $fw ? '" data-full-width-responsive="true' : '" data-full-width-responsive="false';
330
  }
331
+
332
  $output .= '"></ins>' . "\n";
333
  $output .= '<script> ' . "\n";
334
+ $output .= apply_filters( 'advanced-ads-gadsense-responsive-adsbygoogle', '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n" );
335
  $output .= '</script>' . "\n";
336
  }
337
 
modules/gadsense/includes/class-network-adsense.php CHANGED
@@ -46,14 +46,17 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
46
  $section_id
47
  );
48
 
49
- // AdSense anchor ad on top of pages.
50
- add_settings_field(
51
- 'top_anchor_ad',
52
- __( 'Auto ads', 'advanced-ads' ) . ':&nbsp;' . __( 'Disable top anchor ad', 'advanced-ads' ),
53
- array( $this, 'render_settings_adsense_top_anchor_ad' ),
54
- $hook,
55
- $section_id
56
- );
 
 
 
57
 
58
  // hide AdSense stats in the backend
59
  add_settings_field(
@@ -376,4 +379,4 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
376
  {
377
  return true;
378
  }
379
- }
46
  $section_id
47
  );
48
 
49
+ // AdSense anchor ad on top of pages.
50
+ // Only show this field if selected, otherwise use new auto ads code.
51
+ if ( isset( $this->data->get_options()['top-anchor-ad'] ) ) {
52
+ add_settings_field(
53
+ 'top_anchor_ad',
54
+ __( 'Auto ads', 'advanced-ads' ) . ':&nbsp;' . __( 'Disable top anchor ad', 'advanced-ads' ),
55
+ array( $this, 'render_settings_adsense_top_anchor_ad' ),
56
+ $hook,
57
+ $section_id
58
+ );
59
+ }
60
 
61
  // hide AdSense stats in the backend
62
  add_settings_field(
379
  {
380
  return true;
381
  }
382
+ }
modules/gadsense/public/templates/page-level.php CHANGED
@@ -1,33 +1,67 @@
1
- <?php if ( ! $privacy_enabled ) :
2
- ?><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
3
- <script>(adsbygoogle = window.adsbygoogle || []).push({
4
- google_ad_client: "<?php echo $client_id; ?>",
5
- enable_page_level_ads: true<?php if ( isset( $options['top-anchor-ad'] ) && $options['top-anchor-ad'] ) : ?>,
6
- overlays: {bottom: true}
7
- <?php endif; ?>
8
- });
9
- </script>
10
- <?php else: ?>
11
- <script>
12
- // Wait until 'advads.privacy' is available.
13
- (window.advanced_ads_ready || jQuery(document).ready).call(null, function () {
14
- var npa_enabled = <?php echo $npa_enabled ? 1 : 0; ?>;
15
- if (npa_enabled
16
- || (advads.privacy && advads.privacy.get_state() !== 'unknown')
17
- ) {
18
- var script = document.createElement('script');
19
- script.async = 1;
20
- script.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
21
- var first = document.getElementsByTagName('script')[0];
22
- first.parentNode.insertBefore(script, first);
23
 
24
- (adsbygoogle = window.adsbygoogle || []).push({
25
- google_ad_client: "<?php echo $client_id; ?>",
26
- enable_page_level_ads: true<?php if ( isset( $options['top-anchor-ad'] ) && $options['top-anchor-ad'] ) : ?>,
27
- overlays: {bottom: true}
28
- <?php endif; ?>
29
- });
30
- }
31
- });
32
- </script>
33
- <?php endif ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Output auto ads enabled code in head
4
+ *
5
+ * @var bool $privacy_enabled
6
+ * @var bool $npa_enabled
7
+ * @var string $client_id
8
+ * @var array $options
9
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ $top_anchor = isset( $options['top-anchor-ad'] ) && $options['top-anchor-ad'];
12
+ $top_anchor_code = sprintf(
13
+ '(adsbygoogle = window.adsbygoogle || []).push({
14
+ google_ad_client: "%s",
15
+ enable_page_level_ads: true,
16
+ overlays: {bottom: true}
17
+ });',
18
+ esc_attr( $client_id )
19
+ );
20
+ $script_src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
21
+
22
+ if ( $privacy_enabled ) : ?>
23
+ <script>
24
+ // Wait until 'advads.privacy' is available.
25
+ (window.advanced_ads_ready || jQuery(document).ready).call(null, function () {
26
+ var npa_enabled = !!<?php echo $npa_enabled ? 1 : 0; ?>;
27
+ if (npa_enabled || (advads.privacy && advads.privacy.get_state() !== 'unknown')) {
28
+ var script = document.createElement('script'),
29
+ first = document.getElementsByTagName('script')[0];
30
+
31
+ script.async = true;
32
+ script.src = '<?php echo esc_url( $script_src ); ?>';
33
+ <?php
34
+ if ( $top_anchor ) :
35
+ // phpcs:disable WordPress.Security.EscapeOutput
36
+ echo $top_anchor_code;
37
+ // phpcs:enable
38
+ else :
39
+ ?>
40
+ script.dataset.adClient = '<?php echo esc_attr( $client_id ); ?>';
41
+ <?php endif; ?>
42
+ first.parentNode.insertBefore(script, first);
43
+ }
44
+ });
45
+ </script>
46
+ <?php
47
+ return;
48
+ endif;
49
+
50
+ // Privacy not enabled.
51
+ // phpcs:disable WordPress.WP.EnqueuedResources
52
+ if ( $top_anchor ) {
53
+ printf(
54
+ '<script async src="%s"></script><script>%s</script>',
55
+ esc_attr( $script_src ),
56
+ // phpcs:disable WordPress.Security.EscapeOutput
57
+ $top_anchor_code
58
+ // phpcs:enable WordPress.Security.EscapeOutput
59
+ );
60
+ } else {
61
+ printf(
62
+ '<script data-ad-client="%s" async src="%s"></script>',
63
+ esc_attr( $client_id ),
64
+ esc_url( $script_src )
65
+ );
66
+ }
67
+ // phpcs:enable
readme.txt CHANGED
@@ -1,11 +1,10 @@
1
  === Advanced Ads – Ad Manager & AdSense ===
2
  Contributors: webzunft, advancedads
3
- Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
4
  Tags: ads, ad manager, ad rotation, adsense, banner
5
  Requires at least: 4.6
6
  Tested up to: 5.3
7
  Requires PHP: 5.6
8
- Stable tag: 1.15
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -16,12 +15,12 @@ Manage and optimize your ads. All ad codes, Google AdSense Auto ads, ad widget,
16
  Are you looking for a simple ad manager plugin? These are the top arguments to use Advanced Ads:
17
 
18
  * approved in 10 years of Publishing and Ad Optimization
 
19
  * Google AdSense Partner
20
  * most features to test and optimize ads
21
  * unlimited ad units
22
  * ads.txt support
23
  * dedicated Gutenberg block for ads
24
- * works with all ad types and networks (e.g. Google AdSense, Google Ad Manager, or Amazon ads)
25
  * the only solution with *Ad Health* integration and Google AdSense violation checks
26
  * best rated [free support](https://wordpress.org/support/plugin/advanced-ads)
27
 
@@ -32,7 +31,7 @@ This is what our users are saying about Advanced Ads:
32
 
33
  Would you like to know if there is a certain feature, what the optimized setup would be, or how to implement your client’s demands? Just [open a thread in the forum](https://wordpress.org/support/plugin/advanced-ads#new-post)!
34
 
35
- Based on my experience as a publisher with millions of monthly served ads, I've developed this ad management plugin for WordPress when no other solution offered testing and optimization features. It allowed us to grow to 100 MM monthly ad impressions. Benefit from this knowledge about advertising and monetize your website today!
36
 
37
  [Full Feature List](https://wpadvancedads.com/features/).
38
 
@@ -131,6 +130,7 @@ Amazing features of the most powerful and easy Google AdSense plugin.
131
  * assistant for exact sizes of responsive Google AdSense code with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
132
  * convert Google AdSense ads into AMP ads automatically with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
133
  * ads.txt generated with the correct AdSense information automatically
 
134
 
135
  Like j4ckson185, there are thousands of happy AdSense users:
136
 
@@ -262,6 +262,7 @@ Yes. I would add a "Manual" placement into your theme files. It would allow you
262
  Yes. Advanced Ads can be combined with other ad plugins.
263
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
264
  Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, Quick AdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
 
265
 
266
  = Can I use Flash ads? =
267
 
@@ -303,6 +304,20 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
303
 
304
  == Changelog ==
305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  = 1.15 =
307
 
308
  * please enable the new content injection method under Advanced Ads > Settings > General > Content Injection > Use new injection logic
@@ -591,4 +606,4 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
591
  We have rewritten the content injection method. For the next weeks, new users opt in by default, existing ones need to opt in manually.
592
  As existing user, please enable the new content injection method under Advanced Ads > Settings > General > Content Injection > Use new injection logic.
593
 
594
- Please report any issues.
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.3
6
  Requires PHP: 5.6
7
+ Stable tag: 1.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
15
  Are you looking for a simple ad manager plugin? These are the top arguments to use Advanced Ads:
16
 
17
  * approved in 10 years of Publishing and Ad Optimization
18
+ * works with all ad types and networks, including Google AdSense, Google Ad Manager (DFP), Amazon ads, or media.net
19
  * Google AdSense Partner
20
  * most features to test and optimize ads
21
  * unlimited ad units
22
  * ads.txt support
23
  * dedicated Gutenberg block for ads
 
24
  * the only solution with *Ad Health* integration and Google AdSense violation checks
25
  * best rated [free support](https://wordpress.org/support/plugin/advanced-ads)
26
 
31
 
32
  Would you like to know if there is a certain feature, what the optimized setup would be, or how to implement your client’s demands? Just [open a thread in the forum](https://wordpress.org/support/plugin/advanced-ads#new-post)!
33
 
34
+ Advanced Ads allowed us to grow from 0 to 100 MM monthly ad impressions. Benefit from our experience as a publisher and monetize your website today!
35
 
36
  [Full Feature List](https://wpadvancedads.com/features/).
37
 
130
  * assistant for exact sizes of responsive Google AdSense code with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
131
  * convert Google AdSense ads into AMP ads automatically with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
132
  * ads.txt generated with the correct AdSense information automatically
133
+ * works along Google Site Kit or can replace if it you want to [control your ad placements](https://wpadvancedads.com/place-adsense-ad-unit-manually/)
134
 
135
  Like j4ckson185, there are thousands of happy AdSense users:
136
 
262
  Yes. Advanced Ads can be combined with other ad plugins.
263
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
264
  Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, Quick AdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
265
+ Advanced Ads can be used along Google Site Kit or replace it if you need more control over your ad setup.
266
 
267
  = Can I use Flash ads? =
268
 
304
 
305
  == Changelog ==
306
 
307
+ = 1.16 =
308
+
309
+ * moved all users to the new content injection logic and removed opt-out option
310
+ * use new Auto ads code for everyone who didn’t enable the "Disable top anchor ads" option
311
+ * hide "Disable top anchor ads" option to users who didn’t enable it
312
+ * the Ad Admin user role can now also save the plugin settings
313
+ * hide Wizard for existing ads
314
+ * removed warning about WP Autoterms plugin after a fix by the plugin authors
315
+ * some work for Conditions to improve compatibility with an upcoming Pro feature
316
+ * fixed multiple wrappers occurred as result of using nested ads
317
+ * fixed missing index issue on 404 pages for logged-in admins
318
+ * fixed AJAX/PHP error 403 on Settings page
319
+ * fixed layout issue that happened when "If>So Dynamic Content" plugin was active
320
+
321
  = 1.15 =
322
 
323
  * please enable the new content injection method under Advanced Ads > Settings > General > Content Injection > Use new injection logic
606
  We have rewritten the content injection method. For the next weeks, new users opt in by default, existing ones need to opt in manually.
607
  As existing user, please enable the new content injection method under Advanced Ads > Settings > General > Content Injection > Use new injection logic.
608
 
609
+ Please report any issues.