Advanced Ads - Version 1.13

Version Description

  • added support for 'ads.txt'
  • added option to disable Google Auto ads anchor ads at the top of the page
  • prevented attachment content from being shown next to Rich Content ads on attachment pages
  • allow to hide "Ads are disabled" warning
  • added AdSense connection errors to notifications
  • remove hidden notices if resolved
  • load notices box without JavaScript
  • stop content injection into wp_router pages when ads are disabled on secondary queries
  • introduced advanced-ads-max-ad-weight filter to allow manipulating the available ad weight
Download this release

Release Info

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

Code changes from version 1.12 to 1.13

admin/assets/js/admin.js CHANGED
@@ -636,6 +636,8 @@ jQuery( document ).ready(function ($) {
636
  if ( ad_content && ad_content.indexOf( 'enable_page_level_ads' ) !== -1 ) {
637
  advads_show_adsense_auto_ads_warning();
638
  }
 
 
639
  });
640
 
641
 
@@ -847,6 +849,39 @@ function advads_show_adsense_auto_ads_warning() {
847
  });
848
  }
849
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  // Change JQueryUI names to fix name collision with other libraries, eg. Bootstrap
851
  jQuery.fn.advads_button = jQuery.fn.button;
852
 
636
  if ( ad_content && ad_content.indexOf( 'enable_page_level_ads' ) !== -1 ) {
637
  advads_show_adsense_auto_ads_warning();
638
  }
639
+
640
+ advads_ads_txt_check_third_party();
641
  });
642
 
643
 
849
  });
850
  }
851
 
852
+ /**
853
+ * Check if a third-party ads.txt file exists.
854
+ */
855
+ function advads_ads_txt_check_third_party() {
856
+ jQuery( '#advads-ads-txt-check-tp button' ).click( function() {
857
+ var $wrapper = jQuery( this ).parent().hide();
858
+ var $spinner = jQuery( '<span class="spinner advads-spinner"></span>' ).insertAfter( $wrapper );
859
+
860
+ function result( exists, msg ) {
861
+ $wrapper.show().find( 'span' ).hide();
862
+ $spinner.remove();
863
+ if ( exists !== null ) {
864
+ $wrapper.find( '#advads-ads-txt-tpe').toggle( exists );
865
+ $wrapper.find( '#advads-ads-txt-tpne').toggle( ! exists );
866
+ } else {
867
+ $wrapper.find( '#advads-ads-txt-tp-error' ).show().html( msg );
868
+ }
869
+ }
870
+ jQuery.ajax( {
871
+ type: 'POST',
872
+ url: ajaxurl,
873
+ data: {
874
+ action: 'advads-ads-txt',
875
+ nonce: advadsglobal.ajax_nonce
876
+ },
877
+ } ).done(function( response ) {
878
+ result( '1' === response );
879
+ } ).fail(function( jqXHR, textStatus ) {
880
+ result( null, textStatus );
881
+ } );
882
+ } );
883
+ }
884
+
885
  // Change JQueryUI names to fix name collision with other libraries, eg. Bootstrap
886
  jQuery.fn.advads_button = jQuery.fn.button;
887
 
admin/includes/ad-health-notices.php CHANGED
@@ -15,169 +15,189 @@
15
  * - false (remove the item completely from list of notifications)
16
  */
17
  $advanced_ads_ad_health_notices = apply_filters( 'advanced-ads-ad-health-notices', array(
18
- // old PHP version
19
- // checked using Advanced_Ads_Checks::php_version_minimum().
20
- 'old_php' => array(
21
- 'text' => sprintf(
22
  // translators: %1$s is a version number.
23
- __( 'Your <strong>PHP version (%1$s) is too low</strong>. Advanced Ads is built for PHP %2$s and higher. It might work, but updating PHP is highly recommended. Please ask your hosting provider for more information.', 'advanced-ads' ),
24
- phpversion(),
25
- Advanced_Ads_Checks::MINIMUM_PHP_VERSION
26
- ),
27
- 'type' => 'problem',
28
- ),
29
- // cache enabled, but not Advanced Ads Pro
30
- // checked using Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ).
31
- 'cache_no_pro' => array(
32
- 'text' => sprintf(
33
  // translators: %s is a target URL.
34
- __( 'Your <strong>website uses cache</strong>. Some dynamic features like ad rotation or visitor conditions might not work properly. Use the cache-busting feature of <a href="%s" target="_blank">Advanced Ads Pro</a> to load ads dynamically.', 'advanced-ads' ),
35
- ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-cache'
36
- ),
37
- 'type' => 'problem',
38
- ),
39
- // updates for Advanced Ads plugins are available
40
- // checked using Advanced_Ads_Checks::plugin_updates_available().
41
- 'plugin_updates_available' => array(
42
- 'text' => __( 'There are <strong>plugin updates available</strong>. Please update.', 'advanced-ads' ),
43
- 'type' => 'problem',
44
- 'hide' => false,
45
- ),
46
- // Autoptimize found, but no Advanced Ads Pro
47
- // Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ).
48
- 'autoptimize_no_pro' => array(
49
- 'text' => sprintf(
50
  // translators: %s is a target URL.
51
- __( '<strong>Autoptimize plugin detected</strong>. While this plugin is great for site performance, it is known to alter code, including scripts from ad networks. <a href="%s" target="_blank">Advanced Ads Pro</a> has a build-in support for Autoptimize.', 'advanced-ads' ),
52
- ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-autoptimize'
53
- ),
54
- 'type' => 'problem',
55
- ),
56
- // conflicting plugins found
57
- // Advanced_Ads_Checks::conflicting_plugins().
58
- 'conflicting_plugins' => array(
59
- 'text' => sprintf(
60
  // translators: %1$s is a list of plugin names; %2$s a target URL.
61
- __( 'Plugins that are known to cause (partial) problems: <strong>%1$s</strong>. <a href="%2$s" target="_blank">Learn more</a>.', 'advanced-ads' ),
62
- implode( ', ', Advanced_Ads_Checks::conflicting_plugins() ),
63
- ADVADS_URL . 'manual/known-plugin-conflicts/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-plugin-conflicts'
64
- ),
65
- 'type' => 'problem',
66
- ),
67
- // PHP extensions missing
68
- // Advanced_Ads_Checks::php_extensions().
69
- 'php_extensions_missing' => array(
70
- 'text' => sprintf(
71
  // translators: %s is a list of PHP extensions.
72
- __( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ),
73
- implode( ", ", Advanced_Ads_Checks::php_extensions() )
74
- ),
75
- 'type' => 'problem',
76
- ),
77
- // ads are disabled
78
- // Advanced_Ads_Checks::ads_disabled().
79
- 'ads_disabled' => array(
80
- 'text' => sprintf(
81
  // translators: %s is a target URL.
82
- __( 'Ads are disabled for all or some pages. See "disabled ads" in <a href="%s">settings</a>.', 'advanced-ads' ),
83
- admin_url( 'admin.php?page=advanced-ads-settings#top#general' )
84
- ),
85
- 'type' => 'problem',
86
- 'can_hide' => false,
87
- ),
88
- // user is on wordpress.com
89
- // defined( 'IS_WPCOM' ).
90
- 'wp_com' => array(
91
- 'text' => __( 'This site is hosted on wordpress.com.', 'advanced-ads' ),
92
- 'type' => 'problem',
93
- ),
94
- // check if Advanced Ads related constants are enabled
95
- // Advanced_Ads_Checks::get_defined_constants().
96
- 'constants_enabled' => array(
97
- 'text' => '<a href="' . admin_url( 'admin.php?page=advanced-ads-settings#top#support' ) . '">' . esc_html__( 'Advanced Ads related constants enabled', 'advanced-ads' ) . '</a>',
98
- 'type' => 'notice',
99
- ),
100
- // possible JavaScript conflicts
101
- // Advanced_Ads_Checks::jquery_ui_conflict().
102
- 'jquery_ui_conflict' => array(
103
- 'text' => sprintf(
104
  // translators: %s is a target URL.
105
- __( 'Possible conflict between jQueryUI library, used by Advanced Ads and other libraries (probably <a href="%s">Twitter Bootstrap</a>). This might lead to misfortunate formats in forms, but should not damage features.', 'advanced-ads' ),
106
- 'http://getbootstrap.com/javascript/#js-noconflict'
107
- ),
108
- 'type' => 'problem',
109
- ),
110
- // adblocker assets expired
111
- // Advanced_Ads_Checks::assets_expired().
112
- 'assets_expired' => array(
113
- 'text' => sprintf(
114
  // translators: %s is a target URL.
115
- __( 'Some assets were changed. Please <strong>rebuild the asset folder</strong> in the <a href="%s">Advanced Ads settings</a> to update the ad blocker disguise.', 'advanced-ads' ),
116
- admin_url( 'admin.php?page=advanced-ads-settings' )
117
- ),
118
- 'type' => 'problem',
119
- 'hide' => true,
120
- ),
121
- // missing license codes
122
- // Advanced_Ads_Checks::license_invalid().
123
- 'license_invalid' => array(
124
- 'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' '
125
- . sprintf(
126
- // translators: %s is a target URL.
127
- __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ),
128
- get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' )
129
- ),
130
- 'type' => 'problem',
131
- 'can_hide' => false,
132
- ),
133
- // an individual ad expired.
134
- 'ad_expired' => array(
135
- 'text' => __( 'Ad expired', 'advanced-ads' ) . ': ',
136
- 'type' => 'notice',
137
- 'hide' => false,
138
- ),
139
- // an individual ad expired
140
- // is checked in the frontend by Ad Health in Advanced_Ads_Frontend_Checks::can_use_head_placement().
141
- 'ad_with_output_in_head' => array(
142
- // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
143
- 'text' => sprintf(
144
  // translators: %s is empty here, but the string will be followed by a name of an ad unit.
145
- __( 'Visible ads should not use the Header placement: %s', 'advanced-ads' ),
146
- ''
147
- ),
148
- 'type' => 'notice',
149
- 'hide' => false,
150
- ),
151
- // ad AdSense ad was hidden in the frontend using CSS
152
- // check in Ad Health in frontend.
153
- 'adsense_hidden' => array(
154
- // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
155
- 'text' => sprintf(
156
- '%s: %s.',
157
- __( 'AdSense violation', 'advanced-ads' ),
158
- __( 'Ad is hidden', 'advanced-ads' )
159
- ),
160
- 'type' => 'problem',
161
- 'hide' => false,
162
- ),
163
- // Ad has HTTP, but site uses HTTPS
164
- // check in Ad Health in frontend.
165
- 'ad_has_http' => array(
166
- 'text' => __( 'Your website is using HTTPS, but the ad code contains HTTP and might not work.', 'advanced-ads' ),
167
- 'type' => 'notice',
168
- 'hide' => false,
169
- ),
170
- // dummy text for general AdSense issue.
171
- 'adsense_issue' => array(
172
- // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
173
- 'text' => __( 'AdSense issue' ),
174
- 'type' => 'problem',
175
- ),
176
- // no ads created, yet.
177
- 'no_ads' => array(
178
- // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
179
- 'text' => '<a href="' . admin_url( 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) . '">' . __( 'Create your first ad', 'advanced-ads' ) . '</a>.',
180
- 'type' => 'notice',
181
- ),
182
- )
183
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  * - false (remove the item completely from list of notifications)
16
  */
17
  $advanced_ads_ad_health_notices = apply_filters( 'advanced-ads-ad-health-notices', array(
18
+ // old PHP version
19
+ // checked using Advanced_Ads_Checks::php_version_minimum().
20
+ 'old_php' => array(
21
+ 'text' => sprintf(
22
  // translators: %1$s is a version number.
23
+ __( 'Your <strong>PHP version (%1$s) is too low</strong>. Advanced Ads is built for PHP %2$s and higher. It might work, but updating PHP is highly recommended. Please ask your hosting provider for more information.', 'advanced-ads' ),
24
+ phpversion(),
25
+ Advanced_Ads_Checks::MINIMUM_PHP_VERSION
26
+ ),
27
+ 'type' => 'problem',
28
+ ),
29
+ // cache enabled, but not Advanced Ads Pro
30
+ // checked using Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ).
31
+ 'cache_no_pro' => array(
32
+ 'text' => sprintf(
33
  // translators: %s is a target URL.
34
+ __( 'Your <strong>website uses cache</strong>. Some dynamic features like ad rotation or visitor conditions might not work properly. Use the cache-busting feature of <a href="%s" target="_blank">Advanced Ads Pro</a> to load ads dynamically.', 'advanced-ads' ),
35
+ ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-cache'
36
+ ),
37
+ 'type' => 'problem',
38
+ ),
39
+ // updates for Advanced Ads plugins are available
40
+ // checked using Advanced_Ads_Checks::plugin_updates_available().
41
+ 'plugin_updates_available' => array(
42
+ 'text' => __( 'There are <strong>plugin updates available</strong>. Please update.', 'advanced-ads' ),
43
+ 'type' => 'problem',
44
+ 'hide' => false,
45
+ ),
46
+ // Autoptimize found, but no Advanced Ads Pro
47
+ // Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ).
48
+ 'autoptimize_no_pro' => array(
49
+ 'text' => sprintf(
50
  // translators: %s is a target URL.
51
+ __( '<strong>Autoptimize plugin detected</strong>. While this plugin is great for site performance, it is known to alter code, including scripts from ad networks. <a href="%s" target="_blank">Advanced Ads Pro</a> has a build-in support for Autoptimize.', 'advanced-ads' ),
52
+ ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-autoptimize'
53
+ ),
54
+ 'type' => 'problem',
55
+ ),
56
+ // conflicting plugins found
57
+ // Advanced_Ads_Checks::conflicting_plugins().
58
+ 'conflicting_plugins' => array(
59
+ 'text' => sprintf(
60
  // translators: %1$s is a list of plugin names; %2$s a target URL.
61
+ __( 'Plugins that are known to cause (partial) problems: <strong>%1$s</strong>. <a href="%2$s" target="_blank">Learn more</a>.', 'advanced-ads' ),
62
+ implode( ', ', Advanced_Ads_Checks::conflicting_plugins() ),
63
+ ADVADS_URL . 'manual/known-plugin-conflicts/#utm_source=advanced-ads&utm_medium=link&utm_campaign=error-plugin-conflicts'
64
+ ),
65
+ 'type' => 'problem',
66
+ ),
67
+ // PHP extensions missing
68
+ // Advanced_Ads_Checks::php_extensions().
69
+ 'php_extensions_missing' => array(
70
+ 'text' => sprintf(
71
  // translators: %s is a list of PHP extensions.
72
+ __( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ),
73
+ implode( ", ", Advanced_Ads_Checks::php_extensions() )
74
+ ),
75
+ 'type' => 'problem',
76
+ ),
77
+ // ads are disabled
78
+ // Advanced_Ads_Checks::ads_disabled().
79
+ 'ads_disabled' => array(
80
+ 'text' => sprintf(
81
  // translators: %s is a target URL.
82
+ __( 'Ads are disabled for all or some pages. See "disabled ads" in <a href="%s">settings</a>.', 'advanced-ads' ),
83
+ admin_url( 'admin.php?page=advanced-ads-settings#top#general' )
84
+ ),
85
+ 'type' => 'problem',
86
+ ),
87
+ // user is on wordpress.com
88
+ // defined( 'IS_WPCOM' ).
89
+ 'wp_com' => array(
90
+ 'text' => __( 'This site is hosted on wordpress.com.', 'advanced-ads' ),
91
+ 'type' => 'problem',
92
+ ),
93
+ // check if Advanced Ads related constants are enabled
94
+ // Advanced_Ads_Checks::get_defined_constants().
95
+ 'constants_enabled' => array(
96
+ 'text' => '<a href="' . admin_url( 'admin.php?page=advanced-ads-settings#top#support' ) . '">' . esc_html__( 'Advanced Ads related constants enabled', 'advanced-ads' ) . '</a>',
97
+ 'type' => 'notice',
98
+ ),
99
+ // possible JavaScript conflicts
100
+ // Advanced_Ads_Checks::jquery_ui_conflict().
101
+ 'jquery_ui_conflict' => array(
102
+ 'text' => sprintf(
 
103
  // translators: %s is a target URL.
104
+ __( 'Possible conflict between jQueryUI library, used by Advanced Ads and other libraries (probably <a href="%s">Twitter Bootstrap</a>). This might lead to misfortunate formats in forms, but should not damage features.', 'advanced-ads' ),
105
+ 'http://getbootstrap.com/javascript/#js-noconflict'
106
+ ),
107
+ 'type' => 'problem',
108
+ ),
109
+ // adblocker assets expired
110
+ // Advanced_Ads_Checks::assets_expired().
111
+ 'assets_expired' => array(
112
+ 'text' => sprintf(
113
  // translators: %s is a target URL.
114
+ __( 'Some assets were changed. Please <strong>rebuild the asset folder</strong> in the <a href="%s">Advanced Ads settings</a> to update the ad blocker disguise.', 'advanced-ads' ),
115
+ admin_url( 'admin.php?page=advanced-ads-settings' )
116
+ ),
117
+ 'type' => 'problem',
118
+ 'hide' => true,
119
+ ),
120
+ // missing license codes
121
+ // Advanced_Ads_Checks::license_invalid().
122
+ 'license_invalid' => array(
123
+ 'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' '
124
+ . sprintf(
125
+ // translators: %s is a target URL.
126
+ __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ),
127
+ get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' )
128
+ ),
129
+ 'type' => 'problem',
130
+ 'can_hide' => false,
131
+ ),
132
+ // an individual ad expired.
133
+ 'ad_expired' => array(
134
+ 'text' => __( 'Ad expired', 'advanced-ads' ) . ': ',
135
+ 'type' => 'notice',
136
+ 'hide' => false,
137
+ ),
138
+ // an individual ad expired
139
+ // is checked in the frontend by Ad Health in Advanced_Ads_Frontend_Checks::can_use_head_placement().
140
+ 'ad_with_output_in_head' => array(
141
+ // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
142
+ 'text' => sprintf(
143
  // translators: %s is empty here, but the string will be followed by a name of an ad unit.
144
+ __( 'Visible ads should not use the Header placement: %s', 'advanced-ads' ),
145
+ ''
146
+ ),
147
+ 'type' => 'notice',
148
+ 'hide' => false,
149
+ ),
150
+ // ad AdSense ad was hidden in the frontend using CSS
151
+ // check in Ad Health in frontend.
152
+ 'adsense_hidden' => array(
153
+ // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
154
+ 'text' => sprintf(
155
+ '%s: %s.',
156
+ __( 'AdSense violation', 'advanced-ads' ),
157
+ __( 'Ad is hidden', 'advanced-ads' )
158
+ ),
159
+ 'type' => 'problem',
160
+ 'hide' => false,
161
+ ),
162
+ // Ad has HTTP, but site uses HTTPS
163
+ // check in Ad Health in frontend.
164
+ 'ad_has_http' => array(
165
+ 'text' => __( 'Your website is using HTTPS, but the ad code contains HTTP and might not work.', 'advanced-ads' ),
166
+ 'type' => 'notice',
167
+ 'hide' => false,
168
+ ),
169
+ // dummy text for general AdSense issue.
170
+ 'adsense_issue' => array(
171
+ // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
172
+ 'text' => __( 'AdSense issue' ),
173
+ 'type' => 'problem',
174
+ ),
175
+ // no ads created, yet.
176
+ 'no_ads' => array(
177
+ // we keep the %s here and replace it with an empty string, because we use it somewhere else and don’t want to create a new string that is basically the same.
178
+ 'text' => '<a href="' . admin_url( 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) . '">' . __( 'Create your first ad', 'advanced-ads' ) . '</a>.',
179
+ 'type' => 'notice',
180
+ ),
181
+ // AdSense connection error: disapproved account.
182
+ 'adsense_connect_disapprovedAccount' => array(
183
+ 'text' => __( 'Last AdSense account connection attempt failed.', 'advanced-ads' ) .'&nbsp;' . __('Your account was not approved by AdSense.', 'advance-ads' ) . ' ' . Advanced_Ads_Ad_Health_Notices::get_adsense_error_link( 'disapprovedAccount' ),
184
+ 'type' => 'problem',
185
+ 'hide' => false,
186
+ ),
187
+ // AdSense connection error: no adsense account.
188
+ 'adsense_connect_noAdSenseAccount' => array(
189
+ 'text' => sprintf(
190
+ __( 'Last AdSense account connection attempt failed.', 'advanced-ads' ) .'&nbsp;' . __('Create a new AdSense account %1$shere%2$s.', 'advance-ads' ) . ' ' . Advanced_Ads_Ad_Health_Notices::get_adsense_error_link( 'noAdSenseAccount' ),
191
+ '<a href="https://www.google.com/adsense/start/?utm_source=AdvancedAdsPlugIn&utm_medium=partnerships&utm_campaign=AdvancedAdsPartner" target="_blank">',
192
+ '</a>'
193
+ ),
194
+ 'type' => 'problem',
195
+ 'hide' => false,
196
+ ),
197
+ // AdSense account alert.
198
+ 'adsense_alert_ALERT_TYPE_ADS_TXT_UNAUTHORIZED' => array(
199
+ 'text' => __( 'One of your sites is missing the AdSense publisher ID in the ads.txt file.', 'advanced-ads' ) . ' ' . Advanced_Ads_Ad_Health_Notices::get_adsense_error_link( 'ALERT_TYPE_ADS_TXT_UNAUTHORIZED' ),
200
+ 'type' => 'problem',
201
+ ),
202
+ )
203
+ );
admin/includes/class-notices.php CHANGED
@@ -170,11 +170,11 @@ class Advanced_Ads_Admin_Notices {
170
  $this->notices[] = 'nl_free_addons';
171
  }
172
  }
173
- // ask for a review after 5 days and when 3 ads were created and when not paused
174
  if ( ! in_array( 'review', $queue )
175
  && ! isset( $closed['review'] )
176
  && ( ! isset( $paused['review'] ) || $paused['review'] <= time() )
177
- && 432000 < ( time() - $activation)
178
  && 3 <= Advanced_Ads::get_number_of_ads()
179
  ) {
180
  $this->notices[] = 'review';
170
  $this->notices[] = 'nl_free_addons';
171
  }
172
  }
173
+ // ask for a review after 2 days and when 3 ads were created and when not paused
174
  if ( ! in_array( 'review', $queue )
175
  && ! isset( $closed['review'] )
176
  && ( ! isset( $paused['review'] ) || $paused['review'] <= time() )
177
+ && 172800 < ( time() - $activation)
178
  && 3 <= Advanced_Ads::get_number_of_ads()
179
  ) {
180
  $this->notices[] = 'review';
admin/includes/class-overview-widgets.php CHANGED
@@ -62,8 +62,10 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
62
  */
63
  public static function render_notices(){
64
 
65
- ?><span class="advads-loader"></span>
66
- <script>jQuery( document ).ready( function(){ advads_display_ad_health_notices(); });</script><?php
 
 
67
 
68
  }
69
 
62
  */
63
  public static function render_notices(){
64
 
65
+ /*?><span class="advads-loader"></span>
66
+ <script>jQuery( document ).ready( function(){ advads_display_ad_health_notices(); });</script><?php*/
67
+ Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget();
68
+ ?><script>jQuery( document ).ready( function(){ advads_ad_health_maybe_remove_list(); });</script><?php
69
 
70
  }
71
 
admin/includes/class-settings.php CHANGED
@@ -350,9 +350,12 @@ class Advanced_Ads_Admin_Settings {
350
  */
351
  public function render_settings_licenses_pitch_section_callback() {
352
 
353
- echo '<h3>' . __( 'Are you missing something?', 'advanced-ads' ) . '</h3>';
354
 
355
- Advanced_Ads_Overview_Widgets_Callbacks::render_addons( $hide_activated = true );
 
 
 
356
  }
357
 
358
  /**
350
  */
351
  public function render_settings_licenses_pitch_section_callback() {
352
 
353
+ echo '<h3>' . esc_attr__( 'Are you missing something?', 'advanced-ads' ) . '</h3>';
354
 
355
+ $link = ADVADS_URL . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses';
356
+ echo '<p><a href="' . esc_url( $link ) . '" target="_blank">' . esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ) . '</p>';
357
+
358
+ Advanced_Ads_Overview_Widgets_Callbacks::render_addons( true );
359
  }
360
 
361
  /**
admin/includes/notices.php CHANGED
@@ -3,66 +3,75 @@
3
  * array with admin notices
4
  */
5
  $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
6
- // email tutorial
7
- 'nl_intro' => array(
8
- 'type' => 'info',
9
- // 'text' => sprintf(__( 'Advanced Ads successfully installed. <a href="%s" class="button button-primary">Create your first ad</a>', 'advanced-ads' ), admin_url( 'post-new.php?post_type=advanced_ads' )),
10
- 'text' => Advanced_Ads_Admin_Notices::get_instance()->get_welcome_panel(),
11
- 'global' => true
12
- ),
13
- // email tutorial
14
- 'nl_first_steps' => array(
15
- 'type' => 'subscribe',
16
- 'text' => __( 'Thank you for activating <strong>Advanced Ads</strong>. Would you like to receive the first steps via email?', 'advanced-ads' ),
17
- 'confirm_text' => __( 'Yes, send it', 'advanced-ads' ),
18
- 'global' => true
19
- ),
20
- // free add-ons
21
- 'nl_free_addons' => array(
22
- 'type' => 'subscribe',
23
- 'text' => __( 'Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive <strong>2 free add-ons</strong> for joining the newsletter.', 'advanced-ads' ),
24
- 'confirm_text' => __( 'Add me now', 'advanced-ads' ),
25
- 'global' => true
26
- ),
27
- // adsense newsletter group
28
- 'nl_adsense' => array(
29
- 'type' => 'subscribe',
30
- 'text' => __( 'Learn more about how and <strong>how much you can earn with AdSense</strong> and Advanced Ads from my dedicated newsletter.', 'advanced-ads' ),
31
- 'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
32
- 'global' => true
33
- ),
34
- // missing license codes
35
- 'license_invalid' => array(
36
- 'type' => 'plugin_error',
37
- 'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' ' . sprintf( __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ), get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' ) ),
38
- ),
39
- // please review
40
- 'review' => array(
41
- 'type' => 'info',
42
- 'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
43
- . '<p>' . sprintf(__( 'You’ve successfully <strong>created %s ads using Advanced Ads</strong>.', 'advanced-ads' ), Advanced_Ads::get_number_of_ads() ) . '</p>'
44
- . '<p>' . __( 'Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review.', 'advanced-ads' ) . '</p>'
45
- . '<p><em>Thomas & Team</em></p>'
46
- . '<p>'
47
- . '<span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I’ll rate the plugin', 'advanced-ads' ) . '</a></strong>'
48
- . ' &nbsp;&nbsp;<span class="dashicons dashicons-smiley"></span>&nbsp;<a href="javascript:void(0)" target=_"blank" class="advads-notice-dismiss">' . __( 'I already did', 'advanced-ads' ) . '</a>'
49
- . ' &nbsp;&nbsp;<span class="dashicons dashicons-sos"></span>&nbsp;<a href="'. ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review" target=_"blank">' . __( 'I am not happy, please help', 'advanced-ads' ) . '</a>'
50
- . '<br/><br/><span class="dashicons dashicons-clock"></span>&nbsp;<a href="javascript:void(0)" target=_"blank" class="advads-notice-hide">' . __( 'Ask me later', 'advanced-ads' ) . '</a>'
51
- . '</p>',
52
- 'global' => false
53
- ),
54
- // Black Friday 2018 promotion
55
- 'bf2018' => array(
56
- 'type' => 'info',
57
- 'text' => sprintf( __('Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ), ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2018#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2018' ),
58
- 'global' => true
59
- ),
60
- // Black Friday 2018 #2 promotion
61
- 'bf2018_2' => array(
62
- 'type' => 'info',
63
- 'text' => sprintf( __('Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on your upgrade.<a class="button button-primary" target="_blank" href="%s">Upgrade now</a>', 'advanced-ads' ), ADVADS_URL . 'manual/upgrade-to-larger-package/?discount=BFCM2018#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2018-2' ),
64
- 'global' => true
65
- ),
 
 
 
 
 
 
 
 
 
66
 
67
- ));
68
 
3
  * array with admin notices
4
  */
5
  $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
6
+ // email tutorial
7
+ 'nl_intro' => array(
8
+ 'type' => 'info',
9
+ 'text' => Advanced_Ads_Admin_Notices::get_instance()->get_welcome_panel(),
10
+ 'global' => true,
11
+ ),
12
+ // email tutorial.
13
+ 'nl_first_steps' => array(
14
+ 'type' => 'subscribe',
15
+ 'text' => __( 'Thank you for activating <strong>Advanced Ads</strong>. Would you like to receive the first steps via email?', 'advanced-ads' ),
16
+ 'confirm_text' => __( 'Yes, send it', 'advanced-ads' ),
17
+ 'global' => true,
18
+ ),
19
+ // free add-ons.
20
+ 'nl_free_addons' => array(
21
+ 'type' => 'subscribe',
22
+ 'text' => __( 'Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive <strong>2 free add-ons</strong> for joining the newsletter.', 'advanced-ads' ),
23
+ 'confirm_text' => __( 'Add me now', 'advanced-ads' ),
24
+ 'global' => true,
25
+ ),
26
+ // adsense newsletter group.
27
+ 'nl_adsense' => array(
28
+ 'type' => 'subscribe',
29
+ 'text' => __( 'Learn more about how and <strong>how much you can earn with AdSense</strong> and Advanced Ads from my dedicated newsletter.', 'advanced-ads' ),
30
+ 'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
31
+ 'global' => true,
32
+ ),
33
+ // missing license codes.
34
+ 'license_invalid' => array(
35
+ 'type' => 'plugin_error',
36
+ 'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' ' . sprintf( __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ), get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' ) ),
37
+ ),
38
+ // please review.
39
+ 'review' => array(
40
+ 'type' => 'info',
41
+ //'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
42
+ 'text' => '<div style="float: left; font-size: 4em; line-height: 1em; margin-right: 0.5em;">' . Advanced_Ads::get_number_of_ads() . '</div>'
43
+ . '<div style="float:left;">'
44
+ . '<p>' . __( ' ads created using <strong>Advanced Ads</strong>.', 'advanced-ads' ) . '</p>'
45
+ . '<p>' . __( 'Do you find the plugin useful and would like to thank us for updates, fixing bugs and improving your ad setup?', 'advanced-ads' ) . '</p>'
46
+ . '<p>' .
47
+ // translators: this belongs to our message asking the user for a review. You can find a nice equivalent in your own language
48
+ __( 'When you give 5-stars, an actual person does a little happy dance!', 'advanced-ads' ) . '</p>'
49
+ . '<p>'
50
+ . '<span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I appreciate your work', 'advanced-ads' ) . '</a></strong>'
51
+ . ' &nbsp;&nbsp;<span class="dashicons dashicons-sos"></span>&nbsp;<a href="' . ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review" target=_"blank">' . __( 'Yes, but help me first to solve a problem, please', 'advanced-ads' ) . '</a>'
52
+ . '</p></div>',
53
+ 'global' => false,
54
+ ),
55
+ // Black Friday 2018 promotion.
56
+ 'bf2018' => array(
57
+ 'type' => 'info',
58
+ 'text' => sprintf(
59
+ // translators: %s is a link.
60
+ __( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ),
61
+ ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2018#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2018'
62
+ ),
63
+ 'global' => true,
64
+ ),
65
+ // Black Friday 2018 #2 promotion.
66
+ 'bf2018_2' => array(
67
+ 'type' => 'info',
68
+ 'text' => sprintf(
69
+ // translators: %s is a link.
70
+ __( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on your upgrade.<a class="button button-primary" target="_blank" href="%s">Upgrade now</a>', 'advanced-ads' ),
71
+ ADVADS_URL . 'manual/upgrade-to-larger-package/?discount=BFCM2018#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2018-2'
72
+ ),
73
+ 'global' => true,
74
+ ),
75
 
76
+ ) );
77
 
admin/views/feedback-disable.php CHANGED
@@ -22,15 +22,6 @@
22
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php esc_attr_e( 'Which one?', 'advanced-ads' ); ?>"/></li>
23
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php esc_attr_e( 'I stopped using ads on my site.', 'advanced-ads' ); ?></label></li>
24
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php esc_attr_e( 'I switched to another plugin', 'advanced-ads' ); ?></label></li>
25
- <li class="advanced-ads-feedback-review"><span class="advanced-ads-feedback-review-text"><?php _e( 'Faster than the AdSense support!', 'advanced-ads' ); ?></span>
26
- <span class="dashicons dashicons-star-filled"></span>
27
- <span class="dashicons dashicons-star-filled"></span>
28
- <span class="dashicons dashicons-star-filled"></span>
29
- <span class="dashicons dashicons-star-filled"></span>
30
- <span class="dashicons dashicons-star-filled"></span>
31
- <a href="<?php echo Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-support' ); ?>" target="_blank"><?php
32
- _e( 'reach out for help', 'advanced-ads' ); ?></a>
33
- </li>
34
  </ul>
35
  <?php if ( $from ) : ?>
36
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
22
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php esc_attr_e( 'Which one?', 'advanced-ads' ); ?>"/></li>
23
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php esc_attr_e( 'I stopped using ads on my site.', 'advanced-ads' ); ?></label></li>
24
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php esc_attr_e( 'I switched to another plugin', 'advanced-ads' ); ?></label></li>
 
 
 
 
 
 
 
 
 
25
  </ul>
26
  <?php if ( $from ) : ?>
27
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
admin/views/overview-notices.php CHANGED
@@ -1,30 +1,23 @@
1
- <?php if ( Advanced_Ads_Ad_Health_Notices::get_instance()->has_notices_by_type( 'problem' ) ) :
2
-
3
- ?><h3><?php esc_attr_e( 'Problems', 'advanceda-ads' ); ?></h3>
4
- <?php
5
- Advanced_Ads_Ad_Health_Notices::get_instance()->display_problems();
6
-
7
- endif;
8
- if ( Advanced_Ads_Ad_Health_Notices::get_instance()->has_notices_by_type( 'notice' ) ) :
9
 
10
- ?><h3><?php
11
  esc_attr_e( 'Notifications', 'advanceda-ads' );
12
  ?>
13
- </h3>
14
- <?php
15
-
16
- Advanced_Ads_Ad_Health_Notices::get_instance()->display_notices();
17
 
18
- endif;
19
- $ignored_count = count( Advanced_Ads_Ad_Health_Notices::get_instance()->ignore );
20
  ?>
21
- <p class="adsvads-ad-health-notices-show-hidden" <?php echo ! $ignored_count ? 'style="display: none;"' : ''; ?>><?php
22
- printf(
23
  // translators: %s includes a number and markup like <span class="count">6</span>.
24
- __( 'Show %s hidden', 'advanced-ads' ), '<span class="count">' . $ignored_count . '</span>' );
25
- ?>&nbsp;
26
- <button type="button"><span class="dashicons dashicons-visibility"></span></button>
27
- </p>
28
  <?php
29
 
30
  if ( Advanced_Ads_Ad_Health_Notices::has_visible_problems() ) {
1
+ <h3<?php echo ! $has_problems ? ' style="display:none;"' : ''; ?>><?php
2
+ esc_attr_e( 'Problems', 'advanceda-ads' ); ?></h3>
3
+ <?php
4
+ Advanced_Ads_Ad_Health_Notices::get_instance()->display_problems();
 
 
 
 
5
 
6
+ ?><h3<?php echo ! $has_notices ? ' style="display:none;"' : ''; ?>><?php
7
  esc_attr_e( 'Notifications', 'advanceda-ads' );
8
  ?>
9
+ </h3>
10
+ <?php
11
+ Advanced_Ads_Ad_Health_Notices::get_instance()->display_notices();
 
12
 
 
 
13
  ?>
14
+ <p class="adsvads-ad-health-notices-show-hidden" <?php echo ! $ignored_count ? 'style="display: none;"' : ''; ?>><?php
15
+ printf(
16
  // translators: %s includes a number and markup like <span class="count">6</span>.
17
+ __( 'Show %s hidden', 'advanced-ads' ), '<span class="count">' . $ignored_count . '</span>' );
18
+ ?>&nbsp;
19
+ <button type="button"><span class="dashicons dashicons-visibility"></span></button>
20
+ </p>
21
  <?php
22
 
23
  if ( Advanced_Ads_Ad_Health_Notices::has_visible_problems() ) {
advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.12
16
  * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.12' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.13
16
  * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.13' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad-health-notices.php CHANGED
@@ -89,15 +89,23 @@ class Advanced_Ads_Ad_Health_Notices {
89
  * Advanced_Ads_Ad_Health_Notices constructor.
90
  */
91
  public function __construct() {
92
- // load default notices.
93
- include ADVADS_BASE_PATH . '/admin/includes/ad-health-notices.php';
94
- $this->default_notices = $advanced_ads_ad_health_notices;
 
 
95
 
96
  // stop here if notices are disabled.
97
  if ( ! self::notices_enabled() ) {
98
  return;
99
  }
100
 
 
 
 
 
 
 
101
  // fills the class arrays.
102
  $this->load_notices();
103
 
@@ -149,7 +157,7 @@ class Advanced_Ads_Ad_Health_Notices {
149
  $this->notices = isset( $options['notices'] ) ? $options['notices'] : array();
150
 
151
  // load hidden notices.
152
- $this->ignore = isset( $options['ignore'] ) ? $options['ignore'] : array();
153
 
154
  // get displayed notices
155
  // get keys of notices.
@@ -322,7 +330,7 @@ class Advanced_Ads_Ad_Health_Notices {
322
  * Updating an existing notice or add it, if it doesn’t exist, yet
323
  *
324
  * @param string $notice_key notice key to be added to the notice array.
325
- * @param array $atts additional attributes.
326
  *
327
  * attributes:
328
  * - append_text – text added to the default message
@@ -477,6 +485,10 @@ class Advanced_Ads_Ad_Health_Notices {
477
  */
478
  public function render_widget() {
479
 
 
 
 
 
480
  // only render, if there are notices.
481
  if ( $this->has_notices() ) {
482
  include ADVADS_BASE_PATH . 'admin/views/overview-notices.php';
@@ -490,25 +502,26 @@ class Advanced_Ads_Ad_Health_Notices {
490
  *
491
  */
492
  public function display( $type = 'problem' ) {
493
-
494
  // iterate through notices.
495
- ?><ul class="advads-ad-health-notices advads-ad-health-notices-<?php echo $type; ?>"><?php
496
-
 
497
  // failsafe in case this is not an array.
498
- if( !is_array( $this->notices ) ){
499
  return;
500
- }
501
 
502
  foreach ( $this->notices as $_notice_key => $_notice ) {
503
 
504
  $notice_array = $this->get_notice_array_for_key( $_notice_key );
505
  $notice_type = isset( $notice_array['type'] ) ? $notice_array['type'] : 'problem';
506
-
507
- // skip if type is not correct
508
- if( $notice_type !== $type ) {
509
  continue;
510
  }
511
-
512
  if ( ! empty( $_notice['text'] ) ) {
513
  $text = $_notice['text'];
514
  } elseif ( isset( $notice_array['text'] ) ) {
@@ -516,32 +529,32 @@ class Advanced_Ads_Ad_Health_Notices {
516
  } else {
517
  continue;
518
  }
519
-
520
- // attach "append_text"
521
- if ( !empty( $_notice[ 'append_text' ] ) ) {
522
- $text .= $_notice[ 'append_text' ];
523
  }
524
-
525
- $can_hide = ( ! isset( $notice_array['can_hide'] ) || true === $notice_array['can_hide'] ) ? true : false;
526
- $hide = ( ! isset( $notice_array['hide'] ) || true === $notice_array['hide'] ) ? true : false;
527
- $is_hidden = in_array( $_notice_key, $this->ignore ) ? true : false;
528
- $date = isset( $_notice[ 'time' ] ) ? date_i18n( get_option( 'date_format' ), $_notice[ 'time' ] ) : false;
529
-
530
  include ADVADS_BASE_PATH . '/admin/views/overview-notice-row.php';
531
  }
532
-
533
  ?></ul><?php
534
  }
535
 
536
  /**
537
- * display problems
538
  */
539
  public function display_problems() {
540
  $this->display( 'problem' );
541
  }
542
 
543
  /**
544
- * display problems
545
  */
546
  public function display_notices() {
547
  $this->display( 'notice' );
@@ -566,10 +579,10 @@ class Advanced_Ads_Ad_Health_Notices {
566
  /**
567
  * Update notice options
568
  *
569
- * @param array $options new options
570
  */
571
  public function update_options( array $options ) {
572
- // do not allow to clear options
573
  if ( $options === array() ) {
574
  return;
575
  }
@@ -590,6 +603,33 @@ class Advanced_Ads_Ad_Health_Notices {
590
  return count( $displayed_notices );
591
  }
592
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  /**
594
  * Check if there are visible problems (notices of type "problem")
595
  *
@@ -605,21 +645,22 @@ class Advanced_Ads_Ad_Health_Notices {
605
  }
606
 
607
  /**
608
- * Get notices by type – hidden and displayed
609
  *
610
- * @param string $type type of the notice
611
- * @return array
 
612
  */
613
- public function get_notices_by_type( $type = 'problem' ) {
614
-
615
- // get all notices with a given type and which are ignored
616
 
 
617
  $notices_by_type = array();
618
 
619
  foreach ( $this->notices as $_key => $_notice ) {
620
  $notice_array = $this->get_notice_array_for_key( $_key );
621
 
622
- if ( isset( $notice_array['type'] ) && $type === $notice_array['type'] ) {
 
623
  $notices_by_type[ $_key ] = $_notice;
624
  }
625
  }
@@ -634,21 +675,22 @@ class Advanced_Ads_Ad_Health_Notices {
634
  */
635
  public function has_notices() {
636
 
637
- // get all notices
638
  return isset( $this->notices ) && is_array( $this->notices ) && count( $this->notices );
639
 
640
  }
641
 
642
  /**
643
- * Check if there are notices for a given type
 
 
644
  *
645
- * @param string $type type of the notice
646
- * @return integer
647
  */
648
  public function has_notices_by_type( $type = 'problem' ) {
649
 
650
- // get all notices with a given type
651
- $notices = $this->get_notices_by_type( $type );
652
 
653
  if ( ! is_array( $notices ) ) {
654
  return 0;
@@ -661,13 +703,13 @@ class Advanced_Ads_Ad_Health_Notices {
661
  * Get the notice array for a notice key
662
  * useful, if a notice key was manipulated
663
  *
664
- * @param string notice_key key of the notice
665
  *
666
  * @return array type
667
  */
668
  public function get_notice_array_for_key( $notice_key ) {
669
 
670
- // check if there is an original key
671
  $orig_key = isset( $this->notices[ $notice_key ]['orig_key'] ) ? $this->notices[ $notice_key ]['orig_key'] : $notice_key;
672
 
673
  return isset( $this->default_notices[ $orig_key ] ) ? $this->default_notices[ $orig_key ] : array();
@@ -676,13 +718,41 @@ class Advanced_Ads_Ad_Health_Notices {
676
  /**
677
  * Add notification when an ad expires based on the expiry date
678
  *
679
- * @param integer $ad_id ID of the ad
680
- * @param object $ad ad object
681
  */
682
  public function ad_expired( $ad_id, $ad ) {
683
  $id = ! empty( $ad_id ) ? absint( $ad_id ) : 0;
684
  $this->update( 'ad_expired', array( 'append_key' => $id, 'ad_id' => $id ) );
685
  }
686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
 
688
  }
89
  * Advanced_Ads_Ad_Health_Notices constructor.
90
  */
91
  public function __construct() {
92
+
93
+ // failsafe for there were some reports of 502 errors.
94
+ if ( 1 < did_action( 'plugins_loaded' ) ) {
95
+ return;
96
+ }
97
 
98
  // stop here if notices are disabled.
99
  if ( ! self::notices_enabled() ) {
100
  return;
101
  }
102
 
103
+ // load default notices.
104
+ if ( array() === $this->default_notices ) {
105
+ include ADVADS_BASE_PATH . '/admin/includes/ad-health-notices.php';
106
+ $this->default_notices = $advanced_ads_ad_health_notices;
107
+ }
108
+
109
  // fills the class arrays.
110
  $this->load_notices();
111
 
157
  $this->notices = isset( $options['notices'] ) ? $options['notices'] : array();
158
 
159
  // load hidden notices.
160
+ $this->ignore = $this->get_valid_ignored();
161
 
162
  // get displayed notices
163
  // get keys of notices.
330
  * Updating an existing notice or add it, if it doesn’t exist, yet
331
  *
332
  * @param string $notice_key notice key to be added to the notice array.
333
+ * @param array $atts additional attributes.
334
  *
335
  * attributes:
336
  * - append_text – text added to the default message
485
  */
486
  public function render_widget() {
487
 
488
+ $ignored_count = count( $this->ignore );
489
+ $has_problems = $this->has_notices_by_type( 'problem' );
490
+ $has_notices = $this->has_notices_by_type( 'notice' );
491
+
492
  // only render, if there are notices.
493
  if ( $this->has_notices() ) {
494
  include ADVADS_BASE_PATH . 'admin/views/overview-notices.php';
502
  *
503
  */
504
  public function display( $type = 'problem' ) {
505
+
506
  // iterate through notices.
507
+ ?>
508
+ <ul class="advads-ad-health-notices advads-ad-health-notices-<?php echo $type; ?>"><?php
509
+
510
  // failsafe in case this is not an array.
511
+ if ( ! is_array( $this->notices ) ) {
512
  return;
513
+ }
514
 
515
  foreach ( $this->notices as $_notice_key => $_notice ) {
516
 
517
  $notice_array = $this->get_notice_array_for_key( $_notice_key );
518
  $notice_type = isset( $notice_array['type'] ) ? $notice_array['type'] : 'problem';
519
+
520
+ // skip if type is not correct.
521
+ if ( $notice_type !== $type ) {
522
  continue;
523
  }
524
+
525
  if ( ! empty( $_notice['text'] ) ) {
526
  $text = $_notice['text'];
527
  } elseif ( isset( $notice_array['text'] ) ) {
529
  } else {
530
  continue;
531
  }
532
+
533
+ // attach "append_text".
534
+ if ( ! empty( $_notice['append_text'] ) ) {
535
+ $text .= $_notice['append_text'];
536
  }
537
+
538
+ $can_hide = ( ! isset( $notice_array['can_hide'] ) || true === $notice_array['can_hide'] ) ? true : false;
539
+ $hide = ( ! isset( $notice_array['hide'] ) || true === $notice_array['hide'] ) ? true : false;
540
+ $is_hidden = in_array( $_notice_key, $this->ignore, true ) ? true : false;
541
+ $date = isset( $_notice['time'] ) ? date_i18n( get_option( 'date_format' ), $_notice['time'] ) : false;
542
+
543
  include ADVADS_BASE_PATH . '/admin/views/overview-notice-row.php';
544
  }
545
+
546
  ?></ul><?php
547
  }
548
 
549
  /**
550
+ * Display problems.
551
  */
552
  public function display_problems() {
553
  $this->display( 'problem' );
554
  }
555
 
556
  /**
557
+ * Display notices.
558
  */
559
  public function display_notices() {
560
  $this->display( 'notice' );
579
  /**
580
  * Update notice options
581
  *
582
+ * @param array $options new options.
583
  */
584
  public function update_options( array $options ) {
585
+ // do not allow to clear options.
586
  if ( $options === array() ) {
587
  return;
588
  }
603
  return count( $displayed_notices );
604
  }
605
 
606
+ /**
607
+ * Get ignored messages that are also in the notices
608
+ * also updates ignored array, if needed
609
+ */
610
+ public function get_valid_ignored() {
611
+
612
+ $options = $this->options();
613
+ $options_before = $options;
614
+
615
+ $ignore_before = isset( $options['ignore'] ) ? $options['ignore'] : array();
616
+
617
+ // get keys from notices.
618
+ $notice_keys = array_keys( $this->notices );
619
+
620
+ // get the errors that are in ignore AND notices and reset the keys.
621
+ $ignore = array_values( array_intersect( $ignore_before, $notice_keys ) );
622
+ $options['ignore'] = $ignore;
623
+
624
+ // only update if changed.
625
+ if ( $options_before !== $options ) {
626
+ $this->update_options( $options );
627
+ }
628
+
629
+ return $ignore;
630
+ }
631
+
632
+
633
  /**
634
  * Check if there are visible problems (notices of type "problem")
635
  *
645
  }
646
 
647
  /**
648
+ * Get visible notices by type – hidden and displayed
649
  *
650
+ * @param string $type type of the notice.
651
+ *
652
+ * @return array
653
  */
654
+ public function get_visible_notices_by_type( $type = 'problem' ) {
 
 
655
 
656
+ // get all notices with a given type.
657
  $notices_by_type = array();
658
 
659
  foreach ( $this->notices as $_key => $_notice ) {
660
  $notice_array = $this->get_notice_array_for_key( $_key );
661
 
662
+ if ( isset( $notice_array['type'] ) && $type === $notice_array['type']
663
+ && ( ! isset( $this->ignore ) || false === array_search( $_key, $this->ignore, true ) ) ) {
664
  $notices_by_type[ $_key ] = $_notice;
665
  }
666
  }
675
  */
676
  public function has_notices() {
677
 
678
+ // get all notices.
679
  return isset( $this->notices ) && is_array( $this->notices ) && count( $this->notices );
680
 
681
  }
682
 
683
  /**
684
+ * Check if there are visible notices for a given type
685
+ *
686
+ * @param string $type type of the notice.
687
  *
688
+ * @return integer
 
689
  */
690
  public function has_notices_by_type( $type = 'problem' ) {
691
 
692
+ // get all notices with a given type.
693
+ $notices = $this->get_visible_notices_by_type( $type );
694
 
695
  if ( ! is_array( $notices ) ) {
696
  return 0;
703
  * Get the notice array for a notice key
704
  * useful, if a notice key was manipulated
705
  *
706
+ * @param string $notice_key key of the notice.
707
  *
708
  * @return array type
709
  */
710
  public function get_notice_array_for_key( $notice_key ) {
711
 
712
+ // check if there is an original key.
713
  $orig_key = isset( $this->notices[ $notice_key ]['orig_key'] ) ? $this->notices[ $notice_key ]['orig_key'] : $notice_key;
714
 
715
  return isset( $this->default_notices[ $orig_key ] ) ? $this->default_notices[ $orig_key ] : array();
718
  /**
719
  * Add notification when an ad expires based on the expiry date
720
  *
721
+ * @param integer $ad_id ID of the ad.
722
+ * @param object $ad ad object.
723
  */
724
  public function ad_expired( $ad_id, $ad ) {
725
  $id = ! empty( $ad_id ) ? absint( $ad_id ) : 0;
726
  $this->update( 'ad_expired', array( 'append_key' => $id, 'ad_id' => $id ) );
727
  }
728
 
729
+ /**
730
+ * Get AdSense error link
731
+ * this is a copy of Advanced_Ads_AdSense_MAPI::get_adsense_error_link() which might not be available all the time
732
+ *
733
+ * @param string $code error code
734
+ *
735
+ * @return string link
736
+ */
737
+ public static function get_adsense_error_link( $code ) {
738
+ if ( ! empty( $code ) ) {
739
+ $code = '-' . $code;
740
+ }
741
+
742
+ if ( class_exists( 'Advanced_Ads_AdSense_MAPI', false ) ) {
743
+ return Advanced_Ads_AdSense_MAPI::get_adsense_error_link( 'disapprovedAccount' );
744
+ }
745
+
746
+ // is a copy of Advanced_Ads_AdSense_MAPI::get_adsense_error_link().
747
+ $link = sprintf(
748
+ // translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
749
+ esc_attr__( 'Learn more about AdSense account issues %1$shere%2$s.', 'advanced-ads' ),
750
+ '<a href="' . ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error' . $code . '" target="_blank">',
751
+ '</a>'
752
+ );
753
+
754
+ return $link;
755
+ }
756
+
757
 
758
  }
classes/ad_group.php CHANGED
@@ -633,13 +633,19 @@ class Advanced_Ads_Group {
633
  *
634
  * @param int $num_ads number of ads in the group
635
  * @since 1.8.22
 
 
636
  */
637
  public static function get_max_ad_weight( $num_ads = 1 ){
638
 
639
- // use default if lower than default
640
  $num_ads = absint( $num_ads );
641
-
642
- return $num_ads < self::MAX_AD_GROUP_DEFAULT_WEIGHT ? self::MAX_AD_GROUP_DEFAULT_WEIGHT : $num_ads;
 
 
 
 
643
  }
644
 
645
 
633
  *
634
  * @param int $num_ads number of ads in the group
635
  * @since 1.8.22
636
+ *
637
+ * @return max weight used in group settings
638
  */
639
  public static function get_max_ad_weight( $num_ads = 1 ){
640
 
641
+ // use default if lower than default.
642
  $num_ads = absint( $num_ads );
643
+
644
+ // use number of ads or max ad weight value, whatever is higher
645
+ $max_weight = $num_ads < self::MAX_AD_GROUP_DEFAULT_WEIGHT ? self::MAX_AD_GROUP_DEFAULT_WEIGHT : $num_ads;
646
+
647
+ // allow users to manipulate max ad weight
648
+ return apply_filters( 'advanced-ads-max-ad-weight', $max_weight, $num_ads );
649
  }
650
 
651
 
classes/ad_type_content.php CHANGED
@@ -127,7 +127,6 @@ class Advanced_Ads_Ad_Type_Content extends Advanced_Ads_Ad_Type_Abstract{
127
  $output = wpautop( $output );
128
  $output = shortcode_unautop( $output );
129
  $output = $this->do_shortcode( $output, $ad );
130
- $output = prepend_attachment( $output );
131
  // make included images responsive, since WordPress 4.4
132
  if( ! defined( 'ADVADS_DISABLE_RESPONSIVE_IMAGES' ) && function_exists( 'wp_make_content_images_responsive' ) ){
133
  $output = wp_make_content_images_responsive( $output );
127
  $output = wpautop( $output );
128
  $output = shortcode_unautop( $output );
129
  $output = $this->do_shortcode( $output, $ad );
 
130
  // make included images responsive, since WordPress 4.4
131
  if( ! defined( 'ADVADS_DISABLE_RESPONSIVE_IMAGES' ) && function_exists( 'wp_make_content_images_responsive' ) ){
132
  $output = wp_make_content_images_responsive( $output );
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-02-22 12:17+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"
@@ -46,7 +46,6 @@ msgstr ""
46
 
47
  #: admin/class-advanced-ads-admin.php:401 admin/includes/class-menu.php:113
48
  #: admin/includes/class-menu.php:116 admin/views/settings.php:28
49
- #: modules/gadsense/admin/admin.php:198
50
  msgid "Support"
51
  msgstr ""
52
 
@@ -56,7 +55,7 @@ msgid "Add-Ons"
56
  msgstr ""
57
 
58
  #: admin/class-advanced-ads-admin.php:671
59
- #: admin/includes/class-overview-widgets.php:154
60
  #, php-format
61
  msgid ""
62
  "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
@@ -96,11 +95,11 @@ msgid "main query"
96
  msgstr ""
97
 
98
  #: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
99
- #: public/class-advanced-ads.php:707 admin/views/ad-group-list-ads.php:13
100
  msgid "Ad"
101
  msgstr ""
102
 
103
- #: classes/ad-debug.php:121 public/class-advanced-ads.php:670
104
  msgctxt "ad group singular name"
105
  msgid "Ad Group"
106
  msgstr ""
@@ -118,12 +117,19 @@ msgid "Visitor Conditions"
118
  msgstr ""
119
 
120
  #: classes/ad-debug.php:272 classes/frontend_checks.php:235
121
- #: admin/includes/ad-health-notices.php:166
122
  msgid ""
123
  "Your website is using HTTPS, but the ad code contains HTTP and might not "
124
  "work."
125
  msgstr ""
126
 
 
 
 
 
 
 
 
127
  #: classes/ad_placements.php:31
128
  msgid "Manual Placement"
129
  msgstr ""
@@ -522,7 +528,7 @@ msgstr ""
522
  msgid "Random AdSense ads"
523
  msgstr ""
524
 
525
- #: classes/frontend_checks.php:105 admin/includes/class-settings.php:503
526
  msgid "You look like a bot"
527
  msgstr ""
528
 
@@ -564,16 +570,16 @@ msgstr ""
564
  msgid "Ad IDs: %s"
565
  msgstr ""
566
 
567
- #: classes/frontend_checks.php:248 admin/includes/ad-health-notices.php:145
568
  #, php-format
569
  msgid "Visible ads should not use the Header placement: %s"
570
  msgstr ""
571
 
572
- #: classes/frontend_checks.php:262 admin/includes/ad-health-notices.php:157
573
  msgid "AdSense violation"
574
  msgstr ""
575
 
576
- #: classes/frontend_checks.php:263 admin/includes/ad-health-notices.php:158
577
  msgid "Ad is hidden"
578
  msgstr ""
579
 
@@ -707,7 +713,7 @@ msgstr ""
707
  msgid "Ad Groups"
708
  msgstr ""
709
 
710
- #: classes/widget.php:93 public/class-advanced-ads.php:706
711
  #: admin/includes/class-menu.php:68 admin/includes/class-menu.php:68
712
  #: admin/includes/class-shortcode-creator.php:84
713
  #: admin/views/ad-group-list-form-row.php:90
@@ -753,61 +759,61 @@ msgstr ""
753
  msgid "Advanced Ads Error: %s"
754
  msgstr ""
755
 
756
- #: public/class-advanced-ads.php:669
757
  msgctxt "ad group general name"
758
  msgid "Ad Groups & Rotations"
759
  msgstr ""
760
 
761
- #: public/class-advanced-ads.php:671
762
  msgid "Search Ad Groups"
763
  msgstr ""
764
 
765
- #: public/class-advanced-ads.php:672
766
  msgid "All Ad Groups"
767
  msgstr ""
768
 
769
- #: public/class-advanced-ads.php:673
770
  msgid "Parent Ad Groups"
771
  msgstr ""
772
 
773
- #: public/class-advanced-ads.php:674
774
  msgid "Parent Ad Groups:"
775
  msgstr ""
776
 
777
- #: public/class-advanced-ads.php:675
778
  msgid "Edit Ad Group"
779
  msgstr ""
780
 
781
- #: public/class-advanced-ads.php:676
782
  msgid "Update Ad Group"
783
  msgstr ""
784
 
785
- #: public/class-advanced-ads.php:677
786
  msgid "Add New Ad Group"
787
  msgstr ""
788
 
789
- #: public/class-advanced-ads.php:678
790
  msgid "New Ad Groups Name"
791
  msgstr ""
792
 
793
- #: public/class-advanced-ads.php:679 modules/import-export/views/page.php:24
794
  msgid "Groups"
795
  msgstr ""
796
 
797
- #: public/class-advanced-ads.php:680
798
  msgid "No Ad Group found"
799
  msgstr ""
800
 
801
- #: public/class-advanced-ads.php:708 public/class-advanced-ads.php:712
802
  #: admin/includes/class-menu.php:85 admin/views/ad-group-list-ads.php:28
803
  msgid "New Ad"
804
  msgstr ""
805
 
806
- #: public/class-advanced-ads.php:709 admin/includes/class-menu.php:85
807
  msgid "Add New Ad"
808
  msgstr ""
809
 
810
- #: public/class-advanced-ads.php:710
811
  #: admin/includes/class-ad-groups-list.php:313
812
  #: modules/import-export/classes/import.php:146
813
  #: modules/import-export/classes/import.php:186
@@ -815,35 +821,35 @@ msgstr ""
815
  msgid "Edit"
816
  msgstr ""
817
 
818
- #: public/class-advanced-ads.php:711
819
  msgid "Edit Ad"
820
  msgstr ""
821
 
822
- #: public/class-advanced-ads.php:713
823
  msgid "View"
824
  msgstr ""
825
 
826
- #: public/class-advanced-ads.php:714
827
  msgid "View the Ad"
828
  msgstr ""
829
 
830
- #: public/class-advanced-ads.php:715
831
  msgid "Search Ads"
832
  msgstr ""
833
 
834
- #: public/class-advanced-ads.php:716
835
  msgid "No Ads found"
836
  msgstr ""
837
 
838
- #: public/class-advanced-ads.php:717
839
  msgid "No Ads found in Trash"
840
  msgstr ""
841
 
842
- #: public/class-advanced-ads.php:718
843
  msgid "Parent Ad"
844
  msgstr ""
845
 
846
- #: public/class-advanced-ads.php:876
847
  msgctxt "label above ads"
848
  msgid "Advertisements"
849
  msgstr ""
@@ -899,15 +905,15 @@ msgid ""
899
  "href=\"%s\">settings</a>."
900
  msgstr ""
901
 
902
- #: admin/includes/ad-health-notices.php:91
903
  msgid "This site is hosted on wordpress.com."
904
  msgstr ""
905
 
906
- #: admin/includes/ad-health-notices.php:97 admin/views/support.php:25
907
  msgid "Advanced Ads related constants enabled"
908
  msgstr ""
909
 
910
- #: admin/includes/ad-health-notices.php:105
911
  #, php-format
912
  msgid ""
913
  "Possible conflict between jQueryUI library, used by Advanced Ads and other "
@@ -915,7 +921,7 @@ msgid ""
915
  "to misfortunate formats in forms, but should not damage features."
916
  msgstr ""
917
 
918
- #: admin/includes/ad-health-notices.php:115
919
  #, php-format
920
  msgid ""
921
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
@@ -923,27 +929,38 @@ msgid ""
923
  "disguise."
924
  msgstr ""
925
 
926
- #: admin/includes/ad-health-notices.php:124 admin/includes/notices.php:37
927
  msgid ""
928
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
929
  "missing</strong>."
930
  msgstr ""
931
 
932
- #: admin/includes/ad-health-notices.php:127 admin/includes/notices.php:37
933
  #, php-format
934
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
935
  msgstr ""
936
 
937
- #: admin/includes/ad-health-notices.php:135
938
  msgid "Ad expired"
939
  msgstr ""
940
 
941
- #: admin/includes/ad-health-notices.php:179
942
- #: admin/includes/class-overview-widgets.php:84
943
  #: admin/views/notices/welcome-panel.php:6
944
  msgid "Create your first ad"
945
  msgstr ""
946
 
 
 
 
 
 
 
 
 
 
 
 
947
  #: admin/includes/class-ad-groups-list.php:165
948
  msgid "Ad weight"
949
  msgstr ""
@@ -1246,8 +1263,9 @@ msgid "Ad Stats"
1246
  msgstr ""
1247
 
1248
  #: admin/includes/class-meta-box.php:140 admin/includes/class-meta-box.php:151
1249
- #: admin/includes/class-meta-box.php:156 admin/includes/class-settings.php:581
1250
  #: admin/views/ad-output-metabox.php:81
 
1251
  #: modules/privacy/admin/views/setting-enable.php:2
1252
  msgid "Manual"
1253
  msgstr ""
@@ -1314,204 +1332,204 @@ msgstr ""
1314
  msgid "Manual and Support"
1315
  msgstr ""
1316
 
1317
- #: admin/includes/class-overview-widgets.php:87
1318
- #: modules/gadsense/admin/views/adsense-account.php:99
1319
- #: modules/gadsense/admin/views/adsense-account.php:117
1320
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:94
1321
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:96
1322
  msgid "Connect to AdSense"
1323
  msgstr ""
1324
 
1325
- #: admin/includes/class-overview-widgets.php:97
1326
  msgid "Join the newsletter for more benefits"
1327
  msgstr ""
1328
 
1329
- #: admin/includes/class-overview-widgets.php:99
1330
  msgid "Get 2 free add-ons"
1331
  msgstr ""
1332
 
1333
- #: admin/includes/class-overview-widgets.php:100
1334
  msgid "Get the first steps and more tutorials to your inbox"
1335
  msgstr ""
1336
 
1337
- #: admin/includes/class-overview-widgets.php:101
1338
  msgid "How to earn more with AdSense"
1339
  msgstr ""
1340
 
1341
- #: admin/includes/class-overview-widgets.php:104
1342
  msgid "Join now"
1343
  msgstr ""
1344
 
1345
- #: admin/includes/class-overview-widgets.php:112 admin/includes/notices.php:44
1346
  msgid ""
1347
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1348
  "help us with a review."
1349
  msgstr ""
1350
 
1351
- #: admin/includes/class-overview-widgets.php:114 admin/includes/notices.php:47
1352
  msgid "Sure, I’ll rate the plugin"
1353
  msgstr ""
1354
 
1355
- #: admin/includes/class-overview-widgets.php:116 admin/includes/notices.php:48
1356
  msgid "I already did"
1357
  msgstr ""
1358
 
1359
- #: admin/includes/class-overview-widgets.php:122
1360
  msgid "Manage your ads"
1361
  msgstr ""
1362
 
1363
- #: admin/includes/class-overview-widgets.php:126
1364
  msgid "Get the All Access pass"
1365
  msgstr ""
1366
 
1367
- #: admin/includes/class-overview-widgets.php:152
1368
  #: admin/views/notices/welcome-panel.php:22
1369
  #, php-format
1370
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1371
  msgstr ""
1372
 
1373
- #: admin/includes/class-overview-widgets.php:153
1374
  #, php-format
1375
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1376
  msgstr ""
1377
 
1378
- #: admin/includes/class-overview-widgets.php:171
1379
  msgid "The solution for professional websites."
1380
  msgstr ""
1381
 
1382
- #: admin/includes/class-overview-widgets.php:174
1383
  #: admin/views/pitch-pro-tab.php:7
1384
  msgid "support for cached sites"
1385
  msgstr ""
1386
 
1387
- #: admin/includes/class-overview-widgets.php:177
1388
- #: admin/includes/class-overview-widgets.php:178
1389
  #: admin/includes/class-overview-widgets.php:179
1390
  #: admin/includes/class-overview-widgets.php:180
 
 
1391
  #, php-format
1392
  msgid "integrates with <strong>%s</strong>"
1393
  msgstr ""
1394
 
1395
- #: admin/includes/class-overview-widgets.php:181
1396
  msgid "click fraud protection, lazy load, ad-block ads"
1397
  msgstr ""
1398
 
1399
- #: admin/includes/class-overview-widgets.php:182
1400
  #: admin/views/pitch-pro-tab.php:8
1401
  msgid "11 more display and visitor conditions"
1402
  msgstr ""
1403
 
1404
- #: admin/includes/class-overview-widgets.php:183
1405
  #: admin/views/pitch-pro-tab.php:9
1406
  msgid "6 more placements"
1407
  msgstr ""
1408
 
1409
- #: admin/includes/class-overview-widgets.php:184
1410
  #: admin/views/pitch-pro-tab.php:10
1411
  msgid "placement tests for ad optimization"
1412
  msgstr ""
1413
 
1414
- #: admin/includes/class-overview-widgets.php:185
1415
  #: admin/views/pitch-pro-tab.php:11
1416
  msgid "ad grids and many more advanced features"
1417
  msgstr ""
1418
 
1419
- #: admin/includes/class-overview-widgets.php:192
1420
  msgid ""
1421
  "Analyze clicks and impressions of your ads locally or in Google Analytics, "
1422
  "share reports, and limit ads to a specific number of impressions or clicks."
1423
  msgstr ""
1424
 
1425
- #: admin/includes/class-overview-widgets.php:198
1426
  msgid ""
1427
  "Display ads based on the device or the size of your visitor’s browser, and "
1428
  "control ads on AMP pages."
1429
  msgstr ""
1430
 
1431
- #: admin/includes/class-overview-widgets.php:211
1432
  msgid ""
1433
  "Earn more money and let advertisers pay for ad space directly on the "
1434
  "frontend of your site."
1435
  msgstr ""
1436
 
1437
- #: admin/includes/class-overview-widgets.php:217
1438
  msgid ""
1439
  "Target visitors with ads that match their geo location and make more money "
1440
  "with regional campaigns."
1441
  msgstr ""
1442
 
1443
- #: admin/includes/class-overview-widgets.php:223
1444
  msgid ""
1445
  "Increase click rates on your ads by placing them in sticky positions above, "
1446
  "next or below your site."
1447
  msgstr ""
1448
 
1449
- #: admin/includes/class-overview-widgets.php:229
1450
  msgid ""
1451
  "Users will never miss an ad or other information in a PopUp. Choose when it "
1452
  "shows up and for how long a user can close it."
1453
  msgstr ""
1454
 
1455
- #: admin/includes/class-overview-widgets.php:235
1456
  msgid ""
1457
  "Create a beautiful and simple slider from your ads to show more information "
1458
  "on less space."
1459
  msgstr ""
1460
 
1461
- #: admin/includes/class-overview-widgets.php:241
1462
  msgid ""
1463
  "Place AdSense In-feed ads between posts on homepage, category, and archive "
1464
  "pages."
1465
  msgstr ""
1466
 
1467
- #: admin/includes/class-overview-widgets.php:244
1468
- #: admin/includes/class-overview-widgets.php:419
1469
- #: admin/includes/class-overview-widgets.php:435
1470
  msgid "Install now"
1471
  msgstr ""
1472
 
1473
- #: admin/includes/class-overview-widgets.php:262
1474
- #: admin/includes/class-overview-widgets.php:283
1475
- #: admin/includes/class-overview-widgets.php:308
1476
- #: admin/includes/class-overview-widgets.php:326
1477
- #: admin/includes/class-overview-widgets.php:344
1478
- #: admin/includes/class-overview-widgets.php:362
1479
- #: admin/includes/class-overview-widgets.php:380
1480
- #: admin/includes/class-overview-widgets.php:398
1481
  msgid "Activate now"
1482
  msgstr ""
1483
 
1484
- #: admin/includes/class-overview-widgets.php:291
1485
  msgid "Visit your ad stats"
1486
  msgstr ""
1487
 
1488
- #: admin/includes/class-overview-widgets.php:415
1489
  msgid "Use Genesis specific ad positions."
1490
  msgstr ""
1491
 
1492
- #: admin/includes/class-overview-widgets.php:431
1493
  msgid ""
1494
  "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
1495
  msgstr ""
1496
 
1497
- #: admin/includes/class-overview-widgets.php:447
1498
  msgid "Our best deal with all add-ons included."
1499
  msgstr ""
1500
 
1501
- #: admin/includes/class-overview-widgets.php:449
1502
  msgid "Get full access"
1503
  msgstr ""
1504
 
1505
- #: admin/includes/class-overview-widgets.php:463
1506
  #: admin/views/ad-display-metabox.php:48 admin/views/ad-visitor-metabox.php:47
1507
  msgid "Visit the manual"
1508
  msgstr ""
1509
 
1510
- #: admin/includes/class-overview-widgets.php:466
1511
  msgid "Get this add-on"
1512
  msgstr ""
1513
 
1514
- #: admin/includes/class-settings.php:50 admin/includes/class-settings.php:412
1515
  msgid "Admin"
1516
  msgstr ""
1517
 
@@ -1601,37 +1619,41 @@ msgstr ""
1601
  msgid "Are you missing something?"
1602
  msgstr ""
1603
 
1604
- #: admin/includes/class-settings.php:407
 
 
 
 
1605
  msgid "(display to all)"
1606
  msgstr ""
1607
 
1608
- #: admin/includes/class-settings.php:408
1609
  msgid "Subscriber"
1610
  msgstr ""
1611
 
1612
- #: admin/includes/class-settings.php:409
1613
  msgid "Contributor"
1614
  msgstr ""
1615
 
1616
- #: admin/includes/class-settings.php:410
1617
  msgid "Author"
1618
  msgstr ""
1619
 
1620
- #: admin/includes/class-settings.php:411
1621
  msgid "Editor"
1622
  msgstr ""
1623
 
1624
- #: admin/includes/class-settings.php:420
1625
  msgid "Choose the lowest role a user must have in order to not see any ads."
1626
  msgstr ""
1627
 
1628
- #: admin/includes/class-settings.php:434
1629
  msgid ""
1630
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1631
  "needs it."
1632
  msgstr ""
1633
 
1634
- #: admin/includes/class-settings.php:437
1635
  #, php-format
1636
  msgid ""
1637
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
@@ -1639,7 +1661,7 @@ msgid ""
1639
  "need features from this file."
1640
  msgstr ""
1641
 
1642
- #: admin/includes/class-settings.php:457
1643
  msgid ""
1644
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1645
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
@@ -1649,73 +1671,73 @@ msgid ""
1649
  "injection only in the first x posts on your archive pages."
1650
  msgstr ""
1651
 
1652
- #: admin/includes/class-settings.php:473
1653
  msgid ""
1654
  "Please check your post content. A priority of 10 and below might cause "
1655
  "issues (wpautop function might run twice)."
1656
  msgstr ""
1657
 
1658
- #: admin/includes/class-settings.php:475
1659
  msgid ""
1660
  "Play with this value in order to change the priority of the injected ads "
1661
  "compared to other auto injected elements in the post content."
1662
  msgstr ""
1663
 
1664
- #: admin/includes/class-settings.php:489
1665
  msgid ""
1666
  "Advanced Ads ignores paragraphs and other elements in containers when "
1667
  "injecting ads into the post content. Check this option to ignore this "
1668
  "limitation and ads might show up again."
1669
  msgstr ""
1670
 
1671
- #: admin/includes/class-settings.php:505
1672
  msgid "Read this first"
1673
  msgstr ""
1674
 
1675
- #: admin/includes/class-settings.php:506
1676
  msgid "Hide ads from crawlers, bots and empty user agents."
1677
  msgstr ""
1678
 
1679
  #. %1$s is a starting <a> tag and %2$s a closing one
1680
- #: admin/includes/class-settings.php:522
1681
  #, php-format
1682
  msgid ""
1683
  "Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
1684
  "notices like tips, tutorials, email newsletters and update notices."
1685
  msgstr ""
1686
 
1687
- #: admin/includes/class-settings.php:540
1688
  msgid ""
1689
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1690
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1691
  "need to <strong>rewrite css rules afterwards</strong>."
1692
  msgstr ""
1693
 
1694
- #: admin/includes/class-settings.php:559
1695
  msgid "Allow editors to also manage and publish ads."
1696
  msgstr ""
1697
 
1698
- #: admin/includes/class-settings.php:560
1699
  #, php-format
1700
  msgid ""
1701
  "You can assign different ad-related roles on a user basis with <a "
1702
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1703
  msgstr ""
1704
 
1705
- #: admin/includes/class-settings.php:571
1706
  msgctxt "label before ads"
1707
  msgid "Advertisements"
1708
  msgstr ""
1709
 
1710
- #: admin/includes/class-settings.php:580
1711
  msgid "Displayed above ads."
1712
  msgstr ""
1713
 
1714
- #: admin/includes/class-settings.php:617
1715
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1716
  msgstr ""
1717
 
1718
- #: admin/includes/class-settings.php:630
1719
  msgid "Disable shortcode button in visual editor."
1720
  msgstr ""
1721
 
@@ -1726,51 +1748,61 @@ msgid ""
1726
  "the <a href=\"%s\" target=\"_blank\">settings</a>."
1727
  msgstr ""
1728
 
1729
- #: admin/includes/notices.php:16
1730
  msgid ""
1731
  "Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
1732
  "receive the first steps via email?"
1733
  msgstr ""
1734
 
1735
- #: admin/includes/notices.php:17
1736
  msgid "Yes, send it"
1737
  msgstr ""
1738
 
1739
- #: admin/includes/notices.php:23
1740
  msgid ""
1741
  "Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
1742
  "<strong>2 free add-ons</strong> for joining the newsletter."
1743
  msgstr ""
1744
 
1745
- #: admin/includes/notices.php:24
1746
  msgid "Add me now"
1747
  msgstr ""
1748
 
1749
- #: admin/includes/notices.php:30
1750
  msgid ""
1751
  "Learn more about how and <strong>how much you can earn with AdSense</strong> "
1752
  "and Advanced Ads from my dedicated newsletter."
1753
  msgstr ""
1754
 
1755
- #: admin/includes/notices.php:31 admin/views/notices/inline.php:3
1756
  #: admin/views/notices/subscribe.php:3
1757
  msgid "Subscribe me now"
1758
  msgstr ""
1759
 
1760
- #: admin/includes/notices.php:43
1761
- #, php-format
1762
- msgid "You’ve successfully <strong>created %s ads using Advanced Ads</strong>."
1763
  msgstr ""
1764
 
1765
- #: admin/includes/notices.php:49
1766
- msgid "I am not happy, please help"
 
 
 
 
 
 
 
1767
  msgstr ""
1768
 
1769
  #: admin/includes/notices.php:50
1770
- msgid "Ask me later"
 
 
 
 
1771
  msgstr ""
1772
 
1773
- #: admin/includes/notices.php:57
1774
  #, php-format
1775
  msgid ""
1776
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
@@ -1779,7 +1811,7 @@ msgid ""
1779
  "Access</a>"
1780
  msgstr ""
1781
 
1782
- #: admin/includes/notices.php:63
1783
  #, php-format
1784
  msgid ""
1785
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
@@ -2432,44 +2464,36 @@ msgstr ""
2432
  msgid "I switched to another plugin"
2433
  msgstr ""
2434
 
2435
- #: admin/views/feedback-disable.php:25 modules/gadsense/admin/admin.php:303
2436
- msgid "Faster than the AdSense support!"
2437
- msgstr ""
2438
-
2439
- #: admin/views/feedback-disable.php:32 modules/gadsense/admin/admin.php:312
2440
- msgid "reach out for help"
2441
- msgstr ""
2442
-
2443
- #: admin/views/feedback-disable.php:38
2444
  msgid "Send feedback & deactivate"
2445
  msgstr ""
2446
 
2447
- #: admin/views/feedback-disable.php:39
2448
  msgid "Send feedback"
2449
  msgstr ""
2450
 
2451
- #: admin/views/feedback-disable.php:41
2452
  msgid "Only Deactivate"
2453
  msgstr ""
2454
 
2455
- #: admin/views/feedback-disable.php:44
2456
  msgid ""
2457
  "Thanks for submitting your feedback. I will reply within 24 hours on working "
2458
  "days."
2459
  msgstr ""
2460
 
2461
  #. %s is the title of the website
2462
- #: admin/views/feedback-disable.php:49
2463
  #, php-format
2464
  msgid "All the best to you and %s."
2465
  msgstr ""
2466
 
2467
- #: admin/views/feedback-disable.php:50
2468
  msgid "Disabling the plugin now…"
2469
  msgstr ""
2470
 
2471
  #. %s includes a number and markup like <span class="count">6</span>.
2472
- #: admin/views/overview-notices.php:24
2473
  #, php-format
2474
  msgid "Show %s hidden"
2475
  msgstr ""
@@ -2545,7 +2569,7 @@ msgid "Where do you want to display the ad?"
2545
  msgstr ""
2546
 
2547
  #: admin/views/placement-injection-top.php:24
2548
- #: modules/gadsense/admin/admin.php:466
2549
  #, php-format
2550
  msgid ""
2551
  "The AdSense verification and Auto ads code is already activated in the <a "
@@ -2553,7 +2577,7 @@ msgid ""
2553
  msgstr ""
2554
 
2555
  #: admin/views/placement-injection-top.php:30
2556
- #: modules/gadsense/admin/admin.php:468
2557
  msgid ""
2558
  "No need to add the code manually here, unless you want to include it into "
2559
  "certain pages only."
@@ -2639,11 +2663,15 @@ msgid ""
2639
  msgstr ""
2640
 
2641
  #: admin/views/placements-ad-label.php:6 admin/views/placements-ad-label.php:9
 
 
2642
  msgid "enabled"
2643
  msgstr ""
2644
 
2645
  #: admin/views/placements-ad-label.php:11
2646
  #: admin/views/placements-ad-label.php:14
 
 
2647
  msgid "disabled"
2648
  msgstr ""
2649
 
@@ -3070,6 +3098,30 @@ msgstr ""
3070
  msgid "Ad blocker counter"
3071
  msgstr ""
3072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3073
  #: modules/gadsense/admin/admin.php:135
3074
  msgid "AdSense account"
3075
  msgstr ""
@@ -3078,37 +3130,51 @@ msgstr ""
3078
  msgid "Verification code & Auto ads"
3079
  msgstr ""
3080
 
3081
- #: modules/gadsense/admin/admin.php:156
 
 
 
 
 
 
 
 
3082
  msgid "Limit to 3 ads"
3083
  msgstr ""
3084
 
3085
- #: modules/gadsense/admin/admin.php:166
3086
  msgid "Disable violation warnings"
3087
  msgstr ""
3088
 
3089
- #: modules/gadsense/admin/admin.php:174
3090
  msgid "Transparent background"
3091
  msgstr ""
3092
 
3093
- #: modules/gadsense/admin/admin.php:240
3094
  #, php-format
3095
  msgid "Limit to %d AdSense ads"
3096
  msgstr ""
3097
 
3098
- #: modules/gadsense/admin/admin.php:244
3099
  msgid ""
3100
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3101
  "this setting to prevent too many AdSense ads to show accidentally on your "
3102
  "site."
3103
  msgstr ""
3104
 
3105
- #: modules/gadsense/admin/admin.php:248
3106
  msgid ""
3107
  "Due to technical restrictions, the limit does not work on placements with "
3108
  "cache-busting enabled."
3109
  msgstr ""
3110
 
3111
- #: modules/gadsense/admin/admin.php:262
 
 
 
 
 
 
3112
  #: modules/gadsense/admin/views/connect-adsense.php:37
3113
  msgid ""
3114
  "Insert the AdSense header code used for verification and the Auto Ads "
@@ -3116,30 +3182,30 @@ msgid ""
3116
  msgstr ""
3117
 
3118
  #. this is the text for a link to a sub-page in an AdSense account
3119
- #: modules/gadsense/admin/admin.php:267
3120
  msgid "Adjust Auto ads options"
3121
  msgstr ""
3122
 
3123
- #: modules/gadsense/admin/admin.php:269
3124
  #, php-format
3125
  msgid ""
3126
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3127
  "appear in random places</strong>."
3128
  msgstr ""
3129
 
3130
- #: modules/gadsense/admin/admin.php:270
3131
  msgid "Display Auto ads only on specific pages"
3132
  msgstr ""
3133
 
3134
- #: modules/gadsense/admin/admin.php:271
3135
  msgid "Auto ads on AMP pages"
3136
  msgstr ""
3137
 
3138
- #: modules/gadsense/admin/admin.php:284
3139
  msgid "Disable warnings about potential violations of the AdSense terms."
3140
  msgstr ""
3141
 
3142
- #: modules/gadsense/admin/admin.php:285
3143
  #, php-format
3144
  msgid ""
3145
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
@@ -3147,22 +3213,22 @@ msgid ""
3147
  "managed with Advanced Ads. Enable this option to remove these checks"
3148
  msgstr ""
3149
 
3150
- #: modules/gadsense/admin/admin.php:296
3151
  msgid ""
3152
  "Enable this option in case your theme adds an unfortunate background color "
3153
  "to AdSense ads."
3154
  msgstr ""
3155
 
3156
- #: modules/gadsense/admin/admin.php:335
3157
  #: modules/gadsense/includes/class-ad-type-adsense.php:76
3158
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3159
  msgstr ""
3160
 
3161
- #: modules/gadsense/admin/admin.php:357
3162
  msgid "AdSense"
3163
  msgstr ""
3164
 
3165
- #: modules/gadsense/admin/admin.php:409
3166
  #, php-format
3167
  msgid ""
3168
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
@@ -3171,14 +3237,14 @@ msgid ""
3171
  "wrapped in text."
3172
  msgstr ""
3173
 
3174
- #: modules/gadsense/admin/admin.php:415
3175
  #, php-format
3176
  msgid ""
3177
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3178
  "in order to place ads between posts."
3179
  msgstr ""
3180
 
3181
- #: modules/gadsense/admin/admin.php:422
3182
  #, php-format
3183
  msgid ""
3184
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
@@ -3186,7 +3252,7 @@ msgid ""
3186
  "vertical, or rectangle formats."
3187
  msgstr ""
3188
 
3189
- #: modules/gadsense/admin/admin.php:470
3190
  #, php-format
3191
  msgid ""
3192
  "The AdSense verification and Auto ads code should be set up in the <a "
@@ -3194,7 +3260,7 @@ msgid ""
3194
  "now."
3195
  msgstr ""
3196
 
3197
- #: modules/gadsense/admin/admin.php:471
3198
  msgid "Activate"
3199
  msgstr ""
3200
 
@@ -3214,32 +3280,23 @@ msgstr ""
3214
  msgid "Auto"
3215
  msgstr ""
3216
 
3217
- #: modules/gadsense/includes/class-mapi.php:70
3218
- msgid "Your account was not approved by AdSense."
3219
- msgstr ""
3220
-
3221
- #: modules/gadsense/includes/class-mapi.php:72
3222
- #, php-format
3223
- msgid "Create a new AdSense account %1$shere%2$s."
3224
- msgstr ""
3225
-
3226
- #: modules/gadsense/includes/class-mapi.php:383
3227
  msgid ""
3228
  "It seems that some changes have been made in the Advanced Ads settings. "
3229
  "Please refresh this page."
3230
  msgstr ""
3231
 
3232
- #: modules/gadsense/includes/class-mapi.php:390
3233
  #, php-format
3234
  msgid ""
3235
  "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
3236
  msgstr ""
3237
 
3238
- #: modules/gadsense/includes/class-mapi.php:868
3239
  msgid "An error occurred while requesting account details."
3240
  msgstr ""
3241
 
3242
- #: modules/gadsense/includes/class-mapi.php:1176
3243
  #, php-format
3244
  msgid ""
3245
  "There are one or more warnings about the currently linked AdSense account. "
@@ -3508,67 +3565,80 @@ msgid ""
3508
  "Google Analytics property ID above to count them."
3509
  msgstr ""
3510
 
3511
- #: modules/gadsense/admin/views/adsense-account.php:29
3512
- msgid "AdSense warnings"
 
 
3513
  msgstr ""
3514
 
3515
- #: modules/gadsense/admin/views/adsense-account.php:30
3516
- #: modules/gadsense/admin/views/adsense-account.php:81
3517
- msgid "dismiss"
 
 
 
 
 
 
 
 
3518
  msgstr ""
3519
 
3520
- #: modules/gadsense/admin/views/adsense-account.php:35
 
 
 
 
3521
  msgid ""
3522
- "One of your sites is missing the AdSense publisher ID in the ads.txt file."
 
3523
  msgstr ""
3524
 
3525
- #. %1$s is a starting link, %2$s is the end
3526
- #: modules/gadsense/admin/views/adsense-account.php:44
3527
- #: modules/gadsense/admin/views/adsense-account.php:88
3528
- #, php-format
3529
- msgid "Learn more about AdSense account issues %1$shere%2$s"
3530
  msgstr ""
3531
 
3532
- #: modules/gadsense/admin/views/adsense-account.php:72
3533
- msgid "Last AdSense account connection attempt failed."
 
3534
  msgstr ""
3535
 
3536
- #: modules/gadsense/admin/views/adsense-account.php:102
3537
  msgid "Revoke API acccess"
3538
  msgstr ""
3539
 
3540
- #: modules/gadsense/admin/views/adsense-account.php:108
3541
  msgid "Account holder name"
3542
  msgstr ""
3543
 
3544
- #: modules/gadsense/admin/views/adsense-account.php:110
3545
  msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
3546
  msgstr ""
3547
 
3548
- #: modules/gadsense/admin/views/adsense-account.php:116
3549
  msgid "Yes, I have an AdSense account"
3550
  msgstr ""
3551
 
3552
- #: modules/gadsense/admin/views/adsense-account.php:118
3553
  msgid "Configure everything manually"
3554
  msgstr ""
3555
 
3556
- #: modules/gadsense/admin/views/adsense-account.php:121
3557
  msgid "No, I still don't have an AdSense account"
3558
  msgstr ""
3559
 
3560
- #: modules/gadsense/admin/views/adsense-account.php:122
3561
  msgid "Get a free AdSense account"
3562
  msgstr ""
3563
 
3564
  #. %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
3565
- #: modules/gadsense/admin/views/adsense-account.php:172
3566
  #, php-format
3567
  msgid ""
3568
  "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
3569
  msgstr ""
3570
 
3571
- #: modules/gadsense/admin/views/adsense-account.php:180
3572
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:102
3573
  msgid "Can not connect AdSense account. PHP version is too low."
3574
  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-03-08 12:30+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"
46
 
47
  #: admin/class-advanced-ads-admin.php:401 admin/includes/class-menu.php:113
48
  #: admin/includes/class-menu.php:116 admin/views/settings.php:28
 
49
  msgid "Support"
50
  msgstr ""
51
 
55
  msgstr ""
56
 
57
  #: admin/class-advanced-ads-admin.php:671
58
+ #: admin/includes/class-overview-widgets.php:156
59
  #, php-format
60
  msgid ""
61
  "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
95
  msgstr ""
96
 
97
  #: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
98
+ #: public/class-advanced-ads.php:712 admin/views/ad-group-list-ads.php:13
99
  msgid "Ad"
100
  msgstr ""
101
 
102
+ #: classes/ad-debug.php:121 public/class-advanced-ads.php:675
103
  msgctxt "ad group singular name"
104
  msgid "Ad Group"
105
  msgstr ""
117
  msgstr ""
118
 
119
  #: classes/ad-debug.php:272 classes/frontend_checks.php:235
120
+ #: admin/includes/ad-health-notices.php:165
121
  msgid ""
122
  "Your website is using HTTPS, but the ad code contains HTTP and might not "
123
  "work."
124
  msgstr ""
125
 
126
+ #. %1$s is an anchor (link) opening tag, %2$s is the closing tag.
127
+ #: classes/ad-health-notices.php:749
128
+ #: modules/gadsense/includes/class-mapi.php:1312
129
+ #, php-format
130
+ msgid "Learn more about AdSense account issues %1$shere%2$s."
131
+ msgstr ""
132
+
133
  #: classes/ad_placements.php:31
134
  msgid "Manual Placement"
135
  msgstr ""
528
  msgid "Random AdSense ads"
529
  msgstr ""
530
 
531
+ #: classes/frontend_checks.php:105 admin/includes/class-settings.php:506
532
  msgid "You look like a bot"
533
  msgstr ""
534
 
570
  msgid "Ad IDs: %s"
571
  msgstr ""
572
 
573
+ #: classes/frontend_checks.php:248 admin/includes/ad-health-notices.php:144
574
  #, php-format
575
  msgid "Visible ads should not use the Header placement: %s"
576
  msgstr ""
577
 
578
+ #: classes/frontend_checks.php:262 admin/includes/ad-health-notices.php:156
579
  msgid "AdSense violation"
580
  msgstr ""
581
 
582
+ #: classes/frontend_checks.php:263 admin/includes/ad-health-notices.php:157
583
  msgid "Ad is hidden"
584
  msgstr ""
585
 
713
  msgid "Ad Groups"
714
  msgstr ""
715
 
716
+ #: classes/widget.php:93 public/class-advanced-ads.php:711
717
  #: admin/includes/class-menu.php:68 admin/includes/class-menu.php:68
718
  #: admin/includes/class-shortcode-creator.php:84
719
  #: admin/views/ad-group-list-form-row.php:90
759
  msgid "Advanced Ads Error: %s"
760
  msgstr ""
761
 
762
+ #: public/class-advanced-ads.php:674
763
  msgctxt "ad group general name"
764
  msgid "Ad Groups & Rotations"
765
  msgstr ""
766
 
767
+ #: public/class-advanced-ads.php:676
768
  msgid "Search Ad Groups"
769
  msgstr ""
770
 
771
+ #: public/class-advanced-ads.php:677
772
  msgid "All Ad Groups"
773
  msgstr ""
774
 
775
+ #: public/class-advanced-ads.php:678
776
  msgid "Parent Ad Groups"
777
  msgstr ""
778
 
779
+ #: public/class-advanced-ads.php:679
780
  msgid "Parent Ad Groups:"
781
  msgstr ""
782
 
783
+ #: public/class-advanced-ads.php:680
784
  msgid "Edit Ad Group"
785
  msgstr ""
786
 
787
+ #: public/class-advanced-ads.php:681
788
  msgid "Update Ad Group"
789
  msgstr ""
790
 
791
+ #: public/class-advanced-ads.php:682
792
  msgid "Add New Ad Group"
793
  msgstr ""
794
 
795
+ #: public/class-advanced-ads.php:683
796
  msgid "New Ad Groups Name"
797
  msgstr ""
798
 
799
+ #: public/class-advanced-ads.php:684 modules/import-export/views/page.php:24
800
  msgid "Groups"
801
  msgstr ""
802
 
803
+ #: public/class-advanced-ads.php:685
804
  msgid "No Ad Group found"
805
  msgstr ""
806
 
807
+ #: public/class-advanced-ads.php:713 public/class-advanced-ads.php:717
808
  #: admin/includes/class-menu.php:85 admin/views/ad-group-list-ads.php:28
809
  msgid "New Ad"
810
  msgstr ""
811
 
812
+ #: public/class-advanced-ads.php:714 admin/includes/class-menu.php:85
813
  msgid "Add New Ad"
814
  msgstr ""
815
 
816
+ #: public/class-advanced-ads.php:715
817
  #: admin/includes/class-ad-groups-list.php:313
818
  #: modules/import-export/classes/import.php:146
819
  #: modules/import-export/classes/import.php:186
821
  msgid "Edit"
822
  msgstr ""
823
 
824
+ #: public/class-advanced-ads.php:716
825
  msgid "Edit Ad"
826
  msgstr ""
827
 
828
+ #: public/class-advanced-ads.php:718
829
  msgid "View"
830
  msgstr ""
831
 
832
+ #: public/class-advanced-ads.php:719
833
  msgid "View the Ad"
834
  msgstr ""
835
 
836
+ #: public/class-advanced-ads.php:720
837
  msgid "Search Ads"
838
  msgstr ""
839
 
840
+ #: public/class-advanced-ads.php:721
841
  msgid "No Ads found"
842
  msgstr ""
843
 
844
+ #: public/class-advanced-ads.php:722
845
  msgid "No Ads found in Trash"
846
  msgstr ""
847
 
848
+ #: public/class-advanced-ads.php:723
849
  msgid "Parent Ad"
850
  msgstr ""
851
 
852
+ #: public/class-advanced-ads.php:881
853
  msgctxt "label above ads"
854
  msgid "Advertisements"
855
  msgstr ""
905
  "href=\"%s\">settings</a>."
906
  msgstr ""
907
 
908
+ #: admin/includes/ad-health-notices.php:90
909
  msgid "This site is hosted on wordpress.com."
910
  msgstr ""
911
 
912
+ #: admin/includes/ad-health-notices.php:96 admin/views/support.php:25
913
  msgid "Advanced Ads related constants enabled"
914
  msgstr ""
915
 
916
+ #: admin/includes/ad-health-notices.php:104
917
  #, php-format
918
  msgid ""
919
  "Possible conflict between jQueryUI library, used by Advanced Ads and other "
921
  "to misfortunate formats in forms, but should not damage features."
922
  msgstr ""
923
 
924
+ #: admin/includes/ad-health-notices.php:114
925
  #, php-format
926
  msgid ""
927
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
929
  "disguise."
930
  msgstr ""
931
 
932
+ #: admin/includes/ad-health-notices.php:123 admin/includes/notices.php:36
933
  msgid ""
934
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
935
  "missing</strong>."
936
  msgstr ""
937
 
938
+ #: admin/includes/ad-health-notices.php:126 admin/includes/notices.php:36
939
  #, php-format
940
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
941
  msgstr ""
942
 
943
+ #: admin/includes/ad-health-notices.php:134
944
  msgid "Ad expired"
945
  msgstr ""
946
 
947
+ #: admin/includes/ad-health-notices.php:178
948
+ #: admin/includes/class-overview-widgets.php:86
949
  #: admin/views/notices/welcome-panel.php:6
950
  msgid "Create your first ad"
951
  msgstr ""
952
 
953
+ #: admin/includes/ad-health-notices.php:183
954
+ #: admin/includes/ad-health-notices.php:190
955
+ #: modules/gadsense/includes/class-mapi.php:90
956
+ msgid "Last AdSense account connection attempt failed."
957
+ msgstr ""
958
+
959
+ #: admin/includes/ad-health-notices.php:199
960
+ msgid ""
961
+ "One of your sites is missing the AdSense publisher ID in the ads.txt file."
962
+ msgstr ""
963
+
964
  #: admin/includes/class-ad-groups-list.php:165
965
  msgid "Ad weight"
966
  msgstr ""
1263
  msgstr ""
1264
 
1265
  #: admin/includes/class-meta-box.php:140 admin/includes/class-meta-box.php:151
1266
+ #: admin/includes/class-meta-box.php:156 admin/includes/class-settings.php:584
1267
  #: admin/views/ad-output-metabox.php:81
1268
+ #: modules/ads-txt/admin/views/setting-create.php:11
1269
  #: modules/privacy/admin/views/setting-enable.php:2
1270
  msgid "Manual"
1271
  msgstr ""
1332
  msgid "Manual and Support"
1333
  msgstr ""
1334
 
1335
+ #: admin/includes/class-overview-widgets.php:89
1336
+ #: modules/gadsense/admin/views/adsense-account.php:71
1337
+ #: modules/gadsense/admin/views/adsense-account.php:89
1338
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:94
1339
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:96
1340
  msgid "Connect to AdSense"
1341
  msgstr ""
1342
 
1343
+ #: admin/includes/class-overview-widgets.php:99
1344
  msgid "Join the newsletter for more benefits"
1345
  msgstr ""
1346
 
1347
+ #: admin/includes/class-overview-widgets.php:101
1348
  msgid "Get 2 free add-ons"
1349
  msgstr ""
1350
 
1351
+ #: admin/includes/class-overview-widgets.php:102
1352
  msgid "Get the first steps and more tutorials to your inbox"
1353
  msgstr ""
1354
 
1355
+ #: admin/includes/class-overview-widgets.php:103
1356
  msgid "How to earn more with AdSense"
1357
  msgstr ""
1358
 
1359
+ #: admin/includes/class-overview-widgets.php:106
1360
  msgid "Join now"
1361
  msgstr ""
1362
 
1363
+ #: admin/includes/class-overview-widgets.php:114
1364
  msgid ""
1365
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1366
  "help us with a review."
1367
  msgstr ""
1368
 
1369
+ #: admin/includes/class-overview-widgets.php:116
1370
  msgid "Sure, I’ll rate the plugin"
1371
  msgstr ""
1372
 
1373
+ #: admin/includes/class-overview-widgets.php:118
1374
  msgid "I already did"
1375
  msgstr ""
1376
 
1377
+ #: admin/includes/class-overview-widgets.php:124
1378
  msgid "Manage your ads"
1379
  msgstr ""
1380
 
1381
+ #: admin/includes/class-overview-widgets.php:128
1382
  msgid "Get the All Access pass"
1383
  msgstr ""
1384
 
1385
+ #: admin/includes/class-overview-widgets.php:154
1386
  #: admin/views/notices/welcome-panel.php:22
1387
  #, php-format
1388
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1389
  msgstr ""
1390
 
1391
+ #: admin/includes/class-overview-widgets.php:155
1392
  #, php-format
1393
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1394
  msgstr ""
1395
 
1396
+ #: admin/includes/class-overview-widgets.php:173
1397
  msgid "The solution for professional websites."
1398
  msgstr ""
1399
 
1400
+ #: admin/includes/class-overview-widgets.php:176
1401
  #: admin/views/pitch-pro-tab.php:7
1402
  msgid "support for cached sites"
1403
  msgstr ""
1404
 
 
 
1405
  #: admin/includes/class-overview-widgets.php:179
1406
  #: admin/includes/class-overview-widgets.php:180
1407
+ #: admin/includes/class-overview-widgets.php:181
1408
+ #: admin/includes/class-overview-widgets.php:182
1409
  #, php-format
1410
  msgid "integrates with <strong>%s</strong>"
1411
  msgstr ""
1412
 
1413
+ #: admin/includes/class-overview-widgets.php:183
1414
  msgid "click fraud protection, lazy load, ad-block ads"
1415
  msgstr ""
1416
 
1417
+ #: admin/includes/class-overview-widgets.php:184
1418
  #: admin/views/pitch-pro-tab.php:8
1419
  msgid "11 more display and visitor conditions"
1420
  msgstr ""
1421
 
1422
+ #: admin/includes/class-overview-widgets.php:185
1423
  #: admin/views/pitch-pro-tab.php:9
1424
  msgid "6 more placements"
1425
  msgstr ""
1426
 
1427
+ #: admin/includes/class-overview-widgets.php:186
1428
  #: admin/views/pitch-pro-tab.php:10
1429
  msgid "placement tests for ad optimization"
1430
  msgstr ""
1431
 
1432
+ #: admin/includes/class-overview-widgets.php:187
1433
  #: admin/views/pitch-pro-tab.php:11
1434
  msgid "ad grids and many more advanced features"
1435
  msgstr ""
1436
 
1437
+ #: admin/includes/class-overview-widgets.php:194
1438
  msgid ""
1439
  "Analyze clicks and impressions of your ads locally or in Google Analytics, "
1440
  "share reports, and limit ads to a specific number of impressions or clicks."
1441
  msgstr ""
1442
 
1443
+ #: admin/includes/class-overview-widgets.php:200
1444
  msgid ""
1445
  "Display ads based on the device or the size of your visitor’s browser, and "
1446
  "control ads on AMP pages."
1447
  msgstr ""
1448
 
1449
+ #: admin/includes/class-overview-widgets.php:213
1450
  msgid ""
1451
  "Earn more money and let advertisers pay for ad space directly on the "
1452
  "frontend of your site."
1453
  msgstr ""
1454
 
1455
+ #: admin/includes/class-overview-widgets.php:219
1456
  msgid ""
1457
  "Target visitors with ads that match their geo location and make more money "
1458
  "with regional campaigns."
1459
  msgstr ""
1460
 
1461
+ #: admin/includes/class-overview-widgets.php:225
1462
  msgid ""
1463
  "Increase click rates on your ads by placing them in sticky positions above, "
1464
  "next or below your site."
1465
  msgstr ""
1466
 
1467
+ #: admin/includes/class-overview-widgets.php:231
1468
  msgid ""
1469
  "Users will never miss an ad or other information in a PopUp. Choose when it "
1470
  "shows up and for how long a user can close it."
1471
  msgstr ""
1472
 
1473
+ #: admin/includes/class-overview-widgets.php:237
1474
  msgid ""
1475
  "Create a beautiful and simple slider from your ads to show more information "
1476
  "on less space."
1477
  msgstr ""
1478
 
1479
+ #: admin/includes/class-overview-widgets.php:243
1480
  msgid ""
1481
  "Place AdSense In-feed ads between posts on homepage, category, and archive "
1482
  "pages."
1483
  msgstr ""
1484
 
1485
+ #: admin/includes/class-overview-widgets.php:246
1486
+ #: admin/includes/class-overview-widgets.php:421
1487
+ #: admin/includes/class-overview-widgets.php:437
1488
  msgid "Install now"
1489
  msgstr ""
1490
 
1491
+ #: admin/includes/class-overview-widgets.php:264
1492
+ #: admin/includes/class-overview-widgets.php:285
1493
+ #: admin/includes/class-overview-widgets.php:310
1494
+ #: admin/includes/class-overview-widgets.php:328
1495
+ #: admin/includes/class-overview-widgets.php:346
1496
+ #: admin/includes/class-overview-widgets.php:364
1497
+ #: admin/includes/class-overview-widgets.php:382
1498
+ #: admin/includes/class-overview-widgets.php:400
1499
  msgid "Activate now"
1500
  msgstr ""
1501
 
1502
+ #: admin/includes/class-overview-widgets.php:293
1503
  msgid "Visit your ad stats"
1504
  msgstr ""
1505
 
1506
+ #: admin/includes/class-overview-widgets.php:417
1507
  msgid "Use Genesis specific ad positions."
1508
  msgstr ""
1509
 
1510
+ #: admin/includes/class-overview-widgets.php:433
1511
  msgid ""
1512
  "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
1513
  msgstr ""
1514
 
1515
+ #: admin/includes/class-overview-widgets.php:449
1516
  msgid "Our best deal with all add-ons included."
1517
  msgstr ""
1518
 
1519
+ #: admin/includes/class-overview-widgets.php:451
1520
  msgid "Get full access"
1521
  msgstr ""
1522
 
1523
+ #: admin/includes/class-overview-widgets.php:465
1524
  #: admin/views/ad-display-metabox.php:48 admin/views/ad-visitor-metabox.php:47
1525
  msgid "Visit the manual"
1526
  msgstr ""
1527
 
1528
+ #: admin/includes/class-overview-widgets.php:468
1529
  msgid "Get this add-on"
1530
  msgstr ""
1531
 
1532
+ #: admin/includes/class-settings.php:50 admin/includes/class-settings.php:415
1533
  msgid "Admin"
1534
  msgstr ""
1535
 
1619
  msgid "Are you missing something?"
1620
  msgstr ""
1621
 
1622
+ #: admin/includes/class-settings.php:356
1623
+ msgid "How to install and activate an add-on."
1624
+ msgstr ""
1625
+
1626
+ #: admin/includes/class-settings.php:410
1627
  msgid "(display to all)"
1628
  msgstr ""
1629
 
1630
+ #: admin/includes/class-settings.php:411
1631
  msgid "Subscriber"
1632
  msgstr ""
1633
 
1634
+ #: admin/includes/class-settings.php:412
1635
  msgid "Contributor"
1636
  msgstr ""
1637
 
1638
+ #: admin/includes/class-settings.php:413
1639
  msgid "Author"
1640
  msgstr ""
1641
 
1642
+ #: admin/includes/class-settings.php:414
1643
  msgid "Editor"
1644
  msgstr ""
1645
 
1646
+ #: admin/includes/class-settings.php:423
1647
  msgid "Choose the lowest role a user must have in order to not see any ads."
1648
  msgstr ""
1649
 
1650
+ #: admin/includes/class-settings.php:437
1651
  msgid ""
1652
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1653
  "needs it."
1654
  msgstr ""
1655
 
1656
+ #: admin/includes/class-settings.php:440
1657
  #, php-format
1658
  msgid ""
1659
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
1661
  "need features from this file."
1662
  msgstr ""
1663
 
1664
+ #: admin/includes/class-settings.php:460
1665
  msgid ""
1666
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1667
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
1671
  "injection only in the first x posts on your archive pages."
1672
  msgstr ""
1673
 
1674
+ #: admin/includes/class-settings.php:476
1675
  msgid ""
1676
  "Please check your post content. A priority of 10 and below might cause "
1677
  "issues (wpautop function might run twice)."
1678
  msgstr ""
1679
 
1680
+ #: admin/includes/class-settings.php:478
1681
  msgid ""
1682
  "Play with this value in order to change the priority of the injected ads "
1683
  "compared to other auto injected elements in the post content."
1684
  msgstr ""
1685
 
1686
+ #: admin/includes/class-settings.php:492
1687
  msgid ""
1688
  "Advanced Ads ignores paragraphs and other elements in containers when "
1689
  "injecting ads into the post content. Check this option to ignore this "
1690
  "limitation and ads might show up again."
1691
  msgstr ""
1692
 
1693
+ #: admin/includes/class-settings.php:508
1694
  msgid "Read this first"
1695
  msgstr ""
1696
 
1697
+ #: admin/includes/class-settings.php:509
1698
  msgid "Hide ads from crawlers, bots and empty user agents."
1699
  msgstr ""
1700
 
1701
  #. %1$s is a starting <a> tag and %2$s a closing one
1702
+ #: admin/includes/class-settings.php:525
1703
  #, php-format
1704
  msgid ""
1705
  "Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
1706
  "notices like tips, tutorials, email newsletters and update notices."
1707
  msgstr ""
1708
 
1709
+ #: admin/includes/class-settings.php:543
1710
  msgid ""
1711
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1712
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1713
  "need to <strong>rewrite css rules afterwards</strong>."
1714
  msgstr ""
1715
 
1716
+ #: admin/includes/class-settings.php:562
1717
  msgid "Allow editors to also manage and publish ads."
1718
  msgstr ""
1719
 
1720
+ #: admin/includes/class-settings.php:563
1721
  #, php-format
1722
  msgid ""
1723
  "You can assign different ad-related roles on a user basis with <a "
1724
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1725
  msgstr ""
1726
 
1727
+ #: admin/includes/class-settings.php:574
1728
  msgctxt "label before ads"
1729
  msgid "Advertisements"
1730
  msgstr ""
1731
 
1732
+ #: admin/includes/class-settings.php:583
1733
  msgid "Displayed above ads."
1734
  msgstr ""
1735
 
1736
+ #: admin/includes/class-settings.php:620
1737
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1738
  msgstr ""
1739
 
1740
+ #: admin/includes/class-settings.php:633
1741
  msgid "Disable shortcode button in visual editor."
1742
  msgstr ""
1743
 
1748
  "the <a href=\"%s\" target=\"_blank\">settings</a>."
1749
  msgstr ""
1750
 
1751
+ #: admin/includes/notices.php:15
1752
  msgid ""
1753
  "Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
1754
  "receive the first steps via email?"
1755
  msgstr ""
1756
 
1757
+ #: admin/includes/notices.php:16
1758
  msgid "Yes, send it"
1759
  msgstr ""
1760
 
1761
+ #: admin/includes/notices.php:22
1762
  msgid ""
1763
  "Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
1764
  "<strong>2 free add-ons</strong> for joining the newsletter."
1765
  msgstr ""
1766
 
1767
+ #: admin/includes/notices.php:23
1768
  msgid "Add me now"
1769
  msgstr ""
1770
 
1771
+ #: admin/includes/notices.php:29
1772
  msgid ""
1773
  "Learn more about how and <strong>how much you can earn with AdSense</strong> "
1774
  "and Advanced Ads from my dedicated newsletter."
1775
  msgstr ""
1776
 
1777
+ #: admin/includes/notices.php:30 admin/views/notices/inline.php:3
1778
  #: admin/views/notices/subscribe.php:3
1779
  msgid "Subscribe me now"
1780
  msgstr ""
1781
 
1782
+ #: admin/includes/notices.php:44
1783
+ msgid "… ads created using <strong>Advanced Ads</strong>."
 
1784
  msgstr ""
1785
 
1786
+ #: admin/includes/notices.php:45
1787
+ msgid ""
1788
+ "Do you find the plugin useful and would like to thank us for updates, fixing "
1789
+ "bugs and improving your ad setup?"
1790
+ msgstr ""
1791
+
1792
+ #. this belongs to our message asking the user for a review. You can find a nice equivalent in your own language
1793
+ #: admin/includes/notices.php:48
1794
+ msgid "When you give 5-stars, an actual person does a little happy dance!"
1795
  msgstr ""
1796
 
1797
  #: admin/includes/notices.php:50
1798
+ msgid "Sure, I appreciate your work"
1799
+ msgstr ""
1800
+
1801
+ #: admin/includes/notices.php:51
1802
+ msgid "Yes, but help me first to solve a problem, please"
1803
  msgstr ""
1804
 
1805
+ #: admin/includes/notices.php:60
1806
  #, php-format
1807
  msgid ""
1808
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
1811
  "Access</a>"
1812
  msgstr ""
1813
 
1814
+ #: admin/includes/notices.php:70
1815
  #, php-format
1816
  msgid ""
1817
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
2464
  msgid "I switched to another plugin"
2465
  msgstr ""
2466
 
2467
+ #: admin/views/feedback-disable.php:29
 
 
 
 
 
 
 
 
2468
  msgid "Send feedback & deactivate"
2469
  msgstr ""
2470
 
2471
+ #: admin/views/feedback-disable.php:30
2472
  msgid "Send feedback"
2473
  msgstr ""
2474
 
2475
+ #: admin/views/feedback-disable.php:32
2476
  msgid "Only Deactivate"
2477
  msgstr ""
2478
 
2479
+ #: admin/views/feedback-disable.php:35
2480
  msgid ""
2481
  "Thanks for submitting your feedback. I will reply within 24 hours on working "
2482
  "days."
2483
  msgstr ""
2484
 
2485
  #. %s is the title of the website
2486
+ #: admin/views/feedback-disable.php:40
2487
  #, php-format
2488
  msgid "All the best to you and %s."
2489
  msgstr ""
2490
 
2491
+ #: admin/views/feedback-disable.php:41
2492
  msgid "Disabling the plugin now…"
2493
  msgstr ""
2494
 
2495
  #. %s includes a number and markup like <span class="count">6</span>.
2496
+ #: admin/views/overview-notices.php:17
2497
  #, php-format
2498
  msgid "Show %s hidden"
2499
  msgstr ""
2569
  msgstr ""
2570
 
2571
  #: admin/views/placement-injection-top.php:24
2572
+ #: modules/gadsense/admin/admin.php:464
2573
  #, php-format
2574
  msgid ""
2575
  "The AdSense verification and Auto ads code is already activated in the <a "
2577
  msgstr ""
2578
 
2579
  #: admin/views/placement-injection-top.php:30
2580
+ #: modules/gadsense/admin/admin.php:466
2581
  msgid ""
2582
  "No need to add the code manually here, unless you want to include it into "
2583
  "certain pages only."
2663
  msgstr ""
2664
 
2665
  #: admin/views/placements-ad-label.php:6 admin/views/placements-ad-label.php:9
2666
+ #: modules/ads-txt/admin/views/setting-create.php:2
2667
+ #: modules/ads-txt/admin/views/setting-create.php:4
2668
  msgid "enabled"
2669
  msgstr ""
2670
 
2671
  #: admin/views/placements-ad-label.php:11
2672
  #: admin/views/placements-ad-label.php:14
2673
+ #: modules/ads-txt/admin/views/setting-create.php:6
2674
+ #: modules/ads-txt/admin/views/setting-create.php:8
2675
  msgid "disabled"
2676
  msgstr ""
2677
 
3098
  msgid "Ad blocker counter"
3099
  msgstr ""
3100
 
3101
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:162
3102
+ #, php-format
3103
+ msgid ""
3104
+ "The ads.txt file cannot be placed because the URL contains a subdirectory. "
3105
+ "You need to make the file available at %s"
3106
+ msgstr ""
3107
+
3108
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:167
3109
+ #, php-format
3110
+ msgid "The file is available on %s when it contains content to display."
3111
+ msgstr ""
3112
+
3113
+ #. %s the line that may need to be added manually
3114
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:173
3115
+ #, php-format
3116
+ msgid ""
3117
+ "If your site is located on a subdomain, you need to add the following line "
3118
+ "to the ads.txt file of the root domain: %s"
3119
+ msgstr ""
3120
+
3121
+ #: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:179
3122
+ msgid "File does not exist"
3123
+ msgstr ""
3124
+
3125
  #: modules/gadsense/admin/admin.php:135
3126
  msgid "AdSense account"
3127
  msgstr ""
3130
  msgid "Verification code & Auto ads"
3131
  msgstr ""
3132
 
3133
+ #: modules/gadsense/admin/admin.php:153
3134
+ msgid "Auto ads"
3135
+ msgstr ""
3136
+
3137
+ #: modules/gadsense/admin/admin.php:153
3138
+ msgid "Disable top anchor ad"
3139
+ msgstr ""
3140
+
3141
+ #: modules/gadsense/admin/admin.php:165
3142
  msgid "Limit to 3 ads"
3143
  msgstr ""
3144
 
3145
+ #: modules/gadsense/admin/admin.php:175
3146
  msgid "Disable violation warnings"
3147
  msgstr ""
3148
 
3149
+ #: modules/gadsense/admin/admin.php:183
3150
  msgid "Transparent background"
3151
  msgstr ""
3152
 
3153
+ #: modules/gadsense/admin/admin.php:241
3154
  #, php-format
3155
  msgid "Limit to %d AdSense ads"
3156
  msgstr ""
3157
 
3158
+ #: modules/gadsense/admin/admin.php:245
3159
  msgid ""
3160
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3161
  "this setting to prevent too many AdSense ads to show accidentally on your "
3162
  "site."
3163
  msgstr ""
3164
 
3165
+ #: modules/gadsense/admin/admin.php:249
3166
  msgid ""
3167
  "Due to technical restrictions, the limit does not work on placements with "
3168
  "cache-busting enabled."
3169
  msgstr ""
3170
 
3171
+ #: modules/gadsense/admin/admin.php:261
3172
+ msgid ""
3173
+ "Enable this box if you don’t want Google Auto ads to place anchor ads at the "
3174
+ "top of your page."
3175
+ msgstr ""
3176
+
3177
+ #: modules/gadsense/admin/admin.php:276
3178
  #: modules/gadsense/admin/views/connect-adsense.php:37
3179
  msgid ""
3180
  "Insert the AdSense header code used for verification and the Auto Ads "
3182
  msgstr ""
3183
 
3184
  #. this is the text for a link to a sub-page in an AdSense account
3185
+ #: modules/gadsense/admin/admin.php:281
3186
  msgid "Adjust Auto ads options"
3187
  msgstr ""
3188
 
3189
+ #: modules/gadsense/admin/admin.php:283
3190
  #, php-format
3191
  msgid ""
3192
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3193
  "appear in random places</strong>."
3194
  msgstr ""
3195
 
3196
+ #: modules/gadsense/admin/admin.php:284
3197
  msgid "Display Auto ads only on specific pages"
3198
  msgstr ""
3199
 
3200
+ #: modules/gadsense/admin/admin.php:285
3201
  msgid "Auto ads on AMP pages"
3202
  msgstr ""
3203
 
3204
+ #: modules/gadsense/admin/admin.php:298
3205
  msgid "Disable warnings about potential violations of the AdSense terms."
3206
  msgstr ""
3207
 
3208
+ #: modules/gadsense/admin/admin.php:299
3209
  #, php-format
3210
  msgid ""
3211
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
3213
  "managed with Advanced Ads. Enable this option to remove these checks"
3214
  msgstr ""
3215
 
3216
+ #: modules/gadsense/admin/admin.php:310
3217
  msgid ""
3218
  "Enable this option in case your theme adds an unfortunate background color "
3219
  "to AdSense ads."
3220
  msgstr ""
3221
 
3222
+ #: modules/gadsense/admin/admin.php:333
3223
  #: modules/gadsense/includes/class-ad-type-adsense.php:76
3224
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3225
  msgstr ""
3226
 
3227
+ #: modules/gadsense/admin/admin.php:355
3228
  msgid "AdSense"
3229
  msgstr ""
3230
 
3231
+ #: modules/gadsense/admin/admin.php:407
3232
  #, php-format
3233
  msgid ""
3234
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
3237
  "wrapped in text."
3238
  msgstr ""
3239
 
3240
+ #: modules/gadsense/admin/admin.php:413
3241
  #, php-format
3242
  msgid ""
3243
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3244
  "in order to place ads between posts."
3245
  msgstr ""
3246
 
3247
+ #: modules/gadsense/admin/admin.php:420
3248
  #, php-format
3249
  msgid ""
3250
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
3252
  "vertical, or rectangle formats."
3253
  msgstr ""
3254
 
3255
+ #: modules/gadsense/admin/admin.php:468
3256
  #, php-format
3257
  msgid ""
3258
  "The AdSense verification and Auto ads code should be set up in the <a "
3260
  "now."
3261
  msgstr ""
3262
 
3263
+ #: modules/gadsense/admin/admin.php:469
3264
  msgid "Activate"
3265
  msgstr ""
3266
 
3280
  msgid "Auto"
3281
  msgstr ""
3282
 
3283
+ #: modules/gadsense/includes/class-mapi.php:465
 
 
 
 
 
 
 
 
 
3284
  msgid ""
3285
  "It seems that some changes have been made in the Advanced Ads settings. "
3286
  "Please refresh this page."
3287
  msgstr ""
3288
 
3289
+ #: modules/gadsense/includes/class-mapi.php:472
3290
  #, php-format
3291
  msgid ""
3292
  "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
3293
  msgstr ""
3294
 
3295
+ #: modules/gadsense/includes/class-mapi.php:962
3296
  msgid "An error occurred while requesting account details."
3297
  msgstr ""
3298
 
3299
+ #: modules/gadsense/includes/class-mapi.php:1281
3300
  #, php-format
3301
  msgid ""
3302
  "There are one or more warnings about the currently linked AdSense account. "
3565
  "Google Analytics property ID above to count them."
3566
  msgstr ""
3567
 
3568
+ #: modules/ads-txt/admin/views/setting-additional-content.php:2
3569
+ msgid ""
3570
+ "Additional records to add to the file, one record per line. AdSense is added "
3571
+ "automatically."
3572
  msgstr ""
3573
 
3574
+ #: modules/ads-txt/admin/views/setting-check-third-party.php:2
3575
+ msgid "Check for existing ads.txt file"
3576
+ msgstr ""
3577
+
3578
+ #: modules/ads-txt/admin/views/setting-check-third-party.php:4
3579
+ #, php-format
3580
+ msgid "Another ads.txt already exists: %s"
3581
+ msgstr ""
3582
+
3583
+ #: modules/ads-txt/admin/views/setting-check-third-party.php:5
3584
+ msgid "No conflicting ads.txt file found"
3585
  msgstr ""
3586
 
3587
+ #: modules/ads-txt/admin/views/setting-create.php:19
3588
+ msgid "Generate a single ads.txt file for all sites in the multisite network."
3589
+ msgstr ""
3590
+
3591
+ #: modules/ads-txt/admin/views/setting-create.php:27
3592
  msgid ""
3593
+ "Usually, this should be enabled on the main site of the network - often the "
3594
+ "one without a subdomain or subdirectory)."
3595
  msgstr ""
3596
 
3597
+ #: modules/gadsense/admin/views/adsense-account.php:29
3598
+ msgid "AdSense warnings"
 
 
 
3599
  msgstr ""
3600
 
3601
+ #: modules/gadsense/admin/views/adsense-account.php:30
3602
+ #: modules/gadsense/admin/views/adsense-account.php:62
3603
+ msgid "dismiss"
3604
  msgstr ""
3605
 
3606
+ #: modules/gadsense/admin/views/adsense-account.php:74
3607
  msgid "Revoke API acccess"
3608
  msgstr ""
3609
 
3610
+ #: modules/gadsense/admin/views/adsense-account.php:80
3611
  msgid "Account holder name"
3612
  msgstr ""
3613
 
3614
+ #: modules/gadsense/admin/views/adsense-account.php:82
3615
  msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
3616
  msgstr ""
3617
 
3618
+ #: modules/gadsense/admin/views/adsense-account.php:88
3619
  msgid "Yes, I have an AdSense account"
3620
  msgstr ""
3621
 
3622
+ #: modules/gadsense/admin/views/adsense-account.php:90
3623
  msgid "Configure everything manually"
3624
  msgstr ""
3625
 
3626
+ #: modules/gadsense/admin/views/adsense-account.php:93
3627
  msgid "No, I still don't have an AdSense account"
3628
  msgstr ""
3629
 
3630
+ #: modules/gadsense/admin/views/adsense-account.php:94
3631
  msgid "Get a free AdSense account"
3632
  msgstr ""
3633
 
3634
  #. %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
3635
+ #: modules/gadsense/admin/views/adsense-account.php:144
3636
  #, php-format
3637
  msgid ""
3638
  "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
3639
  msgstr ""
3640
 
3641
+ #: modules/gadsense/admin/views/adsense-account.php:152
3642
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:102
3643
  msgid "Can not connect AdSense account. PHP version is too low."
3644
  msgstr ""
modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User interface for managing the 'ads.txt' file.
4
+ */
5
+ class Advanced_Ads_Ads_Txt_Admin {
6
+ /**
7
+ * AdSense network ID.
8
+ */
9
+ const adsense = 'adsense';
10
+ /**
11
+ * Constructor
12
+ *
13
+ * @param obj $strategy Advanced_Ads_Ads_Txt_Strategy.
14
+ */
15
+ public function __construct( $strategy ) {
16
+ $this->strategy = $strategy;
17
+
18
+ add_filter( 'advanced-ads-sanitize-settings', array( $this, 'toggle' ), 10, 1 );
19
+ add_action( 'update_option_advanced-ads-adsense', array( $this, 'update_adsense_option' ), 10, 2 );
20
+ add_action( 'advanced-ads-settings-init', array( $this, 'add_settings' ) );
21
+ add_action( 'wp_ajax_advads-ads-txt', array( $this, 'ajax_check_third_party_exists' ) );
22
+ }
23
+
24
+ /**
25
+ * Toggle ads.txt and add additional content.
26
+ *
27
+ * @param array $options Options.
28
+ * @return array $options Options.
29
+ */
30
+ public function toggle( $options ) {
31
+ $create = ! empty( $_POST['advads-ads-txt-create'] );
32
+ $all_network = ! empty( $_POST['advads-ads-txt-all-network'] );
33
+ $additional_content = ! empty( $_POST['advads-ads-txt-additional-content'] ) ? $_POST['advads-ads-txt-additional-content'] : '';
34
+
35
+ $this->strategy->toggle( $create, $all_network, $additional_content );
36
+ $content = $this->get_adsense_blog_data();
37
+ $this->strategy->add_network_data( self::adsense, $content );
38
+ $r = $this->strategy->save_options();
39
+
40
+ if ( is_wp_error( $r ) ) {
41
+ add_settings_error(
42
+ 'advanced-ads-adsense',
43
+ 'adsense-ads-txt-created',
44
+ $r->get_error_message(),
45
+ 'error'
46
+ );
47
+ }
48
+
49
+ return $options;
50
+ }
51
+
52
+ /**
53
+ * Update the 'ads.txt' file every time the AdSense settings are saved.
54
+ *
55
+ * @param array $prev Previous options.
56
+ * @return array $new New options.
57
+ */
58
+ public function update_adsense_option( $prev, $new ) {
59
+ $content = $this->get_adsense_blog_data( $new );
60
+ $this->strategy->add_network_data( self::adsense, $content );
61
+ $r = $this->strategy->save_options();
62
+
63
+ if ( is_wp_error( $r ) ) {
64
+ add_settings_error(
65
+ 'advanced-ads-adsense',
66
+ 'adsense-ads-txt-created',
67
+ $r->get_error_message(),
68
+ 'error'
69
+ );
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Add setting fields.
75
+ *
76
+ * @param string $hook The slug-name of the settings page.
77
+ */
78
+ public function add_settings( $hook ) {
79
+
80
+ $adsense_data = Advanced_Ads_AdSense_Data::get_instance();
81
+ $adsense_id = $adsense_data->get_adsense_id();
82
+
83
+ add_settings_section(
84
+ 'advanced_ads_ads_txt_setting_section',
85
+ 'ads.txt',
86
+ array( $this, 'render_ads_txt_section_callback' ),
87
+ $hook
88
+ );
89
+
90
+ add_settings_field(
91
+ 'adsense-ads-txt-enable',
92
+ '',
93
+ array( $this, 'render_setting_toggle' ),
94
+ $hook,
95
+ 'advanced_ads_ads_txt_setting_section'
96
+ );
97
+
98
+ add_settings_field(
99
+ 'adsense-ads-txt-content',
100
+ '',
101
+ array( $this, 'render_setting_additional_content' ),
102
+ $hook,
103
+ 'advanced_ads_ads_txt_setting_section'
104
+ );
105
+
106
+ }
107
+
108
+ public function render_ads_txt_section_callback() {
109
+ }
110
+
111
+ /**
112
+ * Render toggle settings.
113
+ */
114
+ public function render_setting_toggle() {
115
+ global $current_blog;
116
+ $domain = isset( $current_blog->domain ) ? $current_blog->domain : '';
117
+
118
+ $can_process_all_network = $this->can_process_all_network();
119
+ $is_all_network = $this->strategy->is_all_network();
120
+
121
+ $is_enabled = $this->strategy->is_enabled();
122
+ include dirname( __FILE__ ) . '/views/setting-create.php';
123
+ }
124
+
125
+ /**
126
+ * Render additional content settings.
127
+ */
128
+ public function render_setting_additional_content() {
129
+ $content = $this->strategy->get_additional_content();
130
+ $notices = $this->get_notices();
131
+ include dirname( __FILE__ ) . '/views/setting-additional-content.php';
132
+ }
133
+
134
+ /**
135
+ * Check if other sites of the network can be processed by the user.
136
+ *
137
+ * @return bool
138
+ */
139
+ private function can_process_all_network() {
140
+ return ! Advanced_Ads_Ads_Txt_Utils::is_subdir()
141
+ && is_super_admin()
142
+ && is_multisite()
143
+ && function_exists( 'is_site_meta_supported' ) && is_site_meta_supported();
144
+ }
145
+
146
+ /**
147
+ * Get notices.
148
+ *
149
+ * @return string
150
+ */
151
+ public function get_notices() {
152
+ $url = home_url( '/' );
153
+ $parsed_url = wp_parse_url( $url );
154
+ if ( ! isset( $parsed_url['scheme'] ) || ! isset ( $parsed_url['host'] ) ) {
155
+ return;
156
+ }
157
+ $notices = array();
158
+ $link = sprintf( '<a href="%1$s" target="_blank">%1$s</a>', esc_url( $url . 'ads.txt' ) );
159
+
160
+ if ( Advanced_Ads_Ads_Txt_Utils::is_subdir() ) {
161
+ $notices[] = array( 'advads-error-message', sprintf(
162
+ esc_html__( 'The ads.txt file cannot be placed because the URL contains a subdirectory. You need to make the file available at %s', 'advanced-ads' ),
163
+ sprintf( '<a href="%1$s" target="_blank">%1$s</a>', esc_url( $parsed_url['scheme'] . '://' . $parsed_url['host'] ) )
164
+ ) );
165
+ } elseif ( $this->strategy->is_enabled() ) {
166
+ $notices[] = array( '', sprintf(
167
+ esc_html__( 'The file is available on %s when it contains content to display.', 'advanced-ads' ),
168
+ $link
169
+ ) );
170
+ if ( Advanced_Ads_Ads_Txt_Utils::need_file_on_root_domain() ) {
171
+ $notices[] = array( '', sprintf(
172
+ /* translators: %s the line that may need to be added manually */
173
+ esc_html__( 'If your site is located on a subdomain, you need to add the following line to the ads.txt file of the root domain: %s', 'advanced-ads' ),
174
+ // Without http://.
175
+ '<code>subdomain=' . esc_html( $parsed_url['host'] ) . '</code>'
176
+ ) );
177
+ }
178
+ } else {
179
+ $notices[] = array( '', esc_html__( 'File does not exist', 'advanced-ads' ) );
180
+ }
181
+
182
+
183
+ $r = '<ul>';
184
+ foreach( $notices as $notice ) {
185
+ $r .= sprintf( '<li class="%s">%s</li>', $notice[0], $notice[1] );
186
+ }
187
+ $r .= '</ul>';
188
+
189
+ $tpe = Advanced_Ads_Ads_Txt_Utils::third_party_exists();
190
+ ob_start();
191
+ include dirname( __FILE__ ) . '/views/setting-check-third-party.php';
192
+ $r .= ob_get_clean();
193
+
194
+ return $r;
195
+ }
196
+
197
+
198
+ /**
199
+ * Get Adsense data.
200
+ *
201
+ * @return string
202
+ */
203
+ public function get_adsense_blog_data( $new = null ) {
204
+ if ( null === $new ) {
205
+ $new = Advanced_Ads_AdSense_Data::get_instance()->get_options();
206
+ }
207
+
208
+ $adsense_id = ! empty( $new['adsense-id'] ) ? trim( $new['adsense-id'] ) : '';
209
+ if ( ! $adsense_id ) {
210
+ return '';
211
+ }
212
+
213
+ $data = array(
214
+ 'domain' => 'google.com',
215
+ 'account_id' => $adsense_id,
216
+ 'account_type' => 'DIRECT',
217
+ 'certification_authority' => 'f08c47fec0942fa0'
218
+ );
219
+ $result = implode( ', ', $data );
220
+
221
+ return $result;
222
+ }
223
+
224
+ /**
225
+ * Check if a third-party ads.txt file exists.
226
+ */
227
+ public function ajax_check_third_party_exists() {
228
+
229
+ check_ajax_referer( 'advanced-ads-admin-ajax-nonce', 'nonce' );
230
+
231
+ if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ) {
232
+ return;
233
+ }
234
+
235
+ $r = Advanced_Ads_Ads_Txt_Utils::third_party_exists( null, true );
236
+ echo $r;
237
+ exit;
238
+ }
239
+
240
+ }
241
+
242
+
modules/ads-txt/admin/views/setting-additional-content.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <textarea cols="50" rows="5" name="advads-ads-txt-additional-content"><?php echo esc_textarea( $content ); ?></textarea>
2
+ <p class="description"><?php esc_html_e( 'Additional records to add to the file, one record per line. AdSense is added automatically.', 'advanced-ads' ); ?></p>
3
+ <p id="advads-ads-txt-result"><?php echo $notices; ?></p>
modules/ads-txt/admin/views/setting-check-third-party.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div id="advads-ads-txt-check-tp">
2
+ <button class="button" type="button" id="advads-check-ads-txt"><?php esc_html_e( 'Check for existing ads.txt file', 'advanced-ads' ); ?></button>
3
+ <span <?php if ( ! $tpe ) { echo 'style="display: none;"'; } ?> class="advads-error-message" id="advads-ads-txt-tpe"><?php
4
+ printf( esc_html__( 'Another ads.txt already exists: %s', 'advanced-ads' ), $link ); ?></span>
5
+ <span <?php if ( $tpe ) { echo 'style="display: none;"'; } ?> id="advads-ads-txt-tpne"><?php esc_html_e( 'No conflicting ads.txt file found', 'advanced-ads' ); ?></span>
6
+ <span id="advads-ads-txt-tp-error" class="advads-error-message"></span>
7
+ </div>
modules/ads-txt/admin/views/setting-create.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="general_advads-ads-txt">
2
+ <label title="<?php _e( 'enabled', 'advanced-ads' ); ?>">
3
+ <input type="radio" name="advads-ads-txt-create" value="1" <?php checked( $is_enabled, true ); ?> />
4
+ <?php _e( 'enabled', 'advanced-ads' ); ?>
5
+ </label>
6
+ <label title="<?php _e( 'disabled', 'advanced-ads' ); ?>">
7
+ <input type="radio" name="advads-ads-txt-create" value="0" <?php checked( $is_enabled, false ); ?> />
8
+ <?php _e( 'disabled', 'advanced-ads' ); ?>
9
+ </label>
10
+ &nbsp;<span class="description"><a target="_blank" href="<?php
11
+ echo ADVADS_URL . 'manual/ads-txt/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-ads-txt' ?>"><?php _e( 'Manual', 'advanced-ads' ); ?></a>
12
+ </span>
13
+
14
+ <?php if ( $can_process_all_network ) : ?>
15
+ <p>
16
+ <label><input name="advads-ads-txt-all-network" type="checkbox" <?php
17
+ checked( $is_all_network, true ); ?> />
18
+ <?php printf(
19
+ esc_html__( 'Generate a single ads.txt file for all sites in the multisite network.', 'advanced-ads' ),
20
+ '<code>abc.' . $domain . '</code>',
21
+ '<code>' . $domain . '/abc</code>'
22
+ ) ?>
23
+ </label>
24
+ </p>
25
+ <p class="description">
26
+ <?php
27
+ esc_html_e( 'Usually, this should be enabled on the main site of the network - often the one without a subdomain or subdirectory).', 'advanced-ads' );
28
+ ?>
29
+ </p>
30
+ <?php endif; ?>
31
+ </div>
modules/ads-txt/config.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module configuration.
4
+ */
5
+
6
+ $path = dirname( __FILE__ );
7
+
8
+ return array(
9
+ 'classmap' => array(
10
+ 'Advanced_Ads_Ads_Txt_Public' => $path . '/public/class-advanced-ads-ads-txt-public.php',
11
+ 'Advanced_Ads_Ads_Txt_Strategy' => $path . '/includes/class-advanced-ads-ads-txt-strategy.php',
12
+ 'Advanced_Ads_Ads_Txt_Admin' => $path . '/admin/class-advanced-ads-ads-txt-admin.php',
13
+ 'Advanced_Ads_Ads_Txt_Utils' => $path . '/includes/class-advanced-ads-ads-txt-utils.php',
14
+ ),
15
+ 'textdomain' => null,
16
+ );
modules/ads-txt/includes/class-advanced-ads-ads-txt-strategy.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage the data.
5
+ */
6
+ class Advanced_Ads_Ads_Txt_Strategy {
7
+ const OPTION = 'advanced_ads_ads_txt';
8
+
9
+ private $options;
10
+ private $changed = false;
11
+
12
+ public function __construct() {
13
+ $this->options = $this->get_options();
14
+ $this->changed = false;
15
+ }
16
+
17
+ /**
18
+ * Whether to include records from other sites of the network.
19
+ *
20
+ * @return bool
21
+ */
22
+ public function is_all_network() {
23
+ $options = $this->get_options();
24
+ return is_multisite() && $options['all_network'];
25
+ }
26
+
27
+ /**
28
+ * Is enabled.
29
+ *
30
+ * @return bool
31
+ */
32
+ public function is_enabled() {
33
+ $this->options = $this->get_options();
34
+ return $this->options['enabled'];
35
+ }
36
+
37
+ /**
38
+ * Get additional content.
39
+ *
40
+ * @return string.
41
+ */
42
+ public function get_additional_content() {
43
+ $options = $this->get_options();
44
+ return $options['custom'];
45
+ }
46
+
47
+ /**
48
+ * Toggle the file and add additional conent.
49
+ *
50
+ * @return bool.
51
+ */
52
+ public function toggle( $is_enabled, $all_network, $additional_content ) {
53
+ $prev = $this->get_options();
54
+
55
+ $additional_content = explode( "\n", $additional_content );
56
+ $additional_content = array_filter( array_map( 'trim', $additional_content ) );
57
+ $additional_content = implode( "\n", $additional_content );
58
+
59
+ $this->options['enabled'] = $is_enabled;
60
+ $this->options['all_network'] = $all_network;
61
+ $this->options['custom'] = $additional_content;
62
+
63
+ if ( $this->options !== $prev ) {
64
+ $this->changed = true;
65
+ }
66
+ return true;
67
+ }
68
+
69
+ /**
70
+ * Add ad network data.
71
+ *
72
+ * @param string $id Ad network id.
73
+ * @param string $rec A Record to add.
74
+ * @return bool
75
+ */
76
+ public function add_network_data( $id, $rec ) {
77
+ $prev = $this->get_options();
78
+
79
+ $this->options['networks'][ $id ]['rec'] = $rec;
80
+
81
+ if ( $this->options !== $prev ) {
82
+ $this->changed = true;
83
+ }
84
+ return true;
85
+
86
+ }
87
+
88
+ /**
89
+ * Prepare content of a blog for output.
90
+ *
91
+ * @param array $options Options.
92
+ * @return string
93
+ */
94
+ public function parse_content( $options ) {
95
+ $o = '';
96
+
97
+ foreach ( $options['networks'] as $_id => $data ) {
98
+ if ( ! empty( $data['rec'] ) ) {
99
+ $o .= $data['rec'] . "\n";
100
+ }
101
+ }
102
+
103
+ if ( ! empty( $options['custom'] ) ) {
104
+ $o .= $options['custom'] . "\n";
105
+ }
106
+
107
+ return $o;
108
+ }
109
+
110
+ /**
111
+ * Save options.
112
+ *
113
+ * @return bool
114
+ */
115
+ public function save_options() {
116
+ if ( ! $this->changed ) {
117
+ return true;
118
+ }
119
+
120
+ if ( is_multisite() ) {
121
+ update_site_meta(
122
+ get_current_blog_id(),
123
+ self::OPTION,
124
+ $this->options
125
+ );
126
+ } else {
127
+ update_option(
128
+ self::OPTION,
129
+ $this->options
130
+ );
131
+ }
132
+
133
+ $this->changed = false;
134
+ delete_transient( Advanced_Ads_Ads_Txt_Utils::TRANSIENT );
135
+ return true;
136
+ }
137
+
138
+ /**
139
+ * Get options.
140
+ *
141
+ * @return array
142
+ */
143
+ public function get_options() {
144
+ if ( isset( $this->options ) ) {
145
+ return $this->options;
146
+ }
147
+
148
+ if ( is_multisite() ) {
149
+ $options = get_site_meta( get_current_blog_id(), self::OPTION, true );
150
+ } else {
151
+ $options = get_option( self::OPTION );
152
+ }
153
+ $this->options = $this->load_default_options( $options );
154
+ return $this->options;
155
+ }
156
+
157
+ /**
158
+ * Load default options.
159
+ *
160
+ * @param array $options Options.
161
+ * @return array
162
+ */
163
+ public function load_default_options( $options ) {
164
+ if ( ! isset( $options['enabled'] ) ) {
165
+ $options['enabled'] = true;
166
+ }
167
+ if ( ! isset( $options['all_network'] ) ) {
168
+ $options['all_network'] = false;
169
+ }
170
+ if ( ! isset( $options['custom'] ) ) {
171
+ $options['custom'] = '';
172
+ }
173
+ if ( ! isset( $options['networks'] ) || ! is_array( $options['networks'] ) ) {
174
+ $options['networks'] = array();
175
+ }
176
+ return $options;
177
+ }
178
+
179
+ }
modules/ads-txt/includes/class-advanced-ads-ads-txt-utils.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User interface for managing the 'ads.txt' file.
4
+ */
5
+ class Advanced_Ads_Ads_Txt_Utils {
6
+ const TRANSIENT = 'advanced_ads_ads_txt_ctp';
7
+
8
+ /**
9
+ * Check if a third-party 'ads.txt' file exists.
10
+ *
11
+ * @return bool
12
+ */
13
+ public static function third_party_exists( $url = null, $force = false ) {
14
+ $url = $url ? $url : home_url( '/' );
15
+
16
+ if ( false === ( $r = get_transient( self::TRANSIENT ) ) || $force ) {
17
+ $response = wp_remote_get( trailingslashit( $url ) . 'ads.txt', array( 'timeout' => 3 ) );
18
+ $code = wp_remote_retrieve_response_code( $response );
19
+ $content = wp_remote_retrieve_body( $response );
20
+ $content_type = wp_remote_retrieve_header( $response, 'content-type' );
21
+
22
+ $r = ( ! is_wp_error( $response )
23
+ && 404 !== $code
24
+ && 'text/plain' === $content_type
25
+ && false === strpos( $content, Advanced_Ads_Ads_Txt_Public::TOP ) ) ? 'yes' : 'no';
26
+ set_transient( self::TRANSIENT, $r, WEEK_IN_SECONDS );
27
+ }
28
+
29
+ return 'yes' === $r;
30
+ }
31
+
32
+
33
+ /**
34
+ * Check if the another 'ads.txt' file should be hosted on the root domain.
35
+ *
36
+ * @return bool
37
+ */
38
+ public static function need_file_on_root_domain( $url = null ) {
39
+ $url = $url ? $url : home_url( '/' );
40
+
41
+ $parsed_url = wp_parse_url( $url );
42
+ if ( ! isset( $parsed_url['host'] ) ) {
43
+ return false;
44
+ }
45
+
46
+ $host = $parsed_url['host'];
47
+
48
+ if ( WP_Http::is_ip_address( $host ) ) {
49
+ return false;
50
+ }
51
+
52
+ $host_parts = explode( '.', $host );
53
+ $count = count( $host_parts );
54
+ if ( $count < 3 ) {
55
+ return false;
56
+ }
57
+
58
+ // Example: `http://one.{net/org/gov/edu/co}.two`.
59
+ $suffixes = array( 'net', 'org', 'gov', 'edu', 'co' );
60
+ if ( 3 === $count && in_array( $host_parts[ $count - 2 ], $suffixes, true ) ) {
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+
66
+ /**
67
+ * Check if the site is in a subdirectory, for example 'http://one.two/three'.
68
+ *
69
+ * @return bool
70
+ */
71
+ public static function is_subdir( $url = null ) {
72
+ $url = $url ? $url : home_url( '/' );
73
+
74
+ $parsed_url = wp_parse_url( $url );
75
+ if ( ! empty( $parsed_url['path'] ) && '/' !== $parsed_url['path'] ) {
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ }
modules/ads-txt/main.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Prepare content of the 'ads.txt' file.
4
+ *
5
+ * @package Advanced_Ads_Ads_Txt
6
+ */
7
+
8
+ class_exists( 'Advanced_Ads', false ) || exit();
9
+
10
+
11
+ if ( is_admin() ) {
12
+ new Advanced_Ads_Ads_Txt_Admin( new Advanced_Ads_Ads_Txt_Strategy() );
13
+ } else {
14
+ new Advanced_Ads_Ads_Txt_Public( new Advanced_Ads_Ads_Txt_Strategy() );
15
+ }
modules/ads-txt/public/class-advanced-ads-ads-txt-public.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Display the 'ads.txt' file.
4
+ */
5
+ class Advanced_Ads_Ads_Txt_Public {
6
+ const TOP = '# Advanced Ads ads.txt';
7
+
8
+ /**
9
+ * Constructor.
10
+ */
11
+ public function __construct( $strategy ) {
12
+ $this->strategy = $strategy;
13
+ add_action( 'init', array( $this, 'display' ) );
14
+ }
15
+
16
+ /**
17
+ * Display the 'ads.txt' file on the frontend.
18
+ */
19
+ public function display() {
20
+ if ( '/ads.txt' === esc_url_raw( $_SERVER['REQUEST_URI'] ) ) {
21
+ $content = $this->prepare_frontend_output();
22
+ if ( $content ) {
23
+ header( 'Content-Type: text/plain; charset=utf-8' );
24
+ echo $content;
25
+ exit;
26
+ }
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Prepare frontend output.
32
+ *
33
+ * @return string
34
+ */
35
+ public function prepare_frontend_output() {
36
+ if ( Advanced_Ads_Ads_Txt_Utils::is_subdir() ) {
37
+ return;
38
+ }
39
+ if ( ! $this->strategy->is_enabled() ) {
40
+ return;
41
+ }
42
+
43
+ if ( $this->strategy->is_all_network() ) {
44
+ $content = $this->prepare_multisite();
45
+ } else {
46
+ $options = $this->strategy->get_options();
47
+ $content = $this->strategy->parse_content( $options );
48
+ $content = apply_filters( 'advanced-ads-ads-txt-content', $content, get_current_blog_id() );
49
+ }
50
+
51
+ if ( $content ) {
52
+ $content = self::TOP . "\n" . $content;
53
+ $content = esc_html( $content );
54
+ return $content;
55
+ }
56
+
57
+ return '';
58
+ }
59
+
60
+ /**
61
+ * Prepare content of several blogs for output.
62
+ *
63
+ * @return string
64
+ */
65
+ public function prepare_multisite( $domain = null ) {
66
+ if ( ! function_exists( 'is_site_meta_supported' ) || ! is_site_meta_supported() ) {
67
+ return;
68
+ }
69
+
70
+ global $current_blog, $wpdb;
71
+ $domain = $domain ? $domain : $current_blog->domain;
72
+ $need_file_on_root_domain = Advanced_Ads_Ads_Txt_Utils::need_file_on_root_domain();
73
+
74
+ // Get all sites that include the current domain as part of their domains.
75
+ $sites = get_sites( array(
76
+ 'search' => $domain,
77
+ 'search_columns' => array( 'domain' ),
78
+ 'meta_key' => Advanced_Ads_Ads_Txt_Strategy::OPTION,
79
+ ) );
80
+
81
+ // Uses `subdomain=` variable.
82
+ $referrals = array();
83
+ // Included to the ads.txt file of the current domain.
84
+ $not_refferals = array();
85
+
86
+ foreach ( $sites as $site ) {
87
+ if ( (int) $site->blog_id === get_current_blog_id() ) {
88
+ // Current domain, no need to refer.
89
+ $not_refferals[] = $site->blog_id;
90
+ continue;
91
+ }
92
+
93
+ if ( $need_file_on_root_domain ) {
94
+ // Subdomains cannot refer to other subdomains.
95
+ $not_refferals[] = $site->blog_id;
96
+ continue;
97
+ }
98
+
99
+ if ( '/' !== $site->path ) {
100
+ // We can refer to domains, not domains plus path.
101
+ $not_refferals[] = $site->blog_id;
102
+ continue;
103
+ }
104
+
105
+ $referrals[ $site->blog_id ] = $site->domain;
106
+ }
107
+
108
+ $o = '';
109
+
110
+ if ( $not_refferals ) {
111
+ $results = $wpdb->get_results( sprintf(
112
+ "SELECT blog_id, meta_value FROM $wpdb->blogmeta WHERE meta_key='%s' AND blog_id IN (%s)",
113
+ Advanced_Ads_Ads_Txt_Strategy::OPTION,
114
+ join( ',', array_map( 'intval', $not_refferals ) )
115
+ ) );
116
+
117
+ foreach ( $results as $result ) {
118
+ $blog_id = $result->blog_id;
119
+
120
+ $options = maybe_unserialize( $result->meta_value );
121
+ $options = $this->strategy->load_default_options( $options );
122
+ $content = $this->strategy->parse_content( $options );
123
+
124
+ if ( $content ) {
125
+ $content = "# blog_id: $blog_id\n" . $content;
126
+ }
127
+
128
+ if ( $blog_id === get_current_blog_id() ) {
129
+ // Refer to other subdomains.
130
+ foreach ( $referrals as $blog_id => $referral ) {
131
+ $content .= "# refer to blog_id: $blog_id\nsubdomain=" . $referral . "\n";
132
+ }
133
+ }
134
+
135
+ $content = apply_filters( 'advanced-ads-ads-txt-content', $content, $blog_id );
136
+ $o .= $content;
137
+ }
138
+ }
139
+
140
+ return $o;
141
+ }
142
+
143
+ }
modules/gadsense/admin/admin.php CHANGED
@@ -147,6 +147,15 @@ class Advanced_Ads_AdSense_Admin {
147
  'advanced_ads_adsense_setting_section'
148
  );
149
 
 
 
 
 
 
 
 
 
 
150
  // add setting field for adsense limit
151
  // deprecated of January, 2019; will be removed one year later
152
  $limit_per_page = $this->data->get_limit_per_page();
@@ -192,17 +201,9 @@ class Advanced_Ads_AdSense_Admin {
192
  // }
193
  // hook for additional settings from add-ons
194
  do_action( 'advanced-ads-adsense-settings-init', $hook );
195
-
196
- add_settings_field(
197
- 'adsense-support',
198
- __( 'Support', 'advanced-ads' ),
199
- array( $this, 'render_settings_adsense_support' ),
200
- $hook,
201
- 'advanced_ads_adsense_setting_section'
202
- );
203
  }
204
 
205
- /**
206
  * render adsense settings section
207
  *
208
  * @since 1.5.1
@@ -249,6 +250,19 @@ class Advanced_Ads_AdSense_Admin {
249
  <?php endif;
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  /**
253
  * render page-level ads setting
254
  *
@@ -296,22 +310,6 @@ class Advanced_Ads_AdSense_Admin {
296
  <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
297
  }
298
 
299
- /**
300
- * Render support info for AdSense
301
- */
302
- public function render_settings_adsense_support() {
303
- ?><p class="advanced-ads-adsense-support"><span class="advanced-ads-adsense-support-text"><?php _e( 'Faster than the AdSense support!', 'advanced-ads' ); ?></span>
304
- <br/>
305
- <span class="dashicons dashicons-star-filled"></span>
306
- <span class="dashicons dashicons-star-filled"></span>
307
- <span class="dashicons dashicons-star-filled"></span>
308
- <span class="dashicons dashicons-star-filled"></span>
309
- <span class="dashicons dashicons-star-filled"></span>
310
- </p>
311
- <p><a href="<?php echo Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-tab-support' )?>" target="_blank"><?php
312
- _e( 'reach out for help', 'advanced-ads' ); ?></a></p><?php
313
- }
314
-
315
  /**
316
  * sanitize adsense settings
317
  *
147
  'advanced_ads_adsense_setting_section'
148
  );
149
 
150
+ // AdSense anchor ad on top of pages.
151
+ add_settings_field(
152
+ 'top_anchor_ad',
153
+ __( 'Auto ads', 'advanced-ads' ) . ':&nbsp;' . __( 'Disable top anchor ad', 'advanced-ads' ),
154
+ array( $this, 'render_settings_adsense_top_anchor_ad' ),
155
+ $hook,
156
+ 'advanced_ads_adsense_setting_section'
157
+ );
158
+
159
  // add setting field for adsense limit
160
  // deprecated of January, 2019; will be removed one year later
161
  $limit_per_page = $this->data->get_limit_per_page();
201
  // }
202
  // hook for additional settings from add-ons
203
  do_action( 'advanced-ads-adsense-settings-init', $hook );
 
 
 
 
 
 
 
 
204
  }
205
 
206
+ /**
207
  * render adsense settings section
208
  *
209
  * @since 1.5.1
250
  <?php endif;
251
  }
252
 
253
+ /**
254
+ * Render top anchor ad setting
255
+ */
256
+ public function render_settings_adsense_top_anchor_ad() {
257
+ $options = $this->data->get_options();
258
+ $anchor_ad = isset( $options['top-anchor-ad'] )? $options['top-anchor-ad'] : ''; ?>
259
+ <label>
260
+ <input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[top-anchor-ad]" value="1" <?php checked( $anchor_ad ); ?> />
261
+ <?php esc_html_e( 'Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page.', 'advanced-ads' ); ?>
262
+ </label>
263
+ <?php
264
+ }
265
+
266
  /**
267
  * render page-level ads setting
268
  *
310
  <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
311
  }
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  /**
314
  * sanitize adsense settings
315
  *
modules/gadsense/admin/assets/js/mapi-settings.js CHANGED
@@ -23,7 +23,6 @@
23
  '<a href="#" class="mapi-dismiss-alert" data-id="' + id + '">' + $div.attr( 'data-dismiss' ) + '</a>' ) );
24
  }
25
  $div.append( $ul );
26
- $div.append( $( AdsenseMAPI.errorPageLink ) );
27
  }
28
  }
29
 
@@ -129,6 +128,13 @@
129
 
130
  } );
131
 
 
 
 
 
 
 
 
132
  $( document ).on( 'advadsMapiRefreshAlerts', function ( ev, response ) {
133
  if ( 'undefined' != typeof response.status && response.status && response.alerts ) {
134
  printAlerts( response );
@@ -141,4 +147,4 @@
141
  }
142
  } );
143
 
144
- })(window.jQuery);
23
  '<a href="#" class="mapi-dismiss-alert" data-id="' + id + '">' + $div.attr( 'data-dismiss' ) + '</a>' ) );
24
  }
25
  $div.append( $ul );
 
26
  }
27
  }
28
 
128
 
129
  } );
130
 
131
+ $( document ).on( 'click', '.mapi-create-ads-txt', function( ev ) {
132
+ ev.preventDefault();
133
+
134
+ var top = jQuery( '#advads-ads-txt-wrapper' ).offset().top;
135
+ window.scrollTo( 0, top );
136
+ } );
137
+
138
  $( document ).on( 'advadsMapiRefreshAlerts', function ( ev, response ) {
139
  if ( 'undefined' != typeof response.status && response.status && response.alerts ) {
140
  printAlerts( response );
147
  }
148
  } );
149
 
150
+ })(window.jQuery);
modules/gadsense/admin/views/adsense-account.php CHANGED
@@ -31,23 +31,7 @@ $alerts_dismiss = __( 'dismiss', 'advanced-ads' );
31
 
32
  $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages();
33
 
34
- $alerts_advads_messages = array(
35
- 'ALERT_TYPE_ADS_TXT_UNAUTHORIZED' => __( 'One of your sites is missing the AdSense publisher ID in the ads.txt file.', 'advanced-ads' ),
36
- );
37
-
38
- ob_start();
39
-
40
- echo '<p style="font-weight:normal">';
41
- $first_alert_code = isset( $alerts['items'] ) && count( $alerts['items'] ) ? '-' . $alerts['items'][ key( $alerts['items'] ) ]["id"] : '';
42
- printf(
43
- // translators: %1$s is a starting link, %2$s is the end
44
- esc_attr__( 'Learn more about AdSense account issues %1$shere%2$s', 'advanced-ads' ),
45
- '<a href="' . ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error'. $first_alert_code .'" target="_blank">',
46
- '</a>'
47
- );
48
- echo '</p>';
49
-
50
- $adsense_error_page_link = ob_get_clean();
51
 
52
  ?>
53
  <div id="mapi-account-alerts" data-heading="<?php echo esc_attr( $alerts_heading ); ?>" data-dismiss="<?php echo esc_attr( $alerts_dismiss ); ?>">
@@ -56,40 +40,28 @@ $adsense_error_page_link = ob_get_clean();
56
  <ul>
57
  <?php foreach( $alerts['items'] as $alert_id => $alert ) : ?>
58
  <?php if ( isset( $alerts_advads_messages[ $alert['id'] ] ) ) : ?>
59
- <li><?php echo esc_html( $alerts_advads_messages[ $alert['id'] ] ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
60
  <?php else : ?>
61
- <li><?php echo esc_html( $alert['message'] ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
62
  <?php endif; ?>
63
  <?php endforeach; ?>
64
  </ul>
65
- <?php echo $adsense_error_page_link; ?>
66
  <?php endif; ?>
67
  </div>
68
  <div id="mapi-connect-errors">
69
  <?php if ( !empty( $mapi_options['connect_error'] ) ) {
70
 
71
  echo '<p>';
72
- esc_attr_e( 'Last AdSense account connection attempt failed.', 'advanced-ads' );
73
-
74
  if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
75
- echo ' ' . $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
76
  } else {
77
- echo ' ' . $connection_error_messages[ $mapi_options['connect_error']['message'] ];
78
  }
79
  echo '<i id="dissmiss-connect-error" class="dashicons dashicons-dismiss align';
80
  echo is_rtl()? 'left' : 'right';
81
  echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
82
  echo '</p>';
83
 
84
- echo '<p>';
85
- $alert_code = isset( $mapi_options['connect_error']['reason'] ) ? '-' . $mapi_options['connect_error']['reason'] : '';
86
- printf(
87
- // translators: %1$s is a starting link, %2$s is the end
88
- esc_attr__( 'Learn more about AdSense account issues %1$shere%2$s', 'advanced-ads' ),
89
- '<a href="' . ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error'. $alert_code . '" target="_blank">',
90
- '</a>'
91
- );
92
- echo '</p>';
93
  }
94
  ?>
95
  </div>
@@ -191,7 +163,6 @@ printf(__( 'Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%
191
  AdsenseMAPI = {};
192
  }
193
  AdsenseMAPI.alertsMsg = <?php echo json_encode( $alerts_advads_messages ) ?>;
194
- AdsenseMAPI.errorPageLink = '<?php echo $adsense_error_page_link; ?>';
195
  </script>
196
  <style type="text/css">
197
  #adsense {
31
 
32
  $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages();
33
 
34
+ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ?>
37
  <div id="mapi-account-alerts" data-heading="<?php echo esc_attr( $alerts_heading ); ?>" data-dismiss="<?php echo esc_attr( $alerts_dismiss ); ?>">
40
  <ul>
41
  <?php foreach( $alerts['items'] as $alert_id => $alert ) : ?>
42
  <?php if ( isset( $alerts_advads_messages[ $alert['id'] ] ) ) : ?>
43
+ <li><?php echo wp_kses( $alerts_advads_messages[ $alert['id'] ], array( 'a' => array( 'href' => true, 'target' => true ) ) ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
44
  <?php else : ?>
45
+ <li><?php echo wp_kses( $alert['message'], array( 'a' => array( 'href' => true, 'target' => true ) ) ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
46
  <?php endif; ?>
47
  <?php endforeach; ?>
48
  </ul>
 
49
  <?php endif; ?>
50
  </div>
51
  <div id="mapi-connect-errors">
52
  <?php if ( !empty( $mapi_options['connect_error'] ) ) {
53
 
54
  echo '<p>';
 
 
55
  if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
56
+ echo $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
57
  } else {
58
+ echo $connection_error_messages[ $mapi_options['connect_error']['message'] ];
59
  }
60
  echo '<i id="dissmiss-connect-error" class="dashicons dashicons-dismiss align';
61
  echo is_rtl()? 'left' : 'right';
62
  echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
63
  echo '</p>';
64
 
 
 
 
 
 
 
 
 
 
65
  }
66
  ?>
67
  </div>
163
  AdsenseMAPI = {};
164
  }
165
  AdsenseMAPI.alertsMsg = <?php echo json_encode( $alerts_advads_messages ) ?>;
 
166
  </script>
167
  <style type="text/css">
168
  #adsense {
modules/gadsense/includes/class-gadsense-data.php CHANGED
@@ -17,7 +17,7 @@ class Advanced_Ads_AdSense_Data {
17
  // starting version 1.7.9, the default limit setting was changed from true to false due to AdSense policy change
18
  $options['limit-per-page'] = false;
19
 
20
- update_option(GADSENSE_OPT_NAME, $options);
21
  }
22
 
23
  if (!isset($options['limit-per-page'])) {
17
  // starting version 1.7.9, the default limit setting was changed from true to false due to AdSense policy change
18
  $options['limit-per-page'] = false;
19
 
20
+ update_option( 'GADSENSE_OPT_NAME', $options);
21
  }
22
 
23
  if (!isset($options['limit-per-page'])) {
modules/gadsense/includes/class-mapi.php CHANGED
@@ -15,8 +15,6 @@ class Advanced_Ads_AdSense_MAPI {
15
 
16
  private static $instance = null;
17
 
18
- private static $connect_error_messages = array();
19
-
20
  private static $default_options = array();
21
 
22
  private static $empty_account_data = array(
@@ -66,18 +64,98 @@ class Advanced_Ads_AdSense_MAPI {
66
  'connect_error' => array(),
67
  );
68
 
69
- self::$connect_error_messages = array(
70
- 'disapprovedAccount' => __( 'Your account was not approved by AdSense.', 'advanced-ads' ),
71
- 'noAdSenseAccount' => sprintf(
72
- __( 'Create a new AdSense account %1$shere%2$s.', 'advanced-ads' ),
73
- '<a href="https://www.google.com/adsense/start/?utm_source=AdvancedAdsPlugIn&utm_medium=partnerships&utm_campaign=AdvancedAdsPartner" target="_blank">',
74
- '</a>'
75
- ),
76
- );
77
-
78
  add_filter( 'advanced-ads-support-messages', array( 'Advanced_Ads_AdSense_MAPI', 'adsense_warnings_check' ) );
 
 
 
79
  }
80
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Discard account connection error
83
  */
@@ -250,6 +328,8 @@ class Advanced_Ads_AdSense_MAPI {
250
  'Authorization' => 'Bearer ' . $access_token,
251
  );
252
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
 
 
253
  if ( is_wp_error( $response ) ) {
254
  return array(
255
  'status' => false,
@@ -311,6 +391,8 @@ class Advanced_Ads_AdSense_MAPI {
311
  'Authorization' => 'Bearer ' . $access_token,
312
  );
313
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
 
 
314
  if ( is_wp_error( $response ) ) {
315
  return array(
316
  'status' => false,
@@ -424,6 +506,8 @@ class Advanced_Ads_AdSense_MAPI {
424
  );
425
 
426
  $response = wp_remote_post( $url, $args );
 
 
427
  if ( is_wp_error( $response ) ) {
428
  return array(
429
  'status' => false,
@@ -478,6 +562,9 @@ class Advanced_Ads_AdSense_MAPI {
478
  );
479
 
480
  $response = wp_remote_post( $url, $args );
 
 
 
481
  if ( is_wp_error( $response ) ) {
482
  echo json_encode( array( 'status' => false ) );
483
  } else {
@@ -586,6 +673,7 @@ class Advanced_Ads_AdSense_MAPI {
586
  // the alert exists.
587
  if ( isset( $options['accounts'][ $account ]['alerts']['items'][ $id ] ) ) {
588
  unset( $options['accounts'][ $account ]['alerts']['items'][ $id ] );
 
589
  update_option( self::OPTNAME, $options );
590
  $items = $options['accounts'][ $account ]['alerts']['items'];
591
  }
@@ -621,6 +709,8 @@ class Advanced_Ads_AdSense_MAPI {
621
  );
622
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
623
 
 
 
624
  // the HTTP response is not an error.
625
  if ( ! is_wp_error( $response ) ) {
626
  $alerts = json_decode( $response['body'], true );
@@ -632,10 +722,11 @@ class Advanced_Ads_AdSense_MAPI {
632
  foreach ( $alerts['items'] as $item ) {
633
  // Do not store alerts of type "INFO".
634
  if ( 0 != strcasecmp( $item['severity'], 'INFO' ) ) {
635
- $items[ wp_generate_password( 6,false ) ] = $item;
636
  }
637
  }
638
  }
 
639
  $alerts_array = array(
640
  'items' => $items ,
641
  'lastCheck' => time(),
@@ -812,6 +903,9 @@ class Advanced_Ads_AdSense_MAPI {
812
 
813
  $headers = array( 'Authorization' => 'Bearer ' . $token_data['access_token'] );
814
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
 
 
 
815
  if ( is_wp_error( $response ) ) {
816
 
817
  header( 'Content-Type: application/json' );
@@ -931,6 +1025,8 @@ class Advanced_Ads_AdSense_MAPI {
931
 
932
  $response = wp_remote_post( $code_url, $args );
933
 
 
 
934
  if ( is_wp_error( $response ) ) {
935
  return json_encode(
936
  array(
@@ -992,7 +1088,7 @@ class Advanced_Ads_AdSense_MAPI {
992
  }
993
  if ( $has_token && is_array( $alerts ) && isset( $alerts['lastCheck'] ) ) {
994
  // check weekly for alerts.
995
- if ( time() > absint( $alerts['lastCheck'] ) + 3600 *24 * 7 ) {
996
  $refresh_alerts = true;
997
  }
998
  }
@@ -1031,6 +1127,15 @@ class Advanced_Ads_AdSense_MAPI {
1031
  }
1032
  }
1033
 
 
 
 
 
 
 
 
 
 
1034
  /**
1035
  * Sort ad units list alphabetically
1036
  */
@@ -1191,11 +1296,52 @@ class Advanced_Ads_AdSense_MAPI {
1191
  return $options + self::$default_options;
1192
  }
1193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
  /**
1195
  * Get custom account connection error message list.
1196
  */
1197
  public static function get_connect_error_messages() {
1198
- return self::$connect_error_messages;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1199
  }
1200
 
1201
  public static function get_instance() {
15
 
16
  private static $instance = null;
17
 
 
 
18
  private static $default_options = array();
19
 
20
  private static $empty_account_data = array(
64
  'connect_error' => array(),
65
  );
66
 
 
 
 
 
 
 
 
 
 
67
  add_filter( 'advanced-ads-support-messages', array( 'Advanced_Ads_AdSense_MAPI', 'adsense_warnings_check' ) );
68
+
69
+ add_action( 'wp_loaded', array( $this, 'update_ad_health_notices' ) );
70
+
71
  }
72
+
73
+ /**
74
+ * Update all MAPI related notices.
75
+ */
76
+ public function update_ad_health_notices() {
77
+ $mapi_options = self::get_option();
78
+
79
+ $connection_error_messages = self::get_connect_error_messages();
80
+
81
+ $health_class = Advanced_Ads_Ad_Health_Notices::get_instance();
82
+
83
+ // Last connection failed.
84
+ if ( isset ( $mapi_options['connect_error'] ) && ! empty( $mapi_options['connect_error'] ) ) {
85
+
86
+ if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
87
+ $health_class->add( 'adsense_connect_' . $mapi_options['connect_error']['reason'] );
88
+ } else {
89
+ $health_class->add( 'adsense_connect_' . $mapi_options['connect_error']['reason'], array(
90
+ 'text' => __( 'Last AdSense account connection attempt failed.', 'advanced-ads' ) . ' ' . $mapi_options['connect_error']['message'],
91
+ 'type' => 'problem',
92
+ ) );
93
+ }
94
+
95
+ foreach( $health_class->notices as $key => $value ) {
96
+ // There was already a connection error but the user tried again and obtained another error.
97
+ if ( false !== stripos( $key, 'adsense_connect_' ) && 'adsense_connect_' . $mapi_options['connect_error']['reason'] !== $key ) {
98
+ $health_class->remove( $key );
99
+ }
100
+ }
101
+
102
+ } else {
103
+
104
+ // Once a connection has been established (or a the warning has been discarded on the AA settings page), remove connection related notices.
105
+ foreach( $health_class->notices as $key => $value ) {
106
+ if ( false !== stripos( $key, 'adsense_connect_' ) ) {
107
+ $health_class->remove( $key );
108
+ }
109
+ }
110
+
111
+ }
112
+
113
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
114
+ $adsense_id = $gadsense_data->get_adsense_id();
115
+
116
+ $alerts = Advanced_Ads_AdSense_MAPI::get_stored_account_alerts( $adsense_id );
117
+
118
+ // AdSense account alerts (can not happens simultaneously with the connection error).
119
+ if ( is_array( $alerts ) && isset( $alerts['items'] ) && is_array( $alerts['items'] ) && $alerts['items'] ) {
120
+
121
+ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages();
122
+ $item_ids = array();
123
+
124
+ foreach ( $alerts['items'] as $internal_id => $item ) {
125
+ $item_ids[] = $item['id'];
126
+ if ( isset( $alerts_advads_messages[ $item['id'] ] ) ) {
127
+ $health_class->add( 'adsense_alert_' . $item['id'] );
128
+ } else {
129
+ $health_class->add( 'adsense_alert_' . $item['id'], array( 'text' => $item['message'] . ' ' . self::get_adsense_error_link( $item['id'] ), 'type' => 'problem' ) );
130
+ }
131
+
132
+ }
133
+
134
+ // Remove notices that no more exist in the AdSense account (or have been dismissed).
135
+ $_remove_ids = array();
136
+ foreach( $health_class->notices as $key => $value ) {
137
+ if ( false !== stripos( $key, 'adsense_alert_' ) ) {
138
+ $alert_id = substr( $key, strlen( 'adsense_alert_' ) );
139
+ if ( ! in_array( $alert_id, $item_ids, true ) ) {
140
+ $_remove_ids[] = $key;
141
+ }
142
+ }
143
+ }
144
+ foreach( $_remove_ids as $id ) {
145
+ $health_class->remove( $id );
146
+ }
147
+
148
+ } else {
149
+ // No more alerts.
150
+ foreach( $health_class->notices as $key => $value ) {
151
+ if ( false !== stripos( $key, 'adsense_alert_' ) ) {
152
+ $health_class->remove( $key );
153
+ }
154
+ }
155
+
156
+ }
157
+ }
158
+
159
  /**
160
  * Discard account connection error
161
  */
328
  'Authorization' => 'Bearer ' . $access_token,
329
  );
330
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
331
+ $this->log( 'Get ad code for ad Unit [' . $adUnit . ']' );
332
+
333
  if ( is_wp_error( $response ) ) {
334
  return array(
335
  'status' => false,
391
  'Authorization' => 'Bearer ' . $access_token,
392
  );
393
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
394
+ $this->log( 'Get ad units list for ca-' . $account );
395
+
396
  if ( is_wp_error( $response ) ) {
397
  return array(
398
  'status' => false,
506
  );
507
 
508
  $response = wp_remote_post( $url, $args );
509
+ $this->log( 'Refresh access token' );
510
+
511
  if ( is_wp_error( $response ) ) {
512
  return array(
513
  'status' => false,
562
  );
563
 
564
  $response = wp_remote_post( $url, $args );
565
+
566
+ $this->log( 'Revoke API access for ca-' . $adsense_id );
567
+
568
  if ( is_wp_error( $response ) ) {
569
  echo json_encode( array( 'status' => false ) );
570
  } else {
673
  // the alert exists.
674
  if ( isset( $options['accounts'][ $account ]['alerts']['items'][ $id ] ) ) {
675
  unset( $options['accounts'][ $account ]['alerts']['items'][ $id ] );
676
+
677
  update_option( self::OPTNAME, $options );
678
  $items = $options['accounts'][ $account ]['alerts']['items'];
679
  }
709
  );
710
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
711
 
712
+ $this->log( 'Get AdSense alerts for ' . $account );
713
+
714
  // the HTTP response is not an error.
715
  if ( ! is_wp_error( $response ) ) {
716
  $alerts = json_decode( $response['body'], true );
722
  foreach ( $alerts['items'] as $item ) {
723
  // Do not store alerts of type "INFO".
724
  if ( 0 != strcasecmp( $item['severity'], 'INFO' ) ) {
725
+ $items[ wp_generate_password( 6, false ) ] = $item;
726
  }
727
  }
728
  }
729
+
730
  $alerts_array = array(
731
  'items' => $items ,
732
  'lastCheck' => time(),
903
 
904
  $headers = array( 'Authorization' => 'Bearer ' . $token_data['access_token'] );
905
  $response = wp_remote_get( $url, array( 'headers' => $headers ) );
906
+
907
+ $this->log( 'Get account details from new access token' );
908
+
909
  if ( is_wp_error( $response ) ) {
910
 
911
  header( 'Content-Type: application/json' );
1025
 
1026
  $response = wp_remote_post( $code_url, $args );
1027
 
1028
+ $this->log( 'Confirm authorization code' );
1029
+
1030
  if ( is_wp_error( $response ) ) {
1031
  return json_encode(
1032
  array(
1088
  }
1089
  if ( $has_token && is_array( $alerts ) && isset( $alerts['lastCheck'] ) ) {
1090
  // check weekly for alerts.
1091
+ if ( time() > absint( $alerts['lastCheck'] ) + 3600 * 24 * 7 ) {
1092
  $refresh_alerts = true;
1093
  }
1094
  }
1127
  }
1128
  }
1129
 
1130
+ public function log( $task = 'No task provided' ) {
1131
+ if ( ! defined( 'ADVANCED_ADS_LOG_ADSENSE_API' ) || ! ADVANCED_ADS_LOG_ADSENSE_API ) {
1132
+ return;
1133
+ }
1134
+
1135
+ $message = date_i18n( '[Y-m-d H:i:s]' ) . ' ' . $task . "\n";
1136
+ error_log( $message, 3, WP_CONTENT_DIR . '/advanced-ads-google-api-requests.log' );
1137
+ }
1138
+
1139
  /**
1140
  * Sort ad units list alphabetically
1141
  */
1296
  return $options + self::$default_options;
1297
  }
1298
 
1299
+ /**
1300
+ * Get the URL to the AdSense error page
1301
+ *
1302
+ * @param string $code Add the error code to the URL.
1303
+ *
1304
+ * @return string The entire text with the url.
1305
+ */
1306
+ public static function get_adsense_error_link( $code = '' ) {
1307
+ if ( ! empty( $code ) ) {
1308
+ $code = '-' . $code;
1309
+ }
1310
+ $link = sprintf(
1311
+ // translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
1312
+ esc_attr__( 'Learn more about AdSense account issues %1$shere%2$s.', 'advanced-ads' ),
1313
+ '<a href="' . ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error'. $code .'" target="_blank">',
1314
+ '</a>'
1315
+ );
1316
+ return $link;
1317
+ }
1318
+
1319
  /**
1320
  * Get custom account connection error message list.
1321
  */
1322
  public static function get_connect_error_messages() {
1323
+ $health_class = Advanced_Ads_Ad_Health_Notices::get_instance();
1324
+ $messages = array();
1325
+ foreach( $health_class->default_notices as $key => $value ) {
1326
+ if ( 0 === strpos( $key, 'adsense_connect_' ) ) {
1327
+ $messages[ substr( $key, strlen( 'adsense_connect_' ) ) ] = $value['text'];
1328
+ }
1329
+ }
1330
+ return $messages;
1331
+ }
1332
+
1333
+ /**
1334
+ * Get custom messages for AdSense alerts.
1335
+ */
1336
+ public static function get_adsense_alert_messages() {
1337
+ $health_class = Advanced_Ads_Ad_Health_Notices::get_instance();
1338
+ $messages = array();
1339
+ foreach( $health_class->default_notices as $key => $value ) {
1340
+ if ( 0 === strpos( $key, 'adsense_alert_' ) ) {
1341
+ $messages[ substr( $key, strlen( 'adsense_alert_' ) ) ] = $value['text'];
1342
+ }
1343
+ }
1344
+ return $messages;
1345
  }
1346
 
1347
  public static function get_instance() {
modules/gadsense/public/templates/page-level.php CHANGED
@@ -1,30 +1,35 @@
1
- <?php if ( ! $privacy_enabled ) : ?>
2
- <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
3
- <script>
4
- (adsbygoogle = window.adsbygoogle || []).push({
5
- google_ad_client: "<?php echo $client_id; ?>",
6
- enable_page_level_ads: true
7
- });
 
 
8
  </script>
9
  <?php else: ?>
10
- <script>
11
- // Wait until 'advads.privacy' is available.
12
- ( window.advanced_ads_ready || jQuery( document ).ready ).call( null, function() {
13
- var npa_enabled = <?php echo $npa_enabled ? 1 : 0; ?>;
14
- if ( npa_enabled
15
- || ( advads.privacy && advads.privacy.get_state() !== 'unknown' )
16
- ) {
17
- var script = document.createElement( 'script' );
18
- script.async=1;
19
- script.src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
20
- var first = document.getElementsByTagName( 'script' )[0];
21
- first.parentNode.insertBefore( script, first );
22
 
23
- (adsbygoogle = window.adsbygoogle || []).push({
24
- google_ad_client: "<?php echo $client_id; ?>",
25
- enable_page_level_ads: true
26
- });
27
- }
28
- } );
29
- </script>
 
 
 
30
  <?php endif ?>
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,
6
+ <?php if ( isset( $options['top-anchor-ad'] ) && $options['top-anchor-ad'] ) : ?>
7
+ overlays: {bottom: true},
8
+ <?php endif; ?>
9
+ });
10
  </script>
11
  <?php else: ?>
12
+ <script>
13
+ // Wait until 'advads.privacy' is available.
14
+ (window.advanced_ads_ready || jQuery(document).ready).call(null, function () {
15
+ var npa_enabled = <?php echo $npa_enabled ? 1 : 0; ?>;
16
+ if (npa_enabled
17
+ || (advads.privacy && advads.privacy.get_state() !== 'unknown')
18
+ ) {
19
+ var script = document.createElement('script');
20
+ script.async = 1;
21
+ script.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
22
+ var first = document.getElementsByTagName('script')[0];
23
+ first.parentNode.insertBefore(script, first);
24
 
25
+ (adsbygoogle = window.adsbygoogle || []).push({
26
+ google_ad_client: "<?php echo $client_id; ?>",
27
+ enable_page_level_ads: true,
28
+ <?php if ( isset( $options['top-anchor-ad'] ) && $options['top-anchor-ad'] ) : ?>
29
+ overlays: {bottom: true},
30
+ <?php endif; ?>
31
+ });
32
+ }
33
+ });
34
+ </script>
35
  <?php endif ?>
public/class-advanced-ads.php CHANGED
@@ -426,10 +426,15 @@ class Advanced_Ads {
426
 
427
  // Check if ads are disabled in secondary queries.
428
  if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
 
429
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
430
- // This function was called by ajax (in secondary query).
431
  return $content;
432
  }
 
 
 
 
 
433
  if ( $this->has_many_the_content() ) {
434
  return $content;
435
  }
426
 
427
  // Check if ads are disabled in secondary queries.
428
  if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
429
+ // this function was called by ajax (in secondary query).
430
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
 
431
  return $content;
432
  }
433
+ // get out of wp_router_page post type if ads are disabled in secondary queries.
434
+ if ( 'wp_router_page' === get_post_type() ) {
435
+ return $content;
436
+ }
437
+
438
  if ( $this->has_many_the_content() ) {
439
  return $content;
440
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
5
  Requires at least: 4.6
6
  Tested up to: 5.1
7
  Requires PHP: 5.4
8
- Stable tag: 1.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,6 +19,7 @@ Are you looking for a simple ad manager plugin? These are the top arguments to u
19
  * Google AdSense Partner
20
  * most features to test and optimize ads
21
  * unlimited ad units
 
22
  * dedicated Gutenberg block for ads
23
  * works with all ad types and networks (e.g. Google AdSense, Google Ad Manager, or Amazon ads)
24
  * the only solution with *Ad Health* integration and Google AdSense violation checks
@@ -113,11 +114,18 @@ Amazing features of the most powerful and easy Google AdSense plugin.
113
  * change type and sizes of an ad without going into your Google AdSense account
114
  * hide Google AdSense advertisements on 404 pages by default (to comply with Google AdSense terms)
115
  * insert Google AdSense code for verification and AdSense Auto Ads (previously called Page-Level ads and QuickStart)
 
116
  * easy Ad Health integration and Google AdSense violation checks
117
  * option to make the Google AdSense background transparent
118
  * place Google AdSense In-feed ads using the also free [In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
119
  * assistant for exact sizes of responsive Google AdSense code with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
120
  * convert Google AdSense ads into AMP ads automatically with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
 
 
 
 
 
 
121
 
122
  https://vimeo.com/299410390
123
 
@@ -131,7 +139,7 @@ Learn more on the [plugin homepage](https://wpadvancedads.com).
131
 
132
  Thank you for motivating us with your [positive review](https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post).
133
 
134
- Localizations: Czech, Dutch, English, French, German, Italian, Japanese, Norwegian, Portuguese, Slovak, Spanish, Turkish, Vietnamese
135
 
136
  > <strong>Add-Ons</strong>
137
  >
@@ -257,7 +265,8 @@ Read more about ad blockers and the features Advanced Ads has to deal with them
257
 
258
  = Does the plugin support an ads.txt? =
259
 
260
- Google AdSense and some other networks ask you to provide an ads.txt. You can create and integrate this file easily with [this plugin](https://wordpress.org/plugins/ads-txt/).
 
261
 
262
  = I am a developer. Can I customize the plugin? =
263
 
@@ -277,6 +286,18 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
277
 
278
  == Changelog ==
279
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  = 1.12 =
281
 
282
  * new ad health notification logic in WP Admin to show notifications and critical issues at one place
5
  Requires at least: 4.6
6
  Tested up to: 5.1
7
  Requires PHP: 5.4
8
+ Stable tag: 1.13
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
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
114
  * change type and sizes of an ad without going into your Google AdSense account
115
  * hide Google AdSense advertisements on 404 pages by default (to comply with Google AdSense terms)
116
  * insert Google AdSense code for verification and AdSense Auto Ads (previously called Page-Level ads and QuickStart)
117
+ * disable Google Auto ads anchor ads at the top of the page
118
  * easy Ad Health integration and Google AdSense violation checks
119
  * option to make the Google AdSense background transparent
120
  * place Google AdSense In-feed ads using the also free [In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
121
  * assistant for exact sizes of responsive Google AdSense code with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
122
  * convert Google AdSense ads into AMP ads automatically with the [Responsive add-on](https://wpadvancedads.com/add-ons/responsive-ads/)
123
+ * ads.txt generated with the correct AdSense information automatically
124
+
125
+ = ads.txt =
126
+
127
+ * generates ads.txt with custom content
128
+ * adds the content for AdSense to the ads.txt automatically
129
 
130
  https://vimeo.com/299410390
131
 
139
 
140
  Thank you for motivating us with your [positive review](https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post).
141
 
142
+ Localizations: Czech, Dutch, English, French, German, Italian, Japanese, Norwegian, Portuguese, Slovak, Spanish, Turkish, Vietnamese, Polish
143
 
144
  > <strong>Add-Ons</strong>
145
  >
265
 
266
  = Does the plugin support an ads.txt? =
267
 
268
+ Google AdSense and some other networks ask you to provide an ads.txt.
269
+ Advanced Ads can create that file automatically with the correct information for AdSense, when you enable the ads.txt feature in Advanced Ads > Settings > General > ads.txt and enter your AdSense publisher ID in Advanced Ads > Settings > AdSense.
270
 
271
  = I am a developer. Can I customize the plugin? =
272
 
286
 
287
  == Changelog ==
288
 
289
+ = 1.13 =
290
+
291
+ * added support for 'ads.txt'
292
+ * added option to disable Google Auto ads anchor ads at the top of the page
293
+ * prevented attachment content from being shown next to Rich Content ads on attachment pages
294
+ * allow to hide "Ads are disabled" warning
295
+ * added AdSense connection errors to notifications
296
+ * remove hidden notices if resolved
297
+ * load notices box without JavaScript
298
+ * stop content injection into wp_router pages when ads are disabled on secondary queries
299
+ * introduced `advanced-ads-max-ad-weight` filter to allow manipulating the available ad weight
300
+
301
  = 1.12 =
302
 
303
  * new ad health notification logic in WP Admin to show notifications and critical issues at one place