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

Version Description

  • Fix for Fatal error: Can't use method return value in write context
Download this release

Release Info

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

Code changes from version 2.1.10 to 2.1.13

ad-inserter.php CHANGED
@@ -1,16 +1,40 @@
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
- Version: 2.1.10
5
- Description: Ad management plugin with powerful 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
  Change Log
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  Ad Inserter 2.1.10 - 2017-07-01
15
  - Fix for shifted sidebars in some themes
16
 
@@ -390,13 +414,14 @@ if (version_compare ($wp_version, "4.0", "<")) {
390
  exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
391
  }
392
 
393
- 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;
394
 
395
  //include required files
396
  require_once AD_INSERTER_PLUGIN_DIR.'class.php';
397
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
398
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
399
  require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
 
400
 
401
  if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
402
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
@@ -412,7 +437,7 @@ foreach ($version_array as $number) {
412
  }
413
 
414
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
415
- $ai_wp_data [AI_WP_URL] = remove_parameters_from_url ($_SERVER ['REQUEST_URI']);
416
 
417
  if (!is_admin()) {
418
  if (!isset ($_GET [AI_URL_DEBUG]))
@@ -432,6 +457,7 @@ if (!is_admin()) {
432
 
433
  $ad_inserter_globals = array ();
434
  $block_object = array ();
 
435
 
436
  ai_load_settings ();
437
 
@@ -442,6 +468,29 @@ if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
442
  }
443
  }
444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  if (function_exists ('ai_load_globals')) ai_load_globals ();
446
 
447
  if (get_dynamic_blocks ()) {
@@ -459,7 +508,8 @@ if (get_dynamic_blocks ()) {
459
  }
460
 
461
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
462
- $ai_wp_data [AI_WP_USER] = AI_USER_NOT_SET;
 
463
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
464
  $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
465
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
@@ -480,7 +530,6 @@ $adF = $block_object [AI_FOOTER_OPTION_NAME];
480
  if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
481
  if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
482
 
483
-
484
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
485
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
486
 
@@ -508,11 +557,12 @@ add_action ('admin_notices', 'ai_admin_notice_hook');
508
 
509
  add_action ('wp', 'ai_wp_hook');
510
 
511
- if ($adH->get_enable_manual () ||
512
- $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
513
- get_remote_debugging () ||
514
- ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0)
515
- add_action ('wp_head', 'ai_wp_head_hook');
 
516
 
517
  //if ($adF->get_enable_manual () ||
518
  // $ai_wp_data [AI_TRACKING] ||
@@ -525,7 +575,6 @@ if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_ou
525
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output)
526
  add_action ('shutdown', 'ai_shutdown_hook');
527
 
528
- add_action ('get_sidebar', 'ai_get_sidebar');
529
  add_action ('widgets_init', 'ai_widgets_init_hook');
530
  add_action ('add_meta_boxes', 'ai_add_meta_box_hook');
531
  add_action ('save_post', 'ai_save_meta_box_data_hook');
@@ -537,6 +586,10 @@ add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 10, 2);
537
  add_action ('wp_ajax_ai_data', 'ai_data');
538
  add_action ('wp_ajax_nopriv_ai_data', 'ai_data');
539
 
 
 
 
 
540
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
541
  $ai_total_plugin_time += microtime (true) - $start_time;
542
  ai_log ("INITIALIZATION END\n");
@@ -562,11 +615,14 @@ function ai_toolbar ($wp_admin_bar) {
562
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) $debug_no_insertion = 1; else $debug_no_insertion = 0;
563
  $debug_no_insertion_class = $debug_no_insertion == 0 ? ' on' : '';
564
 
565
- $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0;
 
 
 
566
 
567
  $debug_settings_class = $debug_settings_on ? ' on' : '';
568
- $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_parameters_from_url ($_SERVER ['REQUEST_URI'])) :
569
- 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']));
570
 
571
  $wp_admin_bar->add_node (array (
572
  'id' => 'ai-toolbar',
@@ -574,7 +630,7 @@ function ai_toolbar ($wp_admin_bar) {
574
  ));
575
  $wp_admin_bar->add_node (array (
576
  'id' => 'ai-toolbar-settings',
577
- 'parent' => 'ai-toolbar',
578
  'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME,
579
  'href' => $top_menu_url,
580
  ));
@@ -645,7 +701,7 @@ function ai_toolbar ($wp_admin_bar) {
645
  ($paragraph_block ['min'] != 0 ? ' min '.$paragraph_block ['min']. ' ' : '').
646
  ($paragraph_block ['max'] != 0 ? ' max '.$paragraph_block ['max']. ' ' : '').
647
  ($paragraph_block ['blockquote'] ? ' [blockquote] ' : '').
648
- ($paragraph_block ['text'] != '' ? ($paragraph_block ['text_type'] == AD_DO_NOT_CONTAIN ? ' NC ' : ' C ').' ['.$paragraph_block ['text'].']' : ''),
649
  'href' => set_url_parameter (AI_URL_DEBUG_POSITIONS, $paragraph_block ['blocks'][0]),
650
  ));
651
  }
@@ -662,6 +718,14 @@ function ai_toolbar ($wp_admin_bar) {
662
  'title' => '<span class="ab-icon'.$debug_no_insertion_class.'"></span>Disable Insertion',
663
  'href' => set_url_parameter (AI_URL_DEBUG_NO_INSERTION, $debug_no_insertion),
664
  ));
 
 
 
 
 
 
 
 
665
  $wp_admin_bar->add_node (array (
666
  'id' => 'ai-toolbar-processing',
667
  'parent' => 'ai-toolbar-settings',
@@ -673,14 +737,16 @@ function ai_toolbar ($wp_admin_bar) {
673
  function set_user () {
674
  global $ai_wp_data;
675
 
676
- if ($ai_wp_data [AI_WP_USER] != AI_USER_NOT_SET) return;
677
 
678
- $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
679
 
680
  if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
681
  if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
682
 
683
  // if (isset ($_GET [AI_URL_DEBUG_USER]) && $_GET [AI_URL_DEBUG_USER] != 0) $ai_wp_data [AI_WP_USER] = $_GET [AI_URL_DEBUG_USER];
 
 
684
  }
685
 
686
  function set_page_type () {
@@ -689,14 +755,14 @@ function set_page_type () {
689
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_NONE) return;
690
 
691
  if (is_admin()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ADMIN;
692
- elseif (is_feed()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_FEED;
693
- elseif (is_404()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_404;
694
- elseif (is_front_page ()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_HOMEPAGE;
695
- elseif (is_page()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_STATIC;
696
- elseif (is_single()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_POST;
697
- elseif (is_category()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_CATEGORY;
698
- elseif (is_search()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_SEARCH;
699
- elseif (is_archive()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ARCHIVE;
700
  }
701
 
702
  function ai_log_message ($message) {
@@ -715,13 +781,13 @@ function ai_log_content (&$content) {
715
  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).']');
716
  }
717
 
718
- function ai_log_block_status ($block, $ai_last_check) {
719
  global $block_object;
720
 
721
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) $block = 0;
722
 
723
- if ($ai_last_check == AI_CHECK_INSERTED) return "BLOCK $block INSERTED";
724
- $status = "BLOCK $block FAILED CHECK: ";
725
  $obj = $block_object [$block];
726
  switch ($ai_last_check) {
727
  case AI_CHECK_PAGE_TYPE_FRONT_PAGE: $status .= "ENABLED ON HOMEPAGE"; break;
@@ -743,6 +809,7 @@ function ai_log_block_status ($block, $ai_last_check) {
743
 
744
  case AI_CHECK_CATEGORY: $status .= "CATEGORY"; break;
745
  case AI_CHECK_TAG: $status .= "TAG"; break;
 
746
  case AI_CHECK_ID: $status .= "ID"; break;
747
  case AI_CHECK_URL: $status .= "URL"; break;
748
  case AI_CHECK_URL_PARAMETER: $status .= "URL PARAMETER"; break;
@@ -760,7 +827,7 @@ function ai_log_block_status ($block, $ai_last_check) {
760
  case AI_CHECK_DISABLED_MANUALLY: $status .= "DISABLED BY HTML COMMENT"; break;
761
 
762
  case AI_CHECK_MAX_INSERTIONS: $status .= "MAX INSERTIONS " . $obj->get_maximum_insertions (); break;
763
- case AI_CHECK_FILTER: $status .= "FILTER " . $obj->get_call_filter(); break;
764
  case AI_CHECK_PARAGRAPH_COUNTING: $status .= "PARAGRAPH COUNTING"; break;
765
  case AI_CHECK_MIN_NUMBER_OF_WORDS: $status .= "MIN NUMBER OF WORDS " . intval ($obj->get_minimum_words()); break;
766
  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;
@@ -787,6 +854,17 @@ function ai_log_block_status ($block, $ai_last_check) {
787
  return $status;
788
  }
789
 
 
 
 
 
 
 
 
 
 
 
 
790
  function ai_log ($message = "") {
791
  global $ai_last_time, $ai_processing_log;
792
 
@@ -799,45 +877,17 @@ function ai_log ($message = "") {
799
  $ai_last_time = microtime (true);
800
  }
801
 
802
- function remove_parameters_from_url ($url, $parameter = '') {
803
- if ($parameter == '')
804
- $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
805
- $parameters = array ($parameter);
806
-
807
- foreach ($parameters as $parameter) {
808
- if (stripos ($url, '?'.$parameter.'=') !== false) {
809
- $url = preg_replace ("/".$parameter."=[^&]*/", "", $url);
810
- $url = rtrim (str_replace ('?&', '?', $url), "?");
811
- }
812
- elseif (stripos ($url, "&".$parameter."=") !== false)
813
- $url = preg_replace ("/&".$parameter."=[^&]*/", "", $url);
814
- }
815
 
816
- return $url;
817
- }
818
-
819
- function current_url () {
820
- if (isset ($_SERVER ["HTTPS"]) && $_SERVER ["HTTPS"] == "on")
821
- $url = "https://"; else
822
- $url = "http://";
823
- $url .= $_SERVER ['SERVER_NAME'];
824
- if($_SERVER['SERVER_PORT'] != 80)
825
- $url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
826
- $url .= $_SERVER["REQUEST_URI"];
827
- return $url;
828
  }
829
 
830
  function set_url_parameter ($parameter, $value) {
831
- $url = remove_parameters_from_url (current_url ());
832
-
833
- if (stripos ($url, $parameter) !== false) {
834
- $url = preg_replace ("/($parameter=[^&]*)/", $parameter .'=' . $value, $url);
835
- } else {
836
- if (strpos ($url, '?') !== false)
837
- $url .= '&' . $parameter .'=' . $value; else
838
- $url .= '?' . $parameter .'=' . $value;
839
- }
840
- return $url;
841
  }
842
 
843
  function number_of_words (&$content) {
@@ -849,7 +899,7 @@ function number_of_words (&$content) {
849
  }
850
 
851
  function ai_wp_hook () {
852
- global $ai_wp_data, $ai_db_options_extract, $ai_total_plugin_time;
853
 
854
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
855
  ai_log ("WP HOOK START");
@@ -863,7 +913,7 @@ function ai_wp_hook () {
863
  ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 &&
864
  get_admin_toolbar_debugging () &&
865
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
866
- add_action ('admin_bar_menu', 'ai_toolbar', 20);
867
 
868
  $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
869
 
@@ -890,6 +940,9 @@ function ai_wp_hook () {
890
  if (isset ($_GET [AI_URL_DEBUG_NO_INSERTION]))
891
  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;
892
 
 
 
 
893
  if (isset ($_GET [AI_URL_DEBUG_POSITIONS])) {
894
  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;
895
  if (is_numeric ($_GET [AI_URL_DEBUG_POSITIONS])) $ai_wp_data [AI_WP_DEBUG_BLOCK] = intval ($_GET [AI_URL_DEBUG_POSITIONS]);
@@ -926,6 +979,16 @@ function ai_wp_hook () {
926
  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)
927
  add_action ('the_post', 'ai_post_hook');
928
 
 
 
 
 
 
 
 
 
 
 
929
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
930
  $ai_total_plugin_time += microtime (true) - $start_time;
931
  ai_log ("WP HOOK END\n");
@@ -957,6 +1020,7 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
957
  global $ai_settings_page;
958
 
959
  if ($hook_suffix == $ai_settings_page) {
 
960
  wp_enqueue_script ('ai-admin-js', plugins_url ('js/ad-inserter.js', __FILE__), array (
961
  'jquery',
962
  'jquery-ui-tabs',
@@ -982,6 +1046,9 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
982
  if (AI_SYNTAX_HIGHLIGHTING) {
983
  wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
984
  wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
 
 
 
985
  }
986
  }
987
  }
@@ -1026,6 +1093,9 @@ function add_head_inline_styles_and_scripts () {
1026
  #wp-admin-bar-ai-toolbar-no-insertion .ab-icon:before {
1027
  content: '\\f214';
1028
  }
 
 
 
1029
  #wp-admin-bar-ai-toolbar-processing .ab-icon:before {
1030
  content: '\\f464';
1031
  }
@@ -1041,10 +1111,374 @@ function add_head_inline_styles_and_scripts () {
1041
  }
1042
  }
1043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1044
  function add_footer_inline_scripts () {
1045
- global $ai_wp_data;
1046
 
1047
- $inline_scripts = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE || $ai_wp_data [AI_TRACKING] || $ai_wp_data [AI_STICKY_WIDGETS];
 
 
 
 
 
 
 
 
 
 
 
 
1048
 
1049
  if ($inline_scripts) echo "<script type='text/javascript'>\n";
1050
 
@@ -1087,20 +1521,41 @@ if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(atob(wrappin
1087
 
1088
  // echo 'jQuery(document).ready(function($) {
1089
  // var sticky_widget_margin = ', get_sticky_widget_margin (), ';
1090
- // $("span.ai-sidebar").each (function () {
1091
- // var sidebar = $(this).next ();
1092
- // var widget = sidebar.find ("div.ai-sticky").first ();
1093
- // if (widget.length == 1) {
1094
- // sidebar.css ("position", "sticky").css ("top", sidebar.offset ().top - widget.offset ().top + sticky_widget_margin);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
  // }
1096
  // });
1097
  // });
1098
  //';
1099
 
1100
- echo 'jQuery(document).ready(function($){var sticky_widget_margin=', get_sticky_widget_margin (), ';$("span.ai-sidebar").each(function(){var sidebar=$(this).next();var widget=sidebar.find("div.ai-sticky").first();if(widget.length==1)sidebar.css("position","sticky").css("top",sidebar.offset().top-widget.offset().top+sticky_widget_margin)})});';
 
1101
 
1102
  }
1103
 
 
 
 
 
 
 
1104
  if (function_exists ('add_footer_inline_scripts_2')) {
1105
  add_footer_inline_scripts_2 ();
1106
  }
@@ -1341,15 +1796,49 @@ function ai_save_meta_box_data_hook ($post_id) {
1341
  update_post_meta ($post_id, '_adinserter_block_exceptions', implode (",", $selected));
1342
  }
1343
 
1344
- function ai_get_sidebar ($name) {
1345
- echo "<span class='ai-sidebar'></span>\n";
1346
- }
1347
-
1348
  function ai_widgets_init_hook () {
1349
  if (is_multisite() && !is_main_site () && !multisite_widgets_enabled ()) return;
1350
  register_widget ('ai_widget');
1351
  }
1352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1353
  function ai_wp_head_hook () {
1354
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
1355
 
@@ -1369,7 +1858,15 @@ function ai_wp_head_hook () {
1369
 
1370
  if ($obj->get_enable_manual ()) {
1371
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1372
- echo $obj->ai_getCode ();
 
 
 
 
 
 
 
 
1373
  }
1374
 
1375
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -1386,7 +1883,9 @@ function ai_wp_footer_hook () {
1386
  $start_time = microtime (true);
1387
  }
1388
 
1389
- add_footer_inline_scripts ();
 
 
1390
 
1391
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
1392
 
@@ -1397,7 +1896,11 @@ function ai_wp_footer_hook () {
1397
 
1398
  if ($obj->get_enable_manual ()) {
1399
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1400
- echo $obj->ai_getCode ();
 
 
 
 
1401
  }
1402
 
1403
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -1407,7 +1910,7 @@ function ai_wp_footer_hook () {
1407
  }
1408
 
1409
  function ai_write_debug_info ($write_processing_log = false) {
1410
- 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;
1411
 
1412
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
1413
  if (function_exists ('ai_debug_header')) ai_debug_header ();
@@ -1419,14 +1922,14 @@ function ai_write_debug_info ($write_processing_log = false) {
1419
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
1420
 
1421
  echo "SETTINGS: ";
1422
- if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']))
1423
- echo (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][0].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][1]), '.',
1424
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
1425
- (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]);
1426
 
1427
  echo "\n";
1428
  echo "SETTINGS TIMESTAMP: ";
1429
- 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";
1430
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
1431
  if (is_multisite()) {
1432
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
@@ -1448,26 +1951,47 @@ function ai_write_debug_info ($write_processing_log = false) {
1448
  case AI_PT_ARCHIVE: echo "ARCHIVE PAGE"; break;
1449
  case AI_PT_SEARCH: echo "SEARCH PAGE"; break;
1450
  case AI_PT_404: echo "404 PAGE"; break;
 
1451
  case AI_PT_FEED: echo "FEED"; break;
 
 
 
1452
  default: echo "?"; break;
1453
  }
1454
  echo "\n";
1455
- echo 'POST TYPE: ', get_post_type (), "\n";
1456
- $category_data = get_the_category();
1457
- $categories = array ();
1458
- foreach ($category_data as $category) {
1459
- $categories []= $category->slug;
1460
- }
1461
- echo 'CATEGORIES: ', implode (', ', $categories), "\n";
1462
- $tag_data = wp_get_post_tags (get_the_ID());
1463
- $tags = array ();
1464
- foreach ($tag_data as $tag) {
1465
- $tags []= $tag->slug;
1466
- }
1467
- echo 'TAGS: ', implode (', ', $tags), "\n";
1468
- echo 'ID: ', get_the_ID(), "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
1470
- echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
1471
  if (function_exists ('ai_debug')) ai_debug ();
1472
  echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
1473
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
@@ -1515,6 +2039,32 @@ function ai_write_debug_info ($write_processing_log = false) {
1515
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
1516
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
1517
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1518
 
1519
  echo "\n";
1520
 
@@ -1532,7 +2082,7 @@ function ai_write_debug_info ($write_processing_log = false) {
1532
  foreach (array_keys ($default->wp_options) as $key){
1533
  switch ($key) {
1534
  case AI_OPTION_CODE:
1535
- case AI_OPTION_NAME:
1536
  continue 2;
1537
  case AI_OPTION_DISPLAY_ON_PAGES:
1538
  case AI_OPTION_DISPLAY_ON_POSTS:
@@ -1564,6 +2114,9 @@ function ai_write_debug_info ($write_processing_log = false) {
1564
  $settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
1565
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1566
  break;
 
 
 
1567
  default:
1568
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
1569
  break;
@@ -1650,19 +2203,31 @@ function ai_write_debug_info ($write_processing_log = false) {
1650
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][AI_PT_ANY]), "\n";
1651
  if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]))
1652
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]), "\n";
 
 
 
 
 
 
1653
 
1654
 
1655
- echo "\nPAGE TYPE BLOCKS\n";
1656
- if (count ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1657
  echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1658
- if (count ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1659
  echo "EXCERPT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1660
- if (count ($ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1661
  echo "LOOP START HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1662
- if (count ($ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1663
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
1664
- if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
1665
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
 
 
 
 
 
 
1666
 
1667
  if ($write_processing_log) {
1668
  echo "\nTIME EVENT\n";
@@ -1672,7 +2237,25 @@ function ai_write_debug_info ($write_processing_log = false) {
1672
  echo $log_line, "\n";
1673
  }
1674
 
 
 
 
 
 
 
 
 
1675
  echo "PHP: ", phpversion(), "\n";
 
 
 
 
 
 
 
 
 
 
1676
  global $wp_version;
1677
  echo "Wordpress: ", $wp_version, "\n";
1678
  $current_theme = wp_get_theme();
@@ -1691,6 +2274,8 @@ function ai_write_debug_info ($write_processing_log = false) {
1691
  echo in_array ($plugin_path, $active_plugins) ? '* ' : ' ', html_entity_decode ($plugin ["Name"]), ' ', $plugin ["Version"], "\n";
1692
  }
1693
  }
 
 
1694
  }
1695
 
1696
  function ai_shutdown_hook () {
@@ -1704,7 +2289,10 @@ function ai_shutdown_hook () {
1704
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST ||
1705
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_CATEGORY ||
1706
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_SEARCH ||
1707
- $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ARCHIVE) {
 
 
 
1708
  echo "\n<!--\n\n";
1709
  ai_write_debug_info (true);
1710
  echo "\n-->\n";
@@ -1763,6 +2351,16 @@ function ai_check_plugin_options ($plugin_options = array ()) {
1763
 
1764
  if (!isset ($plugin_options ['DYNAMIC_BLOCKS'])) $plugin_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
1765
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
 
 
 
 
 
 
 
 
 
 
1766
  if (!isset ($plugin_options ['ADMIN_TOOLBAR_DEBUGGING'])) $plugin_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
1767
  if (!isset ($plugin_options ['REMOTE_DEBUGGING'])) $plugin_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
1768
  if (!isset ($plugin_options ['JAVASCRIPT_DEBUGGING'])) $plugin_options ['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
@@ -1837,15 +2435,15 @@ function ai_load_options () {
1837
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD OPTIONS START");
1838
 
1839
  if (is_multisite()) {
1840
- $ai_db_options_multisite = get_site_option (WP_OPTION_NAME);
1841
  option_stripslashes ($ai_db_options_multisite);
1842
  }
1843
 
1844
  if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
1845
- $ai_db_options = get_blog_option (BLOG_ID_CURRENT_SITE, WP_OPTION_NAME);
1846
  option_stripslashes ($ai_db_options);
1847
  } else {
1848
- $ai_db_options = get_option (WP_OPTION_NAME);
1849
  option_stripslashes ($ai_db_options);
1850
  }
1851
 
@@ -1855,127 +2453,135 @@ function ai_load_options () {
1855
  function get_viewport_css () {
1856
  global $ai_db_options;
1857
 
1858
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'] = generate_viewport_css ();
1859
 
1860
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS']);
1861
  }
1862
 
1863
  function get_syntax_highlighter_theme () {
1864
  global $ai_db_options;
1865
 
1866
- 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;
1867
 
1868
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME']);
1869
  }
1870
 
1871
  function get_block_class_name () {
1872
  global $ai_db_options;
1873
 
1874
- 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;
1875
 
1876
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME']);
1877
  }
1878
 
1879
  function get_minimum_user_role () {
1880
  global $ai_db_options;
1881
 
1882
- 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;
1883
 
1884
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE']);
1885
  }
1886
 
1887
  function get_sticky_widget_margin () {
1888
  global $ai_db_options;
1889
 
1890
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN'] = DEFAULT_STICKY_WIDGET_MARGIN;
1891
 
1892
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['STICKY_WIDGET_MARGIN']);
1893
  }
1894
 
1895
  function get_plugin_priority () {
1896
  global $ai_db_options;
1897
 
1898
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
1899
 
1900
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY']);
1901
  }
1902
 
1903
  function get_dynamic_blocks(){
1904
  global $ai_db_options;
1905
 
1906
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
1907
 
1908
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS']);
1909
  }
1910
 
1911
  function get_paragraph_counting_functions(){
1912
  global $ai_db_options;
1913
 
1914
- 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;
 
 
 
 
 
 
 
 
1915
 
1916
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PARAGRAPH_COUNTING_FUNCTIONS']);
1917
  }
1918
 
1919
  function get_admin_toolbar_debugging () {
1920
  global $ai_db_options;
1921
 
1922
- 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;
1923
 
1924
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING']);
1925
  }
1926
 
1927
  function get_remote_debugging () {
1928
  global $ai_db_options;
1929
 
1930
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
1931
 
1932
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING']);
1933
  }
1934
 
1935
  function get_javascript_debugging () {
1936
  global $ai_db_options;
1937
 
1938
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
1939
 
1940
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING']);
1941
  }
1942
 
1943
  function get_viewport_name ($viewport_number) {
1944
  global $ai_db_options;
1945
 
1946
  $viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
1947
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
1948
- $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
1949
 
1950
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
1951
  }
1952
 
1953
  function get_viewport_width ($viewport_number) {
1954
  global $ai_db_options;
1955
 
1956
  $viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
1957
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
1958
- $ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
1959
 
1960
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
1961
  }
1962
 
1963
  function get_country_group_name ($group_number) {
1964
  global $ai_db_options;
1965
 
1966
  $country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
1967
- 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;
1968
 
1969
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name]);
1970
  }
1971
 
1972
  function get_group_country_list ($group_number) {
1973
  global $ai_db_options;
1974
 
1975
  $group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
1976
- if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name] = '';
1977
 
1978
- return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name]);
1979
  }
1980
 
1981
  function multisite_settings_page_enabled () {
@@ -2045,6 +2651,96 @@ function multisite_main_for_all_blogs () {
2045
  return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
2046
  }
2047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2048
  function filter_html_class ($str){
2049
 
2050
  $str = str_replace (array ("\\\""), array ("\""), $str);
@@ -2067,6 +2763,9 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2067
  $value = str_replace (array ("\\\""), array ("\""), $value);
2068
 
2069
  if ($option == AI_OPTION_DOMAIN_LIST ||
 
 
 
2070
  $option == AI_OPTION_IP_ADDRESS_LIST ||
2071
  $option == AI_OPTION_COUNTRY_LIST) {
2072
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]"), "", $value);
@@ -2079,7 +2778,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2079
  ) {
2080
  $value = esc_html ($value);
2081
  }
2082
- elseif ($option == AI_OPTION_NAME ||
2083
  $option == AI_OPTION_GENERAL_TAG ||
2084
  $option == AI_OPTION_DOMAIN_LIST ||
2085
  $option == AI_OPTION_CATEGORY_LIST ||
@@ -2090,6 +2789,7 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2090
  $option == AI_OPTION_PARAGRAPH_TEXT_TYPE ||
2091
  $option == AI_OPTION_PARAGRAPH_NUMBER ||
2092
  $option == AI_OPTION_MIN_PARAGRAPHS ||
 
2093
  $option == AI_OPTION_AVOID_PARAGRAPHS_ABOVE ||
2094
  $option == AI_OPTION_AVOID_PARAGRAPHS_BELOW ||
2095
  $option == AI_OPTION_AVOID_TRY_LIMIT ||
@@ -2103,7 +2803,13 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
2103
  $option == AI_OPTION_END_DATE ||
2104
  $option == AI_OPTION_FALLBACK ||
2105
  $option == AI_OPTION_EXCERPT_NUMBER ||
2106
- $option == AI_OPTION_CUSTOM_CSS) {
 
 
 
 
 
 
2107
  $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
2108
  $value = esc_html ($value);
2109
  }
@@ -2134,6 +2840,9 @@ function ai_data () {
2134
  if (is_numeric ($block) && $block >= 1 && $block <= AD_INSERTER_BLOCKS) {
2135
  generate_code_preview ($block);
2136
  }
 
 
 
2137
  }
2138
 
2139
  elseif (isset ($_GET ["image"])) {
@@ -2142,6 +2851,27 @@ function ai_data () {
2142
  readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$_GET ["image"]);
2143
  }
2144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2145
  elseif (function_exists ('ai_data_ajax')) {
2146
  ai_data_ajax ();
2147
  }
@@ -2154,17 +2884,23 @@ function ai_generate_extract (&$settings) {
2154
  $obj = new ai_Block (1);
2155
 
2156
  $extract = array ();
2157
- $content_hook_blocks = array ();
2158
- $excerpt_hook_blocks = array ();
2159
- $loop_start_hook_blocks = array ();
2160
- $loop_end_hook_blocks = array ();
2161
- $post_hook_blocks = array ();
2162
-
2163
- $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());
2164
- $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());
2165
- $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());
2166
- $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());
2167
- $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());
 
 
 
 
 
 
2168
 
2169
  // Generate extracted data
2170
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
@@ -2211,15 +2947,30 @@ function ai_generate_extract (&$settings) {
2211
  foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
2212
  $post_hook_blocks [AI_PT_ANY][]= $block;
2213
  break;
 
 
 
 
 
 
 
 
 
 
 
 
2214
  }
2215
  }
2216
  }
2217
 
2218
- $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
2219
- $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
2220
- $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
2221
- $extract [LOOP_END_HOOK_BLOCKS] = $loop_end_hook_blocks;
2222
- $extract [POST_HOOK_BLOCKS] = $post_hook_blocks;
 
 
 
2223
 
2224
  return ($extract);
2225
  }
@@ -2232,14 +2983,15 @@ function ai_load_settings () {
2232
  ai_load_options ();
2233
 
2234
  if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
2235
- isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] == $version_string &&
2236
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
2237
- isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]))
 
2238
  $ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
2239
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
2240
 
2241
  $obj = new ai_Block (0);
2242
- $obj->wp_options [AI_OPTION_NAME] = 'Default';
2243
  $block_object [0] = $obj;
2244
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2245
  $obj = new ai_Block ($block);
@@ -2251,8 +3003,14 @@ function ai_load_settings () {
2251
  $adF = new ai_AdF();
2252
  $adH->load_options (AI_HEADER_OPTION_NAME);
2253
  $adF->load_options (AI_FOOTER_OPTION_NAME);
2254
- $block_object [AI_HEADER_OPTION_NAME] = $adH;
2255
- $block_object [AI_FOOTER_OPTION_NAME] = $adF;
 
 
 
 
 
 
2256
 
2257
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS END");
2258
  }
@@ -2353,7 +3111,7 @@ function ai_settings () {
2353
 
2354
  if ($exported_settings !== false) {
2355
  foreach (array_keys ($ad->wp_options) as $key){
2356
- if ($key == AI_OPTION_NAME && isset ($_POST [$import_name_switch_name]) && $_POST [$import_name_switch_name] != "1") {
2357
  $form_field_name = $key . WP_FORM_FIELD_POSTFIX . $block;
2358
  if (isset ($_POST [$form_field_name])){
2359
  $ad->wp_options [$key] = filter_option ($key, $_POST [$form_field_name]);
@@ -2400,23 +3158,44 @@ function ai_settings () {
2400
  }
2401
  }
2402
 
2403
- $ai_options [AI_HEADER_OPTION_NAME] = $adH->wp_options;
2404
- $ai_options [AI_FOOTER_OPTION_NAME] = $adF->wp_options;
 
 
 
 
 
 
 
 
 
 
 
2405
 
2406
  $options = array ();
2407
 
2408
  if (function_exists ('ai_filter_global_settings')) ai_filter_global_settings ($options);
2409
 
2410
- if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
2411
- if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
2412
- if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
2413
- if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('sticky-widget-margin', $_POST ['sticky-widget-margin']);
2414
- if (isset ($_POST ['plugin_priority'])) $options ['PLUGIN_PRIORITY'] = filter_option ('plugin_priority', $_POST ['plugin_priority']);
2415
- if (isset ($_POST ['dynamic_blocks'])) $options ['DYNAMIC_BLOCKS'] = filter_option ('dynamic_blocks', $_POST ['dynamic_blocks']);
2416
- if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('paragraph_counting_functions', $_POST ['paragraph_counting_functions']);
2417
- if (isset ($_POST ['admin_toolbar_debugging'])) $options ['ADMIN_TOOLBAR_DEBUGGING'] = filter_option ('admin_toolbar_debugging', $_POST ['admin_toolbar_debugging']);
2418
- if (isset ($_POST ['remote_debugging'])) $options ['REMOTE_DEBUGGING'] = filter_option ('remote_debugging', $_POST ['remote_debugging']);
2419
- if (isset ($_POST ['javascript_debugging'])) $options ['JAVASCRIPT_DEBUGGING'] = filter_option ('javascript_debugging', $_POST ['javascript_debugging']);
 
 
 
 
 
 
 
 
 
 
2420
 
2421
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
2422
  if (isset ($_POST ['viewport-name-'.$viewport]))
@@ -2427,7 +3206,7 @@ function ai_settings () {
2427
 
2428
  $options ['VIEWPORT_CSS'] = generate_viewport_css ();
2429
 
2430
- $ai_options [AI_GLOBAL_OPTION_NAME] = ai_check_plugin_options ($options);
2431
  }
2432
 
2433
  if (!empty ($invalid_blocks)) {
@@ -2439,9 +3218,9 @@ function ai_settings () {
2439
  // Generate and save extract
2440
  $ai_options [AI_EXTRACT_OPTION_NAME] = ai_generate_extract ($ai_options);
2441
 
2442
- $ai_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] = time ();
2443
 
2444
- update_option (WP_OPTION_NAME, $ai_options);
2445
 
2446
  // Multisite
2447
  if (is_multisite () && is_main_site ()) {
@@ -2450,7 +3229,7 @@ function ai_settings () {
2450
  if (function_exists ('ai_filter_multisite_settings')) ai_filter_multisite_settings ($options);
2451
 
2452
  ai_check_multisite_options ($options);
2453
- update_site_option (WP_OPTION_NAME, $options);
2454
  }
2455
 
2456
  ai_load_settings ();
@@ -2475,10 +3254,10 @@ function ai_settings () {
2475
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
2476
  delete_option (AD_OPTIONS);
2477
 
2478
- delete_option (WP_OPTION_NAME);
2479
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
2480
  if (is_multisite () && is_main_site ()) {
2481
- delete_site_option (WP_OPTION_NAME, $options);
2482
  }
2483
 
2484
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
@@ -2669,7 +3448,7 @@ function ai_content_hook ($content = '') {
2669
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
2670
  $globals_name = AI_CONTENT_COUNTER_NAME;
2671
 
2672
- $special_element_tags = explode (',', str_replace (' ', '', SPECIAL_ELEMENT_TAGS));
2673
 
2674
  if (!isset ($ad_inserter_globals [$globals_name])) {
2675
  $ad_inserter_globals [$globals_name] = 1;
@@ -2705,6 +3484,7 @@ function ai_content_hook ($content = '') {
2705
  $ai_last_check = AI_CHECK_NONE;
2706
  $current_block = 0;
2707
 
 
2708
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
2709
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2710
 
@@ -2848,6 +3628,7 @@ function ai_excerpt_hook ($content = '') {
2848
  $ai_last_check = AI_CHECK_NONE;
2849
  $current_block = 0;
2850
 
 
2851
  foreach ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
2852
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2853
 
@@ -2939,11 +3720,11 @@ function ai_before_after_post ($query, $automatic_insertion) {
2939
 
2940
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
2941
 
2942
- $style = AI_DEBUG_POSITIONS_STYLE;
2943
-
2944
  $counter = $ad_inserter_globals [$globals_name];
2945
  if ($counter == 1) $counter = '';
2946
 
 
 
2947
  echo "<section style='$style'>".($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? "BEFORE" : "AFTER")." POST ".$counter."</section>";
2948
  }
2949
 
@@ -2957,7 +3738,10 @@ function ai_before_after_post ($query, $automatic_insertion) {
2957
  $ai_last_check = AI_CHECK_NONE;
2958
  $current_block = 0;
2959
 
2960
- 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) {
 
 
 
2961
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
2962
 
2963
  if (!isset ($block_object [$block])) continue;
@@ -3024,8 +3808,7 @@ function ai_loop_end_hook ($query){
3024
 
3025
  // Process Between Posts postion
3026
  function ai_post_hook ($post) {
3027
- global $ai_wp_data, $ai_total_plugin_time;
3028
- global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check;
3029
 
3030
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ADMIN) return;
3031
 
@@ -3060,6 +3843,7 @@ function ai_post_hook ($post) {
3060
  $ai_last_check = AI_CHECK_NONE;
3061
  $current_block = 0;
3062
 
 
3063
  foreach ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3064
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3065
 
@@ -3099,6 +3883,257 @@ function ai_post_hook ($post) {
3099
  return $post;
3100
  }
3101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3102
  function process_shortcode (&$block, $atts) {
3103
  global $block_object, $ai_last_check, $ai_wp_data;
3104
 
@@ -3299,6 +4334,22 @@ class ai_widget extends WP_Widget {
3299
  }
3300
  }
3301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3302
 
3303
  function ai_widget_draw ($args, $instance, &$block) {
3304
  global $block_object, $ad_inserter_globals, $ai_wp_data, $ai_last_check;
@@ -3315,7 +4366,11 @@ function ai_widget_draw ($args, $instance, &$block) {
3315
  if ($sticky) {
3316
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
3317
  if ($block == - 1) {
3318
- echo "<div class='ai-sticky'></div>\n";
 
 
 
 
3319
  return;
3320
  }
3321
  }
@@ -3333,7 +4388,8 @@ function ai_widget_draw ($args, $instance, &$block) {
3333
  $ad_inserter_globals [$globals_name] = 1;
3334
  } else $ad_inserter_globals [$globals_name] ++;
3335
 
3336
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("WIDGET (". $obj->number . ') ['.$ad_inserter_globals [$globals_name] . ']');
 
3337
 
3338
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
3339
 
@@ -3353,7 +4409,13 @@ function ai_widget_draw ($args, $instance, &$block) {
3353
  // Last check before counter check before insertion
3354
  $ai_last_check = AI_CHECK_CODE;
3355
  if ($obj->ai_getCode () == '') {
3356
- if ($sticky) echo "<div class='ai-sticky'></div>\n";
 
 
 
 
 
 
3357
  return;
3358
  }
3359
 
@@ -3362,12 +4424,16 @@ function ai_widget_draw ($args, $instance, &$block) {
3362
 
3363
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3364
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
3365
  $viewport_classes = trim ($obj->get_viewport_classes ());
3366
  $sticky_class = $sticky ? ' ai-sticky' : '';
3367
  $widget_classes = trim ($viewport_classes . $sticky_class);
3368
- if ($widget_classes != "") echo "<div class='" . $widget_classes . "'>";
3369
 
3370
- echo $args ['before_widget'];
 
 
 
 
3371
 
3372
  if (!empty ($title)) {
3373
  echo $args ['before_title'], apply_filters ('widget_title', $title), $args ['after_title'];
@@ -3377,8 +4443,6 @@ function ai_widget_draw ($args, $instance, &$block) {
3377
 
3378
  echo $args ['after_widget'];
3379
 
3380
- if ($widget_classes != "") echo "</div>";
3381
-
3382
  $ai_last_check = AI_CHECK_INSERTED;
3383
 
3384
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && $obj->get_detection_client_side())
@@ -3391,12 +4455,10 @@ function ai_widget_draw_debugger ($args, $instance, &$block) {
3391
 
3392
  $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
3393
 
3394
- echo $args ['before_widget'];
3395
-
3396
  if ($sticky) {
3397
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
3398
- echo "<div class='ai-sticky'></div>\n";
3399
- }
3400
 
3401
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
3402
 
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
+ Version: 2.1.13
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.13 - 2017-08-07
16
+ - Fix for Fatal error: Can't use method return value in write context
17
+
18
+ Ad Inserter 2.1.12 - 2017-08-07
19
+ - Added option to define tags inside which paragraphs are not counted
20
+ - Added max insertions check when inserting for all paragraphs
21
+ - Added support for inverted filter
22
+ - Added option to define minimum number of words in paragraphs above (experimantal)
23
+ - Added support for %N filter item to filter every N-th insertion (experimantal)
24
+ - Added filter support when inserting for all paragraphs (experimantal)
25
+ - Increased nonce lifespan to 48 hours when using tracking (Pro only)
26
+ - Fixed wrong urls in debug menu when behind proxy
27
+
28
+ Ad Inserter 2.1.11 - 2017-07-21
29
+ - Improved support for sticky widgets
30
+ - Added support for ad counting (|count| separator)
31
+ - Added support to black/white-list arbitrary taxonomies (taxonomy, term or taxonomy:term)
32
+ - Added support for automatic insertion before, between and after comments
33
+ - Added processing of shortcodes in the header and footer code
34
+ - Debugging function Show positions shows also page type
35
+ - Fixed page type detection when Post page was set to static page and it was not homepage
36
+ - Few minor bug fixes, cosmetic changes and code improvements
37
+
38
  Ad Inserter 2.1.10 - 2017-07-01
39
  - Fix for shifted sidebars in some themes
40
 
414
  exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
415
  }
416
 
417
+ 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;
418
 
419
  //include required files
420
  require_once AD_INSERTER_PLUGIN_DIR.'class.php';
421
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
422
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
423
  require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
424
+ require_once AD_INSERTER_PLUGIN_DIR.'preview-adb.php';
425
 
426
  if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] != '') {
427
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
437
  }
438
 
439
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
440
+ $ai_wp_data [AI_WP_URL] = remove_debug_parameters_from_url ();
441
 
442
  if (!is_admin()) {
443
  if (!isset ($_GET [AI_URL_DEBUG]))
457
 
458
  $ad_inserter_globals = array ();
459
  $block_object = array ();
460
+ $block_insertion_log = array ();
461
 
462
  ai_load_settings ();
463
 
468
  }
469
  }
470
 
471
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
472
+ $ai_wp_data [AI_ADB_DETECTION] = $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ();
473
+
474
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
475
+ define ('AI_ADB_2_NAME', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY).md5 (NONCE_KEY))), 0, 8));
476
+ define ('AI_ADB_COOKIE_VALUE', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY.md5 (NONCE_KEY)))), 0, 8));
477
+
478
+ $script = AD_INSERTER_PLUGIN_DIR.'includes/js/sponsors.js';
479
+
480
+ $js_ok = false;
481
+ if (file_exists ($script)) {
482
+ if (strpos (file_get_contents ($script), AI_ADB_2_NAME) !== false) $js_ok = true;
483
+ }
484
+
485
+ if (!$js_ok) {
486
+ file_put_contents ($script, 'window.' . AI_ADB_2_NAME . '=true;');
487
+ define ('AI_ADB_2_FILE_RECREATED', true);
488
+ }
489
+
490
+ if (function_exists ('ai_check_files')) ai_check_files ();
491
+ }
492
+ }
493
+
494
  if (function_exists ('ai_load_globals')) ai_load_globals ();
495
 
496
  if (get_dynamic_blocks ()) {
508
  }
509
 
510
  $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
511
+ $ai_wp_data [AI_WP_USER_SET] = false;
512
+ $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
513
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
514
  $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
515
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
530
  if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
531
  if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
532
 
 
533
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
534
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
535
 
557
 
558
  add_action ('wp', 'ai_wp_hook');
559
 
560
+ //if ($adH->get_enable_manual () ||
561
+ // $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
562
+ // get_remote_debugging () ||
563
+ // ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0 ||
564
+ // ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0)
565
+ add_action ('wp_head', 'ai_wp_head_hook');
566
 
567
  //if ($adF->get_enable_manual () ||
568
  // $ai_wp_data [AI_TRACKING] ||
575
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output)
576
  add_action ('shutdown', 'ai_shutdown_hook');
577
 
 
578
  add_action ('widgets_init', 'ai_widgets_init_hook');
579
  add_action ('add_meta_boxes', 'ai_add_meta_box_hook');
580
  add_action ('save_post', 'ai_save_meta_box_data_hook');
586
  add_action ('wp_ajax_ai_data', 'ai_data');
587
  add_action ('wp_ajax_nopriv_ai_data', 'ai_data');
588
 
589
+ if ($ai_wp_data [AI_TRACKING]) {
590
+ add_filter ('nonce_life', function () {return 48 * 3600;});
591
+ }
592
+
593
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
594
  $ai_total_plugin_time += microtime (true) - $start_time;
595
  ai_log ("INITIALIZATION END\n");
615
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) $debug_no_insertion = 1; else $debug_no_insertion = 0;
616
  $debug_no_insertion_class = $debug_no_insertion == 0 ? ' on' : '';
617
 
618
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING) == 0) $debug_ad_blocking = 1; else $debug_ad_blocking = 0;
619
+ $debug_ad_blocking_class = $debug_ad_blocking == 0 ? ' on' : '';
620
+
621
+ $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0 || $debug_ad_blocking == 0;
622
 
623
  $debug_settings_class = $debug_settings_on ? ' on' : '';
624
+ $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_debug_parameters_from_url ()) :
625
+ add_query_arg (array (AI_URL_DEBUG_BLOCKS => '1', AI_URL_DEBUG_POSITIONS => '0', AI_URL_DEBUG_TAGS => '1'), remove_debug_parameters_from_url ());
626
 
627
  $wp_admin_bar->add_node (array (
628
  'id' => 'ai-toolbar',
630
  ));
631
  $wp_admin_bar->add_node (array (
632
  'id' => 'ai-toolbar-settings',
633
+ // 'parent' => 'ai-toolbar',
634
  'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME,
635
  'href' => $top_menu_url,
636
  ));
701
  ($paragraph_block ['min'] != 0 ? ' min '.$paragraph_block ['min']. ' ' : '').
702
  ($paragraph_block ['max'] != 0 ? ' max '.$paragraph_block ['max']. ' ' : '').
703
  ($paragraph_block ['blockquote'] ? ' [blockquote] ' : '').
704
+ ($paragraph_block ['text'] != '' ? ($paragraph_block ['text_type'] == AD_DO_NOT_CONTAIN ? ' NC ' : ' C ').' ['.htmlentities ($paragraph_block ['text']).']' : ''),
705
  'href' => set_url_parameter (AI_URL_DEBUG_POSITIONS, $paragraph_block ['blocks'][0]),
706
  ));
707
  }
718
  'title' => '<span class="ab-icon'.$debug_no_insertion_class.'"></span>Disable Insertion',
719
  'href' => set_url_parameter (AI_URL_DEBUG_NO_INSERTION, $debug_no_insertion),
720
  ));
721
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
722
+ $wp_admin_bar->add_node (array (
723
+ 'id' => 'ai-toolbar-ad-blocking',
724
+ 'parent' => 'ai-toolbar-settings',
725
+ 'title' => '<span class="ab-icon'.$debug_ad_blocking_class.'"></span>Simulate Ad Blocking',
726
+ 'href' => set_url_parameter (AI_URL_DEBUG_AD_BLOCKING, $debug_ad_blocking),
727
+ ));
728
+ }
729
  $wp_admin_bar->add_node (array (
730
  'id' => 'ai-toolbar-processing',
731
  'parent' => 'ai-toolbar-settings',
737
  function set_user () {
738
  global $ai_wp_data;
739
 
740
+ if ($ai_wp_data [AI_WP_USER_SET]) return;
741
 
742
+ // $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
743
 
744
  if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
745
  if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
746
 
747
  // if (isset ($_GET [AI_URL_DEBUG_USER]) && $_GET [AI_URL_DEBUG_USER] != 0) $ai_wp_data [AI_WP_USER] = $_GET [AI_URL_DEBUG_USER];
748
+
749
+ $ai_wp_data [AI_WP_USER_SET] = true;
750
  }
751
 
752
  function set_page_type () {
755
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_NONE) return;
756
 
757
  if (is_admin()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ADMIN;
758
+ elseif (is_feed()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_FEED;
759
+ elseif (is_404()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_404;
760
+ elseif (is_front_page ()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_HOMEPAGE;
761
+ elseif (is_page()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_STATIC;
762
+ elseif (is_single()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_POST;
763
+ elseif (is_category()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_CATEGORY;
764
+ elseif (is_search()) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_SEARCH;
765
+ elseif (is_archive() || (is_home () && !is_front_page ())) $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_ARCHIVE;
766
  }
767
 
768
  function ai_log_message ($message) {
781
  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).']');
782
  }
783
 
784
+ function ai_block_insertion_status ($block, $ai_last_check) {
785
  global $block_object;
786
 
787
  if ($block < 1 || $block > AD_INSERTER_BLOCKS) $block = 0;
788
 
789
+ if ($ai_last_check == AI_CHECK_INSERTED) return "INSERTED";
790
+ $status = "FAILED CHECK: ";
791
  $obj = $block_object [$block];
792
  switch ($ai_last_check) {
793
  case AI_CHECK_PAGE_TYPE_FRONT_PAGE: $status .= "ENABLED ON HOMEPAGE"; break;
809
 
810
  case AI_CHECK_CATEGORY: $status .= "CATEGORY"; break;
811
  case AI_CHECK_TAG: $status .= "TAG"; break;
812
+ case AI_CHECK_TAXONOMY: $status .= "TAXONOMY"; break;
813
  case AI_CHECK_ID: $status .= "ID"; break;
814
  case AI_CHECK_URL: $status .= "URL"; break;
815
  case AI_CHECK_URL_PARAMETER: $status .= "URL PARAMETER"; break;
827
  case AI_CHECK_DISABLED_MANUALLY: $status .= "DISABLED BY HTML COMMENT"; break;
828
 
829
  case AI_CHECK_MAX_INSERTIONS: $status .= "MAX INSERTIONS " . $obj->get_maximum_insertions (); break;
830
+ case AI_CHECK_FILTER: $status .= ($obj->get_inverted_filter() ? 'INVERTED ' : '') . "FILTER " . $obj->get_call_filter(); break;
831
  case AI_CHECK_PARAGRAPH_COUNTING: $status .= "PARAGRAPH COUNTING"; break;
832
  case AI_CHECK_MIN_NUMBER_OF_WORDS: $status .= "MIN NUMBER OF WORDS " . intval ($obj->get_minimum_words()); break;
833
  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;
854
  return $status;
855
  }
856
 
857
+ function ai_log_block_status ($block, $ai_last_check) {
858
+ global $block_insertion_log, $ad_inserter_globals;
859
+
860
+ $global_name = AI_BLOCK_COUNTER_NAME . $block;
861
+
862
+ $block_status = ai_block_insertion_status ($block, $ai_last_check);
863
+ $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] . ']' : '');
864
+
865
+ return "BLOCK $block " . $block_status;
866
+ }
867
+
868
  function ai_log ($message = "") {
869
  global $ai_last_time, $ai_processing_log;
870
 
877
  $ai_last_time = microtime (true);
878
  }
879
 
880
+ function remove_debug_parameters_from_url ($url = false) {
881
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
882
+ $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);
883
+ } else
884
+ $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);
 
 
 
 
 
 
 
 
885
 
886
+ return remove_query_arg ($parameters, $url);
 
 
 
 
 
 
 
 
 
 
 
887
  }
888
 
889
  function set_url_parameter ($parameter, $value) {
890
+ return add_query_arg ($parameter, $value, remove_debug_parameters_from_url ());
 
 
 
 
 
 
 
 
 
891
  }
892
 
893
  function number_of_words (&$content) {
899
  }
900
 
901
  function ai_wp_hook () {
902
+ global $ai_wp_data, $ai_db_options_extract, $ai_total_plugin_time, $ai_walker;
903
 
904
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
905
  ai_log ("WP HOOK START");
913
  ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 &&
914
  get_admin_toolbar_debugging () &&
915
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
916
+ add_action ('admin_bar_menu', 'ai_toolbar', 9920);
917
 
918
  $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
919
 
940
  if (isset ($_GET [AI_URL_DEBUG_NO_INSERTION]))
941
  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;
942
 
943
+ if (isset ($_GET [AI_URL_DEBUG_AD_BLOCKING]))
944
+ 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;
945
+
946
  if (isset ($_GET [AI_URL_DEBUG_POSITIONS])) {
947
  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;
948
  if (is_numeric ($_GET [AI_URL_DEBUG_POSITIONS])) $ai_wp_data [AI_WP_DEBUG_BLOCK] = intval ($_GET [AI_URL_DEBUG_POSITIONS]);
979
  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)
980
  add_action ('the_post', 'ai_post_hook');
981
 
982
+ 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) ||
983
+ (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) ||
984
+ (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) ||
985
+ $debug_positions) {
986
+ $ai_wp_data [AI_NUMBER_OF_COMMENTS] = 0;
987
+ add_filter ('comments_array' , 'ai_comments_array' , 10, 2);
988
+ add_filter ('wp_list_comments_args' , 'ai_wp_list_comments_args');
989
+ $ai_walker = new ai_Walker_Comment;
990
+ }
991
+
992
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
993
  $ai_total_plugin_time += microtime (true) - $start_time;
994
  ai_log ("WP HOOK END\n");
1020
  global $ai_settings_page;
1021
 
1022
  if ($hook_suffix == $ai_settings_page) {
1023
+
1024
  wp_enqueue_script ('ai-admin-js', plugins_url ('js/ad-inserter.js', __FILE__), array (
1025
  'jquery',
1026
  'jquery-ui-tabs',
1046
  if (AI_SYNTAX_HIGHLIGHTING) {
1047
  wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1048
  wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1049
+
1050
+ if (get_syntax_highlighter_theme () == AI_SYNTAX_HIGHLIGHTER_THEME || isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] == AI_SYNTAX_HIGHLIGHTER_THEME)
1051
+ wp_enqueue_script ('ai-ace-theme', plugins_url ('includes/ace/theme-ad_inserter.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
1052
  }
1053
  }
1054
  }
1093
  #wp-admin-bar-ai-toolbar-no-insertion .ab-icon:before {
1094
  content: '\\f214';
1095
  }
1096
+ #wp-admin-bar-ai-toolbar-ad-blocking .ab-icon:before {
1097
+ content: '\\f160';
1098
+ }
1099
  #wp-admin-bar-ai-toolbar-processing .ab-icon:before {
1100
  content: '\\f464';
1101
  }
1111
  }
1112
  }
1113
 
1114
+ function ai_adb_replace_vars ($vars) {
1115
+ global $block_object, $ai_wp_data;
1116
+
1117
+ $adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
1118
+
1119
+ $vars = str_replace ('AI0', ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING) != 0 ? 'true' : 'false', $vars);
1120
+ $vars = str_replace ('AI1', get_javascript_debugging () ? 'true' : 'false', $vars);
1121
+ $vars = str_replace ('AI2', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) . get_overlay_css () . "'}})", $vars);
1122
+ $vars = str_replace ('AI3', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) . get_message_css () . "'}, html: '" .
1123
+ str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ())) . "'});", $vars);
1124
+ $vars = str_replace ('AI4', get_undismissible_message () ? 'true' : 'false', $vars);
1125
+ $vars = str_replace ('AI5', get_no_action_period (true), $vars);
1126
+ $vars = str_replace ('AI6', get_adb_action (true), $vars);
1127
+ $vars = str_replace ('AI7', get_delay_action (true), $vars);
1128
+ $vars = str_replace ('AI8', str_replace (' ', '', get_adb_selectors ()), $vars);
1129
+
1130
+ $redirection_page = get_redirection_page ();
1131
+ if ($redirection_page != 0) $url = get_permalink ($redirection_page); else $url = trim (get_custom_redirection_url ());
1132
+ $vars = str_replace ('AI9', $url, $vars);
1133
+
1134
+ return $vars;
1135
+ }
1136
+
1137
+ function ai_adb_code () {
1138
+ return "
1139
+ var ai_adb_debugging = AI1;
1140
+ var ai_adb_active = false;
1141
+ var ai_adb_counter = 0;
1142
+ var ai_adb_overlay = AI2;
1143
+ var ai_adb_message_window = AI3;
1144
+ var ai_adb_message_undismissible = AI4;
1145
+ var ai_adb_action_cookie_name = 'aiADB';
1146
+ var ai_adb_page_views_cookie_name = 'aiADB_PV';
1147
+ var ai_adb_page_redirection_cookie_name = 'aiADB_PR';
1148
+ var ai_adb_message_cookie_lifetime = AI5;
1149
+ var ai_adb_action = AI6;
1150
+ var ai_adb_page_views = AI7;
1151
+ var ai_adb_selectors = 'AI8';
1152
+ var ai_adb_redirection_url = 'AI9';
1153
+
1154
+ var ai_adb_detected = function(n) {
1155
+ if (ai_adb_debugging) console.log ('AI ad blocking DETECTED', n);
1156
+ if (!ai_adb_active) {
1157
+ ai_adb_active = true;
1158
+ if (ai_adb_debugging) console.log ('AI ad blocking action check');
1159
+
1160
+ (function ($) {
1161
+
1162
+ // $.removeCookie (ai_adb_page_views_cookie_name, {path: '/' });
1163
+ if (ai_adb_page_views != 0) {
1164
+ var ai_adb_page_view_counter = 1;
1165
+ var cookie = $.cookie (ai_adb_page_views_cookie_name);
1166
+ if (typeof cookie != 'undefined') ai_adb_page_view_counter = parseInt (cookie) + 1;
1167
+ if (ai_adb_debugging) console.log ('AI ad blocking page views cookie:', cookie, '- page view:', ai_adb_page_view_counter);
1168
+
1169
+ if (ai_adb_page_view_counter < ai_adb_page_views) {
1170
+ if (ai_adb_debugging) console.log ('AI ad blocking', ai_adb_page_views, 'page views not reached, no action');
1171
+ $.cookie (ai_adb_page_views_cookie_name, ai_adb_page_view_counter, {expires: 365, path: '/'});
1172
+ return;
1173
+ }
1174
+ }
1175
+
1176
+ if (ai_adb_message_cookie_lifetime != 0 && (ai_adb_action != 1 || !ai_adb_message_undismissible)) {
1177
+ var cookie = $.cookie (ai_adb_action_cookie_name);
1178
+ if (ai_adb_debugging) console.log ('AI ad blocking cookie:', cookie);
1179
+ if (typeof cookie != 'undefined' && cookie == '" . AI_ADB_COOKIE_VALUE . "') {
1180
+ if (ai_adb_debugging) console.log ('AI ad blocking valid cookie detected, no action');
1181
+ return;
1182
+ }
1183
+
1184
+ $.cookie (ai_adb_action_cookie_name, '" . AI_ADB_COOKIE_VALUE . "', {expires: ai_adb_message_cookie_lifetime, path: '/'});
1185
+ } else $.removeCookie (ai_adb_action_cookie_name, {path: '/' });
1186
+
1187
+ if (ai_adb_debugging) console.log ('AI ad blocking action', ai_adb_action);
1188
+ switch (ai_adb_action) {
1189
+ case 1:
1190
+ if (!ai_adb_message_undismissible) {
1191
+ ai_adb_overlay.click (function () {
1192
+ $(this).remove();
1193
+ ai_adb_message_window.remove();
1194
+ }).css ('cursor', 'pointer');
1195
+ ai_adb_message_window.click (function () {
1196
+ $(this).remove();
1197
+ ai_adb_overlay.remove();
1198
+ }).css ('cursor', 'pointer');
1199
+ window.onkeydown = function( event ) {
1200
+ if (event.keyCode === 27 ) {
1201
+ ai_adb_overlay.click ();
1202
+ ai_adb_message_window.click ();
1203
+ }
1204
+ }
1205
+ if (ai_adb_debugging) console.log ('AI ad blocking MESSAGE click detection installed');
1206
+ } else {
1207
+ // $.removeCookie (ai_adb_action_cookie_name, {path: '/' });
1208
+ }
1209
+
1210
+ if (ai_adb_debugging) console.log ('AI ad blocking MESSAGE');
1211
+ $('body').prepend (ai_adb_overlay).prepend (ai_adb_message_window);
1212
+
1213
+ break;
1214
+ case 2:
1215
+ if (ai_adb_redirection_url != '') {
1216
+ if (ai_adb_debugging) console.log ('AI ad blocking REDIRECTION to', ai_adb_redirection_url);
1217
+
1218
+ var redirect = true;
1219
+ if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == 'http') {
1220
+ if (window.location.href == ai_adb_redirection_url) var redirect = false;
1221
+ } else {
1222
+ if (window.location.pathname == ai_adb_redirection_url) var redirect = false;
1223
+ }
1224
+
1225
+ if (redirect) {
1226
+ var cookie = $.cookie (ai_adb_page_redirection_cookie_name);
1227
+ if (typeof cookie == 'undefined') {
1228
+ var date = new Date();
1229
+ date.setTime (date.getTime() + (10 * 1000));
1230
+ $.cookie (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: '/' });
1231
+
1232
+ window.location.replace (ai_adb_redirection_url)
1233
+ } else {
1234
+ if (ai_adb_debugging) console.log ('AI ad blocking no redirection, cookie:', cookie);
1235
+ }
1236
+ } else {
1237
+ if (ai_adb_debugging) console.log ('AI ad blocking already on page', window.location.href);
1238
+ jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: '/'});
1239
+ }
1240
+ }
1241
+ break;
1242
+ }
1243
+
1244
+ $(window).ready(function () {
1245
+ if (ai_adb_debugging) console.log ('AI ad blocking block actions');
1246
+
1247
+ $('div.ai-adb-show').each (function () {
1248
+ $(this).css ({'display': 'block', 'visibility': 'visible'});
1249
+
1250
+ if (ai_adb_debugging) {
1251
+ var debug_info = $(this).attr ('data');
1252
+ console.log ('AI ad blocking SHOW', typeof debug_info != 'undefined' ? debug_info : '');
1253
+ }
1254
+ });
1255
+
1256
+ $('div.ai-adb-hide').each (function () {
1257
+ $(this).css ({'display': 'none', 'visibility': 'hidden'});
1258
+ });
1259
+ });
1260
+
1261
+
1262
+
1263
+ }(jQuery));
1264
+
1265
+ }
1266
+ }
1267
+
1268
+ var ai_adb_undetected = function(n) {
1269
+ ai_adb_counter ++;
1270
+ if (ai_adb_debugging) console.log ('AI ad blocking not detected', n, '- counter:', ai_adb_counter);
1271
+
1272
+ if (!ai_adb_active && ai_adb_counter == 3) {
1273
+ if (ai_adb_debugging) console.log ('AI ad blocking NOT DETECTED');
1274
+
1275
+ // var redirected_page = false;
1276
+ // if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == 'http') {
1277
+ // if (window.location.href == ai_adb_redirection_url) var redirected_page = true;
1278
+ // } else {
1279
+ // if (window.location.pathname == ai_adb_redirection_url) var redirected_page = true;
1280
+ // }
1281
+
1282
+ // if (redirected_page) {
1283
+ // var cookie = jQuery.cookie (ai_adb_page_redirection_cookie_name);
1284
+ // if (typeof cookie != 'undefined' && cookie.toLowerCase().substring (0, 4) == 'http') {
1285
+ // if (ai_adb_debugging) console.log ('AI ad blocking returning to', cookie);
1286
+ // jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: '/'});
1287
+ // window.location.replace (cookie);
1288
+ // }
1289
+ // }
1290
+
1291
+ }
1292
+ }
1293
+
1294
+ if (AI0) jQuery (document).ready (function () {ai_adb_detected (0)});
1295
+
1296
+ if (!document.getElementById ('" . AI_ADB_1_NAME . "')){
1297
+ jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (1)});
1298
+ } else {
1299
+ jQuery (document).ready (function () {ai_adb_undetected (1)});
1300
+ }
1301
+
1302
+ if (typeof window." . AI_ADB_2_NAME . " == 'undefined') {
1303
+ jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (2)});
1304
+ } else {
1305
+ jQuery (document).ready (function () {ai_adb_undetected (2)});
1306
+ }
1307
+
1308
+ jQuery (document).ready (function ($) {
1309
+ $(window).ready (function () {
1310
+ if ($('#banner-advert-container img').length > 0) {
1311
+ if ($('#banner-advert-container img').outerHeight() === 0) {
1312
+ $(document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (3)});
1313
+ } else $(document).ready (function () {ai_adb_undetected (3)});
1314
+ $('#banner-advert-container img').remove();
1315
+ }
1316
+
1317
+ if ((!ai_adb_active || ai_adb_debugging) && ai_adb_selectors != '') {
1318
+ var ai_adb_el_counter = 0;
1319
+ var ai_adb_el_zero = 0;
1320
+ var ai_adb_selector = ai_adb_selectors.split (',');
1321
+ $.each (ai_adb_selector, function (i) {
1322
+ if (ai_adb_debugging) console.log ('AI ad blocking selector', ai_adb_selector [i]);
1323
+ if ($(ai_adb_selector [i]).length != 0) {
1324
+ $(ai_adb_selector [i]).each (function (n) {
1325
+ 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 ());
1326
+ ai_adb_el_counter ++;
1327
+ if ($(this).outerHeight () === 0) {
1328
+ $ (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (4)});
1329
+ ai_adb_el_zero ++;
1330
+ if (!ai_adb_debugging) return false;
1331
+ }
1332
+
1333
+ });
1334
+
1335
+ }
1336
+ });
1337
+ if (ai_adb_el_counter != 0 && ai_adb_el_zero == 0) $(document).ready (function () {ai_adb_undetected (4)});
1338
+ }
1339
+ });
1340
+ });
1341
+
1342
+
1343
+ /*!
1344
+ * jQuery Cookie Plugin v1.4.1
1345
+ * https://github.com/carhartl/jquery-cookie
1346
+ *
1347
+ * Copyright 2013 Klaus Hartl
1348
+ * Released under the MIT license
1349
+ */
1350
+ (function (factory) {
1351
+ if (typeof define === 'function' && define.amd) {
1352
+ // AMD
1353
+ define(['jquery'], factory);
1354
+ } else if (typeof exports === 'object') {
1355
+ // CommonJS
1356
+ factory(require('jquery'));
1357
+ } else {
1358
+ // Browser globals
1359
+ factory(jQuery);
1360
+ }
1361
+ }(function ($) {
1362
+
1363
+ var pluses = /\+/g;
1364
+
1365
+ function encode(s) {
1366
+ return config.raw ? s : encodeURIComponent(s);
1367
+ }
1368
+
1369
+ function decode(s) {
1370
+ return config.raw ? s : decodeURIComponent(s);
1371
+ }
1372
+
1373
+ function stringifyCookieValue(value) {
1374
+ return encode(config.json ? JSON.stringify(value) : String(value));
1375
+ }
1376
+
1377
+ function parseCookieValue(s) {
1378
+ if (s.indexOf('\"') === 0) {
1379
+ // This is a quoted cookie as according to RFC2068, unescape...
1380
+ s = s.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');
1381
+ }
1382
+
1383
+ try {
1384
+ // Replace server-side written pluses with spaces.
1385
+ // If we can't decode the cookie, ignore it, it's unusable.
1386
+ // If we can't parse the cookie, ignore it, it's unusable.
1387
+ s = decodeURIComponent(s.replace(pluses, ' '));
1388
+ return config.json ? JSON.parse(s) : s;
1389
+ } catch(e) {}
1390
+ }
1391
+
1392
+ function read(s, converter) {
1393
+ var value = config.raw ? s : parseCookieValue(s);
1394
+ return $.isFunction(converter) ? converter(value) : value;
1395
+ }
1396
+
1397
+ var config = $.cookie = function (key, value, options) {
1398
+
1399
+ // Write
1400
+
1401
+ if (value !== undefined && !$.isFunction(value)) {
1402
+ options = $.extend({}, config.defaults, options);
1403
+
1404
+ if (typeof options.expires === 'number') {
1405
+ var days = options.expires, t = options.expires = new Date();
1406
+ t.setTime(+t + days * 864e+5);
1407
+ }
1408
+
1409
+ return (document.cookie = [
1410
+ encode(key), '=', stringifyCookieValue(value),
1411
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
1412
+ options.path ? '; path=' + options.path : '',
1413
+ options.domain ? '; domain=' + options.domain : '',
1414
+ options.secure ? '; secure' : ''
1415
+ ].join(''));
1416
+ }
1417
+
1418
+ // Read
1419
+
1420
+ var result = key ? undefined : {};
1421
+
1422
+ // To prevent the for loop in the first place assign an empty array
1423
+ // in case there are no cookies at all. Also prevents odd result when
1424
+ // calling $.cookie().
1425
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
1426
+
1427
+ for (var i = 0, l = cookies.length; i < l; i++) {
1428
+ var parts = cookies[i].split('=');
1429
+ var name = decode(parts.shift());
1430
+ var cookie = parts.join('=');
1431
+
1432
+ if (key && key === name) {
1433
+ // If second argument (value) is a function it's a converter...
1434
+ result = read(cookie, value);
1435
+ break;
1436
+ }
1437
+
1438
+ // Prevent storing a cookie that we couldn't decode.
1439
+ if (!key && (cookie = read(cookie)) !== undefined) {
1440
+ result[name] = cookie;
1441
+ }
1442
+ }
1443
+
1444
+ return result;
1445
+ };
1446
+
1447
+ config.defaults = {};
1448
+
1449
+ $.removeCookie = function (key, options) {
1450
+ if ($.cookie(key) === undefined) {
1451
+ return false;
1452
+ }
1453
+
1454
+ // Must not alter options, thus extending a fresh object...
1455
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
1456
+ return !$.cookie(key);
1457
+ };
1458
+
1459
+ }));
1460
+
1461
+ ";
1462
+
1463
+ return "";
1464
+ }
1465
+
1466
  function add_footer_inline_scripts () {
1467
+ global $ai_wp_data, $block_object;
1468
 
1469
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1470
+
1471
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
1472
+ if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
1473
+ 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>';
1474
+ echo "<script type='text/javascript' src='", plugins_url ('includes/js/ads.js?', __FILE__ ), "'></script>\n";
1475
+ echo "<script type='text/javascript' src='", plugins_url ('includes/js/sponsors.js?', __FILE__ ), "'></script>\n";
1476
+ }
1477
+ }
1478
+
1479
+ }
1480
+
1481
+ $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]);
1482
 
1483
  if ($inline_scripts) echo "<script type='text/javascript'>\n";
1484
 
1521
 
1522
  // echo 'jQuery(document).ready(function($) {
1523
  // var sticky_widget_margin = ', get_sticky_widget_margin (), ';
1524
+ // var document_width = $(document).width();
1525
+
1526
+ // $(".ai-sticky").each (function () {
1527
+ // var widget = $(this);
1528
+ // var widget_width = widget.width();
1529
+ //// console.log ("WIDGET:", widget.width (), widget.prop ("tagName"), widget.attr ("id"));
1530
+ // var sidebar = widget.parent ();
1531
+ // while (sidebar.prop ("tagName") != "BODY") {
1532
+ //// console.log ("SIDEBAR:", sidebar.width (), sidebar.prop ("tagName"), sidebar.attr ("id"));
1533
+ // var parent_element = sidebar.parent ();
1534
+ // var parent_element_width = parent_element.width();
1535
+ // if (parent_element_width > widget_width * 1.2 || parent_element_width > document_width / 2) break;
1536
+ // sidebar = parent_element;
1537
+ // }
1538
+ // var new_sidebar_top = sidebar.offset ().top - widget.offset ().top + sticky_widget_margin;
1539
+ //// console.log ("NEW SIDEBAR TOP:", new_sidebar_top);
1540
+ // if (sidebar.css ("position") != "sticky" || isNaN (parseInt (sidebar.css ("top"))) || sidebar.css ("top") < new_sidebar_top) {
1541
+ // sidebar.css ("position", "sticky").css ("top", new_sidebar_top);
1542
+ //// console.log ("SET SIDEBAR TOP:", new_sidebar_top);
1543
  // }
1544
  // });
1545
  // });
1546
  //';
1547
 
1548
+ 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+
1549
+ 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)})});';
1550
 
1551
  }
1552
 
1553
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1554
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
1555
+ if (!function_exists ('add_footer_inline_scripts_2')) echo ai_adb_replace_vars (ai_adb_code ());
1556
+ }
1557
+ }
1558
+
1559
  if (function_exists ('add_footer_inline_scripts_2')) {
1560
  add_footer_inline_scripts_2 ();
1561
  }
1796
  update_post_meta ($post_id, '_adinserter_block_exceptions', implode (",", $selected));
1797
  }
1798
 
 
 
 
 
1799
  function ai_widgets_init_hook () {
1800
  if (is_multisite() && !is_main_site () && !multisite_widgets_enabled ()) return;
1801
  register_widget ('ai_widget');
1802
  }
1803
 
1804
+ function get_page_type_debug_info () {
1805
+ global $ai_wp_data;
1806
+
1807
+ switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1808
+ case AI_PT_STATIC:
1809
+ $page_type = 'STATIC PAGE';
1810
+ break;
1811
+ case AI_PT_POST:
1812
+ $page_type = 'POST';
1813
+ break;
1814
+ case AI_PT_HOMEPAGE:
1815
+ $page_type = 'HOMEPAGE';
1816
+ break;
1817
+ case AI_PT_CATEGORY:
1818
+ $page_type = 'CATEGORY PAGE';
1819
+ break;
1820
+ case AI_PT_SEARCH:
1821
+ $page_type = 'SEARCH PAGE';
1822
+ break;
1823
+ case AI_PT_ARCHIVE:
1824
+ $page_type = 'ARCHIVE PAGE';
1825
+ break;
1826
+ case AI_PT_404:
1827
+ $page_type = 'ERROR 404 PAGE';
1828
+ break;
1829
+ case AI_PT_AJAX:
1830
+ $page_type = 'AJAX CALL';
1831
+ break;
1832
+ default:
1833
+ $page_type = 'UNKNOWN PAGE TYPE';
1834
+ break;
1835
+ }
1836
+ $style = AI_DEBUG_PAGE_TYPE_STYLE;
1837
+
1838
+ return "<section style='$style'>".$page_type."</section>";
1839
+ }
1840
+
1841
+
1842
  function ai_wp_head_hook () {
1843
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
1844
 
1858
 
1859
  if ($obj->get_enable_manual ()) {
1860
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1861
+ echo do_shortcode ($obj->ai_getCode ());
1862
+ }
1863
+
1864
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
1865
+ echo "<script>
1866
+ jQuery(document).ready(function($) {
1867
+ $('body').prepend (\"", get_page_type_debug_info () , "\");
1868
+ });
1869
+ </script>\n";
1870
  }
1871
 
1872
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1883
  $start_time = microtime (true);
1884
  }
1885
 
1886
+ if (!(defined ('DOING_AJAX') && DOING_AJAX)) {
1887
+ add_footer_inline_scripts ();
1888
+ }
1889
 
1890
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
1891
 
1896
 
1897
  if ($obj->get_enable_manual ()) {
1898
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 && !$obj->get_enable_404()) return;
1899
+ echo do_shortcode ($obj->ai_getCode ());
1900
+ }
1901
+
1902
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
1903
+ echo get_page_type_debug_info () , "\n";
1904
  }
1905
 
1906
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1910
  }
1911
 
1912
  function ai_write_debug_info ($write_processing_log = false) {
1913
+ 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;
1914
 
1915
  echo sprintf ("%-25s%s", AD_INSERTER_NAME, AD_INSERTER_VERSION);
1916
  if (function_exists ('ai_debug_header')) ai_debug_header ();
1922
  echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2, '.' , ''), " ms\n";
1923
 
1924
  echo "SETTINGS: ";
1925
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']))
1926
+ echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
1927
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1928
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]);
1929
 
1930
  echo "\n";
1931
  echo "SETTINGS TIMESTAMP: ";
1932
+ 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";
1933
  echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
1934
  if (is_multisite()) {
1935
  echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
1951
  case AI_PT_ARCHIVE: echo "ARCHIVE PAGE"; break;
1952
  case AI_PT_SEARCH: echo "SEARCH PAGE"; break;
1953
  case AI_PT_404: echo "404 PAGE"; break;
1954
+ case AI_PT_ADMIN: echo "ADMIN"; break;
1955
  case AI_PT_FEED: echo "FEED"; break;
1956
+ case AI_PT_AJAX: echo "AJAX"; break;
1957
+ case AI_PT_ANY: echo "ANY ?"; break;
1958
+ case AI_PT_NONE: echo "NONE ?"; break;
1959
  default: echo "?"; break;
1960
  }
1961
  echo "\n";
1962
+
1963
+ switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
1964
+ case AI_PT_STATIC:
1965
+ case AI_PT_POST:
1966
+ echo 'POST TYPE: ', get_post_type (), "\n";
1967
+ $category_data = get_the_category();
1968
+ $categories = array ();
1969
+ foreach ($category_data as $category) {
1970
+ $categories []= $category->slug;
1971
+ }
1972
+ echo 'CATEGORIES: ', implode (', ', $categories), "\n";
1973
+ $tag_data = wp_get_post_tags (get_the_ID());
1974
+ $tags = array ();
1975
+ foreach ($tag_data as $tag) {
1976
+ $tags []= $tag->slug;
1977
+ }
1978
+ echo 'TAGS: ', implode (', ', $tags), "\n";
1979
+ $taxonomies = array ();
1980
+ $taxonomy_names = get_post_taxonomies ();
1981
+ foreach ($taxonomy_names as $taxonomy_name) {
1982
+ $terms = get_the_terms (0, $taxonomy_name);
1983
+ if (is_array ($terms)) {
1984
+ foreach ($terms as $term) {
1985
+ $taxonomies [] = strtolower ($term->taxonomy) . ':' . strtolower ($term->slug);
1986
+ }
1987
+ }
1988
+ }
1989
+ echo 'TAXONOMIES: ', implode (', ', $taxonomies), "\n";
1990
+ echo 'ID: ', get_the_ID(), "\n";
1991
+ }
1992
+
1993
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
1994
+ echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_debug_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
1995
  if (function_exists ('ai_debug')) ai_debug ();
1996
  echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
1997
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
2039
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2040
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2041
 
2042
+ echo 'AD BLOCKING DETECTION: ', $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2043
+ if ($block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ()) {
2044
+ echo 'ADB ACTION: ';
2045
+ switch (get_adb_action ()) {
2046
+ case AI_ACTION_NONE:
2047
+ echo AI_TEXT_NONE;
2048
+ break;
2049
+ case AI_ACTION_WARNING_MESSAGE:
2050
+ echo AI_TEXT_WARNING_MESSAGE;
2051
+ break;
2052
+ case AI_ACTION_REDIRECTION:
2053
+ echo AI_TEXT_REDIRECTION;
2054
+ break;
2055
+ }
2056
+ echo "\n";
2057
+ echo 'ADB DELAY ACTION: ', get_delay_action (), "\n";
2058
+ echo 'ADB NO ACTION PERIOD: ', get_no_action_period (), "\n";
2059
+ echo 'ADB SELECTORS: ', get_adb_selectors (), "\n";
2060
+ $redirection_page = get_redirection_page ();
2061
+ echo 'ADB REDIRECTION PAGE: ', $redirection_page != 0 ? get_the_title ($redirection_page) . ' (' . get_permalink ($redirection_page) . ')' : $redirection_page, "\n";
2062
+ echo 'ADB REDIRECTION URL: ', get_custom_redirection_url (), "\n";
2063
+ echo 'ADB MESSAGE: ', $block_object [AI_ADB_MESSAGE_OPTION_NAME]->ai_getCode (), "\n";
2064
+ echo 'ADB MESSAGE CSS: ', get_message_css (), "\n";
2065
+ echo 'ADB OVERLAY CSS: ', get_overlay_css (), "\n";
2066
+ echo 'ADB UNDISMISSIBLE: ', get_undismissible_message () ? 'ON' : 'OFF', "\n";
2067
+ }
2068
 
2069
  echo "\n";
2070
 
2082
  foreach (array_keys ($default->wp_options) as $key){
2083
  switch ($key) {
2084
  case AI_OPTION_CODE:
2085
+ case AI_OPTION_BLOCK_NAME:
2086
  continue 2;
2087
  case AI_OPTION_DISPLAY_ON_PAGES:
2088
  case AI_OPTION_DISPLAY_ON_POSTS:
2114
  $settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
2115
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
2116
  break;
2117
+ case AI_OPTION_FILTER_TYPE:
2118
+ $settings = $settings .= "[" . $key . ": " . $obj->get_filter_type_text () . ']';
2119
+ break;
2120
  default:
2121
  $settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
2122
  break;
2203
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2204
  if (count ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]))
2205
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2206
+ if (count ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2207
+ echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2208
+ if (count ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2209
+ echo "BETWEEN COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2210
+ if (count ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]))
2211
+ echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][AI_PT_ANY]), "\n";
2212
 
2213
 
2214
+ echo "\nBLOCKS FOR THIS PAGE TYPE\n";
2215
+ 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]]))
2216
  echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2217
+ 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]]))
2218
  echo "EXCERPT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2219
+ 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]]))
2220
  echo "LOOP START HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_START_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2221
+ 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]]))
2222
  echo "LOOP END HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2223
+ 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]]))
2224
  echo "POST HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2225
+ 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]]))
2226
+ echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2227
+ 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]]))
2228
+ echo "BETWEEN COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2229
+ 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]]))
2230
+ echo "AFTER COMMENTS BLOCKS: ", implode (", ", $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]), "\n";
2231
 
2232
  if ($write_processing_log) {
2233
  echo "\nTIME EVENT\n";
2237
  echo $log_line, "\n";
2238
  }
2239
 
2240
+ sort ($block_insertion_log);
2241
+ echo "\nINSERTION SUMMARY\n";
2242
+ echo "======================================\n";
2243
+ foreach ($block_insertion_log as $log_line) {
2244
+ echo substr ($log_line, 3), "\n";
2245
+ }
2246
+ echo "\n\n";
2247
+
2248
  echo "PHP: ", phpversion(), "\n";
2249
+ echo "Memory Limit: ", ini_get ('memory_limit'), "\n";
2250
+ echo "Upload Max Filesize: ", ini_get ('upload_max_filesize'), "\n";
2251
+ echo "Post Max Size: ", ini_get ('post_max_size'), "\n";
2252
+ echo "Max Execution Time: ", ini_get ('max_execution_time'), "\n";
2253
+ echo "Max Input Vars: ", ini_get ('max_input_vars'), "\n";
2254
+ echo "Display Errors: ", ini_get ('display_errors'), "\n";
2255
+ echo "cURL: ", function_exists ('curl_version') ? 'ENABLED' : 'DISABLED', "\n";
2256
+ echo "fsockopen: ", function_exists ('fsockopen') ? 'ENABLED' : 'DISABLED', "\n";
2257
+ echo "\n\n";
2258
+
2259
  global $wp_version;
2260
  echo "Wordpress: ", $wp_version, "\n";
2261
  $current_theme = wp_get_theme();
2274
  echo in_array ($plugin_path, $active_plugins) ? '* ' : ' ', html_entity_decode ($plugin ["Name"]), ' ', $plugin ["Version"], "\n";
2275
  }
2276
  }
2277
+
2278
+
2279
  }
2280
 
2281
  function ai_shutdown_hook () {
2289
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST ||
2290
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_CATEGORY ||
2291
  $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_SEARCH ||
2292
+ $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ARCHIVE ||
2293
+ $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_404 ||
2294
+ $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_NONE ||
2295
+ $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ANY) {
2296
  echo "\n<!--\n\n";
2297
  ai_write_debug_info (true);
2298
  echo "\n-->\n";
2351
 
2352
  if (!isset ($plugin_options ['DYNAMIC_BLOCKS'])) $plugin_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
2353
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
2354
+ if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
2355
+ if (!isset ($plugin_options ['ADB_ACTION'])) $plugin_options ['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
2356
+ if (!isset ($plugin_options ['ADB_DELAY_ACTION'])) $plugin_options ['ADB_DELAY_ACTION'] = '';
2357
+ if (!isset ($plugin_options ['ADB_NO_ACTION_PERIOD'])) $plugin_options ['ADB_NO_ACTION_PERIOD'] = AI_DEFAULT_ADB_NO_ACTION_PERIOD;
2358
+ if (!isset ($plugin_options ['ADB_SELECTORS'])) $plugin_options ['ADB_SELECTORS'] = '';
2359
+ if (!isset ($plugin_options ['ADB_REDIRECTION_PAGE'])) $plugin_options ['ADB_REDIRECTION_PAGE'] = AI_DEFAULT_ADB_REDIRECTION_PAGE;
2360
+ if (!isset ($plugin_options ['ADB_CUSTOM_REDIRECTION_URL'])) $plugin_options ['ADB_CUSTOM_REDIRECTION_URL'] = '';
2361
+ if (!isset ($plugin_options ['ADB_OVERLAY_CSS'])) $plugin_options ['ADB_OVERLAY_CSS'] = AI_DEFAULT_ADB_OVERLAY_CSS;
2362
+ if (!isset ($plugin_options ['ADB_MESSAGE_CSS'])) $plugin_options ['ADB_MESSAGE_CSS'] = AI_DEFAULT_ADB_MESSAGE_CSS;
2363
+ if (!isset ($plugin_options ['ADB_UNDISMISSIBLE_MESSAGE'])) $plugin_options ['ADB_UNDISMISSIBLE_MESSAGE'] = AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE;
2364
  if (!isset ($plugin_options ['ADMIN_TOOLBAR_DEBUGGING'])) $plugin_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
2365
  if (!isset ($plugin_options ['REMOTE_DEBUGGING'])) $plugin_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
2366
  if (!isset ($plugin_options ['JAVASCRIPT_DEBUGGING'])) $plugin_options ['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
2435
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD OPTIONS START");
2436
 
2437
  if (is_multisite()) {
2438
+ $ai_db_options_multisite = get_site_option (AI_OPTION_NAME);
2439
  option_stripslashes ($ai_db_options_multisite);
2440
  }
2441
 
2442
  if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
2443
+ $ai_db_options = get_blog_option (BLOG_ID_CURRENT_SITE, AI_OPTION_NAME);
2444
  option_stripslashes ($ai_db_options);
2445
  } else {
2446
+ $ai_db_options = get_option (AI_OPTION_NAME);
2447
  option_stripslashes ($ai_db_options);
2448
  }
2449
 
2453
  function get_viewport_css () {
2454
  global $ai_db_options;
2455
 
2456
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'])) $ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'] = generate_viewport_css ();
2457
 
2458
+ return ($ai_db_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS']);
2459
  }
2460
 
2461
  function get_syntax_highlighter_theme () {
2462
  global $ai_db_options;
2463
 
2464
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME'])) $ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME'] = DEFAULT_SYNTAX_HIGHLIGHTER_THEME;
2465
 
2466
+ return ($ai_db_options [AI_OPTION_GLOBAL]['SYNTAX_HIGHLIGHTER_THEME']);
2467
  }
2468
 
2469
  function get_block_class_name () {
2470
  global $ai_db_options;
2471
 
2472
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME'])) $ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
2473
 
2474
+ return ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME']);
2475
  }
2476
 
2477
  function get_minimum_user_role () {
2478
  global $ai_db_options;
2479
 
2480
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE'])) $ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2481
 
2482
+ return ($ai_db_options [AI_OPTION_GLOBAL]['MINIMUM_USER_ROLE']);
2483
  }
2484
 
2485
  function get_sticky_widget_margin () {
2486
  global $ai_db_options;
2487
 
2488
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN'])) $ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN'] = DEFAULT_STICKY_WIDGET_MARGIN;
2489
 
2490
+ return ($ai_db_options [AI_OPTION_GLOBAL]['STICKY_WIDGET_MARGIN']);
2491
  }
2492
 
2493
  function get_plugin_priority () {
2494
  global $ai_db_options;
2495
 
2496
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY'])) $ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
2497
 
2498
+ return ($ai_db_options [AI_OPTION_GLOBAL]['PLUGIN_PRIORITY']);
2499
  }
2500
 
2501
  function get_dynamic_blocks(){
2502
  global $ai_db_options;
2503
 
2504
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
2505
 
2506
+ return ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS']);
2507
  }
2508
 
2509
  function get_paragraph_counting_functions(){
2510
  global $ai_db_options;
2511
 
2512
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS'])) $ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
2513
+
2514
+ return ($ai_db_options [AI_OPTION_GLOBAL]['PARAGRAPH_COUNTING_FUNCTIONS']);
2515
+ }
2516
+
2517
+ function get_no_paragraph_counting_inside () {
2518
+ global $ai_db_options;
2519
+
2520
+ 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;
2521
 
2522
+ return (str_replace (array ('<', '>'), '', $ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE']));
2523
  }
2524
 
2525
  function get_admin_toolbar_debugging () {
2526
  global $ai_db_options;
2527
 
2528
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
2529
 
2530
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADMIN_TOOLBAR_DEBUGGING']);
2531
  }
2532
 
2533
  function get_remote_debugging () {
2534
  global $ai_db_options;
2535
 
2536
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
2537
 
2538
+ return ($ai_db_options [AI_OPTION_GLOBAL]['REMOTE_DEBUGGING']);
2539
  }
2540
 
2541
  function get_javascript_debugging () {
2542
  global $ai_db_options;
2543
 
2544
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
2545
 
2546
+ return ($ai_db_options [AI_OPTION_GLOBAL]['JAVASCRIPT_DEBUGGING']);
2547
  }
2548
 
2549
  function get_viewport_name ($viewport_number) {
2550
  global $ai_db_options;
2551
 
2552
  $viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
2553
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]))
2554
+ $ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
2555
 
2556
+ return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
2557
  }
2558
 
2559
  function get_viewport_width ($viewport_number) {
2560
  global $ai_db_options;
2561
 
2562
  $viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
2563
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]))
2564
+ $ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
2565
 
2566
+ return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
2567
  }
2568
 
2569
  function get_country_group_name ($group_number) {
2570
  global $ai_db_options;
2571
 
2572
  $country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
2573
+ 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;
2574
 
2575
+ return ($ai_db_options [AI_OPTION_GLOBAL][$country_group_settins_name]);
2576
  }
2577
 
2578
  function get_group_country_list ($group_number) {
2579
  global $ai_db_options;
2580
 
2581
  $group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
2582
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name])) $ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name] = '';
2583
 
2584
+ return ($ai_db_options [AI_OPTION_GLOBAL][$group_countries_settins_name]);
2585
  }
2586
 
2587
  function multisite_settings_page_enabled () {
2651
  return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
2652
  }
2653
 
2654
+ function get_adb_action () {
2655
+ global $ai_db_options;
2656
+
2657
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
2658
+
2659
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_ACTION']);
2660
+ }
2661
+
2662
+ function get_delay_action ($return_number = false) {
2663
+ global $ai_db_options;
2664
+
2665
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION'] = '';
2666
+
2667
+ if ($return_number) {
2668
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION']);
2669
+ if ($value == '') $value = 0;
2670
+ if (is_numeric ($value)) return $value; else return 0;
2671
+ }
2672
+
2673
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_DELAY_ACTION']);
2674
+ }
2675
+
2676
+ function get_no_action_period ($return_number = false) {
2677
+ global $ai_db_options;
2678
+
2679
+ 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;
2680
+
2681
+ if ($return_number) {
2682
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD']);
2683
+ if ($value == '') $value = 0;
2684
+ if (is_numeric ($value)) return $value; else return AI_DEFAULT_ADB_NO_ACTION_PERIOD;
2685
+ }
2686
+
2687
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_NO_ACTION_PERIOD']);
2688
+ }
2689
+
2690
+ function get_adb_selectors () {
2691
+ global $ai_db_options;
2692
+
2693
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS'] = '';
2694
+
2695
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_SELECTORS']);
2696
+ }
2697
+
2698
+ function get_redirection_page ($return_number = false) {
2699
+ global $ai_db_options;
2700
+
2701
+ 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;
2702
+
2703
+ if ($return_number) {
2704
+ $value = trim ($ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE']);
2705
+ if ($value == '') $value = 0;
2706
+ if (is_numeric ($value)) return $value; else return AI_DEFAULT_ADB_REDIRECTION_PAGE;
2707
+ }
2708
+
2709
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_REDIRECTION_PAGE']);
2710
+ }
2711
+
2712
+ function get_custom_redirection_url () {
2713
+ global $ai_db_options;
2714
+
2715
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL'])) $ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL'] = '';
2716
+
2717
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_CUSTOM_REDIRECTION_URL']);
2718
+ }
2719
+
2720
+ function get_message_css () {
2721
+ global $ai_db_options;
2722
+
2723
+ 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;
2724
+
2725
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_MESSAGE_CSS']);
2726
+ }
2727
+
2728
+ function get_overlay_css () {
2729
+ global $ai_db_options;
2730
+
2731
+ 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;
2732
+
2733
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_OVERLAY_CSS']);
2734
+ }
2735
+
2736
+ function get_undismissible_message () {
2737
+ global $ai_db_options;
2738
+
2739
+ 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;
2740
+
2741
+ return ($ai_db_options [AI_OPTION_GLOBAL]['ADB_UNDISMISSIBLE_MESSAGE']);
2742
+ }
2743
+
2744
  function filter_html_class ($str){
2745
 
2746
  $str = str_replace (array ("\\\""), array ("\""), $str);
2763
  $value = str_replace (array ("\\\""), array ("\""), $value);
2764
 
2765
  if ($option == AI_OPTION_DOMAIN_LIST ||
2766
+ $option == 'NO_PARAGRAPH_COUNTING_INSIDE' ||
2767
+ $option == 'ADB_SELECTORS' ||
2768
+ $option == AI_OPTION_PARAGRAPH_TAGS ||
2769
  $option == AI_OPTION_IP_ADDRESS_LIST ||
2770
  $option == AI_OPTION_COUNTRY_LIST) {
2771
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]"), "", $value);
2778
  ) {
2779
  $value = esc_html ($value);
2780
  }
2781
+ elseif ($option == AI_OPTION_BLOCK_NAME ||
2782
  $option == AI_OPTION_GENERAL_TAG ||
2783
  $option == AI_OPTION_DOMAIN_LIST ||
2784
  $option == AI_OPTION_CATEGORY_LIST ||
2789
  $option == AI_OPTION_PARAGRAPH_TEXT_TYPE ||
2790
  $option == AI_OPTION_PARAGRAPH_NUMBER ||
2791
  $option == AI_OPTION_MIN_PARAGRAPHS ||
2792
+ $option == AI_OPTION_MIN_WORDS_ABOVE ||
2793
  $option == AI_OPTION_AVOID_PARAGRAPHS_ABOVE ||
2794
  $option == AI_OPTION_AVOID_PARAGRAPHS_BELOW ||
2795
  $option == AI_OPTION_AVOID_TRY_LIMIT ||
2803
  $option == AI_OPTION_END_DATE ||
2804
  $option == AI_OPTION_FALLBACK ||
2805
  $option == AI_OPTION_EXCERPT_NUMBER ||
2806
+ $option == 'ADB_DELAY_ACTION' ||
2807
+ $option == 'ADB_NO_ACTION_PERIOD' ||
2808
+ $option == 'ADB_REDIRECTION_PAGE' ||
2809
+ $option == 'ADB_CUSTOM_REDIRECTION_URL' ||
2810
+ $option == AI_OPTION_CUSTOM_CSS ||
2811
+ $option == 'ADB_OVERLAY_CSS' ||
2812
+ $option == 'ADB_MESSAGE_CSS') {
2813
  $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
2814
  $value = esc_html ($value);
2815
  }
2840
  if (is_numeric ($block) && $block >= 1 && $block <= AD_INSERTER_BLOCKS) {
2841
  generate_code_preview ($block);
2842
  }
2843
+ elseif ($block == 'adb') {
2844
+ generate_code_preview_adb ($block);
2845
+ }
2846
  }
2847
 
2848
  elseif (isset ($_GET ["image"])) {
2851
  readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$_GET ["image"]);
2852
  }
2853
 
2854
+ elseif (isset ($_GET ["rating"])) {
2855
+ $cache_time = $_GET ["rating"] == 'update' ? 5 * 60 : AI_TRANSIENT_RATING_EXPIRATION;
2856
+ if (!get_transient (AI_TRANSIENT_RATING) || !($transient_timeout = get_option ('_transient_timeout_' . AI_TRANSIENT_RATING)) || AI_TRANSIENT_RATING_EXPIRATION - ($transient_timeout - time ()) > $cache_time) {
2857
+ if (preg_match_all ("#<span class=\"counter-count\">(.+?)</span>#", file_get_contents ('https://wordpress.org/plugins/ad-inserter/'), $ratings)) {
2858
+ if (count ($ratings [1]) == 5) {
2859
+ $total_rating = 0;
2860
+ $total_count = 0;
2861
+ foreach ($ratings [1] as $index => $count) {
2862
+ $total_rating += (5 - $index) * $count;
2863
+ $total_count += $count;
2864
+ }
2865
+ $rating = number_format ($total_rating / $total_count, 4);
2866
+ set_transient (AI_TRANSIENT_RATING, $rating, AI_TRANSIENT_RATING_EXPIRATION);
2867
+ }
2868
+ }
2869
+ }
2870
+ if ($rating = get_transient (AI_TRANSIENT_RATING)) {
2871
+ if ($rating > 1 && $rating <= 5) echo $rating;
2872
+ }
2873
+ }
2874
+
2875
  elseif (function_exists ('ai_data_ajax')) {
2876
  ai_data_ajax ();
2877
  }
2884
  $obj = new ai_Block (1);
2885
 
2886
  $extract = array ();
2887
+ $content_hook_blocks = array ();
2888
+ $excerpt_hook_blocks = array ();
2889
+ $loop_start_hook_blocks = array ();
2890
+ $loop_end_hook_blocks = array ();
2891
+ $post_hook_blocks = array ();
2892
+ $before_comments_hook_blocks = array ();
2893
+ $between_comments_hook_blocks = array ();
2894
+ $after_comments_hook_blocks = array ();
2895
+
2896
+ $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());
2897
+ $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());
2898
+ $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());
2899
+ $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());
2900
+ $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());
2901
+ $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());
2902
+ $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());
2903
+ $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());
2904
 
2905
  // Generate extracted data
2906
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2947
  foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
2948
  $post_hook_blocks [AI_PT_ANY][]= $block;
2949
  break;
2950
+ case AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS:
2951
+ foreach ($page_types as $block_page_type) $before_comments_hook_blocks [$block_page_type][]= $block;
2952
+ $before_comments_hook_blocks [AI_PT_ANY][]= $block;
2953
+ break;
2954
+ case AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS:
2955
+ foreach ($page_types as $block_page_type) $between_comments_hook_blocks [$block_page_type][]= $block;
2956
+ $between_comments_hook_blocks [AI_PT_ANY][]= $block;
2957
+ break;
2958
+ case AI_AUTOMATIC_INSERTION_AFTER_COMMENTS:
2959
+ foreach ($page_types as $block_page_type) $after_comments_hook_blocks [$block_page_type][]= $block;
2960
+ $after_comments_hook_blocks [AI_PT_ANY][]= $block;
2961
+ break;
2962
  }
2963
  }
2964
  }
2965
 
2966
+ $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
2967
+ $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
2968
+ $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
2969
+ $extract [LOOP_END_HOOK_BLOCKS] = $loop_end_hook_blocks;
2970
+ $extract [POST_HOOK_BLOCKS] = $post_hook_blocks;
2971
+ $extract [BEFORE_COMMENTS_HOOK_BLOCKS] = $before_comments_hook_blocks;
2972
+ $extract [BETWEEN_COMMENTS_HOOK_BLOCKS] = $between_comments_hook_blocks;
2973
+ $extract [AFTER_COMMENTS_HOOK_BLOCKS] = $after_comments_hook_blocks;
2974
 
2975
  return ($extract);
2976
  }
2983
  ai_load_options ();
2984
 
2985
  if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
2986
+ isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
2987
  isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
2988
+ isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
2989
+ isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS]))
2990
  $ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
2991
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
2992
 
2993
  $obj = new ai_Block (0);
2994
+ $obj->wp_options [AI_OPTION_BLOCK_NAME] = 'Default';
2995
  $block_object [0] = $obj;
2996
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
2997
  $obj = new ai_Block ($block);
3003
  $adF = new ai_AdF();
3004
  $adH->load_options (AI_HEADER_OPTION_NAME);
3005
  $adF->load_options (AI_FOOTER_OPTION_NAME);
3006
+ $block_object [AI_HEADER_OPTION_NAME] = $adH;
3007
+ $block_object [AI_FOOTER_OPTION_NAME] = $adF;
3008
+
3009
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
3010
+ $adA = new ai_AdA();
3011
+ $adA->load_options (AI_ADB_MESSAGE_OPTION_NAME);
3012
+ $block_object [AI_ADB_MESSAGE_OPTION_NAME] = $adA;
3013
+ }
3014
 
3015
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS END");
3016
  }
3111
 
3112
  if ($exported_settings !== false) {
3113
  foreach (array_keys ($ad->wp_options) as $key){
3114
+ if ($key == AI_OPTION_BLOCK_NAME && isset ($_POST [$import_name_switch_name]) && $_POST [$import_name_switch_name] != "1") {
3115
  $form_field_name = $key . WP_FORM_FIELD_POSTFIX . $block;
3116
  if (isset ($_POST [$form_field_name])){
3117
  $ad->wp_options [$key] = filter_option ($key, $_POST [$form_field_name]);
3158
  }
3159
  }
3160
 
3161
+ $ai_options [AI_HEADER_OPTION_NAME] = $adH->wp_options;
3162
+ $ai_options [AI_FOOTER_OPTION_NAME] = $adF->wp_options;
3163
+
3164
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
3165
+ $adA = new ai_AdA();
3166
+ foreach(array_keys($adA->wp_options) as $key){
3167
+ $form_field_name = $key . WP_FORM_FIELD_POSTFIX . AI_ADB_MESSAGE_OPTION_NAME;
3168
+ if(isset ($_POST [$form_field_name])){
3169
+ $adA->wp_options [$key] = filter_option_hf ($key, $_POST [$form_field_name]);
3170
+ }
3171
+ }
3172
+ $ai_options [AI_ADB_MESSAGE_OPTION_NAME] = $adA->wp_options;
3173
+ }
3174
 
3175
  $options = array ();
3176
 
3177
  if (function_exists ('ai_filter_global_settings')) ai_filter_global_settings ($options);
3178
 
3179
+ if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
3180
+ if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
3181
+ if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
3182
+ if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('STICKY_WIDGET_MARGIN', $_POST ['sticky-widget-margin']);
3183
+ if (isset ($_POST ['plugin_priority'])) $options ['PLUGIN_PRIORITY'] = filter_option ('PLUGIN_PRIORITY', $_POST ['plugin_priority']);
3184
+ if (isset ($_POST ['dynamic_blocks'])) $options ['DYNAMIC_BLOCKS'] = filter_option ('DYNAMIC_BLOCKS', $_POST ['dynamic_blocks']);
3185
+ if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
3186
+ if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
3187
+ if (isset ($_POST [AI_OPTION_ADB_ACTION])) $options ['ADB_ACTION'] = filter_option ('ADB_ACTION', $_POST [AI_OPTION_ADB_ACTION]);
3188
+ if (isset ($_POST [AI_OPTION_ADB_DELAY_ACTION])) $options ['ADB_DELAY_ACTION'] = filter_option ('ADB_DELAY_ACTION', $_POST [AI_OPTION_ADB_DELAY_ACTION]);
3189
+ 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]);
3190
+ if (isset ($_POST [AI_OPTION_ADB_SELECTORS])) $options ['ADB_SELECTORS'] = filter_option ('ADB_SELECTORS', $_POST [AI_OPTION_ADB_SELECTORS]);
3191
+ if (isset ($_POST [AI_OPTION_ADB_REDIRECTION_PAGE])) $options ['ADB_REDIRECTION_PAGE'] = filter_option ('ADB_REDIRECTION_PAGE', $_POST [AI_OPTION_ADB_REDIRECTION_PAGE]);
3192
+ 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]);
3193
+ if (isset ($_POST [AI_OPTION_ADB_MESSAGE_CSS])) $options ['ADB_MESSAGE_CSS'] = filter_option ('ADB_MESSAGE_CSS', $_POST [AI_OPTION_ADB_MESSAGE_CSS]);
3194
+ if (isset ($_POST [AI_OPTION_ADB_OVERLAY_CSS])) $options ['ADB_OVERLAY_CSS'] = filter_option ('ADB_OVERLAY_CSS', $_POST [AI_OPTION_ADB_OVERLAY_CSS]);
3195
+ if (isset ($_POST [AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE])) $options ['ADB_UNDISMISSIBLE_MESSAGE'] = filter_option ('ADB_UNDISMISSIBLE_MESSAGE', $_POST [AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE]);
3196
+ if (isset ($_POST ['admin_toolbar_debugging'])) $options ['ADMIN_TOOLBAR_DEBUGGING'] = filter_option ('ADMIN_TOOLBAR_DEBUGGING', $_POST ['admin_toolbar_debugging']);
3197
+ if (isset ($_POST ['remote_debugging'])) $options ['REMOTE_DEBUGGING'] = filter_option ('REMOTE_DEBUGGING', $_POST ['remote_debugging']);
3198
+ if (isset ($_POST ['javascript_debugging'])) $options ['JAVASCRIPT_DEBUGGING'] = filter_option ('JAVASCRIPT_DEBUGGING', $_POST ['javascript_debugging']);
3199
 
3200
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
3201
  if (isset ($_POST ['viewport-name-'.$viewport]))
3206
 
3207
  $options ['VIEWPORT_CSS'] = generate_viewport_css ();
3208
 
3209
+ $ai_options [AI_OPTION_GLOBAL] = ai_check_plugin_options ($options);
3210
  }
3211
 
3212
  if (!empty ($invalid_blocks)) {
3218
  // Generate and save extract
3219
  $ai_options [AI_EXTRACT_OPTION_NAME] = ai_generate_extract ($ai_options);
3220
 
3221
+ $ai_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
3222
 
3223
+ update_option (AI_OPTION_NAME, $ai_options);
3224
 
3225
  // Multisite
3226
  if (is_multisite () && is_main_site ()) {
3229
  if (function_exists ('ai_filter_multisite_settings')) ai_filter_multisite_settings ($options);
3230
 
3231
  ai_check_multisite_options ($options);
3232
+ update_site_option (AI_OPTION_NAME, $options);
3233
  }
3234
 
3235
  ai_load_settings ();
3254
  delete_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
3255
  delete_option (AD_OPTIONS);
3256
 
3257
+ delete_option (AI_OPTION_NAME);
3258
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
3259
  if (is_multisite () && is_main_site ()) {
3260
+ delete_site_option (AI_OPTION_NAME, $options);
3261
  }
3262
 
3263
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
3448
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
3449
  $globals_name = AI_CONTENT_COUNTER_NAME;
3450
 
3451
+ $special_element_tags = explode (',', str_replace (' ', '', get_no_paragraph_counting_inside ()));
3452
 
3453
  if (!isset ($ad_inserter_globals [$globals_name])) {
3454
  $ad_inserter_globals [$globals_name] = 1;
3484
  $ai_last_check = AI_CHECK_NONE;
3485
  $current_block = 0;
3486
 
3487
+ if (isset ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3488
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3489
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3490
 
3628
  $ai_last_check = AI_CHECK_NONE;
3629
  $current_block = 0;
3630
 
3631
+ if (isset ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3632
  foreach ($ai_db_options_extract [EXCERPT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3633
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3634
 
3720
 
3721
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
3722
 
 
 
3723
  $counter = $ad_inserter_globals [$globals_name];
3724
  if ($counter == 1) $counter = '';
3725
 
3726
+ $style = AI_DEBUG_POSITIONS_STYLE;
3727
+
3728
  echo "<section style='$style'>".($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? "BEFORE" : "AFTER")." POST ".$counter."</section>";
3729
  }
3730
 
3738
  $ai_last_check = AI_CHECK_NONE;
3739
  $current_block = 0;
3740
 
3741
+
3742
+ $extract_index = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? LOOP_START_HOOK_BLOCKS : LOOP_END_HOOK_BLOCKS;
3743
+ if (isset ($ai_db_options_extract [$extract_index][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3744
+ foreach ($ai_db_options_extract [$extract_index][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3745
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3746
 
3747
  if (!isset ($block_object [$block])) continue;
3808
 
3809
  // Process Between Posts postion
3810
  function ai_post_hook ($post) {
3811
+ global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time;
 
3812
 
3813
  if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_ADMIN) return;
3814
 
3843
  $ai_last_check = AI_CHECK_NONE;
3844
  $current_block = 0;
3845
 
3846
+ if (isset ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3847
  foreach ($ai_db_options_extract [POST_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3848
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3849
 
3883
  return $post;
3884
  }
3885
 
3886
+ function ai_comments_array ($comments , $post_id ){
3887
+ global $ai_wp_data;
3888
+
3889
+ $thread_comments = get_option ('thread_comments');
3890
+ $comment_counter = 0;
3891
+ foreach ($comments as $comment) {
3892
+ if (!$thread_comments || empty ($comment->comment_parent))
3893
+ $comment_counter ++;
3894
+ }
3895
+ $ai_wp_data [AI_NUMBER_OF_COMMENTS] = $comment_counter;
3896
+
3897
+ return $comments;
3898
+ }
3899
+
3900
+ function ai_wp_list_comments_args ($args) {
3901
+ global $ai_wp_data;
3902
+
3903
+ // print_r ($args);
3904
+ // $args['per_page'] = 3;
3905
+ // $args['page'] = 2;
3906
+
3907
+ $ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'] = $args ['callback'];
3908
+ $args ['callback'] = 'ai_comment_callback';
3909
+
3910
+ $ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'] = $args ['end-callback'];
3911
+ $args ['end-callback'] = 'ai_comment_end_callback';
3912
+
3913
+ return $args;
3914
+ }
3915
+
3916
+ // Process comments counter + Before Comments postion
3917
+ function ai_comment_callback ($comment, $args, $depth) {
3918
+ global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time, $ai_walker;
3919
+
3920
+ if ($depth == 1) {
3921
+ if (!isset ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) {
3922
+ $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] = 1;
3923
+ } else $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] ++;
3924
+ }
3925
+
3926
+ $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
3927
+ if ($debug_processing) {
3928
+ ai_log ('COMMENT START HOOK START [' . $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] . ':'. $depth . ']');
3929
+ $start_time = microtime (true);
3930
+ }
3931
+
3932
+ if ($depth == 1 && $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] == 1) {
3933
+
3934
+ $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BEFORE_COMMENTS;
3935
+
3936
+ if ($args ['style'] == 'div') $tag = 'div'; else $tag = 'li';
3937
+
3938
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
3939
+
3940
+ $style = AI_DEBUG_POSITIONS_STYLE;
3941
+
3942
+ echo "<$tag>\n";
3943
+ echo "<section style='$style'>BEFORE COMMENTS</section>";
3944
+ echo "</$tag>\n";
3945
+ }
3946
+
3947
+ $ad_code = "";
3948
+
3949
+ $ai_last_check = AI_CHECK_NONE;
3950
+ $current_block = 0;
3951
+
3952
+ if (isset ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
3953
+ foreach ($ai_db_options_extract [BEFORE_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
3954
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3955
+
3956
+ if (!isset ($block_object [$block])) continue;
3957
+
3958
+ $current_block = $block;
3959
+
3960
+ $obj = $block_object [$block];
3961
+ $obj->clear_code_cache ();
3962
+
3963
+ if (!$obj->check_server_side_detection ()) continue;
3964
+ if (!$obj->check_page_types_lists_users ()) continue;
3965
+ // No filter check
3966
+
3967
+ // Last check before counter check before insertion
3968
+ $ai_last_check = AI_CHECK_CODE;
3969
+ if ($obj->ai_getCode () == '') continue;
3970
+
3971
+ // Last check before insertion
3972
+ if (!$obj->check_and_increment_block_counter ()) continue;
3973
+
3974
+ $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3975
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
3976
+ $ad_code .= $obj->get_code_for_insertion ();
3977
+ $ai_last_check = AI_CHECK_INSERTED;
3978
+ }
3979
+ }
3980
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
3981
+
3982
+ echo "<$tag>\n";
3983
+ echo $ad_code;
3984
+ echo "</$tag>\n";
3985
+ }
3986
+
3987
+ if ($debug_processing) {
3988
+ $ai_total_plugin_time += microtime (true) - $start_time;
3989
+ ai_log ("COMMENT END HOOK END\n");
3990
+ }
3991
+
3992
+ if (!empty ($ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'])) {
3993
+ echo call_user_func ($ai_wp_data ['AI_COMMENTS_SAVED_CALLBACK'], $comment, $args, $depth );
3994
+ } else {
3995
+ $ai_walker->comment_callback ($comment, $args, $depth);
3996
+ }
3997
+ }
3998
+
3999
+ // Process Between Comments postion
4000
+ function ai_comment_end_callback ($comment, $args, $depth) {
4001
+ global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check, $ai_total_plugin_time;
4002
+
4003
+ if ($args ['style'] == 'div') $tag = 'div'; else $tag = 'li';
4004
+
4005
+ if (!empty ($ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'])) {
4006
+ echo call_user_func ($ai_wp_data ['AI_COMMENTS_SAVED_END_CALLBACK'], $comment, $args, $depth);
4007
+ } else echo "</$tag><!-- #comment-## -->\n";
4008
+
4009
+ $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
4010
+ if ($debug_processing) {
4011
+ ai_log ('COMMENT END HOOK START [' . $ad_inserter_globals [AI_COMMENT_COUNTER_NAME] . ':'. ($depth + 1) . ']');
4012
+ $start_time = microtime (true);
4013
+ }
4014
+
4015
+ if ($depth == 0) {
4016
+
4017
+ if (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]) &&
4018
+ $ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] != 0 &&
4019
+ !empty ($args ['per_page']) && !empty ($args ['page'])) {
4020
+ $number_of_comments_mod_per_page = $ai_wp_data [AI_NUMBER_OF_COMMENTS] % $args ['per_page'];
4021
+ if ($number_of_comments_mod_per_page != 0) {
4022
+ $last_page = (int) ($ai_wp_data [AI_NUMBER_OF_COMMENTS] / $args ['per_page']) + 1;
4023
+ $last_comment_number = $args ['page'] == $last_page ? $number_of_comments_mod_per_page : $args ['per_page'];
4024
+ } else $last_comment_number = $args ['per_page'];
4025
+ } else $last_comment_number = $ai_wp_data [AI_NUMBER_OF_COMMENTS];
4026
+
4027
+ if ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME] == $last_comment_number) {
4028
+
4029
+ $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_AFTER_COMMENTS;
4030
+
4031
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
4032
+
4033
+ $style = AI_DEBUG_POSITIONS_STYLE;
4034
+
4035
+ echo "<$tag>\n";
4036
+ echo "<section style='$style'>AFTER COMMENTS</section>";
4037
+ echo "</$tag>\n";
4038
+ }
4039
+
4040
+ $ad_code = "";
4041
+
4042
+ $ai_last_check = AI_CHECK_NONE;
4043
+ $current_block = 0;
4044
+
4045
+ if (isset ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
4046
+ foreach ($ai_db_options_extract [AFTER_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
4047
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4048
+
4049
+ if (!isset ($block_object [$block])) continue;
4050
+
4051
+ $current_block = $block;
4052
+
4053
+ $obj = $block_object [$block];
4054
+ $obj->clear_code_cache ();
4055
+
4056
+ if (!$obj->check_server_side_detection ()) continue;
4057
+ if (!$obj->check_page_types_lists_users ()) continue;
4058
+ // No filter check
4059
+
4060
+ // Last check before counter check before insertion
4061
+ $ai_last_check = AI_CHECK_CODE;
4062
+ if ($obj->ai_getCode () == '') continue;
4063
+
4064
+ // Last check before insertion
4065
+ if (!$obj->check_and_increment_block_counter ()) continue;
4066
+
4067
+ $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4068
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4069
+ $ad_code .= $obj->get_code_for_insertion ();
4070
+ $ai_last_check = AI_CHECK_INSERTED;
4071
+ }
4072
+ }
4073
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4074
+
4075
+ echo "<$tag>\n";
4076
+ echo $ad_code;
4077
+ echo "</$tag>\n";
4078
+ } else {
4079
+ $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BETWEEN_COMMENTS;
4080
+
4081
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
4082
+
4083
+ $style = AI_DEBUG_POSITIONS_STYLE;
4084
+
4085
+ echo "<$tag>\n";
4086
+ echo "<section style='$style'>BETWEEN COMMENTS ".$ad_inserter_globals [AI_COMMENT_COUNTER_NAME]."</section>";
4087
+ echo "</$tag>\n";
4088
+ }
4089
+
4090
+ $ad_code = "";
4091
+
4092
+ $ai_last_check = AI_CHECK_NONE;
4093
+ $current_block = 0;
4094
+
4095
+ if (isset ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
4096
+ foreach ($ai_db_options_extract [BETWEEN_COMMENTS_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
4097
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4098
+
4099
+ if (!isset ($block_object [$block])) continue;
4100
+
4101
+ $current_block = $block;
4102
+
4103
+ $obj = $block_object [$block];
4104
+ $obj->clear_code_cache ();
4105
+
4106
+ if (!$obj->check_server_side_detection ()) continue;
4107
+ if (!$obj->check_page_types_lists_users ()) continue;
4108
+ if (!$obj->check_filter ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) continue;
4109
+
4110
+ // Last check before counter check before insertion
4111
+ $ai_last_check = AI_CHECK_CODE;
4112
+ if ($obj->ai_getCode () == '') continue;
4113
+
4114
+ // Last check before insertion
4115
+ if (!$obj->check_and_increment_block_counter ()) continue;
4116
+
4117
+ $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4118
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4119
+ $ad_code .= $obj->get_code_for_insertion ();
4120
+ $ai_last_check = AI_CHECK_INSERTED;
4121
+ }
4122
+ }
4123
+ if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
4124
+
4125
+ echo "<$tag>\n";
4126
+ echo $ad_code;
4127
+ echo "</$tag>\n";
4128
+ }
4129
+ }
4130
+
4131
+ if ($debug_processing) {
4132
+ $ai_total_plugin_time += microtime (true) - $start_time;
4133
+ ai_log ("COMMENT END HOOK END\n");
4134
+ }
4135
+ }
4136
+
4137
  function process_shortcode (&$block, $atts) {
4138
  global $block_object, $ai_last_check, $ai_wp_data;
4139
 
4334
  }
4335
  }
4336
 
4337
+ function ai_add_attr_data (&$tag, $attr, $new_data) {
4338
+
4339
+ if (trim ($tag) != '' && strpos ($tag, '<!--') === false) {
4340
+ if (stripos ($tag, $attr."=") !== false) {
4341
+ preg_match ("/$attr=[\'\"](.+?)[\'\"]/", $tag, $classes);
4342
+ $tag = str_replace ($classes [1], $classes [1]. ' ' . $new_data, $tag);
4343
+ return true;
4344
+ }
4345
+ elseif (strpos ($tag, ">") !== false) {
4346
+ $tag = str_replace ('>', ' ' . $attr . '="' . $new_data . '">', $tag);
4347
+ return true;
4348
+ }
4349
+ }
4350
+
4351
+ return false;
4352
+ }
4353
 
4354
  function ai_widget_draw ($args, $instance, &$block) {
4355
  global $block_object, $ad_inserter_globals, $ai_wp_data, $ai_last_check;
4366
  if ($sticky) {
4367
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
4368
  if ($block == - 1) {
4369
+ $before_widget = $args ['before_widget'];
4370
+ ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
4371
+ ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
4372
+ echo $before_widget;
4373
+ echo $args ['after_widget'];
4374
  return;
4375
  }
4376
  }
4388
  $ad_inserter_globals [$globals_name] = 1;
4389
  } else $ad_inserter_globals [$globals_name] ++;
4390
 
4391
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0)
4392
+ ai_log ("WIDGET (". $obj->number . ') ['.$ad_inserter_globals [$globals_name] . ']');
4393
 
4394
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
4395
 
4409
  // Last check before counter check before insertion
4410
  $ai_last_check = AI_CHECK_CODE;
4411
  if ($obj->ai_getCode () == '') {
4412
+ if ($sticky) {
4413
+ $before_widget = $args ['before_widget'];
4414
+ ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
4415
+ ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
4416
+ echo $before_widget;
4417
+ echo $args ['after_widget'];
4418
+ }
4419
  return;
4420
  }
4421
 
4424
 
4425
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4426
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4427
+
4428
  $viewport_classes = trim ($obj->get_viewport_classes ());
4429
  $sticky_class = $sticky ? ' ai-sticky' : '';
4430
  $widget_classes = trim ($viewport_classes . $sticky_class);
 
4431
 
4432
+ if ($widget_classes != "") {
4433
+ $before_widget = $args ['before_widget'];
4434
+ ai_add_attr_data ($before_widget, 'class', $widget_classes);
4435
+ echo $before_widget;
4436
+ } else echo $args ['before_widget'];
4437
 
4438
  if (!empty ($title)) {
4439
  echo $args ['before_title'], apply_filters ('widget_title', $title), $args ['after_title'];
4443
 
4444
  echo $args ['after_widget'];
4445
 
 
 
4446
  $ai_last_check = AI_CHECK_INSERTED;
4447
 
4448
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && $obj->get_detection_client_side())
4455
 
4456
  $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
4457
 
 
 
4458
  if ($sticky) {
4459
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
4460
+ echo ai_add_attr_data ($args ['before_widget'], 'class', 'ai-sticky');
4461
+ } else echo $args ['before_widget'];
4462
 
4463
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
4464
 
class.php CHANGED
@@ -90,7 +90,7 @@ abstract class ai_BaseCodeBlock {
90
 
91
  $old_name = "ad" . $block . "_name";
92
  if (isset ($options [$old_name])) {
93
- $options [AI_OPTION_NAME] = $options [$old_name];
94
  unset ($options [$old_name]);
95
  }
96
  $old_name = "ad" . $block . "_displayType";
@@ -364,11 +364,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
364
 
365
  parent::__construct();
366
 
367
- $this->wp_options [AI_OPTION_NAME] = AD_NAME;
368
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
369
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
370
  $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
371
  $this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
 
372
  $this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
373
  $this->wp_options [AI_OPTION_MAX_WORDS] = AD_EMPTY_DATA;
374
  $this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS] = AD_EMPTY_DATA;
@@ -383,7 +384,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
383
  $this->wp_options [AI_OPTION_AVOID_TRY_LIMIT] = AD_ONE;
384
  $this->wp_options [AI_OPTION_AVOID_DIRECTION] = AD_BELOW_AND_THEN_ABOVE;
385
  $this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
386
- $this->wp_options [AI_OPTION_FILTER_TYPE] = AI_OPTION_FILTER_AUTO;
 
387
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
388
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
389
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
@@ -409,6 +411,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,6 +491,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
487
  case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
488
  return AI_TEXT_BETWEEN_POSTS;
489
  break;
 
 
 
 
 
 
 
 
 
490
  default:
491
  return '';
492
  break;
@@ -628,6 +641,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +658,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,13 +718,73 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +810,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +831,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +852,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +873,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +940,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +963,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +980,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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,7 +1071,22 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
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
 
@@ -1076,6 +1169,59 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1076
  }
1077
  }
1078
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1079
  $title = '';
1080
  $fallback_code = '';
1081
  $color = '#e00';
@@ -1211,7 +1357,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1211
  }
1212
 
1213
  public function get_ad_name(){
1214
- $option = isset ($this->wp_options [AI_OPTION_NAME]) ? $this->wp_options [AI_OPTION_NAME] : "";
1215
  if ($option == '') $option = AD_NAME. " " . $this->number;
1216
  return $option;
1217
  }
@@ -1245,6 +1391,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1245
  return $option;
1246
  }
1247
 
 
 
 
 
 
 
 
 
 
 
 
1248
  public function get_ad_enabled_on_which_pages (){
1249
  $option = isset ($this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES]) ? $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] : "";
1250
  if ($option == '') $option = AD_ENABLED_ON_ALL;
@@ -1544,6 +1701,42 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1544
  foreach ($paragraph_positions as $index => $paragraph_position) {
1545
  $positions []= $index + 1;
1546
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1547
  }
1548
  }
1549
 
@@ -1695,12 +1888,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1695
 
1696
  if ($position_preview || !empty ($positions)) {
1697
  $offset = 0;
1698
- $code_for_insertion = $this->get_code_for_insertion ();
1699
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
1700
 
1701
  foreach ($paragraph_positions as $counter => $paragraph_position) {
1702
  if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
1703
- elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
1704
  else continue;
1705
 
1706
  if ($multibyte) {
@@ -1966,10 +2162,64 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1966
  }
1967
  }
1968
  elseif ($position == '') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1969
  foreach ($paragraph_positions as $index => $paragraph_position) {
1970
  $positions []= $index + 1;
1971
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1972
  }
 
1973
  }
1974
 
1975
  if (empty ($positions)) {
@@ -2122,12 +2372,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2122
 
2123
  if ($position_preview || !empty ($positions)) {
2124
  $offset = 0;
2125
- $code_for_insertion = $this->get_code_for_insertion ();
2126
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
2127
 
2128
  foreach ($paragraph_positions as $counter => $paragraph_position) {
2129
  if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
2130
- elseif (!empty ($positions) && in_array ($counter + 1, $positions)) {$inserted_code = $code_for_insertion; $ai_last_check = AI_CHECK_INSERTED;}
 
 
 
 
2131
  else continue;
2132
 
2133
  if ($multibyte) {
@@ -2316,6 +2569,76 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2316
  }
2317
  }
2318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2319
  function check_id () {
2320
  global $ai_wp_data;
2321
 
@@ -2570,6 +2893,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2570
  $ai_last_check = AI_CHECK_TAG;
2571
  if (!$this->check_tag ()) return false;
2572
 
 
 
 
2573
  $ai_last_check = AI_CHECK_ID;
2574
  if (!$this->check_id ()) return false;
2575
 
@@ -2640,42 +2966,51 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2640
  function check_filter ($counter_for_filter) {
2641
  global $ai_last_check, $ad_inserter_globals, $page;
2642
 
 
 
2643
  $ai_last_check = AI_CHECK_FILTER;
2644
- $filter_settings = trim ($this->get_call_filter());
2645
- if ($filter_settings == 0 || $filter_settings == '') return true;
2646
 
2647
  switch ($this->get_filter_type ()) {
2648
- case AI_OPTION_FILTER_PHP_FUNCTION_CALLS:
2649
  if (isset ($ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]))
2650
- $counter_for_filter = $ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]; else return false;
2651
  break;
2652
- case AI_OPTION_FILTER_CONTENT_PROCESSING:
2653
  if (isset ($ad_inserter_globals [AI_CONTENT_COUNTER_NAME]))
2654
- $counter_for_filter = $ad_inserter_globals [AI_CONTENT_COUNTER_NAME]; else return false;
2655
  break;
2656
- case AI_OPTION_FILTER_EXCERPT_PROCESSING:
2657
  if (isset ($ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]))
2658
- $counter_for_filter = $ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]; else return false;
2659
  break;
2660
- case AI_OPTION_FILTER_BEFORE_POST_PROCESSING:
2661
  if (isset ($ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]))
2662
- $counter_for_filter = $ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]; else return false;
2663
  break;
2664
- case AI_OPTION_FILTER_AFTER_POST_PROCESSING:
2665
  if (isset ($ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]))
2666
- $counter_for_filter = $ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]; else return false;
2667
  break;
2668
- case AI_OPTION_FILTER_WIDGET_DRAWING:
2669
  if (isset ($ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]))
2670
- $counter_for_filter = $ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]; else return false;
2671
  break;
2672
- case AI_OPTION_FILTER_SUBPAGES:
2673
  if (isset ($page))
2674
- $counter_for_filter = $page; else return false;
2675
  break;
2676
- case AI_OPTION_FILTER_POSTS:
2677
  if (isset ($ad_inserter_globals [AI_POST_COUNTER_NAME]))
2678
- $counter_for_filter = $ad_inserter_globals [AI_POST_COUNTER_NAME]; else return false;
 
 
 
 
 
 
 
2679
  break;
2680
  }
2681
 
@@ -2684,7 +3019,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2684
  $filter_values = explode (",", $filter_settings);
2685
  } else $filter_values []= $filter_settings;
2686
 
2687
- return in_array ($counter_for_filter, $filter_values);
 
 
 
 
 
 
 
 
 
 
2688
  }
2689
 
2690
  function check_and_increment_block_counter () {
@@ -2703,7 +3048,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2703
  }
2704
 
2705
  function check_block_counter () {
2706
- global $ad_inserter_globals;
2707
 
2708
  $global_name = AI_BLOCK_COUNTER_NAME . $this->number;
2709
  $max_insertions = intval ($this->get_maximum_insertions ());
@@ -2906,7 +3251,7 @@ class ai_Block extends ai_CodeBlock {
2906
  parent::__construct();
2907
 
2908
  $this->number = $number;
2909
- $this->wp_options [AI_OPTION_NAME] = AD_NAME." ".$number;
2910
  }
2911
  }
2912
 
@@ -2923,3 +3268,27 @@ class ai_AdF extends ai_BaseCodeBlock {
2923
  parent::__construct();
2924
  }
2925
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  $old_name = "ad" . $block . "_name";
92
  if (isset ($options [$old_name])) {
93
+ $options [AI_OPTION_BLOCK_NAME] = $options [$old_name];
94
  unset ($options [$old_name]);
95
  }
96
  $old_name = "ad" . $block . "_displayType";
364
 
365
  parent::__construct();
366
 
367
+ $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME;
368
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
369
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
370
  $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
371
  $this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
372
+ $this->wp_options [AI_OPTION_MIN_WORDS_ABOVE] = AD_EMPTY_DATA;
373
  $this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
374
  $this->wp_options [AI_OPTION_MAX_WORDS] = AD_EMPTY_DATA;
375
  $this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS] = AD_EMPTY_DATA;
384
  $this->wp_options [AI_OPTION_AVOID_TRY_LIMIT] = AD_ONE;
385
  $this->wp_options [AI_OPTION_AVOID_DIRECTION] = AD_BELOW_AND_THEN_ABOVE;
386
  $this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
387
+ $this->wp_options [AI_OPTION_FILTER_TYPE] = AI_FILTER_AUTO;
388
+ $this->wp_options [AI_OPTION_INVERTED_FILTER] = AI_DISABLED;
389
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
390
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
391
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
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
  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
  return $option;
642
  }
643
 
644
+ public function get_minimum_words_above (){
645
+ $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS_ABOVE]) ? $this->wp_options [AI_OPTION_MIN_WORDS_ABOVE] : "";
646
+ return $option;
647
+ }
648
+
649
  public function get_minimum_words(){
650
  $option = isset ($this->wp_options [AI_OPTION_MIN_WORDS]) ? $this->wp_options [AI_OPTION_MIN_WORDS] : "";
651
  return $option;
658
 
659
  public function get_paragraph_tags(){
660
  $option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
661
+ return str_replace (array ('<', '>'), '', $option);
662
  }
663
 
664
  public function get_minimum_paragraph_words(){
718
  public function get_call_filter(){
719
  $option = isset ($this->wp_options [AI_OPTION_EXCERPT_NUMBER]) ? $this->wp_options [AI_OPTION_EXCERPT_NUMBER] : "";
720
  return $option;
721
+ }
722
 
723
  public function get_filter_type(){
724
+ $option = isset ($this->wp_options [AI_OPTION_FILTER_TYPE]) ? $this->wp_options [AI_OPTION_FILTER_TYPE] : AI_FILTER_AUTO;
725
+
726
+ if ($option == '') $option = AI_FILTER_AUTO;
727
+
728
+ elseif ($option == AI_OPTION_FILTER_AUTO) $option = AI_FILTER_AUTO;
729
+ elseif ($option == AI_OPTION_FILTER_PHP_FUNCTION_CALLS) $option = AI_FILTER_PHP_FUNCTION_CALLS;
730
+ elseif ($option == AI_OPTION_FILTER_CONTENT_PROCESSING) $option = AI_FILTER_CONTENT_PROCESSING;
731
+ elseif ($option == AI_OPTION_FILTER_EXCERPT_PROCESSING) $option = AI_FILTER_EXCERPT_PROCESSING;
732
+ elseif ($option == AI_OPTION_FILTER_BEFORE_POST_PROCESSING) $option = AI_FILTER_BEFORE_POST_PROCESSING;
733
+ elseif ($option == AI_OPTION_FILTER_AFTER_POST_PROCESSING) $option = AI_FILTER_AFTER_POST_PROCESSING;
734
+ elseif ($option == AI_OPTION_FILTER_WIDGET_DRAWING) $option = AI_FILTER_WIDGET_DRAWING;
735
+ elseif ($option == AI_OPTION_FILTER_SUBPAGES) $option = AI_FILTER_SUBPAGES;
736
+ elseif ($option == AI_OPTION_FILTER_POSTS) $option = AI_FILTER_POSTS;
737
+ elseif ($option == AI_OPTION_FILTER_COMMENTS) $option = AI_FILTER_COMMENTS;
738
+
739
  return $option;
740
+ }
741
+
742
+ public function get_filter_type_text (){
743
+ switch ($this->get_filter_type()) {
744
+ case AI_FILTER_AUTO:
745
+ return AI_TEXT_AUTO;
746
+ break;
747
+ case AI_FILTER_PHP_FUNCTION_CALLS:
748
+ return AI_TEXT_PHP_FUNCTION_CALLS;
749
+ break;
750
+ case AI_FILTER_CONTENT_PROCESSING:
751
+ return AI_TEXT_CONTENT_PROCESSING;
752
+ break;
753
+ case AI_FILTER_EXCERPT_PROCESSING:
754
+ return AI_TEXT_EXCERPT_PROCESSING;
755
+ break;
756
+ case AI_FILTER_BEFORE_POST_PROCESSING:
757
+ return AI_TEXT_BEFORE_POST_PROCESSING;
758
+ break;
759
+ case AI_FILTER_AFTER_POST_PROCESSING:
760
+ return AI_TEXT_AFTER_POST_PROCESSING;
761
+ break;
762
+ case AI_FILTER_WIDGET_DRAWING:
763
+ return AI_TEXT_WIDGET_DRAWING;
764
+ break;
765
+ case AI_FILTER_SUBPAGES:
766
+ return AI_TEXT_SUBPAGES;
767
+ break;
768
+ case AI_FILTER_POSTS:
769
+ return AI_TEXT_POSTS;
770
+ break;
771
+ case AI_FILTER_PARAGRAPHS:
772
+ return AI_TEXT_PARAGRAPHS;
773
+ break;
774
+ case AI_FILTER_COMMENTS:
775
+ return AI_TEXT_COMMENTS;
776
+ break;
777
+ default:
778
+ return '';
779
+ break;
780
+ }
781
+ }
782
+
783
+ public function get_inverted_filter (){
784
+ $inverted_filter = isset ($this->wp_options [AI_OPTION_INVERTED_FILTER]) ? $this->wp_options [AI_OPTION_INVERTED_FILTER] : AI_DISABLED;
785
+ if ($inverted_filter == '') $inverted_filter = AI_DISABLED;
786
+ return $inverted_filter;
787
+ }
788
 
789
  public function get_direction_type(){
790
  $option = isset ($this->wp_options [AI_OPTION_DIRECTION_TYPE]) ? $this->wp_options [AI_OPTION_DIRECTION_TYPE] : "";
810
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] : "";
811
  if ($option == '') $option = AI_DISABLED;
812
 
813
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
814
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
815
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
816
  } else $automatic_insertion = '';
831
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES] : "";
832
  if ($option == '') $option = AI_DISABLED;
833
 
834
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
835
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
836
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
837
  } else $automatic_insertion = '';
852
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES] : "";
853
  if ($option == '') $option = AI_DISABLED;
854
 
855
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
856
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
857
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
858
  } else $automatic_insertion = '';
873
  $option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES] : "";
874
  if ($option == '') $option = AI_DISABLED;
875
 
876
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
877
  if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
878
  $automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
879
  } else $automatic_insertion = '';
940
  $option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
941
 
942
  // Fix for old bug
943
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605' && strpos ($option, "Undefined index")) $option = "";
944
 
945
  return $option;
946
  }
963
 
964
  $option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AI_DISABLED;
965
 
966
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605') {
967
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
968
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
969
  } else $display_for_devices = '';
980
  $option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
981
  $option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AI_DISABLED;
982
 
983
+ if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '010605' && $this->get_detection_client_side()) {
984
  if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
985
  $display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
986
  } else $display_for_devices = '';
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
 
1169
  }
1170
  }
1171
 
1172
+
1173
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1174
+
1175
+ $adb_action = 1;
1176
+ switch ($adb_action) {
1177
+ case 1: // Replacement ad
1178
+
1179
+ $globals_name = AI_ADB_FALLBACK_DEPTH_NAME;
1180
+ if (!isset ($ad_inserter_globals [$globals_name])) {
1181
+ $ad_inserter_globals [$globals_name] = 0;
1182
+ }
1183
+
1184
+ $fallback_block = 4;
1185
+ if ($fallback_block != 0 && $fallback_block <= AD_INSERTER_BLOCKS && $fallback_block != $this->number && $ad_inserter_globals [$globals_name] < 2) {
1186
+ $ad_inserter_globals [$globals_name] ++;
1187
+
1188
+ $fallback_obj = $block_object [$fallback_block];
1189
+
1190
+ $processed_code = "<div>\n" . $processed_code ."</div>\n";
1191
+
1192
+ $fallback_code = $fallback_obj->ai_getProcessedCode (true);
1193
+
1194
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$hide_label) {
1195
+
1196
+ $color = '#e0e';
1197
+
1198
+ $title = '';
1199
+ $counters = $fallback_obj->ai_get_counters ($title);
1200
+
1201
+ if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($fallback_obj->number); else $url_parameters = "";
1202
+ $url = admin_url ('options-general.php?page=ad-inserter.php') . $url_parameters . '&tab=' . $fallback_obj->number;
1203
+
1204
+ $fallback_code = '<section style="border: 1px solid '.$color.';"><section style="padding: 1px 0 1px 5px; background: '.$color.'; color: white; font-size: 12px; text-align: left;"><a style="text-decoration: none; color: white;" title="Click to go to block settings" href="'
1205
+ . $url . '"><kbd style="display: none">[AI]</kbd>' . $fallback_obj->number . ' &nbsp; ' . $fallback_obj->get_ad_name () .'</a> &nbsp;&#8678;&nbsp; AD BLOCKING<a style="float: right; text-decoration: none; color: white; padding: 0px 10px 0 0;"><kbd title="'.$title.'">'.$counters.'</kbd><kbd style="display: none">[/AI]</kbd></a></section>' . $fallback_code . '</section>';
1206
+ }
1207
+
1208
+ $processed_code .= "<div class='ai-adb-show' style='visibility: hidden; display: none;' data='$this->number <= $fallback_obj->number'>\n" . $fallback_code ."</div>\n";
1209
+
1210
+ $ad_inserter_globals [$globals_name] --;
1211
+ }
1212
+
1213
+ break;
1214
+ case 2: // Show
1215
+ $processed_code = "<div class='ai-adb-show' style='visibility: hidden; display: none;' data='$this->number'>\n" . $processed_code ."</div>\n";
1216
+ break;
1217
+ case 3: // Hide
1218
+ $processed_code = "<div class='ai-adb-hide' data='$this->number'>\n" . $processed_code ."</div>\n";
1219
+ break;
1220
+ }
1221
+
1222
+ }
1223
+
1224
+
1225
  $title = '';
1226
  $fallback_code = '';
1227
  $color = '#e00';
1357
  }
1358
 
1359
  public function get_ad_name(){
1360
+ $option = isset ($this->wp_options [AI_OPTION_BLOCK_NAME]) ? $this->wp_options [AI_OPTION_BLOCK_NAME] : "";
1361
  if ($option == '') $option = AD_NAME. " " . $this->number;
1362
  return $option;
1363
  }
1391
  return $option;
1392
  }
1393
 
1394
+ public function get_ad_block_taxonomy(){
1395
+ $option = isset ($this->wp_options [AI_OPTION_TAXONOMY_LIST]) ? $this->wp_options [AI_OPTION_TAXONOMY_LIST] : "";
1396
+ return $option;
1397
+ }
1398
+
1399
+ public function get_ad_block_taxonomy_type(){
1400
+ $option = isset ($this->wp_options [AI_OPTION_TAXONOMY_LIST_TYPE]) ? $this->wp_options [AI_OPTION_TAXONOMY_LIST_TYPE] : "";
1401
+ if ($option == '') $option = AD_BLACK_LIST;
1402
+ return $option;
1403
+ }
1404
+
1405
  public function get_ad_enabled_on_which_pages (){
1406
  $option = isset ($this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES]) ? $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] : "";
1407
  if ($option == '') $option = AD_ENABLED_ON_ALL;
1701
  foreach ($paragraph_positions as $index => $paragraph_position) {
1702
  $positions []= $index + 1;
1703
  }
1704
+
1705
+ if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
1706
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
1707
+ if (!empty ($filter_settings)) {
1708
+
1709
+ $filter_values = array ();
1710
+ if (strpos ($filter_settings, ",") !== false) {
1711
+ $filter_values = explode (",", $filter_settings);
1712
+ } else $filter_values []= $filter_settings;
1713
+
1714
+ $inverted_filter = $this->get_inverted_filter();
1715
+ $filtered_positions = array ();
1716
+
1717
+
1718
+ foreach ($positions as $index => $position) {
1719
+ $insert = false;
1720
+ if (in_array ($index + 1, $filter_values)) {
1721
+ $insert = true;
1722
+ } else {
1723
+ foreach ($filter_values as $filter_value) {
1724
+ $filter_value = trim ($filter_value);
1725
+ if ($filter_value [0] == '%') {
1726
+ $mod_value = substr ($filter_value, 1);
1727
+ if (is_numeric ($mod_value) && $mod_value > 0) {
1728
+ if (($index + 1) % $mod_value == 0) $insert = true;
1729
+ break;
1730
+ }
1731
+ }
1732
+ }
1733
+ }
1734
+ if ($insert xor $inverted_filter) $filtered_positions []= $position;
1735
+ }
1736
+ $positions = $filtered_positions;
1737
+ } else $positions = array ();
1738
+ }
1739
+
1740
  }
1741
  }
1742
 
1888
 
1889
  if ($position_preview || !empty ($positions)) {
1890
  $offset = 0;
 
1891
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
1892
 
1893
  foreach ($paragraph_positions as $counter => $paragraph_position) {
1894
  if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
1895
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
1896
+ $this->increment_block_counter ();
1897
+ $inserted_code = $this->get_code_for_insertion ();
1898
+ $ai_last_check = AI_CHECK_INSERTED;
1899
+ }
1900
  else continue;
1901
 
1902
  if ($multibyte) {
2162
  }
2163
  }
2164
  elseif ($position == '') {
2165
+
2166
+ $min_words_above = $this->get_minimum_words_above ();
2167
+ if (!empty ($min_words_above)) {
2168
+ $words_above = 0;
2169
+ foreach ($paragraph_positions as $index => $paragraph_position) {
2170
+
2171
+ if ($multibyte) {
2172
+ $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]);
2173
+ } else {
2174
+ $paragraph_code = $index == 0 ? substr ($content, 0, $paragraph_position + 1) : substr ($content, $paragraph_positions [$index - 1] + 1, $paragraph_position - $paragraph_positions [$index - 1]);
2175
+ }
2176
+
2177
+ $words_above += number_of_words ($paragraph_code);
2178
+ if ($words_above >= $min_words_above) {
2179
+ $positions []= $index + 1;
2180
+ $words_above = 0;
2181
+ }
2182
+
2183
+ }
2184
+ } else
2185
  foreach ($paragraph_positions as $index => $paragraph_position) {
2186
  $positions []= $index + 1;
2187
  }
2188
+
2189
+ if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
2190
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
2191
+ if (!empty ($filter_settings)) {
2192
+ $filter_values = array ();
2193
+ if (strpos ($filter_settings, ",") !== false) {
2194
+ $filter_values = explode (",", $filter_settings);
2195
+ } else $filter_values []= $filter_settings;
2196
+
2197
+ $inverted_filter = $this->get_inverted_filter();
2198
+ $filtered_positions = array ();
2199
+
2200
+ foreach ($positions as $index => $position) {
2201
+ $insert = false;
2202
+ if (in_array ($index + 1, $filter_values)) {
2203
+ $insert = true;
2204
+ } else {
2205
+ foreach ($filter_values as $filter_value) {
2206
+ $filter_value = trim ($filter_value);
2207
+ if ($filter_value [0] == '%') {
2208
+ $mod_value = substr ($filter_value, 1);
2209
+ if (is_numeric ($mod_value) && $mod_value > 0) {
2210
+ if (($index + 1) % $mod_value == 0) $insert = true;
2211
+ }
2212
+ }
2213
+ }
2214
+ }
2215
+ if ($insert xor $inverted_filter) $filtered_positions []= $position;
2216
+ }
2217
+ $positions = $filtered_positions;
2218
+ } else $positions = array ();
2219
+ }
2220
+
2221
  }
2222
+
2223
  }
2224
 
2225
  if (empty ($positions)) {
2372
 
2373
  if ($position_preview || !empty ($positions)) {
2374
  $offset = 0;
 
2375
  if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
2376
 
2377
  foreach ($paragraph_positions as $counter => $paragraph_position) {
2378
  if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
2379
+ elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
2380
+ $this->increment_block_counter ();
2381
+ $inserted_code = $this->get_code_for_insertion ();
2382
+ $ai_last_check = AI_CHECK_INSERTED;
2383
+ }
2384
  else continue;
2385
 
2386
  if ($multibyte) {
2569
  }
2570
  }
2571
 
2572
+ function check_taxonomy () {
2573
+
2574
+ $taxonomies = trim (strtolower ($this->get_ad_block_taxonomy()));
2575
+ $taxonomy_type = $this->get_ad_block_taxonomy_type();
2576
+
2577
+ if ($taxonomy_type == AD_BLACK_LIST) {
2578
+
2579
+ if ($taxonomies == AD_EMPTY_DATA) return true;
2580
+
2581
+ $taxonomies_listed = explode (",", $taxonomies);
2582
+
2583
+ $taxonomy_names = get_post_taxonomies ();
2584
+ foreach ($taxonomy_names as $taxonomy_name) {
2585
+ $terms = get_the_terms (0, $taxonomy_name);
2586
+ if (is_array ($terms)) {
2587
+ foreach ($terms as $term) {
2588
+
2589
+ foreach ($taxonomies_listed as $taxonomy_disabled){
2590
+
2591
+ $taxonomy_disabled = trim ($taxonomy_disabled);
2592
+
2593
+ $post_term_name = strtolower ($term->name);
2594
+ $post_term_slug = strtolower ($term->slug);
2595
+ $post_taxonomy = strtolower ($term->taxonomy);
2596
+
2597
+ if ($post_term_name == $taxonomy_disabled || $post_term_slug == $taxonomy_disabled) return false;
2598
+
2599
+ $post_taxonomy = strtolower ($term->taxonomy);
2600
+ if ($post_taxonomy == $taxonomy_disabled) return false;
2601
+
2602
+ if ($post_taxonomy . ':' . $post_term_slug == $taxonomy_disabled) return false;
2603
+ }
2604
+ }
2605
+ }
2606
+ }
2607
+ return true;
2608
+
2609
+ } else {
2610
+
2611
+ if ($taxonomies == AD_EMPTY_DATA) return false;
2612
+
2613
+ $taxonomies_listed = explode (",", $taxonomies);
2614
+
2615
+ $taxonomy_names = get_post_taxonomies ();
2616
+ foreach ($taxonomy_names as $taxonomy_name) {
2617
+ $terms = get_the_terms (0, $taxonomy_name);
2618
+ if (is_array ($terms)) {
2619
+ foreach ($terms as $term) {
2620
+
2621
+ foreach ($taxonomies_listed as $taxonomy_enabled) {
2622
+
2623
+ $taxonomy_enabled = trim ($taxonomy_enabled);
2624
+
2625
+ $post_term_name = strtolower ($term->name);
2626
+ $post_term_slug = strtolower ($term->slug);
2627
+
2628
+ if ($post_term_name == $taxonomy_enabled || $post_term_slug == $taxonomy_enabled) return true;
2629
+
2630
+ $post_taxonomy = strtolower ($term->taxonomy);
2631
+ if ($post_taxonomy == $taxonomy_enabled) return true;
2632
+
2633
+ if ($post_taxonomy . ':' . $post_term_slug == $taxonomy_enabled) return true;
2634
+ }
2635
+ }
2636
+ }
2637
+ }
2638
+ return false;
2639
+ }
2640
+ }
2641
+
2642
  function check_id () {
2643
  global $ai_wp_data;
2644
 
2893
  $ai_last_check = AI_CHECK_TAG;
2894
  if (!$this->check_tag ()) return false;
2895
 
2896
+ $ai_last_check = AI_CHECK_TAXONOMY;
2897
+ if (!$this->check_taxonomy ()) return false;
2898
+
2899
  $ai_last_check = AI_CHECK_ID;
2900
  if (!$this->check_id ()) return false;
2901
 
2966
  function check_filter ($counter_for_filter) {
2967
  global $ai_last_check, $ad_inserter_globals, $page;
2968
 
2969
+ $filter_ok = $this->get_inverted_filter() ? false : true;
2970
+
2971
  $ai_last_check = AI_CHECK_FILTER;
2972
+ $filter_settings = trim (str_replace (' ', '', $this->get_call_filter()));
2973
+ if (empty ($filter_settings)) return $filter_ok;
2974
 
2975
  switch ($this->get_filter_type ()) {
2976
+ case AI_FILTER_PHP_FUNCTION_CALLS:
2977
  if (isset ($ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]))
2978
+ $counter_for_filter = $ad_inserter_globals [AI_PHP_FUNCTION_CALL_COUNTER_NAME . $this->number]; else return !$filter_ok;
2979
  break;
2980
+ case AI_FILTER_CONTENT_PROCESSING:
2981
  if (isset ($ad_inserter_globals [AI_CONTENT_COUNTER_NAME]))
2982
+ $counter_for_filter = $ad_inserter_globals [AI_CONTENT_COUNTER_NAME]; else return !$filter_ok;
2983
  break;
2984
+ case AI_FILTER_EXCERPT_PROCESSING:
2985
  if (isset ($ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]))
2986
+ $counter_for_filter = $ad_inserter_globals [AI_EXCERPT_COUNTER_NAME]; else return !$filter_ok;
2987
  break;
2988
+ case AI_FILTER_BEFORE_POST_PROCESSING:
2989
  if (isset ($ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]))
2990
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_BEFORE_COUNTER_NAME]; else return !$filter_ok;
2991
  break;
2992
+ case AI_FILTER_AFTER_POST_PROCESSING:
2993
  if (isset ($ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]))
2994
+ $counter_for_filter = $ad_inserter_globals [AI_LOOP_AFTER_COUNTER_NAME]; else return !$filter_ok;
2995
  break;
2996
+ case AI_FILTER_WIDGET_DRAWING:
2997
  if (isset ($ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]))
2998
+ $counter_for_filter = $ad_inserter_globals [AI_WIDGET_COUNTER_NAME . $this->number]; else return !$filter_ok;
2999
  break;
3000
+ case AI_FILTER_SUBPAGES:
3001
  if (isset ($page))
3002
+ $counter_for_filter = $page; else return !$filter_ok;
3003
  break;
3004
+ case AI_FILTER_POSTS:
3005
  if (isset ($ad_inserter_globals [AI_POST_COUNTER_NAME]))
3006
+ $counter_for_filter = $ad_inserter_globals [AI_POST_COUNTER_NAME]; else return !$filter_ok;
3007
+ break;
3008
+ case AI_FILTER_PARAGRAPHS:
3009
+ return true;
3010
+ break;
3011
+ case AI_FILTER_COMMENTS:
3012
+ if (isset ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME]))
3013
+ $counter_for_filter = $ad_inserter_globals [AI_COMMENT_COUNTER_NAME]; else return !$filter_ok;
3014
  break;
3015
  }
3016
 
3019
  $filter_values = explode (",", $filter_settings);
3020
  } else $filter_values []= $filter_settings;
3021
 
3022
+ foreach ($filter_values as $filter_value) {
3023
+ $filter_value = trim ($filter_value);
3024
+ if ($filter_value [0] == '%') {
3025
+ $mod_value = substr ($filter_value, 1);
3026
+ if (is_numeric ($mod_value) && $mod_value > 0) {
3027
+ if ($counter_for_filter % $mod_value == 0) return $filter_ok;
3028
+ }
3029
+ }
3030
+ }
3031
+
3032
+ return in_array ($counter_for_filter, $filter_values) xor !$filter_ok;
3033
  }
3034
 
3035
  function check_and_increment_block_counter () {
3048
  }
3049
 
3050
  function check_block_counter () {
3051
+ global $ad_inserter_globals, $ai_last_check;
3052
 
3053
  $global_name = AI_BLOCK_COUNTER_NAME . $this->number;
3054
  $max_insertions = intval ($this->get_maximum_insertions ());
3251
  parent::__construct();
3252
 
3253
  $this->number = $number;
3254
+ $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$number;
3255
  }
3256
  }
3257
 
3268
  parent::__construct();
3269
  }
3270
  }
3271
+
3272
+ class ai_AdA extends ai_BaseCodeBlock {
3273
+
3274
+ public function __construct () {
3275
+ parent::__construct();
3276
+
3277
+ $this->wp_options [AI_OPTION_CODE] = AI_DEFAULT_ADB_MESSAGE;
3278
+ }
3279
+ }
3280
+
3281
+ class ai_Walker_Comment extends Walker_Comment {
3282
+
3283
+ public function comment_callback ($comment, $args, $depth) {
3284
+ if (($comment->comment_type == 'pingback' || $comment->comment_type == 'trackback') && $args ['short_ping']) {
3285
+ $this->ping ($comment, $depth, $args);
3286
+ } elseif ($args['format'] === 'html5') {
3287
+ $this->html5_comment ($comment, $depth, $args);
3288
+ } else {
3289
+ $this->comment ($comment, $depth, $args);
3290
+ }
3291
+ }
3292
+
3293
+ }
3294
+
constants.php CHANGED
@@ -1,7 +1,10 @@
1
  <?php
2
 
3
- define ('WP_OPTION_NAME', 'ad_inserter');
4
- define ('AI_GLOBAL_OPTION_NAME', 'global');
 
 
 
5
 
6
  if (!defined ('AD_INSERTER_PLUGIN_DIR'))
7
  define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
@@ -14,7 +17,7 @@ if (!defined( 'AD_INSERTER_NAME'))
14
  define ('AD_INSERTER_NAME', 'Ad Inserter');
15
 
16
  if (!defined( 'AD_INSERTER_VERSION'))
17
- define ('AD_INSERTER_VERSION', '2.1.10');
18
 
19
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
20
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -44,6 +47,7 @@ define ('AI_EXTRACT_OPTION_NAME', 'extract');
44
  define ('WP_FORM_FIELD_POSTFIX', '_block_');
45
  define ('AI_HEADER_OPTION_NAME', 'h');
46
  define ('AI_FOOTER_OPTION_NAME', 'f');
 
47
 
48
  define ('AI_OPTION_CODE', 'code');
49
  define ('AI_OPTION_ENABLE_MANUAL', 'enable_manual');
@@ -53,10 +57,11 @@ define ('AI_OPTION_TRACKING', 'tracking');
53
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
54
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
55
  define ('AI_OPTION_ENABLE_404', 'enable_404');
56
- define ('AI_OPTION_NAME', 'name');
57
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
58
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
59
  define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
 
60
  define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
61
  define ('AI_OPTION_MIN_WORDS', 'min_words');
62
  define ('AI_OPTION_MAX_WORDS', 'max_words');
@@ -72,6 +77,7 @@ define ('AI_OPTION_AVOID_TRY_LIMIT', 'avoid_try_limit');
72
  define ('AI_OPTION_AVOID_DIRECTION', 'avoid_direction');
73
  define ('AI_OPTION_EXCERPT_NUMBER', 'excerpt_number'); // needs to be renamed
74
  define ('AI_OPTION_FILTER_TYPE', 'filter_type');
 
75
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
76
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
77
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
@@ -97,6 +103,8 @@ define ('AI_OPTION_CATEGORY_LIST', 'category_list');
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,12 +122,23 @@ define ('AI_OPTION_DISPLAY_FOR_DEVICES', 'display_for_devices');
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
 
@@ -131,6 +150,7 @@ define('AI_FORM_CLEAR_STATISTICS','ai-clear-statistics');
131
 
132
  define('AD_AUTHOR_SITE', '<!-- Powered by Ad Inserter Plugin By Spacetime -->');
133
  define('AD_ROTATE_SEPARATOR', '|rotate|');
 
134
 
135
  //form select options
136
  define('AD_SELECT_SELECTED','selected');
@@ -160,6 +180,9 @@ define('AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH', 6);
160
  define('AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT', 7);
161
  define('AI_AUTOMATIC_INSERTION_AFTER_EXCERPT', 8);
162
  define('AI_AUTOMATIC_INSERTION_BETWEEN_POSTS', 9);
 
 
 
163
 
164
  define('AI_TEXT_DISABLED', 'Disabled');
165
  define('AI_TEXT_BEFORE_POST', 'Before Post');
@@ -171,6 +194,9 @@ define('AI_TEXT_AFTER_PARAGRAPH', 'After Paragraph');
171
  define('AI_TEXT_BEFORE_EXCERPT', 'Before Excerpt');
172
  define('AI_TEXT_AFTER_EXCERPT', 'After Excerpt');
173
  define('AI_TEXT_BETWEEN_POSTS', 'Between Posts');
 
 
 
174
 
175
  //Display options
176
  define('AD_DISPLAY_ALL_USERS','all users');
@@ -246,7 +272,7 @@ define('AI_ALIGNMENT_CSS_STICKY_BOTTOM', 'position: fixed; bottom: 0; left: 0;
246
  define('AD_BLACK_LIST','Black List');
247
  define('AD_WHITE_LIST','White List');
248
 
249
- //Filter Type
250
  define ('AI_OPTION_FILTER_AUTO', 'Auto');
251
  define ('AI_OPTION_FILTER_PHP_FUNCTION_CALLS', 'PHP function calls');
252
  define ('AI_OPTION_FILTER_CONTENT_PROCESSING', 'Content processing');
@@ -256,6 +282,36 @@ define ('AI_OPTION_FILTER_AFTER_POST_PROCESSING', 'After post processing');
256
  define ('AI_OPTION_FILTER_WIDGET_DRAWING', 'Widget drawing');
257
  define ('AI_OPTION_FILTER_SUBPAGES', 'Subpages');
258
  define ('AI_OPTION_FILTER_POSTS', 'Posts');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
  //Counter names
261
  define ('AI_BLOCK_COUNTER_NAME', 'AI_BLOCK_COUNTER_');
@@ -266,6 +322,8 @@ define ('AI_LOOP_BEFORE_COUNTER_NAME', 'AI_LOOP_BEFORE_COUNTER');
266
  define ('AI_LOOP_AFTER_COUNTER_NAME', 'AI_LOOP_AFTER_COUNTER');
267
  define ('AI_WIDGET_COUNTER_NAME', 'AI_WIDGET_COUNTER_');
268
  define ('AI_POST_COUNTER_NAME', 'AI_POST_COUNTER');
 
 
269
 
270
  //Text List Type
271
  define('AD_CONTAIN','contain');
@@ -311,27 +369,41 @@ define('AI_TRACKING_INTERNAL', 1);
311
 
312
  define('AI_TRACKING_ENABLED', 1);
313
 
 
 
 
 
 
 
 
 
 
314
  // Click detection
315
- define('AI_CLICK_DETECTION_STANDARD', 0);
316
- define('AI_CLICK_DETECTION_ADVANCED', 1);
317
 
318
- define('AI_TEXT_INTERNAL', 'Internal');
319
- define('AI_TEXT_ADVANCED', 'Advanced');
320
- define('AI_TEXT_ENABLED', 'Enabled');
321
 
322
  //Settings
323
- define('AI_ENABLED', '1');
324
- define('AI_DISABLED', '0');
325
 
326
- define('AI_COOKIE_TIME', 3600);
327
 
328
- define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
 
 
 
 
329
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
330
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
331
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
332
  define ('DEFAULT_PLUGIN_PRIORITY', 99999);
333
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
334
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
 
335
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
336
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
337
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
@@ -345,6 +417,18 @@ define ('DEFAULT_TRACKING', AI_TRACKING_DISABLED);
345
  define ('DEFAULT_TRACKING_LOGGED_IN', AI_TRACKING_ENABLED);
346
  define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
347
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  define ('DEFAULT_VIEWPORT_NAME_1', "Desktop");
349
  define ('DEFAULT_VIEWPORT_NAME_2', "Tablet");
350
  define ('DEFAULT_VIEWPORT_NAME_3', "Phone");
@@ -355,11 +439,14 @@ define ('DEFAULT_VIEWPORT_WIDTH_3', 0);
355
 
356
  define ('DEFAULT_COUNTRY_GROUP_NAME', "Group");
357
 
358
- define ('CONTENT_HOOK_BLOCKS', 'content_hook');
359
- define ('EXCERPT_HOOK_BLOCKS', 'excerpt_hook');
360
- define ('LOOP_START_HOOK_BLOCKS', 'loop_start_hook');
361
- define ('LOOP_END_HOOK_BLOCKS', 'loop_end_hook');
362
- define ('POST_HOOK_BLOCKS', 'post_hook');
 
 
 
363
 
364
  define ('AI_CHECK_NONE', - 1);
365
  define ('AI_CHECK_INSERTED', 0);
@@ -417,6 +504,7 @@ define ('AI_CHECK_IP_ADDRESS', 47);
417
  define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
418
  define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
419
  define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
 
420
 
421
  define ('AI_PT_NONE', - 1);
422
  define ('AI_PT_ANY', 0);
@@ -431,21 +519,25 @@ define ('AI_PT_FEED', 8);
431
  define ('AI_PT_ADMIN', 9);
432
  define ('AI_PT_AJAX', 10);
433
 
434
- define ('AI_USER_NOT_SET', - 1);
435
  define ('AI_USER_NOT_LOGGED_IN', 0);
436
  define ('AI_USER_LOGGED_IN', 1);
437
  define ('AI_USER_ADMINISTRATOR', 2);
438
 
439
  define ('AI_WP_PAGE_TYPE', 0);
440
- define ('AI_WP_USER', 1);
441
- define ('AI_WP_DEBUGGING', 2);
442
- define ('AI_WP_DEBUG_BLOCK', 3);
443
- define ('AI_WP_URL', 4);
444
- define ('AI_SERVER_SIDE_DETECTION', 5);
445
- define ('AI_CLIENT_SIDE_DETECTION', 6);
446
- define ('AI_CONTEXT', 7);
447
- define ('AI_TRACKING', 8);
448
- define ('AI_STICKY_WIDGETS', 9);
 
 
 
 
 
449
 
450
  define ('AI_CONTEXT_NONE', 0);
451
  define ('AI_CONTEXT_CONTENT', 1);
@@ -458,6 +550,9 @@ define ('AI_CONTEXT_SHORTCODE', 7);
458
  define ('AI_CONTEXT_HEADER', 8);
459
  define ('AI_CONTEXT_FOOTER', 9);
460
  define ('AI_CONTEXT_BETWEEN_POSTS', 10);
 
 
 
461
 
462
  define ('AI_URL_DEBUG', 'ai-debug');
463
  define ('AI_URL_DEBUG_PROCESSING', 'ai-debug-processing');
@@ -468,12 +563,14 @@ define ('AI_URL_DEBUG_POSITIONS', 'ai-debug-positions');
468
  define ('AI_URL_DEBUG_NO_INSERTION', 'ai-debug-no-insertion');
469
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php');
470
  define ('AI_URL_DEBUG_COUNTRY', 'ai-debug-country');
 
471
 
472
  define ('AI_DEBUG_PROCESSING', 0x01);
473
  define ('AI_DEBUG_BLOCKS', 0x02);
474
  define ('AI_DEBUG_TAGS', 0x04);
475
  define ('AI_DEBUG_POSITIONS', 0x08);
476
  define ('AI_DEBUG_NO_INSERTION', 0x10);
 
477
 
478
  if (!defined ('AD_INSERTER_BLOCKS'))
479
  define ('AD_INSERTER_BLOCKS', 16);
@@ -483,8 +580,7 @@ if (!defined ('AD_INSERTER_VIEWPORTS'))
483
 
484
  define ('AI_DEBUG_TAGS_STYLE', 'font-weight: bold; color: white; padding: 2px;');
485
  define ('AI_DEBUG_POSITIONS_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;');
 
486
  define ('AI_DEBUG_WIDGET_STYLE', 'margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;');
487
 
488
- define ('SPECIAL_ELEMENT_TAGS', 'blockquote, figure, li');
489
-
490
 
1
  <?php
2
 
3
+ //ini_set ('display_errors', 1);
4
+ //error_reporting (E_ALL);
5
+
6
+ define ('AI_OPTION_NAME', 'ad_inserter');
7
+ define ('AI_OPTION_GLOBAL', 'global');
8
 
9
  if (!defined ('AD_INSERTER_PLUGIN_DIR'))
10
  define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
17
  define ('AD_INSERTER_NAME', 'Ad Inserter');
18
 
19
  if (!defined( 'AD_INSERTER_VERSION'))
20
+ define ('AD_INSERTER_VERSION', '2.1.13');
21
 
22
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
23
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
47
  define ('WP_FORM_FIELD_POSTFIX', '_block_');
48
  define ('AI_HEADER_OPTION_NAME', 'h');
49
  define ('AI_FOOTER_OPTION_NAME', 'f');
50
+ define ('AI_ADB_MESSAGE_OPTION_NAME', 'a');
51
 
52
  define ('AI_OPTION_CODE', 'code');
53
  define ('AI_OPTION_ENABLE_MANUAL', 'enable_manual');
57
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
58
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
59
  define ('AI_OPTION_ENABLE_404', 'enable_404');
60
+ define ('AI_OPTION_BLOCK_NAME', 'name');
61
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
62
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
63
  define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
64
+ define ('AI_OPTION_MIN_WORDS_ABOVE', 'min_words_above');
65
  define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
66
  define ('AI_OPTION_MIN_WORDS', 'min_words');
67
  define ('AI_OPTION_MAX_WORDS', 'max_words');
77
  define ('AI_OPTION_AVOID_DIRECTION', 'avoid_direction');
78
  define ('AI_OPTION_EXCERPT_NUMBER', 'excerpt_number'); // needs to be renamed
79
  define ('AI_OPTION_FILTER_TYPE', 'filter_type');
80
+ define ('AI_OPTION_INVERTED_FILTER', 'inverted_filter');
81
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
82
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
83
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
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
  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
 
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
  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
  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
  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
  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
  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
+ define ('AI_ADB_FALLBACK_DEPTH_NAME', 'AI_ADB_FALLBACK_DEPTH');
327
 
328
  //Text List Type
329
  define('AD_CONTAIN','contain');
369
 
370
  define('AI_TRACKING_ENABLED', 1);
371
 
372
+ // Ad Blocking
373
+ define ('AI_ACTION_NONE', 0);
374
+ define ('AI_ACTION_WARNING_MESSAGE', 1);
375
+ define ('AI_ACTION_REDIRECTION', 2);
376
+
377
+ define ('AI_TEXT_NONE', 'None');
378
+ define ('AI_TEXT_WARNING_MESSAGE', 'Warning Message');
379
+ define ('AI_TEXT_REDIRECTION', 'Redirection');
380
+
381
  // Click detection
382
+ define ('AI_CLICK_DETECTION_STANDARD', 0);
383
+ define ('AI_CLICK_DETECTION_ADVANCED', 1);
384
 
385
+ define ('AI_TEXT_INTERNAL', 'Internal');
386
+ define ('AI_TEXT_ADVANCED', 'Advanced');
387
+ define ('AI_TEXT_ENABLED', 'Enabled');
388
 
389
  //Settings
390
+ define ('AI_ENABLED', '1');
391
+ define ('AI_DISABLED', '0');
392
 
393
+ define ('AI_COOKIE_TIME', 3600);
394
 
395
+ define ('AI_TRANSIENT_RATING', 'ai-rating');
396
+ define ('AI_TRANSIENT_RATING_EXPIRATION', 48 * 3600);
397
+
398
+ define ('AI_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
399
+ define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', AI_SYNTAX_HIGHLIGHTER_THEME);
400
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
401
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
402
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
403
  define ('DEFAULT_PLUGIN_PRIORITY', 99999);
404
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
405
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
406
+ define ('DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE', 'blockquote, figure, li');
407
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
408
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
409
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
417
  define ('DEFAULT_TRACKING_LOGGED_IN', AI_TRACKING_ENABLED);
418
  define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
419
 
420
+ //define ('AI_ADBLOCKING_DETECTION', true);
421
+ define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
422
+ define ('AI_BASIC_ADB_OVERLAY_CSS', "position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998; user-select: none;");
423
+ define ('AI_DEFAULT_ADB_OVERLAY_CSS', "background: #000; opacity: 0.85;");
424
+ 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;");
425
+ define ('AI_DEFAULT_ADB_MESSAGE_CSS', "width: 300px; padding: 10px; border: 5px solid #f00; border-radius: 5px;");
426
+ 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>");
427
+ define ('AI_DEFAULT_ADB_ACTION', AI_ACTION_NONE);
428
+ define ('AI_DEFAULT_ADB_NO_ACTION_PERIOD', 30);
429
+ define ('AI_DEFAULT_ADB_REDIRECTION_PAGE', 0);
430
+ define ('AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE', AI_DISABLED);
431
+
432
  define ('DEFAULT_VIEWPORT_NAME_1', "Desktop");
433
  define ('DEFAULT_VIEWPORT_NAME_2', "Tablet");
434
  define ('DEFAULT_VIEWPORT_NAME_3', "Phone");
439
 
440
  define ('DEFAULT_COUNTRY_GROUP_NAME', "Group");
441
 
442
+ define ('CONTENT_HOOK_BLOCKS', 'content_hook');
443
+ define ('EXCERPT_HOOK_BLOCKS', 'excerpt_hook');
444
+ define ('LOOP_START_HOOK_BLOCKS', 'loop_start_hook');
445
+ define ('LOOP_END_HOOK_BLOCKS', 'loop_end_hook');
446
+ define ('POST_HOOK_BLOCKS', 'post_hook');
447
+ define ('BEFORE_COMMENTS_HOOK_BLOCKS', 'before_comments_hook');
448
+ define ('BETWEEN_COMMENTS_HOOK_BLOCKS', 'between_comments_hook');
449
+ define ('AFTER_COMMENTS_HOOK_BLOCKS', 'after_comments_hook');
450
 
451
  define ('AI_CHECK_NONE', - 1);
452
  define ('AI_CHECK_INSERTED', 0);
504
  define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
505
  define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
506
  define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
507
+ define ('AI_CHECK_TAXONOMY', 51);
508
 
509
  define ('AI_PT_NONE', - 1);
510
  define ('AI_PT_ANY', 0);
519
  define ('AI_PT_ADMIN', 9);
520
  define ('AI_PT_AJAX', 10);
521
 
 
522
  define ('AI_USER_NOT_LOGGED_IN', 0);
523
  define ('AI_USER_LOGGED_IN', 1);
524
  define ('AI_USER_ADMINISTRATOR', 2);
525
 
526
  define ('AI_WP_PAGE_TYPE', 0);
527
+ define ('AI_WP_USER_SET', 1);
528
+ define ('AI_WP_USER', 2);
529
+ define ('AI_WP_DEBUGGING', 3);
530
+ define ('AI_WP_DEBUG_BLOCK', 4);
531
+ define ('AI_WP_URL', 5);
532
+ define ('AI_SERVER_SIDE_DETECTION', 6);
533
+ define ('AI_CLIENT_SIDE_DETECTION', 7);
534
+ define ('AI_CONTEXT', 8);
535
+ define ('AI_TRACKING', 9);
536
+ define ('AI_STICKY_WIDGETS', 10);
537
+ define ('AI_NUMBER_OF_COMMENTS', 11);
538
+ define ('AI_COMMENTS_SAVED_CALLBACK', 12);
539
+ define ('AI_COMMENTS_SAVED_END_CALLBACK',13);
540
+ define ('AI_ADB_DETECTION', 14);
541
 
542
  define ('AI_CONTEXT_NONE', 0);
543
  define ('AI_CONTEXT_CONTENT', 1);
550
  define ('AI_CONTEXT_HEADER', 8);
551
  define ('AI_CONTEXT_FOOTER', 9);
552
  define ('AI_CONTEXT_BETWEEN_POSTS', 10);
553
+ define ('AI_CONTEXT_BEFORE_COMMENTS', 11);
554
+ define ('AI_CONTEXT_BETWEEN_COMMENTS', 12);
555
+ define ('AI_CONTEXT_AFTER_COMMENTS', 13);
556
 
557
  define ('AI_URL_DEBUG', 'ai-debug');
558
  define ('AI_URL_DEBUG_PROCESSING', 'ai-debug-processing');
563
  define ('AI_URL_DEBUG_NO_INSERTION', 'ai-debug-no-insertion');
564
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php');
565
  define ('AI_URL_DEBUG_COUNTRY', 'ai-debug-country');
566
+ define ('AI_URL_DEBUG_AD_BLOCKING' , 'ai-debug-ad-blocking');
567
 
568
  define ('AI_DEBUG_PROCESSING', 0x01);
569
  define ('AI_DEBUG_BLOCKS', 0x02);
570
  define ('AI_DEBUG_TAGS', 0x04);
571
  define ('AI_DEBUG_POSITIONS', 0x08);
572
  define ('AI_DEBUG_NO_INSERTION', 0x10);
573
+ define ('AI_DEBUG_AD_BLOCKING', 0x20);
574
 
575
  if (!defined ('AD_INSERTER_BLOCKS'))
576
  define ('AD_INSERTER_BLOCKS', 16);
580
 
581
  define ('AI_DEBUG_TAGS_STYLE', 'font-weight: bold; color: white; padding: 2px;');
582
  define ('AI_DEBUG_POSITIONS_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;');
583
+ define ('AI_DEBUG_PAGE_TYPE_STYLE', 'text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid green; color: green; background: #efe;');
584
  define ('AI_DEBUG_WIDGET_STYLE', 'margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;');
585
 
 
 
586
 
css/ad-inserter.css CHANGED
@@ -1,14 +1,14 @@
1
  #ai-data {
2
- font-family: "2.1.10"; /* 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,6 +20,10 @@
20
  font-size: 12px;
21
  }
22
 
 
 
 
 
23
  .ace_editor {
24
  border: 1px solid #ddd;
25
  border-radius: 4px;
@@ -51,6 +55,21 @@ a.clear-link, a.clear-link:hover, a.clear-link:focus {
51
  box-shadow: 0 0 0;
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /*#editor-1 {*/
55
  /* font-family: Courier, 'Courier New', monospace, tahoma;*/
56
  /* font-family: tahoma;*/
@@ -198,22 +217,31 @@ div.ai-tooltip .version {
198
  margin-right: 24px;
199
  }
200
 
 
 
 
 
201
  #ai-tabs a {
202
  width: 14px;
203
  text-align: center;
 
204
  }
205
  #ai-tabs {
206
  padding: .2em 0 0 .6em;
207
  }
208
 
209
-
210
  #ai-scroll-tabs {
211
  height: 42px;
212
  }
213
 
 
 
 
 
 
214
  #header-buttons {
215
  min-height: 26px;
216
- margin: 10px 0;
217
  float: right;
218
  }
219
 
@@ -232,6 +260,14 @@ textarea.simple-editor {
232
  height: 388px;
233
  }
234
 
 
 
 
 
 
 
 
 
235
  @media (min-width: 783px) and (max-width: 828px) {
236
  .auto-fold #wpcontent, .auto-fold #wpfooter {
237
  margin-left: 20px;
@@ -458,4 +494,23 @@ div.automatic-insertion img {
458
  .text .checkbox-button {
459
  padding: 2px 5px 2px 4px;
460
  }
 
 
 
 
 
 
 
 
 
 
461
  }
 
 
 
 
 
 
 
 
 
1
  #ai-data {
2
+ font-family: "2.1.13"; /* 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
  font-size: 12px;
21
  }
22
 
23
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
24
+ background: #fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x!important;
25
+ }
26
+
27
  .ace_editor {
28
  border: 1px solid #ddd;
29
  border-radius: 4px;
55
  box-shadow: 0 0 0;
56
  }
57
 
58
+ .rounded {
59
+ border-radius: 5px;
60
+ }
61
+
62
+ #ai-form.rounded input, #ai-form.rounded select {
63
+ border-radius: 5px;
64
+ }
65
+
66
+ #ai-form div.rounded, #ai-sidebar div.rounded {
67
+ margin: 8px 0;
68
+ padding: 8px;
69
+ border: 1px solid rgb(221, 221, 221);
70
+ border-radius: 5px;
71
+ }
72
+
73
  /*#editor-1 {*/
74
  /* font-family: Courier, 'Courier New', monospace, tahoma;*/
75
  /* font-family: tahoma;*/
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
  height: 388px;
261
  }
262
 
263
+ .simple-editor.small {
264
+ height: 190px;
265
+ }
266
+
267
+ textarea.simple-editor.small {
268
+ height: 192px;
269
+ }
270
+
271
  @media (min-width: 783px) and (max-width: 828px) {
272
  .auto-fold #wpcontent, .auto-fold #wpfooter {
273
  margin-left: 20px;
494
  .text .checkbox-button {
495
  padding: 2px 5px 2px 4px;
496
  }
497
+ .ai-settings-table tr {
498
+ height: 40px;
499
+ }
500
+ .ai-settings-table input {
501
+ height: 30px;
502
+ }
503
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
504
+ font-family: sans-serif,Arial,Verdana;
505
+ font-size: 16px;
506
+ }
507
  }
508
+
509
+ @media(min-width: 769px) {
510
+ #ai-form select {
511
+ line-height: 22px;
512
+ height: 22px;
513
+ }
514
+ }
515
+
516
+
css/images/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
18
+ </div>
19
+ <p>
20
+ Some Ad Inserter Pro features: IP address and country lists, Scheduling between dates with fallback
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
css/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
18
+ </div>
19
+ <p>
20
+ Some Ad Inserter Pro features: IP address and country lists, Scheduling between dates with fallback
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
images/after-comments.png ADDED
Binary file
images/before-comments.png ADDED
Binary file
images/between-comments.png ADDED
Binary file
images/{media.net_728x90.gif → contextual-1.gif} RENAMED
File without changes
images/{media.net_250x250_2.jpg → contextual-2.jpg} RENAMED
File without changes
images/domain-monitor.png DELETED
Binary file
images/index.html CHANGED
@@ -1,103 +1,26 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <meta http-equiv="content-style-type" content="text/css" />
6
- <meta http-equiv="content-script-type" content="text/javascript" />
7
-
8
- <title>Ad Inserter - Adsense and Amazon ads for Wordpress</title>
9
- <meta name="description" content="Ad Inserter - Insert Adsense, Amazon or any other code into Wordpress" />
10
- <meta name="keywords" content="ad inserter, wordpress, adsense, amazon, html, code, javascript, php" />
11
-
12
- <style>
13
- body {
14
- font-family: arial, helvetica;
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div style="float: left;">
21
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
22
- <h1 style="text-align: center;">Ad Inserter - Insert Any Code Anywhere</h1>
23
- <div style="margin: 8px 0; padding: 0 8px; text-align: center;">
24
- <h2 style="display: inline-block; margin: 16px 0;">Follow Ad Inserter</h2>
25
- <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img src="images/twitter.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter on Twitter" /></a>
26
- <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img src="images/facebook.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter on Facebook" /></a>
27
  </div>
28
- <p>
29
- Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
30
- Need more than 64 code blocks? <a href="http://adinserter.pro/" target="_blank" rel="nofollow">Ad Inserter Pro</a> supports
31
- 64 blocks, 6 viewports, import/export settings and has additional multisite support.
32
- </p>
33
- <div>
34
- <a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" /></a>
35
- </div>
36
- <p>
37
- Settings for one code block. Up to 16 blocks can be configured.
38
- </p>
39
- <hr />
40
- <div>
41
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
42
- </div>
43
- <p>
44
- Some <a href="http://adinserter.pro/" rel="nofollow" class="seoquake-nofollow">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
45
- </p>
46
- <hr />
47
- <div>
48
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
49
- </div>
50
- <p>
51
- Code preview with visual CSS editor
52
- </p>
53
- <hr />
54
- <div>
55
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800"/>
56
- </div>
57
- <p>
58
- Code preview with visual CSS editor - highlighted code
59
- </p>
60
- <hr />
61
- <div>
62
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
63
- </div>
64
- <p>
65
- Complete settings for one code block (Before Paragraph)
66
- </p>
67
- </div>
68
- </div>
69
-
70
- <div style="float: left;">
71
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
72
- <h1 style="text-align: center;">Tiny Monitor</h1>
73
- <h2 style="text-align: center;">Monitor Google AdSense, Amazon Associates and PayPal earnings</h2>
74
- <p style="text-align: justify;">
75
- Tiny Monitor for
76
- <a href="http://tinymonitor.com/adsense-monitor-documentation" target="_blank" rel="nofollow">AdSense</a>,
77
- <a href="http://tinymonitor.com/amazon-monitor-documentation" target="_blank" rel="nofollow">Amazon</a> and
78
- <a href="http://tinymonitor.com/paypal-monitor-documentation" target="_blank" rel="nofollow">PayPal</a> is a perfect solution to track your online earnings.
79
- This is a small PHP script that can be installed on any <a href="http://tinymonitor.com/installing-web-server" target="_blank" rel="nofollow">home web server</a> or commercial web hosting.
80
- If you already have some website (very likely as you are using Ad Inserter plugin) then you can simply put it into a folder.
81
- </p>
82
- <p style="text-align: justify;">
83
- Tiny Monitor automatically downloads data from Google, Amazon or PayPal and presents it in a simple single-page form.
84
- This way you can have all the data easily accessible without the need to log into many websites just to check today's earnings.
85
- </p>
86
- <a href="http://tinymonitor.com/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/monitors.png" alt="Tiny Monitor"></a>
87
- <p style="text-align: justify;">
88
- And if you have more than one domain then you can monitor them with <a href="http://tinymonitor.com/domain-monitor-documentation" target="_blank" rel="nofollow">Tiny Domain Monitor</a>.
89
- This PHP script is a simple yet effective solution to track expiration dates of your own domains or any other domains you would like to register as soon as they expire.
90
- </p>
91
- <a href="http://tinymonitor.com/domainmonitor/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/domain-monitor.png" alt="Domain Monitor Script"></a>
92
- <div>
93
- <p style="text-align: justify;"><a href="http://tinymonitor.com/domain-monitor" target="_blank" rel="nofollow">Tiny Domain Monitor</a> is a simple standalone PHP script for automatic
94
- domain monitoring. It supports most top level domains including country domains. It can be used to monitor own domains and other registered domains in order to be
95
- informed when they expire or become again available for registration. With the help of a cron job the domain data is automatically updated. Tiny Domain Monitor can
96
- send an email when a domain data change occurs and it also generates RSS feed to track domain changes in any feed reader.</p>
97
- </div>
98
- </div>
99
- </div>
100
- <body>
101
-
102
- </html>
103
-
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
 
 
 
 
 
 
 
 
 
18
  </div>
19
+ <p>
20
+ Code preview with visual CSS editor
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/monitors.png DELETED
Binary file
images/stars.png ADDED
Binary file
images/test.png ADDED
Binary file
includes/ace/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
includes/index.html CHANGED
@@ -1,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
includes/js/ads.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
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,4 +1,26 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
+ </div>
19
+ <p>
20
+ Code preview with visual CSS editor - highlighted code
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
index.html CHANGED
@@ -1,103 +1,26 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <meta http-equiv="content-style-type" content="text/css" />
6
- <meta http-equiv="content-script-type" content="text/javascript" />
7
-
8
- <title>Ad Inserter - Adsense and Amazon ads for Wordpress</title>
9
- <meta name="description" content="Ad Inserter - Insert Adsense, Amazon or any other code into Wordpress" />
10
- <meta name="keywords" content="ad inserter, wordpress, adsense, amazon, html, code, javascript, php" />
11
-
12
- <style>
13
- body {
14
- font-family: arial, helvetica;
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div style="float: left;">
21
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
22
- <h1 style="text-align: center;">Ad Inserter - Insert Any Code Anywhere</h1>
23
- <div style="margin: 8px 0; padding: 0 8px; text-align: center;">
24
- <h2 style="display: inline-block; margin: 16px 0;">Follow Ad Inserter</h2>
25
- <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img src="images/twitter.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Twitter" alt="Ad Inserter on Twitter" /></a>
26
- <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img src="images/facebook.png" style="vertical-align: middle; margin: 0 10px 7px 10px;" title="Ad Inserter on Facebook" alt="Ad Inserter on Facebook" /></a>
27
  </div>
28
- <p>
29
- Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
30
- Need more than 64 code blocks? <a href="http://adinserter.pro/" target="_blank" rel="nofollow">Ad Inserter Pro</a> supports
31
- 64 blocks, 6 viewports, import/export settings and has additional multisite support.
32
- </p>
33
- <div>
34
- <a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" /></a>
35
- </div>
36
- <p>
37
- Settings for one code block. Up to 16 blocks can be configured.
38
- </p>
39
- <hr />
40
- <div>
41
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
42
- </div>
43
- <p>
44
- Some <a href="http://adinserter.pro/" rel="nofollow" class="seoquake-nofollow">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
45
- </p>
46
- <hr />
47
- <div>
48
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
49
- </div>
50
- <p>
51
- Code preview with visual CSS editor
52
- </p>
53
- <hr />
54
- <div>
55
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800"/>
56
- </div>
57
- <p>
58
- Code preview with visual CSS editor - highlighted code
59
- </p>
60
- <hr />
61
- <div>
62
- <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
63
- </div>
64
- <p>
65
- Complete settings for one code block (Before Paragraph)
66
- </p>
67
- </div>
68
- </div>
69
-
70
- <div style="float: left;">
71
- <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
72
- <h1 style="text-align: center;">Tiny Monitor</h1>
73
- <h2 style="text-align: center;">Monitor Google AdSense, Amazon Associates and PayPal earnings</h2>
74
- <p style="text-align: justify;">
75
- Tiny Monitor for
76
- <a href="http://tinymonitor.com/adsense-monitor-documentation" target="_blank" rel="nofollow">AdSense</a>,
77
- <a href="http://tinymonitor.com/amazon-monitor-documentation" target="_blank" rel="nofollow">Amazon</a> and
78
- <a href="http://tinymonitor.com/paypal-monitor-documentation" target="_blank" rel="nofollow">PayPal</a> is a perfect solution to track your online earnings.
79
- This is a small PHP script that can be installed on any <a href="http://tinymonitor.com/installing-web-server" target="_blank" rel="nofollow">home web server</a> or commercial web hosting.
80
- If you already have some website (very likely as you are using Ad Inserter plugin) then you can simply put it into a folder.
81
- </p>
82
- <p style="text-align: justify;">
83
- Tiny Monitor automatically downloads data from Google, Amazon or PayPal and presents it in a simple single-page form.
84
- This way you can have all the data easily accessible without the need to log into many websites just to check today's earnings.
85
- </p>
86
- <a href="http://tinymonitor.com/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/monitors.png" alt="Tiny Monitor"></a>
87
- <p style="text-align: justify;">
88
- And if you have more than one domain then you can monitor them with <a href="http://tinymonitor.com/domain-monitor-documentation" target="_blank" rel="nofollow">Tiny Domain Monitor</a>.
89
- This PHP script is a simple yet effective solution to track expiration dates of your own domains or any other domains you would like to register as soon as they expire.
90
- </p>
91
- <a href="http://tinymonitor.com/domainmonitor/" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="images/domain-monitor.png" alt="Domain Monitor Script"></a>
92
- <div>
93
- <p style="text-align: justify;"><a href="http://tinymonitor.com/domain-monitor" target="_blank" rel="nofollow">Tiny Domain Monitor</a> is a simple standalone PHP script for automatic
94
- domain monitoring. It supports most top level domains including country domains. It can be used to monitor own domains and other registered domains in order to be
95
- informed when they expire or become again available for registration. With the help of a cron job the domain data is automatically updated. Tiny Domain Monitor can
96
- send an email when a domain data change occurs and it also generates RSS feed to track domain changes in any feed reader.</p>
97
- </div>
98
- </div>
99
- </div>
100
- <body>
101
-
102
- </html>
103
-
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks? Ad Inserter Pro supports
14
+ 64 blocks, GEO targeting, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <a href="http://adinserter.pro/documentation" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" alt="Ad Inserter Documentation" /></a>
 
 
 
 
 
 
 
 
 
18
  </div>
19
+ <p>
20
+ Settings for one code block. Up to 16 blocks can be configured.
21
+ </p>
22
+ </div>
23
+ <body>
24
+
25
+ </html>
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/ad-inserter.js CHANGED
@@ -1,8 +1,9 @@
1
- var javascript_version = "2.1.10";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
5
  var active_tab = 1;
 
6
  var tabs_to_configure = new Array();
7
 
8
  var current_tab = 0;
@@ -37,6 +38,10 @@ var AI_ALIGNMENT_STICKY_RIGHT = 9;
37
  var AI_ALIGNMENT_STICKY_TOP = 10;
38
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
39
 
 
 
 
 
40
  var shSettings = {
41
  "tab_size":"4",
42
  "use_soft_tabs":"1",
@@ -81,7 +86,7 @@ function SyntaxHighlight (id, block, settings) {
81
  textarea.removeAttr ("name");
82
  }
83
 
84
- jQuery("#ai-active-tab").attr ("value", active_tab);
85
  });
86
 
87
  session.setMode ("ace/mode/html");
@@ -121,6 +126,25 @@ function change_block_alignment (block) {
121
  }(jQuery));
122
 
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  jQuery(document).ready(function($) {
125
 
126
  var header = $('#ai-settings-' + 'header').length != 0;
@@ -775,7 +799,7 @@ jQuery(document).ready(function($) {
775
  });
776
  }
777
 
778
- if (block != 'h' && block != 'f' && !header) {
779
  if ((block - 1) >> 4) {
780
  $('#block' + '-' + block).removeAttr(header_id);
781
  $('#display' + '-type-' + block).removeAttr(header_id);
@@ -788,16 +812,33 @@ jQuery(document).ready(function($) {
788
  }
789
  }
790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
  function configure_tab_0 () {
792
 
793
  if (debug) console.log ("configure_tab_0");
794
 
795
  $('#tab-0').addClass ('configured');
796
 
797
- $('#tab-0 input[type=submit], #tab-0 button').button().show ();
 
798
 
799
  configure_editor ('h');
800
  configure_editor ('f');
 
 
801
 
802
  $('#ai-plugin-settings-tab-container').tabs();
803
  $('#ai-plugin-settings-tabs').show();
@@ -823,8 +864,14 @@ jQuery(document).ready(function($) {
823
  if (syntax_highlighting) configure_editor_language ('f')
824
  });
825
 
 
 
 
 
826
  if (syntax_highlighting) configure_editor_language ('h');
827
  if (syntax_highlighting) configure_editor_language ('f');
 
 
828
 
829
  for (var index = 1; index <= geo_groups; index ++) {
830
  generate_country_list ('group-country', index);
@@ -839,6 +886,31 @@ jQuery(document).ready(function($) {
839
  $('#enable-footer-404').checkboxButton ();
840
  $('#simple-editor-f').checkboxButton ();
841
  $('#process-php-f').checkboxButton ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842
  }
843
 
844
  function configure_tab (tab) {
@@ -1516,6 +1588,23 @@ jQuery(document).ready(function($) {
1516
  }
1517
  }
1518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1519
  function configure_charts (container) {
1520
  $(container).find ('.ai-chart.not-configured').each (function() {
1521
  if (!$(this).hasClass ('hidden')) {
@@ -1524,6 +1613,7 @@ jQuery(document).ready(function($) {
1524
  });
1525
  }
1526
 
 
1527
  if (debug) console.log ("READY");
1528
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1529
  if (debug) {
@@ -1534,11 +1624,20 @@ jQuery(document).ready(function($) {
1534
  $("#blocked-warning").removeClass ('warning-enabled');
1535
  $("#blocked-warning").hide ();
1536
 
1537
- start = parseInt ($('#ai-form').attr('start'));
1538
- end = parseInt ($('#ai-form').attr('end'));
1539
- active_tab = parseInt ($("#ai-active-tab").attr ("value"));
 
 
 
 
 
 
 
 
 
1540
 
1541
- if (debug) console.log ("active_tab: " + active_tab);
1542
 
1543
  var tabs_array = new Array ();
1544
  if (active_tab != 0) tabs_array.push (0);
@@ -1592,6 +1691,7 @@ jQuery(document).ready(function($) {
1592
  var index = 16;
1593
  if (active_tab != 0) index = active_tab - start;
1594
  var block_tabs = $("#ai-tab-container").tabs ({active: index});
 
1595
 
1596
  $('#ai-settings').tooltip({
1597
  show: {effect: "blind",
@@ -1618,14 +1718,14 @@ jQuery(document).ready(function($) {
1618
  remove_default_values (0);
1619
  });
1620
 
1621
- if (syntax_highlighting) {
1622
- $('.ai-tab').click (function () {
1623
- tab_block = $(this).attr ("id");
1624
- tab_block = tab_block.replace ("ai-tab","");
1625
- active_tab = tab_block;
1626
 
1627
- if (debug) console.log ("active_tab: " + active_tab);
1628
 
 
1629
  if (!$("#tab-" + tab_block).hasClass ('configured')) {
1630
  if (debug) console.log ("");
1631
  if (debug) console.log ("Empty tab: " + tab_block);
@@ -1636,9 +1736,14 @@ jQuery(document).ready(function($) {
1636
  var editor = ace.edit ("editor-" + tab_block);
1637
  editor.getSession ().highlightLines (10000000);
1638
  }
1639
- });
 
 
 
 
 
1640
 
1641
- $('.ai-plugin-tab').click (function () {
1642
  tab_block = $(this).attr ("id");
1643
  tab_block = tab_block.replace ("ai-","");
1644
 
@@ -1649,14 +1754,33 @@ jQuery(document).ready(function($) {
1649
  if (tab_block == 'f') {
1650
  editor = ace.edit ("editor-f");
1651
  editor.getSession ().highlightLines (10000000);
 
 
 
 
1652
  }
1653
- });
1654
- }
1655
 
1656
  $('#plugin_name').dblclick (function () {
1657
  $("#system-debugging").toggle();
1658
  });
1659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1660
  if (debug) console.log ("");
1661
  if (debug) console.log ("READY END");
1662
  if (debug) {
1
+ var javascript_version = "2.1.13";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
5
  var active_tab = 1;
6
+ var active_tab_0 = 0;
7
  var tabs_to_configure = new Array();
8
 
9
  var current_tab = 0;
38
  var AI_ALIGNMENT_STICKY_TOP = 10;
39
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
40
 
41
+ var AI_ACTION_NONE = 0;
42
+ var AI_ACTION_WARNING_MESSAGE = 1;
43
+ var AI_ACTION_REDIRECTION = 2;
44
+
45
  var shSettings = {
46
  "tab_size":"4",
47
  "use_soft_tabs":"1",
86
  textarea.removeAttr ("name");
87
  }
88
 
89
+ jQuery("#ai-active-tab").attr ("value", '[' + active_tab + ',' + active_tab_0 + ']');
90
  });
91
 
92
  session.setMode ("ace/mode/html");
126
  }(jQuery));
127
 
128
 
129
+ function get_editor_text (block) {
130
+ var editor = ace.edit ("editor-" + block);
131
+ var textarea = jQuery ("#block-" + block);
132
+ var editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
133
+ if (!editor_disabled) {
134
+ return editor.getSession ().getValue();
135
+ } else return textarea.val ();
136
+ }
137
+
138
+ function set_editor_text (block, text) {
139
+ var editor = ace.edit ("editor-" + block);
140
+ var textarea = jQuery ("#block-" + block);
141
+ var editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
142
+ if (!editor_disabled) {
143
+ return editor.getSession ().setValue(text);
144
+ } else textarea.val (text);
145
+ }
146
+
147
+
148
  jQuery(document).ready(function($) {
149
 
150
  var header = $('#ai-settings-' + 'header').length != 0;
799
  });
800
  }
801
 
802
+ if (block != 'h' && block != 'f' && block != 'a' && !header) {
803
  if ((block - 1) >> 4) {
804
  $('#block' + '-' + block).removeAttr(header_id);
805
  $('#display' + '-type-' + block).removeAttr(header_id);
812
  }
813
  }
814
 
815
+ function configure_adb () {
816
+ $("#adb-message").hide();
817
+ $("#adb-page-redirection").hide();
818
+
819
+ var adb_action = $("select#adb-action option:selected").attr('value');
820
+
821
+ if (adb_action == AI_ACTION_WARNING_MESSAGE) {
822
+ $("#adb-message").show();
823
+ } else
824
+ if (adb_action == AI_ACTION_REDIRECTION) {
825
+ $("#adb-page-redirection").show();
826
+ }
827
+ }
828
+
829
  function configure_tab_0 () {
830
 
831
  if (debug) console.log ("configure_tab_0");
832
 
833
  $('#tab-0').addClass ('configured');
834
 
835
+ // $('#tab-0 input[type=submit], #tab-0 button').button().show ();
836
+ $('#tab-0 input[type=submit]').button().show ();
837
 
838
  configure_editor ('h');
839
  configure_editor ('f');
840
+ if ($("#block-a").length)
841
+ configure_editor ('a');
842
 
843
  $('#ai-plugin-settings-tab-container').tabs();
844
  $('#ai-plugin-settings-tabs').show();
864
  if (syntax_highlighting) configure_editor_language ('f')
865
  });
866
 
867
+ $("input#process-php-a").change (function() {
868
+ if (syntax_highlighting) configure_editor_language ('a')
869
+ });
870
+
871
  if (syntax_highlighting) configure_editor_language ('h');
872
  if (syntax_highlighting) configure_editor_language ('f');
873
+ if ($("#block-a").length)
874
+ if (syntax_highlighting) configure_editor_language ('a');
875
 
876
  for (var index = 1; index <= geo_groups; index ++) {
877
  generate_country_list ('group-country', index);
886
  $('#enable-footer-404').checkboxButton ();
887
  $('#simple-editor-f').checkboxButton ();
888
  $('#process-php-f').checkboxButton ();
889
+
890
+ $('#enable-adb-detection').checkboxButton ();
891
+ $('#simple-editor-a').checkboxButton ();
892
+ $('#process-php-a').checkboxButton ();
893
+
894
+
895
+ configure_adb ();
896
+ $("select#adb-action").change (function() {
897
+ configure_adb ();
898
+ });
899
+
900
+ $("#preview-button-adb").button ({
901
+ }).show ().click (function () {
902
+
903
+ $(this).blur ();
904
+
905
+ var window_width = 820;
906
+ var window_height = 870;
907
+ var nonce = $(this).attr ('nonce');
908
+ var site_url = $(this).attr ('site-url');
909
+ var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&preview=adb&ai_check=" + nonce;
910
+ var window_left = 120;
911
+ var window_top = (screen.height / 2) - (870 / 2);
912
+ var preview_window = window.open (page, 'preview','width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
913
+ });
914
  }
915
 
916
  function configure_tab (tab) {
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
  });
1614
  }
1615
 
1616
+
1617
  if (debug) console.log ("READY");
1618
  if (debug_title) $("#plugin_name").css ("color", "#f00");
1619
  if (debug) {
1624
  $("#blocked-warning").removeClass ('warning-enabled');
1625
  $("#blocked-warning").hide ();
1626
 
1627
+ start = parseInt ($('#ai-form').attr('start'));
1628
+ end = parseInt ($('#ai-form').attr('end'));
1629
+
1630
+ active_tab = 1;
1631
+ active_tab_0 = 0;
1632
+ try {
1633
+ var active_tabs = JSON.parse ($("#ai-active-tab").attr ("value"));
1634
+ if (typeof active_tabs !== "undefined" && active_tabs.constructor === Array && Number.isInteger (active_tabs [0]) && Number.isInteger (active_tabs [1])) {
1635
+ active_tab = parseInt (active_tabs [0]);
1636
+ active_tab_0 = parseInt (active_tabs [1]);
1637
+ }
1638
+ } catch (e) {}
1639
 
1640
+ if (debug) console.log ("active_tabs:", active_tab, active_tab_0);
1641
 
1642
  var tabs_array = new Array ();
1643
  if (active_tab != 0) tabs_array.push (0);
1691
  var index = 16;
1692
  if (active_tab != 0) index = active_tab - start;
1693
  var block_tabs = $("#ai-tab-container").tabs ({active: index});
1694
+ $("#ai-plugin-settings-tab-container").tabs ({active: active_tab_0});
1695
 
1696
  $('#ai-settings').tooltip({
1697
  show: {effect: "blind",
1718
  remove_default_values (0);
1719
  });
1720
 
1721
+ $('.ai-tab').click (function () {
1722
+ tab_block = $(this).attr ("id");
1723
+ tab_block = tab_block.replace ("ai-tab","");
1724
+ active_tab = tab_block;
 
1725
 
1726
+ if (debug) console.log ("active_tab: " + active_tab);
1727
 
1728
+ if (syntax_highlighting) {
1729
  if (!$("#tab-" + tab_block).hasClass ('configured')) {
1730
  if (debug) console.log ("");
1731
  if (debug) console.log ("Empty tab: " + tab_block);
1736
  var editor = ace.edit ("editor-" + tab_block);
1737
  editor.getSession ().highlightLines (10000000);
1738
  }
1739
+ }
1740
+ });
1741
+
1742
+ $('.ai-plugin-tab').click (function () {
1743
+ active_tab_0 = $("#ai-plugin-settings-tab-container").tabs ('option', 'active');
1744
+ if (debug) console.log ("active_tab_0: " + active_tab_0);
1745
 
1746
+ if (syntax_highlighting) {
1747
  tab_block = $(this).attr ("id");
1748
  tab_block = tab_block.replace ("ai-","");
1749
 
1754
  if (tab_block == 'f') {
1755
  editor = ace.edit ("editor-f");
1756
  editor.getSession ().highlightLines (10000000);
1757
+ } else
1758
+ if (tab_block == 'a') {
1759
+ editor = ace.edit ("editor-a");
1760
+ editor.getSession ().highlightLines (10000000);
1761
  }
1762
+ }
1763
+ });
1764
 
1765
  $('#plugin_name').dblclick (function () {
1766
  $("#system-debugging").toggle();
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) {
js/index.html CHANGED
@@ -1,4 +1,27 @@
1
- <html>
2
- <body bgcolor="#FFFFFF">
3
- </body>
4
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Ad Inserter - WordPress plugin for ad management</title>
5
+ <meta name="description" content="WordPress ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code" />
6
+ </head>
7
+ <body style="font-family: arial, helvetica;">
8
+ <div style="width: 800px; padding: 2px 8px 6px 8px; margin: 8px 30px 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; background: #fff;">
9
+ <h1 style="text-align: center;">Ad Inserter</h1>
10
+ <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
+ <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
+ 64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
+ </p>
16
+ <div>
17
+ <img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
18
+ </div>
19
+ <p>
20
+ Complete settings for one code block (Before Paragraph)
21
+ </p>
22
+ </div>
23
+ </div>
24
+ <body>
25
+
26
+ </html>
27
+
preview-adb.php ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //ini_set ('display_errors', 1);
4
+ //error_reporting (E_ALL);
5
+
6
+ function ai_media_buttons () {
7
+ echo '<button type="button" id="add-p" class="button" style="width: 36px;" title="Add dummy paragraph">+</button>';
8
+ echo '<button type="button" id="remove-p" class="button" style="width: 36px;" title="Remove dummy paragraph">-</button>';
9
+ echo '<button type="button" id="use-button" class="button" style="width: 90px;" title="Use current settings"> Use </button>';
10
+ echo '<button type="button" id="reset-button" class="button" style="width: 90px;" title="Reset to the saved settings"> Reset </button>';
11
+ echo '<button type="button" id="default-button" class="button" style="width: 90px;" title="Reset to the default settings"> Default </button>';
12
+ echo '<button type="button" id="cancel-button" class="button" style="width: 90px;" title="Use current settings"> Cancel </button>';
13
+ }
14
+
15
+ function ai_mce_buttons ($buttons, $id) {
16
+ $buttons = array_unique (array_merge ($buttons, array ('styleselect')));
17
+ return $buttons;
18
+ }
19
+
20
+ function ai_mce_buttons_2 ($buttons, $id) {
21
+ $buttons = array_unique (array_merge ($buttons, array ('forecolor', 'backcolor', 'hr', 'fontselect', 'fontsizeselect')));
22
+ if (($key = array_search ('wp_help', $buttons)) !== false) {
23
+ unset ($buttons [$key]);
24
+ }
25
+ return $buttons;
26
+ }
27
+
28
+ function generate_code_preview_adb () {
29
+ global $block_object, $ai_wp_data;
30
+
31
+ $ai_wp_data [AI_WP_DEBUGGING] = 0;
32
+
33
+ $obj = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
34
+ $adb_message = $obj->get_ad_data();
35
+
36
+ wp_enqueue_script ('ai-adb-js', plugins_url ('includes/js/ad-inserter-check.js', __FILE__), array (
37
+ 'jquery',
38
+ 'jquery-ui-tabs',
39
+ 'jquery-ui-button',
40
+ 'jquery-ui-tooltip',
41
+ 'jquery-ui-datepicker',
42
+ 'jquery-ui-dialog',
43
+ ), AD_INSERTER_VERSION);
44
+
45
+ wp_enqueue_style ('ai-adb-css', plugins_url ('css/ad-inserter.css', __FILE__), array (), AD_INSERTER_VERSION);
46
+
47
+ add_action ('media_buttons', 'ai_media_buttons');
48
+
49
+ add_filter ('mce_buttons', 'ai_mce_buttons', 99999, 2);
50
+ add_filter ('mce_buttons_2', 'ai_mce_buttons_2', 99999, 2);
51
+
52
+ ob_start ();
53
+ wp_head ();
54
+ $head = ob_get_clean ();
55
+ $head = preg_replace ('#<title>([^<]*)</title>#', '<title>' . AD_INSERTER_NAME . ' Ad Blocking Detected Message Preview</title>', $head);
56
+ ?>
57
+ <html>
58
+ <head>
59
+ <?php
60
+ echo $head;
61
+ ?>
62
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
63
+ <script>
64
+
65
+ // initialize_preview ();
66
+
67
+ window.onkeydown = function (event) {
68
+ if (event.keyCode === 27 ) {
69
+ window.close();
70
+ }
71
+ }
72
+
73
+ // https://gist.github.com/RadGH/523bed274f307830752c
74
+
75
+ // 0) If you are not using the default visual editor, make your own in PHP with a defined editor ID:
76
+ // wp_editor( $content, 'tab-editor' );
77
+
78
+ // 1) Get contents of your editor in JavaScript:
79
+ // tmce_getContent( 'tab-editor' )
80
+
81
+ // 2) Set content of the editor:
82
+ // tmce_setContent( content, 'tab-editor' )
83
+
84
+ // Note: If you just want to use the default editor, you can leave the ID blank:
85
+ // tmce_getContent()
86
+ // tmce_setContent( content )
87
+
88
+ // Note: If using a custom textarea ID, different than the editor id, add an extra argument:
89
+ // tmce_getContent( 'visual-id', 'textarea-id' )
90
+ // tmce_getContent( content, 'visual-id', 'textarea-id')
91
+
92
+ // Note: An additional function to provide "focus" to the displayed editor:
93
+ // tmce_focus( 'tab-editor' )
94
+
95
+ function tmce_getContent (editor_id, textarea_id) {
96
+ if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
97
+ if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
98
+
99
+ if (jQuery('#wp-' + editor_id + '-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
100
+ return tinyMCE.get(editor_id).getContent();
101
+ } else {
102
+ return jQuery('#'+textarea_id).val();
103
+ }
104
+ }
105
+
106
+ function tmce_setContent (content, editor_id, textarea_id) {
107
+ if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
108
+ if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
109
+
110
+ if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
111
+ return tinyMCE.get (editor_id).setContent (content);
112
+ } else {
113
+ return jQuery('#'+textarea_id).val (content);
114
+ }
115
+ }
116
+
117
+ function tmce_focus (editor_id, textarea_id) {
118
+ if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
119
+ if (typeof textarea_id == 'undefined') textarea_id = editor_id;
120
+
121
+ if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
122
+ return tinyMCE.get (editor_id).focus();
123
+ } else {
124
+ return jQuery('#'+textarea_id).focus();
125
+ }
126
+ }
127
+
128
+ function update_message_preview (editor, e) {
129
+ jQuery('#message').html (editor.getContent());
130
+ }
131
+
132
+ jQuery(document).ready(function($) {
133
+
134
+ function process_display_elements () {
135
+ $('#message').attr ('style', '<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) ; ?>' + $("#message-css").val ()).css ({'position': 'absolute'});
136
+ $('#overlay').attr ('style', '<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) ; ?>' + $("#overlay-css").val ()).css ({'position': 'absolute'});
137
+ $('#message').html (tmce_getContent ());
138
+ }
139
+
140
+ function initialize_preview () {
141
+
142
+ var debug = <?php echo get_javascript_debugging () ? 'true' : 'false'; ?>;
143
+
144
+ function load_from_settings () {
145
+
146
+ if (window.opener != null && !window.opener.closed) {
147
+ var settings = $(window.opener.document).contents();
148
+
149
+ tmce_setContent (window.opener.get_editor_text ('a'));
150
+ $("#message-css").val (settings.find ("#message-css").val ());
151
+ $("#overlay-css").val (settings.find ("#overlay-css").val ());
152
+
153
+ process_display_elements ();
154
+ }
155
+ }
156
+
157
+ function apply_to_settings () {
158
+ if (window.opener != null && !window.opener.closed) {
159
+ var settings = $(window.opener.document).contents ();
160
+
161
+ window.opener.set_editor_text ('a', tmce_getContent ())
162
+ settings.find ("#message-css").val ($("#message-css").val ());
163
+ settings.find ("#overlay-css").val ($("#overlay-css").val ());
164
+ }
165
+ }
166
+
167
+ $("#use-button").button ({
168
+ }).click (function () {
169
+ apply_to_settings ();
170
+ window.close();
171
+ });
172
+
173
+ $("#default-button").button ({
174
+ }).click (function () {
175
+ tmce_setContent ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_MESSAGE); ?>');
176
+ $("#message-css").val ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_MESSAGE_CSS); ?>');
177
+ $("#overlay-css").val ('<?php echo str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_DEFAULT_ADB_OVERLAY_CSS); ?>');
178
+ process_display_elements ();
179
+ });
180
+
181
+ $("#reset-button").button ({
182
+ }).click (function () {
183
+ load_from_settings ();
184
+ });
185
+
186
+ $("#cancel-button").button ({
187
+ }).click (function () {
188
+ window.close();
189
+ });
190
+
191
+ $("#message-css").on ('input', function() {
192
+ process_display_elements ();
193
+ });
194
+
195
+ $("#overlay-css").on ('input', function() {
196
+ process_display_elements ();
197
+ });
198
+
199
+ $('#aiadb').bind('input propertychange', function() {
200
+ $('#message').html ($('#aiadb').val ());
201
+ });
202
+
203
+ $('#add-p').click(function (e) {
204
+ var paragraphs = $('#dummy-text').children ('p.dummy');
205
+ if (paragraphs.length < 10) {
206
+ paragraphs.last().clone().appendTo ($('#dummy-text'));
207
+ }
208
+ });
209
+
210
+ $('#remove-p').click(function (e) {
211
+ var paragraphs = $('#dummy-text').children ('p.dummy');
212
+ if (paragraphs.length > 1) {
213
+ paragraphs.last().remove();
214
+ }
215
+ });
216
+
217
+ load_from_settings ();
218
+ }
219
+
220
+ initialize_preview ();
221
+
222
+ setTimeout (show_blocked_warning, 400);
223
+ });
224
+
225
+ function show_blocked_warning () {
226
+ jQuery("#blocked-warning.warning-enabled").show ();
227
+ }
228
+
229
+ </script>
230
+ <style>
231
+ body {
232
+ background: #fff;
233
+ display: block;
234
+ margin: 8px;
235
+ }
236
+
237
+ input[type="text"] {
238
+ max-width: initial;
239
+ }
240
+
241
+ button,
242
+ input[type="button"] {
243
+ width: initial;
244
+ }
245
+
246
+ .button {
247
+ font-size: 14px!important;
248
+ }
249
+
250
+ #text {
251
+ position: relative;
252
+ }
253
+ </style>
254
+ </head>
255
+ <body style='font-family: arial; overflow-x: hidden;'>
256
+ <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>"></div>
257
+
258
+ <div id="blocked-warning" class="warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
259
+ <div style="float: right; text-align: right; margin: 20px 0px 0px 0;">
260
+ This page was not loaded properly. Please check browser, plugins and ad blockers.
261
+ </div>
262
+ <h3 style="color: red;" title="Error loading page">PAGE BLOCKED</h3>
263
+
264
+ <div style="clear: both;"></div>
265
+ </div>
266
+
267
+ <div id="text">
268
+ <div id="overlay"></div>
269
+ <div id="message"></div>
270
+ <div id="dummy-text">
271
+ <p class='dummy'>Lorem ipsum dolor sit amet, quo ea quem munere, mea eu dicunt moderatius interesset. Eam ei saepe insolens, an wisi timeam vel, regione eruditi admodum in mei.
272
+ Nam iusto definitiones id, an graeci reprimique usu, eum iusto eruditi ei. At sint elitr propriae pro.</p>
273
+ <p class='dummy'>Clita periculis an eam, movet populo semper has an. Id quo unum justo affert, recusabo aliquando nam te, mei aeque soluta voluptaria no. Tantas pertinax ei eos, vim ipsum reformidans ne, lucilius mediocrem explicari cu cum. Eum integre definitionem vituperatoribus te.
274
+ His veri legere assentior ei, vis ferri detraxit cu. No quidam aliquip efficiantur sed, nusquam efficiendi dissentiunt pri ea.</p>
275
+ <p class='dummy'>Exerci aliquando ius ne, nostro timeam in sed, quaeque moderatius his at. At consul iudicabit nam, vel ei legere disputationi. Ea ius quidam sententiae.
276
+ Diam elit no sit, facete democritum referrentur est at. Quo et accusata dissentias, vis eligendi interpretaris ex.</p>
277
+ <p class='dummy'>In choro eleifend his. Qui no ignota mucius labore, dicta eruditi usu ea. Usu id insolens conceptam definitionem.
278
+ Mei quot fastidii pericula ex. Ut etiam delicata aliquando sea, aliquam senserit theophrastus et sit. Dolores torquatos mel ut, alia deserunt eu mea.</p>
279
+ </div>
280
+ </div>
281
+
282
+ <div style="width: 100%; min-height: 310px; margin: 8px 0;">
283
+ <?php
284
+
285
+ $editorSettings = array(
286
+ 'wpautop' => false,
287
+ 'media_buttons' => true,
288
+ 'textarea_rows' => 10,
289
+ 'tinymce'=> array (
290
+ 'menubar ' => false,
291
+ 'statusbar' => false,
292
+ 'setup' => 'function (editor) {
293
+ editor.on("change keyup redo undo", function (e) {
294
+ update_message_preview (editor, e);
295
+ });
296
+ }',
297
+ 'protect' => '[/<\?php.*?\?'.'>/g]',
298
+ ),
299
+ );
300
+
301
+ add_filter ('wp_default_editor', create_function ('', 'return "tinymce";'));
302
+ // wp_editor ($adb_message, 'aiadb', $editorSettings);
303
+ wp_editor ('', 'aiadb', $editorSettings);
304
+
305
+ // To disable Notice: Trying to get property of non-object in /wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 271
306
+ $error_reporting = error_reporting ();
307
+ error_reporting ($error_reporting & ~E_NOTICE);
308
+
309
+ \_WP_Editors::enqueue_scripts();
310
+ print_footer_scripts ();
311
+ \_WP_Editors::editor_js();
312
+
313
+ error_reporting ($error_reporting);
314
+
315
+ ?>
316
+ </div>
317
+
318
+ <div class="max-input" style="margin: 8px 0;">
319
+ <span style="display: table-cell; width: 90px; white-space: nowrap; font-size: 13px;">Message CSS</span>
320
+ <input style="display: table-cell; border-radius: 5px; width: 100%; padding-left: 5px;" type="text" id="message-css" value="" size="50" maxlength="200" />
321
+ </div>
322
+
323
+ <div class="max-input" style="margin: 8px 0;">
324
+ <span style="display: table-cell; width: 90px; white-space: nowrap; font-size: 13px;">Overlay CSS</span>
325
+ <input style="display: table-cell; border-radius: 5px; width: 100%; padding-left: 5px;" type="text" id="overlay-css" value="" size="50" maxlength="200" />
326
+ </div>
327
+
328
+ <?php wp_footer (); ?>
329
+ </body>
330
+ </html>
331
+ <?php
332
+ }
333
+
preview.php CHANGED
@@ -12,8 +12,9 @@ function alt_styles_data ($alt_styles_text) {
12
  }
13
 
14
  function generate_code_preview ($block) {
 
15
 
16
- global $block_object;
17
 
18
  $obj = $block_object [$block];
19
 
@@ -823,7 +824,6 @@ div.automatic-insertion img {
823
  $previous_width = $viewport_width;
824
  }
825
  echo "<td style='background: #eee; text-align: left; border: 1px solid #888; border-left-width: 0; min-width: 2000px'><span style='margin-left: 30px;'>", get_viewport_name (1), "</span><span style='float: left; margin-left: 5px;'>", $previous_width != 0 ? $previous_width . "px" : "", "</span></td>";
826
-
827
  ?>
828
  </tr>
829
  </table>
@@ -851,10 +851,10 @@ div.automatic-insertion img {
851
  </div>
852
 
853
  <div style="float: right; width: 90px; margin-left: 20px;">
854
- <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
855
- <button id="use-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Use</button>
856
- <button id="reset-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Reset</button>
857
- <button id="cancel-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90; height: 35px; float: right;" title="Highlight inserted code" >Cancel</button>
858
  </div>
859
 
860
  <div style="float: left; max-width: 300px; margin-right: 20px">
12
  }
13
 
14
  function generate_code_preview ($block) {
15
+ global $block_object, $ai_wp_data;
16
 
17
+ $ai_wp_data [AI_WP_DEBUGGING] = 0;
18
 
19
  $obj = $block_object [$block];
20
 
824
  $previous_width = $viewport_width;
825
  }
826
  echo "<td style='background: #eee; text-align: left; border: 1px solid #888; border-left-width: 0; min-width: 2000px'><span style='margin-left: 30px;'>", get_viewport_name (1), "</span><span style='float: left; margin-left: 5px;'>", $previous_width != 0 ? $previous_width . "px" : "", "</span></td>";
 
827
  ?>
828
  </tr>
829
  </table>
851
  </div>
852
 
853
  <div style="float: right; width: 90px; margin-left: 20px;">
854
+ <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
855
+ <button id="use-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Use current settings" >Use</button>
856
+ <button id="reset-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Reset to the block settings" >Reset</button>
857
+ <button id="cancel-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Close preview window" >Cancel</button>
858
  </div>
859
 
860
  <div style="float: left; max-width: 300px; margin-right: 20px">
readme.BAK DELETED
@@ -1,1023 +0,0 @@
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, advertising, widgets, contextual ads, ad rotation, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, widgets, PHP, Javascript, HTML, header, footer, tracking, sticky
5
- Requires at least: 4.0
6
- Tested up to: 4.8
7
- Stable tag: 2.1.10
8
- License: GPLv3
9
-
10
- Ad management plugin for all advertising needs: AdSense, Amazon, banner rotation, sticky widgets, contextual ads, AMP, header/footer code, you name it.
11
-
12
- == Description ==
13
-
14
- Ad management plugin with many advertising features to automatically insert adverts. **Perfect for all kinds of ads including AdSense.** Great also for contextual Amazon 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 (ad) 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
- > * Insertion of Google Analytics, Piwik or any other web analytics code
31
- > * Manual insertion: widgets, shortcodes, PHP function call
32
- > * Sticky (fixed) widgets (the sidebar does not move when the page is scrolled)
33
- > * Custom block alignment and style
34
- > * Insertion of ads on AMP pages
35
- > * Custom CSS class name for wrapping divs to avoid ad blockers
36
- > * Insertion of shortcodes from other plugins
37
- > * PHP code processing
38
- > * Ad rotation (server-side and client-side - works with caching)
39
- > * Desktop/mobile device detection (server-side and client-side - works with caching)
40
- > * Black/White-list categories, tags, post IDs, urls, url parameters, referers
41
- > * Simple troubleshooting with many debugging functions
42
- > * Function to visualize inserted code blocks
43
- > * Function to visualize available insertion positions
44
- > * Function to visualize HTML tags
45
-
46
- And <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> has even more features:
47
-
48
- > * 64 code (ad) blocks
49
- > * GEO targeting (works also with caching)
50
- > * Black/White-list IP addresses or countries (works also with caching)
51
- > * Ad impression and click tracking
52
- > * A/B testing
53
- > * Sticky ad positions (left, top, right, bottom)
54
- > * Scheduling with fallback option
55
- > * Multisite options to limit settings on the sites
56
- > * Post/page exception management
57
- > * 6 custom viewports for client-side desktop/mobile device detection
58
- > * Export and import of settings
59
- > * Support via email
60
-
61
- Ad Inserter Wordpress plugin has many features and options to automate ad insertion and to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any Javascript, HTML, PHP or advert code anywhere on the page. For best ad placement and to use optimal advertising positions please read the user manual to get the most of the plugin.
62
-
63
- > * 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
64
- > * 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
65
-
66
- **Endorsed by Amazon**
67
-
68
- > 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.
69
- >
70
- > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
71
- > * 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)
72
-
73
- **One Plugin - Many Functions**
74
-
75
- Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
76
-
77
- * to insert and manage ads
78
- * to insert different ads for mobile devices
79
- * for ad rotation
80
- * for sticky (fixed) widgets
81
- * for PHP code widgets
82
- * to insert some PHP code into posts
83
- * to insert header or footer code
84
- * to insert Google analytics code
85
- * to insert various forms
86
-
87
- Maintaining several plugins (often from different vendors) is not easy. And each plugin is slowing down the speed of your website.
88
-
89
- **Speed Up Your WordPress: Replace them all with free Ad Inserter!**
90
-
91
- **Quick Start**
92
-
93
- 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>:
94
-
95
- * 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
96
- * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
97
- * **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)
98
- * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
99
- * 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)
100
- * If you are using AdSense you may get blank (empty) ad blocks. This might be because there is some error in the code (wrong IDs), your AdSense account is not fully approved yet, your website was not accepted or your AdSense account is banned. Try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> - good AdSense alternative for contextual ads.
101
-
102
- 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.
103
- For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
104
-
105
- **Please support plugin development**
106
-
107
- 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>.
108
-
109
- 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.
110
-
111
- Support the advancement of this plugin:
112
-
113
- * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
114
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
115
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
116
-
117
- == Installation ==
118
-
119
- = Using The WordPress Dashboard =
120
-
121
- 1. Go to Wordpress Plugins menu, click Add New button
122
- 2. Search for `ad inserter`
123
- 3. Click 'Install Now'
124
- 4. Activate Ad Inserter on the Plugin dashboard
125
-
126
- = Uploading plugin file =
127
-
128
- 1. Go to Wordpress Plugins menu, click Add New button
129
- 2. Click Upload Plugin
130
- 3. Select `ad-inserter.zip` from your computer
131
- 4. Click 'Install Now'
132
- 5. Activate Ad Inserter in the Plugin dashboard
133
-
134
- = Using FTP =
135
-
136
- 1. Download `ad-inserter.zip`
137
- 2. Extract `ad-inserter` directory to your computer
138
- 3. Upload `ad-inserter` directory to the `/wp-content/plugins/` directory
139
- 4. Activate Ad Inserter in the Plugin dashboard
140
-
141
- **Ad Inserter Pro Installation**
142
-
143
- If you are using free Ad Inserter then first uninstall it. The Pro version will automatically import existing settings from the free version.
144
- 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,
145
- activate it and then click "Enter License Key" and enter license key you got in the email.
146
-
147
- = Uploading plugin file =
148
-
149
- 1. Go to Wordpress Plugins menu, click Add New button
150
- 2. Click Upload Plugin
151
- 3. Select `ad-inserter-pro.zip` from your computer
152
- 4. Click 'Install Now'
153
- 5. Activate Ad Inserter Pro in the Plugin dashboard
154
- 5. Click "Enter License Key" or go to plugin Settings / tab * and enter license key you got in the email
155
-
156
- = Using FTP =
157
-
158
- 1. Download `ad-inserter-pro.zip`
159
- 2. Extract `ad-inserter-pro` directory to your computer
160
- 3. Upload `ad-inserter-pro` directory to the `/wp-content/plugins/` directory
161
- 4. Activate Ad Inserter Pro in the Plugin dashboard
162
-
163
-
164
- **Uninstall**
165
-
166
- If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
167
-
168
- 1. Go to Ad Inserter Settings (tab *) and click on Reset All Settings
169
- 2. Deactivate Ad Inserter
170
- 3. Delete Ad Inserter plugin
171
-
172
-
173
- **Quick Start**
174
-
175
- 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>:
176
-
177
- * 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
178
- * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
179
- * **Enable insertion on at least one Wordpress page type** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
180
- * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
181
- * 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)
182
-
183
- 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**.
184
-
185
- **Settings**
186
-
187
- 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.
188
- 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.
189
- When you are finished with settings you need to save them by clicking on the button **Save Settings**.
190
-
191
- Each code block has 4 insertion options:
192
-
193
- * Automatic Insertion
194
- * Widget
195
- * Shortcode
196
- * PHP function call
197
-
198
- Normally for each code block you use only one insertion option.
199
- 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).
200
-
201
- To insert code block and display ad at some position **you need to enable and use at least one insertion option**.
202
-
203
- Automatic Insertion Options:
204
-
205
- * Insert Before Post (before post or posts on blog pages, previously named Before Title)
206
- * Insert Before Content (before post or static page text)
207
- * Insert Before Paragraph (on posts, static pages and blog pages)
208
- * Insert After Paragraph (on posts, static pages and blog pages)
209
- * Insert After Content (after post or static page text)
210
- * Insert After Post (after post or posts on blog pages)
211
- * Insert Before Excerpt (on blog pages)
212
- * Insert After Excerpt (on blog pages)
213
- * Insert Between Posts (on blog pages)
214
-
215
- 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.
216
-
217
- 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.
218
-
219
- 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).
220
-
221
- Block Alignment and Style:
222
-
223
- * No Wrapping (leaves ad code as it is, otherwise it is wrapped by a div)
224
- * Custom CSS (You can enter custom CSS code for wrapping div)
225
- * Default (simple div with thin margin)
226
- * Align Left
227
- * Align Right
228
- * Center
229
- * Float Left (ad on left with wrapped text on right)
230
- * Float Right (ad on right with wrapped text on left)
231
-
232
- **[ Preview ]**
233
-
234
- 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.
235
- 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.
236
- 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.
237
-
238
- 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
239
- 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.
240
- 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.
241
-
242
- **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).
243
- 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.
244
-
245
- **Please note** that Preview window uses also Header and Footer code.
246
-
247
- Check <a href="https://wordpress.org/plugins/ad-inserter/screenshots/">screenshots</a> for explanation on alignment.
248
-
249
- **CACHING**
250
-
251
- 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.
252
- 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.
253
-
254
- Caching on the frontend side (what visitors see) in some cases does speed up page loading but may also cause some unwanted behavior.
255
- 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.
256
- 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:
257
-
258
- * Server-side block rotation with |rotate|
259
- * User check
260
- * Server-side device detection
261
- * Referer check
262
- * Server-side GEO targeting (country detection, Pro only)
263
- * Server-side IP address detection (Pro only)
264
- * Debugging functions
265
-
266
- When you need the functions listed above you have to switch off caching (if possible only on selected pages where needed).
267
-
268
- However, Ad Inserter also supports some of the functions above even when caching is enabled:
269
-
270
- * Client-side ad rotation with |rotate|
271
- * Client-side device detection
272
- * Client-side GEO targeting (country detection, Pro only)
273
- * Client-side IP address detection (Pro only)
274
-
275
- 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.
276
-
277
- 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.
278
-
279
- **W3 Total Cache**
280
-
281
- 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.
282
- 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.
283
-
284
- 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.
285
-
286
- Configure W3 Total Cache
287
-
288
- 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.
289
-
290
- * In General Settings set the Page Caching to Disk: Basic.
291
- * In Page Cache under Advanced enable Late Initialization.
292
- * If you use the Minify option add mfunc to the ignored comment stem field.
293
-
294
- You need to flush the cache after making these changes.
295
-
296
- Please note also the following:
297
-
298
- * 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.
299
- * 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.
300
- * Do not use debugging functions when caching is activated.
301
- * When you make changes in settings of the W3 Total Cache purge all caches before you check page.
302
- * After you activate W3 Total Cache plugin go to General Settings and Save all settings.
303
-
304
- **Ad rotation**
305
-
306
- 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.
307
-
308
- 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:
309
-
310
- `<img style='height: 400px;' src="http://malsup.github.io/images/p1.jpg">
311
- |rotate|
312
- <img style='height: 400px;' src="http://malsup.github.io/images/p2.jpg">
313
- |rotate|
314
- <img style='height: 400px;' src="http://malsup.github.io/images/p3.jpg">`
315
-
316
- Please note the following:
317
-
318
- * 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.
319
- * 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>`
320
- * 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.
321
- * Client-side rotation uses div elements to wrap the code(s). This is not important unless you use No wrapping style.
322
-
323
- 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.
324
- Some caching plugins like WP Super Cache and W3 Total Cache have an option to disable caching for known (logged in) users.
325
-
326
- **DEBUGGING**
327
-
328
- Ad Inserter has many debugging functions that can help you to diagnose the problem when you don't see your ads at expected positions.
329
-
330
- * 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.
331
- * 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.
332
- * 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
333
-
334
- 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:
335
-
336
- * 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.
337
- * 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.
338
- * 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.
339
- * 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.
340
- * 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
341
-
342
- **WARNING:** Make sure **caching is disabled while debugging**! All debugging functions you enable will be visible only to you!
343
-
344
- 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`)
345
-
346
- 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.
347
- **Remote debugging** enables other, non-logged in users by using url parameters to see Debugger widget and code insertion debugging (blocks, positions, tags, processing).
348
- 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.
349
-
350
- **Please support plugin development**
351
-
352
- 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>.
353
-
354
- 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.
355
-
356
- Support the advancement of this plugin:
357
-
358
- * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
359
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
360
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
361
-
362
-
363
- == Frequently Asked Questions ==
364
-
365
- = I have activated Ad Inserter. How can I use it? =
366
-
367
- 1. After activation, click "Settings / Ad Inserter" to access the settings page
368
- 2. Put ad (or any other HTML/Javascript/PHP) code into the ad box
369
- 3. Set automatic insertion option (for example: Before Post)
370
- 4. Enable at least one page type (for example: Posts, some insertion options don't work on all page types)
371
- 5. Save settings
372
- 6. Check inserted code on the posts
373
- 7. Check also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
374
-
375
-
376
- = I have installed code for AdSense ads but the ad blocks are blank. =
377
-
378
- 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.
379
- You can also try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> as good AdSense alternative for contextual ads.
380
-
381
-
382
- = Settings for widget =
383
-
384
- * Nothing needed, just enter the code and save settings - widget is enabled by default
385
- * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
386
- * 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
387
- * 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
388
- * In general plugin settings (tab *) you can also define Sticky Widget Top Margin to precisely define top position where first sticky widget will stop
389
-
390
- Additional note regarding *sticky widgets*:
391
-
392
- Sticky widgets work by changing sidebar CSS to `position: sticky;`. This works in most themes but not all.
393
-
394
- If your widgets and sidebar aren't sticking as expected the first thing to check are the rules applied to the sidebar parent containers.
395
- 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.
396
-
397
- If your theme is not using overflow and still having problems it's worth checking if a height is set on the parent.
398
- This may constrain the sticky positioning, stopping it from occurring. Remove the height and see if that fixes the problem.
399
-
400
- = Settings for contextual Amazon Native Shopping Ads =
401
-
402
- * Automatic Insertion: After Content
403
- * On all Posts checked, other page types unchecked
404
-
405
- Sign in to Amazon Associates, go to Widgets/Widget Source, choose ad type and set parameters.
406
- 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.
407
-
408
- `<script type="text/javascript">
409
- amzn_assoc_placement = "adunit0";
410
- amzn_assoc_search_bar = "true";
411
- amzn_assoc_tracking_id = "ad-inserter-20";
412
- amzn_assoc_search_bar_position = "top";
413
- amzn_assoc_ad_mode = "search";
414
- amzn_assoc_ad_type = "smart";
415
- amzn_assoc_marketplace = "amazon";
416
- amzn_assoc_region = "US";
417
- amzn_assoc_title = "Search Results from Amazon";
418
- amzn_assoc_default_search_phrase = "{smart_tag}";
419
- amzn_assoc_default_category = "All";
420
- amzn_assoc_linkid = "cf1873f027a57f63cede634cfd444bea";
421
- </script>
422
- <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>`
423
-
424
- 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.
425
- 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>.
426
-
427
-
428
- = Settings for ... =
429
-
430
- Check <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
431
-
432
-
433
- = I wish to show ads side by side but not in the same block. How do I do this? =
434
-
435
- Configure block 1 and 2 with ads using:
436
-
437
- * Automatic Insertion: Disabled
438
- * Block Alignment and Style: No Wrapping
439
- * Enable shortcode: checked
440
-
441
- Configure block 3 with
442
-
443
- `[adinserter block="1"]
444
- [adinserter block="2"]`
445
-
446
- Use block 3 to insert ads and make sure all 3 blocks are enabled for the same page types (Posts, Pages, Homepage, etc.).
447
-
448
-
449
- = 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?
450
-
451
- This happens because Ad Inserter processes posts last and therefore "sees" also content added by other plugins.
452
-
453
- Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab *).
454
-
455
-
456
- = How can I replace deprecated tags {adinserter n} for manual insertion with new ones [adinserter block="n"] in all posts? =
457
-
458
- 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**.
459
-
460
-
461
- = How can I add some text or title (e.g. Advertisement) above the ad? =
462
-
463
- 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:
464
-
465
- `<h3>Advertisement</h3>
466
-
467
- AD_CODE`
468
-
469
- Change title tag according to the theme style.
470
-
471
-
472
- = I like the plugin. How can I support it? =
473
-
474
- * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
475
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
476
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
477
-
478
-
479
- = How can I enable/disable ads on specific posts/pages? =
480
-
481
- There are two possible approaches.
482
-
483
- * Approach with page/post exceptions - use this one if there are many exceptions:
484
-
485
- 1. Go to Ad Inserter settings page and define default insertion options for post/page.
486
- 2. Enable automatic insertion on posts/pages and choose default display: **On all**, **On all except selected** or **Only on selected**.
487
- 3. Go to post/page editor and open **Ad Inserter Exceptions** meta box below.
488
- 4. Check default insertion options for wanted code blocks.
489
- 5. Set exceptions for this post or page.
490
-
491
- * Approach with code block settings only - use this one if there are only few exceptions:
492
-
493
- 1. Go to Ad Inserter settings page and define default insertion options for post/page.
494
- 2. Enable automatic insertion On all Posts/Pages.
495
- 3. Click on Lists, enter url (or space separated urls) for Urls, e.g. `/permalink-url`, and white-list or black-list it.
496
-
497
- For details check <a href="https://adinserter.pro/exceptions" target="_blank">Ad Inserter Post/Page Exceptions</a>.
498
-
499
-
500
- = I'm using responsive theme. How can I show or hide some ads on mobile devices? =
501
-
502
- Select device types (desktop, tablet or phone) for which you need to show ads and enable **only client-side** device detection.
503
-
504
-
505
- = Which device type detection should I use? =
506
-
507
- 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.
508
-
509
-
510
- = How can I disable ads for direct visitors? =
511
-
512
- Blacklist `#` as referer for visitors that enter web address directly into browser (no referer).
513
- Blacklist `yourdomain.com` as referer for visitors that browse your website yourdomain.com.
514
- To blacklist both enter `yourdomain.com, #`
515
-
516
-
517
- = How can I disable ads on error 404 page? =
518
-
519
- This is disabled by default. Uncheck Error 404 Page checkbox.
520
-
521
-
522
- = Is there a way to display country flag of the visitor? =
523
-
524
- Possible if you are using Ad Inserter Pro. In the header put the following code:
525
-
526
- `<link rel='stylesheet' href='/wp-content/plugins/ad-inserter/css/flags.css' type='text/css' media='all' />`
527
-
528
- In the code block use the following code for flag
529
-
530
- `<span class="flag-icon flag-icon-{country_iso2}" style="width: 400px; height: 300px;"></span>`
531
-
532
- 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.
533
- Of course, you can also use static code for flags. For example, for United States:
534
-
535
- `<span class="flag-icon flag-icon-us" style="width: 400px; height: 300px;"></span>`
536
-
537
-
538
- = How can I enable or disable ads on group of similar pages? =
539
-
540
- If those pages have something in common in the url (page address) then you can block them with url patterns.
541
- Use `*` to define url pattern to whitelist (enable) or blacklist (disable).
542
-
543
- 1. To filter all urls starting with **/url-start** use `/url-start*`
544
- 2. To filter all urls that contain **url-pattern** use `*url-pattern*`
545
- 3. To filter all urls ending with **url-end** use `*url-end`
546
-
547
- For example, to exclude ads on pages that have /shop/ in url (page address) blacklist the following url: `*/shop/*`
548
-
549
- **WARNING:** Separate urls with SPACES.
550
-
551
-
552
- = How can I put an ad in the middle of the post regardless of the number of paragraphs? =
553
-
554
- 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)
555
-
556
-
557
- = How can I put an ad before the second paragraph and one in the middle of post with single ad block? =
558
-
559
- 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).
560
-
561
-
562
- = 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? =
563
-
564
- Yes, simply create block with 4 ads separated with |rotate|: 3 times ad1 and 1 time ad2.
565
-
566
-
567
- = How can I show different ads to different visitors according to a url query parameter? =
568
-
569
- 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.
570
- 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.
571
- Separate parameters with comma.
572
-
573
-
574
- = How can I use PHP code for code block? =
575
-
576
- Enter PHP code surrounded by PHP tags and check Process PHP.
577
- Example:
578
-
579
- `<div style="width: 100%;">
580
- Some HTML/Javascript code
581
- </div>
582
- <?php echo "PHP code by Ad Inserter"; ?>`
583
-
584
-
585
- = How can I insert post category name into my ad code? =
586
-
587
- 1. Use {category} in the ad. This will be replaced with the post category name.
588
- 2. You can also use
589
-
590
- * {title} - Title of the post
591
- * {short_title} - Short title (first 3 words) of the post title
592
- * {category} - Category of the post (or short title if there is no category)
593
- * {short_category} - First words before "," or "and" of the category of the post (or short title if there is no category)
594
- * {tag} - The first tag or general tag if the post has no tags (**works only inside posts**)
595
- * {smart_tag} - Smart selection of post tag in the following order:
596
- * If there is no tag then the category is used;
597
- * If there is a two-word tag then it is used;
598
- * If the first tag is a substring of the second (or vice versa) then the first tag is not taken into account
599
- * If the first and second tags are single words then both words are used
600
- * First three words of the first tag
601
- * General tag
602
- * {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.
603
- * {author} - Post author username (**works only inside posts**)
604
- * {author_name} Post author name (**works only inside posts**)
605
-
606
- For all options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
607
-
608
-
609
- = How can I rotate few versions of the same ad? =
610
-
611
- Enter them into the ad box and separate them with |rotate| (vertical bars around text rotate). Ad Inserter will insert them randomly.
612
- Example:
613
-
614
- `ad_code_1
615
- |rotate|
616
- ad_code_2
617
- |rotate|
618
- ad_code_3`
619
-
620
-
621
- = What settings should I use for ads on AMP pages? =
622
-
623
- Asumming AMP urls end with `/amp/` use the following settings:
624
-
625
- * Automatic Insertion: set as needed
626
- * Select **No wrapping** style
627
- * Whitelist url `*/amp/`
628
- * Put AMP head script in the Header code block (tab *)
629
- * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
630
-
631
- For details check <a href="https://adinserter.pro/settings#amp" target="_blank">settings for ads on AMP pages</a>.
632
-
633
-
634
- = How can place ads below Read More tag? =
635
-
636
- Configure ad block with the following options:
637
-
638
- * Automatic Insertion: After Paragraph
639
- * Paragraph Number: 1
640
- * Count only paragraphs that CONTAIN: `<span id="more-`
641
-
642
- Check source code of your website for proper "read more" tag.
643
-
644
-
645
- = How can I insert code block directly into template php file? =
646
-
647
- Enable PHP function adinserter for code block and call adinserter function with code block number as parameter.
648
- Example for block 3:
649
-
650
- `<?php if (function_exists ('adinserter')) echo adinserter (3); ?>`
651
-
652
- This would generate code as defined for the code block number 3.
653
-
654
-
655
- = Center alignment does not work for some ads! =
656
-
657
- Some iframe ads can not be centered using standard approach so some additional code is needed to put them in the middle.
658
- Simply wrap ad code in a div with some style e.g. left padding. Example:
659
-
660
- `<div style="padding-left: 200px;">
661
- ad_code
662
- </div>`
663
-
664
-
665
- = How can I rotate between different alignments so I can test an ad aligned to the right against an ad aligned to the left? =
666
-
667
- Set Block Alignment and Style to "No Wrapping" and create manual wrapping around both ads separated with |rotate|:
668
-
669
- `<div style="float: left; margin: 0 8px 8px 0;">
670
- AD CODE LEFT
671
- </div>
672
-
673
- |rotate|
674
-
675
- <div style="float: right; margin: 0 0 8px 8px;">
676
- AD CODE RIGHT
677
- </div>`
678
-
679
-
680
- == Screenshots ==
681
-
682
- 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>)
683
- 2. Code preview with visual CSS editor
684
- 3. Code preview with visual CSS editor - highlighted code
685
- 4. Post / Page Ad Inserter Exceptions
686
- 5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
687
- 6. Ad Inserter settings
688
- 7. Visualization of HTML tags in post
689
- 8. Visualization of positions for automatic insertion in post
690
- 9. Visualization of inserted block in post
691
- 10. Alignment **Left**, **Default** - Default means default (usually left) aligned ad block with thin margin around
692
- 11. Alignment **Right** - Right aligned ad block with thin margin around
693
- 12. Alignment **Center** - Center aligned ad block with thin margin around
694
- 13. Alignment **No Wrapping** - Default (usually left) aligned ad block **with no margin around**
695
- 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.)
696
- 15. Alignment **Float Left** - Left aligned ad block with thin margin around wrapped with text on the right
697
- 16. Alignment **Float Right** - Right aligned ad block with thin margin around wrapped with text on the left
698
- 17. Complete settings for one code block (Before Paragraph)
699
-
700
-
701
- == Changelog ==
702
-
703
- = 2.1.10 =
704
- - Fix for shifted sidebars in some themes
705
-
706
- = 2.1.9 =
707
- - Added support for sticky widgets
708
- - Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img)
709
- - Impression and click tracking (beta, Pro only)
710
- - Few minor bug fixes, cosmetic changes and code improvements
711
-
712
- = 2.1.8 =
713
- - Fixed error when using server-side device detection
714
-
715
- = 2.1.7 =
716
- - Fixed error when using PHP 5.4 or earlier
717
-
718
- = 2.1.6 =
719
- - Added support for insertion before/after multiple paragraphs
720
- - Added initial support for impression and click tracking (Pro only)
721
- - Few bug fixes and cosmetic changes
722
-
723
- = 2.1.5 =
724
- - Added support to avoid insertion inside `<figure>` and `<li>` elements (image captions, lists)
725
- - Added support for exceptions for custom post types
726
- - Few minor bug fixes and code improvements
727
-
728
- = 2.1.4 =
729
- - Paragraph counting restored to standard functions
730
- - Added option to select paragraph counting functions with multibyte support (unicode characters)
731
- - Fixed bug for wrong paragraph counting in posts with blockquote sections in some cases
732
- - Fixed bug for wrong measuring of plugin processing time in some cases
733
- - Fixed bug for "Empty delimiter" warning
734
-
735
- = 2.1.3 =
736
- - Added support for counting paragraphs with multibyte (unicode) characters
737
- - Fixed bug for class name not saved
738
- - Few minor bug fixes and cosmetic changes
739
-
740
- = 2.1.2 =
741
- - Fixed bug for disabled settings page on multisite blogs
742
-
743
- = 2.1.1 =
744
- - Changes for compatibility with PHP 7.1
745
- - Automatic rename of old pro plugin slug (Pro only)
746
- - Added support for additional Pro features (Pro only)
747
- - Few bug fixes and cosmetic changes
748
-
749
- = 2.1.0 =
750
- - Added support to insert ads in Ajax requests (e.g. in infinite scroll)
751
- - Added support to not include block classes when class name is empty
752
- - Added sticky positions (Pro only)
753
- - Bug fix for minimum user role not taken into account for exceptions list
754
- - Bug fix for IP database update cron event (Pro only)
755
-
756
- = 2.0.14 =
757
- - Fixed issue for responsive ads not displayed when using Left, Center or Right alignment
758
-
759
- = 2.0.13 =
760
- - Added icons for Automatic insertion and alignment
761
- - Automatic insertion None changed to Disabled
762
- - Alignment None changed to Default
763
- - Changed database option data for Automatic insertion and Alignment settings
764
- - Improved CSS 3 code for Left, Center and Right alignment
765
- - Click on CSS code starts editing
766
- - Page/Post exceptions listed in debug output
767
- - Different plugin slug for Pro version
768
- - Few minor bug fixes and cosmetic changes
769
-
770
- = 2.0.12 =
771
- - Bug fix for page/post exceptions list
772
-
773
- = 2.0.11 =
774
- - Bug fix for settings page not loading
775
-
776
- = 2.0.10 =
777
- - Added option to insert ads between posts on blog pages
778
- - Added option to check and manage post/page exceptions for each block
779
- - Added option to check and manage all post/page exceptions (Pro only)
780
- - Added option for multisite installations to disable PHP processing on sub-sites (Pro only)
781
- - Added license status notifications (Pro only)
782
-
783
- = 2.0.9 =
784
- - Added support for uppercase {country_ISO2} and lowercase {country_iso2} tag (Pro only)
785
- - Removed inclusion of dummy css and js file
786
- - Bug fix: Client-side dynamic blocks were not enabled if not using W3 Total Cache
787
-
788
- = 2.0.8 =
789
- - Added support for client-side rotation (works with caching)
790
- - Added support for server-side rotation with W3 Total Cache
791
- - Added support for client-side country detection (works with caching, Pro only)
792
- - Added support for server-side country detection with W3 Total Cache (Pro only)
793
- - Added debugging functions to measure plugin processing time
794
- - Added option to black/white-list IP addresses (Pro only)
795
- - Added option for fallback code when scheduling between dates expires (Pro only)
796
- - On multisite installations Ad Inserter debug menu item on sites is available only if settings page is enabled
797
- - Added option for multisite installations to use Ad Inserter settings of main site for all blogs
798
- - Added flags to country list (Pro only)
799
- - Bug fix: Code preview did not work if Wordpress was installed in a folder
800
- - Few minor bug fixes and cosmetic changes
801
-
802
- = 2.0.7 =
803
- - Delayed display moved to Misc group
804
- - Added option for scheduling to insert code only between specified dates (Pro only)
805
- - Added option for Geo targeting (Pro only)
806
- - Few minor bug fixes and cosmetic changes
807
-
808
- = 2.0.6 =
809
- - Added support to filter subpages created by the `<!--nextpage-->` tag
810
- - Added option to import block name (Pro only)
811
- - Cookie deleted only when it exists and debugging is disabled
812
- - Few minor bug fixes
813
-
814
- = 2.0.5 =
815
- - Cookie created only when debugging is enabled
816
- - Few minor bug fixes
817
-
818
- = 2.0.4 =
819
- - Bug fix: Cursor position always at the end of block name
820
- - State of debugging functions saved to cookie
821
- - Few minor bug fixes
822
-
823
- = 2.0.3 =
824
- - Debugging functions in admin toolbar available only for administrators
825
- - Added option to hide debugging functions in admin toolbar
826
- - Added shortcode for debugger
827
- - Few minor bug fixes
828
-
829
- = 2.0.2 =
830
- - Changed javascript version check to get plugin version from the HTML page
831
- - Added warning if old cached version of CSS file is loaded on the settings page
832
- - Added warning if version query parameter for js/css files is removed due to inappropriate caching
833
-
834
- = 2.0.1 =
835
- - Bug fix: Shortcodes called by name were not displayed
836
-
837
- = 2.0.0 =
838
- - Redesigned user interface
839
- - Added many debugging tools for easier troubleshooting
840
- - New feature: Code preview tool with visual CSS editor
841
- - New feature: Label inserted blocks
842
- - New feature: Show available positions for automatic insertion
843
- - New feature: Show HTML tags in posts/static pages
844
- - New feature: Log Ad Inserter processing
845
- - Improved loading speed of the settings page
846
- - Improved block insertion processing speed
847
- - Added support to avoid inserion near images, headers and other elements
848
- - Added option to avoid insertion in feeds
849
- - Added option to display code blocks only to administrators
850
- - Added option for publishig date check for display positions Before/After Content
851
- - Added option for server-side device check for header and footer code
852
- - Added option for maximum page/post words
853
- - Added option for maximum paragraph words
854
- - Added option to black/white-list post IDs
855
- - Added option to black/white-list url query parameters
856
- - Added warning if the settings page is blocked by ad blocker
857
- - Added warning if old cached version of javascript is loaded on the settings page
858
- - Added support for multisite installations to disable settings, widgets and exceptions on network sites (Pro only)
859
- - Block names can be edited by clicking on the name
860
- - Filters now work also on posts and single pages
861
- - CSS code for client-side detection moved to inline CSS
862
- - Bug fix: Minimum user roles for exception editing was not calculated properly
863
- - Bug fix: Server-side detection checkbox was not saved properly
864
- - Many other minor bug fixes, code improvements and cosmetic changes
865
-
866
- = 1.7.0 =
867
- - Bug fix: Shortcodes did not ignore post/static page exceptions
868
- - Slightly redesigned user interface
869
- - Excerpt/Post number(s) renamed to Filter as it now works on all display positions
870
- - Widget setting removed from Automatic display to Manual display section
871
- - Added support to disable widgets (standalone checkbox in Manual display)
872
- - Added call counter/filter for widgets
873
- - Added support to edit CSS for predefined styles
874
- - Few other minor bug fixes, code improvements and cosmetic changes
875
-
876
- = 1.6.7 =
877
- - Bug fix: Block code textarea was not escaped
878
- - Added checks for page types for shortcodes
879
- - Added support for Before/After Post position call counter/filter
880
- - Few minor cosmetic changes
881
-
882
- = 1.6.6 =
883
- - 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)
884
- - Few minor cosmetic changes
885
- - Requirements changed to WordPress 4.0 or newer
886
- - Added initial support for Pro version
887
-
888
- = 1.6.5 =
889
- - Fixed bug: Wrong counting of max insertions
890
- - Change: display position Before Title was renamed to Before Post
891
- - Added support for display position After Post
892
- - Added support for posts with no `<p>` tags (paragraphs separated with \r\n\r\n characters)
893
- - Added support for paragraph processing on homepage, category, archive and search pages
894
- - Added support for custom viewports
895
- - Added support for PHP function call counter
896
- - Added support to disable code block on error 404 pages
897
- - Added support to debug paragraph tags
898
-
899
- = 1.6.4 =
900
- - Fixed bug: For shortcodes in posts the url was not checked
901
- - Optimizations for device detection
902
-
903
- = 1.6.3 =
904
- - Removed deprecated code (fixes PHP 7 deprecated warnings)
905
- - Added support for paragraphs with div and other HTML tags (h1, h2, h3,...)
906
-
907
- = 1.6.2 =
908
- - Removed deprecated code (fixes PHP Fatal error Call to a member function get_display_type)
909
- - Added support to change plugin processing priority
910
-
911
- = 1.6.1 =
912
- * Fixed bug: For shortcodes in posts the date was not checked
913
- * Fixed error with some templates "Call to undefined method is_main_query()"
914
- * Added support for minumum number of page/post words for Before/After content display option
915
- * Added support for {author} and {author_name} tags
916
-
917
- = 1.6.0 =
918
- * Added support for client-side device detection
919
- * Many code improvements
920
- * Improved plugin processing speed
921
- * Removed support for deprecated tags for manual insertion {adinserter n}
922
- * Few minor bug fixes
923
-
924
-
925
- == Upgrade Notice ==
926
-
927
- = 2.1.10 =
928
- Fix for shifted sidebars in some themes
929
-
930
- = 2.1.9 =
931
- Added support for sticky widgets;
932
- Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img);
933
- Impression and click tracking (beta, Pro only);
934
- Few minor bug fixes, cosmetic changes and code improvements
935
-
936
- = 2.1.8 =
937
- Fixed error when using server-side device detection
938
-
939
- = 2.1.7 =
940
- Fixed error when using PHP 5.4 or earlier
941
-
942
- = 2.1.6 =
943
- Added support for insertion before/after multiple paragraphs;
944
- Few bug fixes and cosmetic changes
945
-
946
- = 2.1.5 =
947
- Added support to avoid insertion inside `<figure>` and `<li>` elements;
948
- Added support for exceptions for custom post types;
949
- Few minor bug fixes and code improvements
950
-
951
- = 2.1.4 =
952
- Paragraph counting restored to standard functions;
953
- Added option to select paragraph counting functions with multibyte support (unicode characters);
954
- Few bugs fixed including for "Empty delimiter" warning
955
-
956
- = 2.1.3 =
957
- Added support for counting paragraphs with multibyte (unicode) characters;
958
- Fixed bug for class name not saved;
959
- Few minor bug fixes and cosmetic changes
960
-
961
- = 2.1.2 =
962
- Fixed bug for disabled settings page on multisite blogs
963
-
964
- = 2.1.1 =
965
- Changes for compatibility with PHP 7.1;
966
- Few bug fixes and cosmetic changes
967
-
968
- = 2.1.0 =
969
- Support for ads in Ajax requests (e.g. in infinite scroll); Added sticky positions (Pro only);
970
- Bug fix for minimum user role for exceptions list; Bug fix for IP database update cron event (Pro only)
971
-
972
- = 2.0.14 =
973
- Fixed issue for responsive ads not displayed when using Left, Center or Right alignment
974
-
975
- = 2.0.13 =
976
- Added icons for Automatic insertion and alignment; Changed database option data for Automatic insertion and Alignment settings;
977
- Improved CSS 3 code for Left, Center and Right alignment; Few minor bug fixes and cosmetic changes;
978
-
979
- = 2.0.12 =
980
- Bug fix for page/post exceptions list
981
-
982
- = 2.0.11 =
983
- Bug fix for settings page not loading
984
-
985
- = 2.0.10 =
986
- Option to insert ads between posts on blog pages;
987
- Option to check and manage post/page exceptions for each block;
988
-
989
- = 2.0.9 =
990
- Bug fix: Client-side dynamic blocks were not enabled if not using W3 Total Cache;
991
- Added support for uppercase and lowercase {country_iso2} tag (Pro only); Removed inclusion of dummy css and js file
992
-
993
- = 2.0.8 =
994
- Added support for client-side rotation (works with caching), added support for W3 Total Cache, client-side country detection (works with caching, Pro only),
995
- bug fixed: Code preview did not work if Wordpress was installed in a folder, added flags to country list (Pro only)
996
-
997
- = 2.0.7 =
998
- Delayed display moved to Misc group, added option for scheduling to insert code only between specified dates (Pro only),
999
- added option for Geo targeting (Pro only), few minor bug fixes and cosmetic changes
1000
-
1001
- = 2.0.6 =
1002
- Added support to filter subpages created by the `<!--nextpage-->` tag, added option to import block name (Pro only),
1003
- cookie deleted only when it exists and debugging is disabled, few minor bug fixes
1004
-
1005
- = 2.0.5 =
1006
- cookie created only when debugging is enabled, few minor bug fixes
1007
-
1008
- = 2.0.4 =
1009
- Bug fix: Cursor position always at the end of block name, state of debugging functions saved to cookie, few minor bug fixes
1010
-
1011
- = 2.0.3 =
1012
- Debugging functions in admin toolbar available only for administrators, added option to hide debugging functions in admin toolbar,
1013
- Added shortcode for debugger, few minor bug fixes
1014
-
1015
- = 2.0.2 =
1016
- 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,
1017
- added warning if version query parameter for js/css files is removed due to inappropriate caching,
1018
-
1019
- = 2.0.1 =
1020
- Bug fix: Shortcodes called by name were not displayed
1021
-
1022
- = 2.0.0 =
1023
- Redesigned user interface, added code preview and many debugging tools for easier troubleshooting and many new features
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,54 +1,65 @@
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, advertising, widgets, contextual ads, ad rotation, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, widgets, PHP, Javascript, HTML, header, footer, tracking, sticky
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
- Stable tag: 2.1.10
8
  License: GPLv3
9
 
10
- Ad management plugin: AdSense, contextual Amazon ads, banner rotation, sticky widgets, shortcodes, AMP, PHP, HTML, CSS, tracking, header, footer code
11
 
12
  == Description ==
13
 
14
- Ad management plugin with many advertising features to automatically insert adverts. **Perfect for all kinds of ads including AdSense.** Great also for contextual Amazon 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 (ad) 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
- > * Insertion of Google Analytics, Piwik or any other web analytics code
 
31
  > * Manual insertion: widgets, shortcodes, PHP function call
32
- > * Sticky (fixed) widgets (the sidebar does not move when the page is scrolled)
33
  > * Custom block alignment and style
34
- > * Insertion of ads on AMP pages
35
  > * Custom CSS class name for wrapping divs to avoid ad blockers
36
- > * Insertion of shortcodes from other plugins
37
  > * PHP code processing
38
  > * Ad rotation (server-side and client-side - works with caching)
39
  > * Desktop/mobile device detection (server-side and client-side - works with caching)
40
- > * Black/White-list categories, tags, post IDs, urls, url parameters, referers
41
  > * Simple troubleshooting with many debugging functions
42
  > * Function to visualize inserted code blocks
43
  > * Function to visualize available insertion positions
44
  > * Function to visualize HTML tags
45
 
46
- And <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> has even more features:
47
 
48
  > * 64 code (ad) blocks
49
  > * GEO targeting (works also with caching)
50
  > * Black/White-list IP addresses or countries (works also with caching)
51
- > * Ad impression and click tracking
52
  > * A/B testing
53
  > * Sticky ad positions (left, top, right, bottom)
54
  > * Scheduling with fallback option
@@ -58,31 +69,39 @@ And <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> has eve
58
  > * Export and import of settings
59
  > * Support via email
60
 
61
- Ad Inserter Wordpress plugin has many features and options to automate ad insertion and to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any Javascript, HTML, PHP or advert code anywhere on the page. For best ad placement and to use optimal advertising positions please read the user manual to get the most of the plugin.
62
 
63
  > * 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
64
- > * 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
65
 
66
  **Endorsed by Amazon**
67
 
68
  > 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.
69
  >
70
  > * Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>
71
- > * 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)
72
 
73
- **One Plugin - Many Functions**
74
 
75
- Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
76
 
77
- * to insert and manage ads
 
 
 
 
78
  * to insert different ads for mobile devices
 
79
  * for ad rotation
80
- * for sticky (fixed) widgets
81
  * for PHP code widgets
82
- * to insert some PHP code into posts
83
- * to insert header or footer code
 
 
 
 
84
  * to insert Google analytics code
85
- * to insert various forms
86
 
87
  Maintaining several plugins (often from different vendors) is not easy. And each plugin is slowing down the speed of your website.
88
 
@@ -92,12 +111,12 @@ Maintaining several plugins (often from different vendors) is not easy. And each
92
 
93
  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>:
94
 
95
- * 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
96
  * **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
97
  * **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)
98
  * For Posts and static pages **select default value On all Posts / On all Static pages** unless you really know what are you doing
99
  * 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)
100
- * If you are using AdSense you may get blank (empty) ad blocks. This might be because there is some error in the code (wrong IDs), your AdSense account is not fully approved yet, your website was not accepted or your AdSense account is banned. Try <a href="http://bit.ly/2oF81Oh" target="_blank">Media net ads</a> - good AdSense alternative for contextual ads.
101
 
102
  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.
103
  For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
@@ -112,7 +131,7 @@ Support the advancement of this plugin:
112
 
113
  * Write a nice <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
114
  * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
115
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
116
 
117
  == Installation ==
118
 
@@ -285,7 +304,7 @@ When Dynamic blocks is set to Server-side with W3 Total Cache and you are using
285
 
286
  Configure W3 Total Cache
287
 
288
- 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.
289
 
290
  * In General Settings set the Page Caching to Disk: Basic.
291
  * In Page Cache under Advanced enable Late Initialization.
@@ -369,8 +388,9 @@ Support the advancement of this plugin:
369
  3. Set automatic insertion option (for example: Before Post)
370
  4. Enable at least one page type (for example: Posts, some insertion options don't work on all page types)
371
  5. Save settings
372
- 6. Check inserted code on the posts
373
- 7. Check also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
 
374
 
375
 
376
  = I have installed code for AdSense ads but the ad blocks are blank. =
@@ -625,9 +645,11 @@ Asumming AMP urls end with `/amp/` use the following settings:
625
  * Automatic Insertion: set as needed
626
  * Select **No wrapping** style
627
  * Whitelist url `*/amp/`
628
- * Put AMP head script in the Header code block (tab *)
629
  * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
630
 
 
 
631
  For details check <a href="https://adinserter.pro/settings#amp" target="_blank">settings for ads on AMP pages</a>.
632
 
633
 
@@ -654,12 +676,10 @@ This would generate code as defined for the code block number 3.
654
 
655
  = Center alignment does not work for some ads! =
656
 
657
- Some iframe ads can not be centered using standard approach so some additional code is needed to put them in the middle.
658
- Simply wrap ad code in a div with some style e.g. left padding. Example:
659
 
660
- `<div style="padding-left: 200px;">
661
- ad_code
662
- </div>`
663
 
664
 
665
  = How can I rotate between different alignments so I can test an ad aligned to the right against an ad aligned to the left? =
@@ -700,6 +720,27 @@ AD CODE RIGHT
700
 
701
  == Changelog ==
702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
  = 2.1.10 =
704
  - Fix for shifted sidebars in some themes
705
 
@@ -924,6 +965,23 @@ AD CODE RIGHT
924
 
925
  == Upgrade Notice ==
926
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
927
  = 2.1.10 =
928
  Fix for shifted sidebars in some themes
929
 
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
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
 
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>.
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
 
304
 
305
  Configure W3 Total Cache
306
 
307
+ How to fully set up W3 Total Cache is beyond the scope of this page. Check the W3 Total Cache manuals or contact its developer for help with that if you need it.
308
 
309
  * In General Settings set the Page Caching to Disk: Basic.
310
  * In Page Cache under Advanced enable Late Initialization.
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 also <a href="http://adinserter.pro/settings" target="_blank">common settings</a>
392
+ 7. Check inserted code on the posts
393
+ 8. Ads are not showing? Check <a href="https://adinserter.pro/documentation#ads-not-displayed" target="_blank">troubleshooting guide</a> to find out how to fix the problem.
394
 
395
 
396
  = I have installed code for AdSense ads but the ad blocks are blank. =
645
  * Automatic Insertion: set as needed
646
  * Select **No wrapping** style
647
  * Whitelist url `*/amp/`
648
+ * Put AMP head script in the Header code block (tab * / tab Header) and enable it
649
  * For all other ads on standard (non AMP) pages blacklist url `*/amp/`
650
 
651
+ If you have different url structure you'll have to adjust url pattern accordingly.
652
+
653
  For details check <a href="https://adinserter.pro/settings#amp" target="_blank">settings for ads on AMP pages</a>.
654
 
655
 
676
 
677
  = Center alignment does not work for some ads! =
678
 
679
+ Some ads can not be centered using standard approach so some different CSS code is needed to put them in the middle.
680
+ Try to use the following custom CSS:
681
 
682
+ `margin: 8px 0; text-align: center; display: flex; justify-content: center;`
 
 
683
 
684
 
685
  = How can I rotate between different alignments so I can test an ad aligned to the right against an ad aligned to the left? =
720
 
721
  == Changelog ==
722
 
723
+ = 2.1.13 =
724
+ - Fix for Fatal error: Can't use method return value in write context
725
+
726
+ = 2.1.12 =
727
+ - Added option to define tags inside which paragraphs are not counted
728
+ - Added max insertions check when inserting for all paragraphs
729
+ - Added support for inverted filter
730
+ - Increased nonce lifespan to 48 hours when using tracking (Pro only)
731
+ - Fixed wrong urls in debug menu when behind proxy
732
+ - Few other bug fixes, cosmetic changes and code improvements
733
+
734
+ = 2.1.11 =
735
+ - Improved support for sticky widgets (works with most themes)
736
+ - Added support for ad counting (|count| separator)
737
+ - Added support to black/white-list arbitrary taxonomies (taxonomy, term or taxonomy:term)
738
+ - Added support for automatic insertion before, between and after comments
739
+ - Added processing of shortcodes in the header and footer code
740
+ - Debugging function Show positions shows also page type
741
+ - Fixed page type detection when Post page was set to static page and it was not homepage
742
+ - Few minor bug fixes, cosmetic changes and code improvements
743
+
744
  = 2.1.10 =
745
  - Fix for shifted sidebars in some themes
746
 
965
 
966
  == Upgrade Notice ==
967
 
968
+ = 2.1.13 =
969
+ Fix for Fatal error: Can't use method return value in write context
970
+
971
+ = 2.1.12 =
972
+ Added option to define tags inside which paragraphs are not counted;
973
+ Added max insertions check when inserting for all paragraphs;
974
+ Added support for inverted filter;
975
+ Few minor bug fixes, cosmetic changes and code improvements
976
+
977
+ = 2.1.11 =
978
+ Improved support for sticky widgets (works with most themes);
979
+ Added support for ad counting (|count| separator);
980
+ Added support to black/white-list arbitrary taxonomies;
981
+ Added support for automatic insertion before, between and after comments;
982
+ Added processing of shortcodes in the header and footer code;
983
+ Fixed page type detection on blog pages in some cases;
984
+
985
  = 2.1.10 =
986
  Fix for shifted sidebars in some themes
987
 
settings.php CHANGED
@@ -20,15 +20,26 @@ function generate_settings_form (){
20
  $end = 16;
21
  if (function_exists ('ai_settings_parameters')) ai_settings_parameters ($subpage, $start, $end);
22
 
 
 
 
 
 
23
  if (isset ($_GET ['tab'])) $active_tab = $_GET ['tab']; else
24
- $active_tab = isset ($_POST ['ai-active-tab']) ? $_POST ['ai-active-tab'] : 1;
25
  if (!is_numeric ($active_tab)) $active_tab = 1;
26
  if ($active_tab != 0)
27
  if ($active_tab < $start || $active_tab > $end) $active_tab = $start;
28
 
 
 
29
  $adH = $block_object [AI_HEADER_OPTION_NAME];
30
  $adF = $block_object [AI_FOOTER_OPTION_NAME];
31
 
 
 
 
 
32
  $syntax_highlighter_theme = get_syntax_highlighter_theme ();
33
  $block_class_name = get_block_class_name ();
34
 
@@ -79,6 +90,13 @@ function generate_settings_form (){
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,19 +108,19 @@ function generate_settings_form (){
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,9 +131,9 @@ function generate_settings_form (){
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,9 +142,9 @@ function generate_settings_form (){
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,16 +153,16 @@ function generate_settings_form (){
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,15 +271,22 @@ function generate_settings_form (){
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,14 +295,15 @@ function generate_settings_form (){
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,7 +311,7 @@ function generate_settings_form (){
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,17 +327,20 @@ function generate_settings_form (){
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,16 +376,16 @@ function generate_settings_form (){
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,19 +396,22 @@ function generate_settings_form (){
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,7 +425,7 @@ function generate_settings_form (){
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,14 +441,14 @@ function generate_settings_form (){
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,23 +468,23 @@ function generate_settings_form (){
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,20 +495,20 @@ function generate_settings_form (){
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,11 +545,12 @@ function generate_settings_form (){
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,11 +566,11 @@ function generate_settings_form (){
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,8 +578,8 @@ function generate_settings_form (){
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,7 +590,6 @@ function generate_settings_form (){
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,7 +598,6 @@ function generate_settings_form (){
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,14 +612,14 @@ function generate_settings_form (){
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,35 +627,52 @@ function generate_settings_form (){
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,7 +684,7 @@ function generate_settings_form (){
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,11 +694,10 @@ function generate_settings_form (){
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,7 +709,7 @@ function generate_settings_form (){
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,16 +719,15 @@ function generate_settings_form (){
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,7 +735,7 @@ function generate_settings_form (){
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,30 +745,30 @@ function generate_settings_form (){
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,30 +777,46 @@ function generate_settings_form (){
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,14 +825,14 @@ function generate_settings_form (){
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,14 +841,14 @@ function generate_settings_form (){
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,14 +857,14 @@ function generate_settings_form (){
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,12 +873,12 @@ function generate_settings_form (){
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,8 +890,8 @@ function generate_settings_form (){
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,8 +903,8 @@ function generate_settings_form (){
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,25 +916,43 @@ function generate_settings_form (){
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,65 +962,58 @@ function generate_settings_form (){
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,8 +1025,8 @@ function generate_settings_form (){
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,12 +1035,12 @@ function generate_settings_form (){
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,7 +1055,7 @@ function generate_settings_form (){
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,17 +1066,17 @@ function generate_settings_form (){
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;">
@@ -1018,6 +1091,10 @@ function generate_settings_form (){
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,20 +1105,23 @@ function generate_settings_form (){
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,29 +1168,29 @@ function generate_settings_form (){
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; ?>" default="<?php echo DEFAULT_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" data="<?php echo get_minimum_user_role (); ?>" default="<?php echo DEFAULT_MINIMUM_USER_ROLE; ?>" 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" default="<?php echo DEFAULT_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,48 +1198,57 @@ function generate_settings_form (){
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" 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.">
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
  Sticky Widget Top Margin
1134
  </td>
1135
  <td>
1136
- <input style="border-radius: 5px;" type="text" name="sticky-widget-margin" value="<?php echo get_sticky_widget_margin (); ?>" default="<?php echo DEFAULT_STICKY_WIDGET_MARGIN; ?>" size="6" maxlength="4" /> px
1137
  </td>
1138
  </tr>
1139
  <tr>
1140
- <td style="padding-left: 10px;">
1141
  Plugin priority
1142
  </td>
1143
  <td>
1144
- <input style="border-radius: 5px;" type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" default="<?php echo DEFAULT_PLUGIN_PRIORITY; ?>" size="6" maxlength="6" />
1145
  </td>
1146
  </tr>
1147
  </table>
1148
  </div>
1149
 
1150
- <div id="tab-viewports" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1151
- <div style="margin: 8px;">
1152
  Viewport Settings used for client-side device detection
1153
  </div>
1154
  <?php
1155
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
 
1156
  ?>
1157
- <div style="margin: 8px;">
1158
  Viewport <?php echo $viewport; ?> name&nbsp;&nbsp;&nbsp;
1159
- <input style="border-radius: 5px; margin-left: 0px;" type="text" id="option-name-<?php echo $viewport; ?>" name="viewport-name-<?php echo $viewport; ?>" value="<?php echo get_viewport_name ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_NAME_" . $viewport) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport) : ""; ?>" size="15" maxlength="40" />
1160
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '<span style="display: none;">' ?>
1161
  &nbsp;&nbsp; min width
1162
- <input style="border-radius: 5px;" type="text" id="option-length-<?php echo $viewport; ?>" name="viewport-width-<?php echo $viewport; ?>" value="<?php echo get_viewport_width ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) : ""; ?>" size="4" maxlength="4" /> px
1163
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '</span>' ?>
1164
  </div>
1165
  <?php
@@ -1201,11 +1290,11 @@ function generate_settings_form (){
1201
  <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>
1202
  </div>
1203
 
1204
- <div id="device-detection-settings-h" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1205
- <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" />
1206
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" id="server-side-detection-h" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1207
  <label for="server-side-detection-h">Use server-side detection to insert code only for </label>
1208
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-devices-h" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1209
  <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>
1210
  <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>
1211
  <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>
@@ -1215,9 +1304,9 @@ function generate_settings_form (){
1215
  </select>
1216
  devices
1217
 
1218
- <span style="float: right; margin-top: 6px;">
1219
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
1220
- <input style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" id="enable-header-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1221
  <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>
1222
  </span>
1223
  </div>
@@ -1257,11 +1346,11 @@ function generate_settings_form (){
1257
  <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>
1258
  </div>
1259
 
1260
- <div id="device-detection-settings-f" style="padding:8px 8px 8px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
1261
- <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" />
1262
- <input style="border-radius: 5px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" id="server-side-detection-f" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1263
  <label for="server-side-detection-f">Use server-side detection to insert code only for </label>
1264
- <select style="border-radius: 5px; margin-bottom: 3px;" id="display-for-devices-f" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1265
  <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>
1266
  <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>
1267
  <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>
@@ -1271,9 +1360,9 @@ function generate_settings_form (){
1271
  </select>
1272
  devices
1273
 
1274
- <span style="float: right; margin-top: 6px;">
1275
- <input style="border-radius: 5px;" type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
1276
- <input style="border-radius: 5px; margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" id="enable-footer-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1277
  <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>
1278
  </span>
1279
  </div>
@@ -1281,23 +1370,176 @@ function generate_settings_form (){
1281
 
1282
  <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
1283
 
1284
- <div id="tab-debugging" style="margin: 8px 0; padding: 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1285
- <div style="margin: 8px;">
1286
- <input style="border-radius: 5px;" type="hidden" name="admin_toolbar_debugging" value="0" />
1287
- <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 '; ?> />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288
  <label for="admin-toolbar-debugging" title="Enable or disable debugging functions in admin toolbar">Debugging functions in admin toolbar</label>
1289
  </div>
1290
 
1291
- <div style="margin: 8px;">
1292
- <input style="border-radius: 5px;" type="hidden" name="remote_debugging" value="0" />
1293
- <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 '; ?> />
1294
  <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>
1295
  </div>
1296
 
1297
  <div id="system-debugging" style="display: none;">
1298
- <div style="margin: 8px;">
1299
- <input style="border-radius: 5px;" type="hidden" name="javascript_debugging" value="0" />
1300
- <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 '; ?> />
1301
  <label for="javascript-debugging" title="Enable Javascript console output">Javascript debugging</label>
1302
  </div>
1303
 
@@ -1312,20 +1554,27 @@ function generate_settings_form (){
1312
 
1313
  <?php if (!function_exists ('ai_settings_side')) { ?>
1314
 
1315
- <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1316
  <div style="float: left;">
1317
- <h2 style="display: inline-block; margin: 13px 0;">Looking for AdSense alternative?</h2>
1318
  </div>
1319
  <div style="clear: both;"></div>
1320
  </div>
1321
 
1322
- <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;">
1323
- <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>
1324
  </div>
1325
 
 
 
 
 
 
 
 
1326
  <?php } ?>
1327
 
1328
- <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="<?php echo $active_tab; ?>" />
1329
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
1330
 
1331
  </form>
@@ -1337,62 +1586,89 @@ function generate_settings_form (){
1337
  <?php
1338
  if ($subpage == 'main') {
1339
  if (function_exists ('ai_settings_side')) ai_settings_side (); else { ?>
1340
- <div style="float: left;">
1341
- <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1342
  <div style="float: left;">
1343
- <h2 style="display: inline-block; margin: 13px 0;">Please support plugin development</h2>
1344
  </div>
1345
  <div style="float: right;">
1346
- <h2 style="display: inline-block; margin: 13px 0;">Follow Ad Inserter</h2>
1347
- <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>
1348
- <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>
 
 
1349
  </div>
1350
 
1351
  <div style="clear: both;"></div>
1352
  </div>
1353
 
1354
- <div class="ai-form header" style="margin: 8px 0; padding: 0 8px; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1355
- <p>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/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">review page</a>.</p>
1356
- <p>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.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1357
  </div>
1358
 
1359
- <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;">
1360
  <div style="float: right;" >
1361
  <div>
1362
- <a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" title="Automate ad placement on posts and pages" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>
1363
  </div>
1364
  <div>
1365
- <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>
 
1366
  </div>
1367
  </div>
1368
 
1369
- <h3 style="text-align: justify;">Need a plugin for ad management? <a href="http://adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Ad Inserter Pro</a> features:</h3>
 
1370
 
1371
  <ul>
1372
- <li><strong>&squf;</strong> Email support</li>
1373
  <li><strong>&squf;</strong> 64 code (ad) blocks</li>
1374
  <li><strong>&squf;</strong> Syntax highlighting editor</li>
1375
  <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>
1376
  <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>
1377
  <li><strong>&squf;</strong> Automatic insertion between posts on blog pages</li>
 
1378
  <li><strong>&squf;</strong> Insertion exceptions for posts and pages</li>
1379
  <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>
1380
  <li><strong>&squf;</strong> Sticky positions (left, top, right, bottom - ads stay fixed when the page scrolls)</li>
1381
  <li><strong>&squf;</strong> Sticky (fixed) widgets (sidebar does not move when the page scrolls)</li>
1382
- <li><strong>&squf;</strong> Block alignment and style customizations</li>
1383
  <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>
1384
  <li><strong>&squf;</strong> Options to disable insertion on Ajax calls, 404 error pages or in feeds</li>
1385
  <li><strong>&squf;</strong> Ad rotation (works also with caching)</li>
1386
- <li><strong>&squf;</strong> Ad impression and click <a href="https://adinserter.pro/tracking" class="simple-link" target="_blank">tracking</a></li>
1387
- <li><strong>&squf;</strong> <a href="https://adinserter.pro/tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
1388
  <li><strong>&squf;</strong> Support for ads on <a href="http://adinserter.pro/settings#amp" class="simple-link" target="_blank">AMP pages</a></li>
 
1389
  <li><strong>&squf;</strong> Custom CSS class name for wrapping divs to avoid ad blockers</li>
1390
  <li><strong>&squf;</strong> PHP code processing</li>
1391
  <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>
1392
  <li><strong>&squf;</strong> Support for Google Analytics, Piwik or any other web analytics code</li>
1393
  <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>
1394
  <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>
1395
- <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>
1396
  <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>
1397
  <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>
1398
  <li><strong>&squf;</strong> Import/Export block or plugin settings</li>
@@ -1402,11 +1678,12 @@ function generate_settings_form (){
1402
  <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>
1403
  <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>
1404
  <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>
 
1405
  </ul>
1406
 
1407
- <p style="text-align: justify;">Ad Inserter Pro is a complete ad management plugin with many advertising features to automatically insert adverts on posts and pages.
1408
  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,
1409
- 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>
1410
  </div>
1411
 
1412
  </div>
@@ -1414,21 +1691,38 @@ function generate_settings_form (){
1414
  }
1415
  }
1416
  ?>
 
1417
  <script type="text/javascript">
1418
- // setTimeout (show_blocked_warning, 4000);
1419
-
1420
  jQuery(document).ready(function($) {
1421
- setTimeout (show_blocked_warning, 400);
1422
  });
1423
 
1424
- function show_blocked_warning () {
 
 
 
 
 
 
 
 
 
 
 
1425
  jQuery("#blocked-warning.warning-enabled").show ();
1426
  jQuery("#blocked-warning.warning-enabled .blocked-warning-text").css ('color', '#00f');
1427
 
1428
- var image = jQuery("#pro-image");
1429
- if (image.height () < 100) {
1430
- 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'));
1431
  }
 
 
 
 
 
 
 
1432
  }
1433
  </script>
1434
 
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
  }
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
 
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
  ?>
132
  </div>
133
 
134
+ <div id="javascript-warning" class="ai-form rounded" style="display: none;">
135
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
136
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
137
  <span id="javascript-version-parameter" style="display: none;">Wrong version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
138
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
139
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
142
  <div style="clear: both;"></div>
143
  </div>
144
 
145
+ <div id="css-warning" class="ai-form rounded" style="display: none;">
146
  <h2 id="css-version" style="float: left; color: red;" title="Loaded plugin CSS version">&nbsp;</h2>
147
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
148
  <span id="css-version-parameter" style="display: none;">Wrong version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
149
  <span id="css-version-parameter-missing" style="display: none;">Missing version parameter for the CSS file, probably due to inappropriate caching.<br /></span>
150
  Incompatible (old) CSS file loaded, probably due to inappropriate caching.<br />
153
  <div style="clear: both;"></div>
154
  </div>
155
 
156
+ <div id="blocked-warning" class="ai-form warning-enabled rounded">
157
  <h2 class="blocked-warning-text" style="float: left; color: red;" title="Error loading page">PAGE BLOCKED</h2>
158
+ <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
159
  This page was not loaded properly. Please check browser and plugins that may block CSS/javascript<br />
160
+ files or images for this page. For <strong>Ad Blocker</strong> select "Disable on this page" or "Don't run on this page".
161
  </div>
162
  <div style="clear: both;"></div>
163
  </div>
164
 
165
+ <div id="ai-tab-container" class="ai-form rounded" style="padding-bottom: 1px;">
166
  <div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
167
 
168
  <div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
271
  $enabled_h = $adH->get_enable_manual () && $adH->get_ad_data() != "";
272
  $enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
273
  if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
274
+
275
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
276
+ $enabled_a = $adA->get_enable_manual ();
277
+ if ($enabled_a) $title_hf .= ", Ad blocking detection code";
278
+ if ($enabled_a) $class_hf = " on";
279
+ }
280
+
281
  ?>
282
+ <li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> General Settings<?php echo $title_hf ?>" style=" margin: 1px 0 0 0;"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"></div></a></li>
283
  </ul>
284
 
285
  <?php
286
  for ($ad_number = $start; $ad_number <= $end; $ad_number ++){
287
 
288
  $default->number = $ad_number;
289
+ $default->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$ad_number;
290
 
291
  $tab_visible = $ad_number == $active_tab || $generate_all;
292
 
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
 
312
  $scheduling_active = $obj->get_scheduling() != AI_SCHEDULING_OFF;
313
 
314
+ $show_misc = $scheduling_active || !$obj->get_maximum_insertions () || !$obj->get_call_filter() || $obj->get_inverted_filter() || $obj->get_display_for_users() != AD_DISPLAY_ALL_USERS || $obj->get_enable_404 () == AI_ENABLED || $obj->get_enable_feed () == AI_ENABLED;
315
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
316
 
317
  $automatic_insertion = $obj->get_automatic_insertion();
327
  $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() ||
328
  $obj->get_paragraph_text() != $default->get_paragraph_text() ||
329
  $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() ||
330
+ $obj->get_minimum_words_above() != $default->get_minimum_words_above() ||
331
  $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote();
332
 
333
  $paragraph_clearance =
334
  ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) ||
335
  ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0);
336
 
337
+ $filter_type = $obj->get_filter_type();
338
+
339
  ?>
340
  <div id="tab-<?php echo $ad_number; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
341
  <div id="toolbar-<?php echo $ad_number; ?>" class="max-input" style="margin: 8px 0; height: 28px; margin-bottom: 2px;">
342
  <span id="name-label-container-<?php echo $ad_number; ?>" style="display: table-cell; padding: 0; font-weight: bold; cursor: pointer;">
343
+ <input id="name-edit-<?php echo $ad_number; ?>" style="width: 100%; vertical-align: middle; font-size: 14px; display: none;" type="text" name="<?php echo AI_OPTION_BLOCK_NAME, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
344
  <span id="name-label-<?php echo $ad_number; ?>" class="no-select" style="width: 100%; max-width: 440px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top: 4px; margin-left: 7px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name() ?></span>
345
  </span>
346
  <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
376
  </div>
377
  <div style="float: right;">
378
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
379
+ <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
380
  <?php } ?>
381
  </div>
382
  <div style="clear: both;"></div>
383
  </div>
384
 
385
+ <div class="rounded">
386
  <div style="float: left;">
387
  Automatic Insertion:
388
+ <select style="margin-bottom: 3px;" id="display-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_automatic_insertion(); ?>" style="width:200px;">
389
  <option data-img-src="<?php echo plugins_url ('images/disabled.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
390
  <option data-img-src="<?php echo plugins_url ('images/before-post.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
391
  <option data-img-src="<?php echo plugins_url ('images/before-content.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
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
  <div id="alignment-style-<?php echo $ad_number; ?>" style="margin-bottom: 4px;"></div>
426
  <div class="max-input">
427
  <span id="css-label-<?php echo $ad_number; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
428
+ <input id="custom-css-<?php echo $ad_number; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
429
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
430
  <span id="css-no-wrapping-<?php echo $ad_number; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
431
  <span id="css-none-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
441
  </div>
442
  </div>
443
 
444
+ <div class="responsive-table small-button rounded">
445
  <table>
446
  <tr>
447
  <td style="width: 70%">
448
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
449
+ <input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_post(); ?>" id="display-posts-<?php echo $ad_number; ?>" title="Enable or disable insertion on posts" <?php if ($obj->get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />
450
 
451
+ <select style="margin: 0 0 3px 10px;" title="Default insertion for posts - exceptions can be configured on individual post editor pages" id="enabled-on-which-posts-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_POSTS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_posts(); ?>" style="width:160px">
452
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
453
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
454
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
468
  <td style="padding-left: 8px;">
469
  </td>
470
  <td style="padding-left: 8px;">
471
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
472
+ <input id= "display-homepage-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_home(); ?>" <?php if ($obj->get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> />
473
  <label for="display-homepage-<?php echo $ad_number; ?>" title="Enable or disable insertion on homepage: latest posts (including sub-pages), static page or theme homepage">Homepage</label>
474
  </td>
475
  <td style="padding-left: 8px;">
476
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
477
+ <input id= "display-category-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_category(); ?>" <?php if ($obj->get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
478
  <label for="display-category-<?php echo $ad_number; ?>" title="Enable or disable insertion on category blog pages (including sub-pages)">Category pages</label>
479
  </td>
480
  </tr>
481
 
482
  <tr>
483
  <td style="width: 70%">
484
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
485
+ <input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_page(); ?>" id="display-pages-<?php echo $ad_number; ?>" title="Enable or disable insertion on static pages" <?php if ($obj->get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />
486
 
487
+ <select style="margin: 0 0 3px 10px;" title="Default insertion for pages - exceptions can be configured on individual page editor pages" id="enabled-on-which-pages-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_enabled_on_which_pages(); ?>" style="width:160px">
488
  <option value="<?php echo AD_ENABLED_ON_ALL; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL; ?></option>
489
  <option value="<?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED; ?></option>
490
  <option value="<?php echo AD_ENABLED_ONLY_ON_SELECTED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AD_ENABLED_ONLY_ON_SELECTED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ENABLED_ONLY_ON_SELECTED; ?></option>
495
  <td style="padding-left: 8px;">
496
  </td>
497
  <td style="padding-left: 8px;">
498
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
499
+ <input id= "display-search-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_search(); ?>" <?php if ($obj->get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> />
500
  <label for="display-search-<?php echo $ad_number; ?>" title="Enable or disable insertion on search blog pages">Search pages</label>
501
  </td>
502
  <td style="padding-left: 8px;">
503
+ <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
504
+ <input id= "display-archive-<?php echo $ad_number; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_display_settings_archive(); ?>" <?php if ($obj->get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
505
  <label for="display-archive-<?php echo $ad_number; ?>" title="Enable or disable insertion on tag or archive blog pages">Tag / Archive pages</label>
506
  </td>
507
  </tr>
508
  </table>
509
  </div>
510
 
511
+ <div id="block-exceptions-<?php echo $ad_number; ?>" class="responsive-table rounded" style="display: none;">
512
  <?php
513
 
514
  if (!empty ($block_exceptions [$ad_number])) {
545
  ?>
546
  </div>
547
 
548
+ <div id="paragraph-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_settings ? "" : " display: none;" ?>">
549
+ <div style="height: 26px;">
550
  <div style="float: left; margin-top: 1px;">
551
  Paragraph number(s)
552
+ <input
553
+ type="text"
554
  name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
555
  default="<?php echo $default->get_paragraph_number(); ?>"
556
  value="<?php echo $obj->get_paragraph_number(); ?>"
566
  </div>
567
  </div>
568
 
569
+ <div id="paragraph-counting-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_counting ? "" : "display: none;" ?>">
570
+ <div class="max-input" style="margin: 0 0 8px 0;">
571
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
572
  Count&nbsp;
573
+ <select name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_direction_type(); ?>">
574
  <option value="<?php echo AD_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_TOP; ?></option>
575
  <option value="<?php echo AD_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_BOTTOM; ?></option>
576
  </select>
578
  </span>
579
  <span style="display: table-cell;">
580
  <input
581
+ style="width: 100%;"
582
+ title="Comma separated HTML tag names, usually only 'p' tags are used"
583
  type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
584
  default="<?php echo $default->get_paragraph_tags(); ?>"
585
  value="<?php echo $obj->get_paragraph_tags(); ?>"
590
  &nbsp;
591
  that have between
592
  <input
 
593
  type="text"
594
  name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
595
  default="<?php echo $default->get_minimum_paragraph_words(); ?>"
598
  maxlength="5" />
599
  and
600
  <input
 
601
  type="text"
602
  name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
603
  default="<?php echo $default->get_maximum_paragraph_words(); ?>"
612
  <div class="max-input" style="margin: 8px 0 8px 0;">
613
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
614
  and
615
+ <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_PARAGRAPH_TEXT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_paragraph_text_type(); ?>">
616
  <option value="<?php echo AD_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_CONTAIN; ?></option>
617
  <option value="<?php echo AD_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_CONTAIN; ?></option>
618
  </select>
619
  </span>
620
  <span class="small-input-tags" style="display: table-cell;">
621
  <input
622
+ style="width: 100%;"
623
  title="Comma separated text"
624
  type="text"
625
  name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
627
  value="<?php echo $obj->get_paragraph_text(); ?>"
628
  maxlength="200" />
629
  </span>
630
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
631
+ &nbsp;&nbsp;
 
 
 
 
 
 
632
  Minimum number of paragraphs
633
  <input
 
634
  type="text"
635
  name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
636
  default="<?php echo $default->get_paragraph_number_minimum(); ?>"
637
  value="<?php echo $obj->get_paragraph_number_minimum() ?>"
638
  size="2"
639
  maxlength="3" />
640
+ </span>
641
+ </div>
642
+
643
+ <div class="max-input" style="margin: 8px 0 0 0;">
644
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
645
+ <input type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
646
+ <input id= "ignore_blockquote-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_count_inside_blockquote(); ?>" <?php if ($obj->get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />
647
+ <label for="ignore_blockquote-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Count also paragraphs inside <?php echo get_no_paragraph_counting_inside (); ?> elements - defined on general plugin settings page - Tab General">Count inside special elements</label>
648
+ </span>
649
+
650
+ <span class="small-input-tags" style="display: table-cell;">
651
+ <input
652
+ style="width: 100%; visibility: hidden;"
653
+ />
654
+ </span>
655
+
656
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
657
+ &nbsp;&nbsp;
658
+ Minimum number of words in paragraphs above
659
+ <input
660
+ type="text"
661
+ name="<?php echo AI_OPTION_MIN_WORDS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
662
+ default="<?php echo $default->get_minimum_words_above(); ?>"
663
+ value="<?php echo $obj->get_minimum_words_above() ?>"
664
+ title="Used only with automatic insertion After paragraph and empty paragraph numbers"
665
+ size="2"
666
+ maxlength="4" />
667
+ </span>
668
  </div>
669
  </div>
670
 
671
+ <div id="paragraph-clearance-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $paragraph_clearance ? "" : "display: none;" ?>">
672
+ <div class="max-input" style="margin: 0 0 8px 0">
673
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
674
  In
675
  <input
 
676
  type="text"
677
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
678
  default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
684
  </span>
685
  <span style="display: table-cell;">
686
  <input
687
+ style="width: 100%;"
688
  title="Comma separated text"
689
  type="text"
690
  name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
694
  </span>
695
  </div>
696
 
697
+ <div class="max-input" style="margin: 8px 0">
698
  <span style="display: table-cell; width: 1px; white-space: nowrap;">
699
  In
700
  <input
 
701
  type="text"
702
  name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
703
  default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
709
  </span>
710
  <span style="display: table-cell;">
711
  <input
712
+ style="width: 100%;"
713
  title="Comma separated text"
714
  type="text"
715
  name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
719
  </span>
720
  </div>
721
 
722
+ <div style="margin: 8px 0 0 0;">
723
  If text is found
724
+ <select id="avoid-action-<?php echo $ad_number; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_ACTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_action(); ?>">
725
  <option value="<?php echo AD_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AD_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_INSERT; ?></option>
726
  <option value="<?php echo AD_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AD_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_TRY_TO_SHIFT_POSITION; ?></option>
727
  </select>
728
  <span id="check-up-to-<?php echo $ad_number; ?>">
729
  &mdash; check up to
730
  <input
 
731
  type="text"
732
  name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $ad_number; ?>"
733
  default="<?php echo $default->get_avoid_try_limit(); ?>"
735
  size="2"
736
  maxlength="3" />
737
  paragraphs
738
+ <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_avoid_direction(); ?>">
739
  <option value="<?php echo AD_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE; ?></option>
740
  <option value="<?php echo AD_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_BELOW; ?></option>
741
  <option value="<?php echo AD_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE_AND_THEN_BELOW; ?></option>
745
  </div>
746
  </div>
747
 
748
+ <div id="content-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php echo $content_settings ? "" : "display: none;" ?>">
749
  Post/Static page must have between
750
+ <input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" size="4" maxlength="6" />
751
  and
752
+ <input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" title="Maximum number of post/static page words, leave empty for no limit" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" size="4" maxlength="6" />
753
  words
754
  </div>
755
 
756
+ <div class="responsive-table rounded" id="list-settings-<?php echo $ad_number; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
757
+ <table>
758
  <tbody>
759
  <tr>
760
  <td style="padding-right: 7px;">
761
  Categories
762
  </td>
763
  <td style="padding-right: 7px; width: 70%;">
764
+ <input style="width: 100%;" title="Comma separated category slugs" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="500" />
765
  </td>
766
  <td style="padding-right: 7px;">
767
+ <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_BLACK_LIST) echo 'checked '; ?> />
768
  <label for="category-blacklist-<?php echo $ad_number; ?>" title="Blacklist categories"><?php echo AD_BLACK_LIST; ?></label>
769
  </td>
770
  <td>
771
+ <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="category-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_WHITE_LIST) echo 'checked '; ?> />
772
  <label for="category-whitelist-<?php echo $ad_number; ?>" title="Whitelist categories"><?php echo AD_WHITE_LIST; ?></label>
773
  </td>
774
  </tr>
777
  Tags
778
  </td>
779
  <td style="padding-right: 7px;">
780
+ <input style="width: 100%;" title="Comma separated tags" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="500"/>
781
  </td>
782
  <td style="padding-right: 7px;">
783
+ <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_BLACK_LIST) echo 'checked '; ?> />
784
  <label for="tag-blacklist-<?php echo $ad_number; ?>" title="Blacklist tags"><?php echo AD_BLACK_LIST; ?></label>
785
  </td>
786
  <td>
787
+ <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="tag-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_WHITE_LIST) echo 'checked '; ?> />
788
  <label for="tag-whitelist-<?php echo $ad_number; ?>" title="Whitelist tags"><?php echo AD_WHITE_LIST; ?></label>
789
  </td>
790
  </tr>
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
  Urls
826
  </td>
827
  <td style="padding-right: 7px;">
828
+ <input style="width: 100%;" title="SPACE separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="500"/>
829
  </td>
830
  <td style="padding-right: 7px;">
831
+ <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
832
  <label for="url-blacklist-<?php echo $ad_number; ?>" title="Blacklist urls"><?php echo AD_BLACK_LIST; ?></label>
833
  </td>
834
  <td>
835
+ <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
836
  <label for="url-whitelist-<?php echo $ad_number; ?>" title="Whitelist urls"><?php echo AD_WHITE_LIST; ?></label>
837
  </td>
838
  </tr>
841
  Url parameters
842
  </td>
843
  <td style="padding-right: 7px;">
844
+ <input style="width: 100%;" title="Comma separated url query parameters with optional values (use either 'prameter' or 'prameter=value')" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="500"/>
845
  </td>
846
  <td style="padding-right: 7px;">
847
+ <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
848
  <label for="url-parameter-blacklist-<?php echo $ad_number; ?>" title="Blacklist url parameters"><?php echo AD_BLACK_LIST; ?></label>
849
  </td>
850
  <td>
851
+ <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="url-parameter-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
852
  <label for="url-parameter-whitelist-<?php echo $ad_number; ?>" title="Whitelist url parameters"><?php echo AD_WHITE_LIST; ?></label>
853
  </td>
854
  </tr>
857
  Referers
858
  </td>
859
  <td style="padding-right: 7px;">
860
+ <input style="width: 100%;" title="Comma separated domains, use # for no referer" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="500"/>
861
  </td>
862
  <td style="padding-right: 7px;">
863
+ <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-blacklist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
864
  <label for="referer-blacklist-<?php echo $ad_number; ?>" title="Blacklist referers"><?php echo AD_BLACK_LIST; ?></label>
865
  </td>
866
  <td>
867
+ <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="referer-whitelist-<?php echo $ad_number; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
868
  <label for="referer-whitelist-<?php echo $ad_number; ?>" title="Whitelist referers"><?php echo AD_WHITE_LIST; ?></label>
869
  </td>
870
  </tr>
873
  </table>
874
  </div>
875
 
876
+ <div id="manual-settings-<?php echo $ad_number; ?>" class="small-button rounded" style="text-align: left;<?php if (!$show_manual) echo ' display: none;'; ?>">
877
  <table>
878
  <tr>
879
  <td style="padding: 4px 10px 4px 0;">
880
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
881
+ <input id="enable-widget-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_widget(); ?>" <?php if ($obj->get_enable_widget () == AI_ENABLED) echo 'checked '; ?> />
882
  <label for="enable-widget-<?php echo $ad_number; ?>" title="Enable or disable widget for this code block">
883
  Widget
884
  </label>
890
  </tr>
891
  <tr>
892
  <td style="padding: 4px 10px 4px 0;">
893
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
894
+ <input type="checkbox" id="enable-shortcode-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($obj->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> />
895
  <label for="enable-shortcode-<?php echo $ad_number; ?>" title="Enable or disable shortcode for manual insertion of this code block in posts and pages">
896
  Shortcode
897
  </label>
903
  </tr>
904
  <tr>
905
  <td style="padding: 4px 10px 4px 0;">
906
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
907
+ <input id="enable-php-call-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_php_call(); ?>" <?php if ($obj->get_enable_php_call () == AI_ENABLED) echo 'checked '; ?> />
908
  <label for="enable-php-call-<?php echo $ad_number; ?>" title="Enable or disable PHP function call to insert this code block at any position in template file. If function is disabled for block it will return empty string.">
909
  PHP function
910
  </label>
916
  </table>
917
  </div>
918
 
919
+ <div id="misc-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php if (!$show_misc) echo 'display: none;'; ?>">
920
+ <div class="max-input" style="margin: 0 0 8px 0;">
921
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
922
  Insert for
923
+ <select style="margin-bottom: 3px;" id="display-for-users-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_USERS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_users(); ?>" style="width:160px">
924
  <option value="<?php echo AD_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ALL_USERS; ?></option>
925
  <option value="<?php echo AD_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_LOGGED_IN_USERS; ?></option>
926
  <option value="<?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
927
  <option value="<?php echo AD_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ADMINISTRATORS; ?></option>
928
  </select>
929
  </span>
930
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
931
+ &nbsp;&nbsp;
932
+ Max <input type="text" style="width: 26px;" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="1" maxlength="3" title="Empty or 0 means no limit" /> insertions
933
  </span>
934
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
935
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
936
+ <input style="margin-left: 20px;" id="enable-ajax-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_ajax(); ?>" <?php if ($obj->get_enable_ajax () == AI_ENABLED) echo 'checked '; ?> />
937
+ <label for="enable-ajax-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion in Ajax requests">Ajax</label>
938
+ </span>
939
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
940
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
941
+ <input style="margin-left: 10px;" id="enable-feed-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_feed(); ?>" <?php if ($obj->get_enable_feed () == AI_ENABLED) echo 'checked '; ?> />
942
+ <label for="enable-feed-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion in feeds">Feed</label>
943
+ </span>
944
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
945
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
946
+ <input style="margin-left: 10px;" id="enable-404-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($obj->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
947
+ <label for="enable-404-<?php echo $ad_number; ?>" style="vertical-align: top;" title="Enable or disable insertion on page for Error 404: Page not found">404</label>
948
+ </span>
949
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
950
+ &nbsp;&nbsp;
951
  General tag
952
+ &nbsp;
953
  </span>
954
  <span style="display: table-cell;">
955
+ <input style="width: 100%;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" size="8" maxlength="40" title="Used for {tags} when no page data is found" />
956
  </span>
957
  </div>
958
 
962
  Filter insertions
963
  </span>
964
  <span style="display: table-cell;">
965
+ <input style="width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "Filter insertions by specifying wanted calls for this block - single number or comma separated numbers, empty means all / no limits. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="24" />
966
  </span>
967
  <span style="display: table-cell;">
968
  &nbsp;&nbsp;&nbsp;using
969
+ <select style="margin-bottom: 3px;" id="filter-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_FILTER_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_filter_type(); ?>" style="width:160px">
970
+ <option value="<?php echo AI_FILTER_AUTO; ?>" <?php echo ($filter_type == AI_FILTER_AUTO) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AUTO; ?></option>
971
+ <option value="<?php echo AI_FILTER_PHP_FUNCTION_CALLS; ?>" <?php echo ($filter_type == AI_FILTER_PHP_FUNCTION_CALLS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHP_FUNCTION_CALLS; ?></option>
972
+ <option value="<?php echo AI_FILTER_CONTENT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_CONTENT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CONTENT_PROCESSING; ?></option>
973
+ <option value="<?php echo AI_FILTER_EXCERPT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_EXCERPT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_EXCERPT_PROCESSING; ?></option>
974
+ <option value="<?php echo AI_FILTER_BEFORE_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_BEFORE_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST_PROCESSING; ?></option>
975
+ <option value="<?php echo AI_FILTER_AFTER_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_AFTER_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST_PROCESSING; ?></option>
976
+ <option value="<?php echo AI_FILTER_WIDGET_DRAWING; ?>" <?php echo ($filter_type == AI_FILTER_WIDGET_DRAWING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_WIDGET_DRAWING; ?></option>
977
+ <option value="<?php echo AI_FILTER_SUBPAGES; ?>" <?php echo ($filter_type == AI_FILTER_SUBPAGES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SUBPAGES; ?></option>
978
+ <option value="<?php echo AI_FILTER_POSTS; ?>" <?php echo ($filter_type == AI_FILTER_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_POSTS; ?></option>
979
+ <option value="<?php echo AI_FILTER_PARAGRAPHS; ?>" <?php echo ($filter_type == AI_FILTER_PARAGRAPHS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PARAGRAPHS; ?></option>
980
+ <option value="<?php echo AI_FILTER_COMMENTS; ?>" <?php echo ($filter_type == AI_FILTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_COMMENTS; ?></option>
981
  </select>
982
  counter
983
  </span>
984
  <span style="display: table-cell;">
985
+ <input type="hidden" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
986
+ <input style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_inverted_filter(); ?>" <?php if ($obj->get_inverted_filter () == AI_ENABLED) echo 'checked '; ?> />
987
+ <label for="enable-ajax-<?php echo $ad_number; ?>" style="vertical-align: top;" title="If checked specified calls are unwanted">Invert filter</label>
 
 
 
 
 
 
 
 
 
 
988
  </span>
989
  </div>
990
  </div>
991
 
992
+ <div style="margin: 8px 0 0 0;">
993
+ <select style="margin-bottom: 0px;" id="scheduling-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_scheduling(); ?>">
994
  <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
995
  <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
996
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
997
  </select>
998
 
999
  <span id="scheduling-delay-<?php echo $ad_number; ?>">
1000
+ for <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" size="2" maxlength="3" /> days after publishing
1001
  </span>
1002
  <span id="scheduling-delay-warning-<?php echo $ad_number; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
1003
 
1004
  <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($ad_number, $obj, $default); ?>
1005
  </div>
1006
 
1007
+ <?php if (function_exists ('ai_adb_action')) ai_adb_action ($ad_number, $obj, $default); ?>
1008
  </div>
1009
 
1010
+ <div id="device-detection-settings-<?php echo $ad_number; ?>" class="rounded" style="<?php if (!$show_devices) echo 'display: none;'; ?>">
1011
  <table>
1012
  <tr>
1013
  <td>
1014
  <div style="margin-bottom: 5px;">
1015
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1016
+ <input id="client-side-detection-<?php echo $ad_number; ?>" type="checkbox" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="1" default="<?php echo $default->get_detection_client_side(); ?>" <?php if ($obj->get_detection_client_side ()==AI_ENABLED) echo 'checked '; ?> />
1017
  <label for="client-side-detection-<?php echo $ad_number; ?>">Use client-side detection to show only on:</label>
1018
  </div>
1019
 
1025
  if ($viewport_name != '') {
1026
  ?>
1027
  <div style="margin: 8px 0;">
1028
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1029
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="viewport-<?php echo $viewport, "-", $ad_number; ?>" value="1" default="<?php echo $default->get_detection_viewport ($viewport); ?>" <?php if ($obj->get_detection_viewport ($viewport)==AI_ENABLED) echo 'checked '; ?> />
1030
  <label for="viewport-<?php echo $viewport, "-", $ad_number; ?>" title="Device min width <?php echo get_viewport_width ($viewport); ?> px"><?php echo $viewport_name; ?></label>
1031
  </div>
1032
  <?php
1035
  ?>
1036
  </div>
1037
  </td><td style="padding-left: 40px; vertical-align: top;">
1038
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" value="0" />
1039
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" id="server-side-detection-<?php echo $ad_number; ?>" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($obj->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1040
  <label for="server-side-detection-<?php echo $ad_number; ?>">Use server-side detection to insert code only for </label>
1041
 
1042
  <div style="margin: 10px 0 10px 40px;">
1043
+ <select style="margin-bottom: 3px;" id="display-for-devices-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_display_for_devices(); ?>" style="width:160px">
1044
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1045
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1046
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1055
  </table>
1056
  </div>
1057
 
1058
+ <div id="no-wrapping-warning-<?php echo $ad_number; ?>" class="rounded" style="display: none;">
1059
  <span id="" style="margin-top: 5px;"><strong><span style="color: red;">WARNING:</span> No Wrapping</strong> style has no HTML code for client-side device detection!</span>
1060
  </div>
1061
 
1066
  ?>
1067
  <div id="tab-0" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
1068
  <div style="margin: 16px 0 16px 4px;">
1069
+ <h3 style="margin: 0; float: left;"><?php echo AD_INSERTER_NAME ?> Settings <?php if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
1070
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
1071
+ (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]); ?></h3>
1072
+ <h4 style="margin: 0px; float: right;" title="Settings timestamp"><?php echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : ""; ?></h4>
1073
  <div style="clear: both;"></div>
1074
  </div>
1075
 
1076
  <div style="margin: 16px 0;">
1077
  <div style="float: right;">
1078
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1079
+ <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save Settings" type="submit" style="width:120px; font-weight: bold;" />
1080
  </div>
1081
 
1082
  <div style="float: left; color: red;">
1091
 
1092
  if ($enabled_h) $style_h = "font-weight: bold; color: #66f;"; else $style_h = "";
1093
  if ($enabled_f) $style_f = "font-weight: bold; color: #66f;"; else $style_f = "";
1094
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1095
+ $adb_action = get_adb_action();
1096
+ if ($enabled_a) $style_a = "font-weight: bold; color: " . ($adb_action == AI_ACTION_NONE ? "#66f;" : "#f00;"); else $style_a = "";
1097
+ }
1098
  if (false) $style_d = "font-weight: bold; color: #e44;"; else $style_d = "";
1099
  ?>
1100
 
1105
  <li id="ai-h" class="ai-plugin-tab"><a href="#tab-header"><span style="<?php echo $style_h ?>">Header</span></a></li>
1106
  <li id="ai-f" class="ai-plugin-tab"><a href="#tab-footer"><span style="<?php echo $style_f ?>">Footer</span></a></li>
1107
  <?php if (function_exists ('ai_plugin_settings_tab')) ai_plugin_settings_tab ($exceptions); ?>
1108
+ <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
1109
+ <li id="ai-a" class="ai-plugin-tab"><a href="#tab-adblocking"><span style="<?php echo $style_a ?>">Ad Blocking</span></a></li>
1110
+ <?php } ?>
1111
  <li id="ai-d" class="ai-plugin-tab"><a href="#tab-debugging"><span style="<?php echo $style_d ?>">Debugging</span></a></li>
1112
  </ul>
1113
 
1114
+ <div id="tab-general" class="rounded">
1115
 
1116
+ <table class="ai-settings-table" style="width: 100%;">
1117
  <?php if (function_exists ('ai_general_settings')) ai_general_settings (); ?>
1118
  <tr>
1119
+ <td style="width: 36%;">
1120
  Syntax Highlighter Theme
1121
  </td>
1122
  <td>
1123
  <select
1124
+ style="width:220px"
1125
  id="syntax-highlighter-theme"
1126
  name="syntax-highlighter-theme"
1127
  value="Value">
1168
  </td>
1169
  </tr>
1170
  <tr>
1171
+ <td>
1172
  Block Class Name
1173
  </td>
1174
  <td>
1175
+ <input style="margin-left: 0px;" title="CSS Class Name for the wrapping div" type="text" id="block-class-name" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="15" maxlength="40" />
1176
  </td>
1177
  </tr>
1178
  <tr>
1179
+ <td>
1180
  Minimum User Role for Exceptions Editing
1181
  </td>
1182
  <td>
1183
+ <select style="margin-bottom: 3px;" id="minimum-user-role" name="minimum-user-role" selected-value="1" data="<?php echo get_minimum_user_role (); ?>" default="<?php echo DEFAULT_MINIMUM_USER_ROLE; ?>" style="width:300px">
1184
  <?php wp_dropdown_roles (get_minimum_user_role ()); ?>
1185
  </select>
1186
  </td>
1187
  </tr>
1188
  <tr>
1189
+ <td>
1190
  Dynamic blocks
1191
  </td>
1192
  <td>
1193
+ <select id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
1194
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
1195
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
1196
  <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
1198
  </td>
1199
  </tr>
1200
  <tr>
1201
+ <td>
1202
  Functions for Paragraph Counting
1203
  </td>
1204
  <td>
1205
+ <select id="paragraph_counting_functions" name="paragraph_counting_functions" default="<?php echo DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS; ?>" title="Standard PHP functions are faster and work in most cases, use Multibyte functions if paragraphs are not counted properly on non-english pages.">
1206
  <option value="<?php echo AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STANDARD; ?></option>
1207
  <option value="<?php echo AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MULTIBYTE; ?></option>
1208
  </select>
1209
  </td>
1210
  </tr>
1211
  <tr>
1212
+ <td>
1213
+ No Paragraph Counting Inside
1214
+ </td>
1215
+ <td>
1216
+ <input type="text" name="no-paragraph-counting-inside" value="<?php echo get_no_paragraph_counting_inside (); ?>" default="<?php echo DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE; ?>" size="40" maxlength="80" />
1217
+ </td>
1218
+ </tr>
1219
+ <tr>
1220
+ <td>
1221
  Sticky Widget Top Margin
1222
  </td>
1223
  <td>
1224
+ <input type="text" name="sticky-widget-margin" value="<?php echo get_sticky_widget_margin (); ?>" default="<?php echo DEFAULT_STICKY_WIDGET_MARGIN; ?>" size="6" maxlength="4" /> px
1225
  </td>
1226
  </tr>
1227
  <tr>
1228
+ <td>
1229
  Plugin priority
1230
  </td>
1231
  <td>
1232
+ <input type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" default="<?php echo DEFAULT_PLUGIN_PRIORITY; ?>" size="6" maxlength="6" />
1233
  </td>
1234
  </tr>
1235
  </table>
1236
  </div>
1237
 
1238
+ <div id="tab-viewports" class="rounded">
1239
+ <div style="margin: 0 0 8px 0;">
1240
  Viewport Settings used for client-side device detection
1241
  </div>
1242
  <?php
1243
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
1244
+ $bottom_margin = $viewport == AD_INSERTER_VIEWPORTS ? 0 : 8;
1245
  ?>
1246
+ <div style="margin: 8px 0 <?php echo $bottom_margin; ?>px 0;">
1247
  Viewport <?php echo $viewport; ?> name&nbsp;&nbsp;&nbsp;
1248
+ <input style="margin-left: 0px;" type="text" name="viewport-name-<?php echo $viewport; ?>" value="<?php echo get_viewport_name ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_NAME_" . $viewport) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport) : ""; ?>" size="15" maxlength="40" />
1249
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '<span style="display: none;">' ?>
1250
  &nbsp;&nbsp; min width
1251
+ <input type="text" id="option-length-<?php echo $viewport; ?>" name="viewport-width-<?php echo $viewport; ?>" value="<?php echo get_viewport_width ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) : ""; ?>" size="4" maxlength="4" /> px
1252
  <?php if ($viewport == AD_INSERTER_VIEWPORTS) echo '</span>' ?>
1253
  </div>
1254
  <?php
1290
  <textarea id="block-h" name="<?php echo AI_OPTION_CODE, '_block_h'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adH->get_ad_data()); ?></textarea>
1291
  </div>
1292
 
1293
+ <div id="device-detection-settings-h" class="rounded">
1294
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" value="0" />
1295
+ <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" id="server-side-detection-h" style="margin-top: 1px;" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1296
  <label for="server-side-detection-h">Use server-side detection to insert code only for </label>
1297
+ <select id="display-for-devices-h" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1298
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1299
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1300
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1304
  </select>
1305
  devices
1306
 
1307
+ <span style="float: right; margin-top: 2px;">
1308
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
1309
+ <input style="margin-left: 10px; margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" id="enable-header-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1310
  <label for="enable-header-404" title="Enable or disable insertion of this code into HTML page header on page for Error 404: Page not found">Insert on Error 404 page</label>
1311
  </span>
1312
  </div>
1346
  <textarea id="block-f" name="<?php echo AI_OPTION_CODE, '_block_f'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adF->get_ad_data()); ?></textarea>
1347
  </div>
1348
 
1349
+ <div id="device-detection-settings-f" class="rounded">
1350
+ <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" value="0" />
1351
+ <input style="margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" id="server-side-detection-f" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
1352
  <label for="server-side-detection-f">Use server-side detection to insert code only for </label>
1353
+ <select id="display-for-devices-f" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
1354
  <option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
1355
  <option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
1356
  <option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
1360
  </select>
1361
  devices
1362
 
1363
+ <span style="float: right; margin-top: 2px;">
1364
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
1365
+ <input style="margin-left: 10px; margin-top: 1px;" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" id="enable-footer-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
1366
  <label for="enable-footer-404" title="Enable or disable insertion of this code into HTML page footer on page for Error 404: Page not found">Insert on Error 404 page</label>
1367
  </span>
1368
  </div>
1370
 
1371
  <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
1372
 
1373
+ <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
1374
+
1375
+ <div id="tab-adblocking" style="margin: 0px 0; padding: 0; ">
1376
+ <div style="margin: 8px 0;">
1377
+ <div style="float: right;">
1378
+ <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" value="0" />
1379
+ <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" id="enable-adb-detection" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adA->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1380
+ <label class="checkbox-button" style="margin-left: 10px;" for="enable-adb-detection" title="Enable or disable detection of ad blocking"><span class="checkbox-icon icon-enabled<?php if ($adA->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
1381
+ </div>
1382
+
1383
+ <div>
1384
+ <h3 style="margin: 8px 0 8px 2px;">Ad Blocking Detection</h3>
1385
+ </div>
1386
+ </div>
1387
+
1388
+ <div class="rounded" style="margin: 16px 0 8px;">
1389
+ <table class="ai-settings-table" style="width: 100%;" cellpadding="0">
1390
+ <tr>
1391
+ <td style="width: 20%;">
1392
+ <label for="adb-action">Action</label>
1393
+ </td>
1394
+ <td>
1395
+ <select id="adb-action" name="<?php echo AI_OPTION_ADB_ACTION; ?>" title="Global action when ad blocking is detected" default="<?php echo AI_DEFAULT_ADB_ACTION; ?>" >
1396
+ <option value="<?php echo AI_ACTION_NONE; ?>" <?php echo ($adb_action == AI_ACTION_NONE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NONE; ?></option>
1397
+ <option value="<?php echo AI_ACTION_WARNING_MESSAGE; ?>" <?php echo ($adb_action == AI_ACTION_WARNING_MESSAGE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_WARNING_MESSAGE; ?></option>
1398
+ <option value="<?php echo AI_ACTION_REDIRECTION; ?>" <?php echo ($adb_action == AI_ACTION_REDIRECTION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_REDIRECTION; ?></option>
1399
+ </select>
1400
+ </td>
1401
+ </tr>
1402
+ <tr>
1403
+ <td>
1404
+ Delay Action
1405
+ </td>
1406
+ <td>
1407
+ <input style="width: 40px;" type="text" name="<?php echo AI_OPTION_ADB_DELAY_ACTION; ?>" title="Number of page views to delay action when ad blocking is detected. Leave empty for no delay (action fires on first page view). Sets cookie." value="<?php echo get_delay_action (); ?>" default="" size="3" maxlength="5" /> page views
1408
+ </td>
1409
+ </tr>
1410
+ <tr>
1411
+ <td>
1412
+ No Action Period
1413
+ </td>
1414
+ <td>
1415
+ <input style="width: 40px;" type="text" name="<?php echo AI_OPTION_ADB_NO_ACTION_PERIOD; ?>" title="Number of days to supress action when ad blocking is detected. Leave empty for no no-action period (action fires always after defined page view delay). Sets cookie." value="<?php echo get_no_action_period (); ?>" default="<?php echo AI_DEFAULT_ADB_NO_ACTION_PERIOD; ?>" size="3" maxlength="5" /> days
1416
+ </td>
1417
+ </tr>
1418
+ <tr>
1419
+ <td>
1420
+ Custom Selectors
1421
+ </td>
1422
+ <td>
1423
+ <input style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_SELECTORS; ?>" title="Comma seprarated list of CSS selectors (.class, #id) used for additional ad blocking detection. Invisible or zero height of the element means ad blocking is present." value="<?php echo get_adb_selectors (); ?>" default="" size="50" maxlength="200" />
1424
+ </td>
1425
+ </tr>
1426
+ </table>
1427
+ </div>
1428
+
1429
+ <div id="adb-page-redirection" class="rounded">
1430
+ <table class="ai-settings-table" style="width: 100%;">
1431
+ <tr>
1432
+ <td style="width: 20%;">
1433
+ <label for="redirection-page">Redirection Page</label>
1434
+ </td>
1435
+ <td>
1436
+ <?php
1437
+ $args = array(
1438
+ 'depth' => 0,
1439
+ 'child_of' => 0,
1440
+ 'selected' => get_redirection_page (true),
1441
+ 'echo' => 0,
1442
+ 'name' => AI_OPTION_ADB_REDIRECTION_PAGE,
1443
+ 'id' => 'redirection-page',
1444
+ 'class' => null,
1445
+ 'show_option_none' => 'Custom Url',
1446
+ 'show_option_no_change' => null,
1447
+ 'option_none_value' => '0',
1448
+ );
1449
+ $dropdown_pages = wp_dropdown_pages ($args);
1450
+ $dropdown_pages = str_replace ('<select ', '<select default="'.AI_DEFAULT_ADB_REDIRECTION_PAGE.'" title="Static page for redirection when ad blocking is detected. For other pages select Custom url and set it below." ', $dropdown_pages);
1451
+
1452
+ echo $dropdown_pages;
1453
+ ?>
1454
+ </td>
1455
+ </tr>
1456
+ <tr>
1457
+ <td>
1458
+ Custom Redirection Url
1459
+ </td>
1460
+ <td>
1461
+ <input id="custom-redirection-url" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_CUSTOM_REDIRECTION_URL; ?>" value="<?php echo get_custom_redirection_url (); ?>" default="" size="50" maxlength="200" />
1462
+ </td>
1463
+ </tr>
1464
+ </table>
1465
+ </div>
1466
+
1467
+ <div id="adb-message">
1468
+ <div style="padding: 0; min-height: 28px;">
1469
+ <div style="float: left; margin: 10px 0 0 3px;">
1470
+ Message HTML code
1471
+ </div>
1472
+ <div style="float: right;">
1473
+
1474
+ <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
1475
+ <input type="checkbox" value="0" id="simple-editor-a" style="display: none;" />
1476
+ <label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-a" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
1477
+ <?php endif; ?>
1478
+
1479
+ <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="0" />
1480
+ <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="1" id="process-php-a" default="<?php echo $default->get_process_php (); ?>" <?php if ($adA->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
1481
+ <label class="checkbox-button" style="margin-left: 10px;" for="process-php-a" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adA->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
1482
+
1483
+ <button id="preview-button-adb" type="button" style="display: none; margin: 0 4px 0 10px;" title="Preview message when ad blocking is detected" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
1484
+ </div>
1485
+ <div style="clear: both;"></div>
1486
+ </div>
1487
+
1488
+ <div style="margin: 8px 0;">
1489
+ <textarea id="block-a" name="<?php echo AI_OPTION_CODE, '_block_a'; ?>" class="simple-editor small" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;"><?php echo esc_textarea ($adA->get_ad_data()); ?></textarea>
1490
+ </div>
1491
+
1492
+ <div class="rounded">
1493
+ <table class="ai-settings-table" style="width: 100%;">
1494
+ <tr>
1495
+ <td style="width: 20%;">
1496
+ Message CSS
1497
+ </td>
1498
+ <td>
1499
+ <input id="message-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_MESSAGE_CSS; ?>" value="<?php echo get_message_css (); ?>" default="<?php echo AI_DEFAULT_ADB_MESSAGE_CSS; ?>" size="50" maxlength="200" />
1500
+ </td>
1501
+ </tr>
1502
+ <tr>
1503
+ <td>
1504
+ Overlay CSS
1505
+ </td>
1506
+ <td>
1507
+ <input id="overlay-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_OVERLAY_CSS; ?>" value="<?php echo get_overlay_css (); ?>" default="<?php echo AI_ADB_DEFAULT_OVERLAY_CSS; ?>" size="50" maxlength="200" />
1508
+ </td>
1509
+ </tr>
1510
+ <tr>
1511
+ <td>
1512
+ <label for="undismissible-message" title="Prevent visitors from closing the warning message">Undismissible Message</label>
1513
+ </td>
1514
+ <td>
1515
+ <input type="hidden" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" value="0" />
1516
+ <input style="margin-left: 1px;" type="checkbox" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" id="undismissible-message" value="1" default="<?php echo AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE; ?>" <?php if (get_undismissible_message () == AI_ENABLED) echo 'checked '; ?> />
1517
+ </td>
1518
+ </tr>
1519
+ </table>
1520
+ </div>
1521
+ </div>
1522
+ </div>
1523
+
1524
+ <?php } ?>
1525
+
1526
+ <div id="tab-debugging" class="rounded">
1527
+ <div style="margin: 0 0 8px 0;">
1528
+ <input type="hidden" name="admin_toolbar_debugging" value="0" />
1529
+ <input type="checkbox" name="admin_toolbar_debugging" id="admin-toolbar-debugging" value="1" default="<?php echo DEFAULT_ADMIN_TOOLBAR_DEBUGGING; ?>" <?php if (get_admin_toolbar_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1530
  <label for="admin-toolbar-debugging" title="Enable or disable debugging functions in admin toolbar">Debugging functions in admin toolbar</label>
1531
  </div>
1532
 
1533
+ <div style="margin: 8px 0 0 0;">
1534
+ <input type="hidden" name="remote_debugging" value="0" />
1535
+ <input type="checkbox" name="remote_debugging" id="remote-debugging" value="1" default="<?php echo DEFAULT_REMOTE_DEBUGGING; ?>" <?php if (get_remote_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1536
  <label for="remote-debugging" title="Enable Debugger widget and code insertion debugging (blocks, positions, tags, processing) by url parameters for non-logged in users. Enable this option to allow other people to see Debugger widget, labeled blocks and positions in order to help you to diagnose problems. For logged in administrators debugging is always enabled.">Remote debugging</label>
1537
  </div>
1538
 
1539
  <div id="system-debugging" style="display: none;">
1540
+ <div style="margin: 8px 0 0 0;">
1541
+ <input type="hidden" name="javascript_debugging" value="0" />
1542
+ <input type="checkbox" name="javascript_debugging"id="javascript-debugging" value="1" default="<?php echo DEFAULT_JAVASCRIPT_DEBUGGING; ?>" <?php if (get_javascript_debugging ()==AI_ENABLED) echo 'checked '; ?> />
1543
  <label for="javascript-debugging" title="Enable Javascript console output">Javascript debugging</label>
1544
  </div>
1545
 
1554
 
1555
  <?php if (!function_exists ('ai_settings_side')) { ?>
1556
 
1557
+ <div class="ai-form header rounded">
1558
  <div style="float: left;">
1559
+ <h2 style="display: inline-block; margin: 5px 0;">Blank Ad Blocks? Looking for AdSense alternative?</h2>
1560
  </div>
1561
  <div style="clear: both;"></div>
1562
  </div>
1563
 
1564
+ <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
1565
+ <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
1566
  </div>
1567
 
1568
+ <!--<div class="ai-form header rounded">-->
1569
+ <!-- <div style="float: left;">-->
1570
+ <!-- <h2 style="display: inline-block; margin: 5px 0;">WordPress [Great Content] + Ad Inserter [AdSense, Amazon, media.net] = ?</h2>-->
1571
+ <!-- </div>-->
1572
+ <!-- <div style="clear: both;"></div>-->
1573
+ <!--</div>-->
1574
+
1575
  <?php } ?>
1576
 
1577
+ <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="[<?php echo $active_tab, ',', $active_tab_0; ?>]" />
1578
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
1579
 
1580
  </form>
1586
  <?php
1587
  if ($subpage == 'main') {
1588
  if (function_exists ('ai_settings_side')) ai_settings_side (); else { ?>
1589
+ <div id="ai-sidebar" style="float: left;">
1590
+ <div class="ai-form header rounded no-select">
1591
  <div style="float: left;">
1592
+ <h2 style="display: inline-block; margin: 7px 0;">Support plugin development</h2>
1593
  </div>
1594
  <div style="float: right;">
1595
+ <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img id="ai-tw" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>twitter.png" style="vertical-align: middle; margin: 0 0 0 20px;" 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
  <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
  }
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