Advanced Ads - Version 1.2.6

Version Description

  • layout updates to display condition box
  • moved single post display condition to new layout
  • individual post ids display condition is now only checked on singular pages
  • added quick action buttons to overview page
  • added debug output for display conditions (if WP_DEBUG is true)
  • fixed bug with trashed ads still showing
  • fixed admin notices appearing on overview page on the wrong place
  • fixed display conditions for category of post and category archives interfered with each other

IMPORTANT: It is no longer possible to use the single post display condition to select individual posts where the ad is displayed and where it is hidden at the same time. This didnt made sense before and is prevented now completely.

Download this release

Release Info

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

Code changes from version 1.2.5 to 1.2.6

admin/assets/css/admin.css CHANGED
@@ -42,6 +42,8 @@
42
  .post-type-advanced_ads .advads-conditions-all { display: block; }
43
  .post-type-advanced_ads .advads-conditions-single { margin-bottom: 10px; padding: 10px; }
44
  .post-type-advanced_ads .advads-conditions-single.disabled { display: none; opacity: .5; }
 
 
45
  .post-type-advanced_ads #advads-ad-content-plain {
46
  width: 100%;
47
  }
@@ -51,6 +53,8 @@
51
  .post-type-advanced_ads #advanced-ads-ad-parameters-size label + label { margin-left: 1em; }
52
  .post-type-advanced_ads #advanced-ads-ad-parameters-size input { width: 4em; margin-left: .5em; }
53
 
 
 
54
  /**
55
  AD GROUP LIST
56
  */
42
  .post-type-advanced_ads .advads-conditions-all { display: block; }
43
  .post-type-advanced_ads .advads-conditions-single { margin-bottom: 10px; padding: 10px; }
44
  .post-type-advanced_ads .advads-conditions-single.disabled { display: none; opacity: .5; }
45
+ .advads-conditions-postids-list li { background: #F1F1F1; padding: 3px; }
46
+ .advads-conditions-postids-list .remove { margin-right: 1em; font-size: .9em; }
47
  .post-type-advanced_ads #advads-ad-content-plain {
48
  width: 100%;
49
  }
53
  .post-type-advanced_ads #advanced-ads-ad-parameters-size label + label { margin-left: 1em; }
54
  .post-type-advanced_ads #advanced-ads-ad-parameters-size input { width: 4em; margin-left: .5em; }
55
 
56
+ .advads-debug-output legend { text-decoration: underline; cursor: pointer; }
57
+
58
  /**
59
  AD GROUP LIST
60
  */
admin/assets/js/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function($) {
2
  "use strict";
3
 
4
  function advads_load_ad_type_parameter_metabox(ad_type) {
@@ -11,57 +11,132 @@ jQuery(document).ready(function($) {
11
  'ad_type': ad_type,
12
  'ad_id': $('#post_ID').val()
13
  },
14
- success: function(data, textStatus, XMLHttpRequest) {
15
  // toggle main content field
16
  if (data) {
17
  $('#advanced-ads-ad-parameters').html(data);
18
  }
19
  },
20
- error: function(MLHttpRequest, textStatus, errorThrown) {
21
  $('#advanced-ads-ad-parameters').html(errorThrown);
22
  }
23
  });
24
  }
25
  ;
26
 
27
- $(document).on('change', '#advanced-ad-type input', function() {
28
  var ad_type = $(this).val()
29
  advads_load_ad_type_parameter_metabox(ad_type);
30
  });
31
 
32
  // empty / clear input condition fields in the same row as the clear button
33
- $('#advanced-ad-conditions .clear-radio').click(function() {
34
  $(this).closest('tr').find('input[type="radio"]').prop('checked', false);
35
  $(this).closest('tr').find('input[type="text"]').val('');
36
  });
37
 
38
  // toggle display conditions
39
- $('#advanced-ad-conditions-enable input').click(function(){
40
  advads_toggle_display_conditions(this.value);
41
  });
42
  // display on load
43
  advads_toggle_display_conditions($('#advanced-ad-conditions-enable input:checked').val());
44
 
45
  // display / hide options if all-option is checked for display condition
46
- $('.advanced-ad-display-condition .advads-conditions-all input').click(function(){
47
  advads_toggle_single_display_conditions(this);
48
  });
49
  // display / hide options if all-option is checked for display condition – on load
50
- $('.advanced-ad-display-condition .advads-conditions-all input').each(function(){
51
  advads_toggle_single_display_conditions(this);
52
  });
53
 
54
  // toggle single display condition checkboxes that have a counterpart
55
- $('.advads-conditions-single input[type="checkbox"]').click(function(){
56
  advads_toggle_single_display_condition_checkbox(this);
57
  });
58
  // toggle single display condition checkboxes that have a counterpart on load
59
- $('.advads-conditions-single input[type="checkbox"]').each(function(){
60
  advads_toggle_single_display_condition_checkbox(this);
61
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  });
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * toggle content elements (hide/show)
67
  *
@@ -77,7 +152,7 @@ function advads_toggle(selector) {
77
  * @param selector jquery selector
78
  */
79
  function advads_toggle_box(e, selector) {
80
- if(jQuery(e).is(':checked')){
81
  jQuery(selector).slideDown();
82
  } else {
83
  jQuery(selector).slideUp();
@@ -91,7 +166,7 @@ function advads_toggle_box(e, selector) {
91
  * @param selector jquery selector
92
  */
93
  function advads_toggle_box_enable(e, selector) {
94
- if(jQuery(e).is(':checked')){
95
  jQuery(selector).find('input').removeAttr('disabled', '');
96
  } else {
97
  jQuery(selector).find('input').attr('disabled', 'disabled');
@@ -102,8 +177,8 @@ function advads_toggle_box_enable(e, selector) {
102
  * toggle display conditions
103
  * @param {bool} value
104
  */
105
- function advads_toggle_display_conditions(value){
106
- if(value == 1){
107
  jQuery('#advanced-ad-conditions').fadeIn();
108
  } else {
109
  jQuery('#advanced-ad-conditions').fadeOut();
@@ -114,9 +189,9 @@ function advads_toggle_display_conditions(value){
114
  * disable new display conditions
115
  * @param {string} checkbox element
116
  */
117
- function advads_toggle_single_display_conditions(checkbox){
118
  // console.log(jQuery(checkbox).parent('div').find('label:not(.advads-conditions-all) input').css('border', 'solid'));
119
- if(jQuery(checkbox).is(':checked')){
120
  jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').addClass('disabled').find('input').attr('disabled', 'disabled');
121
  } else {
122
  jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').removeClass('disabled').find('input').removeAttr('disabled');
@@ -127,11 +202,11 @@ function advads_toggle_single_display_conditions(checkbox){
127
  * toggle display condition checkboxes
128
  * @param {string} checkbox element
129
  */
130
- function advads_toggle_single_display_condition_checkbox(checkbox){
131
  // get the counterpart (same value, but not current element)
132
- var counterpart = jQuery(checkbox).parents('.advads-conditions-single').find('input[type="checkbox"][value="'+ checkbox.value +'"]').not(checkbox);
133
  // toggle counterpart
134
- if(jQuery(checkbox).is(':checked')){
135
  counterpart.attr('checked', false);
136
  counterpart.attr('disabled', 'disabled');
137
  } else {
1
+ jQuery(document).ready(function ($) {
2
  "use strict";
3
 
4
  function advads_load_ad_type_parameter_metabox(ad_type) {
11
  'ad_type': ad_type,
12
  'ad_id': $('#post_ID').val()
13
  },
14
+ success: function (data, textStatus, XMLHttpRequest) {
15
  // toggle main content field
16
  if (data) {
17
  $('#advanced-ads-ad-parameters').html(data);
18
  }
19
  },
20
+ error: function (MLHttpRequest, textStatus, errorThrown) {
21
  $('#advanced-ads-ad-parameters').html(errorThrown);
22
  }
23
  });
24
  }
25
  ;
26
 
27
+ $(document).on('change', '#advanced-ad-type input', function () {
28
  var ad_type = $(this).val()
29
  advads_load_ad_type_parameter_metabox(ad_type);
30
  });
31
 
32
  // empty / clear input condition fields in the same row as the clear button
33
+ $('#advanced-ad-conditions .clear-radio').click(function () {
34
  $(this).closest('tr').find('input[type="radio"]').prop('checked', false);
35
  $(this).closest('tr').find('input[type="text"]').val('');
36
  });
37
 
38
  // toggle display conditions
39
+ $('#advanced-ad-conditions-enable input').click(function () {
40
  advads_toggle_display_conditions(this.value);
41
  });
42
  // display on load
43
  advads_toggle_display_conditions($('#advanced-ad-conditions-enable input:checked').val());
44
 
45
  // display / hide options if all-option is checked for display condition
46
+ $('.advanced-ad-display-condition .advads-conditions-all input').click(function () {
47
  advads_toggle_single_display_conditions(this);
48
  });
49
  // display / hide options if all-option is checked for display condition – on load
50
+ $('.advanced-ad-display-condition .advads-conditions-all input').each(function () {
51
  advads_toggle_single_display_conditions(this);
52
  });
53
 
54
  // toggle single display condition checkboxes that have a counterpart
55
+ $('.advads-conditions-single input[type="checkbox"]').click(function () {
56
  advads_toggle_single_display_condition_checkbox(this);
57
  });
58
  // toggle single display condition checkboxes that have a counterpart on load
59
+ $('.advads-conditions-single input[type="checkbox"]').each(function () {
60
  advads_toggle_single_display_condition_checkbox(this);
61
  });
62
+ // display input field to search for post, page, etc.
63
+ $('.advads-conditions-postids-list .show-search a').click(function (e) {
64
+ e.preventDefault();
65
+ // display input field
66
+ $('#advads-display-conditions-individual-post').show();
67
+ $(this).hide();
68
+ });
69
+ // register autocomplete to display condition posts
70
+ var response = [];
71
+ $("#advads-display-conditions-individual-post").autocomplete({
72
+ source: function(request, callback){
73
+ var searchParam = request.term;
74
+ advads_post_search(searchParam, callback);
75
+ },
76
+ minLength: 2,
77
+ select: function( event, ui ) {
78
+ // append new line with input fields
79
+ var newline = $('<li></li>');
80
+ $('<a class="remove" href="#">remove</a>').appendTo(newline);
81
+ $('<span>' + ui.item.label + '</span><input type="hidden" name="advanced_ad[conditions][postids][ids][]" value="'+ ui.item.value +'">').appendTo(newline);
82
+ newline.insertBefore('.advads-conditions-postids-list .show-search');
83
+
84
+ // show / hide other elements
85
+ $('#advads-display-conditions-individual-post').hide();
86
+ $('.advads-conditions-postids-list .show-search a').show();
87
+ },
88
+ close: function( event, ui ) {
89
+ $('#advads-display-conditions-individual-post').val('');
90
+ }
91
+ });
92
+
93
+ // remove individual posts from the display conditions post list
94
+ $(document).on('click', '.advads-conditions-postids-list .remove', function(e){
95
+ e.preventDefault();
96
+ $(this).parent('li').remove();
97
+ });
98
 
99
  });
100
 
101
+ /**
102
+ * callback for post search autocomplete
103
+ *
104
+ * @param {type} query
105
+ * @param {type} callback
106
+ * @returns {obj} json object with labels and values
107
+ */
108
+ function advads_post_search(query, callback) {
109
+
110
+ // return ['post', 'poster'];
111
+ var query = {
112
+ action: 'wp-link-ajax',
113
+ _ajax_linking_nonce: jQuery('#_ajax_linking_nonce').val()
114
+ };
115
+
116
+ query.search = jQuery('#advads-display-conditions-individual-post').val();
117
+
118
+ var querying = true;
119
+
120
+ var results = {};
121
+ jQuery.post(ajaxurl, query, function (r) {
122
+ querying = false;
123
+ var results = [];
124
+ if(r){
125
+ r.map(function(element, index){
126
+ results[index] = {
127
+ label: element.title,
128
+ value: element.ID
129
+ };
130
+ });
131
+ }
132
+ callback(results);
133
+ }, 'json');
134
+
135
+ // results = [{huch:'post', hach:'poster', hoch:'position'}];
136
+ //return results;
137
+
138
+ }
139
+
140
  /**
141
  * toggle content elements (hide/show)
142
  *
152
  * @param selector jquery selector
153
  */
154
  function advads_toggle_box(e, selector) {
155
+ if (jQuery(e).is(':checked')) {
156
  jQuery(selector).slideDown();
157
  } else {
158
  jQuery(selector).slideUp();
166
  * @param selector jquery selector
167
  */
168
  function advads_toggle_box_enable(e, selector) {
169
+ if (jQuery(e).is(':checked')) {
170
  jQuery(selector).find('input').removeAttr('disabled', '');
171
  } else {
172
  jQuery(selector).find('input').attr('disabled', 'disabled');
177
  * toggle display conditions
178
  * @param {bool} value
179
  */
180
+ function advads_toggle_display_conditions(value) {
181
+ if (value == 1) {
182
  jQuery('#advanced-ad-conditions').fadeIn();
183
  } else {
184
  jQuery('#advanced-ad-conditions').fadeOut();
189
  * disable new display conditions
190
  * @param {string} checkbox element
191
  */
192
+ function advads_toggle_single_display_conditions(checkbox) {
193
  // console.log(jQuery(checkbox).parent('div').find('label:not(.advads-conditions-all) input').css('border', 'solid'));
194
+ if (jQuery(checkbox).is(':checked')) {
195
  jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').addClass('disabled').find('input').attr('disabled', 'disabled');
196
  } else {
197
  jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').removeClass('disabled').find('input').removeAttr('disabled');
202
  * toggle display condition checkboxes
203
  * @param {string} checkbox element
204
  */
205
+ function advads_toggle_single_display_condition_checkbox(checkbox) {
206
  // get the counterpart (same value, but not current element)
207
+ var counterpart = jQuery(checkbox).parents('.advads-conditions-single').find('input[type="checkbox"][value="' + checkbox.value + '"]').not(checkbox);
208
  // toggle counterpart
209
+ if (jQuery(checkbox).is(':checked')) {
210
  counterpart.attr('checked', false);
211
  counterpart.attr('disabled', 'disabled');
212
  } else {
admin/class-advanced-ads-admin.php CHANGED
@@ -14,7 +14,7 @@
14
  * Plugin class. This class should ideally be used to work with the
15
  * administrative side of the WordPress site.
16
  *
17
- * *
18
  * @package Advanced_Ads_Admin
19
  * @author Thomas Maier <thomas.maier@webgilde.com>
20
  */
@@ -150,8 +150,8 @@ class Advanced_Ads_Admin {
150
  return;
151
  }
152
 
153
- wp_enqueue_script($this->plugin_slug . '-admin-script', plugins_url('assets/js/admin.js', __FILE__), array('jquery'), Advanced_Ads::VERSION);
154
-
155
  // just register this script for later inclusion on ad group list page
156
  wp_register_script('inline-edit-group-ads', plugins_url('assets/js/inline-edit-group-ads.js', __FILE__), array('jquery'), Advanced_Ads::VERSION);
157
 
14
  * Plugin class. This class should ideally be used to work with the
15
  * administrative side of the WordPress site.
16
  *
17
+ *
18
  * @package Advanced_Ads_Admin
19
  * @author Thomas Maier <thomas.maier@webgilde.com>
20
  */
150
  return;
151
  }
152
 
153
+ wp_enqueue_script($this->plugin_slug . '-admin-script', plugins_url('assets/js/admin.js', __FILE__), array('jquery', 'jquery-ui-autocomplete'), Advanced_Ads::VERSION);
154
+
155
  // just register this script for later inclusion on ad group list page
156
  wp_register_script('inline-edit-group-ads', plugins_url('assets/js/inline-edit-group-ads.js', __FILE__), array('jquery'), Advanced_Ads::VERSION);
157
 
admin/includes/class-display-condition-callbacks.php CHANGED
@@ -163,8 +163,9 @@ class AdvAds_Display_Condition_Callbacks {
163
  ?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][categoryarchiveids][all]" value="1" <?php checked($_all, 1); ?>><?php
164
  _e('Display on all <strong>category archive pages</strong>.', ADVADS_SLUG); ?></label></h4><?php
165
  $taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
166
- ?><p class="description"><?php _e('Choose the terms from public categories, tags and other taxonomies on which’s archive page ads can appear', ADVADS_SLUG); ?></p>
167
- <div class="advads-conditions-single"><table><?php
 
168
  foreach($taxonomies as $_tax):
169
  if($_tax->name === 'advanced_ads_groups') continue; // exclude adv ads groups
170
  $terms = get_terms($_tax->name, array());
@@ -209,4 +210,105 @@ class AdvAds_Display_Condition_Callbacks {
209
  endforeach;
210
  ?></table></div><?php
211
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  }
163
  ?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][categoryarchiveids][all]" value="1" <?php checked($_all, 1); ?>><?php
164
  _e('Display on all <strong>category archive pages</strong>.', ADVADS_SLUG); ?></label></h4><?php
165
  $taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
166
+ ?><div class="advads-conditions-single"><table>
167
+ <p class="description"><?php _e('Choose the terms from public categories, tags and other taxonomies on which’s archive page ads can appear', ADVADS_SLUG); ?></p>
168
+ <table><?php
169
  foreach($taxonomies as $_tax):
170
  if($_tax->name === 'advanced_ads_groups') continue; // exclude adv ads groups
171
  $terms = get_terms($_tax->name, array());
210
  endforeach;
211
  ?></table></div><?php
212
  }
213
+
214
+ /**
215
+ * render display condition for single post types
216
+ *
217
+ * @param obj $ad ad object
218
+ * @since 1.2.6
219
+ */
220
+ public static function single_posts($ad = false){
221
+
222
+ if(is_object($ad)){
223
+ $_all = (isset($ad->conditions['postids']['all'])) ? 1 : 0;
224
+ if(!$_all && empty($ad->conditions['postids']['include']) && empty($ad->conditions['postids']['exclude'])){
225
+ $_all = 1;
226
+ }
227
+ }
228
+
229
+ ?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][postids][all]" value="1" <?php
230
+ checked($_all, 1); ?>><?php _e('Display an all <strong>individual posts, pages</strong> and public post type pages', ADVADS_SLUG); ?></label></h4><?php
231
+
232
+ ?><div class="advads-conditions-single">
233
+ <p class="description"><?php _e('Choose on which individual posts, pages and public post type pages you want to display or hide ads.', ADVADS_SLUG); ?></p><?php
234
+
235
+ // derrive method from previous setup
236
+ // set defaults
237
+ if(is_object($ad)){
238
+ $_method = (isset($ad->conditions['postids']['method'])) ? $ad->conditions['postids']['method'] : 0;
239
+ if($_method === 0){
240
+ if(empty($ad->conditions['postids']['include']) && !empty($ad->conditions['postids']['exclude'])){
241
+ $_method = 'exclude';
242
+ } elseif(!empty($ad->conditions['postids']['include']) && empty($ad->conditions['postids']['exclude'])) {
243
+ $_method = 'include';
244
+ } else {
245
+ $_method = '';
246
+ }
247
+ }
248
+ }
249
+
250
+ ?><p><?php _e('What should happen with ads on the list of individual posts below?', ADVADS_SLUG); ?></p>
251
+ <label><input type="radio" name='advanced_ad[conditions][postids][method]' value='' <?php checked('', $_method); ?>><?php _e('ignore the list', ADVADS_SLUG); ?></label></li>
252
+ <label><input type="radio" name='advanced_ad[conditions][postids][method]' value='include' <?php checked('include', $_method); ?>><?php _e('display the ad only there', ADVADS_SLUG); ?></label></li>
253
+ <label><input type="radio" name='advanced_ad[conditions][postids][method]' value='exclude' <?php checked('exclude', $_method); ?>><?php _e('hide the ad here', ADVADS_SLUG); ?></label></li>
254
+ <?php
255
+
256
+ /**
257
+ * Update warning
258
+ * @todo remove on a later version, if no longer needed
259
+ */
260
+ if(!empty($ad->conditions['postids']['include']) && !empty($ad->conditions['postids']['exclude'])){
261
+ ?><div style="color: red;"><p><strong><?php _e('Update warning', ADVADS_SLUG); ?></strong></p>
262
+ <p><?php _e('Due to some conflicts before version 1.2.6, it is from now on only possible to choose either individual pages to include or exclude an ad, but not both with mixed settings. It seems you are still using mixed settings on this page. Please consider changing your setup for this ad.', ADVADS_SLUG); ?></p>
263
+ <p><?php _e('Your old values are:', ADVADS_SLUG); ?></p>
264
+ <p><?php _e('Post IDs the ad is displayed on:', ADVADS_SLUG); echo $ad->conditions['postids']['include']; ?></p>
265
+ <p><?php _e('Post IDs the ad is hidden from:', ADVADS_SLUG); echo $ad->conditions['postids']['exclude']; ?></p>
266
+ <p><?php _e('Below you find the pages the ad is displayed on. If this is ok, just save the ad. If not, please update your settings.', ADVADS_SLUG); ?></p>
267
+
268
+ </div><?php
269
+ }
270
+
271
+ if(!empty($ad->conditions['postids']['include'])){
272
+ // backward compatibility
273
+ // TODO: remove in a later version; this should already be an array
274
+ if(is_string($ad->conditions['postids']['include'])){
275
+ $_postids = explode(',', $ad->conditions['postids']['include']);
276
+ } else {
277
+ $_postids = $ad->conditions['postids']['include'];
278
+ }
279
+ } elseif(!empty($ad->conditions['postids']['exclude'])){
280
+ // backward compatibility
281
+ // TODO: remove in a later version; this should already be an array
282
+ if(is_string($ad->conditions['postids']['exclude'])){
283
+ $_postids = explode(',', $ad->conditions['postids']['exclude']);
284
+ } else {
285
+ $_postids = $ad->conditions['postids']['exclude'];
286
+ }
287
+ } else {
288
+ $_postids = array();
289
+ }
290
+
291
+ ?><ul class='advads-conditions-postids-list'><?php
292
+ if($_postids != array()){
293
+ $args = array(
294
+ 'post_type' => 'any',
295
+ // 'post_status' => 'publish',
296
+ 'post__in' => $_postids,
297
+ // 'ignore_sticky_posts' => 1,
298
+ );
299
+
300
+ $the_query = new WP_Query( $args );
301
+ while ( $the_query->have_posts() ) {
302
+ $the_query->next_post();
303
+ echo '<li><a class="remove" href="#">remove</a><a href="'.get_permalink($the_query->post->ID).'">' . get_the_title( $the_query->post->ID ) . '</a><input type="hidden" name="advanced_ad[conditions][postids][ids][]" value="'.$the_query->post->ID.'"></li>';
304
+ }
305
+ }
306
+ ?><li class="show-search"><a href="#"><?php _e('new', ADVADS_SLUG); ?></a>
307
+ <input type="text" style="display:none;" id="advads-display-conditions-individual-post" value="" placeholder="<?php
308
+ _e('type the title', ADVADS_SLUG); ?>"/>
309
+ <?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
310
+ </li>
311
+ </ul>
312
+ </div><?php
313
+ }
314
  }
admin/views/ad-display-metabox.php CHANGED
@@ -1,63 +1,75 @@
1
- <?php // include callback file
 
2
  require_once(ADVADS_BASE_PATH . 'admin/includes/class-display-condition-callbacks.php');
3
  ?>
4
  <?php $types = Advanced_Ads::get_instance()->ad_types; ?>
5
- <p class="description"><?php _e('Choose where to display the ad and where not.', ADVADS_SLUG); ?></p>
6
  <div id="advanced-ad-conditions-enable">
7
- <?php $conditions_enabled = (empty($ad->conditions['enabled'])) ? 0 : 1; ?>
8
  <label><input type="radio" name="advanced_ad[conditions][enabled]" value="0" <?php checked($conditions_enabled, 0); ?>/><?php _e('Display ad everywhere', ADVADS_SLUG); ?></label>
9
  <label><input type="radio" name="advanced_ad[conditions][enabled]" value="1" <?php checked($conditions_enabled, 1); ?>/><?php _e('Set display conditions', ADVADS_SLUG); ?></label>
10
  </div>
11
- <p class="advads-toggle-link" onclick="advads_toggle('#advads-how-it-works')">>>><?php _e('Click to see Help', $this->plugin_slug); ?><<<</p>
12
- <ul id="advads-how-it-works" style="display: none;">
13
- <li><?php _e('If you want to display the ad everywhere, don’t do anything here. ', $this->plugin_slug); ?></li>
14
- <li><?php _e('The fewer conditions you enter, the better the performance will be.', $this->plugin_slug); ?></li>
15
- <li><?php _e('Filling more than one item into the ’show here’ text field means at least one of them needs to be true. (OR)', $this->plugin_slug); ?></li>
16
- <li><?php _e('Filling more than one item into the ’don’t show’ text field means all must match (AND).', $this->plugin_slug); ?></li>
17
- <li><?php _e('When using one of the two choices on checkbox conditions, the rule is binding. E.g. "Front Page: show here" will result on the ad being only visible on the front page.', $this->plugin_slug); ?></li>
18
- <li><?php _e('If there is nothing in the row, there won’t be any check. Meaning, if you leave everything empty, the ad will be displayed everywhere.', $this->plugin_slug); ?></li>
19
- </ul>
20
  <div id="advanced-ad-conditions">
21
- <?php global $advanced_ads_ad_conditions;
 
 
 
 
 
 
22
  if (is_array($advanced_ads_ad_conditions)) :
23
  foreach ($advanced_ads_ad_conditions as $_key => $_condition) :
24
- if(!isset($_condition['callback'])) continue;
 
25
  ?><div class="advanced-ad-display-condition">
26
- <?php if(is_array($_condition['callback']) && method_exists($_condition['callback'][0], $_condition['callback'][1])) {
 
27
  call_user_func(array($_condition['callback'][0], $_condition['callback'][1]), $ad); // works also in php below 5.3
28
  // $_condition['callback'][0]::$_condition['callback'][1]($ad); // works only in php 5.3 and above
29
  }
30
- ?></div><?php
31
- endforeach;
32
- ?><p><?php _e('UPDATE NOTICE: I am currently moving the old settings from below to a new form (above). Don’t worry, the old settings will still work in the future.', ADVADS_SLUG); ?></p>
33
- <table>
34
- <thead>
35
- <tr>
36
- <th></th>
37
- <th><?php _e('show here', $this->plugin_slug); ?></th>
38
- <th><?php _e('DON’T show', $this->plugin_slug); ?></th>
39
- <th></th>
40
- </tr><?php
41
- foreach ($advanced_ads_ad_conditions as $_key => $_condition) :
42
- if(isset($_condition['callback'])) continue;
43
- ?><tr>
44
- <th><?php echo $_condition['label']; ?>
45
- <?php if (!empty($_condition['description'])) : ?>
46
- <span class="description" title="<?php echo $_condition['description']; ?>">(?)</span>
47
- <?php endif; ?>
48
- </th>
49
- <?php if (empty($_condition['type'])) : continue; ?>
50
- <?php elseif ($_condition['type'] == 'idfield' || $_condition['type'] == 'textvalues') : ?>
51
- <td><input type="text" name="advanced_ad[conditions][<?php echo $_key; ?>][include]" value="<?php if(isset($ad->conditions[$_key]['include'])) echo $ad->conditions[$_key]['include']; ?>"/></td>
52
- <td><input type="text" name="advanced_ad[conditions][<?php echo $_key; ?>][exclude]" value="<?php if(isset($ad->conditions[$_key]['exclude'])) echo $ad->conditions[$_key]['exclude']; ?>"/></td>
 
 
53
  <?php elseif ($_condition['type'] == 'radio') : ?>
54
- <td><input type="radio" name="advanced_ad[conditions][<?php echo $_key; ?>]" value="1" <?php if(isset($ad->conditions[$_key])) checked($ad->conditions[$_key], 1) ?>/></td>
55
- <td><input type="radio" name="advanced_ad[conditions][<?php echo $_key; ?>]" value="0" <?php if(isset($ad->conditions[$_key])) checked($ad->conditions[$_key], 0) ?>/></td>
56
- <?php endif; ?>
57
- <td><button type="button" class="clear-radio"><?php _e('clear', $this->plugin_slug); ?></button></td>
58
- </tr>
59
- <?php endforeach;?>
60
- </thead>
61
- </table>
 
 
 
 
 
 
 
 
 
62
  </div>
63
- <?php endif;
 
1
+ <?php
2
+ // include callback file
3
  require_once(ADVADS_BASE_PATH . 'admin/includes/class-display-condition-callbacks.php');
4
  ?>
5
  <?php $types = Advanced_Ads::get_instance()->ad_types; ?>
6
+ <p class="description"><?php _e('Choose where to display the ad and where to hide it.', ADVADS_SLUG); ?></p>
7
  <div id="advanced-ad-conditions-enable">
8
+ <?php $conditions_enabled = (empty($ad->conditions['enabled'])) ? 0 : 1; ?>
9
  <label><input type="radio" name="advanced_ad[conditions][enabled]" value="0" <?php checked($conditions_enabled, 0); ?>/><?php _e('Display ad everywhere', ADVADS_SLUG); ?></label>
10
  <label><input type="radio" name="advanced_ad[conditions][enabled]" value="1" <?php checked($conditions_enabled, 1); ?>/><?php _e('Set display conditions', ADVADS_SLUG); ?></label>
11
  </div>
 
 
 
 
 
 
 
 
 
12
  <div id="advanced-ad-conditions">
13
+ <ul id="advads-how-it-works">
14
+ <li><?php _e('If you want to display the ad everywhere, don’t do anything here. ', ADVADS_SLUG); ?></li>
15
+ <li><?php _e('The fewer conditions you enter, the better the performance will be.', ADVADS_SLUG); ?></li>
16
+ <li><?php printf(__('Learn more about display conditions from the <a href="%s" target="_blank">manual</a>.', ADVADS_SLUG), 'http://wpadvancedads.com/advancedads/manual/display-conditions/'); ?></li>
17
+ </ul>
18
+ <?php
19
+ global $advanced_ads_ad_conditions;
20
  if (is_array($advanced_ads_ad_conditions)) :
21
  foreach ($advanced_ads_ad_conditions as $_key => $_condition) :
22
+ if (!isset($_condition['callback']))
23
+ continue;
24
  ?><div class="advanced-ad-display-condition">
25
+ <?php
26
+ if (is_array($_condition['callback']) && method_exists($_condition['callback'][0], $_condition['callback'][1])) {
27
  call_user_func(array($_condition['callback'][0], $_condition['callback'][1]), $ad); // works also in php below 5.3
28
  // $_condition['callback'][0]::$_condition['callback'][1]($ad); // works only in php 5.3 and above
29
  }
30
+ ?></div><?php
31
+ endforeach;
32
+ ?><h4><?php _e('Other conditions', ADVADS_SLUG); ?></h4>
33
+ <p><?php _e('When using one of the two choices on checkbox conditions, the rule is binding. E.g. "Front Page: show" will result on the ad being only visible on the front page.', ADVADS_SLUG); ?></p>
34
+ <table>
35
+ <thead>
36
+ <tr>
37
+ <th></th>
38
+ <th><?php _e('show', ADVADS_SLUG); ?></th>
39
+ <th><?php _e('hide', ADVADS_SLUG); ?></th>
40
+ <th></th>
41
+ </tr><?php
42
+ foreach ($advanced_ads_ad_conditions as $_key => $_condition) :
43
+ if (isset($_condition['callback']))
44
+ continue;
45
+ ?><tr>
46
+ <th><?php echo $_condition['label']; ?>
47
+ <?php if (!empty($_condition['description'])) : ?>
48
+ <span class="description" title="<?php echo $_condition['description']; ?>">(?)</span>
49
+ <?php endif; ?>
50
+ </th>
51
+ <?php if (empty($_condition['type'])) : continue; ?>
52
+ <?php elseif ($_condition['type'] == 'idfield' || $_condition['type'] == 'textvalues') : ?>
53
+ <td><input type="text" name="advanced_ad[conditions][<?php echo $_key; ?>][include]" value="<?php if (isset($ad->conditions[$_key]['include'])) echo $ad->conditions[$_key]['include']; ?>"/></td>
54
+ <td><input type="text" name="advanced_ad[conditions][<?php echo $_key; ?>][exclude]" value="<?php if (isset($ad->conditions[$_key]['exclude'])) echo $ad->conditions[$_key]['exclude']; ?>"/></td>
55
  <?php elseif ($_condition['type'] == 'radio') : ?>
56
+ <td><input type="radio" name="advanced_ad[conditions][<?php echo $_key; ?>]" value="1" <?php if (isset($ad->conditions[$_key])) checked($ad->conditions[$_key], 1) ?>/></td>
57
+ <td><input type="radio" name="advanced_ad[conditions][<?php echo $_key; ?>]" value="0" <?php if (isset($ad->conditions[$_key])) checked($ad->conditions[$_key], 0) ?>/></td>
58
+ <?php endif; ?>
59
+ <td><button type="button" class="clear-radio"><?php _e('clear', ADVADS_SLUG); ?></button></td>
60
+ </tr>
61
+ <?php endforeach; ?>
62
+ </thead>
63
+ </table><?php
64
+ if(WP_DEBUG) : ?>
65
+ <fieldset class="advads-debug-output advads-debug-output-conditions"><legend onclick="advads_toggle('.advads-debug-output-conditions .inner')"><?php
66
+ _e('show debug output', ADVADS_SLUG); ?></legend><div class="inner" style="display:none;">
67
+ <p class="description"><?php _e('Values saved for this ad in the database (post metas)', ADVADS_SLUG); ?></p><?php
68
+ echo "<pre>";
69
+ print_r($ad->conditions);
70
+ echo "</pre>";
71
+ ?></div></fieldset>
72
+ <?php endif; ?>
73
  </div>
74
+ <?php
75
+ endif;
admin/views/overview.php CHANGED
@@ -4,7 +4,7 @@
4
  */
5
  ?><div class="wrap">
6
  <?php screen_icon(); ?>
7
- <h1><?php echo esc_html(get_admin_page_title()); ?></h1>
8
  <div class="advads-content-wrapper">
9
  <div class="advads-content-left">
10
  <div class="advads-box">
@@ -28,6 +28,9 @@
28
  ?>
29
  <?php endforeach; ?>
30
  </ul>
 
 
 
31
  <?php endif; ?>
32
  </div>
33
  <br class="clear"/>
@@ -51,6 +54,9 @@
51
  ?>
52
  <?php endforeach; ?>
53
  </ul>
 
 
 
54
  <?php endif; ?>
55
  </div>
56
  <br class="clear"/>
@@ -74,6 +80,9 @@
74
  ?>
75
  <?php endforeach; ?>
76
  </ul>
 
 
 
77
  <?php endif; ?>
78
  </div>
79
  <br class="clear"/>
@@ -98,6 +107,8 @@
98
  <li><a href="http://wpadvancedads.com/layer-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">PopUp and Layer Ads</a></li>
99
  <li><a href="http://wpadvancedads.com/sticky-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">Sticky Ads</a></li>
100
  </ul>
 
 
101
  </div>
102
  </div>
103
  </div>
4
  */
5
  ?><div class="wrap">
6
  <?php screen_icon(); ?>
7
+ <h2><?php echo esc_html(get_admin_page_title()); ?></h2>
8
  <div class="advads-content-wrapper">
9
  <div class="advads-content-left">
10
  <div class="advads-box">
28
  ?>
29
  <?php endforeach; ?>
30
  </ul>
31
+ <?php else : ?>
32
+ <a class="button button-primary" href="<?php echo admin_url('post-new.php?post_type=' . $this->post_type);
33
+ ?>"><?php _e('Create your first ad', ADVADS_SLUG); ?></a>
34
  <?php endif; ?>
35
  </div>
36
  <br class="clear"/>
54
  ?>
55
  <?php endforeach; ?>
56
  </ul>
57
+ <?php else : ?>
58
+ <a class="button button-primary" href="<?php echo admin_url('admin.php?action=edit&page=advanced-ads-groups');
59
+ ?>"><?php _e('Create your first group', ADVADS_SLUG); ?></a>
60
  <?php endif; ?>
61
  </div>
62
  <br class="clear"/>
80
  ?>
81
  <?php endforeach; ?>
82
  </ul>
83
+ <?php else : ?>
84
+ <a class="button button-primary" href="<?php echo admin_url('admin.php?page=advanced-ads-placements');
85
+ ?>"><?php _e('Create your first placement', ADVADS_SLUG); ?></a>
86
  <?php endif; ?>
87
  </div>
88
  <br class="clear"/>
107
  <li><a href="http://wpadvancedads.com/layer-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">PopUp and Layer Ads</a></li>
108
  <li><a href="http://wpadvancedads.com/sticky-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">Sticky Ads</a></li>
109
  </ul>
110
+ <a class="button button-primary" target="_blank" href="http://wpadvancedads.com"><?php
111
+ _e('See Add-Ons', ADVADS_SLUG); ?></a>
112
  </div>
113
  </div>
114
  </div>
advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: http://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.2.5
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: http://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.2.6
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
classes/ad.php CHANGED
@@ -227,7 +227,7 @@ class Advads_Ad {
227
  $see_ads_capability = (!empty($options['hide-for-user-role'])) ? $options['hide-for-user-role'] : 0;
228
 
229
  // don’t display ads that are not published or private for users not logged in
230
- if($this->status !== 'publish' && ($this->status === 'private' && !is_user_logged_in())){
231
  return false;
232
  }
233
 
@@ -268,27 +268,36 @@ class Advads_Ad {
268
  switch($_cond_key){
269
  // check for post ids
270
  case 'postids' :
271
- // included posts
272
- if(!empty($_cond_value['include'])){
273
- $post_ids = explode(',', $_cond_value['include']);
274
- if(is_array($post_ids)
275
- && isset($post->ID)
276
- && !in_array($post->ID, $post_ids))
277
- return false;
278
- }
279
- // excluded posts
280
- if(!empty($_cond_value['exclude'])){
281
- $post_ids = explode(',', $_cond_value['exclude']);
282
- if(is_array($post_ids)
283
- && isset($post->ID)
284
- && in_array($post->ID, $post_ids))
 
 
 
 
 
 
 
285
  return false;
 
 
286
  }
287
  break;
288
  // check for category ids
289
  case 'categoryids' :
290
  // included
291
- if(is_archive() && empty($_cond_value['all'])){
292
  if(!empty($_cond_value['include'])){
293
  if(is_string($_cond_value['include'])){
294
  $category_ids = explode(',', $_cond_value['include']);
@@ -320,7 +329,7 @@ class Advads_Ad {
320
  // check for included category archive ids
321
  // @link http://codex.wordpress.org/Conditional_Tags#A_Category_Page
322
  case 'categoryarchiveids' :
323
- if(isset($query->term_id) && empty($_cond_value['all'])){
324
  if(!empty($_cond_value['include'])){
325
  if(is_string($_cond_value['include'])){
326
  $category_ids = explode(',', $_cond_value['include']);
@@ -372,8 +381,8 @@ class Advads_Ad {
372
  // check is_front_page
373
  // @link https://codex.wordpress.org/Conditional_Tags#The_Front_Page
374
  case 'is_front_page' :
375
- if(($_cond_value == 1 && !is_front_page())
376
- || ($_cond_value == 0 && is_front_page()))
377
  return false;
378
  break;
379
  // check is_singular
@@ -547,11 +556,30 @@ class Advads_Ad {
547
  if(!is_array($conditions) || $conditions == array()) return array();
548
 
549
  foreach($conditions as $_key => $_condition){
550
- if(!is_array($_condition))
551
- $_condition = trim($_condition);
552
- if($_condition == '') {
553
- $conditions[$_key] = $_condition;
554
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  }
556
  $type = !empty($advanced_ads_ad_conditions[$_key]['type']) ? $advanced_ads_ad_conditions[$_key]['type'] : 0;
557
  if(empty($type)) continue;
@@ -571,6 +599,7 @@ class Advads_Ad {
571
  */
572
  public static function sanitize_condition_idfield($cond = ''){
573
  // strip anything that is not comma or number
 
574
  if(is_array($cond)){
575
  foreach($cond as $_key => $_cond){
576
  $cond[$_key] = preg_replace('#[^0-9,]#', '', $_cond);
227
  $see_ads_capability = (!empty($options['hide-for-user-role'])) ? $options['hide-for-user-role'] : 0;
228
 
229
  // don’t display ads that are not published or private for users not logged in
230
+ if($this->status !== 'publish' && !($this->status === 'private' && !is_user_logged_in())){
231
  return false;
232
  }
233
 
268
  switch($_cond_key){
269
  // check for post ids
270
  case 'postids' :
271
+ if(is_singular() && empty($_cond_value['all'])){
272
+ // included posts
273
+ if(!empty($_cond_value['include'])){
274
+ if(is_string($_cond_value['include'])){
275
+ $post_ids = explode(',', $_cond_value['include']);
276
+ } else {
277
+ $post_ids = $_cond_value['include'];
278
+ }
279
+ if(is_array($post_ids)
280
+ && isset($post->ID)
281
+ && !in_array($post->ID, $post_ids))
282
+ return false;
283
+ }
284
+ // excluded posts
285
+ if(!empty($_cond_value['exclude'])){
286
+ if(is_string($_cond_value['exclude'])){
287
+ $post_ids = explode(',', $_cond_value['exclude']);
288
+ } else {
289
+ $post_ids = $_cond_value['exclude'];
290
+ }
291
+ if(is_array($post_ids) && isset($post->ID) && in_array($post->ID, $post_ids)){
292
  return false;
293
+ }
294
+ }
295
  }
296
  break;
297
  // check for category ids
298
  case 'categoryids' :
299
  // included
300
+ if(is_singular() && empty($_cond_value['all'])){
301
  if(!empty($_cond_value['include'])){
302
  if(is_string($_cond_value['include'])){
303
  $category_ids = explode(',', $_cond_value['include']);
329
  // check for included category archive ids
330
  // @link http://codex.wordpress.org/Conditional_Tags#A_Category_Page
331
  case 'categoryarchiveids' :
332
+ if(isset($query->term_id) && is_archive() && empty($_cond_value['all'])){
333
  if(!empty($_cond_value['include'])){
334
  if(is_string($_cond_value['include'])){
335
  $category_ids = explode(',', $_cond_value['include']);
381
  // check is_front_page
382
  // @link https://codex.wordpress.org/Conditional_Tags#The_Front_Page
383
  case 'is_front_page' :
384
+ if(($_cond_value == 1 && (!is_front_page() && !is_home))
385
+ || ($_cond_value == 0 && (is_front_page() || is_home())))
386
  return false;
387
  break;
388
  // check is_singular
556
  if(!is_array($conditions) || $conditions == array()) return array();
557
 
558
  foreach($conditions as $_key => $_condition){
559
+ if($_key == 'postids'){
560
+ // sanitize single post conditions
561
+ if(empty($_condition['ids'])){ // remove, if empty
562
+ $_condition['include'] = array();
563
+ $_condition['exclude'] = array();
564
+ } else {
565
+ switch($_condition['method']){
566
+ case 'include' :
567
+ $_condition['include'] = $_condition['ids'];
568
+ $_condition['exclude'] = array();
569
+ break;
570
+ case 'exclude' :
571
+ $_condition['include'] = array();
572
+ $_condition['exclude'] = $_condition['ids'];
573
+ break;
574
+ }
575
+ }
576
+ } else {
577
+ if(!is_array($_condition))
578
+ $_condition = trim($_condition);
579
+ if($_condition == '') {
580
+ $conditions[$_key] = $_condition;
581
+ continue;
582
+ }
583
  }
584
  $type = !empty($advanced_ads_ad_conditions[$_key]['type']) ? $advanced_ads_ad_conditions[$_key]['type'] : 0;
585
  if(empty($type)) continue;
599
  */
600
  public static function sanitize_condition_idfield($cond = ''){
601
  // strip anything that is not comma or number
602
+
603
  if(is_array($cond)){
604
  foreach($cond as $_key => $_cond){
605
  $cond[$_key] = preg_replace('#[^0-9,]#', '', $_cond);
includes/array_ad_conditions.php CHANGED
@@ -14,6 +14,7 @@
14
  * type - information / markup type
15
  * idfield - input field for comma separated lists of ids
16
  * radio - radio button
 
17
  *
18
  * note: ’idfield’ always has a {field}_not version that is created automatically and being its own condition
19
  *
@@ -28,11 +29,6 @@ $advanced_ads_ad_conditions = array(
28
  'type' => 'textvalues',
29
  'callback' => array('AdvAds_Display_Condition_Callbacks', 'post_types')
30
  ),
31
- 'postids' => array(
32
- 'label' => __('Single Pages/Posts', $advanced_ads_slug),
33
- 'description' => __('comma seperated IDs of post, page or custom post type', $advanced_ads_slug),
34
- 'type' => 'idfield',
35
- ),
36
  'categoryids' => array(
37
  'label' => __('Categories, Tags and Taxonomies', $advanced_ads_slug),
38
  'description' => __('Choose terms from public category, tag and other taxonomies a post must belong to in order to have ads.', $advanced_ads_slug),
@@ -45,6 +41,12 @@ $advanced_ads_ad_conditions = array(
45
  'type' => 'idfield',
46
  'callback' => array('AdvAds_Display_Condition_Callbacks', 'category_archives')
47
  ),
 
 
 
 
 
 
48
  'is_front_page' => array(
49
  'label' => __('Home Page', $advanced_ads_slug),
50
  'description' => __('(don’t) show on Home page', $advanced_ads_slug),
14
  * type - information / markup type
15
  * idfield - input field for comma separated lists of ids
16
  * radio - radio button
17
+ * others - added to not trigger internal sanitization
18
  *
19
  * note: ’idfield’ always has a {field}_not version that is created automatically and being its own condition
20
  *
29
  'type' => 'textvalues',
30
  'callback' => array('AdvAds_Display_Condition_Callbacks', 'post_types')
31
  ),
 
 
 
 
 
32
  'categoryids' => array(
33
  'label' => __('Categories, Tags and Taxonomies', $advanced_ads_slug),
34
  'description' => __('Choose terms from public category, tag and other taxonomies a post must belong to in order to have ads.', $advanced_ads_slug),
41
  'type' => 'idfield',
42
  'callback' => array('AdvAds_Display_Condition_Callbacks', 'category_archives')
43
  ),
44
+ 'postids' => array(
45
+ 'label' => __('Individual Posts, Pages and Public Post Types', $advanced_ads_slug),
46
+ 'description' => __('Choose on which individual posts, pages and public post type pages you want to display or hide ads.', $advanced_ads_slug),
47
+ 'type' => 'other',
48
+ 'callback' => array('AdvAds_Display_Condition_Callbacks', 'single_posts')
49
+ ),
50
  'is_front_page' => array(
51
  'label' => __('Home Page', $advanced_ads_slug),
52
  'description' => __('(don’t) show on Home page', $advanced_ads_slug),
public/class-advanced-ads.php CHANGED
@@ -25,7 +25,7 @@ class Advanced_Ads {
25
  * @var string
26
  */
27
 
28
- const VERSION = '1.2.5';
29
 
30
  /**
31
  * post type slug
25
  * @var string
26
  */
27
 
28
+ const VERSION = '1.2.6';
29
 
30
  /**
31
  * post type slug
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, adsense, display, banner, advertisements, adverts, advert, monetization
5
  Requires at least: WP 3.5, PHP 5.3
6
  Tested up to: 4.0.0
7
- Stable tag: 1.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -134,6 +134,19 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
134
 
135
  == Changelog ==
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  = 1.2.5 =
138
 
139
  * fixed wrong links on overview page
4
  Tags: ads, ad, adsense, display, banner, advertisements, adverts, advert, monetization
5
  Requires at least: WP 3.5, PHP 5.3
6
  Tested up to: 4.0.0
7
+ Stable tag: 1.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
134
 
135
  == Changelog ==
136
 
137
+ = 1.2.6 =
138
+
139
+ * layout updates to display condition box
140
+ * moved single post display condition to new layout
141
+ * individual post ids display condition is now only checked on singular pages
142
+ * added quick action buttons to overview page
143
+ * added debug output for display conditions (if WP_DEBUG is true)
144
+ * fixed bug with trashed ads still showing
145
+ * fixed admin notices appearing on overview page on the wrong place
146
+ * fixed display conditions for category of post and category archives interfered with each other
147
+
148
+ IMPORTANT: It is no longer possible to use the single post display condition to select individual posts where the ad is displayed and where it is hidden at the same time. This didn’t made sense before and is prevented now completely.
149
+
150
  = 1.2.5 =
151
 
152
  * fixed wrong links on overview page