Advanced Ads - Version 1.8.3

Version Description

  • introduced advads_is_amp function to fix ad injections on AMP pages
Download this release

Release Info

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

Code changes from version 1.8.2 to 1.8.3

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.8.2
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.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, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.8.2' );
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.8.3
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.8.3' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
includes/functions.php CHANGED
@@ -87,3 +87,14 @@ function the_ad_placement($id = ''){
87
  function advads_can_display_ads(){
88
  return Advanced_Ads::get_instance()->can_display_ads();
89
  }
 
 
 
 
 
 
 
 
 
 
 
87
  function advads_can_display_ads(){
88
  return Advanced_Ads::get_instance()->can_display_ads();
89
  }
90
+
91
+ /**
92
+ * Are we currently on an AMP URL?
93
+ * Will always return `false` if called before the `parse_query` hook.
94
+ *
95
+ * @return bool true if amp url, false otherwise
96
+ */
97
+ function advads_is_amp() {
98
+ return ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
99
+ || ( function_exists( 'is_wp_amp' ) && is_wp_amp() );
100
+ }
public/class-advanced-ads.php CHANGED
@@ -393,7 +393,7 @@ class Advanced_Ads {
393
  // check if admin allows injection in all places
394
  if( ! isset( $options['content-injection-everywhere'] ) ){
395
  // check if this is a singular page within the loop or an amp page
396
- $is_amp = function_exists( 'advanced_ads_is_amp' ) && advanced_ads_is_amp();
397
  if ( ( ! is_singular( $public_post_types ) && ! is_feed() ) || ( ! $is_amp && ! in_the_loop() ) ) { return $content; }
398
  } else {
399
  global $wp_query;
@@ -526,7 +526,7 @@ class Advanced_Ads {
526
  */
527
  public function is_bot(){
528
  // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page
529
- if ( function_exists( 'advanced_ads_is_amp' ) && advanced_ads_is_amp() ) {
530
  return false;
531
  }
532
 
393
  // check if admin allows injection in all places
394
  if( ! isset( $options['content-injection-everywhere'] ) ){
395
  // check if this is a singular page within the loop or an amp page
396
+ $is_amp = advads_is_amp();
397
  if ( ( ! is_singular( $public_post_types ) && ! is_feed() ) || ( ! $is_amp && ! in_the_loop() ) ) { return $content; }
398
  } else {
399
  global $wp_query;
526
  */
527
  public function is_bot(){
528
  // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page
529
+ if ( advads_is_amp() ) {
530
  return false;
531
  }
532
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id
4
  Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
5
  Requires at least: 4.2
6
  Tested up to: 4.8
7
- Stable tag: 1.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -211,6 +211,10 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
211
 
212
  == Changelog ==
213
 
 
 
 
 
214
  = 1.8.2 =
215
 
216
  * fixed Content Age condition
4
  Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
5
  Requires at least: 4.2
6
  Tested up to: 4.8
7
+ Stable tag: 1.8.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
211
 
212
  == Changelog ==
213
 
214
+ = 1.8.3 =
215
+
216
+ * introduced `advads_is_amp` function to fix ad injections on AMP pages
217
+
218
  = 1.8.2 =
219
 
220
  * fixed Content Age condition