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

Version Description

  • Added option to define tags inside which paragraphs are not counted
  • Added max insertions check when inserting for all paragraphs
  • Added support for inverted filter
  • Increased nonce lifespan to 48 hours when using tracking (Pro only)
  • Fixed wrong urls in debug menu when behind proxy
  • Few other 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.1.12
Comparing to
See all releases

Code changes from version 2.1.11 to 2.1.12

ad-inserter.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
- Version: 2.1.11
5
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes into your website.
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
@@ -12,6 +12,16 @@ Plugin URI: http://adinserter.pro/documentation
12
 
13
  Change Log
14
 
 
 
 
 
 
 
 
 
 
 
15
  Ad Inserter 2.1.11 - 2017-07-21
16
  - Improved support for sticky widgets
17
  - Added support for ad counting (|count| separator)
@@ -401,13 +411,14 @@ if (version_compare ($wp_version, "4.0", "<")) {
401
  exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
402
  }
403
 
404
- global $block_object, $ai_wp_data, $ad_inserter_globals, $ai_last_check, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_db_options;
405
 
406
  //include required files
407
  require_once AD_INSERTER_PLUGIN_DIR.'class.php';
408
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
409
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
410
  require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
 
411
 
412
  if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
413
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
@@ -423,7 +434,7 @@ foreach ($version_array as $number) {
423
  }
424
 
425
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
426
- $ai_wp_data [AI_WP_URL] = remove_parameters_from_url ($_SERVER ['REQUEST_URI']);
427
 
428
  if (!is_admin()) {
429
  if (!isset ($_GET [AI_URL_DEBUG]))
@@ -443,6 +454,7 @@ if (!is_admin()) {
443
 
444
  $ad_inserter_globals = array ();
445
  $block_object = array ();
 
446
 
447
  ai_load_settings ();
448
 
@@ -453,17 +465,29 @@ if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
453
  }
454
  }
455
 
456
- if (defined ('AI_ADBLOCKER_DETECTION') && AI_ADBLOCKER_DETECTION) {
457
- define ('AI_ADB_2_NAME', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY).md5 (NONCE_KEY))), 0, 8));
458
 
459
- $script = AD_INSERTER_PLUGIN_DIR.'includes/js/sponsors.js';
 
 
460
 
461
- if (!file_exists ($script)) {
462
- file_put_contents ($script, 'window.' . AI_ADB_2_NAME . '=true;');
463
- }
 
 
 
464
 
465
- if (function_exists ('ai_check_files')) ai_check_files ();
 
 
 
 
 
 
466
  }
 
467
  if (function_exists ('ai_load_globals')) ai_load_globals ();
468
 
469
  if (get_dynamic_blocks ()) {
@@ -559,12 +583,17 @@ add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 10, 2);
559
  add_action ('wp_ajax_ai_data', 'ai_data');
560
  add_action ('wp_ajax_nopriv_ai_data', 'ai_data');
561
 
 
 
 
 
562
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
563
  $ai_total_plugin_time += microtime (true) - $start_time;
564
  ai_log ("INITIALIZATION END\n");
565
  }
566
 
567
 
 
568
  function ai_toolbar ($wp_admin_bar) {
569
  global $block_object, $ai_wp_data;
570
 
@@ -583,11 +612,14 @@ function ai_toolbar ($wp_admin_bar) {
583
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) $debug_no_insertion = 1; else $debug_no_insertion = 0;
584
  $debug_no_insertion_class = $debug_no_insertion == 0 ? ' on' : '';
585
 
586
- $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0;
 
 
 
587
 
588
  $debug_settings_class = $debug_settings_on ? ' on' : '';
589
- $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_parameters_from_url ($_SERVER ['REQUEST_URI'])) :
590
- add_query_arg (array (AI_URL_DEBUG_BLOCKS => '1', AI_URL_DEBUG_POSITIONS => '0', AI_URL_DEBUG_TAGS => '1'), remove_parameters_from_url ($_SERVER ['REQUEST_URI']));
591
 
592
  $wp_admin_bar->add_node (array (
593
  'id' => 'ai-toolbar',
@@ -595,7 +627,7 @@ function ai_toolbar ($wp_admin_bar) {
595
  ));
596
  $wp_admin_bar->add_node (array (
597
  'id' => 'ai-toolbar-settings',
598
- 'parent' => 'ai-toolbar',
599
  'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME,
600
  'href' => $top_menu_url,
601
  ));
@@ -666,7 +698,7 @@ function ai_toolbar ($wp_admin_bar) {
666
  ($paragraph_block ['min'] != 0 ? ' min '.$paragraph_block ['min']. ' ' : '').
667
  ($paragraph_block ['max'] != 0 ? ' max '.$paragraph_block ['max']. ' ' : '').
668
  ($paragraph_block ['blockquote'] ? ' [blockquote] ' : '').
669
- ($paragraph_block ['text'] != '' ? ($paragraph_block ['text_type'] == AD_DO_NOT_CONTAIN ? ' NC ' : ' C ').' ['.$paragraph_block ['text'].']' : ''),
670
  'href' => set_url_parameter (AI_URL_DEBUG_POSITIONS, $paragraph_block ['blocks'][0]),
671
  ));
672
  }
@@ -683,6 +715,14 @@ function ai_toolbar ($wp_admin_bar) {
683
  'title' => '<span class="ab-icon'.$debug_no_insertion_class.'"></span>Disable Insertion',
684
  'href' => set_url_parameter (AI_URL_DEBUG_NO_INSERTION, $debug_no_insertion),
685
  ));
 
 
 
 
 
 
 
 
686
  $wp_admin_bar->add_node (array (
687
  'id' => 'ai-toolbar-processing',
688
  'parent' => 'ai-toolbar-settings',
@@ -738,13 +778,13 @@ function ai_log_content (&$content) {
738
  ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).']');
739
  }
740
 
741
- function ai_log_block_status ($block, $ai_last_check) {
742
  global $block_object;
743
 
744
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) $block = 0;
745
 
746
- if ($ai_last_check == AI_CHECK_INSERTED) return "BLOCK $block INSERTED";
747
- $status = "BLOCK $block FAILED CHECK: ";
748
  $obj = $block_object [$block];
749
  switch ($ai_last_check) {
750
  case AI_CHECK_PAGE_TYPE_FRONT_PAGE: $status .= "ENABLED ON HOMEPAGE"; break;
@@ -784,7 +824,7 @@ function ai_log_block_status ($block, $ai_last_check) {
784
  case AI_CHECK_DISABLED_MANUALLY: $status .= "DISABLED BY HTML COMMENT"; break;
785
 
786
  case AI_CHECK_MAX_INSERTIONS: $status .= "MAX INSERTIONS " . $obj->get_maximum_insertions (); break;
787
- case AI_CHECK_FILTER: $status .= "FILTER " . $obj->get_call_filter(); break;
788
  case AI_CHECK_PARAGRAPH_COUNTING: $status .= "PARAGRAPH COUNTING"; break;
789
  case AI_CHECK_MIN_NUMBER_OF_WORDS: $status .= "MIN NUMBER OF WORDS " . intval ($obj->get_minimum_words()); break;
790
  case AI_CHECK_MAX_NUMBER_OF_WORDS: $status .= "MAX NUMBER OF WORDS " . (intval ($obj->get_maximum_words()) == 0 ? 1000000 : intval ($obj->get_maximum_words())); break;
@@ -811,6 +851,17 @@ function ai_log_block_status ($block, $ai_last_check) {
811
  return $status;
812
  }
813
 
 
 
 
 
 
 
 
 
 
 
 
814
  function ai_log ($message = "") {
815
  global $ai_last_time, $ai_processing_log;
816
 
@@ -823,45 +874,17 @@ function ai_log ($message = "") {
823
  $ai_last_time = microtime (true);
824
  }
825
 
826
- function remove_parameters_from_url ($url, $parameter = '') {
827
- if ($parameter == '')
828
- $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION); else
829
- $parameters = array ($parameter);
830
-
831
- foreach ($parameters as $parameter) {
832
- if (stripos ($url, '?'.$parameter.'=') !== false) {
833
- $url = preg_replace ("/".$parameter."=[^&]*/", "", $url);
834
- $url = rtrim (str_replace ('?&', '?', $url), "?");
835
- }
836
- elseif (stripos ($url, "&".$parameter."=") !== false)
837
- $url = preg_replace ("/&".$parameter."=[^&]*/", "", $url);
838
- }
839
-
840
- return $url;
841
- }
842
 
843
- function current_url () {
844
- if (isset ($_SERVER ["HTTPS"]) && $_SERVER ["HTTPS"] == "on")
845
- $url = "https://"; else
846
- $url = "http://";
847
- $url .= $_SERVER ['SERVER_NAME'];
848
- if($_SERVER['SERVER_PORT'] != 80)
849
- $url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
850
- $url .= $_SERVER["REQUEST_URI"];
851
- return $url;
852
  }
853
 
854
  function set_url_parameter ($parameter, $value) {
855
- $url = remove_parameters_from_url (current_url ());
856
-
857
- if (stripos ($url, $parameter) !== false) {
858
- $url = preg_replace ("/($parameter=[^&]*)/", $parameter .'=' . $value, $url);
859
- } else {
860
- if (strpos ($url, '?') !== false)
861
- $url .= '&' . $parameter .'=' . $value; else
862
- $url .= '?' . $parameter .'=' . $value;
863
- }
864
- return $url;
865
  }
866
 
867
  function number_of_words (&$content) {
@@ -887,7 +910,7 @@ function ai_wp_hook () {
887
  ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 &&
888
  get_admin_toolbar_debugging () &&
889
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
890
- add_action ('admin_bar_menu', 'ai_toolbar', 20);
891
 
892
  $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
893
 
@@ -914,6 +937,9 @@ function ai_wp_hook () {
914
  if (isset ($_GET [AI_URL_DEBUG_NO_INSERTION]))
915
  if ($_GET [AI_URL_DEBUG_NO_INSERTION] && $url_debugging) $ai_wp_data [AI_WP_DEBUGGING] |= AI_DEBUG_NO_INSERTION; else $ai_wp_data [AI_WP_DEBUGGING] &= ~AI_DEBUG_NO_INSERTION;
916
 
 
 
 
917
  if (isset ($_GET [AI_URL_DEBUG_POSITIONS])) {
918
  if ($_GET [AI_URL_DEBUG_POSITIONS] !== '' && $url_debugging) $ai_wp_data [AI_WP_DEBUGGING] |= AI_DEBUG_POSITIONS; else $ai_wp_data [AI_WP_DEBUGGING] &= ~AI_DEBUG_POSITIONS;
919
  if (is_numeric ($_GET [AI_URL_DEBUG_POSITIONS])) $ai_wp_data [AI_WP_DEBUG_BLOCK] = intval ($_GET [AI_URL_DEBUG_POSITIONS]);
@@ -991,6 +1017,7 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
991
  global $ai_settings_page;
992
 
993
  if ($hook_suffix == $ai_settings_page) {
 
994
  wp_enqueue_script ('ai-admin-js', plugins_url ('js/ad-inserter.js', __FILE__), array (
995
  'jquery',
996
  'jquery-ui-tabs',
@@ -1016,6 +1043,9 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
1016
  if (AI_SYNTAX_HIGHLIGHTING) {
1017
  wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1018
  wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
 
 
 
1019
  }
1020
  }
1021
  }
@@ -1060,6 +1090,9 @@ function add_head_inline_styles_and_scripts () {
1060
  #wp-admin-bar-ai-toolbar-no-insertion .ab-icon:before {
1061
  content: '\\f214';
1062
  }
 
 
 
1063
  #wp-admin-bar-ai-toolbar-processing .ab-icon:before {
1064
  content: '\\f464';
1065
  }
@@ -1075,56 +1108,355 @@ function add_head_inline_styles_and_scripts () {
1075
  }
1076
  }
1077
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
  function ai_adb_code () {
1079
- return "
1080
- var ai_adb_debugging = " . (get_javascript_debugging () ? 'true' : 'false') . ";
1081
  var ai_adb_active = false;
1082
-
1083
- var ai_adb_detected = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
1084
  if (!ai_adb_active) {
1085
  ai_adb_active = true;
1086
- if (ai_adb_debugging) console.log ('AI AdBlocker DETECTED');
 
 
1087
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
 
1089
  }
1090
  }
1091
- var ai_adb_undetected = function() {
1092
- // if (!ai_adb_active) {
1093
- // if (ai_adb_debugging) console.log ('AI AdBlocker not detected');
1094
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
  }
1096
 
 
 
1097
  if (!document.getElementById ('" . AI_ADB_1_NAME . "')){
1098
- if (ai_adb_debugging) console.log ('AI AdBlocker 1 DETECTED');
1099
- jQuery (document).ready (ai_adb_detected);
1100
  } else {
1101
- if (ai_adb_debugging) console.log ('AI AdBlocker 1 not detected');
1102
- jQuery (document).ready (ai_adb_undetected);
1103
  }
1104
 
1105
  if (typeof window." . AI_ADB_2_NAME . " == 'undefined') {
1106
- if (ai_adb_debugging) console.log ('AI AdBlocker 2 DETECTED');
1107
- jQuery (document).ready (ai_adb_detected);
1108
  } else {
1109
- if (ai_adb_debugging) console.log ('AI AdBlocker 2 not detected');
1110
- jQuery (document).ready (ai_adb_undetected);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
  }
 
 
 
 
 
 
 
 
1112
  ";
1113
 
1114
- // return "";
1115
  }
1116
 
1117
  function add_footer_inline_scripts () {
1118
- global $ai_wp_data;
 
 
1119
 
1120
- if (defined ('AI_ADBLOCKER_DETECTION') && AI_ADBLOCKER_DETECTION) {
1121
- if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
1122
- echo "<script type='text/javascript' src='", plugins_url ('includes/js/ads.js?', __FILE__ ), "'></script>\n";
1123
- echo "<script type='text/javascript' src='", plugins_url ('includes/js/sponsors.js?', __FILE__ ), "'></script>\n";
 
 
1124
  }
 
1125
  }
1126
 
1127
- $inline_scripts = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE || $ai_wp_data [AI_TRACKING] || $ai_wp_data [AI_STICKY_WIDGETS] || (defined ('AI_ADBLOCKER_DETECTION') && AI_ADBLOCKER_DETECTION);
1128
 
1129
  if ($inline_scripts) echo "<script type='text/javascript'>\n";
1130
 
@@ -1196,8 +1528,10 @@ sticky_widget_margin;if(sidebar.css("position")!="sticky"||isNaN(parseInt(sideba
1196
 
1197
  }
1198
 
1199
- if (defined ('AI_ADBLOCKER_DETECTION') && AI_ADBLOCKER_DETECTION) {
1200
- if (!function_exists ('add_footer_inline_scripts_2')) echo ai_adb_code ();
 
 
1201
  }
1202
 
1203
  if (function_exists ('add_footer_inline_scripts_2')) {
@@ -1527,7 +1861,9 @@ function ai_wp_footer_hook () {
1527
  $start_time = microtime (true);
1528
  }
1529
 
1530
- add_footer_inline_scripts ();
 
 
1531
 
1532
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
1533
 
@@ -1552,7 +1888,7 @@ function ai_wp_footer_hook () {
1552
  }
1553
 
1554
  function ai_write_debug_info ($write_processing_log = false) {
1555
- 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;
1556
 
1557
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
1558
  if (function_exists ('ai_debug_header')) ai_debug_header ();
@@ -1564,14 +1900,14 @@ function ai_write_debug_info ($write_processing_log = false) {
1564
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
1565
 
1566
  echo "SETTINGS: ";
1567
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']))
1568
- echo (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][0].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][1]), '.',
1569
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
1570
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]);
1571
 
1572
  echo "\n";
1573
  echo "SETTINGS TIMESTAMP: ";
1574
- echo isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "", "\n";
1575
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
1576
  if (is_multisite()) {
1577
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
@@ -1633,7 +1969,7 @@ function ai_write_debug_info ($write_processing_log = false) {
1633
  }
1634
 
1635
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
1636
- echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
1637
  if (function_exists ('ai_debug')) ai_debug ();
1638
  echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
1639
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
@@ -1681,6 +2017,32 @@ function ai_write_debug_info ($write_processing_log = false) {
1681
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
1682
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
1683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1684
 
1685
  echo "\n";
1686
 
@@ -1698,7 +2060,7 @@ function ai_write_debug_info ($write_processing_log = false) {
1698
  foreach (array_keys ($default->wp_options) as $key){
1699
  switch ($key) {
1700
  case AI_OPTION_CODE:
1701
- case AI_OPTION_NAME:
1702
  continue 2;
1703
  case AI_OPTION_DISPLAY_ON_PAGES:
1704
  case AI_OPTION_DISPLAY_ON_POSTS:
@@ -1730,6 +2092,9 @@ function ai_write_debug_info ($write_processing_log = false) {
1730
  $settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
1731
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1732
  break;
 
 
 
1733
  default:
1734
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1735
  break;
@@ -1850,7 +2215,25 @@ function ai_write_debug_info ($write_processing_log = false) {
1850
  echo $log_line, "\n";
1851
  }
1852
 
 
 
 
 
 
 
 
 
1853
  echo "PHP: ", phpversion(), "\n";
 
 
 
 
 
 
 
 
 
 
1854
  global $wp_version;
1855
  echo "Wordpress: ", $wp_version, "\n";
1856
  $current_theme = wp_get_theme();
@@ -1869,6 +2252,8 @@ function ai_write_debug_info ($write_processing_log = false) {
1869
  echo in_array ($plugin_path, $active_plugins) ? '* ' : ' ', html_entity_decode ($plugin ["Name"]), ' ', $plugin ["Version"], "\n";
1870
  }
1871
  }
 
 
1872
  }
1873
 
1874
  function ai_shutdown_hook () {
@@ -1944,6 +2329,16 @@ function ai_check_plugin_options ($plugin_options = array ()) {
1944
 
1945
  if (!isset ($plugin_options ['DYNAMIC_BLOCKS'])) $plugin_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
1946
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
 
 
 
 
 
 
 
 
 
 
1947
  if (!isset ($plugin_options ['ADMIN_TOOLBAR_DEBUGGING'])) $plugin_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
1948
  if (!isset ($plugin_options ['REMOTE_DEBUGGING'])) $plugin_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
1949
  if (!isset ($plugin_options ['JAVASCRIPT_DEBUGGING'])) $plugin_options ['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
@@ -2018,15 +2413,15 @@ function ai_load_options () {
2018
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD OPTIONS START");
2019
 
2020
  if (is_multisite()) {
2021
- $ai_db_options_multisite = get_site_option (WP_OPTION_NAME);
2022
  option_stripslashes ($ai_db_options_multisite);
2023
  }
2024
 
2025
  if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
2026
- $ai_db_options = get_blog_option (BLOG_ID_CURRENT_SITE, WP_OPTION_NAME);
2027
  option_stripslashes ($ai_db_options);
2028
  } else {
2029
- $ai_db_options = get_option (WP_OPTION_NAME);
2030
  option_stripslashes ($ai_db_options);
2031
  }
2032
 
@@ -2036,127 +2431,135 @@ function ai_load_options () {
2036
  function get_viewport_css () {
2037
  global $ai_db_options;
2038
 
2039
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'] = generate_viewport_css ();
2040
 
2041
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS']);
2042
  }
2043
 
2044
  function get_syntax_highlighter_theme () {
2045
  global $ai_db_options;
2046
 
2047
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME'] = DEFAULT_SYNTAX_HIGHLIGHTER_THEME;
2048
 
2049
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME']);
2050
  }
2051
 
2052
  function get_block_class_name () {
2053
  global $ai_db_options;
2054
 
2055
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
2056
 
2057
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME']);
2058
  }
2059
 
2060
  function get_minimum_user_role () {
2061
  global $ai_db_options;
2062
 
2063
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2064
 
2065
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE']);
2066
  }
2067
 
2068
  function get_sticky_widget_margin () {
2069
  global $ai_db_options;
2070
 
2071
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN'] = DEFAULT_STICKY_WIDGET_MARGIN;
2072
 
2073
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN']);
2074
  }
2075
 
2076
  function get_plugin_priority () {
2077
  global $ai_db_options;
2078
 
2079
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
2080
 
2081
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY']);
2082
  }
2083
 
2084
  function get_dynamic_blocks(){
2085
  global $ai_db_options;
2086
 
2087
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
2088
 
2089
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS']);
2090
  }
2091
 
2092
  function get_paragraph_counting_functions(){
2093
  global $ai_db_options;
2094
 
2095
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PARAGRAPH_COUNTING_FUNCTIONS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
2096
 
2097
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PARAGRAPH_COUNTING_FUNCTIONS']);
 
 
 
 
 
 
 
 
2098
  }
2099
 
2100
  function get_admin_toolbar_debugging () {
2101
  global $ai_db_options;
2102
 
2103
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
2104
 
2105
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING']);
2106
  }
2107
 
2108
  function get_remote_debugging () {
2109
  global $ai_db_options;
2110
 
2111
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
2112
 
2113
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING']);
2114
  }
2115
 
2116
  function get_javascript_debugging () {
2117
  global $ai_db_options;
2118
 
2119
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
2120
 
2121
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING']);
2122
  }
2123
 
2124
  function get_viewport_name ($viewport_number) {
2125
  global $ai_db_options;
2126
 
2127
  $viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
2128
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
2129
- $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
2130
 
2131
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
2132
  }
2133
 
2134
  function get_viewport_width ($viewport_number) {
2135
  global $ai_db_options;
2136
 
2137
  $viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
2138
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
2139
- $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
2140
 
2141
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
2142
  }
2143
 
2144
  function get_country_group_name ($group_number) {
2145
  global $ai_db_options;
2146
 
2147
  $country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
2148
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name] = DEFAULT_COUNTRY_GROUP_NAME . ' ' . $group_number;
2149
 
2150
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name]);
2151
  }
2152
 
2153
  function get_group_country_list ($group_number) {
2154
  global $ai_db_options;
2155
 
2156
  $group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
2157
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name] = '';
2158
 
2159
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name]);
2160
  }
2161
 
2162
  function multisite_settings_page_enabled () {
@@ -2226,6 +2629,96 @@ function multisite_main_for_all_blogs () {
2226
  return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
2227
  }
2228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2229
  function filter_html_class ($str){
2230
 
2231
  $str = str_replace (array ("\\\""), array ("\""), $str);
@@ -2248,6 +2741,9 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2248
  $value = str_replace (array ("\\\""), array ("\""), $value);
2249
 
2250
  if ($option == AI_OPTION_DOMAIN_LIST ||
 
 
 
2251
  $option == AI_OPTION_IP_ADDRESS_LIST ||
2252
  $option == AI_OPTION_COUNTRY_LIST) {
2253
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]"), "", $value);
@@ -2260,7 +2756,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2260
  ) {
2261
  $value = esc_html ($value);
2262
  }
2263
- elseif ($option == AI_OPTION_NAME ||
2264
  $option == AI_OPTION_GENERAL_TAG ||
2265
  $option == AI_OPTION_DOMAIN_LIST ||
2266
  $option == AI_OPTION_CATEGORY_LIST ||
@@ -2271,6 +2767,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2271
  $option == AI_OPTION_PARAGRAPH_TEXT_TYPE ||
2272
  $option == AI_OPTION_PARAGRAPH_NUMBER ||
2273
  $option == AI_OPTION_MIN_PARAGRAPHS ||
 
2274
  $option == AI_OPTION_AVOID_PARAGRAPHS_ABOVE ||
2275
  $option == AI_OPTION_AVOID_PARAGRAPHS_BELOW ||
2276
  $option == AI_OPTION_AVOID_TRY_LIMIT ||
@@ -2284,7 +2781,13 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2284
  $option == AI_OPTION_END_DATE ||
2285
  $option == AI_OPTION_FALLBACK ||
2286
  $option == AI_OPTION_EXCERPT_NUMBER ||
2287
- $option == AI_OPTION_CUSTOM_CSS) {
 
 
 
 
 
 
2288
  $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
2289
  $value = esc_html ($value);
2290
  }
@@ -2315,6 +2818,9 @@ function ai_data () {
2315
  if (is_numeric ($block) && $block >= 1 && $block <= AD_INSERTER_BLOCKS) {
2316
  generate_code_preview ($block);
2317
  }
 
 
 
2318
  }
2319
 
2320
  elseif (isset ($_GET ["image"])) {
@@ -2324,8 +2830,8 @@ function ai_data () {
2324
  }
2325
 
2326
  elseif (isset ($_GET ["rating"])) {
2327
- $cache_time = $_GET ["rating"] == 'update' ? 5 * 60 : 24 * 3600;
2328
- if (!file_exists (AI_RATING_FILE) || time () - filemtime (AI_RATING_FILE) > $cache_time) {
2329
  if (preg_match_all ("#<span class=\"counter-count\">(.+?)</span>#", file_get_contents ('https://wordpress.org/plugins/ad-inserter/'), $ratings)) {
2330
  if (count ($ratings [1]) == 5) {
2331
  $total_rating = 0;
@@ -2335,12 +2841,11 @@ function ai_data () {
2335
  $total_count += $count;
2336
  }
2337
  $rating = number_format ($total_rating / $total_count, 4);
2338
- file_put_contents (AI_RATING_FILE, $rating);
2339
  }
2340
  }
2341
  }
2342
- if (file_exists (AI_RATING_FILE)) {
2343
- $rating = file_get_contents (AI_RATING_FILE);
2344
  if ($rating > 1 && $rating <= 5) echo $rating;
2345
  }
2346
  }
@@ -2456,7 +2961,7 @@ function ai_load_settings () {
2456
  ai_load_options ();
2457
 
2458
  if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
2459
- isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] == $version_string &&
2460
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
2461
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
2462
  isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS]))
@@ -2464,7 +2969,7 @@ function ai_load_settings () {
2464
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
2465
 
2466
  $obj = new ai_Block (0);
2467
- $obj->wp_options [AI_OPTION_NAME] = 'Default';
2468
  $block_object [0] = $obj;
2469
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2470
  $obj = new ai_Block ($block);
@@ -2476,8 +2981,14 @@ function ai_load_settings () {
2476
  $adF = new ai_AdF();
2477
  $adH->load_options (AI_HEADER_OPTION_NAME);
2478
  $adF->load_options (AI_FOOTER_OPTION_NAME);
2479
- $block_object [AI_HEADER_OPTION_NAME] = $adH;
2480
- $block_object [AI_FOOTER_OPTION_NAME] = $adF;
 
 
 
 
 
 
2481
 
2482
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS END");
2483
  }
@@ -2578,7 +3089,7 @@ function ai_settings () {
2578
 
2579
  if ($exported_settings !== false) {
2580
  foreach (array_keys ($ad->wp_options) as $key){
2581
- if ($key == AI_OPTION_NAME && isset ($_POST [$import_name_switch_name]) && $_POST [$import_name_switch_name] != "1") {
2582
  $form_field_name = $key . WP_FORM_FIELD_POSTFIX . $block;
2583
  if (isset ($_POST [$form_field_name])){
2584
  $ad->wp_options [$key] = filter_option ($key, $_POST [$form_field_name]);
@@ -2625,23 +3136,44 @@ function ai_settings () {
2625
  }
2626
  }
2627
 
2628
- $ai_options [AI_HEADER_OPTION_NAME] = $adH->wp_options;
2629
- $ai_options [AI_FOOTER_OPTION_NAME] = $adF->wp_options;
 
 
 
 
 
 
 
 
 
 
 
2630
 
2631
  $options = array ();
2632
 
2633
  if (function_exists ('ai_filter_global_settings')) ai_filter_global_settings ($options);
2634
 
2635
- if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
2636
- if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
2637
- if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
2638
- if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('sticky-widget-margin', $_POST ['sticky-widget-margin']);
2639
- if (isset ($_POST ['plugin_priority'])) $options ['PLUGIN_PRIORITY'] = filter_option ('plugin_priority', $_POST ['plugin_priority']);
2640
- if (isset ($_POST ['dynamic_blocks'])) $options ['DYNAMIC_BLOCKS'] = filter_option ('dynamic_blocks', $_POST ['dynamic_blocks']);
2641
- if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('paragraph_counting_functions', $_POST ['paragraph_counting_functions']);
2642
- if (isset ($_POST ['admin_toolbar_debugging'])) $options ['ADMIN_TOOLBAR_DEBUGGING'] = filter_option ('admin_toolbar_debugging', $_POST ['admin_toolbar_debugging']);
2643
- if (isset ($_POST ['remote_debugging'])) $options ['REMOTE_DEBUGGING'] = filter_option ('remote_debugging', $_POST ['remote_debugging']);
2644
- if (isset ($_POST ['javascript_debugging'])) $options ['JAVASCRIPT_DEBUGGING'] = filter_option ('javascript_debugging', $_POST ['javascript_debugging']);
 
 
 
 
 
 
 
 
 
 
2645
 
2646
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
2647
  if (isset ($_POST ['viewport-name-'.$viewport]))
@@ -2652,7 +3184,7 @@ function ai_settings () {
2652
 
2653
  $options ['VIEWPORT_CSS'] = generate_viewport_css ();
2654
 
2655
- $ai_options [AI_GLOBAL_OPTION_NAME] = ai_check_plugin_options ($options);
2656
  }
2657
 
2658
  if (!empty ($invalid_blocks)) {
@@ -2664,9 +3196,9 @@ function ai_settings () {
2664
  // Generate and save extract
2665
  $ai_options [AI_EXTRACT_OPTION_NAME] = ai_generate_extract ($ai_options);
2666
 
2667
- $ai_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] = time ();
2668
 
2669
- update_option (WP_OPTION_NAME, $ai_options);
2670
 
2671
  // Multisite
2672
  if (is_multisite () && is_main_site ()) {
@@ -2675,7 +3207,7 @@ function ai_settings () {
2675
  if (function_exists ('ai_filter_multisite_settings')) ai_filter_multisite_settings ($options);
2676
 
2677
  ai_check_multisite_options ($options);
2678
- update_site_option (WP_OPTION_NAME, $options);
2679
  }
2680
 
2681
  ai_load_settings ();
@@ -2700,10 +3232,10 @@ function ai_settings () {
2700
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
2701
  delete_option (AD_OPTIONS);
2702
 
2703
- delete_option (WP_OPTION_NAME);
2704
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
2705
  if (is_multisite () && is_main_site ()) {
2706
- delete_site_option (WP_OPTION_NAME, $options);
2707
  }
2708
 
2709
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
@@ -2894,7 +3426,7 @@ function ai_content_hook ($content = '') {
2894
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
2895
  $globals_name = AI_CONTENT_COUNTER_NAME;
2896
 
2897
- $special_element_tags = explode (',', str_replace (' ', '', SPECIAL_ELEMENT_TAGS));
2898
 
2899
  if (!isset ($ad_inserter_globals [$globals_name])) {
2900
  $ad_inserter_globals [$globals_name] = 1;
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
+ Version: 2.1.12
5
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes into your website.
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
12
 
13
  Change Log
14
 
15
+ Ad Inserter 2.1.12 - 2017-08-07
16
+ - Added option to define tags inside which paragraphs are not counted
17
+ - Added max insertions check when inserting for all paragraphs
18
+ - Added support for inverted filter
19
+ - Added option to define minimum number of words in paragraphs above (experimantal)
20
+ - Added support for %N filter item to filter every N-th insertion (experimantal)
21
+ - Added filter support when inserting for all paragraphs (experimantal)
22
+ - Increased nonce lifespan to 48 hours when using tracking (Pro only)
23
+ - Fixed wrong urls in debug menu when behind proxy
24
+
25
  Ad Inserter 2.1.11 - 2017-07-21
26
  - Improved support for sticky widgets
27
  - Added support for ad counting (|count| separator)
411
  exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
412
  }
413
 
414
+ global $block_object, $ai_wp_data, $ad_inserter_globals, $ai_last_check, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_db_options, $block_insertion_log;
415
 
416
  //include required files
417
  require_once AD_INSERTER_PLUGIN_DIR.'class.php';
418
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
419
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
420
  require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
421
+ require_once AD_INSERTER_PLUGIN_DIR.'preview-adb.php';
422
 
423
  if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
424
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
434
  }
435
 
436
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
437
+ $ai_wp_data [AI_WP_URL] = remove_debug_parameters_from_url ();
438
 
439
  if (!is_admin()) {
440
  if (!isset ($_GET [AI_URL_DEBUG]))
454
 
455
  $ad_inserter_globals = array ();
456
  $block_object = array ();
457
+ $block_insertion_log = array ();
458
 
459
  ai_load_settings ();
460
 
465
  }
466
  }
467
 
468
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
469
+ $ai_wp_data [AI_ADB_DETECTION] = $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ();
470
 
471
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
472
+ define ('AI_ADB_2_NAME', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY).md5 (NONCE_KEY))), 0, 8));
473
+ define ('AI_ADB_COOKIE_VALUE', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY.md5 (NONCE_KEY)))), 0, 8));
474
 
475
+ $script = AD_INSERTER_PLUGIN_DIR.'includes/js/sponsors.js';
476
+
477
+ $js_ok = false;
478
+ if (file_exists ($script)) {
479
+ if (strpos (file_get_contents ($script), AI_ADB_2_NAME) !== false) $js_ok = true;
480
+ }
481
 
482
+ if (!$js_ok) {
483
+ file_put_contents ($script, 'window.' . AI_ADB_2_NAME . '=true;');
484
+ define ('AI_ADB_2_FILE_RECREATED', true);
485
+ }
486
+
487
+ if (function_exists ('ai_check_files')) ai_check_files ();
488
+ }
489
  }
490
+
491
  if (function_exists ('ai_load_globals')) ai_load_globals ();
492
 
493
  if (get_dynamic_blocks ()) {
583
  add_action ('wp_ajax_ai_data', 'ai_data');
584
  add_action ('wp_ajax_nopriv_ai_data', 'ai_data');
585
 
586
+ if ($ai_wp_data [AI_TRACKING]) {
587
+ add_filter ('nonce_life', function () {return 48 * 3600;});
588
+ }
589
+
590
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
591
  $ai_total_plugin_time += microtime (true) - $start_time;
592
  ai_log ("INITIALIZATION END\n");
593
  }
594
 
595
 
596
+
597
  function ai_toolbar ($wp_admin_bar) {
598
  global $block_object, $ai_wp_data;
599
 
612
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) $debug_no_insertion = 1; else $debug_no_insertion = 0;
613
  $debug_no_insertion_class = $debug_no_insertion == 0 ? ' on' : '';
614
 
615
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING) == 0) $debug_ad_blocking = 1; else $debug_ad_blocking = 0;
616
+ $debug_ad_blocking_class = $debug_ad_blocking == 0 ? ' on' : '';
617
+
618
+ $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0 || $debug_ad_blocking == 0;
619
 
620
  $debug_settings_class = $debug_settings_on ? ' on' : '';
621
+ $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_debug_parameters_from_url ()) :
622
+ add_query_arg (array (AI_URL_DEBUG_BLOCKS => '1', AI_URL_DEBUG_POSITIONS => '0', AI_URL_DEBUG_TAGS => '1'), remove_debug_parameters_from_url ());
623
 
624
  $wp_admin_bar->add_node (array (
625
  'id' => 'ai-toolbar',
627
  ));
628
  $wp_admin_bar->add_node (array (
629
  'id' => 'ai-toolbar-settings',
630
+ // 'parent' => 'ai-toolbar',
631
  'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME,
632
  'href' => $top_menu_url,
633
  ));
698
  ($paragraph_block ['min'] != 0 ? ' min '.$paragraph_block ['min']. ' ' : '').
699
  ($paragraph_block ['max'] != 0 ? ' max '.$paragraph_block ['max']. ' ' : '').
700
  ($paragraph_block ['blockquote'] ? ' [blockquote] ' : '').
701
+ ($paragraph_block ['text'] != '' ? ($paragraph_block ['text_type'] == AD_DO_NOT_CONTAIN ? ' NC ' : ' C ').' ['.htmlentities ($paragraph_block ['text']).']' : ''),
702
  'href' => set_url_parameter (AI_URL_DEBUG_POSITIONS, $paragraph_block ['blocks'][0]),
703
  ));
704
  }
715
  'title' => '<span class="ab-icon'.$debug_no_insertion_class.'"></span>Disable Insertion',
716
  'href' => set_url_parameter (AI_URL_DEBUG_NO_INSERTION, $debug_no_insertion),
717
  ));
718
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
719
+ $wp_admin_bar->add_node (array (
720
+ 'id' => 'ai-toolbar-ad-blocking',
721
+ 'parent' => 'ai-toolbar-settings',
722
+ 'title' => '<span class="ab-icon'.$debug_ad_blocking_class.'"></span>Simulate Ad Blocking',
723
+ 'href' => set_url_parameter (AI_URL_DEBUG_AD_BLOCKING, $debug_ad_blocking),
724
+ ));
725
+ }
726
  $wp_admin_bar->add_node (array (
727
  'id' => 'ai-toolbar-processing',
728
  'parent' => 'ai-toolbar-settings',
778
  ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).']');
779
  }
780
 
781
+ function ai_block_insertion_status ($block, $ai_last_check) {
782
  global $block_object;
783
 
784
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) $block = 0;
785
 
786
+ if ($ai_last_check == AI_CHECK_INSERTED) return "INSERTED";
787
+ $status = "FAILED CHECK: ";
788
  $obj = $block_object [$block];
789
  switch ($ai_last_check) {
790
  case AI_CHECK_PAGE_TYPE_FRONT_PAGE: $status .= "ENABLED ON HOMEPAGE"; break;
824
  case AI_CHECK_DISABLED_MANUALLY: $status .= "DISABLED BY HTML COMMENT"; break;
825
 
826
  case AI_CHECK_MAX_INSERTIONS: $status .= "MAX INSERTIONS " . $obj->get_maximum_insertions (); break;
827
+ case AI_CHECK_FILTER: $status .= ($obj->get_inverted_filter() ? 'INVERTED ' : '') . "FILTER " . $obj->get_call_filter(); break;
828
  case AI_CHECK_PARAGRAPH_COUNTING: $status .= "PARAGRAPH COUNTING"; break;
829
  case AI_CHECK_MIN_NUMBER_OF_WORDS: $status .= "MIN NUMBER OF WORDS " . intval ($obj->get_minimum_words()); break;
830
  case AI_CHECK_MAX_NUMBER_OF_WORDS: $status .= "MAX NUMBER OF WORDS " . (intval ($obj->get_maximum_words()) == 0 ? 1000000 : intval ($obj->get_maximum_words())); break;
851
  return $status;
852
  }
853
 
854
+ function ai_log_block_status ($block, $ai_last_check) {
855
+ global $block_insertion_log, $ad_inserter_globals;
856
+
857
+ $global_name = AI_BLOCK_COUNTER_NAME . $block;
858
+
859
+ $block_status = ai_block_insertion_status ($block, $ai_last_check);
860
+ $block_insertion_log [] = sprintf ("% 2d BLOCK % 2d %s %s", $block, $block, $block_status, $ai_last_check == AI_CHECK_INSERTED && $ad_inserter_globals [$global_name] != 1 ? '['.$ad_inserter_globals [$global_name] . ']' : '');
861
+
862
+ return "BLOCK $block " . $block_status;
863
+ }
864
+
865
  function ai_log ($message = "") {
866
  global $ai_last_time, $ai_processing_log;
867
 
874
  $ai_last_time = microtime (true);
875
  }
876
 
877
+ function remove_debug_parameters_from_url ($url = false) {
878
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
879
+ $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION, AI_URL_DEBUG_AD_BLOCKING);
880
+ } else
881
+ $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION);
 
 
 
 
 
 
 
 
 
 
 
882
 
883
+ return remove_query_arg ($parameters, $url);
 
 
 
 
 
 
 
 
884
  }
885
 
886
  function set_url_parameter ($parameter, $value) {
887
+ return add_query_arg ($parameter, $value, remove_debug_parameters_from_url ());
 
 
 
 
 
 
 
 
 
888
  }
889
 
890
  function number_of_words (&$content) {
910
  ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 &&
911
  get_admin_toolbar_debugging () &&
912
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
913
+ add_action ('admin_bar_menu', 'ai_toolbar', 9920);
914
 
915
  $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
916
 
937
  if (isset ($_GET [AI_URL_DEBUG_NO_INSERTION]))
938
  if ($_GET [AI_URL_DEBUG_NO_INSERTION] && $url_debugging) $ai_wp_data [AI_WP_DEBUGGING] |= AI_DEBUG_NO_INSERTION; else $ai_wp_data [AI_WP_DEBUGGING] &= ~AI_DEBUG_NO_INSERTION;
939
 
940
+ if (isset ($_GET [AI_URL_DEBUG_AD_BLOCKING]))
941
+ if ($_GET [AI_URL_DEBUG_AD_BLOCKING] && $url_debugging) $ai_wp_data [AI_WP_DEBUGGING] |= AI_DEBUG_AD_BLOCKING; else $ai_wp_data [AI_WP_DEBUGGING] &= ~AI_DEBUG_AD_BLOCKING;
942
+
943
  if (isset ($_GET [AI_URL_DEBUG_POSITIONS])) {
944
  if ($_GET [AI_URL_DEBUG_POSITIONS] !== '' && $url_debugging) $ai_wp_data [AI_WP_DEBUGGING] |= AI_DEBUG_POSITIONS; else $ai_wp_data [AI_WP_DEBUGGING] &= ~AI_DEBUG_POSITIONS;
945
  if (is_numeric ($_GET [AI_URL_DEBUG_POSITIONS])) $ai_wp_data [AI_WP_DEBUG_BLOCK] = intval ($_GET [AI_URL_DEBUG_POSITIONS]);
1017
  global $ai_settings_page;
1018
 
1019
  if ($hook_suffix == $ai_settings_page) {
1020
+
1021
  wp_enqueue_script ('ai-admin-js', plugins_url ('js/ad-inserter.js', __FILE__), array (
1022
  'jquery',
1023
  'jquery-ui-tabs',
1043
  if (AI_SYNTAX_HIGHLIGHTING) {
1044
  wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1045
  wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1046
+
1047
+ if (get_syntax_highlighter_theme () == AI_SYNTAX_HIGHLIGHTER_THEME || isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] == AI_SYNTAX_HIGHLIGHTER_THEME)
1048
+ wp_enqueue_script ('ai-ace-theme', plugins_url ('includes/ace/theme-ad_inserter.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1049
  }
1050
  }
1051
  }
1090
  #wp-admin-bar-ai-toolbar-no-insertion .ab-icon:before {
1091
  content: '\\f214';
1092
  }
1093
+ #wp-admin-bar-ai-toolbar-ad-blocking .ab-icon:before {
1094
+ content: '\\f160';
1095
+ }
1096
  #wp-admin-bar-ai-toolbar-processing .ab-icon:before {
1097
  content: '\\f464';
1098
  }
1108
  }
1109
  }
1110
 
1111
+ function ai_adb_replace_vars ($vars) {
1112
+ global $block_object, $ai_wp_data;
1113
+
1114
+ $adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
1115
+
1116
+ $vars = str_replace ('AI0', ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING) != 0 ? 'true' : 'false', $vars);
1117
+ $vars = str_replace ('AI1', get_javascript_debugging () ? 'true' : 'false', $vars);
1118
+ $vars = str_replace ('AI2', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) . get_overlay_css () . "'}})", $vars);
1119
+ $vars = str_replace ('AI3', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) . get_message_css () . "'}, html: '" .
1120
+ str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ())) . "'});", $vars);
1121
+ $vars = str_replace ('AI4', get_undismissible_message () ? 'true' : 'false', $vars);
1122
+ $vars = str_replace ('AI5', get_no_action_period (true), $vars);
1123
+ $vars = str_replace ('AI6', get_adb_action (true), $vars);
1124
+ $vars = str_replace ('AI7', get_delay_action (true), $vars);
1125
+ $vars = str_replace ('AI8', str_replace (' ', '', get_adb_selectors ()), $vars);
1126
+
1127
+ $redirection_page = get_redirection_page ();
1128
+ if ($redirection_page != 0) $url = get_permalink ($redirection_page); else $url = trim (get_custom_redirection_url ());
1129
+ $vars = str_replace ('AI9', $url, $vars);
1130
+
1131
+ return $vars;
1132
+ }
1133
+
1134
  function ai_adb_code () {
1135
+ return "
1136
+ var ai_adb_debugging = AI1;
1137
  var ai_adb_active = false;
1138
+ var ai_adb_counter = 0;
1139
+ var ai_adb_overlay = AI2;
1140
+ var ai_adb_message_window = AI3;
1141
+ var ai_adb_message_undismissible = AI4;
1142
+ var ai_adb_action_cookie_name = 'aiADB';
1143
+ var ai_adb_page_views_cookie_name = 'aiADB_PV';
1144
+ var ai_adb_page_redirection_cookie_name = 'aiADB_PR';
1145
+ var ai_adb_message_cookie_lifetime = AI5;
1146
+ var ai_adb_action = AI6;
1147
+ var ai_adb_page_views = AI7;
1148
+ var ai_adb_selectors = 'AI8';
1149
+ var ai_adb_redirection_url = 'AI9';
1150
+
1151
+ var ai_adb_detected = function(n) {
1152
+ if (ai_adb_debugging) console.log ('AI ad blocking DETECTED', n);
1153
  if (!ai_adb_active) {
1154
  ai_adb_active = true;
1155
+ if (ai_adb_debugging) console.log ('AI ad blocking action check');
1156
+
1157
+ (function ($) {
1158
 
1159
+ // $.removeCookie (ai_adb_page_views_cookie_name, {path: '/' });
1160
+ if (ai_adb_page_views != 0) {
1161
+ var ai_adb_page_view_counter = 1;
1162
+ var cookie = $.cookie (ai_adb_page_views_cookie_name);
1163
+ if (typeof cookie != 'undefined') ai_adb_page_view_counter = parseInt (cookie) + 1;
1164
+ if (ai_adb_debugging) console.log ('AI ad blocking page views cookie:', cookie, '- page view:', ai_adb_page_view_counter);
1165
+
1166
+ if (ai_adb_page_view_counter < ai_adb_page_views) {
1167
+ if (ai_adb_debugging) console.log ('AI ad blocking', ai_adb_page_views, 'page views not reached, no action');
1168
+ $.cookie (ai_adb_page_views_cookie_name, ai_adb_page_view_counter, {expires: 365, path: '/'});
1169
+ return;
1170
+ }
1171
+ }
1172
+
1173
+ if (ai_adb_message_cookie_lifetime != 0 && (ai_adb_action != 1 || !ai_adb_message_undismissible)) {
1174
+ var cookie = $.cookie (ai_adb_action_cookie_name);
1175
+ if (ai_adb_debugging) console.log ('AI ad blocking cookie:', cookie);
1176
+ if (typeof cookie != 'undefined' && cookie == '" . AI_ADB_COOKIE_VALUE . "') {
1177
+ if (ai_adb_debugging) console.log ('AI ad blocking valid cookie detected, no action');
1178
+ return;
1179
+ }
1180
+
1181
+ $.cookie (ai_adb_action_cookie_name, '" . AI_ADB_COOKIE_VALUE . "', {expires: ai_adb_message_cookie_lifetime, path: '/'});
1182
+ } else $.removeCookie (ai_adb_action_cookie_name, {path: '/' });
1183
+
1184
+ if (ai_adb_debugging) console.log ('AI ad blocking action', ai_adb_action);
1185
+ switch (ai_adb_action) {
1186
+ case 1:
1187
+ if (!ai_adb_message_undismissible) {
1188
+ ai_adb_overlay.click (function () {
1189
+ $(this).remove();
1190
+ ai_adb_message_window.remove();
1191
+ }).css ('cursor', 'pointer');
1192
+ ai_adb_message_window.click (function () {
1193
+ $(this).remove();
1194
+ ai_adb_overlay.remove();
1195
+ }).css ('cursor', 'pointer');
1196
+ window.onkeydown = function( event ) {
1197
+ if (event.keyCode === 27 ) {
1198
+ ai_adb_overlay.click ();
1199
+ ai_adb_message_window.click ();
1200
+ }
1201
+ }
1202
+ if (ai_adb_debugging) console.log ('AI ad blocking MESSAGE click detection installed');
1203
+ } else {
1204
+ // $.removeCookie (ai_adb_action_cookie_name, {path: '/' });
1205
+ }
1206
+
1207
+ if (ai_adb_debugging) console.log ('AI ad blocking MESSAGE');
1208
+ $('body').prepend (ai_adb_overlay).prepend (ai_adb_message_window);
1209
+
1210
+ break;
1211
+ case 2:
1212
+ if (ai_adb_redirection_url != '') {
1213
+ if (ai_adb_debugging) console.log ('AI ad blocking REDIRECTION to', ai_adb_redirection_url);
1214
+
1215
+ var redirect = true;
1216
+ if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == 'http') {
1217
+ if (window.location.href == ai_adb_redirection_url) var redirect = false;
1218
+ } else {
1219
+ if (window.location.pathname == ai_adb_redirection_url) var redirect = false;
1220
+ }
1221
+
1222
+ if (redirect) {
1223
+ var cookie = $.cookie (ai_adb_page_redirection_cookie_name);
1224
+ if (typeof cookie == 'undefined') {
1225
+ var date = new Date();
1226
+ date.setTime (date.getTime() + (10 * 1000));
1227
+ $.cookie (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: '/' });
1228
+
1229
+ window.location.replace (ai_adb_redirection_url)
1230
+ } else {
1231
+ if (ai_adb_debugging) console.log ('AI ad blocking no redirection, cookie:', cookie);
1232
+ }
1233
+ } else {
1234
+ if (ai_adb_debugging) console.log ('AI ad blocking already on page', window.location.href);
1235
+ jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: '/'});
1236
+ }
1237
+ }
1238
+ break;
1239
+ }
1240
+
1241
+ }(jQuery));
1242
 
1243
  }
1244
  }
1245
+
1246
+ var ai_adb_undetected = function(n) {
1247
+ ai_adb_counter ++;
1248
+ if (ai_adb_debugging) console.log ('AI ad blocking not detected', n, '- counter:', ai_adb_counter);
1249
+
1250
+ if (!ai_adb_active && ai_adb_counter == 3) {
1251
+ if (ai_adb_debugging) console.log ('AI ad blocking NOT DETECTED');
1252
+
1253
+ // var redirected_page = false;
1254
+ // if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == 'http') {
1255
+ // if (window.location.href == ai_adb_redirection_url) var redirected_page = true;
1256
+ // } else {
1257
+ // if (window.location.pathname == ai_adb_redirection_url) var redirected_page = true;
1258
+ // }
1259
+
1260
+ // if (redirected_page) {
1261
+ // var cookie = jQuery.cookie (ai_adb_page_redirection_cookie_name);
1262
+ // if (typeof cookie != 'undefined' && cookie.toLowerCase().substring (0, 4) == 'http') {
1263
+ // if (ai_adb_debugging) console.log ('AI ad blocking returning to', cookie);
1264
+ // jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: '/'});
1265
+ // window.location.replace (cookie);
1266
+ // }
1267
+ // }
1268
+
1269
+ }
1270
  }
1271
 
1272
+ if (AI0) jQuery (document).ready (function () {ai_adb_detected (0)});
1273
+
1274
  if (!document.getElementById ('" . AI_ADB_1_NAME . "')){
1275
+ jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (1)});
 
1276
  } else {
1277
+ jQuery (document).ready (function () {ai_adb_undetected (1)});
 
1278
  }
1279
 
1280
  if (typeof window." . AI_ADB_2_NAME . " == 'undefined') {
1281
+ jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (2)});
 
1282
  } else {
1283
+ jQuery (document).ready (function () {ai_adb_undetected (2)});
1284
+ }
1285
+
1286
+ jQuery (document).ready (function ($) {
1287
+ $(window).load(function () {
1288
+ if ($('#banner-advert-container img').length > 0) {
1289
+ if ($('#banner-advert-container img').outerHeight() === 0) {
1290
+ $(document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (3)});
1291
+ } else $(document).ready (function () {ai_adb_undetected (3)});
1292
+ $('#banner-advert-container img').remove();
1293
+ }
1294
+
1295
+ if ((!ai_adb_active || ai_adb_debugging) && ai_adb_selectors != '') {
1296
+ var ai_adb_el_counter = 0;
1297
+ var ai_adb_el_zero = 0;
1298
+ var ai_adb_selector = ai_adb_selectors.split (',');
1299
+ $.each (ai_adb_selector, function (i) {
1300
+ if (ai_adb_debugging) console.log ('AI ad blocking selector', ai_adb_selector [i]);
1301
+ if ($(ai_adb_selector [i]).length != 0) {
1302
+ $(ai_adb_selector [i]).each (function (n) {
1303
+ if (ai_adb_debugging) console.log ('AI ad blocking element id=\'' + $(this).attr ('id') + '\' class=\'' + $(this).attr ('class') + '\' heights:', $(this).outerHeight (), $(this).innerHeight (), $(this).height ());
1304
+ ai_adb_el_counter ++;
1305
+ if ($(this).outerHeight () === 0) {
1306
+ $ (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (4)});
1307
+ ai_adb_el_zero ++;
1308
+ if (!ai_adb_debugging) return false;
1309
+ }
1310
+
1311
+ });
1312
+
1313
+ }
1314
+ });
1315
+ if (ai_adb_el_counter != 0 && ai_adb_el_zero == 0) $(document).ready (function () {ai_adb_undetected (4)});
1316
+ }
1317
+ });
1318
+ });
1319
+
1320
+
1321
+ /*!
1322
+ * jQuery Cookie Plugin v1.4.1
1323
+ * https://github.com/carhartl/jquery-cookie
1324
+ *
1325
+ * Copyright 2013 Klaus Hartl
1326
+ * Released under the MIT license
1327
+ */
1328
+ (function (factory) {
1329
+ if (typeof define === 'function' && define.amd) {
1330
+ // AMD
1331
+ define(['jquery'], factory);
1332
+ } else if (typeof exports === 'object') {
1333
+ // CommonJS
1334
+ factory(require('jquery'));
1335
+ } else {
1336
+ // Browser globals
1337
+ factory(jQuery);
1338
+ }
1339
+ }(function ($) {
1340
+
1341
+ var pluses = /\+/g;
1342
+
1343
+ function encode(s) {
1344
+ return config.raw ? s : encodeURIComponent(s);
1345
+ }
1346
+
1347
+ function decode(s) {
1348
+ return config.raw ? s : decodeURIComponent(s);
1349
+ }
1350
+
1351
+ function stringifyCookieValue(value) {
1352
+ return encode(config.json ? JSON.stringify(value) : String(value));
1353
+ }
1354
+
1355
+ function parseCookieValue(s) {
1356
+ if (s.indexOf('\"') === 0) {
1357
+ // This is a quoted cookie as according to RFC2068, unescape...
1358
+ s = s.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');
1359
+ }
1360
+
1361
+ try {
1362
+ // Replace server-side written pluses with spaces.
1363
+ // If we can't decode the cookie, ignore it, it's unusable.
1364
+ // If we can't parse the cookie, ignore it, it's unusable.
1365
+ s = decodeURIComponent(s.replace(pluses, ' '));
1366
+ return config.json ? JSON.parse(s) : s;
1367
+ } catch(e) {}
1368
+ }
1369
+
1370
+ function read(s, converter) {
1371
+ var value = config.raw ? s : parseCookieValue(s);
1372
+ return $.isFunction(converter) ? converter(value) : value;
1373
+ }
1374
+
1375
+ var config = $.cookie = function (key, value, options) {
1376
+
1377
+ // Write
1378
+
1379
+ if (value !== undefined && !$.isFunction(value)) {
1380
+ options = $.extend({}, config.defaults, options);
1381
+
1382
+ if (typeof options.expires === 'number') {
1383
+ var days = options.expires, t = options.expires = new Date();
1384
+ t.setTime(+t + days * 864e+5);
1385
+ }
1386
+
1387
+ return (document.cookie = [
1388
+ encode(key), '=', stringifyCookieValue(value),
1389
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
1390
+ options.path ? '; path=' + options.path : '',
1391
+ options.domain ? '; domain=' + options.domain : '',
1392
+ options.secure ? '; secure' : ''
1393
+ ].join(''));
1394
+ }
1395
+
1396
+ // Read
1397
+
1398
+ var result = key ? undefined : {};
1399
+
1400
+ // To prevent the for loop in the first place assign an empty array
1401
+ // in case there are no cookies at all. Also prevents odd result when
1402
+ // calling $.cookie().
1403
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
1404
+
1405
+ for (var i = 0, l = cookies.length; i < l; i++) {
1406
+ var parts = cookies[i].split('=');
1407
+ var name = decode(parts.shift());
1408
+ var cookie = parts.join('=');
1409
+
1410
+ if (key && key === name) {
1411
+ // If second argument (value) is a function it's a converter...
1412
+ result = read(cookie, value);
1413
+ break;
1414
+ }
1415
+
1416
+ // Prevent storing a cookie that we couldn't decode.
1417
+ if (!key && (cookie = read(cookie)) !== undefined) {
1418
+ result[name] = cookie;
1419
+ }
1420
+ }
1421
+
1422
+ return result;
1423
+ };
1424
+
1425
+ config.defaults = {};
1426
+
1427
+ $.removeCookie = function (key, options) {
1428
+ if ($.cookie(key) === undefined) {
1429
+ return false;
1430
  }
1431
+
1432
+ // Must not alter options, thus extending a fresh object...
1433
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
1434
+ return !$.cookie(key);
1435
+ };
1436
+
1437
+ }));
1438
+
1439
  ";
1440
 
1441
+ return "";
1442
  }
1443
 
1444
  function add_footer_inline_scripts () {
1445
+ global $ai_wp_data, $block_object;
1446
+
1447
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1448
 
1449
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
1450
+ if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
1451
+ echo '<div id="banner-advert-container" class="ad-inserter chitika-ad" style="position:absolute; z-index: -10; height: 1px; width: 1px; top: -1px; left: - 1;"><img id="adsense" class="SponsorAds adsense" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></div>';
1452
+ echo "<script type='text/javascript' src='", plugins_url ('includes/js/ads.js?', __FILE__ ), "'></script>\n";
1453
+ echo "<script type='text/javascript' src='", plugins_url ('includes/js/sponsors.js?', __FILE__ ), "'></script>\n";
1454
+ }
1455
  }
1456
+
1457
  }
1458
 
1459
+ $inline_scripts = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE || $ai_wp_data [AI_TRACKING] || $ai_wp_data [AI_STICKY_WIDGETS] || (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION]);
1460
 
1461
  if ($inline_scripts) echo "<script type='text/javascript'>\n";
1462
 
1528
 
1529
  }
1530
 
1531
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1532
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
1533
+ if (!function_exists ('add_footer_inline_scripts_2')) echo ai_adb_replace_vars (ai_adb_code ());
1534
+ }
1535
  }
1536
 
1537
  if (function_exists ('add_footer_inline_scripts_2')) {
1861
  $start_time = microtime (true);
1862
  }
1863
 
1864
+ if (!(defined ('DOING_AJAX') && DOING_AJAX)) {
1865
+ add_footer_inline_scripts ();
1866
+ }
1867
 
1868
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
1869
 
1888
  }
1889
 
1890
  function ai_write_debug_info ($write_processing_log = false) {
1891
+ 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;
1892
 
1893
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
1894
  if (function_exists ('ai_debug_header')) ai_debug_header ();
1900
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
1901
 
1902
  echo "SETTINGS: ";
1903
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']))
1904
+ echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
1905
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1906
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]);
1907
 
1908
  echo "\n";
1909
  echo "SETTINGS TIMESTAMP: ";
1910
+ 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";
1911
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
1912
  if (is_multisite()) {
1913
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
1969
  }
1970
 
1971
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
1972
+ echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_debug_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
1973
  if (function_exists ('ai_debug')) ai_debug ();
1974
  echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
1975
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
2017
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2018
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2019
 
2020
+ echo 'AD BLOCKING DETECTION: ', $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2021
+ if ($block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ()) {
2022
+ echo 'ADB ACTION: ';
2023
+ switch (get_adb_action ()) {
2024
+ case AI_ACTION_NONE:
2025
+ echo AI_TEXT_NONE;
2026
+ break;
2027
+ case AI_ACTION_WARNING_MESSAGE:
2028
+ echo AI_TEXT_WARNING_MESSAGE;
2029
+ break;
2030
+ case AI_ACTION_REDIRECTION:
2031
+ echo AI_TEXT_REDIRECTION;
2032
+ break;
2033
+ }
2034
+ echo "\n";
2035
+ echo 'ADB DELAY ACTION: ', get_delay_action (), "\n";
2036
+ echo 'ADB NO ACTION PERIOD: ', get_no_action_period (), "\n";
2037
+ echo 'ADB SELECTORS: ', get_adb_selectors (), "\n";
2038
+ $redirection_page = get_redirection_page ();
2039
+ echo 'ADB REDIRECTION PAGE: ', $redirection_page != 0 ? get_the_title ($redirection_page) . ' (' . get_permalink ($redirection_page) . ')' : $redirection_page, "\n";
2040
+ echo 'ADB REDIRECTION URL: ', get_custom_redirection_url (), "\n";
2041
+ echo 'ADB MESSAGE: ', $block_object [AI_ADB_MESSAGE_OPTION_NAME]->ai_getCode (), "\n";
2042
+ echo 'ADB MESSAGE CSS: ', get_message_css (), "\n";
2043
+ echo 'ADB OVERLAY CSS: ', get_overlay_css (), "\n";
2044
+ echo 'ADB UNDISMISSIBLE: ', get_undismissible_message () ? 'ON' : 'OFF', "\n";
2045
+ }
2046
 
2047
  echo "\n";
2048
 
2060
  foreach (array_keys ($default->wp_options) as $key){
2061
  switch ($key) {
2062
  case AI_OPTION_CODE:
2063
+ case AI_OPTION_BLOCK_NAME:
2064
  continue 2;
2065
  case AI_OPTION_DISPLAY_ON_PAGES:
2066
  case AI_OPTION_DISPLAY_ON_POSTS:
2092
  $settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
2093
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
2094
  break;
2095
+ case AI_OPTION_FILTER_TYPE:
2096
+ $settings = $settings .= "[" . $key . ": " . $obj->get_filter_type_text () . ']';
2097
+ break;
2098
  default:
2099
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
2100
  break;
2215
  echo $log_line, "\n";
2216
  }
2217
 
2218
+ sort ($block_insertion_log);
2219
+ echo "\nINSERTION SUMMARY\n";
2220
+ echo "======================================\n";
2221
+ foreach ($block_insertion_log as $log_line) {
2222
+ echo substr ($log_line, 3), "\n";
2223
+ }
2224
+ echo "\n\n";
2225
+
2226
  echo "PHP: ", phpversion(), "\n";
2227
+ echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
2228
+ echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
2229
+ echo "Post Max Size: ", ini_get ('post_max_size'), "\n";
2230
+ echo "Max Execution Time: ", ini_get ('max_execution_time'), "\n";
2231
+ echo "Max Input Vars: ", ini_get ('max_input_vars'), "\n";
2232
+ echo "Display Errors: ", ini_get ('display_errors'), "\n";
2233
+ echo "cURL: ", function_exists ('curl_version') ? 'ENABLED' : 'DISABLED', "\n";
2234
+ echo "fsockopen: ", function_exists ('fsockopen') ? 'ENABLED' : 'DISABLED', "\n";
2235
+ echo "\n\n";
2236
+
2237
  global $wp_version;
2238
  echo "Wordpress: ", $wp_version, "\n";
2239
  $current_theme = wp_get_theme();
2252
  echo in_array ($plugin_path, $active_plugins) ? '* ' : ' ', html_entity_decode ($plugin ["Name"]), ' ', $plugin ["Version"], "\n";
2253
  }
2254
  }
2255
+
2256
+
2257
  }
2258
 
2259
  function ai_shutdown_hook () {
2329
 
2330
  if (!isset ($plugin_options ['DYNAMIC_BLOCKS'])) $plugin_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
2331
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
2332
+ if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
2333
+ if (!isset ($plugin_options ['ADB_ACTION'])) $plugin_options ['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
2334
+ if (!isset ($plugin_options ['ADB_DELAY_ACTION'])) $plugin_options ['ADB_DELAY_ACTION'] = '';
2335
+ if (!isset ($plugin_options ['ADB_NO_ACTION_PERIOD'])) $plugin_options ['ADB_NO_ACTION_PERIOD'] = AI_DEFAULT_ADB_NO_ACTION_PERIOD;
2336
+ if (!isset ($plugin_options ['ADB_SELECTORS'])) $plugin_options ['ADB_SELECTORS'] = '';
2337
+ if (!isset ($plugin_options ['ADB_REDIRECTION_PAGE'])) $plugin_options ['ADB_REDIRECTION_PAGE'] = AI_DEFAULT_ADB_REDIRECTION_PAGE;
2338
+ if (!isset ($plugin_options ['ADB_CUSTOM_REDIRECTION_URL'])) $plugin_options ['ADB_CUSTOM_REDIRECTION_URL'] = '';
2339
+ if (!isset ($plugin_options ['ADB_OVERLAY_CSS'])) $plugin_options ['ADB_OVERLAY_CSS'] = AI_DEFAULT_ADB_OVERLAY_CSS;
2340
+ if (!isset ($plugin_options ['ADB_MESSAGE_CSS'])) $plugin_options ['ADB_MESSAGE_CSS'] = AI_DEFAULT_ADB_MESSAGE_CSS;
2341
+ if (!isset ($plugin_options ['ADB_UNDISMISSIBLE_MESSAGE'])) $plugin_options ['ADB_UNDISMISSIBLE_MESSAGE'] = AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE;
2342
  if (!isset ($plugin_options ['ADMIN_TOOLBAR_DEBUGGING'])) $plugin_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
2343
  if (!isset ($plugin_options ['REMOTE_DEBUGGING'])) $plugin_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
2344
  if (!isset ($plugin_options ['JAVASCRIPT_DEBUGGING'])) $plugin_options ['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
2413
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD OPTIONS START");
2414
 
2415
  if (is_multisite()) {
2416
+ $ai_db_options_multisite = get_site_option (AI_OPTION_NAME);
2417
  option_stripslashes ($ai_db_options_multisite);
2418
  }
2419
 
2420
  if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
2421
+ $ai_db_options = get_blog_option (BLOG_ID_CURRENT_SITE, AI_OPTION_NAME);
2422
  option_stripslashes ($ai_db_options);
2423
  } else {
2424
+ $ai_db_options = get_option (AI_OPTION_NAME);
2425
  option_stripslashes ($ai_db_options);
2426
  }
2427
 
2431
  function get_viewport_css () {
2432
  global $ai_db_options;
2433
 
2434
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'])) $ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'] = generate_viewport_css ();
2435
 
2436
+ return ($ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS']);
2437
  }
2438
 
2439
  function get_syntax_highlighter_theme () {
2440
  global $ai_db_options;
2441
 
2442
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME'])) $ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME'] = DEFAULT_SYNTAX_HIGHLIGHTER_THEME;
2443
 
2444
+ return ($ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME']);
2445
  }
2446
 
2447
  function get_block_class_name () {
2448
  global $ai_db_options;
2449
 
2450
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME'])) $ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
2451
 
2452
+ return ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME']);
2453
  }
2454
 
2455
  function get_minimum_user_role () {
2456
  global $ai_db_options;
2457
 
2458
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE'])) $ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2459
 
2460
+ return ($ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE']);
2461
  }
2462
 
2463
  function get_sticky_widget_margin () {
2464
  global $ai_db_options;
2465
 
2466
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN'])) $ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN'] = DEFAULT_STICKY_WIDGET_MARGIN;
2467
 
2468
+ return ($ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN']);
2469
  }
2470
 
2471
  function get_plugin_priority () {
2472
  global $ai_db_options;
2473
 
2474
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY'])) $ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
2475
 
2476
+ return ($ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY']);
2477
  }
2478
 
2479
  function get_dynamic_blocks(){
2480
  global $ai_db_options;
2481
 
2482
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
2483
 
2484
+ return ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS']);
2485
  }
2486
 
2487
  function get_paragraph_counting_functions(){
2488
  global $ai_db_options;
2489
 
2490
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS'])) $ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
2491
 
2492
+ return ($ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS']);
2493
+ }
2494
+
2495
+ function get_no_paragraph_counting_inside () {
2496
+ global $ai_db_options;
2497
+
2498
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE'])) $ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
2499
+
2500
+ return (str_replace (array ('<', '>'), '', $ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE']));
2501
  }
2502
 
2503
  function get_admin_toolbar_debugging () {
2504
  global $ai_db_options;
2505
 
2506
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
2507
 
2508
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING']);
2509
  }
2510
 
2511
  function get_remote_debugging () {
2512
  global $ai_db_options;
2513
 
2514
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
2515
 
2516
+ return ($ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING']);
2517
  }
2518
 
2519
  function get_javascript_debugging () {
2520
  global $ai_db_options;
2521
 
2522
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
2523
 
2524
+ return ($ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING']);
2525
  }
2526
 
2527
  function get_viewport_name ($viewport_number) {
2528
  global $ai_db_options;
2529
 
2530
  $viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
2531
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]))
2532
+ $ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
2533
 
2534
+ return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
2535
  }
2536
 
2537
  function get_viewport_width ($viewport_number) {
2538
  global $ai_db_options;
2539
 
2540
  $viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
2541
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]))
2542
+ $ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
2543
 
2544
+ return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
2545
  }
2546
 
2547
  function get_country_group_name ($group_number) {
2548
  global $ai_db_options;
2549
 
2550
  $country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
2551
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$country_group_settins_name])) $ai_db_options [AI_OPTION_GLOBAL][$country_group_settins_name] = DEFAULT_COUNTRY_GROUP_NAME . ' ' . $group_number;
2552
 
2553
+ return ($ai_db_options [AI_OPTION_GLOBAL][$country_group_settins_name]);
2554
  }
2555
 
2556
  function get_group_country_list ($group_number) {
2557
  global $ai_db_options;
2558
 
2559
  $group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
2560
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name])) $ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name] = '';
2561
 
2562
+ return ($ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name]);
2563
  }
2564
 
2565
  function multisite_settings_page_enabled () {
2629
  return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
2630
  }
2631
 
2632
+ function get_adb_action () {
2633
+ global $ai_db_options;
2634
+
2635
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
2636
+
2637
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION']);
2638
+ }
2639
+
2640
+ function get_delay_action ($return_number = false) {
2641
+ global $ai_db_options;
2642
+
2643
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION'] = '';
2644
+
2645
+ if ($return_number) {
2646
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION']);
2647
+ if ($value == '') $value = 0;
2648
+ if (is_numeric ($value)) return $value; else return 0;
2649
+ }
2650
+
2651
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION']);
2652
+ }
2653
+
2654
+ function get_no_action_period ($return_number = false) {
2655
+ global $ai_db_options;
2656
+
2657
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD'] = AI_DEFAULT_ADB_NO_ACTION_PERIOD;
2658
+
2659
+ if ($return_number) {
2660
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD']);
2661
+ if ($value == '') $value = 0;
2662
+ if (is_numeric ($value)) return $value; else return AI_DEFAULT_ADB_NO_ACTION_PERIOD;
2663
+ }
2664
+
2665
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD']);
2666
+ }
2667
+
2668
+ function get_adb_selectors () {
2669
+ global $ai_db_options;
2670
+
2671
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS'] = '';
2672
+
2673
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS']);
2674
+ }
2675
+
2676
+ function get_redirection_page ($return_number = false) {
2677
+ global $ai_db_options;
2678
+
2679
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE'] = AI_DEFAULT_ADB_REDIRECTION_PAGE;
2680
+
2681
+ if ($return_number) {
2682
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE']);
2683
+ if ($value == '') $value = 0;
2684
+ if (is_numeric ($value)) return $value; else return AI_DEFAULT_ADB_REDIRECTION_PAGE;
2685
+ }
2686
+
2687
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE']);
2688
+ }
2689
+
2690
+ function get_custom_redirection_url () {
2691
+ global $ai_db_options;
2692
+
2693
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL'] = '';
2694
+
2695
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL']);
2696
+ }
2697
+
2698
+ function get_message_css () {
2699
+ global $ai_db_options;
2700
+
2701
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_MESSAGE_CSS'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_MESSAGE_CSS'] = AI_DEFAULT_ADB_MESSAGE_CSS;
2702
+
2703
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_MESSAGE_CSS']);
2704
+ }
2705
+
2706
+ function get_overlay_css () {
2707
+ global $ai_db_options;
2708
+
2709
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_OVERLAY_CSS'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_OVERLAY_CSS'] = AI_DEFAULT_ADB_OVERLAY_CSS;
2710
+
2711
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_OVERLAY_CSS']);
2712
+ }
2713
+
2714
+ function get_undismissible_message () {
2715
+ global $ai_db_options;
2716
+
2717
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_UNDISMISSIBLE_MESSAGE'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_UNDISMISSIBLE_MESSAGE'] = AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE;
2718
+
2719
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_UNDISMISSIBLE_MESSAGE']);
2720
+ }
2721
+
2722
  function filter_html_class ($str){
2723
 
2724
  $str = str_replace (array ("\\\""), array ("\""), $str);
2741
  $value = str_replace (array ("\\\""), array ("\""), $value);
2742
 
2743
  if ($option == AI_OPTION_DOMAIN_LIST ||
2744
+ $option == 'NO_PARAGRAPH_COUNTING_INSIDE' ||
2745
+ $option == 'ADB_SELECTORS' ||
2746
+ $option == AI_OPTION_PARAGRAPH_TAGS ||
2747
  $option == AI_OPTION_IP_ADDRESS_LIST ||
2748
  $option == AI_OPTION_COUNTRY_LIST) {
2749
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]"), "", $value);
2756
  ) {
2757
  $value = esc_html ($value);
2758
  }
2759
+ elseif ($option == AI_OPTION_BLOCK_NAME ||
2760
  $option == AI_OPTION_GENERAL_TAG ||
2761
  $option == AI_OPTION_DOMAIN_LIST ||
2762
  $option == AI_OPTION_CATEGORY_LIST ||
2767
  $option == AI_OPTION_PARAGRAPH_TEXT_TYPE ||
2768
  $option == AI_OPTION_PARAGRAPH_NUMBER ||
2769
  $option == AI_OPTION_MIN_PARAGRAPHS ||
2770
+ $option == AI_OPTION_MIN_WORDS_ABOVE ||
2771
  $option == AI_OPTION_AVOID_PARAGRAPHS_ABOVE ||
2772
  $option == AI_OPTION_AVOID_PARAGRAPHS_BELOW ||
2773
  $option == AI_OPTION_AVOID_TRY_LIMIT ||
2781
  $option == AI_OPTION_END_DATE ||
2782
  $option == AI_OPTION_FALLBACK ||
2783
  $option == AI_OPTION_EXCERPT_NUMBER ||
2784
+ $option == 'ADB_DELAY_ACTION' ||
2785
+ $option == 'ADB_NO_ACTION_PERIOD' ||
2786
+ $option == 'ADB_REDIRECTION_PAGE' ||
2787
+ $option == 'ADB_CUSTOM_REDIRECTION_URL' ||
2788
+ $option == AI_OPTION_CUSTOM_CSS ||
2789
+ $option == 'ADB_OVERLAY_CSS' ||
2790
+ $option == 'ADB_MESSAGE_CSS') {
2791
  $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
2792
  $value = esc_html ($value);
2793
  }
2818
  if (is_numeric ($block) && $block >= 1 && $block <= AD_INSERTER_BLOCKS) {
2819
  generate_code_preview ($block);
2820
  }
2821
+ elseif ($block == 'adb') {
2822
+ generate_code_preview_adb ($block);
2823
+ }
2824
  }
2825
 
2826
  elseif (isset ($_GET ["image"])) {
2830
  }
2831
 
2832
  elseif (isset ($_GET ["rating"])) {
2833
+ $cache_time = $_GET ["rating"] == 'update' ? 5 * 60 : AI_TRANSIENT_RATING_EXPIRATION;
2834
+ if (!get_transient (AI_TRANSIENT_RATING) || !($transient_timeout = get_option ('_transient_timeout_' . AI_TRANSIENT_RATING)) || AI_TRANSIENT_RATING_EXPIRATION - ($transient_timeout - time ()) > $cache_time) {
2835
  if (preg_match_all ("#<span class=\"counter-count\">(.+?)</span>#", file_get_contents ('https://wordpress.org/plugins/ad-inserter/'), $ratings)) {
2836
  if (count ($ratings [1]) == 5) {
2837
  $total_rating = 0;
2841
  $total_count += $count;
2842
  }
2843
  $rating = number_format ($total_rating / $total_count, 4);
2844
+ set_transient (AI_TRANSIENT_RATING, $rating, AI_TRANSIENT_RATING_EXPIRATION);
2845
  }
2846
  }
2847
  }
2848
+ if ($rating = get_transient (AI_TRANSIENT_RATING)) {
 
2849
  if ($rating > 1 && $rating <= 5) echo $rating;
2850
  }
2851
  }
2961
  ai_load_options ();
2962
 
2963
  if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
2964
+ isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
2965
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
2966
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
2967
  isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS]))
2969
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
2970
 
2971
  $obj = new ai_Block (0);
2972
+ $obj->wp_options [AI_OPTION_BLOCK_NAME] = 'Default';
2973
  $block_object [0] = $obj;
2974
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2975
  $obj = new ai_Block ($block);
2981
  $adF = new ai_AdF();
2982
  $adH->load_options (AI_HEADER_OPTION_NAME);
2983
  $adF->load_options (AI_FOOTER_OPTION_NAME);
2984
+ $block_object [AI_HEADER_OPTION_NAME] = $adH;
2985
+ $block_object [AI_FOOTER_OPTION_NAME] = $adF;
2986
+
2987
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
2988
+ $adA = new ai_AdA();
2989
+ $adA->load_options (AI_ADB_MESSAGE_OPTION_NAME);
2990
+ $block_object [AI_ADB_MESSAGE_OPTION_NAME] = $adA;
2991
+ }
2992
 
2993
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS END");
2994
  }
3089
 
3090
  if ($exported_settings !== false) {
3091
  foreach (array_keys ($ad->wp_options) as $key){
3092
+ if ($key == AI_OPTION_BLOCK_NAME && isset ($_POST [$import_name_switch_name]) && $_POST [$import_name_switch_name] != "1") {
3093
  $form_field_name = $key . WP_FORM_FIELD_POSTFIX . $block;
3094
  if (isset ($_POST [$form_field_name])){
3095
  $ad->wp_options [$key] = filter_option ($key, $_POST [$form_field_name]);
3136
  }
3137
  }
3138
 
3139
+ $ai_options [AI_HEADER_OPTION_NAME] = $adH->wp_options;
3140
+ $ai_options [AI_FOOTER_OPTION_NAME] = $adF->wp_options;
3141
+
3142
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
3143
+ $adA = new ai_AdA();
3144
+ foreach(array_keys($adA->wp_options) as $key){
3145
+ $form_field_name = $key . WP_FORM_FIELD_POSTFIX . AI_ADB_MESSAGE_OPTION_NAME;
3146
+ if(isset ($_POST [$form_field_name])){
3147
+ $adA->wp_options [$key] = filter_option_hf ($key, $_POST [$form_field_name]);
3148
+ }
3149
+ }
3150
+ $ai_options [AI_ADB_MESSAGE_OPTION_NAME] = $adA->wp_options;
3151
+ }
3152
 
3153
  $options = array ();
3154
 
3155
  if (function_exists ('ai_filter_global_settings')) ai_filter_global_settings ($options);
3156
 
3157
+ if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
3158
+ if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
3159
+ if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
3160
+ if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('STICKY_WIDGET_MARGIN', $_POST ['sticky-widget-margin']);
3161
+ if (isset ($_POST ['plugin_priority'])) $options ['PLUGIN_PRIORITY'] = filter_option ('PLUGIN_PRIORITY', $_POST ['plugin_priority']);
3162
+ if (isset ($_POST ['dynamic_blocks'])) $options ['DYNAMIC_BLOCKS'] = filter_option ('DYNAMIC_BLOCKS', $_POST ['dynamic_blocks']);
3163
+ if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
3164
+ if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
3165
+ if (isset ($_POST [AI_OPTION_ADB_ACTION])) $options ['ADB_ACTION'] = filter_option ('ADB_ACTION', $_POST [AI_OPTION_ADB_ACTION]);
3166
+ if (isset ($_POST [AI_OPTION_ADB_DELAY_ACTION])) $options ['ADB_DELAY_ACTION'] = filter_option ('ADB_DELAY_ACTION', $_POST [AI_OPTION_ADB_DELAY_ACTION]);
3167
+ if (isset ($_POST [AI_OPTION_ADB_NO_ACTION_PERIOD])) $options ['ADB_NO_ACTION_PERIOD'] = filter_option ('ADB_NO_ACTION_PERIOD', $_POST [AI_OPTION_ADB_NO_ACTION_PERIOD]);
3168
+ if (isset ($_POST [AI_OPTION_ADB_SELECTORS])) $options ['ADB_SELECTORS'] = filter_option ('ADB_SELECTORS', $_POST [AI_OPTION_ADB_SELECTORS]);
3169
+ if (isset ($_POST [AI_OPTION_ADB_REDIRECTION_PAGE])) $options ['ADB_REDIRECTION_PAGE'] = filter_option ('ADB_REDIRECTION_PAGE', $_POST [AI_OPTION_ADB_REDIRECTION_PAGE]);
3170
+ if (isset ($_POST [AI_OPTION_ADB_CUSTOM_REDIRECTION_URL])) $options ['ADB_CUSTOM_REDIRECTION_URL'] = filter_option ('ADB_CUSTOM_REDIRECTION_URL', $_POST [AI_OPTION_ADB_CUSTOM_REDIRECTION_URL]);
3171
+ if (isset ($_POST [AI_OPTION_ADB_MESSAGE_CSS])) $options ['ADB_MESSAGE_CSS'] = filter_option ('ADB_MESSAGE_CSS', $_POST [AI_OPTION_ADB_MESSAGE_CSS]);
3172
+ if (isset ($_POST [AI_OPTION_ADB_OVERLAY_CSS])) $options ['ADB_OVERLAY_CSS'] = filter_option ('ADB_OVERLAY_CSS', $_POST [AI_OPTION_ADB_OVERLAY_CSS]);
3173
+ if (isset ($_POST [AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE])) $options ['ADB_UNDISMISSIBLE_MESSAGE'] = filter_option ('ADB_UNDISMISSIBLE_MESSAGE', $_POST [AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE]);
3174
+ if (isset ($_POST ['admin_toolbar_debugging'])) $options ['ADMIN_TOOLBAR_DEBUGGING'] = filter_option ('ADMIN_TOOLBAR_DEBUGGING', $_POST ['admin_toolbar_debugging']);
3175
+ if (isset ($_POST ['remote_debugging'])) $options ['REMOTE_DEBUGGING'] = filter_option ('REMOTE_DEBUGGING', $_POST ['remote_debugging']);
3176
+ if (isset ($_POST ['javascript_debugging'])) $options ['JAVASCRIPT_DEBUGGING'] = filter_option ('JAVASCRIPT_DEBUGGING', $_POST ['javascript_debugging']);
3177
 
3178
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
3179
  if (isset ($_POST ['viewport-name-'.$viewport]))
3184
 
3185
  $options ['VIEWPORT_CSS'] = generate_viewport_css ();
3186
 
3187
+ $ai_options [AI_OPTION_GLOBAL] = ai_check_plugin_options ($options);
3188
  }
3189
 
3190
  if (!empty ($invalid_blocks)) {
3196
  // Generate and save extract
3197
  $ai_options [AI_EXTRACT_OPTION_NAME] = ai_generate_extract ($ai_options);
3198
 
3199
+ $ai_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
3200
 
3201
+ update_option (AI_OPTION_NAME, $ai_options);
3202
 
3203
  // Multisite
3204
  if (is_multisite () && is_main_site ()) {
3207
  if (function_exists ('ai_filter_multisite_settings')) ai_filter_multisite_settings ($options);
3208
 
3209
  ai_check_multisite_options ($options);
3210
+ update_site_option (AI_OPTION_NAME, $options);
3211
  }
3212
 
3213
  ai_load_settings ();
3232
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
3233
  delete_option (AD_OPTIONS);
3234
 
3235
+ delete_option (AI_OPTION_NAME);
3236
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
3237
  if (is_multisite () && is_main_site ()) {
3238
+ delete_site_option (AI_OPTION_NAME, $options);
3239
  }
3240
 
3241
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
3426
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
3427
  $globals_name = AI_CONTENT_COUNTER_NAME;
3428
 
3429
+ $special_element_tags = explode (',', str_replace (' ', '', get_no_paragraph_counting_inside ()));
3430
 
3431
  if (!isset ($ad_inserter_globals [$globals_name])) {
3432
  $ad_inserter_globals [$globals_name] = 1;
class.php CHANGED
@@ -90,7 +90,7 @@ abstract class ai_BaseCodeBlock {
90
 
91
  $old_name = "ad" . $block . "_name";
92
  if (isset ($options [$old_name])) {
93
- $options [AI_OPTION_NAME] = $options [$old_name];
94
  unset ($options [$old_name]);
95
  }
96
  $old_name = "ad" . $block . "_displayType";
@@ -364,11 +364,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
364
 
365
  parent::__construct();
366
 
367
- $this->wp_options [AI_OPTION_NAME] = AD_NAME;
368
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
369
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
370
  $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
371
  $this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
 
372
  $this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
373
  $this->wp_options [AI_OPTION_MAX_WORDS] = AD_EMPTY_DATA;
374
  $this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS] = AD_EMPTY_DATA;
@@ -383,7 +384,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
383
  $this->wp_options [AI_OPTION_AVOID_TRY_LIMIT] = AD_ONE;
384
  $this->wp_options [AI_OPTION_AVOID_DIRECTION] = AD_BELOW_AND_THEN_ABOVE;
385
  $this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
386
- $this->wp_options [AI_OPTION_FILTER_TYPE] = AI_OPTION_FILTER_AUTO;
 
387
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
388
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
389
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
@@ -639,6 +641,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
639
  return $option;
640
  }
641
 
 
 
 
 
 
642
  public function get_minimum_words(){
643
  $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS]) ? $this->wp_options [AI_OPTION_MIN_WORDS] : "";
644
  return $option;
@@ -651,7 +658,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
651
 
652
  public function get_paragraph_tags(){
653
  $option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
654
- return $option;
655
  }
656
 
657
  public function get_minimum_paragraph_words(){
@@ -711,13 +718,73 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
711
  public function get_call_filter(){
712
  $option = isset ($this->wp_options [AI_OPTION_EXCERPT_NUMBER]) ? $this->wp_options [AI_OPTION_EXCERPT_NUMBER] : "";
713
  return $option;
714
- }
715
 
716
  public function get_filter_type(){
717
- $option = isset ($this->wp_options [AI_OPTION_FILTER_TYPE]) ? $this->wp_options [AI_OPTION_FILTER_TYPE] : "";
718
- if ($option == '') $option = AI_OPTION_FILTER_AUTO;
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  return $option;
720
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
 
722
  public function get_direction_type(){
723
  $option = isset ($this->wp_options [AI_OPTION_DIRECTION_TYPE]) ? $this->wp_options [AI_OPTION_DIRECTION_TYPE] : "";
@@ -743,7 +810,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
743
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] : "";
744
  if ($option == '') $option = AI_DISABLED;
745
 
746
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
747
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
748
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
749
  } else $automatic_insertion = '';
@@ -764,7 +831,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
764
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES] : "";
765
  if ($option == '') $option = AI_DISABLED;
766
 
767
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
768
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
769
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
770
  } else $automatic_insertion = '';
@@ -785,7 +852,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
785
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES] : "";
786
  if ($option == '') $option = AI_DISABLED;
787
 
788
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
789
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
790
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
791
  } else $automatic_insertion = '';
@@ -806,7 +873,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
806
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES] : "";
807
  if ($option == '') $option = AI_DISABLED;
808
 
809
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
810
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
811
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
812
  } else $automatic_insertion = '';
@@ -873,7 +940,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
873
  $option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
874
 
875
  // Fix for old bug
876
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && strpos ($option, "Undefined index")) $option = "";
877
 
878
  return $option;
879
  }
@@ -896,7 +963,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
896
 
897
  $option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AI_DISABLED;
898
 
899
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
900
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
901
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
902
  } else $display_for_devices = '';
@@ -913,7 +980,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
913
  $option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
914
  $option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AI_DISABLED;
915
 
916
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && $this->get_detection_client_side()) {
917
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
918
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
919
  } else $display_for_devices = '';
@@ -1237,7 +1304,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1237
  }
1238
 
1239
  public function get_ad_name(){
1240
- $option = isset ($this->wp_options [AI_OPTION_NAME]) ? $this->wp_options [AI_OPTION_NAME] : "";
1241
  if ($option == '') $option = AD_NAME. " " . $this->number;
1242
  return $option;
1243
  }
@@ -1581,6 +1648,42 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1581
  foreach ($paragraph_positions as $index => $paragraph_position) {
1582
  $positions []= $index + 1;
1583
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  }
1585
  }
1586
 
@@ -1732,12 +1835,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1732
 
1733
  if ($position_preview || !empty ($positions)) {
1734
  $offset = 0;
1735
- $code_for_insertion = $this->get_code_for_insertion ();
1736
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
1737
 
1738
  foreach ($paragraph_positions as $counter => $paragraph_position) {
1739
  if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
1740
- elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
1741
  else continue;
1742
 
1743
  if ($multibyte) {
@@ -2003,10 +2109,64 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2003
  }
2004
  }
2005
  elseif ($position == '') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2006
  foreach ($paragraph_positions as $index => $paragraph_position) {
2007
  $positions []= $index + 1;
2008
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2009
  }
 
2010
  }
2011
 
2012
  if (empty ($positions)) {
@@ -2159,12 +2319,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2159
 
2160
  if ($position_preview || !empty ($positions)) {
2161
  $offset = 0;
2162
- $code_for_insertion = $this->get_code_for_insertion ();
2163
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
2164
 
2165
  foreach ($paragraph_positions as $counter => $paragraph_position) {
2166
  if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
2167
- elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
2168
  else continue;
2169
 
2170
  if ($multibyte) {
@@ -2750,46 +2913,51 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2750
  function check_filter ($counter_for_filter) {
2751
  global $ai_last_check, $ad_inserter_globals, $page;
2752
 
 
 
2753
  $ai_last_check = AI_CHECK_FILTER;
2754
- $filter_settings = trim ($this->get_call_filter());
2755
- if ($filter_settings == 0 || $filter_settings == '') return true;
2756
 
2757
  switch ($this->get_filter_type ()) {
2758
- case AI_OPTION_FILTER_PHP_FUNCTION_CALLS:
2759
  if (isset ($ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]))
2760
- $counter_for_filter = $ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]; else return false;
2761
  break;
2762
- case AI_OPTION_FILTER_CONTENT_PROCESSING:
2763
  if (isset ($ad_inserter_globals [AI_CONTENT_COUNTER_NAME]))
2764
- $counter_for_filter = $ad_inserter_globals [AI_CONTENT_COUNTER_NAME]; else return false;
2765
  break;
2766
- case AI_OPTION_FILTER_EXCERPT_PROCESSING:
2767
  if (isset ($ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]))
2768
- $counter_for_filter = $ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]; else return false;
2769
  break;
2770
- case AI_OPTION_FILTER_BEFORE_POST_PROCESSING:
2771
  if (isset ($ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]))
2772
- $counter_for_filter = $ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]; else return false;
2773
  break;
2774
- case AI_OPTION_FILTER_AFTER_POST_PROCESSING:
2775
  if (isset ($ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]))
2776
- $counter_for_filter = $ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]; else return false;
2777
  break;
2778
- case AI_OPTION_FILTER_WIDGET_DRAWING:
2779
  if (isset ($ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]))
2780
- $counter_for_filter = $ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]; else return false;
2781
  break;
2782
- case AI_OPTION_FILTER_SUBPAGES:
2783
  if (isset ($page))
2784
- $counter_for_filter = $page; else return false;
2785
  break;
2786
- case AI_OPTION_FILTER_POSTS:
2787
  if (isset ($ad_inserter_globals [AI_POST_COUNTER_NAME]))
2788
- $counter_for_filter = $ad_inserter_globals [AI_POST_COUNTER_NAME]; else return false;
2789
  break;
2790
- case AI_OPTION_FILTER_COMMENTS:
 
 
 
2791
  if (isset ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME]))
2792
- $counter_for_filter = $ad_inserter_globals [AI_COMMENT_COUNTER_NAME]; else return false;
2793
  break;
2794
  }
2795
 
@@ -2798,7 +2966,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2798
  $filter_values = explode (",", $filter_settings);
2799
  } else $filter_values []= $filter_settings;
2800
 
2801
- return in_array ($counter_for_filter, $filter_values);
 
 
 
 
 
 
 
 
 
 
2802
  }
2803
 
2804
  function check_and_increment_block_counter () {
@@ -2817,7 +2995,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2817
  }
2818
 
2819
  function check_block_counter () {
2820
- global $ad_inserter_globals;
2821
 
2822
  $global_name = AI_BLOCK_COUNTER_NAME . $this->number;
2823
  $max_insertions = intval ($this->get_maximum_insertions ());
@@ -3020,7 +3198,7 @@ class ai_Block extends ai_CodeBlock {
3020
  parent::__construct();
3021
 
3022
  $this->number = $number;
3023
- $this->wp_options [AI_OPTION_NAME] = AD_NAME." ".$number;
3024
  }
3025
  }
3026
 
@@ -3038,6 +3216,15 @@ class ai_AdF extends ai_BaseCodeBlock {
3038
  }
3039
  }
3040
 
 
 
 
 
 
 
 
 
 
3041
  class ai_Walker_Comment extends Walker_Comment {
3042
 
3043
  public function comment_callback ($comment, $args, $depth) {
90
 
91
  $old_name = "ad" . $block . "_name";
92
  if (isset ($options [$old_name])) {
93
+ $options [AI_OPTION_BLOCK_NAME] = $options [$old_name];
94
  unset ($options [$old_name]);
95
  }
96
  $old_name = "ad" . $block . "_displayType";
364
 
365
  parent::__construct();
366
 
367
+ $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME;
368
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
369
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
370
  $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
371
  $this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
372
+ $this->wp_options [AI_OPTION_MIN_WORDS_ABOVE] = AD_EMPTY_DATA;
373
  $this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
374
  $this->wp_options [AI_OPTION_MAX_WORDS] = AD_EMPTY_DATA;
375
  $this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS] = AD_EMPTY_DATA;
384
  $this->wp_options [AI_OPTION_AVOID_TRY_LIMIT] = AD_ONE;
385
  $this->wp_options [AI_OPTION_AVOID_DIRECTION] = AD_BELOW_AND_THEN_ABOVE;
386
  $this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
387
+ $this->wp_options [AI_OPTION_FILTER_TYPE] = AI_FILTER_AUTO;
388
+ $this->wp_options [AI_OPTION_INVERTED_FILTER] = AI_DISABLED;
389
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
390
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
391
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
641
  return $option;
642
  }
643
 
644
+ public function get_minimum_words_above (){
645
+ $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS_ABOVE]) ? $this->wp_options [AI_OPTION_MIN_WORDS_ABOVE] : "";
646
+ return $option;
647
+ }
648
+
649
  public function get_minimum_words(){
650
  $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS]) ? $this->wp_options [AI_OPTION_MIN_WORDS] : "";
651
  return $option;
658
 
659
  public function get_paragraph_tags(){
660
  $option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
661
+ return str_replace (array ('<', '>'), '', $option);
662
  }
663
 
664
  public function get_minimum_paragraph_words(){
718
  public function get_call_filter(){
719
  $option = isset ($this->wp_options [AI_OPTION_EXCERPT_NUMBER]) ? $this->wp_options [AI_OPTION_EXCERPT_NUMBER] : "";
720
  return $option;
721
+ }
722
 
723
  public function get_filter_type(){
724
+ $option = isset ($this->wp_options [AI_OPTION_FILTER_TYPE]) ? $this->wp_options [AI_OPTION_FILTER_TYPE] : AI_FILTER_AUTO;
725
+
726
+ if ($option == '') $option = AI_FILTER_AUTO;
727
+
728
+ elseif ($option == AI_OPTION_FILTER_AUTO) $option = AI_FILTER_AUTO;
729
+ elseif ($option == AI_OPTION_FILTER_PHP_FUNCTION_CALLS) $option = AI_FILTER_PHP_FUNCTION_CALLS;
730
+ elseif ($option == AI_OPTION_FILTER_CONTENT_PROCESSING) $option = AI_FILTER_CONTENT_PROCESSING;
731
+ elseif ($option == AI_OPTION_FILTER_EXCERPT_PROCESSING) $option = AI_FILTER_EXCERPT_PROCESSING;
732
+ elseif ($option == AI_OPTION_FILTER_BEFORE_POST_PROCESSING) $option = AI_FILTER_BEFORE_POST_PROCESSING;
733
+ elseif ($option == AI_OPTION_FILTER_AFTER_POST_PROCESSING) $option = AI_FILTER_AFTER_POST_PROCESSING;
734
+ elseif ($option == AI_OPTION_FILTER_WIDGET_DRAWING) $option = AI_FILTER_WIDGET_DRAWING;
735
+ elseif ($option == AI_OPTION_FILTER_SUBPAGES) $option = AI_FILTER_SUBPAGES;
736
+ elseif ($option == AI_OPTION_FILTER_POSTS) $option = AI_FILTER_POSTS;
737
+ elseif ($option == AI_OPTION_FILTER_COMMENTS) $option = AI_FILTER_COMMENTS;
738
+
739
  return $option;
740
+ }
741
+
742
+ public function get_filter_type_text (){
743
+ switch ($this->get_filter_type()) {
744
+ case AI_FILTER_AUTO:
745
+ return AI_TEXT_AUTO;
746
+ break;
747
+ case AI_FILTER_PHP_FUNCTION_CALLS:
748
+ return AI_TEXT_PHP_FUNCTION_CALLS;
749
+ break;
750
+ case AI_FILTER_CONTENT_PROCESSING:
751
+ return AI_TEXT_CONTENT_PROCESSING;
752
+ break;
753
+ case AI_FILTER_EXCERPT_PROCESSING:
754
+ return AI_TEXT_EXCERPT_PROCESSING;
755
+ break;
756
+ case AI_FILTER_BEFORE_POST_PROCESSING:
757
+ return AI_TEXT_BEFORE_POST_PROCESSING;
758
+ break;
759
+ case AI_FILTER_AFTER_POST_PROCESSING:
760
+ return AI_TEXT_AFTER_POST_PROCESSING;
761
+ break;
762
+ case AI_FILTER_WIDGET_DRAWING:
763
+ return AI_TEXT_WIDGET_DRAWING;
764
+ break;
765
+ case AI_FILTER_SUBPAGES:
766
+ return AI_TEXT_SUBPAGES;
767
+ break;
768
+ case AI_FILTER_POSTS:
769
+ return AI_TEXT_POSTS;
770
+ break;
771
+ case AI_FILTER_PARAGRAPHS:
772
+ return AI_TEXT_PARAGRAPHS;
773
+ break;
774
+ case AI_FILTER_COMMENTS:
775
+ return AI_TEXT_COMMENTS;
776
+ break;
777
+ default:
778
+ return '';
779
+ break;
780
+ }
781
+ }
782
+
783
+ public function get_inverted_filter (){
784
+ $inverted_filter = isset ($this->wp_options [AI_OPTION_INVERTED_FILTER]) ? $this->wp_options [AI_OPTION_INVERTED_FILTER] : AI_DISABLED;
785
+ if ($inverted_filter == '') $inverted_filter = AI_DISABLED;
786
+ return $inverted_filter;
787
+ }
788
 
789
  public function get_direction_type(){
790
  $option = isset ($this->wp_options [AI_OPTION_DIRECTION_TYPE]) ? $this->wp_options [AI_OPTION_DIRECTION_TYPE] : "";
810
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] : "";
811
  if ($option == '') $option = AI_DISABLED;
812
 
813
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
814
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
815
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
816
  } else $automatic_insertion = '';
831
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES] : "";
832
  if ($option == '') $option = AI_DISABLED;
833
 
834
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
835
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
836
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
837
  } else $automatic_insertion = '';
852
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES] : "";
853
  if ($option == '') $option = AI_DISABLED;
854
 
855
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
856
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
857
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
858
  } else $automatic_insertion = '';
873
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES] : "";
874
  if ($option == '') $option = AI_DISABLED;
875
 
876
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
877
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
878
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
879
  } else $automatic_insertion = '';
940
  $option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
941
 
942
  // Fix for old bug
943
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605' && strpos ($option, "Undefined index")) $option = "";
944
 
945
  return $option;
946
  }
963
 
964
  $option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AI_DISABLED;
965
 
966
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
967
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
968
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
969
  } else $display_for_devices = '';
980
  $option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
981
  $option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AI_DISABLED;
982
 
983
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605' && $this->get_detection_client_side()) {
984
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
985
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
986
  } else $display_for_devices = '';
1304
  }
1305
 
1306
  public function get_ad_name(){
1307
+ $option = isset ($this->wp_options [AI_OPTION_BLOCK_NAME]) ? $this->wp_options [AI_OPTION_BLOCK_NAME] : "";
1308
  if ($option == '') $option = AD_NAME. " " . $this->number;
1309
  return $option;
1310
  }
1648
  foreach ($paragraph_positions as $index => $paragraph_position) {
1649
  $positions []= $index + 1;
1650
  }
1651
+
1652
+ if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
1653
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
1654
+ if (!empty ($filter_settings)) {
1655
+
1656
+ $filter_values = array ();
1657
+ if (strpos ($filter_settings, ",") !== false) {
1658
+ $filter_values = explode (",", $filter_settings);
1659
+ } else $filter_values []= $filter_settings;
1660
+
1661
+ $inverted_filter = $this->get_inverted_filter();
1662
+ $filtered_positions = array ();
1663
+
1664
+
1665
+ foreach ($positions as $index => $position) {
1666
+ $insert = false;
1667
+ if (in_array ($index + 1, $filter_values)) {
1668
+ $insert = true;
1669
+ } else {
1670
+ foreach ($filter_values as $filter_value) {
1671
+ $filter_value = trim ($filter_value);
1672
+ if ($filter_value [0] == '%') {
1673
+ $mod_value = substr ($filter_value, 1);
1674
+ if (is_numeric ($mod_value) && $mod_value > 0) {
1675
+ if (($index + 1) % $mod_value == 0) $insert = true;
1676
+ break;
1677
+ }
1678
+ }
1679
+ }
1680
+ }
1681
+ if ($insert xor $inverted_filter) $filtered_positions []= $position;
1682
+ }
1683
+ $positions = $filtered_positions;
1684
+ } else $positions = array ();
1685
+ }
1686
+
1687
  }
1688
  }
1689
 
1835
 
1836
  if ($position_preview || !empty ($positions)) {
1837
  $offset = 0;
 
1838
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
1839
 
1840
  foreach ($paragraph_positions as $counter => $paragraph_position) {
1841
  if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
1842
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
1843
+ $this->increment_block_counter ();
1844
+ $inserted_code = $this->get_code_for_insertion ();
1845
+ $ai_last_check = AI_CHECK_INSERTED;
1846
+ }
1847
  else continue;
1848
 
1849
  if ($multibyte) {
2109
  }
2110
  }
2111
  elseif ($position == '') {
2112
+
2113
+ $min_words_above = $this->get_minimum_words_above ();
2114
+ if (!empty ($min_words_above)) {
2115
+ $words_above = 0;
2116
+ foreach ($paragraph_positions as $index => $paragraph_position) {
2117
+
2118
+ if ($multibyte) {
2119
+ $paragraph_code = $index == 0 ? mb_substr ($content, 0, $paragraph_position + 1) : mb_substr ($content, $paragraph_positions [$index - 1] + 1, $paragraph_position - $paragraph_positions [$index - 1]);
2120
+ } else {
2121
+ $paragraph_code = $index == 0 ? substr ($content, 0, $paragraph_position + 1) : substr ($content, $paragraph_positions [$index - 1] + 1, $paragraph_position - $paragraph_positions [$index - 1]);
2122
+ }
2123
+
2124
+ $words_above += number_of_words ($paragraph_code);
2125
+ if ($words_above >= $min_words_above) {
2126
+ $positions []= $index + 1;
2127
+ $words_above = 0;
2128
+ }
2129
+
2130
+ }
2131
+ } else
2132
  foreach ($paragraph_positions as $index => $paragraph_position) {
2133
  $positions []= $index + 1;
2134
  }
2135
+
2136
+ if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
2137
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
2138
+ if (!empty ($filter_settings)) {
2139
+ $filter_values = array ();
2140
+ if (strpos ($filter_settings, ",") !== false) {
2141
+ $filter_values = explode (",", $filter_settings);
2142
+ } else $filter_values []= $filter_settings;
2143
+
2144
+ $inverted_filter = $this->get_inverted_filter();
2145
+ $filtered_positions = array ();
2146
+
2147
+ foreach ($positions as $index => $position) {
2148
+ $insert = false;
2149
+ if (in_array ($index + 1, $filter_values)) {
2150
+ $insert = true;
2151
+ } else {
2152
+ foreach ($filter_values as $filter_value) {
2153
+ $filter_value = trim ($filter_value);
2154
+ if ($filter_value [0] == '%') {
2155
+ $mod_value = substr ($filter_value, 1);
2156
+ if (is_numeric ($mod_value) && $mod_value > 0) {
2157
+ if (($index + 1) % $mod_value == 0) $insert = true;
2158
+ }
2159
+ }
2160
+ }
2161
+ }
2162
+ if ($insert xor $inverted_filter) $filtered_positions []= $position;
2163
+ }
2164
+ $positions = $filtered_positions;
2165
+ } else $positions = array ();
2166
+ }
2167
+
2168
  }
2169
+
2170
  }
2171
 
2172
  if (empty ($positions)) {
2319
 
2320
  if ($position_preview || !empty ($positions)) {
2321
  $offset = 0;
 
2322
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
2323
 
2324
  foreach ($paragraph_positions as $counter => $paragraph_position) {
2325
  if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
2326
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
2327
+ $this->increment_block_counter ();
2328
+ $inserted_code = $this->get_code_for_insertion ();
2329
+ $ai_last_check = AI_CHECK_INSERTED;
2330
+ }
2331
  else continue;
2332
 
2333
  if ($multibyte) {
2913
  function check_filter ($counter_for_filter) {
2914
  global $ai_last_check, $ad_inserter_globals, $page;
2915
 
2916
+ $filter_ok = $this->get_inverted_filter() ? false : true;
2917
+
2918
  $ai_last_check = AI_CHECK_FILTER;
2919
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
2920
+ if (empty ($filter_settings)) return $filter_ok;
2921
 
2922
  switch ($this->get_filter_type ()) {
2923
+ case AI_FILTER_PHP_FUNCTION_CALLS:
2924
  if (isset ($ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]))
2925
+ $counter_for_filter = $ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]; else return !$filter_ok;
2926
  break;
2927
+ case AI_FILTER_CONTENT_PROCESSING:
2928
  if (isset ($ad_inserter_globals [AI_CONTENT_COUNTER_NAME]))
2929
+ $counter_for_filter = $ad_inserter_globals [AI_CONTENT_COUNTER_NAME]; else return !$filter_ok;
2930
  break;
2931
+ case AI_FILTER_EXCERPT_PROCESSING:
2932
  if (isset ($ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]))
2933
+ $counter_for_filter = $ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]; else return !$filter_ok;
2934
  break;
2935
+ case AI_FILTER_BEFORE_POST_PROCESSING:
2936
  if (isset ($ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]))
2937
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]; else return !$filter_ok;
2938
  break;
2939
+ case AI_FILTER_AFTER_POST_PROCESSING:
2940
  if (isset ($ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]))
2941
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]; else return !$filter_ok;
2942
  break;
2943
+ case AI_FILTER_WIDGET_DRAWING:
2944
  if (isset ($ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]))
2945
+ $counter_for_filter = $ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]; else return !$filter_ok;
2946
  break;
2947
+ case AI_FILTER_SUBPAGES:
2948
  if (isset ($page))
2949
+ $counter_for_filter = $page; else return !$filter_ok;
2950
  break;
2951
+ case AI_FILTER_POSTS:
2952
  if (isset ($ad_inserter_globals [AI_POST_COUNTER_NAME]))
2953
+ $counter_for_filter = $ad_inserter_globals [AI_POST_COUNTER_NAME]; else return !$filter_ok;
2954
  break;
2955
+ case AI_FILTER_PARAGRAPHS:
2956
+ return true;
2957
+ break;
2958
+ case AI_FILTER_COMMENTS:
2959
  if (isset ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME]))
2960
+ $counter_for_filter = $ad_inserter_globals [AI_COMMENT_COUNTER_NAME]; else return !$filter_ok;
2961
  break;
2962
  }
2963
 
2966
  $filter_values = explode (",", $filter_settings);
2967
  } else $filter_values []= $filter_settings;
2968
 
2969
+ foreach ($filter_values as $filter_value) {
2970
+ $filter_value = trim ($filter_value);
2971
+ if ($filter_value [0] == '%') {
2972
+ $mod_value = substr ($filter_value, 1);
2973
+ if (is_numeric ($mod_value) && $mod_value > 0) {
2974
+ if ($counter_for_filter % $mod_value == 0) return $filter_ok;
2975
+ }
2976
+ }
2977
+ }
2978
+
2979
+ return in_array ($counter_for_filter, $filter_values) xor !$filter_ok;
2980
  }
2981
 
2982
  function check_and_increment_block_counter () {
2995
  }
2996
 
2997
  function check_block_counter () {
2998
+ global $ad_inserter_globals, $ai_last_check;
2999
 
3000
  $global_name = AI_BLOCK_COUNTER_NAME . $this->number;
3001
  $max_insertions = intval ($this->get_maximum_insertions ());
3198
  parent::__construct();
3199
 
3200
  $this->number = $number;
3201
+ $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$number;
3202
  }
3203
  }
3204
 
3216
  }
3217
  }
3218
 
3219
+ class ai_AdA extends ai_BaseCodeBlock {
3220
+
3221
+ public function __construct () {
3222
+ parent::__construct();
3223
+
3224
+ $this->wp_options [AI_OPTION_CODE] = AI_DEFAULT_ADB_MESSAGE;
3225
+ }
3226
+ }
3227
+
3228
  class ai_Walker_Comment extends Walker_Comment {
3229
 
3230
  public function comment_callback ($comment, $args, $depth) {
constants.php CHANGED
@@ -1,7 +1,10 @@
1
  <?php
2
 
3
- define ('WP_OPTION_NAME', 'ad_inserter');
4
- define ('AI_GLOBAL_OPTION_NAME', 'global');
 
 
 
5
 
6
  if (!defined ('AD_INSERTER_PLUGIN_DIR'))
7
  define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
@@ -14,7 +17,7 @@ if (!defined( 'AD_INSERTER_NAME'))
14
  define ('AD_INSERTER_NAME', 'Ad Inserter');
15
 
16
  if (!defined( 'AD_INSERTER_VERSION'))
17
- define ('AD_INSERTER_VERSION', '2.1.11');
18
 
19
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
20
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -44,6 +47,7 @@ define ('AI_EXTRACT_OPTION_NAME', 'extract');
44
  define ('WP_FORM_FIELD_POSTFIX', '_block_');
45
  define ('AI_HEADER_OPTION_NAME', 'h');
46
  define ('AI_FOOTER_OPTION_NAME', 'f');
 
47
 
48
  define ('AI_OPTION_CODE', 'code');
49
  define ('AI_OPTION_ENABLE_MANUAL', 'enable_manual');
@@ -53,10 +57,11 @@ define ('AI_OPTION_TRACKING', 'tracking');
53
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
54
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
55
  define ('AI_OPTION_ENABLE_404', 'enable_404');
56
- define ('AI_OPTION_NAME', 'name');
57
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
58
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
59
  define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
 
60
  define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
61
  define ('AI_OPTION_MIN_WORDS', 'min_words');
62
  define ('AI_OPTION_MAX_WORDS', 'max_words');
@@ -72,6 +77,7 @@ define ('AI_OPTION_AVOID_TRY_LIMIT', 'avoid_try_limit');
72
  define ('AI_OPTION_AVOID_DIRECTION', 'avoid_direction');
73
  define ('AI_OPTION_EXCERPT_NUMBER', 'excerpt_number'); // needs to be renamed
74
  define ('AI_OPTION_FILTER_TYPE', 'filter_type');
 
75
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
76
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
77
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
@@ -116,12 +122,23 @@ define ('AI_OPTION_DISPLAY_FOR_DEVICES', 'display_for_devices');
116
  define ('AI_OPTION_DETECT_SERVER_SIDE', 'detect_server_side');
117
  define ('AI_OPTION_DETECT_CLIENT_SIDE', 'detect_client_side');
118
  define ('AI_OPTION_DETECT_VIEWPORT', 'detect_viewport');
 
119
  define ('AI_OPTION_DISABLED', 'disabled');
120
 
121
  define ('AI_OPTION_IMPORT', 'import');
122
  define ('AI_OPTION_IMPORT_NAME', 'import_name');
123
  define ('AI_OPTION_PLUGIN_STATUS', 'plugin_status');
124
 
 
 
 
 
 
 
 
 
 
 
125
  //misc
126
  define('AD_EMPTY_VALUE','');
127
 
@@ -255,7 +272,7 @@ define('AI_ALIGNMENT_CSS_STICKY_BOTTOM', 'position: fixed; bottom: 0; left: 0;
255
  define('AD_BLACK_LIST','Black List');
256
  define('AD_WHITE_LIST','White List');
257
 
258
- //Filter Type
259
  define ('AI_OPTION_FILTER_AUTO', 'Auto');
260
  define ('AI_OPTION_FILTER_PHP_FUNCTION_CALLS', 'PHP function calls');
261
  define ('AI_OPTION_FILTER_CONTENT_PROCESSING', 'Content processing');
@@ -267,6 +284,35 @@ define ('AI_OPTION_FILTER_SUBPAGES', 'Subpages');
267
  define ('AI_OPTION_FILTER_POSTS', 'Posts');
268
  define ('AI_OPTION_FILTER_COMMENTS', 'Comments');
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  //Counter names
271
  define ('AI_BLOCK_COUNTER_NAME', 'AI_BLOCK_COUNTER_');
272
  define ('AI_PHP_FUNCTION_CALL_COUNTER_NAME', 'AI_PHP_FUNCTION_CALL_COUNTER_');
@@ -322,27 +368,41 @@ define('AI_TRACKING_INTERNAL', 1);
322
 
323
  define('AI_TRACKING_ENABLED', 1);
324
 
 
 
 
 
 
 
 
 
 
325
  // Click detection
326
- define('AI_CLICK_DETECTION_STANDARD', 0);
327
- define('AI_CLICK_DETECTION_ADVANCED', 1);
328
 
329
- define('AI_TEXT_INTERNAL', 'Internal');
330
- define('AI_TEXT_ADVANCED', 'Advanced');
331
- define('AI_TEXT_ENABLED', 'Enabled');
332
 
333
  //Settings
334
- define('AI_ENABLED', '1');
335
- define('AI_DISABLED', '0');
 
 
336
 
337
- define('AI_COOKIE_TIME', 3600);
 
338
 
339
- define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
 
340
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
341
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
342
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
343
  define ('DEFAULT_PLUGIN_PRIORITY', 99999);
344
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
345
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
 
346
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
347
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
348
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
@@ -356,6 +416,18 @@ define ('DEFAULT_TRACKING', AI_TRACKING_DISABLED);
356
  define ('DEFAULT_TRACKING_LOGGED_IN', AI_TRACKING_ENABLED);
357
  define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
358
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  define ('DEFAULT_VIEWPORT_NAME_1', "Desktop");
360
  define ('DEFAULT_VIEWPORT_NAME_2', "Tablet");
361
  define ('DEFAULT_VIEWPORT_NAME_3', "Phone");
@@ -464,6 +536,7 @@ define ('AI_STICKY_WIDGETS', 10);
464
  define ('AI_NUMBER_OF_COMMENTS', 11);
465
  define ('AI_COMMENTS_SAVED_CALLBACK', 12);
466
  define ('AI_COMMENTS_SAVED_END_CALLBACK',13);
 
467
 
468
  define ('AI_CONTEXT_NONE', 0);
469
  define ('AI_CONTEXT_CONTENT', 1);
@@ -489,12 +562,14 @@ define ('AI_URL_DEBUG_POSITIONS', 'ai-debug-positions');
489
  define ('AI_URL_DEBUG_NO_INSERTION', 'ai-debug-no-insertion');
490
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php');
491
  define ('AI_URL_DEBUG_COUNTRY', 'ai-debug-country');
 
492
 
493
  define ('AI_DEBUG_PROCESSING', 0x01);
494
  define ('AI_DEBUG_BLOCKS', 0x02);
495
  define ('AI_DEBUG_TAGS', 0x04);
496
  define ('AI_DEBUG_POSITIONS', 0x08);
497
  define ('AI_DEBUG_NO_INSERTION', 0x10);
 
498
 
499
  if (!defined ('AD_INSERTER_BLOCKS'))
500
  define ('AD_INSERTER_BLOCKS', 16);
@@ -502,18 +577,9 @@ if (!defined ('AD_INSERTER_BLOCKS'))
502
  if (!defined ('AD_INSERTER_VIEWPORTS'))
503
  define ('AD_INSERTER_VIEWPORTS', 3);
504
 
505
- define ('AI_RATING_FILE', AD_INSERTER_PLUGIN_DIR.'includes/rating.txt');
506
-
507
  define ('AI_DEBUG_TAGS_STYLE', 'font-weight: bold; color: white; padding: 2px;');
508
  define ('AI_DEBUG_POSITIONS_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;');
509
  define ('AI_DEBUG_PAGE_TYPE_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid green; color: green; background: #efe;');
510
  define ('AI_DEBUG_WIDGET_STYLE', 'margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;');
511
 
512
- define ('SPECIAL_ELEMENT_TAGS', 'blockquote, figure, li');
513
-
514
- //define ('AI_ADBLOCKER_DETECTION', true);
515
-
516
- define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
517
-
518
-
519
 
1
  <?php
2
 
3
+ //ini_set ('display_errors', 1);
4
+ //error_reporting (E_ALL);
5
+
6
+ define ('AI_OPTION_NAME', 'ad_inserter');
7
+ define ('AI_OPTION_GLOBAL', 'global');
8
 
9
  if (!defined ('AD_INSERTER_PLUGIN_DIR'))
10
  define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
17
  define ('AD_INSERTER_NAME', 'Ad Inserter');
18
 
19
  if (!defined( 'AD_INSERTER_VERSION'))
20
+ define ('AD_INSERTER_VERSION', '2.1.12');
21
 
22
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
23
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
47
  define ('WP_FORM_FIELD_POSTFIX', '_block_');
48
  define ('AI_HEADER_OPTION_NAME', 'h');
49
  define ('AI_FOOTER_OPTION_NAME', 'f');
50
+ define ('AI_ADB_MESSAGE_OPTION_NAME', 'a');
51
 
52
  define ('AI_OPTION_CODE', 'code');
53
  define ('AI_OPTION_ENABLE_MANUAL', 'enable_manual');
57
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
58
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
59
  define ('AI_OPTION_ENABLE_404', 'enable_404');
60
+ define ('AI_OPTION_BLOCK_NAME', 'name');
61
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
62
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
63
  define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
64
+ define ('AI_OPTION_MIN_WORDS_ABOVE', 'min_words_above');
65
  define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
66
  define ('AI_OPTION_MIN_WORDS', 'min_words');
67
  define ('AI_OPTION_MAX_WORDS', 'max_words');
77
  define ('AI_OPTION_AVOID_DIRECTION', 'avoid_direction');
78
  define ('AI_OPTION_EXCERPT_NUMBER', 'excerpt_number'); // needs to be renamed
79
  define ('AI_OPTION_FILTER_TYPE', 'filter_type');
80
+ define ('AI_OPTION_INVERTED_FILTER', 'inverted_filter');
81
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
82
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
83
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
122
  define ('AI_OPTION_DETECT_SERVER_SIDE', 'detect_server_side');
123
  define ('AI_OPTION_DETECT_CLIENT_SIDE', 'detect_client_side');
124
  define ('AI_OPTION_DETECT_VIEWPORT', 'detect_viewport');
125
+
126
  define ('AI_OPTION_DISABLED', 'disabled');
127
 
128
  define ('AI_OPTION_IMPORT', 'import');
129
  define ('AI_OPTION_IMPORT_NAME', 'import_name');
130
  define ('AI_OPTION_PLUGIN_STATUS', 'plugin_status');
131
 
132
+ define ('AI_OPTION_ADB_ACTION', 'adb-action');
133
+ define ('AI_OPTION_ADB_SELECTORS', 'adb-selectors');
134
+ define ('AI_OPTION_ADB_DELAY_ACTION', 'adb-delay-action');
135
+ define ('AI_OPTION_ADB_NO_ACTION_PERIOD', 'adb-no-action-period');
136
+ define ('AI_OPTION_ADB_REDIRECTION_PAGE', 'adb-redirection-page');
137
+ define ('AI_OPTION_ADB_CUSTOM_REDIRECTION_URL', 'adb-custom-redirection-url');
138
+ define ('AI_OPTION_ADB_MESSAGE_CSS', 'adb-message-css');
139
+ define ('AI_OPTION_ADB_OVERLAY_CSS', 'adb-overlay-css');
140
+ define ('AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE', 'adb-undismissible-message');
141
+
142
  //misc
143
  define('AD_EMPTY_VALUE','');
144
 
272
  define('AD_BLACK_LIST','Black List');
273
  define('AD_WHITE_LIST','White List');
274
 
275
+ //Filter Type - Deprecated
276
  define ('AI_OPTION_FILTER_AUTO', 'Auto');
277
  define ('AI_OPTION_FILTER_PHP_FUNCTION_CALLS', 'PHP function calls');
278
  define ('AI_OPTION_FILTER_CONTENT_PROCESSING', 'Content processing');
284
  define ('AI_OPTION_FILTER_POSTS', 'Posts');
285
  define ('AI_OPTION_FILTER_COMMENTS', 'Comments');
286
 
287
+
288
+ //Filter Type
289
+ define ('AI_FILTER_AUTO', 0);
290
+ define ('AI_FILTER_PHP_FUNCTION_CALLS', 1);
291
+ define ('AI_FILTER_CONTENT_PROCESSING', 2);
292
+ define ('AI_FILTER_EXCERPT_PROCESSING', 3);
293
+ define ('AI_FILTER_BEFORE_POST_PROCESSING', 4);
294
+ define ('AI_FILTER_AFTER_POST_PROCESSING', 5);
295
+ define ('AI_FILTER_WIDGET_DRAWING', 6);
296
+ define ('AI_FILTER_SUBPAGES', 7);
297
+ define ('AI_FILTER_POSTS', 8);
298
+ define ('AI_FILTER_PARAGRAPHS', 9);
299
+ define ('AI_FILTER_COMMENTS', 10);
300
+
301
+
302
+ define ('AI_TEXT_AUTO', 'Auto');
303
+ define ('AI_TEXT_PHP_FUNCTION_CALLS', 'PHP function calls');
304
+ define ('AI_TEXT_CONTENT_PROCESSING', 'Content processing');
305
+ define ('AI_TEXT_EXCERPT_PROCESSING', 'Excerpt processing');
306
+ define ('AI_TEXT_BEFORE_POST_PROCESSING', 'Before post processing');
307
+ define ('AI_TEXT_AFTER_POST_PROCESSING', 'After post processing');
308
+ define ('AI_TEXT_WIDGET_DRAWING', 'Widget drawing');
309
+ define ('AI_TEXT_SUBPAGES', 'Subpages');
310
+ define ('AI_TEXT_POSTS', 'Posts');
311
+ define ('AI_TEXT_PARAGRAPHS', 'Paragraphs');
312
+ define ('AI_TEXT_COMMENTS', 'Comments');
313
+
314
+
315
+
316
  //Counter names
317
  define ('AI_BLOCK_COUNTER_NAME', 'AI_BLOCK_COUNTER_');
318
  define ('AI_PHP_FUNCTION_CALL_COUNTER_NAME', 'AI_PHP_FUNCTION_CALL_COUNTER_');
368
 
369
  define('AI_TRACKING_ENABLED', 1);
370
 
371
+ // Ad Blocking
372
+ define ('AI_ACTION_NONE', 0);
373
+ define ('AI_ACTION_WARNING_MESSAGE', 1);
374
+ define ('AI_ACTION_REDIRECTION', 2);
375
+
376
+ define ('AI_TEXT_NONE', 'None');
377
+ define ('AI_TEXT_WARNING_MESSAGE', 'Warning Message');
378
+ define ('AI_TEXT_REDIRECTION', 'Redirection');
379
+
380
  // Click detection
381
+ define ('AI_CLICK_DETECTION_STANDARD', 0);
382
+ define ('AI_CLICK_DETECTION_ADVANCED', 1);
383
 
384
+ define ('AI_TEXT_INTERNAL', 'Internal');
385
+ define ('AI_TEXT_ADVANCED', 'Advanced');
386
+ define ('AI_TEXT_ENABLED', 'Enabled');
387
 
388
  //Settings
389
+ define ('AI_ENABLED', '1');
390
+ define ('AI_DISABLED', '0');
391
+
392
+ define ('AI_COOKIE_TIME', 3600);
393
 
394
+ define ('AI_TRANSIENT_RATING', 'ai-rating');
395
+ define ('AI_TRANSIENT_RATING_EXPIRATION', 48 * 3600);
396
 
397
+ define ('AI_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
398
+ define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', AI_SYNTAX_HIGHLIGHTER_THEME);
399
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
400
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
401
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
402
  define ('DEFAULT_PLUGIN_PRIORITY', 99999);
403
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
404
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
405
+ define ('DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE', 'blockquote, figure, li');
406
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
407
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
408
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
416
  define ('DEFAULT_TRACKING_LOGGED_IN', AI_TRACKING_ENABLED);
417
  define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
418
 
419
+ //define ('AI_ADBLOCKING_DETECTION', true);
420
+ define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
421
+ define ('AI_BASIC_ADB_OVERLAY_CSS', "position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998; user-select: none;");
422
+ define ('AI_DEFAULT_ADB_OVERLAY_CSS', "background: #000; opacity: 0.85;");
423
+ define ('AI_BASIC_ADB_MESSAGE_CSS', "position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 99999; background: #000; color: #fff; user-select: none;");
424
+ define ('AI_DEFAULT_ADB_MESSAGE_CSS', "width: 300px; padding: 10px; border: 5px solid #f00; border-radius: 5px;");
425
+ define ('AI_DEFAULT_ADB_MESSAGE', "<p><strong>Blocked because of Ad Blocker</strong></p>\n<p>It seems that you are using some ad blocking software which is preventing the page from fully loading. Please whitelist this website or disable ad blocking software.</p>");
426
+ define ('AI_DEFAULT_ADB_ACTION', AI_ACTION_NONE);
427
+ define ('AI_DEFAULT_ADB_NO_ACTION_PERIOD', 30);
428
+ define ('AI_DEFAULT_ADB_REDIRECTION_PAGE', 0);
429
+ define ('AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE', AI_DISABLED);
430
+
431
  define ('DEFAULT_VIEWPORT_NAME_1', "Desktop");
432
  define ('DEFAULT_VIEWPORT_NAME_2', "Tablet");
433
  define ('DEFAULT_VIEWPORT_NAME_3', "Phone");
536
  define ('AI_NUMBER_OF_COMMENTS', 11);
537
  define ('AI_COMMENTS_SAVED_CALLBACK', 12);
538
  define ('AI_COMMENTS_SAVED_END_CALLBACK',13);
539
+ define ('AI_ADB_DETECTION', 14);
540
 
541
  define ('AI_CONTEXT_NONE', 0);
542
  define ('AI_CONTEXT_CONTENT', 1);
562
  define ('AI_URL_DEBUG_NO_INSERTION', 'ai-debug-no-insertion');
563
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php');
564
  define ('AI_URL_DEBUG_COUNTRY', 'ai-debug-country');
565
+ define ('AI_URL_DEBUG_AD_BLOCKING' , 'ai-debug-ad-blocking');
566
 
567
  define ('AI_DEBUG_PROCESSING', 0x01);
568
  define ('AI_DEBUG_BLOCKS', 0x02);
569
  define ('AI_DEBUG_TAGS', 0x04);
570
  define ('AI_DEBUG_POSITIONS', 0x08);
571
  define ('AI_DEBUG_NO_INSERTION', 0x10);
572
+ define ('AI_DEBUG_AD_BLOCKING', 0x20);
573
 
574
  if (!defined ('AD_INSERTER_BLOCKS'))
575
  define ('AD_INSERTER_BLOCKS', 16);
577
  if (!defined ('AD_INSERTER_VIEWPORTS'))
578
  define ('AD_INSERTER_VIEWPORTS', 3);
579
 
 
 
580
  define ('AI_DEBUG_TAGS_STYLE', 'font-weight: bold; color: white; padding: 2px;');
581
  define ('AI_DEBUG_POSITIONS_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;');
582
  define ('AI_DEBUG_PAGE_TYPE_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid green; color: green; background: #efe;');
583
  define ('AI_DEBUG_WIDGET_STYLE', 'margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;');
584
 
 
 
 
 
 
 
 
585
 
css/ad-inserter.css CHANGED
@@ -1,12 +1,12 @@
1
  #ai-data {
2
- font-family: "2.1.11"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
6
  display: none;
7
  }
8
 
9
- .ui-widget {
10
  font-family: sans-serif,Arial,Verdana;
11
  font-size: 12px!important;
12
  }
@@ -20,6 +20,10 @@
20
  font-size: 12px;
21
  }
22
 
 
 
 
 
23
  .ace_editor {
24
  border: 1px solid #ddd;
25
  border-radius: 4px;
@@ -51,6 +55,21 @@ a.clear-link, a.clear-link:hover, a.clear-link:focus {
51
  box-shadow: 0 0 0;
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /*#editor-1 {*/
55
  /* font-family: Courier, 'Courier New', monospace, tahoma;*/
56
  /* font-family: tahoma;*/
@@ -205,19 +224,24 @@ div.ai-tooltip .version {
205
  #ai-tabs a {
206
  width: 14px;
207
  text-align: center;
 
208
  }
209
  #ai-tabs {
210
  padding: .2em 0 0 .6em;
211
  }
212
 
213
-
214
  #ai-scroll-tabs {
215
  height: 42px;
216
  }
217
 
 
 
 
 
 
218
  #header-buttons {
219
  min-height: 26px;
220
- margin: 10px 0;
221
  float: right;
222
  }
223
 
@@ -236,6 +260,14 @@ textarea.simple-editor {
236
  height: 388px;
237
  }
238
 
 
 
 
 
 
 
 
 
239
  @media (min-width: 783px) and (max-width: 828px) {
240
  .auto-fold #wpcontent, .auto-fold #wpfooter {
241
  margin-left: 20px;
@@ -462,4 +494,23 @@ div.automatic-insertion img {
462
  .text .checkbox-button {
463
  padding: 2px 5px 2px 4px;
464
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  }
 
 
1
  #ai-data {
2
+ font-family: "2.1.12"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
6
  display: none;
7
  }
8
 
9
+ .ui-widget, #ai-form td {
10
  font-family: sans-serif,Arial,Verdana;
11
  font-size: 12px!important;
12
  }
20
  font-size: 12px;
21
  }
22
 
23
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
24
+ background: #fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x!important;
25
+ }
26
+
27
  .ace_editor {
28
  border: 1px solid #ddd;
29
  border-radius: 4px;
55
  box-shadow: 0 0 0;
56
  }
57
 
58
+ .rounded {
59
+ border-radius: 5px;
60
+ }
61
+
62
+ #ai-form.rounded input, #ai-form.rounded select {
63
+ border-radius: 5px;
64
+ }
65
+
66
+ #ai-form div.rounded, #ai-sidebar div.rounded {
67
+ margin: 8px 0;
68
+ padding: 8px;
69
+ border: 1px solid rgb(221, 221, 221);
70
+ border-radius: 5px;
71
+ }
72
+
73
  /*#editor-1 {*/
74
  /* font-family: Courier, 'Courier New', monospace, tahoma;*/
75
  /* font-family: tahoma;*/
224
  #ai-tabs a {
225
  width: 14px;
226
  text-align: center;
227
+ font-size: 12px;
228
  }
229
  #ai-tabs {
230
  padding: .2em 0 0 .6em;
231
  }
232
 
 
233
  #ai-scroll-tabs {
234
  height: 42px;
235
  }
236
 
237
+ #ai-plugin-settings-tabs li a {
238
+ padding: .5em 0.6em;
239
+ font-size: 12px;
240
+ }
241
+
242
  #header-buttons {
243
  min-height: 26px;
244
+ margin: 2px 0;
245
  float: right;
246
  }
247
 
260
  height: 388px;
261
  }
262
 
263
+ .simple-editor.small {
264
+ height: 190px;
265
+ }
266
+
267
+ textarea.simple-editor.small {
268
+ height: 192px;
269
+ }
270
+
271
  @media (min-width: 783px) and (max-width: 828px) {
272
  .auto-fold #wpcontent, .auto-fold #wpfooter {
273
  margin-left: 20px;
494
  .text .checkbox-button {
495
  padding: 2px 5px 2px 4px;
496
  }
497
+ .ai-settings-table tr {
498
+ height: 40px;
499
+ }
500
+ .ai-settings-table input {
501
+ height: 30px;
502
+ }
503
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
504
+ font-family: sans-serif,Arial,Verdana;
505
+ font-size: 16px;
506
+ }
507
+ }
508
+
509
+ @media(min-width: 769px) {
510
+ #ai-form select {
511
+ line-height: 22px;
512
+ height: 22px;
513
+ }
514
  }
515
+
516
+
css/images/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
18
+ </div>
19
+ <p>
20
+ Some Ad Inserter Pro features: IP address and country lists, Scheduling between dates with fallback
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
css/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
18
+ </div>
19
+ <p>
20
+ Some Ad Inserter Pro features: IP address and country lists, Scheduling between dates with fallback
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
images/domain-monitor.png DELETED
Binary file
images/how-to-monetize-a-small-blog.png DELETED
Binary file
images/index.html CHANGED
@@ -1,103 +1,26 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <meta http-equiv="content-style-type" content="text/css" />
6
- <meta http-equiv="content-script-type" content="text/javascript" />
7
-
8
- <title>Ad Inserter - Adsense and Amazon ads for Wordpress</title>
9
- <meta name="description" content="Ad Inserter - Insert Adsense, Amazon or any other code into Wordpress" />
10
- <meta name="keywords" content="ad inserter, wordpress, adsense, amazon, html, code, javascript, php" />
11
-
12
- <style>
13
- body {
14
- font-family: arial, helvetica;
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div style="float: left;">
21
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
22
- <h1 style="text-align: center;">Ad Inserter - Insert Any Code Anywhere</h1>
23
- <div style="margin: 8px 0; padding: 0 8px; text-align: center;">
24
- <h2 style="display: inline-block; margin: 16px 0;">Follow Ad Inserter</h2>
25
- <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img src="images/twitter.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter on Twitter" /></a>
26
- <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img src="images/facebook.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter on Facebook" /></a>
27
  </div>
28
- <p>
29
- Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
30
- Need more than 64 code blocks? <a href="http://adinserter.pro/" target="_blank" rel="nofollow">Ad Inserter Pro</a> supports
31
- 64 blocks, 6 viewports, import/export settings and has additional multisite support.
32
- </p>
33
- <div>
34
- <a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" /></a>
35
- </div>
36
- <p>
37
- Settings for one code block. Up to 16 blocks can be configured.
38
- </p>
39
- <hr />
40
- <div>
41
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
42
- </div>
43
- <p>
44
- Some <a href="http://adinserter.pro/" rel="nofollow" class="seoquake-nofollow">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
45
- </p>
46
- <hr />
47
- <div>
48
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
49
- </div>
50
- <p>
51
- Code preview with visual CSS editor
52
- </p>
53
- <hr />
54
- <div>
55
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800"/>
56
- </div>
57
- <p>
58
- Code preview with visual CSS editor - highlighted code
59
- </p>
60
- <hr />
61
- <div>
62
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
63
- </div>
64
- <p>
65
- Complete settings for one code block (Before Paragraph)
66
- </p>
67
- </div>
68
- </div>
69
-
70
- <div style="float: left;">
71
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
72
- <h1 style="text-align: center;">Tiny Monitor</h1>
73
- <h2 style="text-align: center;">Monitor Google AdSense, Amazon Associates and PayPal earnings</h2>
74
- <p style="text-align: justify;">
75
- Tiny Monitor for
76
- <a href="http://tinymonitor.com/adsense-monitor-documentation" target="_blank" rel="nofollow">AdSense</a>,
77
- <a href="http://tinymonitor.com/amazon-monitor-documentation" target="_blank" rel="nofollow">Amazon</a> and
78
- <a href="http://tinymonitor.com/paypal-monitor-documentation" target="_blank" rel="nofollow">PayPal</a> is a perfect solution to track your online earnings.
79
- This is a small PHP script that can be installed on any <a href="http://tinymonitor.com/installing-web-server" target="_blank" rel="nofollow">home web server</a> or commercial web hosting.
80
- If you already have some website (very likely as you are using Ad Inserter plugin) then you can simply put it into a folder.
81
- </p>
82
- <p style="text-align: justify;">
83
- Tiny Monitor automatically downloads data from Google, Amazon or PayPal and presents it in a simple single-page form.
84
- This way you can have all the data easily accessible without the need to log into many websites just to check today's earnings.
85
- </p>
86
- <a href="http://tinymonitor.com/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/monitors.png" alt="Tiny Monitor"></a>
87
- <p style="text-align: justify;">
88
- And if you have more than one domain then you can monitor them with <a href="http://tinymonitor.com/domain-monitor-documentation" target="_blank" rel="nofollow">Tiny Domain Monitor</a>.
89
- This PHP script is a simple yet effective solution to track expiration dates of your own domains or any other domains you would like to register as soon as they expire.
90
- </p>
91
- <a href="http://tinymonitor.com/domainmonitor/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/domain-monitor.png" alt="Domain Monitor Script"></a>
92
- <div>
93
- <p style="text-align: justify;"><a href="http://tinymonitor.com/domain-monitor" target="_blank" rel="nofollow">Tiny Domain Monitor</a> is a simple standalone PHP script for automatic
94
- domain monitoring. It supports most top level domains including country domains. It can be used to monitor own domains and other registered domains in order to be
95
- informed when they expire or become again available for registration. With the help of a cron job the domain data is automatically updated. Tiny Domain Monitor can
96
- send an email when a domain data change occurs and it also generates RSS feed to track domain changes in any feed reader.</p>
97
- </div>
98
- </div>
99
- </div>
100
- <body>
101
-
102
- </html>
103
-
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
 
 
 
 
 
 
 
 
 
18
  </div>
19
+ <p>
20
+ Code preview with visual CSS editor
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/monitors.png DELETED
Binary file
images/test.png ADDED
Binary file
includes/ace/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
includes/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
includes/js/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
index.html CHANGED
@@ -1,102 +1,26 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <meta http-equiv="content-style-type" content="text/css" />
6
- <meta http-equiv="content-script-type" content="text/javascript" />
7
-
8
- <title>Ad Inserter - Adsense and Amazon ads for Wordpress</title>
9
- <meta name="description" content="Ad Inserter - Insert Adsense, Amazon or any other code into Wordpress" />
10
- <meta name="keywords" content="ad inserter, wordpress, adsense, amazon, ads, code, javascript, php" />
11
-
12
- <style>
13
- body {
14
- font-family: arial, helvetica;
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div style="float: left;">
21
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
22
- <h1 style="text-align: center;">Ad Inserter - Insert Any Code Anywhere</h1>
23
- <div style="margin: 8px 0; padding: 0 8px; text-align: center;">
24
- <h2 style="display: inline-block; margin: 16px 0;">Follow Ad Inserter</h2>
25
- <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img src="images/twitter.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter - WordPress plugin for ad managenet" /></a>
26
- <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img src="images/facebook.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter - WordPress plugin for advertising" /></a>
27
  </div>
28
- <p style="text-align: justify;">
29
- Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
30
- Need more than 64 code blocks? Ad Inserter Pro is a all-in-one <a href="http://adinserter.pro/" target="_blank">WordPress plugin for ads</a> - it supports
31
- 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
32
- </p>
33
- <div>
34
- <a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" /></a>
35
- </div>
36
- <p>
37
- Settings for one code block. Up to 16 blocks can be configured.
38
- </p>
39
- <hr />
40
- <div>
41
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
42
- </div>
43
- <p>
44
- Some <a href="http://adinserter.pro/" rel="nofollow" class="seoquake-nofollow">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
45
- </p>
46
- <hr />
47
- <div>
48
- <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" alt="CSS editor for alignments and styles" /></a>
49
- </div>
50
- <p>
51
- Code preview with visual CSS editor
52
- </p>
53
- <hr />
54
- <div>
55
- <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
56
- </div>
57
- <p>
58
- Code preview with visual CSS editor - highlighted code
59
- </p>
60
- <hr />
61
- <div>
62
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
63
- </div>
64
- <p>
65
- Complete settings for one code block (Before Paragraph)
66
- </p>
67
- </div>
68
- </div>
69
-
70
- <div style="float: left;">
71
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
72
- <h1 style="text-align: center;">Tiny Monitor</h1>
73
- <h2 style="text-align: center;">Monitor Google AdSense and PayPal earnings</h2>
74
- <p style="text-align: justify;">
75
- Tiny Monitor for
76
- <a href="http://tinymonitor.com/adsense-monitor-documentation" target="_blank" rel="nofollow">AdSense</a> and
77
- <a href="http://tinymonitor.com/paypal-monitor-documentation" target="_blank" rel="nofollow">PayPal</a> is a perfect solution to track your online earnings.
78
- This is a small PHP script that can be installed on any <a href="http://tinymonitor.com/installing-web-server" target="_blank" rel="nofollow">home web server</a> or commercial web hosting.
79
- If you already have some website (very likely as you are using Ad Inserter plugin) then you can simply put it into a folder.
80
- </p>
81
- <p style="text-align: justify;">
82
- Tiny Monitor automatically downloads data from Google, Amazon or PayPal and presents it in a simple single-page form.
83
- This way you can have all the data easily accessible without the need to log into many websites just to check today's earnings.
84
- </p>
85
- <a href="http://tinymonitor.com/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/monitors.png" alt="Tiny Monitor"></a>
86
- <p style="text-align: justify;">
87
- And if you have more than one domain then you can monitor them with <a href="http://tinymonitor.com/domain-monitor-documentation" target="_blank" rel="nofollow">Tiny Domain Monitor</a>.
88
- This PHP script is a simple yet effective solution to track expiration dates of your own domains or any other domains you would like to register as soon as they expire.
89
- </p>
90
- <a href="http://tinymonitor.com/domainmonitor/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/domain-monitor.png" alt="Domain Monitor Script"></a>
91
- <div>
92
- <p style="text-align: justify;"><a href="http://tinymonitor.com/domain-monitor" target="_blank" rel="nofollow">Tiny Domain Monitor</a> is a simple standalone PHP script for automatic
93
- domain monitoring. It supports most top level domains including country domains. It can be used to monitor own domains and other registered domains in order to be
94
- informed when they expire or become again available for registration. With the help of a cron job the domain data is automatically updated. Tiny Domain Monitor can
95
- send an email when a domain data change occurs and it also generates RSS feed to track domain changes in any feed reader.</p>
96
- </div>
97
- </div>
98
- </div>
99
- <body>
100
-
101
- </html>
102
-
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks? Ad Inserter Pro supports
14
+ 64 blocks, GEO targeting, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="http://adinserter.pro/documentation" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" alt="Ad Inserter Documentation" /></a>
 
 
 
 
 
 
 
 
 
18
  </div>
19
+ <p>
20
+ Settings for one code block. Up to 16 blocks can be configured.
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/ad-inserter.js CHANGED
@@ -1,8 +1,9 @@
1
- var javascript_version = "2.1.11";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
5
  var active_tab = 1;
 
6
  var tabs_to_configure = new Array();
7
 
8
  var current_tab = 0;
@@ -37,6 +38,10 @@ var AI_ALIGNMENT_STICKY_RIGHT = 9;
37
  var AI_ALIGNMENT_STICKY_TOP = 10;
38
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
39
 
 
 
 
 
40
  var shSettings = {
41
  "tab_size":"4",
42
  "use_soft_tabs":"1",
@@ -81,7 +86,7 @@ function SyntaxHighlight (id, block, settings) {
81
  textarea.removeAttr ("name");
82
  }
83
 
84
- jQuery("#ai-active-tab").attr ("value", active_tab);
85
  });
86
 
87
  session.setMode ("ace/mode/html");
@@ -121,6 +126,25 @@ function change_block_alignment (block) {
121
  }(jQuery));
122
 
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  jQuery(document).ready(function($) {
125
 
126
  var header = $('#ai-settings-' + 'header').length != 0;
@@ -775,7 +799,7 @@ jQuery(document).ready(function($) {
775
  });
776
  }
777
 
778
- if (block != 'h' && block != 'f' && !header) {
779
  if ((block - 1) >> 4) {
780
  $('#block' + '-' + block).removeAttr(header_id);
781
  $('#display' + '-type-' + block).removeAttr(header_id);
@@ -788,16 +812,33 @@ jQuery(document).ready(function($) {
788
  }
789
  }
790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
  function configure_tab_0 () {
792
 
793
  if (debug) console.log ("configure_tab_0");
794
 
795
  $('#tab-0').addClass ('configured');
796
 
797
- $('#tab-0 input[type=submit], #tab-0 button').button().show ();
 
798
 
799
  configure_editor ('h');
800
  configure_editor ('f');
 
 
801
 
802
  $('#ai-plugin-settings-tab-container').tabs();
803
  $('#ai-plugin-settings-tabs').show();
@@ -823,8 +864,14 @@ jQuery(document).ready(function($) {
823
  if (syntax_highlighting) configure_editor_language ('f')
824
  });
825
 
 
 
 
 
826
  if (syntax_highlighting) configure_editor_language ('h');
827
  if (syntax_highlighting) configure_editor_language ('f');
 
 
828
 
829
  for (var index = 1; index <= geo_groups; index ++) {
830
  generate_country_list ('group-country', index);
@@ -839,6 +886,31 @@ jQuery(document).ready(function($) {
839
  $('#enable-footer-404').checkboxButton ();
840
  $('#simple-editor-f').checkboxButton ();
841
  $('#process-php-f').checkboxButton ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842
  }
843
 
844
  function configure_tab (tab) {
@@ -1541,6 +1613,7 @@ jQuery(document).ready(function($) {
1541
  });
1542
  }
1543
 
 
1544
  if (debug) console.log ("READY");
1545
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1546
  if (debug) {
@@ -1551,11 +1624,20 @@ jQuery(document).ready(function($) {
1551
  $("#blocked-warning").removeClass ('warning-enabled');
1552
  $("#blocked-warning").hide ();
1553
 
1554
- start = parseInt ($('#ai-form').attr('start'));
1555
- end = parseInt ($('#ai-form').attr('end'));
1556
- active_tab = parseInt ($("#ai-active-tab").attr ("value"));
 
 
 
 
 
 
 
 
 
1557
 
1558
- if (debug) console.log ("active_tab: " + active_tab);
1559
 
1560
  var tabs_array = new Array ();
1561
  if (active_tab != 0) tabs_array.push (0);
@@ -1609,6 +1691,7 @@ jQuery(document).ready(function($) {
1609
  var index = 16;
1610
  if (active_tab != 0) index = active_tab - start;
1611
  var block_tabs = $("#ai-tab-container").tabs ({active: index});
 
1612
 
1613
  $('#ai-settings').tooltip({
1614
  show: {effect: "blind",
@@ -1635,14 +1718,14 @@ jQuery(document).ready(function($) {
1635
  remove_default_values (0);
1636
  });
1637
 
1638
- if (syntax_highlighting) {
1639
- $('.ai-tab').click (function () {
1640
- tab_block = $(this).attr ("id");
1641
- tab_block = tab_block.replace ("ai-tab","");
1642
- active_tab = tab_block;
1643
 
1644
- if (debug) console.log ("active_tab: " + active_tab);
1645
 
 
1646
  if (!$("#tab-" + tab_block).hasClass ('configured')) {
1647
  if (debug) console.log ("");
1648
  if (debug) console.log ("Empty tab: " + tab_block);
@@ -1653,9 +1736,14 @@ jQuery(document).ready(function($) {
1653
  var editor = ace.edit ("editor-" + tab_block);
1654
  editor.getSession ().highlightLines (10000000);
1655
  }
1656
- });
 
1657
 
1658
- $('.ai-plugin-tab').click (function () {
 
 
 
 
1659
  tab_block = $(this).attr ("id");
1660
  tab_block = tab_block.replace ("ai-","");
1661
 
@@ -1666,9 +1754,13 @@ jQuery(document).ready(function($) {
1666
  if (tab_block == 'f') {
1667
  editor = ace.edit ("editor-f");
1668
  editor.getSession ().highlightLines (10000000);
 
 
 
 
1669
  }
1670
- });
1671
- }
1672
 
1673
  $('#plugin_name').dblclick (function () {
1674
  $("#system-debugging").toggle();
@@ -1687,7 +1779,7 @@ jQuery(document).ready(function($) {
1687
  $('#ai-stars').show ();
1688
  });
1689
 
1690
- setTimeout (update_rating, 6000);
1691
 
1692
  if (debug) console.log ("");
1693
  if (debug) console.log ("READY END");
1
+ var javascript_version = "2.1.12";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
5
  var active_tab = 1;
6
+ var active_tab_0 = 0;
7
  var tabs_to_configure = new Array();
8
 
9
  var current_tab = 0;
38
  var AI_ALIGNMENT_STICKY_TOP = 10;
39
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
40
 
41
+ var AI_ACTION_NONE = 0;
42
+ var AI_ACTION_WARNING_MESSAGE = 1;
43
+ var AI_ACTION_REDIRECTION = 2;
44
+
45
  var shSettings = {
46
  "tab_size":"4",
47
  "use_soft_tabs":"1",
86
  textarea.removeAttr ("name");
87
  }
88
 
89
+ jQuery("#ai-active-tab").attr ("value", '[' + active_tab + ',' + active_tab_0 + ']');
90
  });
91
 
92
  session.setMode ("ace/mode/html");
126
  }(jQuery));
127
 
128
 
129
+ function get_editor_text (block) {
130
+ var editor = ace.edit ("editor-" + block);
131
+ var textarea = jQuery ("#block-" + block);
132
+ var editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
133
+ if (!editor_disabled) {
134
+ return editor.getSession ().getValue();
135
+ } else return textarea.val ();
136
+ }
137
+
138
+ function set_editor_text (block, text) {
139
+ var editor = ace.edit ("editor-" + block);
140
+ var textarea = jQuery ("#block-" + block);
141
+ var editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
142
+ if (!editor_disabled) {
143
+ return editor.getSession ().setValue(text);
144
+ } else textarea.val (text);
145
+ }
146
+
147
+
148
  jQuery(document).ready(function($) {
149
 
150
  var header = $('#ai-settings-' + 'header').length != 0;
799
  });
800
  }
801
 
802
+ if (block != 'h' && block != 'f' && block != 'a' && !header) {
803
  if ((block - 1) >> 4) {
804
  $('#block' + '-' + block).removeAttr(header_id);
805
  $('#display' + '-type-' + block).removeAttr(header_id);
812
  }
813
  }
814
 
815
+ function configure_adb () {
816
+ $("#adb-message").hide();
817
+ $("#adb-page-redirection").hide();
818
+
819
+ var adb_action = $("select#adb-action option:selected").attr('value');
820
+
821
+ if (adb_action == AI_ACTION_WARNING_MESSAGE) {
822
+ $("#adb-message").show();
823
+ } else
824
+ if (adb_action == AI_ACTION_REDIRECTION) {
825
+ $("#adb-page-redirection").show();
826
+ }
827
+ }
828
+
829
  function configure_tab_0 () {
830
 
831
  if (debug) console.log ("configure_tab_0");
832
 
833
  $('#tab-0').addClass ('configured');
834
 
835
+ // $('#tab-0 input[type=submit], #tab-0 button').button().show ();
836
+ $('#tab-0 input[type=submit]').button().show ();
837
 
838
  configure_editor ('h');
839
  configure_editor ('f');
840
+ if ($("#block-a").length)
841
+ configure_editor ('a');
842
 
843
  $('#ai-plugin-settings-tab-container').tabs();
844
  $('#ai-plugin-settings-tabs').show();
864
  if (syntax_highlighting) configure_editor_language ('f')
865
  });
866
 
867
+ $("input#process-php-a").change (function() {
868
+ if (syntax_highlighting) configure_editor_language ('a')
869
+ });
870
+
871
  if (syntax_highlighting) configure_editor_language ('h');
872
  if (syntax_highlighting) configure_editor_language ('f');
873
+ if ($("#block-a").length)
874
+ if (syntax_highlighting) configure_editor_language ('a');
875
 
876
  for (var index = 1; index <= geo_groups; index ++) {
877
  generate_country_list ('group-country', index);
886
  $('#enable-footer-404').checkboxButton ();
887
  $('#simple-editor-f').checkboxButton ();
888
  $('#process-php-f').checkboxButton ();
889
+
890
+ $('#enable-adb-detection').checkboxButton ();
891
+ $('#simple-editor-a').checkboxButton ();
892
+ $('#process-php-a').checkboxButton ();
893
+
894
+
895
+ configure_adb ();
896
+ $("select#adb-action").change (function() {
897
+ configure_adb ();
898
+ });
899
+
900
+ $("#preview-button-adb").button ({
901
+ }).show ().click (function () {
902
+
903
+ $(this).blur ();
904
+
905
+ var window_width = 820;
906
+ var window_height = 870;
907
+ var nonce = $(this).attr ('nonce');
908
+ var site_url = $(this).attr ('site-url');
909
+ var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&preview=adb&ai_check=" + nonce;
910
+ var window_left = 120;
911
+ var window_top = (screen.height / 2) - (870 / 2);
912
+ var preview_window = window.open (page, 'preview','width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
913
+ });
914
  }
915
 
916
  function configure_tab (tab) {
1613
  });
1614
  }
1615
 
1616
+
1617
  if (debug) console.log ("READY");
1618
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1619
  if (debug) {
1624
  $("#blocked-warning").removeClass ('warning-enabled');
1625
  $("#blocked-warning").hide ();
1626
 
1627
+ start = parseInt ($('#ai-form').attr('start'));
1628
+ end = parseInt ($('#ai-form').attr('end'));
1629
+
1630
+ active_tab = 1;
1631
+ active_tab_0 = 0;
1632
+ try {
1633
+ var active_tabs = JSON.parse ($("#ai-active-tab").attr ("value"));
1634
+ if (typeof active_tabs !== "undefined" && active_tabs.constructor === Array && Number.isInteger (active_tabs [0]) && Number.isInteger (active_tabs [1])) {
1635
+ active_tab = parseInt (active_tabs [0]);
1636
+ active_tab_0 = parseInt (active_tabs [1]);
1637
+ }
1638
+ } catch (e) {}
1639
 
1640
+ if (debug) console.log ("active_tabs:", active_tab, active_tab_0);
1641
 
1642
  var tabs_array = new Array ();
1643
  if (active_tab != 0) tabs_array.push (0);
1691
  var index = 16;
1692
  if (active_tab != 0) index = active_tab - start;
1693
  var block_tabs = $("#ai-tab-container").tabs ({active: index});
1694
+ $("#ai-plugin-settings-tab-container").tabs ({active: active_tab_0});
1695
 
1696
  $('#ai-settings').tooltip({
1697
  show: {effect: "blind",
1718
  remove_default_values (0);
1719
  });
1720
 
1721
+ $('.ai-tab').click (function () {
1722
+ tab_block = $(this).attr ("id");
1723
+ tab_block = tab_block.replace ("ai-tab","");
1724
+ active_tab = tab_block;
 
1725
 
1726
+ if (debug) console.log ("active_tab: " + active_tab);
1727
 
1728
+ if (syntax_highlighting) {
1729
  if (!$("#tab-" + tab_block).hasClass ('configured')) {
1730
  if (debug) console.log ("");
1731
  if (debug) console.log ("Empty tab: " + tab_block);
1736
  var editor = ace.edit ("editor-" + tab_block);
1737
  editor.getSession ().highlightLines (10000000);
1738
  }
1739
+ }
1740
+ });
1741
 
1742
+ $('.ai-plugin-tab').click (function () {
1743
+ active_tab_0 = $("#ai-plugin-settings-tab-container").tabs ('option', 'active');
1744
+ if (debug) console.log ("active_tab_0: " + active_tab_0);
1745
+
1746
+ if (syntax_highlighting) {
1747
  tab_block = $(this).attr ("id");
1748
  tab_block = tab_block.replace ("ai-","");
1749
 
1754
  if (tab_block == 'f') {
1755
  editor = ace.edit ("editor-f");
1756
  editor.getSession ().highlightLines (10000000);
1757
+ } else
1758
+ if (tab_block == 'a') {
1759
+ editor = ace.edit ("editor-a");
1760
+ editor.getSession ().highlightLines (10000000);
1761
  }
1762
+ }
1763
+ });
1764
 
1765
  $('#plugin_name').dblclick (function () {
1766
  $("#system-debugging").toggle();
1779
  $('#ai-stars').show ();
1780
  });
1781
 
1782
+ setTimeout (update_rating, 1000);
1783
 
1784
  if (debug) console.log ("");
1785
  if (debug) console.log ("READY END");
js/index.html CHANGED
@@ -1,4 +1,27 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
18
+ </div>
19
+ <p>
20
+ Complete settings for one code block (Before Paragraph)
21
+ </p>
22
+ </div>
23
+ </div>
24
+ <body>
25
+
26
+ </html>
27
+
preview-adb.php ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //ini_set ('display_errors', 1);
4
+ //error_reporting (E_ALL);
5
+
6
+ function ai_media_buttons () {
7
+ echo '<button type="button" id="add-p" class="button" style="width: 36px;" title="Add dummy paragraph">+</button>';
8
+ echo '<button type="button" id="remove-p" class="button" style="width: 36px;" title="Remove dummy paragraph">-</button>';
9
+ echo '<button type="button" id="use-button" class="button" style="width: 90px;" title="Use current settings"> Use </button>';
10
+ echo '<button type="button" id="reset-button" class="button" style="width: 90px;" title="Reset to the saved settings"> Reset </button>';
11
+ echo '<button type="button" id="default-button" class="button" style="width: 90px;" title="Reset to the default settings"> Default </button>';
12
+ echo '<button type="button" id="cancel-button" class="button" style="width: 90px;" title="Use current settings"> Cancel </button>';
13
+ }
14
+
15
+ function ai_mce_buttons ($buttons, $id) {
16
+ $buttons = array_unique (array_merge ($buttons, array ('styleselect')));
17
+ return $buttons;
18
+ }
19
+
20
+ function ai_mce_buttons_2 ($buttons, $id) {
21
+ $buttons = array_unique (array_merge ($buttons, array ('forecolor', 'backcolor', 'hr', 'fontselect', 'fontsizeselect')));
22
+ if (($key = array_search ('wp_help', $buttons)) !== false) {
23
+ unset ($buttons [$key]);
24
+ }
25
+ return $buttons;
26
+ }
27
+
28
+ function generate_code_preview_adb () {
29
+ global $block_object, $ai_wp_data;
30
+
31
+ $ai_wp_data [AI_WP_DEBUGGING] = 0;
32
+
33
+ $obj = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
34
+ $adb_message = $obj->get_ad_data();
35
+
36
+ wp_enqueue_script ('ai-adb-js', plugins_url ('includes/js/ad-inserter-check.js', __FILE__), array (
37
+ 'jquery',
38
+ 'jquery-ui-tabs',
39
+ 'jquery-ui-button',
40
+ 'jquery-ui-tooltip',
41
+ 'jquery-ui-datepicker',
42
+ 'jquery-ui-dialog',
43
+ ), AD_INSERTER_VERSION);
44
+
45
+ wp_enqueue_style ('ai-adb-css', plugins_url ('css/ad-inserter.css', __FILE__), array (), AD_INSERTER_VERSION);
46
+
47
+ add_action ('media_buttons', 'ai_media_buttons');
48
+
49
+ add_filter ('mce_buttons', 'ai_mce_buttons', 99999, 2);
50
+ add_filter ('mce_buttons_2', 'ai_mce_buttons_2', 99999, 2);
51
+
52
+ ob_start ();
53
+ wp_head ();
54
+ $head = ob_get_clean ();
55
+ $head = preg_replace ('#<title>([^<]*)</title>#', '<title>' . AD_INSERTER_NAME . ' Ad Blocking Detected Message Preview</title>', $head);
56
+ ?>
57
+ <html>
58
+ <head>
59
+ <?php
60
+ echo $head;
61
+ ?>
62
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
63
+ <script>
64
+
65
+ // initialize_preview ();
66
+
67
+ window.onkeydown = function (event) {
68
+ if (event.keyCode === 27 ) {
69
+ window.close();
70
+ }
71
+ }
72
+
73
+ // https://gist.github.com/RadGH/523bed274f307830752c
74
+
75
+ // 0) If you are not using the default visual editor, make your own in PHP with a defined editor ID:
76
+ // wp_editor( $content, 'tab-editor' );
77
+
78
+ // 1) Get contents of your editor in JavaScript:
79
+ // tmce_getContent( 'tab-editor' )
80
+
81
+ // 2) Set content of the editor:
82
+ // tmce_setContent( content, 'tab-editor' )
83
+
84
+ // Note: If you just want to use the default editor, you can leave the ID blank:
85
+ // tmce_getContent()
86
+ // tmce_setContent( content )
87
+
88
+ // Note: If using a custom textarea ID, different than the editor id, add an extra argument:
89
+ // tmce_getContent( 'visual-id', 'textarea-id' )
90
+ // tmce_getContent( content, 'visual-id', 'textarea-id')
91
+
92
+ // Note: An additional function to provide "focus" to the displayed editor:
93
+ // tmce_focus( 'tab-editor' )
94
+
95
+ function tmce_getContent (editor_id, textarea_id) {
96
+ if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
97
+ if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
98
+
99
+ if (jQuery('#wp-' + editor_id + '-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
100
+ return tinyMCE.get(editor_id).getContent();
101
+ } else {
102
+ return jQuery('#'+textarea_id).val();
103
+ }
104
+ }
105
+
106
+ function tmce_setContent (content, editor_id, textarea_id) {
107
+ if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
108
+ if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
109
+
110
+ if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
111
+ return tinyMCE.get (editor_id).setContent (content);
112
+ } else {
113
+ return jQuery('#'+textarea_id).val (content);
114
+ }
115
+ }
116
+
117
+ function tmce_focus (editor_id, textarea_id) {
118
+ if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
119
+ if (typeof textarea_id == 'undefined') textarea_id = editor_id;
120
+
121
+ if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
122
+ return tinyMCE.get (editor_id).focus();
123
+ } else {
124
+ return jQuery('#'+textarea_id).focus();
125
+ }
126
+ }
127
+
128
+ function update_message_preview (editor, e) {
129
+ jQuery('#message').html (editor.getContent());
130
+ }
131
+
132
+ jQuery(document).ready(function($) {
133
+
134
+ function process_display_elements () {
135
+ $('#message').attr ('style', '<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) ; ?>' + $("#message-css").val ()).css ({'position': 'absolute'});
136
+ $('#overlay').attr ('style', '<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) ; ?>' + $("#overlay-css").val ()).css ({'position': 'absolute'});
137
+ $('#message').html (tmce_getContent ());
138
+ }
139
+
140
+ function initialize_preview () {
141
+
142
+ var debug = <?php echo get_javascript_debugging () ? 'true' : 'false'; ?>;
143
+
144
+ function load_from_settings () {
145
+
146
+ if (window.opener != null && !window.opener.closed) {
147
+ var settings = $(window.opener.document).contents();
148
+
149
+ tmce_setContent (window.opener.get_editor_text ('a'));
150
+ $("#message-css").val (settings.find ("#message-css").val ());
151
+ $("#overlay-css").val (settings.find ("#overlay-css").val ());
152
+
153
+ process_display_elements ();
154
+ }
155
+ }
156
+
157
+ function apply_to_settings () {
158
+ if (window.opener != null && !window.opener.closed) {
159
+ var settings = $(window.opener.document).contents ();
160
+
161
+ window.opener.set_editor_text ('a', tmce_getContent ())
162
+ settings.find ("#message-css").val ($("#message-css").val ());
163
+ settings.find ("#overlay-css").val ($("#overlay-css").val ());
164
+ }
165
+ }
166
+
167
+ $("#use-button").button ({
168
+ }).click (function () {
169
+ apply_to_settings ();
170
+ window.close();
171
+ });
172
+
173
+ $("#default-button").button ({
174
+ }).click (function () {
175
+ tmce_setContent ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_MESSAGE); ?>');
176
+ $("#message-css").val ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_MESSAGE_CSS); ?>');
177
+ $("#overlay-css").val ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_OVERLAY_CSS); ?>');
178
+ process_display_elements ();
179
+ });
180
+
181
+ $("#reset-button").button ({
182
+ }).click (function () {
183
+ load_from_settings ();
184
+ });
185
+
186
+ $("#cancel-button").button ({
187
+ }).click (function () {
188
+ window.close();
189
+ });
190
+
191
+ $("#message-css").on ('input', function() {
192
+ process_display_elements ();
193
+ });
194
+
195
+ $("#overlay-css").on ('input', function() {
196
+ process_display_elements ();
197
+ });
198
+
199
+ $('#aiadb').bind('input propertychange', function() {
200
+ $('#message').html ($('#aiadb').val ());
201
+ });
202
+
203
+ $('#add-p').click(function (e) {
204
+ var paragraphs = $('#dummy-text').children ('p.dummy');
205
+ if (paragraphs.length < 10) {
206
+ paragraphs.last().clone().appendTo ($('#dummy-text'));
207
+ }
208
+ });
209
+
210
+ $('#remove-p').click(function (e) {
211
+ var paragraphs = $('#dummy-text').children ('p.dummy');
212
+ if (paragraphs.length > 1) {
213
+ paragraphs.last().remove();
214
+ }
215
+ });
216
+
217
+ load_from_settings ();
218
+ }
219
+
220
+ initialize_preview ();
221
+
222
+ setTimeout (show_blocked_warning, 400);
223
+ });
224
+
225
+ function show_blocked_warning () {
226
+ jQuery("#blocked-warning.warning-enabled").show ();
227
+ }
228
+
229
+ </script>
230
+ <style>
231
+ body {
232
+ background: #fff;
233
+ display: block;
234
+ margin: 8px;
235
+ }
236
+
237
+ input[type="text"] {
238
+ max-width: initial;
239
+ }
240
+
241
+ button,
242
+ input[type="button"] {
243
+ width: initial;
244
+ }
245
+
246
+ .button {
247
+ font-size: 14px!important;
248
+ }
249
+
250
+ #text {
251
+ position: relative;
252
+ }
253
+ </style>
254
+ </head>
255
+ <body style='font-family: arial; overflow-x: hidden;'>
256
+ <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>"></div>
257
+
258
+ <div id="blocked-warning" class="warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
259
+ <div style="float: right; text-align: right; margin: 20px 0px 0px 0;">
260
+ This page was not loaded properly. Please check browser, plugins and ad blockers.
261
+ </div>
262
+ <h3 style="color: red;" title="Error loading page">PAGE BLOCKED</h3>
263
+
264
+ <div style="clear: both;"></div>
265
+ </div>
266
+
267
+ <div id="text">
268
+ <div id="overlay"></div>
269
+ <div id="message"></div>
270
+ <div id="dummy-text">
271
+ <p class='dummy'>Lorem ipsum dolor sit amet, quo ea quem munere, mea eu dicunt moderatius interesset. Eam ei saepe insolens, an wisi timeam vel, regione eruditi admodum in mei.
272
+ Nam iusto definitiones id, an graeci reprimique usu, eum iusto eruditi ei. At sint elitr propriae pro.</p>
273
+ <p class='dummy'>Clita periculis an eam, movet populo semper has an. Id quo unum justo affert, recusabo aliquando nam te, mei aeque soluta voluptaria no. Tantas pertinax ei eos, vim ipsum reformidans ne, lucilius mediocrem explicari cu cum. Eum integre definitionem vituperatoribus te.
274
+ His veri legere assentior ei, vis ferri detraxit cu. No quidam aliquip efficiantur sed, nusquam efficiendi dissentiunt pri ea.</p>
275
+ <p class='dummy'>Exerci aliquando ius ne, nostro timeam in sed, quaeque moderatius his at. At consul iudicabit nam, vel ei legere disputationi. Ea ius quidam sententiae.
276
+ Diam elit no sit, facete democritum referrentur est at. Quo et accusata dissentias, vis eligendi interpretaris ex.</p>
277
+ <p class='dummy'>In choro eleifend his. Qui no ignota mucius labore, dicta eruditi usu ea. Usu id insolens conceptam definitionem.
278
+ Mei quot fastidii pericula ex. Ut etiam delicata aliquando sea, aliquam senserit theophrastus et sit. Dolores torquatos mel ut, alia deserunt eu mea.</p>
279
+ </div>
280
+ </div>
281
+
282
+ <div style="width: 100%; min-height: 310px; margin: 8px 0;">
283
+ <?php
284
+
285
+ $editorSettings = array(
286
+ 'wpautop' => false,
287
+ 'media_buttons' => true,
288
+ 'textarea_rows' => 10,
289
+ 'tinymce'=> array (
290
+ 'menubar ' => false,
291
+ 'statusbar' => false,
292
+ 'setup' => 'function (editor) {
293
+ editor.on("change keyup redo undo", function (e) {
294
+ update_message_preview (editor, e);
295
+ });
296
+ }',
297
+ 'protect' => '[/<\?php.*?\?'.'>/g]',
298
+ ),
299
+ );
300
+
301
+ add_filter ('wp_default_editor', create_function ('', 'return "tinymce";'));
302
+ // wp_editor ($adb_message, 'aiadb', $editorSettings);
303
+ wp_editor ('', 'aiadb', $editorSettings);
304
+
305
+ // To disable Notice: Trying to get property of non-object in /wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 271
306
+ $error_reporting = error_reporting ();
307
+ error_reporting ($error_reporting & ~E_NOTICE);
308
+
309
+ \_WP_Editors::enqueue_scripts();
310
+ print_footer_scripts ();
311
+ \_WP_Editors::editor_js();
312
+
313
+ error_reporting ($error_reporting);
314
+
315
+ ?>
316
+ </div>
317
+
318
+ <div class="max-input" style="margin: 8px 0;">
319
+ <span style="display: table-cell; width: 90px; white-space: nowrap; font-size: 13px;">Message CSS</span>
320
+ <input style="display: table-cell; border-radius: 5px; width: 100%; padding-left: 5px;" type="text" id="message-css" value="" size="50" maxlength="200" />
321
+ </div>
322
+
323
+ <div class="max-input" style="margin: 8px 0;">
324
+ <span style="display: table-cell; width: 90px; white-space: nowrap; font-size: 13px;">Overlay CSS</span>
325
+ <input style="display: table-cell; border-radius: 5px; width: 100%; padding-left: 5px;" type="text" id="overlay-css" value="" size="50" maxlength="200" />
326
+ </div>
327
+
328
+ <?php wp_footer (); ?>
329
+ </body>
330
+ </html>
331
+ <?php
332
+ }
333
+
preview.php CHANGED
@@ -12,8 +12,9 @@ function alt_styles_data ($alt_styles_text) {
12
  }
13
 
14
  function generate_code_preview ($block) {
 
15
 
16
- global $block_object;
17
 
18
  $obj = $block_object [$block];
19
 
@@ -823,7 +824,6 @@ div.automatic-insertion img {
823
  $previous_width = $viewport_width;
824
  }
825
  echo "<td style='background: #eee; text-align: left; border: 1px solid #888; border-left-width: 0; min-width: 2000px'><span style='margin-left: 30px;'>", get_viewport_name (1), "</span><span style='float: left; margin-left: 5px;'>", $previous_width != 0 ? $previous_width . "px" : "", "</span></td>";
826
-
827
  ?>
828
  </tr>
829
  </table>
@@ -851,10 +851,10 @@ div.automatic-insertion img {
851
  </div>
852
 
853
  <div style="float: right; width: 90px; margin-left: 20px;">
854
- <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
855
- <button id="use-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Use</button>
856
- <button id="reset-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Reset</button>
857
- <button id="cancel-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Cancel</button>
858
  </div>
859
 
860
  <div style="float: left; max-width: 300px; margin-right: 20px">
12
  }
13
 
14
  function generate_code_preview ($block) {
15
+ global $block_object, $ai_wp_data;
16
 
17
+ $ai_wp_data [AI_WP_DEBUGGING] = 0;
18
 
19
  $obj = $block_object [$block];
20
 
824
  $previous_width = $viewport_width;
825
  }
826
  echo "<td style='background: #eee; text-align: left; border: 1px solid #888; border-left-width: 0; min-width: 2000px'><span style='margin-left: 30px;'>", get_viewport_name (1), "</span><span style='float: left; margin-left: 5px;'>", $previous_width != 0 ? $previous_width . "px" : "", "</span></td>";
 
827
  ?>
828
  </tr>
829
  </table>
851
  </div>
852
 
853
  <div style="float: right; width: 90px; margin-left: 20px;">
854
+ <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
855
+ <button id="use-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Use current settings" >Use</button>
856
+ <button id="reset-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Reset to the block settings" >Reset</button>
857
+ <button id="cancel-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Close preview window" >Cancel</button>
858
  </div>
859
 
860
  <div style="float: left; max-width: 300px; margin-right: 20px">
readme.txt CHANGED
@@ -1,26 +1,27 @@
1
- === Ad Inserter - Complete Ad Management ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
- Tags: ads, adsense, ad management, advertising, widgets, contextual ads, ad rotation, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, widgets, PHP, Javascript, HTML, header, footer, tracking, sticky, taxonomy, term, custom post
6
  Requires at least: 4.0
7
  Tested up to: 4.8
8
- Stable tag: 2.1.10
9
  License: GPLv3
10
 
11
  Ad management plugin: AdSense, Amazon ads, banners, ad rotation, sticky widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
12
 
13
  == Description ==
14
 
15
- Ad management plugin with many advanced advertising features. **Supports all kinds of ads including Google AdSense, contextual Amazon Native Shopping Ads and rotating banners.**
16
 
17
- Ad Inserter is more than just ad manager, it provides many advanced options to insert any Javascript, CSS, HTML, PHP or advert code anywhere on the page.
18
 
19
  > **Features**
20
  >
21
  > * 16 code (ad) blocks
22
  > * Syntax highlighting editor
23
  > * Code preview with visual CSS editor
 
24
  > * Insert before or after post
25
  > * Insert before or after content
26
  > * Insert before or after paragraph
@@ -30,8 +31,8 @@ Ad Inserter is more than just ad manager, it provides many advanced options to i
30
  > * Insert before or after excerpt
31
  > * Insert before or after any HTML element in post
32
  > * Insert at relative position in posts
33
- > * Insert between posts on blog pages
34
- > * Insert between excerpt on blog pages
35
  > * Insert between comments
36
  > * Clearance options to avoid insertion near images or headers
37
  > * Insertion exceptions for posts and pages
@@ -53,12 +54,12 @@ Ad Inserter is more than just ad manager, it provides many advanced options to i
53
  > * Function to visualize available insertion positions
54
  > * Function to visualize HTML tags
55
 
56
- And Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank">WordPress ad management plugin</a> has even more features:
57
 
58
  > * 64 code (ad) blocks
59
  > * GEO targeting (works also with caching)
60
  > * Black/White-list IP addresses or countries (works also with caching)
61
- > * Ad impression and click tracking (works also with `<iframe>` Javascript ads like AdSense)
62
  > * A/B testing
63
  > * Sticky ad positions (left, top, right, bottom)
64
  > * Scheduling with fallback option
@@ -68,7 +69,7 @@ And Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank
68
  > * Export and import of settings
69
  > * Support via email
70
 
71
- Ad Inserter Wordpress plugin has many features and options to automate ad insertion and to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any Javascript, HTML, PHP or advert code anywhere on the page. For best ad placement and to use optimal advertising positions please read the user manual to get the most of the plugin.
72
 
73
  > * Check <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a> for detailed description of all the features and some <a href="http://adinserter.pro/settings" target="_blank">common settings</a> for quick start
74
  > * Download **PDF user guide** for Ad Inserter: go to <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro plugin</a> page and below you can find button for free download of Ad Inserter User Guide
@@ -78,21 +79,24 @@ Ad Inserter Wordpress plugin has many features and options to automate ad insert
78
  > Amazon suggests to use Ad Inserter to add Native Shopping Ads to Wordpress posts. Native Shopping Ads provide highly relevant and dynamic product recommendations in a stylishly designed and responsive ad unit that can be placed at the end of your content or within your content to create a more compelling visitor experience and shopping opportunity.
79
  >
80
  > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
81
- > * Check settings for <a href="https://adinserter.pro/settings#amazon">contextual Native Shopping Ads</a> that show items related to the post content (using post tags)
82
 
83
- **One Plugin - Many Functions**
84
 
85
- Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
86
 
87
- * to manage ads
88
  * to insert ads between paragraphs
89
  * to insert ads between posts
90
  * to insert ads between comments
91
  * to insert ads on AMP pages
92
  * to insert different ads for mobile devices
 
93
  * for ad rotation
94
  * for PHP code widgets
95
  * for sticky (fixed) widgets
 
 
96
  * to insert PHP or HTML code into posts
97
  * to insert header, footer or tracking code
98
  * to insert PHP, HTML, CSS, shortcodes
@@ -107,12 +111,12 @@ Maintaining several plugins (often from different vendors) is not easy. And each
107
 
108
  Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
109
 
110
- * Code block is any code (for example AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
111
  * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
112
  * **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
113
  * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
114
  * If you don't see inserted code block turn on **debugging functions**: Label inserted blocks, Show available positions for automatic insertion (Ad Inserter menu item in the Wordpress toolbar on the top of every post/page)
115
- * If you are using AdSense you may get blank (empty) ad blocks. This might be because there is some error in the code (wrong IDs), your AdSense account is not fully approved yet, your website was not accepted or your AdSense account is banned. Try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> - they seem to be a good alternative for contextual ads.
116
 
117
  Few typical settings are described on the <a href="https://wordpress.org/plugins/ad-inserter/faq/">FAQ</a> page. Please make sure you have also read <a href="https://wordpress.org/plugins/ad-inserter/installation/">Installation</a> page.
118
  For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
@@ -717,6 +721,14 @@ AD CODE RIGHT
717
 
718
  == Changelog ==
719
 
 
 
 
 
 
 
 
 
720
  = 2.1.11 =
721
  - Improved support for sticky widgets (works with most themes)
722
  - Added support for ad counting (|count| separator)
@@ -951,6 +963,12 @@ AD CODE RIGHT
951
 
952
  == Upgrade Notice ==
953
 
 
 
 
 
 
 
954
  = 2.1.11 =
955
  Improved support for sticky widgets (works with most themes);
956
  Added support for ad counting (|count| separator);
1
+ === Ad Inserter - WordPress Ads Management ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
+ Tags: ads, adsense, ad management, advertising manager, advanced contextual ads, ad rotation, adverts, widgets, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, PHP, Javascript, HTML, header, footer, tracking, sticky, taxonomy, term, custom post
6
  Requires at least: 4.0
7
  Tested up to: 4.8
8
+ Stable tag: 2.1.11
9
  License: GPLv3
10
 
11
  Ad management plugin: AdSense, Amazon ads, banners, ad rotation, sticky widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
12
 
13
  == Description ==
14
 
15
+ Ad management plugin with many advanced advertising features. **Supports all kinds of WordPress ads including Google AdSense, contextual Amazon Native Shopping Ads and rotating banners.**
16
 
17
+ Ad Inserter is more than just ad manager plugin. It provides many advanced options to insert any Javascript, CSS, HTML, PHP or advert code anywhere on the page.
18
 
19
  > **Features**
20
  >
21
  > * 16 code (ad) blocks
22
  > * Syntax highlighting editor
23
  > * Code preview with visual CSS editor
24
+ > * Automatically inserts ads in posts and pages
25
  > * Insert before or after post
26
  > * Insert before or after content
27
  > * Insert before or after paragraph
31
  > * Insert before or after excerpt
32
  > * Insert before or after any HTML element in post
33
  > * Insert at relative position in posts
34
+ > * Insert between posts on blog pages (in-feed AdSense ads)
35
+ > * Insert between excerpts on blog pages
36
  > * Insert between comments
37
  > * Clearance options to avoid insertion near images or headers
38
  > * Insertion exceptions for posts and pages
54
  > * Function to visualize available insertion positions
55
  > * Function to visualize HTML tags
56
 
57
+ And Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank">WordPress ad management plugin</a> has even more advanced features:
58
 
59
  > * 64 code (ad) blocks
60
  > * GEO targeting (works also with caching)
61
  > * Black/White-list IP addresses or countries (works also with caching)
62
+ > * Ad impression and click tracking (works also with `<iframe>` Javascript ads like Google AdSense)
63
  > * A/B testing
64
  > * Sticky ad positions (left, top, right, bottom)
65
  > * Scheduling with fallback option
69
  > * Export and import of settings
70
  > * Support via email
71
 
72
+ Ad Inserter Wordpress plugin is and advanced advertising manager - it has many features and options to automate ad insertion and to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any Javascript, HTML, PHP or advert code anywhere on the page. For best ad placement and to use optimal advertising positions please read the user manual to get the most of the plugin.
73
 
74
  > * Check <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a> for detailed description of all the features and some <a href="http://adinserter.pro/settings" target="_blank">common settings</a> for quick start
75
  > * Download **PDF user guide** for Ad Inserter: go to <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro plugin</a> page and below you can find button for free download of Ad Inserter User Guide
79
  > Amazon suggests to use Ad Inserter to add Native Shopping Ads to Wordpress posts. Native Shopping Ads provide highly relevant and dynamic product recommendations in a stylishly designed and responsive ad unit that can be placed at the end of your content or within your content to create a more compelling visitor experience and shopping opportunity.
80
  >
81
  > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
82
+ > * Ad Inserter supports advanced contextual ads: check settings for <a href="https://adinserter.pro/settings#amazon">contextual Native Shopping Ads</a> that show items related to the post content (using post tags)
83
 
84
+ **Ad Inserter Ad Manager - One Plugin - Many Functions**
85
 
86
+ Ad Inserter is not just another plugin for WordPress ads. Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
87
 
88
+ * ad management
89
  * to insert ads between paragraphs
90
  * to insert ads between posts
91
  * to insert ads between comments
92
  * to insert ads on AMP pages
93
  * to insert different ads for mobile devices
94
+ * to hide ads on specific pages
95
  * for ad rotation
96
  * for PHP code widgets
97
  * for sticky (fixed) widgets
98
+ * for widget logic
99
+ * to restrict widgets
100
  * to insert PHP or HTML code into posts
101
  * to insert header, footer or tracking code
102
  * to insert PHP, HTML, CSS, shortcodes
111
 
112
  Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
113
 
114
+ * Code block is any code (for example Google AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
115
  * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
116
  * **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
117
  * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
118
  * If you don't see inserted code block turn on **debugging functions**: Label inserted blocks, Show available positions for automatic insertion (Ad Inserter menu item in the Wordpress toolbar on the top of every post/page)
119
+ * If you are using AdSense you may get blank (empty) ad blocks. This might be because there is some error in the code (wrong IDs), your Google AdSense account is not fully approved yet, your website was not accepted or your Google AdSense account is banned. Try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> - they seem to be a good alternative for contextual ads.
120
 
121
  Few typical settings are described on the <a href="https://wordpress.org/plugins/ad-inserter/faq/">FAQ</a> page. Please make sure you have also read <a href="https://wordpress.org/plugins/ad-inserter/installation/">Installation</a> page.
122
  For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
721
 
722
  == Changelog ==
723
 
724
+ = 2.1.12 =
725
+ - Added option to define tags inside which paragraphs are not counted
726
+ - Added max insertions check when inserting for all paragraphs
727
+ - Added support for inverted filter
728
+ - Increased nonce lifespan to 48 hours when using tracking (Pro only)
729
+ - Fixed wrong urls in debug menu when behind proxy
730
+ - Few other bug fixes, cosmetic changes and code improvements
731
+
732
  = 2.1.11 =
733
  - Improved support for sticky widgets (works with most themes)
734
  - Added support for ad counting (|count| separator)
963
 
964
  == Upgrade Notice ==
965
 
966
+ = 2.1.12 =
967
+ Added option to define tags inside which paragraphs are not counted;
968
+ Added max insertions check when inserting for all paragraphs;
969
+ Added support for inverted filter;
970
+ Few minor bug fixes, cosmetic changes and code improvements
971
+
972
  = 2.1.11 =
973
  Improved support for sticky widgets (works with most themes);
974
  Added support for ad counting (|count| separator);
settings.php CHANGED
@@ -20,15 +20,26 @@ function generate_settings_form (){
20
  $end = 16;
21
  if (function_exists ('ai_settings_parameters')) ai_settings_parameters ($subpage, $start, $end);
22
 
 
 
 
 
 
23
  if (isset ($_GET ['tab'])) $active_tab = $_GET ['tab']; else
24
- $active_tab = isset ($_POST ['ai-active-tab']) ? $_POST ['ai-active-tab'] : 1;
25
  if (!is_numeric ($active_tab)) $active_tab = 1;
26
  if ($active_tab != 0)
27
  if ($active_tab < $start || $active_tab > $end) $active_tab = $start;
28
 
 
 
29
  $adH = $block_object [AI_HEADER_OPTION_NAME];
30
  $adF = $block_object [AI_FOOTER_OPTION_NAME];
31
 
 
 
 
 
32
  $syntax_highlighter_theme = get_syntax_highlighter_theme ();
33
  $block_class_name = get_block_class_name ();
34
 
@@ -80,12 +91,11 @@ function generate_settings_form (){
80
  }
81
  }
82
 
83
- $rating = '';
84
- if (file_exists (AI_RATING_FILE)) {
85
- $rating = file_get_contents (AI_RATING_FILE);
86
- if ($rating < 1 && $rating > 5) $rating = '';
87
  }
88
- $rating_css = $rating == '' ? 'width: 100%;' : 'width: '.number_format ($rating * 20, 4).'%;';
 
89
 
90
  ?>
91
 
@@ -98,14 +108,14 @@ function generate_settings_form (){
98
 
99
  <div id="ai-settings" style="float: left;">
100
 
101
- <form id="ai-form" class="ai-form no-select" action="<?php echo $save_url; ?>" method="post" id="ai-form" name="ai_form" style="float: left;" start="<?php echo $start; ?>" end="<?php echo $end; ?>">
102
 
103
- <div id="header" class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
104
  <?php
105
  if (function_exists ('ai_settings_header')) ai_settings_header ($start, $active_tab); else { ?>
106
 
107
  <div style="float: left;">
108
- <h2 id="plugin_name" style="display: inline-block; margin: 13px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
109
  </div>
110
  <div id="header-buttons">
111
  <a style="text-decoration: none;" href="http://adinserter.pro/documentation" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 62px;" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button></a>
@@ -121,9 +131,9 @@ function generate_settings_form (){
121
  ?>
122
  </div>
123
 
124
- <div id="javascript-warning" class="ai-form" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; display: none;">
125
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
126
- <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
127
  <span id="javascript-version-parameter" style="display: none;">Wrong version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
128
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
129
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
@@ -132,9 +142,9 @@ function generate_settings_form (){
132
  <div style="clear: both;"></div>
133
  </div>
134
 
135
- <div id="css-warning" class="ai-form" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; display: none;">
136
  <h2 id="css-version" style="float: left; color: red;" title="Loaded plugin CSS version">&nbsp;</h2>
137
- <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
138
  <span id="css-version-parameter" style="display: none;">Wrong version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
139
  <span id="css-version-parameter-missing" style="display: none;">Missing version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
140
  Incompatible (old) CSS file loaded, probably due to inappropriate caching.<br />
@@ -143,16 +153,16 @@ function generate_settings_form (){
143
  <div style="clear: both;"></div>
144
  </div>
145
 
146
- <div id="blocked-warning" class="ai-form warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
147
  <h2 class="blocked-warning-text" style="float: left; color: red;" title="Error loading page">PAGE BLOCKED</h2>
148
- <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
149
  This page was not loaded properly. Please check browser and plugins that may block CSS/javascript<br />
150
- files for this page. For <strong>Ad Blocker</strong> select "Disable on this page" or "Don't run on this page".
151
  </div>
152
  <div style="clear: both;"></div>
153
  </div>
154
 
155
- <div id="ai-tab-container" class="ai-form" style="padding: 8px 8px 1px 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
156
  <div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
157
 
158
  <div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
@@ -261,15 +271,22 @@ function generate_settings_form (){
261
  $enabled_h = $adH->get_enable_manual () && $adH->get_ad_data() != "";
262
  $enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
263
  if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
 
 
 
 
 
 
 
264
  ?>
265
- <li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> Settings<?php echo $title_hf ?>" style=" margin: 1px 0 0 0;"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"></div></a></li>
266
  </ul>
267
 
268
  <?php
269
  for ($ad_number = $start; $ad_number <= $end; $ad_number ++){
270
 
271
  $default->number = $ad_number;
272
- $default->wp_options [AI_OPTION_NAME] = AD_NAME." ".$ad_number;
273
 
274
  $tab_visible = $ad_number == $active_tab || $generate_all;
275
 
@@ -294,7 +311,7 @@ function generate_settings_form (){
294
 
295
  $scheduling_active = $obj->get_scheduling() != AI_SCHEDULING_OFF;
296
 
297
- $show_misc = $scheduling_active || intval ($obj->get_maximum_insertions ()) != 0 || intval ($obj->get_call_filter()) != 0 || $obj->get_display_for_users() != AD_DISPLAY_ALL_USERS || $obj->get_enable_404 () == AI_ENABLED || $obj->get_enable_feed () == AI_ENABLED;
298
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
299
 
300
  $automatic_insertion = $obj->get_automatic_insertion();
@@ -310,17 +327,20 @@ function generate_settings_form (){
310
  $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() ||
311
  $obj->get_paragraph_text() != $default->get_paragraph_text() ||
312
  $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() ||
 
313
  $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote();
314
 
315
  $paragraph_clearance =
316
  ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) ||
317
  ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0);
318
 
 
 
319
  ?>
320
  <div id="tab-<?php echo $ad_number; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
321
  <div id="toolbar-<?php echo $ad_number; ?>" class="max-input" style="margin: 8px 0; height: 28px; margin-bottom: 2px;">
322
  <span id="name-label-container-<?php echo $ad_number; ?>" style="display: table-cell; padding: 0; font-weight: bold; cursor: pointer;">
323
- <input id="name-edit-<?php echo $ad_number; ?>" style="width: 100%; vertical-align: middle; font-size: 14px; border-radius: 4px; display: none;" type="text" name="<?php echo AI_OPTION_NAME, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
324
  <span id="name-label-<?php echo $ad_number; ?>" class="no-select" style="width: 100%; max-width: 440px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top: 4px; margin-left: 7px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name() ?></span>
325
  </span>
326
  <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
@@ -356,16 +376,16 @@ function generate_settings_form (){
356
  </div>
357
  <div style="float: right;">
358
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
359
- <input style="display: none; border-radius: 5px; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
360
  <?php } ?>
361
  </div>
362
  <div style="clear: both;"></div>
363
  </div>
364
 
365
- <div style="padding:8px 8px 6px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
366
  <div style="float: left;">
367
  Automatic Insertion:
368
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_automatic_insertion(); ?>" style="width:200px;">
369
  <option data-img-src="<?php echo plugins_url ('images/disabled.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
370
  <option data-img-src="<?php echo plugins_url ('images/before-post.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
371
  <option data-img-src="<?php echo plugins_url ('images/before-content.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
@@ -384,7 +404,7 @@ function generate_settings_form (){
384
 
385
  <div style="float: right;">
386
  Alignment and Style:&nbsp;&nbsp;&nbsp;
387
- <select style="border-radius: 5px; width:120px;" id="block-alignment-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_alignment_type(); ?>">
388
  <option data-img-src="<?php echo plugins_url ('images/default.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
389
  <option data-img-src="<?php echo plugins_url ('images/align-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
390
  <option data-img-src="<?php echo plugins_url ('images/center.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
@@ -405,7 +425,7 @@ function generate_settings_form (){
405
  <div id="alignment-style-<?php echo $ad_number; ?>" style="margin-bottom: 4px;"></div>
406
  <div class="max-input">
407
  <span id="css-label-<?php echo $ad_number; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
408
- <input id="custom-css-<?php echo $ad_number; ?>" style="width: 100%; border-radius: 4px; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
409
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
410
  <span id="css-no-wrapping-<?php echo $ad_number; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
411
  <span id="css-none-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
@@ -421,14 +441,14 @@ function generate_settings_form (){
421
  </div>
422
  </div>
423
 
424
- <div class="responsive-table small-button" style="padding: 7px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
425
  <table>
426
  <tr>
427
  <td style="width: 70%">
428
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
429
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_post(); ?>" id="display-posts-<?php echo $ad_number; ?>" title="Enable or disable insertion on posts" <?php if ($obj->get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />
430
 
431
- <select style="border-radius: 5px; margin: 0 0 3px 10px;" title="Default insertion for posts - exceptions can be configured on individual post editor pages" id="enabled-on-which-posts-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_posts(); ?>" style="width:160px">
432
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
433
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
434
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
@@ -448,23 +468,23 @@ function generate_settings_form (){
448
  <td style="padding-left: 8px;">
449
  </td>
450
  <td style="padding-left: 8px;">
451
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
452
- <input id= "display-homepage-<?php echo $ad_number; ?>" style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_home(); ?>" <?php if ($obj->get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> />
453
  <label for="display-homepage-<?php echo $ad_number; ?>" title="Enable or disable insertion on homepage: latest posts (including sub-pages), static page or theme homepage">Homepage</label>
454
  </td>
455
  <td style="padding-left: 8px;">
456
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
457
- <input id= "display-category-<?php echo $ad_number; ?>" style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_category(); ?>" <?php if ($obj->get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
458
  <label for="display-category-<?php echo $ad_number; ?>" title="Enable or disable insertion on category blog pages (including sub-pages)">Category pages</label>
459
  </td>
460
  </tr>
461
 
462
  <tr>
463
  <td style="width: 70%">
464
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
465
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_page(); ?>" id="display-pages-<?php echo $ad_number; ?>" title="Enable or disable insertion on static pages" <?php if ($obj->get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />
466
 
467
- <select style="border-radius: 5px; margin: 0 0 3px 10px;" title="Default insertion for pages - exceptions can be configured on individual page editor pages" id="enabled-on-which-pages-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_pages(); ?>" style="width:160px">
468
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
469
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
470
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
@@ -475,20 +495,20 @@ function generate_settings_form (){
475
  <td style="padding-left: 8px;">
476
  </td>
477
  <td style="padding-left: 8px;">
478
- <input style="border-radius: 5px;;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
479
- <input id= "display-search-<?php echo $ad_number; ?>" style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_search(); ?>" <?php if ($obj->get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> />
480
  <label for="display-search-<?php echo $ad_number; ?>" title="Enable or disable insertion on search blog pages">Search pages</label>
481
  </td>
482
  <td style="padding-left: 8px;">
483
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
484
- <input id= "display-archive-<?php echo $ad_number; ?>" style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_archive(); ?>" <?php if ($obj->get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
485
  <label for="display-archive-<?php echo $ad_number; ?>" title="Enable or disable insertion on tag or archive blog pages">Tag / Archive pages</label>
486
  </td>
487
  </tr>
488
  </table>
489
  </div>
490
 
491
- <div id="block-exceptions-<?php echo $ad_number; ?>" class="responsive-table" style="padding: 7px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px; display: none;">
492
  <?php
493
 
494
  if (!empty ($block_exceptions [$ad_number])) {
@@ -525,11 +545,12 @@ function generate_settings_form (){
525
  ?>
526
  </div>
527
 
528
- <div id="paragraph-settings-<?php echo $ad_number; ?>" style="padding:4px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;<?php echo $paragraph_settings ? "" : " display: none;" ?>">
529
- <div style="margin: 4px 0; height: 26px;">
530
  <div style="float: left; margin-top: 1px;">
531
  Paragraph number(s)
532
- <input style="border-radius: 5px;" type="text"
 
533
  name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
534
  default="<?php echo $default->get_paragraph_number(); ?>"
535
  value="<?php echo $obj->get_paragraph_number(); ?>"
@@ -545,11 +566,11 @@ function generate_settings_form (){
545
  </div>
546
  </div>
547
 
548
- <div id="paragraph-counting-<?php echo $ad_number; ?>" style="padding:4px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;<?php echo $paragraph_counting ? "" : " display: none;" ?>">
549
- <div class="max-input" style="margin: 4px 0 8px 0;">
550
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
551
  Count&nbsp;
552
- <select style="border-radius: 5px;" name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_direction_type(); ?>">
553
  <option value="<?php echo AD_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_TOP; ?></option>
554
  <option value="<?php echo AD_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_BOTTOM; ?></option>
555
  </select>
@@ -557,8 +578,8 @@ function generate_settings_form (){
557
  </span>
558
  <span style="display: table-cell;">
559
  <input
560
- style="border-radius: 5px; width: 100%;"
561
- title="Comma separated HTML tags, usually only 'p' tags are used"
562
  type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
563
  default="<?php echo $default->get_paragraph_tags(); ?>"
564
  value="<?php echo $obj->get_paragraph_tags(); ?>"
@@ -569,7 +590,6 @@ function generate_settings_form (){
569
  &nbsp;
570
  that have between
571
  <input
572
- style="border-radius: 5px;"
573
  type="text"
574
  name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
575
  default="<?php echo $default->get_minimum_paragraph_words(); ?>"
@@ -578,7 +598,6 @@ function generate_settings_form (){
578
  maxlength="5" />
579
  and
580
  <input
581
- style="border-radius: 5px;"
582
  type="text"
583
  name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
584
  default="<?php echo $default->get_maximum_paragraph_words(); ?>"
@@ -593,14 +612,14 @@ function generate_settings_form (){
593
  <div class="max-input" style="margin: 8px 0 8px 0;">
594
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
595
  and
596
- <select style="border-radius: 5px; margin-bottom: 3px;" name="<?php echo AI_OPTION_PARAGRAPH_TEXT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_paragraph_text_type(); ?>">
597
  <option value="<?php echo AD_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_CONTAIN; ?></option>
598
  <option value="<?php echo AD_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_CONTAIN; ?></option>
599
  </select>
600
  </span>
601
  <span class="small-input-tags" style="display: table-cell;">
602
  <input
603
- style="border-radius: 5px; width: 100%;"
604
  title="Comma separated text"
605
  type="text"
606
  name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
@@ -608,35 +627,52 @@ function generate_settings_form (){
608
  value="<?php echo $obj->get_paragraph_text(); ?>"
609
  maxlength="200" />
610
  </span>
611
- <span style="display: table-cell; width: 1px; white-space: nowrap; padding-left: 20px;">
612
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
613
- <input id= "ignore_blockquote-<?php echo $ad_number; ?>" style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_count_inside_blockquote(); ?>" <?php if ($obj->get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />
614
- <label for="ignore_blockquote-<?php echo $ad_number; ?>" title="Count also paragraphs inside <?php echo SPECIAL_ELEMENT_TAGS; ?> elements">Count inside special elements</label>
615
- </span>
616
- </div>
617
-
618
- <div style="margin: 8px 0 4px 0;">
619
  Minimum number of paragraphs
620
  <input
621
- style="border-radius: 5px;"
622
  type="text"
623
  name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
624
  default="<?php echo $default->get_paragraph_number_minimum(); ?>"
625
  value="<?php echo $obj->get_paragraph_number_minimum() ?>"
626
  size="2"
627
  maxlength="3" />
628
- <div style="float: right;">
629
- </div>
630
- <div style="clear: both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  </div>
632
  </div>
633
 
634
- <div id="paragraph-clearance-<?php echo $ad_number; ?>" style="padding:4px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;<?php echo $paragraph_clearance ? "" : " display: none;" ?>">
635
- <div class="max-input" style="margin: 4px 0 8px 0;">
636
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
637
  In
638
  <input
639
- style="border-radius: 5px;"
640
  type="text"
641
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
642
  default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
@@ -648,7 +684,7 @@ function generate_settings_form (){
648
  </span>
649
  <span style="display: table-cell;">
650
  <input
651
- style="border-radius: 5px; width: 100%;"
652
  title="Comma separated text"
653
  type="text"
654
  name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
@@ -658,11 +694,10 @@ function generate_settings_form (){
658
  </span>
659
  </div>
660
 
661
- <div class="max-input" style="margin: 4px 0 8px 0;">
662
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
663
  In
664
  <input
665
- style="border-radius: 5px;"
666
  type="text"
667
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
668
  default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
@@ -674,7 +709,7 @@ function generate_settings_form (){
674
  </span>
675
  <span style="display: table-cell;">
676
  <input
677
- style="border-radius: 5px; width: 100%;"
678
  title="Comma separated text"
679
  type="text"
680
  name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
@@ -684,16 +719,15 @@ function generate_settings_form (){
684
  </span>
685
  </div>
686
 
687
- <div style="margin: 8px 0 4px 0;">
688
  If text is found
689
- <select id="avoid-action-<?php echo $ad_number; ?>" style="border-radius: 5px; margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_ACTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_action(); ?>">
690
  <option value="<?php echo AD_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AD_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_INSERT; ?></option>
691
  <option value="<?php echo AD_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AD_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_TRY_TO_SHIFT_POSITION; ?></option>
692
  </select>
693
  <span id="check-up-to-<?php echo $ad_number; ?>">
694
  &mdash; check up to
695
  <input
696
- style="border-radius: 5px;"
697
  type="text"
698
  name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
699
  default="<?php echo $default->get_avoid_try_limit(); ?>"
@@ -701,7 +735,7 @@ function generate_settings_form (){
701
  size="2"
702
  maxlength="3" />
703
  paragraphs
704
- <select style="border-radius: 5px; margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_direction(); ?>">
705
  <option value="<?php echo AD_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE; ?></option>
706
  <option value="<?php echo AD_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_BELOW; ?></option>
707
  <option value="<?php echo AD_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE_AND_THEN_BELOW; ?></option>
@@ -711,30 +745,30 @@ function generate_settings_form (){
711
  </div>
712
  </div>
713
 
714
- <div id="content-settings-<?php echo $ad_number; ?>" style="padding: 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;<?php echo $content_settings ? "" : " display: none;" ?>">
715
  Post/Static page must have between
716
- <input style="border-radius: 5px;" type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" size="4" maxlength="6" />
717
  and
718
- <input style="border-radius: 5px;" type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" title="Maximum number of post/static page words, leave empty for no limit" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" size="4" maxlength="6" />
719
  words
720
  </div>
721
 
722
- <div class="responsive-table" id="list-settings-<?php echo $ad_number; ?>" style="margin: 8px 0; border: 1px solid #ddd; border-radius: 5px; <?php if (!$show_lists) echo 'display: none;'; ?>">
723
- <table style="padding: 8px 8px 10px 8px;">
724
  <tbody>
725
  <tr>
726
  <td style="padding-right: 7px;">
727
  Categories
728
  </td>
729
  <td style="padding-right: 7px; width: 70%;">
730
- <input style="border-radius: 5px; width: 100%;" title="Comma separated category slugs" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="500" />
731
  </td>
732
  <td style="padding-right: 7px;">
733
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_BLACK_LIST) echo 'checked '; ?> />
734
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist categories"><?php echo AD_BLACK_LIST; ?></label>
735
  </td>
736
  <td>
737
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_WHITE_LIST) echo 'checked '; ?> />
738
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist categories"><?php echo AD_WHITE_LIST; ?></label>
739
  </td>
740
  </tr>
@@ -743,14 +777,14 @@ function generate_settings_form (){
743
  Tags
744
  </td>
745
  <td style="padding-right: 7px;">
746
- <input style="border-radius: 5px; width: 100%;" title="Comma separated tags" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="500"/>
747
  </td>
748
  <td style="padding-right: 7px;">
749
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_BLACK_LIST) echo 'checked '; ?> />
750
  <label for="tag-blacklist-<?php echo $ad_number; ?>" title="Blacklist tags"><?php echo AD_BLACK_LIST; ?></label>
751
  </td>
752
  <td>
753
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_WHITE_LIST) echo 'checked '; ?> />
754
  <label for="tag-whitelist-<?php echo $ad_number; ?>" title="Whitelist tags"><?php echo AD_WHITE_LIST; ?></label>
755
  </td>
756
  </tr>
@@ -759,14 +793,14 @@ function generate_settings_form (){
759
  Taxonomies
760
  </td>
761
  <td style="padding-right: 7px; width: 70%;">
762
- <input style="border-radius: 5px; width: 100%;" title="Comma separated slugs: taxonomy, term or taxonomy:term" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy(); ?>" value="<?php echo $taxonomy_list; ?>" size="54" maxlength="500" />
763
  </td>
764
  <td style="padding-right: 7px;">
765
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="taxonomy-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_BLACK_LIST) echo 'checked '; ?> />
766
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist taxonomies"><?php echo AD_BLACK_LIST; ?></label>
767
  </td>
768
  <td>
769
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="taxonomy-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_WHITE_LIST) echo 'checked '; ?> />
770
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist taxonomies"><?php echo AD_WHITE_LIST; ?></label>
771
  </td>
772
  </tr>
@@ -775,14 +809,14 @@ function generate_settings_form (){
775
  Post IDs
776
  </td>
777
  <td style="padding-right: 7px;">
778
- <input style="border-radius: 5px; width: 100%;" title="Comma separated post/page IDs" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_id_list(); ?>" value="<?php echo $id_list; ?>" size="54" maxlength="500"/>
779
  </td>
780
  <td style="padding-right: 7px;">
781
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="id-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_id_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
782
  <label for="id-blacklist-<?php echo $ad_number; ?>" title="Blacklist IDs"><?php echo AD_BLACK_LIST; ?></label>
783
  </td>
784
  <td>
785
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="id-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_id_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
786
  <label for="id-whitelist-<?php echo $ad_number; ?>" title="Whitelist IDs"><?php echo AD_WHITE_LIST; ?></label>
787
  </td>
788
  </tr>
@@ -791,14 +825,14 @@ function generate_settings_form (){
791
  Urls
792
  </td>
793
  <td style="padding-right: 7px;">
794
- <input style="border-radius: 5px; width: 100%;" title="SPACE separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="500"/>
795
  </td>
796
  <td style="padding-right: 7px;">
797
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
798
  <label for="url-blacklist-<?php echo $ad_number; ?>" title="Blacklist urls"><?php echo AD_BLACK_LIST; ?></label>
799
  </td>
800
  <td>
801
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
802
  <label for="url-whitelist-<?php echo $ad_number; ?>" title="Whitelist urls"><?php echo AD_WHITE_LIST; ?></label>
803
  </td>
804
  </tr>
@@ -807,14 +841,14 @@ function generate_settings_form (){
807
  Url parameters
808
  </td>
809
  <td style="padding-right: 7px;">
810
- <input style="border-radius: 5px; width: 100%;" title="Comma separated url query parameters with optional values (use either 'prameter' or 'prameter=value')" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="500"/>
811
  </td>
812
  <td style="padding-right: 7px;">
813
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
814
  <label for="url-parameter-blacklist-<?php echo $ad_number; ?>" title="Blacklist url parameters"><?php echo AD_BLACK_LIST; ?></label>
815
  </td>
816
  <td>
817
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
818
  <label for="url-parameter-whitelist-<?php echo $ad_number; ?>" title="Whitelist url parameters"><?php echo AD_WHITE_LIST; ?></label>
819
  </td>
820
  </tr>
@@ -823,14 +857,14 @@ function generate_settings_form (){
823
  Referers
824
  </td>
825
  <td style="padding-right: 7px;">
826
- <input style="border-radius: 5px; width: 100%;" title="Comma separated domains, use # for no referer" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="500"/>
827
  </td>
828
  <td style="padding-right: 7px;">
829
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
830
  <label for="referer-blacklist-<?php echo $ad_number; ?>" title="Blacklist referers"><?php echo AD_BLACK_LIST; ?></label>
831
  </td>
832
  <td>
833
- <input style="border-radius: 5px;" type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
834
  <label for="referer-whitelist-<?php echo $ad_number; ?>" title="Whitelist referers"><?php echo AD_WHITE_LIST; ?></label>
835
  </td>
836
  </tr>
@@ -839,12 +873,12 @@ function generate_settings_form (){
839
  </table>
840
  </div>
841
 
842
- <div id="manual-settings-<?php echo $ad_number; ?>" class="small-button" style="padding:7px; margin: 8px 0; text-align: left; border: 1px solid #ddd; border-radius: 5px; <?php if (!$show_manual) echo 'display: none;'; ?>">
843
  <table>
844
  <tr>
845
  <td style="padding: 4px 10px 4px 0;">
846
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
847
- <input style="border-radius: 5px;" id="enable-widget-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_widget(); ?>" <?php if ($obj->get_enable_widget () == AI_ENABLED) echo 'checked '; ?> />
848
  <label for="enable-widget-<?php echo $ad_number; ?>" title="Enable or disable widget for this code block">
849
  Widget
850
  </label>
@@ -856,8 +890,8 @@ function generate_settings_form (){
856
  </tr>
857
  <tr>
858
  <td style="padding: 4px 10px 4px 0;">
859
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
860
- <input style="border-radius: 5px;" type="checkbox" id="enable-shortcode-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($obj->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> />
861
  <label for="enable-shortcode-<?php echo $ad_number; ?>" title="Enable or disable shortcode for manual insertion of this code block in posts and pages">
862
  Shortcode
863
  </label>
@@ -869,8 +903,8 @@ function generate_settings_form (){
869
  </tr>
870
  <tr>
871
  <td style="padding: 4px 10px 4px 0;">
872
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
873
- <input style="border-radius: 5px;" id="enable-php-call-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_php_call(); ?>" <?php if ($obj->get_enable_php_call () == AI_ENABLED) echo 'checked '; ?> />
874
  <label for="enable-php-call-<?php echo $ad_number; ?>" title="Enable or disable PHP function call to insert this code block at any position in template file. If function is disabled for block it will return empty string.">
875
  PHP function
876
  </label>
@@ -882,25 +916,43 @@ function generate_settings_form (){
882
  </table>
883
  </div>
884
 
885
- <div id="misc-settings-<?php echo $ad_number; ?>" style="margin: 8px 0; padding: 0 8px; border: 1px solid #ddd; border-radius: 5px; <?php if (!$show_misc) echo 'display: none;'; ?>">
886
- <div class="max-input" style="margin: 8px 0;">
887
- <span style="display: table-cell;">
888
  Insert for
889
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-users-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_USERS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_users(); ?>" style="width:160px">
890
  <option value="<?php echo AD_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ALL_USERS; ?></option>
891
  <option value="<?php echo AD_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_LOGGED_IN_USERS; ?></option>
892
  <option value="<?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
893
  <option value="<?php echo AD_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ADMINISTRATORS; ?></option>
894
  </select>
895
  </span>
896
- <span style="display: table-cell;">
897
- Max <input style="border-radius: 5px;" type="text" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="2" maxlength="3" title="Empty or 0 means no limit" /> insertions
 
898
  </span>
899
- <span style="display: table-cell;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
  General tag
 
901
  </span>
902
  <span style="display: table-cell;">
903
- <input style="border-radius: 5px; width: 100%;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" maxlength="40" title="Used for {tags} when no page data is found" />
904
  </span>
905
  </div>
906
 
@@ -910,66 +962,58 @@ function generate_settings_form (){
910
  Filter insertions
911
  </span>
912
  <span style="display: table-cell;">
913
- <input style="border-radius: 5px; width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "Filter insertions by specifying wanted calls for this block - single number or comma separated numbers, empty means all / no limits. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="24" />
914
  </span>
915
  <span style="display: table-cell;">
916
  &nbsp;&nbsp;&nbsp;using
917
- <select style="border-radius: 5px; margin-bottom: 3px;" id="filter-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_FILTER_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_filter_type(); ?>" style="width:160px">
918
- <option value="<?php echo AI_OPTION_FILTER_AUTO; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_AUTO) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_AUTO; ?></option>
919
- <option value="<?php echo AI_OPTION_FILTER_PHP_FUNCTION_CALLS; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_PHP_FUNCTION_CALLS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_PHP_FUNCTION_CALLS; ?></option>
920
- <option value="<?php echo AI_OPTION_FILTER_CONTENT_PROCESSING; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_CONTENT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_CONTENT_PROCESSING; ?></option>
921
- <option value="<?php echo AI_OPTION_FILTER_EXCERPT_PROCESSING; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_EXCERPT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_EXCERPT_PROCESSING; ?></option>
922
- <option value="<?php echo AI_OPTION_FILTER_BEFORE_POST_PROCESSING; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_BEFORE_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_BEFORE_POST_PROCESSING; ?></option>
923
- <option value="<?php echo AI_OPTION_FILTER_AFTER_POST_PROCESSING; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_AFTER_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_AFTER_POST_PROCESSING; ?></option>
924
- <option value="<?php echo AI_OPTION_FILTER_WIDGET_DRAWING; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_WIDGET_DRAWING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_WIDGET_DRAWING; ?></option>
925
- <option value="<?php echo AI_OPTION_FILTER_SUBPAGES; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_SUBPAGES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_SUBPAGES; ?></option>
926
- <option value="<?php echo AI_OPTION_FILTER_POSTS; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_POSTS; ?></option>
927
- <option value="<?php echo AI_OPTION_FILTER_COMMENTS; ?>" <?php echo ($obj->get_filter_type()==AI_OPTION_FILTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_OPTION_FILTER_COMMENTS; ?></option>
 
928
  </select>
929
  counter
930
  </span>
931
  <span style="display: table-cell;">
932
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
933
- <input style="border-radius: 5px; margin-left: 10px;" id="enable-ajax-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_ajax(); ?>" <?php if ($obj->get_enable_ajax () == AI_ENABLED) echo 'checked '; ?> />
934
- <label for="enable-ajax-<?php echo $ad_number; ?>" title="Enable or disable insertion in Ajax requests">Ajax</label>
935
- </span>
936
- <span style="display: table-cell;">
937
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
938
- <input style="border-radius: 5px; margin-left: 10px;" id="enable-feed-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_feed(); ?>" <?php if ($obj->get_enable_feed () == AI_ENABLED) echo 'checked '; ?> />
939
- <label for="enable-feed-<?php echo $ad_number; ?>" title="Enable or disable insertion in feeds">Feed</label>
940
- </span>
941
- <span style="display: table-cell;">
942
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
943
- <input style="border-radius: 5px; margin-left: 10px;" id="enable-404-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($obj->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
944
- <label for="enable-404-<?php echo $ad_number; ?>" title="Enable or disable insertion on page for Error 404: Page not found">404</label>
945
  </span>
946
  </div>
947
  </div>
948
 
949
- <div style="margin: 8px 0;">
950
- <select style="border-radius: 5px; margin-bottom: 0px;" id="scheduling-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_scheduling(); ?>">
951
  <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
952
  <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
953
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
954
  </select>
955
 
956
  <span id="scheduling-delay-<?php echo $ad_number; ?>">
957
- for <input style="border-radius: 5px;" type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" size="2" maxlength="3" /> days after publishing
958
  </span>
959
  <span id="scheduling-delay-warning-<?php echo $ad_number; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
960
 
961
  <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($ad_number, $obj, $default); ?>
962
  </div>
963
 
 
964
  </div>
965
 
966
- <div id="device-detection-settings-<?php echo $ad_number; ?>" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px; <?php if (!$show_devices) echo 'display: none;'; ?>">
967
  <table>
968
  <tr>
969
  <td>
970
  <div style="margin-bottom: 5px;">
971
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
972
- <input id="client-side-detection-<?php echo $ad_number; ?>" style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_detection_client_side(); ?>" <?php if ($obj->get_detection_client_side ()==AI_ENABLED) echo 'checked '; ?> />
973
  <label for="client-side-detection-<?php echo $ad_number; ?>">Use client-side detection to show only on:</label>
974
  </div>
975
 
@@ -981,8 +1025,8 @@ function generate_settings_form (){
981
  if ($viewport_name != '') {
982
  ?>
983
  <div style="margin: 8px 0;">
984
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
985
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="viewport-<?php echo $viewport, "-", $ad_number; ?>" value="1" default="<?php echo $default->get_detection_viewport ($viewport); ?>" <?php if ($obj->get_detection_viewport ($viewport)==AI_ENABLED) echo 'checked '; ?> />
986
  <label for="viewport-<?php echo $viewport, "-", $ad_number; ?>" title="Device min width <?php echo get_viewport_width ($viewport); ?> px"><?php echo $viewport_name; ?></label>
987
  </div>
988
  <?php
@@ -991,12 +1035,12 @@ function generate_settings_form (){
991
  ?>
992
  </div>
993
  </td><td style="padding-left: 40px; vertical-align: top;">
994
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
995
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="server-side-detection-<?php echo $ad_number; ?>" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($obj->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
996
  <label for="server-side-detection-<?php echo $ad_number; ?>">Use server-side detection to insert code only for </label>
997
 
998
  <div style="margin: 10px 0 10px 40px;">
999
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-devices-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_devices(); ?>" style="width:160px">
1000
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1001
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1002
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
@@ -1011,7 +1055,7 @@ function generate_settings_form (){
1011
  </table>
1012
  </div>
1013
 
1014
- <div id="no-wrapping-warning-<?php echo $ad_number; ?>" style="padding:8px; margin: 8px 0 8px 5px; border: 1px solid #ddd; border-radius: 5px; display: none;">
1015
  <span id="" style="margin-top: 5px;"><strong><span style="color: red;">WARNING:</span> No Wrapping</strong> style has no HTML code for client-side device detection!</span>
1016
  </div>
1017
 
@@ -1022,17 +1066,17 @@ function generate_settings_form (){
1022
  ?>
1023
  <div id="tab-0" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
1024
  <div style="margin: 16px 0 16px 4px;">
1025
- <h3 style="margin: 0; float: left;"><?php echo AD_INSERTER_NAME ?> Settings <?php if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'])) echo (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][0].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][1]), '.',
1026
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
1027
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]); ?></h3>
1028
- <h4 style="margin: 0px; float: right;" title="Settings timestamp"><?php echo isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : ""; ?></h4>
1029
  <div style="clear: both;"></div>
1030
  </div>
1031
 
1032
  <div style="margin: 16px 0;">
1033
  <div style="float: right;">
1034
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1035
- <input style="display: none; border-radius: 5px; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save Settings" type="submit" style="width:120px; font-weight: bold;" />
1036
  </div>
1037
 
1038
  <div style="float: left; color: red;">
@@ -1047,6 +1091,10 @@ function generate_settings_form (){
1047
 
1048
  if ($enabled_h) $style_h = "font-weight: bold; color: #66f;"; else $style_h = "";
1049
  if ($enabled_f) $style_f = "font-weight: bold; color: #66f;"; else $style_f = "";
 
 
 
 
1050
  if (false) $style_d = "font-weight: bold; color: #e44;"; else $style_d = "";
1051
  ?>
1052
 
@@ -1057,20 +1105,23 @@ function generate_settings_form (){
1057
  <li id="ai-h" class="ai-plugin-tab"><a href="#tab-header"><span style="<?php echo $style_h ?>">Header</span></a></li>
1058
  <li id="ai-f" class="ai-plugin-tab"><a href="#tab-footer"><span style="<?php echo $style_f ?>">Footer</span></a></li>
1059
  <?php if (function_exists ('ai_plugin_settings_tab')) ai_plugin_settings_tab ($exceptions); ?>
 
 
 
1060
  <li id="ai-d" class="ai-plugin-tab"><a href="#tab-debugging"><span style="<?php echo $style_d ?>">Debugging</span></a></li>
1061
  </ul>
1062
 
1063
- <div id="tab-general" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1064
 
1065
- <table style="width: 100%;">
1066
  <?php if (function_exists ('ai_general_settings')) ai_general_settings (); ?>
1067
  <tr>
1068
- <td style="padding-left: 10px;">
1069
  Syntax Highlighter Theme
1070
  </td>
1071
  <td>
1072
  <select
1073
- style="border-radius: 5px; width:220px"
1074
  id="syntax-highlighter-theme"
1075
  name="syntax-highlighter-theme"
1076
  value="Value">
@@ -1117,29 +1168,29 @@ function generate_settings_form (){
1117
  </td>
1118
  </tr>
1119
  <tr>
1120
- <td style="padding-left: 10px;">
1121
  Block Class Name
1122
  </td>
1123
  <td>
1124
- <input style="border-radius: 5px; margin-left: 0px;" title="CSS Class Name for the wrapping div" type="text" id="block-class-name" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="15" maxlength="40" />
1125
  </td>
1126
  </tr>
1127
  <tr>
1128
- <td style="padding: 0 10px;">
1129
  Minimum User Role for Exceptions Editing
1130
  </td>
1131
  <td>
1132
- <select style="border-radius: 5px; margin-bottom: 3px;" id="minimum-user-role" name="minimum-user-role" selected-value="1" data="<?php echo get_minimum_user_role (); ?>" default="<?php echo DEFAULT_MINIMUM_USER_ROLE; ?>" style="width:300px">
1133
  <?php wp_dropdown_roles (get_minimum_user_role ()); ?>
1134
  </select>
1135
  </td>
1136
  </tr>
1137
  <tr>
1138
- <td style="padding-left: 10px;">
1139
  Dynamic blocks
1140
  </td>
1141
  <td>
1142
- <select style="border-radius: 5px; margin-bottom: 3px;" id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
1143
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
1144
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
1145
  <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
@@ -1147,48 +1198,57 @@ function generate_settings_form (){
1147
  </td>
1148
  </tr>
1149
  <tr>
1150
- <td style="padding-left: 10px;">
1151
  Functions for Paragraph Counting
1152
  </td>
1153
  <td>
1154
- <select style="border-radius: 5px; margin-bottom: 3px;" id="paragraph_counting_functions" name="paragraph_counting_functions" default="<?php echo DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS; ?>" title="Standard PHP functions are faster and work in most cases, use Multibyte functions if paragraphs are not counted properly on non-english pages.">
1155
  <option value="<?php echo AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STANDARD; ?></option>
1156
  <option value="<?php echo AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MULTIBYTE; ?></option>
1157
  </select>
1158
  </td>
1159
  </tr>
1160
  <tr>
1161
- <td style="padding-left: 10px;">
 
 
 
 
 
 
 
 
1162
  Sticky Widget Top Margin
1163
  </td>
1164
  <td>
1165
- <input style="border-radius: 5px;" type="text" name="sticky-widget-margin" value="<?php echo get_sticky_widget_margin (); ?>" default="<?php echo DEFAULT_STICKY_WIDGET_MARGIN; ?>" size="6" maxlength="4" /> px
1166
  </td>
1167
  </tr>
1168
  <tr>
1169
- <td style="padding-left: 10px;">
1170
  Plugin priority
1171
  </td>
1172
  <td>
1173
- <input style="border-radius: 5px;" type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" default="<?php echo DEFAULT_PLUGIN_PRIORITY; ?>" size="6" maxlength="6" />
1174
  </td>
1175
  </tr>
1176
  </table>
1177
  </div>
1178
 
1179
- <div id="tab-viewports" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1180
- <div style="margin: 8px;">
1181
  Viewport Settings used for client-side device detection
1182
  </div>
1183
  <?php
1184
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
 
1185
  ?>
1186
- <div style="margin: 8px;">
1187
  Viewport <?php echo $viewport; ?> name&nbsp;&nbsp;&nbsp;
1188
- <input style="border-radius: 5px; margin-left: 0px;" type="text" id="option-name-<?php echo $viewport; ?>" name="viewport-name-<?php echo $viewport; ?>" value="<?php echo get_viewport_name ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_NAME_" . $viewport) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport) : ""; ?>" size="15" maxlength="40" />
1189
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '<span style="display: none;">' ?>
1190
  &nbsp;&nbsp; min width
1191
- <input style="border-radius: 5px;" type="text" id="option-length-<?php echo $viewport; ?>" name="viewport-width-<?php echo $viewport; ?>" value="<?php echo get_viewport_width ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) : ""; ?>" size="4" maxlength="4" /> px
1192
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '</span>' ?>
1193
  </div>
1194
  <?php
@@ -1230,11 +1290,11 @@ function generate_settings_form (){
1230
  <textarea id="block-h" name="<?php echo AI_OPTION_CODE, '_block_h'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adH->get_ad_data()); ?></textarea>
1231
  </div>
1232
 
1233
- <div id="device-detection-settings-h" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1234
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" value="0" />
1235
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" id="server-side-detection-h" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1236
  <label for="server-side-detection-h">Use server-side detection to insert code only for </label>
1237
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-devices-h" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1238
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1239
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1240
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
@@ -1244,9 +1304,9 @@ function generate_settings_form (){
1244
  </select>
1245
  devices
1246
 
1247
- <span style="float: right; margin-top: 6px;">
1248
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
1249
- <input style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" id="enable-header-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1250
  <label for="enable-header-404" title="Enable or disable insertion of this code into HTML page header on page for Error 404: Page not found">Insert on Error 404 page</label>
1251
  </span>
1252
  </div>
@@ -1286,11 +1346,11 @@ function generate_settings_form (){
1286
  <textarea id="block-f" name="<?php echo AI_OPTION_CODE, '_block_f'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adF->get_ad_data()); ?></textarea>
1287
  </div>
1288
 
1289
- <div id="device-detection-settings-f" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1290
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" value="0" />
1291
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" id="server-side-detection-f" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1292
  <label for="server-side-detection-f">Use server-side detection to insert code only for </label>
1293
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-devices-f" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1294
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1295
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1296
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
@@ -1300,9 +1360,9 @@ function generate_settings_form (){
1300
  </select>
1301
  devices
1302
 
1303
- <span style="float: right; margin-top: 6px;">
1304
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
1305
- <input style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" id="enable-footer-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1306
  <label for="enable-footer-404" title="Enable or disable insertion of this code into HTML page footer on page for Error 404: Page not found">Insert on Error 404 page</label>
1307
  </span>
1308
  </div>
@@ -1310,23 +1370,176 @@ function generate_settings_form (){
1310
 
1311
  <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
1312
 
1313
- <div id="tab-debugging" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1314
- <div style="margin: 8px;">
1315
- <input style="border-radius: 5px;" type="hidden" name="admin_toolbar_debugging" value="0" />
1316
- <input style="border-radius: 5px;" type="checkbox" name="admin_toolbar_debugging" id="admin-toolbar-debugging" value="1" default="<?php echo DEFAULT_ADMIN_TOOLBAR_DEBUGGING; ?>" <?php if (get_admin_toolbar_debugging ()==AI_ENABLED) echo 'checked '; ?> />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1317
  <label for="admin-toolbar-debugging" title="Enable or disable debugging functions in admin toolbar">Debugging functions in admin toolbar</label>
1318
  </div>
1319
 
1320
- <div style="margin: 8px;">
1321
- <input style="border-radius: 5px;" type="hidden" name="remote_debugging" value="0" />
1322
- <input style="border-radius: 5px;" type="checkbox" name="remote_debugging" id="remote-debugging" value="1" default="<?php echo DEFAULT_REMOTE_DEBUGGING; ?>" <?php if (get_remote_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1323
  <label for="remote-debugging" title="Enable Debugger widget and code insertion debugging (blocks, positions, tags, processing) by url parameters for non-logged in users. Enable this option to allow other people to see Debugger widget, labeled blocks and positions in order to help you to diagnose problems. For logged in administrators debugging is always enabled.">Remote debugging</label>
1324
  </div>
1325
 
1326
  <div id="system-debugging" style="display: none;">
1327
- <div style="margin: 8px;">
1328
- <input style="border-radius: 5px;" type="hidden" name="javascript_debugging" value="0" />
1329
- <input style="border-radius: 5px;" type="checkbox" name="javascript_debugging"id="javascript-debugging" value="1" default="<?php echo DEFAULT_JAVASCRIPT_DEBUGGING; ?>" <?php if (get_javascript_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1330
  <label for="javascript-debugging" title="Enable Javascript console output">Javascript debugging</label>
1331
  </div>
1332
 
@@ -1341,27 +1554,27 @@ function generate_settings_form (){
1341
 
1342
  <?php if (!function_exists ('ai_settings_side')) { ?>
1343
 
1344
- <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1345
  <div style="float: left;">
1346
- <h2 style="display: inline-block; margin: 13px 0;">Looking for AdSense alternative?</h2>
1347
  </div>
1348
  <div style="clear: both;"></div>
1349
  </div>
1350
 
1351
- <div class="ai-form" style="height: 90px; margin: 8px 0; padding: 8px 4px 8px 12px;border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1352
- <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
1353
  </div>
1354
 
1355
- <!--<div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">-->
1356
  <!-- <div style="float: left;">-->
1357
- <!-- <h2 style="display: inline-block; margin: 13px 0;">WordPress [Great Content] + Ad Inserter [AdSense, Amazon, media.net] = ?</h2>-->
1358
  <!-- </div>-->
1359
  <!-- <div style="clear: both;"></div>-->
1360
  <!--</div>-->
1361
 
1362
  <?php } ?>
1363
 
1364
- <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="<?php echo $active_tab; ?>" />
1365
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
1366
 
1367
  </form>
@@ -1373,30 +1586,33 @@ function generate_settings_form (){
1373
  <?php
1374
  if ($subpage == 'main') {
1375
  if (function_exists ('ai_settings_side')) ai_settings_side (); else { ?>
1376
- <div style="float: left;">
1377
- <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1378
  <div style="float: left;">
1379
- <h2 style="display: inline-block; margin: 13px 0;">Support plugin development</h2>
1380
  </div>
1381
  <div style="float: right;">
1382
- <h2 style="display: inline-block; margin: 13px 0;">Follow Ad Inserter</h2>
1383
- <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>twitter.png" style="vertical-align: middle; margin: 0 10px 6px 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter on Twitter" /></a>
1384
- <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>facebook.png" style="vertical-align: middle; margin: 0 10px 6px 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter on Facebook" /></a>
 
 
1385
  </div>
1386
 
1387
  <div style="clear: both;"></div>
1388
  </div>
1389
 
1390
- <div class="ai-form header no-select" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1391
- <ul>
1392
  <li><strong>&squf;</strong>
1393
  If you like Ad Inserter please do me a big favor and give plugin a 5 star rating on the <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">review page</a>.
1394
 
1395
- <img id="ai-stars" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>stars.png" style="margin: 0 0 -3px 80px; cursor: pointer;" />
1396
 
1397
- <div id="ai-rating-bar" class="header" style="cursor: pointer; margin-left: 4px; width: 148px; display: none;" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">
 
1398
  <div class="header" style="background: #ccc;" title="Average rating of the plugin - Thank you!">
1399
- <div id="rating-value" style="text-align: center; font-size: 11px; line-height: 12px; border-radius: 2px; background: #fddf87; height: 100%; <?php echo $rating_css; ?>"><span style=""><?php echo $rating; ?></span></div>
1400
  </div>
1401
  </div>
1402
  </li>
@@ -1413,16 +1629,14 @@ function generate_settings_form (){
1413
  Thank you! Igor <img draggable="false" class="emoji" alt="happy" src="https://s.w.org/images/core/emoji/2.3/svg/1f642.svg" style="margin-left: 5px!important;"></p>
1414
  </div>
1415
 
1416
- <div class="ai-form" style="padding: 2px 8px 6px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
1417
  <div style="float: right;" >
1418
  <div>
1419
- <a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" title="Automate ad placement on posts and pages" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>
1420
- </div>
1421
- <div>
1422
- <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
1423
  </div>
1424
  <div>
1425
- <a href='http://amzn.to/2uWiu8w' class="clear-link" title="Do you want to earn a living doing what you love?" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>how-to-monetize-a-small-blog.png" style="margin-top: 10px;" /></a>
 
1426
  </div>
1427
  </div>
1428
 
@@ -1477,21 +1691,38 @@ function generate_settings_form (){
1477
  }
1478
  }
1479
  ?>
 
1480
  <script type="text/javascript">
1481
- // setTimeout (show_blocked_warning, 4000);
1482
-
1483
  jQuery(document).ready(function($) {
1484
- setTimeout (show_blocked_warning, 400);
1485
  });
1486
 
1487
- function show_blocked_warning () {
 
 
 
 
 
 
 
 
 
 
 
1488
  jQuery("#blocked-warning.warning-enabled").show ();
1489
  jQuery("#blocked-warning.warning-enabled .blocked-warning-text").css ('color', '#00f');
1490
 
1491
- var image = jQuery("#pro-image");
1492
- if (image.height () < 100) {
1493
- image.hide ().after (image.clone ().attr ('class', '').attr ("id", 'pro-image-ajax').attr ('src', '<?php echo wp_make_link_relative (get_site_url()); ?>/wp-admin/admin-ajax.php?action=ai_data&image=ad-inserter-pro.jpg&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>').css ('display', 'block'));
1494
  }
 
 
 
 
 
 
 
1495
  }
1496
  </script>
1497
 
20
  $end = 16;
21
  if (function_exists ('ai_settings_parameters')) ai_settings_parameters ($subpage, $start, $end);
22
 
23
+ if (isset ($_POST ['ai-active-tab'])) {
24
+ $active_tabs = json_decode ($_POST ['ai-active-tab']);
25
+ if ($active_tabs == null) $active_tabs = array (1, 0);
26
+ }
27
+
28
  if (isset ($_GET ['tab'])) $active_tab = $_GET ['tab']; else
29
+ $active_tab = isset ($active_tabs [0]) ? $active_tabs [0] : 1;
30
  if (!is_numeric ($active_tab)) $active_tab = 1;
31
  if ($active_tab != 0)
32
  if ($active_tab < $start || $active_tab > $end) $active_tab = $start;
33
 
34
+ $active_tab_0 = isset ($active_tabs [1]) ? $active_tabs [1] : 0;
35
+
36
  $adH = $block_object [AI_HEADER_OPTION_NAME];
37
  $adF = $block_object [AI_FOOTER_OPTION_NAME];
38
 
39
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
40
+ $adA = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
41
+ }
42
+
43
  $syntax_highlighter_theme = get_syntax_highlighter_theme ();
44
  $block_class_name = get_block_class_name ();
45
 
91
  }
92
  }
93
 
94
+ if ($rating_string = get_transient (AI_TRANSIENT_RATING)) {
95
+ if ($rating_string < 1 && $rating_string > 5) $rating_string = '';
 
 
96
  }
97
+ $rating_css = $rating_string == '' ? 'width: 100%;' : 'width: '.number_format ($rating_string * 20, 4).'%;';
98
+ $rating_value = $rating_string == '' ? '' : number_format ($rating_string, 1);
99
 
100
  ?>
101
 
108
 
109
  <div id="ai-settings" style="float: left;">
110
 
111
+ <form id="ai-form" class="no-select rounded" style="float: left;" action="<?php echo $save_url; ?>" method="post" name="ai_form" start="<?php echo $start; ?>" end="<?php echo $end; ?>">
112
 
113
+ <div id="header" class="ai-form header rounded">
114
  <?php
115
  if (function_exists ('ai_settings_header')) ai_settings_header ($start, $active_tab); else { ?>
116
 
117
  <div style="float: left;">
118
+ <h2 id="plugin_name" style="display: inline-block; margin: 5px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
119
  </div>
120
  <div id="header-buttons">
121
  <a style="text-decoration: none;" href="http://adinserter.pro/documentation" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 62px;" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button></a>
131
  ?>
132
  </div>
133
 
134
+ <div id="javascript-warning" class="ai-form rounded" style="display: none;">
135
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
136
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
137
  <span id="javascript-version-parameter" style="display: none;">Wrong version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
138
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
139
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
142
  <div style="clear: both;"></div>
143
  </div>
144
 
145
+ <div id="css-warning" class="ai-form rounded" style="display: none;">
146
  <h2 id="css-version" style="float: left; color: red;" title="Loaded plugin CSS version">&nbsp;</h2>
147
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
148
  <span id="css-version-parameter" style="display: none;">Wrong version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
149
  <span id="css-version-parameter-missing" style="display: none;">Missing version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
150
  Incompatible (old) CSS file loaded, probably due to inappropriate caching.<br />
153
  <div style="clear: both;"></div>
154
  </div>
155
 
156
+ <div id="blocked-warning" class="ai-form warning-enabled rounded">
157
  <h2 class="blocked-warning-text" style="float: left; color: red;" title="Error loading page">PAGE BLOCKED</h2>
158
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
159
  This page was not loaded properly. Please check browser and plugins that may block CSS/javascript<br />
160
+ files or images for this page. For <strong>Ad Blocker</strong> select "Disable on this page" or "Don't run on this page".
161
  </div>
162
  <div style="clear: both;"></div>
163
  </div>
164
 
165
+ <div id="ai-tab-container" class="ai-form rounded" style="padding-bottom: 1px;">
166
  <div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
167
 
168
  <div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
271
  $enabled_h = $adH->get_enable_manual () && $adH->get_ad_data() != "";
272
  $enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
273
  if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
274
+
275
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
276
+ $enabled_a = $adA->get_enable_manual ();
277
+ if ($enabled_a) $title_hf .= ", Ad blocking detection code";
278
+ if ($enabled_a) $class_hf = " on";
279
+ }
280
+
281
  ?>
282
+ <li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> General Settings<?php echo $title_hf ?>" style=" margin: 1px 0 0 0;"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"></div></a></li>
283
  </ul>
284
 
285
  <?php
286
  for ($ad_number = $start; $ad_number <= $end; $ad_number ++){
287
 
288
  $default->number = $ad_number;
289
+ $default->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$ad_number;
290
 
291
  $tab_visible = $ad_number == $active_tab || $generate_all;
292
 
311
 
312
  $scheduling_active = $obj->get_scheduling() != AI_SCHEDULING_OFF;
313
 
314
+ $show_misc = $scheduling_active || !empty ($obj->get_maximum_insertions ()) || !empty ($obj->get_call_filter()) || $obj->get_inverted_filter() || $obj->get_display_for_users() != AD_DISPLAY_ALL_USERS || $obj->get_enable_404 () == AI_ENABLED || $obj->get_enable_feed () == AI_ENABLED;
315
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
316
 
317
  $automatic_insertion = $obj->get_automatic_insertion();
327
  $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() ||
328
  $obj->get_paragraph_text() != $default->get_paragraph_text() ||
329
  $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() ||
330
+ $obj->get_minimum_words_above() != $default->get_minimum_words_above() ||
331
  $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote();
332
 
333
  $paragraph_clearance =
334
  ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) ||
335
  ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0);
336
 
337
+ $filter_type = $obj->get_filter_type();
338
+
339
  ?>
340
  <div id="tab-<?php echo $ad_number; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
341
  <div id="toolbar-<?php echo $ad_number; ?>" class="max-input" style="margin: 8px 0; height: 28px; margin-bottom: 2px;">
342
  <span id="name-label-container-<?php echo $ad_number; ?>" style="display: table-cell; padding: 0; font-weight: bold; cursor: pointer;">
343
+ <input id="name-edit-<?php echo $ad_number; ?>" style="width: 100%; vertical-align: middle; font-size: 14px; display: none;" type="text" name="<?php echo AI_OPTION_BLOCK_NAME, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
344
  <span id="name-label-<?php echo $ad_number; ?>" class="no-select" style="width: 100%; max-width: 440px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top: 4px; margin-left: 7px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name() ?></span>
345
  </span>
346
  <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
376
  </div>
377
  <div style="float: right;">
378
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
379
+ <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
380
  <?php } ?>
381
  </div>
382
  <div style="clear: both;"></div>
383
  </div>
384
 
385
+ <div class="rounded">
386
  <div style="float: left;">
387
  Automatic Insertion:
388
+ <select style="margin-bottom: 3px;" id="display-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_automatic_insertion(); ?>" style="width:200px;">
389
  <option data-img-src="<?php echo plugins_url ('images/disabled.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
390
  <option data-img-src="<?php echo plugins_url ('images/before-post.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
391
  <option data-img-src="<?php echo plugins_url ('images/before-content.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
404
 
405
  <div style="float: right;">
406
  Alignment and Style:&nbsp;&nbsp;&nbsp;
407
+ <select style="width:120px;" id="block-alignment-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_alignment_type(); ?>">
408
  <option data-img-src="<?php echo plugins_url ('images/default.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
409
  <option data-img-src="<?php echo plugins_url ('images/align-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
410
  <option data-img-src="<?php echo plugins_url ('images/center.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
425
  <div id="alignment-style-<?php echo $ad_number; ?>" style="margin-bottom: 4px;"></div>
426
  <div class="max-input">
427
  <span id="css-label-<?php echo $ad_number; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
428
+ <input id="custom-css-<?php echo $ad_number; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
429
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
430
  <span id="css-no-wrapping-<?php echo $ad_number; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
431
  <span id="css-none-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
441
  </div>
442
  </div>
443
 
444
+ <div class="responsive-table small-button rounded">
445
  <table>
446
  <tr>
447
  <td style="width: 70%">
448
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
449
+ <input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_post(); ?>" id="display-posts-<?php echo $ad_number; ?>" title="Enable or disable insertion on posts" <?php if ($obj->get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />
450
 
451
+ <select style="margin: 0 0 3px 10px;" title="Default insertion for posts - exceptions can be configured on individual post editor pages" id="enabled-on-which-posts-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_posts(); ?>" style="width:160px">
452
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
453
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
454
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
468
  <td style="padding-left: 8px;">
469
  </td>
470
  <td style="padding-left: 8px;">
471
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
472
+ <input id= "display-homepage-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_home(); ?>" <?php if ($obj->get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> />
473
  <label for="display-homepage-<?php echo $ad_number; ?>" title="Enable or disable insertion on homepage: latest posts (including sub-pages), static page or theme homepage">Homepage</label>
474
  </td>
475
  <td style="padding-left: 8px;">
476
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
477
+ <input id= "display-category-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_category(); ?>" <?php if ($obj->get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
478
  <label for="display-category-<?php echo $ad_number; ?>" title="Enable or disable insertion on category blog pages (including sub-pages)">Category pages</label>
479
  </td>
480
  </tr>
481
 
482
  <tr>
483
  <td style="width: 70%">
484
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
485
+ <input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_page(); ?>" id="display-pages-<?php echo $ad_number; ?>" title="Enable or disable insertion on static pages" <?php if ($obj->get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />
486
 
487
+ <select style="margin: 0 0 3px 10px;" title="Default insertion for pages - exceptions can be configured on individual page editor pages" id="enabled-on-which-pages-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_pages(); ?>" style="width:160px">
488
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
489
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
490
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
495
  <td style="padding-left: 8px;">
496
  </td>
497
  <td style="padding-left: 8px;">
498
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
499
+ <input id= "display-search-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_search(); ?>" <?php if ($obj->get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> />
500
  <label for="display-search-<?php echo $ad_number; ?>" title="Enable or disable insertion on search blog pages">Search pages</label>
501
  </td>
502
  <td style="padding-left: 8px;">
503
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
504
+ <input id= "display-archive-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_archive(); ?>" <?php if ($obj->get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
505
  <label for="display-archive-<?php echo $ad_number; ?>" title="Enable or disable insertion on tag or archive blog pages">Tag / Archive pages</label>
506
  </td>
507
  </tr>
508
  </table>
509
  </div>
510
 
511
+ <div id="block-exceptions-<?php echo $ad_number; ?>" class="responsive-table rounded" style="display: none;">
512
  <?php
513
 
514
  if (!empty ($block_exceptions [$ad_number])) {
545
  ?>
546
  </div>
547
 
548
+ <div id="paragraph-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_settings ? "" : " display: none;" ?>">
549
+ <div style="height: 26px;">
550
  <div style="float: left; margin-top: 1px;">
551
  Paragraph number(s)
552
+ <input
553
+ type="text"
554
  name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
555
  default="<?php echo $default->get_paragraph_number(); ?>"
556
  value="<?php echo $obj->get_paragraph_number(); ?>"
566
  </div>
567
  </div>
568
 
569
+ <div id="paragraph-counting-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_counting ? "" : "display: none;" ?>">
570
+ <div class="max-input" style="margin: 0 0 8px 0;">
571
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
572
  Count&nbsp;
573
+ <select name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_direction_type(); ?>">
574
  <option value="<?php echo AD_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_TOP; ?></option>
575
  <option value="<?php echo AD_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_BOTTOM; ?></option>
576
  </select>
578
  </span>
579
  <span style="display: table-cell;">
580
  <input
581
+ style="width: 100%;"
582
+ title="Comma separated HTML tag names, usually only 'p' tags are used"
583
  type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
584
  default="<?php echo $default->get_paragraph_tags(); ?>"
585
  value="<?php echo $obj->get_paragraph_tags(); ?>"
590
  &nbsp;
591
  that have between
592
  <input
 
593
  type="text"
594
  name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
595
  default="<?php echo $default->get_minimum_paragraph_words(); ?>"
598
  maxlength="5" />
599
  and
600
  <input
 
601
  type="text"
602
  name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
603
  default="<?php echo $default->get_maximum_paragraph_words(); ?>"
612
  <div class="max-input" style="margin: 8px 0 8px 0;">
613
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
614
  and
615
+ <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_PARAGRAPH_TEXT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_paragraph_text_type(); ?>">
616
  <option value="<?php echo AD_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_CONTAIN; ?></option>
617
  <option value="<?php echo AD_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_CONTAIN; ?></option>
618
  </select>
619
  </span>
620
  <span class="small-input-tags" style="display: table-cell;">
621
  <input
622
+ style="width: 100%;"
623
  title="Comma separated text"
624
  type="text"
625
  name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
627
  value="<?php echo $obj->get_paragraph_text(); ?>"
628
  maxlength="200" />
629
  </span>
630
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
631
+ &nbsp;&nbsp;
 
 
 
 
 
 
632
  Minimum number of paragraphs
633
  <input
 
634
  type="text"
635
  name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
636
  default="<?php echo $default->get_paragraph_number_minimum(); ?>"
637
  value="<?php echo $obj->get_paragraph_number_minimum() ?>"
638
  size="2"
639
  maxlength="3" />
640
+ </span>
641
+ </div>
642
+
643
+ <div class="max-input" style="margin: 8px 0 0 0;">
644
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
645
+ <input type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
646
+ <input id= "ignore_blockquote-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_count_inside_blockquote(); ?>" <?php if ($obj->get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />
647
+ <label for="ignore_blockquote-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Count also paragraphs inside <?php echo get_no_paragraph_counting_inside (); ?> elements - defined on general plugin settings page - Tab General">Count inside special elements</label>
648
+ </span>
649
+
650
+ <span class="small-input-tags" style="display: table-cell;">
651
+ <input
652
+ style="width: 100%; visibility: hidden;"
653
+ />
654
+ </span>
655
+
656
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
657
+ &nbsp;&nbsp;
658
+ Minimum number of words in paragraphs above
659
+ <input
660
+ type="text"
661
+ name="<?php echo AI_OPTION_MIN_WORDS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
662
+ default="<?php echo $default->get_minimum_words_above(); ?>"
663
+ value="<?php echo $obj->get_minimum_words_above() ?>"
664
+ title="Used only with automatic insertion After paragraph and empty paragraph numbers"
665
+ size="2"
666
+ maxlength="4" />
667
+ </span>
668
  </div>
669
  </div>
670
 
671
+ <div id="paragraph-clearance-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_clearance ? "" : "display: none;" ?>">
672
+ <div class="max-input" style="margin: 0 0 8px 0">
673
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
674
  In
675
  <input
 
676
  type="text"
677
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
678
  default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
684
  </span>
685
  <span style="display: table-cell;">
686
  <input
687
+ style="width: 100%;"
688
  title="Comma separated text"
689
  type="text"
690
  name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
694
  </span>
695
  </div>
696
 
697
+ <div class="max-input" style="margin: 8px 0">
698
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
699
  In
700
  <input
 
701
  type="text"
702
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
703
  default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
709
  </span>
710
  <span style="display: table-cell;">
711
  <input
712
+ style="width: 100%;"
713
  title="Comma separated text"
714
  type="text"
715
  name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
719
  </span>
720
  </div>
721
 
722
+ <div style="margin: 8px 0 0 0;">
723
  If text is found
724
+ <select id="avoid-action-<?php echo $ad_number; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_ACTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_action(); ?>">
725
  <option value="<?php echo AD_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AD_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_INSERT; ?></option>
726
  <option value="<?php echo AD_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AD_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_TRY_TO_SHIFT_POSITION; ?></option>
727
  </select>
728
  <span id="check-up-to-<?php echo $ad_number; ?>">
729
  &mdash; check up to
730
  <input
 
731
  type="text"
732
  name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
733
  default="<?php echo $default->get_avoid_try_limit(); ?>"
735
  size="2"
736
  maxlength="3" />
737
  paragraphs
738
+ <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_direction(); ?>">
739
  <option value="<?php echo AD_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE; ?></option>
740
  <option value="<?php echo AD_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_BELOW; ?></option>
741
  <option value="<?php echo AD_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE_AND_THEN_BELOW; ?></option>
745
  </div>
746
  </div>
747
 
748
+ <div id="content-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $content_settings ? "" : "display: none;" ?>">
749
  Post/Static page must have between
750
+ <input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" size="4" maxlength="6" />
751
  and
752
+ <input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" title="Maximum number of post/static page words, leave empty for no limit" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" size="4" maxlength="6" />
753
  words
754
  </div>
755
 
756
+ <div class="responsive-table rounded" id="list-settings-<?php echo $ad_number; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
757
+ <table>
758
  <tbody>
759
  <tr>
760
  <td style="padding-right: 7px;">
761
  Categories
762
  </td>
763
  <td style="padding-right: 7px; width: 70%;">
764
+ <input style="width: 100%;" title="Comma separated category slugs" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="500" />
765
  </td>
766
  <td style="padding-right: 7px;">
767
+ <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_BLACK_LIST) echo 'checked '; ?> />
768
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist categories"><?php echo AD_BLACK_LIST; ?></label>
769
  </td>
770
  <td>
771
+ <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_WHITE_LIST) echo 'checked '; ?> />
772
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist categories"><?php echo AD_WHITE_LIST; ?></label>
773
  </td>
774
  </tr>
777
  Tags
778
  </td>
779
  <td style="padding-right: 7px;">
780
+ <input style="width: 100%;" title="Comma separated tags" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="500"/>
781
  </td>
782
  <td style="padding-right: 7px;">
783
+ <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_BLACK_LIST) echo 'checked '; ?> />
784
  <label for="tag-blacklist-<?php echo $ad_number; ?>" title="Blacklist tags"><?php echo AD_BLACK_LIST; ?></label>
785
  </td>
786
  <td>
787
+ <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_WHITE_LIST) echo 'checked '; ?> />
788
  <label for="tag-whitelist-<?php echo $ad_number; ?>" title="Whitelist tags"><?php echo AD_WHITE_LIST; ?></label>
789
  </td>
790
  </tr>
793
  Taxonomies
794
  </td>
795
  <td style="padding-right: 7px; width: 70%;">
796
+ <input style="width: 100%;" title="Comma separated slugs: taxonomy, term or taxonomy:term" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy(); ?>" value="<?php echo $taxonomy_list; ?>" size="54" maxlength="500" />
797
  </td>
798
  <td style="padding-right: 7px;">
799
+ <input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="taxonomy-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_BLACK_LIST) echo 'checked '; ?> />
800
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist taxonomies"><?php echo AD_BLACK_LIST; ?></label>
801
  </td>
802
  <td>
803
+ <input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="taxonomy-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_WHITE_LIST) echo 'checked '; ?> />
804
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist taxonomies"><?php echo AD_WHITE_LIST; ?></label>
805
  </td>
806
  </tr>
809
  Post IDs
810
  </td>
811
  <td style="padding-right: 7px;">
812
+ <input style="width: 100%;" title="Comma separated post/page IDs" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_id_list(); ?>" value="<?php echo $id_list; ?>" size="54" maxlength="500"/>
813
  </td>
814
  <td style="padding-right: 7px;">
815
+ <input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="id-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_id_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
816
  <label for="id-blacklist-<?php echo $ad_number; ?>" title="Blacklist IDs"><?php echo AD_BLACK_LIST; ?></label>
817
  </td>
818
  <td>
819
+ <input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="id-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_id_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
820
  <label for="id-whitelist-<?php echo $ad_number; ?>" title="Whitelist IDs"><?php echo AD_WHITE_LIST; ?></label>
821
  </td>
822
  </tr>
825
  Urls
826
  </td>
827
  <td style="padding-right: 7px;">
828
+ <input style="width: 100%;" title="SPACE separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="500"/>
829
  </td>
830
  <td style="padding-right: 7px;">
831
+ <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
832
  <label for="url-blacklist-<?php echo $ad_number; ?>" title="Blacklist urls"><?php echo AD_BLACK_LIST; ?></label>
833
  </td>
834
  <td>
835
+ <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
836
  <label for="url-whitelist-<?php echo $ad_number; ?>" title="Whitelist urls"><?php echo AD_WHITE_LIST; ?></label>
837
  </td>
838
  </tr>
841
  Url parameters
842
  </td>
843
  <td style="padding-right: 7px;">
844
+ <input style="width: 100%;" title="Comma separated url query parameters with optional values (use either 'prameter' or 'prameter=value')" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="500"/>
845
  </td>
846
  <td style="padding-right: 7px;">
847
+ <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
848
  <label for="url-parameter-blacklist-<?php echo $ad_number; ?>" title="Blacklist url parameters"><?php echo AD_BLACK_LIST; ?></label>
849
  </td>
850
  <td>
851
+ <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
852
  <label for="url-parameter-whitelist-<?php echo $ad_number; ?>" title="Whitelist url parameters"><?php echo AD_WHITE_LIST; ?></label>
853
  </td>
854
  </tr>
857
  Referers
858
  </td>
859
  <td style="padding-right: 7px;">
860
+ <input style="width: 100%;" title="Comma separated domains, use # for no referer" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="500"/>
861
  </td>
862
  <td style="padding-right: 7px;">
863
+ <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
864
  <label for="referer-blacklist-<?php echo $ad_number; ?>" title="Blacklist referers"><?php echo AD_BLACK_LIST; ?></label>
865
  </td>
866
  <td>
867
+ <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
868
  <label for="referer-whitelist-<?php echo $ad_number; ?>" title="Whitelist referers"><?php echo AD_WHITE_LIST; ?></label>
869
  </td>
870
  </tr>
873
  </table>
874
  </div>
875
 
876
+ <div id="manual-settings-<?php echo $ad_number; ?>" class="small-button rounded" style="text-align: left;<?php if (!$show_manual) echo ' display: none;'; ?>">
877
  <table>
878
  <tr>
879
  <td style="padding: 4px 10px 4px 0;">
880
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
881
+ <input id="enable-widget-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_widget(); ?>" <?php if ($obj->get_enable_widget () == AI_ENABLED) echo 'checked '; ?> />
882
  <label for="enable-widget-<?php echo $ad_number; ?>" title="Enable or disable widget for this code block">
883
  Widget
884
  </label>
890
  </tr>
891
  <tr>
892
  <td style="padding: 4px 10px 4px 0;">
893
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
894
+ <input type="checkbox" id="enable-shortcode-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($obj->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> />
895
  <label for="enable-shortcode-<?php echo $ad_number; ?>" title="Enable or disable shortcode for manual insertion of this code block in posts and pages">
896
  Shortcode
897
  </label>
903
  </tr>
904
  <tr>
905
  <td style="padding: 4px 10px 4px 0;">
906
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
907
+ <input id="enable-php-call-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_php_call(); ?>" <?php if ($obj->get_enable_php_call () == AI_ENABLED) echo 'checked '; ?> />
908
  <label for="enable-php-call-<?php echo $ad_number; ?>" title="Enable or disable PHP function call to insert this code block at any position in template file. If function is disabled for block it will return empty string.">
909
  PHP function
910
  </label>
916
  </table>
917
  </div>
918
 
919
+ <div id="misc-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php if (!$show_misc) echo 'display: none;'; ?>">
920
+ <div class="max-input" style="margin: 0 0 8px 0;">
921
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
922
  Insert for
923
+ <select style="margin-bottom: 3px;" id="display-for-users-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_USERS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_users(); ?>" style="width:160px">
924
  <option value="<?php echo AD_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ALL_USERS; ?></option>
925
  <option value="<?php echo AD_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_LOGGED_IN_USERS; ?></option>
926
  <option value="<?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
927
  <option value="<?php echo AD_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ADMINISTRATORS; ?></option>
928
  </select>
929
  </span>
930
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
931
+ &nbsp;&nbsp;
932
+ Max <input type="text" style="width: 26px;" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="1" maxlength="3" title="Empty or 0 means no limit" /> insertions
933
  </span>
934
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
935
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
936
+ <input style="margin-left: 20px;" id="enable-ajax-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_ajax(); ?>" <?php if ($obj->get_enable_ajax () == AI_ENABLED) echo 'checked '; ?> />
937
+ <label for="enable-ajax-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion in Ajax requests">Ajax</label>
938
+ </span>
939
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
940
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
941
+ <input style="margin-left: 10px;" id="enable-feed-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_feed(); ?>" <?php if ($obj->get_enable_feed () == AI_ENABLED) echo 'checked '; ?> />
942
+ <label for="enable-feed-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion in feeds">Feed</label>
943
+ </span>
944
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
945
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
946
+ <input style="margin-left: 10px;" id="enable-404-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($obj->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
947
+ <label for="enable-404-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion on page for Error 404: Page not found">404</label>
948
+ </span>
949
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
950
+ &nbsp;&nbsp;
951
  General tag
952
+ &nbsp;
953
  </span>
954
  <span style="display: table-cell;">
955
+ <input style="width: 100%;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" size="8" maxlength="40" title="Used for {tags} when no page data is found" />
956
  </span>
957
  </div>
958
 
962
  Filter insertions
963
  </span>
964
  <span style="display: table-cell;">
965
+ <input style="width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "Filter insertions by specifying wanted calls for this block - single number or comma separated numbers, empty means all / no limits. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="24" />
966
  </span>
967
  <span style="display: table-cell;">
968
  &nbsp;&nbsp;&nbsp;using
969
+ <select style="margin-bottom: 3px;" id="filter-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_FILTER_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_filter_type(); ?>" style="width:160px">
970
+ <option value="<?php echo AI_FILTER_AUTO; ?>" <?php echo ($filter_type == AI_FILTER_AUTO) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AUTO; ?></option>
971
+ <option value="<?php echo AI_FILTER_PHP_FUNCTION_CALLS; ?>" <?php echo ($filter_type == AI_FILTER_PHP_FUNCTION_CALLS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHP_FUNCTION_CALLS; ?></option>
972
+ <option value="<?php echo AI_FILTER_CONTENT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_CONTENT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CONTENT_PROCESSING; ?></option>
973
+ <option value="<?php echo AI_FILTER_EXCERPT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_EXCERPT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_EXCERPT_PROCESSING; ?></option>
974
+ <option value="<?php echo AI_FILTER_BEFORE_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_BEFORE_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST_PROCESSING; ?></option>
975
+ <option value="<?php echo AI_FILTER_AFTER_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_AFTER_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST_PROCESSING; ?></option>
976
+ <option value="<?php echo AI_FILTER_WIDGET_DRAWING; ?>" <?php echo ($filter_type == AI_FILTER_WIDGET_DRAWING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_WIDGET_DRAWING; ?></option>
977
+ <option value="<?php echo AI_FILTER_SUBPAGES; ?>" <?php echo ($filter_type == AI_FILTER_SUBPAGES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SUBPAGES; ?></option>
978
+ <option value="<?php echo AI_FILTER_POSTS; ?>" <?php echo ($filter_type == AI_FILTER_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_POSTS; ?></option>
979
+ <option value="<?php echo AI_FILTER_PARAGRAPHS; ?>" <?php echo ($filter_type == AI_FILTER_PARAGRAPHS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PARAGRAPHS; ?></option>
980
+ <option value="<?php echo AI_FILTER_COMMENTS; ?>" <?php echo ($filter_type == AI_FILTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_COMMENTS; ?></option>
981
  </select>
982
  counter
983
  </span>
984
  <span style="display: table-cell;">
985
+ <input type="hidden" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
986
+ <input style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_inverted_filter(); ?>" <?php if ($obj->get_inverted_filter () == AI_ENABLED) echo 'checked '; ?> />
987
+ <label for="enable-ajax-<?php echo $ad_number; ?>" style="vertical-align: top;" title="If checked specified calls are unwanted">Invert filter</label>
 
 
 
 
 
 
 
 
 
 
988
  </span>
989
  </div>
990
  </div>
991
 
992
+ <div style="margin: 8px 0 0 0;">
993
+ <select style="margin-bottom: 0px;" id="scheduling-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_scheduling(); ?>">
994
  <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
995
  <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
996
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
997
  </select>
998
 
999
  <span id="scheduling-delay-<?php echo $ad_number; ?>">
1000
+ for <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" size="2" maxlength="3" /> days after publishing
1001
  </span>
1002
  <span id="scheduling-delay-warning-<?php echo $ad_number; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
1003
 
1004
  <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($ad_number, $obj, $default); ?>
1005
  </div>
1006
 
1007
+ <?php if (function_exists ('ai_adb_action')) ai_adb_action ($ad_number, $obj, $default); ?>
1008
  </div>
1009
 
1010
+ <div id="device-detection-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php if (!$show_devices) echo 'display: none;'; ?>">
1011
  <table>
1012
  <tr>
1013
  <td>
1014
  <div style="margin-bottom: 5px;">
1015
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1016
+ <input id="client-side-detection-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_detection_client_side(); ?>" <?php if ($obj->get_detection_client_side ()==AI_ENABLED) echo 'checked '; ?> />
1017
  <label for="client-side-detection-<?php echo $ad_number; ?>">Use client-side detection to show only on:</label>
1018
  </div>
1019
 
1025
  if ($viewport_name != '') {
1026
  ?>
1027
  <div style="margin: 8px 0;">
1028
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1029
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="viewport-<?php echo $viewport, "-", $ad_number; ?>" value="1" default="<?php echo $default->get_detection_viewport ($viewport); ?>" <?php if ($obj->get_detection_viewport ($viewport)==AI_ENABLED) echo 'checked '; ?> />
1030
  <label for="viewport-<?php echo $viewport, "-", $ad_number; ?>" title="Device min width <?php echo get_viewport_width ($viewport); ?> px"><?php echo $viewport_name; ?></label>
1031
  </div>
1032
  <?php
1035
  ?>
1036
  </div>
1037
  </td><td style="padding-left: 40px; vertical-align: top;">
1038
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1039
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="server-side-detection-<?php echo $ad_number; ?>" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($obj->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1040
  <label for="server-side-detection-<?php echo $ad_number; ?>">Use server-side detection to insert code only for </label>
1041
 
1042
  <div style="margin: 10px 0 10px 40px;">
1043
+ <select style="margin-bottom: 3px;" id="display-for-devices-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_devices(); ?>" style="width:160px">
1044
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1045
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1046
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1055
  </table>
1056
  </div>
1057
 
1058
+ <div id="no-wrapping-warning-<?php echo $ad_number; ?>" class="rounded" style="display: none;">
1059
  <span id="" style="margin-top: 5px;"><strong><span style="color: red;">WARNING:</span> No Wrapping</strong> style has no HTML code for client-side device detection!</span>
1060
  </div>
1061
 
1066
  ?>
1067
  <div id="tab-0" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
1068
  <div style="margin: 16px 0 16px 4px;">
1069
+ <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]), '.',
1070
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1071
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]); ?></h3>
1072
+ <h4 style="margin: 0px; float: right;" 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>
1073
  <div style="clear: both;"></div>
1074
  </div>
1075
 
1076
  <div style="margin: 16px 0;">
1077
  <div style="float: right;">
1078
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1079
+ <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save Settings" type="submit" style="width:120px; font-weight: bold;" />
1080
  </div>
1081
 
1082
  <div style="float: left; color: red;">
1091
 
1092
  if ($enabled_h) $style_h = "font-weight: bold; color: #66f;"; else $style_h = "";
1093
  if ($enabled_f) $style_f = "font-weight: bold; color: #66f;"; else $style_f = "";
1094
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1095
+ $adb_action = get_adb_action();
1096
+ if ($enabled_a) $style_a = "font-weight: bold; color: " . ($adb_action == AI_ACTION_NONE ? "#66f;" : "#f00;"); else $style_a = "";
1097
+ }
1098
  if (false) $style_d = "font-weight: bold; color: #e44;"; else $style_d = "";
1099
  ?>
1100
 
1105
  <li id="ai-h" class="ai-plugin-tab"><a href="#tab-header"><span style="<?php echo $style_h ?>">Header</span></a></li>
1106
  <li id="ai-f" class="ai-plugin-tab"><a href="#tab-footer"><span style="<?php echo $style_f ?>">Footer</span></a></li>
1107
  <?php if (function_exists ('ai_plugin_settings_tab')) ai_plugin_settings_tab ($exceptions); ?>
1108
+ <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
1109
+ <li id="ai-a" class="ai-plugin-tab"><a href="#tab-adblocking"><span style="<?php echo $style_a ?>">Ad Blocking</span></a></li>
1110
+ <?php } ?>
1111
  <li id="ai-d" class="ai-plugin-tab"><a href="#tab-debugging"><span style="<?php echo $style_d ?>">Debugging</span></a></li>
1112
  </ul>
1113
 
1114
+ <div id="tab-general" class="rounded">
1115
 
1116
+ <table class="ai-settings-table" style="width: 100%;">
1117
  <?php if (function_exists ('ai_general_settings')) ai_general_settings (); ?>
1118
  <tr>
1119
+ <td style="width: 36%;">
1120
  Syntax Highlighter Theme
1121
  </td>
1122
  <td>
1123
  <select
1124
+ style="width:220px"
1125
  id="syntax-highlighter-theme"
1126
  name="syntax-highlighter-theme"
1127
  value="Value">
1168
  </td>
1169
  </tr>
1170
  <tr>
1171
+ <td>
1172
  Block Class Name
1173
  </td>
1174
  <td>
1175
+ <input style="margin-left: 0px;" title="CSS Class Name for the wrapping div" type="text" id="block-class-name" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="15" maxlength="40" />
1176
  </td>
1177
  </tr>
1178
  <tr>
1179
+ <td>
1180
  Minimum User Role for Exceptions Editing
1181
  </td>
1182
  <td>
1183
+ <select style="margin-bottom: 3px;" id="minimum-user-role" name="minimum-user-role" selected-value="1" data="<?php echo get_minimum_user_role (); ?>" default="<?php echo DEFAULT_MINIMUM_USER_ROLE; ?>" style="width:300px">
1184
  <?php wp_dropdown_roles (get_minimum_user_role ()); ?>
1185
  </select>
1186
  </td>
1187
  </tr>
1188
  <tr>
1189
+ <td>
1190
  Dynamic blocks
1191
  </td>
1192
  <td>
1193
+ <select id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
1194
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
1195
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
1196
  <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
1198
  </td>
1199
  </tr>
1200
  <tr>
1201
+ <td>
1202
  Functions for Paragraph Counting
1203
  </td>
1204
  <td>
1205
+ <select id="paragraph_counting_functions" name="paragraph_counting_functions" default="<?php echo DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS; ?>" title="Standard PHP functions are faster and work in most cases, use Multibyte functions if paragraphs are not counted properly on non-english pages.">
1206
  <option value="<?php echo AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STANDARD; ?></option>
1207
  <option value="<?php echo AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MULTIBYTE; ?></option>
1208
  </select>
1209
  </td>
1210
  </tr>
1211
  <tr>
1212
+ <td>
1213
+ No Paragraph Counting Inside
1214
+ </td>
1215
+ <td>
1216
+ <input type="text" name="no-paragraph-counting-inside" value="<?php echo get_no_paragraph_counting_inside (); ?>" default="<?php echo DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE; ?>" size="40" maxlength="80" />
1217
+ </td>
1218
+ </tr>
1219
+ <tr>
1220
+ <td>
1221
  Sticky Widget Top Margin
1222
  </td>
1223
  <td>
1224
+ <input type="text" name="sticky-widget-margin" value="<?php echo get_sticky_widget_margin (); ?>" default="<?php echo DEFAULT_STICKY_WIDGET_MARGIN; ?>" size="6" maxlength="4" /> px
1225
  </td>
1226
  </tr>
1227
  <tr>
1228
+ <td>
1229
  Plugin priority
1230
  </td>
1231
  <td>
1232
+ <input type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" default="<?php echo DEFAULT_PLUGIN_PRIORITY; ?>" size="6" maxlength="6" />
1233
  </td>
1234
  </tr>
1235
  </table>
1236
  </div>
1237
 
1238
+ <div id="tab-viewports" class="rounded">
1239
+ <div style="margin: 0 0 8px 0;">
1240
  Viewport Settings used for client-side device detection
1241
  </div>
1242
  <?php
1243
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
1244
+ $bottom_margin = $viewport == AD_INSERTER_VIEWPORTS ? 0 : 8;
1245
  ?>
1246
+ <div style="margin: 8px 0 <?php echo $bottom_margin; ?>px 0;">
1247
  Viewport <?php echo $viewport; ?> name&nbsp;&nbsp;&nbsp;
1248
+ <input style="margin-left: 0px;" type="text" name="viewport-name-<?php echo $viewport; ?>" value="<?php echo get_viewport_name ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_NAME_" . $viewport) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport) : ""; ?>" size="15" maxlength="40" />
1249
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '<span style="display: none;">' ?>
1250
  &nbsp;&nbsp; min width
1251
+ <input type="text" id="option-length-<?php echo $viewport; ?>" name="viewport-width-<?php echo $viewport; ?>" value="<?php echo get_viewport_width ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) : ""; ?>" size="4" maxlength="4" /> px
1252
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '</span>' ?>
1253
  </div>
1254
  <?php
1290
  <textarea id="block-h" name="<?php echo AI_OPTION_CODE, '_block_h'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adH->get_ad_data()); ?></textarea>
1291
  </div>
1292
 
1293
+ <div id="device-detection-settings-h" class="rounded">
1294
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" value="0" />
1295
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" id="server-side-detection-h" style="margin-top: 1px;" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1296
  <label for="server-side-detection-h">Use server-side detection to insert code only for </label>
1297
+ <select id="display-for-devices-h" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1298
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1299
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1300
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1304
  </select>
1305
  devices
1306
 
1307
+ <span style="float: right; margin-top: 2px;">
1308
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
1309
+ <input style="margin-left: 10px; margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" id="enable-header-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1310
  <label for="enable-header-404" title="Enable or disable insertion of this code into HTML page header on page for Error 404: Page not found">Insert on Error 404 page</label>
1311
  </span>
1312
  </div>
1346
  <textarea id="block-f" name="<?php echo AI_OPTION_CODE, '_block_f'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adF->get_ad_data()); ?></textarea>
1347
  </div>
1348
 
1349
+ <div id="device-detection-settings-f" class="rounded">
1350
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" value="0" />
1351
+ <input style="margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" id="server-side-detection-f" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1352
  <label for="server-side-detection-f">Use server-side detection to insert code only for </label>
1353
+ <select id="display-for-devices-f" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1354
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1355
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1356
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1360
  </select>
1361
  devices
1362
 
1363
+ <span style="float: right; margin-top: 2px;">
1364
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
1365
+ <input style="margin-left: 10px; margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" id="enable-footer-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1366
  <label for="enable-footer-404" title="Enable or disable insertion of this code into HTML page footer on page for Error 404: Page not found">Insert on Error 404 page</label>
1367
  </span>
1368
  </div>
1370
 
1371
  <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
1372
 
1373
+ <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
1374
+
1375
+ <div id="tab-adblocking" style="margin: 0px 0; padding: 0; ">
1376
+ <div style="margin: 8px 0;">
1377
+ <div style="float: right;">
1378
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" value="0" />
1379
+ <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" id="enable-adb-detection" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adA->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1380
+ <label class="checkbox-button" style="margin-left: 10px;" for="enable-adb-detection" title="Enable or disable detection of ad blocking"><span class="checkbox-icon icon-enabled<?php if ($adA->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1381
+ </div>
1382
+
1383
+ <div>
1384
+ <h3 style="margin: 8px 0 8px 2px;">Ad Blocking Detection</h3>
1385
+ </div>
1386
+ </div>
1387
+
1388
+ <div class="rounded" style="margin: 16px 0 8px;">
1389
+ <table class="ai-settings-table" style="width: 100%;" cellpadding="0">
1390
+ <tr>
1391
+ <td style="width: 20%;">
1392
+ <label for="adb-action">Action</label>
1393
+ </td>
1394
+ <td>
1395
+ <select id="adb-action" name="<?php echo AI_OPTION_ADB_ACTION; ?>" title="Global action when ad blocking is detected" default="<?php echo AI_DEFAULT_ADB_ACTION; ?>" >
1396
+ <option value="<?php echo AI_ACTION_NONE; ?>" <?php echo ($adb_action == AI_ACTION_NONE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NONE; ?></option>
1397
+ <option value="<?php echo AI_ACTION_WARNING_MESSAGE; ?>" <?php echo ($adb_action == AI_ACTION_WARNING_MESSAGE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_WARNING_MESSAGE; ?></option>
1398
+ <option value="<?php echo AI_ACTION_REDIRECTION; ?>" <?php echo ($adb_action == AI_ACTION_REDIRECTION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_REDIRECTION; ?></option>
1399
+ </select>
1400
+ </td>
1401
+ </tr>
1402
+ <tr>
1403
+ <td>
1404
+ Delay Action
1405
+ </td>
1406
+ <td>
1407
+ <input style="width: 40px;" type="text" name="<?php echo AI_OPTION_ADB_DELAY_ACTION; ?>" title="Number of page views to delay action when ad blocking is detected. Leave empty for no delay (action fires on first page view). Sets cookie." value="<?php echo get_delay_action (); ?>" default="" size="3" maxlength="5" /> page views
1408
+ </td>
1409
+ </tr>
1410
+ <tr>
1411
+ <td>
1412
+ No Action Period
1413
+ </td>
1414
+ <td>
1415
+ <input style="width: 40px;" type="text" name="<?php echo AI_OPTION_ADB_NO_ACTION_PERIOD; ?>" title="Number of days to supress action when ad blocking is detected. Leave empty for no no-action period (action fires always after defined page view delay). Sets cookie." value="<?php echo get_no_action_period (); ?>" default="<?php echo AI_DEFAULT_ADB_NO_ACTION_PERIOD; ?>" size="3" maxlength="5" /> days
1416
+ </td>
1417
+ </tr>
1418
+ <tr>
1419
+ <td>
1420
+ Custom Selectors
1421
+ </td>
1422
+ <td>
1423
+ <input style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_SELECTORS; ?>" title="Comma seprarated list of CSS selectors (.class, #id) used for additional ad blocking detection. Invisible or zero height of the element means ad blocking is present." value="<?php echo get_adb_selectors (); ?>" default="" size="50" maxlength="200" />
1424
+ </td>
1425
+ </tr>
1426
+ </table>
1427
+ </div>
1428
+
1429
+ <div id="adb-page-redirection" class="rounded">
1430
+ <table class="ai-settings-table" style="width: 100%;">
1431
+ <tr>
1432
+ <td style="width: 20%;">
1433
+ <label for="redirection-page">Redirection Page</label>
1434
+ </td>
1435
+ <td>
1436
+ <?php
1437
+ $args = array(
1438
+ 'depth' => 0,
1439
+ 'child_of' => 0,
1440
+ 'selected' => get_redirection_page (true),
1441
+ 'echo' => 0,
1442
+ 'name' => AI_OPTION_ADB_REDIRECTION_PAGE,
1443
+ 'id' => 'redirection-page',
1444
+ 'class' => null,
1445
+ 'show_option_none' => 'Custom Url',
1446
+ 'show_option_no_change' => null,
1447
+ 'option_none_value' => '0',
1448
+ );
1449
+ $dropdown_pages = wp_dropdown_pages ($args);
1450
+ $dropdown_pages = str_replace ('<select ', '<select default="'.AI_DEFAULT_ADB_REDIRECTION_PAGE.'" title="Static page for redirection when ad blocking is detected. For other pages select Custom url and set it below." ', $dropdown_pages);
1451
+
1452
+ echo $dropdown_pages;
1453
+ ?>
1454
+ </td>
1455
+ </tr>
1456
+ <tr>
1457
+ <td>
1458
+ Custom Redirection Url
1459
+ </td>
1460
+ <td>
1461
+ <input id="custom-redirection-url" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_CUSTOM_REDIRECTION_URL; ?>" value="<?php echo get_custom_redirection_url (); ?>" default="" size="50" maxlength="200" />
1462
+ </td>
1463
+ </tr>
1464
+ </table>
1465
+ </div>
1466
+
1467
+ <div id="adb-message">
1468
+ <div style="padding: 0; min-height: 28px;">
1469
+ <div style="float: left; margin: 10px 0 0 3px;">
1470
+ Message HTML code
1471
+ </div>
1472
+ <div style="float: right;">
1473
+
1474
+ <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
1475
+ <input type="checkbox" value="0" id="simple-editor-a" style="display: none;" />
1476
+ <label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-a" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
1477
+ <?php endif; ?>
1478
+
1479
+ <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="0" />
1480
+ <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="1" id="process-php-a" default="<?php echo $default->get_process_php (); ?>" <?php if ($adA->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1481
+ <label class="checkbox-button" style="margin-left: 10px;" for="process-php-a" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adA->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1482
+
1483
+ <button id="preview-button-adb" type="button" style="display: none; margin: 0 4px 0 10px;" title="Preview message when ad blocking is detected" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
1484
+ </div>
1485
+ <div style="clear: both;"></div>
1486
+ </div>
1487
+
1488
+ <div style="margin: 8px 0;">
1489
+ <textarea id="block-a" name="<?php echo AI_OPTION_CODE, '_block_a'; ?>" class="simple-editor small" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adA->get_ad_data()); ?></textarea>
1490
+ </div>
1491
+
1492
+ <div class="rounded">
1493
+ <table class="ai-settings-table" style="width: 100%;">
1494
+ <tr>
1495
+ <td style="width: 20%;">
1496
+ Message CSS
1497
+ </td>
1498
+ <td>
1499
+ <input id="message-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_MESSAGE_CSS; ?>" value="<?php echo get_message_css (); ?>" default="<?php echo AI_DEFAULT_ADB_MESSAGE_CSS; ?>" size="50" maxlength="200" />
1500
+ </td>
1501
+ </tr>
1502
+ <tr>
1503
+ <td>
1504
+ Overlay CSS
1505
+ </td>
1506
+ <td>
1507
+ <input id="overlay-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_OVERLAY_CSS; ?>" value="<?php echo get_overlay_css (); ?>" default="<?php echo AI_ADB_DEFAULT_OVERLAY_CSS; ?>" size="50" maxlength="200" />
1508
+ </td>
1509
+ </tr>
1510
+ <tr>
1511
+ <td>
1512
+ <label for="undismissible-message" title="Prevent visitors from closing the warning message">Undismissible Message</label>
1513
+ </td>
1514
+ <td>
1515
+ <input type="hidden" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" value="0" />
1516
+ <input style="margin-left: 1px;" type="checkbox" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" id="undismissible-message" value="1" default="<?php echo AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE; ?>" <?php if (get_undismissible_message () == AI_ENABLED) echo 'checked '; ?> />
1517
+ </td>
1518
+ </tr>
1519
+ </table>
1520
+ </div>
1521
+ </div>
1522
+ </div>
1523
+
1524
+ <?php } ?>
1525
+
1526
+ <div id="tab-debugging" class="rounded">
1527
+ <div style="margin: 0 0 8px 0;">
1528
+ <input type="hidden" name="admin_toolbar_debugging" value="0" />
1529
+ <input type="checkbox" name="admin_toolbar_debugging" id="admin-toolbar-debugging" value="1" default="<?php echo DEFAULT_ADMIN_TOOLBAR_DEBUGGING; ?>" <?php if (get_admin_toolbar_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1530
  <label for="admin-toolbar-debugging" title="Enable or disable debugging functions in admin toolbar">Debugging functions in admin toolbar</label>
1531
  </div>
1532
 
1533
+ <div style="margin: 8px 0 0 0;">
1534
+ <input type="hidden" name="remote_debugging" value="0" />
1535
+ <input type="checkbox" name="remote_debugging" id="remote-debugging" value="1" default="<?php echo DEFAULT_REMOTE_DEBUGGING; ?>" <?php if (get_remote_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1536
  <label for="remote-debugging" title="Enable Debugger widget and code insertion debugging (blocks, positions, tags, processing) by url parameters for non-logged in users. Enable this option to allow other people to see Debugger widget, labeled blocks and positions in order to help you to diagnose problems. For logged in administrators debugging is always enabled.">Remote debugging</label>
1537
  </div>
1538
 
1539
  <div id="system-debugging" style="display: none;">
1540
+ <div style="margin: 8px 0 0 0;">
1541
+ <input type="hidden" name="javascript_debugging" value="0" />
1542
+ <input type="checkbox" name="javascript_debugging"id="javascript-debugging" value="1" default="<?php echo DEFAULT_JAVASCRIPT_DEBUGGING; ?>" <?php if (get_javascript_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1543
  <label for="javascript-debugging" title="Enable Javascript console output">Javascript debugging</label>
1544
  </div>
1545
 
1554
 
1555
  <?php if (!function_exists ('ai_settings_side')) { ?>
1556
 
1557
+ <div class="ai-form header rounded">
1558
  <div style="float: left;">
1559
+ <h2 style="display: inline-block; margin: 5px 0;">Blank Ad Blocks? Looking for AdSense alternative?</h2>
1560
  </div>
1561
  <div style="clear: both;"></div>
1562
  </div>
1563
 
1564
+ <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
1565
+ <a href='http://bit.ly/2oF81Oh' 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>
1566
  </div>
1567
 
1568
+ <!--<div class="ai-form header rounded">-->
1569
  <!-- <div style="float: left;">-->
1570
+ <!-- <h2 style="display: inline-block; margin: 5px 0;">WordPress [Great Content] + Ad Inserter [AdSense, Amazon, media.net] = ?</h2>-->
1571
  <!-- </div>-->
1572
  <!-- <div style="clear: both;"></div>-->
1573
  <!--</div>-->
1574
 
1575
  <?php } ?>
1576
 
1577
+ <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="[<?php echo $active_tab, ',', $active_tab_0; ?>]" />
1578
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
1579
 
1580
  </form>
1586
  <?php
1587
  if ($subpage == 'main') {
1588
  if (function_exists ('ai_settings_side')) ai_settings_side (); else { ?>
1589
+ <div id="ai-sidebar" style="float: left;">
1590
+ <div class="ai-form header rounded no-select">
1591
  <div style="float: left;">
1592
+ <h2 style="display: inline-block; margin: 7px 0;">Support plugin development</h2>
1593
  </div>
1594
  <div style="float: right;">
1595
+ <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img id="ai-tw" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>twitter.png" style="vertical-align: middle; margin: 0 0 0 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter on Twitter" /></a>
1596
+ <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img id="ai-fb" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>facebook.png" style="vertical-align: middle; margin: 0 0 0 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter on Facebook" /></a>
1597
+ </div>
1598
+ <div style="float: right; margin-top: 2px;">
1599
+ <h2 style="display: inline-block; margin: 5px 0;">Follow Ad Inserter</h2>
1600
  </div>
1601
 
1602
  <div style="clear: both;"></div>
1603
  </div>
1604
 
1605
+ <div class="ai-form header no-select rounded">
1606
+ <ul style="margin: 0;">
1607
  <li><strong>&squf;</strong>
1608
  If you like Ad Inserter please do me a big favor and give plugin a 5 star rating on the <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">review page</a>.
1609
 
1610
+ <div id="ai-stars" style="float: right; margin: 0 0 -3px 0; cursor: pointer;"><span><?php echo $rating_value; ?></span><img id="ai-stars-img" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>stars.png" style="margin: 0 0 -3px 10px;"/></div>
1611
 
1612
+
1613
+ <div id="ai-rating-bar" class="header" style="float: right; cursor: pointer; margin: 4px 0 0 0; width: 148px; display: none;" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">
1614
  <div class="header" style="background: #ccc;" title="Average rating of the plugin - Thank you!">
1615
+ <div id="rating-value" style="text-align: center; font-size: 11px; line-height: 12px; border-radius: 2px; background: #fddf87; height: 100%; <?php echo $rating_css; ?>"><span style=""><?php echo $rating_string; ?></span></div>
1616
  </div>
1617
  </div>
1618
  </li>
1629
  Thank you! Igor <img draggable="false" class="emoji" alt="happy" src="https://s.w.org/images/core/emoji/2.3/svg/1f642.svg" style="margin-left: 5px!important;"></p>
1630
  </div>
1631
 
1632
+ <div class="ai-form rounded no-select" style="background: #fff;">
1633
  <div style="float: right;" >
1634
  <div>
1635
+ <a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" 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>
 
 
 
1636
  </div>
1637
  <div>
1638
+ <a href='http://bit.ly/2oF81Oh' 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>
1639
+
1640
  </div>
1641
  </div>
1642
 
1691
  }
1692
  }
1693
  ?>
1694
+ <img id="ai-pixel" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>test.png"/>
1695
  <script type="text/javascript">
 
 
1696
  jQuery(document).ready(function($) {
1697
+ setTimeout (check_blocked_images, 400);
1698
  });
1699
 
1700
+ function check_blocked_images () {
1701
+
1702
+ function replace_blocked_image (image_id, image_src, css_display = 'block') {
1703
+ var image_selector = "#" + image_id;
1704
+ if (!jQuery(image_selector + ":visible").length) {
1705
+ var image = jQuery(image_selector);
1706
+ image.hide ().after (image.clone ().attr ('class', '').attr ("id", image_id + '-ajax').
1707
+ attr ('src', '<?php echo wp_make_link_relative (get_site_url()); ?>/wp-admin/admin-ajax.php?action=ai_data&image=' + image_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>').
1708
+ css ('display', css_display));
1709
+ }
1710
+ }
1711
+
1712
  jQuery("#blocked-warning.warning-enabled").show ();
1713
  jQuery("#blocked-warning.warning-enabled .blocked-warning-text").css ('color', '#00f');
1714
 
1715
+ if (!jQuery("#ai-pixel:visible").length || jQuery("#ai-pixel").width () != 1) {
1716
+ jQuery("#blocked-warning").show ();
1717
+ jQuery("#blocked-warning .blocked-warning-text").css ('color', '#00f');
1718
  }
1719
+
1720
+ replace_blocked_image ('ai-media-1', 'contextual-1.gif');
1721
+ replace_blocked_image ('ai-media-2', 'contextual-2.jpg');
1722
+ replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg');
1723
+ replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
1724
+ replace_blocked_image ('ai-tw', 'twitter.png', 'inline');
1725
+ replace_blocked_image ('ai-fb', 'facebook.png', 'inline');
1726
  }
1727
  </script>
1728