Advanced Ads - Version 1.7.1.1

Version Description

  • added Feed condition to General Display Conditions
  • trim license keys when saving
  • reverted too strict display condition checks for taxonomies
  • shortened debug page
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.1.1

admin/class-advanced-ads-admin.php CHANGED
@@ -1045,6 +1045,7 @@ class Advanced_Ads_Admin {
1045
  $disable_404 = isset($options['disabled-ads']['404']) ? 1 : 0;
1046
  $disable_archives = isset($options['disabled-ads']['archives']) ? 1 : 0;
1047
  $disable_secondary = isset($options['disabled-ads']['secondary']) ? 1 : 0;
 
1048
 
1049
  // load the template
1050
  include ADVADS_BASE_PATH . 'admin/views/settings-disable-ads.php';
@@ -1256,6 +1257,9 @@ class Advanced_Ads_Admin {
1256
  $editor_role->remove_cap( 'advanced_ads_place_ads' );
1257
  }
1258
 
 
 
 
1259
  return $options;
1260
  }
1261
 
@@ -1271,6 +1275,9 @@ class Advanced_Ads_Admin {
1271
 
1272
  // get existing license keys
1273
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
 
 
 
1274
 
1275
  // merge existing with new license key to prevent accidental removal
1276
  if( is_array( $options ) && is_array( $licenses ) ){
1045
  $disable_404 = isset($options['disabled-ads']['404']) ? 1 : 0;
1046
  $disable_archives = isset($options['disabled-ads']['archives']) ? 1 : 0;
1047
  $disable_secondary = isset($options['disabled-ads']['secondary']) ? 1 : 0;
1048
+ $disable_feed = ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ? 1 : 0;
1049
 
1050
  // load the template
1051
  include ADVADS_BASE_PATH . 'admin/views/settings-disable-ads.php';
1257
  $editor_role->remove_cap( 'advanced_ads_place_ads' );
1258
  }
1259
 
1260
+ // we need 3 states: ! isset, 1, 0
1261
+ $options['disabled-ads']['feed'] = isset( $options['disabled-ads']['feed'] ) ? 1 : 0;
1262
+
1263
  return $options;
1264
  }
1265
 
1275
 
1276
  // get existing license keys
1277
  $licenses = get_option( ADVADS_SLUG . '-licenses', array() );
1278
+
1279
+ // trim all keys
1280
+ $options = array_map('trim', $options);
1281
 
1282
  // merge existing with new license key to prevent accidental removal
1283
  if( is_array( $options ) && is_array( $licenses ) ){
admin/views/ad-group.php CHANGED
@@ -53,7 +53,7 @@ if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || iss
53
  <?php if ( isset($message) ) : ?>
54
  <div id="message" class="updated"><p><?php echo $message; ?></p></div>
55
  <?php
56
- $_SERVER['REQUEST_URI'] = remove_query_arg( array('message'), $_SERVER['REQUEST_URI'] );
57
  endif;
58
  ?>
59
  <div id="ajax-response"></div>
53
  <?php if ( isset($message) ) : ?>
54
  <div id="message" class="updated"><p><?php echo $message; ?></p></div>
55
  <?php
56
+ $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array('message'), $_SERVER['REQUEST_URI'] ) );
57
  endif;
58
  ?>
59
  <div id="ajax-response"></div>
admin/views/debug.php CHANGED
@@ -5,14 +5,10 @@
5
  ?><div class="wrap">
6
  <h1><?php _e( 'Debug Page', 'advanced-ads' ); ?></h1>
7
  <p><?php _e( 'Work in progress', 'advanced-ads' ); ?></p>
8
- <p><?php _e( 'This screen is work in progress. You can use the information if you understand them, but there is nothing to do here yet.', 'advanced-ads' ); ?></p>
9
  <?php screen_icon(); ?>
10
 
11
  <h2><?php _e( 'Settings', 'advanced-ads' ); ?></h2>
12
  <pre><?php print_r( $plugin_options ); ?></pre>
13
 
14
- <h2><?php _e( 'Ad Placements', 'advanced-ads' ); ?></h2>
15
- <pre><?php print_r( $ad_placements ); ?></pre>
16
-
17
  <?php do_action('advanced-ads-debug-after', $plugin_options); ?>
18
  </div>
5
  ?><div class="wrap">
6
  <h1><?php _e( 'Debug Page', 'advanced-ads' ); ?></h1>
7
  <p><?php _e( 'Work in progress', 'advanced-ads' ); ?></p>
 
8
  <?php screen_icon(); ?>
9
 
10
  <h2><?php _e( 'Settings', 'advanced-ads' ); ?></h2>
11
  <pre><?php print_r( $plugin_options ); ?></pre>
12
 
 
 
 
13
  <?php do_action('advanced-ads-debug-after', $plugin_options); ?>
14
  </div>
admin/views/settings-disable-ads.php CHANGED
@@ -14,4 +14,8 @@
14
  <label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php
15
  echo ADVADS_SLUG; ?>[disabled-ads][secondary]" <?php checked( $disable_secondary, 1 );
16
  ?>><?php _e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
17
- <p class="description"><?php _e( 'Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear.', 'advanced-ads' ); ?></p>
 
 
 
 
14
  <label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php
15
  echo ADVADS_SLUG; ?>[disabled-ads][secondary]" <?php checked( $disable_secondary, 1 );
16
  ?>><?php _e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
17
+ <p class="description"><?php _e( 'Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear.', 'advanced-ads' ); ?></p>
18
+
19
+ <label><input id="advanced-ads-disable-ads-feed" type="checkbox" value="1" name="<?php
20
+ echo ADVADS_SLUG; ?>[disabled-ads][feed]" <?php checked( $disable_feed, 1 );
21
+ ?>><?php _e( 'Disable ads in Feed', 'advanced-ads' ); ?></label>
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.1
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.1' );
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.1.1
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.1.1' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad.php CHANGED
@@ -326,6 +326,9 @@ class Advanced_Ads_Ad {
326
  * @return bool $can_display true if can be displayed in frontend based on visitor settings
327
  */
328
  public function can_display_by_visitor(){
 
 
 
329
 
330
  // check old "visitor" and new "visitors" conditions
331
  if ( ( empty($this->options['visitors']) ||
326
  * @return bool $can_display true if can be displayed in frontend based on visitor settings
327
  */
328
  public function can_display_by_visitor(){
329
+ if ( ! empty( $this->options['wp_the_query']['is_feed'] ) ) {
330
+ return true;
331
+ }
332
 
333
  // check old "visitor" and new "visitors" conditions
334
  if ( ( empty($this->options['visitors']) ||
classes/ad_placements.php CHANGED
@@ -77,7 +77,7 @@ class Advanced_Ads_Placements {
77
  if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_placements') ) ) {
78
  return;
79
  }
80
- remove_query_arg('message');
81
 
82
  if ( isset($_POST['advads']['placement']) && check_admin_referer( 'advads-placement', 'advads_placement' ) ){
83
  $success = self::save_new_placement( $_POST['advads']['placement'] );
@@ -89,7 +89,7 @@ class Advanced_Ads_Placements {
89
 
90
  if(isset($success)){
91
  $message = $success ? 'updated' : 'error';
92
- wp_redirect( add_query_arg(array('message' => $message)) );
93
  }
94
  }
95
 
77
  if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_placements') ) ) {
78
  return;
79
  }
80
+ esc_url( remove_query_arg('message') );
81
 
82
  if ( isset($_POST['advads']['placement']) && check_admin_referer( 'advads-placement', 'advads_placement' ) ){
83
  $success = self::save_new_placement( $_POST['advads']['placement'] );
89
 
90
  if(isset($success)){
91
  $message = $success ? 'updated' : 'error';
92
+ wp_redirect( esc_url( add_query_arg(array('message' => $message)) ) );
93
  }
94
  }
95
 
classes/display-conditions.php CHANGED
@@ -33,6 +33,7 @@ class Advanced_Ads_Display_Conditions {
33
  'is_attachment',
34
  'is_singular',
35
  'is_front_page',
 
36
  );
37
 
38
  // this is how the general conditions should look like by default
@@ -43,7 +44,8 @@ class Advanced_Ads_Display_Conditions {
43
  'is_search',
44
  'is_404',
45
  'is_attachment',
46
- 'is_main_query'
 
47
  );
48
 
49
  public function __construct() {
@@ -464,6 +466,11 @@ class Advanced_Ads_Display_Conditions {
464
  'label' => __('Secondary Queries', 'advanced-ads'),
465
  'description' => __('allow ads in secondary queries', 'advanced-ads'),
466
  'type' => 'radio',
 
 
 
 
 
467
  )
468
  );
469
  }
@@ -565,7 +572,7 @@ class Advanced_Ads_Display_Conditions {
565
  return true;
566
  }
567
 
568
- if ( ! isset($query['is_singular']) || ! $query['is_singular'] || !self::can_display_ids($options['value'], $term_ids, $operator)
569
  ) {
570
  return false;
571
  }
@@ -594,7 +601,7 @@ class Advanced_Ads_Display_Conditions {
594
  $ad_options = $ad->options();
595
  $query = $ad_options['wp_the_query'];
596
 
597
- if ( ! isset($query['term_id']) || ! isset($query['is_archive']) || ! $query['is_archive'] || !self::can_display_ids($query['term_id'], $options['value'], $operator)
598
  ) {
599
  return false;
600
  }
33
  'is_attachment',
34
  'is_singular',
35
  'is_front_page',
36
+ 'is_feed'
37
  );
38
 
39
  // this is how the general conditions should look like by default
44
  'is_search',
45
  'is_404',
46
  'is_attachment',
47
+ 'is_main_query',
48
+ 'is_feed'
49
  );
50
 
51
  public function __construct() {
466
  'label' => __('Secondary Queries', 'advanced-ads'),
467
  'description' => __('allow ads in secondary queries', 'advanced-ads'),
468
  'type' => 'radio',
469
+ ),
470
+ 'is_feed' => array(
471
+ 'label' => __('Feed', 'advanced-ads'),
472
+ 'description' => __('allow ads in Feed', 'advanced-ads'),
473
+ 'type' => 'radio',
474
  )
475
  );
476
  }
572
  return true;
573
  }
574
 
575
+ if (isset($query['is_singular']) && $query['is_singular'] && !self::can_display_ids($options['value'], $term_ids, $operator)
576
  ) {
577
  return false;
578
  }
601
  $ad_options = $ad->options();
602
  $query = $ad_options['wp_the_query'];
603
 
604
+ if ( isset($query['term_id']) && isset($query['is_archive']) && $query['is_archive'] && !self::can_display_ids($query['term_id'], $options['value'], $operator)
605
  ) {
606
  return false;
607
  }
public/class-advanced-ads.php CHANGED
@@ -250,6 +250,12 @@ class Advanced_Ads {
250
  return;
251
  }
252
 
 
 
 
 
 
 
253
  // check if ads are disabled on the current page
254
  if ( $wp_the_query->is_singular() && isset($post->ID) ){
255
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
@@ -361,7 +367,7 @@ class Advanced_Ads {
361
  $options = $this->plugin->options();
362
  if( ! isset( $options['content-injection-everywhere'] ) ){
363
  // check if this is a singular page within the loop
364
- if ( ! is_singular( $public_post_types ) || ! in_the_loop() ) { return $content; }
365
  }
366
 
367
  $placements = get_option( 'advads-ads-placements', array() );
250
  return;
251
  }
252
 
253
+ // check if ads are disabled in Feed
254
+ if ( $wp_the_query->is_feed() && ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ) {
255
+ define( 'ADVADS_ADS_DISABLED', true );
256
+ return;
257
+ }
258
+
259
  // check if ads are disabled on the current page
260
  if ( $wp_the_query->is_singular() && isset($post->ID) ){
261
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
367
  $options = $this->plugin->options();
368
  if( ! isset( $options['content-injection-everywhere'] ) ){
369
  // check if this is a singular page within the loop
370
+ if ( ( ! is_singular( $public_post_types ) && ! is_feed() ) || ! in_the_loop() ) { return $content; }
371
  }
372
 
373
  $placements = get_option( 'advads-ads-placements', array() );
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -196,6 +196,13 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
196
 
197
  == Changelog ==
198
 
 
 
 
 
 
 
 
199
  = 1.7.1 =
200
 
201
  * introduced AND/OR connectors for 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.1.1
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.1.1 =
200
+
201
+ * added Feed condition to General Display Conditions
202
+ * trim license keys when saving
203
+ * reverted too strict display condition checks for taxonomies
204
+ * shortened debug page
205
+
206
  = 1.7.1 =
207
 
208
  * introduced AND/OR connectors for Display Conditions