Advanced Ads - Version 1.14.1

Version Description

  • fixed issue with PHP 5.2 (please update to PHP 5.6.20 since it is the minimum requirement of WordPress)
  • fixed potential conflict with ClassiPress ad categories
  • prevented user interface from looking broken when Twitter Bootstrap is added by another source
Download this release

Release Info

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

Code changes from version 1.14 to 1.14.1

admin/assets/css/admin.css CHANGED
@@ -174,7 +174,7 @@ select + .advads-conditions-single { display: inline-block; }
174
 
175
  /* option lists */
176
  .advads-option-list { overflow: hidden; }
177
- .advads-option-list > .label { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; }
178
  .advads-option-list > .label + div { display: block; float: left; padding: 10px; }
179
  .advads-option-list > hr { clear: both; float: none; display: block; }
180
 
@@ -524,4 +524,4 @@ div#advads-gadsense-box{
524
 
525
  tr.advads-clickable-row:hover{
526
  cursor: pointer;
527
- }
174
 
175
  /* option lists */
176
  .advads-option-list { overflow: hidden; }
177
+ .advads-option-list > .label { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; text-transform: capitalize; color: #444; text-align: left; font-size: 100%; }
178
  .advads-option-list > .label + div { display: block; float: left; padding: 10px; }
179
  .advads-option-list > hr { clear: both; float: none; display: block; }
180
 
524
 
525
  tr.advads-clickable-row:hover{
526
  cursor: pointer;
527
+ }
admin/assets/js/admin.js CHANGED
@@ -1,8 +1,4 @@
1
  jQuery( document ).ready(function ($) {
2
- if ( ! $.fn.accordion || ! $.fn.tooltip || ! advads_use_ui_buttonset() ) {
3
- $( '.advads-jqueryui-error').show();
4
- }
5
-
6
  function advads_load_ad_type_parameter_metabox(ad_type) {
7
  jQuery( '#advanced-ad-type input' ).prop( 'disabled', true );
8
  $( '#advanced-ads-tinymce-wrapper' ).hide();
@@ -96,8 +92,8 @@ jQuery( document ).ready(function ($) {
96
  });
97
 
98
  // activate general buttons
99
- if ( advads_use_ui_buttonset() ) {
100
- $( '.advads-buttonset' ).buttonset();
101
  }
102
  // activate accordions
103
  if ( $.fn.accordion ) {
@@ -453,8 +449,8 @@ jQuery( document ).ready(function ($) {
453
  * PLACEMENTS
454
  */
455
  // show image tooltips
456
- if ( $.fn.tooltip ) {
457
- $( ".advads-placements-new-form .advads-placement-type" ).tooltip({
458
  items: "label",
459
  content: function() {
460
  return $( this ).parents('.advads-placement-type').find( '.advads-placement-description' ).html();
@@ -907,20 +903,66 @@ function advads_ads_txt_find_issues() {
907
 
908
  }
909
 
910
- // Change JQueryUI names to fix name collision with other libraries, eg. Bootstrap
911
- jQuery.fn.advads_button = jQuery.fn.button;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912
 
913
  /**
914
- * check if jQueryUI button/buttonset can be used
 
 
 
915
  */
916
- var advads_use_ui_buttonset = ( function() {
917
- var ret = null;
918
- return function () {
919
- if ( null === ret ) {
920
- var needle = 'var g="string"==typeof f,h=c.call(arguments,1)'; //string from jquery-ui source code
921
- ret = jQuery.fn.advads_button && jQuery.fn.buttonset && jQuery.fn.button.toString().indexOf( needle ) !== -1;
922
  }
923
- return ret;
924
  };
925
  })();
926
 
@@ -1479,4 +1521,4 @@ class AdvancedAdsAdNetwork{
1479
 
1480
  class AdvancedAdsExternalAdUnit{
1481
 
1482
- }
1
  jQuery( document ).ready(function ($) {
 
 
 
 
2
  function advads_load_ad_type_parameter_metabox(ad_type) {
3
  jQuery( '#advanced-ad-type input' ).prop( 'disabled', true );
4
  $( '#advanced-ads-tinymce-wrapper' ).hide();
92
  });
93
 
94
  // activate general buttons
95
+ if ( $.fn.advads_buttonset ) {
96
+ $( '.advads-buttonset' ).advads_buttonset();
97
  }
98
  // activate accordions
99
  if ( $.fn.accordion ) {
449
  * PLACEMENTS
450
  */
451
  // show image tooltips
452
+ if ( $.fn.advads_tooltip ) {
453
+ $( ".advads-placements-new-form .advads-placement-type" ).advads_tooltip({
454
  items: "label",
455
  content: function() {
456
  return $( this ).parents('.advads-placement-type').find( '.advads-placement-description' ).html();
903
 
904
  }
905
 
906
+ jQuery.fn.advads_tooltip = function() {
907
+ return _advads_apply_jqueryui_widget.call( this, 'tooltip', ['tooltip'], arguments );
908
+ };
909
+
910
+ jQuery.fn.advads_button = function() {
911
+ return _advads_apply_jqueryui_widget.call( this, 'button', ['button'], arguments );
912
+ };
913
+
914
+ jQuery.fn.advads_buttonset = function() {
915
+ return _advads_apply_jqueryui_widget.call( this, 'buttonset', ['button', 'buttonset'], arguments );
916
+ };
917
+
918
+ /**
919
+ * Apply jQueryUI widget.
920
+ *
921
+ * @param str name Widget name.
922
+ * @param arr revoke Names of Twitter Bootstrap widgets to revoke.
923
+ * @param arguments_ mixed Widget arguments.
924
+ */
925
+ function _advads_apply_jqueryui_widget( name, revoke, args ) {
926
+ var revoked = {};
927
+ var can_apply = true;
928
+
929
+ jQuery.each( revoke, function( _index, _name ) {
930
+ if ( jQuery.fn[ _name ].noConflict ) {
931
+ // Revoke Twitter Bootstrap, assign jQuery UI.
932
+ revoked[ _name ] = jQuery.fn[ _name ].noConflict();
933
+ }
934
+ can_apply = _advads_can_apply_jqueryui_widget( _name );
935
+ });
936
+
937
+ if ( ! can_apply ) {
938
+ // The culprit is not Bootstrap, we haven't been able to assign jQuery UI.
939
+ jQuery( '.advads-jqueryui-error').show();
940
+ return;
941
+ }
942
+
943
+ var r = this[ name ].apply( this, args );
944
+
945
+ jQuery.each( revoked, function( _name, _widget ) {
946
+ // Revoke jQuery UI, assign Bootstrap.
947
+ jQuery.fn[ _name ] = _widget;
948
+ });
949
+ return r;
950
+ }
951
 
952
  /**
953
+ * Check whether jQueryUI widget was overridden by another library.
954
+ *
955
+ * @param name Widget name.
956
+ * @return bool
957
  */
958
+ var _advads_can_apply_jqueryui_widget = ( function( name ) {
959
+ var r = {};
960
+ return function ( name ) {
961
+ if ( ! r.hasOwnProperty( name ) ) {
962
+ var needle = 'prior to initialization;'; // A string from jquery-ui source code.
963
+ r[ name ] = jQuery.fn[ name ].toString().indexOf( needle ) !== -1;
964
  }
965
+ return r[ name ];
966
  };
967
  })();
968
 
1521
 
1522
  class AdvancedAdsExternalAdUnit{
1523
 
1524
+ }
admin/includes/ad-health-notices.php CHANGED
@@ -46,6 +46,7 @@ $advanced_ads_ad_health_notices = apply_filters( 'advanced-ads-ad-health-notices
46
  ),
47
  // Autoptimize found, but no Advanced Ads Pro
48
  // Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ).
 
49
  'autoptimize_no_pro' => array(
50
  'text' => sprintf(
51
  // translators: %s is a target URL.
46
  ),
47
  // Autoptimize found, but no Advanced Ads Pro
48
  // Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ).
49
+ // 1907: Autoptimize didn’t cause issues for a while. We are no longer showing the warning and might remove this if the plugin doesn’t cause problems anymore
50
  'autoptimize_no_pro' => array(
51
  'text' => sprintf(
52
  // translators: %s is a target URL.
admin/includes/class-ad-type.php CHANGED
@@ -52,8 +52,9 @@ class Advanced_Ads_Admin_Ad_Type {
52
 
53
  add_filter( 'gettext', array( $this, 'replace_cheating_message' ), 20, 2 );
54
 
55
- // Remove parent group dropdown in ad edit
56
- add_filter( 'wp_dropdown_cats', array( $this, 'remove_parent_group_dropdown'), 10, 2 );
 
57
  }
58
 
59
  /**
@@ -677,6 +678,21 @@ class Advanced_Ads_Admin_Ad_Type {
677
  return $translated_text;
678
  }
679
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
680
  /**
681
  * Remove parent group dropdown from ad group taxonomy
682
  *
52
 
53
  add_filter( 'gettext', array( $this, 'replace_cheating_message' ), 20, 2 );
54
 
55
+ // things that need to know the current screen
56
+ add_action( 'current_screen', array( $this, 'run_on_ad_edit_screen' ) );
57
+
58
  }
59
 
60
  /**
678
  return $translated_text;
679
  }
680
 
681
+ /**
682
+ * General stuff after ad edit page is loaded and screen variable is available
683
+ */
684
+ public function run_on_ad_edit_screen() {
685
+ $screen = get_current_screen();
686
+
687
+ if ( ! isset( $screen->id ) || 'advanced_ads' !== $screen->id ) {
688
+ return;
689
+ }
690
+
691
+ // Remove parent group dropdown in ad edit
692
+ add_filter( 'wp_dropdown_cats', array( $this, 'remove_parent_group_dropdown'), 10, 2 );
693
+
694
+ }
695
+
696
  /**
697
  * Remove parent group dropdown from ad group taxonomy
698
  *
admin/views/ad-display-metabox.php CHANGED
@@ -189,8 +189,8 @@ endforeach;
189
  var connector = '<input style="display:none;" type="checkbox" name="<?php echo Advanced_Ads_Display_Conditions::FORM_NAME; ?>[' + display_condition_index + '][connector]" checked="checked" value="or" id="advads-conditions-'+ display_condition_index +'-connector"><label for="advads-conditions-'+ display_condition_index +'-connector"><?php esc_attr_e( 'or', 'advanced-ads' ); ?></label>';
190
  var newline = '<tr class="advads-conditions-connector advads-conditions-connector-or"><td colspan="3">'+connector+'</td></tr><tr><td class="advads-conditions-type" data-condition-type="'+ display_condition_type +'">' + display_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
191
  $('#advads-display-conditions table tbody').append(newline);
192
- if ( advads_use_ui_buttonset() ) {
193
- $('#advads-display-conditions table tbody .advads-conditions-single.advads-buttonset').buttonset();
194
  }
195
  if ( jQuery.fn.advads_button ) {
196
  $('#advads-display-conditions table tbody .advads-conditions-connector input').advads_button();
189
  var connector = '<input style="display:none;" type="checkbox" name="<?php echo Advanced_Ads_Display_Conditions::FORM_NAME; ?>[' + display_condition_index + '][connector]" checked="checked" value="or" id="advads-conditions-'+ display_condition_index +'-connector"><label for="advads-conditions-'+ display_condition_index +'-connector"><?php esc_attr_e( 'or', 'advanced-ads' ); ?></label>';
190
  var newline = '<tr class="advads-conditions-connector advads-conditions-connector-or"><td colspan="3">'+connector+'</td></tr><tr><td class="advads-conditions-type" data-condition-type="'+ display_condition_type +'">' + display_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
191
  $('#advads-display-conditions table tbody').append(newline);
192
+ if ( jQuery.fn.advads_buttonset ) {
193
+ $('#advads-display-conditions table tbody .advads-conditions-single.advads-buttonset').advads_buttonset();
194
  }
195
  if ( jQuery.fn.advads_button ) {
196
  $('#advads-display-conditions table tbody .advads-conditions-connector input').advads_button();
admin/views/ad-visitor-metabox.php CHANGED
@@ -158,8 +158,8 @@ jQuery( document ).ready(function ($) {
158
  var connector = '<input type="checkbox" name="<?php echo Advanced_Ads_Visitor_Conditions::FORM_NAME; ?>[' + visitor_condition_index + '][connector]" value="or" id="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><label for="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><?php _e( 'and', 'advanced-ads' ); ?></label>';
159
  var newline = '<tr class="advads-conditions-connector advads-conditions-connector-and"><td colspan="3">'+connector+'</td></tr><tr><td>' + visitor_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
160
  $( '#advads-visitor-conditions table tbody' ).append( newline );
161
- if ( advads_use_ui_buttonset() ) { // only used in Pro right now
162
- $('#advads-visitor-conditions table tbody .advads-conditions-single.advads-buttonset').buttonset();
163
  }
164
  if ( jQuery.fn.advads_button ) {
165
  $('#advads-visitor-conditions table tbody .advads-conditions-connector input').advads_button();
158
  var connector = '<input type="checkbox" name="<?php echo Advanced_Ads_Visitor_Conditions::FORM_NAME; ?>[' + visitor_condition_index + '][connector]" value="or" id="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><label for="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><?php _e( 'and', 'advanced-ads' ); ?></label>';
159
  var newline = '<tr class="advads-conditions-connector advads-conditions-connector-and"><td colspan="3">'+connector+'</td></tr><tr><td>' + visitor_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
160
  $( '#advads-visitor-conditions table tbody' ).append( newline );
161
+ if ( jQuery.fn.advads_buttonset ) { // only used in Pro right now
162
+ $('#advads-visitor-conditions table tbody .advads-conditions-single.advads-buttonset').advads_buttonset();
163
  }
164
  if ( jQuery.fn.advads_button ) {
165
  $('#advads-visitor-conditions table tbody .advads-conditions-connector input').advads_button();
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.14
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
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.14' );
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.14.1
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
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.14.1' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad-health-notices.php CHANGED
@@ -183,18 +183,10 @@ class Advanced_Ads_Ad_Health_Notices {
183
 
184
  // unignore notices if `show-hidden=true` is set in the URL.
185
  if ( isset( $_GET['advads_nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['advads_nonce'] ), 'advanced-ads-show-hidden-notices' )
186
- && isset( $_GET['advads-show-hidden-notices'] ) && 'true' === $_GET['advads-show-hidden-notices'] ) {
187
  $this->unignore();
188
  // remove the argument from the URL.
189
- add_filter(
190
- 'removable_query_args',
191
- function ( $removable_query_args ) {
192
- $removable_query_args[] = 'advads-show-hidden-notices';
193
- $removable_query_args[] = 'advads_nonce';
194
-
195
- return $removable_query_args;
196
- }
197
- );
198
  }
199
 
200
 
@@ -207,6 +199,19 @@ class Advanced_Ads_Ad_Health_Notices {
207
  $this->displayed_notices = array_diff( $notice_keys, $this->ignore );
208
  }
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  /**
211
  * Manage when to run checks
212
  * - only when users have ads
@@ -249,11 +254,12 @@ class Advanced_Ads_Ad_Health_Notices {
249
  } else {
250
  $this->remove( 'cache_no_pro' );
251
  }
252
- if ( Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ) {
 
253
  $this->add( 'autoptimize_no_pro' );
254
  } else {
255
  $this->remove( 'autoptimize_no_pro' );
256
- }
257
  if ( count( Advanced_Ads_Checks::conflicting_plugins() ) ) {
258
  $this->add( 'conflicting_plugins' );
259
  } else {
183
 
184
  // unignore notices if `show-hidden=true` is set in the URL.
185
  if ( isset( $_GET['advads_nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['advads_nonce'] ), 'advanced-ads-show-hidden-notices' )
186
+ && isset( $_GET['advads-show-hidden-notices'] ) && 'true' === $_GET['advads-show-hidden-notices'] ) {
187
  $this->unignore();
188
  // remove the argument from the URL.
189
+ add_filter( 'removable_query_args', array( $this, 'remove_query_vars_after_notice_update' ) );
 
 
 
 
 
 
 
 
190
  }
191
 
192
 
199
  $this->displayed_notices = array_diff( $notice_keys, $this->ignore );
200
  }
201
 
202
+ /**
203
+ * Remove query var from URL after notice was updated
204
+ *
205
+ * @param array $removable_query_args array with removable query vars.
206
+ * @return array updated query vars.
207
+ */
208
+ public function remove_query_vars_after_notice_update( $removable_query_args ) {
209
+ $removable_query_args[] = 'advads-show-hidden-notices';
210
+ $removable_query_args[] = 'advads_nonce';
211
+
212
+ return $removable_query_args;
213
+ }
214
+
215
  /**
216
  * Manage when to run checks
217
  * - only when users have ads
254
  } else {
255
  $this->remove( 'cache_no_pro' );
256
  }
257
+ // 1907: Autoptimize didn’t cause issues for a while so let’s remove the warning and see
258
+ /*if ( Advanced_Ads_Checks::active_autoptimize() && ! defined( 'AAP_VERSION' ) ) {
259
  $this->add( 'autoptimize_no_pro' );
260
  } else {
261
  $this->remove( 'autoptimize_no_pro' );
262
+ }*/
263
  if ( count( Advanced_Ads_Checks::conflicting_plugins() ) ) {
264
  $this->add( 'conflicting_plugins' );
265
  } else {
modules/gadsense/admin/assets/js/adsense.js CHANGED
@@ -402,7 +402,6 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
402
  }
403
  if ('in-feed' == theAd.type) {
404
  $( '#unit-type' ).val( 'in-feed' );
405
- $( '#ad-layout' ).val( theAd.layout );
406
  $( '#ad-layout-key' ).val( theAd.layout_key );
407
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
408
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
@@ -437,7 +436,6 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
437
  adContent.resize = resize;
438
  }
439
  if ('in-feed' == unitType) {
440
- adContent.layout = $( '#ad-parameters-box #ad-layout' ).val();
441
  adContent.layout_key = $( '#ad-parameters-box #ad-layout-key' ).val();
442
  }
443
  if ('undefined' != typeof(adContent.resize) && 'auto' != adContent.resize) {
@@ -469,10 +467,11 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
469
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
470
  $( '.clearfix-before' ).show();
471
  } else if ( 'in-feed' == type ) {
472
- $( '.advads-adsense-layout' ).css( 'display', 'block' );
473
- $( '.advads-adsense-layout' ).next('div').css( 'display', 'block' );
474
  $( '.advads-adsense-layout-key' ).css( 'display', 'block' );
475
  $( '.advads-adsense-layout-key' ).next('div').css( 'display', 'block' );
 
476
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
477
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
478
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
@@ -697,9 +696,6 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
697
  'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
698
  'data-ad-slot="' + slotId + '" ' +
699
  'data-ad-layout-key="' + layoutKey + '" ';
700
- if ( '' != layout ) {
701
- code += 'data-ad-layout="' + layout + '" ';
702
- }
703
  code += 'data-ad-format="fluid"></ins>' +
704
  '<script>' +
705
  '(adsbygoogle = window.adsbygoogle || []).push({});' +
402
  }
403
  if ('in-feed' == theAd.type) {
404
  $( '#unit-type' ).val( 'in-feed' );
 
405
  $( '#ad-layout-key' ).val( theAd.layout_key );
406
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
407
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
436
  adContent.resize = resize;
437
  }
438
  if ('in-feed' == unitType) {
 
439
  adContent.layout_key = $( '#ad-parameters-box #ad-layout-key' ).val();
440
  }
441
  if ('undefined' != typeof(adContent.resize) && 'auto' != adContent.resize) {
467
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
468
  $( '.clearfix-before' ).show();
469
  } else if ( 'in-feed' == type ) {
470
+ $( '.advads-adsense-layout' ).css( 'display', 'none' );
471
+ $( '.advads-adsense-layout' ).next('div').css( 'display', '`none' );
472
  $( '.advads-adsense-layout-key' ).css( 'display', 'block' );
473
  $( '.advads-adsense-layout-key' ).next('div').css( 'display', 'block' );
474
+ $( '.advads-adsense-layout-key' ).next('div').css( 'display', 'block' );
475
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
476
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
477
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
696
  'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
697
  'data-ad-slot="' + slotId + '" ' +
698
  'data-ad-layout-key="' + layoutKey + '" ';
 
 
 
699
  code += 'data-ad-format="fluid"></ins>' +
700
  '<script>' +
701
  '(adsbygoogle = window.adsbygoogle || []).push({});' +
modules/gadsense/admin/views/adsense-account.php CHANGED
@@ -79,7 +79,11 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
79
  <?php if ( $mapi_account_details ) : ?>
80
  <p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
81
  <?php else : ?>
82
- <p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
 
 
 
 
83
  <?php endif; ?>
84
  </div>
85
  <?php if ( empty( $adsense_id ) ) : ?>
79
  <?php if ( $mapi_account_details ) : ?>
80
  <p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
81
  <?php else : ?>
82
+ <?php if ( 0 !== strpos( $adsense_id, 'pub-' ) ) : ?>
83
+ <p class="advads-error-message"><?php esc_html_e( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' ); ?></p>
84
+ <?php else : ?>
85
+ <p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
86
+ <?php endif; ?>
87
  <?php endif; ?>
88
  </div>
89
  <?php if ( empty( $adsense_id ) ) : ?>
modules/gadsense/includes/class-network-adsense.php CHANGED
@@ -239,14 +239,7 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
239
  if( 0 === strpos( $options['adsense-id'], 'ca-' ) ){
240
  $options['adsense-id'] = str_replace( 'ca-', '', $options['adsense-id'] );
241
  }
242
-
243
- if( 0 !== strpos( $options['adsense-id'], 'pub-' ) ){
244
- // add settings error
245
- add_settings_error(
246
- 'adsense-limit',
247
- 'settings_updated',
248
- __( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' ));
249
- }
250
  // trim publisher id
251
  $options['adsense-id'] = trim($options['adsense-id']);
252
  }
239
  if( 0 === strpos( $options['adsense-id'], 'ca-' ) ){
240
  $options['adsense-id'] = str_replace( 'ca-', '', $options['adsense-id'] );
241
  }
242
+
 
 
 
 
 
 
 
243
  // trim publisher id
244
  $options['adsense-id'] = trim($options['adsense-id']);
245
  }
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==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);var target_string=target;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")}if(target.length>1){console.log("Advanced Ads: element '"+target_string+"' found "+target.length+" times.")}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,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);var parent=el.parent();if(options.use_grandparent){parent=parent.parent()}if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);if(options.use_grandparent){this.set_parent_relative(el.parent())}else{this.set_parent_relative(el)}if(options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(options.is_invisible){el.hide()}if("left"===options.offset){var rightoffset=jQuery(window).width()-leftoffset-el.outerWidth();el.css("position","fixed").css("top",topoffset+"px").css("right",rightoffset+"px").css("left","")}else{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;if(el.css("position")!=="fixed"){left-=topoffset=parseInt(el.offset().top)}el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()},wait_for_images:function($el,ready_callback){var loaded_count=0;var srcs=[];$el.find('img[src][src!=""]').each(function(){srcs.push(this.src)});if(srcs.length===0){ready_callback.call($el)}jQuery.each(srcs,function(i,src){var image=new Image;image.src=src;var events="load error";jQuery(image).one(events,function me(event){jQuery(this).off(events,me);loaded_count++;if(loaded_count==srcs.length){ready_callback.call($el[0]);return false}})})},privacy:{get_state:function(){if(!window.advads_options||!window.advads_options.privacy){return"not_needed"}var options=window.advads_options.privacy;if(!options.enabled){return"not_needed"}var method=options["consent-method"]?options["consent-method"]:"0";switch(method){case"0":return"not_needed";break;case"custom":if(options["custom-cookie-value"===undefined]||options["custom-cookie-value"]===undefined){return"not_needed"}var found=advads.get_cookie(options["custom-cookie-name"]);if(typeof found!=="string"){return"unknown"}if(options["custom-cookie-value"]===""&&found===""||options["custom-cookie-value"]!==""&&found.indexOf(options["custom-cookie-value"])!==-1){return"accepted"}return"unknown";break;default:return advads.cookie_exists(method)?"accepted":"unknown"}},is_adsense_npa_enabled:function(){if(!window.advads_options||!window.advads_options.privacy){return true}var options=window.advads_options.privacy;return!!options["show-non-personalized-adsense"]}}};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);var target_string=target;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")}else{target=jQuery(target)}if(target.length>1){console.log("Advanced Ads: element '"+target_string+"' found "+target.length+" times.")}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,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);var parent=el.parent();if(options.use_grandparent){parent=parent.parent()}if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);if(options.use_grandparent){this.set_parent_relative(el.parent())}else{this.set_parent_relative(el)}if(options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(options.is_invisible){el.hide()}if("left"===options.offset){var rightoffset=jQuery(window).width()-leftoffset-el.outerWidth();el.css("position","fixed").css("top",topoffset+"px").css("right",rightoffset+"px").css("left","")}else{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;if(el.css("position")!=="fixed"){left-=topoffset=parseInt(el.offset().top)}el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()},wait_for_images:function($el,ready_callback){var loaded_count=0;var srcs=[];$el.find('img[src][src!=""]').each(function(){srcs.push(this.src)});if(srcs.length===0){ready_callback.call($el)}jQuery.each(srcs,function(i,src){var image=new Image;image.src=src;var events="load error";jQuery(image).one(events,function me(event){jQuery(this).off(events,me);loaded_count++;if(loaded_count==srcs.length){ready_callback.call($el[0]);return false}})})},privacy:{get_state:function(){if(!window.advads_options||!window.advads_options.privacy){return"not_needed"}var options=window.advads_options.privacy;if(!options.enabled){return"not_needed"}var method=options["consent-method"]?options["consent-method"]:"0";switch(method){case"0":return"not_needed";break;case"custom":if(options["custom-cookie-value"===undefined]||options["custom-cookie-value"]===undefined){return"not_needed"}var found=advads.get_cookie(options["custom-cookie-name"]);if(typeof found!=="string"){return"unknown"}if(options["custom-cookie-value"]===""&&found===""||options["custom-cookie-value"]!==""&&found.indexOf(options["custom-cookie-value"])!==-1){return"accepted"}return"unknown";break;default:return advads.cookie_exists(method)?"accepted":"unknown"}},is_adsense_npa_enabled:function(){if(!window.advads_options||!window.advads_options.privacy){return true}var options=window.advads_options.privacy;return!!options["show-non-personalized-adsense"]}}};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
@@ -175,8 +175,10 @@ advads = {
175
  // use only visible elements
176
  if( typeof options.moveintohidden === 'undefined' ){
177
  target = jQuery( target ).filter(':visible');
 
 
178
  }
179
-
180
  // print warning in console if the element appears multiple times
181
  if( target.length > 1 ){
182
  console.log( "Advanced Ads: element '" + target_string + "' found " + target.length + " times." );
175
  // use only visible elements
176
  if( typeof options.moveintohidden === 'undefined' ){
177
  target = jQuery( target ).filter(':visible');
178
+ } else {
179
+ target = jQuery( target );
180
  }
181
+
182
  // print warning in console if the element appears multiple times
183
  if( target.length > 1 ){
184
  console.log( "Advanced Ads: element '" + target_string + "' found " + target.length + " times." );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
5
  Requires at least: 4.6
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
- Stable tag: 1.14
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -44,7 +44,7 @@ Based on my experience as a publisher with millions of monthly served ads, I've
44
 
45
  choose between different ad types that enable you to:
46
 
47
- * insert ads content and banners from all ad and affiliate networks (e.g., Google AdSense, Chitika, Amazon, BuySellAds, Google Ad Manager, DoubleClick (DFP), Ezoic, media.net, Booking.com, Tradedoubler, Awin, Getyourguide, The Moneytizer...)
48
  * dedicated support for all types of Google AdSense ads, including text and diplay ads, native ads (In-article, In-feed, matched content), link units (standard and responsive), Auto ads, and Auto ads for AMP
49
  * display images and image banners
50
  * create content-rich ads with the WordPress TinyMCE editor
@@ -290,6 +290,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
290
 
291
  == Changelog ==
292
 
 
 
 
 
 
 
293
  = 1.14 =
294
 
295
  * rewrite of AdSense code logic. Please reach out through https://wpadvancedads.com/support/ if you discover any issues
5
  Requires at least: 4.6
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 1.14.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
44
 
45
  choose between different ad types that enable you to:
46
 
47
+ * insert ads content and banners from all ad and affiliate networks (e.g., Google AdSense, Amazon, BuySellAds, Google Ad Manager, DoubleClick (DFP), Ezoic, media.net, Booking.com, Tradedoubler, Awin, Getyourguide, The Moneytizer...)
48
  * dedicated support for all types of Google AdSense ads, including text and diplay ads, native ads (In-article, In-feed, matched content), link units (standard and responsive), Auto ads, and Auto ads for AMP
49
  * display images and image banners
50
  * create content-rich ads with the WordPress TinyMCE editor
290
 
291
  == Changelog ==
292
 
293
+ = 1.14.1 =
294
+
295
+ * fixed issue with PHP 5.2 (please update to PHP 5.6.20 since it is the minimum requirement of WordPress)
296
+ * fixed potential conflict with ClassiPress ad categories
297
+ * prevented user interface from looking broken when Twitter Bootstrap is added by another source
298
+
299
  = 1.14 =
300
 
301
  * rewrite of AdSense code logic. Please reach out through https://wpadvancedads.com/support/ if you discover any issues