Advanced Ads - Version 1.8.17

Version Description

  • updated review message
  • prepared for upcoming fixes for Pro add-ons with WP Rocket defer option
  • fixed index issue
Download this release

Release Info

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

Code changes from version 1.8.16 to 1.8.17

admin/assets/js/admin-global.js CHANGED
@@ -7,7 +7,8 @@ jQuery( document ).ready(function () {
7
  * ADMIN NOTICES
8
  */
9
  // close button
10
- jQuery(document).on('click', '.advads-admin-notice button.notice-dismiss', function(){
 
11
  var messagebox = jQuery(this).parents('.advads-admin-notice');
12
  if( messagebox.attr('data-notice') === undefined) return;
13
 
@@ -18,9 +19,23 @@ jQuery( document ).ready(function () {
18
  };
19
  // send query
20
  jQuery.post(ajaxurl, query, function (r) {
21
- // messagebox.fadeOut();
22
  });
 
 
 
 
 
23
 
 
 
 
 
 
 
 
 
 
24
  });
25
  // autoresponder button
26
  jQuery('.advads-notices-button-subscribe').click(function(){
7
  * ADMIN NOTICES
8
  */
9
  // close button
10
+ // .advads-notice-dismiss class can be used to add a custom close button (e.g., link)
11
+ jQuery(document).on('click', '.advads-admin-notice button.notice-dismiss, .advads-admin-notice .advads-notice-dismiss', function(){
12
  var messagebox = jQuery(this).parents('.advads-admin-notice');
13
  if( messagebox.attr('data-notice') === undefined) return;
14
 
19
  };
20
  // send query
21
  jQuery.post(ajaxurl, query, function (r) {
22
+ messagebox.fadeOut();
23
  });
24
+ });
25
+ // hide notice for 7 days
26
+ jQuery(document).on('click', '.advads-admin-notice .advads-notice-hide', function(){
27
+ var messagebox = jQuery(this).parents('.advads-admin-notice');
28
+ if( messagebox.attr('data-notice') === undefined) return;
29
 
30
+ var query = {
31
+ action: 'advads-hide-notice',
32
+ notice: messagebox.attr('data-notice'),
33
+ nonce: advadsglobal.ajax_nonce
34
+ };
35
+ // send query
36
+ jQuery.post(ajaxurl, query, function (r) {
37
+ messagebox.fadeOut();
38
+ });
39
  });
40
  // autoresponder button
41
  jQuery('.advads-notices-button-subscribe').click(function(){
admin/includes/class-ad-groups-list.php CHANGED
@@ -178,9 +178,14 @@ class Advanced_Ads_Groups_List {
178
  $expiry = $ad->expiry_date;
179
  $expiry_date = date_create( '@' . $expiry );
180
 
 
181
  if ( $tz_option ) {
182
  $expiry_date->setTimezone( Advanced_Ads_Admin::get_wp_timezone() );
183
  } else {
 
 
 
 
184
  $expiry_date = date_create( '@' . ( $expiry + $offset_in_sec ) );
185
  }
186
 
178
  $expiry = $ad->expiry_date;
179
  $expiry_date = date_create( '@' . $expiry );
180
 
181
+
182
  if ( $tz_option ) {
183
  $expiry_date->setTimezone( Advanced_Ads_Admin::get_wp_timezone() );
184
  } else {
185
+ $tz_name = Advanced_Ads_Admin::timezone_get_name( Advanced_Ads_Admin::get_wp_timezone() );
186
+ $tz_offset = substr( $tz_name, 3 );
187
+ $off_time = date_create( '2017-09-21 T10:44:02' . $tz_offset );
188
+ $offset_in_sec = date_offset_get( $off_time );
189
  $expiry_date = date_create( '@' . ( $expiry + $offset_in_sec ) );
190
  }
191
 
admin/includes/class-notices.php CHANGED
@@ -159,6 +159,7 @@ class Advanced_Ads_Admin_Notices {
159
  $options = $this->options();
160
  $closed = isset($options['closed']) ? $options['closed'] : array();
161
  $queue = isset($options['queue']) ? $options['queue'] : array();
 
162
 
163
  // register intro message
164
  if( $options === array() && ! in_array( 'nl_intro', $queue ) && ! isset( $closed['nl_intro'] ) ){
@@ -171,9 +172,14 @@ class Advanced_Ads_Admin_Notices {
171
  $this->notices[] = 'nl_free_addons';
172
  }
173
  }
174
- // ask for a review after 5 days
175
- if ( 432000 < ( time() - $activation) && ! in_array( 'review', $queue ) && ! isset( $closed['review'] )) {
176
- $this->notices[] = 'review';
 
 
 
 
 
177
  }
178
  }
179
 
@@ -282,6 +288,7 @@ class Advanced_Ads_Admin_Notices {
282
  }
283
  $queue = (array) $options['queue'];
284
  $closed = isset($options['closed']) ? $options['closed'] : array();
 
285
 
286
  $key = array_search( $notice, $queue );
287
  if ( $key !== false ) {
@@ -292,11 +299,58 @@ class Advanced_Ads_Admin_Notices {
292
  if( ! isset( $closed[$notice] )){
293
  $closed[$notice] = time();
294
  }
 
 
 
 
295
 
296
  // update db
297
  $options['queue'] = $queue;
298
  $options['closed'] = $closed;
 
 
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  // only update if changed
302
  if( $options_before !== $options ){
159
  $options = $this->options();
160
  $closed = isset($options['closed']) ? $options['closed'] : array();
161
  $queue = isset($options['queue']) ? $options['queue'] : array();
162
+ $paused = isset($options['paused']) ? $options['paused'] : array();
163
 
164
  // register intro message
165
  if( $options === array() && ! in_array( 'nl_intro', $queue ) && ! isset( $closed['nl_intro'] ) ){
172
  $this->notices[] = 'nl_free_addons';
173
  }
174
  }
175
+ // ask for a review after 5 days and when 3 ads were created and when not paused
176
+ if ( ! in_array( 'review', $queue )
177
+ && ! isset( $closed['review'] )
178
+ && ( ! isset( $paused['review'] ) || $paused['review'] <= time() )
179
+ && 432000 < ( time() - $activation)
180
+ && 3 <= Advanced_Ads::get_number_of_ads()
181
+ ) {
182
+ $this->notices[] = 'review';
183
  }
184
  }
185
 
288
  }
289
  $queue = (array) $options['queue'];
290
  $closed = isset($options['closed']) ? $options['closed'] : array();
291
+ $paused = isset($options['paused']) ? $options['paused'] : array();
292
 
293
  $key = array_search( $notice, $queue );
294
  if ( $key !== false ) {
299
  if( ! isset( $closed[$notice] )){
300
  $closed[$notice] = time();
301
  }
302
+ // remove from pause
303
+ if( isset( $paused[$notice] ) ){
304
+ unset( $paused[$notice] );
305
+ }
306
 
307
  // update db
308
  $options['queue'] = $queue;
309
  $options['closed'] = $closed;
310
+ $options['paused'] = $paused;
311
+
312
 
313
+ // only update if changed
314
+ if( $options_before !== $options ){
315
+ $this->update_options( $options );
316
+ // update already registered notices
317
+ $this->load_notices();
318
+ }
319
+ }
320
+
321
+ /**
322
+ * hide any notice for a given time
323
+ * move notice into "paused" with notice as key and timestamp as value
324
+ *
325
+ * @since 1.8-17
326
+ * @param str $notice notice to be paused
327
+ */
328
+ public function hide_notice($notice) {
329
+ if ( ! isset($notice) ) {
330
+ return;
331
+ }
332
+
333
+ // get queue from options
334
+ $options_before = $options = $this->options();
335
+ if ( ! isset($options['queue']) ) {
336
+ return;
337
+ }
338
+ $queue = (array) $options['queue'];
339
+ $paused = isset($options['paused']) ? $options['paused'] : array();
340
+
341
+ $key = array_search( $notice, $queue );
342
+ if ( $key !== false ) {
343
+ unset($queue[$key]);
344
+ }
345
+ // close message with timestamp in 7 days
346
+ // don’t close again twice
347
+ if( ! isset( $paused[$notice] )){
348
+ $paused[$notice] = time() + WEEK_IN_SECONDS;
349
+ }
350
+
351
+ // update db
352
+ $options['queue'] = $queue;
353
+ $options['paused'] = $paused;
354
 
355
  // only update if changed
356
  if( $options_before !== $options ){
admin/includes/notices.php CHANGED
@@ -50,7 +50,16 @@ $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
50
  // please review
51
  'review' => array(
52
  'type' => 'info',
53
- 'text' => sprintf( __( '<img src="%3$s" alt="Thomas" width="80" height="115" class="advads-review-image"/>You are using <strong>Advanced Ads</strong> for some time now. Thank you! If you need my help then please visit the <a href="%1$s" target="_blank">Support page</a> to get free help.</p><h3>Thanks for your Review</h3><p>If you share my passion and find Advanced Ads useful then please <a href="%2$s" target="_blank">leave a 5-star review on wordpress.org</a>.</p><p><em>Thomas</em>', 'advanced-ads' ), ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review', 'https://wordpress.org/support/plugin/advanced-ads/reviews/#postform', ADVADS_BASE_URL . 'admin/assets/img/thomas.png' ),
 
 
 
 
 
 
 
 
 
54
  'global' => false
55
  ),
56
  // adblocker assets expired
50
  // please review
51
  'review' => array(
52
  'type' => 'info',
53
+ 'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
54
+ . '<p>' . sprintf(__( 'You’ve successfully <strong>created %s ads using Advanced Ads</strong>.', 'advanced-ads' ), Advanced_Ads::get_number_of_ads() ) . '</p>'
55
+ . '<p>' . __( 'If you share my passion and find Advanced Ads useful then please help spreading the word with a review.', 'advanced-ads' ) . '</p>'
56
+ . '<p><em>Thomas & Team</em></p>'
57
+ . '<p>'
58
+ . '<span class="dashicons dashicons-external"></span>&nbsp;<strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I’ll rate the plugin', 'advanced-ads' ) . '</a></strong>'
59
+ . ' &nbsp;&nbsp;<span class="dashicons dashicons-smiley"></span>&nbsp;<a href="javascript:void(0)" target=_"blank" class="advads-notice-dismiss">' . __( 'I already did', 'advanced-ads' ) . '</a>'
60
+ . ' &nbsp;&nbsp;<span class="dashicons dashicons-sos"></span>&nbsp;<a href="'. ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review" target=_"blank">' . __( 'I am not happy, please help', 'advanced-ads' ) . '</a>'
61
+ . '<br/><br/><span class="dashicons dashicons-clock"></span>&nbsp;<a href="javascript:void(0)" target=_"blank" class="advads-notice-hide">' . __( 'Ask me later', 'advanced-ads' ) . '</a>'
62
+ . '</p>',
63
  'global' => false
64
  ),
65
  // adblocker assets expired
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.8.16
16
  * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.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.8.16' );
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.8.17
16
  * Author: Thomas Maier
17
  * Author URI: https://wpadvancedads.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.8.17' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad_ajax_callbacks.php CHANGED
@@ -27,6 +27,7 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
27
  add_action( 'wp_ajax_load_display_conditions_metabox', array( $this, 'load_display_condition' ) );
28
  add_action( 'wp_ajax_advads-terms-search', array( $this, 'search_terms' ) );
29
  add_action( 'wp_ajax_advads-close-notice', array( $this, 'close_notice' ) );
 
30
  add_action( 'wp_ajax_advads-subscribe-notice', array( $this, 'subscribe' ) );
31
  add_action( 'wp_ajax_advads-activate-license', array( $this, 'activate_license' ) );
32
  add_action( 'wp_ajax_advads-deactivate-license', array( $this, 'deactivate_license' ) );
@@ -169,7 +170,7 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
169
  }
170
 
171
  /**
172
- * search terms belonging to a specific taxonomy
173
  *
174
  * @since 1.5.3
175
  */
@@ -186,6 +187,25 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
186
  Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue($_POST['notice']);
187
  die();
188
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
  /**
191
  * subscribe to newsletter
27
  add_action( 'wp_ajax_load_display_conditions_metabox', array( $this, 'load_display_condition' ) );
28
  add_action( 'wp_ajax_advads-terms-search', array( $this, 'search_terms' ) );
29
  add_action( 'wp_ajax_advads-close-notice', array( $this, 'close_notice' ) );
30
+ add_action( 'wp_ajax_advads-hide-notice', array( $this, 'hide_notice' ) );
31
  add_action( 'wp_ajax_advads-subscribe-notice', array( $this, 'subscribe' ) );
32
  add_action( 'wp_ajax_advads-activate-license', array( $this, 'activate_license' ) );
33
  add_action( 'wp_ajax_advads-deactivate-license', array( $this, 'deactivate_license' ) );
170
  }
171
 
172
  /**
173
+ * close a notice for good
174
  *
175
  * @since 1.5.3
176
  */
187
  Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue($_POST['notice']);
188
  die();
189
  }
190
+
191
+ /**
192
+ * hide a notice for some time (7 days right now)
193
+ *
194
+ * @since 1.8.17
195
+ */
196
+ public function hide_notice(){
197
+
198
+ check_ajax_referer('advanced-ads-admin-ajax-nonce', 'nonce');
199
+
200
+ if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') )
201
+ || empty( $_POST['notice'] )
202
+ ) {
203
+ die();
204
+ }
205
+
206
+ Advanced_Ads_Admin_Notices::get_instance()->hide_notice( $_POST['notice'] );
207
+ die();
208
+ }
209
 
210
  /**
211
  * subscribe to newsletter
classes/ad_group.php CHANGED
@@ -142,6 +142,7 @@ class Advanced_Ads_Group {
142
  $this->ad_args = $ad_args;
143
 
144
  $this->load_additional_attributes();
 
145
  }
146
 
147
  /**
@@ -153,8 +154,6 @@ class Advanced_Ads_Group {
153
  // -TODO should abstract (i.e. only call once per request)
154
  $all_groups = get_option( 'advads-ad-groups', array() );
155
 
156
- $this->create_wrapper();
157
-
158
  if ( ! isset( $all_groups[ $this->id ] ) || ! is_array( $all_groups[ $this->id ] ) ) { return; }
159
 
160
  if ( isset( $this->ad_args['change-group'] ) ) {
142
  $this->ad_args = $ad_args;
143
 
144
  $this->load_additional_attributes();
145
+ $this->create_wrapper();
146
  }
147
 
148
  /**
154
  // -TODO should abstract (i.e. only call once per request)
155
  $all_groups = get_option( 'advads-ad-groups', array() );
156
 
 
 
157
  if ( ! isset( $all_groups[ $this->id ] ) || ! is_array( $all_groups[ $this->id ] ) ) { return; }
158
 
159
  if ( isset( $this->ad_args['change-group'] ) ) {
classes/frontend_checks.php CHANGED
@@ -402,7 +402,7 @@ class Advanced_Ads_Frontend_Checks {
402
  }
403
  }
404
 
405
- addEvent( w, 'load', function() {
406
  var adblock_item = d.getElementById( 'wp-admin-bar-advanced_ads_ad_health_adblocker_enabled' );
407
  // jQuery_item = d.getElementById( 'wp-admin-bar-advanced_ads_ad_health_jquery' ),
408
 
@@ -426,13 +426,13 @@ class Advanced_Ads_Frontend_Checks {
426
 
427
  <?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
428
  // show warning if AdSense ad is hidden
429
- addEvent( w, 'load', function() {
430
- window.jQuery && jQuery( document ).ready( function() {
431
  var advads_ad_health_check_adsense_hidden_ids = [];
432
  jQuery('ins.adsbygoogle').each( function(){
433
- if( ! jQuery( this ).parent().is(':visible') ){
434
  advads_ad_health_check_adsense_hidden_ids.push( this.dataset.adSlot );
435
- }
436
  });
437
  if( advads_ad_health_check_adsense_hidden_ids.length ){
438
  var advads_has_hidden_adsense_link = document.querySelector( '.advanced_ads_ad_health_hidden_adsense' );
@@ -447,11 +447,13 @@ class Advanced_Ads_Frontend_Checks {
447
  advanced_ads_frontend_checks.showCount();
448
  }
449
  }
450
- });
451
  });
452
 
453
  // highlight AdSense QuickStart ads 3 seconds after site loaded
454
- setTimeout(function(){ advads_highlight_adsense_quickstart(); }, 3000);
 
 
455
  function advads_highlight_adsense_quickstart(){
456
  if ( ! window.jQuery ) {
457
  window.console && window.console.log( 'Advanced Ads: jQuery not found. Some Ad Health warnings will not be shown' );
@@ -491,7 +493,7 @@ class Advanced_Ads_Frontend_Checks {
491
  // Allow DFP debugging by showing a link that points to the current URL with the 'googfc' parameter.
492
  if ( $ad->type === 'plain' && preg_match( '/gpt\.js/', $content ) ) {
493
  ob_start(); ?>
494
- <!--noptimize--><script>window.jQuery && jQuery( document ).ready( function() {
495
  var advads_dfp_link = document.querySelector( '.advanced_ads_ad_health_debug_dfp_link.hidden' );
496
  if ( advads_dfp_link ) {
497
  advads_dfp_link.className = advads_dfp_link.className.replace( 'hidden', '' );
@@ -505,7 +507,7 @@ class Advanced_Ads_Frontend_Checks {
505
 
506
  if ( Advanced_Ads_Ad_Debug::is_https_and_http( $ad ) ) {
507
  ob_start(); ?>
508
- <!--noptimize--><script>window.jQuery && jQuery( document ).ready( function() {
509
  var advads_has_http_link = document.querySelector( '.advanced_ads_ad_health_has_http' );
510
  if ( advads_has_http_link ) {
511
  advads_has_http_link.className = advads_has_http_link.className.replace( 'hidden', '' );
402
  }
403
  }
404
 
405
+ advanced_ads_ready( function() {
406
  var adblock_item = d.getElementById( 'wp-admin-bar-advanced_ads_ad_health_adblocker_enabled' );
407
  // jQuery_item = d.getElementById( 'wp-admin-bar-advanced_ads_ad_health_jquery' ),
408
 
426
 
427
  <?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
428
  // show warning if AdSense ad is hidden
429
+ advanced_ads_ready( function() {
430
+ if ( window.jQuery ) {
431
  var advads_ad_health_check_adsense_hidden_ids = [];
432
  jQuery('ins.adsbygoogle').each( function(){
433
+ if( ! jQuery( this ).parent().is(':visible') ){
434
  advads_ad_health_check_adsense_hidden_ids.push( this.dataset.adSlot );
435
+ }
436
  });
437
  if( advads_ad_health_check_adsense_hidden_ids.length ){
438
  var advads_has_hidden_adsense_link = document.querySelector( '.advanced_ads_ad_health_hidden_adsense' );
447
  advanced_ads_frontend_checks.showCount();
448
  }
449
  }
450
+ }
451
  });
452
 
453
  // highlight AdSense QuickStart ads 3 seconds after site loaded
454
+ setTimeout( function(){
455
+ advanced_ads_ready( advads_highlight_adsense_quickstart )
456
+ }, 3000 );
457
  function advads_highlight_adsense_quickstart(){
458
  if ( ! window.jQuery ) {
459
  window.console && window.console.log( 'Advanced Ads: jQuery not found. Some Ad Health warnings will not be shown' );
493
  // Allow DFP debugging by showing a link that points to the current URL with the 'googfc' parameter.
494
  if ( $ad->type === 'plain' && preg_match( '/gpt\.js/', $content ) ) {
495
  ob_start(); ?>
496
+ <!--noptimize--><script>advanced_ads_ready( function() {
497
  var advads_dfp_link = document.querySelector( '.advanced_ads_ad_health_debug_dfp_link.hidden' );
498
  if ( advads_dfp_link ) {
499
  advads_dfp_link.className = advads_dfp_link.className.replace( 'hidden', '' );
507
 
508
  if ( Advanced_Ads_Ad_Debug::is_https_and_http( $ad ) ) {
509
  ob_start(); ?>
510
+ <!--noptimize--><script>advanced_ads_ready( function() {
511
  var advads_has_http_link = document.querySelector( '.advanced_ads_ad_health_has_http' );
512
  if ( advads_has_http_link ) {
513
  advads_has_http_link.className = advads_has_http_link.className.replace( 'hidden', '' );
classes/plugin.php CHANGED
@@ -101,6 +101,7 @@ class Advanced_Ads_Plugin {
101
  // Load public-facing style sheet and JavaScript.
102
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
103
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
104
 
105
  // add short codes
106
  add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
@@ -150,6 +151,30 @@ class Advanced_Ads_Plugin {
150
  }
151
  }
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  public function widget_init() {
154
  register_widget( 'Advanced_Ads_Widget' );
155
  }
101
  // Load public-facing style sheet and JavaScript.
102
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
103
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
104
+ add_action( 'wp_head', array( $this, 'print_head_scripts' ), 7 );
105
 
106
  // add short codes
107
  add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
151
  }
152
  }
153
 
154
+ /**
155
+ * Print public-facing JavaScript in the HTML head.
156
+ *
157
+ * @since untagged
158
+ */
159
+ public function print_head_scripts() {
160
+ /**
161
+ * Usage example in add-ons:
162
+ * ( window.advanced_ads_ready || jQuery( document ).ready ).call( null, function() {
163
+ * // Called when DOM is ready.
164
+ * } );
165
+ */
166
+ ?>
167
+ <!--noptimize--><script>
168
+ <?php if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
169
+ readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
170
+ } else { ?>
171
+ advanced_ads_ready=function(){var fns=[],listener,doc=typeof document==="object"&&document,hack=doc&&doc.documentElement.doScroll,domContentLoaded="DOMContentLoaded",loaded=doc&&(hack?/^loaded|^c/:/^loaded|^i|^c/).test(doc.readyState);if(!loaded&&doc){listener=function(){doc.removeEventListener(domContentLoaded,listener);window.removeEventListener("load",listener);loaded=1;while(listener=fns.shift())listener()};doc.addEventListener(domContentLoaded,listener);window.addEventListener("load",listener)}return function(fn){loaded?setTimeout(fn,0):fns.push(fn)}}();
172
+ <?php
173
+ }
174
+ ?></script><!--/noptimize-->
175
+ <?php
176
+ }
177
+
178
  public function widget_init() {
179
  register_widget( 'Advanced_Ads_Widget' );
180
  }
languages/advanced-ads.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
- "POT-Creation-Date: 2017-11-26 13:55+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
@@ -198,12 +198,12 @@ msgstr ""
198
  msgid "headline 4 (%s)"
199
  msgstr ""
200
 
201
- #: classes/ad_placements.php:547
202
  #, php-format
203
  msgid "Set <em>%s</em> to show more ads"
204
  msgstr ""
205
 
206
- #: classes/ad_placements.php:547 admin/includes/class-settings.php:141
207
  msgid "Disable level limitation"
208
  msgstr ""
209
 
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
+ "POT-Creation-Date: 2017-11-28 14:16+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
198
  msgid "headline 4 (%s)"
199
  msgstr ""
200
 
201
+ #: classes/ad_placements.php:549
202
  #, php-format
203
  msgid "Set <em>%s</em> to show more ads"
204
  msgstr ""
205
 
206
+ #: classes/ad_placements.php:549 admin/includes/class-settings.php:141
207
  msgid "Disable level limitation"
208
  msgstr ""
209
 
public/assets/js/advanced.js CHANGED
@@ -1 +1 @@
1
- advads={supports_localstorage:function(){"use strict";try{if(!window||window.localStorage===undefined){return false}window.localStorage.setItem("x","x");window.localStorage.removeItem("x");return true}catch(e){return false}},max_per_session:function(name,max){var num=1;if(max===undefined||parseInt(max)===0){max=1}if(this.cookie_exists(name)){if(this.get_cookie(name)>=max){return true}num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num);return false},count_up:function(name,exdays){var num=1;if(this.cookie_exists(name)){num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num)},set_cookie_exists:function(name){if(get_cookie(name)){return true}set_cookie(name,"",0);return false},get_cookie:function(name){var i,x,y,ADVcookies=document.cookie.split(";");for(i=0;i<ADVcookies.length;i++){x=ADVcookies[i].substr(0,ADVcookies[i].indexOf("="));y=ADVcookies[i].substr(ADVcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x===name){return unescape(y)}}},set_cookie:function(name,value,exdays,path,domain,secure){var expiry=exdays*24*60*60;this.set_cookie_sec(name,value,expiry,path,domain,secure)},set_cookie_sec:function(name,value,expiry,path,domain,secure){var exdate=new Date;exdate.setSeconds(exdate.getSeconds()+parseInt(expiry));document.cookie=name+"="+escape(value)+(expiry==null?"":"; expires="+exdate.toUTCString())+(path==null?"; path=/":"; path="+path)+(domain==null?"":"; domain="+domain)+(secure==null?"":"; secure")},cookie_exists:function(name){var c_value=this.get_cookie(name);if(c_value!==null&&c_value!==""&&c_value!==undefined){return true}return false},move:function(element,target,options){var el=jQuery(element);if(typeof options==="undefined"){options={}}if(typeof options.css==="undefined"){options.css={}}if(typeof options.method==="undefined"){options.method="prependTo"}if(target===""&&typeof options.target!=="undefined"){switch(options.target){case"wrapper":var offset="left";if(typeof options.offset!=="undefined"){offset=options.offset}target=this.find_wrapper(element,offset);break}}if(typeof options.moveintohidden==="undefined"){target=jQuery(target).filter(":visible")}switch(options.method){case"insertBefore":el.insertBefore(target);break;case"insertAfter":el.insertAfter(target);break;case"appendTo":el.appendTo(target);break;case"prependTo":el.prependTo(target);break;default:el.prependTo(target)}},set_parent_relative:function(element){var el=jQuery(element);var parent=el.parent();if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){this.set_parent_relative(element);var el=jQuery(element);if(typeof options!=="undefined"&&options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(typeof options!=="undefined"&&options.is_invisible){el.hide()}el.css("position","fixed").css("top",topoffset+"px").css("left",leftoffset+"px").css("right","")},find_wrapper:function(element,offset){var returnValue;jQuery("body").children().each(function(key,value){if(value.id!==element.substring(1)){var checkedelement=jQuery(value);if(offset==="right"&&checkedelement.offset().left+jQuery(checkedelement).width()<jQuery(window).width()||offset==="left"&&checkedelement.offset().left>0){if(checkedelement.css("position")==="static"||checkedelement.css("position")===""){checkedelement.css("position","relative")}returnValue=value;return false}}});return returnValue},center_fixed_element:function(element){var el=jQuery(element);var left=jQuery(window).width()/2-parseInt(el.css("width"))/2;el.css("left",left+"px")},center_vertically:function(element){var el=jQuery(element);var left=jQuery(window).height()/2-parseInt(el.css("height"))/2;el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()}};jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var advads_picker_cur,advads_picker_overlay=jQuery("<div id='advads-picker-overlay'>"),advads_picker_no=[document.body,document.documentElement,document];advads_picker_overlay.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(e){if(e.target===advads_picker_cur){return}if(~advads_picker_no.indexOf(e.target)){advads_picker_cur=null;advads_picker_overlay.hide();return}var target=jQuery(e.target),offset=target.offset(),width=target.outerWidth(),height=target.outerHeight();advads_picker_cur=e.target;advads_picker_overlay.css({top:offset.top,left:offset.left,width:width,height:height}).show();console.log(jQuery(advads_picker_cur).getPath())});jQuery(document).click(function(e){var path=jQuery(advads_picker_cur).getPath();localStorage.setItem("advads_frontend_element",path);window.location=localStorage.getItem("advads_prev_url")})}});jQuery.fn.extend({getPath:function(path,depth){if(typeof path==="undefined")path="";if(typeof depth==="undefined")depth=0;if(this.is("html")){return"html > "+path}else if(3===depth){return path}var cur=this.get(0).nodeName.toLowerCase();var el_id=this.attr("id"),el_class=this.attr("class");depth=depth+1;if(typeof el_id!=="undefined"&&!/\d/.test(el_id)){cur+="#"+el_id}else if(typeof el_class!=="undefined"){el_class=el_class.split(/[\s\n]+/);el_class=jQuery.grep(el_class,function(element,index){return!/\d/.test(element)});if(el_class.length){cur+="."+el_class.slice(0,2).join(".")}}if(this.siblings(cur).length){cur+=":eq("+this.siblings(cur).addBack().not("#advads-picker-overlay").index(this)+")"}if(path===""){return this.parent().getPath(cur,depth)}else{return this.parent().getPath(cur+" > "+path,depth)}}});
1
+ advads={supports_localstorage:function(){"use strict";try{if(!window||window.localStorage===undefined){return false}window.localStorage.setItem("x","x");window.localStorage.removeItem("x");return true}catch(e){return false}},max_per_session:function(name,max){var num=1;if(max===undefined||parseInt(max)===0){max=1}if(this.cookie_exists(name)){if(this.get_cookie(name)>=max){return true}num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num);return false},count_up:function(name,exdays){var num=1;if(this.cookie_exists(name)){num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num)},set_cookie_exists:function(name){if(get_cookie(name)){return true}set_cookie(name,"",0);return false},get_cookie:function(name){var i,x,y,ADVcookies=document.cookie.split(";");for(i=0;i<ADVcookies.length;i++){x=ADVcookies[i].substr(0,ADVcookies[i].indexOf("="));y=ADVcookies[i].substr(ADVcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x===name){return unescape(y)}}},set_cookie:function(name,value,exdays,path,domain,secure){var expiry=exdays==null?null:exdays*24*60*60;this.set_cookie_sec(name,value,expiry,path,domain,secure)},set_cookie_sec:function(name,value,expiry,path,domain,secure){var exdate=new Date;exdate.setSeconds(exdate.getSeconds()+parseInt(expiry));document.cookie=name+"="+escape(value)+(expiry==null?"":"; expires="+exdate.toUTCString())+(path==null?"; path=/":"; path="+path)+(domain==null?"":"; domain="+domain)+(secure==null?"":"; secure")},cookie_exists:function(name){var c_value=this.get_cookie(name);if(c_value!==null&&c_value!==""&&c_value!==undefined){return true}return false},move:function(element,target,options){var el=jQuery(element);if(typeof options==="undefined"){options={}}if(typeof options.css==="undefined"){options.css={}}if(typeof options.method==="undefined"){options.method="prependTo"}if(target===""&&typeof options.target!=="undefined"){switch(options.target){case"wrapper":var offset="left";if(typeof options.offset!=="undefined"){offset=options.offset}target=this.find_wrapper(element,offset);break}}if(typeof options.moveintohidden==="undefined"){target=jQuery(target).filter(":visible")}switch(options.method){case"insertBefore":el.insertBefore(target);break;case"insertAfter":el.insertAfter(target);break;case"appendTo":el.appendTo(target);break;case"prependTo":el.prependTo(target);break;default:el.prependTo(target)}},set_parent_relative:function(element){var el=jQuery(element);var parent=el.parent();if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){this.set_parent_relative(element);var el=jQuery(element);if(typeof options!=="undefined"&&options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(typeof options!=="undefined"&&options.is_invisible){el.hide()}el.css("position","fixed").css("top",topoffset+"px").css("left",leftoffset+"px").css("right","")},find_wrapper:function(element,offset){var returnValue;jQuery("body").children().each(function(key,value){if(value.id!==element.substring(1)){var checkedelement=jQuery(value);if(offset==="right"&&checkedelement.offset().left+jQuery(checkedelement).width()<jQuery(window).width()||offset==="left"&&checkedelement.offset().left>0){if(checkedelement.css("position")==="static"||checkedelement.css("position")===""){checkedelement.css("position","relative")}returnValue=value;return false}}});return returnValue},center_fixed_element:function(element){var el=jQuery(element);var left=jQuery(window).width()/2-parseInt(el.css("width"))/2;el.css("left",left+"px")},center_vertically:function(element){var el=jQuery(element);var left=jQuery(window).height()/2-parseInt(el.css("height"))/2;el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()}};jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var advads_picker_cur,advads_picker_overlay=jQuery("<div id='advads-picker-overlay'>"),advads_picker_no=[document.body,document.documentElement,document];advads_picker_overlay.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(e){if(e.target===advads_picker_cur){return}if(~advads_picker_no.indexOf(e.target)){advads_picker_cur=null;advads_picker_overlay.hide();return}var target=jQuery(e.target),offset=target.offset(),width=target.outerWidth(),height=target.outerHeight();advads_picker_cur=e.target;advads_picker_overlay.css({top:offset.top,left:offset.left,width:width,height:height}).show();console.log(jQuery(advads_picker_cur).getPath())});jQuery(document).click(function(e){var path=jQuery(advads_picker_cur).getPath();localStorage.setItem("advads_frontend_element",path);window.location=localStorage.getItem("advads_prev_url")})}});jQuery.fn.extend({getPath:function(path,depth){if(typeof path==="undefined")path="";if(typeof depth==="undefined")depth=0;if(this.is("html")){return"html > "+path}else if(3===depth){return path}var cur=this.get(0).nodeName.toLowerCase();var el_id=this.attr("id"),el_class=this.attr("class");depth=depth+1;if(typeof el_id!=="undefined"&&!/\d/.test(el_id)){cur+="#"+el_id}else if(typeof el_class!=="undefined"){el_class=el_class.split(/[\s\n]+/);el_class=jQuery.grep(el_class,function(element,index){return!/\d/.test(element)});if(el_class.length){cur+="."+el_class.slice(0,2).join(".")}}if(this.siblings(cur).length){cur+=":eq("+this.siblings(cur).addBack().not("#advads-picker-overlay").index(this)+")"}if(path===""){return this.parent().getPath(cur,depth)}else{return this.parent().getPath(cur+" > "+path,depth)}}});
public/assets/js/advanced.orig.js CHANGED
@@ -100,7 +100,7 @@ advads = {
100
  */
101
  set_cookie: function (name, value, exdays, path, domain, secure) {
102
  // days in seconds
103
- var expiry = exdays * 24 * 60 * 60;
104
  this.set_cookie_sec( name, value, expiry, path, domain, secure );
105
  },
106
  /**
100
  */
101
  set_cookie: function (name, value, exdays, path, domain, secure) {
102
  // days in seconds
103
+ var expiry = ( exdays == null ) ? null : exdays * 24 * 60 * 60;
104
  this.set_cookie_sec( name, value, expiry, path, domain, secure );
105
  },
106
  /**
public/assets/js/ready.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * based on domready (c) Dustin Diaz 2014 - License MIT
3
+ * https://github.com/ded/domready
4
+ */
5
+ advanced_ads_ready = ( function() {
6
+ var fns = [], listener
7
+ , doc = typeof document === 'object' && document
8
+ , hack = doc && doc.documentElement.doScroll
9
+ , domContentLoaded = 'DOMContentLoaded'
10
+ , loaded = doc && (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState)
11
+
12
+ if (!loaded && doc){
13
+ listener = function () {
14
+ doc.removeEventListener(domContentLoaded, listener)
15
+ window.removeEventListener( "load", listener );
16
+ loaded = 1
17
+ while (listener = fns.shift()) listener()
18
+ }
19
+
20
+ doc.addEventListener(domContentLoaded, listener )
21
+ window.addEventListener( 'load', listener );
22
+ }
23
+
24
+ return function (fn) {
25
+ loaded ? setTimeout(fn, 0) : fns.push(fn)
26
+ }
27
+ } )();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, ad
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.2
8
- Stable tag: 1.8.16
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -230,6 +230,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
230
 
231
  == Changelog ==
232
 
 
 
 
 
 
 
233
  = 1.8.16 =
234
 
235
  * fixed issue introduced to some ad types with last code highlighting support update
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.2
8
+ Stable tag: 1.8.17
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
230
 
231
  == Changelog ==
232
 
233
+ = 1.8.17 =
234
+
235
+ * updated review message
236
+ * prepared for upcoming fixes for Pro add-ons with WP Rocket defer option
237
+ * fixed index issue
238
+
239
  = 1.8.16 =
240
 
241
  * fixed issue introduced to some ad types with last code highlighting support update