Advanced Ads - Version 1.14.8

Version Description

  • replaced AdSense with dummy ads on Customizer and Elementor preview pages to prevent issues
  • make text fields in Advanced Ads settings fully resizable
  • removed unneeded ads.txt warning on com.br domains
Download this release

Release Info

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

Code changes from version 1.14.7 to 1.14.8

admin/assets/css/admin.css CHANGED
@@ -364,6 +364,7 @@ tr:hover .on-hover { display: block; }
364
  .advads-tab-sub-menu ul li + li a { padding-left: 0.5em; }
365
  #advads-settings-hide-by-user-role { -webkit-columns: 200px 5; /* Chrome, Safari, Opera */ -moz-columns: 200px 5; /* Firefox */ columns: 200px 5; column-gap: 10px; }
366
  #advads-settings-hide-by-user-role label { display: block; }
 
367
 
368
  /**
369
  - SUPPORT PAGE
364
  .advads-tab-sub-menu ul li + li a { padding-left: 0.5em; }
365
  #advads-settings-hide-by-user-role { -webkit-columns: 200px 5; /* Chrome, Safari, Opera */ -moz-columns: 200px 5; /* Firefox */ columns: 200px 5; column-gap: 10px; }
366
  #advads-settings-hide-by-user-role label { display: block; }
367
+ .advads-settings-tab-main-form textarea { resize: both; }
368
 
369
  /**
370
  - SUPPORT PAGE
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.14.7
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.14.7' );
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.14.8
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.14.8' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/utils.php CHANGED
@@ -154,5 +154,51 @@ class Advanced_Ads_Utils {
154
 
155
  return array_unique( $roles );
156
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
  ?>
154
 
155
  return array_unique( $roles );
156
  }
157
+
158
+ /**
159
+ * Check if the page is loaded in an iframe.
160
+ *
161
+ * @return bool
162
+ */
163
+ public static function is_iframe() {
164
+ if ( is_customize_preview() ) {
165
+ return true;
166
+ }
167
+
168
+ if ( self::is_elementor_preview() ) {
169
+ return true;
170
+ }
171
+
172
+ return false;
173
+ }
174
+
175
+ /**
176
+ * Check if the Elementor preview mode is used.
177
+ *
178
+ * @return bool
179
+ */
180
+ public static function is_elementor_preview() {
181
+ if ( class_exists( '\Elementor\Plugin' ) && class_exists( '\Elementor\Preview' ) ) {
182
+ try {
183
+ $refl_plugin = new ReflectionClass( '\Elementor\Plugin' );
184
+
185
+ if ( $refl_plugin->hasMethod( 'instance' ) ) {
186
+ $refl_instance_method = $refl_plugin->getMethod( 'instance' );
187
+
188
+ if ( $refl_instance_method->isPublic() && $refl_instance_method->isStatic() && $refl_plugin->hasProperty( 'preview' ) ) {
189
+ $preview_property = new ReflectionProperty( '\Elementor\Plugin', 'preview' );
190
+
191
+ if ( $preview_property->isPublic() && ! $preview_property->isStatic() ) {
192
+ if ( method_exists( '\Elementor\Preview', 'is_preview_mode' ) ) {
193
+ return \Elementor\Plugin::$instance->preview->is_preview_mode();
194
+ }
195
+ }
196
+ }
197
+ }
198
+ } catch ( Exception $e ) {
199
+ }
200
+ }
201
+ return false;
202
+ }
203
  }
204
  ?>
modules/ads-txt/includes/class-advanced-ads-ads-txt-utils.php CHANGED
@@ -73,7 +73,7 @@ class Advanced_Ads_Ads_Txt_Utils {
73
 
74
  // Example: `one.com.au'.
75
  $suffix_and_tld = implode( '.', array_slice( $host_parts, 1 ) );
76
- if ( $suffix_and_tld == 'com.au' ) {
77
  return false;
78
  }
79
 
73
 
74
  // Example: `one.com.au'.
75
  $suffix_and_tld = implode( '.', array_slice( $host_parts, 1 ) );
76
+ if ( in_array( $suffix_and_tld, array( 'com.au', 'com.br' ) ) ) {
77
  return false;
78
  }
79
 
modules/gadsense/includes/class-ad-type-adsense.php CHANGED
@@ -160,13 +160,13 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
160
  }
161
 
162
  /**
163
- * prepare the ads frontend output
164
  *
165
- * @param obj $ad ad object
166
- * @return str $content ad content prepared for frontend output
167
  * @since 1.0.0
168
  */
169
- public function prepare_output($ad) {
170
  global $gadsense;
171
 
172
  $content = json_decode( stripslashes( $ad->content ) );
@@ -201,6 +201,28 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
201
  return '';
202
  }
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  $output = apply_filters( 'advanced-ads-gadsense-output', false, $ad, $pub_id, $content );
205
  if ( $output !== false ) {
206
  return $output;
@@ -212,7 +234,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
212
  $output = '';
213
 
214
  // build static normal content ads first
215
- if ( ! in_array( $content->unitType, array( 'responsive', 'link-responsive', 'matched-content', 'in-article', 'in-feed' ) ) ) {
216
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
217
  $output .= '<ins class="adsbygoogle" ';
218
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
@@ -305,4 +327,5 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
305
  $output .= '</script>' . "\n";
306
  }
307
 
 
308
  }
160
  }
161
 
162
  /**
163
+ * Prepare the ads frontend output.
164
  *
165
+ * @param object $ad ad object.
166
+ * @return string $content ad content prepared for frontend output
167
  * @since 1.0.0
168
  */
169
+ public function prepare_output( $ad ) {
170
  global $gadsense;
171
 
172
  $content = json_decode( stripslashes( $ad->content ) );
201
  return '';
202
  }
203
 
204
+ $is_static_normal_content = ! in_array( $content->unitType, array( 'responsive', 'link-responsive', 'matched-content', 'in-article', 'in-feed' ) );
205
+
206
+ if ( Advanced_Ads_Utils::is_iframe() ) {
207
+ $attrs = array(
208
+ 'style' => array(
209
+ 'width' => ( $is_static_normal_content && $ad->width ) ? $ad->width . 'px' : '300px',
210
+ 'height' => ( $is_static_normal_content && $ad->height ) ? $ad->height . 'px' : '125px',
211
+ 'text-align' => 'center',
212
+ 'display' => 'flex',
213
+ 'align-items' => 'center',
214
+ 'justify-content' => 'center',
215
+ 'background' => '#cccccc',
216
+ 'color' => '#64655D'
217
+ )
218
+ );
219
+
220
+ return '<div ' . Advanced_Ads_Utils::build_html_attributes( $attrs ) . '>'
221
+ // translators: we replace AdSense code with a dummy ad code in the Customizer and Elementor since AdSense could cause them to break. This is the text within that dummy ad.
222
+ . __( 'This will be an AdSense ad on your live site.', 'advanced-ads' )
223
+ . '</div>';
224
+ }
225
+
226
  $output = apply_filters( 'advanced-ads-gadsense-output', false, $ad, $pub_id, $content );
227
  if ( $output !== false ) {
228
  return $output;
234
  $output = '';
235
 
236
  // build static normal content ads first
237
+ if ( $is_static_normal_content ) {
238
  $output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
239
  $output .= '<ins class="adsbygoogle" ';
240
  $output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
327
  $output .= '</script>' . "\n";
328
  }
329
 
330
+
331
  }
modules/gadsense/public/public.php CHANGED
@@ -36,6 +36,10 @@ class Advanced_Ads_AdSense_Public {
36
  return;
37
  }
38
 
 
 
 
 
39
  $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
40
  $privacy_enabled = ! empty( $privacy_options['enabled'] ) && 'not_needed' !== Advanced_Ads_Privacy::get_instance()->get_state();
41
  $npa_enabled = ! empty( $privacy_options['show-non-personalized-adsense'] );
36
  return;
37
  }
38
 
39
+ if ( Advanced_Ads_Utils::is_iframe() ) {
40
+ return;
41
+ }
42
+
43
  $privacy_options = Advanced_Ads_Privacy::get_instance()->options();
44
  $privacy_enabled = ! empty( $privacy_options['enabled'] ) && 'not_needed' !== Advanced_Ads_Privacy::get_instance()->get_state();
45
  $npa_enabled = ! empty( $privacy_options['show-non-personalized-adsense'] );
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.2
7
  Requires PHP: 5.6
8
- Stable tag: 1.14.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -303,6 +303,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
303
 
304
  == Changelog ==
305
 
 
 
 
 
 
 
306
  = 1.14.7 =
307
 
308
  * allow "Footer code" and "Sidebar Widget" placements on AMP pages created by the official AMP plugin
5
  Requires at least: 4.6
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 1.14.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
303
 
304
  == Changelog ==
305
 
306
+ = 1.14.8 =
307
+
308
+ * replaced AdSense with dummy ads on Customizer and Elementor preview pages to prevent issues
309
+ * make text fields in Advanced Ads settings fully resizable
310
+ * removed unneeded ads.txt warning on com.br domains
311
+
312
  = 1.14.7 =
313
 
314
  * allow "Footer code" and "Sidebar Widget" placements on AMP pages created by the official AMP plugin