Advanced Ads - Version 1.6.8

Version Description

  • added option to change the prefix of ids and classes in the frontend to prevent widgets from being ad-blocked
  • minor optimization to autocomplete feature of post display condition
  • minor changes to align with changes in WordPress 4.3
  • content-injection now detects wrappers around content up to the third level
Download this release

Release Info

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

Code changes from version 1.6.7.1 to 1.6.8

admin/assets/js/admin.js CHANGED
@@ -124,9 +124,9 @@ jQuery( document ).ready(function ($) {
124
  $( '#advads-display-conditions-individual-post' ).val( '' );
125
  },
126
  })
127
- .autocomplete( "instance" )._renderItem = function( ul, item ) {
128
  ul.addClass( "advads-conditions-postids-autocomplete-suggestions" );
129
- return $( "<li>" )
130
  .append( "<span class='left'>" + item.label + "</span><span class='right'>" + item.info + "</span>" )
131
  .appendTo( ul );
132
  };
124
  $( '#advads-display-conditions-individual-post' ).val( '' );
125
  },
126
  })
127
+ .autocomplete().data("ui-autocomplete")._renderItem = function( ul, item ) {
128
  ul.addClass( "advads-conditions-postids-autocomplete-suggestions" );
129
+ return $( "<li></li>" )
130
  .append( "<span class='left'>" + item.label + "</span><span class='right'>" + item.info + "</span>" )
131
  .appendTo( ul );
132
  };
admin/class-advanced-ads-admin.php CHANGED
@@ -788,6 +788,14 @@ class Advanced_Ads_Admin {
788
  $hook,
789
  'advanced_ads_setting_section'
790
  );
 
 
 
 
 
 
 
 
791
 
792
  // hook for additional settings from add-ons
793
  do_action( 'advanced-ads-settings-init', $hook );
@@ -945,6 +953,23 @@ class Advanced_Ads_Admin {
945
  echo '<p class="description">'. __( 'Disable internal notices like tips, tutorials, email newsletters and update notices. Disabling notices is recommended if you run multiple blogs with Advanced Ads already.', ADVADS_SLUG ) . '</p>';
946
  }
947
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948
  /**
949
  * sanitize plugin settings
950
  *
788
  $hook,
789
  'advanced_ads_setting_section'
790
  );
791
+ // opt out from internal notices
792
+ add_settings_field(
793
+ 'id-prefix',
794
+ __( 'ID prefix', ADVADS_SLUG ),
795
+ array($this, 'render_settings_id_prefix'),
796
+ $hook,
797
+ 'advanced_ads_setting_section'
798
+ );
799
 
800
  // hook for additional settings from add-ons
801
  do_action( 'advanced-ads-settings-init', $hook );
953
  echo '<p class="description">'. __( 'Disable internal notices like tips, tutorials, email newsletters and update notices. Disabling notices is recommended if you run multiple blogs with Advanced Ads already.', ADVADS_SLUG ) . '</p>';
954
  }
955
 
956
+ /**
957
+ * render setting for id prefix
958
+ *
959
+ * @since 1.6.8
960
+ */
961
+ public function render_settings_id_prefix(){
962
+ $options = Advanced_Ads::get_instance()->options();
963
+
964
+ $prefix = ( isset($options['id-prefix'])) ? esc_attr( $options['id-prefix'] ) : Advanced_Ads_Plugin::DEFAULT_FRONTEND_PREFIX;
965
+ if( ! isset($options['id-prefix']) ){
966
+ echo '<p class="advads-error-message">'. __( 'Please check your widgets after saving this page. The original id and class prefix changed and custom css rules must be rewritten.', ADVADS_SLUG ) .'</p>';
967
+ }
968
+
969
+ echo '<input id="advanced-ads-id-prefix" type="text" value="' .$prefix .'" name="'.ADVADS_SLUG.'[id-prefix]" />';
970
+ echo '<p class="description">'. __( 'Prefix of class or id attributes in the frontend. Change it if you don’t want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might need to <strong>re-create your widgets and rewrite css rules afterwards</strong>.', ADVADS_SLUG ) .'</p>';
971
+ }
972
+
973
  /**
974
  * sanitize plugin settings
975
  *
admin/views/ad-group-edit.php CHANGED
@@ -20,7 +20,7 @@ do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy );
20
  ?>
21
 
22
  <div class="wrap">
23
- <h2><?php echo $tax->labels->edit_item; ?></h2>
24
  <div id="ajax-response"></div>
25
  <form name="editgroup" id="editgroup" method="post" action="<?php echo Advanced_Ads_Admin::group_page_url(); ?>" class="validate"<?php do_action( $taxonomy . '_term_edit_form_tag' ); ?>>
26
  <input type="hidden" name="action" value="editedgroup" />
20
  ?>
21
 
22
  <div class="wrap">
23
+ <h1><?php echo $tax->labels->edit_item; ?></h1>
24
  <div id="ajax-response"></div>
25
  <form name="editgroup" id="editgroup" method="post" action="<?php echo Advanced_Ads_Admin::group_page_url(); ?>" class="validate"<?php do_action( $taxonomy . '_term_edit_form_tag' ); ?>>
26
  <input type="hidden" name="action" value="editedgroup" />
admin/views/ad-group.php CHANGED
@@ -40,7 +40,7 @@ if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || iss
40
  ?>
41
 
42
  <div class="wrap nosubsub">
43
- <h2><?php
44
  echo esc_html( $title );
45
  if ( ! empty($_REQUEST['s']) ) {
46
  printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', ADVADS_SLUG ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
@@ -48,7 +48,7 @@ if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || iss
48
  echo ' <a href="' . Advanced_Ads_Admin::group_page_url( array('action' => 'edit') ) . '" class="add-new-h2">' . $tax->labels->add_new_item . '</a>';
49
  }
50
  ?>
51
- </h2>
52
  <p><?php _e( 'Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', ADVADS_SLUG ); ?></p>
53
  <?php if ( isset($message) ) : ?>
54
  <div id="message" class="updated"><p><?php echo $message; ?></p></div>
40
  ?>
41
 
42
  <div class="wrap nosubsub">
43
+ <h1><?php
44
  echo esc_html( $title );
45
  if ( ! empty($_REQUEST['s']) ) {
46
  printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', ADVADS_SLUG ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
48
  echo ' <a href="' . Advanced_Ads_Admin::group_page_url( array('action' => 'edit') ) . '" class="add-new-h2">' . $tax->labels->add_new_item . '</a>';
49
  }
50
  ?>
51
+ </h1>
52
  <p><?php _e( 'Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', ADVADS_SLUG ); ?></p>
53
  <?php if ( isset($message) ) : ?>
54
  <div id="message" class="updated"><p><?php echo $message; ?></p></div>
admin/views/overview.php CHANGED
@@ -23,7 +23,7 @@ if ( wp_is_mobile() ) {
23
  $title = __( 'Ads Dashboard', ADVADS_SLUG );
24
 
25
  ?><div class="wrap">
26
- <h2><?php echo esc_html( $title ); ?></h2>
27
 
28
  <div id="dashboard-widgets-wrap">
29
  <?php wp_dashboard(); ?>
23
  $title = __( 'Ads Dashboard', ADVADS_SLUG );
24
 
25
  ?><div class="wrap">
26
+ <h1><?php echo esc_html( $title ); ?></h1>
27
 
28
  <div id="dashboard-widgets-wrap">
29
  <?php wp_dashboard(); ?>
admin/views/placements.php CHANGED
@@ -11,7 +11,7 @@
11
  endif; ?>
12
  <?php endif; ?>
13
  <?php screen_icon(); ?>
14
- <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
15
  <p class="description"><?php _e( 'Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates.', ADVADS_SLUG ); ?></p>
16
  <p class="description"><?php printf( __( 'See also the manual for more information on <a href="%s">placements</a>.', ADVADS_SLUG ), ADVADS_URL . 'manual/placements/' ); ?></p>
17
  <?php if ( isset($placements) && is_array( $placements ) && count( $placements ) ) : ?>
@@ -29,7 +29,7 @@
29
  <tbody>
30
  <?php foreach ( $placements as $_placement_slug => $_placement ) :
31
  $type_missing = false;
32
- if( empty($_placement['type']) || ! isset( $placement_types[$_placement['type']] )) {
33
  $missed_type = $_placement['type'];
34
  $_placement['type'] = 'default';
35
  $type_missing = true;
@@ -50,7 +50,8 @@
50
  endif;
51
  ?></td>
52
  <td><?php echo $_placement['name']; ?><br/>
53
- <?php if( 'default' === $_placement['type']) :
 
54
  ?><a class="usage-link"><?php _e( 'show usage', ADVADS_SLUG ); ?></a><div class="hidden advads-usage">
55
  <label><?php _e( 'shortcode', ADVADS_SLUG ); ?>
56
  <code><input type="text" onclick="this.select();" value='[the_ad_placement id="<?php echo $_placement_slug; ?>"]'/></code>
11
  endif; ?>
12
  <?php endif; ?>
13
  <?php screen_icon(); ?>
14
+ <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
15
  <p class="description"><?php _e( 'Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates.', ADVADS_SLUG ); ?></p>
16
  <p class="description"><?php printf( __( 'See also the manual for more information on <a href="%s">placements</a>.', ADVADS_SLUG ), ADVADS_URL . 'manual/placements/' ); ?></p>
17
  <?php if ( isset($placements) && is_array( $placements ) && count( $placements ) ) : ?>
29
  <tbody>
30
  <?php foreach ( $placements as $_placement_slug => $_placement ) :
31
  $type_missing = false;
32
+ if( isset( $_placement['type'] ) && ! isset( $placement_types[$_placement['type']] )) {
33
  $missed_type = $_placement['type'];
34
  $_placement['type'] = 'default';
35
  $type_missing = true;
50
  endif;
51
  ?></td>
52
  <td><?php echo $_placement['name']; ?><br/>
53
+ <?php if( ! isset( $_placement['type'] ) || 'default' === $_placement['type']) :
54
+ $_placement['type'] = 'default';
55
  ?><a class="usage-link"><?php _e( 'show usage', ADVADS_SLUG ); ?></a><div class="hidden advads-usage">
56
  <label><?php _e( 'shortcode', ADVADS_SLUG ); ?>
57
  <code><input type="text" onclick="this.select();" value='[the_ad_placement id="<?php echo $_placement_slug; ?>"]'/></code>
admin/views/settings.php CHANGED
@@ -14,7 +14,7 @@ $setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
14
  ));
15
  ?><div class="wrap">
16
  <?php screen_icon(); ?>
17
- <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
18
  <?php settings_errors(); ?>
19
  <h2 class="nav-tab-wrapper" id="advads-tabs">
20
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
14
  ));
15
  ?><div class="wrap">
16
  <?php screen_icon(); ?>
17
+ <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
18
  <?php settings_errors(); ?>
19
  <h2 class="nav-tab-wrapper" id="advads-tabs">
20
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
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.6.7.1
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
@@ -38,7 +38,7 @@ define( 'ADVADS_BASE_DIR', dirname( plugin_basename( __FILE__ ) ) ); // director
38
  // general and global slug, e.g. to store options in WP, textdomain
39
  define( 'ADVADS_SLUG', 'advanced-ads' );
40
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
41
- define( 'ADVADS_VERSION', '1.6.7.1' );
42
 
43
  /*----------------------------------------------------------------------------*
44
  * 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.6.8
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
38
  // general and global slug, e.g. to store options in WP, textdomain
39
  define( 'ADVADS_SLUG', 'advanced-ads' );
40
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
41
+ define( 'ADVADS_VERSION', '1.6.8' );
42
 
43
  /*----------------------------------------------------------------------------*
44
  * Autoloading, modules and functions
classes/ad.php CHANGED
@@ -656,6 +656,9 @@ class Advanced_Ads_Ad {
656
  * @return string $id random id string
657
  */
658
  private function create_wrapper_id(){
659
- return 'advads-' . mt_rand();
 
 
 
660
  }
661
  }
656
  * @return string $id random id string
657
  */
658
  private function create_wrapper_id(){
659
+ $options = Advanced_Ads::get_instance()->options();
660
+ $prefix = isset( $options['id-prefix'] ) ? $options['id-prefix'] : 'advads-';
661
+
662
+ return $prefix . mt_rand();
663
  }
664
  }
classes/ad_placements.php CHANGED
@@ -235,6 +235,11 @@ class Advanced_Ads_Placements {
235
  }
236
  }
237
  }
 
 
 
 
 
238
  // return either ad or group content
239
  switch ( $_item[0] ) {
240
  case 'ad':
@@ -247,7 +252,7 @@ class Advanced_Ads_Placements {
247
  if ( ! isset( $args['output']['class'] ) ) {
248
  $args['output']['class'] = array();
249
  }
250
- $class = 'advads-' . $id;
251
  if ( ! in_array( $class, $args['output']['class'] ) ) {
252
  $args['output']['class'][] = $class;
253
  }
@@ -293,7 +298,6 @@ class Advanced_Ads_Placements {
293
 
294
  // parse document as DOM (fragment - having only a part of an actual post given)
295
  // -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
296
- // -TODO mb extension might not be available for really old hosts
297
  // prevent messages from dom parser
298
  $wpCharset = get_bloginfo('charset');
299
  $content = mb_convert_encoding($content, 'HTML-ENTITIES', $wpCharset);
@@ -323,6 +327,15 @@ class Advanced_Ads_Placements {
323
  $items = $xpath->query('/html/body/' . $tag);
324
  $offset = null;
325
 
 
 
 
 
 
 
 
 
 
326
  // filter empty tags from items
327
  $paragraphs = array();
328
  foreach ($items as $item) {
235
  }
236
  }
237
  }
238
+
239
+ // options
240
+ $options = Advanced_Ads::get_instance()->options();
241
+ $prefix = isset( $options['id-prefix'] ) ? $options['id-prefix'] : 'advads-';
242
+
243
  // return either ad or group content
244
  switch ( $_item[0] ) {
245
  case 'ad':
252
  if ( ! isset( $args['output']['class'] ) ) {
253
  $args['output']['class'] = array();
254
  }
255
+ $class = $prefix . $id;
256
  if ( ! in_array( $class, $args['output']['class'] ) ) {
257
  $args['output']['class'][] = $class;
258
  }
298
 
299
  // parse document as DOM (fragment - having only a part of an actual post given)
300
  // -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
 
301
  // prevent messages from dom parser
302
  $wpCharset = get_bloginfo('charset');
303
  $content = mb_convert_encoding($content, 'HTML-ENTITIES', $wpCharset);
327
  $items = $xpath->query('/html/body/' . $tag);
328
  $offset = null;
329
 
330
+ // if there are to few (one or less) items at this level test nesting
331
+ if ($items->length < 2) {
332
+ $items = $xpath->query('/html/body/*/' . $tag);
333
+ }
334
+ // try third level as last resort
335
+ if ($items->length < 2) {
336
+ $items = $xpath->query('/html/body/*/*/' . $tag);
337
+ }
338
+
339
  // filter empty tags from items
340
  $paragraphs = array();
341
  foreach ($items as $item) {
classes/plugin.php CHANGED
@@ -39,6 +39,15 @@ class Advanced_Ads_Plugin {
39
  */
40
  protected $internal_options;
41
 
 
 
 
 
 
 
 
 
 
42
  private function __construct() {
43
  register_activation_hook( dirname( __FILE__ ), array( $this, 'activate' ) );
44
  register_deactivation_hook( dirname( __FILE__ ), array( $this, 'deactivate' ) );
39
  */
40
  protected $internal_options;
41
 
42
+ /**
43
+ * default prefix of selectors (id, class) in the frontend
44
+ * can be changed by options
45
+ *
46
+ * @var Advanced_Ads_Plugin
47
+ */
48
+ const DEFAULT_FRONTEND_PREFIX = 'advads-';
49
+
50
+
51
  private function __construct() {
52
  register_activation_hook( dirname( __FILE__ ), array( $this, 'activate' ) );
53
  register_deactivation_hook( dirname( __FILE__ ), array( $this, 'deactivate' ) );
classes/widget.php CHANGED
@@ -16,16 +16,26 @@
16
  class Advanced_Ads_Widget extends WP_Widget {
17
 
18
  function __construct() {
19
- $widget_ops = array('classname' => 'advads_widget', 'description' => __( 'Display Ads and Ad Groups.', ADVADS_SLUG ));
 
 
 
 
 
 
20
  $control_ops = array();
21
- parent::__construct( 'advads_ad_widget','Advanced Ads', $widget_ops, $control_ops );
 
 
 
 
 
22
  }
23
 
24
  function widget($args, $instance) {
25
  /** This filter is documented in wp-includes/default-widgets.php */
26
  $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
27
 
28
-
29
  extract( $args );
30
  $item_id = empty($instance['item_id']) ? '' : $instance['item_id'];
31
  $title = empty($instance['title']) ? '' : $instance['title'];
16
  class Advanced_Ads_Widget extends WP_Widget {
17
 
18
  function __construct() {
19
+
20
+ $options = Advanced_Ads_Plugin::get_instance()->options();
21
+
22
+ $prefix = isset( $options['id-prefix'] ) ? $options['id-prefix'] : 'advads_';
23
+ $classname = $prefix . 'widget';
24
+
25
+ $widget_ops = array('classname' => $classname, 'description' => __( 'Display Ads and Ad Groups.', ADVADS_SLUG ));
26
  $control_ops = array();
27
+
28
+ // TODO: make default of prefix2 identical to prefix; for now we need it to not lose the existing widgets
29
+ $prefix2 = isset( $options['id-prefix'] ) ? $options['id-prefix'] : 'advads_ad_';
30
+ $base_id = $prefix2 . 'widget';
31
+
32
+ parent::__construct( $base_id,'Advanced Ads', $widget_ops, $control_ops );
33
  }
34
 
35
  function widget($args, $instance) {
36
  /** This filter is documented in wp-includes/default-widgets.php */
37
  $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
38
 
 
39
  extract( $args );
40
  $item_id = empty($instance['item_id']) ? '' : $instance['item_id'];
41
  $title = empty($instance['title']) ? '' : $instance['title'];
public/assets/js/advanced.js CHANGED
@@ -1 +1 @@
1
- advads={max_per_session:function(e,t){var i=1;if((void 0===t||0===parseInt(t))&&(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;i+=parseInt(this.get_cookie(e))}return this.set_cookie(e,i),!1},count_up:function(e){var t=1;this.cookie_exists(e)&&(t+=parseInt(this.get_cookie(e))),this.set_cookie(e,t)},set_cookie_exists:function(e){return get_cookie(e)?!0:(set_cookie(e,"",0),!1)},get_cookie:function(e){var t,i,s,o=document.cookie.split(";");for(t=0;t<o.length;t++)if(i=o[t].substr(0,o[t].indexOf("=")),s=o[t].substr(o[t].indexOf("=")+1),i=i.replace(/^\s+|\s+$/g,""),i===e)return unescape(s)},set_cookie:function(e,t,i,s,o,n){var r=new Date;r.setDate(r.getDate()+i),document.cookie=e+"="+escape(t)+(null==i?"":"; expires="+r.toUTCString())+(null==s?"; path=/":"; path="+s)+(null==o?"":"; domain="+o)+(null==n?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t?!0:!1},move:function(e,t,i){var s=jQuery(e);if("undefined"==typeof i&&(i={}),"undefined"==typeof i.css&&(i.css={}),"undefined"==typeof i.method&&(i.method="prependTo"),""===t&&"undefined"!=typeof i.target)switch(i.target){case"wrapper":var o="left";"undefined"!=typeof i.offset&&(o=i.offset),t=this.find_wrapper(e,o)}switch(i.method){case"insertBefore":s.insertBefore(t);break;case"insertAfter":s.insertAfter(t);break;case"appendTo":s.appendTo(t);break;case"prependTo":s.prependTo(t);break;default:s.prependTo(t)}},fix_element:function(e){var t=jQuery(e),i=t.parent();("static"===i.css("position")||""===i.css("position"))&&i.css("position","relative");var s=parseInt(t.offset().top),o=parseInt(t.offset().left);t.css("position","fixed").css("top",s+"px").css("left",o+"px")},find_wrapper:function(e,t){var i;return jQuery("body").children().each(function(s,o){if(o.id!==e.substring(1)){var n=jQuery(o);if("right"===t&&n.offset().left+jQuery(n).width()<jQuery(window).width()||"left"===t&&n.offset().left>0)return("static"===n.css("position")||""===n.css("position"))&&n.css("position","relative"),i=o,!1}}),i},center_fixed_element:function(e){var t=jQuery(e),i=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",i+"px")}};
1
+ advads={max_per_session:function(e,t){var o=1;if((void 0===t||0===parseInt(t))&&(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;o+=parseInt(this.get_cookie(e))}return this.set_cookie(e,o),!1},count_up:function(e){var t=1;this.cookie_exists(e)&&(t+=parseInt(this.get_cookie(e))),this.set_cookie(e,t)},set_cookie_exists:function(e){return get_cookie(e)?!0:(set_cookie(e,"",0),!1)},get_cookie:function(e){var t,o,i,n=document.cookie.split(";");for(t=0;t<n.length;t++)if(o=n[t].substr(0,n[t].indexOf("=")),i=n[t].substr(n[t].indexOf("=")+1),o=o.replace(/^\s+|\s+$/g,""),o===e)return unescape(i)},set_cookie:function(e,t,o,i,n,s){var r=new Date;r.setDate(r.getDate()+o),document.cookie=e+"="+escape(t)+(null==o?"":"; expires="+r.toUTCString())+(null==i?"; path=/":"; path="+i)+(null==n?"":"; domain="+n)+(null==s?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t?!0:!1},move:function(e,t,o){var i=jQuery(e);if("undefined"==typeof o&&(o={}),"undefined"==typeof o.css&&(o.css={}),"undefined"==typeof o.method&&(o.method="prependTo"),""===t&&"undefined"!=typeof o.target)switch(o.target){case"wrapper":var n="left";"undefined"!=typeof o.offset&&(n=o.offset),t=this.find_wrapper(e,n)}switch(o.method){case"insertBefore":i.insertBefore(t);break;case"insertAfter":i.insertAfter(t);break;case"appendTo":i.appendTo(t);break;case"prependTo":i.prependTo(t);break;default:i.prependTo(t)}},fix_element:function(e){var t=jQuery(e),o=t.parent();("static"===o.css("position")||""===o.css("position"))&&o.css("position","relative");var i=parseInt(t.offset().top),n=parseInt(t.offset().left);t.css("position","fixed").css("top",i+"px").css("left",n+"px")},find_wrapper:function(e,t){var o;return jQuery("body").children().each(function(i,n){if(n.id!==e.substring(1)){var s=jQuery(n);if("right"===t&&s.offset().left+jQuery(s).width()<jQuery(window).width()||"left"===t&&s.offset().left>0)return("static"===s.css("position")||""===s.css("position"))&&s.css("position","relative"),o=n,!1}}),o},center_fixed_element:function(e){var t=jQuery(e),o=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",o+"px")}},jQuery(document).ready(function(){if(localStorage.getItem("advads_frontend_picker")){var e,t=jQuery("<div id='advads-picker-overlay'>"),o=[document.body,document.documentElement,document];t.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(i){if(i.target!==e){if(~o.indexOf(i.target))return e=null,void t.hide();var n=jQuery(i.target),s=n.offset(),r=n.outerWidth(),a=n.outerHeight();e=i.target,t.css({top:s.top,left:s.left,width:r,height:a}).show(),console.log(jQuery(e).getPath())}}),jQuery(document).click(function(){var t=jQuery(e).getPath();localStorage.setItem("advads_frontend_element",t),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(e,t){if("undefined"==typeof e&&(e=""),"undefined"==typeof t&&(t=0),this.is("html"))return"html > "+e;if(2===t)return e;var o=this.get(0).nodeName.toLowerCase(),i=this.attr("id"),n=this.attr("class");return"undefined"!=typeof i?(o+="#"+i,t+=1):"undefined"!=typeof n&&(o+="."+n.split(/[\s\n]+/).join(".")),this.siblings(o).length&&(o+=":eq("+this.index()+")"),""===e?this.parent().getPath(o,t):this.parent().getPath(o+" > "+e,t)}});
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: webzunft
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
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.2.3
7
- Stable tag: 1.6.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -182,6 +182,13 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
182
 
183
  == Changelog ==
184
 
 
 
 
 
 
 
 
185
  = 1.6.7.1 =
186
 
187
  * hotfix to prevent error message on empty content injection placements
2
  Contributors: webzunft
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
4
  Tags: ads, ad, adsense, display, banner, advertisements, adverts, advert, monetization
5
+ Requires at least: WP 4.2, PHP 5.3
6
+ Tested up to: 4.3
7
+ Stable tag: 1.6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
182
 
183
  == Changelog ==
184
 
185
+ = 1.6.8 =
186
+
187
+ * added option to change the prefix of ids and classes in the frontend to prevent widgets from being ad-blocked
188
+ * minor optimization to autocomplete feature of post display condition
189
+ * minor changes to align with changes in WordPress 4.3
190
+ * content-injection now detects wrappers around content up to the third level
191
+
192
  = 1.6.7.1 =
193
 
194
  * hotfix to prevent error message on empty content injection placements