Ad Inserter – WordPress Ads Management with AdSense Header Integration - Version 2.6.1

Version Description

  • Fix for errors on the settings page
  • Fix for non English characters in ads
  • Fix for sticky widgets
  • Few minor bug fixes
Download this release

Release Info

Developer spacetime
Plugin Icon 128x128 Ad Inserter – WordPress Ads Management with AdSense Header Integration
Version 2.6.1
Comparing to
See all releases

Code changes from version 2.6.0 to 2.6.1

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.6.0
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -15,6 +15,12 @@ Domain Path: /languages
15
 
16
  Change Log
17
 
 
 
 
 
 
 
18
  Ad Inserter 2.6.0 - 2020-01-09
19
  - Added support for VIEWPORT separator
20
  - Added support for viewport check in CHECK separators (Pro only)
@@ -1876,6 +1882,7 @@ function ai_set_footer_inline_scripts () {
1876
 
1877
  $adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
1878
 
 
1879
  $ai_wp_data [AI_FOOTER_INLINE_SCRIPTS] =
1880
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
1881
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || // alerady in $ai_wp_data [AI_CLIENT_SIDE_INSERTION]
@@ -2354,10 +2361,16 @@ function add_footer_inline_scripts () {
2354
  }
2355
  }
2356
 
 
 
 
2357
  if ($ai_wp_data [AI_FOOTER_INLINE_SCRIPTS]) {
2358
  // echo "<span ai-ao></span>\n";
2359
  echo "<script>\n";
2360
 
 
 
 
2361
  if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
2362
  $js_code = "";
2363
 
@@ -2370,7 +2383,18 @@ function add_footer_inline_scripts () {
2370
  echo $js_code;
2371
  }
2372
 
2373
- $wait_for_jquery = get_wait_for_jquery ();
 
 
 
 
 
 
 
 
 
 
 
2374
 
2375
  // Wait for jQuery
2376
  if ($wait_for_jquery && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
@@ -2427,8 +2451,6 @@ function add_footer_inline_scripts () {
2427
  //";
2428
  } // Wait for jQuery
2429
 
2430
- $client_side_dynamic_blocks = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT;
2431
-
2432
  if ($ai_wp_data [AI_STICKY_WIDGETS] && get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS) {
2433
  // echo ai_get_js ('ResizeSensor');
2434
  echo ai_get_js ('theia-sticky-sidebar');
@@ -3741,6 +3763,16 @@ function ai_write_debug_info ($write_processing_log = false) {
3741
  $categories []= $category->name . ' ('.$category->slug.')';
3742
  }
3743
  echo 'CATEGORIES: ', implode (', ', $categories), "\n";
 
 
 
 
 
 
 
 
 
 
3744
  $tag_data = wp_get_post_tags (get_the_ID());
3745
  $tags = array ();
3746
  foreach ($tag_data as $tag) {
@@ -9136,13 +9168,12 @@ function ai_get_post_meta () {
9136
  return $meta_value;
9137
  }
9138
 
9139
- function ai_post_is_in_descendant_category ($category) {
9140
- $category_to_check = get_term_by ('name', $category, 'category');
9141
  if ($category_to_check) {
9142
  $post_id = ai_get_post_id ();
9143
- $descendants = get_term_children ($category_to_check->term_id, 'category');
9144
-
9145
- if ($descendants && in_category ($descendants, $post_id)) return true;
9146
  }
9147
  return false;
9148
  }
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.6.1
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
15
 
16
  Change Log
17
 
18
+ Ad Inserter 2.6.1 - 2020-01-10
19
+ - Fix for errors on the settings page
20
+ - Fix for non English characters in ads
21
+ - Fix for sticky widgets
22
+ - Few minor bug fixes
23
+
24
  Ad Inserter 2.6.0 - 2020-01-09
25
  - Added support for VIEWPORT separator
26
  - Added support for viewport check in CHECK separators (Pro only)
1882
 
1883
  $adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
1884
 
1885
+ // Check again later in the footer
1886
  $ai_wp_data [AI_FOOTER_INLINE_SCRIPTS] =
1887
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
1888
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || // alerady in $ai_wp_data [AI_CLIENT_SIDE_INSERTION]
2361
  }
2362
  }
2363
 
2364
+ // Use updated flags
2365
+ ai_set_footer_inline_scripts ();
2366
+
2367
  if ($ai_wp_data [AI_FOOTER_INLINE_SCRIPTS]) {
2368
  // echo "<span ai-ao></span>\n";
2369
  echo "<script>\n";
2370
 
2371
+ $client_side_dynamic_blocks = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT;
2372
+ $wait_for_jquery = get_wait_for_jquery ();
2373
+
2374
  if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
2375
  $js_code = "";
2376
 
2383
  echo $js_code;
2384
  }
2385
 
2386
+ if ($client_side_dynamic_blocks ||
2387
+ $ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
2388
+ $ai_wp_data [AI_CHECK_BLOCK] ||
2389
+ isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION]) ||
2390
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
2391
+ ($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) ||
2392
+ $ai_wp_data [AI_CHECK_BLOCK] ||
2393
+ ($ai_wp_data [AI_TRACKING] && !isset ($ai_wp_data [AI_TRACKING_SHORTCODE_DISABLED])) ||
2394
+ $adb_code
2395
+ ) {
2396
+ echo ai_get_js ('ai-base64');
2397
+ }
2398
 
2399
  // Wait for jQuery
2400
  if ($wait_for_jquery && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
2451
  //";
2452
  } // Wait for jQuery
2453
 
 
 
2454
  if ($ai_wp_data [AI_STICKY_WIDGETS] && get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS) {
2455
  // echo ai_get_js ('ResizeSensor');
2456
  echo ai_get_js ('theia-sticky-sidebar');
3763
  $categories []= $category->name . ' ('.$category->slug.')';
3764
  }
3765
  echo 'CATEGORIES: ', implode (', ', $categories), "\n";
3766
+
3767
+ $category_data = get_categories ();
3768
+ $categories = array ();
3769
+ foreach ($category_data as $category) {
3770
+ if (ai_post_is_in_child_categories ($category->slug)) {
3771
+ $categories []= $category->name . ' ('.$category->slug.')';
3772
+ }
3773
+ }
3774
+ echo 'PARENT CATEGORIES: ', implode (', ', $categories), "\n";
3775
+
3776
  $tag_data = wp_get_post_tags (get_the_ID());
3777
  $tags = array ();
3778
  foreach ($tag_data as $tag) {
9168
  return $meta_value;
9169
  }
9170
 
9171
+ function ai_post_is_in_child_categories ($category) {
9172
+ $category_to_check = get_term_by ('slug', $category, 'category');
9173
  if ($category_to_check) {
9174
  $post_id = ai_get_post_id ();
9175
+ $children = get_term_children ($category_to_check->term_id, 'category');
9176
+ if ($children && in_category ($children, $post_id)) return true;
 
9177
  }
9178
  return false;
9179
  }
class.php CHANGED
@@ -4192,8 +4192,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4192
 
4193
  $serverside_insertion_code = '';
4194
  if (!get_disable_js_code ()) {
4195
- // b64d might not be available if inserted before AI footer code
4196
- $js_code = "ai_insert ('$insertion', '$selector', atob ('[#AI_CODE#]'));";
4197
  $serverside_insertion_code .= ai_js_dom_ready ($js_code);
4198
  }
4199
  }
@@ -6615,7 +6614,7 @@ echo '</body>
6615
  }
6616
 
6617
  if ($check_childern) {
6618
- if (ai_post_is_in_descendant_category ($cat_disabled)) {
6619
  return false;
6620
  }
6621
  }
@@ -6657,7 +6656,7 @@ echo '</body>
6657
  }
6658
 
6659
  if ($check_childern) {
6660
- if (ai_post_is_in_descendant_category ($cat_enabled)) {
6661
  return true;
6662
  }
6663
  }
4192
 
4193
  $serverside_insertion_code = '';
4194
  if (!get_disable_js_code ()) {
4195
+ $js_code = "ai_insert ('$insertion', '$selector', b64d ('[#AI_CODE#]'));";
 
4196
  $serverside_insertion_code .= ai_js_dom_ready ($js_code);
4197
  }
4198
  }
6614
  }
6615
 
6616
  if ($check_childern) {
6617
+ if (ai_post_is_in_child_categories ($cat_disabled)) {
6618
  return false;
6619
  }
6620
  }
6656
  }
6657
 
6658
  if ($check_childern) {
6659
+ if (ai_post_is_in_child_categories ($cat_enabled)) {
6660
  return true;
6661
  }
6662
  }
constants.php CHANGED
@@ -31,7 +31,7 @@ if (!defined( 'AD_INSERTER_NAME'))
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
- define ('AD_INSERTER_VERSION', '2.6.0');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
+ define ('AD_INSERTER_VERSION', '2.6.1');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
css/ai-settings.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.6.0"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.6.1"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
includes/js/ai-base64.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ b64e = function (str) {
2
+ // first we use encodeURIComponent to get percent-encoded UTF-8,
3
+ // then we convert the percent encodings into raw bytes which
4
+ // can be fed into btoa.
5
+ return btoa(encodeURIComponent (str).replace (/%([0-9A-F]{2})/g,
6
+ function toSolidBytes (match, p1) {
7
+ return String.fromCharCode ('0x' + p1);
8
+ }));
9
+ }
10
+
11
+ b64d = function (str) {
12
+ // Going backwards: from bytestream, to percent-encoding, to original string.
13
+ return decodeURIComponent (atob (str).split ('').map (function(c) {
14
+ return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
15
+ }).join (''));
16
+ }
includes/js/ai-base64.min.js ADDED
@@ -0,0 +1 @@
 
1
+ b64e=function(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)}))};b64d=function(a){return decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""))};
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.6.0";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -2553,7 +2553,7 @@ jQuery(document).ready (function($) {
2553
  $("#scheduling-date-on-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
2554
  $("#scheduling-date-off-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
2555
 
2556
- if (typeof $.fn.timepicker != 'undefined') {
2557
  $("#scheduling-time-on-"+tab).timepicker ({'timeFormat': timeFormat, 'minTime': '00:00:00', 'maxTime': '23:00:00', 'step': 60});
2558
  $("#scheduling-time-off-"+tab).timepicker ({'timeFormat': timeFormat, 'minTime': '00:00:00', 'maxTime': '23:00:00', 'step': 60});
2559
 
1
+ var javascript_version = "2.6.1";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
2553
  $("#scheduling-date-on-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
2554
  $("#scheduling-date-off-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
2555
 
2556
+ if ($("#scheduling-weekdays-value-"+tab).length != 0) {
2557
  $("#scheduling-time-on-"+tab).timepicker ({'timeFormat': timeFormat, 'minTime': '00:00:00', 'maxTime': '23:00:00', 'step': 60});
2558
  $("#scheduling-time-off-"+tab).timepicker ({'timeFormat': timeFormat, 'minTime': '00:00:00', 'maxTime': '23:00:00', 'step': 60});
2559
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection,
6
  Requires at least: 4.6
7
  Tested up to: 5.3
8
  Requires PHP: 5.6
9
- Stable tag: 2.6.0
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
@@ -330,6 +330,12 @@ If you are not happy to reveal this information and you have opted in, simply di
330
 
331
  == Changelog ==
332
 
 
 
 
 
 
 
333
  = 2.6.0 =
334
  - Added support for VIEWPORT separator
335
  - Added support for viewport check in CHECK separators (Pro only)
@@ -558,6 +564,12 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
558
 
559
  == Upgrade Notice ==
560
 
 
 
 
 
 
 
561
  = 2.6.0 =
562
  Added support for VIEWPORT separator;
563
  Added support for viewport check in CHECK separators (Pro only);
6
  Requires at least: 4.6
7
  Tested up to: 5.3
8
  Requires PHP: 5.6
9
+ Stable tag: 2.6.1
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
330
 
331
  == Changelog ==
332
 
333
+ = 2.6.1 =
334
+ - Fix for errors on the settings page
335
+ - Fix for non English characters in ads
336
+ - Fix for sticky widgets
337
+ - Few minor bug fixes
338
+
339
  = 2.6.0 =
340
  - Added support for VIEWPORT separator
341
  - Added support for viewport check in CHECK separators (Pro only)
564
 
565
  == Upgrade Notice ==
566
 
567
+ = 2.6.1 =
568
+ Fix for errors on the settings page;
569
+ Fix for non English characters in ads;
570
+ Fix for sticky widgets;
571
+ Few minor bug fixes
572
+
573
  = 2.6.0 =
574
  Added support for VIEWPORT separator;
575
  Added support for viewport check in CHECK separators (Pro only);