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

Version Description

  • Improved loading of settings
  • Fix for content processing in some ajax calls
  • Few minor bug fixes, cosmetic changes and code improvements
Download this release

Release Info

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

Code changes from version 2.3.19 to 2.3.20

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.19
6
  Description: Ad management plugin with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -13,6 +13,11 @@ Plugin URI: https://adinserter.pro/documentation
13
 
14
  Change Log
15
 
 
 
 
 
 
16
  Ad Inserter 2.3.19 - 2018-08-26
17
  - Improved code for client-side insertion
18
  - Fix for rotation with shortcodes
@@ -583,9 +588,6 @@ function ai_buffering_end () {
583
  $start_time = microtime (true);
584
  }
585
 
586
- // TEST
587
- // $page = ai_content_hook ($page);
588
-
589
  $matches = preg_split ('/(<body.*?'.'>)/i', $page, - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
590
 
591
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -699,8 +701,6 @@ function ai_buffering_end () {
699
  echo $body;
700
  } else echo $page;
701
 
702
- // echo ai_content_hook ($matches [2]);
703
-
704
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
705
  $ai_total_plugin_time += microtime (true) - $start_time;
706
  ai_log ("BUFFERING END PROCESSING\n");
@@ -1027,6 +1027,8 @@ function ai_init_hook () {
1027
  if (defined ('DOING_AJAX') && DOING_AJAX) {
1028
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_AJAX;
1029
 
 
 
1030
  ai_wp_hook ();
1031
  }
1032
 
@@ -1036,28 +1038,86 @@ function ai_init_hook () {
1036
  add_filter ('pre_do_shortcode_tag', 'ai_pre_do_shortcode_tag', 10, 4);
1037
  }
1038
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1039
  function ai_wp_loaded_hook () {
1040
- global $ai_db_options, $ai_db_options_extract, $version_string, $ai_total_plugin_time, $ai_wp_data;
 
1041
 
1042
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1043
  ai_log ("WP LOADED HOOK START");
1044
  $start_time = microtime (true);
1045
  }
1046
 
1047
- if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
1048
- isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
1049
- isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
1050
- isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
1051
- isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
1052
- isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
1053
- @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
1054
- isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
1055
- $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
1056
- $ai_db_options_extract = ai_generate_extract ($ai_db_options);
 
 
1057
 
1058
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1059
  $ai_total_plugin_time += microtime (true) - $start_time;
1060
- if (defined ('AI_GENERATE_EXTRACT')) ai_log ("EXTRACT GENERATED");
1061
  ai_log ("WP LOADED HOOK END\n");
1062
  }
1063
  }
@@ -1407,12 +1467,12 @@ function ai_replace_js_data ($js) {
1407
  $js = str_replace ('AI_ADB_REDIRECTION_PAGE', $url, $js);
1408
 
1409
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING_STATUS) != 0) {
1410
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=1', '$("#ai-adb-status").text ("DETECTED, " + d1 + " PAGE VIEW" + (d1 == 1 ? "" : "S") + " - NO ACTION");', $js);
1411
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=2', '$("#ai-adb-status").text ("DETECTED, COOKIE DETECTED - NO ACTION");', $js);
1412
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=3', '$("#ai-adb-status").text ("DETECTED - ACTION");', $js);
1413
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=4', 'jQuery("#ai-adb-status").text ("NOT DETECTED");', $js);
1414
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=5', '$("#ai-adb-status").text ("COOKIES DELETED");', $js);
1415
- $js = str_replace ('var AI_ADB_STATUS_MESSAGE=6', '$("#ai-adb-status").text ("DETECTED - NO ACTION");', $js);
1416
  } else {
1417
  $js = str_replace ('var AI_ADB_STATUS_MESSAGE=1', '', $js);
1418
  $js = str_replace ('var AI_ADB_STATUS_MESSAGE=2', '', $js);
@@ -1471,8 +1531,10 @@ function add_footer_inline_scripts () {
1471
  if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
1472
  echo '<div id="banner-advert-container" class="ad-inserter chitika-ad" style="position:absolute; z-index: -10; height: 1px; width: 1px; top: -1px; left: -1px;"><img id="adsense" class="SponsorAds adsense" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></div>', "\n";
1473
  echo '<!--noptimize-->', "\n";
1474
- echo "<script type='text/javascript' src='", plugins_url ('js/ads.js', __FILE__ ), "?ver=", rand (1, 9999999), "'></script>\n";
1475
- echo "<script type='text/javascript' src='", plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", rand (1, 9999999), "'></script>\n";
 
 
1476
  echo '<!--/noptimize-->', "\n";
1477
  }
1478
  }
@@ -2288,7 +2350,7 @@ function ai_amp_footer_hook () {
2288
  }
2289
 
2290
  function ai_write_debug_info ($write_processing_log = false) {
2291
- global $block_object, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_wp_data, $ai_db_options, $block_insertion_log, $ai_custom_hooks;
2292
 
2293
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
2294
  if (function_exists ('ai_debug_header')) ai_debug_header ();
@@ -2296,7 +2358,7 @@ function ai_write_debug_info ($write_processing_log = false) {
2296
  if (($install_timestamp = get_option (AI_INSTALL_NAME)) !== false) {
2297
  echo "INSTALLED: ", date ("Y-m-d H:i:s", $install_timestamp + get_option ('gmt_offset') * 3600);
2298
  if (isset ($ai_wp_data [AI_INSTALL_TIME_DIFFERENCE])) {
2299
- printf (' (%04d-%02d-%02d %02d:%02d:%02d, %d days)', $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->y,
2300
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->m,
2301
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->d,
2302
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->h,
@@ -2311,6 +2373,8 @@ function ai_write_debug_info ($write_processing_log = false) {
2311
  echo "PLUGIN CODE PROCESSING: ", number_format (($ai_total_plugin_time - $ai_total_php_time) * 1000, 2, '.' , ''), " ms\n";
2312
  echo "USER CODE PROCESSING: ", number_format ($ai_total_php_time * 1000, 2, '.' , ''), " ms\n";
2313
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
 
 
2314
 
2315
  echo "SETTINGS: ";
2316
  if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']))
@@ -2321,7 +2385,29 @@ function ai_write_debug_info ($write_processing_log = false) {
2321
  echo "\n";
2322
  echo "SETTINGS TIMESTAMP: ";
2323
  echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "", "\n";
2324
- echo "SETTINGS EXTRACT: ", defined ('AI_GENERATE_EXTRACT') ? "NO" : "YES", "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2325
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
2326
  if (is_multisite()) {
2327
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
@@ -2788,6 +2874,19 @@ function ai_write_debug_info ($write_processing_log = false) {
2788
  }
2789
  echo "\n\n";
2790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2791
  echo "PHP: ", phpversion(), "\n";
2792
  echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
2793
  echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
@@ -3810,10 +3909,10 @@ function ai_ajax_backend () {
3810
  }
3811
 
3812
  function ai_generate_extract (&$settings) {
3813
- global $ai_custom_hooks, $ai_wp_data;
3814
 
3815
- if (!defined ('AI_GENERATE_EXTRACT'))
3816
- define ('AI_GENERATE_EXTRACT', true);
3817
 
3818
  $obj = new ai_Block (1);
3819
 
@@ -4049,6 +4148,9 @@ function ai_generate_extract (&$settings) {
4049
  }
4050
  }
4051
 
 
 
 
4052
  return ($extract);
4053
  }
4054
 
@@ -4060,6 +4162,8 @@ function ai_load_settings () {
4060
 
4061
  ai_load_options ();
4062
 
 
 
4063
  $ai_custom_hooks = array ();
4064
  for ($hook = 1; $hook <= AD_INSERTER_HOOKS; $hook ++) {
4065
  $name = get_hook_name ($hook);
@@ -4569,6 +4673,8 @@ function ai_settings () {
4569
 
4570
  update_option (AI_OPTION_NAME, $ai_options);
4571
 
 
 
4572
  // Multisite
4573
  if (is_multisite () && is_main_site ()) {
4574
  $options = array ();
@@ -4581,6 +4687,15 @@ function ai_settings () {
4581
 
4582
  if (function_exists ('ai_load_globals')) ai_load_globals ();
4583
 
 
 
 
 
 
 
 
 
 
4584
  delete_option (str_replace ("#", "Header", AD_ADx_OPTIONS));
4585
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
4586
  delete_option (AD_OPTIONS);
@@ -4599,6 +4714,7 @@ function ai_settings () {
4599
  delete_option (AD_OPTIONS);
4600
 
4601
  delete_option (AI_OPTION_NAME);
 
4602
 
4603
  if (is_multisite () && is_main_site ()) {
4604
  delete_site_option (AI_OPTION_NAME, $options);
@@ -6334,7 +6450,6 @@ require_once AD_INSERTER_PLUGIN_DIR.'class.php';
6334
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
6335
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
6336
 
6337
-
6338
  $version_array = explode (".", AD_INSERTER_VERSION);
6339
  $version_string = "";
6340
  foreach ($version_array as $number) {
@@ -6452,12 +6567,13 @@ if (isset ($_POST [AI_FORM_SAVE]))
6452
  define ('AI_SYNTAX_HIGHLIGHTING', get_syntax_highlighter_theme () != AI_OPTION_DISABLED);
6453
 
6454
 
6455
- add_action ('wp_loaded', 'ai_wp_loaded_hook');
6456
- add_action ('admin_menu', 'ai_admin_menu_hook');
6457
- add_action ('init', 'ai_init_hook');
6458
- add_action ('admin_notices', 'ai_admin_notice_hook');
6459
- add_action ('wp', 'ai_wp_hook');
6460
- add_action( 'wp_enqueue_scripts', 'ai_wp_enqueue_scripts_hook' );
 
6461
 
6462
  if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
6463
 
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.20
6
  Description: Ad management plugin with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
13
 
14
  Change Log
15
 
16
+ Ad Inserter 2.3.20 - 2018-09-04
17
+ - Improved loading of settings
18
+ - Fix for content processing in some ajax calls
19
+ - Few minor bug fixes, cosmetic changes and code improvements
20
+
21
  Ad Inserter 2.3.19 - 2018-08-26
22
  - Improved code for client-side insertion
23
  - Fix for rotation with shortcodes
588
  $start_time = microtime (true);
589
  }
590
 
 
 
 
591
  $matches = preg_split ('/(<body.*?'.'>)/i', $page, - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
592
 
593
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
701
  echo $body;
702
  } else echo $page;
703
 
 
 
704
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
705
  $ai_total_plugin_time += microtime (true) - $start_time;
706
  ai_log ("BUFFERING END PROCESSING\n");
1027
  if (defined ('DOING_AJAX') && DOING_AJAX) {
1028
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_AJAX;
1029
 
1030
+ ai_load_extract ();
1031
+
1032
  ai_wp_hook ();
1033
  }
1034
 
1038
  add_filter ('pre_do_shortcode_tag', 'ai_pre_do_shortcode_tag', 10, 4);
1039
  }
1040
 
1041
+ //function ai_upgrader_process_complete_hook ($upgrader_object, $options) {
1042
+ // global $ai_db_options, $ai_db_options_extract;
1043
+
1044
+ // if (is_array ($options) && array_key_exists ('action', $options) && $options ['action'] == 'update' && array_key_exists ('type', $options)) {
1045
+ // if ($options ['type'] == 'plugin' && array_key_exists ('plugins', $options) && is_array ($options ['plugins']) && !empty ($options ['plugins'])) {
1046
+ // $this_plugin = plugin_basename (__FILE__);
1047
+ // foreach ($options ['plugins'] as $plugin) {
1048
+ // if ($plugin == $this_plugin) {
1049
+ // if (defined ('AI_EXTRACT_GENERATED') && isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) {
1050
+ // $ai_db_options [AI_OPTION_EXTRACT] = $ai_db_options_extract;
1051
+ // update_option (AI_OPTION_NAME, $ai_db_options);
1052
+ // }
1053
+ // break;
1054
+ // }
1055
+ // }
1056
+ // }
1057
+ // }
1058
+ //}
1059
+
1060
+ function ai_load_extract ($recreate = true) {
1061
+ global $ai_db_options, $ai_db_options_extract, $version_string;
1062
+
1063
+ if (isset ($ai_db_options_extract)) return;
1064
+
1065
+ // if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
1066
+ //// isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
1067
+ // isset ($ai_db_options [AI_OPTION_EXTRACT]['VERSION']) && $ai_db_options [AI_OPTION_EXTRACT]['VERSION'] == $version_string . '-' . AD_INSERTER_BLOCKS &&
1068
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
1069
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
1070
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
1071
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
1072
+ // @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
1073
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
1074
+ // $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
1075
+ // $ai_db_options_extract = ai_generate_extract ($ai_db_options);
1076
+
1077
+ $expected_extract_version = $version_string . '-' . AD_INSERTER_BLOCKS;
1078
+
1079
+ if (isset ($ai_db_options [AI_OPTION_EXTRACT]['VERSION']) && $ai_db_options [AI_OPTION_EXTRACT]['VERSION'] == $expected_extract_version) {
1080
+ $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT];
1081
+ } else {
1082
+ if (($saved_extract = get_option (AI_EXTRACT_NAME)) === false || $saved_extract ['VERSION'] != $expected_extract_version) {
1083
+ if ($recreate) {
1084
+ $ai_db_options_extract = ai_generate_extract ($ai_db_options);
1085
+ $ai_db_options [AI_OPTION_EXTRACT] = $ai_db_options_extract;
1086
+ if (get_option (AI_OPTION_NAME) !== false)
1087
+ update_option (AI_EXTRACT_NAME, $ai_db_options_extract);
1088
+ }
1089
+ } else {
1090
+ $ai_db_options_extract = $saved_extract;
1091
+ $ai_db_options [AI_OPTION_EXTRACT] = $ai_db_options_extract;
1092
+ }
1093
+ }
1094
+ }
1095
+
1096
  function ai_wp_loaded_hook () {
1097
+ // global $ai_db_options, $ai_db_options_extract, $version_string, $ai_total_plugin_time, $ai_wp_data;
1098
+ global $ai_total_plugin_time, $ai_wp_data;
1099
 
1100
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1101
  ai_log ("WP LOADED HOOK START");
1102
  $start_time = microtime (true);
1103
  }
1104
 
1105
+ // if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
1106
+ // isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
1107
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
1108
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
1109
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
1110
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
1111
+ // @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
1112
+ // isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
1113
+ // $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
1114
+ // $ai_db_options_extract = ai_generate_extract ($ai_db_options);
1115
+
1116
+ ai_load_extract ();
1117
 
1118
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1119
  $ai_total_plugin_time += microtime (true) - $start_time;
1120
+ if (defined ('AI_EXTRACT_GENERATED')) ai_log ("EXTRACT GENERATED");
1121
  ai_log ("WP LOADED HOOK END\n");
1122
  }
1123
  }
1467
  $js = str_replace ('AI_ADB_REDIRECTION_PAGE', $url, $js);
1468
 
1469
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING_STATUS) != 0) {
1470
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=1', '$("#ai-adb-status").text ("DETECTED, " + d1 + " PAGE VIEW" + (d1 == 1 ? "" : "S") + " - NO ACTION")', $js);
1471
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=2', '$("#ai-adb-status").text ("DETECTED, COOKIE DETECTED - NO ACTION")', $js);
1472
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=3', '$("#ai-adb-status").text ("DETECTED - ACTION")', $js);
1473
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=4', 'jQuery("#ai-adb-status").text ("NOT DETECTED")', $js);
1474
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=5', '$("#ai-adb-status").text ("COOKIES DELETED")', $js);
1475
+ $js = str_replace ('var AI_ADB_STATUS_MESSAGE=6', '$("#ai-adb-status").text ("DETECTED - NO ACTION")', $js);
1476
  } else {
1477
  $js = str_replace ('var AI_ADB_STATUS_MESSAGE=1', '', $js);
1478
  $js = str_replace ('var AI_ADB_STATUS_MESSAGE=2', '', $js);
1531
  if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
1532
  echo '<div id="banner-advert-container" class="ad-inserter chitika-ad" style="position:absolute; z-index: -10; height: 1px; width: 1px; top: -1px; left: -1px;"><img id="adsense" class="SponsorAds adsense" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></div>', "\n";
1533
  echo '<!--noptimize-->', "\n";
1534
+ // echo "<script type='text/javascript' src='", plugins_url ('js/ads.js', __FILE__ ), "?ver=", rand (1, 9999999), "'></script>\n";
1535
+ // echo "<script type='text/javascript' src='", plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", rand (1, 9999999), "'></script>\n";
1536
+ echo "<script type='text/javascript' src='", plugins_url ('js/ads.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
1537
+ echo "<script type='text/javascript' src='", plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
1538
  echo '<!--/noptimize-->', "\n";
1539
  }
1540
  }
2350
  }
2351
 
2352
  function ai_write_debug_info ($write_processing_log = false) {
2353
+ global $block_object, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_wp_data, $ai_db_options, $block_insertion_log, $ai_custom_hooks, $version_string;
2354
 
2355
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
2356
  if (function_exists ('ai_debug_header')) ai_debug_header ();
2358
  if (($install_timestamp = get_option (AI_INSTALL_NAME)) !== false) {
2359
  echo "INSTALLED: ", date ("Y-m-d H:i:s", $install_timestamp + get_option ('gmt_offset') * 3600);
2360
  if (isset ($ai_wp_data [AI_INSTALL_TIME_DIFFERENCE])) {
2361
+ printf (' (%04d-%02d-%02d %02d:%02d:%02d, %d days ago)', $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->y,
2362
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->m,
2363
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->d,
2364
  $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->h,
2373
  echo "PLUGIN CODE PROCESSING: ", number_format (($ai_total_plugin_time - $ai_total_php_time) * 1000, 2, '.' , ''), " ms\n";
2374
  echo "USER CODE PROCESSING: ", number_format ($ai_total_php_time * 1000, 2, '.' , ''), " ms\n";
2375
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
2376
+ // echo "MEMORY USED: ", number_format (memory_get_usage (true) / 1024 / 1024, 2, '.' , ''), " MB\n";
2377
+ // echo "PEAK MEMORY USED: ", number_format (memory_get_peak_usage (true) / 1024 / 1024, 2, '.' , ''), " MB\n";
2378
 
2379
  echo "SETTINGS: ";
2380
  if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']))
2385
  echo "\n";
2386
  echo "SETTINGS TIMESTAMP: ";
2387
  echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "", "\n";
2388
+
2389
+ $expected_extract_version = $version_string . '-' . AD_INSERTER_BLOCKS;
2390
+ $extract_source = '';
2391
+ $saved_settings = get_option (AI_OPTION_NAME);
2392
+ if (isset ($saved_settings [AI_OPTION_EXTRACT]['VERSION']) && $saved_settings [AI_OPTION_EXTRACT]['VERSION'] == $expected_extract_version) {
2393
+ $saved_extract = $saved_settings [AI_OPTION_EXTRACT];
2394
+ $extract_source = 'SAVED SETTINGS';
2395
+ } else {
2396
+ $saved_extract = get_option (AI_EXTRACT_NAME);
2397
+ $extract_source = defined ('AI_EXTRACT_GENERATED') ? "REGENERATED" : 'SAVED EXTRACT';
2398
+ }
2399
+ echo "SETTINGS EXTRACT: ";
2400
+ if (isset ($saved_extract ['VERSION'])) {
2401
+ $extract_blocks = explode ('-', $saved_extract ['VERSION']);
2402
+ echo (int) ($saved_extract ['VERSION'][0].$saved_extract ['VERSION'][1]), '.',
2403
+ (int) ($saved_extract ['VERSION'][2].$saved_extract ['VERSION'][3]), '.',
2404
+ (int) ($saved_extract ['VERSION'][4].$saved_extract ['VERSION'][5]), '-', $extract_blocks [1];
2405
+ }
2406
+ echo"\n";
2407
+ echo "EXTRACT TIMESTAMP: ";
2408
+ echo isset ($saved_extract ['TIMESTAMP']) ? date ("Y-m-d H:i:s", $saved_extract ['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "", "\n";
2409
+ echo "EXTRACT SOURCE: ", $extract_source, "\n";
2410
+
2411
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
2412
  if (is_multisite()) {
2413
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
2874
  }
2875
  echo "\n\n";
2876
 
2877
+
2878
+ echo "SERVER_ADDR: ", isset ($_SERVER ['SERVER_ADDR']) ? $_SERVER ['SERVER_ADDR'] : '', "\n";
2879
+ echo "HTTP_CF_CONNECTING_IP: ", isset ($_SERVER ['HTTP_CF_CONNECTING_IP']) ? $_SERVER ['HTTP_CF_CONNECTING_IP'] : '', "\n";
2880
+ echo "HTTP_CLIENT_IP: ", isset ($_SERVER ['HTTP_CLIENT_IP']) ? $_SERVER ['HTTP_CLIENT_IP'] : '', "\n";
2881
+ echo "HTTP_X_FORWARDED_FOR: ", isset ($_SERVER ['HTTP_X_FORWARDED_FOR']) ? $_SERVER ['HTTP_X_FORWARDED_FOR'] : '', "\n";
2882
+ echo "HTTP_X_FORWARDED: ", isset ($_SERVER ['HTTP_X_FORWARDED']) ? $_SERVER ['HTTP_X_FORWARDED'] : '', "\n";
2883
+ echo "HTTP_X_CLUSTER_CLIENT_IP:", isset ($_SERVER ['HTTP_X_CLUSTER_CLIENT_IP']) ? $_SERVER ['HTTP_X_CLUSTER_CLIENT_IP'] : '', "\n";
2884
+ echo "HTTP_FORWARDED_FOR: ", isset ($_SERVER ['HTTP_FORWARDED_FOR']) ? $_SERVER ['HTTP_FORWARDED_FOR'] : '', "\n";
2885
+ echo "HTTP_FORWARDED: ", isset ($_SERVER ['HTTP_FORWARDED']) ? $_SERVER ['HTTP_FORWARDED'] : '', "\n";
2886
+ echo "REMOTE_ADDR: ", isset ($_SERVER ['REMOTE_ADDR']) ? $_SERVER ['REMOTE_ADDR'] : '', "\n";
2887
+
2888
+ echo "\n";
2889
+
2890
  echo "PHP: ", phpversion(), "\n";
2891
  echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
2892
  echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
3909
  }
3910
 
3911
  function ai_generate_extract (&$settings) {
3912
+ global $ai_custom_hooks, $ai_wp_data, $version_string;
3913
 
3914
+ if (!defined ('AI_EXTRACT_GENERATED'))
3915
+ define ('AI_EXTRACT_GENERATED', true);
3916
 
3917
  $obj = new ai_Block (1);
3918
 
4148
  }
4149
  }
4150
 
4151
+ $extract ['VERSION'] = $version_string . '-' . AD_INSERTER_BLOCKS;
4152
+ $extract ['TIMESTAMP'] = time ();
4153
+
4154
  return ($extract);
4155
  }
4156
 
4162
 
4163
  ai_load_options ();
4164
 
4165
+ ai_load_extract (false);
4166
+
4167
  $ai_custom_hooks = array ();
4168
  for ($hook = 1; $hook <= AD_INSERTER_HOOKS; $hook ++) {
4169
  $name = get_hook_name ($hook);
4673
 
4674
  update_option (AI_OPTION_NAME, $ai_options);
4675
 
4676
+ update_option (AI_EXTRACT_NAME, $ai_db_options_extract);
4677
+
4678
  // Multisite
4679
  if (is_multisite () && is_main_site ()) {
4680
  $options = array ();
4687
 
4688
  if (function_exists ('ai_load_globals')) ai_load_globals ();
4689
 
4690
+ if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
4691
+ if (isset ($_POST ['plugin-usage-tracking'])) {
4692
+ global $ai_dst;
4693
+ if (isset ($ai_dst) && is_object ($ai_dst)) {
4694
+ $ai_dst->set_tracking ((bool) $_POST ['plugin-usage-tracking']);
4695
+ }
4696
+ }
4697
+ }
4698
+
4699
  delete_option (str_replace ("#", "Header", AD_ADx_OPTIONS));
4700
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
4701
  delete_option (AD_OPTIONS);
4714
  delete_option (AD_OPTIONS);
4715
 
4716
  delete_option (AI_OPTION_NAME);
4717
+ delete_option (AI_EXTRACT_NAME);
4718
 
4719
  if (is_multisite () && is_main_site ()) {
4720
  delete_site_option (AI_OPTION_NAME, $options);
6450
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
6451
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
6452
 
 
6453
  $version_array = explode (".", AD_INSERTER_VERSION);
6454
  $version_string = "";
6455
  foreach ($version_array as $number) {
6567
  define ('AI_SYNTAX_HIGHLIGHTING', get_syntax_highlighter_theme () != AI_OPTION_DISABLED);
6568
 
6569
 
6570
+ add_action ('wp_loaded', 'ai_wp_loaded_hook');
6571
+ add_action ('admin_menu', 'ai_admin_menu_hook');
6572
+ add_action ('init', 'ai_init_hook');
6573
+ add_action ('admin_notices', 'ai_admin_notice_hook');
6574
+ add_action ('wp', 'ai_wp_hook');
6575
+ add_action ('wp_enqueue_scripts', 'ai_wp_enqueue_scripts_hook' );
6576
+ //add_action ('upgrader_process_complete', 'ai_upgrader_process_complete_hook', 10, 2);
6577
 
6578
  if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
6579
 
constants.php CHANGED
@@ -4,6 +4,7 @@
4
  //error_reporting (E_ALL);
5
 
6
  define ('AI_OPTION_NAME', 'ad_inserter');
 
7
  define ('AI_INSTALL_NAME', 'ai-install');
8
  define ('AI_OPTION_GLOBAL', 'global');
9
  define ('AI_OPTION_EXTRACT', 'extract');
@@ -26,7 +27,7 @@ if (!defined( 'AD_INSERTER_NAME'))
26
  define ('AD_INSERTER_NAME', 'Ad Inserter');
27
 
28
  if (!defined( 'AD_INSERTER_VERSION'))
29
- define ('AD_INSERTER_VERSION', '2.3.19');
30
 
31
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
32
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -530,6 +531,10 @@ define ('AI_TEXT_REPLACE', 'Replace');
530
  define ('AI_TEXT_SHOW', 'Show');
531
  define ('AI_TEXT_HIDE', 'Hide');
532
 
 
 
 
 
533
  // Ad blocking detection
534
  define ('AI_ADB_DETECTION_STANDARD', 0);
535
  define ('AI_ADB_DETECTION_ADVANCED', 1);
4
  //error_reporting (E_ALL);
5
 
6
  define ('AI_OPTION_NAME', 'ad_inserter');
7
+ define ('AI_EXTRACT_NAME', 'ad_inserter_extract');
8
  define ('AI_INSTALL_NAME', 'ai-install');
9
  define ('AI_OPTION_GLOBAL', 'global');
10
  define ('AI_OPTION_EXTRACT', 'extract');
27
  define ('AD_INSERTER_NAME', 'Ad Inserter');
28
 
29
  if (!defined( 'AD_INSERTER_VERSION'))
30
+ define ('AD_INSERTER_VERSION', '2.3.20');
31
 
32
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
33
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
531
  define ('AI_TEXT_SHOW', 'Show');
532
  define ('AI_TEXT_HIDE', 'Hide');
533
 
534
+ // Plugin tracking
535
+ define ('AI_PLUGIN_TRACKING_DISABLED', 0);
536
+ define ('AI_PLUGIN_TRACKING_ENABLED', 1);
537
+
538
  // Ad blocking detection
539
  define ('AI_ADB_DETECTION_STANDARD', 0);
540
  define ('AI_ADB_DETECTION_ADVANCED', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.19"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.3.20"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
includes/Mobile_Detect.php CHANGED
@@ -377,7 +377,7 @@ class ai_Mobile_Detect
377
  'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
378
  // Modecom Tablets - http://www.modecom.eu/tablets/portal/
379
  'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
380
- // Vonino Tablets - http://www.vonino.eu/tablets
381
  'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
382
  // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
383
  'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1',
@@ -618,7 +618,7 @@ class ai_Mobile_Detect
618
  'Coast' => array('Coast/[VER]'),
619
  'Dolfin' => 'Dolfin/[VER]',
620
  // @reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox
621
- 'Firefox' => array('Firefox/[VER]', 'FxiOS/[VER]'),
622
  'Fennec' => 'Fennec/[VER]',
623
  // http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
624
  // https://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
377
  'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
378
  // Modecom Tablets - http://www.modecom.eu/tablets/portal/
379
  'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
380
+ // Vonino Tablets
381
  'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
382
  // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
383
  'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1',
618
  'Coast' => array('Coast/[VER]'),
619
  'Dolfin' => 'Dolfin/[VER]',
620
  // @reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox
621
+ 'Firefox' => array('Firefox/[VER]', 'FxiOS/[VER]'),
622
  'Fennec' => 'Fennec/[VER]',
623
  // http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
624
  // https://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.19";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1
+ var javascript_version = "2.3.20";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, adv
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
- Stable tag: 2.3.18
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
@@ -679,6 +679,11 @@ AD CODE RIGHT
679
 
680
  == Changelog ==
681
 
 
 
 
 
 
682
  = 2.3.19 =
683
  - Improved code for client-side insertion
684
  - Fix for rotation with shortcodes
@@ -800,6 +805,11 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
800
 
801
  == Upgrade Notice ==
802
 
 
 
 
 
 
803
  = 2.3.19 =
804
  Improved code for client-side insertion;
805
  Fix for rotation with shortcodes;
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
+ Stable tag: 2.3.19
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
679
 
680
  == Changelog ==
681
 
682
+ = 2.3.20 =
683
+ - Improved loading of settings
684
+ - Fix for content processing in some ajax calls
685
+ - Few minor bug fixes, cosmetic changes and code improvements
686
+
687
  = 2.3.19 =
688
  - Improved code for client-side insertion
689
  - Fix for rotation with shortcodes
805
 
806
  == Upgrade Notice ==
807
 
808
+ = 2.3.20 =
809
+ Improved loading of settings;
810
+ Fix for content processing in some ajax calls;
811
+ Few minor bug fixes, cosmetic changes and code improvements
812
+
813
  = 2.3.19 =
814
  Improved code for client-side insertion;
815
  Fix for rotation with shortcodes;
settings.php CHANGED
@@ -1847,7 +1847,7 @@ function generate_settings_form (){
1847
  <h3 style="margin: 0; float: left;"><?php echo AD_INSERTER_NAME ?> Settings <?php if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
1848
  (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1849
  (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]); ?></h3>
1850
- <h4 style="margin: 0px; float: right;<?php if (defined ('AI_GENERATE_EXTRACT')) echo ' color: #00f;'; ?>" title="Settings timestamp"><?php echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "";?></h4>
1851
  <div style="clear: both;"></div>
1852
  </div>
1853
 
@@ -2046,8 +2046,30 @@ function generate_settings_form (){
2046
  </td>
2047
  </tr>
2048
 
2049
- <?php if (function_exists ('ai_general_settings_2')) ai_general_settings_2 (); ?>
2050
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2051
  </table>
2052
  </div>
2053
 
@@ -2815,6 +2837,7 @@ function code_block_list () {
2815
  $new_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
2816
 
2817
  update_option (AI_OPTION_NAME, $new_options);
 
2818
  ai_load_settings ();
2819
 
2820
 
@@ -3381,7 +3404,7 @@ function sidebar_addense_alternative () { ?>
3381
  <div style="clear: both;"></div>
3382
  </div>
3383
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3384
- <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3385
  </div>
3386
 
3387
  <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
@@ -3402,7 +3425,7 @@ function sidebar_addense_alternative () { ?>
3402
  </div>
3403
 
3404
  <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
3405
- <!-- <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>-->
3406
  <!-- </div>-->
3407
  <?php
3408
  break;
@@ -3505,7 +3528,7 @@ function sidebar_pro () {
3505
  <!-- <a href="https://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>-->
3506
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" style="margin-top: 10px;" /></a>
3507
  <?php break; case 1: ?>
3508
- <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3509
  <?php break;
3510
  } ?>
3511
  </div>
@@ -3521,7 +3544,7 @@ function sidebar_pro () {
3521
  <div>
3522
  <?php switch ($version) {
3523
  case 0: ?>
3524
- <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3525
  <?php break; case 1: ?>
3526
  <!-- <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>-->
3527
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" style="margin-top: 10px;" /></a>
1847
  <h3 style="margin: 0; float: left;"><?php echo AD_INSERTER_NAME ?> Settings <?php if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
1848
  (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1849
  (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]); ?></h3>
1850
+ <h4 style="margin: 0px; float: right;<?php if (defined ('AI_EXTRACT_GENERATED')) echo ' color: #00f;'; ?>" title="Settings timestamp"><?php echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "";?></h4>
1851
  <div style="clear: both;"></div>
1852
  </div>
1853
 
2046
  </td>
2047
  </tr>
2048
 
2049
+ <?php if (function_exists ('ai_general_settings_2')) ai_general_settings_2 ();
2050
 
2051
+ if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
2052
+ // if (!function_exists ('ai_general_settings_2')) {
2053
+ global $ai_dst;
2054
+ if (isset ($ai_dst) && is_object ($ai_dst) && $ai_dst->get_plugin_tracking () !== null) {
2055
+ $plugin_tracking = $ai_dst->get_tracking ();
2056
+ ?>
2057
+ <tr>
2058
+ <td>
2059
+ Plugin usage tracking
2060
+ </td>
2061
+ <td>
2062
+ <select id="plugin-usage-tracking" name="plugin-usage-tracking" default="#" title="Enable tracking of <?php echo AD_INSERTER_NAME; ?> usage and help us to make improvements to the plugin. Only information regarding the WordPress environment and <?php echo AD_INSERTER_NAME; ?> usage is recorded.">
2063
+ <option value="<?php echo AI_PLUGIN_TRACKING_DISABLED; ?>" <?php echo $plugin_tracking == AI_PLUGIN_TRACKING_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
2064
+ <option value="<?php echo AI_PLUGIN_TRACKING_ENABLED; ?>" <?php echo $plugin_tracking == AI_PLUGIN_TRACKING_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
2065
+ </select>
2066
+ </td>
2067
+ </tr>
2068
+ <?php
2069
+ }
2070
+ // }
2071
+ }
2072
+ ?>
2073
  </table>
2074
  </div>
2075
 
2837
  $new_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
2838
 
2839
  update_option (AI_OPTION_NAME, $new_options);
2840
+ update_option (AI_EXTRACT_NAME, $ai_db_options_extract);
2841
  ai_load_settings ();
2842
 
2843
 
3404
  <div style="clear: both;"></div>
3405
  </div>
3406
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3407
+ <a href='http://bit.ly/Media-NET' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3408
  </div>
3409
 
3410
  <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
3425
  </div>
3426
 
3427
  <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
3428
+ <!-- <a href='http://bit.ly/Media-NET' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>-->
3429
  <!-- </div>-->
3430
  <?php
3431
  break;
3528
  <!-- <a href="https://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>-->
3529
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" style="margin-top: 10px;" /></a>
3530
  <?php break; case 1: ?>
3531
+ <a href='http://bit.ly/media_NET' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3532
  <?php break;
3533
  } ?>
3534
  </div>
3544
  <div>
3545
  <?php switch ($version) {
3546
  case 0: ?>
3547
+ <a href='http://bit.ly/media_NET' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3548
  <?php break; case 1: ?>
3549
  <!-- <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>-->
3550
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" style="margin-top: 10px;" /></a>