Advanced Ads - Version 1.7.24

Version Description

  • fixed issue with shortcode button that caused some page builders and scripts to break
  • fixed saving settings on multisite sub-blogs
  • applied fix to updater class
  • fixed basic fix function needed for Sticky ads
Download this release

Release Info

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

Code changes from version 1.7.23 to 1.7.24

admin/includes/class-shortcode-creator.php CHANGED
@@ -46,6 +46,7 @@ class Advanced_Ads_Shortcode_Creator {
46
  add_action( 'wp_ajax_advads_content_for_shortcode_creator', array( $this, 'get_content_for_shortcode_creator' ) );
47
 
48
  add_filter( 'the_editor', array( $this, 'add_addblocker_warning' ) );
 
49
  }
50
 
51
  /**
@@ -143,7 +144,7 @@ class Advanced_Ads_Shortcode_Creator {
143
  }
144
 
145
  /**
146
- * Show a warning above TinyMCE editor when an adblock is enabled.
147
  *
148
  * @param string $output Editor's HTML markup.
149
  */
@@ -153,6 +154,14 @@ class Advanced_Ads_Shortcode_Creator {
153
  printf( __ ( 'Please, either switch off your ad blocker or disable the shortcode button in the <a href="%s" target="_blank">settings</a>.', 'advanced-ads' ),
154
  admin_url( 'admin.php?page=advanced-ads-settings' ) ); ?>
155
  </div>
 
 
 
 
 
 
 
 
156
  <script>
157
  (function(){
158
  if ( 'undefined' === typeof advanced_ads_adblocker_test ) {
@@ -166,6 +175,6 @@ class Advanced_Ads_Shortcode_Creator {
166
  })();
167
  </script>
168
  <?php
169
- return ob_get_clean() . $output;
170
  }
 
171
  }
46
  add_action( 'wp_ajax_advads_content_for_shortcode_creator', array( $this, 'get_content_for_shortcode_creator' ) );
47
 
48
  add_filter( 'the_editor', array( $this, 'add_addblocker_warning' ) );
49
+ add_action( 'admin_footer', array( $this, 'maybe_show_adblocker_warning' ) );
50
  }
51
 
52
  /**
144
  }
145
 
146
  /**
147
+ * Add a warning above TinyMCE editor.
148
  *
149
  * @param string $output Editor's HTML markup.
150
  */
154
  printf( __ ( 'Please, either switch off your ad blocker or disable the shortcode button in the <a href="%s" target="_blank">settings</a>.', 'advanced-ads' ),
155
  admin_url( 'admin.php?page=advanced-ads-settings' ) ); ?>
156
  </div>
157
+ <?php
158
+ return ob_get_clean() . $output;
159
+ }
160
+
161
+ /**
162
+ * Show a warning above TinyMCE editor when an adblock is enabled.
163
+ */
164
+ public function maybe_show_adblocker_warning() { ?>
165
  <script>
166
  (function(){
167
  if ( 'undefined' === typeof advanced_ads_adblocker_test ) {
175
  })();
176
  </script>
177
  <?php
 
178
  }
179
+
180
  }
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.23
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.22' );
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.24
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.24' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/EDD_SL_Plugin_Updater.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
7
  * Allows plugins to use their own update API.
8
  *
9
  * @author Easy Digital Downloads
10
- * @version 1.6.11
11
  */
12
  class EDD_SL_Plugin_Updater {
13
 
@@ -279,8 +279,8 @@ class EDD_SL_Plugin_Updater {
279
  // Convert sections into an associative array, since we're getting an object, but Core expects an array.
280
  if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
281
  $new_sections = array();
282
- foreach ( $_data->sections as $key => $key ) {
283
- $new_sections[ $key ] = $key;
284
  }
285
 
286
  $_data->sections = $new_sections;
@@ -289,8 +289,8 @@ class EDD_SL_Plugin_Updater {
289
  // Convert banners into an associative array, since we're getting an object, but Core expects an array.
290
  if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
291
  $new_banners = array();
292
- foreach ( $_data->banners as $key => $key ) {
293
- $new_banners[ $key ] = $key;
294
  }
295
 
296
  $_data->banners = $new_banners;
7
  * Allows plugins to use their own update API.
8
  *
9
  * @author Easy Digital Downloads
10
+ * @version 1.6.12
11
  */
12
  class EDD_SL_Plugin_Updater {
13
 
279
  // Convert sections into an associative array, since we're getting an object, but Core expects an array.
280
  if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
281
  $new_sections = array();
282
+ foreach ( $_data->sections as $key => $value ) {
283
+ $new_sections[ $key ] = $value;
284
  }
285
 
286
  $_data->sections = $new_sections;
289
  // Convert banners into an associative array, since we're getting an object, but Core expects an array.
290
  if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
291
  $new_banners = array();
292
+ foreach ( $_data->banners as $key => $value ) {
293
+ $new_banners[ $key ] = $value;
294
  }
295
 
296
  $_data->banners = $new_banners;
modules/ad-blocker/classes/plugin.php CHANGED
@@ -118,10 +118,12 @@ class Advanced_Ads_Ad_Blocker
118
  if ( ! isset( $this->options ) ) {
119
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
120
  global $current_site;
 
121
  switch_to_blog( $current_site->blog_id );
122
 
123
  $this->options = get_option( ADVADS_AB_SLUG, array() );
124
- $advads_options = Advanced_Ads::get_instance()->options();
 
125
  $upload_dir = wp_upload_dir();
126
 
127
  restore_current_blog();
118
  if ( ! isset( $this->options ) ) {
119
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
120
  global $current_site;
121
+ // Switch to main blog.
122
  switch_to_blog( $current_site->blog_id );
123
 
124
  $this->options = get_option( ADVADS_AB_SLUG, array() );
125
+ // Do not init options in the 'Advanced_Ads_Plugin' class.
126
+ $advads_options = (array) get_option( ADVADS_SLUG, array() );
127
  $upload_dir = wp_upload_dir();
128
 
129
  restore_current_blog();
public/assets/js/advanced.js CHANGED
@@ -1 +1 @@
1
- advads={supports_localstorage:function(){"use strict";try{return!(!window||void 0===window.localStorage)&&(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0)}catch(a){return!1}},max_per_session:function(a,b){var c=1;if(void 0!==b&&0!==parseInt(b)||(b=1),this.cookie_exists(a)){if(this.get_cookie(a)>=b)return!0;c+=parseInt(this.get_cookie(a))}return this.set_cookie(a,c),!1},count_up:function(a,b){var c=1;this.cookie_exists(a)&&(c+=parseInt(this.get_cookie(a))),this.set_cookie(a,c)},set_cookie_exists:function(a){return!!get_cookie(a)||(set_cookie(a,"",0),!1)},get_cookie:function(a){var b,c,d,e=document.cookie.split(";");for(b=0;b<e.length;b++)if(c=e[b].substr(0,e[b].indexOf("=")),d=e[b].substr(e[b].indexOf("=")+1),c=c.replace(/^\s+|\s+$/g,""),c===a)return unescape(d)},set_cookie:function(a,b,c,d,e,f){var g=24*c*60*60;this.set_cookie_sec(a,b,g,d,e,f)},set_cookie_sec:function(a,b,c,d,e,f){var g=new Date;g.setSeconds(g.getSeconds()+parseInt(c)),document.cookie=a+"="+escape(b)+(null==c?"":"; expires="+g.toUTCString())+(null==d?"; path=/":"; path="+d)+(null==e?"":"; domain="+e)+(null==f?"":"; secure")},cookie_exists:function(a){var b=this.get_cookie(a);return null!==b&&""!==b&&void 0!==b},move:function(a,b,c){var d=jQuery(a);if("undefined"==typeof c&&(c={}),"undefined"==typeof c.css&&(c.css={}),"undefined"==typeof c.method&&(c.method="prependTo"),""===b&&"undefined"!=typeof c.target)switch(c.target){case"wrapper":var e="left";"undefined"!=typeof c.offset&&(e=c.offset),b=this.find_wrapper(a,e)}switch("undefined"==typeof c.moveintohidden&&(b=jQuery(b).filter(":visible")),c.method){case"insertBefore":d.insertBefore(b);break;case"insertAfter":d.insertAfter(b);break;case"appendTo":d.appendTo(b);break;case"prependTo":d.prependTo(b);break;default:d.prependTo(b)}},fix_element:function(a,b){var c=jQuery(a),d=c.parent();"static"!==d.css("position")&&""!==d.css("position")||d.css("position","relative"),"undefined"!=typeof b&&b.is_invisible&&c.show();var e=parseInt(c.offset().top),f=parseInt(c.offset().left);"undefined"!=typeof b&&b.is_invisible&&c.hide(),c.css("position","fixed").css("top",e+"px").css("left",f+"px")},find_wrapper:function(a,b){var c;return jQuery("body").children().each(function(d,e){if(e.id!==a.substring(1)){var f=jQuery(e);if("right"===b&&f.offset().left+jQuery(f).width()<jQuery(window).width()||"left"===b&&f.offset().left>0)return"static"!==f.css("position")&&""!==f.css("position")||f.css("position","relative"),c=e,!1}}),c},center_fixed_element:function(a){var b=jQuery(a),c=jQuery(window).width()/2-parseInt(b.css("width"))/2;b.css("left",c+"px")},center_vertically:function(a){var b=jQuery(a),c=jQuery(window).height()/2-parseInt(b.css("height"))/2;b.css("top",c+"px")},close:function(a){var b=jQuery(a);b.remove()}},jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var a,b=jQuery("<div id='advads-picker-overlay'>"),c=[document.body,document.documentElement,document];b.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),jQuery(document).mousemove(function(d){if(d.target!==a){if(~c.indexOf(d.target))return a=null,void b.hide();var e=jQuery(d.target),f=e.offset(),g=e.outerWidth(),h=e.outerHeight();a=d.target,b.css({top:f.top,left:f.left,width:g,height:h}).show(),console.log(jQuery(a).getPath())}}),jQuery(document).click(function(b){var c=jQuery(a).getPath();localStorage.setItem("advads_frontend_element",c),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(a,b){if("undefined"==typeof a&&(a=""),"undefined"==typeof b&&(b=0),this.is("html"))return"html > "+a;if(3===b)return a;var c=this.get(0).nodeName.toLowerCase(),d=this.attr("id"),e=this.attr("class");return b+=1,"undefined"==typeof d||/\d/.test(d)?"undefined"!=typeof e&&(e=e.split(/[\s\n]+/),e=jQuery.grep(e,function(a,b){return!/\d/.test(a)}),e.length&&(c+="."+e.slice(0,2).join("."))):c+="#"+d,this.siblings(c).length&&(c+=":eq("+this.siblings(c).addBack().not("#advads-picker-overlay").index(this)+")"),""===a?this.parent().getPath(c,b):this.parent().getPath(c+" > "+a,b)}});
1
+ advads={supports_localstorage:function(){"use strict";try{return!(!window||void 0===window.localStorage)&&(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0)}catch(a){return!1}},max_per_session:function(a,b){var c=1;if(void 0!==b&&0!==parseInt(b)||(b=1),this.cookie_exists(a)){if(this.get_cookie(a)>=b)return!0;c+=parseInt(this.get_cookie(a))}return this.set_cookie(a,c),!1},count_up:function(a,b){var c=1;this.cookie_exists(a)&&(c+=parseInt(this.get_cookie(a))),this.set_cookie(a,c)},set_cookie_exists:function(a){return!!get_cookie(a)||(set_cookie(a,"",0),!1)},get_cookie:function(a){var b,c,d,e=document.cookie.split(";");for(b=0;b<e.length;b++)if(c=e[b].substr(0,e[b].indexOf("=")),d=e[b].substr(e[b].indexOf("=")+1),(c=c.replace(/^\s+|\s+$/g,""))===a)return unescape(d)},set_cookie:function(a,b,c,d,e,f){var g=24*c*60*60;this.set_cookie_sec(a,b,g,d,e,f)},set_cookie_sec:function(a,b,c,d,e,f){var g=new Date;g.setSeconds(g.getSeconds()+parseInt(c)),document.cookie=a+"="+escape(b)+(null==c?"":"; expires="+g.toUTCString())+(null==d?"; path=/":"; path="+d)+(null==e?"":"; domain="+e)+(null==f?"":"; secure")},cookie_exists:function(a){var b=this.get_cookie(a);return null!==b&&""!==b&&void 0!==b},move:function(a,b,c){var d=jQuery(a);if(void 0===c&&(c={}),void 0===c.css&&(c.css={}),void 0===c.method&&(c.method="prependTo"),""===b&&void 0!==c.target)switch(c.target){case"wrapper":var e="left";void 0!==c.offset&&(e=c.offset),b=this.find_wrapper(a,e)}switch(void 0===c.moveintohidden&&(b=jQuery(b).filter(":visible")),c.method){case"insertBefore":d.insertBefore(b);break;case"insertAfter":d.insertAfter(b);break;case"appendTo":d.appendTo(b);break;case"prependTo":d.prependTo(b);break;default:d.prependTo(b)}},fix_element:function(a,b){var c=jQuery(a),d=c.parent();"static"!==d.css("position")&&""!==d.css("position")||d.css("position","relative"),void 0!==b&&b.is_invisible&&c.show();var e=parseInt(c.offset().top),f=parseInt(c.offset().left);void 0!==b&&b.is_invisible&&c.hide(),c.css("position","fixed").css("top",e+"px").css("left",f+"px").css("right","")},find_wrapper:function(a,b){var c;return jQuery("body").children().each(function(d,e){if(e.id!==a.substring(1)){var f=jQuery(e);if("right"===b&&f.offset().left+jQuery(f).width()<jQuery(window).width()||"left"===b&&f.offset().left>0)return"static"!==f.css("position")&&""!==f.css("position")||f.css("position","relative"),c=e,!1}}),c},center_fixed_element:function(a){var b=jQuery(a),c=jQuery(window).width()/2-parseInt(b.css("width"))/2;b.css("left",c+"px")},center_vertically:function(a){var b=jQuery(a),c=jQuery(window).height()/2-parseInt(b.css("height"))/2;b.css("top",c+"px")},close:function(a){jQuery(a).remove()}},jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var a,b=jQuery("<div id='advads-picker-overlay'>"),c=[document.body,document.documentElement,document];b.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),jQuery(document).mousemove(function(d){if(d.target!==a){if(~c.indexOf(d.target))return a=null,void b.hide();var e=jQuery(d.target),f=e.offset(),g=e.outerWidth(),h=e.outerHeight();a=d.target,b.css({top:f.top,left:f.left,width:g,height:h}).show(),console.log(jQuery(a).getPath())}}),jQuery(document).click(function(b){var c=jQuery(a).getPath();localStorage.setItem("advads_frontend_element",c),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(a,b){if(void 0===a&&(a=""),void 0===b&&(b=0),this.is("html"))return"html > "+a;if(3===b)return a;var c=this.get(0).nodeName.toLowerCase(),d=this.attr("id"),e=this.attr("class");return b+=1,void 0===d||/\d/.test(d)?void 0!==e&&(e=e.split(/[\s\n]+/),e=jQuery.grep(e,function(a,b){return!/\d/.test(a)}),e.length&&(c+="."+e.slice(0,2).join("."))):c+="#"+d,this.siblings(c).length&&(c+=":eq("+this.siblings(c).addBack().not("#advads-picker-overlay").index(this)+")"),""===a?this.parent().getPath(c,b):this.parent().getPath(c+" > "+a,b)}});
public/assets/js/advanced.orig.js CHANGED
@@ -219,7 +219,8 @@ advads = {
219
  if( typeof options !== 'undefined' && options.is_invisible ){
220
  el.hide();
221
  }
222
- el.css('position', 'fixed').css('top', topoffset + 'px').css('left', leftoffset + 'px');
 
223
  },
224
  /**
225
  * find the main wrapper
219
  if( typeof options !== 'undefined' && options.is_invisible ){
220
  el.hide();
221
  }
222
+ // reset "right" to prevent conflicts
223
+ el.css('position', 'fixed').css('top', topoffset + 'px').css('left', leftoffset + 'px').css('right', '');
224
  },
225
  /**
226
  * find the main wrapper
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webzunft
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
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.7.3
7
- Stable tag: 1.7.23
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -210,6 +210,13 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
210
 
211
  == Changelog ==
212
 
 
 
 
 
 
 
 
213
  = 1.7.23 =
214
 
215
  * fix a warning that appears when wp admin bar is missing.
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
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.7.4
7
+ Stable tag: 1.7.24
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
210
 
211
  == Changelog ==
212
 
213
+ = 1.7.24 =
214
+
215
+ * fixed issue with shortcode button that caused some page builders and scripts to break
216
+ * fixed saving settings on multisite sub-blogs
217
+ * applied fix to updater class
218
+ * fixed basic fix function needed for Sticky ads
219
+
220
  = 1.7.23 =
221
 
222
  * fix a warning that appears when wp admin bar is missing.