Version Description
- prevent possible issue with empty groups
- show only 1 ad in groups by default
- fix for loading the wrong plugin language in WP Admin
- added helpful advice when license activation was blocked by firewall
- made ads for ad blockers (Pro) work when Google Analytics ID is not set
- prevented Google Custom Search tags from breaking with content injection
- added code to fix Analytics tracking in Tracking add-on for multisites loading an ad from another blog
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.8.28 |
Comparing to | |
See all releases |
Code changes from version 1.8.27 to 1.8.28
- admin/assets/js/admin.js +2 -1
- admin/includes/class-ad-groups-list.php +2 -2
- admin/includes/class-licenses.php +34 -1
- admin/views/support.php +4 -0
- advanced-ads.php +2 -2
- classes/ad-ajax.php +16 -4
- classes/ad-model.php +7 -0
- classes/ad.php +1 -1
- classes/ad_group.php +12 -3
- classes/ad_placements.php +8 -1
- modules/adblock-finder/public/public.php +1 -5
- modules/adblock-finder/public/script.js +2 -2
- modules/adblock-finder/public/script.min.js +1 -1
- modules/gadsense/admin/assets/js/new-ad.js +15 -12
- modules/gadsense/includes/class-ad-type-adsense.php +9 -19
- modules/gadsense/main.php +9 -6
- modules/import-export/classes/import.php +3 -3
- public/class-advanced-ads.php +22 -0
- readme.txt +22 -7
admin/assets/js/admin.js
CHANGED
@@ -417,7 +417,8 @@ jQuery( document ).ready(function ($) {
|
|
417 |
button.siblings('input').prop('readonly', false);
|
418 |
button.fadeOut();
|
419 |
} else {
|
420 |
-
|
|
|
421 |
button.siblings('.advads-license-activate-active').hide();
|
422 |
button.show();
|
423 |
}
|
417 |
button.siblings('input').prop('readonly', false);
|
418 |
button.fadeOut();
|
419 |
} else {
|
420 |
+
console.log( r );
|
421 |
+
button.siblings('.advads-license-activate-error').show().html( r );
|
422 |
button.siblings('.advads-license-activate-active').hide();
|
423 |
button.show();
|
424 |
}
|
admin/includes/class-ad-groups-list.php
CHANGED
@@ -365,7 +365,7 @@ class Advanced_Ads_Groups_List {
|
|
365 |
// allow other add-ons to save their own group attributes
|
366 |
$atts = apply_filters( 'advanced-ads-group-save-atts', array(
|
367 |
'type' => 'default',
|
368 |
-
'ad_count' =>
|
369 |
'options' => array(),
|
370 |
), $group);
|
371 |
|
@@ -494,4 +494,4 @@ class Advanced_Ads_Groups_List {
|
|
494 |
return add_query_arg( $args, admin_url( 'admin.php' ) );
|
495 |
}
|
496 |
|
497 |
-
}
|
365 |
// allow other add-ons to save their own group attributes
|
366 |
$atts = apply_filters( 'advanced-ads-group-save-atts', array(
|
367 |
'type' => 'default',
|
368 |
+
'ad_count' => 1,
|
369 |
'options' => array(),
|
370 |
), $group);
|
371 |
|
494 |
return add_query_arg( $args, admin_url( 'admin.php' ) );
|
495 |
}
|
496 |
|
497 |
+
}
|
admin/includes/class-licenses.php
CHANGED
@@ -248,6 +248,11 @@ class Advanced_Ads_Admin_Licenses {
|
|
248 |
|
249 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
250 |
|
|
|
|
|
|
|
|
|
|
|
251 |
// save license status
|
252 |
|
253 |
// remove data
|
@@ -499,7 +504,35 @@ class Advanced_Ads_Admin_Licenses {
|
|
499 |
}
|
500 |
}
|
501 |
return null;
|
502 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
|
504 |
|
505 |
}
|
248 |
|
249 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
250 |
|
251 |
+
// check if call was blocked by our site (e.g., Firewall)
|
252 |
+
if( isset( $response['response']['code'] ) && 403 === $response['response']['code'] ){
|
253 |
+
return sprintf(__( 'Your call was blocked by a Firewall. <a href="%s" target="_blank">Learn more</a>', 'advanced-ads' ), ADVADS_URL . "manual/i-cant-activate-my-license/" );
|
254 |
+
}
|
255 |
+
|
256 |
// save license status
|
257 |
|
258 |
// remove data
|
504 |
}
|
505 |
}
|
506 |
return null;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* check if any license is valid
|
511 |
+
* can be used to display information for any Pro user only, like link to direct support
|
512 |
+
*/
|
513 |
+
public static function any_license_valid(){
|
514 |
+
$add_ons = apply_filters( 'advanced-ads-add-ons', array() );
|
515 |
+
|
516 |
+
if( $add_ons === array() ) {
|
517 |
+
return false;
|
518 |
+
}
|
519 |
+
|
520 |
+
foreach( $add_ons as $_add_on ){
|
521 |
+
$status = Advanced_Ads_Admin_Licenses::get_instance()->get_license_status( $_add_on['options_slug'] );
|
522 |
+
|
523 |
+
// check expiry date
|
524 |
+
$expiry_date = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $_add_on['options_slug'] );
|
525 |
+
|
526 |
+
if( ( $expiry_date && strtotime( $expiry_date ) > time() )
|
527 |
+
|| 'valid' === $status
|
528 |
+
|| 'lifetime' === $expiry_date ){
|
529 |
+
|
530 |
+
return true;
|
531 |
+
}
|
532 |
+
}
|
533 |
+
|
534 |
+
return false;
|
535 |
+
}
|
536 |
|
537 |
|
538 |
}
|
admin/views/support.php
CHANGED
@@ -17,5 +17,9 @@
|
|
17 |
<input type="search" name="s"/>
|
18 |
<input type="submit" class="button button-primary" value="<?php _e( 'search', 'advanced-ads' ); ?>">
|
19 |
</form>
|
|
|
20 |
<p><?php printf(__( 'Take a look at more common issues or contact us directly through the <a href="%s" target="_blank">support page</a>.', 'advanced-ads' ), ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support' ); ?></p>
|
|
|
|
|
|
|
21 |
</div>
|
17 |
<input type="search" name="s"/>
|
18 |
<input type="submit" class="button button-primary" value="<?php _e( 'search', 'advanced-ads' ); ?>">
|
19 |
</form>
|
20 |
+
<?php if( Advanced_Ads_Admin_Licenses::any_license_valid() ) : ?>
|
21 |
<p><?php printf(__( 'Take a look at more common issues or contact us directly through the <a href="%s" target="_blank">support page</a>.', 'advanced-ads' ), ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support' ); ?></p>
|
22 |
+
<?php else : ?>
|
23 |
+
<p><?php printf(__( 'Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href="%s" target="_blank">support forum</a> for individual help.', 'advanced-ads' ), 'https://wordpress.org/support/plugin/advanced-ads' ); ?></p>
|
24 |
+
<?php endif; ?>
|
25 |
</div>
|
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.
|
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, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
-
define( 'ADVADS_VERSION', '1.8.
|
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.28
|
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, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
+
define( 'ADVADS_VERSION', '1.8.28' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/ad-ajax.php
CHANGED
@@ -46,11 +46,23 @@ class Advanced_Ads_Ajax {
|
|
46 |
if ( $deferedAds ) { // load all ajax ads with a single request
|
47 |
$response = array();
|
48 |
|
|
|
49 |
foreach ( (array) $deferedAds as $request ) {
|
50 |
-
$
|
51 |
-
$
|
52 |
-
$response[] = $result;
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
echo json_encode( $response );
|
55 |
die();
|
56 |
}
|
@@ -89,7 +101,7 @@ class Advanced_Ads_Ajax {
|
|
89 |
$content = $selector->get_ad_by_method( $id, $method, $arguments );
|
90 |
$adIds = array_slice( $advads->current_ads, $l ); // ads loaded by this request
|
91 |
|
92 |
-
return array( 'status' => 'success', 'item' => $content, 'id' => $id, 'method' => $method, 'ads' => $adIds );
|
93 |
} else {
|
94 |
// report error
|
95 |
return array( 'status' => 'error', 'message' => 'No valid ID or METHOD found.' );
|
46 |
if ( $deferedAds ) { // load all ajax ads with a single request
|
47 |
$response = array();
|
48 |
|
49 |
+
$requests_by_blog = array();
|
50 |
foreach ( (array) $deferedAds as $request ) {
|
51 |
+
$blog_id = isset( $request['blog_id'] ) ? $request['blog_id'] : get_current_blog_id();
|
52 |
+
$requests_by_blog[ $blog_id ][] = $request;
|
|
|
53 |
}
|
54 |
+
foreach ( $requests_by_blog as $blog_id => $requests ) {
|
55 |
+
if ( $blog_id !== get_current_blog_id() ) { Advanced_Ads::get_instance()->switch_to_blog( $blog_id ); }
|
56 |
+
|
57 |
+
foreach ( $requests as $request ) {
|
58 |
+
$result = $this->select_one( $request );
|
59 |
+
$result['elementId'] = ! empty( $request['elementId'] ) ? $request['elementId'] : null;
|
60 |
+
$response[] = $result;
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( $blog_id !== get_current_blog_id() ) { Advanced_Ads::get_instance()->restore_current_blog(); }
|
64 |
+
}
|
65 |
+
|
66 |
echo json_encode( $response );
|
67 |
die();
|
68 |
}
|
101 |
$content = $selector->get_ad_by_method( $id, $method, $arguments );
|
102 |
$adIds = array_slice( $advads->current_ads, $l ); // ads loaded by this request
|
103 |
|
104 |
+
return array( 'status' => 'success', 'item' => $content, 'id' => $id, 'method' => $method, 'ads' => $adIds, 'blog_id' => get_current_blog_id() );
|
105 |
} else {
|
106 |
// report error
|
107 |
return array( 'status' => 'error', 'message' => 'No valid ID or METHOD found.' );
|
classes/ad-model.php
CHANGED
@@ -121,6 +121,13 @@ class Advanced_Ads_Model {
|
|
121 |
return $this->ad_placements;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
/**
|
125 |
* update the array with ad placements
|
126 |
*
|
121 |
return $this->ad_placements;
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* Reset placement array.
|
126 |
+
*/
|
127 |
+
public function reset_placement_array() {
|
128 |
+
$this->ad_placements = null;
|
129 |
+
}
|
130 |
+
|
131 |
/**
|
132 |
* update the array with ad placements
|
133 |
*
|
classes/ad.php
CHANGED
@@ -40,7 +40,7 @@ class Advanced_Ads_Ad {
|
|
40 |
/**
|
41 |
* true, if this is an Advanced Ads Ad post type
|
42 |
*/
|
43 |
-
|
44 |
|
45 |
/**
|
46 |
* ad type
|
40 |
/**
|
41 |
* true, if this is an Advanced Ads Ad post type
|
42 |
*/
|
43 |
+
public $is_ad = false;
|
44 |
|
45 |
/**
|
46 |
* ad type
|
classes/ad_group.php
CHANGED
@@ -232,10 +232,19 @@ class Advanced_Ads_Group {
|
|
232 |
$advads->current_ads[] = array('type' => 'group', 'id' => $this->id, 'title' => $this->name);
|
233 |
}
|
234 |
|
235 |
-
if ( ! $output ) {
|
236 |
-
|
|
|
|
|
237 |
// filter grouped ads output
|
238 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
if ( $this->wrapper !== array() ) {
|
241 |
$output_string = '<div' . Advanced_Ads_Utils::build_html_attributes( $this->wrapper ) . '>'
|
232 |
$advads->current_ads[] = array('type' => 'group', 'id' => $this->id, 'title' => $this->name);
|
233 |
}
|
234 |
|
235 |
+
if ( $output === array() || ! is_array( $output ) ){
|
236 |
+
return '';
|
237 |
+
}
|
238 |
+
|
239 |
// filter grouped ads output
|
240 |
+
$output_array = apply_filters( 'advanced-ads-group-output-array', $output, $this );
|
241 |
+
|
242 |
+
// make sure the right format comes through the filter
|
243 |
+
if ( $output_array === array() || ! is_array( $output_array ) ){
|
244 |
+
return '';
|
245 |
+
}
|
246 |
+
|
247 |
+
$output_string = implode( '', $output_array );
|
248 |
|
249 |
if ( $this->wrapper !== array() ) {
|
250 |
$output_string = '<div' . Advanced_Ads_Utils::build_html_attributes( $this->wrapper ) . '>'
|
classes/ad_placements.php
CHANGED
@@ -374,7 +374,13 @@ class Advanced_Ads_Placements {
|
|
374 |
$dom = new DOMDocument('1.0', $wpCharset);
|
375 |
// may loose some fragments or add autop-like code
|
376 |
libxml_use_internal_errors(true); // avoid notices and warnings - html is most likely malformed
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
libxml_use_internal_errors(false);
|
379 |
if ($success !== true) {
|
380 |
// -TODO handle cases were dom-parsing failed (at least inform user)
|
@@ -530,6 +536,7 @@ class Advanced_Ads_Placements {
|
|
530 |
// remove head and tail (required for dom parser but unwanted for content)
|
531 |
$content = substr($content, stripos($content, '<body>') + 6);
|
532 |
$content = str_replace(array('</body>', '</html>'), '', $content);
|
|
|
533 |
|
534 |
// no fall-back desired: if there are too few paragraphs do nothing
|
535 |
|
374 |
$dom = new DOMDocument('1.0', $wpCharset);
|
375 |
// may loose some fragments or add autop-like code
|
376 |
libxml_use_internal_errors(true); // avoid notices and warnings - html is most likely malformed
|
377 |
+
|
378 |
+
// temporarily change content during processing
|
379 |
+
$replacements = array(
|
380 |
+
'gcse:search' => 'gcse__search', // Google custom search namespaced tags.
|
381 |
+
);
|
382 |
+
$content_to_load = str_replace( array_keys( $replacements ), array_values( $replacements ), $content );
|
383 |
+
$success = $dom->loadHtml('<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wpCharset . '" /><body>' . $content_to_load);
|
384 |
libxml_use_internal_errors(false);
|
385 |
if ($success !== true) {
|
386 |
// -TODO handle cases were dom-parsing failed (at least inform user)
|
536 |
// remove head and tail (required for dom parser but unwanted for content)
|
537 |
$content = substr($content, stripos($content, '<body>') + 6);
|
538 |
$content = str_replace(array('</body>', '</html>'), '', $content);
|
539 |
+
$content = str_replace( array_values( $replacements ), array_keys( $replacements ), $content );
|
540 |
|
541 |
// no fall-back desired: if there are too few paragraphs do nothing
|
542 |
|
modules/adblock-finder/public/public.php
CHANGED
@@ -9,12 +9,8 @@ class Advanced_Ads_Adblock_Finder {
|
|
9 |
public function print_adblock_check_js() {
|
10 |
$options = Advanced_Ads::get_instance()->options();
|
11 |
|
12 |
-
if ( empty( $options['ga-UID'] ) ) {
|
13 |
-
return;
|
14 |
-
}
|
15 |
-
|
16 |
?><script>
|
17 |
-
var
|
18 |
<?php
|
19 |
|
20 |
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && current_user_can( 'manage_options' ) ) {
|
9 |
public function print_adblock_check_js() {
|
10 |
$options = Advanced_Ads::get_instance()->options();
|
11 |
|
|
|
|
|
|
|
|
|
12 |
?><script>
|
13 |
+
var advanced_ads_ga_UID = <?php echo isset( $options['ga-UID'] ) ? "'" . esc_js( $options['ga-UID'] ). "'" : 'false' ?>;
|
14 |
<?php
|
15 |
|
16 |
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && current_user_can( 'manage_options' ) ) {
|
modules/adblock-finder/public/script.js
CHANGED
@@ -89,8 +89,8 @@
|
|
89 |
|
90 |
advanced_ads_check_adblocker( function( is_enabled ) {
|
91 |
// Send data to Google Analytics if an ad blocker was detected.
|
92 |
-
if ( is_enabled && 'string' === typeof
|
93 |
-
new advadsTracker( 'advadsTracker',
|
94 |
}
|
95 |
} );
|
96 |
}());
|
89 |
|
90 |
advanced_ads_check_adblocker( function( is_enabled ) {
|
91 |
// Send data to Google Analytics if an ad blocker was detected.
|
92 |
+
if ( is_enabled && 'string' === typeof advanced_ads_ga_UID && advanced_ads_ga_UID ) {
|
93 |
+
new advadsTracker( 'advadsTracker', advanced_ads_ga_UID );
|
94 |
}
|
95 |
} );
|
96 |
}());
|
modules/adblock-finder/public/script.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
advanced_ads_check_adblocker=function(t){function e(t){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)}).call(window,t)}var n=[],a=null;return e(function(){var t=document.createElement("div");t.innerHTML=" ",t.setAttribute("class","ad_unit ad-unit text-ad text_ad pub_300x250"),t.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;"),document.body.appendChild(t),e(function(){var e=window.getComputedStyle&&window.getComputedStyle(t),o=e&&e.getPropertyValue("-moz-binding");a=e&&"none"===e.getPropertyValue("display")||"string"==typeof o&&-1!==o.indexOf("about:");for(var i=0;i<n.length;i++)n[i](a);n=[]})}),function(t){if(null===a)return void n.push(t);t(a)}}(),function(){var t=function(t,e){this.name=t,this.UID=e,this.analyticsObject=null;var n=this,a={hitType:"event",eventCategory:"Advanced Ads",eventAction:"AdBlock",eventLabel:"Yes",nonInteraction:!0,transport:"beacon"};this.analyticsObject="string"==typeof GoogleAnalyticsObject&&"function"==typeof window[GoogleAnalyticsObject]&&window[GoogleAnalyticsObject],!1===this.analyticsObject?(!function(t,e,n,a,o,i,d){t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=1*new Date,i=e.createElement(n),d=e.getElementsByTagName(n)[0],i.async=1,i.src="https://www.google-analytics.com/analytics.js",d.parentNode.insertBefore(i,d)}(window,document,"script",0,"_advads_ga"),_advads_ga("create",n.UID,"auto",this.name),_advads_ga(n.name+".send",a)):(window.console&&window.console.log("Advanced Ads Analytics >> using other's variable named `"+GoogleAnalyticsObject+"`"),window[GoogleAnalyticsObject]("create",n.UID,"auto",this.name),window[GoogleAnalyticsObject](n.name+".send",a))};advanced_ads_check_adblocker(function(e){e&&"string"==typeof
|
1 |
+
advanced_ads_check_adblocker=function(t){function e(t){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)}).call(window,t)}var n=[],a=null;return e(function(){var t=document.createElement("div");t.innerHTML=" ",t.setAttribute("class","ad_unit ad-unit text-ad text_ad pub_300x250"),t.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;"),document.body.appendChild(t),e(function(){var e=window.getComputedStyle&&window.getComputedStyle(t),o=e&&e.getPropertyValue("-moz-binding");a=e&&"none"===e.getPropertyValue("display")||"string"==typeof o&&-1!==o.indexOf("about:");for(var i=0;i<n.length;i++)n[i](a);n=[]})}),function(t){if(null===a)return void n.push(t);t(a)}}(),function(){var t=function(t,e){this.name=t,this.UID=e,this.analyticsObject=null;var n=this,a={hitType:"event",eventCategory:"Advanced Ads",eventAction:"AdBlock",eventLabel:"Yes",nonInteraction:!0,transport:"beacon"};this.analyticsObject="string"==typeof GoogleAnalyticsObject&&"function"==typeof window[GoogleAnalyticsObject]&&window[GoogleAnalyticsObject],!1===this.analyticsObject?(!function(t,e,n,a,o,i,d){t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=1*new Date,i=e.createElement(n),d=e.getElementsByTagName(n)[0],i.async=1,i.src="https://www.google-analytics.com/analytics.js",d.parentNode.insertBefore(i,d)}(window,document,"script",0,"_advads_ga"),_advads_ga("create",n.UID,"auto",this.name),_advads_ga(n.name+".send",a)):(window.console&&window.console.log("Advanced Ads Analytics >> using other's variable named `"+GoogleAnalyticsObject+"`"),window[GoogleAnalyticsObject]("create",n.UID,"auto",this.name),window[GoogleAnalyticsObject](n.name+".send",a))};advanced_ads_check_adblocker(function(e){e&&"string"==typeof advanced_ads_ga_UID&&advanced_ads_ga_UID&&new t("advadsTracker",advanced_ads_ga_UID)})}();
|
modules/gadsense/admin/assets/js/new-ad.js
CHANGED
@@ -63,18 +63,16 @@
|
|
63 |
theAd.type = 'normal';
|
64 |
theAd.width = adByGoogle.css( 'width' ).replace( 'px', '' );
|
65 |
theAd.height = adByGoogle.css( 'height' ).replace( 'px', '' );
|
66 |
-
return theAd;
|
67 |
}
|
68 |
|
69 |
/* Responsive ad, auto resize */
|
70 |
-
if ('undefined' != typeof(theAd.format) && 'auto' == theAd.format) {
|
71 |
theAd.type = 'responsive';
|
72 |
-
return theAd;
|
73 |
}
|
74 |
|
75 |
|
76 |
/* older link unit format; for new ads the format type is no longer needed; link units are created through the AdSense panel */
|
77 |
-
if ('undefined' != typeof(theAd.format) && 'link' == theAd.format) {
|
78 |
|
79 |
if( -1 != theAd.style.indexOf( 'width' ) ){
|
80 |
// is fixed size
|
@@ -85,17 +83,15 @@
|
|
85 |
// is responsive
|
86 |
theAd.type = 'link-responsive';
|
87 |
}
|
88 |
-
return theAd;
|
89 |
}
|
90 |
|
91 |
/* Responsive Matched Content */
|
92 |
-
if ('undefined' != typeof(theAd.format) && 'autorelaxed' == theAd.format) {
|
93 |
theAd.type = 'matched-content';
|
94 |
-
return theAd;
|
95 |
}
|
96 |
|
97 |
/* InArticle & InFeed ads */
|
98 |
-
if ('undefined' != typeof(theAd.format) && 'fluid' == theAd.format) {
|
99 |
|
100 |
// InFeed
|
101 |
if('undefined' != typeof(theAd.layout) && 'in-article' == theAd.layout){
|
@@ -104,17 +100,21 @@
|
|
104 |
// InArticle
|
105 |
theAd.type = 'in-feed';
|
106 |
}
|
107 |
-
return theAd;
|
108 |
}
|
109 |
}
|
110 |
|
111 |
/* Page-Level ad */
|
112 |
if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 ) {
|
113 |
-
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
/**
|
@@ -191,6 +191,7 @@
|
|
191 |
} else {
|
192 |
$( '#adsense-ad-param-error' ).empty();
|
193 |
}
|
|
|
194 |
$( '#unit-type' ).trigger( 'change' );
|
195 |
}
|
196 |
|
@@ -218,6 +219,8 @@
|
|
218 |
if ('undefined' != typeof(adContent.resize) && 'auto' != adContent.resize) {
|
219 |
$( document ).trigger( 'gadsenseFormatAdResponsive', [adContent] );
|
220 |
}
|
|
|
|
|
221 |
if ('undefined' != typeof(window.gadsenseAdContent)) {
|
222 |
adContent = window.gadsenseAdContent;
|
223 |
delete( window.gadsenseAdContent );
|
63 |
theAd.type = 'normal';
|
64 |
theAd.width = adByGoogle.css( 'width' ).replace( 'px', '' );
|
65 |
theAd.height = adByGoogle.css( 'height' ).replace( 'px', '' );
|
|
|
66 |
}
|
67 |
|
68 |
/* Responsive ad, auto resize */
|
69 |
+
else if ('undefined' != typeof(theAd.format) && 'auto' == theAd.format) {
|
70 |
theAd.type = 'responsive';
|
|
|
71 |
}
|
72 |
|
73 |
|
74 |
/* older link unit format; for new ads the format type is no longer needed; link units are created through the AdSense panel */
|
75 |
+
else if ('undefined' != typeof(theAd.format) && 'link' == theAd.format) {
|
76 |
|
77 |
if( -1 != theAd.style.indexOf( 'width' ) ){
|
78 |
// is fixed size
|
83 |
// is responsive
|
84 |
theAd.type = 'link-responsive';
|
85 |
}
|
|
|
86 |
}
|
87 |
|
88 |
/* Responsive Matched Content */
|
89 |
+
else if ('undefined' != typeof(theAd.format) && 'autorelaxed' == theAd.format) {
|
90 |
theAd.type = 'matched-content';
|
|
|
91 |
}
|
92 |
|
93 |
/* InArticle & InFeed ads */
|
94 |
+
else if ('undefined' != typeof(theAd.format) && 'fluid' == theAd.format) {
|
95 |
|
96 |
// InFeed
|
97 |
if('undefined' != typeof(theAd.layout) && 'in-article' == theAd.layout){
|
100 |
// InArticle
|
101 |
theAd.type = 'in-feed';
|
102 |
}
|
|
|
103 |
}
|
104 |
}
|
105 |
|
106 |
/* Page-Level ad */
|
107 |
if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 ) {
|
108 |
+
theAd = { 'parse_message': 'pageLevelAd' };
|
109 |
}
|
110 |
|
111 |
+
else if ( ! theAd.type ) {
|
112 |
+
/* Unknown ad */
|
113 |
+
theAd = { 'parse_message': 'unknownAd' };
|
114 |
+
}
|
115 |
+
|
116 |
+
$( document ).trigger( 'gadsenseParseAdContent', [ theAd, adByGoogle ] );
|
117 |
+
return theAd;
|
118 |
}
|
119 |
|
120 |
/**
|
191 |
} else {
|
192 |
$( '#adsense-ad-param-error' ).empty();
|
193 |
}
|
194 |
+
$( document ).trigger( 'setDetailsFromAdCode', [ theAd ] );
|
195 |
$( '#unit-type' ).trigger( 'change' );
|
196 |
}
|
197 |
|
219 |
if ('undefined' != typeof(adContent.resize) && 'auto' != adContent.resize) {
|
220 |
$( document ).trigger( 'gadsenseFormatAdResponsive', [adContent] );
|
221 |
}
|
222 |
+
$( document ).trigger( 'gadsenseFormatAdContent', [adContent] );
|
223 |
+
|
224 |
if ('undefined' != typeof(window.gadsenseAdContent)) {
|
225 |
adContent = window.gadsenseAdContent;
|
226 |
delete( window.gadsenseAdContent );
|
modules/gadsense/includes/class-ad-type-adsense.php
CHANGED
@@ -201,24 +201,17 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
201 |
$output .= '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n";
|
202 |
$output .= '</script>' . "\n";
|
203 |
} else {
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
207 |
/**
|
208 |
-
*
|
209 |
-
*
|
210 |
-
* The $output variable already contains the first line which includes "adsbygoogle.js",
|
211 |
-
* The rest of the output should be appended to it.
|
212 |
*/
|
213 |
-
$
|
214 |
-
$output = apply_filters( 'advanced-ads-gadsense-responsive-output', $output, $ad, $pub_id );
|
215 |
-
if ( $unmodified == $output ) {
|
216 |
-
/**
|
217 |
-
* If the output has not been modified, perform a default responsive output.
|
218 |
-
* A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
|
219 |
-
*/
|
220 |
-
$this->append_defaut_responsive_content( $output, $pub_id, $content );
|
221 |
-
}
|
222 |
}
|
223 |
}
|
224 |
return $output;
|
@@ -244,9 +237,6 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
244 |
$layout = 'in-article';
|
245 |
$style = 'display:block; text-align:center;';
|
246 |
break;
|
247 |
-
case 'link-responsive' :
|
248 |
-
$format = 'link';
|
249 |
-
break;
|
250 |
default :
|
251 |
$format = 'auto';
|
252 |
}
|
201 |
$output .= '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n";
|
202 |
$output .= '</script>' . "\n";
|
203 |
} else {
|
204 |
+
/**
|
205 |
+
* The value of $ad->content->resize should be tested to format the output correctly
|
206 |
+
*/
|
207 |
+
$unmodified = $output;
|
208 |
+
$output = apply_filters( 'advanced-ads-gadsense-responsive-output', $output, $ad, $pub_id );
|
209 |
+
if ( $unmodified == $output ) {
|
210 |
/**
|
211 |
+
* If the output has not been modified, perform a default responsive output.
|
212 |
+
* A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
|
|
|
|
|
213 |
*/
|
214 |
+
$this->append_defaut_responsive_content( $output, $pub_id, $content );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
}
|
217 |
return $output;
|
237 |
$layout = 'in-article';
|
238 |
$style = 'display:block; text-align:center;';
|
239 |
break;
|
|
|
|
|
|
|
240 |
default :
|
241 |
$format = 'auto';
|
242 |
}
|
modules/gadsense/main.php
CHANGED
@@ -19,12 +19,15 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
|
|
19 |
return date_i18n( get_option( 'date_format' ), $time ) . __( ' at ', 'advanced-ads' ) . date_i18n( get_option( 'time_format' ), $time );
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
29 |
}
|
|
|
30 |
}
|
19 |
return date_i18n( get_option( 'date_format' ), $time ) . __( ' at ', 'advanced-ads' ) . date_i18n( get_option( 'time_format' ), $time );
|
20 |
}
|
21 |
|
22 |
+
function gadsense_init() {
|
23 |
+
Advanced_Ads_AdSense_Data::get_instance();
|
24 |
+
add_filter( 'advanced-ads-ad-types', 'advads_add_ad_type_adsense' );
|
25 |
|
26 |
+
if ( ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) && is_admin() ) {
|
27 |
+
Advanced_Ads_AdSense_Admin::get_instance();
|
28 |
+
} else {
|
29 |
+
Advanced_Ads_AdSense_Public::get_instance();
|
30 |
+
}
|
31 |
}
|
32 |
+
add_action( 'advanced-ads-plugin-loaded', 'gadsense_init' );
|
33 |
}
|
modules/import-export/classes/import.php
CHANGED
@@ -412,7 +412,7 @@ class Advanced_Ads_Import {
|
|
412 |
}
|
413 |
}
|
414 |
|
415 |
-
$updated_placements[ $placement_key_uniq ] = $placement;
|
416 |
}
|
417 |
|
418 |
if ( $existing_placements !== $updated_placements ) {
|
@@ -431,7 +431,7 @@ class Advanced_Ads_Import {
|
|
431 |
* - or int id of the existing ad/group if exists
|
432 |
* - or bool false
|
433 |
*/
|
434 |
-
|
435 |
$found = false;
|
436 |
|
437 |
switch ( $type ) {
|
@@ -661,4 +661,4 @@ class Advanced_Ads_Import {
|
|
661 |
public function get_messages(){
|
662 |
return $this->messages;
|
663 |
}
|
664 |
-
}
|
412 |
}
|
413 |
}
|
414 |
|
415 |
+
$updated_placements[ $placement_key_uniq ] = apply_filters( 'advanced-ads-import-placement', $placement, $this );
|
416 |
}
|
417 |
|
418 |
if ( $existing_placements !== $updated_placements ) {
|
431 |
* - or int id of the existing ad/group if exists
|
432 |
* - or bool false
|
433 |
*/
|
434 |
+
public function search_item( $id, $type ) {
|
435 |
$found = false;
|
436 |
|
437 |
switch ( $type ) {
|
661 |
public function get_messages(){
|
662 |
return $this->messages;
|
663 |
}
|
664 |
+
}
|
public/class-advanced-ads.php
CHANGED
@@ -783,4 +783,26 @@ class Advanced_Ads {
|
|
783 |
|
784 |
return count( $recent_ads );
|
785 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
786 |
}
|
783 |
|
784 |
return count( $recent_ads );
|
785 |
}
|
786 |
+
|
787 |
+
/**
|
788 |
+
* Switch the current blog.
|
789 |
+
*
|
790 |
+
* @param int $blog_id
|
791 |
+
*/
|
792 |
+
public function switch_to_blog( $blog_id ) {
|
793 |
+
if ( is_multisite() ) {
|
794 |
+
switch_to_blog( $blog_id );
|
795 |
+
Advanced_Ads::get_instance()->get_model()->reset_placement_array();
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Restore the current blog.
|
801 |
+
*/
|
802 |
+
public function restore_current_blog() {
|
803 |
+
if ( is_multisite() ) {
|
804 |
+
restore_current_blog();
|
805 |
+
Advanced_Ads::get_instance()->get_model()->reset_placement_array();
|
806 |
+
}
|
807 |
+
}
|
808 |
}
|
readme.txt
CHANGED
@@ -5,27 +5,29 @@ Tags: ads, ad manager, ad widget, ad rotation, adsense, advertise, advertisement
|
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
Requires PHP: 5.2
|
8 |
-
Stable tag: 1.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
Manage and optimize your ads
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
Are you looking for
|
17 |
|
18 |
* most features to test and optimize ads
|
19 |
* unlimited ad units
|
|
|
|
|
20 |
* works with all ad types and networks (e.g. AdSense or Amazon)
|
21 |
* the only solution with *Ad Health* integration and AdSense violation checks
|
22 |
-
*
|
23 |
|
24 |
I built Advanced Ads based on my experience delivering millions of ads per month.
|
25 |
|
26 |
[Full Feature List](https://wpadvancedads.com/features/).
|
27 |
|
28 |
-
=
|
29 |
|
30 |
* create and display **unlimited** ad units
|
31 |
* rotate ads
|
@@ -42,7 +44,7 @@ choose between different ad types that enable you to:
|
|
42 |
* dedicated support for all types of Google AdSense banners, including Responsive, InFeed and InArticle ads
|
43 |
* display images and image banners
|
44 |
* create content-rich ads with the WordPress TinyMCE editor
|
45 |
-
* use shortcodes within ads (to also deliver advertisements from other ad plugins like AdRotate or the AdSense Plugin WP QUADS)
|
46 |
|
47 |
= display ads =
|
48 |
|
@@ -115,10 +117,13 @@ Placements to insert ads in pre-defined positions in your theme and content. [Li
|
|
115 |
|
116 |
Learn more on the [plugin homepage](https://wpadvancedads.com).
|
117 |
|
|
|
|
|
118 |
Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese, Vietnamese
|
119 |
|
120 |
> <strong>Add-Ons</strong>
|
121 |
>
|
|
|
122 |
> * [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/) – powerful tools for ad optimizations: cache-busting, more placements, lazy load, ad blocker module, click fraud, and more
|
123 |
> * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles.
|
124 |
> * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on geo location of the visitor
|
@@ -128,7 +133,7 @@ Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese, Vie
|
|
128 |
> * [PopUp and Layer Ads](https://wpadvancedads.com/add-ons/popup-and-layer-ads/) – display ads and other content in layers and popups
|
129 |
> * [Slider](https://wpadvancedads.com/add-ons/slider/) – create a simple slider from your ads
|
130 |
|
131 |
-
If you have problems with Advanced Ads, please reach out to [our support](https://
|
132 |
|
133 |
== Installation ==
|
134 |
|
@@ -235,6 +240,16 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
|
|
235 |
|
236 |
== Changelog ==
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
= 1.8.27 =
|
239 |
|
240 |
* prepared for repeating content ad injections in [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
Requires PHP: 5.2
|
8 |
+
Stable tag: 1.8.28
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
Manage and optimize your ads. All ad codes, AdSense Auto ads, ad widget, rotation, header and footer code injection, Google AdSense partner support
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
Are you looking for a simple ad manager plugin? These are the top arguments to use Advanced Ads:
|
17 |
|
18 |
* most features to test and optimize ads
|
19 |
* unlimited ad units
|
20 |
+
* approved by 9 years in Publishing and Ad Optimization
|
21 |
+
* Google AdSense Partner
|
22 |
* works with all ad types and networks (e.g. AdSense or Amazon)
|
23 |
* the only solution with *Ad Health* integration and AdSense violation checks
|
24 |
+
* best rated [free support](https://wordpress.org/support/plugin/advanced-ads)
|
25 |
|
26 |
I built Advanced Ads based on my experience delivering millions of ads per month.
|
27 |
|
28 |
[Full Feature List](https://wpadvancedads.com/features/).
|
29 |
|
30 |
+
= ad management =
|
31 |
|
32 |
* create and display **unlimited** ad units
|
33 |
* rotate ads
|
44 |
* dedicated support for all types of Google AdSense banners, including Responsive, InFeed and InArticle ads
|
45 |
* display images and image banners
|
46 |
* create content-rich ads with the WordPress TinyMCE editor
|
47 |
+
* use shortcodes within ads (to also deliver advertisements from other ad plugins like Ad Inserter, AdRotate or the AdSense Plugin WP QUADS)
|
48 |
|
49 |
= display ads =
|
50 |
|
117 |
|
118 |
Learn more on the [plugin homepage](https://wpadvancedads.com).
|
119 |
|
120 |
+
Thank you for motivating us with your [positive review](https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post).
|
121 |
+
|
122 |
Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese, Vietnamese
|
123 |
|
124 |
> <strong>Add-Ons</strong>
|
125 |
>
|
126 |
+
> * all add-ons include priority email support
|
127 |
> * [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/) – powerful tools for ad optimizations: cache-busting, more placements, lazy load, ad blocker module, click fraud, and more
|
128 |
> * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles.
|
129 |
> * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on geo location of the visitor
|
133 |
> * [PopUp and Layer Ads](https://wpadvancedads.com/add-ons/popup-and-layer-ads/) – display ads and other content in layers and popups
|
134 |
> * [Slider](https://wpadvancedads.com/add-ons/slider/) – create a simple slider from your ads
|
135 |
|
136 |
+
If you have problems with Advanced Ads, please reach out to [our support](https://wordpress.org/support/plugin/advanced-ads).
|
137 |
|
138 |
== Installation ==
|
139 |
|
240 |
|
241 |
== Changelog ==
|
242 |
|
243 |
+
= 1.8.28 =
|
244 |
+
|
245 |
+
* prevent possible issue with empty groups
|
246 |
+
* show only 1 ad in groups by default
|
247 |
+
* fix for loading the wrong plugin language in WP Admin
|
248 |
+
* added helpful advice when license activation was blocked by firewall
|
249 |
+
* made ads for ad blockers (Pro) work when Google Analytics ID is not set
|
250 |
+
* prevented Google Custom Search tags from breaking with content injection
|
251 |
+
* added code to fix Analytics tracking in Tracking add-on for multisites loading an ad from another blog
|
252 |
+
|
253 |
= 1.8.27 =
|
254 |
|
255 |
* prepared for repeating content ad injections in [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
|