Advanced Ads - Version 1.7.9.3

Version Description

  • added Selling Ads widget on overview page
  • removed add-on update transient hopefully fixing update checks
  • updated EDD class
  • workaround for empty post-id error caused by BuddyPress
Download this release

Release Info

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

Code changes from version 1.7.9.2 to 1.7.9.3

admin/class-advanced-ads-admin.php CHANGED
@@ -574,8 +574,8 @@ class Advanced_Ads_Admin {
574
  */
575
  public function add_on_updater(){
576
 
577
- // ignore, if not main blog
578
- if( is_multisite() && ! is_main_site() ){
579
  return;
580
  }
581
 
@@ -594,13 +594,6 @@ class Advanced_Ads_Admin {
594
  return;
595
  }
596
 
597
- // check only every hour for updates to decrease load on store
598
- // ignore, if force-update was set
599
- if( ! isset( $_GET['force-check'] ) && get_transient( ADVADS_SLUG . '_add-on-updates-checked' ) ){
600
- return;
601
- }
602
- set_transient( ADVADS_SLUG . '_add-on-updates-checked', true, 3600 );
603
-
604
  // load license keys
605
  $licenses = get_option(ADVADS_SLUG . '-licenses', array());
606
 
574
  */
575
  public function add_on_updater(){
576
 
577
+ // ignore, if not main blog or is ajax
578
+ if( ( is_multisite() && ! is_main_site() ) || defined( 'DOING_AJAX' ) ){
579
  return;
580
  }
581
 
594
  return;
595
  }
596
 
 
 
 
 
 
 
 
597
  // load license keys
598
  $licenses = get_option(ADVADS_SLUG . '-licenses', array());
599
 
admin/includes/class-overview-widgets.php CHANGED
@@ -64,8 +64,8 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
64
  array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_layer'), $screen->id, 'side', 'high');
65
  add_meta_box('advads_overview_addon_slider', __( 'Ad Slider', 'advanced-ads' ),
66
  array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_slider'), $screen->id, 'side', 'high');
67
- // add_meta_box('advads_overview_addon_sellingads', __( 'Selling Ads', 'advanced-ads' ),
68
- // array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_sellingads'), $screen->id, 'side', 'high');
69
 
70
  do_action( 'advanced-ads-overview-widgets-after', $screen );
71
  }
@@ -255,8 +255,8 @@ foreach ( $next_steps as $_step ){
255
  * selling ads add-on widget
256
  */
257
  public static function render_add_on_sellingads(){
258
- ?><p><?php _e( 'Let users purchase ads directly in the frontend of your site.', 'advanced-ads' ); ?></p>
259
- <p><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons" target="_blank"><?php
260
  _e( 'Get the Selling Ads add-on', 'advanced-ads' ); ?></a></p><?php
261
  }
262
 
64
  array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_layer'), $screen->id, 'side', 'high');
65
  add_meta_box('advads_overview_addon_slider', __( 'Ad Slider', 'advanced-ads' ),
66
  array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_slider'), $screen->id, 'side', 'high');
67
+ add_meta_box('advads_overview_addon_sellingads', __( 'Selling Ads', 'advanced-ads' ),
68
+ array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_sellingads'), $screen->id, 'side', 'high');
69
 
70
  do_action( 'advanced-ads-overview-widgets-after', $screen );
71
  }
255
  * selling ads add-on widget
256
  */
257
  public static function render_add_on_sellingads(){
258
+ ?><p><?php _e( 'Let advertisers purchase ad space directly on the frontend of your site.', 'advanced-ads' ); ?></p>
259
+ <p><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons" target="_blank"><?php
260
  _e( 'Get the Selling Ads add-on', 'advanced-ads' ); ?></a></p><?php
261
  }
262
 
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.9.2
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.9.2' );
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.9.3
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.9.3' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/EDD_SL_Plugin_Updater.php CHANGED
@@ -10,14 +10,16 @@ if ( ! defined( 'ABSPATH' ) ) exit;
10
  * Allows plugins to use their own update API.
11
  *
12
  * @author Pippin Williamson
13
- * @version 1.6.3
14
  */
15
  class EDD_SL_Plugin_Updater {
16
- private $api_url = '';
17
- private $api_data = array();
18
- private $name = '';
19
- private $slug = '';
20
- private $version = '';
 
 
21
 
22
  /**
23
  * Class constructor.
@@ -33,11 +35,12 @@ class EDD_SL_Plugin_Updater {
33
 
34
  global $edd_plugin_data;
35
 
36
- $this->api_url = trailingslashit( $_api_url );
37
- $this->api_data = $_api_data;
38
- $this->name = plugin_basename( $_plugin_file );
39
- $this->slug = basename( $_plugin_file, '.php' );
40
- $this->version = $_api_data['version'];
 
41
 
42
  $edd_plugin_data[ $this->slug ] = $this->api_data;
43
 
@@ -80,31 +83,31 @@ class EDD_SL_Plugin_Updater {
80
 
81
  global $pagenow;
82
 
83
- if( ! is_object( $_transient_data ) ) {
84
  $_transient_data = new stdClass;
85
  }
86
 
87
- if( 'plugins.php' == $pagenow && is_multisite() ) {
88
  return $_transient_data;
89
  }
90
 
91
- if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
92
-
93
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
94
-
95
- if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
96
 
97
- if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
98
 
99
- $_transient_data->response[ $this->name ] = $version_info;
100
 
101
- }
102
 
103
- $_transient_data->last_checked = time();
104
- $_transient_data->checked[ $this->name ] = $this->version;
105
 
106
  }
107
 
 
 
 
108
  }
109
 
110
  return $_transient_data;
@@ -118,6 +121,10 @@ class EDD_SL_Plugin_Updater {
118
  */
119
  public function show_update_notification( $file, $plugin ) {
120
 
 
 
 
 
121
  if( ! current_user_can( 'update_plugins' ) ) {
122
  return;
123
  }
@@ -134,7 +141,7 @@ class EDD_SL_Plugin_Updater {
134
  remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
135
 
136
  $update_cache = get_site_transient( 'update_plugins' );
137
-
138
  $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
139
 
140
  if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
@@ -177,7 +184,10 @@ class EDD_SL_Plugin_Updater {
177
 
178
  // build a plugin list row, with update notification
179
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
180
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
 
 
 
181
 
182
  $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
183
 
@@ -207,7 +217,6 @@ class EDD_SL_Plugin_Updater {
207
  }
208
  }
209
 
210
-
211
  /**
212
  * Updates information on the "View version x.x details" page with custom data.
213
  *
@@ -242,16 +251,28 @@ class EDD_SL_Plugin_Updater {
242
  )
243
  );
244
 
245
- $api_response = $this->api_request( 'plugin_information', $to_send );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
- if ( false !== $api_response ) {
248
- $_data = $api_response;
249
  }
250
 
251
  return $_data;
252
  }
253
 
254
-
255
  /**
256
  * Disable SSL verification in order to prevent download update failures
257
  *
@@ -288,7 +309,7 @@ class EDD_SL_Plugin_Updater {
288
  return;
289
  }
290
 
291
- if( $this->api_url == home_url() ) {
292
  return false; // Don't allow a plugin to ping itself
293
  }
294
 
@@ -334,7 +355,7 @@ class EDD_SL_Plugin_Updater {
334
  }
335
 
336
  if( ! current_user_can( 'update_plugins' ) ) {
337
- wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
338
  }
339
 
340
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
10
  * Allows plugins to use their own update API.
11
  *
12
  * @author Pippin Williamson
13
+ * @version 1.6.5
14
  */
15
  class EDD_SL_Plugin_Updater {
16
+
17
+ private $api_url = '';
18
+ private $api_data = array();
19
+ private $name = '';
20
+ private $slug = '';
21
+ private $version = '';
22
+ private $wp_override = false;
23
 
24
  /**
25
  * Class constructor.
35
 
36
  global $edd_plugin_data;
37
 
38
+ $this->api_url = trailingslashit( $_api_url );
39
+ $this->api_data = $_api_data;
40
+ $this->name = plugin_basename( $_plugin_file );
41
+ $this->slug = basename( $_plugin_file, '.php' );
42
+ $this->version = $_api_data['version'];
43
+ $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
44
 
45
  $edd_plugin_data[ $this->slug ] = $this->api_data;
46
 
83
 
84
  global $pagenow;
85
 
86
+ if ( ! is_object( $_transient_data ) ) {
87
  $_transient_data = new stdClass;
88
  }
89
 
90
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
91
  return $_transient_data;
92
  }
93
 
94
+ if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
95
+ return $_transient_data;
96
+ }
 
 
97
 
98
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
99
 
100
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
101
 
102
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
103
 
104
+ $_transient_data->response[ $this->name ] = $version_info;
 
105
 
106
  }
107
 
108
+ $_transient_data->last_checked = time();
109
+ $_transient_data->checked[ $this->name ] = $this->version;
110
+
111
  }
112
 
113
  return $_transient_data;
121
  */
122
  public function show_update_notification( $file, $plugin ) {
123
 
124
+ if ( is_network_admin() ) {
125
+ return;
126
+ }
127
+
128
  if( ! current_user_can( 'update_plugins' ) ) {
129
  return;
130
  }
141
  remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
142
 
143
  $update_cache = get_site_transient( 'update_plugins' );
144
+
145
  $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
146
 
147
  if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
184
 
185
  // build a plugin list row, with update notification
186
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
187
+ # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
188
+ echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
189
+ echo '<td colspan="3" class="plugin-update colspanchange">';
190
+ echo '<div class="update-message notice inline notice-warning notice-alt">';
191
 
192
  $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
193
 
217
  }
218
  }
219
 
 
220
  /**
221
  * Updates information on the "View version x.x details" page with custom data.
222
  *
251
  )
252
  );
253
 
254
+ $cache_key = 'edd_api_request_' . substr( md5( serialize( $this->slug ) ), 0, 15 );
255
+
256
+ //Get the transient where we store the api request for this plugin for 24 hours
257
+ $edd_api_request_transient = get_site_transient( $cache_key );
258
+
259
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
260
+ if ( empty( $edd_api_request_transient ) ){
261
+
262
+ $api_response = $this->api_request( 'plugin_information', $to_send );
263
+
264
+ //Expires in 1 day
265
+ set_site_transient( $cache_key, $api_response, DAY_IN_SECONDS );
266
+
267
+ if ( false !== $api_response ) {
268
+ $_data = $api_response;
269
+ }
270
 
 
 
271
  }
272
 
273
  return $_data;
274
  }
275
 
 
276
  /**
277
  * Disable SSL verification in order to prevent download update failures
278
  *
309
  return;
310
  }
311
 
312
+ if( $this->api_url == trailingslashit (home_url() ) ) {
313
  return false; // Don't allow a plugin to ping itself
314
  }
315
 
355
  }
356
 
357
  if( ! current_user_can( 'update_plugins' ) ) {
358
+ wp_die( __( 'You do not have permission to install plugin updates', 'advanced-ads' ), __( 'Error', 'advanced-ads' ), array( 'response' => 403 ) );
359
  }
360
 
361
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
classes/display-conditions.php CHANGED
@@ -660,6 +660,15 @@ class Advanced_Ads_Display_Conditions {
660
  $query = $ad_options['wp_the_query'];
661
  $post_id = isset($ad_options['post']['id']) ? $ad_options['post']['id'] : null;
662
 
 
 
 
 
 
 
 
 
 
663
  if( empty( $ad_options['wp_the_query']['is_singular'] ) ){
664
  if( 'is_not' === $operator ){
665
  return true;
660
  $query = $ad_options['wp_the_query'];
661
  $post_id = isset($ad_options['post']['id']) ? $ad_options['post']['id'] : null;
662
 
663
+ //fixes page id on BuddyPress pages
664
+ if ( $post_id == 0 && class_exists( 'BuddyPress' ) && function_exists( 'bp_current_component' )){
665
+ $component = bp_current_component();
666
+ $bp_pages = get_option( 'bp-pages' );
667
+ if ( isset( $bp_pages[$component] ) ){
668
+ $post_id = $bp_pages[$component];
669
+ }
670
+ }
671
+
672
  if( empty( $ad_options['wp_the_query']['is_singular'] ) ){
673
  if( 'is_not' === $operator ){
674
  return true;
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.6.1
7
- Stable tag: 1.7.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -206,6 +206,13 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
206
 
207
  == Changelog ==
208
 
 
 
 
 
 
 
 
209
  = 1.7.9.2 =
210
 
211
  * display ad health menu only to ad admins
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.6.1
7
+ Stable tag: 1.7.9.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
206
 
207
  == Changelog ==
208
 
209
+ = 1.7.9.3 =
210
+
211
+ * added Selling Ads widget on overview page
212
+ * removed add-on update transient hopefully fixing update checks
213
+ * updated EDD class
214
+ * workaround for empty post-id error caused by BuddyPress
215
+
216
  = 1.7.9.2 =
217
 
218
  * display ad health menu only to ad admins