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

Version Description

  • Fix for Fatal error: Call to undefined function mb_strtoupper()
Download this release

Release Info

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

Code changes from version 2.4.3 to 2.4.4

Files changed (6) hide show
  1. ad-inserter.php +19 -14
  2. class.php +2 -2
  3. constants.php +2 -1
  4. css/ad-inserter.css +1 -1
  5. js/ad-inserter.js +1 -1
  6. readme.txt +7 -1
ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.4.3
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,9 @@ Domain Path: /languages
15
 
16
  Change Log
17
 
 
 
 
18
  Ad Inserter 2.4.3 - 2018-12-10
19
  - Added support for insertion before/after every N paragraphs (%N)
20
  - Added support for i18n
@@ -650,7 +653,7 @@ function ai_buffering_end () {
650
  }
651
 
652
  $no_closing_tag = array ('img', 'hr', 'br');
653
- $multibyte = get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
654
 
655
  foreach ($ai_db_options_extract [HTML_ELEMENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
656
 
@@ -3138,7 +3141,7 @@ function ai_write_debug_info ($write_processing_log = false) {
3138
  if ($default_settings && $settings == '') continue;
3139
  $settings = ' [' . $insertion_settings . '][' . $alignment_settings . ']' . $settings;
3140
 
3141
- echo sprintf ("%2d %-21s ", $block, mb_substr ($obj->get_ad_name(), 0, 21));
3142
 
3143
  echo $obj->get_display_settings_post() ? "o" : ".", " ";
3144
  echo $obj->get_display_settings_page() ? "o" : ".", " ";
@@ -3308,6 +3311,7 @@ function ai_write_debug_info ($write_processing_log = false) {
3308
  echo "\n";
3309
 
3310
  echo "PHP: ", phpversion(), "\n";
 
3311
  echo "Default charset: ", ini_get ("default_charset"), "\n";
3312
  echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
3313
  echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
@@ -5635,25 +5639,25 @@ function ai_content_hook ($content = '') {
5635
  foreach ($matches [0] as $index => $match) {
5636
  $content = str_replace ($match,
5637
  "<section class='$class'><a href='#' class='ai-debug-left ai-debug-visibility-hidden'><span class='ai-debug-display-none'>[(]</span>" . $matches [2][$index] . " " . _n('word', 'words', $matches [2][$index], 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a>' .
5638
- mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) . ' ' . $matches [1][$index] .
5639
  "<a href='#' class='ai-debug-right'><span class='ai-debug-display-none'>[(]</span>" . $matches [2][$index] . ' ' . _n('word', 'words', $matches [2][$index], 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a></section>',
5640
  $content);
5641
  }
5642
  }
5643
 
5644
- // $content = preg_replace ("/\[\[AI_BP([\d]+?)=([\d]+?)\]\]/", "<section class='$class'><a class='ai-debug-left' style='visibility: hidden;'><span style='display: none'>[(]</span>$2 " . __('words', 'ad-inserter') . '[)]</a>' . mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) . " $1<a class='ai-debug-right'><span style='display: none'>[(]</span>$2 " . __('word', 'words', 'ad-inserter') . '<span style="display: none">[)]</span></a></section>', $content);
5645
- $content = preg_replace ("/\[\[AI_AP([\d]+?)\]\]/", "<section class='$class'>" . mb_strtoupper (AI_TEXT_AFTER_PARAGRAPH) . " $1</section>", $content);
5646
 
5647
  $counter = $ad_inserter_globals [$globals_name];
5648
  if ($counter == 1) $counter = '';
5649
 
5650
- $content = "<section class='$class'><a href='#' class='ai-debug-left ai-debug-visibility-hidden'><span class='ai-debug-display-none'>[(]</span>".$content_words . ' ' . _n('word', 'words', $content_words, 'ad-inserter') . '</a> ' . mb_strtoupper (AI_TEXT_BEFORE_CONTENT) . ' '.$counter."<a href='#' class='ai-debug-right'>".$content_words.' ' . _n('word', 'words', $content_words, 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a></section>'. $content;
5651
 
5652
  if ($ai_wp_data [AI_WP_AMP_PAGE]) {
5653
  $content = get_page_type_debug_info ('AMP ') . $content;
5654
  }
5655
 
5656
- $content = $content . "<section class='$class'>" . mb_strtoupper (AI_TEXT_AFTER_CONTENT) . ' '.$counter."</section>";
5657
 
5658
  $content = $content . get_page_type_debug_info ();
5659
 
@@ -5753,7 +5757,7 @@ function ai_excerpt_hook ($content = '') {
5753
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
5754
  $class = AI_DEBUG_POSITIONS_CLASS;
5755
 
5756
- $content = "<section class='$class'>" . mb_strtoupper (AI_TEXT_BEFORE_EXCERPT) . ' ' . $ad_inserter_globals [$globals_name]."</section>". $content . "<section class='$class'>" . mb_strtoupper (AI_TEXT_AFTER_EXCERPT) . ' ' .$ad_inserter_globals [$globals_name]."</section>";
5757
 
5758
 
5759
  // Remove word counts
@@ -5762,10 +5766,10 @@ function ai_excerpt_hook ($content = '') {
5762
 
5763
  // Color positions from the content hook
5764
  // $content = preg_replace ("/((BEFORE|AFTER) (CONTENT|PARAGRAPH) ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5765
- $content = preg_replace ("/(" . mb_strtoupper (AI_TEXT_BEFORE_CONTENT) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5766
- $content = preg_replace ("/(" . mb_strtoupper (AI_TEXT_AFTER_CONTENT) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5767
- $content = preg_replace ("/(" . mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5768
- $content = preg_replace ("/(" . mb_strtoupper (AI_TEXT_AFTER_PARAGRAPH) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5769
  }
5770
 
5771
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_TAGS) != 0) {
@@ -6097,7 +6101,7 @@ function ai_custom_hook ($action, $name, $hook_parameter = null, $hook_check = n
6097
  if (!call_user_func ($hook_check, $hook_parameter, $action)) return;
6098
  }
6099
 
6100
- $hook_name = mb_strtoupper ($name);
6101
 
6102
  if ($debug_processing) {
6103
  ai_log (str_replace (array ('&LT;', '&GT;'), array ('<', '>'), $hook_name) . " HOOK START");
@@ -7032,6 +7036,7 @@ $ai_wp_data [AI_LAZY_LOADING] = false;
7032
  $ai_wp_data [AI_PAGE_BLOCKS] = 0;
7033
  $ai_wp_data [AI_GEOLOCATION] = false;
7034
  $ai_wp_data [AI_HTML_ELEMENT_SELECTION] = isset ($_POST ['html_element_selection']) ? $_POST ['html_element_selection'] : false;
 
7035
 
7036
  ai_load_settings ();
7037
 
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.4.4
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.4.4 - 2018-12-11
19
+ - Fix for Fatal error: Call to undefined function mb_strtoupper()
20
+
21
  Ad Inserter 2.4.3 - 2018-12-10
22
  - Added support for insertion before/after every N paragraphs (%N)
23
  - Added support for i18n
653
  }
654
 
655
  $no_closing_tag = array ('img', 'hr', 'br');
656
+ $multibyte = $ai_wp_data [AI_MBSTRING_LOADED] && get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
657
 
658
  foreach ($ai_db_options_extract [HTML_ELEMENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
659
 
3141
  if ($default_settings && $settings == '') continue;
3142
  $settings = ' [' . $insertion_settings . '][' . $alignment_settings . ']' . $settings;
3143
 
3144
+ echo sprintf ("%2d %-21s ", $block, $ai_wp_data [AI_MBSTRING_LOADED] ? mb_substr ($obj->get_ad_name(), 0, 21) : substr ($obj->get_ad_name(), 0, 21));
3145
 
3146
  echo $obj->get_display_settings_post() ? "o" : ".", " ";
3147
  echo $obj->get_display_settings_page() ? "o" : ".", " ";
3311
  echo "\n";
3312
 
3313
  echo "PHP: ", phpversion(), "\n";
3314
+ echo "mbstring: ", $ai_wp_data [AI_MBSTRING_LOADED] ? 'LOADED' : 'NO', "\n";
3315
  echo "Default charset: ", ini_get ("default_charset"), "\n";
3316
  echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
3317
  echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
5639
  foreach ($matches [0] as $index => $match) {
5640
  $content = str_replace ($match,
5641
  "<section class='$class'><a href='#' class='ai-debug-left ai-debug-visibility-hidden'><span class='ai-debug-display-none'>[(]</span>" . $matches [2][$index] . " " . _n('word', 'words', $matches [2][$index], 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a>' .
5642
+ ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) : strtoupper (AI_TEXT_BEFORE_PARAGRAPH)) . ' ' . $matches [1][$index] .
5643
  "<a href='#' class='ai-debug-right'><span class='ai-debug-display-none'>[(]</span>" . $matches [2][$index] . ' ' . _n('word', 'words', $matches [2][$index], 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a></section>',
5644
  $content);
5645
  }
5646
  }
5647
 
5648
+ // $content = preg_replace ("/\[\[AI_BP([\d]+?)=([\d]+?)\]\]/", "<section class='$class'><a class='ai-debug-left' style='visibility: hidden;'><span style='display: none'>[(]</span>$2 " . __('words', 'ad-inserter') . '[)]</a>' . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) : strtoupper (AI_TEXT_BEFORE_PARAGRAPH)) . " $1<a class='ai-debug-right'><span style='display: none'>[(]</span>$2 " . __('word', 'words', 'ad-inserter') . '<span style="display: none">[)]</span></a></section>', $content);
5649
+ $content = preg_replace ("/\[\[AI_AP([\d]+?)\]\]/", "<section class='$class'>" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_AFTER_PARAGRAPH) : strtoupper (AI_TEXT_AFTER_PARAGRAPH)) . " $1</section>", $content);
5650
 
5651
  $counter = $ad_inserter_globals [$globals_name];
5652
  if ($counter == 1) $counter = '';
5653
 
5654
+ $content = "<section class='$class'><a href='#' class='ai-debug-left ai-debug-visibility-hidden'><span class='ai-debug-display-none'>[(]</span>".$content_words . ' ' . _n('word', 'words', $content_words, 'ad-inserter') . '</a> ' . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_CONTENT): strtoupper (AI_TEXT_BEFORE_CONTENT)) . ' '.$counter."<a href='#' class='ai-debug-right'>".$content_words.' ' . _n('word', 'words', $content_words, 'ad-inserter') . '<span class="ai-debug-display-none">[)]</span></a></section>'. $content;
5655
 
5656
  if ($ai_wp_data [AI_WP_AMP_PAGE]) {
5657
  $content = get_page_type_debug_info ('AMP ') . $content;
5658
  }
5659
 
5660
+ $content = $content . "<section class='$class'>" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_AFTER_CONTENT) : strtoupper (AI_TEXT_AFTER_CONTENT)) . ' '.$counter."</section>";
5661
 
5662
  $content = $content . get_page_type_debug_info ();
5663
 
5757
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
5758
  $class = AI_DEBUG_POSITIONS_CLASS;
5759
 
5760
+ $content = "<section class='$class'>" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_EXCERPT) : strtoupper (AI_TEXT_BEFORE_EXCERPT)) . ' ' . $ad_inserter_globals [$globals_name]."</section>". $content . "<section class='$class'>" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_AFTER_EXCERPT) : strtoupper (AI_TEXT_AFTER_EXCERPT)) . ' ' .$ad_inserter_globals [$globals_name]."</section>";
5761
 
5762
 
5763
  // Remove word counts
5766
 
5767
  // Color positions from the content hook
5768
  // $content = preg_replace ("/((BEFORE|AFTER) (CONTENT|PARAGRAPH) ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5769
+ $content = preg_replace ("/(" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_CONTENT) : strtoupper (AI_TEXT_BEFORE_CONTENT)) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5770
+ $content = preg_replace ("/(" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_AFTER_CONTENT) : strtoupper (AI_TEXT_AFTER_CONTENT)) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5771
+ $content = preg_replace ("/(" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_BEFORE_PARAGRAPH) : strtoupper (AI_TEXT_BEFORE_PARAGRAPH)) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5772
+ $content = preg_replace ("/(" . ($ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper (AI_TEXT_AFTER_PARAGRAPH) : strtoupper (AI_TEXT_AFTER_PARAGRAPH)) . " ?[\d]*)/", "<span class='ai-debug-content-hook-positions'> [$1] </span>", $content);
5773
  }
5774
 
5775
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_TAGS) != 0) {
6101
  if (!call_user_func ($hook_check, $hook_parameter, $action)) return;
6102
  }
6103
 
6104
+ $hook_name = $ai_wp_data [AI_MBSTRING_LOADED] ? mb_strtoupper ($name) : strtoupper ($name);
6105
 
6106
  if ($debug_processing) {
6107
  ai_log (str_replace (array ('&LT;', '&GT;'), array ('<', '>'), $hook_name) . " HOOK START");
7036
  $ai_wp_data [AI_PAGE_BLOCKS] = 0;
7037
  $ai_wp_data [AI_GEOLOCATION] = false;
7038
  $ai_wp_data [AI_HTML_ELEMENT_SELECTION] = isset ($_POST ['html_element_selection']) ? $_POST ['html_element_selection'] : false;
7039
+ $ai_wp_data [AI_MBSTRING_LOADED] = extension_loaded ('mbstring');
7040
 
7041
  ai_load_settings ();
7042
 
class.php CHANGED
@@ -3111,7 +3111,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3111
  public function before_paragraph ($content, $position_preview = false) {
3112
  global $ai_wp_data, $ai_last_check, $special_element_tags;
3113
 
3114
- $multibyte = get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
3115
 
3116
  $paragraph_positions = array ();
3117
  $active_paragraph_positions = array ();
@@ -3746,7 +3746,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3746
  public function after_paragraph ($content, $position_preview = false) {
3747
  global $ai_wp_data, $ai_last_check, $special_element_tags;
3748
 
3749
- $multibyte = get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
3750
 
3751
  $paragraph_positions = array ();
3752
  $active_paragraph_positions = array ();
3111
  public function before_paragraph ($content, $position_preview = false) {
3112
  global $ai_wp_data, $ai_last_check, $special_element_tags;
3113
 
3114
+ $multibyte = $ai_wp_data [AI_MBSTRING_LOADED] && get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
3115
 
3116
  $paragraph_positions = array ();
3117
  $active_paragraph_positions = array ();
3746
  public function after_paragraph ($content, $position_preview = false) {
3747
  global $ai_wp_data, $ai_last_check, $special_element_tags;
3748
 
3749
+ $multibyte = $ai_wp_data [AI_MBSTRING_LOADED] && get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
3750
 
3751
  $paragraph_positions = array ();
3752
  $active_paragraph_positions = array ();
constants.php CHANGED
@@ -29,7 +29,7 @@ if (!defined( 'AD_INSERTER_NAME'))
29
  define ('AD_INSERTER_NAME', 'Ad Inserter');
30
 
31
  if (!defined( 'AD_INSERTER_VERSION'))
32
- define ('AD_INSERTER_VERSION', '2.4.3');
33
 
34
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
35
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -935,6 +935,7 @@ define ('AI_PAGE_BLOCKS', 38);
935
  define ('AI_GEOLOCATION', 39);
936
  define ('AI_HTML_ELEMENT_SELECTION', 40);
937
  define ('AI_DISABLE_TRANSLATION', 41);
 
938
 
939
  define ('AI_CONTEXT_NONE', 0);
940
  define ('AI_CONTEXT_CONTENT', 1);
29
  define ('AD_INSERTER_NAME', 'Ad Inserter');
30
 
31
  if (!defined( 'AD_INSERTER_VERSION'))
32
+ define ('AD_INSERTER_VERSION', '2.4.4');
33
 
34
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
35
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
935
  define ('AI_GEOLOCATION', 39);
936
  define ('AI_HTML_ELEMENT_SELECTION', 40);
937
  define ('AI_DISABLE_TRANSLATION', 41);
938
+ define ('AI_MBSTRING_LOADED', 42);
939
 
940
  define ('AI_CONTEXT_NONE', 0);
941
  define ('AI_CONTEXT_CONTENT', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.4.3"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.4.4"; /* 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.4.3";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1
+ var javascript_version = "2.4.4";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad rotation, ad manager, amp ads, amazon, ad blocking detect
6
  Requires at least: 4.0
7
  Tested up to: 5.0
8
  Requires PHP: 5.6
9
- Stable tag: 2.4.3
10
  License: GPLv3
11
 
12
  Insert and manage ads: Google AdSense ads, Amazon banners, ad rotation, sticky widget ads, PHP, tracking, footer, AdSense header code, AMP ads
@@ -514,6 +514,9 @@ Please note that responsive AdSense ads can not work with floating alignments (a
514
 
515
  == Changelog ==
516
 
 
 
 
517
  = 2.4.3 =
518
  - Added support for insertion before/after every N paragraphs (%N)
519
  - Added support for i18n
@@ -578,6 +581,9 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
578
 
579
  == Upgrade Notice ==
580
 
 
 
 
581
  = 2.4.3 =
582
  Added support for insertion before/after every N paragraphs (%N);
583
  Added support for i18n;
6
  Requires at least: 4.0
7
  Tested up to: 5.0
8
  Requires PHP: 5.6
9
+ Stable tag: 2.4.4
10
  License: GPLv3
11
 
12
  Insert and manage ads: Google AdSense ads, Amazon banners, ad rotation, sticky widget ads, PHP, tracking, footer, AdSense header code, AMP ads
514
 
515
  == Changelog ==
516
 
517
+ = 2.4.4 =
518
+ - Fix for Fatal error: Call to undefined function mb_strtoupper()
519
+
520
  = 2.4.3 =
521
  - Added support for insertion before/after every N paragraphs (%N)
522
  - Added support for i18n
581
 
582
  == Upgrade Notice ==
583
 
584
+ = 2.4.4 =
585
+ Fix for Fatal error: Call to undefined function mb_strtoupper()
586
+
587
  = 2.4.3 =
588
  Added support for insertion before/after every N paragraphs (%N);
589
  Added support for i18n;