Advanced Ads - Version 1.7.0.2

Version Description

  • hide ad if no term is selected for taxonomy display conditions
  • show warning, if no items selected in display conditions
  • fixed 500 error caused by plugins using WP_Query unsecured
Download this release

Release Info

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

Code changes from version 1.7 to 1.7.0.2

admin/assets/js/admin.js CHANGED
@@ -118,11 +118,28 @@ jQuery( document ).ready(function ($) {
118
  };
119
  };
120
  });
121
-
122
  // remove individual posts from the display conditions post list
123
  $( document ).on('click', '.advads-conditions-postid-buttons .button', function(e){
124
  $( this ).remove();
125
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  // display ad groups form
128
  $( '#advads-ad-group-list a.edit, #advads-ad-group-list a.row-title' ).click(function(e){
118
  };
119
  };
120
  });
121
+
122
  // remove individual posts from the display conditions post list
123
  $( document ).on('click', '.advads-conditions-postid-buttons .button', function(e){
124
  $( this ).remove();
125
  });
126
+ // display/hide error message if no option was selected
127
+ // is also called on every click
128
+ function advads_display_condition_option_not_selected(){
129
+ $( '.advads-conditions-not-selected' ).each(function(){
130
+ if( $( this ).siblings('label.ui-state-active').length ){
131
+ $( this ).hide();
132
+ } else {
133
+ $( this ).show();
134
+ }
135
+ });
136
+ }
137
+ advads_display_condition_option_not_selected();
138
+ // update error messages when an item is clicked
139
+ $( document ).on( 'click', '.advads-conditions-terms-buttons .ui-button, .advads-conditions-single .ui-button', function(){
140
+ // needs a slight delay until the buttons are updated
141
+ window.setTimeout( advads_display_condition_option_not_selected, 200 );
142
+ });
143
 
144
  // display ad groups form
145
  $( '#advads-ad-group-list a.edit, #advads-ad-group-list a.row-title' ).click(function(e){
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.7
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.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.7.0.2
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.7.0.2' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/display-conditions.php CHANGED
@@ -173,7 +173,7 @@ class Advanced_Ads_Display_Conditions {
173
  ?><label class="button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id;
174
  ?>"><?php echo $_type->label; ?></label><input type="checkbox" id="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id; ?>" name="<?php echo $name; ?>[value][]" <?php checked($_val, 1); ?> value="<?php echo $_type_id; ?>"><?php
175
  }
176
- ?></div><?php
177
  }
178
 
179
  /**
@@ -214,10 +214,10 @@ class Advanced_Ads_Display_Conditions {
214
  } else {
215
  $_val = 0;
216
  }
217
- ?><label class="button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_author->ID;
218
  ?>"><?php echo $_author->display_name; ?></label><input type="checkbox" id="advads-conditions-<?php echo $index; ?>-<?php echo $_author->ID; ?>" name="<?php echo $name; ?>[value][]" <?php checked($_val, 1); ?> value="<?php echo $_author->ID; ?>"><?php
219
  }
220
- ?></div><?php
221
  }
222
 
223
  /**
@@ -305,7 +305,7 @@ class Advanced_Ads_Display_Conditions {
305
  $field_id = "advads-conditions-$index-$_term->term_id";
306
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $inputname; ?>" value="<?php echo $_term->term_id; ?>" <?php checked(in_array($_term->term_id, $checked), true); ?>><label for="<?php echo $field_id; ?>"><?php echo $_term->name; ?></label><?php
307
  endforeach;
308
- ?></div><?php
309
  endif;
310
  endif;
311
  }
@@ -504,6 +504,10 @@ class Advanced_Ads_Display_Conditions {
504
  */
505
  static function check_taxonomies($options = array(), Advanced_Ads_Ad $ad) {
506
 
 
 
 
 
507
  if (isset($options['operator']) && $options['operator'] === 'is_not') {
508
  $operator = 'is_not';
509
  } else {
@@ -547,6 +551,10 @@ class Advanced_Ads_Display_Conditions {
547
  */
548
  static function check_taxonomy_archive($options = array(), Advanced_Ads_Ad $ad) {
549
 
 
 
 
 
550
  if (isset($options['operator']) && $options['operator'] === 'is_not') {
551
  $operator = 'is_not';
552
  } else {
173
  ?><label class="button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id;
174
  ?>"><?php echo $_type->label; ?></label><input type="checkbox" id="advads-conditions-<?php echo $index; ?>-<?php echo $_type_id; ?>" name="<?php echo $name; ?>[value][]" <?php checked($_val, 1); ?> value="<?php echo $_type_id; ?>"><?php
175
  }
176
+ ?><p class="advads-conditions-not-selected advads-error-message" display="none"><?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p></div><?php
177
  }
178
 
179
  /**
214
  } else {
215
  $_val = 0;
216
  }
217
+ ?><label class="button ui-button" for="advads-conditions-<?php echo $index; ?>-<?php echo $_author->ID;
218
  ?>"><?php echo $_author->display_name; ?></label><input type="checkbox" id="advads-conditions-<?php echo $index; ?>-<?php echo $_author->ID; ?>" name="<?php echo $name; ?>[value][]" <?php checked($_val, 1); ?> value="<?php echo $_author->ID; ?>"><?php
219
  }
220
+ ?><p class="advads-conditions-not-selected advads-error-message" display="none"><?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p></div><?php
221
  }
222
 
223
  /**
305
  $field_id = "advads-conditions-$index-$_term->term_id";
306
  ?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $inputname; ?>" value="<?php echo $_term->term_id; ?>" <?php checked(in_array($_term->term_id, $checked), true); ?>><label for="<?php echo $field_id; ?>"><?php echo $_term->name; ?></label><?php
307
  endforeach;
308
+ ?><p class="advads-conditions-not-selected advads-error-message" display="none"><?php _ex( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?></p></div><?php
309
  endif;
310
  endif;
311
  }
504
  */
505
  static function check_taxonomies($options = array(), Advanced_Ads_Ad $ad) {
506
 
507
+ if( !isset( $options['value']) ){
508
+ return false;
509
+ }
510
+
511
  if (isset($options['operator']) && $options['operator'] === 'is_not') {
512
  $operator = 'is_not';
513
  } else {
551
  */
552
  static function check_taxonomy_archive($options = array(), Advanced_Ads_Ad $ad) {
553
 
554
+ if( !isset( $options['value']) ){
555
+ return false;
556
+ }
557
+
558
  if (isset($options['operator']) && $options['operator'] === 'is_not') {
559
  $operator = 'is_not';
560
  } else {
classes/upgrades.php CHANGED
@@ -17,9 +17,10 @@ class Advanced_Ads_Upgrades {
17
  if( empty( $internal_options['version'] ) ) {
18
  return;
19
  }
20
-
21
  if ( version_compare( $internal_options['version'], '1.7' ) == -1 ) {
22
- $this->upgrade_1_7();
 
23
  }
24
 
25
  // update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
17
  if( empty( $internal_options['version'] ) ) {
18
  return;
19
  }
20
+
21
  if ( version_compare( $internal_options['version'], '1.7' ) == -1 ) {
22
+ // run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized
23
+ add_action( 'wp_loaded', array( $this, 'upgrade_1_7') );
24
  }
25
 
26
  // update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
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: WP 4.2, PHP 5.3
6
  Tested up to: 4.4.2
7
- Stable tag: 1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -196,6 +196,16 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
196
 
197
  == Changelog ==
198
 
 
 
 
 
 
 
 
 
 
 
199
  = 1.7 =
200
 
201
  * rewritten Display Conditions interface and logic, see [manual](http://wpadvancedads.com/manual/display-conditions/)
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: WP 4.2, PHP 5.3
6
  Tested up to: 4.4.2
7
+ Stable tag: 1.7.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
196
 
197
  == Changelog ==
198
 
199
+ = 1.7.0.2 =
200
+
201
+ * hide ad if no term is selected for taxonomy display conditions
202
+ * show warning, if no items selected in display conditions
203
+ * fixed 500 error caused by plugins using WP_Query unsecured
204
+
205
+ = 1.7.0.1 =
206
+
207
+ * hotfix for missing get_current_screen issue
208
+
209
  = 1.7 =
210
 
211
  * rewritten Display Conditions interface and logic, see [manual](http://wpadvancedads.com/manual/display-conditions/)