Version Description
- fixed issue caused by wrongly registered third party taxonomies
- fixed conflict on ad list with plugins going an extra query, e.g., Elementor
- added PHP version check to new AdSense connector (5.4)
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.10.1 |
Comparing to | |
See all releases |
Code changes from version 1.10 to 1.10.1
admin/includes/class-list-filters.php
CHANGED
@@ -260,6 +260,10 @@ class Advanced_Ads_Ad_List_Filters {
|
|
260 |
$scr = get_current_screen();
|
261 |
// execute only on the first query.
|
262 |
if ( ! $scr ) {
|
|
|
|
|
|
|
|
|
263 |
// and only on the ad list page.
|
264 |
$request = wp_unslash( $_REQUEST );
|
265 |
$server = wp_unslash( $_SERVER );
|
260 |
$scr = get_current_screen();
|
261 |
// execute only on the first query.
|
262 |
if ( ! $scr ) {
|
263 |
+
// if there are already some records, don't re-execute. Prevents bug with plugins making early extra query.
|
264 |
+
if ( count( $this->all_ads ) ) {
|
265 |
+
return $posts;
|
266 |
+
}
|
267 |
// and only on the ad list page.
|
268 |
$request = wp_unslash( $_REQUEST );
|
269 |
$server = wp_unslash( $_SERVER );
|
admin/views/checks.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
|
8 |
$messages = array();
|
9 |
if( ! Advanced_Ads_Checks::php_version_minimum() ) :
|
10 |
-
$messages[] = sprintf(__( 'Your <strong>PHP version (%s) is too low</strong>. Advanced Ads is built for PHP
|
11 |
endif;
|
12 |
if( Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ) ) :
|
13 |
$messages[] = sprintf(__( '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' ), ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support' );
|
7 |
|
8 |
$messages = array();
|
9 |
if( ! Advanced_Ads_Checks::php_version_minimum() ) :
|
10 |
+
$messages[] = sprintf(__( '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' ), phpversion(), Advanced_Ads_Checks::MINIMUM_PHP_VERSION );
|
11 |
endif;
|
12 |
if( Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ) ) :
|
13 |
$messages[] = sprintf(__( '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' ), ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=support' );
|
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.10
|
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.10' );
|
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.10.1
|
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.10.1' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/checks.php
CHANGED
@@ -7,6 +7,12 @@
|
|
7 |
*/
|
8 |
class Advanced_Ads_Checks {
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* show the list of potential issues
|
12 |
*/
|
@@ -15,13 +21,13 @@ class Advanced_Ads_Checks {
|
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
-
* php version minimum 5.
|
19 |
*
|
20 |
-
* @return bool true if 5.
|
21 |
*/
|
22 |
public static function php_version_minimum(){
|
23 |
|
24 |
-
if (version_compare(phpversion(),
|
25 |
return true;
|
26 |
}
|
27 |
|
7 |
*/
|
8 |
class Advanced_Ads_Checks {
|
9 |
|
10 |
+
/**
|
11 |
+
* Minimum required PHP version of Advanced Ads
|
12 |
+
*/
|
13 |
+
const MINIMUM_PHP_VERSION = 5.4;
|
14 |
+
|
15 |
+
|
16 |
/**
|
17 |
* show the list of potential issues
|
18 |
*/
|
21 |
}
|
22 |
|
23 |
/**
|
24 |
+
* php version minimum 5.4
|
25 |
*
|
26 |
+
* @return bool true if 5.4 and higher
|
27 |
*/
|
28 |
public static function php_version_minimum(){
|
29 |
|
30 |
+
if (version_compare(phpversion(), self::MINIMUM_PHP_VERSION, '>=')) {
|
31 |
return true;
|
32 |
}
|
33 |
|
classes/display-conditions.php
CHANGED
@@ -110,19 +110,23 @@ class Advanced_Ads_Display_Conditions {
|
|
110 |
),
|
111 |
);
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
// register a condition for each taxonomy for posts
|
116 |
$taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
|
117 |
-
// count names of taxonomies and adjust label if there are duplicates
|
118 |
-
$tax_label_counts = array_count_values( wp_list_pluck( $taxonomies, 'label' ) );
|
119 |
|
|
|
|
|
120 |
foreach ($taxonomies as $_tax) :
|
121 |
if ( in_array( $_tax->name, array( 'advanced_ads_groups' ) ) ) {
|
122 |
-
|
123 |
}
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
if ( $tax_label_counts[ $_tax->label ] < 2 ) {
|
127 |
$label = $_tax->label;
|
128 |
$archive_label = $_tax->labels->singular_name;
|
@@ -147,7 +151,7 @@ class Advanced_Ads_Display_Conditions {
|
|
147 |
'taxonomy' => $_tax->name, // unique for this type: the taxonomy name
|
148 |
);
|
149 |
endforeach;
|
150 |
-
|
151 |
$this->conditions = apply_filters('advanced-ads-display-conditions', $conditions);
|
152 |
}
|
153 |
|
110 |
),
|
111 |
);
|
112 |
|
113 |
+
// register a condition for each taxonomy for posts.
|
|
|
|
|
114 |
$taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
|
|
|
|
|
115 |
|
116 |
+
$tax_label_counts = array();
|
117 |
+
|
118 |
foreach ($taxonomies as $_tax) :
|
119 |
if ( in_array( $_tax->name, array( 'advanced_ads_groups' ) ) ) {
|
120 |
+
continue;
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* Count names of taxonomies and adjust label if there are duplicates.
|
125 |
+
* we can’t use `array_count_values` here because "label" might not always be a simple string (though it should be)
|
126 |
+
*/
|
127 |
+
$tax_label_counts[ $_tax->label ] = isset( $tax_label_counts[ $_tax->label ] ) ? $tax_label_counts[ $_tax->label ] + 1 : $tax_label_counts[ $_tax->label ] = 1;
|
128 |
+
|
129 |
+
// add tax type to label if we find it multiple times.
|
130 |
if ( $tax_label_counts[ $_tax->label ] < 2 ) {
|
131 |
$label = $_tax->label;
|
132 |
$archive_label = $_tax->labels->singular_name;
|
151 |
'taxonomy' => $_tax->name, // unique for this type: the taxonomy name
|
152 |
);
|
153 |
endforeach;
|
154 |
+
|
155 |
$this->conditions = apply_filters('advanced-ads-display-conditions', $conditions);
|
156 |
}
|
157 |
|
modules/gadsense/admin/views/adsense-account.php
CHANGED
@@ -30,7 +30,7 @@ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
|
|
30 |
<div id="full-adsense-settings-div" <?php if ( empty( $adsense_id ) ) echo 'style="display:none"' ?>>
|
31 |
<input type="text" <?php if ( $has_token ) echo 'readonly' ?> name="<?php echo GADSENSE_OPT_NAME; ?>[adsense-id]" style="margin-right:.8em" id="adsense-id" size="32" value="<?php echo $adsense_id; ?>" />
|
32 |
<?php if ( !empty( $adsense_id ) && !$has_token ) : ?>
|
33 |
-
<a id="connect-adsense" class="button-primary preventDefault" <?php if (
|
34 |
<?php endif; ?>
|
35 |
<?php if ( $has_token ) : ?>
|
36 |
<a id="revoke-token" class="button-secondary preventDefault"><?php _e( 'Revoke API acccess', 'advanced-ads' ) ?></a>
|
@@ -44,7 +44,7 @@ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
|
|
44 |
<div id="auto-adsense-settings-div" <?php if ( !empty( $adsense_id ) ) echo 'style="display:none;"' ?>>
|
45 |
<div class="widget-col">
|
46 |
<h3><?php _e( 'Yes, I have an AdSense account', 'advanced-ads' ) ?></h3>
|
47 |
-
<a id="connect-adsense" class="button-primary preventDefault"
|
48 |
<a id="adsense-manual-config" class="button-secondary preventDefault"><?php _e( 'Configure everything manually', 'advanced-ads' ) ?></a>
|
49 |
</div>
|
50 |
<div class="widget-col">
|
@@ -100,6 +100,9 @@ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
|
|
100 |
<?php else : ?>
|
101 |
<p><?php printf(__( 'Problems with AdSense? Check out the <a href="%s" target="_blank">manual</a> and get a free setup check.', 'advanced-ads' ), ADVADS_URL . 'manual/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check' ); ?></p>
|
102 |
<?php endif; ?>
|
|
|
|
|
|
|
103 |
<script type="text/javascript">
|
104 |
var AdsenseMAPI = {
|
105 |
nonce: '<?php echo $nonce ?>',
|
30 |
<div id="full-adsense-settings-div" <?php if ( empty( $adsense_id ) ) echo 'style="display:none"' ?>>
|
31 |
<input type="text" <?php if ( $has_token ) echo 'readonly' ?> name="<?php echo GADSENSE_OPT_NAME; ?>[adsense-id]" style="margin-right:.8em" id="adsense-id" size="32" value="<?php echo $adsense_id; ?>" />
|
32 |
<?php if ( !empty( $adsense_id ) && !$has_token ) : ?>
|
33 |
+
<a id="connect-adsense" class="button-primary <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled ' : ''; ?>preventDefault" <?php if ( ! $can_connect || ! Advanced_Ads_Checks::php_version_minimum() ) echo 'disabled'; ?>><?php _e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
|
34 |
<?php endif; ?>
|
35 |
<?php if ( $has_token ) : ?>
|
36 |
<a id="revoke-token" class="button-secondary preventDefault"><?php _e( 'Revoke API acccess', 'advanced-ads' ) ?></a>
|
44 |
<div id="auto-adsense-settings-div" <?php if ( !empty( $adsense_id ) ) echo 'style="display:none;"' ?>>
|
45 |
<div class="widget-col">
|
46 |
<h3><?php _e( 'Yes, I have an AdSense account', 'advanced-ads' ) ?></h3>
|
47 |
+
<a id="connect-adsense" class="button-primary <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled ' : ''; ?>preventDefault" <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled' : ''; ?>><?php _e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
|
48 |
<a id="adsense-manual-config" class="button-secondary preventDefault"><?php _e( 'Configure everything manually', 'advanced-ads' ) ?></a>
|
49 |
</div>
|
50 |
<div class="widget-col">
|
100 |
<?php else : ?>
|
101 |
<p><?php printf(__( 'Problems with AdSense? Check out the <a href="%s" target="_blank">manual</a> and get a free setup check.', 'advanced-ads' ), ADVADS_URL . 'manual/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check' ); ?></p>
|
102 |
<?php endif; ?>
|
103 |
+
<?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
104 |
+
<p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ) ?></p>
|
105 |
+
<?php endif; ?>
|
106 |
<script type="text/javascript">
|
107 |
var AdsenseMAPI = {
|
108 |
nonce: '<?php echo $nonce ?>',
|
modules/gadsense/admin/views/adsense-ad-parameters.php
CHANGED
@@ -57,18 +57,22 @@ if ( $use_paste_code ) : ?>
|
|
57 |
<?php endif; ?>
|
58 |
<div id="pastecode-msg"></div>
|
59 |
</div>
|
60 |
-
<?php if ( $has_token ) require_once GADSENSE_BASE_PATH . 'admin/views/mapi-ad-selector.php'; ?>
|
61 |
|
62 |
<p>
|
63 |
<span class="advads-adsense-show-code">
|
64 |
<a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
|
65 |
</span>
|
66 |
-
<?php if ( $has_token ) : ?>
|
67 |
<span id="mapi-open-selector">
|
68 |
<?php _e( 'or', 'advanced-ads' ); ?><a href="#" class="prevent-default"><?php _e( 'Get ad code from your linked account', 'advanced-ads' ); ?></a>
|
69 |
</span>
|
70 |
<?php endif; ?>
|
71 |
</p>
|
|
|
|
|
|
|
|
|
72 |
<?php endif; ?>
|
73 |
<p id="adsense-ad-param-error"></p>
|
74 |
<?php ob_start(); ?>
|
57 |
<?php endif; ?>
|
58 |
<div id="pastecode-msg"></div>
|
59 |
</div>
|
60 |
+
<?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) require_once GADSENSE_BASE_PATH . 'admin/views/mapi-ad-selector.php'; ?>
|
61 |
|
62 |
<p>
|
63 |
<span class="advads-adsense-show-code">
|
64 |
<a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
|
65 |
</span>
|
66 |
+
<?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
67 |
<span id="mapi-open-selector">
|
68 |
<?php _e( 'or', 'advanced-ads' ); ?><a href="#" class="prevent-default"><?php _e( 'Get ad code from your linked account', 'advanced-ads' ); ?></a>
|
69 |
</span>
|
70 |
<?php endif; ?>
|
71 |
</p>
|
72 |
+
<?php if ( $has_token && ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
73 |
+
<p class="advads-error-message"><?php _e( 'Your PHP version is too low to connect an AdSense account', 'advanced-ads' ); ?></p>
|
74 |
+
<?php endif; ?>
|
75 |
+
|
76 |
<?php endif; ?>
|
77 |
<p id="adsense-ad-param-error"></p>
|
78 |
<?php ob_start(); ?>
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id
|
|
4 |
Tags: ads, ad manager, ad widget, ad rotation, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banner ads, banners, buysellads, chitika, clickbank, dfp, doubleclick, double click, geotarget, geolocation, geo location, google dfp, google ad manager, monetization, widget, wordpress, wordpress ads
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
-
Requires PHP: 5.
|
8 |
-
Stable tag: 1.10
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -264,6 +264,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
|
|
264 |
|
265 |
== Changelog ==
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
= 1.10 =
|
268 |
|
269 |
* added AdSense integration
|
4 |
Tags: ads, ad manager, ad widget, ad rotation, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banner ads, banners, buysellads, chitika, clickbank, dfp, doubleclick, double click, geotarget, geolocation, geo location, google dfp, google ad manager, monetization, widget, wordpress, wordpress ads
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
+
Requires PHP: 5.4
|
8 |
+
Stable tag: 1.10.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
264 |
|
265 |
== Changelog ==
|
266 |
|
267 |
+
= 1.10.1 =
|
268 |
+
|
269 |
+
* fixed issue caused by wrongly registered third party taxonomies
|
270 |
+
* fixed conflict on ad list with plugins going an extra query, e.g., Elementor
|
271 |
+
* added PHP version check to new AdSense connector (5.4)
|
272 |
+
|
273 |
= 1.10 =
|
274 |
|
275 |
* added AdSense integration
|