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

Version Description

  • Bug fix for paragraph counting and clearance
  • Bug fix for undefined constant error
Download this release

Release Info

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

Code changes from version 2.7.7 to 2.7.8

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.7.7
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/
@@ -17,6 +17,10 @@ Requires PHP: 5.6
17
 
18
  Change Log
19
 
 
 
 
 
20
  Ad Inserter 2.7.7 - 2021-11-30
21
  - Few bug fixes
22
 
@@ -10660,17 +10664,21 @@ function ai_post_is_in_child_taxonomies ($taxonomy, $term) {
10660
  }
10661
 
10662
  function ai_get_permalink ($id) {
10663
- $connected_website = get_transient (AI_CONNECTED_WEBSITE);
 
10664
 
10665
- if ($connected_website !== false) return '';
 
10666
 
10667
  return (get_permalink ($id));
10668
  }
10669
 
10670
  function ai_get_edit_post_link ($id) {
10671
- $connected_website = get_transient (AI_CONNECTED_WEBSITE);
 
10672
 
10673
- if ($connected_website !== false) return '';
 
10674
 
10675
  return (get_edit_post_link ($id));
10676
  }
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.7.8
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/
17
 
18
  Change Log
19
 
20
+ Ad Inserter 2.7.8 - 2021-11-31
21
+ - Bug fix for paragraph counting and clearance
22
+ - Bug fix for undefined constant error
23
+
24
  Ad Inserter 2.7.7 - 2021-11-30
25
  - Few bug fixes
26
 
10664
  }
10665
 
10666
  function ai_get_permalink ($id) {
10667
+ if (defined ('AI_CONNECTED_WEBSITE')) {
10668
+ $connected_website = get_transient (AI_CONNECTED_WEBSITE);
10669
 
10670
+ if ($connected_website !== false) return '';
10671
+ }
10672
 
10673
  return (get_permalink ($id));
10674
  }
10675
 
10676
  function ai_get_edit_post_link ($id) {
10677
+ if (defined ('AI_CONNECTED_WEBSITE')) {
10678
+ $connected_website = get_transient (AI_CONNECTED_WEBSITE);
10679
 
10680
+ if ($connected_website !== false) return '';
10681
+ }
10682
 
10683
  return (get_edit_post_link ($id));
10684
  }
class.php CHANGED
@@ -6510,7 +6510,7 @@ echo '</body>
6510
 
6511
 
6512
  // Prepare $paragraph_end_positions
6513
- if ($position_preview || $position_text == '') {
6514
  if (!isset ($paragraph_end_positions)) {
6515
  $paragraph_end_positions = array ();
6516
  get_paragraph_end_positions ($content, $multibyte, $paragraph_positions, $paragraph_start_strings, $paragraph_end_positions, $dummy);
@@ -6526,7 +6526,7 @@ echo '</body>
6526
  if ($direction_type == AI_DIRECTION_FROM_BOTTOM) {
6527
  $paragraph_end_positions = array_reverse ($paragraph_end_positions);
6528
  }
6529
- }
6530
 
6531
 
6532
  $filtered_paragraph_positions = array ();
@@ -6703,10 +6703,10 @@ echo '</body>
6703
 
6704
  if (!empty ($positions) && !$before_image) {
6705
 
6706
- if (!isset ($paragraph_end_positions)) {
6707
- $paragraph_end_positions = array ();
6708
- get_paragraph_end_positions ($content, $multibyte, $paragraph_positions, $paragraph_start_strings, $paragraph_end_positions, $dummy);
6709
- }
6710
 
6711
  $avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
6712
  $avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
@@ -7307,6 +7307,7 @@ echo '</body>
7307
 
7308
  if (!$this->check_number_of_words_in_paragraph ($paragraph_code, $paragraph_min_words, $paragraph_max_words)) $active_paragraph_positions [$index] = 0;
7309
  }
 
7310
  }
7311
 
7312
  // Nothing to do
@@ -7429,7 +7430,7 @@ echo '</body>
7429
 
7430
 
7431
  // Prepare $paragraph_start_positions
7432
- if ($position_preview || $position_text == '') {
7433
  if (!isset ($paragraph_start_positions)) {
7434
  $paragraph_start_positions = array ();
7435
  get_paragraph_start_positions ($content, $multibyte, $paragraph_positions, $paragraph_end_strings, $paragraph_start_positions, $dummy);
@@ -7445,7 +7446,7 @@ echo '</body>
7445
  if ($direction_type == AI_DIRECTION_FROM_BOTTOM) {
7446
  $paragraph_start_positions = array_reverse ($paragraph_start_positions);
7447
  }
7448
- }
7449
 
7450
 
7451
  $filtered_paragraph_positions = array ();
@@ -7622,10 +7623,11 @@ echo '</body>
7622
 
7623
  if (!empty ($positions) && !$after_image) {
7624
 
7625
- if (!isset ($paragraph_start_positions)) {
7626
- $paragraph_start_positions = array ();
7627
- get_paragraph_start_positions ($content, $multibyte, $paragraph_positions, $paragraph_end_strings, $paragraph_start_positions, $dummy);
7628
- }
 
7629
 
7630
  $avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
7631
  $avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
@@ -7725,8 +7727,8 @@ echo '</body>
7725
  $start_position_below = $paragraph_start_positions [$paragraph_position_below];
7726
  $end_position_below = $paragraph_positions [$paragraph_position_below];
7727
  } else {
7728
- $start_position_below = $paragraph_start_positions [$position];
7729
- $end_position_below = $paragraph_positions [$paragraph_position_below];
7730
  }
7731
 
7732
  if ($multibyte) {
6510
 
6511
 
6512
  // Prepare $paragraph_end_positions
6513
+ // if ($position_preview || $position_text == '') { // Prepare always
6514
  if (!isset ($paragraph_end_positions)) {
6515
  $paragraph_end_positions = array ();
6516
  get_paragraph_end_positions ($content, $multibyte, $paragraph_positions, $paragraph_start_strings, $paragraph_end_positions, $dummy);
6526
  if ($direction_type == AI_DIRECTION_FROM_BOTTOM) {
6527
  $paragraph_end_positions = array_reverse ($paragraph_end_positions);
6528
  }
6529
+ // }
6530
 
6531
 
6532
  $filtered_paragraph_positions = array ();
6703
 
6704
  if (!empty ($positions) && !$before_image) {
6705
 
6706
+ // if (!isset ($paragraph_end_positions)) {
6707
+ // $paragraph_end_positions = array ();
6708
+ // get_paragraph_end_positions ($content, $multibyte, $paragraph_positions, $paragraph_start_strings, $paragraph_end_positions, $dummy);
6709
+ // }
6710
 
6711
  $avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
6712
  $avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
7307
 
7308
  if (!$this->check_number_of_words_in_paragraph ($paragraph_code, $paragraph_min_words, $paragraph_max_words)) $active_paragraph_positions [$index] = 0;
7309
  }
7310
+
7311
  }
7312
 
7313
  // Nothing to do
7430
 
7431
 
7432
  // Prepare $paragraph_start_positions
7433
+ // if ($position_preview || $position_text == '') { // Prepare always
7434
  if (!isset ($paragraph_start_positions)) {
7435
  $paragraph_start_positions = array ();
7436
  get_paragraph_start_positions ($content, $multibyte, $paragraph_positions, $paragraph_end_strings, $paragraph_start_positions, $dummy);
7446
  if ($direction_type == AI_DIRECTION_FROM_BOTTOM) {
7447
  $paragraph_start_positions = array_reverse ($paragraph_start_positions);
7448
  }
7449
+ // }
7450
 
7451
 
7452
  $filtered_paragraph_positions = array ();
7623
 
7624
  if (!empty ($positions) && !$after_image) {
7625
 
7626
+ // Not needed anymore
7627
+ // if (!isset ($paragraph_start_positions)) {
7628
+ // $paragraph_start_positions = array ();
7629
+ // get_paragraph_start_positions ($content, $multibyte, $paragraph_positions, $paragraph_end_strings, $paragraph_start_positions, $dummy);
7630
+ // }
7631
 
7632
  $avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
7633
  $avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
7727
  $start_position_below = $paragraph_start_positions [$paragraph_position_below];
7728
  $end_position_below = $paragraph_positions [$paragraph_position_below];
7729
  } else {
7730
+ $start_position_below = $paragraph_positions [$position];
7731
+ $end_position_below = $paragraph_positions [$paragraph_position_below];
7732
  }
7733
 
7734
  if ($multibyte) {
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.7.7');
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.7.8');
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.7.7"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.7.8"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.7.7"
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1
+ var javascript_version = "2.7.8"
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
js/ad-inserter.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version="2.7.7",ignore_key=!0,start=1,end=16,active_tab=1,active_tab_0=0,tabs_to_configure=[],debug=!1,debug_title=!1,save_enabled=!0,current_tab=0,next_tab=0,syntax_highlighting=!1,settings_page="",dateFormat="yy-mm-dd",timeFormat="H:i:s",list_search_reload=!1,website_list_search_reload=!1,AI_DISABLED=0,AI_BEFORE_POST=1,AI_AFTER_POST=2,AI_BEFORE_CONTENT=3,AI_AFTER_CONTENT=4,AI_BEFORE_PARAGRAPH=5,AI_AFTER_PARAGRAPH=6,AI_BEFORE_EXCERPT=7,AI_AFTER_EXCERPT=8,AI_BETWEEN_POSTS=9,AI_BEFORE_COMMENTS=
2
  10,AI_BETWEEN_COMMENTS=11,AI_AFTER_COMMENTS=12,AI_FOOTER=13,AI_ABOVE_HEADER=14,AI_BEFORE_HTML_ELEMENT=15,AI_AFTER_HTML_ELEMENT=16,AI_INSIDE_HTML_ELEMENT=17,AI_BEFORE_IMAGE=18,AI_AFTER_IMAGE=19,AI_ALIGNMENT_DEFAULT=0,AI_ALIGNMENT_LEFT=1,AI_ALIGNMENT_RIGHT=2,AI_ALIGNMENT_CENTER=3,AI_ALIGNMENT_FLOAT_LEFT=4,AI_ALIGNMENT_FLOAT_RIGHT=5,AI_ALIGNMENT_NO_WRAPPING=6,AI_ALIGNMENT_CUSTOM_CSS=7,AI_ALIGNMENT_STICKY_LEFT=8,AI_ALIGNMENT_STICKY_RIGHT=9,AI_ALIGNMENT_STICKY_TOP=10,AI_ALIGNMENT_STICKY_BOTTOM=11,AI_ALIGNMENT_STICKY=
3
  12,AI_ADB_ACTION_NONE=0,AI_ADB_ACTION_MESSAGE=1,AI_ADB_ACTION_REDIRECTION=2,AI_ADB_BLOCK_ACTION_DO_NOTHING=0,AI_ADB_BLOCK_ACTION_REPLACE=1,AI_ADB_BLOCK_ACTION_SHOW=2,AI_ADB_BLOCK_ACTION_HIDE=3,AI_CODE_UNKNOWN=100,AI_CODE_BANNER=0,AI_CODE_ADSENSE=1,AI_CODE_AMAZON=2,AI_ADSENSE_STANDARD=0,AI_ADSENSE_LINK=1,AI_ADSENSE_IN_ARTICLE=2,AI_ADSENSE_IN_FEED=3,AI_ADSENSE_MATCHED_CONTENT=4,AI_ADSENSE_SIZE_FIXED=0,AI_ADSENSE_SIZE_RESPONSIVE=1,AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT=2,AI_HTML_INSERTION_CLIENT_SIDE=0,AI_HTML_INSERTION_SEREVR_SIDE=
4
  2,AI_STICK_TO_THE_LEFT=0,AI_STICK_TO_THE_CONTENT_LEFT=1,AI_STICK_HORIZONTAL_CENTER=2,AI_STICK_TO_THE_CONTENT_RIGHT=3,AI_STICK_TO_THE_RIGHT=4,AI_STICK_TO_THE_TOP=0,AI_STICK_VERTICAL_CENTER=1,AI_SCROLL_WITH_THE_CONTENT=2,AI_STICK_TO_THE_BOTTOM=3,AI_ANIMATION_NONE=0,AI_BACKGROUND_REPEAT_DEFAULT=0,AI_BACKGROUND_REPEAT_NO=1,AI_BACKGROUND_REPEAT_YES=2,AI_BACKGROUND_REPEAT_HORIZONTALY=3,AI_BACKGROUND_REPEAT_VERTICALLY=4,AI_BACKGROUND_REPEAT_SPACE=5,AI_BACKGROUND_REPEAT_ROUND=6,AI_BACKGROUND_SIZE_DEFAULT=
1
+ var javascript_version="2.7.8",ignore_key=!0,start=1,end=16,active_tab=1,active_tab_0=0,tabs_to_configure=[],debug=!1,debug_title=!1,save_enabled=!0,current_tab=0,next_tab=0,syntax_highlighting=!1,settings_page="",dateFormat="yy-mm-dd",timeFormat="H:i:s",list_search_reload=!1,website_list_search_reload=!1,AI_DISABLED=0,AI_BEFORE_POST=1,AI_AFTER_POST=2,AI_BEFORE_CONTENT=3,AI_AFTER_CONTENT=4,AI_BEFORE_PARAGRAPH=5,AI_AFTER_PARAGRAPH=6,AI_BEFORE_EXCERPT=7,AI_AFTER_EXCERPT=8,AI_BETWEEN_POSTS=9,AI_BEFORE_COMMENTS=
2
  10,AI_BETWEEN_COMMENTS=11,AI_AFTER_COMMENTS=12,AI_FOOTER=13,AI_ABOVE_HEADER=14,AI_BEFORE_HTML_ELEMENT=15,AI_AFTER_HTML_ELEMENT=16,AI_INSIDE_HTML_ELEMENT=17,AI_BEFORE_IMAGE=18,AI_AFTER_IMAGE=19,AI_ALIGNMENT_DEFAULT=0,AI_ALIGNMENT_LEFT=1,AI_ALIGNMENT_RIGHT=2,AI_ALIGNMENT_CENTER=3,AI_ALIGNMENT_FLOAT_LEFT=4,AI_ALIGNMENT_FLOAT_RIGHT=5,AI_ALIGNMENT_NO_WRAPPING=6,AI_ALIGNMENT_CUSTOM_CSS=7,AI_ALIGNMENT_STICKY_LEFT=8,AI_ALIGNMENT_STICKY_RIGHT=9,AI_ALIGNMENT_STICKY_TOP=10,AI_ALIGNMENT_STICKY_BOTTOM=11,AI_ALIGNMENT_STICKY=
3
  12,AI_ADB_ACTION_NONE=0,AI_ADB_ACTION_MESSAGE=1,AI_ADB_ACTION_REDIRECTION=2,AI_ADB_BLOCK_ACTION_DO_NOTHING=0,AI_ADB_BLOCK_ACTION_REPLACE=1,AI_ADB_BLOCK_ACTION_SHOW=2,AI_ADB_BLOCK_ACTION_HIDE=3,AI_CODE_UNKNOWN=100,AI_CODE_BANNER=0,AI_CODE_ADSENSE=1,AI_CODE_AMAZON=2,AI_ADSENSE_STANDARD=0,AI_ADSENSE_LINK=1,AI_ADSENSE_IN_ARTICLE=2,AI_ADSENSE_IN_FEED=3,AI_ADSENSE_MATCHED_CONTENT=4,AI_ADSENSE_SIZE_FIXED=0,AI_ADSENSE_SIZE_RESPONSIVE=1,AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT=2,AI_HTML_INSERTION_CLIENT_SIDE=0,AI_HTML_INSERTION_SEREVR_SIDE=
4
  2,AI_STICK_TO_THE_LEFT=0,AI_STICK_TO_THE_CONTENT_LEFT=1,AI_STICK_HORIZONTAL_CENTER=2,AI_STICK_TO_THE_CONTENT_RIGHT=3,AI_STICK_TO_THE_RIGHT=4,AI_STICK_TO_THE_TOP=0,AI_STICK_VERTICAL_CENTER=1,AI_SCROLL_WITH_THE_CONTENT=2,AI_STICK_TO_THE_BOTTOM=3,AI_ANIMATION_NONE=0,AI_BACKGROUND_REPEAT_DEFAULT=0,AI_BACKGROUND_REPEAT_NO=1,AI_BACKGROUND_REPEAT_YES=2,AI_BACKGROUND_REPEAT_HORIZONTALY=3,AI_BACKGROUND_REPEAT_VERTICALLY=4,AI_BACKGROUND_REPEAT_SPACE=5,AI_BACKGROUND_REPEAT_ROUND=6,AI_BACKGROUND_SIZE_DEFAULT=
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection,
6
  Requires at least: 4.9
7
  Tested up to: 5.8
8
  Requires PHP: 5.6
9
- Stable tag: 2.7.7
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
@@ -352,6 +352,10 @@ If you are not happy to reveal this information and you have opted in, simply di
352
 
353
  == Changelog ==
354
 
 
 
 
 
355
  = 2.7.7 =
356
  - Few bug fixes
357
 
@@ -598,6 +602,10 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
598
 
599
  == Upgrade Notice ==
600
 
 
 
 
 
601
  = 2.7.7 =
602
  Few bug fixes
603
 
6
  Requires at least: 4.9
7
  Tested up to: 5.8
8
  Requires PHP: 5.6
9
+ Stable tag: 2.7.8
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
352
 
353
  == Changelog ==
354
 
355
+ = 2.7.8 =
356
+ - Bug fix for paragraph counting and clearance
357
+ - Bug fix for undefined constant error
358
+
359
  = 2.7.7 =
360
  - Few bug fixes
361
 
602
 
603
  == Upgrade Notice ==
604
 
605
+ = 2.7.8 =
606
+ Bug fix for paragraph counting and clearance;
607
+ Bug fix for undefined constant error
608
+
609
  = 2.7.7 =
610
  Few bug fixes
611
 
settings.php CHANGED
@@ -691,12 +691,14 @@ function generate_settings_form (){
691
  <td></td>
692
  </tr>' . "\n";
693
 
694
- $connected_website = get_transient (AI_CONNECTED_WEBSITE);
 
695
 
696
- if ($connected_website !== false) {
697
- // No links to the local site
698
- $exception_line = preg_replace ('#<a.*?'.'>(.*?)</a>#i', '\1', $exception_line);
699
- $exception_line = preg_replace ('#title="(.*?)"#i', '', $exception_line);
 
700
  }
701
 
702
  if ($exception ['type'] == 'page') {
@@ -5237,8 +5239,10 @@ function ai_clear_settings () {
5237
  delete_option (WP_AD_INSERTER_PRO_CLIENT);
5238
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
5239
 
5240
- delete_option (AI_WEBSITES);
5241
- delete_transient (AI_CONNECTED_WEBSITE);
 
 
5242
 
5243
  delete_transient (AI_TRANSIENT_ADB_CLASS_1);
5244
  delete_transient (AI_TRANSIENT_ADB_CLASS_2);
691
  <td></td>
692
  </tr>' . "\n";
693
 
694
+ if (defined ('AI_CONNECTED_WEBSITE')) {
695
+ $connected_website = get_transient (AI_CONNECTED_WEBSITE);
696
 
697
+ if ($connected_website !== false) {
698
+ // No links to the local site
699
+ $exception_line = preg_replace ('#<a.*?'.'>(.*?)</a>#i', '\1', $exception_line);
700
+ $exception_line = preg_replace ('#title="(.*?)"#i', '', $exception_line);
701
+ }
702
  }
703
 
704
  if ($exception ['type'] == 'page') {
5239
  delete_option (WP_AD_INSERTER_PRO_CLIENT);
5240
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
5241
 
5242
+ if (defined ('AI_CONNECTED_WEBSITE')) {
5243
+ delete_transient (AI_CONNECTED_WEBSITE);
5244
+ delete_option (AI_WEBSITES);
5245
+ }
5246
 
5247
  delete_transient (AI_TRANSIENT_ADB_CLASS_1);
5248
  delete_transient (AI_TRANSIENT_ADB_CLASS_2);