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

Version Description

  • Fixed error when using server-side device detection
Download this release

Release Info

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

Code changes from version 2.1.12 to 2.1.8

ad-inserter.php CHANGED
@@ -1,46 +1,16 @@
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/
8
  Plugin URI: http://adinserter.pro/documentation
9
  */
10
 
11
  /*
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)
28
- - Added support to black/white-list arbitrary taxonomies (taxonomy, term or taxonomy:term)
29
- - Added support for automatic insertion before, between and after comments
30
- - Added processing of shortcodes in the header and footer code
31
- - Debugging function Show positions shows also page type
32
- - Fixed page type detection when Post page was set to static page and it was not homepage
33
- - Few minor bug fixes, cosmetic changes and code improvements
34
-
35
- Ad Inserter 2.1.10 - 2017-07-01
36
- - Fix for shifted sidebars in some themes
37
-
38
- Ad Inserter 2.1.9 - 2017-06-30
39
- - Added support for sticky widgets
40
- - Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img)
41
- - Impression and click tracking (beta, Pro only)
42
- - Few minor bug fixes, cosmetic changes and code improvements
43
-
44
  Ad Inserter 2.1.8 - 2017-05-18
45
  - Fixed error when using server-side device detection
46
 
@@ -411,14 +381,13 @@ if (version_compare ($wp_version, "4.0", "<")) {
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,7 +403,7 @@ foreach ($version_array as $number) {
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,7 +423,6 @@ if (!is_admin()) {
454
 
455
  $ad_inserter_globals = array ();
456
  $block_object = array ();
457
- $block_insertion_log = array ();
458
 
459
  ai_load_settings ();
460
 
@@ -465,29 +433,6 @@ if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
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 ()) {
@@ -505,13 +450,11 @@ if (get_dynamic_blocks ()) {
505
  }
506
 
507
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
508
- $ai_wp_data [AI_WP_USER_SET] = false;
509
- $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
510
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
511
  $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
512
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
513
  $ai_wp_data [AI_TRACKING] = false;
514
- $ai_wp_data [AI_STICKY_WIDGETS] = false;
515
 
516
  for ($counter = 1; $counter <= AD_INSERTER_BLOCKS; $counter ++) {
517
  $obj = $block_object [$counter];
@@ -527,6 +470,7 @@ $adF = $block_object [AI_FOOTER_OPTION_NAME];
527
  if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
528
  if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
529
 
 
530
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
531
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
532
 
@@ -554,18 +498,16 @@ add_action ('admin_notices', 'ai_admin_notice_hook');
554
 
555
  add_action ('wp', 'ai_wp_hook');
556
 
557
- //if ($adH->get_enable_manual () ||
558
- // $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
559
- // get_remote_debugging () ||
560
- // ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0 ||
561
- // ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0)
562
- add_action ('wp_head', 'ai_wp_head_hook');
563
 
564
- //if ($adF->get_enable_manual () ||
565
- // $ai_wp_data [AI_TRACKING] ||
566
- // get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
567
- // $ai_wp_data [AI_STICKY_WIDGETS])
568
- add_action ('wp_footer', 'ai_wp_footer_hook');
569
 
570
  if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
571
 
@@ -583,17 +525,12 @@ add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 10, 2);
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,14 +549,11 @@ function ai_toolbar ($wp_admin_bar) {
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,7 +561,7 @@ function ai_toolbar ($wp_admin_bar) {
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
  ));
@@ -697,8 +631,8 @@ function ai_toolbar ($wp_admin_bar) {
697
  ($paragraph_block ['direction'] == 'b' ? ' <span class="dashicons dashicons-arrow-up-alt up-icon"></span>' : '').
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,14 +649,6 @@ function ai_toolbar ($wp_admin_bar) {
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',
@@ -734,16 +660,14 @@ function ai_toolbar ($wp_admin_bar) {
734
  function set_user () {
735
  global $ai_wp_data;
736
 
737
- if ($ai_wp_data [AI_WP_USER_SET]) return;
738
 
739
- // $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
740
 
741
  if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
742
  if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
743
 
744
  // if (isset ($_GET [AI_URL_DEBUG_USER]) && $_GET [AI_URL_DEBUG_USER] != 0) $ai_wp_data [AI_WP_USER] = $_GET [AI_URL_DEBUG_USER];
745
-
746
- $ai_wp_data [AI_WP_USER_SET] = true;
747
  }
748
 
749
  function set_page_type () {
@@ -752,14 +676,14 @@ function set_page_type () {
752
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_NONE) return;
753
 
754
  if (is_admin()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ADMIN;
755
- elseif (is_feed()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_FEED;
756
- elseif (is_404()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_404;
757
- elseif (is_front_page ()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_HOMEPAGE;
758
- elseif (is_page()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_STATIC;
759
- elseif (is_single()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_POST;
760
- elseif (is_category()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_CATEGORY;
761
- elseif (is_search()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_SEARCH;
762
- elseif (is_archive() || (is_home () && !is_front_page ())) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ARCHIVE;
763
  }
764
 
765
  function ai_log_message ($message) {
@@ -778,13 +702,13 @@ function ai_log_content (&$content) {
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;
@@ -806,7 +730,6 @@ function ai_block_insertion_status ($block, $ai_last_check) {
806
 
807
  case AI_CHECK_CATEGORY: $status .= "CATEGORY"; break;
808
  case AI_CHECK_TAG: $status .= "TAG"; break;
809
- case AI_CHECK_TAXONOMY: $status .= "TAXONOMY"; break;
810
  case AI_CHECK_ID: $status .= "ID"; break;
811
  case AI_CHECK_URL: $status .= "URL"; break;
812
  case AI_CHECK_URL_PARAMETER: $status .= "URL PARAMETER"; break;
@@ -824,7 +747,7 @@ function ai_block_insertion_status ($block, $ai_last_check) {
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,17 +774,6 @@ function ai_block_insertion_status ($block, $ai_last_check) {
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,17 +786,45 @@ function ai_log ($message = "") {
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) {
@@ -896,7 +836,7 @@ function number_of_words (&$content) {
896
  }
897
 
898
  function ai_wp_hook () {
899
- global $ai_wp_data, $ai_db_options_extract, $ai_total_plugin_time, $ai_walker;
900
 
901
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
902
  ai_log ("WP HOOK START");
@@ -910,7 +850,7 @@ function ai_wp_hook () {
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,9 +877,6 @@ function ai_wp_hook () {
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]);
@@ -976,16 +913,6 @@ function ai_wp_hook () {
976
  if (isset ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) != 0 || $debug_positions)
977
  add_action ('the_post', 'ai_post_hook');
978
 
979
- if ((isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) != 0) ||
980
- (isset ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) != 0) ||
981
- (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) != 0) ||
982
- $debug_positions) {
983
- $ai_wp_data [AI_NUMBER_OF_COMMENTS] = 0;
984
- add_filter ('comments_array' , 'ai_comments_array' , 10, 2);
985
- add_filter ('wp_list_comments_args' , 'ai_wp_list_comments_args');
986
- $ai_walker = new ai_Walker_Comment;
987
- }
988
-
989
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
990
  $ai_total_plugin_time += microtime (true) - $start_time;
991
  ai_log ("WP HOOK END\n");
@@ -1017,14 +944,12 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
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',
1024
  'jquery-ui-button',
1025
  'jquery-ui-tooltip',
1026
  'jquery-ui-datepicker',
1027
- 'jquery-ui-dialog',
1028
  ), AD_INSERTER_VERSION);
1029
  wp_enqueue_style ('ai-admin-jquery-ui', plugins_url ('css/jquery-ui-1.10.3.custom.min.css', __FILE__), array (), null);
1030
 
@@ -1043,9 +968,6 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
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,9 +1012,6 @@ function add_head_inline_styles_and_scripts () {
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,355 +1027,10 @@ function add_head_inline_styles_and_scripts () {
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
 
@@ -1470,11 +1044,6 @@ function add_footer_inline_scripts () {
1470
  // $("div.ai-rotate").each (function () {
1471
  // var rotate_options = $(".ai-rotate-option", this);
1472
  // var random_index = Math.floor (Math.random () * rotate_options.length);
1473
-
1474
- // var d = new Date();
1475
- // var n = d.getMilliseconds();
1476
- // if (n % 2) random_index = rotate_options.length - random_index - 1;
1477
-
1478
  // rotate_options.hide ();
1479
  // $(rotate_options [random_index]).css ({"display": "", "visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""});
1480
  // $(this).css ({"position": ""});
@@ -1491,47 +1060,8 @@ function add_footer_inline_scripts () {
1491
  // });
1492
  //';
1493
 
1494
- echo 'jQuery(function($){var wrapping_div_class=".', $block_class_name, '";$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();if(n%2)random_index=rotate_options.length-random_index-1;rotate_options.hide();$(rotate_options[random_index]).css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""});$(this).css({"position":""});var wrapping_div=$(this).closest(wrapping_div_class);
1495
- if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}})});';
1496
- }
1497
-
1498
- if ($ai_wp_data [AI_STICKY_WIDGETS]) {
1499
-
1500
- // echo 'jQuery(document).ready(function($) {
1501
- // var sticky_widget_margin = ', get_sticky_widget_margin (), ';
1502
- // var document_width = $(document).width();
1503
-
1504
- // $(".ai-sticky").each (function () {
1505
- // var widget = $(this);
1506
- // var widget_width = widget.width();
1507
- //// console.log ("WIDGET:", widget.width (), widget.prop ("tagName"), widget.attr ("id"));
1508
- // var sidebar = widget.parent ();
1509
- // while (sidebar.prop ("tagName") != "BODY") {
1510
- //// console.log ("SIDEBAR:", sidebar.width (), sidebar.prop ("tagName"), sidebar.attr ("id"));
1511
- // var parent_element = sidebar.parent ();
1512
- // var parent_element_width = parent_element.width();
1513
- // if (parent_element_width > widget_width * 1.2 || parent_element_width > document_width / 2) break;
1514
- // sidebar = parent_element;
1515
- // }
1516
- // var new_sidebar_top = sidebar.offset ().top - widget.offset ().top + sticky_widget_margin;
1517
- //// console.log ("NEW SIDEBAR TOP:", new_sidebar_top);
1518
- // if (sidebar.css ("position") != "sticky" || isNaN (parseInt (sidebar.css ("top"))) || sidebar.css ("top") < new_sidebar_top) {
1519
- // sidebar.css ("position", "sticky").css ("top", new_sidebar_top);
1520
- //// console.log ("SET SIDEBAR TOP:", new_sidebar_top);
1521
- // }
1522
- // });
1523
- // });
1524
- //';
1525
-
1526
- echo 'jQuery(document).ready(function($){var sticky_widget_margin=', get_sticky_widget_margin (), ';var document_width=$(document).width();$(".ai-sticky").each(function(){var widget=$(this);var widget_width=widget.width();var sidebar=widget.parent();while(sidebar.prop("tagName")!="BODY"){var parent_element=sidebar.parent();var parent_element_width=parent_element.width();if(parent_element_width>widget_width*1.2||parent_element_width>document_width/2)break;sidebar=parent_element}var new_sidebar_top=sidebar.offset().top-widget.offset().top+
1527
- sticky_widget_margin;if(sidebar.css("position")!="sticky"||isNaN(parseInt(sidebar.css("top")))||sidebar.css("top")<new_sidebar_top)sidebar.css("position","sticky").css("top",new_sidebar_top)})});';
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')) {
@@ -1779,44 +1309,6 @@ function ai_widgets_init_hook () {
1779
  register_widget ('ai_widget');
1780
  }
1781
 
1782
- function get_page_type_debug_info () {
1783
- global $ai_wp_data;
1784
-
1785
- switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1786
- case AI_PT_STATIC:
1787
- $page_type = 'STATIC PAGE';
1788
- break;
1789
- case AI_PT_POST:
1790
- $page_type = 'POST';
1791
- break;
1792
- case AI_PT_HOMEPAGE:
1793
- $page_type = 'HOMEPAGE';
1794
- break;
1795
- case AI_PT_CATEGORY:
1796
- $page_type = 'CATEGORY PAGE';
1797
- break;
1798
- case AI_PT_SEARCH:
1799
- $page_type = 'SEARCH PAGE';
1800
- break;
1801
- case AI_PT_ARCHIVE:
1802
- $page_type = 'ARCHIVE PAGE';
1803
- break;
1804
- case AI_PT_404:
1805
- $page_type = 'ERROR 404 PAGE';
1806
- break;
1807
- case AI_PT_AJAX:
1808
- $page_type = 'AJAX CALL';
1809
- break;
1810
- default:
1811
- $page_type = 'UNKNOWN PAGE TYPE';
1812
- break;
1813
- }
1814
- $style = AI_DEBUG_PAGE_TYPE_STYLE;
1815
-
1816
- return "<section style='$style'>".$page_type."</section>";
1817
- }
1818
-
1819
-
1820
  function ai_wp_head_hook () {
1821
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
1822
 
@@ -1836,15 +1328,7 @@ function ai_wp_head_hook () {
1836
 
1837
  if ($obj->get_enable_manual ()) {
1838
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1839
- echo do_shortcode ($obj->ai_getCode ());
1840
- }
1841
-
1842
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
1843
- echo "<script>
1844
- jQuery(document).ready(function($) {
1845
- $('body').prepend (\"", get_page_type_debug_info () , "\");
1846
- });
1847
- </script>\n";
1848
  }
1849
 
1850
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -1861,9 +1345,7 @@ function ai_wp_footer_hook () {
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
 
@@ -1874,11 +1356,7 @@ function ai_wp_footer_hook () {
1874
 
1875
  if ($obj->get_enable_manual ()) {
1876
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1877
- echo do_shortcode ($obj->ai_getCode ());
1878
- }
1879
-
1880
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
1881
- echo get_page_type_debug_info () , "\n";
1882
  }
1883
 
1884
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -1888,7 +1366,7 @@ function ai_wp_footer_hook () {
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,14 +1378,14 @@ function ai_write_debug_info ($write_processing_log = false) {
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";
@@ -1916,10 +1394,7 @@ function ai_write_debug_info ($write_processing_log = false) {
1916
  echo "USER: ";
1917
  if (($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) == AI_USER_LOGGED_IN) echo "LOGGED-IN "; else echo "NOT LOGGED-IN ";
1918
  if (($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) == AI_USER_ADMINISTRATOR) echo "ADMINISTRATOR";
1919
- $current_user = wp_get_current_user();
1920
  echo "\n";
1921
- echo 'USER ROLES: ', implode (', ', $current_user->roles), "\n";
1922
- echo 'MIN.USER FOR EXCEPTIONS: ', get_minimum_user_role (), "\n";
1923
  echo "PAGE TYPE: ";
1924
  switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1925
  case AI_PT_STATIC: echo "STATIC PAGE"; break;
@@ -1929,47 +1404,26 @@ function ai_write_debug_info ($write_processing_log = false) {
1929
  case AI_PT_ARCHIVE: echo "ARCHIVE PAGE"; break;
1930
  case AI_PT_SEARCH: echo "SEARCH PAGE"; break;
1931
  case AI_PT_404: echo "404 PAGE"; break;
1932
- case AI_PT_ADMIN: echo "ADMIN"; break;
1933
  case AI_PT_FEED: echo "FEED"; break;
1934
- case AI_PT_AJAX: echo "AJAX"; break;
1935
- case AI_PT_ANY: echo "ANY ?"; break;
1936
- case AI_PT_NONE: echo "NONE ?"; break;
1937
  default: echo "?"; break;
1938
  }
1939
  echo "\n";
1940
-
1941
- switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1942
- case AI_PT_STATIC:
1943
- case AI_PT_POST:
1944
- echo 'POST TYPE: ', get_post_type (), "\n";
1945
- $category_data = get_the_category();
1946
- $categories = array ();
1947
- foreach ($category_data as $category) {
1948
- $categories []= $category->slug;
1949
- }
1950
- echo 'CATEGORIES: ', implode (', ', $categories), "\n";
1951
- $tag_data = wp_get_post_tags (get_the_ID());
1952
- $tags = array ();
1953
- foreach ($tag_data as $tag) {
1954
- $tags []= $tag->slug;
1955
- }
1956
- echo 'TAGS: ', implode (', ', $tags), "\n";
1957
- $taxonomies = array ();
1958
- $taxonomy_names = get_post_taxonomies ();
1959
- foreach ($taxonomy_names as $taxonomy_name) {
1960
- $terms = get_the_terms (0, $taxonomy_name);
1961
- if (is_array ($terms)) {
1962
- foreach ($terms as $term) {
1963
- $taxonomies [] = strtolower ($term->taxonomy) . ':' . strtolower ($term->slug);
1964
- }
1965
- }
1966
- }
1967
- echo 'TAXONOMIES: ', implode (', ', $taxonomies), "\n";
1968
- echo 'ID: ', get_the_ID(), "\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) {
@@ -1989,60 +1443,6 @@ function ai_write_debug_info ($write_processing_log = false) {
1989
  elseif (AI_PHONE) echo "PHONE\n";
1990
  else echo "?\n";
1991
  }
1992
- echo 'BLOCK CLASS NAME: ', get_block_class_name (), "\n";
1993
- echo 'DYNAMIC BLOCKS: ';
1994
- switch (get_dynamic_blocks()) {
1995
- case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1996
- echo AI_TEXT_SERVER_SIDE;
1997
- break;
1998
- case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1999
- echo AI_TEXT_SERVER_SIDE_W3TC;
2000
- break;
2001
- case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
2002
- echo AI_TEXT_CLIENT_SIDE;
2003
- break;
2004
- }
2005
- echo "\n";
2006
- echo 'PARAGRAPH COUNTING: ';
2007
- switch (get_paragraph_counting_functions()) {
2008
- case AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS:
2009
- echo AI_TEXT_STANDARD;
2010
- break;
2011
- case AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS:
2012
- echo AI_TEXT_MULTIBYTE;
2013
- break;
2014
- }
2015
- echo "\n";
2016
- echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
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,7 +1460,7 @@ function ai_write_debug_info ($write_processing_log = false) {
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,9 +1492,6 @@ function ai_write_debug_info ($write_processing_log = false) {
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;
@@ -2181,31 +1578,19 @@ function ai_write_debug_info ($write_processing_log = false) {
2181
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2182
  if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]))
2183
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2184
- if (count ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2185
- echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2186
- if (count ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2187
- echo "BETWEEN COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2188
- if (count ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2189
- echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2190
 
2191
 
2192
- echo "\nBLOCKS FOR THIS PAGE TYPE\n";
2193
- if (isset ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2194
  echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2195
- if (isset ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2196
  echo "EXCERPT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2197
- if (isset ($ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2198
  echo "LOOP START HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2199
- if (isset ($ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2200
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2201
- if (isset ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2202
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2203
- if (isset ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2204
- echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2205
- if (isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2206
- echo "BETWEEN COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2207
- if (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
2208
- echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2209
 
2210
  if ($write_processing_log) {
2211
  echo "\nTIME EVENT\n";
@@ -2215,25 +1600,7 @@ function ai_write_debug_info ($write_processing_log = false) {
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,8 +1619,6 @@ function ai_write_debug_info ($write_processing_log = false) {
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 () {
@@ -2267,10 +1632,7 @@ function ai_shutdown_hook () {
2267
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST ||
2268
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_CATEGORY ||
2269
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_SEARCH ||
2270
- $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ARCHIVE ||
2271
- $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 ||
2272
- $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_NONE ||
2273
- $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ANY) {
2274
  echo "\n<!--\n\n";
2275
  ai_write_debug_info (true);
2276
  echo "\n-->\n";
@@ -2297,21 +1659,6 @@ function ai_check_plugin_options ($plugin_options = array ()) {
2297
 
2298
  if (!isset ($plugin_options ['MINIMUM_USER_ROLE'])) $plugin_options ['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2299
 
2300
- if (!isset ($plugin_options ['STICKY_WIDGET_MARGIN'])) $plugin_options ['STICKY_WIDGET_MARGIN'] = DEFAULT_STICKY_WIDGET_MARGIN;
2301
- $sticky_widget_margin = $plugin_options ['STICKY_WIDGET_MARGIN'];
2302
- if (!is_numeric ($sticky_widget_margin)) {
2303
- $sticky_widget_margin = DEFAULT_STICKY_WIDGET_MARGIN;
2304
- }
2305
- $sticky_widget_margin = intval ($sticky_widget_margin);
2306
- if ($sticky_widget_margin < 0) {
2307
- $sticky_widget_margin = 0;
2308
- }
2309
- if ($sticky_widget_margin > 999) {
2310
- $sticky_widget_margin = 999;
2311
- }
2312
- $plugin_options ['STICKY_WIDGET_MARGIN'] = $sticky_widget_margin;
2313
-
2314
-
2315
  if (!isset ($plugin_options ['PLUGIN_PRIORITY'])) $plugin_options ['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
2316
  $plugin_priority = $plugin_options ['PLUGIN_PRIORITY'];
2317
  if (!is_numeric ($plugin_priority)) {
@@ -2329,16 +1676,6 @@ function ai_check_plugin_options ($plugin_options = array ()) {
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,15 +1750,15 @@ function ai_load_options () {
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,135 +1768,119 @@ function ai_load_options () {
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,96 +1950,6 @@ function multisite_main_for_all_blogs () {
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,9 +1972,6 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
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,7 +1984,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
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,7 +1995,6 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
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,13 +2008,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
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,9 +2039,6 @@ function ai_data () {
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"])) {
@@ -2829,27 +2047,6 @@ function ai_data () {
2829
  readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$_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;
2838
- $total_count = 0;
2839
- foreach ($ratings [1] as $index => $count) {
2840
- $total_rating += (5 - $index) * $count;
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
- }
2852
-
2853
  elseif (function_exists ('ai_data_ajax')) {
2854
  ai_data_ajax ();
2855
  }
@@ -2862,23 +2059,17 @@ function ai_generate_extract (&$settings) {
2862
  $obj = new ai_Block (1);
2863
 
2864
  $extract = array ();
2865
- $content_hook_blocks = array ();
2866
- $excerpt_hook_blocks = array ();
2867
- $loop_start_hook_blocks = array ();
2868
- $loop_end_hook_blocks = array ();
2869
- $post_hook_blocks = array ();
2870
- $before_comments_hook_blocks = array ();
2871
- $between_comments_hook_blocks = array ();
2872
- $after_comments_hook_blocks = array ();
2873
-
2874
- $content_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2875
- $excerpt_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2876
- $loop_start_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2877
- $loop_end_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2878
- $post_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2879
- $before_comments_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2880
- $between_comments_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2881
- $after_comments_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2882
 
2883
  // Generate extracted data
2884
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
@@ -2925,30 +2116,15 @@ function ai_generate_extract (&$settings) {
2925
  foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
2926
  $post_hook_blocks [AI_PT_ANY][]= $block;
2927
  break;
2928
- case AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS:
2929
- foreach ($page_types as $block_page_type) $before_comments_hook_blocks [$block_page_type][]= $block;
2930
- $before_comments_hook_blocks [AI_PT_ANY][]= $block;
2931
- break;
2932
- case AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS:
2933
- foreach ($page_types as $block_page_type) $between_comments_hook_blocks [$block_page_type][]= $block;
2934
- $between_comments_hook_blocks [AI_PT_ANY][]= $block;
2935
- break;
2936
- case AI_AUTOMATIC_INSERTION_AFTER_COMMENTS:
2937
- foreach ($page_types as $block_page_type) $after_comments_hook_blocks [$block_page_type][]= $block;
2938
- $after_comments_hook_blocks [AI_PT_ANY][]= $block;
2939
- break;
2940
  }
2941
  }
2942
  }
2943
 
2944
- $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
2945
- $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
2946
- $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
2947
- $extract [LOOP_END_HOOK_BLOCKS] = $loop_end_hook_blocks;
2948
- $extract [POST_HOOK_BLOCKS] = $post_hook_blocks;
2949
- $extract [BEFORE_COMMENTS_HOOK_BLOCKS] = $before_comments_hook_blocks;
2950
- $extract [BETWEEN_COMMENTS_HOOK_BLOCKS] = $between_comments_hook_blocks;
2951
- $extract [AFTER_COMMENTS_HOOK_BLOCKS] = $after_comments_hook_blocks;
2952
 
2953
  return ($extract);
2954
  }
@@ -2961,15 +2137,14 @@ function ai_load_settings () {
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]))
2968
  $ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
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,14 +2156,8 @@ function ai_load_settings () {
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,7 +2258,7 @@ function ai_settings () {
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,44 +2305,22 @@ function ai_settings () {
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,7 +2331,7 @@ function ai_settings () {
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,9 +2343,9 @@ function ai_settings () {
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,7 +2354,7 @@ function ai_settings () {
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,10 +2379,10 @@ function ai_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);
@@ -3333,10 +2480,6 @@ function ai_settings () {
3333
  }
3334
  }
3335
  }
3336
- } elseif (isset ($_POST [AI_FORM_CLEAR_STATISTICS]) && is_numeric ($_POST [AI_FORM_CLEAR_STATISTICS])) {
3337
- if ($_POST [AI_FORM_CLEAR_STATISTICS] != 0) {
3338
- $wpdb->query ("DELETE FROM " . AI_STATISTICS_DB_TABLE . " WHERE block = " . $_POST [AI_FORM_CLEAR_STATISTICS]);
3339
- } else $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
3340
  }
3341
 
3342
  generate_settings_form ();
@@ -3426,7 +2569,7 @@ function ai_content_hook ($content = '') {
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;
@@ -3462,7 +2605,6 @@ function ai_content_hook ($content = '') {
3462
  $ai_last_check = AI_CHECK_NONE;
3463
  $current_block = 0;
3464
 
3465
- if (isset ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3466
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3467
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3468
 
@@ -3606,7 +2748,6 @@ function ai_excerpt_hook ($content = '') {
3606
  $ai_last_check = AI_CHECK_NONE;
3607
  $current_block = 0;
3608
 
3609
- if (isset ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3610
  foreach ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3611
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3612
 
@@ -3698,11 +2839,11 @@ function ai_before_after_post ($query, $automatic_insertion) {
3698
 
3699
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
3700
 
 
 
3701
  $counter = $ad_inserter_globals [$globals_name];
3702
  if ($counter == 1) $counter = '';
3703
 
3704
- $style = AI_DEBUG_POSITIONS_STYLE;
3705
-
3706
  echo "<section style='$style'>".($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? "BEFORE" : "AFTER")." POST ".$counter."</section>";
3707
  }
3708
 
@@ -3716,10 +2857,7 @@ function ai_before_after_post ($query, $automatic_insertion) {
3716
  $ai_last_check = AI_CHECK_NONE;
3717
  $current_block = 0;
3718
 
3719
-
3720
- $extract_index = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? LOOP_START_HOOK_BLOCKS : LOOP_END_HOOK_BLOCKS;
3721
- if (isset ($ai_db_options_extract [$extract_index][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3722
- foreach ($ai_db_options_extract [$extract_index][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3723
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3724
 
3725
  if (!isset ($block_object [$block])) continue;
@@ -3786,7 +2924,8 @@ function ai_loop_end_hook ($query){
3786
 
3787
  // Process Between Posts postion
3788
  function ai_post_hook ($post) {
3789
- global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time;
 
3790
 
3791
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ADMIN) return;
3792
 
@@ -3821,7 +2960,6 @@ function ai_post_hook ($post) {
3821
  $ai_last_check = AI_CHECK_NONE;
3822
  $current_block = 0;
3823
 
3824
- if (isset ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3825
  foreach ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3826
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3827
 
@@ -3861,257 +2999,6 @@ function ai_post_hook ($post) {
3861
  return $post;
3862
  }
3863
 
3864
- function ai_comments_array ($comments , $post_id ){
3865
- global $ai_wp_data;
3866
-
3867
- $thread_comments = get_option ('thread_comments');
3868
- $comment_counter = 0;
3869
- foreach ($comments as $comment) {
3870
- if (!$thread_comments || empty ($comment->comment_parent))
3871
- $comment_counter ++;
3872
- }
3873
- $ai_wp_data [AI_NUMBER_OF_COMMENTS] = $comment_counter;
3874
-
3875
- return $comments;
3876
- }
3877
-
3878
- function ai_wp_list_comments_args ($args) {
3879
- global $ai_wp_data;
3880
-
3881
- // print_r ($args);
3882
- // $args['per_page'] = 3;
3883
- // $args['page'] = 2;
3884
-
3885
- $ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'] = $args ['callback'];
3886
- $args ['callback'] = 'ai_comment_callback';
3887
-
3888
- $ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'] = $args ['end-callback'];
3889
- $args ['end-callback'] = 'ai_comment_end_callback';
3890
-
3891
- return $args;
3892
- }
3893
-
3894
- // Process comments counter + Before Comments postion
3895
- function ai_comment_callback ($comment, $args, $depth) {
3896
- global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time, $ai_walker;
3897
-
3898
- if ($depth == 1) {
3899
- if (!isset ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) {
3900
- $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] = 1;
3901
- } else $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] ++;
3902
- }
3903
-
3904
- $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
3905
- if ($debug_processing) {
3906
- ai_log ('COMMENT START HOOK START [' . $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] . ':'. $depth . ']');
3907
- $start_time = microtime (true);
3908
- }
3909
-
3910
- if ($depth == 1 && $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] == 1) {
3911
-
3912
- $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BEFORE_COMMENTS;
3913
-
3914
- if ($args ['style'] == 'div') $tag = 'div'; else $tag = 'li';
3915
-
3916
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
3917
-
3918
- $style = AI_DEBUG_POSITIONS_STYLE;
3919
-
3920
- echo "<$tag>\n";
3921
- echo "<section style='$style'>BEFORE COMMENTS</section>";
3922
- echo "</$tag>\n";
3923
- }
3924
-
3925
- $ad_code = "";
3926
-
3927
- $ai_last_check = AI_CHECK_NONE;
3928
- $current_block = 0;
3929
-
3930
- if (isset ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3931
- foreach ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3932
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3933
-
3934
- if (!isset ($block_object [$block])) continue;
3935
-
3936
- $current_block = $block;
3937
-
3938
- $obj = $block_object [$block];
3939
- $obj->clear_code_cache ();
3940
-
3941
- if (!$obj->check_server_side_detection ()) continue;
3942
- if (!$obj->check_page_types_lists_users ()) continue;
3943
- // No filter check
3944
-
3945
- // Last check before counter check before insertion
3946
- $ai_last_check = AI_CHECK_CODE;
3947
- if ($obj->ai_getCode () == '') continue;
3948
-
3949
- // Last check before insertion
3950
- if (!$obj->check_and_increment_block_counter ()) continue;
3951
-
3952
- $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3953
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
3954
- $ad_code .= $obj->get_code_for_insertion ();
3955
- $ai_last_check = AI_CHECK_INSERTED;
3956
- }
3957
- }
3958
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3959
-
3960
- echo "<$tag>\n";
3961
- echo $ad_code;
3962
- echo "</$tag>\n";
3963
- }
3964
-
3965
- if ($debug_processing) {
3966
- $ai_total_plugin_time += microtime (true) - $start_time;
3967
- ai_log ("COMMENT END HOOK END\n");
3968
- }
3969
-
3970
- if (!empty ($ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'])) {
3971
- echo call_user_func ($ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'], $comment, $args, $depth );
3972
- } else {
3973
- $ai_walker->comment_callback ($comment, $args, $depth);
3974
- }
3975
- }
3976
-
3977
- // Process Between Comments postion
3978
- function ai_comment_end_callback ($comment, $args, $depth) {
3979
- global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time;
3980
-
3981
- if ($args ['style'] == 'div') $tag = 'div'; else $tag = 'li';
3982
-
3983
- if (!empty ($ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'])) {
3984
- echo call_user_func ($ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'], $comment, $args, $depth);
3985
- } else echo "</$tag><!-- #comment-## -->\n";
3986
-
3987
- $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
3988
- if ($debug_processing) {
3989
- ai_log ('COMMENT END HOOK START [' . $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] . ':'. ($depth + 1) . ']');
3990
- $start_time = microtime (true);
3991
- }
3992
-
3993
- if ($depth == 0) {
3994
-
3995
- if (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) &&
3996
- $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] != 0 &&
3997
- !empty ($args ['per_page']) && !empty ($args ['page'])) {
3998
- $number_of_comments_mod_per_page = $ai_wp_data [AI_NUMBER_OF_COMMENTS] % $args ['per_page'];
3999
- if ($number_of_comments_mod_per_page != 0) {
4000
- $last_page = (int) ($ai_wp_data [AI_NUMBER_OF_COMMENTS] / $args ['per_page']) + 1;
4001
- $last_comment_number = $args ['page'] == $last_page ? $number_of_comments_mod_per_page : $args ['per_page'];
4002
- } else $last_comment_number = $args ['per_page'];
4003
- } else $last_comment_number = $ai_wp_data [AI_NUMBER_OF_COMMENTS];
4004
-
4005
- if ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME] == $last_comment_number) {
4006
-
4007
- $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_AFTER_COMMENTS;
4008
-
4009
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
4010
-
4011
- $style = AI_DEBUG_POSITIONS_STYLE;
4012
-
4013
- echo "<$tag>\n";
4014
- echo "<section style='$style'>AFTER COMMENTS</section>";
4015
- echo "</$tag>\n";
4016
- }
4017
-
4018
- $ad_code = "";
4019
-
4020
- $ai_last_check = AI_CHECK_NONE;
4021
- $current_block = 0;
4022
-
4023
- if (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
4024
- foreach ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
4025
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4026
-
4027
- if (!isset ($block_object [$block])) continue;
4028
-
4029
- $current_block = $block;
4030
-
4031
- $obj = $block_object [$block];
4032
- $obj->clear_code_cache ();
4033
-
4034
- if (!$obj->check_server_side_detection ()) continue;
4035
- if (!$obj->check_page_types_lists_users ()) continue;
4036
- // No filter check
4037
-
4038
- // Last check before counter check before insertion
4039
- $ai_last_check = AI_CHECK_CODE;
4040
- if ($obj->ai_getCode () == '') continue;
4041
-
4042
- // Last check before insertion
4043
- if (!$obj->check_and_increment_block_counter ()) continue;
4044
-
4045
- $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4046
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4047
- $ad_code .= $obj->get_code_for_insertion ();
4048
- $ai_last_check = AI_CHECK_INSERTED;
4049
- }
4050
- }
4051
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4052
-
4053
- echo "<$tag>\n";
4054
- echo $ad_code;
4055
- echo "</$tag>\n";
4056
- } else {
4057
- $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BETWEEN_COMMENTS;
4058
-
4059
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
4060
-
4061
- $style = AI_DEBUG_POSITIONS_STYLE;
4062
-
4063
- echo "<$tag>\n";
4064
- echo "<section style='$style'>BETWEEN COMMENTS ".$ad_inserter_globals [AI_COMMENT_COUNTER_NAME]."</section>";
4065
- echo "</$tag>\n";
4066
- }
4067
-
4068
- $ad_code = "";
4069
-
4070
- $ai_last_check = AI_CHECK_NONE;
4071
- $current_block = 0;
4072
-
4073
- if (isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
4074
- foreach ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
4075
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4076
-
4077
- if (!isset ($block_object [$block])) continue;
4078
-
4079
- $current_block = $block;
4080
-
4081
- $obj = $block_object [$block];
4082
- $obj->clear_code_cache ();
4083
-
4084
- if (!$obj->check_server_side_detection ()) continue;
4085
- if (!$obj->check_page_types_lists_users ()) continue;
4086
- if (!$obj->check_filter ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) continue;
4087
-
4088
- // Last check before counter check before insertion
4089
- $ai_last_check = AI_CHECK_CODE;
4090
- if ($obj->ai_getCode () == '') continue;
4091
-
4092
- // Last check before insertion
4093
- if (!$obj->check_and_increment_block_counter ()) continue;
4094
-
4095
- $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4096
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4097
- $ad_code .= $obj->get_code_for_insertion ();
4098
- $ai_last_check = AI_CHECK_INSERTED;
4099
- }
4100
- }
4101
- if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4102
-
4103
- echo "<$tag>\n";
4104
- echo $ad_code;
4105
- echo "</$tag>\n";
4106
- }
4107
- }
4108
-
4109
- if ($debug_processing) {
4110
- $ai_total_plugin_time += microtime (true) - $start_time;
4111
- ai_log ("COMMENT END HOOK END\n");
4112
- }
4113
- }
4114
-
4115
  function process_shortcode (&$block, $atts) {
4116
  global $block_object, $ai_last_check, $ai_wp_data;
4117
 
@@ -4234,33 +3121,26 @@ class ai_widget extends WP_Widget {
4234
  // Output admin widget options form
4235
 
4236
  $widget_title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
4237
- $block = isset ($instance ['block']) ? $instance ['block'] : 1;
4238
- if ($block > AD_INSERTER_BLOCKS) $block = 1;
4239
- $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
4240
 
4241
- if ($block == 0) $title = 'Debugger';
4242
- elseif ($block == - 1) $title = 'Dummy Widget';
4243
- elseif ($block >= 1) {
4244
  $obj = $block_object [$block];
4245
 
4246
  $title = '[' . $block . '] ' . $obj->get_ad_name();
4247
  if (!empty ($widget_title)) $title .= ' - ' . $widget_title;
4248
  if (!$obj->get_enable_widget ()) $title .= ' - DISABLED';
4249
- } else $title = "Unknown block";
4250
-
4251
- $url_parameters = "";
4252
- if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block);
4253
 
4254
  ?>
4255
  <input id="<?php echo $this->get_field_id ('title'); ?>" name="<?php echo $this->get_field_name ('title'); ?>" type="hidden" value="<?php echo esc_attr ($title); ?>">
4256
 
4257
  <p>
4258
- <label for="<?php echo $this->get_field_id ('widget-title'); ?>">Title: &nbsp;</label>
4259
- <input id="<?php echo $this->get_field_id ('widget-title'); ?>" name="<?php echo $this->get_field_name ('widget-title'); ?>" type="text" value="<?php echo esc_attr ($widget_title); ?>" style="width: 88%;">
4260
  </p>
4261
 
4262
  <p>
4263
- <label for="<?php echo $this->get_field_id ('block'); ?>"><a href='<?php echo admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, "&tab=", $block; ?>' title='Click for block settings' style='text-decoration: none;'>Block</a>:</label>
4264
  <select id="<?php echo $this->get_field_id ('block'); ?>" name="<?php echo $this->get_field_name('block'); ?>" style="width: 88%;">
4265
  <?php
4266
  for ($block_index = 1; $block_index <= AD_INSERTER_BLOCKS; $block_index ++) {
@@ -4269,16 +3149,14 @@ class ai_widget extends WP_Widget {
4269
  <option value='<?php echo $block_index; ?>' <?php if ($block_index == $block) echo 'selected="selected"'; ?>><?php echo $block_index, ' - ', $obj->get_ad_name(), !$obj->get_enable_widget ()? ' - DISABLED' : ''; ?></option>
4270
  <?php } ?>
4271
  <option value='0' <?php if ($block == 0) echo 'selected="selected"'; ?>>Debugger</option>
4272
- <option value='-1' <?php if ($block == - 1) echo 'selected="selected"'; ?>>Dummy Widget</option>
4273
  </select>
4274
  </p>
4275
 
4276
- <p>
4277
- <input type="hidden" name='<?php echo $this->get_field_name ('sticky'); ?>' value="0" />
4278
- <input type='checkbox' id='<?php echo $this->get_field_id ('sticky'); ?>' name='<?php echo $this->get_field_name ('sticky'); ?>' value='1' <?php if ($sticky) echo 'checked '; ?>>
4279
- <label for='<?php echo $this->get_field_id ('sticky'); ?>'>Sticky</label>
4280
- </p>
4281
  <?php
 
 
 
 
4282
  }
4283
 
4284
  function update ($new_instance, $old_instance) {
@@ -4286,9 +3164,8 @@ class ai_widget extends WP_Widget {
4286
  $instance = $old_instance;
4287
 
4288
  $instance ['widget-title'] = (!empty ($new_instance ['widget-title'])) ? strip_tags ($new_instance ['widget-title']) : '';
4289
- $instance ['title'] = (!empty ($new_instance ['title'])) ? strip_tags ($new_instance ['title']) : '';
4290
- $instance ['block'] = (isset ($new_instance ['block'])) ? $new_instance ['block'] : 1;
4291
- $instance ['sticky'] = (isset ($new_instance ['sticky'])) ? $new_instance ['sticky'] : 0;
4292
 
4293
  return $instance;
4294
  }
@@ -4312,28 +3189,11 @@ class ai_widget extends WP_Widget {
4312
  }
4313
  }
4314
 
4315
- function ai_add_attr_data (&$tag, $attr, $new_data) {
4316
-
4317
- if (trim ($tag) != '' && strpos ($tag, '<!--') === false) {
4318
- if (stripos ($tag, $attr."=") !== false) {
4319
- preg_match ("/$attr=[\'\"](.+?)[\'\"]/", $tag, $classes);
4320
- $tag = str_replace ($classes [1], $classes [1]. ' ' . $new_data, $tag);
4321
- return true;
4322
- }
4323
- elseif (strpos ($tag, ">") !== false) {
4324
- $tag = str_replace ('>', ' ' . $attr . '="' . $new_data . '">', $tag);
4325
- return true;
4326
- }
4327
- }
4328
-
4329
- return false;
4330
- }
4331
 
4332
  function ai_widget_draw ($args, $instance, &$block) {
4333
  global $block_object, $ad_inserter_globals, $ai_wp_data, $ai_last_check;
4334
 
4335
- $block = isset ($instance ['block']) ? $instance ['block'] : 1;
4336
- $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
4337
 
4338
  if ($block == 0) {
4339
  if (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0)
@@ -4341,18 +3201,6 @@ function ai_widget_draw ($args, $instance, &$block) {
4341
  return;
4342
  }
4343
 
4344
- if ($sticky) {
4345
- $ai_wp_data [AI_STICKY_WIDGETS] = true;
4346
- if ($block == - 1) {
4347
- $before_widget = $args ['before_widget'];
4348
- ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
4349
- ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
4350
- echo $before_widget;
4351
- echo $args ['after_widget'];
4352
- return;
4353
- }
4354
- }
4355
-
4356
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) return;
4357
 
4358
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
@@ -4366,8 +3214,7 @@ function ai_widget_draw ($args, $instance, &$block) {
4366
  $ad_inserter_globals [$globals_name] = 1;
4367
  } else $ad_inserter_globals [$globals_name] ++;
4368
 
4369
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0)
4370
- ai_log ("WIDGET (". $obj->number . ') ['.$ad_inserter_globals [$globals_name] . ']');
4371
 
4372
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
4373
 
@@ -4386,32 +3233,16 @@ function ai_widget_draw ($args, $instance, &$block) {
4386
 
4387
  // Last check before counter check before insertion
4388
  $ai_last_check = AI_CHECK_CODE;
4389
- if ($obj->ai_getCode () == '') {
4390
- if ($sticky) {
4391
- $before_widget = $args ['before_widget'];
4392
- ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
4393
- ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
4394
- echo $before_widget;
4395
- echo $args ['after_widget'];
4396
- }
4397
- return;
4398
- }
4399
 
4400
  // Last check before insertion
4401
  if (!$obj->check_and_increment_block_counter ()) return;
4402
 
4403
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4404
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4405
-
4406
  $viewport_classes = trim ($obj->get_viewport_classes ());
4407
- $sticky_class = $sticky ? ' ai-sticky' : '';
4408
- $widget_classes = trim ($viewport_classes . $sticky_class);
4409
-
4410
- if ($widget_classes != "") {
4411
- $before_widget = $args ['before_widget'];
4412
- ai_add_attr_data ($before_widget, 'class', $widget_classes);
4413
- echo $before_widget;
4414
- } else echo $args ['before_widget'];
4415
 
4416
  if (!empty ($title)) {
4417
  echo $args ['before_title'], apply_filters ('widget_title', $title), $args ['after_title'];
@@ -4420,6 +3251,7 @@ function ai_widget_draw ($args, $instance, &$block) {
4420
  echo $obj->get_code_for_insertion (false);
4421
 
4422
  echo $args ['after_widget'];
 
4423
 
4424
  $ai_last_check = AI_CHECK_INSERTED;
4425
 
@@ -4431,12 +3263,7 @@ function ai_widget_draw ($args, $instance, &$block) {
4431
  function ai_widget_draw_debugger ($args, $instance, &$block) {
4432
  global $ai_wp_data, $ai_db_options, $block_object;
4433
 
4434
- $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
4435
-
4436
- if ($sticky) {
4437
- $ai_wp_data [AI_STICKY_WIDGETS] = true;
4438
- echo ai_add_attr_data ($args ['before_widget'], 'class', 'ai-sticky');
4439
- } else echo $args ['before_widget'];
4440
 
4441
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
4442
 
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
+ Version: 2.1.8
5
+ Description: Insert any ad or code into Wordpress. Perfect for all kinds of ads. Simply enter any ad or HTML/Javascript/PHP code and select where and how you want to display it.
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
8
  Plugin URI: http://adinserter.pro/documentation
9
  */
10
 
11
  /*
 
12
  Change Log
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  Ad Inserter 2.1.8 - 2017-05-18
15
  - Fixed error when using server-side device detection
16
 
381
  exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
382
  }
383
 
384
+ 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;
385
 
386
  //include required files
387
  require_once AD_INSERTER_PLUGIN_DIR.'class.php';
388
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
389
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
390
  require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
 
391
 
392
  if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
393
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
403
  }
404
 
405
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
406
+ $ai_wp_data [AI_WP_URL] = remove_parameters_from_url ($_SERVER ['REQUEST_URI']);
407
 
408
  if (!is_admin()) {
409
  if (!isset ($_GET [AI_URL_DEBUG]))
423
 
424
  $ad_inserter_globals = array ();
425
  $block_object = array ();
 
426
 
427
  ai_load_settings ();
428
 
433
  }
434
  }
435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  if (function_exists ('ai_load_globals')) ai_load_globals ();
437
 
438
  if (get_dynamic_blocks ()) {
450
  }
451
 
452
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
453
+ $ai_wp_data [AI_WP_USER] = AI_USER_NOT_SET;
 
454
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
455
  $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
456
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
457
  $ai_wp_data [AI_TRACKING] = false;
 
458
 
459
  for ($counter = 1; $counter <= AD_INSERTER_BLOCKS; $counter ++) {
460
  $obj = $block_object [$counter];
470
  if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
471
  if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
472
 
473
+
474
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
475
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
476
 
498
 
499
  add_action ('wp', 'ai_wp_hook');
500
 
501
+ if ($adH->get_enable_manual () ||
502
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
503
+ get_remote_debugging () ||
504
+ ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0)
505
+ add_action ('wp_head', 'ai_wp_head_hook');
 
506
 
507
+ if ($adF->get_enable_manual () ||
508
+ $ai_wp_data [AI_TRACKING] ||
509
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE)
510
+ add_action ('wp_footer', 'ai_wp_footer_hook');
 
511
 
512
  if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
513
 
525
  add_action ('wp_ajax_ai_data', 'ai_data');
526
  add_action ('wp_ajax_nopriv_ai_data', 'ai_data');
527
 
 
 
 
 
528
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
529
  $ai_total_plugin_time += microtime (true) - $start_time;
530
  ai_log ("INITIALIZATION END\n");
531
  }
532
 
533
 
 
534
  function ai_toolbar ($wp_admin_bar) {
535
  global $block_object, $ai_wp_data;
536
 
549
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) $debug_no_insertion = 1; else $debug_no_insertion = 0;
550
  $debug_no_insertion_class = $debug_no_insertion == 0 ? ' on' : '';
551
 
552
+ $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0;
 
 
 
553
 
554
  $debug_settings_class = $debug_settings_on ? ' on' : '';
555
+ $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_parameters_from_url ($_SERVER ['REQUEST_URI'])) :
556
+ 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']));
557
 
558
  $wp_admin_bar->add_node (array (
559
  'id' => 'ai-toolbar',
561
  ));
562
  $wp_admin_bar->add_node (array (
563
  'id' => 'ai-toolbar-settings',
564
+ 'parent' => 'ai-toolbar',
565
  'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME,
566
  'href' => $top_menu_url,
567
  ));
631
  ($paragraph_block ['direction'] == 'b' ? ' <span class="dashicons dashicons-arrow-up-alt up-icon"></span>' : '').
632
  ($paragraph_block ['min'] != 0 ? ' min '.$paragraph_block ['min']. ' ' : '').
633
  ($paragraph_block ['max'] != 0 ? ' max '.$paragraph_block ['max']. ' ' : '').
634
+ ($paragraph_block ['blockquote'] ? ' blockquote ' : '').
635
+ ($paragraph_block ['text'] != '' ? ($paragraph_block ['text_type'] == AD_DO_NOT_CONTAIN ? ' NC ' : ' C ').' '.$paragraph_block ['text'] : ''),
636
  'href' => set_url_parameter (AI_URL_DEBUG_POSITIONS, $paragraph_block ['blocks'][0]),
637
  ));
638
  }
649
  'title' => '<span class="ab-icon'.$debug_no_insertion_class.'"></span>Disable Insertion',
650
  'href' => set_url_parameter (AI_URL_DEBUG_NO_INSERTION, $debug_no_insertion),
651
  ));
 
 
 
 
 
 
 
 
652
  $wp_admin_bar->add_node (array (
653
  'id' => 'ai-toolbar-processing',
654
  'parent' => 'ai-toolbar-settings',
660
  function set_user () {
661
  global $ai_wp_data;
662
 
663
+ if ($ai_wp_data [AI_WP_USER] != AI_USER_NOT_SET) return;
664
 
665
+ $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
666
 
667
  if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
668
  if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
669
 
670
  // if (isset ($_GET [AI_URL_DEBUG_USER]) && $_GET [AI_URL_DEBUG_USER] != 0) $ai_wp_data [AI_WP_USER] = $_GET [AI_URL_DEBUG_USER];
 
 
671
  }
672
 
673
  function set_page_type () {
676
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_NONE) return;
677
 
678
  if (is_admin()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ADMIN;
679
+ elseif (is_feed()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_FEED;
680
+ elseif (is_404()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_404;
681
+ elseif (is_front_page ()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_HOMEPAGE;
682
+ elseif (is_page()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_STATIC;
683
+ elseif (is_single()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_POST;
684
+ elseif (is_category()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_CATEGORY;
685
+ elseif (is_search()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_SEARCH;
686
+ elseif (is_archive()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ARCHIVE;
687
  }
688
 
689
  function ai_log_message ($message) {
702
  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).']');
703
  }
704
 
705
+ function ai_log_block_status ($block, $ai_last_check) {
706
  global $block_object;
707
 
708
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) $block = 0;
709
 
710
+ if ($ai_last_check == AI_CHECK_INSERTED) return "BLOCK $block INSERTED";
711
+ $status = "BLOCK $block FAILED CHECK: ";
712
  $obj = $block_object [$block];
713
  switch ($ai_last_check) {
714
  case AI_CHECK_PAGE_TYPE_FRONT_PAGE: $status .= "ENABLED ON HOMEPAGE"; break;
730
 
731
  case AI_CHECK_CATEGORY: $status .= "CATEGORY"; break;
732
  case AI_CHECK_TAG: $status .= "TAG"; break;
 
733
  case AI_CHECK_ID: $status .= "ID"; break;
734
  case AI_CHECK_URL: $status .= "URL"; break;
735
  case AI_CHECK_URL_PARAMETER: $status .= "URL PARAMETER"; break;
747
  case AI_CHECK_DISABLED_MANUALLY: $status .= "DISABLED BY HTML COMMENT"; break;
748
 
749
  case AI_CHECK_MAX_INSERTIONS: $status .= "MAX INSERTIONS " . $obj->get_maximum_insertions (); break;
750
+ case AI_CHECK_FILTER: $status .= "FILTER " . $obj->get_call_filter(); break;
751
  case AI_CHECK_PARAGRAPH_COUNTING: $status .= "PARAGRAPH COUNTING"; break;
752
  case AI_CHECK_MIN_NUMBER_OF_WORDS: $status .= "MIN NUMBER OF WORDS " . intval ($obj->get_minimum_words()); break;
753
  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;
774
  return $status;
775
  }
776
 
 
 
 
 
 
 
 
 
 
 
 
777
  function ai_log ($message = "") {
778
  global $ai_last_time, $ai_processing_log;
779
 
786
  $ai_last_time = microtime (true);
787
  }
788
 
789
+ function remove_parameters_from_url ($url, $parameter = '') {
790
+ if ($parameter == '')
791
+ $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
792
+ $parameters = array ($parameter);
 
793
 
794
+ foreach ($parameters as $parameter) {
795
+ if (stripos ($url, '?'.$parameter.'=') !== false) {
796
+ $url = preg_replace ("/".$parameter."=[^&]*/", "", $url);
797
+ $url = rtrim (str_replace ('?&', '?', $url), "?");
798
+ }
799
+ elseif (stripos ($url, "&".$parameter."=") !== false)
800
+ $url = preg_replace ("/&".$parameter."=[^&]*/", "", $url);
801
+ }
802
+
803
+ return $url;
804
+ }
805
+
806
+ function current_url () {
807
+ if (isset ($_SERVER ["HTTPS"]) && $_SERVER ["HTTPS"] == "on")
808
+ $url = "https://"; else
809
+ $url = "http://";
810
+ $url .= $_SERVER ['SERVER_NAME'];
811
+ if($_SERVER['SERVER_PORT'] != 80)
812
+ $url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
813
+ $url .= $_SERVER["REQUEST_URI"];
814
+ return $url;
815
  }
816
 
817
  function set_url_parameter ($parameter, $value) {
818
+ $url = remove_parameters_from_url (current_url ());
819
+
820
+ if (stripos ($url, $parameter) !== false) {
821
+ $url = preg_replace ("/($parameter=[^&]*)/", $parameter .'=' . $value, $url);
822
+ } else {
823
+ if (strpos ($url, '?') !== false)
824
+ $url .= '&' . $parameter .'=' . $value; else
825
+ $url .= '?' . $parameter .'=' . $value;
826
+ }
827
+ return $url;
828
  }
829
 
830
  function number_of_words (&$content) {
836
  }
837
 
838
  function ai_wp_hook () {
839
+ global $ai_wp_data, $ai_db_options_extract, $ai_total_plugin_time;
840
 
841
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
842
  ai_log ("WP HOOK START");
850
  ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 &&
851
  get_admin_toolbar_debugging () &&
852
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
853
+ add_action ('admin_bar_menu', 'ai_toolbar', 20);
854
 
855
  $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
856
 
877
  if (isset ($_GET [AI_URL_DEBUG_NO_INSERTION]))
878
  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;
879
 
 
 
 
880
  if (isset ($_GET [AI_URL_DEBUG_POSITIONS])) {
881
  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;
882
  if (is_numeric ($_GET [AI_URL_DEBUG_POSITIONS])) $ai_wp_data [AI_WP_DEBUG_BLOCK] = intval ($_GET [AI_URL_DEBUG_POSITIONS]);
913
  if (isset ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) && count ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) != 0 || $debug_positions)
914
  add_action ('the_post', 'ai_post_hook');
915
 
 
 
 
 
 
 
 
 
 
 
916
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
917
  $ai_total_plugin_time += microtime (true) - $start_time;
918
  ai_log ("WP HOOK END\n");
944
  global $ai_settings_page;
945
 
946
  if ($hook_suffix == $ai_settings_page) {
 
947
  wp_enqueue_script ('ai-admin-js', plugins_url ('js/ad-inserter.js', __FILE__), array (
948
  'jquery',
949
  'jquery-ui-tabs',
950
  'jquery-ui-button',
951
  'jquery-ui-tooltip',
952
  'jquery-ui-datepicker',
 
953
  ), AD_INSERTER_VERSION);
954
  wp_enqueue_style ('ai-admin-jquery-ui', plugins_url ('css/jquery-ui-1.10.3.custom.min.css', __FILE__), array (), null);
955
 
968
  if (AI_SYNTAX_HIGHLIGHTING) {
969
  wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
970
  wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
 
 
 
971
  }
972
  }
973
  }
1012
  #wp-admin-bar-ai-toolbar-no-insertion .ab-icon:before {
1013
  content: '\\f214';
1014
  }
 
 
 
1015
  #wp-admin-bar-ai-toolbar-processing .ab-icon:before {
1016
  content: '\\f464';
1017
  }
1027
  }
1028
  }
1029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  function add_footer_inline_scripts () {
1031
+ global $ai_wp_data;
 
 
 
 
 
 
 
 
 
 
 
 
1032
 
1033
+ $inline_scripts = $ai_wp_data [AI_TRACKING] || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE;
1034
 
1035
  if ($inline_scripts) echo "<script type='text/javascript'>\n";
1036
 
1044
  // $("div.ai-rotate").each (function () {
1045
  // var rotate_options = $(".ai-rotate-option", this);
1046
  // var random_index = Math.floor (Math.random () * rotate_options.length);
 
 
 
 
 
1047
  // rotate_options.hide ();
1048
  // $(rotate_options [random_index]).css ({"display": "", "visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""});
1049
  // $(this).css ({"position": ""});
1060
  // });
1061
  //';
1062
 
1063
+ echo 'jQuery(function($){var wrapping_div_class=".', $block_class_name, '";$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);rotate_options.hide();$(rotate_options[random_index]).css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""});$(this).css({"position":""});var wrapping_div=$(this).closest(wrapping_div_class);if(typeof wrapping_div.data("ai")!="undefined"){var data=
1064
+ JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}})});';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1065
  }
1066
 
1067
  if (function_exists ('add_footer_inline_scripts_2')) {
1309
  register_widget ('ai_widget');
1310
  }
1311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1312
  function ai_wp_head_hook () {
1313
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
1314
 
1328
 
1329
  if ($obj->get_enable_manual ()) {
1330
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1331
+ echo $obj->ai_getCode ();
 
 
 
 
 
 
 
 
1332
  }
1333
 
1334
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1345
  $start_time = microtime (true);
1346
  }
1347
 
1348
+ add_footer_inline_scripts ();
 
 
1349
 
1350
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
1351
 
1356
 
1357
  if ($obj->get_enable_manual ()) {
1358
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1359
+ echo $obj->ai_getCode ();
 
 
 
 
1360
  }
1361
 
1362
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1366
  }
1367
 
1368
  function ai_write_debug_info ($write_processing_log = false) {
1369
+ 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;
1370
 
1371
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
1372
  if (function_exists ('ai_debug_header')) ai_debug_header ();
1378
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
1379
 
1380
  echo "SETTINGS: ";
1381
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']))
1382
+ echo (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][0].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][1]), '.',
1383
+ (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
1384
+ (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]);
1385
 
1386
  echo "\n";
1387
  echo "SETTINGS TIMESTAMP: ";
1388
+ 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";
1389
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
1390
  if (is_multisite()) {
1391
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
1394
  echo "USER: ";
1395
  if (($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) == AI_USER_LOGGED_IN) echo "LOGGED-IN "; else echo "NOT LOGGED-IN ";
1396
  if (($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) == AI_USER_ADMINISTRATOR) echo "ADMINISTRATOR";
 
1397
  echo "\n";
 
 
1398
  echo "PAGE TYPE: ";
1399
  switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1400
  case AI_PT_STATIC: echo "STATIC PAGE"; break;
1404
  case AI_PT_ARCHIVE: echo "ARCHIVE PAGE"; break;
1405
  case AI_PT_SEARCH: echo "SEARCH PAGE"; break;
1406
  case AI_PT_404: echo "404 PAGE"; break;
 
1407
  case AI_PT_FEED: echo "FEED"; break;
 
 
 
1408
  default: echo "?"; break;
1409
  }
1410
  echo "\n";
1411
+ echo 'POST TYPE: ', get_post_type (), "\n";
1412
+ $category_data = get_the_category();
1413
+ $categories = array ();
1414
+ foreach ($category_data as $category) {
1415
+ $categories []= $category->slug;
1416
+ }
1417
+ echo 'CATEGORIES: ', implode (', ', $categories), "\n";
1418
+ $tag_data = wp_get_post_tags (get_the_ID());
1419
+ $tags = array ();
1420
+ foreach ($tag_data as $tag) {
1421
+ $tags []= $tag->slug;
1422
+ }
1423
+ echo 'TAGS: ', implode (', ', $tags), "\n";
1424
+ echo 'ID: ', get_the_ID(), "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1425
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
1426
+ echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
1427
  if (function_exists ('ai_debug')) ai_debug ();
1428
  echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
1429
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
1443
  elseif (AI_PHONE) echo "PHONE\n";
1444
  else echo "?\n";
1445
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1446
 
1447
  echo "\n";
1448
 
1460
  foreach (array_keys ($default->wp_options) as $key){
1461
  switch ($key) {
1462
  case AI_OPTION_CODE:
1463
+ case AI_OPTION_NAME:
1464
  continue 2;
1465
  case AI_OPTION_DISPLAY_ON_PAGES:
1466
  case AI_OPTION_DISPLAY_ON_POSTS:
1492
  $settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
1493
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1494
  break;
 
 
 
1495
  default:
1496
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1497
  break;
1578
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][AI_PT_ANY]), "\n";
1579
  if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]))
1580
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]), "\n";
 
 
 
 
 
 
1581
 
1582
 
1583
+ echo "\nPAGE TYPE BLOCKS\n";
1584
+ if (count ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1585
  echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1586
+ if (count ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1587
  echo "EXCERPT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1588
+ if (count ($ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1589
  echo "LOOP START HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1590
+ if (count ($ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1591
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1592
+ if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1593
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
 
 
 
 
 
 
1594
 
1595
  if ($write_processing_log) {
1596
  echo "\nTIME EVENT\n";
1600
  echo $log_line, "\n";
1601
  }
1602
 
 
 
 
 
 
 
 
 
1603
  echo "PHP: ", phpversion(), "\n";
 
 
 
 
 
 
 
 
 
 
1604
  global $wp_version;
1605
  echo "Wordpress: ", $wp_version, "\n";
1606
  $current_theme = wp_get_theme();
1619
  echo in_array ($plugin_path, $active_plugins) ? '* ' : ' ', html_entity_decode ($plugin ["Name"]), ' ', $plugin ["Version"], "\n";
1620
  }
1621
  }
 
 
1622
  }
1623
 
1624
  function ai_shutdown_hook () {
1632
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST ||
1633
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_CATEGORY ||
1634
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_SEARCH ||
1635
+ $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ARCHIVE) {
 
 
 
1636
  echo "\n<!--\n\n";
1637
  ai_write_debug_info (true);
1638
  echo "\n-->\n";
1659
 
1660
  if (!isset ($plugin_options ['MINIMUM_USER_ROLE'])) $plugin_options ['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
1661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1662
  if (!isset ($plugin_options ['PLUGIN_PRIORITY'])) $plugin_options ['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
1663
  $plugin_priority = $plugin_options ['PLUGIN_PRIORITY'];
1664
  if (!is_numeric ($plugin_priority)) {
1676
 
1677
  if (!isset ($plugin_options ['DYNAMIC_BLOCKS'])) $plugin_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
1678
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
 
 
 
 
 
 
 
 
 
 
1679
  if (!isset ($plugin_options ['ADMIN_TOOLBAR_DEBUGGING'])) $plugin_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
1680
  if (!isset ($plugin_options ['REMOTE_DEBUGGING'])) $plugin_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
1681
  if (!isset ($plugin_options ['JAVASCRIPT_DEBUGGING'])) $plugin_options ['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
1750
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD OPTIONS START");
1751
 
1752
  if (is_multisite()) {
1753
+ $ai_db_options_multisite = get_site_option (WP_OPTION_NAME);
1754
  option_stripslashes ($ai_db_options_multisite);
1755
  }
1756
 
1757
  if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
1758
+ $ai_db_options = get_blog_option (BLOG_ID_CURRENT_SITE, WP_OPTION_NAME);
1759
  option_stripslashes ($ai_db_options);
1760
  } else {
1761
+ $ai_db_options = get_option (WP_OPTION_NAME);
1762
  option_stripslashes ($ai_db_options);
1763
  }
1764
 
1768
  function get_viewport_css () {
1769
  global $ai_db_options;
1770
 
1771
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'] = generate_viewport_css ();
1772
 
1773
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS']);
1774
  }
1775
 
1776
  function get_syntax_highlighter_theme () {
1777
  global $ai_db_options;
1778
 
1779
+ 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;
1780
 
1781
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME']);
1782
  }
1783
 
1784
  function get_block_class_name () {
1785
  global $ai_db_options;
1786
 
1787
+ 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;
1788
 
1789
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME']);
1790
  }
1791
 
1792
  function get_minimum_user_role () {
1793
  global $ai_db_options;
1794
 
1795
+ 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;
1796
 
1797
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE']);
 
 
 
 
 
 
 
 
1798
  }
1799
 
1800
  function get_plugin_priority () {
1801
  global $ai_db_options;
1802
 
1803
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
1804
 
1805
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY']);
1806
  }
1807
 
1808
  function get_dynamic_blocks(){
1809
  global $ai_db_options;
1810
 
1811
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
1812
 
1813
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS']);
1814
  }
1815
 
1816
  function get_paragraph_counting_functions(){
1817
  global $ai_db_options;
1818
 
1819
+ 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;
1820
 
1821
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PARAGRAPH_COUNTING_FUNCTIONS']);
 
 
 
 
 
 
 
 
1822
  }
1823
 
1824
  function get_admin_toolbar_debugging () {
1825
  global $ai_db_options;
1826
 
1827
+ 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;
1828
 
1829
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING']);
1830
  }
1831
 
1832
  function get_remote_debugging () {
1833
  global $ai_db_options;
1834
 
1835
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
1836
 
1837
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING']);
1838
  }
1839
 
1840
  function get_javascript_debugging () {
1841
  global $ai_db_options;
1842
 
1843
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
1844
 
1845
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING']);
1846
  }
1847
 
1848
  function get_viewport_name ($viewport_number) {
1849
  global $ai_db_options;
1850
 
1851
  $viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
1852
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
1853
+ $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
1854
 
1855
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
1856
  }
1857
 
1858
  function get_viewport_width ($viewport_number) {
1859
  global $ai_db_options;
1860
 
1861
  $viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
1862
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
1863
+ $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
1864
 
1865
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
1866
  }
1867
 
1868
  function get_country_group_name ($group_number) {
1869
  global $ai_db_options;
1870
 
1871
  $country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
1872
+ 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;
1873
 
1874
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name]);
1875
  }
1876
 
1877
  function get_group_country_list ($group_number) {
1878
  global $ai_db_options;
1879
 
1880
  $group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
1881
+ if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name] = '';
1882
 
1883
+ return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name]);
1884
  }
1885
 
1886
  function multisite_settings_page_enabled () {
1950
  return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
1951
  }
1952
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1953
  function filter_html_class ($str){
1954
 
1955
  $str = str_replace (array ("\\\""), array ("\""), $str);
1972
  $value = str_replace (array ("\\\""), array ("\""), $value);
1973
 
1974
  if ($option == AI_OPTION_DOMAIN_LIST ||
 
 
 
1975
  $option == AI_OPTION_IP_ADDRESS_LIST ||
1976
  $option == AI_OPTION_COUNTRY_LIST) {
1977
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]"), "", $value);
1984
  ) {
1985
  $value = esc_html ($value);
1986
  }
1987
+ elseif ($option == AI_OPTION_NAME ||
1988
  $option == AI_OPTION_GENERAL_TAG ||
1989
  $option == AI_OPTION_DOMAIN_LIST ||
1990
  $option == AI_OPTION_CATEGORY_LIST ||
1995
  $option == AI_OPTION_PARAGRAPH_TEXT_TYPE ||
1996
  $option == AI_OPTION_PARAGRAPH_NUMBER ||
1997
  $option == AI_OPTION_MIN_PARAGRAPHS ||
 
1998
  $option == AI_OPTION_AVOID_PARAGRAPHS_ABOVE ||
1999
  $option == AI_OPTION_AVOID_PARAGRAPHS_BELOW ||
2000
  $option == AI_OPTION_AVOID_TRY_LIMIT ||
2008
  $option == AI_OPTION_END_DATE ||
2009
  $option == AI_OPTION_FALLBACK ||
2010
  $option == AI_OPTION_EXCERPT_NUMBER ||
2011
+ $option == AI_OPTION_CUSTOM_CSS) {
 
 
 
 
 
 
2012
  $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
2013
  $value = esc_html ($value);
2014
  }
2039
  if (is_numeric ($block) && $block >= 1 && $block <= AD_INSERTER_BLOCKS) {
2040
  generate_code_preview ($block);
2041
  }
 
 
 
2042
  }
2043
 
2044
  elseif (isset ($_GET ["image"])) {
2047
  readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$_GET ["image"]);
2048
  }
2049
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2050
  elseif (function_exists ('ai_data_ajax')) {
2051
  ai_data_ajax ();
2052
  }
2059
  $obj = new ai_Block (1);
2060
 
2061
  $extract = array ();
2062
+ $content_hook_blocks = array ();
2063
+ $excerpt_hook_blocks = array ();
2064
+ $loop_start_hook_blocks = array ();
2065
+ $loop_end_hook_blocks = array ();
2066
+ $post_hook_blocks = array ();
2067
+
2068
+ $content_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2069
+ $excerpt_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2070
+ $loop_start_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2071
+ $loop_end_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
2072
+ $post_hook_blocks = array (AI_PT_ANY => array (), AI_PT_HOMEPAGE => array(), AI_PT_CATEGORY => array(), AI_PT_SEARCH => array(), AI_PT_ARCHIVE => array(), AI_PT_STATIC => array(), AI_PT_POST => array(), AI_PT_404 => array(), AI_PT_FEED => array(), AI_PT_AJAX => array());
 
 
 
 
 
 
2073
 
2074
  // Generate extracted data
2075
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2116
  foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
2117
  $post_hook_blocks [AI_PT_ANY][]= $block;
2118
  break;
 
 
 
 
 
 
 
 
 
 
 
 
2119
  }
2120
  }
2121
  }
2122
 
2123
+ $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
2124
+ $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
2125
+ $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
2126
+ $extract [LOOP_END_HOOK_BLOCKS] = $loop_end_hook_blocks;
2127
+ $extract [POST_HOOK_BLOCKS] = $post_hook_blocks;
 
 
 
2128
 
2129
  return ($extract);
2130
  }
2137
  ai_load_options ();
2138
 
2139
  if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
2140
+ isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] == $version_string &&
2141
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
2142
+ isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]))
 
2143
  $ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
2144
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
2145
 
2146
  $obj = new ai_Block (0);
2147
+ $obj->wp_options [AI_OPTION_NAME] = 'Default';
2148
  $block_object [0] = $obj;
2149
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2150
  $obj = new ai_Block ($block);
2156
  $adF = new ai_AdF();
2157
  $adH->load_options (AI_HEADER_OPTION_NAME);
2158
  $adF->load_options (AI_FOOTER_OPTION_NAME);
2159
+ $block_object [AI_HEADER_OPTION_NAME] = $adH;
2160
+ $block_object [AI_FOOTER_OPTION_NAME] = $adF;
 
 
 
 
 
 
2161
 
2162
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS END");
2163
  }
2258
 
2259
  if ($exported_settings !== false) {
2260
  foreach (array_keys ($ad->wp_options) as $key){
2261
+ if ($key == AI_OPTION_NAME && isset ($_POST [$import_name_switch_name]) && $_POST [$import_name_switch_name] != "1") {
2262
  $form_field_name = $key . WP_FORM_FIELD_POSTFIX . $block;
2263
  if (isset ($_POST [$form_field_name])){
2264
  $ad->wp_options [$key] = filter_option ($key, $_POST [$form_field_name]);
2305
  }
2306
  }
2307
 
2308
+ $ai_options [AI_HEADER_OPTION_NAME] = $adH->wp_options;
2309
+ $ai_options [AI_FOOTER_OPTION_NAME] = $adF->wp_options;
 
 
 
 
 
 
 
 
 
 
 
2310
 
2311
  $options = array ();
2312
 
2313
  if (function_exists ('ai_filter_global_settings')) ai_filter_global_settings ($options);
2314
 
2315
+ $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
2316
+ $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
2317
+ $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
2318
+ $options ['PLUGIN_PRIORITY'] = filter_option ('plugin_priority', $_POST ['plugin_priority']);
2319
+ $options ['DYNAMIC_BLOCKS'] = filter_option ('dynamic_blocks', $_POST ['dynamic_blocks']);
2320
+ $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('paragraph_counting_functions', $_POST ['paragraph_counting_functions']);
2321
+ $options ['ADMIN_TOOLBAR_DEBUGGING'] = filter_option ('admin_toolbar_debugging', $_POST ['admin_toolbar_debugging']);
2322
+ $options ['REMOTE_DEBUGGING'] = filter_option ('remote_debugging', $_POST ['remote_debugging']);
2323
+ $options ['JAVASCRIPT_DEBUGGING'] = filter_option ('javascript_debugging', $_POST ['javascript_debugging']);
 
 
 
 
 
 
 
 
 
 
 
2324
 
2325
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
2326
  if (isset ($_POST ['viewport-name-'.$viewport]))
2331
 
2332
  $options ['VIEWPORT_CSS'] = generate_viewport_css ();
2333
 
2334
+ $ai_options [AI_GLOBAL_OPTION_NAME] = ai_check_plugin_options ($options);
2335
  }
2336
 
2337
  if (!empty ($invalid_blocks)) {
2343
  // Generate and save extract
2344
  $ai_options [AI_EXTRACT_OPTION_NAME] = ai_generate_extract ($ai_options);
2345
 
2346
+ $ai_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] = time ();
2347
 
2348
+ update_option (WP_OPTION_NAME, $ai_options);
2349
 
2350
  // Multisite
2351
  if (is_multisite () && is_main_site ()) {
2354
  if (function_exists ('ai_filter_multisite_settings')) ai_filter_multisite_settings ($options);
2355
 
2356
  ai_check_multisite_options ($options);
2357
+ update_site_option (WP_OPTION_NAME, $options);
2358
  }
2359
 
2360
  ai_load_settings ();
2379
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
2380
  delete_option (AD_OPTIONS);
2381
 
2382
+ delete_option (WP_OPTION_NAME);
2383
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
2384
  if (is_multisite () && is_main_site ()) {
2385
+ delete_site_option (WP_OPTION_NAME, $options);
2386
  }
2387
 
2388
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
2480
  }
2481
  }
2482
  }
 
 
 
 
2483
  }
2484
 
2485
  generate_settings_form ();
2569
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
2570
  $globals_name = AI_CONTENT_COUNTER_NAME;
2571
 
2572
+ $special_element_tags = explode (',', str_replace (' ', '', SPECIAL_ELEMENT_TAGS));
2573
 
2574
  if (!isset ($ad_inserter_globals [$globals_name])) {
2575
  $ad_inserter_globals [$globals_name] = 1;
2605
  $ai_last_check = AI_CHECK_NONE;
2606
  $current_block = 0;
2607
 
 
2608
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
2609
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2610
 
2748
  $ai_last_check = AI_CHECK_NONE;
2749
  $current_block = 0;
2750
 
 
2751
  foreach ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
2752
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2753
 
2839
 
2840
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
2841
 
2842
+ $style = AI_DEBUG_POSITIONS_STYLE;
2843
+
2844
  $counter = $ad_inserter_globals [$globals_name];
2845
  if ($counter == 1) $counter = '';
2846
 
 
 
2847
  echo "<section style='$style'>".($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? "BEFORE" : "AFTER")." POST ".$counter."</section>";
2848
  }
2849
 
2857
  $ai_last_check = AI_CHECK_NONE;
2858
  $current_block = 0;
2859
 
2860
+ foreach ($ai_db_options_extract [$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? LOOP_START_HOOK_BLOCKS : LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
 
 
 
2861
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2862
 
2863
  if (!isset ($block_object [$block])) continue;
2924
 
2925
  // Process Between Posts postion
2926
  function ai_post_hook ($post) {
2927
+ global $ai_wp_data, $ai_total_plugin_time;
2928
+ global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check;
2929
 
2930
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ADMIN) return;
2931
 
2960
  $ai_last_check = AI_CHECK_NONE;
2961
  $current_block = 0;
2962
 
 
2963
  foreach ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
2964
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2965
 
2999
  return $post;
3000
  }
3001
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3002
  function process_shortcode (&$block, $atts) {
3003
  global $block_object, $ai_last_check, $ai_wp_data;
3004
 
3121
  // Output admin widget options form
3122
 
3123
  $widget_title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
3124
+ $block = isset ($instance ['block']) ? $instance ['block'] : 1;
 
 
3125
 
3126
+ if ($block == 0) $title = 'Debugger'; else {
 
 
3127
  $obj = $block_object [$block];
3128
 
3129
  $title = '[' . $block . '] ' . $obj->get_ad_name();
3130
  if (!empty ($widget_title)) $title .= ' - ' . $widget_title;
3131
  if (!$obj->get_enable_widget ()) $title .= ' - DISABLED';
3132
+ }
 
 
 
3133
 
3134
  ?>
3135
  <input id="<?php echo $this->get_field_id ('title'); ?>" name="<?php echo $this->get_field_name ('title'); ?>" type="hidden" value="<?php echo esc_attr ($title); ?>">
3136
 
3137
  <p>
3138
+ <label for="<?php echo $this->get_field_id ('widget-title'); ?>">Title:</label>
3139
+ <input id="<?php echo $this->get_field_id ('widget-title'); ?>" name="<?php echo $this->get_field_name ('widget-title'); ?>" type="text" value="<?php echo esc_attr ($widget_title); ?>" style="width: 90%;">
3140
  </p>
3141
 
3142
  <p>
3143
+ <label for="<?php echo $this->get_field_id ('block'); ?>">Block:</label>
3144
  <select id="<?php echo $this->get_field_id ('block'); ?>" name="<?php echo $this->get_field_name('block'); ?>" style="width: 88%;">
3145
  <?php
3146
  for ($block_index = 1; $block_index <= AD_INSERTER_BLOCKS; $block_index ++) {
3149
  <option value='<?php echo $block_index; ?>' <?php if ($block_index == $block) echo 'selected="selected"'; ?>><?php echo $block_index, ' - ', $obj->get_ad_name(), !$obj->get_enable_widget ()? ' - DISABLED' : ''; ?></option>
3150
  <?php } ?>
3151
  <option value='0' <?php if ($block == 0) echo 'selected="selected"'; ?>>Debugger</option>
 
3152
  </select>
3153
  </p>
3154
 
 
 
 
 
 
3155
  <?php
3156
+ $url_parameters = "";
3157
+ if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block);
3158
+
3159
+ echo "<p><a href='", admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, "&tab=", $block, "'>Settings</a></p>";
3160
  }
3161
 
3162
  function update ($new_instance, $old_instance) {
3164
  $instance = $old_instance;
3165
 
3166
  $instance ['widget-title'] = (!empty ($new_instance ['widget-title'])) ? strip_tags ($new_instance ['widget-title']) : '';
3167
+ $instance ['title'] = (!empty ($new_instance ['title'])) ? strip_tags ($new_instance ['title']) : '';
3168
+ $instance ['block'] = (isset ($new_instance ['block'])) ? $new_instance ['block'] : 1;
 
3169
 
3170
  return $instance;
3171
  }
3189
  }
3190
  }
3191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3192
 
3193
  function ai_widget_draw ($args, $instance, &$block) {
3194
  global $block_object, $ad_inserter_globals, $ai_wp_data, $ai_last_check;
3195
 
3196
+ $block = isset ($instance ['block']) ? $instance ['block'] : 1;
 
3197
 
3198
  if ($block == 0) {
3199
  if (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0)
3201
  return;
3202
  }
3203
 
 
 
 
 
 
 
 
 
 
 
 
 
3204
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) return;
3205
 
3206
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
3214
  $ad_inserter_globals [$globals_name] = 1;
3215
  } else $ad_inserter_globals [$globals_name] ++;
3216
 
3217
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("WIDGET (". $obj->number . ') ['.$ad_inserter_globals [$globals_name] . ']');
 
3218
 
3219
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
3220
 
3233
 
3234
  // Last check before counter check before insertion
3235
  $ai_last_check = AI_CHECK_CODE;
3236
+ if ($obj->ai_getCode () == '') return;
 
 
 
 
 
 
 
 
 
3237
 
3238
  // Last check before insertion
3239
  if (!$obj->check_and_increment_block_counter ()) return;
3240
 
3241
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3242
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
3243
  $viewport_classes = trim ($obj->get_viewport_classes ());
3244
+ if ($viewport_classes != "") echo "<div class='" . $viewport_classes . "'>";
3245
+ echo $args ['before_widget'];
 
 
 
 
 
 
3246
 
3247
  if (!empty ($title)) {
3248
  echo $args ['before_title'], apply_filters ('widget_title', $title), $args ['after_title'];
3251
  echo $obj->get_code_for_insertion (false);
3252
 
3253
  echo $args ['after_widget'];
3254
+ if ($viewport_classes != "") echo "</div>";
3255
 
3256
  $ai_last_check = AI_CHECK_INSERTED;
3257
 
3263
  function ai_widget_draw_debugger ($args, $instance, &$block) {
3264
  global $ai_wp_data, $ai_db_options, $block_object;
3265
 
3266
+ echo $args ['before_widget'];
 
 
 
 
 
3267
 
3268
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
3269
 
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_BLOCK_NAME] = $options [$old_name];
94
  unset ($options [$old_name]);
95
  }
96
  $old_name = "ad" . $block . "_displayType";
@@ -364,12 +364,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,8 +383,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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;
@@ -411,8 +409,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
411
  $this->wp_options [AI_OPTION_CATEGORY_LIST_TYPE] = AD_BLACK_LIST;
412
  $this->wp_options [AI_OPTION_TAG_LIST] = AD_EMPTY_DATA;
413
  $this->wp_options [AI_OPTION_TAG_LIST_TYPE] = AD_BLACK_LIST;
414
- $this->wp_options [AI_OPTION_TAXONOMY_LIST] = AD_EMPTY_DATA;
415
- $this->wp_options [AI_OPTION_TAXONOMY_LIST_TYPE] = AD_BLACK_LIST;
416
  $this->wp_options [AI_OPTION_DISPLAY_ON_POSTS] = AI_ENABLED;
417
  $this->wp_options [AI_OPTION_DISPLAY_ON_PAGES] = AI_DISABLED;
418
  $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] = AI_DISABLED;
@@ -491,15 +487,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
491
  case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
492
  return AI_TEXT_BETWEEN_POSTS;
493
  break;
494
- case AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS:
495
- return AI_TEXT_BEFORE_COMMENTS;
496
- break;
497
- case AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS:
498
- return AI_TEXT_BETWEEN_COMMENTS;
499
- break;
500
- case AI_AUTOMATIC_INSERTION_AFTER_COMMENTS:
501
- return AI_TEXT_AFTER_COMMENTS;
502
- break;
503
  default:
504
  return '';
505
  break;
@@ -641,11 +628,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +640,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,73 +700,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +732,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +753,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +774,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +795,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +862,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +885,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +902,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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 = '';
@@ -1071,22 +993,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1071
  public function ai_getProcessedCode ($hide_label = false, $force_server_side_code = false){
1072
  global $ai_wp_data, $ad_inserter_globals, $block_object;
1073
 
1074
- $code = $this->ai_getCode ();
1075
-
1076
- if (strpos ($code, AD_COUNT_SEPARATOR) !== false) {
1077
- $ads = explode (AD_COUNT_SEPARATOR, $code);
1078
-
1079
- if (isset ($ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number])) {
1080
- $counter_for_filter = $ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number];
1081
-
1082
- if ($counter_for_filter != 0 && $counter_for_filter <= count ($ads)) {
1083
- $code = $ads [$counter_for_filter - 1];
1084
- } else $code = '';
1085
- } else $code = $ads [rand (0, count ($ads) - 1)];
1086
- }
1087
-
1088
- $processed_code = do_shortcode ($this->replace_ai_tags ($code));
1089
-
1090
  $dynamic_blocks = get_dynamic_blocks ();
1091
  if ($force_server_side_code || ($dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && defined ('AI_NO_W3TC'))) $dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1092
 
@@ -1099,7 +1006,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1099
  $processed_code = $ads [$this->code_version - 1];
1100
  break;
1101
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
1102
- $this->code_version = '""';
1103
  $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n";
1104
  foreach ($ads as $index => $ad) {
1105
  switch ($index) {
@@ -1304,7 +1210,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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
  }
@@ -1338,17 +1244,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1338
  return $option;
1339
  }
1340
 
1341
- public function get_ad_block_taxonomy(){
1342
- $option = isset ($this->wp_options [AI_OPTION_TAXONOMY_LIST]) ? $this->wp_options [AI_OPTION_TAXONOMY_LIST] : "";
1343
- return $option;
1344
- }
1345
-
1346
- public function get_ad_block_taxonomy_type(){
1347
- $option = isset ($this->wp_options [AI_OPTION_TAXONOMY_LIST_TYPE]) ? $this->wp_options [AI_OPTION_TAXONOMY_LIST_TYPE] : "";
1348
- if ($option == '') $option = AD_BLACK_LIST;
1349
- return $option;
1350
- }
1351
-
1352
  public function get_ad_enabled_on_which_pages (){
1353
  $option = isset ($this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES]) ? $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] : "";
1354
  if ($option == '') $option = AD_ENABLED_ON_ALL;
@@ -1648,42 +1543,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,15 +1694,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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) {
@@ -1892,8 +1748,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1892
  public function after_paragraph ($content, $position_preview = false) {
1893
  global $ai_wp_data, $ai_last_check, $special_element_tags;
1894
 
1895
- $no_closing_tag = array ('img', 'hr');
1896
-
1897
  $multibyte = get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
1898
 
1899
  $paragraph_positions = array ();
@@ -1913,27 +1767,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1913
  if (count ($paragraph_end_strings) == 0) return $content;
1914
 
1915
  foreach ($paragraph_end_strings as $paragraph_end_string) {
 
1916
 
1917
  $last_position = - 1;
1918
 
1919
  $paragraph_end_string = trim ($paragraph_end_string);
1920
- if ($paragraph_end_string == '') continue;
1921
-
1922
- if (in_array ($paragraph_end_string, $no_closing_tag)) {
1923
- if (preg_match_all ("/<$paragraph_end_string(.*?)>/", $content, $images)) {
1924
- foreach ($images [0] as $paragraph_end) {
1925
- if ($multibyte) {
1926
- $last_position = mb_stripos ($content, $paragraph_end, $last_position + 1) + mb_strlen ($paragraph_end) - 1;
1927
- $paragraph_positions [] = $last_position;
1928
- } else {
1929
- $last_position = stripos ($content, $paragraph_end, $last_position + 1) + strlen ($paragraph_end) - 1;
1930
- $paragraph_positions [] = $last_position;
1931
- }
1932
- }
1933
- }
1934
- continue;
1935
- }
1936
- elseif ($paragraph_end_string == "#") {
1937
  $paragraph_end = "\r\n\r\n";
1938
  if (!in_array ($last_content_position, $paragraph_positions)) $paragraph_positions [] = $last_content_position;
1939
  } else $paragraph_end = '</' . $paragraph_end_string . '>';
@@ -2109,64 +1948,10 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,15 +2104,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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) {
@@ -2516,76 +2298,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2516
  }
2517
  }
2518
 
2519
- function check_taxonomy () {
2520
-
2521
- $taxonomies = trim (strtolower ($this->get_ad_block_taxonomy()));
2522
- $taxonomy_type = $this->get_ad_block_taxonomy_type();
2523
-
2524
- if ($taxonomy_type == AD_BLACK_LIST) {
2525
-
2526
- if ($taxonomies == AD_EMPTY_DATA) return true;
2527
-
2528
- $taxonomies_listed = explode (",", $taxonomies);
2529
-
2530
- $taxonomy_names = get_post_taxonomies ();
2531
- foreach ($taxonomy_names as $taxonomy_name) {
2532
- $terms = get_the_terms (0, $taxonomy_name);
2533
- if (is_array ($terms)) {
2534
- foreach ($terms as $term) {
2535
-
2536
- foreach ($taxonomies_listed as $taxonomy_disabled){
2537
-
2538
- $taxonomy_disabled = trim ($taxonomy_disabled);
2539
-
2540
- $post_term_name = strtolower ($term->name);
2541
- $post_term_slug = strtolower ($term->slug);
2542
- $post_taxonomy = strtolower ($term->taxonomy);
2543
-
2544
- if ($post_term_name == $taxonomy_disabled || $post_term_slug == $taxonomy_disabled) return false;
2545
-
2546
- $post_taxonomy = strtolower ($term->taxonomy);
2547
- if ($post_taxonomy == $taxonomy_disabled) return false;
2548
-
2549
- if ($post_taxonomy . ':' . $post_term_slug == $taxonomy_disabled) return false;
2550
- }
2551
- }
2552
- }
2553
- }
2554
- return true;
2555
-
2556
- } else {
2557
-
2558
- if ($taxonomies == AD_EMPTY_DATA) return false;
2559
-
2560
- $taxonomies_listed = explode (",", $taxonomies);
2561
-
2562
- $taxonomy_names = get_post_taxonomies ();
2563
- foreach ($taxonomy_names as $taxonomy_name) {
2564
- $terms = get_the_terms (0, $taxonomy_name);
2565
- if (is_array ($terms)) {
2566
- foreach ($terms as $term) {
2567
-
2568
- foreach ($taxonomies_listed as $taxonomy_enabled) {
2569
-
2570
- $taxonomy_enabled = trim ($taxonomy_enabled);
2571
-
2572
- $post_term_name = strtolower ($term->name);
2573
- $post_term_slug = strtolower ($term->slug);
2574
-
2575
- if ($post_term_name == $taxonomy_enabled || $post_term_slug == $taxonomy_enabled) return true;
2576
-
2577
- $post_taxonomy = strtolower ($term->taxonomy);
2578
- if ($post_taxonomy == $taxonomy_enabled) return true;
2579
-
2580
- if ($post_taxonomy . ':' . $post_term_slug == $taxonomy_enabled) return true;
2581
- }
2582
- }
2583
- }
2584
- }
2585
- return false;
2586
- }
2587
- }
2588
-
2589
  function check_id () {
2590
  global $ai_wp_data;
2591
 
@@ -2840,9 +2552,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2840
  $ai_last_check = AI_CHECK_TAG;
2841
  if (!$this->check_tag ()) return false;
2842
 
2843
- $ai_last_check = AI_CHECK_TAXONOMY;
2844
- if (!$this->check_taxonomy ()) return false;
2845
-
2846
  $ai_last_check = AI_CHECK_ID;
2847
  if (!$this->check_id ()) return false;
2848
 
@@ -2913,51 +2622,42 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,17 +2666,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +2685,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +2888,7 @@ class ai_Block extends ai_CodeBlock {
3198
  parent::__construct();
3199
 
3200
  $this->number = $number;
3201
- $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$number;
3202
  }
3203
  }
3204
 
@@ -3215,27 +2905,3 @@ class ai_AdF extends ai_BaseCodeBlock {
3215
  parent::__construct();
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) {
3231
- if (($comment->comment_type == 'pingback' || $comment->comment_type == 'trackback') && $args ['short_ping']) {
3232
- $this->ping ($comment, $depth, $args);
3233
- } elseif ($args['format'] === 'html5') {
3234
- $this->html5_comment ($comment, $depth, $args);
3235
- } else {
3236
- $this->comment ($comment, $depth, $args);
3237
- }
3238
- }
3239
-
3240
- }
3241
-
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
 
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
  $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;
409
  $this->wp_options [AI_OPTION_CATEGORY_LIST_TYPE] = AD_BLACK_LIST;
410
  $this->wp_options [AI_OPTION_TAG_LIST] = AD_EMPTY_DATA;
411
  $this->wp_options [AI_OPTION_TAG_LIST_TYPE] = AD_BLACK_LIST;
 
 
412
  $this->wp_options [AI_OPTION_DISPLAY_ON_POSTS] = AI_ENABLED;
413
  $this->wp_options [AI_OPTION_DISPLAY_ON_PAGES] = AI_DISABLED;
414
  $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] = AI_DISABLED;
487
  case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
488
  return AI_TEXT_BETWEEN_POSTS;
489
  break;
 
 
 
 
 
 
 
 
 
490
  default:
491
  return '';
492
  break;
628
  return $option;
629
  }
630
 
 
 
 
 
 
631
  public function get_minimum_words(){
632
  $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS]) ? $this->wp_options [AI_OPTION_MIN_WORDS] : "";
633
  return $option;
640
 
641
  public function get_paragraph_tags(){
642
  $option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
643
+ return $option;
644
  }
645
 
646
  public function get_minimum_paragraph_words(){
700
  public function get_call_filter(){
701
  $option = isset ($this->wp_options [AI_OPTION_EXCERPT_NUMBER]) ? $this->wp_options [AI_OPTION_EXCERPT_NUMBER] : "";
702
  return $option;
703
+ }
704
 
705
  public function get_filter_type(){
706
+ $option = isset ($this->wp_options [AI_OPTION_FILTER_TYPE]) ? $this->wp_options [AI_OPTION_FILTER_TYPE] : "";
707
+ if ($option == '') $option = AI_OPTION_FILTER_AUTO;
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  return $option;
709
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
 
711
  public function get_direction_type(){
712
  $option = isset ($this->wp_options [AI_OPTION_DIRECTION_TYPE]) ? $this->wp_options [AI_OPTION_DIRECTION_TYPE] : "";
732
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] : "";
733
  if ($option == '') $option = AI_DISABLED;
734
 
735
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
736
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
737
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
738
  } else $automatic_insertion = '';
753
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES] : "";
754
  if ($option == '') $option = AI_DISABLED;
755
 
756
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
757
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
758
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
759
  } else $automatic_insertion = '';
774
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES] : "";
775
  if ($option == '') $option = AI_DISABLED;
776
 
777
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
778
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
779
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
780
  } else $automatic_insertion = '';
795
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES] : "";
796
  if ($option == '') $option = AI_DISABLED;
797
 
798
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
799
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
800
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
801
  } else $automatic_insertion = '';
862
  $option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
863
 
864
  // Fix for old bug
865
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && strpos ($option, "Undefined index")) $option = "";
866
 
867
  return $option;
868
  }
885
 
886
  $option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AI_DISABLED;
887
 
888
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
889
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
890
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
891
  } else $display_for_devices = '';
902
  $option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
903
  $option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AI_DISABLED;
904
 
905
+ if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && $this->get_detection_client_side()) {
906
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
907
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
908
  } else $display_for_devices = '';
993
  public function ai_getProcessedCode ($hide_label = false, $force_server_side_code = false){
994
  global $ai_wp_data, $ad_inserter_globals, $block_object;
995
 
996
+ $processed_code = do_shortcode ($this->replace_ai_tags ($this->ai_getCode ()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  $dynamic_blocks = get_dynamic_blocks ();
998
  if ($force_server_side_code || ($dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && defined ('AI_NO_W3TC'))) $dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
999
 
1006
  $processed_code = $ads [$this->code_version - 1];
1007
  break;
1008
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
 
1009
  $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n";
1010
  foreach ($ads as $index => $ad) {
1011
  switch ($index) {
1210
  }
1211
 
1212
  public function get_ad_name(){
1213
+ $option = isset ($this->wp_options [AI_OPTION_NAME]) ? $this->wp_options [AI_OPTION_NAME] : "";
1214
  if ($option == '') $option = AD_NAME. " " . $this->number;
1215
  return $option;
1216
  }
1244
  return $option;
1245
  }
1246
 
 
 
 
 
 
 
 
 
 
 
 
1247
  public function get_ad_enabled_on_which_pages (){
1248
  $option = isset ($this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES]) ? $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] : "";
1249
  if ($option == '') $option = AD_ENABLED_ON_ALL;
1543
  foreach ($paragraph_positions as $index => $paragraph_position) {
1544
  $positions []= $index + 1;
1545
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1546
  }
1547
  }
1548
 
1694
 
1695
  if ($position_preview || !empty ($positions)) {
1696
  $offset = 0;
1697
+ $code_for_insertion = $this->get_code_for_insertion ();
1698
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
1699
 
1700
  foreach ($paragraph_positions as $counter => $paragraph_position) {
1701
  if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
1702
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
1703
  else continue;
1704
 
1705
  if ($multibyte) {
1748
  public function after_paragraph ($content, $position_preview = false) {
1749
  global $ai_wp_data, $ai_last_check, $special_element_tags;
1750
 
 
 
1751
  $multibyte = get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS;
1752
 
1753
  $paragraph_positions = array ();
1767
  if (count ($paragraph_end_strings) == 0) return $content;
1768
 
1769
  foreach ($paragraph_end_strings as $paragraph_end_string) {
1770
+ if (trim ($paragraph_end_string) == '') continue;
1771
 
1772
  $last_position = - 1;
1773
 
1774
  $paragraph_end_string = trim ($paragraph_end_string);
1775
+ if ($paragraph_end_string == "#") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1776
  $paragraph_end = "\r\n\r\n";
1777
  if (!in_array ($last_content_position, $paragraph_positions)) $paragraph_positions [] = $last_content_position;
1778
  } else $paragraph_end = '</' . $paragraph_end_string . '>';
1948
  }
1949
  }
1950
  elseif ($position == '') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1951
  foreach ($paragraph_positions as $index => $paragraph_position) {
1952
  $positions []= $index + 1;
1953
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1954
  }
 
1955
  }
1956
 
1957
  if (empty ($positions)) {
2104
 
2105
  if ($position_preview || !empty ($positions)) {
2106
  $offset = 0;
2107
+ $code_for_insertion = $this->get_code_for_insertion ();
2108
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
2109
 
2110
  foreach ($paragraph_positions as $counter => $paragraph_position) {
2111
  if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
2112
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
2113
  else continue;
2114
 
2115
  if ($multibyte) {
2298
  }
2299
  }
2300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2301
  function check_id () {
2302
  global $ai_wp_data;
2303
 
2552
  $ai_last_check = AI_CHECK_TAG;
2553
  if (!$this->check_tag ()) return false;
2554
 
 
 
 
2555
  $ai_last_check = AI_CHECK_ID;
2556
  if (!$this->check_id ()) return false;
2557
 
2622
  function check_filter ($counter_for_filter) {
2623
  global $ai_last_check, $ad_inserter_globals, $page;
2624
 
 
 
2625
  $ai_last_check = AI_CHECK_FILTER;
2626
+ $filter_settings = trim ($this->get_call_filter());
2627
+ if ($filter_settings == 0 || $filter_settings == '') return true;
2628
 
2629
  switch ($this->get_filter_type ()) {
2630
+ case AI_OPTION_FILTER_PHP_FUNCTION_CALLS:
2631
  if (isset ($ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]))
2632
+ $counter_for_filter = $ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]; else return false;
2633
  break;
2634
+ case AI_OPTION_FILTER_CONTENT_PROCESSING:
2635
  if (isset ($ad_inserter_globals [AI_CONTENT_COUNTER_NAME]))
2636
+ $counter_for_filter = $ad_inserter_globals [AI_CONTENT_COUNTER_NAME]; else return false;
2637
  break;
2638
+ case AI_OPTION_FILTER_EXCERPT_PROCESSING:
2639
  if (isset ($ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]))
2640
+ $counter_for_filter = $ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]; else return false;
2641
  break;
2642
+ case AI_OPTION_FILTER_BEFORE_POST_PROCESSING:
2643
  if (isset ($ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]))
2644
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]; else return false;
2645
  break;
2646
+ case AI_OPTION_FILTER_AFTER_POST_PROCESSING:
2647
  if (isset ($ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]))
2648
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]; else return false;
2649
  break;
2650
+ case AI_OPTION_FILTER_WIDGET_DRAWING:
2651
  if (isset ($ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]))
2652
+ $counter_for_filter = $ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]; else return false;
2653
  break;
2654
+ case AI_OPTION_FILTER_SUBPAGES:
2655
  if (isset ($page))
2656
+ $counter_for_filter = $page; else return false;
2657
  break;
2658
+ case AI_OPTION_FILTER_POSTS:
2659
  if (isset ($ad_inserter_globals [AI_POST_COUNTER_NAME]))
2660
+ $counter_for_filter = $ad_inserter_globals [AI_POST_COUNTER_NAME]; else return false;
 
 
 
 
 
 
 
2661
  break;
2662
  }
2663
 
2666
  $filter_values = explode (",", $filter_settings);
2667
  } else $filter_values []= $filter_settings;
2668
 
2669
+ return in_array ($counter_for_filter, $filter_values);
 
 
 
 
 
 
 
 
 
 
2670
  }
2671
 
2672
  function check_and_increment_block_counter () {
2685
  }
2686
 
2687
  function check_block_counter () {
2688
+ global $ad_inserter_globals;
2689
 
2690
  $global_name = AI_BLOCK_COUNTER_NAME . $this->number;
2691
  $max_insertions = intval ($this->get_maximum_insertions ());
2888
  parent::__construct();
2889
 
2890
  $this->number = $number;
2891
+ $this->wp_options [AI_OPTION_NAME] = AD_NAME." ".$number;
2892
  }
2893
  }
2894
 
2905
  parent::__construct();
2906
  }
2907
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
constants.php CHANGED
@@ -1,10 +1,7 @@
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,7 +14,7 @@ if (!defined( 'AD_INSERTER_NAME'))
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,7 +44,6 @@ define ('AI_EXTRACT_OPTION_NAME', 'extract');
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,11 +53,10 @@ define ('AI_OPTION_TRACKING', 'tracking');
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,7 +72,6 @@ define ('AI_OPTION_AVOID_TRY_LIMIT', 'avoid_try_limit');
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');
@@ -103,8 +97,6 @@ define ('AI_OPTION_CATEGORY_LIST', 'category_list');
103
  define ('AI_OPTION_CATEGORY_LIST_TYPE', 'category_list_type');
104
  define ('AI_OPTION_TAG_LIST', 'tag_list');
105
  define ('AI_OPTION_TAG_LIST_TYPE', 'tag_list_type');
106
- define ('AI_OPTION_TAXONOMY_LIST', 'taxonomy_list');
107
- define ('AI_OPTION_TAXONOMY_LIST_TYPE', 'taxonomy_list_type');
108
  define ('AI_OPTION_DISPLAY_ON_HOMEPAGE', 'display_on_homepage');
109
  define ('AI_OPTION_DISPLAY_ON_PAGES', 'display_on_pages');
110
  define ('AI_OPTION_DISPLAY_ON_POSTS', 'display_on_posts');
@@ -122,35 +114,22 @@ define ('AI_OPTION_DISPLAY_FOR_DEVICES', 'display_for_devices');
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
 
145
  //define constant variable form
146
  define('AI_FORM_SAVE','ai_save');
147
  define('AI_FORM_CLEAR','ai_clear');
148
- define('AI_FORM_CLEAR_EXCEPTIONS','ai-clear-exceptions');
149
- define('AI_FORM_CLEAR_STATISTICS','ai-clear-statistics');
150
 
151
  define('AD_AUTHOR_SITE', '<!-- Powered by Ad Inserter Plugin By Spacetime -->');
152
  define('AD_ROTATE_SEPARATOR', '|rotate|');
153
- define('AD_COUNT_SEPARATOR', '|count|');
154
 
155
  //form select options
156
  define('AD_SELECT_SELECTED','selected');
@@ -180,9 +159,6 @@ define('AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH', 6);
180
  define('AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT', 7);
181
  define('AI_AUTOMATIC_INSERTION_AFTER_EXCERPT', 8);
182
  define('AI_AUTOMATIC_INSERTION_BETWEEN_POSTS', 9);
183
- define('AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS', 10);
184
- define('AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS', 11);
185
- define('AI_AUTOMATIC_INSERTION_AFTER_COMMENTS', 12);
186
 
187
  define('AI_TEXT_DISABLED', 'Disabled');
188
  define('AI_TEXT_BEFORE_POST', 'Before Post');
@@ -194,9 +170,6 @@ define('AI_TEXT_AFTER_PARAGRAPH', 'After Paragraph');
194
  define('AI_TEXT_BEFORE_EXCERPT', 'Before Excerpt');
195
  define('AI_TEXT_AFTER_EXCERPT', 'After Excerpt');
196
  define('AI_TEXT_BETWEEN_POSTS', 'Between Posts');
197
- define('AI_TEXT_BEFORE_COMMENTS', 'Before Comments');
198
- define('AI_TEXT_BETWEEN_COMMENTS', 'Between Comments');
199
- define('AI_TEXT_AFTER_COMMENTS', 'After Comments');
200
 
201
  //Display options
202
  define('AD_DISPLAY_ALL_USERS','all users');
@@ -272,7 +245,7 @@ define('AI_ALIGNMENT_CSS_STICKY_BOTTOM', 'position: fixed; bottom: 0; left: 0;
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');
@@ -282,36 +255,6 @@ define ('AI_OPTION_FILTER_AFTER_POST_PROCESSING', 'After post processing');
282
  define ('AI_OPTION_FILTER_WIDGET_DRAWING', 'Widget drawing');
283
  define ('AI_OPTION_FILTER_SUBPAGES', 'Subpages');
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_');
@@ -322,7 +265,6 @@ define ('AI_LOOP_BEFORE_COUNTER_NAME', 'AI_LOOP_BEFORE_COUNTER');
322
  define ('AI_LOOP_AFTER_COUNTER_NAME', 'AI_LOOP_AFTER_COUNTER');
323
  define ('AI_WIDGET_COUNTER_NAME', 'AI_WIDGET_COUNTER_');
324
  define ('AI_POST_COUNTER_NAME', 'AI_POST_COUNTER');
325
- define ('AI_COMMENT_COUNTER_NAME', 'AI_COMMENT_COUNTER');
326
 
327
  //Text List Type
328
  define('AD_CONTAIN','contain');
@@ -366,43 +308,25 @@ define('AI_TEXT_MULTIBYTE', 'Multibyte');
366
  define('AI_TRACKING_DISABLED', 0);
367
  define('AI_TRACKING_INTERNAL', 1);
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);
@@ -413,21 +337,8 @@ define ('DEFAULT_MULTISITE_PHP_PROCESSING', AI_ENABLED);
413
  define ('DEFAULT_MULTISITE_EXCEPTIONS', AI_ENABLED);
414
  define ('DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS', AI_DISABLED);
415
  define ('DEFAULT_TRACKING', AI_TRACKING_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");
@@ -438,14 +349,11 @@ define ('DEFAULT_VIEWPORT_WIDTH_3', 0);
438
 
439
  define ('DEFAULT_COUNTRY_GROUP_NAME', "Group");
440
 
441
- define ('CONTENT_HOOK_BLOCKS', 'content_hook');
442
- define ('EXCERPT_HOOK_BLOCKS', 'excerpt_hook');
443
- define ('LOOP_START_HOOK_BLOCKS', 'loop_start_hook');
444
- define ('LOOP_END_HOOK_BLOCKS', 'loop_end_hook');
445
- define ('POST_HOOK_BLOCKS', 'post_hook');
446
- define ('BEFORE_COMMENTS_HOOK_BLOCKS', 'before_comments_hook');
447
- define ('BETWEEN_COMMENTS_HOOK_BLOCKS', 'between_comments_hook');
448
- define ('AFTER_COMMENTS_HOOK_BLOCKS', 'after_comments_hook');
449
 
450
  define ('AI_CHECK_NONE', - 1);
451
  define ('AI_CHECK_INSERTED', 0);
@@ -503,7 +411,6 @@ define ('AI_CHECK_IP_ADDRESS', 47);
503
  define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
504
  define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
505
  define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
506
- define ('AI_CHECK_TAXONOMY', 51);
507
 
508
  define ('AI_PT_NONE', - 1);
509
  define ('AI_PT_ANY', 0);
@@ -518,25 +425,20 @@ define ('AI_PT_FEED', 8);
518
  define ('AI_PT_ADMIN', 9);
519
  define ('AI_PT_AJAX', 10);
520
 
 
521
  define ('AI_USER_NOT_LOGGED_IN', 0);
522
  define ('AI_USER_LOGGED_IN', 1);
523
  define ('AI_USER_ADMINISTRATOR', 2);
524
 
525
  define ('AI_WP_PAGE_TYPE', 0);
526
- define ('AI_WP_USER_SET', 1);
527
- define ('AI_WP_USER', 2);
528
- define ('AI_WP_DEBUGGING', 3);
529
- define ('AI_WP_DEBUG_BLOCK', 4);
530
- define ('AI_WP_URL', 5);
531
- define ('AI_SERVER_SIDE_DETECTION', 6);
532
- define ('AI_CLIENT_SIDE_DETECTION', 7);
533
- define ('AI_CONTEXT', 8);
534
- define ('AI_TRACKING', 9);
535
- define ('AI_STICKY_WIDGETS', 10);
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);
@@ -549,9 +451,6 @@ define ('AI_CONTEXT_SHORTCODE', 7);
549
  define ('AI_CONTEXT_HEADER', 8);
550
  define ('AI_CONTEXT_FOOTER', 9);
551
  define ('AI_CONTEXT_BETWEEN_POSTS', 10);
552
- define ('AI_CONTEXT_BEFORE_COMMENTS', 11);
553
- define ('AI_CONTEXT_BETWEEN_COMMENTS', 12);
554
- define ('AI_CONTEXT_AFTER_COMMENTS', 13);
555
 
556
  define ('AI_URL_DEBUG', 'ai-debug');
557
  define ('AI_URL_DEBUG_PROCESSING', 'ai-debug-processing');
@@ -562,14 +461,12 @@ define ('AI_URL_DEBUG_POSITIONS', 'ai-debug-positions');
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);
@@ -579,7 +476,8 @@ if (!defined ('AD_INSERTER_VIEWPORTS'))
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
 
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
  define ('AD_INSERTER_NAME', 'Ad Inserter');
15
 
16
  if (!defined( 'AD_INSERTER_VERSION'))
17
+ define ('AD_INSERTER_VERSION', '2.1.8');
18
 
19
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
20
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
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
  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
  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');
97
  define ('AI_OPTION_CATEGORY_LIST_TYPE', 'category_list_type');
98
  define ('AI_OPTION_TAG_LIST', 'tag_list');
99
  define ('AI_OPTION_TAG_LIST_TYPE', 'tag_list_type');
 
 
100
  define ('AI_OPTION_DISPLAY_ON_HOMEPAGE', 'display_on_homepage');
101
  define ('AI_OPTION_DISPLAY_ON_PAGES', 'display_on_pages');
102
  define ('AI_OPTION_DISPLAY_ON_POSTS', 'display_on_posts');
114
  define ('AI_OPTION_DETECT_SERVER_SIDE', 'detect_server_side');
115
  define ('AI_OPTION_DETECT_CLIENT_SIDE', 'detect_client_side');
116
  define ('AI_OPTION_DETECT_VIEWPORT', 'detect_viewport');
 
117
  define ('AI_OPTION_DISABLED', 'disabled');
118
 
119
  define ('AI_OPTION_IMPORT', 'import');
120
  define ('AI_OPTION_IMPORT_NAME', 'import_name');
121
  define ('AI_OPTION_PLUGIN_STATUS', 'plugin_status');
122
 
 
 
 
 
 
 
 
 
 
 
123
  //misc
124
  define('AD_EMPTY_VALUE','');
125
 
126
  //define constant variable form
127
  define('AI_FORM_SAVE','ai_save');
128
  define('AI_FORM_CLEAR','ai_clear');
129
+ define('AI_FORM_CLEAR_EXCEPTIONS','ai_clear_exceptions');
 
130
 
131
  define('AD_AUTHOR_SITE', '<!-- Powered by Ad Inserter Plugin By Spacetime -->');
132
  define('AD_ROTATE_SEPARATOR', '|rotate|');
 
133
 
134
  //form select options
135
  define('AD_SELECT_SELECTED','selected');
159
  define('AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT', 7);
160
  define('AI_AUTOMATIC_INSERTION_AFTER_EXCERPT', 8);
161
  define('AI_AUTOMATIC_INSERTION_BETWEEN_POSTS', 9);
 
 
 
162
 
163
  define('AI_TEXT_DISABLED', 'Disabled');
164
  define('AI_TEXT_BEFORE_POST', 'Before Post');
170
  define('AI_TEXT_BEFORE_EXCERPT', 'Before Excerpt');
171
  define('AI_TEXT_AFTER_EXCERPT', 'After Excerpt');
172
  define('AI_TEXT_BETWEEN_POSTS', 'Between Posts');
 
 
 
173
 
174
  //Display options
175
  define('AD_DISPLAY_ALL_USERS','all users');
245
  define('AD_BLACK_LIST','Black List');
246
  define('AD_WHITE_LIST','White List');
247
 
248
+ //Filter Type
249
  define ('AI_OPTION_FILTER_AUTO', 'Auto');
250
  define ('AI_OPTION_FILTER_PHP_FUNCTION_CALLS', 'PHP function calls');
251
  define ('AI_OPTION_FILTER_CONTENT_PROCESSING', 'Content processing');
255
  define ('AI_OPTION_FILTER_WIDGET_DRAWING', 'Widget drawing');
256
  define ('AI_OPTION_FILTER_SUBPAGES', 'Subpages');
257
  define ('AI_OPTION_FILTER_POSTS', 'Posts');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
 
259
  //Counter names
260
  define ('AI_BLOCK_COUNTER_NAME', 'AI_BLOCK_COUNTER_');
265
  define ('AI_LOOP_AFTER_COUNTER_NAME', 'AI_LOOP_AFTER_COUNTER');
266
  define ('AI_WIDGET_COUNTER_NAME', 'AI_WIDGET_COUNTER_');
267
  define ('AI_POST_COUNTER_NAME', 'AI_POST_COUNTER');
 
268
 
269
  //Text List Type
270
  define('AD_CONTAIN','contain');
308
  define('AI_TRACKING_DISABLED', 0);
309
  define('AI_TRACKING_INTERNAL', 1);
310
 
 
 
 
 
 
 
 
 
 
 
 
311
  // Click detection
312
+ define('AI_CLICK_DETECTION_STANDARD', 0);
313
+ define('AI_CLICK_DETECTION_ADVANCED', 1);
314
 
315
+ define('AI_TEXT_INTERNAL', 'Internal');
316
+ define('AI_TEXT_ADVANCED', 'Advanced');
 
317
 
318
  //Settings
319
+ define('AI_ENABLED', '1');
320
+ define('AI_DISABLED', '0');
321
 
322
+ define('AI_COOKIE_TIME', 3600);
323
 
324
+ define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
 
 
 
 
325
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
326
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
 
327
  define ('DEFAULT_PLUGIN_PRIORITY', 99999);
328
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
329
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
 
330
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
331
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
332
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
337
  define ('DEFAULT_MULTISITE_EXCEPTIONS', AI_ENABLED);
338
  define ('DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS', AI_DISABLED);
339
  define ('DEFAULT_TRACKING', AI_TRACKING_DISABLED);
 
340
  define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
341
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  define ('DEFAULT_VIEWPORT_NAME_1', "Desktop");
343
  define ('DEFAULT_VIEWPORT_NAME_2', "Tablet");
344
  define ('DEFAULT_VIEWPORT_NAME_3', "Phone");
349
 
350
  define ('DEFAULT_COUNTRY_GROUP_NAME', "Group");
351
 
352
+ define ('CONTENT_HOOK_BLOCKS', 'content_hook');
353
+ define ('EXCERPT_HOOK_BLOCKS', 'excerpt_hook');
354
+ define ('LOOP_START_HOOK_BLOCKS', 'loop_start_hook');
355
+ define ('LOOP_END_HOOK_BLOCKS', 'loop_end_hook');
356
+ define ('POST_HOOK_BLOCKS', 'post_hook');
 
 
 
357
 
358
  define ('AI_CHECK_NONE', - 1);
359
  define ('AI_CHECK_INSERTED', 0);
411
  define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
412
  define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
413
  define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
 
414
 
415
  define ('AI_PT_NONE', - 1);
416
  define ('AI_PT_ANY', 0);
425
  define ('AI_PT_ADMIN', 9);
426
  define ('AI_PT_AJAX', 10);
427
 
428
+ define ('AI_USER_NOT_SET', - 1);
429
  define ('AI_USER_NOT_LOGGED_IN', 0);
430
  define ('AI_USER_LOGGED_IN', 1);
431
  define ('AI_USER_ADMINISTRATOR', 2);
432
 
433
  define ('AI_WP_PAGE_TYPE', 0);
434
+ define ('AI_WP_USER', 1);
435
+ define ('AI_WP_DEBUGGING', 2);
436
+ define ('AI_WP_DEBUG_BLOCK', 3);
437
+ define ('AI_WP_URL', 4);
438
+ define ('AI_SERVER_SIDE_DETECTION', 5);
439
+ define ('AI_CLIENT_SIDE_DETECTION', 6);
440
+ define ('AI_CONTEXT', 7);
441
+ define ('AI_TRACKING', 8);
 
 
 
 
 
 
442
 
443
  define ('AI_CONTEXT_NONE', 0);
444
  define ('AI_CONTEXT_CONTENT', 1);
451
  define ('AI_CONTEXT_HEADER', 8);
452
  define ('AI_CONTEXT_FOOTER', 9);
453
  define ('AI_CONTEXT_BETWEEN_POSTS', 10);
 
 
 
454
 
455
  define ('AI_URL_DEBUG', 'ai-debug');
456
  define ('AI_URL_DEBUG_PROCESSING', 'ai-debug-processing');
461
  define ('AI_URL_DEBUG_NO_INSERTION', 'ai-debug-no-insertion');
462
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php');
463
  define ('AI_URL_DEBUG_COUNTRY', 'ai-debug-country');
 
464
 
465
  define ('AI_DEBUG_PROCESSING', 0x01);
466
  define ('AI_DEBUG_BLOCKS', 0x02);
467
  define ('AI_DEBUG_TAGS', 0x04);
468
  define ('AI_DEBUG_POSITIONS', 0x08);
469
  define ('AI_DEBUG_NO_INSERTION', 0x10);
 
470
 
471
  if (!defined ('AD_INSERTER_BLOCKS'))
472
  define ('AD_INSERTER_BLOCKS', 16);
476
 
477
  define ('AI_DEBUG_TAGS_STYLE', 'font-weight: bold; color: white; padding: 2px;');
478
  define ('AI_DEBUG_POSITIONS_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;');
 
479
  define ('AI_DEBUG_WIDGET_STYLE', 'margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;');
480
 
481
+ define ('SPECIAL_ELEMENT_TAGS', 'blockquote, figure, li');
482
+
483
 
css/ad-inserter.css CHANGED
@@ -1,14 +1,14 @@
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
  }
13
 
14
  #ai-form .ui-widget {
@@ -20,10 +20,6 @@
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,21 +51,6 @@ a.clear-link, a.clear-link:hover, a.clear-link:focus {
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;*/
@@ -188,7 +169,6 @@ div.ai-chart-label {
188
  top: 13px;
189
  left: 44px;
190
  z-index: 202;
191
- opacity: 0.5;
192
  display: none;
193
  }
194
 
@@ -217,31 +197,22 @@ div.ai-tooltip .version {
217
  margin-right: 24px;
218
  }
219
 
220
- .ui-tabs .ui-tabs-nav li {
221
- margin: 1px 0.18em 0 0;
222
- }
223
-
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,14 +231,6 @@ textarea.simple-editor {
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;
@@ -484,33 +447,15 @@ div.automatic-insertion img {
484
  background: url('images/icons.png') -180px 0;
485
  }
486
 
487
- .checkbox-icon.icon-none {
488
- width: 10px;
489
  height: 12px;
490
  margin-top: 6px;
 
491
  }
492
 
493
  @media(max-width: 768px) {
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
-
1
  #ai-data {
2
+ font-family: "2.1.8"; /* 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;
12
  }
13
 
14
  #ai-form .ui-widget {
20
  font-size: 12px;
21
  }
22
 
 
 
 
 
23
  .ace_editor {
24
  border: 1px solid #ddd;
25
  border-radius: 4px;
51
  box-shadow: 0 0 0;
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /*#editor-1 {*/
55
  /* font-family: Courier, 'Courier New', monospace, tahoma;*/
56
  /* font-family: tahoma;*/
169
  top: 13px;
170
  left: 44px;
171
  z-index: 202;
 
172
  display: none;
173
  }
174
 
197
  margin-right: 24px;
198
  }
199
 
 
 
 
 
200
  #ai-tabs a {
201
  width: 14px;
202
  text-align: center;
 
203
  }
204
  #ai-tabs {
205
  padding: .2em 0 0 .6em;
206
  }
207
 
208
+
209
  #ai-scroll-tabs {
210
  height: 42px;
211
  }
212
 
 
 
 
 
 
213
  #header-buttons {
214
  min-height: 26px;
215
+ margin: 10px 0;
216
  float: right;
217
  }
218
 
231
  height: 388px;
232
  }
233
 
 
 
 
 
 
 
 
 
234
  @media (min-width: 783px) and (max-width: 828px) {
235
  .auto-fold #wpcontent, .auto-fold #wpfooter {
236
  margin-left: 20px;
447
  background: url('images/icons.png') -180px 0;
448
  }
449
 
450
+ .checkbox-icon.icon-red {
451
+ width: 12px;
452
  height: 12px;
453
  margin-top: 6px;
454
+ background: url('images/icons.png') 0 -40px;
455
  }
456
 
457
  @media(max-width: 768px) {
458
  .text .checkbox-button {
459
  padding: 2px 5px 2px 4px;
460
  }
 
 
 
 
 
 
 
 
 
 
461
  }
 
 
 
 
 
 
 
 
 
css/images/index.html CHANGED
@@ -1,26 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/index.html CHANGED
@@ -1,26 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/after-comments.png DELETED
Binary file
images/before-comments.png DELETED
Binary file
images/between-comments.png DELETED
Binary file
images/domain-monitor.png ADDED
Binary file
images/index.html CHANGED
@@ -1,26 +1,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
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
images/{contextual-2.jpg → media.net_250x250_2.jpg} RENAMED
File without changes
images/{contextual-1.gif → media.net_728x90.gif} RENAMED
File without changes
images/monitors.png ADDED
Binary file
images/stars.png DELETED
Binary file
images/test.png DELETED
Binary file
includes/ace/index.html CHANGED
@@ -1,26 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/index.html CHANGED
@@ -1,26 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js/ads.js DELETED
@@ -1,4 +0,0 @@
1
- var e=document.createElement('div');
2
- e.id='dqwpediwqswqma';
3
- e.style.display='none';
4
- document.body.appendChild(e);
 
 
 
 
includes/js/index.html CHANGED
@@ -1,26 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.html CHANGED
@@ -1,26 +1,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, 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
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
js/ad-inserter.js CHANGED
@@ -1,9 +1,8 @@
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,10 +37,6 @@ var AI_ALIGNMENT_STICKY_RIGHT = 9;
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,7 +81,7 @@ function SyntaxHighlight (id, block, settings) {
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,25 +121,6 @@ function change_block_alignment (block) {
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;
@@ -152,7 +128,7 @@ jQuery(document).ready(function($) {
152
  if (header) {
153
  $.elycharts.templates['ai'] = {
154
  type : "line",
155
- margins : [10, 38, 20, 38],
156
  defaultSeries : {
157
  fill: true,
158
  fillProps: {
@@ -237,7 +213,7 @@ jQuery(document).ready(function($) {
237
 
238
  $.elycharts.templates['ai-versions'] = {
239
  type : "line",
240
- margins : [10, 38, 20, 38],
241
  defaultSeries: {
242
  color: "#0a0",
243
  fillProps: {
@@ -307,7 +283,7 @@ jQuery(document).ready(function($) {
307
 
308
  $.elycharts.templates['ai-versions-legend'] = {
309
  template: 'ai-versions',
310
- margins : [10, 38, 10, 38],
311
  defaultSeries : {
312
  fill: true,
313
  fillProps: {
@@ -414,7 +390,7 @@ jQuery(document).ready(function($) {
414
  $.elycharts.templates['ai-bar'] = {
415
  template: 'ai-pie',
416
  type: "line",
417
- margins : [5, 0, 5, 45],
418
  barMargins : 1,
419
  defaultSeries : {
420
  type: "bar",
@@ -463,93 +439,82 @@ jQuery(document).ready(function($) {
463
  $("#tab-" + block + " input:checkbox").each (function() {
464
  var default_value = $(this).attr ("default");
465
  var current_value = $(this).is (':checked');
466
- var name = $(this).attr ("name");
467
 
468
- if (typeof name != 'undefined') {
469
- if (typeof default_value != 'undefined') {
470
- default_value = Boolean (parseInt (default_value));
471
- // console.log ($(this).attr ("name"), ": default_value: ", $(this).attr ("default"), " = ", default_value, ", current_value: ", current_value);
472
 
473
- if (current_value == default_value) {
474
- $(this).removeAttr ("name");
475
- $("#tab-" + block + " [name='" + name + "']").removeAttr ("name");
476
- // console.log ("REMOVED: ", name);
477
- }
478
  }
479
- // else console.log ("NO DEFAULT VALUE:", $(this).attr ("name"));
480
  }
 
481
  });
482
 
483
  $("#tab-" + block + " input:text").each (function() {
484
  var default_value = $(this).attr ("default");
485
  var current_value = $(this).val ();
486
- var name = $(this).attr ("name");
487
 
488
- if (typeof name != 'undefined') {
489
- if (typeof default_value != 'undefined') {
490
- // console.log ($(this).attr ("name"), ": default_value: ", default_value, ", current_value: ", current_value);
491
 
492
- if (current_value == default_value) {
493
- $(this).removeAttr ("name");
494
- // console.log ("REMOVED: ", name);
495
- }
496
  }
497
- // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
498
  }
 
499
  });
500
 
501
  $("#tab-" + block + " select").each (function() {
502
  var default_value = $(this).attr ("default");
503
- var current_value = $(this).val();
504
- var name = $(this).attr ("name");
505
-
506
- if (typeof name != 'undefined') {
507
- // console.log ($(this).attr ("id"), name, default_value, current_value);
508
-
509
- // to do: children of OPTGROUP
510
- var childern = $(this).children ();
511
- if (childern.prop ("tagName") == "OPTGROUP") {
512
- var current_value = "";
513
- childern.each (function() {
514
- var selected = $(this).val();
515
- if (selected.length != 0) {
516
- current_value = selected;
517
- return false;
518
- }
519
- });
520
- }
521
 
522
- // if ($(this).attr ("selected-value") == 1) current_value = current_value.attr("value");
523
 
524
- if (typeof default_value != 'undefined') {
525
- // console.log ($(this).attr ("name"), ": default_value: ", default_value, " current_value: ", current_value);
526
 
527
- if (current_value == default_value) {
528
- $(this).removeAttr ("name");
529
- // console.log ("REMOVED: ", name);
530
- }
531
  }
532
- // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
533
  }
 
534
  });
535
 
536
  $("#tab-" + block + " input:radio:checked").each (function() {
537
  var default_value = $(this).attr ("default");
538
  var current_value = $(this).is (':checked');
539
- var name = $(this).attr ("name");
540
 
541
- if (typeof name != 'undefined') {
542
- if (typeof default_value != 'undefined') {
543
- default_value = Boolean (parseInt (default_value));
544
- // console.log ($(this).attr ("name"), ": default_value: ", $(this).attr ("default"), " = ", default_value, ", current_value: ", current_value);
545
 
546
- if (current_value == default_value) {
547
- $("#tab-" + block + " [name='" + name + "']").removeAttr ("name");
548
- // console.log ("REMOVED: ", name);
549
- }
550
  }
551
- // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
552
  }
 
553
  });
554
  }
555
 
@@ -799,7 +764,7 @@ jQuery(document).ready(function($) {
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,33 +777,16 @@ jQuery(document).ready(function($) {
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,14 +812,8 @@ jQuery(document).ready(function($) {
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,31 +828,6 @@ jQuery(document).ready(function($) {
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) {
@@ -1213,12 +1130,7 @@ jQuery(document).ready(function($) {
1213
  var version_charts_container = $("div#ai-version-charts-" + block);
1214
  var version_charts_container_visible = version_charts_container.is (':visible');
1215
 
1216
- var delete_range = '';
1217
- if ($("input#clear-range-"+block).hasClass ('delete')) {
1218
- delete_range = '&delete=1';
1219
- }
1220
-
1221
- container.load (site_url+"/wp-admin/admin-ajax.php?action=ai_data&statistics=" + block + "&start-date=" + start_date + "&end-date=" + end_date + delete_range + "&ai_check=" + nonce, function (response, status, xhr) {
1222
  label.removeClass ('on');
1223
  if ( status == "error" ) {
1224
  var message = "Error downloading data: " + xhr.status + " " + xhr.statusText ;
@@ -1263,44 +1175,6 @@ jQuery(document).ready(function($) {
1263
  }
1264
  });
1265
 
1266
- $("input#clear-range-"+tab).click (function () {
1267
- var block = $(this).attr ("id");
1268
- block = block.replace ("clear-range-","");
1269
-
1270
- var delete_button = this;
1271
- var start_date = $("input#chart-start-date-" + block).attr('value');
1272
- var end_date = $("input#chart-end-date-" + block).attr('value');
1273
-
1274
- var message = '';
1275
- if (start_date == '' && end_date == '')
1276
- var message = 'Delete all statistics data?'; else
1277
- if (start_date != '' && end_date != '') var message = 'Delete statistics data between ' + start_date + ' and ' + end_date + '?';
1278
-
1279
- if (message != '')
1280
- $('<div />').html(message).attr ('title', 'Warning').dialog({
1281
- bgiframe: true,
1282
- draggable: false,
1283
- resizable: false,
1284
- modal: true,
1285
- height: "auto",
1286
- width: 400,
1287
- position: {my: 'center', at: 'center', of: '#ai-settings'},
1288
- buttons: {
1289
- "Delete": function() {
1290
- $(this).dialog ("close");
1291
-
1292
- $(delete_button).addClass ('delete');
1293
- $("input#load-custom-range-"+block).click ();
1294
- $(delete_button).removeClass ('delete');
1295
- },
1296
- Cancel: function() {
1297
- $(this).dialog ("close");
1298
- },
1299
- },
1300
- open: function() {$(this).parent ().find ('button:nth-child(2)').focus();}
1301
- });
1302
- });
1303
-
1304
  $("input#chart-start-date-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
1305
  $("input#chart-end-date-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
1306
 
@@ -1535,27 +1409,8 @@ jQuery(document).ready(function($) {
1535
  function configure_chart (container) {
1536
  if (!$(container).hasClass ('not-configured')) return;
1537
  var template = $(container).data ('template');
1538
-
1539
  if (typeof template != 'undefined') {
1540
- var new_colors = [];
1541
- var color_indexes = $(container).data ('colors');
1542
- if (typeof color_indexes != 'undefined') {
1543
- var colors = $.elycharts.templates['ai-pie'].defaultSeries.values;
1544
- color_indexes.forEach (function (element) {
1545
- new_colors.push (colors [element]);
1546
- });
1547
- }
1548
-
1549
  var values = $(container).data ('values-1');
1550
- if (values == null) values = $(container).data ('values-2');
1551
- if (values == null) values = $(container).data ('values-3');
1552
- if (values == null) values = $(container).data ('values-4');
1553
- if (values == null) values = $(container).data ('values-5');
1554
- if (values == null) values = $(container).data ('values-6');
1555
- if (values == null) values = $(container).data ('values-7');
1556
- if (values == null) values = $(container).data ('values-8');
1557
- if (values == null) values = $(container).data ('values-9');
1558
-
1559
  $(container).chart({
1560
  template: template,
1561
  labels: $(container).data ('labels'),
@@ -1572,7 +1427,6 @@ jQuery(document).ready(function($) {
1572
  },
1573
  legend: $(container).data ('legend'),
1574
  tooltips: {serie1: $(container).data ('tooltips')},
1575
- defaultSeries: {values: new_colors},
1576
  defaultAxis : {
1577
  max: $(container).data ('max'),
1578
  },
@@ -1582,29 +1436,11 @@ jQuery(document).ready(function($) {
1582
  }
1583
  }
1584
  });
1585
-
1586
  $(container).removeClass ('not-configured');
1587
  $(container).parent().find ('div.ai-chart-label').show ();
1588
  }
1589
  }
1590
 
1591
- function update_rating (parameter = '') {
1592
- var rating_bar = $('#ai-rating-bar');
1593
- var nonce = rating_bar.attr ('nonce');
1594
- var site_url = rating_bar.attr ('site-url');
1595
- $("#rating-value span").load (site_url+"/wp-admin/admin-ajax.php?action=ai_data&rating=" + parameter + "&ai_check=" + nonce, function() {
1596
- var rating = $("#rating-value span").text ()
1597
- var rating_value = 0;
1598
- if (rating != '') var rating_value = parseFloat (rating);
1599
- $("#rating-value").css ('width', rating_value * 20 + '%');
1600
-
1601
- if ($("#rating-value span").text () == '') {
1602
- $("#ai-rating-bar").hide ();
1603
- $('#ai-stars').show ();
1604
- }
1605
- });
1606
- }
1607
-
1608
  function configure_charts (container) {
1609
  $(container).find ('.ai-chart.not-configured').each (function() {
1610
  if (!$(this).hasClass ('hidden')) {
@@ -1613,7 +1449,6 @@ jQuery(document).ready(function($) {
1613
  });
1614
  }
1615
 
1616
-
1617
  if (debug) console.log ("READY");
1618
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1619
  if (debug) {
@@ -1624,20 +1459,11 @@ jQuery(document).ready(function($) {
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,7 +1517,6 @@ jQuery(document).ready(function($) {
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",
@@ -1712,20 +1537,19 @@ jQuery(document).ready(function($) {
1712
  $('.header button').button().show ();
1713
 
1714
  $("#ai-form").submit (function (event) {
1715
- for (var tab = start; tab <= end; tab ++) {
1716
- remove_default_values (tab);
1717
- }
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,14 +1560,9 @@ jQuery(document).ready(function($) {
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,33 +1573,14 @@ jQuery(document).ready(function($) {
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();
1767
  });
1768
 
1769
- $('#ai-stars').click (function () {
1770
- if ($("#rating-value span").text () != '') {
1771
- $("#ai-rating-bar").css ('display', 'inline-block');
1772
- $('#ai-stars').hide ();
1773
- }
1774
- update_rating ('update');
1775
- });
1776
-
1777
- $("#ai-rating-bar").click (function () {
1778
- $("#ai-rating-bar").hide ();
1779
- $('#ai-stars').show ();
1780
- });
1781
-
1782
- setTimeout (update_rating, 1000);
1783
-
1784
  if (debug) console.log ("");
1785
  if (debug) console.log ("READY END");
1786
  if (debug) {
1
+ var javascript_version = "2.1.8";
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
  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
  textarea.removeAttr ("name");
82
  }
83
 
84
+ jQuery("#ai-active-tab").attr ("value", active_tab);
85
  });
86
 
87
  session.setMode ("ace/mode/html");
121
  }(jQuery));
122
 
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  jQuery(document).ready(function($) {
125
 
126
  var header = $('#ai-settings-' + 'header').length != 0;
128
  if (header) {
129
  $.elycharts.templates['ai'] = {
130
  type : "line",
131
+ margins : [10, 37, 20, 37],
132
  defaultSeries : {
133
  fill: true,
134
  fillProps: {
213
 
214
  $.elycharts.templates['ai-versions'] = {
215
  type : "line",
216
+ margins : [10, 37, 20, 37],
217
  defaultSeries: {
218
  color: "#0a0",
219
  fillProps: {
283
 
284
  $.elycharts.templates['ai-versions-legend'] = {
285
  template: 'ai-versions',
286
+ margins : [10, 37, 10, 37],
287
  defaultSeries : {
288
  fill: true,
289
  fillProps: {
390
  $.elycharts.templates['ai-bar'] = {
391
  template: 'ai-pie',
392
  type: "line",
393
+ margins : [5, 0, 5, 30],
394
  barMargins : 1,
395
  defaultSeries : {
396
  type: "bar",
439
  $("#tab-" + block + " input:checkbox").each (function() {
440
  var default_value = $(this).attr ("default");
441
  var current_value = $(this).is (':checked');
 
442
 
443
+ if (typeof default_value != 'undefined') {
444
+ default_value = Boolean (parseInt (default_value));
445
+ // console.log ($(this).attr ("name"), ": default_value: ", $(this).attr ("default"), " = ", default_value, ", current_value: ", current_value);
 
446
 
447
+ if (current_value == default_value) {
448
+ var name = $(this).attr ("name");
449
+ $(this).removeAttr ("name");
450
+ $("#tab-" + block + " [name='" + name + "']").removeAttr ("name");
451
+ // console.log ("REMOVED: ", name);
452
  }
 
453
  }
454
+ // else console.log ("NO DEFAULT VALUE:", $(this).attr ("name"));
455
  });
456
 
457
  $("#tab-" + block + " input:text").each (function() {
458
  var default_value = $(this).attr ("default");
459
  var current_value = $(this).val ();
 
460
 
461
+ if (typeof default_value != 'undefined') {
462
+ // console.log ($(this).attr ("name"), ": default_value: ", default_value, ", current_value: ", current_value);
 
463
 
464
+ if (current_value == default_value) {
465
+ var name = $(this).attr ("name");
466
+ $(this).removeAttr ("name");
467
+ // console.log ("REMOVED: ", name);
468
  }
 
469
  }
470
+ // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
471
  });
472
 
473
  $("#tab-" + block + " select").each (function() {
474
  var default_value = $(this).attr ("default");
475
+ var current_value = $(this).children ("option:selected");
476
+
477
+ var childern = $(this).children ();
478
+ if (childern.prop ("tagName") == "OPTGROUP") {
479
+ var current_value = "";
480
+ childern.each (function() {
481
+ var selected = $(this).children ("option:selected");
482
+ if (selected.length != 0) {
483
+ current_value = selected;
484
+ return false;
485
+ }
486
+ });
487
+ }
 
 
 
 
 
488
 
489
+ if ($(this).attr ("selected-value") == 1) current_value = current_value.attr("value"); else current_value = current_value.text();
490
 
491
+ if (typeof default_value != 'undefined') {
492
+ // console.log ($(this).attr ("name"), ": default_value: ", default_value, ", current_value: ", current_value);
493
 
494
+ if (current_value == default_value) {
495
+ var name = $(this).attr ("name");
496
+ $(this).removeAttr ("name");
497
+ // console.log ("REMOVED: ", name);
498
  }
 
499
  }
500
+ // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
501
  });
502
 
503
  $("#tab-" + block + " input:radio:checked").each (function() {
504
  var default_value = $(this).attr ("default");
505
  var current_value = $(this).is (':checked');
 
506
 
507
+ if (typeof default_value != 'undefined') {
508
+ default_value = Boolean (parseInt (default_value));
509
+ // console.log ($(this).attr ("name"), ": default_value: ", $(this).attr ("default"), " = ", default_value, ", current_value: ", current_value);
 
510
 
511
+ if (current_value == default_value) {
512
+ var name = $(this).attr ("name");
513
+ $("#tab-" + block + " [name='" + name + "']").removeAttr ("name");
514
+ // console.log ("REMOVED: ", name);
515
  }
 
516
  }
517
+ // else console.log ("NO DEFAULT VALUE: ", $(this).attr ("name"));
518
  });
519
  }
520
 
764
  });
765
  }
766
 
767
+ if (block != 'h' && block != 'f' && !header) {
768
  if ((block - 1) >> 4) {
769
  $('#block' + '-' + block).removeAttr(header_id);
770
  $('#display' + '-type-' + block).removeAttr(header_id);
777
  }
778
  }
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  function configure_tab_0 () {
781
 
782
  if (debug) console.log ("configure_tab_0");
783
 
784
  $('#tab-0').addClass ('configured');
785
 
786
+ $('#tab-0 input[type=submit], #tab-0 button').button().show ();
 
787
 
788
  configure_editor ('h');
789
  configure_editor ('f');
 
 
790
 
791
  $('#ai-plugin-settings-tab-container').tabs();
792
  $('#ai-plugin-settings-tabs').show();
812
  if (syntax_highlighting) configure_editor_language ('f')
813
  });
814
 
 
 
 
 
815
  if (syntax_highlighting) configure_editor_language ('h');
816
  if (syntax_highlighting) configure_editor_language ('f');
 
 
817
 
818
  for (var index = 1; index <= geo_groups; index ++) {
819
  generate_country_list ('group-country', index);
828
  $('#enable-footer-404').checkboxButton ();
829
  $('#simple-editor-f').checkboxButton ();
830
  $('#process-php-f').checkboxButton ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  }
832
 
833
  function configure_tab (tab) {
1130
  var version_charts_container = $("div#ai-version-charts-" + block);
1131
  var version_charts_container_visible = version_charts_container.is (':visible');
1132
 
1133
+ container.load (site_url+"/wp-admin/admin-ajax.php?action=ai_data&statistics=" + block + "&start-date=" + start_date + "&end-date=" + end_date + "&ai_check=" + nonce, function (response, status, xhr) {
 
 
 
 
 
1134
  label.removeClass ('on');
1135
  if ( status == "error" ) {
1136
  var message = "Error downloading data: " + xhr.status + " " + xhr.statusText ;
1175
  }
1176
  });
1177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1178
  $("input#chart-start-date-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
1179
  $("input#chart-end-date-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
1180
 
1409
  function configure_chart (container) {
1410
  if (!$(container).hasClass ('not-configured')) return;
1411
  var template = $(container).data ('template');
 
1412
  if (typeof template != 'undefined') {
 
 
 
 
 
 
 
 
 
1413
  var values = $(container).data ('values-1');
 
 
 
 
 
 
 
 
 
1414
  $(container).chart({
1415
  template: template,
1416
  labels: $(container).data ('labels'),
1427
  },
1428
  legend: $(container).data ('legend'),
1429
  tooltips: {serie1: $(container).data ('tooltips')},
 
1430
  defaultAxis : {
1431
  max: $(container).data ('max'),
1432
  },
1436
  }
1437
  }
1438
  });
 
1439
  $(container).removeClass ('not-configured');
1440
  $(container).parent().find ('div.ai-chart-label').show ();
1441
  }
1442
  }
1443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1444
  function configure_charts (container) {
1445
  $(container).find ('.ai-chart.not-configured').each (function() {
1446
  if (!$(this).hasClass ('hidden')) {
1449
  });
1450
  }
1451
 
 
1452
  if (debug) console.log ("READY");
1453
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1454
  if (debug) {
1459
  $("#blocked-warning").removeClass ('warning-enabled');
1460
  $("#blocked-warning").hide ();
1461
 
1462
+ start = parseInt ($('#ai-form').attr('start'));
1463
+ end = parseInt ($('#ai-form').attr('end'));
1464
+ active_tab = parseInt ($("#ai-active-tab").attr ("value"));
 
 
 
 
 
 
 
 
 
1465
 
1466
+ if (debug) console.log ("active_tab: " + active_tab);
1467
 
1468
  var tabs_array = new Array ();
1469
  if (active_tab != 0) tabs_array.push (0);
1517
  var index = 16;
1518
  if (active_tab != 0) index = active_tab - start;
1519
  var block_tabs = $("#ai-tab-container").tabs ({active: index});
 
1520
 
1521
  $('#ai-settings').tooltip({
1522
  show: {effect: "blind",
1537
  $('.header button').button().show ();
1538
 
1539
  $("#ai-form").submit (function (event) {
1540
+ for (var tab = start; tab <= end; tab ++) {
1541
+ remove_default_values (tab);
1542
+ }
 
1543
  });
1544
 
1545
+ if (syntax_highlighting) {
1546
+ $('.ai-tab').click (function () {
1547
+ tab_block = $(this).attr ("id");
1548
+ tab_block = tab_block.replace ("ai-tab","");
1549
+ active_tab = tab_block;
1550
 
1551
+ if (debug) console.log ("active_tab: " + active_tab);
1552
 
 
1553
  if (!$("#tab-" + tab_block).hasClass ('configured')) {
1554
  if (debug) console.log ("");
1555
  if (debug) console.log ("Empty tab: " + tab_block);
1560
  var editor = ace.edit ("editor-" + tab_block);
1561
  editor.getSession ().highlightLines (10000000);
1562
  }
1563
+ });
 
 
 
 
 
1564
 
1565
+ $('.ai-plugin-tab').click (function () {
1566
  tab_block = $(this).attr ("id");
1567
  tab_block = tab_block.replace ("ai-","");
1568
 
1573
  if (tab_block == 'f') {
1574
  editor = ace.edit ("editor-f");
1575
  editor.getSession ().highlightLines (10000000);
 
 
 
 
1576
  }
1577
+ });
1578
+ }
1579
 
1580
  $('#plugin_name').dblclick (function () {
1581
  $("#system-debugging").toggle();
1582
  });
1583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  if (debug) console.log ("");
1585
  if (debug) console.log ("READY END");
1586
  if (debug) {
js/index.html CHANGED
@@ -1,27 +1,4 @@
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
-
1
+ <html>
2
+ <body bgcolor="#FFFFFF">
3
+ </body>
4
+ </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
preview-adb.php DELETED
@@ -1,333 +0,0 @@
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,9 +12,8 @@ function alt_styles_data ($alt_styles_text) {
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,6 +823,7 @@ div.automatic-insertion img {
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,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: 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">
12
  }
13
 
14
  function generate_code_preview ($block) {
 
15
 
16
+ global $block_object;
17
 
18
  $obj = $block_object [$block];
19
 
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
  </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">
readme.org.bak ADDED
@@ -0,0 +1,945 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Ad Inserter ===
2
+ Contributors: spacetime
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
4
+ Tags: ads, adsense, amazon, automatic insertion, ad rotation, contextual ads, banners, amp, geo targeting, multisite, shortcodes, widgets
5
+ Requires at least: 4.0
6
+ Tested up to: 4.8
7
+ Stable tag: 2.1.5
8
+ License: GPLv3
9
+
10
+ Insert any ad, HTML, Javascript, PHP, header or footer code. Perfect for all kinds of ads: AdSense, Amazon, AMP, widgets, shortcodes, ad rotation,...
11
+
12
+ == Description ==
13
+
14
+ A simple yet powerful plugin to insert any ad or code into Wordpress. **Perfect for all kinds of ads including AdSense and Amazon.** Insert anything anywhere on the page.
15
+
16
+ > **Features**
17
+ >
18
+ > * 16 code blocks
19
+ > * Syntax highlighting editor
20
+ > * Code preview with visual CSS editor
21
+ > * Automatic insertion before / after post, content, paragraph or excerpt
22
+ > * Automatic insertion before or after random paragraph
23
+ > * Automatic insertion before or after multiple paragraphs
24
+ > * Automatic insertion before or after any HTML element in post
25
+ > * Automatic insertion at relative position in posts
26
+ > * Clearance options to avoid insertion near images or headers
27
+ > * Automatic insertion between posts on blog pages
28
+ > * Insertion exceptions for posts and pages
29
+ > * Manual insertion: widgets, shortcodes, PHP function call
30
+ > * Custom block alignment and style
31
+ > * Insertion of ads on AMP pages
32
+ > * Custom CSS class name for wrapping divs to avoid ad blockers
33
+ > * Insertion of shortcodes from other plugins
34
+ > * PHP code processing
35
+ > * Ad rotation (server-side and client-side - works with caching)
36
+ > * Device detection (server-side and client-side, 3 custom viewports)
37
+ > * Black/White-list categories, tags, post IDs, urls, url parameters, referers
38
+ > * Simple troubleshooting with many debugging functions
39
+ > * Function to visualize inserted code blocks
40
+ > * Function to visualize available insertion positions
41
+ > * Function to visualize HTML tags
42
+
43
+ Ad Inserter plugin is simple to use but has many features. Please read user manual to get the most of it.
44
+
45
+ > * 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
46
+ > * Download **PDF user guide** for Ad Inserter: go to <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> page and below you can find button for free download of Ad Inserter User Guide
47
+
48
+ **Endorsed by Amazon**
49
+
50
+ > 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.
51
+ >
52
+ > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
53
+ > * On the <a href="https://wordpress.org/plugins/ad-inserter/faq/">FAQ</a> page you can also find an example of contextual Amazon Shopping Ads that show items related to the post content (using post tags)
54
+
55
+ There is also <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> if you need more:
56
+
57
+ > * 64 code blocks
58
+ > * GEO targeting (works also with caching)
59
+ > * Black/White-list IP addresses or countries (works also with caching)
60
+ > * Sticky positions
61
+ > * Scheduling with fallback option
62
+ > * Export and import of settings
63
+ > * Multisite options to limit settings on the sites
64
+ > * Post/page exception management
65
+ > * 6 custom viewports
66
+ > * Support via email
67
+
68
+ **Quick Start**
69
+
70
+ 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>:
71
+
72
+ * 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
73
+ * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
74
+ * **Enable insertion on at least one Wordpress page type** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
75
+ * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
76
+ * 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)
77
+
78
+ 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/">Docs</a> page.
79
+ For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
80
+
81
+ Please *support the plugin* if you like it:
82
+
83
+ * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
84
+ * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
85
+
86
+
87
+ == Installation ==
88
+
89
+ = Using The WordPress Dashboard =
90
+
91
+ 1. Go to Wordpress Plugins menu, click Add New button
92
+ 2. Search for `ad inserter`
93
+ 3. Click 'Install Now'
94
+ 4. Activate Ad Inserter on the Plugin dashboard
95
+
96
+ = Uploading plugin file =
97
+
98
+ 1. Go to Wordpress Plugins menu, click Add New button
99
+ 2. Click Upload Plugin
100
+ 3. Select `ad-inserter.zip` from your computer
101
+ 4. Click 'Install Now'
102
+ 5. Activate Ad Inserter in the Plugin dashboard
103
+
104
+ = Using FTP =
105
+
106
+ 1. Download `ad-inserter.zip`
107
+ 2. Extract `ad-inserter` directory to your computer
108
+ 3. Upload `ad-inserter` directory to the `/wp-content/plugins/` directory
109
+ 4. Activate Ad Inserter in the Plugin dashboard
110
+
111
+ **Ad Inserter Pro Installation**
112
+
113
+ If you are using free Ad Inserter simply uninstall it. The Pro version will automatically import existing settings from the free version.
114
+ After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to Wordpress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
115
+ activate it and then click "Enter License Key" and enter license key you got in the email.
116
+
117
+ = Uploading plugin file =
118
+
119
+ 1. Go to Wordpress Plugins menu, click Add New button
120
+ 2. Click Upload Plugin
121
+ 3. Select `ad-inserter-pro.zip` from your computer
122
+ 4. Click 'Install Now'
123
+ 5. Activate Ad Inserter Pro in the Plugin dashboard
124
+ 5. Click "Enter License Key" or go to plugin Settings / tab * and enter license key you got in the email
125
+
126
+ = Using FTP =
127
+
128
+ 1. Download `ad-inserter-pro.zip`
129
+ 2. Extract `ad-inserter-pro` directory to your computer
130
+ 3. Upload `ad-inserter-pro` directory to the `/wp-content/plugins/` directory
131
+ 4. Activate Ad Inserter Pro in the Plugin dashboard
132
+
133
+
134
+ **Uninstall**
135
+
136
+ If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
137
+
138
+ 1. Go to Ad Inserter Settings (tab *) and click on Reset All Settings
139
+ 2. Deactivate Ad Inserter
140
+ 3. Delete Ad Inserter plugin
141
+
142
+
143
+ **Quick Start**
144
+
145
+ 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>:
146
+
147
+ * 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
148
+ * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
149
+ * **Enable insertion on at least one Wordpress page type** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
150
+ * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
151
+ * 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)
152
+
153
+ Few examples for automatic insertion are described on the <a href="http://adinserter.pro/settings">Common settings</a> page. Please make sure you have also read **WARNINGS** on the bottom of this page and instructions for **Debugging**.
154
+
155
+ **Settings**
156
+
157
+ Each code block has a name and settings which are divided into sections. Some settings depend also on automatic insertion used. To rename code block click on the block name.
158
+ Check **Simple editor** to switch to simple editor for mobile devices. If you have PHP code (surrounded with PHP tags `<?php � ?>`) in code block, you need to check **Process PHP** to enable PHP processing.
159
+ When you are finished with settings you need to save them by clicking on the button **Save Settings**.
160
+
161
+ Each code block has 4 insertion options:
162
+
163
+ * Automatic Insertion
164
+ * Widget
165
+ * Shortcode
166
+ * PHP function call
167
+
168
+ Normally for each code block you use only one insertion option.
169
+ Of course, you can use all 4 options simultaneously taking into account that all insertion options use the same block settings (with some exceptions mentioned below).
170
+
171
+ To insert code block and display ad at some position **you need to enable and use at least one insertion option**.
172
+
173
+ Automatic Insertion Options:
174
+
175
+ * Insert Before Post (before post or posts on blog pages, previously named Before Title)
176
+ * Insert Before Content (before post or static page text)
177
+ * Insert Before Paragraph (on posts, static pages and blog pages)
178
+ * Insert After Paragraph (on posts, static pages and blog pages)
179
+ * Insert After Content (after post or static page text)
180
+ * Insert After Post (after post or posts on blog pages)
181
+ * Insert Before Excerpt (on blog pages)
182
+ * Insert After Excerpt (on blog pages)
183
+ * Insert Between Posts (on blog pages)
184
+
185
+ For single posts or static pages insertion position Before Post usually means position above the post/page title, for blog pages Before Post position means position above all the posts on the blog page.
186
+
187
+ For single posts or static pages insertion position After Post means position below the post/page after all the content, for blog pages After Post position means position below all the posts on the blog page.
188
+
189
+ Please use **Show positions** function to see available positions for automatic insertion (Ad Inserter menu item in the Wordpress toolbar on the top of every post/page).
190
+
191
+ Block Alignment and Style:
192
+
193
+ * No Wrapping (leaves ad code as it is, otherwise it is wrapped by a div)
194
+ * Custom CSS (You can enter custom CSS code for wrapping div)
195
+ * Default (simple div with thin margin)
196
+ * Align Left
197
+ * Align Right
198
+ * Center
199
+ * Float Left (ad on left with wrapped text on right)
200
+ * Float Right (ad on right with wrapped text on left)
201
+
202
+ **[ Preview ]**
203
+
204
+ Ad Inserter has a very useful function that can help you to check if the ad code is working and to see how it will look like when it will be inserted. Click on the **Preview** button to open Preview window.
205
+ WARNING: Some adblockers may block code on the Ad Inserter preview window. If you see warning PAGE BLOCKED or you don't see your code and the widow elements are distorted, make sure you have disabled ad blockers.
206
+ On the top of the window there is visual CSS editor and four buttons and below there is CSS code of the wrapping div (which can be edited manually) and 'Block Alignment and Style' selection.
207
+
208
+ Below the settings there is a **preview of the saved code** between two dummy paragraphs. Here you can test various block alignments, visually edit margin and padding values of the wrapping div or write CSS code directly
209
+ and watch live preview. Highlight button highlights background, wrapping div margin and code area, while Reset button restores all the values to those of the current block.
210
+ You can resize the window (and refresh the page to reload ads) to check display with different screen widths. Once you are satisfied with alignment click on the Use button and the settings will be copied to the active block.
211
+
212
+ **Please note** that the code displayed here is the code that is saved for this block, while block name, alignment and style are taken from the current block settings (may not be saved).
213
+ No Wrapping style inserts the code as it is so margin and padding can't be set. However, you can use own HTML code for the block.
214
+
215
+ **Please note** that Preview window uses also Header and Footer code.
216
+
217
+ Check <a href="https://wordpress.org/plugins/ad-inserter/screenshots/">screenshots</a> for explanation on alignment.
218
+
219
+ **CACHING**
220
+
221
+ Keep in mind that just installing a caching plugin does not necessarily make your site faster. Doing a bit of optimization will get you a lot of speed increase without caching plugins.
222
+ To further combat slowness you may want to re-evaluate the performance of your hosting package. Maybe you've outgrown it. In that case, upgrade to a better hosting solution.
223
+
224
+ Caching on the frontend side (what visitors see) in some cases does speed up page loading but may also cause some unwanted behavior.
225
+ When you are using caching and visitor visits some page, Wordpress creates that page, Ad Inseter is called to do the job, the created page is sent to the visitor and it is also saved for quicker serving later.
226
+ The next time the page is visited **the visitor gets cached (saved) page**. Because of this some Ad Inserter functions can not work because Ad Inserter is not called when the page is cached:
227
+
228
+ * Server-side block rotation with |rotate|
229
+ * User check
230
+ * Server-side device detection
231
+ * Referer check
232
+ * Server-side GEO targeting (country detection, Pro only)
233
+ * Server-side IP address detection (Pro only)
234
+ * Debugging functions
235
+
236
+ When you need the functions listed above you have to switch off caching (if possible only on selected pages where needed).
237
+
238
+ However, Ad Inserter also supports some of the functions above even when caching is enabled:
239
+
240
+ * Client-side ad rotation with |rotate|
241
+ * Client-side device detection
242
+ * Client-side GEO targeting (country detection, Pro only)
243
+ * Client-side IP address detection (Pro only)
244
+
245
+ All you have to do is to set enable and use client-side functions (executed in the visitor's browser). But you have to be careful as some adverts might not work properly or can't be used this way and you might violate their Terms of Service.
246
+
247
+ PLEASE NOTE: If you are using W3 Total Cache for caching then you can still use server-side ad rotation, IP address and country detection even when the pages are cached as Ad Inserter supports special features of this caching plugin.
248
+
249
+ **W3 Total Cache**
250
+
251
+ If you are using W3 Total Cache for caching then you can still use server-side ad rotation, IP address and country detection even when the pages are cached as Ad Inserter supports special features of this caching plugin.
252
+ To enable this mode go to Ad Inserter plugin settings tab * / tab General and set Dynamic blocks to Server-side with W3 Total Cache and configure W3 Total Cache for dynamic content.
253
+
254
+ When Dynamic blocks is set to Server-side with W3 Total Cache and you are using ad rotation, IP address or country detection, Ad Inserter inserts short PHP code with special tags in place of code block. When W3 Total Cache plugin loads cached page it executes this code before it serves the pages. So the page is stills served from the cache but the Ad Inserter blocks are dynamically created just before the page is served. Therefore, pages are served from the cache and the Ad Inserter code is still generated on the server-side.
255
+
256
+ Configure W3 Total Cache
257
+
258
+ How to fully set up W3 Total Cache is beyond the scope of this page. Check the W3 Total Cache manuals or contact it's developer for help with that if you need it.
259
+
260
+ * In General Settings set the Page Caching to Disk: Basic.
261
+ * In Page Cache under Advanced enable Late Initialization.
262
+ * If you use the Minify option add mfunc to the ignored comment stem field.
263
+
264
+ You need to flush the cache after making these changes.
265
+
266
+ Please note also the following:
267
+
268
+ * Mixing static cached and dynamic content is a tricky thing to do and often causes all kinds of issues. Ad Inserter follows the guidelines from W3 Total Cache on this. If it doesn't work it's very likely you didn't configure W3 Total Cache correctly. Alternatively, you can decide to use client-side option for dynamic blocks - your adverts will show up just fine and rotation and GEO targeting will still work.
269
+ * In order to use dynamic content with W3 Total Cache, W3TC_DYNAMIC_SECURITY PHP constant needs to be defined. Usually it is located in the wp-confing.php file. This is a security string used when generating PHP code for dynamic content. If this constant is not defined, Ad Inserter will define and use it.
270
+ * Do not use debugging functions when caching is activated.
271
+ * When you make changes in settings of the W3 Total Cache purge all caches before you check page.
272
+ * After you activate W3 Total Cache plugin go to General Settings and Save all settings.
273
+
274
+ **Ad rotation**
275
+
276
+ To use client-side rotation you have to enable it first. Go to Ad Inserter plugin settings tab * / tab General and set Dynamic blocks to Client-side.
277
+
278
+ Configure blocks normally and separate different versions with |rotate| tag. When the page will be created and Ad Inserter called, it will generate hidden code for all block versions. When the page will be loaded in the browser, one randomly chosen version of the code will be displayed. For example, to rotate 3 images:
279
+
280
+ `<img style='height: 400px;' src="http://malsup.github.io/images/p1.jpg">
281
+ |rotate|
282
+ <img style='height: 400px;' src="http://malsup.github.io/images/p2.jpg">
283
+ |rotate|
284
+ <img style='height: 400px;' src="http://malsup.github.io/images/p3.jpg">`
285
+
286
+ Please note the following:
287
+
288
+ * Client-side rotation works fine with banners, text ads and many ad networks including Amazon Associates. However, it should not be used with some ad networks including AdSense (hiding ad units is not allowed) because of the method used for client-side rotation: all options are present on the page but are hidden until the page is loaded and one option is made visible. Please check Terms of Service for your ad network.
289
+ * Ad Inserter reserves space for code block based on the height of the first block version. If all the versions have the same height then you won't notice anything. However, if block versions have different heights then it makes sense to define fixed block height with Custom CSS to avoid content jumping when block option with different or initially unknown height is displayed. If the first option is some Javascript based ad (e.g. Amazon widget) you should wrap it with a div and define height, for example `<div style="height: 300px;"> ... </div>`
290
+ * Since the code (block option) is displayed only when the page is loaded, you may notice a very short delay (few 100 ms) before the code (or ad) is displayed.
291
+ * Client-side rotation uses div elements to wrap the code(s). This is not important unless you use No wrapping style.
292
+
293
+ WARNING: If you are using caching, the inserted code may not appear immediately on the page. Make sure you disable caching when you are testing or debugging.
294
+ Some caching plugins like WP Super Cache and W3 Total Cache have an option to disable caching for known (logged in) users.
295
+
296
+ **DEBUGGING**
297
+
298
+ Ad Inserter has many debugging functions that can help you to diagnose the problem when you don't see your ads at expected positions.
299
+
300
+ * Code preview: click on the Preview button for each code block to see how the ad or code will look like. On the Preview window click on the Highlight button to highlight code. If you don't see the ad displayed here it is very likely that the code is not working properly.
301
+ * Debugger Widget: Place Debugger widget in some widget area to see basic Wordpress page and Ad Inserter data (User status, Page Type, Post ID, Url, Referer, etc). With this widget you can also check saved block settings and client-side viewport name.
302
+ * Debugger Shortcode: Place shortcode [adinserter block="0"] or [adinserter name="Debugger"] into post or static page to see basic Wordpress page and Ad Inserter data
303
+
304
+ Each post/page has a Wordpress toolbar on the top. Ad Inserter menu (visible only to administrators and can be hidden) item has the following debugging functions:
305
+
306
+ * Label Blocks: Each inserted block is labeled with a thin red border and red bar with block number, name and counters. Blocks that use client-side detection and are hidden are shown with blue bar and viewport name - resize the browser to check display for other devices (or screen widths). If you see only red bar then this means that the block with your **code is inserted** but the code doesn't display anything.
307
+ * Show Positions: Enable this function to show available positions for automatic insertion. Displayed positions are based on the theme layout and configured paragraph counting. You can choose between all paragraph tag lists (or counting parameters) used for blocks configured for Before or After paragraph. If you click on the Show Positions menu item you'll see default paragraph positions for p tags.
308
+ * Show HTML tags: Enable this function to see HTML tags used in the post. Use this function to determine post structure in order to configure paragraph counting.
309
+ * Disable insertion: Use this function to temporarily disable insertion of code blocks - everything else on the page will look like the code blocks were processed and inserted.
310
+ * Log Processing: Use this function to log insertion process in order to determine why some code block was not inserted. The log is added as HTML comment at the end of the page - check page source
311
+
312
+ **WARNING:** Make sure **caching is disabled while debugging**! All debugging functions you enable will be visible only to you!
313
+
314
+ When browsing other pages on the website debugging settings are temporarily saved (in a cookie). To disable all debugging functions click on the 'Ad Inserter' top menu item in the toolbar (or use `ai-debug=0`)
315
+
316
+ If you enable **Remote debugging** you can also allow other people using url parameters to see post/page with debugging data. Remote debugging option is located on the Ad Inserter Settings tab - Debugging tab below.
317
+ **Remote debugging** enables other, non-logged in users by using url parameters to see Debugger widget and code insertion debugging (blocks, positions, tags, processing).
318
+ Enable this option (and disable caching) 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 via url is always enabled.
319
+
320
+ Please **support the plugin** if you like it:
321
+
322
+ * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
323
+ * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
324
+
325
+
326
+ == Frequently Asked Questions ==
327
+
328
+ = I have activated Ad Inserter. How can I use it? =
329
+
330
+ 1. After activation, click "Settings / Ad Inserter" to access the settings page
331
+ 2. Put ad (or any other HTML/Javascript/PHP) code into the ad box
332
+ 3. Set automatic insertion option (for example: Before Post)
333
+ 4. Enable at least one page type: Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages (some insertion options don't work on all page types)
334
+ 5. Save settings
335
+ 6. Check inserted code on the page
336
+ 7. Check also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
337
+
338
+
339
+ = Settings for widget =
340
+
341
+ * Nothing needed, just enter the code and save settings - widget is enabled by default
342
+ * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
343
+
344
+
345
+ = Settings for contextual Amazon Native Shopping Ads =
346
+
347
+ * Automatic Insertion: After Content
348
+ * On all Posts checked, other page types unchecked
349
+
350
+ Sign in to Amazon Associates, go to Widgets/Widget Source, choose ad type and set parameters.
351
+ For titles and search terms use tags. For example, the code below would display amazon products related to the post tags - check documentation for all possible tags.
352
+
353
+ `<script type="text/javascript">
354
+ amzn_assoc_placement = "adunit0";
355
+ amzn_assoc_search_bar = "true";
356
+ amzn_assoc_tracking_id = "ad-inserter-20";
357
+ amzn_assoc_search_bar_position = "top";
358
+ amzn_assoc_ad_mode = "search";
359
+ amzn_assoc_ad_type = "smart";
360
+ amzn_assoc_marketplace = "amazon";
361
+ amzn_assoc_region = "US";
362
+ amzn_assoc_title = "Search Results from Amazon";
363
+ amzn_assoc_default_search_phrase = "{smart_tag}";
364
+ amzn_assoc_default_category = "All";
365
+ amzn_assoc_linkid = "cf1873f027a57f63cede634cfd444bea";
366
+ </script>
367
+ <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>`
368
+
369
+ Use your own tracking id! Please note `{smart_tag}` as default search phrase. This makes this widget contextual. It will show products related to the tags for this post.
370
+ You can also try with `{tag}', `{short_title}`, `{category}` or `{short_category}`. For more options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
371
+
372
+
373
+ = Settings for ... =
374
+
375
+ Check <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
376
+
377
+
378
+ = I wish to show ads side by side but not in the same block. How do I do this? =
379
+
380
+ Configure block 1 and 2 with ads using:
381
+
382
+ * Automatic Insertion: Disabled
383
+ * Block Alignment and Style: No Wrapping
384
+ * Enable shortcode: checked
385
+
386
+ Configure block 3 with
387
+
388
+ `[adinserter block="1"]
389
+ [adinserter block="2"]`
390
+
391
+ Use block 3 to insert ads and make sure all 3 blocks are enabled for the same page types (Posts, Pages, Homepage, etc.).
392
+
393
+
394
+ = I use After Content insertion position but the code is inserted after the stuff provided by other plugins. How can I insert directly after post content?
395
+
396
+ This happens because Ad Inserter processes posts last and therefore "sees" also content added by other plugins.
397
+
398
+ Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab *).
399
+
400
+
401
+ = How can I replace deprecated tags {adinserter n} for manual insertion with new ones [adinserter block="n"] in all posts? =
402
+
403
+ Use <a href="https://wordpress.org/plugins/search-regex/" target="_blank">Search Regex</a> plugin to replace tags in all posts with few clicks. If you are not familiar with regular expressions simply use search and replace text for each code block. Use **Replace** to test replacements and when it works as expected use **Replace & Save**.
404
+
405
+
406
+ = How can I add some text or title (e.g. Advertisement) above the ad? =
407
+
408
+ If this is a sidebar widget then you can simply name the widget. In other cases you can add title HTML code above ad code. For example:
409
+
410
+ `<h3>Advertisement</h3>
411
+
412
+ AD_CODE`
413
+
414
+ Change title tag according to the theme style.
415
+
416
+
417
+ = I like the plugin. How can I support it? =
418
+
419
+ * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
420
+ * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
421
+
422
+
423
+ = How can I enable/disable ads on specific posts/pages? =
424
+
425
+ There are two possible approaches.
426
+
427
+ * Approach with page/post exceptions - use this one if there are many exceptions:
428
+
429
+ 1. Go to Ad Inserter settings page and define default insertion options for post/page.
430
+ 2. Enable automatic insertion on posts/pages and choose default display: **On all**, **On all except selected** or **Only on selected**.
431
+ 3. Go to post/page editor and open **Ad Inserter Exceptions** meta box below.
432
+ 4. Check default insertion options for wanted code blocks.
433
+ 5. Set exceptions for this post or page.
434
+
435
+ * Approach with code block settings only - use this one if there are only few exceptions:
436
+
437
+ 1. Go to Ad Inserter settings page and define default insertion options for post/page.
438
+ 2. Enable automatic insertion On all Posts/Pages.
439
+ 3. Click on Lists, enter url (or space separated urls) for Urls, e.g. `/permalink-url`, and white-list or black-list it.
440
+
441
+
442
+ = I'm using responsive theme. How can I show or hide some ads on mobile devices? =
443
+
444
+ Select device types (desktop, tablet or phone) for which you need to show ads and enable **only client-side** device detection.
445
+
446
+
447
+ = Which device type detection should I use? =
448
+
449
+ In most cases you should use ONLY client-side detection. All code blocks are generated, however, they are displayed according to settings and browser's screen width using CSS Media Queries. This works perfectly in responsive designs.
450
+
451
+
452
+ = How can I disable ads for direct visitors? =
453
+
454
+ Blacklist `#` as referer for visitors that enter web address directly into browser (no referer).
455
+ Blacklist `yourdomain.com` as referer for visitors that browse your website yourdomain.com.
456
+ To blacklist both enter `yourdomain.com, #`
457
+
458
+
459
+ = How can I disable ads on error 404 page? =
460
+
461
+ This is disabled by default. Uncheck Error 404 Page checkbox.
462
+
463
+
464
+ = Is there a way to display country flag of the visitor? =
465
+
466
+ Possible if you are using Ad Inserter Pro. In the header put the following code:
467
+
468
+ `<link rel='stylesheet' href='/wp-content/plugins/ad-inserter/css/flags.css' type='text/css' media='all' />`
469
+
470
+ In the code block use the following code for flag
471
+
472
+ `<span class="flag-icon flag-icon-{country_iso2}" style="width: 400px; height: 300px;"></span>`
473
+
474
+ Adjust width and height according to your needs. Please not that `{country_iso2}` tag works only server-side - it won't work on cached pages.
475
+ Of course, you can also use static code for flags. For example, for United States:
476
+
477
+ `<span class="flag-icon flag-icon-us" style="width: 400px; height: 300px;"></span>`
478
+
479
+
480
+ = How can I enable or disable ads on group of similar pages? =
481
+
482
+ If those pages have something in common in the url (page address) then you can block them with url patterns.
483
+ Use `*` to define url pattern to whitelist (enable) or blacklist (disable).
484
+
485
+ 1. To filter all urls starting with **/url-start** use `/url-start*`
486
+ 2. To filter all urls that contain **url-pattern** use `*url-pattern*`
487
+ 3. To filter all urls ending with **url-end** use `*url-end`
488
+
489
+ For example, to exclude ads on pages that have /shop/ in url (page address) blacklist the following url: `*/shop/*`
490
+
491
+ **WARNING:** Separate urls with SPACES.
492
+
493
+
494
+ = How can I put an ad in the middle of the post regardless of the number of paragraphs? =
495
+
496
+ Use Before paragraph automatic insertion and put 0.5 as paragraph number. Value between 0 and 1 means relative position in post or page (e.g. 0.3 means paragraph 30% from top or bottom)
497
+
498
+
499
+ = How can I put an ad before the second paragraph and one in the middle of post with single ad block? =
500
+
501
+ Use Before paragraph automatic insertion and put `2, 0.5` as paragraph number. You can specify multiple paragraphs as comma separated paragraph numbers (or relative postions).
502
+
503
+
504
+ = I'd like to rotate my ad codes based on percentage, for example show one ad 75% of the time and another one 25% of the time. Is that possible? =
505
+
506
+ Yes, simply create block with 4 ads separated with |rotate|: 3 times ad1 and 1 time ad2.
507
+
508
+
509
+ = How can I show different ads to different visitors according to a url query parameter? =
510
+
511
+ Use Url parameters List to black/white-list certain url parameters. Leave url parameter list empty and set it to Black list to show ads for all url.
512
+ You can specify either parameters or parameters with values. For example for url `http://example.com?data=2&customer-id=22&device=0` you can define url parameters '`data, customer-id=22`' to insert ad only for urls where there is `data` parameter and `customer-id` parameter with value 22.
513
+ Separate parameters with comma.
514
+
515
+
516
+ = How can I use PHP code for code block? =
517
+
518
+ Enter PHP code surrounded by PHP tags and check Process PHP.
519
+ Example:
520
+
521
+ `<div style="width: 100%;">
522
+ Some HTML/Javascript code
523
+ </div>
524
+ <?php echo "PHP code by Ad Inserter"; ?>`
525
+
526
+
527
+ = How can I insert post category name into my ad code? =
528
+
529
+ 1. Use {category} in the ad. This will be replaced with the post category name.
530
+ 2. You can also use
531
+
532
+ * {title} - Title of the post
533
+ * {short_title} - Short title (first 3 words) of the post title
534
+ * {category} - Category of the post (or short title if there is no category)
535
+ * {short_category} - First words before "," or "and" of the category of the post (or short title if there is no category)
536
+ * {tag} - The first tag or general tag if the post has no tags (**works only inside posts**)
537
+ * {smart_tag} - Smart selection of post tag in the following order:
538
+ * If there is no tag then the category is used;
539
+ * If there is a two-word tag then it is used;
540
+ * If the first tag is a substring of the second (or vice versa) then the first tag is not taken into account
541
+ * If the first and second tags are single words then both words are used
542
+ * First three words of the first tag
543
+ * General tag
544
+ * {search_query} - Search engine query that brought visitor to your website (supports Google, Yahoo, Bing and Ask search engines), {smart_tag} is used when there is no search query. You need to disable caching to use this tag. Please note that most search queries are now encrypted.
545
+ * {author} - Post author username (**works only inside posts**)
546
+ * {author_name} Post author name (**works only inside posts**)
547
+
548
+ For all options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
549
+
550
+
551
+ = How can I rotate few versions of the same ad? =
552
+
553
+ Enter them into the ad box and separate them with |rotate| (vertical bars around text rotate). Ad Inserter will insert them randomly.
554
+ Example:
555
+
556
+ `ad_code_1
557
+ |rotate|
558
+ ad_code_2
559
+ |rotate|
560
+ ad_code_3`
561
+
562
+
563
+ = What settings should I use for ads on AMP pages? =
564
+
565
+ Asumming AMP urls end with `/amp/` use the following settings:
566
+
567
+ * Automatic Insertion: set as needed
568
+ * Select **No wrapping** style
569
+ * Whitelist url `*/amp/`
570
+ * Put AMP head script in the Header code block (tab *)
571
+ * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
572
+
573
+
574
+ = How can place ads below Read More tag? =
575
+
576
+ Configure ad block with the following options:
577
+
578
+ * Automatic Insertion: After Paragraph
579
+ * Paragraph Number: 1
580
+ * Count only paragraphs that CONTAIN: `<span id="more-`
581
+
582
+ Check source code of your website for proper "read more" tag.
583
+
584
+
585
+ = How can I insert code block directly into template php file? =
586
+
587
+ Enable PHP function adinserter for code block and call adinserter function with code block number as parameter.
588
+ Example for block 3:
589
+
590
+ `<?php if (function_exists ('adinserter')) echo adinserter (3); ?>`
591
+
592
+ This would generate code as defined for the code block number 3.
593
+
594
+
595
+ = Center alignment does not work for some ads! =
596
+
597
+ Some iframe ads can not be centered using standard approach so some additional code is needed to put them in the middle.
598
+ Simply wrap ad code in a div with some style e.g. left padding. Example:
599
+
600
+ `<div style="padding-left: 200px;">
601
+ ad_code
602
+ </div>`
603
+
604
+
605
+ = How can I rotate between different alignments so I can test an ad aligned to the right against an ad aligned to the left? =
606
+
607
+ Set Block Alignment and Style to "No Wrapping" and create manual wrapping around both ads separated with |rotate|:
608
+
609
+ `<div style="float: left; margin: 0 8px 8px 0;">
610
+ AD CODE LEFT
611
+ </div>
612
+
613
+ |rotate|
614
+
615
+ <div style="float: right; margin: 0 0 8px 8px;">
616
+ AD CODE RIGHT
617
+ </div>`
618
+
619
+
620
+ == Screenshots ==
621
+
622
+ 1. Settings for one code block (Before post). Up to 16 blocks can be configured (up to 64 in <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>)
623
+ 2. Code preview with visual CSS editor
624
+ 3. Code preview with visual CSS editor - highlighted code
625
+ 4. Post / Page Ad Inserter Exceptions
626
+ 5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
627
+ 6. Ad Inserter settings
628
+ 7. Visualization of HTML tags in post
629
+ 8. Visualization of positions for automatic insertion in post
630
+ 9. Visualization of inserted block in post
631
+ 10. Alignment **Left**, **Default** - Default means default (usually left) aligned ad block with thin margin around
632
+ 11. Alignment **Right** - Right aligned ad block with thin margin around
633
+ 12. Alignment **Center** - Center aligned ad block with thin margin around
634
+ 13. Alignment **No Wrapping** - Default (usually left) aligned ad block **with no margin around**
635
+ 14. Alignment **Custom CSS** - Ad block with custom CSS (no margin around). You can use it for special effects (border, background, padding, margin, floating, etc.)
636
+ 15. Alignment **Float Left** - Left aligned ad block with thin margin around wrapped with text on the right
637
+ 16. Alignment **Float Right** - Right aligned ad block with thin margin around wrapped with text on the left
638
+ 17. Complete settings for one code block (Before Paragraph)
639
+
640
+
641
+ == Changelog ==
642
+
643
+ = 2.1.8 =
644
+ - Fixed error when using server-side device detection
645
+
646
+ = 2.1.7 =
647
+ - Fixed error when using PHP 5.4 or earlier
648
+
649
+ = 2.1.6 =
650
+ - Added support for insertion before/after multiple paragraphs
651
+ - Added initial support for impression and click tracking (Pro only)
652
+ - Few bug fixes and cosmetic changes
653
+
654
+ = 2.1.5 =
655
+ - Added support to avoid insertion inside `<figure>` and `<li>` elements (image captions, lists)
656
+ - Added support for exceptions for custom post types
657
+ - Few minor bug fixes and code improvements
658
+
659
+ = 2.1.4 =
660
+ - Paragraph counting restored to standard functions
661
+ - Added option to select paragraph counting functions with multibyte support (unicode characters)
662
+ - Fixed bug for wrong paragraph counting in posts with blockquote sections in some cases
663
+ - Fixed bug for wrong measuring of plugin processing time in some cases
664
+ - Fixed bug for "Empty delimiter" warning
665
+
666
+ = 2.1.3 =
667
+ - Added support for counting paragraphs with multibyte (unicode) characters
668
+ - Fixed bug for class name not saved
669
+ - Few minor bug fixes and cosmetic changes
670
+
671
+ = 2.1.2 =
672
+ - Fixed bug for disabled settings page on multisite blogs
673
+
674
+ = 2.1.1 =
675
+ - Changes for compatibility with PHP 7.1
676
+ - Automatic rename of old pro plugin slug (Pro only)
677
+ - Added support for additional Pro features (Pro only)
678
+ - Few bug fixes and cosmetic changes
679
+
680
+ = 2.1.0 =
681
+ - Added support to insert ads in Ajax requests (e.g. in infinite scroll)
682
+ - Added support to not include block classes when class name is empty
683
+ - Added sticky positions (Pro only)
684
+ - Bug fix for minimum user role not taken into account for exceptions list
685
+ - Bug fix for IP database update cron event (Pro only)
686
+
687
+ = 2.0.14 =
688
+ - Fixed issue for responsive ads not displayed when using Left, Center or Right alignment
689
+
690
+ = 2.0.13 =
691
+ - Added icons for Automatic insertion and alignment
692
+ - Automatic insertion None changed to Disabled
693
+ - Alignment None changed to Default
694
+ - Changed database option data for Automatic insertion and Alignment settings
695
+ - Improved CSS 3 code for Left, Center and Right alignment
696
+ - Click on CSS code starts editing
697
+ - Page/Post exceptions listed in debug output
698
+ - Different plugin slug for Pro version
699
+ - Few minor bug fixes and cosmetic changes
700
+
701
+ = 2.0.12 =
702
+ - Bug fix for page/post exceptions list
703
+
704
+ = 2.0.11 =
705
+ - Bug fix for settings page not loading
706
+
707
+ = 2.0.10 =
708
+ - Added option to insert ads between posts on blog pages
709
+ - Added option to check and manage post/page exceptions for each block
710
+ - Added option to check and manage all post/page exceptions (Pro only)
711
+ - Added option for multisite installations to disable PHP processing on sub-sites (Pro only)
712
+ - Added license status notifications (Pro only)
713
+
714
+ = 2.0.9 =
715
+ - Added support for uppercase {country_ISO2} and lowercase {country_iso2} tag (Pro only)
716
+ - Removed inclusion of dummy css and js file
717
+ - Bug fix: Client-side dynamic blocks were not enabled if not using W3 Total Cache
718
+
719
+ = 2.0.8 =
720
+ - Added support for client-side rotation (works with caching)
721
+ - Added support for server-side rotation with W3 Total Cache
722
+ - Added support for client-side country detection (works with caching, Pro only)
723
+ - Added support for server-side country detection with W3 Total Cache (Pro only)
724
+ - Added debugging functions to measure plugin processing time
725
+ - Added option to black/white-list IP addresses (Pro only)
726
+ - Added option for fallback code when scheduling between dates expires (Pro only)
727
+ - On multisite installations Ad Inserter debug menu item on sites is available only if settings page is enabled
728
+ - Added option for multisite installations to use Ad Inserter settings of main site for all blogs
729
+ - Added flags to country list (Pro only)
730
+ - Bug fix: Code preview did not work if Wordpress was installed in a folder
731
+ - Few minor bug fixes and cosmetic changes
732
+
733
+ = 2.0.7 =
734
+ - Delayed display moved to Misc group
735
+ - Added option for scheduling to insert code only between specified dates (Pro only)
736
+ - Added option for Geo targeting (Pro only)
737
+ - Few minor bug fixes and cosmetic changes
738
+
739
+ = 2.0.6 =
740
+ - Added support to filter subpages created by the `<!--nextpage-->` tag
741
+ - Added option to import block name (Pro only)
742
+ - Cookie deleted only when it exists and debugging is disabled
743
+ - Few minor bug fixes
744
+
745
+ = 2.0.5 =
746
+ - Cookie created only when debugging is enabled
747
+ - Few minor bug fixes
748
+
749
+ = 2.0.4 =
750
+ - Bug fix: Cursor position always at the end of block name
751
+ - State of debugging functions saved to cookie
752
+ - Few minor bug fixes
753
+
754
+ = 2.0.3 =
755
+ - Debugging functions in admin toolbar available only for administrators
756
+ - Added option to hide debugging functions in admin toolbar
757
+ - Added shortcode for debugger
758
+ - Few minor bug fixes
759
+
760
+ = 2.0.2 =
761
+ - Changed javascript version check to get plugin version from the HTML page
762
+ - Added warning if old cached version of CSS file is loaded on the settings page
763
+ - Added warning if version query parameter for js/css files is removed due to inappropriate caching
764
+
765
+ = 2.0.1 =
766
+ - Bug fix: Shortcodes called by name were not displayed
767
+
768
+ = 2.0.0 =
769
+ - Redesigned user interface
770
+ - Added many debugging tools for easier troubleshooting
771
+ - New feature: Code preview tool with visual CSS editor
772
+ - New feature: Label inserted blocks
773
+ - New feature: Show available positions for automatic insertion
774
+ - New feature: Show HTML tags in posts/static pages
775
+ - New feature: Log Ad Inserter processing
776
+ - Improved loading speed of the settings page
777
+ - Improved block insertion processing speed
778
+ - Added support to avoid inserion near images, headers and other elements
779
+ - Added option to avoid insertion in feeds
780
+ - Added option to display code blocks only to administrators
781
+ - Added option for publishig date check for display positions Before/After Content
782
+ - Added option for server-side device check for header and footer code
783
+ - Added option for maximum page/post words
784
+ - Added option for maximum paragraph words
785
+ - Added option to black/white-list post IDs
786
+ - Added option to black/white-list url query parameters
787
+ - Added warning if the settings page is blocked by ad blocker
788
+ - Added warning if old cached version of javascript is loaded on the settings page
789
+ - Added support for multisite installations to disable settings, widgets and exceptions on network sites (Pro only)
790
+ - Block names can be edited by clicking on the name
791
+ - Filters now work also on posts and single pages
792
+ - CSS code for client-side detection moved to inline CSS
793
+ - Bug fix: Minimum user roles for exception editing was not calculated properly
794
+ - Bug fix: Server-side detection checkbox was not saved properly
795
+ - Many other minor bug fixes, code improvements and cosmetic changes
796
+
797
+ = 1.7.0 =
798
+ - Bug fix: Shortcodes did not ignore post/static page exceptions
799
+ - Slightly redesigned user interface
800
+ - Excerpt/Post number(s) renamed to Filter as it now works on all display positions
801
+ - Widget setting removed from Automatic display to Manual display section
802
+ - Added support to disable widgets (standalone checkbox in Manual display)
803
+ - Added call counter/filter for widgets
804
+ - Added support to edit CSS for predefined styles
805
+ - Few other minor bug fixes, code improvements and cosmetic changes
806
+
807
+ = 1.6.7 =
808
+ - Bug fix: Block code textarea was not escaped
809
+ - Added checks for page types for shortcodes
810
+ - Added support for Before/After Post position call counter/filter
811
+ - Few minor cosmetic changes
812
+
813
+ = 1.6.6 =
814
+ - Bug fix: Display on Homepage and other blog pages might get disabled - important if you were using PHP function call or shortcode (import of settings from 1.6.4)
815
+ - Few minor cosmetic changes
816
+ - Requirements changed to WordPress 4.0 or newer
817
+ - Added initial support for Pro version
818
+
819
+ = 1.6.5 =
820
+ - Fixed bug: Wrong counting of max insertions
821
+ - Change: display position Before Title was renamed to Before Post
822
+ - Added support for display position After Post
823
+ - Added support for posts with no `<p>` tags (paragraphs separated with \r\n\r\n characters)
824
+ - Added support for paragraph processing on homepage, category, archive and search pages
825
+ - Added support for custom viewports
826
+ - Added support for PHP function call counter
827
+ - Added support to disable code block on error 404 pages
828
+ - Added support to debug paragraph tags
829
+
830
+ = 1.6.4 =
831
+ - Fixed bug: For shortcodes in posts the url was not checked
832
+ - Optimizations for device detection
833
+
834
+ = 1.6.3 =
835
+ - Removed deprecated code (fixes PHP 7 deprecated warnings)
836
+ - Added support for paragraphs with div and other HTML tags (h1, h2, h3,...)
837
+
838
+ = 1.6.2 =
839
+ - Removed deprecated code (fixes PHP Fatal error Call to a member function get_display_type)
840
+ - Added support to change plugin processing priority
841
+
842
+ = 1.6.1 =
843
+ * Fixed bug: For shortcodes in posts the date was not checked
844
+ * Fixed error with some templates "Call to undefined method is_main_query()"
845
+ * Added support for minumum number of page/post words for Before/After content display option
846
+ * Added support for {author} and {author_name} tags
847
+
848
+ = 1.6.0 =
849
+ * Added support for client-side device detection
850
+ * Many code improvements
851
+ * Improved plugin processing speed
852
+ * Removed support for deprecated tags for manual insertion {adinserter n}
853
+ * Few minor bug fixes
854
+
855
+
856
+ == Upgrade Notice ==
857
+
858
+ = 2.1.8 =
859
+ Fixed error when using server-side device detection
860
+
861
+ = 2.1.7 =
862
+ Fixed error when using PHP 5.4 or earlier
863
+
864
+ = 2.1.6 =
865
+ Added support for insertion before/after multiple paragraphs;
866
+ Few bug fixes and cosmetic changes
867
+
868
+ = 2.1.5 =
869
+ Added support to avoid insertion inside `<figure>` and `<li>` elements;
870
+ Added support for exceptions for custom post types;
871
+ Few minor bug fixes and code improvements
872
+
873
+ = 2.1.4 =
874
+ Paragraph counting restored to standard functions;
875
+ Added option to select paragraph counting functions with multibyte support (unicode characters);
876
+ Few bugs fixed including for "Empty delimiter" warning
877
+
878
+ = 2.1.3 =
879
+ Added support for counting paragraphs with multibyte (unicode) characters;
880
+ Fixed bug for class name not saved;
881
+ Few minor bug fixes and cosmetic changes
882
+
883
+ = 2.1.2 =
884
+ Fixed bug for disabled settings page on multisite blogs
885
+
886
+ = 2.1.1 =
887
+ Changes for compatibility with PHP 7.1;
888
+ Few bug fixes and cosmetic changes
889
+
890
+ = 2.1.0 =
891
+ Support for ads in Ajax requests (e.g. in infinite scroll); Added sticky positions (Pro only);
892
+ Bug fix for minimum user role for exceptions list; Bug fix for IP database update cron event (Pro only)
893
+
894
+ = 2.0.14 =
895
+ Fixed issue for responsive ads not displayed when using Left, Center or Right alignment
896
+
897
+ = 2.0.13 =
898
+ Added icons for Automatic insertion and alignment; Changed database option data for Automatic insertion and Alignment settings;
899
+ Improved CSS 3 code for Left, Center and Right alignment; Few minor bug fixes and cosmetic changes;
900
+
901
+ = 2.0.12 =
902
+ Bug fix for page/post exceptions list
903
+
904
+ = 2.0.11 =
905
+ Bug fix for settings page not loading
906
+
907
+ = 2.0.10 =
908
+ Option to insert ads between posts on blog pages;
909
+ Option to check and manage post/page exceptions for each block;
910
+
911
+ = 2.0.9 =
912
+ Bug fix: Client-side dynamic blocks were not enabled if not using W3 Total Cache;
913
+ Added support for uppercase and lowercase {country_iso2} tag (Pro only); Removed inclusion of dummy css and js file
914
+
915
+ = 2.0.8 =
916
+ Added support for client-side rotation (works with caching), added support for W3 Total Cache, client-side country detection (works with caching, Pro only),
917
+ bug fixed: Code preview did not work if Wordpress was installed in a folder, added flags to country list (Pro only)
918
+
919
+ = 2.0.7 =
920
+ Delayed display moved to Misc group, added option for scheduling to insert code only between specified dates (Pro only),
921
+ added option for Geo targeting (Pro only), few minor bug fixes and cosmetic changes
922
+
923
+ = 2.0.6 =
924
+ Added support to filter subpages created by the `<!--nextpage-->` tag, added option to import block name (Pro only),
925
+ cookie deleted only when it exists and debugging is disabled, few minor bug fixes
926
+
927
+ = 2.0.5 =
928
+ cookie created only when debugging is enabled, few minor bug fixes
929
+
930
+ = 2.0.4 =
931
+ Bug fix: Cursor position always at the end of block name, state of debugging functions saved to cookie, few minor bug fixes
932
+
933
+ = 2.0.3 =
934
+ Debugging functions in admin toolbar available only for administrators, added option to hide debugging functions in admin toolbar,
935
+ Added shortcode for debugger, few minor bug fixes
936
+
937
+ = 2.0.2 =
938
+ Changed javascript version check to get plugin version from the HTML page, added warning if old cached version of CSS file is loaded on the settings page,
939
+ added warning if version query parameter for js/css files is removed due to inappropriate caching,
940
+
941
+ = 2.0.1 =
942
+ Bug fix: Shortcodes called by name were not displayed
943
+
944
+ = 2.0.0 =
945
+ Redesigned user interface, added code preview and many debugging tools for easier troubleshooting and many new features
readme.txt CHANGED
@@ -1,124 +1,82 @@
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
28
- > * Insert before or after random paragraph
29
- > * Insert before or after multiple paragraphs
30
- > * Insert before or after comments
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
39
- > * Insert header and footer code
40
- > * Insert Google Analytics, Piwik or any other web analytics code
41
- > * Insert HTML, CSS, Javascript or PHP code
42
  > * Manual insertion: widgets, shortcodes, PHP function call
43
- > * Sticky (fixed) widgets (the sidebar does not move when the page is scrolled, works with most themes)
44
  > * Custom block alignment and style
45
- > * Insert ads on AMP pages
46
  > * Custom CSS class name for wrapping divs to avoid ad blockers
47
- > * Use shortcodes from other plugins
48
  > * PHP code processing
49
  > * Ad rotation (server-side and client-side - works with caching)
50
  > * Desktop/mobile device detection (server-side and client-side - works with caching)
51
- > * Black/White-list categories, tags, taxonomies, post IDs, urls, url query parameters, referers
52
  > * Simple troubleshooting with many debugging functions
53
  > * Function to visualize inserted code blocks
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
66
- > * Multisite options to limit settings on the sites
67
- > * Post/page exception management
68
- > * 6 custom viewports for client-side desktop/mobile device detection
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
76
 
77
  **Endorsed by Amazon**
78
 
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
103
- * to insert Google analytics code
104
- * to insert various opt-in forms
105
-
106
- Maintaining several plugins (often from different vendors) is not easy. And each plugin is slowing down the speed of your website.
107
-
108
- **Speed Up Your WordPress: Replace them all with free Ad Inserter!**
109
 
110
  **Quick Start**
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>.
123
 
124
  **Please support plugin development**
@@ -131,7 +89,7 @@ Support the advancement of this plugin:
131
 
132
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
133
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
134
- * Buy license for Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank">Wordpress plugin for ads</a>
135
 
136
  == Installation ==
137
 
@@ -366,18 +324,13 @@ If you enable **Remote debugging** you can also allow other people using url par
366
  **Remote debugging** enables other, non-logged in users by using url parameters to see Debugger widget and code insertion debugging (blocks, positions, tags, processing).
367
  Enable this option (and disable caching) 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 via url is always enabled.
368
 
369
- **Please support plugin development**
370
 
371
  If you are using Ad Inserter and you like it, then please write about it and spread the word on the <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review page</a>.
372
-
373
  Positive reviews are a great way to show your appreciation for my work. Besides being an incredible boost to my morale, they are also a great incentive to fix any bug found in the software and to add new features for better monetization of your website.
374
 
375
- Support the advancement of this plugin:
376
-
377
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
378
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
379
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
380
-
381
 
382
  == Frequently Asked Questions ==
383
 
@@ -386,35 +339,17 @@ Support the advancement of this plugin:
386
  1. After activation, click "Settings / Ad Inserter" to access the settings page
387
  2. Put ad (or any other HTML/Javascript/PHP) code into the ad box
388
  3. Set automatic insertion option (for example: Before Post)
389
- 4. Enable at least one page type (for example: Posts, some insertion options don't work on all page types)
390
  5. Save settings
391
- 6. Check inserted code on the posts
392
  7. Check also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
393
 
394
 
395
- = I have installed code for AdSense ads but the ad blocks are blank. =
396
-
397
- If you get blank ads then 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.
398
- You can also try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> as good AdSense alternative for contextual ads.
399
-
400
-
401
  = Settings for widget =
402
 
403
  * Nothing needed, just enter the code and save settings - widget is enabled by default
404
  * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
405
- * Optionally you can enable Sticky widget - this means that this widget (and widgets below) will stay fixed in the sidebar when the page is scrolled, but please note that this may not work with all themes
406
- * You can also make other widgets sticky even if you don't use Ad Inserter widgets - drag Ad Inserter widget to the sidebar ABOVE the top widget that needs to be sticky, select Dummy Widget for Block, check Sticky and save widget
407
- * In general plugin settings (tab *) you can also define Sticky Widget Top Margin to precisely define top position where first sticky widget will stop
408
-
409
- Additional note regarding *sticky widgets*:
410
-
411
- Sticky widgets work by changing sidebar CSS to `position: sticky;`. This works in most themes but not all.
412
 
413
- If your widgets and sidebar aren't sticking as expected the first thing to check are the rules applied to the sidebar parent containers.
414
- Specifically, look for any overflow property set on the parent. You can't use: `overflow: hidden`, `overflow: scroll` or `overflow: auto` on the parent of a `position: sticky` sidebar.
415
-
416
- If your theme is not using overflow and still having problems it's worth checking if a height is set on the parent.
417
- This may constrain the sticky positioning, stopping it from occurring. Remove the height and see if that fixes the problem.
418
 
419
  = Settings for contextual Amazon Native Shopping Ads =
420
 
@@ -492,7 +427,6 @@ Change title tag according to the theme style.
492
 
493
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
494
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
495
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
496
 
497
 
498
  = How can I enable/disable ads on specific posts/pages? =
@@ -513,8 +447,6 @@ There are two possible approaches.
513
  2. Enable automatic insertion On all Posts/Pages.
514
  3. Click on Lists, enter url (or space separated urls) for Urls, e.g. `/permalink-url`, and white-list or black-list it.
515
 
516
- For details check <a href="https://adinserter.pro/exceptions" target="_blank">Ad Inserter Post/Page Exceptions</a>.
517
-
518
 
519
  = I'm using responsive theme. How can I show or hide some ads on mobile devices? =
520
 
@@ -644,13 +576,9 @@ Asumming AMP urls end with `/amp/` use the following settings:
644
  * Automatic Insertion: set as needed
645
  * Select **No wrapping** style
646
  * Whitelist url `*/amp/`
647
- * Put AMP head script in the Header code block (tab * / tab Header) and enable it
648
  * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
649
 
650
- If you have different url structure you'll have to adjust url pattern accordingly.
651
-
652
- For details check <a href="https://adinserter.pro/settings#amp" target="_blank">settings for ads on AMP pages</a>.
653
-
654
 
655
  = How can place ads below Read More tag? =
656
 
@@ -721,33 +649,6 @@ AD CODE RIGHT
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)
735
- - Added support to black/white-list arbitrary taxonomies (taxonomy, term or taxonomy:term)
736
- - Added support for automatic insertion before, between and after comments
737
- - Added processing of shortcodes in the header and footer code
738
- - Debugging function Show positions shows also page type
739
- - Fixed page type detection when Post page was set to static page and it was not homepage
740
- - Few minor bug fixes, cosmetic changes and code improvements
741
-
742
- = 2.1.10 =
743
- - Fix for shifted sidebars in some themes
744
-
745
- = 2.1.9 =
746
- - Added support for sticky widgets
747
- - Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img)
748
- - Impression and click tracking (beta, Pro only)
749
- - Few minor bug fixes, cosmetic changes and code improvements
750
-
751
  = 2.1.8 =
752
  - Fixed error when using server-side device detection
753
 
@@ -963,29 +864,6 @@ AD CODE RIGHT
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);
975
- Added support to black/white-list arbitrary taxonomies;
976
- Added support for automatic insertion before, between and after comments;
977
- Added processing of shortcodes in the header and footer code;
978
- Fixed page type detection on blog pages in some cases;
979
-
980
- = 2.1.10 =
981
- Fix for shifted sidebars in some themes
982
-
983
- = 2.1.9 =
984
- Added support for sticky widgets;
985
- Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img);
986
- Impression and click tracking (beta, Pro only);
987
- Few minor bug fixes, cosmetic changes and code improvements
988
-
989
  = 2.1.8 =
990
  Fixed error when using server-side device detection
991
 
1
+ === Ad Inserter ===
 
2
  Contributors: spacetime
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
4
+ Tags: ads, adsense, ad management, ad rotation, advertising, contextual ads, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, widgets, PHP, Javascript, HTML
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
+ Stable tag: 2.1.5
8
  License: GPLv3
9
 
10
+ Ad management plugin to automate advertising on your website: AdSense, Amazon, banner rotation and more. Insert any code or ads anywhere on the page.
11
 
12
  == Description ==
13
 
14
+ Ad management plugin with many advertising features to automatically insert adverts. **Perfect for all kinds of ads including AdSense and Amazon.** Great also for contextual Native Shopping Ads and rotating banners. Ad Inserter provides many options to insert any Javascript, HTML, PHP or advert code anywhere on the page.
 
 
15
 
16
  > **Features**
17
  >
18
+ > * 16 code blocks
19
  > * Syntax highlighting editor
20
  > * Code preview with visual CSS editor
21
+ > * Automatic insertion before / after post, content, paragraph or excerpt
22
+ > * Automatic insertion before or after random paragraph
23
+ > * Automatic insertion before or after multiple paragraphs
24
+ > * Automatic insertion before or after any HTML element in post
25
+ > * Automatic insertion at relative position in posts
 
 
 
 
 
 
 
 
26
  > * Clearance options to avoid insertion near images or headers
27
+ > * Automatic insertion between posts on blog pages
28
  > * Insertion exceptions for posts and pages
29
+ > * Insertion of header and footer code
 
 
30
  > * Manual insertion: widgets, shortcodes, PHP function call
 
31
  > * Custom block alignment and style
32
+ > * Insertion of ads on AMP pages
33
  > * Custom CSS class name for wrapping divs to avoid ad blockers
34
+ > * Insertion of shortcodes from other plugins
35
  > * PHP code processing
36
  > * Ad rotation (server-side and client-side - works with caching)
37
  > * Desktop/mobile device detection (server-side and client-side - works with caching)
38
+ > * Black/White-list categories, tags, post IDs, urls, url parameters, referers
39
  > * Simple troubleshooting with many debugging functions
40
  > * Function to visualize inserted code blocks
41
  > * Function to visualize available insertion positions
42
  > * Function to visualize HTML tags
43
 
44
+ 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. Please read the user manual to get the most of it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  > * 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
47
+ > * Download **PDF user guide** for Ad Inserter: go to <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> page and below you can find button for free download of Ad Inserter User Guide
48
 
49
  **Endorsed by Amazon**
50
 
51
  > 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.
52
  >
53
  > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
54
+ > * On the <a href="https://wordpress.org/plugins/ad-inserter/faq/">FAQ</a> page you can also find an example of contextual Amazon Shopping Ads that show items related to the post content (using post tags)
55
+
56
+ There is also <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> if you need more:
57
+
58
+ > * 64 code blocks
59
+ > * GEO targeting (works also with caching)
60
+ > * Black/White-list IP addresses or countries (works also with caching)
61
+ > * Sticky positions
62
+ > * Scheduling with fallback option
63
+ > * Export and import of settings
64
+ > * Multisite options to limit settings on the sites
65
+ > * Post/page exception management
66
+ > * 6 custom viewports
67
+ > * Support via email
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  **Quick Start**
70
 
71
  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>:
72
 
73
+ * 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
74
  * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
75
  * **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)
76
  * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
77
  * 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)
 
78
 
79
+ 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/">Docs</a> page.
80
  For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
81
 
82
  **Please support plugin development**
89
 
90
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
91
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
92
+
93
 
94
  == Installation ==
95
 
324
  **Remote debugging** enables other, non-logged in users by using url parameters to see Debugger widget and code insertion debugging (blocks, positions, tags, processing).
325
  Enable this option (and disable caching) 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 via url is always enabled.
326
 
327
+ Please **support the plugin** if you like it:
328
 
329
  If you are using Ad Inserter and you like it, then please write about it and spread the word on the <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review page</a>.
 
330
  Positive reviews are a great way to show your appreciation for my work. Besides being an incredible boost to my morale, they are also a great incentive to fix any bug found in the software and to add new features for better monetization of your website.
331
 
 
 
332
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
333
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
 
 
334
 
335
  == Frequently Asked Questions ==
336
 
339
  1. After activation, click "Settings / Ad Inserter" to access the settings page
340
  2. Put ad (or any other HTML/Javascript/PHP) code into the ad box
341
  3. Set automatic insertion option (for example: Before Post)
342
+ 4. Enable at least one page type: Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages (some insertion options don't work on all page types)
343
  5. Save settings
344
+ 6. Check inserted code on the page
345
  7. Check also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
346
 
347
 
 
 
 
 
 
 
348
  = Settings for widget =
349
 
350
  * Nothing needed, just enter the code and save settings - widget is enabled by default
351
  * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
 
 
 
 
 
 
 
352
 
 
 
 
 
 
353
 
354
  = Settings for contextual Amazon Native Shopping Ads =
355
 
427
 
428
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
429
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
 
430
 
431
 
432
  = How can I enable/disable ads on specific posts/pages? =
447
  2. Enable automatic insertion On all Posts/Pages.
448
  3. Click on Lists, enter url (or space separated urls) for Urls, e.g. `/permalink-url`, and white-list or black-list it.
449
 
 
 
450
 
451
  = I'm using responsive theme. How can I show or hide some ads on mobile devices? =
452
 
576
  * Automatic Insertion: set as needed
577
  * Select **No wrapping** style
578
  * Whitelist url `*/amp/`
579
+ * Put AMP head script in the Header code block (tab *)
580
  * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
581
 
 
 
 
 
582
 
583
  = How can place ads below Read More tag? =
584
 
649
 
650
  == Changelog ==
651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  = 2.1.8 =
653
  - Fixed error when using server-side device detection
654
 
864
 
865
  == Upgrade Notice ==
866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
867
  = 2.1.8 =
868
  Fixed error when using server-side device detection
869
 
settings.php CHANGED
@@ -20,26 +20,15 @@ function generate_settings_form (){
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
 
@@ -90,13 +79,6 @@ function generate_settings_form (){
90
  }
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
 
102
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo get_javascript_debugging () ? '1' : '0'; ?>" ></div>
@@ -108,19 +90,19 @@ function generate_settings_form (){
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>
122
  <a style="text-decoration: none;" href="https://wordpress.org/support/plugin/ad-inserter" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 68px;" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button></a>
123
- <a style="text-decoration: none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 62px;" title="Support Free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!">Donate</button></a>
124
  <a style="text-decoration: none;" href="https://wordpress.org/support/plugin/ad-inserter/reviews/" target="_blank"><button type="button" title="If you like Ad Inserter please write a nice review" style="display: none; margin: 0 10px 0 0; width: 62px;">Review</button></a>
125
  <a style="text-decoration: none;" href="http://adinserter.pro/" target="_blank"><button type="button" title="Upgrade to Ad Inserter Pro" style="display: none; margin: 0 10px 0 0; width: 62px;">Go&nbsp;Pro</button></a>
126
  </div>
@@ -131,9 +113,9 @@ function generate_settings_form (){
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,9 +124,9 @@ function generate_settings_form (){
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,16 +135,16 @@ function generate_settings_form (){
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,22 +253,15 @@ function generate_settings_form (){
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
 
@@ -295,15 +270,14 @@ function generate_settings_form (){
295
  $show_devices = $obj->get_detection_client_side () == AI_ENABLED || $obj->get_detection_server_side () == AI_ENABLED;
296
  if ($show_devices) $devices_style = "font-weight: bold; color: #66f;"; else $devices_style = "";
297
 
298
- $cat_list = $obj->get_ad_block_cat();
299
- $tag_list = $obj->get_ad_block_tag();
300
- $taxonomy_list = $obj->get_ad_block_taxonomy();
301
- $id_list = $obj->get_id_list();
302
- $url_list = $obj->get_ad_url_list();
303
  $url_parameter_list = $obj->get_url_parameter_list();
304
  $domain_list = $obj->get_ad_domain_list();
305
  if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
306
- $show_lists = $cat_list != '' || $tag_list != '' || $taxonomy_list != '' || $id_list != '' || $url_list != '' || $url_parameter_list != '' || $domain_list != '' || $lists;
307
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
308
 
309
  $show_manual = $manual [$ad_number];
@@ -311,7 +285,7 @@ function generate_settings_form (){
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,20 +301,17 @@ function generate_settings_form (){
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,16 +347,16 @@ function generate_settings_form (){
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>
@@ -396,22 +367,19 @@ function generate_settings_form (){
396
  <option data-img-src="<?php echo plugins_url ('images/before-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
397
  <option data-img-src="<?php echo plugins_url ('images/after-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
398
  <option data-img-src="<?php echo plugins_url ('images/between-posts.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
399
- <option data-img-src="<?php echo plugins_url ('images/before-comments.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_COMMENTS; ?></option>
400
- <option data-img-src="<?php echo plugins_url ('images/between-comments.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_COMMENTS; ?></option>
401
- <option data-img-src="<?php echo plugins_url ('images/after-comments.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_COMMENTS; ?></option>
402
  </select>
403
  </div>
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>
411
  <option data-img-src="<?php echo plugins_url ('images/align-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
412
  <option data-img-src="<?php echo plugins_url ('images/float-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
413
  <option data-img-src="<?php echo plugins_url ('images/float-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
414
- <?php $css_code_height = 260; if (function_exists ('ai_style_options')) $css_code_height = ai_style_options ($obj); ?>
415
  <option data-img-src="<?php echo plugins_url ('images/custom-css.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
416
  <option data-img-src="<?php echo plugins_url ('images/no-wrapping.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
417
  </select>
@@ -425,7 +393,7 @@ function generate_settings_form (){
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,14 +409,14 @@ function generate_settings_form (){
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,23 +436,23 @@ function generate_settings_form (){
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,20 +463,20 @@ function generate_settings_form (){
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,12 +513,11 @@ function generate_settings_form (){
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,11 +533,11 @@ function generate_settings_form (){
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,8 +545,8 @@ function generate_settings_form (){
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,6 +557,7 @@ function generate_settings_form (){
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,6 +566,7 @@ function generate_settings_form (){
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,14 +581,14 @@ function generate_settings_form (){
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,52 +596,35 @@ function generate_settings_form (){
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,7 +636,7 @@ function generate_settings_form (){
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,10 +646,11 @@ function generate_settings_form (){
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,7 +662,7 @@ function generate_settings_form (){
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,15 +672,16 @@ function generate_settings_form (){
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,7 +689,7 @@ function generate_settings_form (){
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,30 +699,30 @@ function generate_settings_form (){
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,46 +731,30 @@ function generate_settings_form (){
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>
791
- <tr>
792
- <td style="padding-right: 7px;">
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>
807
  <tr>
808
  <td style="padding-right: 7px;">
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,14 +763,14 @@ function generate_settings_form (){
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,14 +779,14 @@ function generate_settings_form (){
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,14 +795,14 @@ function generate_settings_form (){
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,12 +811,12 @@ function generate_settings_form (){
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,8 +828,8 @@ function generate_settings_form (){
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,8 +841,8 @@ function generate_settings_form (){
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,43 +854,25 @@ function generate_settings_form (){
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,58 +882,65 @@ function generate_settings_form (){
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,8 +952,8 @@ function generate_settings_form (){
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,12 +962,12 @@ function generate_settings_form (){
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,7 +982,7 @@ function generate_settings_form (){
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,21 +993,21 @@ function generate_settings_form (){
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;">
1083
- <input onclick="if (confirm('Are you sure you want to reset all settings?')) return true; return false;" name="<?php echo AI_FORM_CLEAR; ?>" value="Reset All Settings" type="submit" style="display: none; width:125px; font-weight: bold; color: #e44;" />
1084
  </div>
1085
 
1086
  <div style="clear: both;"></div>
@@ -1091,10 +1018,6 @@ function generate_settings_form (){
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,23 +1028,20 @@ function generate_settings_form (){
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,29 +1088,29 @@ function generate_settings_form (){
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,57 +1118,40 @@ function generate_settings_form (){
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
@@ -1265,11 +1168,11 @@ function generate_settings_form (){
1265
  <?php endif; ?>
1266
 
1267
  <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" value="0" />
1268
- <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" id="enable-header" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adH->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1269
  <label class="checkbox-button" style="margin-left: 10px;" for="enable-header" title="Enable or disable insertion of this code into HTML page header"><span class="checkbox-icon icon-enabled<?php if ($adH->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1270
 
1271
  <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="0" />
1272
- <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="1" id="process-php-h" default="<?php echo $default->get_process_php (); ?>" <?php if ($adH->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1273
  <label class="checkbox-button" style="margin-left: 10px;" for="process-php-h" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adH->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1274
  </div>
1275
 
@@ -1290,11 +1193,11 @@ function generate_settings_form (){
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,9 +1207,9 @@ function generate_settings_form (){
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>
@@ -1321,11 +1224,11 @@ function generate_settings_form (){
1321
  <?php endif; ?>
1322
 
1323
  <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" value="0" />
1324
- <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" id="enable-footer" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adF->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1325
  <label class="checkbox-button" style="margin-left: 10px;" for="enable-footer" title="Enable or disable insertion of this code into HTML page footer"><span class="checkbox-icon icon-enabled<?php if ($adF->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1326
 
1327
  <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="0" />
1328
- <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="1" id="process-php-f" default="<?php echo $default->get_process_php (); ?>" <?php if ($adF->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1329
  <label class="checkbox-button" style="margin-left: 10px;" for="process-php-f" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adF->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1330
  </div>
1331
 
@@ -1346,11 +1249,11 @@ function generate_settings_form (){
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,9 +1263,9 @@ function generate_settings_form (){
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,176 +1273,23 @@ function generate_settings_form (){
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,27 +1304,20 @@ function generate_settings_form (){
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,89 +1329,54 @@ function generate_settings_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>
1619
- <li><strong>&squf;</strong>
1620
- If you're not happy then please open a thread on the <a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">support forum</a> and <a href="https://wordpress.org/support/topic/please-read-how-to-ask-for-help-2/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">describe the problem</a>.
1621
- </li>
1622
- <li><strong>&squf;</strong>
1623
- Ads are not showing? Check <a href="https://adinserter.pro/documentation#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">troubleshooting guide</a> to find out how to fix the problem.
1624
- </li>
1625
- </ul>
1626
-
1627
- <p style="text-align: justify;">Positive reviews are a great way to show your appreciation for my work. Besides being an incredible boost to my morale,<br />
1628
- they are also a great incentive to fix bugs and to add new features for better monetization of your website.
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
 
1643
- <h3 style="text-align: justify;">Looking for Pro Ad Management plugin?</h3>
1644
- <h4 style="text-align: justify;">To Optimally Monetize your WordPress website?</h4>
1645
 
1646
  <ul>
1647
- <li><strong>&squf;</strong> 64 code (ad) blocks</li>
1648
  <li><strong>&squf;</strong> Syntax highlighting editor</li>
1649
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
1650
  <li><strong>&squf;</strong> Automatic insertion before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
1651
  <li><strong>&squf;</strong> Automatic insertion between posts on blog pages</li>
1652
- <li><strong>&squf;</strong> Automatic insertion before, between and after comments</li>
1653
  <li><strong>&squf;</strong> Insertion exceptions for posts and pages</li>
1654
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#manual" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
1655
- <li><strong>&squf;</strong> Sticky positions (left, top, right, bottom - ads stay fixed when the page scrolls)</li>
1656
- <li><strong>&squf;</strong> Sticky (fixed) widgets (sidebar does not move when the page scrolls)</li>
1657
- <li><strong>&squf;</strong> Block <a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">alignment and style</a> customizations</li>
1658
- <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers (AdSense TOS)</li>
1659
  <li><strong>&squf;</strong> Options to disable insertion on Ajax calls, 404 error pages or in feeds</li>
1660
  <li><strong>&squf;</strong> Ad rotation (works also with caching)</li>
1661
- <li><strong>&squf;</strong> Ad impression and click <a href="https://adinserter.pro/tracking" class="simple-link" target="_blank">tracking</a> (works also with Javascript ads like AdSense)</li>
1662
- <li><strong>&squf;</strong> Support for <a href="https://adinserter.pro/tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
1663
- <li><strong>&squf;</strong> Support for ads on <a href="http://adinserter.pro/settings#amp" class="simple-link" target="_blank">AMP pages</a></li>
1664
- <li><strong>&squf;</strong> Support for contextual <a href="https://adinserter.pro/settings#amazon" class="simple-link" target="_blank">Amazon Native Shopping Ads</a> (responsive)</li>
1665
  <li><strong>&squf;</strong> Custom CSS class name for wrapping divs to avoid ad blockers</li>
1666
  <li><strong>&squf;</strong> PHP code processing</li>
1667
  <li><strong>&squf;</strong> Support for <a href="http://adinserter.pro/documentation#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
1668
- <li><strong>&squf;</strong> Support for Google Analytics, Piwik or any other web analytics code</li>
1669
  <li><strong>&squf;</strong> Desktop, tablet and phone server-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a></li>
1670
  <li><strong>&squf;</strong> Client-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a> (works with caching, 6 custom viewports)</li>
1671
- <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#lists" class="simple-link" target="_blank">Black/White-list</a> categories, tags, taxonomies, post IDs, urls, referers</li>
1672
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#lists" class="simple-link" target="_blank">Black/White-list</a> IP addresses or countries (works also with caching)</li>
1673
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#multisite" class="simple-link" target="_blank">Multisite options</a> to limit settings on the sites</li>
1674
  <li><strong>&squf;</strong> Import/Export block or plugin settings</li>
@@ -1678,12 +1386,10 @@ function generate_settings_form (){
1678
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
1679
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
1680
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
1681
- <li><strong>&squf;</strong> Support via email</li>
1682
  </ul>
1683
 
1684
- <p style="text-align: justify;">Ad Inserter Pro is a complete all-in-one ad management plugin for WordPress website with many advertising features to automatically insert adverts on posts and pages.
1685
- With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, GEO targeting,
1686
- impression and click tracking or multisite support then you can simply upgrade to <a href="http://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
1687
  </div>
1688
 
1689
  </div>
@@ -1691,38 +1397,21 @@ function generate_settings_form (){
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
 
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
 
79
  }
80
  }
81
  }
 
 
 
 
 
 
 
82
  ?>
83
 
84
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo get_javascript_debugging () ? '1' : '0'; ?>" ></div>
90
 
91
  <div id="ai-settings" style="float: left;">
92
 
93
+ <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; ?>">
94
 
95
+ <div id="header" class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
96
  <?php
97
  if (function_exists ('ai_settings_header')) ai_settings_header ($start, $active_tab); else { ?>
98
 
99
  <div style="float: left;">
100
+ <h2 id="plugin_name" style="display: inline-block; margin: 13px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
101
  </div>
102
  <div id="header-buttons">
103
  <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>
104
  <a style="text-decoration: none;" href="https://wordpress.org/support/plugin/ad-inserter" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 68px;" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button></a>
105
+ <a style="text-decoration: none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 62px;" title="Support Free Ad Inserter development">Donate</button></a>
106
  <a style="text-decoration: none;" href="https://wordpress.org/support/plugin/ad-inserter/reviews/" target="_blank"><button type="button" title="If you like Ad Inserter please write a nice review" style="display: none; margin: 0 10px 0 0; width: 62px;">Review</button></a>
107
  <a style="text-decoration: none;" href="http://adinserter.pro/" target="_blank"><button type="button" title="Upgrade to Ad Inserter Pro" style="display: none; margin: 0 10px 0 0; width: 62px;">Go&nbsp;Pro</button></a>
108
  </div>
113
  ?>
114
  </div>
115
 
116
+ <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;">
117
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
118
+ <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
119
  <span id="javascript-version-parameter" style="display: none;">Wrong version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
120
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
121
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
124
  <div style="clear: both;"></div>
125
  </div>
126
 
127
+ <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;">
128
  <h2 id="css-version" style="float: left; color: red;" title="Loaded plugin CSS version">&nbsp;</h2>
129
+ <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
130
  <span id="css-version-parameter" style="display: none;">Wrong version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
131
  <span id="css-version-parameter-missing" style="display: none;">Missing version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
132
  Incompatible (old) CSS file loaded, probably due to inappropriate caching.<br />
135
  <div style="clear: both;"></div>
136
  </div>
137
 
138
+ <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;">
139
  <h2 class="blocked-warning-text" style="float: left; color: red;" title="Error loading page">PAGE BLOCKED</h2>
140
+ <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
141
  This page was not loaded properly. Please check browser and plugins that may block CSS/javascript<br />
142
+ files for this page. For <strong>Ad Blocker</strong> select "Disable on this page" or "Don't run on this page".
143
  </div>
144
  <div style="clear: both;"></div>
145
  </div>
146
 
147
+ <div id="ai-tab-container" class="ai-form" style="padding: 8px 8px 1px 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
148
  <div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
149
 
150
  <div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
253
  $enabled_h = $adH->get_enable_manual () && $adH->get_ad_data() != "";
254
  $enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
255
  if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
 
 
 
 
 
 
 
256
  ?>
257
+ <li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> Settings<?php echo $title_hf ?>"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"></div></a></li>
258
  </ul>
259
 
260
  <?php
261
  for ($ad_number = $start; $ad_number <= $end; $ad_number ++){
262
 
263
  $default->number = $ad_number;
264
+ $default->wp_options [AI_OPTION_NAME] = AD_NAME." ".$ad_number;
265
 
266
  $tab_visible = $ad_number == $active_tab || $generate_all;
267
 
270
  $show_devices = $obj->get_detection_client_side () == AI_ENABLED || $obj->get_detection_server_side () == AI_ENABLED;
271
  if ($show_devices) $devices_style = "font-weight: bold; color: #66f;"; else $devices_style = "";
272
 
273
+ $cat_list = $obj->get_ad_block_cat();
274
+ $tag_list = $obj->get_ad_block_tag();
275
+ $id_list = $obj->get_id_list();
276
+ $url_list = $obj->get_ad_url_list();
 
277
  $url_parameter_list = $obj->get_url_parameter_list();
278
  $domain_list = $obj->get_ad_domain_list();
279
  if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
280
+ $show_lists = $cat_list != '' || $tag_list != '' || $id_list != '' || $url_list != '' || $url_parameter_list != '' || $domain_list != '' || $lists;
281
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
282
 
283
  $show_manual = $manual [$ad_number];
285
 
286
  $scheduling_active = $obj->get_scheduling() != AI_SCHEDULING_OFF;
287
 
288
+ $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;
289
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
290
 
291
  $automatic_insertion = $obj->get_automatic_insertion();
301
  $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() ||
302
  $obj->get_paragraph_text() != $default->get_paragraph_text() ||
303
  $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() ||
 
304
  $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote();
305
 
306
  $paragraph_clearance =
307
  ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) ||
308
  ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0);
309
 
 
 
310
  ?>
311
  <div id="tab-<?php echo $ad_number; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
312
  <div id="toolbar-<?php echo $ad_number; ?>" class="max-input" style="margin: 8px 0; height: 28px; margin-bottom: 2px;">
313
  <span id="name-label-container-<?php echo $ad_number; ?>" style="display: table-cell; padding: 0; font-weight: bold; cursor: pointer;">
314
+ <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" />
315
  <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>
316
  </span>
317
  <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
347
  </div>
348
  <div style="float: right;">
349
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
350
+ <input style="display: none; border-radius: 5px; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
351
  <?php } ?>
352
  </div>
353
  <div style="clear: both;"></div>
354
  </div>
355
 
356
+ <div style="padding:8px 8px 6px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
357
  <div style="float: left;">
358
  Automatic Insertion:
359
+ <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;">
360
  <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>
361
  <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>
362
  <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>
367
  <option data-img-src="<?php echo plugins_url ('images/before-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
368
  <option data-img-src="<?php echo plugins_url ('images/after-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
369
  <option data-img-src="<?php echo plugins_url ('images/between-posts.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
 
 
 
370
  </select>
371
  </div>
372
 
373
  <div style="float: right;">
374
  Alignment and Style:&nbsp;&nbsp;&nbsp;
375
+ <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(); ?>">
376
  <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>
377
  <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>
378
  <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>
379
  <option data-img-src="<?php echo plugins_url ('images/align-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
380
  <option data-img-src="<?php echo plugins_url ('images/float-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
381
  <option data-img-src="<?php echo plugins_url ('images/float-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
382
+ <?php $css_code_height = 190; if (function_exists ('ai_style_options')) $css_code_height = ai_style_options ($obj); ?>
383
  <option data-img-src="<?php echo plugins_url ('images/custom-css.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
384
  <option data-img-src="<?php echo plugins_url ('images/no-wrapping.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
385
  </select>
393
  <div id="alignment-style-<?php echo $ad_number; ?>" style="margin-bottom: 4px;"></div>
394
  <div class="max-input">
395
  <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>
396
+ <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" />
397
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
398
  <span id="css-no-wrapping-<?php echo $ad_number; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
399
  <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>
409
  </div>
410
  </div>
411
 
412
+ <div class="responsive-table small-button" style="padding: 7px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
413
  <table>
414
  <tr>
415
  <td style="width: 70%">
416
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
417
+ <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 '; ?> />
418
 
419
+ <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">
420
  <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>
421
  <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>
422
  <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>
436
  <td style="padding-left: 8px;">
437
  </td>
438
  <td style="padding-left: 8px;">
439
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
440
+ <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 '; ?> />
441
  <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>
442
  </td>
443
  <td style="padding-left: 8px;">
444
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
445
+ <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 '; ?> />
446
  <label for="display-category-<?php echo $ad_number; ?>" title="Enable or disable insertion on category blog pages (including sub-pages)">Category pages</label>
447
  </td>
448
  </tr>
449
 
450
  <tr>
451
  <td style="width: 70%">
452
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
453
+ <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 '; ?> />
454
 
455
+ <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">
456
  <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>
457
  <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>
458
  <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>
463
  <td style="padding-left: 8px;">
464
  </td>
465
  <td style="padding-left: 8px;">
466
+ <input style="border-radius: 5px;;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
467
+ <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 '; ?> />
468
  <label for="display-search-<?php echo $ad_number; ?>" title="Enable or disable insertion on search blog pages">Search pages</label>
469
  </td>
470
  <td style="padding-left: 8px;">
471
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
472
+ <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 '; ?> />
473
  <label for="display-archive-<?php echo $ad_number; ?>" title="Enable or disable insertion on tag or archive blog pages">Tag / Archive pages</label>
474
  </td>
475
  </tr>
476
  </table>
477
  </div>
478
 
479
+ <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;">
480
  <?php
481
 
482
  if (!empty ($block_exceptions [$ad_number])) {
513
  ?>
514
  </div>
515
 
516
+ <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;" ?>">
517
+ <div style="margin: 4px 0; height: 26px;">
518
  <div style="float: left; margin-top: 1px;">
519
  Paragraph number(s)
520
+ <input style="border-radius: 5px;" type="text"
 
521
  name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
522
  default="<?php echo $default->get_paragraph_number(); ?>"
523
  value="<?php echo $obj->get_paragraph_number(); ?>"
533
  </div>
534
  </div>
535
 
536
+ <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;" ?>">
537
+ <div class="max-input" style="margin: 4px 0 8px 0;">
538
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
539
  Count&nbsp;
540
+ <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(); ?>">
541
  <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>
542
  <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>
543
  </select>
545
  </span>
546
  <span style="display: table-cell;">
547
  <input
548
+ style="border-radius: 5px; width: 100%;"
549
+ title="Comma separated HTML tags, usually only 'p' tags are used"
550
  type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
551
  default="<?php echo $default->get_paragraph_tags(); ?>"
552
  value="<?php echo $obj->get_paragraph_tags(); ?>"
557
  &nbsp;
558
  that have between
559
  <input
560
+ style="border-radius: 5px;"
561
  type="text"
562
  name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
563
  default="<?php echo $default->get_minimum_paragraph_words(); ?>"
566
  maxlength="5" />
567
  and
568
  <input
569
+ style="border-radius: 5px;"
570
  type="text"
571
  name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
572
  default="<?php echo $default->get_maximum_paragraph_words(); ?>"
581
  <div class="max-input" style="margin: 8px 0 8px 0;">
582
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
583
  and
584
+ <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(); ?>">
585
  <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>
586
  <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>
587
  </select>
588
  </span>
589
  <span class="small-input-tags" style="display: table-cell;">
590
  <input
591
+ style="border-radius: 5px; width: 100%;"
592
  title="Comma separated text"
593
  type="text"
594
  name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
596
  value="<?php echo $obj->get_paragraph_text(); ?>"
597
  maxlength="200" />
598
  </span>
599
+ <span style="display: table-cell; width: 1px; white-space: nowrap; padding-left: 20px;">
600
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
601
+ <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 '; ?> />
602
+ <label for="ignore_blockquote-<?php echo $ad_number; ?>" title="Count also paragraphs inside <?php echo SPECIAL_ELEMENT_TAGS; ?> elements">Count inside special elements</label>
603
+ </span>
604
+ </div>
605
+
606
+ <div style="margin: 8px 0 4px 0;">
607
  Minimum number of paragraphs
608
  <input
609
+ style="border-radius: 5px;"
610
  type="text"
611
  name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
612
  default="<?php echo $default->get_paragraph_number_minimum(); ?>"
613
  value="<?php echo $obj->get_paragraph_number_minimum() ?>"
614
  size="2"
615
  maxlength="3" />
616
+ <div style="float: right;">
617
+ </div>
618
+ <div style="clear: both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  </div>
620
  </div>
621
 
622
+ <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;" ?>">
623
+ <div class="max-input" style="margin: 4px 0 8px 0;">
624
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
625
  In
626
  <input
627
+ style="border-radius: 5px;"
628
  type="text"
629
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
630
  default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
636
  </span>
637
  <span style="display: table-cell;">
638
  <input
639
+ style="border-radius: 5px; width: 100%;"
640
  title="Comma separated text"
641
  type="text"
642
  name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
646
  </span>
647
  </div>
648
 
649
+ <div class="max-input" style="margin: 4px 0 8px 0;">
650
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
651
  In
652
  <input
653
+ style="border-radius: 5px;"
654
  type="text"
655
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
656
  default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
662
  </span>
663
  <span style="display: table-cell;">
664
  <input
665
+ style="border-radius: 5px; width: 100%;"
666
  title="Comma separated text"
667
  type="text"
668
  name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
672
  </span>
673
  </div>
674
 
675
+ <div style="margin: 8px 0 4px 0;">
676
  If text is found
677
+ <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(); ?>">
678
  <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>
679
  <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>
680
  </select>
681
  <span id="check-up-to-<?php echo $ad_number; ?>">
682
  &mdash; check up to
683
  <input
684
+ style="border-radius: 5px;"
685
  type="text"
686
  name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
687
  default="<?php echo $default->get_avoid_try_limit(); ?>"
689
  size="2"
690
  maxlength="3" />
691
  paragraphs
692
+ <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(); ?>">
693
  <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>
694
  <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>
695
  <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>
699
  </div>
700
  </div>
701
 
702
+ <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;" ?>">
703
  Post/Static page must have between
704
+ <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" />
705
  and
706
+ <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" />
707
  words
708
  </div>
709
 
710
+ <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;'; ?>">
711
+ <table style="padding: 8px 8px 10px 8px;">
712
  <tbody>
713
  <tr>
714
  <td style="padding-right: 7px;">
715
  Categories
716
  </td>
717
  <td style="padding-right: 7px; width: 70%;">
718
+ <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" />
719
  </td>
720
  <td style="padding-right: 7px;">
721
+ <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 '; ?> />
722
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist categories"><?php echo AD_BLACK_LIST; ?></label>
723
  </td>
724
  <td>
725
+ <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 '; ?> />
726
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist categories"><?php echo AD_WHITE_LIST; ?></label>
727
  </td>
728
  </tr>
731
  Tags
732
  </td>
733
  <td style="padding-right: 7px;">
734
+ <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"/>
735
  </td>
736
  <td style="padding-right: 7px;">
737
+ <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 '; ?> />
738
  <label for="tag-blacklist-<?php echo $ad_number; ?>" title="Blacklist tags"><?php echo AD_BLACK_LIST; ?></label>
739
  </td>
740
  <td>
741
+ <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 '; ?> />
742
  <label for="tag-whitelist-<?php echo $ad_number; ?>" title="Whitelist tags"><?php echo AD_WHITE_LIST; ?></label>
743
  </td>
744
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745
  <tr>
746
  <td style="padding-right: 7px;">
747
  Post IDs
748
  </td>
749
  <td style="padding-right: 7px;">
750
+ <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"/>
751
  </td>
752
  <td style="padding-right: 7px;">
753
+ <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 '; ?> />
754
  <label for="id-blacklist-<?php echo $ad_number; ?>" title="Blacklist IDs"><?php echo AD_BLACK_LIST; ?></label>
755
  </td>
756
  <td>
757
+ <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 '; ?> />
758
  <label for="id-whitelist-<?php echo $ad_number; ?>" title="Whitelist IDs"><?php echo AD_WHITE_LIST; ?></label>
759
  </td>
760
  </tr>
763
  Urls
764
  </td>
765
  <td style="padding-right: 7px;">
766
+ <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"/>
767
  </td>
768
  <td style="padding-right: 7px;">
769
+ <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 '; ?> />
770
  <label for="url-blacklist-<?php echo $ad_number; ?>" title="Blacklist urls"><?php echo AD_BLACK_LIST; ?></label>
771
  </td>
772
  <td>
773
+ <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 '; ?> />
774
  <label for="url-whitelist-<?php echo $ad_number; ?>" title="Whitelist urls"><?php echo AD_WHITE_LIST; ?></label>
775
  </td>
776
  </tr>
779
  Url parameters
780
  </td>
781
  <td style="padding-right: 7px;">
782
+ <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"/>
783
  </td>
784
  <td style="padding-right: 7px;">
785
+ <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 '; ?> />
786
  <label for="url-parameter-blacklist-<?php echo $ad_number; ?>" title="Blacklist url parameters"><?php echo AD_BLACK_LIST; ?></label>
787
  </td>
788
  <td>
789
+ <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 '; ?> />
790
  <label for="url-parameter-whitelist-<?php echo $ad_number; ?>" title="Whitelist url parameters"><?php echo AD_WHITE_LIST; ?></label>
791
  </td>
792
  </tr>
795
  Referers
796
  </td>
797
  <td style="padding-right: 7px;">
798
+ <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"/>
799
  </td>
800
  <td style="padding-right: 7px;">
801
+ <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 '; ?> />
802
  <label for="referer-blacklist-<?php echo $ad_number; ?>" title="Blacklist referers"><?php echo AD_BLACK_LIST; ?></label>
803
  </td>
804
  <td>
805
+ <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 '; ?> />
806
  <label for="referer-whitelist-<?php echo $ad_number; ?>" title="Whitelist referers"><?php echo AD_WHITE_LIST; ?></label>
807
  </td>
808
  </tr>
811
  </table>
812
  </div>
813
 
814
+ <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;'; ?>">
815
  <table>
816
  <tr>
817
  <td style="padding: 4px 10px 4px 0;">
818
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
819
+ <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 '; ?> />
820
  <label for="enable-widget-<?php echo $ad_number; ?>" title="Enable or disable widget for this code block">
821
  Widget
822
  </label>
828
  </tr>
829
  <tr>
830
  <td style="padding: 4px 10px 4px 0;">
831
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
832
+ <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 '; ?> />
833
  <label for="enable-shortcode-<?php echo $ad_number; ?>" title="Enable or disable shortcode for manual insertion of this code block in posts and pages">
834
  Shortcode
835
  </label>
841
  </tr>
842
  <tr>
843
  <td style="padding: 4px 10px 4px 0;">
844
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
845
+ <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 '; ?> />
846
  <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.">
847
  PHP function
848
  </label>
854
  </table>
855
  </div>
856
 
857
+ <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;'; ?>">
858
+ <div class="max-input" style="margin: 8px 0;">
859
+ <span style="display: table-cell;">
860
  Insert for
861
+ <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">
862
  <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>
863
  <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>
864
  <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>
865
  <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>
866
  </select>
867
  </span>
868
+ <span style="display: table-cell;">
869
+ 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
870
  </span>
871
+ <span style="display: table-cell;">
 
872
  General tag
 
873
  </span>
874
  <span style="display: table-cell;">
875
+ <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" />
876
  </span>
877
  </div>
878
 
882
  Filter insertions
883
  </span>
884
  <span style="display: table-cell;">
885
+ <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" />
886
  </span>
887
  <span style="display: table-cell;">
888
  &nbsp;&nbsp;&nbsp;using
889
+ <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">
890
+ <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>
891
+ <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>
892
+ <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>
893
+ <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>
894
+ <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>
895
+ <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>
896
+ <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>
897
+ <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>
898
+ <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>
 
 
899
  </select>
900
  counter
901
  </span>
902
  <span style="display: table-cell;">
903
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
904
+ <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 '; ?> />
905
+ <label for="enable-ajax-<?php echo $ad_number; ?>" title="Enable or disable insertion in Ajax requests">Ajax</label>
906
+ </span>
907
+ <span style="display: table-cell;">
908
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
909
+ <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 '; ?> />
910
+ <label for="enable-feed-<?php echo $ad_number; ?>" title="Enable or disable insertion in feeds">Feed</label>
911
+ </span>
912
+ <span style="display: table-cell;">
913
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
914
+ <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 '; ?> />
915
+ <label for="enable-404-<?php echo $ad_number; ?>" title="Enable or disable insertion on page for Error 404: Page not found">404</label>
916
  </span>
917
  </div>
918
  </div>
919
 
920
+ <div style="margin: 8px 0;">
921
+ <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(); ?>">
922
  <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>
923
  <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>
924
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
925
  </select>
926
 
927
  <span id="scheduling-delay-<?php echo $ad_number; ?>">
928
+ 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
929
  </span>
930
  <span id="scheduling-delay-warning-<?php echo $ad_number; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
931
 
932
  <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($ad_number, $obj, $default); ?>
933
  </div>
934
 
 
935
  </div>
936
 
937
+ <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;'; ?>">
938
  <table>
939
  <tr>
940
  <td>
941
  <div style="margin-bottom: 5px;">
942
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
943
+ <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 '; ?> />
944
  <label for="client-side-detection-<?php echo $ad_number; ?>">Use client-side detection to show only on:</label>
945
  </div>
946
 
952
  if ($viewport_name != '') {
953
  ?>
954
  <div style="margin: 8px 0;">
955
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
956
+ <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 '; ?> />
957
  <label for="viewport-<?php echo $viewport, "-", $ad_number; ?>" title="Device min width <?php echo get_viewport_width ($viewport); ?> px"><?php echo $viewport_name; ?></label>
958
  </div>
959
  <?php
962
  ?>
963
  </div>
964
  </td><td style="padding-left: 40px; vertical-align: top;">
965
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
966
+ <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 '; ?> />
967
  <label for="server-side-detection-<?php echo $ad_number; ?>">Use server-side detection to insert code only for </label>
968
 
969
  <div style="margin: 10px 0 10px 40px;">
970
+ <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">
971
  <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>
972
  <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>
973
  <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>
982
  </table>
983
  </div>
984
 
985
+ <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;">
986
  <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>
987
  </div>
988
 
993
  ?>
994
  <div id="tab-0" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
995
  <div style="margin: 16px 0 16px 4px;">
996
+ <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]), '.',
997
+ (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
998
+ (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]); ?></h3>
999
+ <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>
1000
  <div style="clear: both;"></div>
1001
  </div>
1002
 
1003
  <div style="margin: 16px 0;">
1004
  <div style="float: right;">
1005
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1006
+ <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;" />
1007
  </div>
1008
 
1009
  <div style="float: left; color: red;">
1010
+ <input onclick="if (confirm('Are you sure you want to reset all settings?')) return true; return false" name="<?php echo AI_FORM_CLEAR; ?>" value="Reset All Settings" type="submit" style="display: none; width:120px; font-weight: bold; color: #e44;" />
1011
  </div>
1012
 
1013
  <div style="clear: both;"></div>
1018
 
1019
  if ($enabled_h) $style_h = "font-weight: bold; color: #66f;"; else $style_h = "";
1020
  if ($enabled_f) $style_f = "font-weight: bold; color: #66f;"; else $style_f = "";
 
 
 
 
1021
  if (false) $style_d = "font-weight: bold; color: #e44;"; else $style_d = "";
1022
  ?>
1023
 
1028
  <li id="ai-h" class="ai-plugin-tab"><a href="#tab-header"><span style="<?php echo $style_h ?>">Header</span></a></li>
1029
  <li id="ai-f" class="ai-plugin-tab"><a href="#tab-footer"><span style="<?php echo $style_f ?>">Footer</span></a></li>
1030
  <?php if (function_exists ('ai_plugin_settings_tab')) ai_plugin_settings_tab ($exceptions); ?>
 
 
 
1031
  <li id="ai-d" class="ai-plugin-tab"><a href="#tab-debugging"><span style="<?php echo $style_d ?>">Debugging</span></a></li>
1032
  </ul>
1033
 
1034
+ <div id="tab-general" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1035
 
1036
+ <table style="width: 100%;">
1037
  <?php if (function_exists ('ai_general_settings')) ai_general_settings (); ?>
1038
  <tr>
1039
+ <td style="padding-left: 10px;">
1040
  Syntax Highlighter Theme
1041
  </td>
1042
  <td>
1043
  <select
1044
+ style="border-radius: 5px; width:220px"
1045
  id="syntax-highlighter-theme"
1046
  name="syntax-highlighter-theme"
1047
  value="Value">
1088
  </td>
1089
  </tr>
1090
  <tr>
1091
+ <td style="padding-left: 10px;">
1092
  Block Class Name
1093
  </td>
1094
  <td>
1095
+ <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; ?>" size="15" maxlength="40" />
1096
  </td>
1097
  </tr>
1098
  <tr>
1099
+ <td style="padding: 0 10px;">
1100
  Minimum User Role for Exceptions Editing
1101
  </td>
1102
  <td>
1103
+ <select style="border-radius: 5px; margin-bottom: 3px;" id="minimum-user-role" name="minimum-user-role" selected-value="1" style="width:300px">
1104
  <?php wp_dropdown_roles (get_minimum_user_role ()); ?>
1105
  </select>
1106
  </td>
1107
  </tr>
1108
  <tr>
1109
+ <td style="padding-left: 10px;">
1110
  Dynamic blocks
1111
  </td>
1112
  <td>
1113
+ <select style="border-radius: 5px; margin-bottom: 3px;" id="dynamic_blocks" name="dynamic_blocks">
1114
  <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>
1115
  <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>
1116
  <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>
1118
  </td>
1119
  </tr>
1120
  <tr>
1121
+ <td style="padding-left: 10px;">
1122
  Functions for Paragraph Counting
1123
  </td>
1124
  <td>
1125
+ <select style="border-radius: 5px; margin-bottom: 3px;" id="paragraph_counting_functions" name="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.">
1126
  <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>
1127
  <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>
1128
  </select>
1129
  </td>
1130
  </tr>
1131
  <tr>
1132
+ <td style="padding-left: 10px;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1133
  Plugin priority
1134
  </td>
1135
  <td>
1136
+ <input style="border-radius: 5px;" type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" size="6" maxlength="6" />
1137
  </td>
1138
  </tr>
1139
  </table>
1140
  </div>
1141
 
1142
+ <div id="tab-viewports" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1143
+ <div style="margin: 8px;">
1144
  Viewport Settings used for client-side device detection
1145
  </div>
1146
  <?php
1147
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
 
1148
  ?>
1149
+ <div style="margin: 8px;">
1150
  Viewport <?php echo $viewport; ?> name&nbsp;&nbsp;&nbsp;
1151
+ <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); ?>" size="15" maxlength="40" />
1152
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '<span style="display: none;">' ?>
1153
  &nbsp;&nbsp; min width
1154
+ <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); ?>" size="4" maxlength="4" /> px
1155
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '</span>' ?>
1156
  </div>
1157
  <?php
1168
  <?php endif; ?>
1169
 
1170
  <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" value="0" />
1171
+ <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" id="enable-header" value="1" <?php if ($adH->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1172
  <label class="checkbox-button" style="margin-left: 10px;" for="enable-header" title="Enable or disable insertion of this code into HTML page header"><span class="checkbox-icon icon-enabled<?php if ($adH->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1173
 
1174
  <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="0" />
1175
+ <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="1" id="process-php-h" <?php if ($adH->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1176
  <label class="checkbox-button" style="margin-left: 10px;" for="process-php-h" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adH->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1177
  </div>
1178
 
1193
  <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>
1194
  </div>
1195
 
1196
+ <div id="device-detection-settings-h" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1197
+ <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" />
1198
+ <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" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1199
  <label for="server-side-detection-h">Use server-side detection to insert code only for </label>
1200
+ <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; ?>" >
1201
  <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>
1202
  <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>
1203
  <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>
1207
  </select>
1208
  devices
1209
 
1210
+ <span style="float: right; margin-top: 6px;">
1211
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
1212
+ <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" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1213
  <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>
1214
  </span>
1215
  </div>
1224
  <?php endif; ?>
1225
 
1226
  <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" value="0" />
1227
+ <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" id="enable-footer" value="1" <?php if ($adF->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1228
  <label class="checkbox-button" style="margin-left: 10px;" for="enable-footer" title="Enable or disable insertion of this code into HTML page footer"><span class="checkbox-icon icon-enabled<?php if ($adF->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1229
 
1230
  <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="0" />
1231
+ <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="1" id="process-php-f" <?php if ($adF->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1232
  <label class="checkbox-button" style="margin-left: 10px;" for="process-php-f" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adF->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1233
  </div>
1234
 
1249
  <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>
1250
  </div>
1251
 
1252
+ <div id="device-detection-settings-f" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1253
+ <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" />
1254
+ <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" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1255
  <label for="server-side-detection-f">Use server-side detection to insert code only for </label>
1256
+ <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; ?>" >
1257
  <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>
1258
  <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>
1259
  <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>
1263
  </select>
1264
  devices
1265
 
1266
+ <span style="float: right; margin-top: 6px;">
1267
+ <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
1268
+ <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" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1269
  <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>
1270
  </span>
1271
  </div>
1273
 
1274
  <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
1275
 
1276
+ <div id="tab-debugging" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1277
+ <div style="margin: 8px;">
1278
+ <input style="border-radius: 5px;" type="hidden" name="admin_toolbar_debugging" value="0" />
1279
+ <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 '; ?> />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1280
  <label for="admin-toolbar-debugging" title="Enable or disable debugging functions in admin toolbar">Debugging functions in admin toolbar</label>
1281
  </div>
1282
 
1283
+ <div style="margin: 8px;">
1284
+ <input style="border-radius: 5px;" type="hidden" name="remote_debugging" value="0" />
1285
+ <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 '; ?> />
1286
  <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>
1287
  </div>
1288
 
1289
  <div id="system-debugging" style="display: none;">
1290
+ <div style="margin: 8px;">
1291
+ <input style="border-radius: 5px;" type="hidden" name="javascript_debugging" value="0" />
1292
+ <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 '; ?> />
1293
  <label for="javascript-debugging" title="Enable Javascript console output">Javascript debugging</label>
1294
  </div>
1295
 
1304
 
1305
  <?php if (!function_exists ('ai_settings_side')) { ?>
1306
 
1307
+ <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1308
  <div style="float: left;">
1309
+ <h2 style="display: inline-block; margin: 13px 0;">Looking for AdSense alternative?</h2>
1310
  </div>
1311
  <div style="clear: both;"></div>
1312
  </div>
1313
 
1314
+ <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;">
1315
+ <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; ?>media.net_728x90.gif" /></a>
1316
  </div>
1317
 
 
 
 
 
 
 
 
1318
  <?php } ?>
1319
 
1320
+ <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="<?php echo $active_tab; ?>" />
1321
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
1322
 
1323
  </form>
1329
  <?php
1330
  if ($subpage == 'main') {
1331
  if (function_exists ('ai_settings_side')) ai_settings_side (); else { ?>
1332
+ <div style="float: left;">
1333
+ <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1334
  <div style="float: left;">
1335
+ <h2 style="display: inline-block; margin: 13px 0;">Follow Ad Inserter</h2>
1336
+ <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>
1337
+ <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>
1338
  </div>
1339
+
1340
+ <div id="header-buttons">
1341
+ <a style="text-decoration: none; box-shadow: 0 0 0;" href="http://adinserter.pro/" target="_blank"><button type="button" style="display: none; margin: 0 10px 0 0; width: 62px;">Go&nbsp;Pro</button></a>
 
 
 
1342
  </div>
1343
 
1344
  <div style="clear: both;"></div>
1345
  </div>
1346
 
 
 
 
 
 
 
 
1347
 
1348
+ <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;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1349
  <div style="float: right;" >
1350
  <div>
1351
+ <a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" title="Automate ad placement in posts and pages" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>
1352
  </div>
1353
  <div>
1354
+ <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; ?>media.net_250x250_2.jpg" style="margin-top: 10px;" /></a>
 
1355
  </div>
1356
  </div>
1357
 
1358
+ <h3 style="text-align: justify;"><a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Ad Inserter Pro</a> features:</h3>
 
1359
 
1360
  <ul>
1361
+ <li><strong>&squf;</strong> 64 code blocks</li>
1362
  <li><strong>&squf;</strong> Syntax highlighting editor</li>
1363
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
1364
  <li><strong>&squf;</strong> Automatic insertion before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
1365
  <li><strong>&squf;</strong> Automatic insertion between posts on blog pages</li>
 
1366
  <li><strong>&squf;</strong> Insertion exceptions for posts and pages</li>
1367
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#manual" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
1368
+ <li><strong>&squf;</strong> Sticky positions (ads do not move when the page scrolls)</li>
1369
+ <li><strong>&squf;</strong> Block alignment and style customizations</li>
1370
+ <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers</li>
 
1371
  <li><strong>&squf;</strong> Options to disable insertion on Ajax calls, 404 error pages or in feeds</li>
1372
  <li><strong>&squf;</strong> Ad rotation (works also with caching)</li>
1373
+ <li><strong>&squf;</strong> Support for <a href="http://adinserter.pro/settings#amp" class="simple-link" target="_blank">AMP pages</a></li>
 
 
 
1374
  <li><strong>&squf;</strong> Custom CSS class name for wrapping divs to avoid ad blockers</li>
1375
  <li><strong>&squf;</strong> PHP code processing</li>
1376
  <li><strong>&squf;</strong> Support for <a href="http://adinserter.pro/documentation#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
 
1377
  <li><strong>&squf;</strong> Desktop, tablet and phone server-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a></li>
1378
  <li><strong>&squf;</strong> Client-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a> (works with caching, 6 custom viewports)</li>
1379
+ <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#lists" class="simple-link" target="_blank">Black/White-list</a> categories, tags, post IDs, urls, referers</li>
1380
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#lists" class="simple-link" target="_blank">Black/White-list</a> IP addresses or countries (works also with caching)</li>
1381
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#multisite" class="simple-link" target="_blank">Multisite options</a> to limit settings on the sites</li>
1382
  <li><strong>&squf;</strong> Import/Export block or plugin settings</li>
1386
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
1387
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
1388
  <li><strong>&squf;</strong> <a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
 
1389
  </ul>
1390
 
1391
+ <p style="text-align: justify;">With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, GEO targeting or multisite support
1392
+ then you can simply upgrade to <a href="http://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
 
1393
  </div>
1394
 
1395
  </div>
1397
  }
1398
  }
1399
  ?>
 
1400
  <script type="text/javascript">
1401
+ // setTimeout (show_blocked_warning, 4000);
1402
+
1403
  jQuery(document).ready(function($) {
1404
+ setTimeout (show_blocked_warning, 400);
1405
  });
1406
 
1407
+ function show_blocked_warning () {
 
 
 
 
 
 
 
 
 
 
 
1408
  jQuery("#blocked-warning.warning-enabled").show ();
1409
  jQuery("#blocked-warning.warning-enabled .blocked-warning-text").css ('color', '#00f');
1410
 
1411
+ var image = jQuery("#pro-image");
1412
+ if (image.height () < 100) {
1413
+ 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'));
1414
  }
 
 
 
 
 
 
 
1415
  }
1416
  </script>
1417