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

Version Description

  • Added filter hooks for ad labels
  • Added support for variables
  • Added support for rotation option index attribute
  • Added shortcodes for block number and block name
  • Few minor bug fixes, cosmetic changes and code improvements
Download this release

Release Info

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

Code changes from version 2.7.14 to 2.7.15

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.7.14
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -17,6 +17,13 @@ Requires PHP: 5.6
17
 
18
  Change Log
19
 
 
 
 
 
 
 
 
20
  Ad Inserter 2.7.14 - 2022-04-28
21
  - Added support for demo settings
22
  - Added support for background transparency
@@ -1504,7 +1511,7 @@ function ai_wp_hook () {
1504
  }
1505
  } else if (isset ($_COOKIE ['AI_WP_DEBUG_BLOCK'])) ai_setcookie ('AI_WP_DEBUG_BLOCK', '', time() - (15 * 60), COOKIEPATH);
1506
 
1507
- if ($ai_wp_data [AI_WP_DEBUGGING] != 0 || isset ($_GET [AI_URL_DEBUG])) {
1508
  ai_disable_caching ();
1509
  }
1510
 
@@ -4320,6 +4327,8 @@ function ai_write_debug_info ($write_processing_log = false) {
4320
  echo "\n";
4321
  }
4322
  echo 'AD LABEL: ', get_ad_label (), "\n";
 
 
4323
  if (defined ('AI_STICKY_SETTINGS') && AI_STICKY_SETTINGS) {
4324
  echo 'MAIN CONTENT: ', get_main_content_element (), "\n";
4325
  }
@@ -4993,6 +5002,14 @@ function ai_check_plugin_options ($plugin_options = array ()) {
4993
  $plugin_options [$last_viewport_width_option_name] = 0;
4994
  }
4995
 
 
 
 
 
 
 
 
 
4996
  for ($hook = 1; $hook <= 20; $hook ++) {
4997
  $hook_enabled_settins_name = 'HOOK_ENABLED_' . $hook;
4998
  $hook_name_settins_name = 'HOOK_NAME_' . $hook;
@@ -5558,6 +5575,13 @@ function get_blocks_sticky () {
5558
  return (($current_flags & AD_FLAGS_BLOCKS_STICKY) != 0);
5559
  }
5560
 
 
 
 
 
 
 
 
5561
  function get_viewport_name ($viewport_number) {
5562
  global $ai_db_options;
5563
 
@@ -5578,6 +5602,24 @@ function get_viewport_width ($viewport_number) {
5578
  return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
5579
  }
5580
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5581
  function get_hook_enabled ($hook_number) {
5582
  global $ai_db_options;
5583
 
@@ -6771,6 +6813,25 @@ function ai_load_settings () {
6771
 
6772
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS START");
6773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6774
  ai_load_options ();
6775
 
6776
  if (!is_array ($ai_db_options)) {
@@ -7520,6 +7581,11 @@ function ai_settings () {
7520
  if (isset ($_POST ['viewport-width-'.$viewport])) $options ['VIEWPORT_WIDTH_'.$viewport] = filter_option ('viewport_width', $_POST ['viewport-width-'.$viewport]);
7521
  }
7522
 
 
 
 
 
 
7523
  for ($hook = 1; $hook <= 20; $hook ++) {
7524
  if (isset ($_POST ['hook-enabled-'.$hook])) $options ['HOOK_ENABLED_'.$hook] = filter_option ('HOOK_ENABLED', $_POST ['hook-enabled-'.$hook]);
7525
  if (isset ($_POST ['hook-name-'.$hook])) $options ['HOOK_NAME_'.$hook] = filter_string_tags ($_POST ['hook-name-'.$hook]);
@@ -8679,17 +8745,28 @@ function ai_process_shortcode (&$block, $atts) {
8679
  "share" => "",
8680
  "time" => "",
8681
  "category" => "",
 
8682
  "tag" => "",
 
8683
  "taxonomy" => "",
 
8684
  "id" => "",
 
8685
  "url" => "",
 
8686
  "url-parameter" => "",
 
8687
  "cookie" => "",
 
8688
  "referrer" => "",
 
8689
  "client" => "",
 
8690
  "scheduling" => "",
8691
  "ip-address" => "",
 
8692
  "country" => "",
 
8693
  ), $atts);
8694
 
8695
 
@@ -8885,16 +8962,38 @@ function ai_process_shortcode (&$block, $atts) {
8885
  }
8886
 
8887
  if ($parameters ['data'] != '') {
 
 
 
 
 
 
 
8888
  if (strpos ($parameters ['data'], ',') !== false) {
8889
  $data_tags = explode (',', $parameters ['data']);
8890
  $data = array ();
8891
  foreach ($data_tags as $data_tag) {
8892
- $data []= replace_ai_tags ('{'.trim ($data_tag).'}');
 
 
 
 
 
 
 
 
 
 
 
 
 
8893
  }
8894
  return implode (', ', $data);
8895
  }
 
8896
  return replace_ai_tags ('{'.$parameters ['data'].'}');
8897
  }
 
8898
  if ($parameters ['counter'] != '') {
8899
  $counter_name = strtolower ($parameters ['counter']);
8900
 
@@ -9065,6 +9164,9 @@ function ai_process_shortcode (&$block, $atts) {
9065
  if (isset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER])) {
9066
  $saved_block_number = $ai_wp_data [AI_CURRENT_BLOCK_NUMBER];
9067
  }
 
 
 
9068
 
9069
  $code = $obj->get_code_for_serverside_insertion (true, false, $code_only);
9070
 
@@ -9095,6 +9197,9 @@ function ai_process_shortcode (&$block, $atts) {
9095
  if (isset ($saved_block_number)) {
9096
  $ai_wp_data [AI_CURRENT_BLOCK_NUMBER] = $saved_block_number;
9097
  } else unset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER]);
 
 
 
9098
 
9099
  // Must be after get_code_for_serverside_insertion ()
9100
  $ai_last_check = AI_CHECK_INSERTED;
@@ -10917,7 +11022,7 @@ function ai_process_viewport_separators ($code, $shortcode_data) {
10917
 
10918
  $ai_code = base64_encode (ai_strip_js_markers ($viewport_code));
10919
 
10920
- $processed_code .= "<div class='{$viewport_classes} {$code_id}' data-insertion='after' data-selector='.{$code_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
10921
  if (!get_disable_js_code ()) {
10922
  // $js_code = "ai_insert_code (document.getElementsByClassName ('$code_id') [0]);";
10923
  $js_code = "ai_insert_code_by_class ('$code_id');";
@@ -11266,6 +11371,10 @@ function replace_ai_tags ($content, $general_tag = '') {
11266
  $ad_data = preg_replace ("/{search_query}/i", $ai_wp_data [AI_TAGS]['SEARCH_QUERY'], $ad_data);
11267
  $ad_data = preg_replace ("/{author_name}/i", $ai_wp_data [AI_TAGS]['AUTHOR_NAME'], $ad_data);
11268
 
 
 
 
 
11269
  $ad_data = preg_replace ("/{url}/i", $ai_wp_data [AI_TAGS]['URL'], $ad_data);
11270
 
11271
  if (preg_match_all ("/{tag-([\d+])}/i", $ad_data, $tag_matches)) {
@@ -11309,6 +11418,29 @@ function replace_ai_tags ($content, $general_tag = '') {
11309
  return $ad_data;
11310
  }
11311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11312
  function ai_php_enabled () {
11313
  $php_enabled = !(defined ('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT) && !(defined ('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS);
11314
  return apply_filters ('ai_php_enabled', $php_enabled);
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.7.15
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
17
 
18
  Change Log
19
 
20
+ Ad Inserter 2.7.15 - 2022-06-01
21
+ - Added filter hooks for ad labels
22
+ - Added support for variables
23
+ - Added support for rotation option index attribute
24
+ - Added shortcodes for block number and block name
25
+ - Few minor bug fixes, cosmetic changes and code improvements
26
+
27
  Ad Inserter 2.7.14 - 2022-04-28
28
  - Added support for demo settings
29
  - Added support for background transparency
1511
  }
1512
  } else if (isset ($_COOKIE ['AI_WP_DEBUG_BLOCK'])) ai_setcookie ('AI_WP_DEBUG_BLOCK', '', time() - (15 * 60), COOKIEPATH);
1513
 
1514
+ if ($ai_wp_data [AI_WP_DEBUGGING] != 0 || isset ($_GET [AI_URL_DEBUG]) || isset ($_GET [AI_URL_DEBUG_BLOCKS]) || isset ($_GET [AI_URL_DEBUG_POSITIONS]) || isset ($_GET [AI_URL_DEBUG_TAGS]) || isset ($_GET [AI_URL_DEBUG_PROCESSING_FE])) {
1515
  ai_disable_caching ();
1516
  }
1517
 
4327
  echo "\n";
4328
  }
4329
  echo 'AD LABEL: ', get_ad_label (), "\n";
4330
+ echo 'AD LABEL HTML CODE: ', trim (ai_ad_label_code (), "\n"), "\n";
4331
+
4332
  if (defined ('AI_STICKY_SETTINGS') && AI_STICKY_SETTINGS) {
4333
  echo 'MAIN CONTENT: ', get_main_content_element (), "\n";
4334
  }
5002
  $plugin_options [$last_viewport_width_option_name] = 0;
5003
  }
5004
 
5005
+ for ($variable = 1; $variable <= 6; $variable ++) {
5006
+ $variable_name_option_name = 'VARIABLE_NAME_' . $variable;
5007
+ $variable_value_option_name = 'VARIABLE_VALUE_' . $variable;
5008
+
5009
+ if (!isset ($plugin_options [$variable_name_option_name])) $plugin_options [$variable_name_option_name] = "";
5010
+ if (!isset ($plugin_options [$variable_value_option_name])) $plugin_options [$variable_value_option_name] = "";
5011
+ }
5012
+
5013
  for ($hook = 1; $hook <= 20; $hook ++) {
5014
  $hook_enabled_settins_name = 'HOOK_ENABLED_' . $hook;
5015
  $hook_name_settins_name = 'HOOK_NAME_' . $hook;
5575
  return (($current_flags & AD_FLAGS_BLOCKS_STICKY) != 0);
5576
  }
5577
 
5578
+ function get_settings_hidden () {
5579
+ if (!function_exists ('ai_block_list_buttons')) return false;
5580
+
5581
+ $current_flags = get_option (AI_FLAGS_NAME, 0);
5582
+ return (($current_flags & AD_FLAGS_SETTINGS_HIDDEN) != 0);
5583
+ }
5584
+
5585
  function get_viewport_name ($viewport_number) {
5586
  global $ai_db_options;
5587
 
5602
  return ($ai_db_options [AI_OPTION_GLOBAL][$viewport_settins_name]);
5603
  }
5604
 
5605
+ function get_variable_name ($variable_number) {
5606
+ global $ai_db_options;
5607
+
5608
+ $variable_settins_name = 'VARIABLE_NAME_' . $variable_number;
5609
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name])) $ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name] = "";
5610
+
5611
+ return ($ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name]);
5612
+ }
5613
+
5614
+ function get_variable_value ($variable_number) {
5615
+ global $ai_db_options;
5616
+
5617
+ $variable_settins_name = 'VARIABLE_VALUE_' . $variable_number;
5618
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name])) $ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name] = "";
5619
+
5620
+ return ($ai_db_options [AI_OPTION_GLOBAL][$variable_settins_name]);
5621
+ }
5622
+
5623
  function get_hook_enabled ($hook_number) {
5624
  global $ai_db_options;
5625
 
6813
 
6814
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS START");
6815
 
6816
+
6817
+
6818
+
6819
+ if (get_option (AI_OPTION_NAME) === false) {
6820
+ $initial_settings = '';
6821
+ $initial_settings = apply_filters ('ai_initial_settings', $initial_settings);
6822
+
6823
+ if (is_string ($initial_settings) && substr ($initial_settings, 0, 4) === ':AI:') {
6824
+ update_option (AI_OPTION_NAME, $initial_settings);
6825
+ }
6826
+
6827
+ elseif (is_array ($initial_settings)) {
6828
+ $ai_db_options = $initial_settings;
6829
+ ai_save_options ($ai_db_options);
6830
+ }
6831
+ }
6832
+
6833
+
6834
+
6835
  ai_load_options ();
6836
 
6837
  if (!is_array ($ai_db_options)) {
7581
  if (isset ($_POST ['viewport-width-'.$viewport])) $options ['VIEWPORT_WIDTH_'.$viewport] = filter_option ('viewport_width', $_POST ['viewport-width-'.$viewport]);
7582
  }
7583
 
7584
+ for ($variable = 1; $variable <= 6; $variable ++) {
7585
+ if (isset ($_POST ['variable-name-'.$variable])) $options ['VARIABLE_NAME_'.$variable] = filter_string ($_POST ['variable-name-'.$variable]);
7586
+ if (isset ($_POST ['variable-value-'.$variable])) $options ['VARIABLE_VALUE_'.$variable] = filter_string ($_POST ['variable-value-'.$variable]);
7587
+ }
7588
+
7589
  for ($hook = 1; $hook <= 20; $hook ++) {
7590
  if (isset ($_POST ['hook-enabled-'.$hook])) $options ['HOOK_ENABLED_'.$hook] = filter_option ('HOOK_ENABLED', $_POST ['hook-enabled-'.$hook]);
7591
  if (isset ($_POST ['hook-name-'.$hook])) $options ['HOOK_NAME_'.$hook] = filter_string_tags ($_POST ['hook-name-'.$hook]);
8745
  "share" => "",
8746
  "time" => "",
8747
  "category" => "",
8748
+ "categories" => "",
8749
  "tag" => "",
8750
+ "tags" => "",
8751
  "taxonomy" => "",
8752
+ "taxonomies" => "",
8753
  "id" => "",
8754
+ "ids" => "",
8755
  "url" => "",
8756
+ "urls" => "",
8757
  "url-parameter" => "",
8758
+ "url-parameters" => "",
8759
  "cookie" => "",
8760
+ "cookies" => "",
8761
  "referrer" => "",
8762
+ "referrers" => "",
8763
  "client" => "",
8764
+ "clients" => "",
8765
  "scheduling" => "",
8766
  "ip-address" => "",
8767
+ "ip-addresses" => "",
8768
  "country" => "",
8769
+ "countries" => "",
8770
  ), $atts);
8771
 
8772
 
8962
  }
8963
 
8964
  if ($parameters ['data'] != '') {
8965
+ for ($variable = 1; $variable <= 6; $variable ++) {
8966
+ $variable_name = trim (get_variable_name ($variable));
8967
+ if ($variable_name != '' && $parameters ['data'] == $variable_name) {
8968
+ return get_variable_value ($variable);
8969
+ }
8970
+ }
8971
+
8972
  if (strpos ($parameters ['data'], ',') !== false) {
8973
  $data_tags = explode (',', $parameters ['data']);
8974
  $data = array ();
8975
  foreach ($data_tags as $data_tag) {
8976
+
8977
+ $variable_found = false;
8978
+ for ($variable = 1; $variable <= 6; $variable ++) {
8979
+ $variable_name = trim (get_variable_name ($variable));
8980
+ if ($variable_name != '' && $data_tag == $variable_name) {
8981
+ $data []= get_variable_value ($variable);
8982
+ $variable_found = true;
8983
+ break;
8984
+ }
8985
+ }
8986
+
8987
+ if (!$variable_found) {
8988
+ $data []= replace_ai_tags ('{'.trim ($data_tag).'}');
8989
+ }
8990
  }
8991
  return implode (', ', $data);
8992
  }
8993
+
8994
  return replace_ai_tags ('{'.$parameters ['data'].'}');
8995
  }
8996
+
8997
  if ($parameters ['counter'] != '') {
8998
  $counter_name = strtolower ($parameters ['counter']);
8999
 
9164
  if (isset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER])) {
9165
  $saved_block_number = $ai_wp_data [AI_CURRENT_BLOCK_NUMBER];
9166
  }
9167
+ if (isset ($ai_wp_data [AI_CURRENT_BLOCK_NAME])) {
9168
+ $saved_block_name = $ai_wp_data [AI_CURRENT_BLOCK_NAME];
9169
+ }
9170
 
9171
  $code = $obj->get_code_for_serverside_insertion (true, false, $code_only);
9172
 
9197
  if (isset ($saved_block_number)) {
9198
  $ai_wp_data [AI_CURRENT_BLOCK_NUMBER] = $saved_block_number;
9199
  } else unset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER]);
9200
+ if (isset ($saved_block_number)) {
9201
+ $ai_wp_data [AI_CURRENT_BLOCK_NAME] = $saved_block_name;
9202
+ } else unset ($ai_wp_data [AI_CURRENT_BLOCK_NAME]);
9203
 
9204
  // Must be after get_code_for_serverside_insertion ()
9205
  $ai_last_check = AI_CHECK_INSERTED;
11022
 
11023
  $ai_code = base64_encode (ai_strip_js_markers ($viewport_code));
11024
 
11025
+ $processed_code .= "<div class='{$viewport_classes} {$code_id}' data-insertion-position='after' data-selector='.{$code_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
11026
  if (!get_disable_js_code ()) {
11027
  // $js_code = "ai_insert_code (document.getElementsByClassName ('$code_id') [0]);";
11028
  $js_code = "ai_insert_code_by_class ('$code_id');";
11371
  $ad_data = preg_replace ("/{search_query}/i", $ai_wp_data [AI_TAGS]['SEARCH_QUERY'], $ad_data);
11372
  $ad_data = preg_replace ("/{author_name}/i", $ai_wp_data [AI_TAGS]['AUTHOR_NAME'], $ad_data);
11373
 
11374
+ $ad_data = preg_replace ("/{block-number}/i", isset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER]) ? $ai_wp_data [AI_CURRENT_BLOCK_NUMBER] : '', $ad_data);
11375
+ $ad_data = preg_replace ("/{block-name}/i", isset ($ai_wp_data [AI_CURRENT_BLOCK_NAME]) ? $ai_wp_data [AI_CURRENT_BLOCK_NAME] : '', $ad_data);
11376
+ $ad_data = preg_replace ("/{block-name-encoded}/i", isset ($ai_wp_data [AI_CURRENT_BLOCK_NAME]) ? urlencode ($ai_wp_data [AI_CURRENT_BLOCK_NAME]) : '', $ad_data);
11377
+
11378
  $ad_data = preg_replace ("/{url}/i", $ai_wp_data [AI_TAGS]['URL'], $ad_data);
11379
 
11380
  if (preg_match_all ("/{tag-([\d+])}/i", $ad_data, $tag_matches)) {
11418
  return $ad_data;
11419
  }
11420
 
11421
+ function ai_ad_label_code () {
11422
+ global $ai_wp_data;
11423
+
11424
+ $ad_label = get_ad_label (true);
11425
+
11426
+ $ad_label = apply_filters ("ai_ad_label", $ad_label);
11427
+
11428
+ if (strpos ($ad_label, '<') === false && strpos ($ad_label, '>') === false) {
11429
+ $ad_label = '<div class="' . get_block_class_name (true) . '-label">' . $ad_label . '</div>';
11430
+ }
11431
+
11432
+ $unfiltered_html = $ai_wp_data [AI_UNFILTERED_HTML];
11433
+ if (defined ('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) {
11434
+ $unfiltered_html = false;
11435
+ }
11436
+
11437
+ if (!$unfiltered_html) {
11438
+ $ad_label = wp_kses ($ad_label, 'post');
11439
+ }
11440
+
11441
+ return $ad_label .= "\n";
11442
+ }
11443
+
11444
  function ai_php_enabled () {
11445
  $php_enabled = !(defined ('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT) && !(defined ('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS);
11446
  return apply_filters ('ai_php_enabled', $php_enabled);
class.php CHANGED
@@ -16,6 +16,7 @@ abstract class ai_BaseCodeBlock {
16
  var $before_w3tc_fallback_code;
17
  var $needs_class;
18
  var $code_version;
 
19
  var $version_name;
20
  var $additional_code_before; // For server-side dynamic PHP code and debugging labels
21
  var $additional_code_after; // For server-side dynamic PHP code and debugging labels
@@ -66,7 +67,7 @@ abstract class ai_BaseCodeBlock {
66
 
67
  var $check_names;
68
  var $count_names;
69
- var $roate_names;
70
  var $viewport_names;
71
  var $fallback_names;
72
 
@@ -97,6 +98,7 @@ abstract class ai_BaseCodeBlock {
97
  $this->before_w3tc_fallback_code = '';
98
  $this->needs_class = false;
99
  $this->code_version = 0;
 
100
  $this->version_name = '';
101
  $this->additional_code_before = '';
102
  $this->additional_code_after = '';
@@ -126,7 +128,7 @@ abstract class ai_BaseCodeBlock {
126
 
127
  $this->check_names = null;
128
  $this->count_names = null;
129
- $this->roate_names = null;
130
  $this->viewport_names = null;
131
  $this->fallback_names = null;
132
 
@@ -2604,21 +2606,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2604
 
2605
  if (!$label_enabled) return '';
2606
 
2607
- $ad_label = get_ad_label (true);
2608
- if (strpos ($ad_label, '<') === false && strpos ($ad_label, '>') === false) {
2609
- $ad_label = '<div class="' . get_block_class_name (true) . '-label">' . $ad_label . '</div>';
2610
- }
2611
 
2612
- $unfiltered_html = $ai_wp_data [AI_UNFILTERED_HTML];
2613
- if (defined ('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) {
2614
- $unfiltered_html = false;
2615
- }
2616
 
2617
- if (!$unfiltered_html) {
2618
- $ad_label = wp_kses ($ad_label, 'post');
2619
- }
2620
-
2621
- return $ad_label .= "\n";
2622
  }
2623
 
2624
  public function ai_generateDebugLabel ($class = '', $title = '') {
@@ -2956,6 +2948,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2956
  }
2957
  }
2958
 
 
2959
  if ($viewport_classes == '') {
2960
  if ($viewport_parameters [$viewport_code_index]['viewport'] != '') {
2961
  // Invalid viewport - Code will never be inserted
@@ -2967,7 +2960,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2967
  $code_id = 'ai-viewport-code-' . rand (1000, 9999) . rand (1000, 9999);
2968
 
2969
  $ai_dbg_code = base64_encode ($invisible_label);
2970
- $processed_code .= "<div class='{$code_id}-dbg' data-insertion='after' data-selector='.{$code_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
2971
  $js_code = "ai_insert_code_by_class ('{$code_id}-dbg');";
2972
  $processed_code .= $this->ai_js_dom_ready ($js_code);
2973
  }
@@ -3013,6 +3006,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3013
  $viewport_code = $debug_viewport->bar ($viewport_text, '', _x('VISIBLE', 'Block', 'ad-inserter'), '&nbsp;') . $viewport_code;
3014
  }
3015
 
 
 
 
 
 
 
3016
  if ($insert_code) {
3017
  $code_id = 'ai-viewport-code-' . rand (1000, 9999) . rand (1000, 9999);
3018
 
@@ -3029,7 +3028,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3029
  // $style_attribute = " data-css='" . $viewport_parameters [$viewport_code_index]['css'] . "'";
3030
  }
3031
 
3032
- $processed_code .= "<div class='{$viewport_classes} {$code_id}'{$style_attribute} data-insertion='after' data-selector='.{$code_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
3033
  if (!get_disable_js_code ()) {
3034
  $js_code = "ai_insert_viewport_code ('$code_id');";
3035
 
@@ -3040,7 +3039,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3040
  $invisible_viewport_classes = 'ai-viewports ' . $invisible_viewport_classes . ' ';
3041
  }
3042
  $ai_dbg_code = base64_encode ($invisible_label);
3043
- $processed_code .= "<div class='$invisible_viewport_classes {$code_id}-dbg' data-insertion='after' data-selector='.{$code_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
3044
  $js_code = "ai_insert_code_by_class ('{$code_id}-dbg');";
3045
  $processed_code .= $this->ai_js_dom_ready ($js_code);
3046
  }
@@ -3125,6 +3124,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3125
  $this->w3tc_code = '';
3126
  $this->w3tc_debug = array ();
3127
  $this->no_insertion_text = '';
 
3128
 
3129
  $not_iframe_or_inside = !$this->get_iframe () || $ai_wp_data [AI_CODE_FOR_IFRAME];
3130
 
@@ -3402,10 +3402,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3402
  unset ($ai_wp_data [AI_SHORTCODES]['viewport']);
3403
 
3404
  $ai_wp_data [AI_CURRENT_BLOCK_NUMBER] = $this->number;
 
3405
 
3406
- // $code = $this->replace_ai_tags (do_shortcode ($this->ai_getCode (), true)); // Does not expand shortcodes inside HTML <div id='div-gpt-ad-1234567890-[ADINSERTER counter="block"]'>
3407
- // $ai_code = do_shortcode ($this->ai_getCode (), true); // Does not expand shortcodes inside HTML <div id='div-gpt-ad-1234567890-[ADINSERTER counter="block"]'>
3408
- // $ai_code = str_replace ('<', '<ad-inserter-dummy-tag>', $ai_code); // Causes issues with [su_list] shortcodes
3409
  $ai_code = $this->ai_getCode ();
3410
 
3411
  $replace_embed = false;
@@ -3423,9 +3421,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3423
  $code = $GLOBALS[ 'wp_embed']->run_shortcode ($code);
3424
  }
3425
 
3426
- // $code = str_replace ('<ad-inserter-dummy-tag>', '<', $code);
3427
-
3428
  unset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER]);
 
3429
 
3430
  if (isset ($ai_wp_data [AI_SHORTCODES])) {
3431
  $this->shortcodes = $ai_wp_data [AI_SHORTCODES];
@@ -3447,6 +3444,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3447
 
3448
  if (function_exists ('ai_check_separators')) {
3449
  $processed_code = ai_check_separators ($this, $processed_code);
 
3450
  if ($this->check_code_empty && $processed_code == '') {
3451
  return '';
3452
  }
@@ -3534,16 +3532,19 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3534
  // first option with index 0 is always inserted
3535
  // first check option has index 1
3536
  $this->code_version = isset ($this->check_codes_data [$this->check_codes_index]['index']) && trim ($this->check_codes_data [$this->check_codes_index]['index']) != '' ? (int) $this->check_codes_data [$this->check_codes_index]['index'] : $this->check_codes_index;
 
3537
  $this->version_name = isset ($this->check_codes_data [$this->check_codes_index]['name']) ? $this->check_codes_data [$this->check_codes_index]['name'] : '';
3538
  } else {
3539
- // first check option has index 0
3540
  $this->code_version = isset ($this->check_codes_data [$this->check_codes_index]['index']) && trim ($this->check_codes_data [$this->check_codes_index]['index']) != '' ? (int) $this->check_codes_data [$this->check_codes_index]['index'] : $this->check_codes_index + 1;
 
3541
  $this->version_name = isset ($this->check_codes_data [$this->check_codes_index]['name']) ? $this->check_codes_data [$this->check_codes_index]['name'] : '';
3542
  }
3543
 
3544
  } else {
3545
  // Clear for ROTATE in case of multiple block insertions (CHECK separator)
3546
  $this->code_version = 0;
 
3547
  $this->version_name = '';
3548
  }
3549
 
@@ -3589,12 +3590,16 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3589
  $groups = false;
3590
  $unique = false;
3591
  $version_names = array ();
 
3592
  $version_shares = array ();
3593
  $version_times = array ();
3594
  $version_scheduling = array ();
3595
  $version_groups = array ();
3596
 
3597
  foreach ($rotate_parameters as $index => $option) {
 
 
 
3598
  if ((isset ($option ['group']) && trim ($option ['group']) != '') || $groups) {
3599
  $groups = true;
3600
  $shares = false;
@@ -3652,7 +3657,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3652
  $ai_wp_data [AI_ROTATION_SEED] = mt_rand (1, time ()) % count ($ads);
3653
  }
3654
 
3655
- $this->roate_names = $version_names;
3656
 
3657
  if ($groups) {
3658
  // Clear in case there were mixed rotate options
@@ -3816,7 +3821,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3816
 
3817
  if ($this->code_version != 0) {
3818
  $processed_code = trim ($ads [$this->code_version - 1]);
3819
- $this->version_name = $version_names [$this->code_version - 1];
 
3820
  }
3821
 
3822
  if (preg_match ($groups_marker, $processed_code, $matches)) {
@@ -3839,7 +3845,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3839
 
3840
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
3841
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
3842
- $this->code_version = '""';
 
3843
 
3844
  $rotation_data = '';
3845
  if ($shares) {
@@ -3928,7 +3935,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3928
  $ad = preg_replace ("#(<span data-ai-groups=\"[^\"]+?\"></span>)#", '$1' . $debug_list->bar (__('ACTIVE GROUPS', 'ad-inserter') . ': ' . $current_group_name, '', ''), $ad);
3929
  }
3930
 
3931
- $version_name_data = ' data-name="'.base64_encode ($version_names [$index]).'"';
 
3932
  $version_time_data = $version_times [$index] >= 0 ? ' data-time="'.base64_encode ($version_times [$index]).'"' : '';
3933
  $version_scheduling_data = $version_scheduling [$index] != - 1 ? ' data-scheduling="'.base64_encode ($version_scheduling [$index]).'"' : '';
3934
  $version_group_data = $groups ? ' data-group="'.base64_encode ($version_groups [$index]).'"' : '';
@@ -3938,21 +3946,21 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3938
  switch ($index) {
3939
  case 0:
3940
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
3941
- $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden'".$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3942
  } else
3943
- $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3944
  break;
3945
  default:
3946
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
3947
- $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden ai-rotate-hidden-2'".$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3948
  } else
3949
- $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3950
  break;
3951
  }
3952
  break;
3953
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
3954
  $version_code_data = ' data-code="'.base64_encode (ai_strip_js_markers ($ad)).'"';
3955
- $processed_code .= '<div class="ai-rotate-option"'.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.$version_code_data.">\n</div>\n";
3956
  break;
3957
  }
3958
 
@@ -4002,6 +4010,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4002
 
4003
  $this->w3tc_code .= ' if ($ai_index != 0) {$ai_dummy1 = $ai_dummy2 = null; $ai_code = ai_w3tc_execute_php ($ai_code [$ai_index - 1], $ai_dummy1, $ai_dummy2); $ai_enabled = true;} else {$ai_code = \'\'; $ai_enabled = false;}';
4004
 
 
 
 
 
 
 
 
4005
  $this->w3tc_code .= ' if ($ai_enabled) {$groups_marker = base64_decode (\'' . base64_encode ($groups_marker) .
4006
  '\'); global $ai_groups; if (preg_match ($groups_marker, $ai_code, $matches)) {$ai_groups = json_decode (base64_decode ($matches [1])); $ai_code = preg_replace ($groups_marker, \'\', $ai_code);}}';
4007
 
@@ -4356,7 +4371,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4356
  $fallback_code_data = " data-fallback-code='" . base64_encode ($fallback_code) . "'";
4357
 
4358
  $fallback_tracking_block = $fallback_obj->get_tracking () ? $fallback_obj->number : 0;
4359
- $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->code_version},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
 
4360
 
4361
  $ad_inserter_globals [$globals_name] --;
4362
  }
@@ -4532,7 +4548,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4532
  } else $w3tc_fallback_status = '';
4533
 
4534
 
4535
-
4536
  if ($fallback_obj->get_tracking ()) {
4537
  $fallback_tracking_block = $fallback_block;
4538
  } else $fallback_tracking_block = '0';
@@ -4758,6 +4773,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4758
 
4759
  $viewports_code = true;
4760
 
 
 
 
 
 
 
 
 
 
 
 
4761
  if ($dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) {
4762
  $class_id = 'ai-insert-' . $this->number . '-' . rand (1000, 9999) . rand (1000, 9999);
4763
 
@@ -4767,7 +4793,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4767
 
4768
  $ai_code = $this->base64_encode_w3tc (ai_strip_w3tc_markers ($processed_code), false); // Use W3TC code in case W3TC was used before and insert was specified for CHECK
4769
 
4770
- $processed_code = "<div class='{$viewport_classes} {$class_id}' data-insertion='after' data-selector='.{$class_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
4771
 
4772
  if (!get_disable_js_code ()) {
4773
  $js_code = "ai_insert_list_code ('{$class_id}');";
@@ -4779,7 +4805,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4779
  $invisible_viewport_classes = 'ai-viewports ' . $invisible_viewport_classes . ' ';
4780
  }
4781
  $ai_dbg_code = base64_encode ($invisible_label);
4782
- $processed_code .= "<div class='{$invisible_viewport_classes} {$class_id}-dbg' data-insertion='after' data-selector='.{$class_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
4783
  $js_code = "ai_insert_code_by_class ('{$class_id}-dbg');";
4784
  $processed_code .= $this->ai_js_dom_ready ($js_code);
4785
  }
@@ -4872,7 +4898,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4872
  $fallback_code = $fallback_obj->ai_getProcessedCode ();
4873
 
4874
  $fallback_tracking_block = $fallback_obj->get_tracking () ? $fallback_obj->number : 0;
4875
- $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->code_version},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
 
4876
 
4877
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
4878
  $debug_fallback = new ai_block_labels ('ai-debug-fallback');
@@ -4896,7 +4923,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4896
 
4897
  $processed_code =
4898
  $debug_html_code .
4899
- "<div class='no-visibility-check ai-check-{$block_id}' data-insertion='after' data-selector='.ai-check-{$block_id}' data-code='" .
4900
  base64_encode (ai_strip_w3tc_markers (ai_strip_js_markers ($processed_code))) .
4901
  "'{$fallback_data} data-block='{$this->number}'>{$ai_check_block_html_code}</div>\n";
4902
 
@@ -5092,7 +5119,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5092
  } // ai_getProcessedCode
5093
 
5094
  public function get_code_for_single_insertion ($include_viewport_classes = true, $hidden_widgets = false, $code_only = false) {
5095
- global $ai_wp_data, $block_object, $ad_inserter_globals, $ai_total_hook_php_time, $filter_hooks;
5096
 
5097
  if ($this->get_disable_caching ()) $ai_wp_data [AI_DISABLE_CACHING] = true;
5098
 
@@ -5232,7 +5259,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5232
  $block_counter = isset ($ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $block_object [$this->fallback]->number]) ? $ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $block_object [$this->fallback]->number] : 0;
5233
 
5234
  $tracking_code_pre = " data-ai='";
5235
- $tracking_code_data = "[{$this->fallback},{$this->code_version},\"{$block_object [$this->fallback]->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
 
5236
  $tracking_code_post = "'";
5237
 
5238
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
@@ -5244,7 +5272,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5244
  $block_counter = isset ($ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number]) ? $ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number] : 0;
5245
 
5246
  $tracking_code_pre = " data-ai='";
5247
- $tracking_code_data = "[{$this->number},{$this->code_version},\"{$this->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
 
5248
  $tracking_code_post = "'";
5249
 
5250
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
@@ -5296,8 +5325,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5296
  $wrapper_before .= $this->additional_code_before;
5297
  $wrapper_after = $this->additional_code_after . $wrapper_after;
5298
 
5299
- $this->w3tc_code .= ' if (!isset ($ai_fallback)) $ai_fallback = null; if (!isset ($ai_index)) $ai_index = ' . $this->code_version . ';';
5300
- $this->w3tc_code .= ' if ($ai_fallback === null) $ai_tracking_data = \'['.$tracking_block.',\'.$ai_index.\']\'; else $ai_tracking_data = \'[\'.$ai_fallback.\',\'.$ai_index.\']\';';
 
 
 
 
 
5301
  $this->w3tc_code .= ' $ai_code = str_replace (\'[#AI_DATA#]\', base64_encode ($ai_tracking_data), base64_decode (\''.base64_encode ($wrapper_before).'\')) . $ai_code . base64_decode (\''.$this->base64_encode_w3tc ($wrapper_after, false).'\');';
5302
 
5303
  // Process W3TC filter hook
@@ -5379,15 +5413,18 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5379
 
5380
  $check_options ++;
5381
  if ($this->w3tc_code != '') {
 
 
 
5382
  $w3tc_options = true;
5383
  $w3tc_code = $this->w3tc_code;
5384
  } else {
5385
  // Gnerate W3TC code if W3TC was not used for the option
5386
- $w3tc_code = '$ai_code = base64_decode (\''.base64_encode ($code).'\'); $ai_enabled = true;';
5387
  }
5388
 
5389
  // $w3tc_codes will be used only if any of the options uses W3TC
5390
- $w3tc_codes .= $w3tc_code . ' if (!isset ($ai_check_code)) $ai_check_code = \'\'; $ai_check_code .= $ai_code;';
5391
 
5392
  $code .= $code_for_single_insertion;
5393
  } while (is_array ($this->check_codes) && isset ($this->check_codes [$this->check_codes_index + 1]));
@@ -5481,6 +5518,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5481
  $viewports_insertion = $this->get_detection_client_side() && $this->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT;
5482
  $server_side_html_insertion = $this->get_html_element_insertion () == AI_HTML_INSERTION_SEREVR_SIDE;
5483
 
 
 
 
 
 
 
 
 
5484
  $insertion_name = '';
5485
  switch ($this->get_automatic_insertion()) {
5486
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
@@ -5533,13 +5578,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5533
  if ($viewports_insertion && !$html_element_insertion) {
5534
  $block_code = $this->base64_encode_w3tc (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
5535
  $selector = $this->get_viewport_names ();
5536
- $viewport_classes = trim ($this->get_viewport_classes ());
5537
 
5538
  $style_attribute = "style='" . $this->get_alignment_style () . "'";
5539
 
5540
- // $serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' {$style_attribute} data-insertion='after' data-selector='.{$block_id}' data-insertion-no-dbg data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
5541
  // Insert inside to prevent CLS
5542
- $serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' {$style_attribute} data-insertion='prepend' data-selector='.{$block_id}' data-insertion-no-dbg data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
5543
  if (!get_disable_js_code ()) {
5544
  $js_code = "ai_insert_viewport_code ('$block_id');";
5545
 
@@ -5550,9 +5594,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5550
  $this->counters = '<span class="ai-selector-counter"></span>';
5551
  $block_code = $this->base64_encode_w3tc (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
5552
  $selector = trim ($this->get_html_selector (true));
5553
- $viewport_classes = trim ($this->get_viewport_classes ());
5554
 
5555
- $serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' data-insertion='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
5556
  if (!empty ($selector) && !get_disable_js_code ()) {
5557
  // Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
5558
  $js_code = "ai_insert_viewport_code ('$block_id');";
@@ -5600,24 +5644,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5600
  // Check to replace " with \'
5601
  $this->w3tc_code .= ' $ai_code = str_replace ("[#AI_CODE#]", base64_encode ($ai_code), base64_decode ("'. base64_encode (ai_strip_js_markers ($serverside_insertion_code)) . '"));';
5602
 
5603
- // $serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5604
- // $serverside_insertion_code .= $this->w3tc_code.' if ($ai_enabled) echo $ai_code;';
5605
- // $serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5606
-
5607
  $serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' ';
5608
  $serverside_insertion_code .= $this->w3tc_code.' if ($ai_enabled) echo $ai_code;';
5609
  $serverside_insertion_code .= ' --><!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5610
 
5611
  } else {
5612
- // if ($this->w3tc_fallback_code != '' && $dynamic_blocks_w3tc) {
5613
- // $this->w3tc_fallback_code .= ' $ai_code = str_replace ("[#AI_CODE2#]", $ai_enabled ? $ai_code : "", base64_decode ("'. base64_encode ($this->before_w3tc_fallback_code) . '"));';
5614
- // $this->w3tc_fallback_code .= ' $ai_code = str_replace ("[#AI_CODE#]", base64_encode ($ai_code), base64_decode ("'. base64_encode ($serverside_insertion_code) . '"));';
5615
-
5616
- // $serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5617
- // $serverside_insertion_code .= $this->w3tc_fallback_code .' echo $ai_code;';
5618
- // $serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5619
- // } else
5620
-
5621
  $serverside_insertion_code = str_replace ('[#AI_CODE#]', $block_code, $serverside_insertion_code);
5622
  }
5623
 
16
  var $before_w3tc_fallback_code;
17
  var $needs_class;
18
  var $code_version;
19
+ var $tracking_index;
20
  var $version_name;
21
  var $additional_code_before; // For server-side dynamic PHP code and debugging labels
22
  var $additional_code_after; // For server-side dynamic PHP code and debugging labels
67
 
68
  var $check_names;
69
  var $count_names;
70
+ var $rotate_names;
71
  var $viewport_names;
72
  var $fallback_names;
73
 
98
  $this->before_w3tc_fallback_code = '';
99
  $this->needs_class = false;
100
  $this->code_version = 0;
101
+ $this->tracking_index = 0;
102
  $this->version_name = '';
103
  $this->additional_code_before = '';
104
  $this->additional_code_after = '';
128
 
129
  $this->check_names = null;
130
  $this->count_names = null;
131
+ $this->rotate_names = null;
132
  $this->viewport_names = null;
133
  $this->fallback_names = null;
134
 
2606
 
2607
  if (!$label_enabled) return '';
2608
 
2609
+ $label_code = ai_ad_label_code ();
 
 
 
2610
 
2611
+ $label_code = apply_filters ("ai_block_ad_label", $label_code, $this->number);
 
 
 
2612
 
2613
+ return $label_code;
 
 
 
 
2614
  }
2615
 
2616
  public function ai_generateDebugLabel ($class = '', $title = '') {
2948
  }
2949
  }
2950
 
2951
+
2952
  if ($viewport_classes == '') {
2953
  if ($viewport_parameters [$viewport_code_index]['viewport'] != '') {
2954
  // Invalid viewport - Code will never be inserted
2960
  $code_id = 'ai-viewport-code-' . rand (1000, 9999) . rand (1000, 9999);
2961
 
2962
  $ai_dbg_code = base64_encode ($invisible_label);
2963
+ $processed_code .= "<div class='{$code_id}-dbg' data-insertion-position='after' data-selector='.{$code_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
2964
  $js_code = "ai_insert_code_by_class ('{$code_id}-dbg');";
2965
  $processed_code .= $this->ai_js_dom_ready ($js_code);
2966
  }
3006
  $viewport_code = $debug_viewport->bar ($viewport_text, '', _x('VISIBLE', 'Block', 'ad-inserter'), '&nbsp;') . $viewport_code;
3007
  }
3008
 
3009
+
3010
+ // All viewports selected
3011
+ if ($invisible_viewport_classes == '') {
3012
+ $processed_code .= $viewport_code;
3013
+ } else
3014
+
3015
  if ($insert_code) {
3016
  $code_id = 'ai-viewport-code-' . rand (1000, 9999) . rand (1000, 9999);
3017
 
3028
  // $style_attribute = " data-css='" . $viewport_parameters [$viewport_code_index]['css'] . "'";
3029
  }
3030
 
3031
+ $processed_code .= "<div class='{$viewport_classes} {$code_id}'{$style_attribute} data-insertion-position='after' data-selector='.{$code_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
3032
  if (!get_disable_js_code ()) {
3033
  $js_code = "ai_insert_viewport_code ('$code_id');";
3034
 
3039
  $invisible_viewport_classes = 'ai-viewports ' . $invisible_viewport_classes . ' ';
3040
  }
3041
  $ai_dbg_code = base64_encode ($invisible_label);
3042
+ $processed_code .= "<div class='$invisible_viewport_classes {$code_id}-dbg' data-insertion-position='after' data-selector='.{$code_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
3043
  $js_code = "ai_insert_code_by_class ('{$code_id}-dbg');";
3044
  $processed_code .= $this->ai_js_dom_ready ($js_code);
3045
  }
3124
  $this->w3tc_code = '';
3125
  $this->w3tc_debug = array ();
3126
  $this->no_insertion_text = '';
3127
+ $this->rotate_names = null;
3128
 
3129
  $not_iframe_or_inside = !$this->get_iframe () || $ai_wp_data [AI_CODE_FOR_IFRAME];
3130
 
3402
  unset ($ai_wp_data [AI_SHORTCODES]['viewport']);
3403
 
3404
  $ai_wp_data [AI_CURRENT_BLOCK_NUMBER] = $this->number;
3405
+ $ai_wp_data [AI_CURRENT_BLOCK_NAME] = $this->get_ad_name ();
3406
 
 
 
 
3407
  $ai_code = $this->ai_getCode ();
3408
 
3409
  $replace_embed = false;
3421
  $code = $GLOBALS[ 'wp_embed']->run_shortcode ($code);
3422
  }
3423
 
 
 
3424
  unset ($ai_wp_data [AI_CURRENT_BLOCK_NUMBER]);
3425
+ unset ($ai_wp_data [AI_CURRENT_BLOCK_NAME]);
3426
 
3427
  if (isset ($ai_wp_data [AI_SHORTCODES])) {
3428
  $this->shortcodes = $ai_wp_data [AI_SHORTCODES];
3444
 
3445
  if (function_exists ('ai_check_separators')) {
3446
  $processed_code = ai_check_separators ($this, $processed_code);
3447
+
3448
  if ($this->check_code_empty && $processed_code == '') {
3449
  return '';
3450
  }
3532
  // first option with index 0 is always inserted
3533
  // first check option has index 1
3534
  $this->code_version = isset ($this->check_codes_data [$this->check_codes_index]['index']) && trim ($this->check_codes_data [$this->check_codes_index]['index']) != '' ? (int) $this->check_codes_data [$this->check_codes_index]['index'] : $this->check_codes_index;
3535
+ $this->tracking_index = $this->code_version;
3536
  $this->version_name = isset ($this->check_codes_data [$this->check_codes_index]['name']) ? $this->check_codes_data [$this->check_codes_index]['name'] : '';
3537
  } else {
3538
+ // first check option has index 0 => 1
3539
  $this->code_version = isset ($this->check_codes_data [$this->check_codes_index]['index']) && trim ($this->check_codes_data [$this->check_codes_index]['index']) != '' ? (int) $this->check_codes_data [$this->check_codes_index]['index'] : $this->check_codes_index + 1;
3540
+ $this->tracking_index = $this->code_version;
3541
  $this->version_name = isset ($this->check_codes_data [$this->check_codes_index]['name']) ? $this->check_codes_data [$this->check_codes_index]['name'] : '';
3542
  }
3543
 
3544
  } else {
3545
  // Clear for ROTATE in case of multiple block insertions (CHECK separator)
3546
  $this->code_version = 0;
3547
+ $this->tracking_index = 0;
3548
  $this->version_name = '';
3549
  }
3550
 
3590
  $groups = false;
3591
  $unique = false;
3592
  $version_names = array ();
3593
+ $tracking_indexes = array ();
3594
  $version_shares = array ();
3595
  $version_times = array ();
3596
  $version_scheduling = array ();
3597
  $version_groups = array ();
3598
 
3599
  foreach ($rotate_parameters as $index => $option) {
3600
+
3601
+ $tracking_indexes []= isset ($option ['index']) && trim ($option ['index']) != '' ? (int) $option ['index'] : $index + 1;
3602
+
3603
  if ((isset ($option ['group']) && trim ($option ['group']) != '') || $groups) {
3604
  $groups = true;
3605
  $shares = false;
3657
  $ai_wp_data [AI_ROTATION_SEED] = mt_rand (1, time ()) % count ($ads);
3658
  }
3659
 
3660
+ $this->rotate_names = $version_names;
3661
 
3662
  if ($groups) {
3663
  // Clear in case there were mixed rotate options
3821
 
3822
  if ($this->code_version != 0) {
3823
  $processed_code = trim ($ads [$this->code_version - 1]);
3824
+ $this->tracking_index = $tracking_indexes [$this->code_version - 1];
3825
+ $this->version_name = $version_names [$this->code_version - 1];
3826
  }
3827
 
3828
  if (preg_match ($groups_marker, $processed_code, $matches)) {
3845
 
3846
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
3847
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
3848
+ $this->code_version = '""';
3849
+ $this->tracking_index = '""';
3850
 
3851
  $rotation_data = '';
3852
  if ($shares) {
3935
  $ad = preg_replace ("#(<span data-ai-groups=\"[^\"]+?\"></span>)#", '$1' . $debug_list->bar (__('ACTIVE GROUPS', 'ad-inserter') . ': ' . $current_group_name, '', ''), $ad);
3936
  }
3937
 
3938
+ $tracking_index_data = ' data-index="'.$tracking_indexes [$index].'"';
3939
+ $version_name_data = ' data-name="' .base64_encode ($version_names [$index]).'"';
3940
  $version_time_data = $version_times [$index] >= 0 ? ' data-time="'.base64_encode ($version_times [$index]).'"' : '';
3941
  $version_scheduling_data = $version_scheduling [$index] != - 1 ? ' data-scheduling="'.base64_encode ($version_scheduling [$index]).'"' : '';
3942
  $version_group_data = $groups ? ' data-group="'.base64_encode ($version_groups [$index]).'"' : '';
3946
  switch ($index) {
3947
  case 0:
3948
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
3949
+ $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden'".$tracking_index_data.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3950
  } else
3951
+ $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$tracking_index_data.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3952
  break;
3953
  default:
3954
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
3955
+ $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden ai-rotate-hidden-2'".$tracking_index_data.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3956
  } else
3957
+ $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$tracking_index_data.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.">\n".trim ($ad, "\n\r")."</div>\n";
3958
  break;
3959
  }
3960
  break;
3961
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
3962
  $version_code_data = ' data-code="'.base64_encode (ai_strip_js_markers ($ad)).'"';
3963
+ $processed_code .= '<div class="ai-rotate-option"'.$tracking_index_data.$version_name_data.$version_time_data.$version_scheduling_data.$version_group_data.$version_code_data.">\n</div>\n";
3964
  break;
3965
  }
3966
 
4010
 
4011
  $this->w3tc_code .= ' if ($ai_index != 0) {$ai_dummy1 = $ai_dummy2 = null; $ai_code = ai_w3tc_execute_php ($ai_code [$ai_index - 1], $ai_dummy1, $ai_dummy2); $ai_enabled = true;} else {$ai_code = \'\'; $ai_enabled = false;}';
4012
 
4013
+ // Set $ai_version_name according to $ai_index and and $ai_index to the index for tracking
4014
+ $this->w3tc_code .= ' if ($ai_index != 0) {$version_names = unserialize (base64_decode (\''.base64_encode (serialize ($this->rotate_names)).'\')); $ai_version_name = $version_names [$ai_index - 1]; $tracking_indexes = unserialize (base64_decode (\''.base64_encode (serialize ($tracking_indexes)).'\')); $ai_index = $tracking_indexes [$ai_index - 1];';
4015
+ if ($ai_wp_data [AI_W3TC_DEBUGGING]) {
4016
+ $this->w3tc_code .= ' ai_w3tc_log_run (\'TRACKING INDEX: \' . $ai_index . (isset ($ai_version_name) ? \' [\'.$ai_version_name.\']\' : \'\'));';
4017
+ }
4018
+ $this->w3tc_code .= '}';
4019
+
4020
  $this->w3tc_code .= ' if ($ai_enabled) {$groups_marker = base64_decode (\'' . base64_encode ($groups_marker) .
4021
  '\'); global $ai_groups; if (preg_match ($groups_marker, $ai_code, $matches)) {$ai_groups = json_decode (base64_decode ($matches [1])); $ai_code = preg_replace ($groups_marker, \'\', $ai_code);}}';
4022
 
4371
  $fallback_code_data = " data-fallback-code='" . base64_encode ($fallback_code) . "'";
4372
 
4373
  $fallback_tracking_block = $fallback_obj->get_tracking () ? $fallback_obj->number : 0;
4374
+ // $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->code_version},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
4375
+ $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->tracking_index},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
4376
 
4377
  $ad_inserter_globals [$globals_name] --;
4378
  }
4548
  } else $w3tc_fallback_status = '';
4549
 
4550
 
 
4551
  if ($fallback_obj->get_tracking ()) {
4552
  $fallback_tracking_block = $fallback_block;
4553
  } else $fallback_tracking_block = '0';
4773
 
4774
  $viewports_code = true;
4775
 
4776
+
4777
+ // All viewports selected
4778
+ if ($viewport_classes == '' && $invisible_viewport_classes == 'ai-viewport-0') {
4779
+ // $processed_code already contains code for isnertion
4780
+ } else
4781
+ // No viewport selected
4782
+ if ($viewport_classes == 'ai-viewport-0' && $invisible_viewport_classes == '') {
4783
+ $processed_code = $invisible_label;
4784
+ } else
4785
+
4786
+
4787
  if ($dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) {
4788
  $class_id = 'ai-insert-' . $this->number . '-' . rand (1000, 9999) . rand (1000, 9999);
4789
 
4793
 
4794
  $ai_code = $this->base64_encode_w3tc (ai_strip_w3tc_markers ($processed_code), false); // Use W3TC code in case W3TC was used before and insert was specified for CHECK
4795
 
4796
+ $processed_code = "<div class='{$viewport_classes} {$class_id}' data-insertion-position='after' data-selector='.{$class_id}' data-insertion-no-dbg data-code='$ai_code'></div>\n";
4797
 
4798
  if (!get_disable_js_code ()) {
4799
  $js_code = "ai_insert_list_code ('{$class_id}');";
4805
  $invisible_viewport_classes = 'ai-viewports ' . $invisible_viewport_classes . ' ';
4806
  }
4807
  $ai_dbg_code = base64_encode ($invisible_label);
4808
+ $processed_code .= "<div class='{$invisible_viewport_classes} {$class_id}-dbg' data-insertion-position='after' data-selector='.{$class_id}-dbg' data-insertion-no-dbg data-code='$ai_dbg_code'></div>\n";
4809
  $js_code = "ai_insert_code_by_class ('{$class_id}-dbg');";
4810
  $processed_code .= $this->ai_js_dom_ready ($js_code);
4811
  }
4898
  $fallback_code = $fallback_obj->ai_getProcessedCode ();
4899
 
4900
  $fallback_tracking_block = $fallback_obj->get_tracking () ? $fallback_obj->number : 0;
4901
+ // $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->code_version},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
4902
+ $fallback_tracking_data = base64_encode ("[{$fallback_tracking_block},{$fallback_obj->tracking_index},\"{$fallback_obj->get_ad_name ()}\",\"{$fallback_obj->version_name}\"]");
4903
 
4904
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
4905
  $debug_fallback = new ai_block_labels ('ai-debug-fallback');
4923
 
4924
  $processed_code =
4925
  $debug_html_code .
4926
+ "<div class='no-visibility-check ai-check-{$block_id}' data-insertion-position='after' data-selector='.ai-check-{$block_id}' data-code='" .
4927
  base64_encode (ai_strip_w3tc_markers (ai_strip_js_markers ($processed_code))) .
4928
  "'{$fallback_data} data-block='{$this->number}'>{$ai_check_block_html_code}</div>\n";
4929
 
5119
  } // ai_getProcessedCode
5120
 
5121
  public function get_code_for_single_insertion ($include_viewport_classes = true, $hidden_widgets = false, $code_only = false) {
5122
+ global $ai_wp_data, $block_object, $ad_inserter_globals, $ai_total_hook_php_time, $filter_hooks, $version_names;
5123
 
5124
  if ($this->get_disable_caching ()) $ai_wp_data [AI_DISABLE_CACHING] = true;
5125
 
5259
  $block_counter = isset ($ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $block_object [$this->fallback]->number]) ? $ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $block_object [$this->fallback]->number] : 0;
5260
 
5261
  $tracking_code_pre = " data-ai='";
5262
+ // $tracking_code_data = "[{$this->fallback},{$this->code_version},\"{$block_object [$this->fallback]->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
5263
+ $tracking_code_data = "[{$this->fallback},{$this->tracking_index},\"{$block_object [$this->fallback]->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
5264
  $tracking_code_post = "'";
5265
 
5266
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
5272
  $block_counter = isset ($ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number]) ? $ad_inserter_globals [AI_BLOCK_COUNTER_NAME . $this->number] : 0;
5273
 
5274
  $tracking_code_pre = " data-ai='";
5275
+ // $tracking_code_data = "[{$this->number},{$this->code_version},\"{$this->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
5276
+ $tracking_code_data = "[{$this->number},{$this->tracking_index},\"{$this->get_ad_name ()}\",\"{$this->version_name}\",{$block_counter}]";
5277
  $tracking_code_post = "'";
5278
 
5279
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
5325
  $wrapper_before .= $this->additional_code_before;
5326
  $wrapper_after = $this->additional_code_after . $wrapper_after;
5327
 
5328
+ // $this->w3tc_code .= ' if (!isset ($ai_fallback)) $ai_fallback = null; if (!isset ($ai_index)) $ai_index = ' . $this->code_version . ';';
5329
+ $this->w3tc_code .= ' if (!isset ($ai_fallback)) $ai_fallback = null; if (!isset ($ai_index)) $ai_index = ' . $this->tracking_index . ';';
5330
+
5331
+ // $this->w3tc_code .= ' if ($ai_fallback === null) $ai_tracking_data = \'['.$tracking_block.',\'.$ai_index.\']\'; else $ai_tracking_data = \'[\'.$ai_fallback.\',\'.$ai_index.\']\';';
5332
+ $this->w3tc_code .= ' if (!isset ($ai_version_name)) $ai_version_name = "' . $this->version_name . '";' .
5333
+ ' if ($ai_fallback === null) $ai_tracking_data = \'['.$tracking_block.',\'.$ai_index.\',"'.$this->get_ad_name ().'","\'.$ai_version_name.\'"]\'; else $ai_tracking_data = \'[\'.$ai_fallback.\',\'.$ai_index.\']\';';
5334
+
5335
  $this->w3tc_code .= ' $ai_code = str_replace (\'[#AI_DATA#]\', base64_encode ($ai_tracking_data), base64_decode (\''.base64_encode ($wrapper_before).'\')) . $ai_code . base64_decode (\''.$this->base64_encode_w3tc ($wrapper_after, false).'\');';
5336
 
5337
  // Process W3TC filter hook
5413
 
5414
  $check_options ++;
5415
  if ($this->w3tc_code != '') {
5416
+
5417
+
5418
+
5419
  $w3tc_options = true;
5420
  $w3tc_code = $this->w3tc_code;
5421
  } else {
5422
  // Gnerate W3TC code if W3TC was not used for the option
5423
+ $w3tc_code = '$ai_code = base64_decode (\''.base64_encode ($code_for_single_insertion).'\'); $ai_enabled = true;';
5424
  }
5425
 
5426
  // $w3tc_codes will be used only if any of the options uses W3TC
5427
+ $w3tc_codes .= $w3tc_code . ' if (!isset ($ai_check_code)) $ai_check_code = \'\'; $ai_check_code .= $ai_code; unset ($ai_version_name); unset ($ai_index);';
5428
 
5429
  $code .= $code_for_single_insertion;
5430
  } while (is_array ($this->check_codes) && isset ($this->check_codes [$this->check_codes_index + 1]));
5518
  $viewports_insertion = $this->get_detection_client_side() && $this->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT;
5519
  $server_side_html_insertion = $this->get_html_element_insertion () == AI_HTML_INSERTION_SEREVR_SIDE;
5520
 
5521
+ if ($viewports_insertion) {
5522
+ $viewport_classes = trim ($this->get_viewport_classes ());
5523
+ if ($viewport_classes == '') {
5524
+ // All viewports
5525
+ $viewports_insertion = false;
5526
+ }
5527
+ }
5528
+
5529
  $insertion_name = '';
5530
  switch ($this->get_automatic_insertion()) {
5531
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
5578
  if ($viewports_insertion && !$html_element_insertion) {
5579
  $block_code = $this->base64_encode_w3tc (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
5580
  $selector = $this->get_viewport_names ();
5581
+ // $viewport_classes = trim ($this->get_viewport_classes ());
5582
 
5583
  $style_attribute = "style='" . $this->get_alignment_style () . "'";
5584
 
 
5585
  // Insert inside to prevent CLS
5586
+ $serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' {$style_attribute} data-insertion-position='prepend' data-selector='.{$block_id}' data-insertion-no-dbg data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
5587
  if (!get_disable_js_code ()) {
5588
  $js_code = "ai_insert_viewport_code ('$block_id');";
5589
 
5594
  $this->counters = '<span class="ai-selector-counter"></span>';
5595
  $block_code = $this->base64_encode_w3tc (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
5596
  $selector = trim ($this->get_html_selector (true));
5597
+ // $viewport_classes = trim ($this->get_viewport_classes ());
5598
 
5599
+ $serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' data-insertion-position='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
5600
  if (!empty ($selector) && !get_disable_js_code ()) {
5601
  // Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
5602
  $js_code = "ai_insert_viewport_code ('$block_id');";
5644
  // Check to replace " with \'
5645
  $this->w3tc_code .= ' $ai_code = str_replace ("[#AI_CODE#]", base64_encode ($ai_code), base64_decode ("'. base64_encode (ai_strip_js_markers ($serverside_insertion_code)) . '"));';
5646
 
 
 
 
 
5647
  $serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' ';
5648
  $serverside_insertion_code .= $this->w3tc_code.' if ($ai_enabled) echo $ai_code;';
5649
  $serverside_insertion_code .= ' --><!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
5650
 
5651
  } else {
 
 
 
 
 
 
 
 
 
5652
  $serverside_insertion_code = str_replace ('[#AI_CODE#]', $block_code, $serverside_insertion_code);
5653
  }
5654
 
constants.php CHANGED
@@ -31,7 +31,7 @@ if (!defined( 'AD_INSERTER_NAME'))
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
- define ('AD_INSERTER_VERSION', '2.7.14');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -51,6 +51,7 @@ define ('AD_ONE', '1');
51
  define ('AD_TWO', '2');
52
 
53
  define ('AD_FLAGS_BLOCKS_STICKY', 0x01);
 
54
  define ('AI_MAX_LIST_ITEMS', 2000);
55
 
56
  // Old options
@@ -1174,7 +1175,7 @@ define ('AI_IFRAMES', 46);
1174
  define ('AI_HEAD_CODES', 47);
1175
  define ('AI_HEAD_GROUPS', 48);
1176
  define ('AI_CURRENT_BLOCK_NUMBER', 50);
1177
- define ('AI_ACTIVE_GROUP_NAMES', 51);
1178
  define ('AI_ADB_SHORTCODE_DISABLED', 52);
1179
  define ('AI_CHECK_BLOCK', 53);
1180
  define ('AI_CUSTOM_FIELDS', 54);
@@ -1203,6 +1204,10 @@ define ('AI_LIMITS_FALLBACK_LEVEL', 76);
1203
  define ('AI_PARALLAX', 77);
1204
  define ('AI_PHP_PROCESSING', 78);
1205
  define ('AI_UNFILTERED_HTML', 79);
 
 
 
 
1206
 
1207
  define ('AI_CONTEXT_NONE', 0);
1208
  define ('AI_CONTEXT_CONTENT', 1);
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
+ define ('AD_INSERTER_VERSION', '2.7.15');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
51
  define ('AD_TWO', '2');
52
 
53
  define ('AD_FLAGS_BLOCKS_STICKY', 0x01);
54
+ define ('AD_FLAGS_SETTINGS_HIDDEN', 0x02);
55
  define ('AI_MAX_LIST_ITEMS', 2000);
56
 
57
  // Old options
1175
  define ('AI_HEAD_CODES', 47);
1176
  define ('AI_HEAD_GROUPS', 48);
1177
  define ('AI_CURRENT_BLOCK_NUMBER', 50);
1178
+ define ('AI_CURRENT_BLOCK_NAME', 51);
1179
  define ('AI_ADB_SHORTCODE_DISABLED', 52);
1180
  define ('AI_CHECK_BLOCK', 53);
1181
  define ('AI_CUSTOM_FIELDS', 54);
1204
  define ('AI_PARALLAX', 77);
1205
  define ('AI_PHP_PROCESSING', 78);
1206
  define ('AI_UNFILTERED_HTML', 79);
1207
+ define ('AI_ACTIVE_GROUP_NAMES', 80);
1208
+
1209
+
1210
+
1211
 
1212
  define ('AI_CONTEXT_NONE', 0);
1213
  define ('AI_CONTEXT_CONTENT', 1);
css/ai-settings.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.7.14"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
@@ -348,6 +348,14 @@ div.ai-tooltip .version {
348
  margin-right: 24px;
349
  }
350
 
 
 
 
 
 
 
 
 
351
  .ui-tabs .ui-tabs-nav li {
352
  margin: 1px 0.17em 0 0;
353
  }
@@ -1655,6 +1663,10 @@ table.check-pages a span.dashicons {
1655
  max-width: 300px;
1656
  }
1657
 
 
 
 
 
1658
  @media (max-width: 762px) {
1659
  #ai-sidebar-right {
1660
  float: none;
@@ -1793,6 +1805,10 @@ table.check-pages a span.dashicons {
1793
  table.check-pages td.ai-position, table.check-pages td.ai-not-checked {
1794
  font-size: 1.5em!important;
1795
  }
 
 
 
 
1796
  }
1797
 
1798
  @media (min-width: 783px) and (max-width: 828px) {
1
  #ai-data {
2
+ font-family: "2.7.15"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
348
  margin-right: 24px;
349
  }
350
 
351
+ #ai-settings-wrapper.settings-hidden {
352
+ width: 740px;
353
+ }
354
+
355
+ #ai-settings-wrapper.settings-hidden #ai-container {
356
+ display: none;
357
+ }
358
+
359
  .ui-tabs .ui-tabs-nav li {
360
  margin: 1px 0.17em 0 0;
361
  }
1663
  max-width: 300px;
1664
  }
1665
 
1666
+ .desktop-only {
1667
+ display: none;
1668
+ }
1669
+
1670
  @media (max-width: 762px) {
1671
  #ai-sidebar-right {
1672
  float: none;
1805
  table.check-pages td.ai-position, table.check-pages td.ai-not-checked {
1806
  font-size: 1.5em!important;
1807
  }
1808
+
1809
+ .desktop-only {
1810
+ display: block;
1811
+ }
1812
  }
1813
 
1814
  @media (min-width: 783px) and (max-width: 828px) {
includes/ace/mode-ai-html.js CHANGED
@@ -35,9 +35,9 @@ function add_ai_highlighting_rules (highlighter, highlight_rules) {
35
  highlighter.$ai_shortcodes = highlighter.$lang.arrayToMap ("adinserter".split ("|"));
36
  highlighter.$ai_separators1 = highlighter.$lang.arrayToMap ("http|count|check".split ("|"));
37
  highlighter.$ai_separators2 = highlighter.$lang.arrayToMap ("head|amp".split ("|"));
38
- highlighter.$ai_separators3 = highlighter.$lang.arrayToMap ("rotate".split ("|"));
39
  highlighter.$ai_separators4 = highlighter.$lang.arrayToMap ("fallback".split ("|"));
40
- highlighter.$ai_attributes = highlighter.$lang.arrayToMap ("block|code|name|group|ignore|viewport|debugger|adb|tracking|css|text|selectors|custom-field|random|data|share|time|counter|category|tag|taxonomy|id|url|url-parameter|referrer|client|scheduling|ip-address|country|cookie|disable".split ("|"));
41
 
42
  //WP shortcodes
43
  highlighter.$rules ['start'].unshift (
35
  highlighter.$ai_shortcodes = highlighter.$lang.arrayToMap ("adinserter".split ("|"));
36
  highlighter.$ai_separators1 = highlighter.$lang.arrayToMap ("http|count|check".split ("|"));
37
  highlighter.$ai_separators2 = highlighter.$lang.arrayToMap ("head|amp".split ("|"));
38
+ highlighter.$ai_separators3 = highlighter.$lang.arrayToMap ("rotate|index".split ("|"));
39
  highlighter.$ai_separators4 = highlighter.$lang.arrayToMap ("fallback".split ("|"));
40
+ highlighter.$ai_attributes = highlighter.$lang.arrayToMap ("block|code|name|group|ignore|viewport|debugger|adb|tracking|css|text|selectors|custom-field|random|data|share|time|counter|categories|tags|taxonomies|post-ids|urls|url-parameters|referrers|clients|scheduling|ip-addresses|countries|cookies|disable".split ("|"));
41
 
42
  //WP shortcodes
43
  highlighter.$rules ['start'].unshift (
includes/ace/mode-ai-php.js CHANGED
@@ -35,9 +35,9 @@ function add_ai_highlighting_rules (highlighter, highlight_rules) {
35
  highlighter.$ai_shortcodes = highlighter.$lang.arrayToMap ("adinserter".split ("|"));
36
  highlighter.$ai_separators1 = highlighter.$lang.arrayToMap ("http|count|check".split ("|"));
37
  highlighter.$ai_separators2 = highlighter.$lang.arrayToMap ("head|amp".split ("|"));
38
- highlighter.$ai_separators3 = highlighter.$lang.arrayToMap ("rotate".split ("|"));
39
  highlighter.$ai_separators4 = highlighter.$lang.arrayToMap ("fallback".split ("|"));
40
- highlighter.$ai_attributes = highlighter.$lang.arrayToMap ("block|code|name|group|ignore|viewport|debugger|adb|tracking|css|text|selectors|custom-field|random|data|share|time|counter|category|tag|taxonomy|id|url|url-parameter|referrer|client|scheduling|ip-address|country|cookie|disable".split ("|"));
41
 
42
  //WP shortcodes
43
  highlighter.$rules ['start'].unshift (
35
  highlighter.$ai_shortcodes = highlighter.$lang.arrayToMap ("adinserter".split ("|"));
36
  highlighter.$ai_separators1 = highlighter.$lang.arrayToMap ("http|count|check".split ("|"));
37
  highlighter.$ai_separators2 = highlighter.$lang.arrayToMap ("head|amp".split ("|"));
38
+ highlighter.$ai_separators3 = highlighter.$lang.arrayToMap ("rotate|index".split ("|"));
39
  highlighter.$ai_separators4 = highlighter.$lang.arrayToMap ("fallback".split ("|"));
40
+ highlighter.$ai_attributes = highlighter.$lang.arrayToMap ("block|code|name|group|ignore|viewport|debugger|adb|tracking|css|text|selectors|custom-field|random|data|share|time|counter|categories|tags|taxonomies|post-ids|urls|url-parameters|referrers|clients|scheduling|ip-addresses|countries|cookies|disable".split ("|"));
41
 
42
  //WP shortcodes
43
  highlighter.$rules ['start'].unshift (
includes/js/ai-adb.js CHANGED
@@ -26,6 +26,14 @@ function ai_adb_process_content () {
26
  $(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each (function () {
27
  var ai_adb_parent = $(this).parent ();
28
 
 
 
 
 
 
 
 
 
29
  if (ai_adb_debugging) console.log ("AI AD BLOCKING parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
30
 
31
  var ai_adb_css = $(this).data ("css");
@@ -60,6 +68,14 @@ function ai_adb_process_content () {
60
  $(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each (function () {
61
  var ai_adb_parent = $(this).parent ();
62
 
 
 
 
 
 
 
 
 
63
  if (ai_adb_debugging) console.log ("AI AD BLOCKING DELETE, parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
64
 
65
  var ai_adb_selectors = $(this).data ("selectors");
@@ -68,6 +84,7 @@ function ai_adb_process_content () {
68
  if (ai_adb_debugging) console.log ("AI AD BLOCKING DELETE, selectors='" + ai_adb_selectors + "'");
69
 
70
  var ai_adb_action = false;
 
71
  $(ai_adb_parent).find ('.AI_ADB_CONTENT_DELETE_BEGIN_CLASS, .AI_ADB_CONTENT_DELETE_END_CLASS, ' + ai_adb_selectors).each (function () {
72
  if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")) {$(this).remove (); ai_adb_action = true;}
73
  else if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_END_CLASS")) {$(this).remove (); ai_adb_action = false;}
@@ -83,6 +100,14 @@ function ai_adb_process_content () {
83
  $(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each (function () {
84
  var ai_adb_parent = $(this).parent ();
85
 
 
 
 
 
 
 
 
 
86
  if (ai_adb_debugging) console.log ("AI AD BLOCKING REPLACE, parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
87
 
88
  var ai_adb_text = $(this).data ("text");
26
  $(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each (function () {
27
  var ai_adb_parent = $(this).parent ();
28
 
29
+ if (ai_adb_parent.closest ('.ai-debug-block').length) {
30
+ ai_adb_parent = ai_adb_parent.parent ().parent ();
31
+ }
32
+
33
+ if (ai_adb_parent.closest ('.AI_FUNC_GET_BLOCK_CLASS_NAME').length) {
34
+ ai_adb_parent = ai_adb_parent.parent ();
35
+ }
36
+
37
  if (ai_adb_debugging) console.log ("AI AD BLOCKING parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
38
 
39
  var ai_adb_css = $(this).data ("css");
68
  $(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each (function () {
69
  var ai_adb_parent = $(this).parent ();
70
 
71
+ if (ai_adb_parent.closest ('.ai-debug-block').length) {
72
+ ai_adb_parent = ai_adb_parent.parent ().parent ();
73
+ }
74
+
75
+ if (ai_adb_parent.closest ('.AI_FUNC_GET_BLOCK_CLASS_NAME').length) {
76
+ ai_adb_parent = ai_adb_parent.parent ();
77
+ }
78
+
79
  if (ai_adb_debugging) console.log ("AI AD BLOCKING DELETE, parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
80
 
81
  var ai_adb_selectors = $(this).data ("selectors");
84
  if (ai_adb_debugging) console.log ("AI AD BLOCKING DELETE, selectors='" + ai_adb_selectors + "'");
85
 
86
  var ai_adb_action = false;
87
+
88
  $(ai_adb_parent).find ('.AI_ADB_CONTENT_DELETE_BEGIN_CLASS, .AI_ADB_CONTENT_DELETE_END_CLASS, ' + ai_adb_selectors).each (function () {
89
  if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")) {$(this).remove (); ai_adb_action = true;}
90
  else if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_END_CLASS")) {$(this).remove (); ai_adb_action = false;}
100
  $(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each (function () {
101
  var ai_adb_parent = $(this).parent ();
102
 
103
+ if (ai_adb_parent.closest ('.ai-debug-block').length) {
104
+ ai_adb_parent = ai_adb_parent.parent ().parent ();
105
+ }
106
+
107
+ if (ai_adb_parent.closest ('.AI_FUNC_GET_BLOCK_CLASS_NAME').length) {
108
+ ai_adb_parent = ai_adb_parent.parent ();
109
+ }
110
+
111
  if (ai_adb_debugging) console.log ("AI AD BLOCKING REPLACE, parent", ai_adb_parent.prop ("tagName"), "id=\""+ ai_adb_parent.attr ("id")+"\"", "class=\""+ ai_adb_parent.attr ("class")+"\"");
112
 
113
  var ai_adb_text = $(this).data ("text");
includes/js/ai-adb.min.js CHANGED
@@ -1,26 +1,27 @@
1
  var ai_adb_active=!1,ai_adb_counter=0,ai_adb_act_cookie_name="aiADB",ai_adb_pgv_cookie_name="aiADB_PV",ai_adb_page_redirection_cookie_name="aiADB_PR",ai_adb_overlay=AI_ADB_OVERLAY_WINDOW,ai_adb_message_window=AI_ADB_MESSAGE_WINDOW,ai_adb_message_undismissible=AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE,ai_adb_message_cookie_lifetime=AI_FUNCT_GET_NO_ACTION_PERIOD,ai_adb_devices=AI_FUNC_GET_ADB_DEVICES,ai_adb_action=AI_FUNC_GET_ADB_ACTION,ai_adb_page_views="AI_FUNC_GET_DELAY_ACTION",ai_adb_selectors="AI_ADB_SELECTORS",
2
  ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
3
- function ai_adb_process_content(){(function(a){a(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each(function(){var c=a(this).parent(),d=a(this).data("css");"undefined"==typeof d&&(d="display: none !important;");var b=a(this).data("selectors");if("undefined"==typeof b||""==b)b="p";var f=!1;a(c).find(".AI_ADB_CONTENT_CSS_BEGIN_CLASS, .AI_ADB_CONTENT_CSS_END_CLASS, "+b).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_CSS_BEGIN_CLASS"))a(this).remove(),f=!0;else if(a(this).hasClass("AI_ADB_CONTENT_CSS_END_CLASS"))a(this).remove(),f=
4
- !1;else if(f){var e=a(this).attr("style");"undefined"==typeof e?e="":(e=e.trim(),""!=e&&";"!=e[e.length-1]&&(e+=";"));a(this).attr("style",e+" "+d)}})});a(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each(function(){var c=a(this).parent(),d=a(this).data("selectors");if("undefined"==typeof d||""==d)d="p";var b=!1;a(c).find(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS, .AI_ADB_CONTENT_DELETE_END_CLASS, "+d).each(function(){a(this).hasClass("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")?(a(this).remove(),b=!0):a(this).hasClass("AI_ADB_CONTENT_DELETE_END_CLASS")?
5
- (a(this).remove(),b=!1):b&&a(this).remove()})});a(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each(function(){var c=a(this).parent(),d=a(this).data("text");"undefined"==typeof d&&(d="");var b=a(this).data("css");"undefined"==typeof b&&(b="");var f=a(this).data("selectors");if("undefined"==typeof f||""==f)f="p";var e=!1;a(c).find(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, .AI_ADB_CONTENT_REPLACE_END_CLASS, "+f).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS"))a(this).remove(),e=!0;else if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_END_CLASS"))a(this).remove(),
6
- e=!1;else if(e){if(0!=d.length){var g=Math.round(a(this).text().length/(d.length+1));a(this).text(Array(g+1).join(d+" ").trim())}else a(this).text("");""!=b&&(g=a(this).attr("style"),"undefined"==typeof g?g="":(g=g.trim(),""!=g&&";"!=g[g.length-1]&&(g+=";")),""!=b&&(b=" "+b),a(this).attr("style",g+b))}})})})(jQuery)}
7
- function ai_adb_process_blocks(a){(function(c){"undefined"==typeof a&&(a=c("body"));var d=c(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME),b="string"===typeof d?d==b64d("bWFzaw=="):null;if("string"===typeof d&&"boolean"===typeof b)if(b){do{var f=!1;c(".ai-adb-hide",a).each(function(){c(this).css({display:"none",visibility:"hidden"});c(this).removeClass("ai-adb-hide");var e=c(this).closest("div[data-ai]");if("undefined"!=typeof e.attr("data-ai")){var g=JSON.parse(b64d(e.attr("data-ai")));"undefined"!==typeof g&&
8
- g.constructor===Array&&(g[1]="",e.attr("data-ai",b64e(JSON.stringify(g))))}ai_disable_processing(c(this))});c(".ai-adb-show",a).each(function(){c(this).css({display:"block",visibility:"visible"});c(this).removeClass("ai-adb-show");if("undefined"!=typeof c(this).data("code")){var e=b64d(c(this).data("code"));c(this).append(e);f=!0;"function"==typeof ai_process_elements&&ai_process_elements()}e=c(this).attr("data-ai-tracking");if("undefined"!=typeof e){var g=c(this).closest("div[data-ai]");if("undefined"!=
9
- typeof g.attr("data-ai")){if(c(this).hasClass("ai-no-tracking")){var h=JSON.parse(b64d(g.attr("data-ai")));"undefined"!==typeof h&&h.constructor===Array&&(h[1]="",e=b64e(JSON.stringify(h)))}g.attr("data-ai",e)}}})}while(f);setTimeout(function(){"function"==typeof ai_process_impressions&&1==ai_tracking_finished&&ai_process_impressions();"function"==typeof ai_install_click_trackers&&1==ai_tracking_finished&&ai_install_click_trackers()},15);setTimeout(ai_adb_process_content,10)}else c(".ai-adb-hide",
10
- a).each(function(){c(this).removeClass("ai-adb-hide");if(0==c(this).outerHeight()&&0==c(this).closest(".ai-adb-show").length){var e=c(this).closest("div[data-ai]");if("undefined"!=typeof e.attr("data-ai")){var g=JSON.parse(b64d(e.attr("data-ai")));"undefined"!==typeof g&&g.constructor===Array&&(g[1]="",e.attr("data-ai",b64e(JSON.stringify(g))),e.addClass("ai-viewport-0").css("display","none"))}}}),c(".ai-adb-show",a).each(function(){ai_disable_processing(c(this));c(this).removeClass("ai-adb-show")})})(jQuery)}
11
- ai_adb_detection_type_log=function(a){var c=ai_adb_detection_type(a),d=jQuery("#ai-adb-events");if(0!=d.count){var b=d.text();d.text((""!=b?b+", ":b+", EVENTS: ")+a)}return c};ai_adb_detection_type=function(a){return""};
 
12
  var ai_adb_detected=function(a){setTimeout(function(){ai_adb_detected_actions(a)},2)},ai_disable_processing=function(a){jQuery(a).find(".ai-lazy").removeClass("ai-lazy");jQuery(a).find(".ai-manual").removeClass("ai-manual");jQuery(a).find(".ai-rotate").removeClass("ai-unprocessed").removeAttr("data-info");jQuery(a).find(".ai-list-data").removeClass("ai-list-data");jQuery(a).find(".ai-ip-data").removeClass("ai-ip-data");jQuery(a).find("[data-code]").removeAttr("data-code")},ai_adb_detected_actions=
13
- function(a){ai_adb_active||(ai_adb_active=!0,jQuery(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME,b64d("bWFzaw==")),function(c){c(window).ready(function(){ai_adb_process_blocks()});"undefined"!==typeof MobileDetect&&(new MobileDetect(window.navigator.userAgent)).is("bot")&&(ai_adb_action=0);if(""!=ai_adb_page_views){if(ai_adb_page_views.includes(",")){var d=ai_adb_page_views.split(","),b=parseInt(d[0]);d=parseInt(d[1])}else b=parseInt(ai_adb_page_views),d=0;var f=1,e=AiCookies.get(ai_adb_pgv_cookie_name);
14
- "undefined"!=typeof e&&(f=parseInt(e)+1);if(f<=b){AiCookies.set(ai_adb_pgv_cookie_name,f,{expires:365,path:"/"});window.ai_d1=f;window.AI_ADB_STATUS_MESSAGE=1;return}if(0!=d&&(AiCookies.set(ai_adb_pgv_cookie_name,f,{expires:365,path:"/"}),0!=(f-b-1)%d)){window.ai_d1=f;window.AI_ADB_STATUS_MESSAGE=1;return}}if(0==ai_adb_message_cookie_lifetime||1==ai_adb_action&&ai_adb_message_undismissible)AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});else{e=AiCookies.get(ai_adb_act_cookie_name);if("undefined"!=
15
  typeof e&&"AI_CONST_AI_ADB_COOKIE_VALUE"==e){window.AI_ADB_STATUS_MESSAGE=2;return}AiCookies.set(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}0==ai_adb_action?(ai_dummy=16,window.AI_ADB_STATUS_MESSAGE=6,ai_dummy++):(window.AI_ADB_STATUS_MESSAGE=3,ai_dummy=13);switch(ai_adb_action){case 1:ai_adb_message_undismissible?(ai_adb_overlay.find('[style*="cursor"]').css("cursor","no-drop"),ai_adb_message_window.find('[style*="cursor"]').css("cursor",
16
- "no-drop")):(ai_adb_overlay.click(function(){c(this).remove();ai_adb_message_window.remove()}),ai_adb_message_window.click(function(){c(this).remove();ai_adb_overlay.remove()}),window.onkeydown=function(g){27===g.keyCode&&(ai_adb_overlay.click(),ai_adb_message_window.click())});b=c(b64d("Ym9keQ==")).children();b.eq(Math.floor(Math.random()*b.length)).after(ai_adb_overlay);b.eq(Math.floor(Math.random()*b.length)).after(ai_adb_message_window);break;case 2:""!=ai_adb_redirection_url&&(b=!0,"http"==ai_adb_redirection_url.toLowerCase().substring(0,
17
- 4)?window.location.href==ai_adb_redirection_url&&(b=!1):window.location.pathname==ai_adb_redirection_url&&(b=!1),b?(e=AiCookies.get(ai_adb_page_redirection_cookie_name),"undefined"==typeof e&&(b=new Date,b.setTime(b.getTime()+1E4),AiCookies.set(ai_adb_page_redirection_cookie_name,window.location.href,{expires:b,path:"/"}),window.location.replace(ai_adb_redirection_url))):AiCookies.remove(ai_adb_page_redirection_cookie_name,{path:"/"}))}}(jQuery))},ai_adb_undetected=function(a){setTimeout(function(){ai_adb_active||
18
  ai_adb_undetected_actions(a)},200)},ai_adb_undetected_actions=function(a){ai_adb_counter++;ai_adb_active||4!=ai_adb_counter||(jQuery(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME,b64d("Y2xlYXI=")),ai_dummy=11,window.AI_ADB_STATUS_MESSAGE=4,ai_dummy=14,ai_adb_process_blocks())};AI_DBG_AI_DEBUG_AD_BLOCKING&&jQuery(document).ready(function(){ai_adb_detected(0)});
19
- jQuery(document).ready(function(a){a(window).ready(function(){ai_debugging_active="undefined"!==typeof ai_adb_fe_dbg;setTimeout(function(){a("#ai-adb-bar").click(function(){AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});AiCookies.remove(ai_adb_pgv_cookie_name,{path:"/"});window.AI_ADB_STATUS_MESSAGE=5;ai_dummy=15})},2);if((!ai_adb_active||ai_debugging_active)&&""!=ai_adb_selectors){var c=0,d=0,b=ai_adb_selectors.split(",");a.each(b,function(f){b[f]=b[f].trim();0!=a(b[f]).length&&a(b[f]).each(function(e){var g=
20
- a(this).outerHeight();e=a(this).find(".ai-attributes");e.length&&e.each(function(){g>=a(this).outerHeight()&&(g-=a(this).outerHeight())});c++;if(0===g&&(a(document).ready(function(){ai_adb_active&&!ai_debugging_active||ai_adb_detected(4)}),d++,!ai_debugging_active))return!1})});0!=c&&0==d&&a(document).ready(function(){ai_adb_undetected(4)})}})});
21
- function ai_adb_get_script(a,c){var d=document.createElement("script");d.src="ai-adb-url"+a+".js?ver="+(new Date).getTime();var b=document.getElementsByTagName("head")[0],f=!1;d.onerror=function(){c&&c();d.onerror=null;b.removeChild(d)};d.onload=d.onreadystatechange=function(){f||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(f=!0,c&&c(),d.onload=d.onreadystatechange=null,b.removeChild(d))};b.appendChild(d)}
22
- jQuery(window).on("load",function(){function a(){document.getElementById("AI_CONST_AI_ADB_1_NAME")?ai_adb_undetected(1):ai_adb_active&&!ai_debugging_active||ai_adb_detected(1)}function c(){"undefined"==typeof window.AI_CONST_AI_ADB_2_NAME?(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(2):ai_adb_undetected(2)}function d(){var f=jQuery(b64d("I2FpLWFkYi1nYQ=="));f.length&&(f.width()*f.height()?ai_adb_undetected(5):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(5));f=jQuery(b64d("I2FpLWFkYi1tbg=="));
23
- f.length&&(f.width()*f.height()?ai_adb_undetected(6):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(6));f=jQuery(b64d("I2FpLWFkYi1kYmxjbGs="));f.length&&(f.width()*f.height()?ai_adb_undetected(8):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(8))}if("undefined"!==typeof MobileDetect){var b=new MobileDetect(window.navigator.userAgent);if(6!=ai_adb_devices)switch(ai_adb_devices){case 0:if(b.mobile())return!1;break;case 1:if(!b.mobile())return!1;break;case 2:if(!b.tablet())return!1;break;
24
- case 3:if(!b.phone())return!1;break;case 4:if(b.phone())return!1;break;case 5:if(b.tablet())return!1}}setTimeout(function(){d();setTimeout(function(){ai_adb_active||setTimeout(function(){d()},400)},5)},1050);setTimeout(function(){var f="undefined"!==typeof ai_adb_fe_dbg;jQuery(b64d("I2FpLWFkYi1hZHM=")).length&&(document.getElementById("AI_CONST_AI_ADB_1_NAME")?a():ai_adb_get_script("ads",a));jQuery(b64d("I2FpLWFkYi1zcG9uc29ycw==")).length&&("undefined"==typeof window.AI_CONST_AI_ADB_2_NAME?ai_adb_get_script("sponsors",
25
- c):c());var e=b64d("I2Jhbm5lci1hZHZlcnQtY29udGFpbmVy"),g=b64d("I2Jhbm5lci1hZHZlcnQtY29udGFpbmVyIGltZw==");jQuery(e).length&&0<jQuery(g).length&&(0===jQuery(g).outerHeight()?(!ai_adb_active||f)&&ai_adb_detected(3):ai_adb_undetected(3),jQuery(g).remove());jQuery(b64d("I2FpLWFkYi1iYW5uZXI=")).length&&("undefined"==typeof window.ad_banner?(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(11):ai_adb_undetected(11));jQuery(b64d("I2FpLWFkYi0zMDB4MjUw")).length&&("undefined"==typeof window.ad_300x250?
26
  (!ai_adb_active||ai_debugging_active)&&ai_adb_detected(12):ai_adb_undetected(12))},1150)});
1
  var ai_adb_active=!1,ai_adb_counter=0,ai_adb_act_cookie_name="aiADB",ai_adb_pgv_cookie_name="aiADB_PV",ai_adb_page_redirection_cookie_name="aiADB_PR",ai_adb_overlay=AI_ADB_OVERLAY_WINDOW,ai_adb_message_window=AI_ADB_MESSAGE_WINDOW,ai_adb_message_undismissible=AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE,ai_adb_message_cookie_lifetime=AI_FUNCT_GET_NO_ACTION_PERIOD,ai_adb_devices=AI_FUNC_GET_ADB_DEVICES,ai_adb_action=AI_FUNC_GET_ADB_ACTION,ai_adb_page_views="AI_FUNC_GET_DELAY_ACTION",ai_adb_selectors="AI_ADB_SELECTORS",
2
  ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
3
+ function ai_adb_process_content(){(function(a){a(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each(function(){var b=a(this).parent();b.closest(".ai-debug-block").length&&(b=b.parent().parent());b.closest(".AI_FUNC_GET_BLOCK_CLASS_NAME").length&&(b=b.parent());var d=a(this).data("css");"undefined"==typeof d&&(d="display: none !important;");var c=a(this).data("selectors");if("undefined"==typeof c||""==c)c="p";var f=!1;a(b).find(".AI_ADB_CONTENT_CSS_BEGIN_CLASS, .AI_ADB_CONTENT_CSS_END_CLASS, "+c).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_CSS_BEGIN_CLASS"))a(this).remove(),
4
+ f=!0;else if(a(this).hasClass("AI_ADB_CONTENT_CSS_END_CLASS"))a(this).remove(),f=!1;else if(f){var e=a(this).attr("style");"undefined"==typeof e?e="":(e=e.trim(),""!=e&&";"!=e[e.length-1]&&(e+=";"));a(this).attr("style",e+" "+d)}})});a(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each(function(){var b=a(this).parent();b.closest(".ai-debug-block").length&&(b=b.parent().parent());b.closest(".AI_FUNC_GET_BLOCK_CLASS_NAME").length&&(b=b.parent());var d=a(this).data("selectors");if("undefined"==typeof d||""==
5
+ d)d="p";var c=!1;a(b).find(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS, .AI_ADB_CONTENT_DELETE_END_CLASS, "+d).each(function(){a(this).hasClass("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")?(a(this).remove(),c=!0):a(this).hasClass("AI_ADB_CONTENT_DELETE_END_CLASS")?(a(this).remove(),c=!1):c&&a(this).remove()})});a(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each(function(){var b=a(this).parent();b.closest(".ai-debug-block").length&&(b=b.parent().parent());b.closest(".AI_FUNC_GET_BLOCK_CLASS_NAME").length&&(b=b.parent());
6
+ var d=a(this).data("text");"undefined"==typeof d&&(d="");var c=a(this).data("css");"undefined"==typeof c&&(c="");var f=a(this).data("selectors");if("undefined"==typeof f||""==f)f="p";var e=!1;a(b).find(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, .AI_ADB_CONTENT_REPLACE_END_CLASS, "+f).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS"))a(this).remove(),e=!0;else if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_END_CLASS"))a(this).remove(),e=!1;else if(e){if(0!=d.length){var g=Math.round(a(this).text().length/
7
+ (d.length+1));a(this).text(Array(g+1).join(d+" ").trim())}else a(this).text("");""!=c&&(g=a(this).attr("style"),"undefined"==typeof g?g="":(g=g.trim(),""!=g&&";"!=g[g.length-1]&&(g+=";")),""!=c&&(c=" "+c),a(this).attr("style",g+c))}})})})(jQuery)}
8
+ function ai_adb_process_blocks(a){(function(b){"undefined"==typeof a&&(a=b("body"));var d=b(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME),c="string"===typeof d?d==b64d("bWFzaw=="):null;if("string"===typeof d&&"boolean"===typeof c)if(c){do{var f=!1;b(".ai-adb-hide",a).each(function(){b(this).css({display:"none",visibility:"hidden"});b(this).removeClass("ai-adb-hide");var e=b(this).closest("div[data-ai]");if("undefined"!=typeof e.attr("data-ai")){var g=JSON.parse(b64d(e.attr("data-ai")));"undefined"!==typeof g&&
9
+ g.constructor===Array&&(g[1]="",e.attr("data-ai",b64e(JSON.stringify(g))))}ai_disable_processing(b(this))});b(".ai-adb-show",a).each(function(){b(this).css({display:"block",visibility:"visible"});b(this).removeClass("ai-adb-show");if("undefined"!=typeof b(this).data("code")){var e=b64d(b(this).data("code"));b(this).append(e);f=!0;"function"==typeof ai_process_elements&&ai_process_elements()}e=b(this).attr("data-ai-tracking");if("undefined"!=typeof e){var g=b(this).closest("div[data-ai]");if("undefined"!=
10
+ typeof g.attr("data-ai")){if(b(this).hasClass("ai-no-tracking")){var h=JSON.parse(b64d(g.attr("data-ai")));"undefined"!==typeof h&&h.constructor===Array&&(h[1]="",e=b64e(JSON.stringify(h)))}g.attr("data-ai",e)}}})}while(f);setTimeout(function(){"function"==typeof ai_process_impressions&&1==ai_tracking_finished&&ai_process_impressions();"function"==typeof ai_install_click_trackers&&1==ai_tracking_finished&&ai_install_click_trackers()},15);setTimeout(ai_adb_process_content,10)}else b(".ai-adb-hide",
11
+ a).each(function(){b(this).removeClass("ai-adb-hide");if(0==b(this).outerHeight()&&0==b(this).closest(".ai-adb-show").length){var e=b(this).closest("div[data-ai]");if("undefined"!=typeof e.attr("data-ai")){var g=JSON.parse(b64d(e.attr("data-ai")));"undefined"!==typeof g&&g.constructor===Array&&(g[1]="",e.attr("data-ai",b64e(JSON.stringify(g))),e.addClass("ai-viewport-0").css("display","none"))}}}),b(".ai-adb-show",a).each(function(){ai_disable_processing(b(this));b(this).removeClass("ai-adb-show")})})(jQuery)}
12
+ ai_adb_detection_type_log=function(a){var b=ai_adb_detection_type(a),d=jQuery("#ai-adb-events");if(0!=d.count){var c=d.text();d.text((""!=c?c+", ":c+", EVENTS: ")+a)}return b};ai_adb_detection_type=function(a){return""};
13
  var ai_adb_detected=function(a){setTimeout(function(){ai_adb_detected_actions(a)},2)},ai_disable_processing=function(a){jQuery(a).find(".ai-lazy").removeClass("ai-lazy");jQuery(a).find(".ai-manual").removeClass("ai-manual");jQuery(a).find(".ai-rotate").removeClass("ai-unprocessed").removeAttr("data-info");jQuery(a).find(".ai-list-data").removeClass("ai-list-data");jQuery(a).find(".ai-ip-data").removeClass("ai-ip-data");jQuery(a).find("[data-code]").removeAttr("data-code")},ai_adb_detected_actions=
14
+ function(a){ai_adb_active||(ai_adb_active=!0,jQuery(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME,b64d("bWFzaw==")),function(b){b(window).ready(function(){ai_adb_process_blocks()});"undefined"!==typeof MobileDetect&&(new MobileDetect(window.navigator.userAgent)).is("bot")&&(ai_adb_action=0);if(""!=ai_adb_page_views){if(ai_adb_page_views.includes(",")){var d=ai_adb_page_views.split(","),c=parseInt(d[0]);d=parseInt(d[1])}else c=parseInt(ai_adb_page_views),d=0;var f=1,e=AiCookies.get(ai_adb_pgv_cookie_name);
15
+ "undefined"!=typeof e&&(f=parseInt(e)+1);if(f<=c){AiCookies.set(ai_adb_pgv_cookie_name,f,{expires:365,path:"/"});window.ai_d1=f;window.AI_ADB_STATUS_MESSAGE=1;return}if(0!=d&&(AiCookies.set(ai_adb_pgv_cookie_name,f,{expires:365,path:"/"}),0!=(f-c-1)%d)){window.ai_d1=f;window.AI_ADB_STATUS_MESSAGE=1;return}}if(0==ai_adb_message_cookie_lifetime||1==ai_adb_action&&ai_adb_message_undismissible)AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});else{e=AiCookies.get(ai_adb_act_cookie_name);if("undefined"!=
16
  typeof e&&"AI_CONST_AI_ADB_COOKIE_VALUE"==e){window.AI_ADB_STATUS_MESSAGE=2;return}AiCookies.set(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}0==ai_adb_action?(ai_dummy=16,window.AI_ADB_STATUS_MESSAGE=6,ai_dummy++):(window.AI_ADB_STATUS_MESSAGE=3,ai_dummy=13);switch(ai_adb_action){case 1:ai_adb_message_undismissible?(ai_adb_overlay.find('[style*="cursor"]').css("cursor","no-drop"),ai_adb_message_window.find('[style*="cursor"]').css("cursor",
17
+ "no-drop")):(ai_adb_overlay.click(function(){b(this).remove();ai_adb_message_window.remove()}),ai_adb_message_window.click(function(){b(this).remove();ai_adb_overlay.remove()}),window.onkeydown=function(g){27===g.keyCode&&(ai_adb_overlay.click(),ai_adb_message_window.click())});c=b(b64d("Ym9keQ==")).children();c.eq(Math.floor(Math.random()*c.length)).after(ai_adb_overlay);c.eq(Math.floor(Math.random()*c.length)).after(ai_adb_message_window);break;case 2:""!=ai_adb_redirection_url&&(c=!0,"http"==ai_adb_redirection_url.toLowerCase().substring(0,
18
+ 4)?window.location.href==ai_adb_redirection_url&&(c=!1):window.location.pathname==ai_adb_redirection_url&&(c=!1),c?(e=AiCookies.get(ai_adb_page_redirection_cookie_name),"undefined"==typeof e&&(c=new Date,c.setTime(c.getTime()+1E4),AiCookies.set(ai_adb_page_redirection_cookie_name,window.location.href,{expires:c,path:"/"}),window.location.replace(ai_adb_redirection_url))):AiCookies.remove(ai_adb_page_redirection_cookie_name,{path:"/"}))}}(jQuery))},ai_adb_undetected=function(a){setTimeout(function(){ai_adb_active||
19
  ai_adb_undetected_actions(a)},200)},ai_adb_undetected_actions=function(a){ai_adb_counter++;ai_adb_active||4!=ai_adb_counter||(jQuery(b64d("Ym9keQ==")).attr(AI_ADB_ATTR_NAME,b64d("Y2xlYXI=")),ai_dummy=11,window.AI_ADB_STATUS_MESSAGE=4,ai_dummy=14,ai_adb_process_blocks())};AI_DBG_AI_DEBUG_AD_BLOCKING&&jQuery(document).ready(function(){ai_adb_detected(0)});
20
+ jQuery(document).ready(function(a){a(window).ready(function(){ai_debugging_active="undefined"!==typeof ai_adb_fe_dbg;setTimeout(function(){a("#ai-adb-bar").click(function(){AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});AiCookies.remove(ai_adb_pgv_cookie_name,{path:"/"});window.AI_ADB_STATUS_MESSAGE=5;ai_dummy=15})},2);if((!ai_adb_active||ai_debugging_active)&&""!=ai_adb_selectors){var b=0,d=0,c=ai_adb_selectors.split(",");a.each(c,function(f){c[f]=c[f].trim();0!=a(c[f]).length&&a(c[f]).each(function(e){var g=
21
+ a(this).outerHeight();e=a(this).find(".ai-attributes");e.length&&e.each(function(){g>=a(this).outerHeight()&&(g-=a(this).outerHeight())});b++;if(0===g&&(a(document).ready(function(){ai_adb_active&&!ai_debugging_active||ai_adb_detected(4)}),d++,!ai_debugging_active))return!1})});0!=b&&0==d&&a(document).ready(function(){ai_adb_undetected(4)})}})});
22
+ function ai_adb_get_script(a,b){var d=document.createElement("script");d.src="ai-adb-url"+a+".js?ver="+(new Date).getTime();var c=document.getElementsByTagName("head")[0],f=!1;d.onerror=function(){b&&b();d.onerror=null;c.removeChild(d)};d.onload=d.onreadystatechange=function(){f||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(f=!0,b&&b(),d.onload=d.onreadystatechange=null,c.removeChild(d))};c.appendChild(d)}
23
+ jQuery(window).on("load",function(){function a(){document.getElementById("AI_CONST_AI_ADB_1_NAME")?ai_adb_undetected(1):ai_adb_active&&!ai_debugging_active||ai_adb_detected(1)}function b(){"undefined"==typeof window.AI_CONST_AI_ADB_2_NAME?(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(2):ai_adb_undetected(2)}function d(){var f=jQuery(b64d("I2FpLWFkYi1nYQ=="));f.length&&(f.width()*f.height()?ai_adb_undetected(5):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(5));f=jQuery(b64d("I2FpLWFkYi1tbg=="));
24
+ f.length&&(f.width()*f.height()?ai_adb_undetected(6):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(6));f=jQuery(b64d("I2FpLWFkYi1kYmxjbGs="));f.length&&(f.width()*f.height()?ai_adb_undetected(8):(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(8))}if("undefined"!==typeof MobileDetect){var c=new MobileDetect(window.navigator.userAgent);if(6!=ai_adb_devices)switch(ai_adb_devices){case 0:if(c.mobile())return!1;break;case 1:if(!c.mobile())return!1;break;case 2:if(!c.tablet())return!1;break;
25
+ case 3:if(!c.phone())return!1;break;case 4:if(c.phone())return!1;break;case 5:if(c.tablet())return!1}}setTimeout(function(){d();setTimeout(function(){ai_adb_active||setTimeout(function(){d()},400)},5)},1050);setTimeout(function(){var f="undefined"!==typeof ai_adb_fe_dbg;jQuery(b64d("I2FpLWFkYi1hZHM=")).length&&(document.getElementById("AI_CONST_AI_ADB_1_NAME")?a():ai_adb_get_script("ads",a));jQuery(b64d("I2FpLWFkYi1zcG9uc29ycw==")).length&&("undefined"==typeof window.AI_CONST_AI_ADB_2_NAME?ai_adb_get_script("sponsors",
26
+ b):b());var e=b64d("I2Jhbm5lci1hZHZlcnQtY29udGFpbmVy"),g=b64d("I2Jhbm5lci1hZHZlcnQtY29udGFpbmVyIGltZw==");jQuery(e).length&&0<jQuery(g).length&&(0===jQuery(g).outerHeight()?(!ai_adb_active||f)&&ai_adb_detected(3):ai_adb_undetected(3),jQuery(g).remove());jQuery(b64d("I2FpLWFkYi1iYW5uZXI=")).length&&("undefined"==typeof window.ad_banner?(!ai_adb_active||ai_debugging_active)&&ai_adb_detected(11):ai_adb_undetected(11));jQuery(b64d("I2FpLWFkYi0zMDB4MjUw")).length&&("undefined"==typeof window.ad_300x250?
27
  (!ai_adb_active||ai_debugging_active)&&ai_adb_detected(12):ai_adb_undetected(12))},1150)});
includes/js/ai-insert.js CHANGED
@@ -161,7 +161,7 @@ ai_insert_code = function (element) {
161
  if (ai_debug) console.log ('AI ELEMENT VISIBLE: block', block, 'offsetWidth:', element.offsetWidth, 'offsetHeight:', element.offsetHeight, 'getClientRects().length:', element.getClientRects().length);
162
 
163
  var insertion_code = element.getAttribute ('data-code');
164
- var insertion_type = element.getAttribute ('data-insertion');
165
  var selector = element.getAttribute ('data-selector');
166
 
167
  if (insertion_code != null) {
161
  if (ai_debug) console.log ('AI ELEMENT VISIBLE: block', block, 'offsetWidth:', element.offsetWidth, 'offsetHeight:', element.offsetHeight, 'getClientRects().length:', element.getClientRects().length);
162
 
163
  var insertion_code = element.getAttribute ('data-code');
164
+ var insertion_type = element.getAttribute ('data-insertion-position');
165
  var selector = element.getAttribute ('data-selector');
166
 
167
  if (insertion_code != null) {
includes/js/ai-insert.min.js CHANGED
@@ -4,7 +4,7 @@ ai_front.insertion_before:"after"==a?m=ai_front.insertion_after:"prepend"==a?m=a
4
  c):jQuery(v.innerHTML).insertBefore(jQuery(c)):"after"==a?m?c.parentNode.insertBefore(w,c.nextSibling):jQuery(v.innerHTML).insertBefore(jQuery(c.nextSibling)):"prepend"==a?m?c.insertBefore(w,c.firstChild):jQuery(v.innerHTML).insertBefore(jQuery(c.firstChild)):"append"==a?m?c.insertBefore(w,null):jQuery(v.innerHTML).appendTo(jQuery(c)):"replace-content"==a?(c.innerHTML="",m?c.insertBefore(w,null):jQuery(v.innerHTML).appendTo(jQuery(c))):"replace-element"==a&&(m?c.parentNode.insertBefore(w,c):jQuery(v.innerHTML).insertBefore(jQuery(c)),
5
  c.parentNode.removeChild(c))}};
6
  ai_insert_code=function(a){function h(n,m){return null==n?!1:n.classList?n.classList.contains(m):-1<(" "+n.className+" ").indexOf(" "+m+" ")}function q(n,m){null!=n&&(n.classList?n.classList.add(m):n.className+=" "+m)}function k(n,m){null!=n&&(n.classList?n.classList.remove(m):n.className=n.className.replace(new RegExp("(^|\\b)"+m.split(" ").join("|")+"(\\b|$)","gi")," "))}if("undefined"!=typeof a){var u=!1;if(h(a,"no-visibility-check")||a.offsetWidth||a.offsetHeight||a.getClientRects().length){u=
7
- a.getAttribute("data-code");var y=a.getAttribute("data-insertion"),c=a.getAttribute("data-selector");if(null!=u)if(null!=y&&null!=c){if(-1!=c.indexOf(":eq")?jQuery(c).length:document.querySelectorAll(c).length)ai_insert(y,c,b64d(u)),k(a,"ai-viewports")}else{y=document.createRange();c=!0;try{var v=y.createContextualFragment(b64d(u))}catch(n){c=!1}c?a.parentNode.insertBefore(v,a.nextSibling):jQuery(b64d(u)).insertBefore(jQuery(a.nextSibling));k(a,"ai-viewports")}u=!0}else v=a.previousElementSibling,
8
  h(v,"ai-debug-bar")&&h(v,"ai-debug-script")&&(k(v,"ai-debug-script"),q(v,"ai-debug-viewport-invisible")),k(a,"ai-viewports");return u}};
9
  ai_insert_list_code=function(a){var h=document.getElementsByClassName(a)[0];if("undefined"!=typeof h){var q=ai_insert_code(h),k=h.closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME");if(k){q||k.removeAttribute("data-ai");var u=k.querySelectorAll(".ai-debug-block");k&&u.length&&(k.classList.remove("ai-list-block"),k.classList.remove("ai-list-block-ip"),k.classList.remove("ai-list-block-filter"),k.style.visibility="",k.classList.contains("ai-remove-position")&&(k.style.position=""))}h.classList.remove(a);q&&
10
  ai_process_elements()}};ai_insert_viewport_code=function(a){var h=document.getElementsByClassName(a)[0];if("undefined"!=typeof h){var q=ai_insert_code(h);h.classList.remove(a);q&&(a=h.closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME"),null!=a&&(q=h.getAttribute("style"),null!=q&&a.setAttribute("style",a.getAttribute("style")+" "+q)));setTimeout(function(){h.removeAttribute("style")},2);ai_process_elements()}};
4
  c):jQuery(v.innerHTML).insertBefore(jQuery(c)):"after"==a?m?c.parentNode.insertBefore(w,c.nextSibling):jQuery(v.innerHTML).insertBefore(jQuery(c.nextSibling)):"prepend"==a?m?c.insertBefore(w,c.firstChild):jQuery(v.innerHTML).insertBefore(jQuery(c.firstChild)):"append"==a?m?c.insertBefore(w,null):jQuery(v.innerHTML).appendTo(jQuery(c)):"replace-content"==a?(c.innerHTML="",m?c.insertBefore(w,null):jQuery(v.innerHTML).appendTo(jQuery(c))):"replace-element"==a&&(m?c.parentNode.insertBefore(w,c):jQuery(v.innerHTML).insertBefore(jQuery(c)),
5
  c.parentNode.removeChild(c))}};
6
  ai_insert_code=function(a){function h(n,m){return null==n?!1:n.classList?n.classList.contains(m):-1<(" "+n.className+" ").indexOf(" "+m+" ")}function q(n,m){null!=n&&(n.classList?n.classList.add(m):n.className+=" "+m)}function k(n,m){null!=n&&(n.classList?n.classList.remove(m):n.className=n.className.replace(new RegExp("(^|\\b)"+m.split(" ").join("|")+"(\\b|$)","gi")," "))}if("undefined"!=typeof a){var u=!1;if(h(a,"no-visibility-check")||a.offsetWidth||a.offsetHeight||a.getClientRects().length){u=
7
+ a.getAttribute("data-code");var y=a.getAttribute("data-insertion-position"),c=a.getAttribute("data-selector");if(null!=u)if(null!=y&&null!=c){if(-1!=c.indexOf(":eq")?jQuery(c).length:document.querySelectorAll(c).length)ai_insert(y,c,b64d(u)),k(a,"ai-viewports")}else{y=document.createRange();c=!0;try{var v=y.createContextualFragment(b64d(u))}catch(n){c=!1}c?a.parentNode.insertBefore(v,a.nextSibling):jQuery(b64d(u)).insertBefore(jQuery(a.nextSibling));k(a,"ai-viewports")}u=!0}else v=a.previousElementSibling,
8
  h(v,"ai-debug-bar")&&h(v,"ai-debug-script")&&(k(v,"ai-debug-script"),q(v,"ai-debug-viewport-invisible")),k(a,"ai-viewports");return u}};
9
  ai_insert_list_code=function(a){var h=document.getElementsByClassName(a)[0];if("undefined"!=typeof h){var q=ai_insert_code(h),k=h.closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME");if(k){q||k.removeAttribute("data-ai");var u=k.querySelectorAll(".ai-debug-block");k&&u.length&&(k.classList.remove("ai-list-block"),k.classList.remove("ai-list-block-ip"),k.classList.remove("ai-list-block-filter"),k.style.visibility="",k.classList.contains("ai-remove-position")&&(k.style.position=""))}h.classList.remove(a);q&&
10
  ai_process_elements()}};ai_insert_viewport_code=function(a){var h=document.getElementsByClassName(a)[0];if("undefined"!=typeof h){var q=ai_insert_code(h);h.classList.remove(a);q&&(a=h.closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME"),null!=a&&(q=h.getAttribute("style"),null!=q&&a.setAttribute("style",a.getAttribute("style")+" "+q)));setTimeout(function(){h.removeAttribute("style")},2);ai_process_elements()}};
includes/js/ai-rotation.js CHANGED
@@ -268,9 +268,11 @@ jQuery (function ($) {
268
  if (typeof option.data ('time') != 'undefined') {
269
  var rotation_time = atob (option.data ('time'));
270
 
 
271
  if (ai_debug) {
 
272
  var option_name = b64d (option.data ('name'));
273
- console.log ('AI TIMED ROTATION index:', random_index + ',', 'name:', '"'+option_name+'",', 'time:', rotation_time);
274
  }
275
 
276
  if (rotation_time == 0 && rotate_options.length > 1) {
@@ -330,8 +332,9 @@ jQuery (function ($) {
330
  }
331
  else if (typeof option.data ('group') != 'undefined') {
332
  if (ai_debug) {
 
333
  var option_name = b64d (option.data ('name'));
334
- console.log ('AI ROTATE GROUP', '"' + option_name + '",', 'index:', random_index);
335
  }
336
  }
337
  else {
@@ -371,6 +374,7 @@ jQuery (function ($) {
371
  ai_process_elements ();
372
  }
373
 
 
374
  var option_name = b64d (option.data ('name'));
375
  var debug_block_frame = $(rotation_block).closest ('.ai-debug-block');
376
  if (debug_block_frame.length != 0) {
@@ -394,7 +398,8 @@ jQuery (function ($) {
394
  if (adb_show_wrapping_div.attr ("data-ai-tracking")) {
395
  var data = JSON.parse (b64d (adb_show_wrapping_div.attr ("data-ai-tracking")));
396
  if (typeof data !== "undefined" && data.constructor === Array) {
397
- data [1] = random_index + 1;
 
398
  data [3] = option_name ;
399
 
400
  if (ai_debug) console.log ('AI ROTATE TRACKING DATA ', b64d (adb_show_wrapping_div.attr ("data-ai-tracking")), ' <= ', JSON.stringify (data));
@@ -414,7 +419,8 @@ jQuery (function ($) {
414
  if (typeof wrapping_div.attr ("data-ai") != "undefined") {
415
  var data = JSON.parse (b64d (wrapping_div.attr ("data-ai")));
416
  if (typeof data !== "undefined" && data.constructor === Array) {
417
- data [1] = random_index + 1;
 
418
  data [3] = option_name;
419
  wrapping_div.attr ("data-ai", b64e (JSON.stringify (data)))
420
 
268
  if (typeof option.data ('time') != 'undefined') {
269
  var rotation_time = atob (option.data ('time'));
270
 
271
+
272
  if (ai_debug) {
273
+ var option_index = option.data ('index');
274
  var option_name = b64d (option.data ('name'));
275
+ console.log ('AI TIMED ROTATION index:', random_index + ' [', option_index + '],', 'name:', '"'+option_name+'",', 'time:', rotation_time);
276
  }
277
 
278
  if (rotation_time == 0 && rotate_options.length > 1) {
332
  }
333
  else if (typeof option.data ('group') != 'undefined') {
334
  if (ai_debug) {
335
+ var option_index = option.data ('index');
336
  var option_name = b64d (option.data ('name'));
337
+ console.log ('AI ROTATE GROUP', '"' + option_name + '",', 'index:', random_index, '[' + option_index + ']');
338
  }
339
  }
340
  else {
374
  ai_process_elements ();
375
  }
376
 
377
+ var option_index = option.data ('index');
378
  var option_name = b64d (option.data ('name'));
379
  var debug_block_frame = $(rotation_block).closest ('.ai-debug-block');
380
  if (debug_block_frame.length != 0) {
398
  if (adb_show_wrapping_div.attr ("data-ai-tracking")) {
399
  var data = JSON.parse (b64d (adb_show_wrapping_div.attr ("data-ai-tracking")));
400
  if (typeof data !== "undefined" && data.constructor === Array) {
401
+ // data [1] = random_index + 1;
402
+ data [1] = option_index;
403
  data [3] = option_name ;
404
 
405
  if (ai_debug) console.log ('AI ROTATE TRACKING DATA ', b64d (adb_show_wrapping_div.attr ("data-ai-tracking")), ' <= ', JSON.stringify (data));
419
  if (typeof wrapping_div.attr ("data-ai") != "undefined") {
420
  var data = JSON.parse (b64d (wrapping_div.attr ("data-ai")));
421
  if (typeof data !== "undefined" && data.constructor === Array) {
422
+ // data [1] = random_index + 1;
423
+ data [1] = option_index;
424
  data [3] = option_name;
425
  wrapping_div.attr ("data-ai", b64e (JSON.stringify (data)))
426
 
includes/js/ai-rotation.min.js CHANGED
@@ -1,12 +1,12 @@
1
- jQuery(function(a){function u(){a("div.ai-rotate.ai-rotation-groups").each(function(f,l){a(this).addClass("ai-timer");ai_process_rotation(this)})}var p=[];ai_process_rotation=function(f){if(a(f).hasClass("ai-unprocessed")||a(f).hasClass("ai-timer")){a(f).removeClass("ai-unprocessed").removeClass("ai-timer");var l=!1;if("undefined"!=typeof a(f).data("info")){var g="div.ai-rotate.ai-"+JSON.parse(atob(a(f).data("info")))[0];p.includes(g)&&(p.splice(p.indexOf(g),1),l=!0)}if("number"==typeof f.length)for(l=
2
- 0;l<f.length;l++)0==l?ai_process_single_rotation(f[l],!0):ai_process_single_rotation(f[l],!1);else ai_process_single_rotation(f,!l)}};ai_process_single_rotation=function(f,l){var g=a(f).children(".ai-rotate-option");if(0!=g.length){g.hide();if("undefined"==typeof a(f).data("next"))if("undefined"!=typeof a(g[0]).data("group")){var h=-1,t=[];a("span[data-ai-groups]").each(function(q){(a(this)[0].offsetWidth||a(this)[0].offsetHeight||a(this)[0].getClientRects().length)&&t.push(this)});1<=t.length&&JSON.parse(b64d(a(t).first().data("ai-groups"))).forEach(function(q,
3
- w){-1==h&&g.each(function(v){if(b64d(a(this).data("group"))==q)return h=v,!1})})}else{var e=a(f).data("shares");if("string"===typeof e){e=JSON.parse(atob(e));var d=Math.round(100*Math.random());for(var b=0;b<e.length&&(h=b,0>e[b]||!(d<=e[b]));b++);}else e=a(f).hasClass("ai-unique"),d=new Date,e?("number"!=typeof ai_rotation_seed&&(ai_rotation_seed=(Math.floor(1E3*Math.random())+d.getMilliseconds())%g.length),e=a(f).data("counter"),h=ai_rotation_seed+e,h>=g.length&&(h-=g.length)):(h=Math.floor(Math.random()*
4
- g.length),d.getMilliseconds()%2&&(h=g.length-h-1))}else h=parseInt(a(f).attr("data-next")),d=a(g[h]),"undefined"!=typeof d.data("code")&&(d=a(b64d(d.data("code")))),0!=d.find("span[data-ai-groups]").addBack("span[data-ai-groups]").length&&0!=a(".ai-rotation-groups").length&&setTimeout(function(){u()},5);if(a(f).hasClass("ai-rotation-scheduling"))for(h=-1,e=0;e<g.length;e++)if(d=a(g[e]),d=d.data("scheduling"),"undefined"!=typeof d){b=b64d(d);d=!0;0==b.indexOf("^")&&(d=!1,b=b.substring(1));var m=b.split("="),
5
- c=-1!=b.indexOf("%")?m[0].split("%"):[m[0]];b=c[0].trim().toLowerCase();c="undefined"!=typeof c[1]?c[1].trim():0;m=m[1].replace(" ","");var n=(new Date).getTime();n=new Date(n);var k=0;switch(b){case "s":k=n.getSeconds();break;case "i":k=n.getMinutes();break;case "h":k=n.getHours();break;case "d":k=n.getDate();break;case "m":k=n.getMonth();break;case "y":k=n.getFullYear();break;case "w":k=n.getDay(),k=0==k?6:k-1}b=0!=c?k%c:k;c=m.split(",");m=!d;for(n=0;n<c.length;n++)if(k=c[n],-1!=k.indexOf("-")){if(k=
6
- k.split("-"),b>=k[0]&&b<=k[1]){m=d;break}}else if(b==k){m=d;break}if(m){h=e;break}}if(!(0>h||h>=g.length)){d=a(g[h]);e="";if("undefined"!=typeof d.data("time")){b=atob(d.data("time"));if(0==b&&1<g.length){c=h;do{c++;c>=g.length&&(c=0);m=a(g[c]);if("undefined"==typeof m.data("time")){h=c;d=a(g[h]);b=0;break}m=atob(m.data("time"))}while(0==m&&c!=h);0!=b&&(h=c,d=a(g[h]),b=atob(d.data("time")))}if(0<b&&(c=h+1,c>=g.length&&(c=0),"undefined"!=typeof a(f).data("info"))){e=JSON.parse(atob(a(f).data("info")))[0];
7
- a(f).attr("data-next",c);var r="div.ai-rotate.ai-"+e;p.includes(r)&&(l=!1);l&&(p.push(r),setTimeout(function(){a(r).addClass("ai-timer");ai_process_rotation(a(r))},1E3*b));e=" ("+b+" s)"}}else"undefined"==typeof d.data("group")&&g.each(function(q){q!=h&&a(this).remove()});d.css({display:"",visibility:"",position:"",width:"",height:"",top:"",left:""}).removeClass("ai-rotate-hidden").removeClass("ai-rotate-hidden-2");a(f).css({position:""});"undefined"!=typeof d.data("code")&&(g.empty(),b=b64d(d.data("code")),
8
- d.append(b),ai_process_elements());d=b64d(d.data("name"));c=a(f).closest(".ai-debug-block");0!=c.length&&(b=c.find("kbd.ai-option-name"),c=c.find(".ai-debug-block"),"undefined"!=typeof c&&(c=c.find("kbd.ai-option-name"),b=b.slice(0,b.length-c.length)),"undefined"!=typeof b&&(c=b.first().data("separator"),"undefined"==typeof c&&(c=""),b.html(c+d+e)));b=!1;c=a(f).closest(".ai-adb-show");0!=c.length&&c.attr("data-ai-tracking")&&(e=JSON.parse(b64d(c.attr("data-ai-tracking"))),"undefined"!==typeof e&&
9
- e.constructor===Array&&(e[1]=h+1,e[3]=d,c.attr("data-ai-tracking",b64e(JSON.stringify(e))),c.addClass("ai-track"),b=!0));b||(b=a(f).closest("div[data-ai]"),"undefined"!=typeof b.attr("data-ai")&&(e=JSON.parse(b64d(b.attr("data-ai"))),"undefined"!==typeof e&&e.constructor===Array&&(e[1]=h+1,e[3]=d,b.attr("data-ai",b64e(JSON.stringify(e))),b.addClass("ai-track"))))}}};ai_process_rotations=function(){a("div.ai-rotate").each(function(f,l){ai_process_rotation(this)})};ai_process_rotations_in_element=function(f){a("div.ai-rotate",
10
- f).each(function(l,g){ai_process_rotation(this)})};a(document).ready(function(f){setTimeout(function(){ai_process_rotations()},10)})});ai_process_elements_active=!1;
11
  function ai_process_elements(){ai_process_elements_active||setTimeout(function(){ai_process_elements_active=!1;"function"==typeof ai_process_rotations&&ai_process_rotations();"function"==typeof ai_process_lists&&ai_process_lists(jQuery(".ai-list-data"));"function"==typeof ai_process_ip_addresses&&ai_process_ip_addresses(jQuery(".ai-ip-data"));"function"==typeof ai_process_filter_hooks&&ai_process_filter_hooks(jQuery(".ai-filter-check"));"function"==typeof ai_adb_process_blocks&&ai_adb_process_blocks();
12
  "function"==typeof ai_process_impressions&&1==ai_tracking_finished&&ai_process_impressions();"function"==typeof ai_install_click_trackers&&1==ai_tracking_finished&&ai_install_click_trackers();"function"==typeof ai_install_close_buttons&&ai_install_close_buttons(document)},5);ai_process_elements_active=!0};
1
+ jQuery(function(b){function u(){b("div.ai-rotate.ai-rotation-groups").each(function(e,m){b(this).addClass("ai-timer");ai_process_rotation(this)})}var p=[];ai_process_rotation=function(e){if(b(e).hasClass("ai-unprocessed")||b(e).hasClass("ai-timer")){b(e).removeClass("ai-unprocessed").removeClass("ai-timer");var m=!1;if("undefined"!=typeof b(e).data("info")){var a="div.ai-rotate.ai-"+JSON.parse(atob(b(e).data("info")))[0];p.includes(a)&&(p.splice(p.indexOf(a),1),m=!0)}if("number"==typeof e.length)for(m=
2
+ 0;m<e.length;m++)0==m?ai_process_single_rotation(e[m],!0):ai_process_single_rotation(e[m],!1);else ai_process_single_rotation(e,!m)}};ai_process_single_rotation=function(e,m){var a,k=b(e).children(".ai-rotate-option");if(0!=k.length){k.hide();if("undefined"==typeof b(e).data("next"))if("undefined"!=typeof b(k[0]).data("group")){var h=-1,t=[];b("span[data-ai-groups]").each(function(q){(b(this)[0].offsetWidth||b(this)[0].offsetHeight||b(this)[0].getClientRects().length)&&t.push(this)});1<=t.length&&
3
+ JSON.parse(b64d(b(t).first().data("ai-groups"))).forEach(function(q,w){-1==h&&k.each(function(v){if(b64d(b(this).data("group"))==q)return h=v,!1})})}else{var g=b(e).data("shares");if("string"===typeof g){g=JSON.parse(atob(g));var f=Math.round(100*Math.random());for(a=0;a<g.length&&(h=a,0>g[a]||!(f<=g[a]));a++);}else g=b(e).hasClass("ai-unique"),f=new Date,g?("number"!=typeof ai_rotation_seed&&(ai_rotation_seed=(Math.floor(1E3*Math.random())+f.getMilliseconds())%k.length),g=b(e).data("counter"),h=
4
+ ai_rotation_seed+g,h>=k.length&&(h-=k.length)):(h=Math.floor(Math.random()*k.length),f.getMilliseconds()%2&&(h=k.length-h-1))}else h=parseInt(b(e).attr("data-next")),a=b(k[h]),"undefined"!=typeof a.data("code")&&(a=b(b64d(a.data("code")))),0!=a.find("span[data-ai-groups]").addBack("span[data-ai-groups]").length&&0!=b(".ai-rotation-groups").length&&setTimeout(function(){u()},5);if(b(e).hasClass("ai-rotation-scheduling"))for(h=-1,g=0;g<k.length;g++)if(a=b(k[g]),f=a.data("scheduling"),"undefined"!=typeof f){a=
5
+ b64d(f);f=!0;0==a.indexOf("^")&&(f=!1,a=a.substring(1));var d=a.split("="),c=-1!=a.indexOf("%")?d[0].split("%"):[d[0]];a=c[0].trim().toLowerCase();c="undefined"!=typeof c[1]?c[1].trim():0;d=d[1].replace(" ","");var n=(new Date).getTime();n=new Date(n);var l=0;switch(a){case "s":l=n.getSeconds();break;case "i":l=n.getMinutes();break;case "h":l=n.getHours();break;case "d":l=n.getDate();break;case "m":l=n.getMonth();break;case "y":l=n.getFullYear();break;case "w":l=n.getDay(),l=0==l?6:l-1}a=0!=c?l%c:
6
+ l;c=d.split(",");d=!f;for(n=0;n<c.length;n++)if(l=c[n],-1!=l.indexOf("-")){if(l=l.split("-"),a>=l[0]&&a<=l[1]){d=f;break}}else if(a==l){d=f;break}if(d){h=g;break}}if(!(0>h||h>=k.length)){a=b(k[h]);f="";if("undefined"!=typeof a.data("time")){g=atob(a.data("time"));if(0==g&&1<k.length){c=h;do{c++;c>=k.length&&(c=0);d=b(k[c]);if("undefined"==typeof d.data("time")){h=c;a=b(k[h]);g=0;break}d=atob(d.data("time"))}while(0==d&&c!=h);0!=g&&(h=c,a=b(k[h]),g=atob(a.data("time")))}if(0<g&&(c=h+1,c>=k.length&&
7
+ (c=0),"undefined"!=typeof b(e).data("info"))){f=JSON.parse(atob(b(e).data("info")))[0];b(e).attr("data-next",c);var r="div.ai-rotate.ai-"+f;p.includes(r)&&(m=!1);m&&(p.push(r),setTimeout(function(){b(r).addClass("ai-timer");ai_process_rotation(b(r))},1E3*g));f=" ("+g+" s)"}}else"undefined"==typeof a.data("group")&&k.each(function(q){q!=h&&b(this).remove()});a.css({display:"",visibility:"",position:"",width:"",height:"",top:"",left:""}).removeClass("ai-rotate-hidden").removeClass("ai-rotate-hidden-2");
8
+ b(e).css({position:""});"undefined"!=typeof a.data("code")&&(k.empty(),g=b64d(a.data("code")),a.append(g),ai_process_elements());g=a.data("index");a=b64d(a.data("name"));d=b(e).closest(".ai-debug-block");0!=d.length&&(c=d.find("kbd.ai-option-name"),d=d.find(".ai-debug-block"),"undefined"!=typeof d&&(d=d.find("kbd.ai-option-name"),c=c.slice(0,c.length-d.length)),"undefined"!=typeof c&&(d=c.first().data("separator"),"undefined"==typeof d&&(d=""),c.html(d+a+f)));c=!1;d=b(e).closest(".ai-adb-show");0!=
9
+ d.length&&d.attr("data-ai-tracking")&&(f=JSON.parse(b64d(d.attr("data-ai-tracking"))),"undefined"!==typeof f&&f.constructor===Array&&(f[1]=g,f[3]=a,d.attr("data-ai-tracking",b64e(JSON.stringify(f))),d.addClass("ai-track"),c=!0));c||(c=b(e).closest("div[data-ai]"),"undefined"!=typeof c.attr("data-ai")&&(f=JSON.parse(b64d(c.attr("data-ai"))),"undefined"!==typeof f&&f.constructor===Array&&(f[1]=g,f[3]=a,c.attr("data-ai",b64e(JSON.stringify(f))),c.addClass("ai-track"))))}}};ai_process_rotations=function(){b("div.ai-rotate").each(function(e,
10
+ m){ai_process_rotation(this)})};ai_process_rotations_in_element=function(e){b("div.ai-rotate",e).each(function(m,a){ai_process_rotation(this)})};b(document).ready(function(e){setTimeout(function(){ai_process_rotations()},10)})});ai_process_elements_active=!1;
11
  function ai_process_elements(){ai_process_elements_active||setTimeout(function(){ai_process_elements_active=!1;"function"==typeof ai_process_rotations&&ai_process_rotations();"function"==typeof ai_process_lists&&ai_process_lists(jQuery(".ai-list-data"));"function"==typeof ai_process_ip_addresses&&ai_process_ip_addresses(jQuery(".ai-ip-data"));"function"==typeof ai_process_filter_hooks&&ai_process_filter_hooks(jQuery(".ai-filter-check"));"function"==typeof ai_adb_process_blocks&&ai_adb_process_blocks();
12
  "function"==typeof ai_process_impressions&&1==ai_tracking_finished&&ai_process_impressions();"function"==typeof ai_install_click_trackers&&1==ai_tracking_finished&&ai_install_click_trackers();"function"==typeof ai_install_close_buttons&&ai_install_close_buttons(document)},5);ai_process_elements_active=!0};
includes/preview.php CHANGED
@@ -63,14 +63,14 @@ function check_count_rotate_code ($obj, $check, $count, $rotate, $viewport, $fal
63
  <?php
64
  endif;
65
 
66
- if ($obj->roate_names !== null) : ?>
67
  <div style="display: inline-block; margin: 10px 0;">
68
  <div style="display: inline-block; vertical-align: middle;">
69
  ROTATE
70
  </div>
71
  <select id="rotate" style="min-width: 50px; margin: 0 10px 0 5px;">
72
  <?php
73
- foreach ($obj->roate_names as $index => $roate_name) {
74
  echo '<option value="', $index, '" ', $rotate == $index ? AD_SELECT_SELECTED : AD_EMPTY_VALUE, '>', $roate_name, '</option>';
75
  }
76
  ?>
63
  <?php
64
  endif;
65
 
66
+ if ($obj->rotate_names !== null) : ?>
67
  <div style="display: inline-block; margin: 10px 0;">
68
  <div style="display: inline-block; vertical-align: middle;">
69
  ROTATE
70
  </div>
71
  <select id="rotate" style="min-width: 50px; margin: 0 10px 0 5px;">
72
  <?php
73
+ foreach ($obj->rotate_names as $index => $roate_name) {
74
  echo '<option value="', $index, '" ', $rotate == $index ? AD_SELECT_SELECTED : AD_EMPTY_VALUE, '>', $roate_name, '</option>';
75
  }
76
  ?>
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.7.14"
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -5349,6 +5349,36 @@ jQuery(document).ready (function($) {
5349
 
5350
  check_and_configure_active_tab ();
5351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5352
  });
5353
 
5354
  $("label.ai-copy-block").click (function () {
@@ -6280,6 +6310,8 @@ jQuery(document).ready (function($) {
6280
 
6281
  configure_tabs ();
6282
 
 
 
6283
  $('#plugin_name').dblclick (function () {
6284
  $(".system-debugging").toggle();
6285
  });
@@ -6374,6 +6406,26 @@ jQuery(document).ready (function($) {
6374
  }
6375
  });
6376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6377
  $("#ai-list-search").keyup (function (event) {
6378
  if (!list_search_reload) {
6379
  list_search_reload = true;
@@ -6437,7 +6489,7 @@ jQuery(document).ready (function($) {
6437
  $("#ai-list-container").toggle ();
6438
  }
6439
 
6440
- $.get (ajaxurl+"?action=ai_ajax_backend&blocks-sticky=" + sticky + "&start=" + start + "&end=" + end + '&ai_check=' + ai_nonce, function (response, status, xhr) {
6441
  if (status == "error") {
6442
  var message = "Error updating sticky: " + xhr.status + " " + xhr.statusText;
6443
  var data_container = $("#ai-list-data");
1
+ var javascript_version = "2.7.15"
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
5349
 
5350
  check_and_configure_active_tab ();
5351
 
5352
+ if ($("#ai-settings-wrapper").hasClass ('settings-hidden')) {
5353
+ $('#ai-toggle-settings').click ();
5354
+ }
5355
+ });
5356
+
5357
+ $(".ai-range-link").click (function (event) {
5358
+ if (!$(this).hasClass ('button-clicked')) {
5359
+ $(this).addClass ('button-clicked');
5360
+
5361
+ var link = $(this).data ('address');
5362
+
5363
+ if ($("#ai-settings-wrapper").hasClass ('settings-hidden')) {
5364
+
5365
+ // Show settings and load new range
5366
+ $.get (ajaxurl+"?action=ai_ajax_backend&settings-hidden=0&ai_check=" + ai_nonce, function (response, status, xhr) {
5367
+ if (status == "error") {
5368
+ var message = "Error updating hidden settings: " + xhr.status + " " + xhr.statusText;
5369
+ var data_container = $("#ai-list-data");
5370
+ data_container.html (message);
5371
+ if (debug) console.log (message);
5372
+ } else {
5373
+ if (debug) console.log ('AI hidden settings:', response, 'loading:', link);
5374
+
5375
+ setTimeout (function() {
5376
+ window.location.href = link;
5377
+ }, 100);
5378
+ }
5379
+ });
5380
+ } else window.location.href = link;
5381
+ }
5382
  });
5383
 
5384
  $("label.ai-copy-block").click (function () {
6310
 
6311
  configure_tabs ();
6312
 
6313
+ $('.ai-extra-settings input[type=submit], .ai-extra-settings button.ai-button').button().show ();
6314
+
6315
  $('#plugin_name').dblclick (function () {
6316
  $(".system-debugging").toggle();
6317
  });
6406
  }
6407
  });
6408
 
6409
+ $("#ai-toggle-settings").click (function () {
6410
+ $("#ai-settings-wrapper").toggleClass ('settings-hidden');
6411
+
6412
+ var hidden = $(this).hasClass ('on') ? '1' : '0';
6413
+
6414
+ $(this).toggleClass ('on');
6415
+
6416
+ $.get (ajaxurl+"?action=ai_ajax_backend&settings-hidden=" + hidden + '&ai_check=' + ai_nonce, function (response, status, xhr) {
6417
+ if (status == "error") {
6418
+ var message = "Error updating hidden settings: " + xhr.status + " " + xhr.statusText;
6419
+ var data_container = $("#ai-list-data");
6420
+ data_container.html (message);
6421
+ if (debug) console.log (message);
6422
+ } else {
6423
+ if (debug) console.log ('AI hidden settings:', response);
6424
+ }
6425
+ });
6426
+
6427
+ });
6428
+
6429
  $("#ai-list-search").keyup (function (event) {
6430
  if (!list_search_reload) {
6431
  list_search_reload = true;
6489
  $("#ai-list-container").toggle ();
6490
  }
6491
 
6492
+ $.get (ajaxurl+"?action=ai_ajax_backend&blocks-sticky=" + sticky + '&ai_check=' + ai_nonce, function (response, status, xhr) {
6493
  if (status == "error") {
6494
  var message = "Error updating sticky: " + xhr.status + " " + xhr.statusText;
6495
  var data_container = $("#ai-list-data");
js/ad-inserter.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version="2.7.14",ignore_key=!0,start=1,end=16,active_tab=1,active_tab_0=0,tabs_to_configure=[],debug=!1,debug_title=!1,save_enabled=!0,current_tab=0,next_tab=0,syntax_highlighting=!1,settings_page="",dateFormat="yy-mm-dd",timeFormat="H:i:s",list_search_reload=!1,website_list_search_reload=!1,AI_DISABLED=0,AI_BEFORE_POST=1,AI_AFTER_POST=2,AI_BEFORE_CONTENT=3,AI_AFTER_CONTENT=4,AI_BEFORE_PARAGRAPH=5,AI_AFTER_PARAGRAPH=6,AI_BEFORE_EXCERPT=7,AI_AFTER_EXCERPT=8,AI_BETWEEN_POSTS=9,AI_BEFORE_COMMENTS=
2
  10,AI_BETWEEN_COMMENTS=11,AI_AFTER_COMMENTS=12,AI_FOOTER=13,AI_ABOVE_HEADER=14,AI_BEFORE_HTML_ELEMENT=15,AI_AFTER_HTML_ELEMENT=16,AI_INSIDE_HTML_ELEMENT=17,AI_BEFORE_IMAGE=18,AI_AFTER_IMAGE=19,AI_ALIGNMENT_DEFAULT=0,AI_ALIGNMENT_LEFT=1,AI_ALIGNMENT_RIGHT=2,AI_ALIGNMENT_CENTER=3,AI_ALIGNMENT_FLOAT_LEFT=4,AI_ALIGNMENT_FLOAT_RIGHT=5,AI_ALIGNMENT_NO_WRAPPING=6,AI_ALIGNMENT_CUSTOM_CSS=7,AI_ALIGNMENT_STICKY_LEFT=8,AI_ALIGNMENT_STICKY_RIGHT=9,AI_ALIGNMENT_STICKY_TOP=10,AI_ALIGNMENT_STICKY_BOTTOM=11,AI_ALIGNMENT_STICKY=
3
  12,AI_ADB_ACTION_NONE=0,AI_ADB_ACTION_MESSAGE=1,AI_ADB_ACTION_REDIRECTION=2,AI_ADB_BLOCK_ACTION_DO_NOTHING=0,AI_ADB_BLOCK_ACTION_REPLACE=1,AI_ADB_BLOCK_ACTION_SHOW=2,AI_ADB_BLOCK_ACTION_HIDE=3,AI_CODE_UNKNOWN=100,AI_CODE_BANNER=0,AI_CODE_ADSENSE=1,AI_CODE_AMAZON=2,AI_ADSENSE_STANDARD=0,AI_ADSENSE_LINK=1,AI_ADSENSE_IN_ARTICLE=2,AI_ADSENSE_IN_FEED=3,AI_ADSENSE_MATCHED_CONTENT=4,AI_ADSENSE_SIZE_FIXED=0,AI_ADSENSE_SIZE_RESPONSIVE=1,AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT=2,AI_HTML_INSERTION_CLIENT_SIDE=0,AI_HTML_INSERTION_SEREVR_SIDE=
4
  2,AI_STICK_TO_THE_LEFT=0,AI_STICK_TO_THE_CONTENT_LEFT=1,AI_STICK_HORIZONTAL_CENTER=2,AI_STICK_TO_THE_CONTENT_RIGHT=3,AI_STICK_TO_THE_RIGHT=4,AI_STICK_TO_THE_TOP=0,AI_STICK_VERTICAL_CENTER=1,AI_SCROLL_WITH_THE_CONTENT=2,AI_STICK_TO_THE_BOTTOM=3,AI_ANIMATION_NONE=0,AI_BACKGROUND_REPEAT_DEFAULT=0,AI_BACKGROUND_REPEAT_NO=1,AI_BACKGROUND_REPEAT_YES=2,AI_BACKGROUND_REPEAT_HORIZONTALY=3,AI_BACKGROUND_REPEAT_VERTICALLY=4,AI_BACKGROUND_REPEAT_SPACE=5,AI_BACKGROUND_REPEAT_ROUND=6,AI_BACKGROUND_SIZE_DEFAULT=
@@ -201,36 +201,37 @@ ignore_key=!1;else if(13==d)return a("#ai-save-websites").click(),ignore_key=!1,
201
  !0});a("#ai-website-list-table .ai-delete-website").click(function(){var b=a(this).closest("tr.ai-website-list"),d=b.data("website"),f=b.find(".ai-website-labels.ai-website-url").text();b=b.find(".ai-website-labels.ai-website-desc").text();var c=d;c=ai_admin.delete_website+"<br />"+b+"<br />"+f;a("<div />").html(c).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,resizable:!1,modal:!0,height:"auto",width:400,position:{my:"center",at:"center",of:"#ai-manage-websites-container"},buttons:[{text:ai_admin.cancel,
202
  click:function(){a(this).dialog("close")}},{text:ai_admin.delete_all,click:function(){a(this).dialog("close");a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K("&delete=all")}},{text:ai_admin["delete"],click:function(){a(this).dialog("close");a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K("&delete="+d)}}]})});a("#ai-website-list-table .ai-connect-website").click(function(){var b=
203
  a(this).closest("tr.ai-website-list"),d=b.data("website"),f=b.hasClass("read-only")?"&read-only=1":"";b.find(".ai-connect-website .checkbox-icon").hasClass("on");ai_reload_websites_function=function(){0==a("#ai-website-data .ai-ajax-error").length&&(window.location.href=ai_settings)};a("#ai-save-websites").is(":visible")?a("#ai-save-websites").attr("data-connect",d).click():K("&connect="+d+f)});a("#ai-website-data .ai-ajax-error").dblclick(function(){a("#ai-remote-dbg-error-msg").toggle()});a("#ai-website-list-table label[title]").tooltip({track:!0,
204
- delay:700,showURL:!1,showBody:" | ",fade:250})}function za(){var b=a("#ai-list-data");a(".ai-tab-link").click(function(){var d=a(this).data("tab")-start;a("#ai-tab-container").tabs({active:d});active_tab=parseInt(a(this).data("tab"));debug&&console.log("$('.ai-tab-link').click",active_tab);ya()});a("label.ai-copy-block").click(function(){var d=a(this).closest("tr").data("block");Sa(d,!0)});a("label.ai-pause-block").click(function(){if(!ai_read_only){var d=a(this).closest("tr").data("block");Q("cmd=pause&cmd-block="+
205
- d);ai_reload_list_function=function(){var f=a("#disable-insertion-"+d),c=f.parent().find(".icon-pause").hasClass("on");a("#ai-list-table tr.ai-block-"+d).find("label.ai-pause-block").hasClass("ai-paused")!=c&&f.click()}}});a("label.ai-preview-block").click(function(){var d=a(this).closest("tr").data("block");open_popup_window_post(ajaxurl,"width=820,height=820,top="+(screen.height/2-410)+",left=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no","preview",
206
- {action:"ai_ajax_backend",preview:d,ai_check:ai_nonce,read_only:1})});xa();b.disableSelection();a("#ai-list-data td[title]").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})}function K(b){website_list_search_reload=!1;var d=encodeURIComponent(a("#ai-website-list-search").val()),f=a("#ai-website-data");a("#ai-loading").show();"undefined"==typeof b&&(b="");f.load(ajaxurl+"?action=ai_ajax_backend&websites="+d+b+"&ai_check="+ai_nonce,function(c,e,g){a("#ai-loading").hide();"error"==e?
207
- (c="Error downloading website data: "+g.status+" "+g.statusText,f.html(c),debug&&console.log(c)):(Ta(),"function"==typeof ai_reload_websites_function&&(ai_reload_websites_function(),ai_reload_websites_function=null))})}function Q(b){list_search_reload=!1;var d=encodeURIComponent(a("#ai-list-search").val()),f=+!a("#ai-load-all").hasClass("light-blue"),c=a("#list-rearrange-controls"),e=c.hasClass("rearrange");c.removeClass("rearrange").hide();a("#ai-rearrange").removeClass("blue");c="";if(e){c=a("table#ai-list-table");
208
- var g=c.data("blocks");"undefined"==typeof g&&(g=[]);var n=[];c.find("tbody tr").each(function(q){n.push(a(this).data("block"))});c="&blocks-org="+JSON.stringify(g)+"&blocks-new="+JSON.stringify(n)}var r=a("#ai-list-data");g=parseInt(a("#ai-data").attr("safe-mode"))?"&safe-mode":"";b="undefined"==typeof b?"":"&"+b;a("#ai-loading").show();r.load(ajaxurl+"?action=ai_ajax_backend&list="+d+"&all="+f+"&start="+start+"&end="+end+"&active="+active_tab+c+g+b+"&ai_check="+ai_nonce,function(q,t,v){a("#ai-loading").hide();
209
- "error"==t?(q="Error downloading list data: "+v.status+" "+v.statusText,r.html(q),debug&&console.log(q)):(za(),"function"==typeof ai_reload_list_function&&(ai_reload_list_function(),ai_reload_list_function=null),e&&Ua())})}function R(b){adsense_search_reload=!1;var d=encodeURIComponent(a("#adsense-list-search").val()),f=+!a("#adsense-load-all").parent().find(".checkbox-icon").hasClass("on"),c=a("#adsense-list-data");c.load(ajaxurl+"?action=ai_ajax_backend&adsense-list="+d+"&all="+f+"&update_ad_units="+
210
- (b?1:0)+"&ai_check="+ai_nonce,function(e,g,n){a("#adsense-reload").parent().find(".checkbox-icon").removeClass("on");"error"==g?(e="Error downloading AdSense data: "+n.status+" "+n.statusText,c.html(e),debug&&console.log(e)):a("#adsense-client-id",c).length?(a("#adsense-list-controls").hide(),a("button.ai-top-button",c).button().show(),a("#save-client-ids").click(function(){var r=a("input#adsense-client-id").val(),q=a("input#adsense-client-secret").val();c.text(ai_admin.loading);a("#ai-loading").show();
211
- a.get(ajaxurl+"?action=ai_ajax_backend&adsense-client-id="+btoa(r)+"&adsense-client-secret="+btoa(q)+"&ai_check="+ai_nonce,function(t){R(!1)}).fail(function(t,v,B){console.log("Error saving AdSense client IDs: "+t.status+" "+t.statusText)}).always(function(){a("#ai-loading").hide()})}),a(".authorize-adsense",c).click(function(){a("#adsense-list-controls").show();c.text(ai_admin.loading);authorization_code="";ka(authorization_code)})):a("#adsense-authorization-code",c).length?(a("#adsense-list-controls").hide(),
212
- a("button.ai-top-button",c).button().show(),a(".authorize-adsense",c).click(function(){var r=a("input#adsense-authorization-code").val();a("#adsense-list-controls").show();c.text(ai_admin.loading);a(this).hasClass("clear-adsense")&&(r="");a(this).hasClass("own-ids")&&(r="own-ids");ka(r)})):(a("#adsense-list-controls").show(),e=a("#adsense-data",c).data("publisher-id"),"undefined"==typeof e&&(e=""),a("label#google-adsense-button").attr("title",ai_admin.google_adsense_homepage+" "+e).tooltip({track:!0,
213
- delay:700,showURL:!1,showBody:" | ",fade:250}),a("label.adsense-copy-code").click(function(){var r=a(this).closest("tr").data("id"),q=atob(a(this).closest("tr").data("name"));debug&&console.log("ADSENSE CODE: ",r);a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-code="+r+"&ai_check="+ai_nonce,function(t){t=JSON.parse(t);var v=t["error-message"];if(""==v){t=t.code;debug&&console.log(t);v=a("#ai-clipboard-template");var B=a("#ai-clipboard");B.html(v.html());B.find("input#name-edit-999").attr("value",
214
- q).attr("default",q);B.find("textarea.simple-editor").text(t);a("#ai-container .ai-copy").each(function(){a(this).next("label").find(".checkbox-icon").addClass("on")});t=a("#tools-button-"+active_tab);t.next("label").find(".checkbox-icon").hasClass("on")||t.click()}else console.log("AdSense API error:",v)}).fail(function(t,v,B){console.log("Error downloading AdSense code: "+t.status+" "+t.statusText)}).always(function(){a("#ai-loading").hide()})}),a("label.adsense-preview-code").click(function(){var r=
215
- a(this).closest("tr").data("id"),q=a(this).closest("tr").data("name"),t=screen.height/2-410;r={action:"ai_ajax_backend",preview:"adsense",ai_check:ai_nonce,read_only:1,slot_id:btoa(r),name:q};open_popup_window_post(ajaxurl,"width=820,height=820,top="+t+",left=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no","preview",r)}),a("label.adsense-get-code").click(function(){var r=a(this).closest("tr").data("id");atob(a(this).closest("tr").data("name"));debug&&console.log("ADSENSE CODE: ",
216
- r);a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-code="+r+"&ai_check="+ai_nonce,function(q){q=JSON.parse(q);var t=q["error-message"];""==t?(q=q.code,debug&&console.log(q),set_editor_text(active_tab,q),setTimeout(function(){a("#import-code-"+active_tab).click()},10)):console.log("AdSense API error:",t)}).fail(function(q,t,v){console.log("Error downloading AdSense code: "+q.status+" "+q.statusText)}).always(function(){a("#ai-loading").hide()})}),c.disableSelection())})}function O(){ads_txt_reload=
217
- !1;var b=a("#ads-txt-editor"),d=a("#ads-txt-reload"),f=a("#ads-txt-virtual").hasClass("violet")?"1":"0",c=b.hasClass("editor")?"text":"table",e=encodeURIComponent(a("#ads-txt-search").val()),g=a("#ads-txt-data");d.addClass("red");g.load(ajaxurl+"?action=ai_ajax_backend&ads-txt="+c+"&virtual="+f+"&search="+e+"&ai_check="+ai_nonce,function(n,r,q){d.removeClass("red");if("error"==r)n="Error loading ads.txt file: "+q.status+" "+q.statusText,g.html(n),debug&&console.log(n);else{0!=a("#ads-txt-missing").length&&
218
- (c="text",b.addClass("editor"),a("#ads-txt-search").hide());switch(c){case "text":a("#ads-txt-search").hide();b.removeClass("dashicons-edit");b.addClass("dashicons-yes-alt");b.addClass("green");b.attr("title",b.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});d.removeClass("dashicons-download");d.addClass("dashicons-no");0!=a("#ads-txt-missing").length?(d.removeClass("red"),d.attr("title",d.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",
219
- fade:250})):(d.addClass("red"),d.attr("title",d.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}));break;case "table":b.removeClass("dashicons-yes-alt"),b.removeClass("green"),b.addClass("dashicons-edit"),b.attr("title",b.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),d.removeClass("dashicons-no"),d.removeClass("red"),d.addClass("dashicons-download"),d.attr("title",d.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,
220
- showBody:" | ",fade:250})}a("#ads-txt-controls").show()}})}function Va(b){var d=a("#ads-txt-data"),f=a("#ads-txt-editor"),c=a("#ads-txt-reload"),e=a("#ads-txt-virtual").hasClass("violet")?"1":"0";d={text:b64e(d.find("textarea#ads-txt-text").val())};a("#ads-txt-error").text("");f.removeClass("green");f.addClass("red");a.post(ajaxurl+"?action=ai_ajax_backend&ads-txt=save&virtual="+e+"&ai_check="+ai_nonce,d).done(function(g){}).fail(function(g,n,r){f.removeClass("red");f.addClass("green");g="Error saving ads.txt file: "+
221
- g.status+" "+g.statusText;a("#ads-txt-error").text(g);debug&&console.log(g)}).always(function(){f.removeClass("editor");f.removeClass("green");f.removeClass("red");f.removeClass("dashicons-yes-alt");f.addClass("dashicons-edit");f.attr("title",f.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});c.addClass("dashicons-download");c.removeClass("dashicons-no");c.removeClass("red");c.attr("title",c.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",
222
- fade:250});a("#ads-txt-search").show();b&&setTimeout(function(){O()},100)})}function na(b){var d=parseInt(a("select#insertion-type-"+b+" option:selected").attr("value")),f=a("#page-types-"+b);switch(d){case AI_BEFORE_HTML_ELEMENT:case AI_AFTER_HTML_ELEMENT:case AI_INSIDE_HTML_ELEMENT:f.find("td.ai-page-type").removeClass("ai-unavailable");return}"po pa hp cp ap sp".split(" ").forEach(function(c,e){var g=a("table.check-pages").attr("data-positions-"+c);null!=g&&(-1!=JSON.parse(g).indexOf(d)?f.find("td.ai-page-type.ai-"+
223
- c).removeClass("ai-unavailable").find("input, label").removeAttr("title").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}):f.find("td.ai-page-type.ai-"+c).addClass("ai-unavailable").find("input, label").attr("title",ai_admin.position_might_not_available).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}))})}function Wa(b,d,f){var c=d.closest(".ai-check-pages").find(".ai-error-message");a.get(ajaxurl+"?action=ai_ajax_backend&check-page="+b+"&ai_check="+ai_nonce,function(e){if(""!=
224
- e){debug&&console.log("AI CHECK PAGES:",e);try{var g=JSON.parse(e),n=g.positions,r=g.urls;debug&&console.log("AI CHECK PAGES positions:",n);debug&&console.log("AI CHECK PAGES urls:",r);a("table.check-pages").attr("data-positions-"+b,JSON.stringify(n));a("table.check-pages").attr("data-urls-"+b,JSON.stringify(r));a("table.check-pages td.ai-position.ai-"+b).each(function(){a(this).removeClass("ai-not-checked");var q=a(this).data("insertion");-1==n.indexOf(q)?a(this).addClass("ai-no").attr("title",ai_admin.position_not_available):
225
- a(this).addClass("ai-yes").attr("title",ai_admin.position_available);a(this).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})});null!=r&&0!=r.length&&a("table.check-pages a.ai-"+b).each(function(q,t){"undefined"!=typeof r[q]&&a(this).attr("href",r[q]).show()})}catch(q){c.find(".ai-error-message-text").text(e),c.show(),console.log("AI CHECK PAGES: JSON error decoding available positions: "+e)}}}).fail(function(e,g,n){c.find(".ai-error-message-text").text(e.status+" "+e.statusText);
226
- c.show();console.log("AI CHECK PAGES: Error loading positions for",b+":",e.status,e.statusText)}).always(function(){if(f){a("#ai-loading").hide();a("#ai-loading-2").hide();d.find("span.ui-button-text").removeClass("on");for(var e=start;e<=end;e++)na(e)}})}function Aa(){var b=[];if(0!=ai_tab_setup_delay){0!=active_tab&&b.push(0);for(var d=end;d>=start;d--)d!=active_tab&&b.push(d)}tabs_to_configure=b.concat(tabs_to_configure);0!=ai_tab_setup_delay&&setTimeout(ia,3*ai_tab_setup_delay);b=16;0!=active_tab&&
227
- (b=active_tab-start);a("#ai-tab-container").tabs({active:b});a("#ai-plugin-settings-tab-container").tabs({active:active_tab_0});debug_title&&a("#plugin_name").css("color","#00f");0==active_tab?la():fa(active_tab);a("#dummy-tabs").hide();a("#ai-tabs").show();a("#ai-tab-container").on("tabsbeforeactivate",function(f,c){var e=c.newTab.attr("id");e.includes("ai-tab")&&(active_tab=e=parseInt(e.replace("ai-tab","")),debug&&console.log("on tabsbeforeactivate",active_tab),ya())});a(".ai-plugin-tab").click(function(){active_tab_0=
228
- a("#ai-plugin-settings-tab-container").tabs("option","active");debug&&console.log("active_tab_0: "+active_tab_0);if(syntax_highlighting){var f=a(this).attr("id");f=f.replace("ai-","");"h"==f?(f=ace.edit("editor-h"),f.getSession().highlightLines(1E7)):"f"==f?(f=ace.edit("editor-f"),f.getSession().highlightLines(1E7)):"a"==f&&(f=ace.edit("editor-a"),f.getSession().highlightLines(1E7))}});a("#check-pages-button").button({}).show().click(function(){var f=a(this),c=a(this).closest(".ai-check-pages").find(".ai-error-message");
229
- a("#ai-loading").show();a("#ai-loading-2").show();c.hide();f.find("span.ui-button-text").addClass("on");a("table.check-pages a").removeAttr("href").hide();var e="po pa hp cp ap sp".split(" ");e.forEach(function(g,n){a("table.check-pages td.ai-position").each(function(){a(this).removeClass("ai-yes").removeClass("ai-no").addClass("ai-not-checked").attr("title",ai_admin.position_not_checked);a(this).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})});a("table.ai-page-types td.ai-page-type").each(function(){a(this).removeClass("ai-unavailable")});
230
- setTimeout(function(){Wa(g,f,n==e.length-1)},300*n+10)})})}function Ua(){debug&&console.log("RELOAD SETTINGS");var b=a("#ai-container");a("#ai-error-container").hide();debug_title&&a("#plugin_name").css("color","#f00");a("#ai-loading").show();var d=a("#ai-tools-toolbar-"+active_tab).is(":visible"),f=a("#simple-editor-"+active_tab).is(":checked"),c=a("#copy-block-"+active_tab).next("label").find(".checkbox-icon").hasClass("on");b.load(ajaxurl+"?action=ai_ajax_backend&settings="+active_tab+"&ai_check="+
231
- ai_nonce,function(e,g,n){"error"==g?(a("#ai-loading").hide(),e=ai_admin.error_reloading_settings+": "+n.status+" "+n.statusText,a("#ai-error-container").text(e).show(),debug&&console.log(e)):(debug&&console.log(" Configuring..."),debug&&(ja=Z=(new Date).getTime()),Aa(),f&&a("#simple-editor-"+active_tab).click(),d&&a("#tools-button-"+active_tab).click(),c&&a("#ai-container .ai-copy").each(function(){a(this).next("label").find(".checkbox-icon").addClass("on")}),debug&&console.log(" Configured"),a("#ai-loading").hide())})}
232
- function ka(b){a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-authorization-code="+btoa(b)+"&ai_check="+ai_nonce,function(d){R(!1)}).fail(function(d,f,c){console.log("Error saving AdSense authorization: "+d.status+" "+d.statusText)}).always(function(){a("#ai-loading").hide()})}function ea(){var b=a("#adsense-list-container");b.toggle();b.is(":visible")?(a(".checkbox-icon.icon-adsense").addClass("on"),R(!1)):a(".checkbox-icon.icon-adsense").removeClass("on")}function Ba(){var b=
233
- encodeURIComponent(a("#block-class-name").val()),d=a("#block-class").is(":checked")?1:0,f=a("#block-number-class").is(":checked")?1:0,c=a("#block-name-class").is(":checked")?1:0,e=a("#inline-styles").is(":checked")?1:0;a.get(ajaxurl+"?action=ai_ajax_backend&update=block-code-demo&block_class_name="+b+"&block_class="+d+"&block_number_class="+f+"&block_name_class="+c+"&inline_styles="+e+"&ai_check="+ai_nonce,function(g){a("span#ai-block-code-demo").html(g)}).fail(function(g,n,r){console.log("Error updating block code demo: "+
 
234
  g.status+" "+g.statusText)})}0!=a("#export-container-0").length&&(a.elycharts.templates.ai={type:"line",margins:[10,38,20,38],defaultSeries:{fill:!0,fillProps:{opacity:.15},plotProps:{"stroke-width":1}},series:{serie1:{color:"#66f",rounded:.8},serie2:{color:"#888",axis:"r",fillProps:{opacity:.1}}},defaultAxis:{labels:!0,min:0},features:{grid:{draw:!0,forceBorder:!0,ny:5,ticks:{active:[!0,!0,!0],size:[4,0],props:{stroke:"#ccc"}}}},interactive:!1},a.elycharts.templates["ai-clicks"]={template:"ai",series:{serie1:{color:"#0a0",
235
  fillProps:{opacity:.2}},serie2:{color:"#888"}}},a.elycharts.templates["ai-impressions"]={template:"ai",series:{serie1:{color:"#66f"},serie2:{color:"#888"}}},a.elycharts.templates["ai-ctr"]={template:"ai",series:{serie1:{color:"#e22"},serie2:{color:"#888"}}},a.elycharts.templates["ai-versions"]={type:"line",margins:[10,38,20,38],defaultSeries:{color:"#0a0",fillProps:{opacity:.2},plotProps:{"stroke-width":2},tooltip:{frameProps:{opacity:.8}},rounded:.8},series:{serie1:{color:"#aaa",axis:"l"},serie2:{color:"#0a0",
236
  axis:"r"},serie3:{color:"#33f"},serie4:{color:"#e22"},serie5:{color:"#e2f"},serie6:{color:"#ec6400"},serie7:{color:"#00a3b5"},serie8:{color:"#7000ff"},serie9:{color:"#000"},serie10:{color:"#000"}},defaultAxis:{labels:!0,min:0},features:{grid:{draw:!0,forceBorder:!0,ny:5,ticks:{active:[!0,!0,!0],size:[4,0],props:{stroke:"#ccc"}}}},interactive:!0},a.elycharts.templates["ai-versions-legend"]={template:"ai-versions",margins:[10,38,10,38],defaultSeries:{fill:!0,fillProps:{opacity:0},plotProps:{"stroke-width":0}},
@@ -243,22 +244,23 @@ start;active_tab_0=0;try{var C=JSON.parse(a("#ai-active-tab").attr("value"));"un
243
  javascript_version),G=a("script[src*='ad-inserter.js']").attr("src"),"undefined"==typeof G?a("#javascript-version-parameter-missing").show():(javascript_version_parameter_string=G.split("=")[1],"undefined"==typeof javascript_version_parameter_string?a("#javascript-version-parameter-missing").show():javascript_version_parameter_string!=C&&(console.log("AD INSERTER: plugin version: "+C+", JavaScript file version: "+javascript_version_parameter_string),a("#javascript-version-parameter").show())),a("#javascript-version").html("Javascript<br />"+
244
  javascript_version),a("#javascript-warning").show());G=a("#ai-data").css("font-family").replace(/["']/g,"");if(-1==G.indexOf("."))a("#blocked-warning").show();else if(G!=C){console.log("AD INSERTER: plugin version:",C+", loaded CSS version:",G);var Ea=a("link[href*='ai-settings.css']").attr("href");"undefined"==typeof Ea?a("#css-version-parameter-missing").show():(css_version_parameter_string=Ea.split("=")[1],"undefined"==typeof css_version_parameter_string?a("#css-version-parameter-missing").show():
245
  css_version_parameter_string!=C&&(console.log("AD INSERTER: plugin version:",C+", CSS file version:",css_version_parameter_string),a("#css-version-parameter").show()));a("#css-version").html("CSS<br />"+G);a("#css-warning").show()}a(".header button").button().show();a("#ai-form").submit(function(b){for(var d=start;d<=end;d++)if(a("#rotation-"+d).parent().find(".icon-rotation").hasClass("on")){b.preventDefault();a("#ai-tab-container").tabs({active:d-1});b='<div class="checkbox-icon icon-rotation on" style="margin: 3px 10px 24px 0px;"></div><div>'+
246
- ai_admin.rotation_active+"</div>";a("<div />").html(b).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,resizable:!1,modal:!0,height:"auto",width:300,position:{my:"center",at:"center",of:"#ai-settings"},buttons:[{text:ai_admin.ok,click:function(){a(this).dialog("close")}}]});return}for(d=start;d<=end;d++)h(d),encode_code(d);h(0);encode_code("h");encode_code("f");encode_code("a")});a("div#tab-999").attr("id","ai-clipboard-template").insertBefore("#ai-clipboard");Aa();a("#plugin_name").dblclick(function(){a(".system-debugging").toggle()});
247
- a("#ai-stars").click(function(){""!=a("#rating-value span").text()&&(a("#ai-rating-bar").css("display","inline-block"),a("#ai-stars").hide());wa("update","")});a("#ai-rating-bar").click(function(){a("#ai-rating-bar").hide();a("#ai-stars").show()});a("#adsense-list").click(function(){ea()});a("#ai-ads-txt").click(function(){a(this).blur();var b=a("#ads-txt-container");b.toggle();b.is(":visible")?(a("#ai-ads-txt .checkbox-icon.icon-ads-txt").addClass("on"),O()):a("#ai-ads-txt .checkbox-icon.icon-ads-txt").removeClass("on")});
248
- a("#page-checker-button").click(function(){a("#page-checker-container").toggle();a("#page-checker-container").is(":visible")?(a(".page-checker-button").addClass("blue"),a("#page-checker-button").addClass("blue")):(a(".page-checker-button").removeClass("blue"),a("#page-checker-button").removeClass("blue"))});a("#ai-manage-websites").click(function(){a("#ai-manage-websites-container").toggle();a("#ai-manage-websites").toggleClass("blue");a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();
249
- a("#ai-rearrange-websites").removeClass("blue");a("#ai-manage-websites-container").is(":visible")&&K()});a("#ai-website-list-search").keyup(function(b){website_list_search_reload||(website_list_search_reload=!0,setTimeout(K,200))});a("#ai-list").click(function(){a("#ai-list").toggleClass("blue");var b=a("#ai-list-container");a("#ai-pin-list").hasClass("on")||a("#ai-list").hasClass("blue")==b.is(":visible")||b.toggle();b.is(":visible")&&Q();a("#ai-list").hasClass("blue")?(a("#plugin_name").hide(),
250
- a("#block-ranges").show()):(a("#plugin_name").show(),a("#block-ranges").hide())});a("#ai-list-search").keyup(function(b){list_search_reload||(list_search_reload=!0,setTimeout(Q,200))});a("#ai-load-all").click(function(){a(this).toggleClass("light-blue");Q()});a("#ai-rearrange").click(function(){a(this).toggleClass("blue");var b=a("#ai-list-data"),d=a("#list-rearrange-controls");a(this).hasClass("blue")?(a("#ai-rearrange").attr("title",ai_admin.cancel_rearrangement).tooltip({track:!0,delay:700,showURL:!1,
251
- showBody:" | ",fade:250}),d.show(),b.find("tbody").sortable({start:function(f,c){a("#list-save").show()},placeholder:"ui-state-highlight"}).css("cursor","move")):(b.find("tbody").sortable("disable"),a("#ai-rearrange").attr("title",ai_admin.rearrange_block_order).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),a("#list-save").hide(),d.hide(),Q())});a("#ai-save-changes").click(function(){a("#list-rearrange-controls").addClass("rearrange");Q()});a("#ai-pin-list").click(function(){a(this).toggleClass("on");
252
- var b=a(this).hasClass("on")?"1":"0";a("#ai-list").hasClass("blue")||a("#ai-list-container").toggle();a.get(ajaxurl+"?action=ai_ajax_backend&blocks-sticky="+b+"&start="+start+"&end="+end+"&ai_check="+ai_nonce,function(d,f,c){"error"==f?(d="Error updating sticky: "+c.status+" "+c.statusText,a("#ai-list-data").html(d),debug&&console.log(d)):debug&&console.log("AI blocks sticky:",d)})});a("#maxmind-db-status").hasClass("maxmind-db-missing")&&(C=ajaxurl+"?action=ai_ajax_backend&update=maxmind&ai_check="+
253
- ai_nonce,a("span.maxmind-db-missing").text(ai_admin.downloading),a.get(C,function(b){""==b?(a("span.maxmind-db-missing").closest(".notice.notice-error").hide(),a("#maxmind-db-status").text("")):(debug&&console.log(b),b=JSON.parse(b),debug&&console.log(b),"undefined"!==typeof b?(a(".notice span.maxmind-db-missing").text(b[0]),a("#maxmind-db-status").text(b[1])):a("span.maxmind-db-missing").text(ai_admin.update_error))}).fail(function(b,d,f){a("span.maxmind-db-missing").text(ai_admin.download_error)}));
254
- a("#adsense-load-all").click(function(){a(this).parent().find(".checkbox-icon").toggleClass("on");R(!1)});a("#adsense-list-search").keyup(function(b){adsense_search_reload||(adsense_search_reload=!0,setTimeout(function(){R(!1)},200))});a("#adsense-reload").click(function(){a(this).parent().find(".checkbox-icon").addClass("on");setTimeout(function(){R(!0)},200)});a("#clear-adsense-authorization").click(function(){a("#adsense-list-data").text(ai_admin.updating);ka("")});a(".ai-block-code-demo").change(function(){Ba()}).on("input",
255
- function(b){Ba()});setTimeout(function(){wa("")},1E3);a("#license-key").dblclick(function(){a("#hide-key").toggle()});a("input[title], button[title], label[title], h2[title], li[title], td[title], select[title], div[title], span[title]").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});debug&&console.log("");debug&&console.log("READY END");debug&&(C=(new Date).getTime(),console.log("main time: "+((C-Da)/1E3).toFixed(3)));a("#ads-txt-virtual").click(function(){function b(){var e=a("#ads-txt-virtual");
256
- e.removeClass("violet");e.attr("title",e.attr("title-physical")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});setTimeout(function(){O()},50)}var d=a("#ads-txt-editor").hasClass("editor")?"text":"table",f=a("#ads-txt-virtual");if(f.hasClass("violet")){f=ai_admin.switch_to_physical_ads_txt;var c=a("#ads-txt-data").find("textarea#ads-txt-text").val();0!=a("#ads-txt-missing").length||"table"!=d&&""==c?b():a("<div />").html(f).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,
257
- resizable:!1,modal:!0,height:"auto",width:400,position:{my:"center",at:"center",of:"#ads-txt-container"},buttons:[{text:ai_admin["switch"],click:function(){a(this).dialog("close");b()}},{text:ai_admin.cancel,click:function(){a(this).dialog("close")}}]})}else f.addClass("violet"),f.attr("title",f.attr("title-virtual")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),setTimeout(function(){O()},50)});a("#ads-txt-reload").click(function(){var b=a("#ads-txt-editor");b.hasClass("editor")&&
258
- b.removeClass("editor");setTimeout(function(){O()},50)});a("#ads-txt-editor").click(function(){a(this).hasClass("editor")?setTimeout(function(){Va(!0)},50):(a(this).addClass("editor"),setTimeout(function(){O()},50),a(this).attr("title",a(this).attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}))});a("#ads-txt-search").keyup(function(b){ads_txt_reload||(ads_txt_reload=!0,setTimeout(function(){O()},200))});a(".ai-public-controls").dblclick(function(){a(this).toggleClass("on")});
259
- a(".public-report-button").click(function(){var b=JSON.parse(a(this).attr("report-data")),d=b[0],f=b[1],c=a(this).parent().parent().parent().parent().find(".ai-public-controls").hasClass("on")?"1":"0",e=a(this).parent().parent().parent().parent().find(".custom-range-controls").attr("range-name"),g=b[2];b=b[3];""==b&&(b="---");f=f+c+g+e+b;c=b64e(f).replaceAll("+",".").replaceAll("/","_").replaceAll("=","-");d=d+md5(f).substring(0,2)+c;window.open(d,"ai-report")});a("#ai-list-data").hasClass("ai-sticky")&&
260
- za();a("#ai-cancel-websites").click(function(){a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K()});a("#ai-add-website").click(function(){a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");ai_reload_websites_function=function(){a("#ai-website-list-table tr.ai-website-list").last().find(".ai-website-labels.ai-website-desc").click()};K("&add=")});a("#ai-save-websites").click(function(){var b=
261
- a(this).attr("data-connect");"undefined"!==typeof b&&!1!==b?(a(this).removeAttr("data-connect"),b="&connect="+b):b="";a("#ai-website-list-table tr.ai-website-list").each(function(){var f=a(this);f.find(".ai-website-editor .ai-website-key").is(":visible")&&(f.find(".ai-website-editor .ai-website-key").attr("data-key",f.find(".ai-website-editor .ai-website-key").val()),f.find(".ai-website-labels.ai-website-desc").text(f.find(".ai-website-editor .ai-website-desc").val()),f.find(".ai-website-labels.ai-website-url").text(f.find(".ai-website-editor .ai-website-url").val()),
262
- f.find(".ai-website-labels").show(),f.find(".ai-website-editor").hide())});var d=[];a("#ai-website-list-table tr.ai-website-list").each(function(){var f=a(this),c=f.find(".ai-website-labels.ai-website-url").text().trim(),e=f.find(".ai-website-labels.ai-website-desc").text().trim();f=f.find(".ai-website-editor .ai-website-key").attr("data-key").trim();""!=c&&d.push({url:c,name:e,key:b64e(f)})});a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");
263
- K("&save="+b64e(JSON.stringify(d))+b)});a("#ai-rearrange-websites").click(function(){a(this).toggleClass("blue");var b=a("#ai-website-data");a(this).hasClass("blue")?(a("#ai-website-list-table .ai-delete-website").each(function(){a(this).closest("tr.ai-website-list").find(".ai-connect-website .checkbox-icon").hasClass("on")||a(this).show()}),b.find("tbody").sortable({start:function(d,f){a("#ai-cancel-websites").show();a("#ai-save-websites").show()},placeholder:"ui-state-highlight"}).css("cursor",
264
- "move")):(b.find("tbody").sortable("disable"),K())});a(".ai-managing").length&&(setTimeout(function(){window.location.href=ai_settings},18E5),check_managing_slave(),a("#ai-connected").click(function(){a(this).css("color","#ababab");a("#ai-loading").show();ai_reload_websites_function=function(){0==a("#ai-website-data .ai-ajax-error").length&&(window.location.href=ai_settings)};K("&connect=")}))});
 
1
+ var javascript_version="2.7.15",ignore_key=!0,start=1,end=16,active_tab=1,active_tab_0=0,tabs_to_configure=[],debug=!1,debug_title=!1,save_enabled=!0,current_tab=0,next_tab=0,syntax_highlighting=!1,settings_page="",dateFormat="yy-mm-dd",timeFormat="H:i:s",list_search_reload=!1,website_list_search_reload=!1,AI_DISABLED=0,AI_BEFORE_POST=1,AI_AFTER_POST=2,AI_BEFORE_CONTENT=3,AI_AFTER_CONTENT=4,AI_BEFORE_PARAGRAPH=5,AI_AFTER_PARAGRAPH=6,AI_BEFORE_EXCERPT=7,AI_AFTER_EXCERPT=8,AI_BETWEEN_POSTS=9,AI_BEFORE_COMMENTS=
2
  10,AI_BETWEEN_COMMENTS=11,AI_AFTER_COMMENTS=12,AI_FOOTER=13,AI_ABOVE_HEADER=14,AI_BEFORE_HTML_ELEMENT=15,AI_AFTER_HTML_ELEMENT=16,AI_INSIDE_HTML_ELEMENT=17,AI_BEFORE_IMAGE=18,AI_AFTER_IMAGE=19,AI_ALIGNMENT_DEFAULT=0,AI_ALIGNMENT_LEFT=1,AI_ALIGNMENT_RIGHT=2,AI_ALIGNMENT_CENTER=3,AI_ALIGNMENT_FLOAT_LEFT=4,AI_ALIGNMENT_FLOAT_RIGHT=5,AI_ALIGNMENT_NO_WRAPPING=6,AI_ALIGNMENT_CUSTOM_CSS=7,AI_ALIGNMENT_STICKY_LEFT=8,AI_ALIGNMENT_STICKY_RIGHT=9,AI_ALIGNMENT_STICKY_TOP=10,AI_ALIGNMENT_STICKY_BOTTOM=11,AI_ALIGNMENT_STICKY=
3
  12,AI_ADB_ACTION_NONE=0,AI_ADB_ACTION_MESSAGE=1,AI_ADB_ACTION_REDIRECTION=2,AI_ADB_BLOCK_ACTION_DO_NOTHING=0,AI_ADB_BLOCK_ACTION_REPLACE=1,AI_ADB_BLOCK_ACTION_SHOW=2,AI_ADB_BLOCK_ACTION_HIDE=3,AI_CODE_UNKNOWN=100,AI_CODE_BANNER=0,AI_CODE_ADSENSE=1,AI_CODE_AMAZON=2,AI_ADSENSE_STANDARD=0,AI_ADSENSE_LINK=1,AI_ADSENSE_IN_ARTICLE=2,AI_ADSENSE_IN_FEED=3,AI_ADSENSE_MATCHED_CONTENT=4,AI_ADSENSE_SIZE_FIXED=0,AI_ADSENSE_SIZE_RESPONSIVE=1,AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT=2,AI_HTML_INSERTION_CLIENT_SIDE=0,AI_HTML_INSERTION_SEREVR_SIDE=
4
  2,AI_STICK_TO_THE_LEFT=0,AI_STICK_TO_THE_CONTENT_LEFT=1,AI_STICK_HORIZONTAL_CENTER=2,AI_STICK_TO_THE_CONTENT_RIGHT=3,AI_STICK_TO_THE_RIGHT=4,AI_STICK_TO_THE_TOP=0,AI_STICK_VERTICAL_CENTER=1,AI_SCROLL_WITH_THE_CONTENT=2,AI_STICK_TO_THE_BOTTOM=3,AI_ANIMATION_NONE=0,AI_BACKGROUND_REPEAT_DEFAULT=0,AI_BACKGROUND_REPEAT_NO=1,AI_BACKGROUND_REPEAT_YES=2,AI_BACKGROUND_REPEAT_HORIZONTALY=3,AI_BACKGROUND_REPEAT_VERTICALLY=4,AI_BACKGROUND_REPEAT_SPACE=5,AI_BACKGROUND_REPEAT_ROUND=6,AI_BACKGROUND_SIZE_DEFAULT=
201
  !0});a("#ai-website-list-table .ai-delete-website").click(function(){var b=a(this).closest("tr.ai-website-list"),d=b.data("website"),f=b.find(".ai-website-labels.ai-website-url").text();b=b.find(".ai-website-labels.ai-website-desc").text();var c=d;c=ai_admin.delete_website+"<br />"+b+"<br />"+f;a("<div />").html(c).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,resizable:!1,modal:!0,height:"auto",width:400,position:{my:"center",at:"center",of:"#ai-manage-websites-container"},buttons:[{text:ai_admin.cancel,
202
  click:function(){a(this).dialog("close")}},{text:ai_admin.delete_all,click:function(){a(this).dialog("close");a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K("&delete=all")}},{text:ai_admin["delete"],click:function(){a(this).dialog("close");a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K("&delete="+d)}}]})});a("#ai-website-list-table .ai-connect-website").click(function(){var b=
203
  a(this).closest("tr.ai-website-list"),d=b.data("website"),f=b.hasClass("read-only")?"&read-only=1":"";b.find(".ai-connect-website .checkbox-icon").hasClass("on");ai_reload_websites_function=function(){0==a("#ai-website-data .ai-ajax-error").length&&(window.location.href=ai_settings)};a("#ai-save-websites").is(":visible")?a("#ai-save-websites").attr("data-connect",d).click():K("&connect="+d+f)});a("#ai-website-data .ai-ajax-error").dblclick(function(){a("#ai-remote-dbg-error-msg").toggle()});a("#ai-website-list-table label[title]").tooltip({track:!0,
204
+ delay:700,showURL:!1,showBody:" | ",fade:250})}function za(){var b=a("#ai-list-data");a(".ai-tab-link").click(function(){var d=a(this).data("tab")-start;a("#ai-tab-container").tabs({active:d});active_tab=parseInt(a(this).data("tab"));debug&&console.log("$('.ai-tab-link').click",active_tab);ya();a("#ai-settings-wrapper").hasClass("settings-hidden")&&a("#ai-toggle-settings").click()});a(".ai-range-link").click(function(d){if(!a(this).hasClass("button-clicked")){a(this).addClass("button-clicked");var f=
205
+ a(this).data("address");a("#ai-settings-wrapper").hasClass("settings-hidden")?a.get(ajaxurl+"?action=ai_ajax_backend&settings-hidden=0&ai_check="+ai_nonce,function(c,e,g){"error"==e?(c="Error updating hidden settings: "+g.status+" "+g.statusText,a("#ai-list-data").html(c),debug&&console.log(c)):(debug&&console.log("AI hidden settings:",c,"loading:",f),setTimeout(function(){window.location.href=f},100))}):window.location.href=f}});a("label.ai-copy-block").click(function(){var d=a(this).closest("tr").data("block");
206
+ Sa(d,!0)});a("label.ai-pause-block").click(function(){if(!ai_read_only){var d=a(this).closest("tr").data("block");Q("cmd=pause&cmd-block="+d);ai_reload_list_function=function(){var f=a("#disable-insertion-"+d),c=f.parent().find(".icon-pause").hasClass("on");a("#ai-list-table tr.ai-block-"+d).find("label.ai-pause-block").hasClass("ai-paused")!=c&&f.click()}}});a("label.ai-preview-block").click(function(){var d=a(this).closest("tr").data("block");open_popup_window_post(ajaxurl,"width=820,height=820,top="+
207
+ (screen.height/2-410)+",left=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no","preview",{action:"ai_ajax_backend",preview:d,ai_check:ai_nonce,read_only:1})});xa();b.disableSelection();a("#ai-list-data td[title]").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})}function K(b){website_list_search_reload=!1;var d=encodeURIComponent(a("#ai-website-list-search").val()),f=a("#ai-website-data");a("#ai-loading").show();"undefined"==typeof b&&(b=
208
+ "");f.load(ajaxurl+"?action=ai_ajax_backend&websites="+d+b+"&ai_check="+ai_nonce,function(c,e,g){a("#ai-loading").hide();"error"==e?(c="Error downloading website data: "+g.status+" "+g.statusText,f.html(c),debug&&console.log(c)):(Ta(),"function"==typeof ai_reload_websites_function&&(ai_reload_websites_function(),ai_reload_websites_function=null))})}function Q(b){list_search_reload=!1;var d=encodeURIComponent(a("#ai-list-search").val()),f=+!a("#ai-load-all").hasClass("light-blue"),c=a("#list-rearrange-controls"),
209
+ e=c.hasClass("rearrange");c.removeClass("rearrange").hide();a("#ai-rearrange").removeClass("blue");c="";if(e){c=a("table#ai-list-table");var g=c.data("blocks");"undefined"==typeof g&&(g=[]);var n=[];c.find("tbody tr").each(function(q){n.push(a(this).data("block"))});c="&blocks-org="+JSON.stringify(g)+"&blocks-new="+JSON.stringify(n)}var r=a("#ai-list-data");g=parseInt(a("#ai-data").attr("safe-mode"))?"&safe-mode":"";b="undefined"==typeof b?"":"&"+b;a("#ai-loading").show();r.load(ajaxurl+"?action=ai_ajax_backend&list="+
210
+ d+"&all="+f+"&start="+start+"&end="+end+"&active="+active_tab+c+g+b+"&ai_check="+ai_nonce,function(q,t,v){a("#ai-loading").hide();"error"==t?(q="Error downloading list data: "+v.status+" "+v.statusText,r.html(q),debug&&console.log(q)):(za(),"function"==typeof ai_reload_list_function&&(ai_reload_list_function(),ai_reload_list_function=null),e&&Ua())})}function R(b){adsense_search_reload=!1;var d=encodeURIComponent(a("#adsense-list-search").val()),f=+!a("#adsense-load-all").parent().find(".checkbox-icon").hasClass("on"),
211
+ c=a("#adsense-list-data");c.load(ajaxurl+"?action=ai_ajax_backend&adsense-list="+d+"&all="+f+"&update_ad_units="+(b?1:0)+"&ai_check="+ai_nonce,function(e,g,n){a("#adsense-reload").parent().find(".checkbox-icon").removeClass("on");"error"==g?(e="Error downloading AdSense data: "+n.status+" "+n.statusText,c.html(e),debug&&console.log(e)):a("#adsense-client-id",c).length?(a("#adsense-list-controls").hide(),a("button.ai-top-button",c).button().show(),a("#save-client-ids").click(function(){var r=a("input#adsense-client-id").val(),
212
+ q=a("input#adsense-client-secret").val();c.text(ai_admin.loading);a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-client-id="+btoa(r)+"&adsense-client-secret="+btoa(q)+"&ai_check="+ai_nonce,function(t){R(!1)}).fail(function(t,v,B){console.log("Error saving AdSense client IDs: "+t.status+" "+t.statusText)}).always(function(){a("#ai-loading").hide()})}),a(".authorize-adsense",c).click(function(){a("#adsense-list-controls").show();c.text(ai_admin.loading);authorization_code="";
213
+ ka(authorization_code)})):a("#adsense-authorization-code",c).length?(a("#adsense-list-controls").hide(),a("button.ai-top-button",c).button().show(),a(".authorize-adsense",c).click(function(){var r=a("input#adsense-authorization-code").val();a("#adsense-list-controls").show();c.text(ai_admin.loading);a(this).hasClass("clear-adsense")&&(r="");a(this).hasClass("own-ids")&&(r="own-ids");ka(r)})):(a("#adsense-list-controls").show(),e=a("#adsense-data",c).data("publisher-id"),"undefined"==typeof e&&(e=
214
+ ""),a("label#google-adsense-button").attr("title",ai_admin.google_adsense_homepage+" "+e).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),a("label.adsense-copy-code").click(function(){var r=a(this).closest("tr").data("id"),q=atob(a(this).closest("tr").data("name"));debug&&console.log("ADSENSE CODE: ",r);a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-code="+r+"&ai_check="+ai_nonce,function(t){t=JSON.parse(t);var v=t["error-message"];if(""==v){t=t.code;debug&&
215
+ console.log(t);v=a("#ai-clipboard-template");var B=a("#ai-clipboard");B.html(v.html());B.find("input#name-edit-999").attr("value",q).attr("default",q);B.find("textarea.simple-editor").text(t);a("#ai-container .ai-copy").each(function(){a(this).next("label").find(".checkbox-icon").addClass("on")});t=a("#tools-button-"+active_tab);t.next("label").find(".checkbox-icon").hasClass("on")||t.click()}else console.log("AdSense API error:",v)}).fail(function(t,v,B){console.log("Error downloading AdSense code: "+
216
+ t.status+" "+t.statusText)}).always(function(){a("#ai-loading").hide()})}),a("label.adsense-preview-code").click(function(){var r=a(this).closest("tr").data("id"),q=a(this).closest("tr").data("name"),t=screen.height/2-410;r={action:"ai_ajax_backend",preview:"adsense",ai_check:ai_nonce,read_only:1,slot_id:btoa(r),name:q};open_popup_window_post(ajaxurl,"width=820,height=820,top="+t+",left=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no","preview",r)}),a("label.adsense-get-code").click(function(){var r=
217
+ a(this).closest("tr").data("id");atob(a(this).closest("tr").data("name"));debug&&console.log("ADSENSE CODE: ",r);a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-code="+r+"&ai_check="+ai_nonce,function(q){q=JSON.parse(q);var t=q["error-message"];""==t?(q=q.code,debug&&console.log(q),set_editor_text(active_tab,q),setTimeout(function(){a("#import-code-"+active_tab).click()},10)):console.log("AdSense API error:",t)}).fail(function(q,t,v){console.log("Error downloading AdSense code: "+
218
+ q.status+" "+q.statusText)}).always(function(){a("#ai-loading").hide()})}),c.disableSelection())})}function O(){ads_txt_reload=!1;var b=a("#ads-txt-editor"),d=a("#ads-txt-reload"),f=a("#ads-txt-virtual").hasClass("violet")?"1":"0",c=b.hasClass("editor")?"text":"table",e=encodeURIComponent(a("#ads-txt-search").val()),g=a("#ads-txt-data");d.addClass("red");g.load(ajaxurl+"?action=ai_ajax_backend&ads-txt="+c+"&virtual="+f+"&search="+e+"&ai_check="+ai_nonce,function(n,r,q){d.removeClass("red");if("error"==
219
+ r)n="Error loading ads.txt file: "+q.status+" "+q.statusText,g.html(n),debug&&console.log(n);else{0!=a("#ads-txt-missing").length&&(c="text",b.addClass("editor"),a("#ads-txt-search").hide());switch(c){case "text":a("#ads-txt-search").hide();b.removeClass("dashicons-edit");b.addClass("dashicons-yes-alt");b.addClass("green");b.attr("title",b.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});d.removeClass("dashicons-download");d.addClass("dashicons-no");0!=a("#ads-txt-missing").length?
220
+ (d.removeClass("red"),d.attr("title",d.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})):(d.addClass("red"),d.attr("title",d.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}));break;case "table":b.removeClass("dashicons-yes-alt"),b.removeClass("green"),b.addClass("dashicons-edit"),b.attr("title",b.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),d.removeClass("dashicons-no"),d.removeClass("red"),
221
+ d.addClass("dashicons-download"),d.attr("title",d.attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})}a("#ads-txt-controls").show()}})}function Va(b){var d=a("#ads-txt-data"),f=a("#ads-txt-editor"),c=a("#ads-txt-reload"),e=a("#ads-txt-virtual").hasClass("violet")?"1":"0";d={text:b64e(d.find("textarea#ads-txt-text").val())};a("#ads-txt-error").text("");f.removeClass("green");f.addClass("red");a.post(ajaxurl+"?action=ai_ajax_backend&ads-txt=save&virtual="+e+"&ai_check="+
222
+ ai_nonce,d).done(function(g){}).fail(function(g,n,r){f.removeClass("red");f.addClass("green");g="Error saving ads.txt file: "+g.status+" "+g.statusText;a("#ads-txt-error").text(g);debug&&console.log(g)}).always(function(){f.removeClass("editor");f.removeClass("green");f.removeClass("red");f.removeClass("dashicons-yes-alt");f.addClass("dashicons-edit");f.attr("title",f.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});c.addClass("dashicons-download");c.removeClass("dashicons-no");
223
+ c.removeClass("red");c.attr("title",c.attr("title-editor")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});a("#ads-txt-search").show();b&&setTimeout(function(){O()},100)})}function na(b){var d=parseInt(a("select#insertion-type-"+b+" option:selected").attr("value")),f=a("#page-types-"+b);switch(d){case AI_BEFORE_HTML_ELEMENT:case AI_AFTER_HTML_ELEMENT:case AI_INSIDE_HTML_ELEMENT:f.find("td.ai-page-type").removeClass("ai-unavailable");return}"po pa hp cp ap sp".split(" ").forEach(function(c,
224
+ e){var g=a("table.check-pages").attr("data-positions-"+c);null!=g&&(-1!=JSON.parse(g).indexOf(d)?f.find("td.ai-page-type.ai-"+c).removeClass("ai-unavailable").find("input, label").removeAttr("title").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}):f.find("td.ai-page-type.ai-"+c).addClass("ai-unavailable").find("input, label").attr("title",ai_admin.position_might_not_available).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}))})}function Wa(b,d,f){var c=d.closest(".ai-check-pages").find(".ai-error-message");
225
+ a.get(ajaxurl+"?action=ai_ajax_backend&check-page="+b+"&ai_check="+ai_nonce,function(e){if(""!=e){debug&&console.log("AI CHECK PAGES:",e);try{var g=JSON.parse(e),n=g.positions,r=g.urls;debug&&console.log("AI CHECK PAGES positions:",n);debug&&console.log("AI CHECK PAGES urls:",r);a("table.check-pages").attr("data-positions-"+b,JSON.stringify(n));a("table.check-pages").attr("data-urls-"+b,JSON.stringify(r));a("table.check-pages td.ai-position.ai-"+b).each(function(){a(this).removeClass("ai-not-checked");
226
+ var q=a(this).data("insertion");-1==n.indexOf(q)?a(this).addClass("ai-no").attr("title",ai_admin.position_not_available):a(this).addClass("ai-yes").attr("title",ai_admin.position_available);a(this).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250})});null!=r&&0!=r.length&&a("table.check-pages a.ai-"+b).each(function(q,t){"undefined"!=typeof r[q]&&a(this).attr("href",r[q]).show()})}catch(q){c.find(".ai-error-message-text").text(e),c.show(),console.log("AI CHECK PAGES: JSON error decoding available positions: "+
227
+ e)}}}).fail(function(e,g,n){c.find(".ai-error-message-text").text(e.status+" "+e.statusText);c.show();console.log("AI CHECK PAGES: Error loading positions for",b+":",e.status,e.statusText)}).always(function(){if(f){a("#ai-loading").hide();a("#ai-loading-2").hide();d.find("span.ui-button-text").removeClass("on");for(var e=start;e<=end;e++)na(e)}})}function Aa(){var b=[];if(0!=ai_tab_setup_delay){0!=active_tab&&b.push(0);for(var d=end;d>=start;d--)d!=active_tab&&b.push(d)}tabs_to_configure=b.concat(tabs_to_configure);
228
+ 0!=ai_tab_setup_delay&&setTimeout(ia,3*ai_tab_setup_delay);b=16;0!=active_tab&&(b=active_tab-start);a("#ai-tab-container").tabs({active:b});a("#ai-plugin-settings-tab-container").tabs({active:active_tab_0});debug_title&&a("#plugin_name").css("color","#00f");0==active_tab?la():fa(active_tab);a("#dummy-tabs").hide();a("#ai-tabs").show();a("#ai-tab-container").on("tabsbeforeactivate",function(f,c){var e=c.newTab.attr("id");e.includes("ai-tab")&&(active_tab=e=parseInt(e.replace("ai-tab","")),debug&&console.log("on tabsbeforeactivate",
229
+ active_tab),ya())});a(".ai-plugin-tab").click(function(){active_tab_0=a("#ai-plugin-settings-tab-container").tabs("option","active");debug&&console.log("active_tab_0: "+active_tab_0);if(syntax_highlighting){var f=a(this).attr("id");f=f.replace("ai-","");"h"==f?(f=ace.edit("editor-h"),f.getSession().highlightLines(1E7)):"f"==f?(f=ace.edit("editor-f"),f.getSession().highlightLines(1E7)):"a"==f&&(f=ace.edit("editor-a"),f.getSession().highlightLines(1E7))}});a("#check-pages-button").button({}).show().click(function(){var f=
230
+ a(this),c=a(this).closest(".ai-check-pages").find(".ai-error-message");a("#ai-loading").show();a("#ai-loading-2").show();c.hide();f.find("span.ui-button-text").addClass("on");a("table.check-pages a").removeAttr("href").hide();var e="po pa hp cp ap sp".split(" ");e.forEach(function(g,n){a("table.check-pages td.ai-position").each(function(){a(this).removeClass("ai-yes").removeClass("ai-no").addClass("ai-not-checked").attr("title",ai_admin.position_not_checked);a(this).tooltip({track:!0,delay:700,showURL:!1,
231
+ showBody:" | ",fade:250})});a("table.ai-page-types td.ai-page-type").each(function(){a(this).removeClass("ai-unavailable")});setTimeout(function(){Wa(g,f,n==e.length-1)},300*n+10)})})}function Ua(){debug&&console.log("RELOAD SETTINGS");var b=a("#ai-container");a("#ai-error-container").hide();debug_title&&a("#plugin_name").css("color","#f00");a("#ai-loading").show();var d=a("#ai-tools-toolbar-"+active_tab).is(":visible"),f=a("#simple-editor-"+active_tab).is(":checked"),c=a("#copy-block-"+active_tab).next("label").find(".checkbox-icon").hasClass("on");
232
+ b.load(ajaxurl+"?action=ai_ajax_backend&settings="+active_tab+"&ai_check="+ai_nonce,function(e,g,n){"error"==g?(a("#ai-loading").hide(),e=ai_admin.error_reloading_settings+": "+n.status+" "+n.statusText,a("#ai-error-container").text(e).show(),debug&&console.log(e)):(debug&&console.log(" Configuring..."),debug&&(ja=Z=(new Date).getTime()),Aa(),f&&a("#simple-editor-"+active_tab).click(),d&&a("#tools-button-"+active_tab).click(),c&&a("#ai-container .ai-copy").each(function(){a(this).next("label").find(".checkbox-icon").addClass("on")}),
233
+ debug&&console.log(" Configured"),a("#ai-loading").hide())})}function ka(b){a("#ai-loading").show();a.get(ajaxurl+"?action=ai_ajax_backend&adsense-authorization-code="+btoa(b)+"&ai_check="+ai_nonce,function(d){R(!1)}).fail(function(d,f,c){console.log("Error saving AdSense authorization: "+d.status+" "+d.statusText)}).always(function(){a("#ai-loading").hide()})}function ea(){var b=a("#adsense-list-container");b.toggle();b.is(":visible")?(a(".checkbox-icon.icon-adsense").addClass("on"),R(!1)):a(".checkbox-icon.icon-adsense").removeClass("on")}
234
+ function Ba(){var b=encodeURIComponent(a("#block-class-name").val()),d=a("#block-class").is(":checked")?1:0,f=a("#block-number-class").is(":checked")?1:0,c=a("#block-name-class").is(":checked")?1:0,e=a("#inline-styles").is(":checked")?1:0;a.get(ajaxurl+"?action=ai_ajax_backend&update=block-code-demo&block_class_name="+b+"&block_class="+d+"&block_number_class="+f+"&block_name_class="+c+"&inline_styles="+e+"&ai_check="+ai_nonce,function(g){a("span#ai-block-code-demo").html(g)}).fail(function(g,n,r){console.log("Error updating block code demo: "+
235
  g.status+" "+g.statusText)})}0!=a("#export-container-0").length&&(a.elycharts.templates.ai={type:"line",margins:[10,38,20,38],defaultSeries:{fill:!0,fillProps:{opacity:.15},plotProps:{"stroke-width":1}},series:{serie1:{color:"#66f",rounded:.8},serie2:{color:"#888",axis:"r",fillProps:{opacity:.1}}},defaultAxis:{labels:!0,min:0},features:{grid:{draw:!0,forceBorder:!0,ny:5,ticks:{active:[!0,!0,!0],size:[4,0],props:{stroke:"#ccc"}}}},interactive:!1},a.elycharts.templates["ai-clicks"]={template:"ai",series:{serie1:{color:"#0a0",
236
  fillProps:{opacity:.2}},serie2:{color:"#888"}}},a.elycharts.templates["ai-impressions"]={template:"ai",series:{serie1:{color:"#66f"},serie2:{color:"#888"}}},a.elycharts.templates["ai-ctr"]={template:"ai",series:{serie1:{color:"#e22"},serie2:{color:"#888"}}},a.elycharts.templates["ai-versions"]={type:"line",margins:[10,38,20,38],defaultSeries:{color:"#0a0",fillProps:{opacity:.2},plotProps:{"stroke-width":2},tooltip:{frameProps:{opacity:.8}},rounded:.8},series:{serie1:{color:"#aaa",axis:"l"},serie2:{color:"#0a0",
237
  axis:"r"},serie3:{color:"#33f"},serie4:{color:"#e22"},serie5:{color:"#e2f"},serie6:{color:"#ec6400"},serie7:{color:"#00a3b5"},serie8:{color:"#7000ff"},serie9:{color:"#000"},serie10:{color:"#000"}},defaultAxis:{labels:!0,min:0},features:{grid:{draw:!0,forceBorder:!0,ny:5,ticks:{active:[!0,!0,!0],size:[4,0],props:{stroke:"#ccc"}}}},interactive:!0},a.elycharts.templates["ai-versions-legend"]={template:"ai-versions",margins:[10,38,10,38],defaultSeries:{fill:!0,fillProps:{opacity:0},plotProps:{"stroke-width":0}},
244
  javascript_version),G=a("script[src*='ad-inserter.js']").attr("src"),"undefined"==typeof G?a("#javascript-version-parameter-missing").show():(javascript_version_parameter_string=G.split("=")[1],"undefined"==typeof javascript_version_parameter_string?a("#javascript-version-parameter-missing").show():javascript_version_parameter_string!=C&&(console.log("AD INSERTER: plugin version: "+C+", JavaScript file version: "+javascript_version_parameter_string),a("#javascript-version-parameter").show())),a("#javascript-version").html("Javascript<br />"+
245
  javascript_version),a("#javascript-warning").show());G=a("#ai-data").css("font-family").replace(/["']/g,"");if(-1==G.indexOf("."))a("#blocked-warning").show();else if(G!=C){console.log("AD INSERTER: plugin version:",C+", loaded CSS version:",G);var Ea=a("link[href*='ai-settings.css']").attr("href");"undefined"==typeof Ea?a("#css-version-parameter-missing").show():(css_version_parameter_string=Ea.split("=")[1],"undefined"==typeof css_version_parameter_string?a("#css-version-parameter-missing").show():
246
  css_version_parameter_string!=C&&(console.log("AD INSERTER: plugin version:",C+", CSS file version:",css_version_parameter_string),a("#css-version-parameter").show()));a("#css-version").html("CSS<br />"+G);a("#css-warning").show()}a(".header button").button().show();a("#ai-form").submit(function(b){for(var d=start;d<=end;d++)if(a("#rotation-"+d).parent().find(".icon-rotation").hasClass("on")){b.preventDefault();a("#ai-tab-container").tabs({active:d-1});b='<div class="checkbox-icon icon-rotation on" style="margin: 3px 10px 24px 0px;"></div><div>'+
247
+ ai_admin.rotation_active+"</div>";a("<div />").html(b).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,resizable:!1,modal:!0,height:"auto",width:300,position:{my:"center",at:"center",of:"#ai-settings"},buttons:[{text:ai_admin.ok,click:function(){a(this).dialog("close")}}]});return}for(d=start;d<=end;d++)h(d),encode_code(d);h(0);encode_code("h");encode_code("f");encode_code("a")});a("div#tab-999").attr("id","ai-clipboard-template").insertBefore("#ai-clipboard");Aa();a(".ai-extra-settings input[type=submit], .ai-extra-settings button.ai-button").button().show();
248
+ a("#plugin_name").dblclick(function(){a(".system-debugging").toggle()});a("#ai-stars").click(function(){""!=a("#rating-value span").text()&&(a("#ai-rating-bar").css("display","inline-block"),a("#ai-stars").hide());wa("update","")});a("#ai-rating-bar").click(function(){a("#ai-rating-bar").hide();a("#ai-stars").show()});a("#adsense-list").click(function(){ea()});a("#ai-ads-txt").click(function(){a(this).blur();var b=a("#ads-txt-container");b.toggle();b.is(":visible")?(a("#ai-ads-txt .checkbox-icon.icon-ads-txt").addClass("on"),
249
+ O()):a("#ai-ads-txt .checkbox-icon.icon-ads-txt").removeClass("on")});a("#page-checker-button").click(function(){a("#page-checker-container").toggle();a("#page-checker-container").is(":visible")?(a(".page-checker-button").addClass("blue"),a("#page-checker-button").addClass("blue")):(a(".page-checker-button").removeClass("blue"),a("#page-checker-button").removeClass("blue"))});a("#ai-manage-websites").click(function(){a("#ai-manage-websites-container").toggle();a("#ai-manage-websites").toggleClass("blue");
250
+ a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");a("#ai-manage-websites-container").is(":visible")&&K()});a("#ai-website-list-search").keyup(function(b){website_list_search_reload||(website_list_search_reload=!0,setTimeout(K,200))});a("#ai-list").click(function(){a("#ai-list").toggleClass("blue");var b=a("#ai-list-container");a("#ai-pin-list").hasClass("on")||a("#ai-list").hasClass("blue")==b.is(":visible")||b.toggle();b.is(":visible")&&
251
+ Q();a("#ai-list").hasClass("blue")?(a("#plugin_name").hide(),a("#block-ranges").show()):(a("#plugin_name").show(),a("#block-ranges").hide())});a("#ai-toggle-settings").click(function(){a("#ai-settings-wrapper").toggleClass("settings-hidden");var b=a(this).hasClass("on")?"1":"0";a(this).toggleClass("on");a.get(ajaxurl+"?action=ai_ajax_backend&settings-hidden="+b+"&ai_check="+ai_nonce,function(d,f,c){"error"==f?(d="Error updating hidden settings: "+c.status+" "+c.statusText,a("#ai-list-data").html(d),
252
+ debug&&console.log(d)):debug&&console.log("AI hidden settings:",d)})});a("#ai-list-search").keyup(function(b){list_search_reload||(list_search_reload=!0,setTimeout(Q,200))});a("#ai-load-all").click(function(){a(this).toggleClass("light-blue");Q()});a("#ai-rearrange").click(function(){a(this).toggleClass("blue");var b=a("#ai-list-data"),d=a("#list-rearrange-controls");a(this).hasClass("blue")?(a("#ai-rearrange").attr("title",ai_admin.cancel_rearrangement).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",
253
+ fade:250}),d.show(),b.find("tbody").sortable({start:function(f,c){a("#list-save").show()},placeholder:"ui-state-highlight"}).css("cursor","move")):(b.find("tbody").sortable("disable"),a("#ai-rearrange").attr("title",ai_admin.rearrange_block_order).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),a("#list-save").hide(),d.hide(),Q())});a("#ai-save-changes").click(function(){a("#list-rearrange-controls").addClass("rearrange");Q()});a("#ai-pin-list").click(function(){a(this).toggleClass("on");
254
+ var b=a(this).hasClass("on")?"1":"0";a("#ai-list").hasClass("blue")||a("#ai-list-container").toggle();a.get(ajaxurl+"?action=ai_ajax_backend&blocks-sticky="+b+"&ai_check="+ai_nonce,function(d,f,c){"error"==f?(d="Error updating sticky: "+c.status+" "+c.statusText,a("#ai-list-data").html(d),debug&&console.log(d)):debug&&console.log("AI blocks sticky:",d)})});a("#maxmind-db-status").hasClass("maxmind-db-missing")&&(C=ajaxurl+"?action=ai_ajax_backend&update=maxmind&ai_check="+ai_nonce,a("span.maxmind-db-missing").text(ai_admin.downloading),
255
+ a.get(C,function(b){""==b?(a("span.maxmind-db-missing").closest(".notice.notice-error").hide(),a("#maxmind-db-status").text("")):(debug&&console.log(b),b=JSON.parse(b),debug&&console.log(b),"undefined"!==typeof b?(a(".notice span.maxmind-db-missing").text(b[0]),a("#maxmind-db-status").text(b[1])):a("span.maxmind-db-missing").text(ai_admin.update_error))}).fail(function(b,d,f){a("span.maxmind-db-missing").text(ai_admin.download_error)}));a("#adsense-load-all").click(function(){a(this).parent().find(".checkbox-icon").toggleClass("on");
256
+ R(!1)});a("#adsense-list-search").keyup(function(b){adsense_search_reload||(adsense_search_reload=!0,setTimeout(function(){R(!1)},200))});a("#adsense-reload").click(function(){a(this).parent().find(".checkbox-icon").addClass("on");setTimeout(function(){R(!0)},200)});a("#clear-adsense-authorization").click(function(){a("#adsense-list-data").text(ai_admin.updating);ka("")});a(".ai-block-code-demo").change(function(){Ba()}).on("input",function(b){Ba()});setTimeout(function(){wa("")},1E3);a("#license-key").dblclick(function(){a("#hide-key").toggle()});
257
+ a("input[title], button[title], label[title], h2[title], li[title], td[title], select[title], div[title], span[title]").tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250});debug&&console.log("");debug&&console.log("READY END");debug&&(C=(new Date).getTime(),console.log("main time: "+((C-Da)/1E3).toFixed(3)));a("#ads-txt-virtual").click(function(){function b(){var e=a("#ads-txt-virtual");e.removeClass("violet");e.attr("title",e.attr("title-physical")).tooltip({track:!0,delay:700,showURL:!1,
258
+ showBody:" | ",fade:250});setTimeout(function(){O()},50)}var d=a("#ads-txt-editor").hasClass("editor")?"text":"table",f=a("#ads-txt-virtual");if(f.hasClass("violet")){f=ai_admin.switch_to_physical_ads_txt;var c=a("#ads-txt-data").find("textarea#ads-txt-text").val();0!=a("#ads-txt-missing").length||"table"!=d&&""==c?b():a("<div />").html(f).attr("title",ai_admin.warning).dialog({bgiframe:!0,draggable:!1,resizable:!1,modal:!0,height:"auto",width:400,position:{my:"center",at:"center",of:"#ads-txt-container"},
259
+ buttons:[{text:ai_admin["switch"],click:function(){a(this).dialog("close");b()}},{text:ai_admin.cancel,click:function(){a(this).dialog("close")}}]})}else f.addClass("violet"),f.attr("title",f.attr("title-virtual")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}),setTimeout(function(){O()},50)});a("#ads-txt-reload").click(function(){var b=a("#ads-txt-editor");b.hasClass("editor")&&b.removeClass("editor");setTimeout(function(){O()},50)});a("#ads-txt-editor").click(function(){a(this).hasClass("editor")?
260
+ setTimeout(function(){Va(!0)},50):(a(this).addClass("editor"),setTimeout(function(){O()},50),a(this).attr("title",a(this).attr("title-table")).tooltip({track:!0,delay:700,showURL:!1,showBody:" | ",fade:250}))});a("#ads-txt-search").keyup(function(b){ads_txt_reload||(ads_txt_reload=!0,setTimeout(function(){O()},200))});a(".ai-public-controls").dblclick(function(){a(this).toggleClass("on")});a(".public-report-button").click(function(){var b=JSON.parse(a(this).attr("report-data")),d=b[0],f=b[1],c=a(this).parent().parent().parent().parent().find(".ai-public-controls").hasClass("on")?
261
+ "1":"0",e=a(this).parent().parent().parent().parent().find(".custom-range-controls").attr("range-name"),g=b[2];b=b[3];""==b&&(b="---");f=f+c+g+e+b;c=b64e(f).replaceAll("+",".").replaceAll("/","_").replaceAll("=","-");d=d+md5(f).substring(0,2)+c;window.open(d,"ai-report")});a("#ai-list-data").hasClass("ai-sticky")&&za();a("#ai-cancel-websites").click(function(){a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K()});a("#ai-add-website").click(function(){a("#ai-cancel-websites").hide();
262
+ a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");ai_reload_websites_function=function(){a("#ai-website-list-table tr.ai-website-list").last().find(".ai-website-labels.ai-website-desc").click()};K("&add=")});a("#ai-save-websites").click(function(){var b=a(this).attr("data-connect");"undefined"!==typeof b&&!1!==b?(a(this).removeAttr("data-connect"),b="&connect="+b):b="";a("#ai-website-list-table tr.ai-website-list").each(function(){var f=a(this);f.find(".ai-website-editor .ai-website-key").is(":visible")&&
263
+ (f.find(".ai-website-editor .ai-website-key").attr("data-key",f.find(".ai-website-editor .ai-website-key").val()),f.find(".ai-website-labels.ai-website-desc").text(f.find(".ai-website-editor .ai-website-desc").val()),f.find(".ai-website-labels.ai-website-url").text(f.find(".ai-website-editor .ai-website-url").val()),f.find(".ai-website-labels").show(),f.find(".ai-website-editor").hide())});var d=[];a("#ai-website-list-table tr.ai-website-list").each(function(){var f=a(this),c=f.find(".ai-website-labels.ai-website-url").text().trim(),
264
+ e=f.find(".ai-website-labels.ai-website-desc").text().trim();f=f.find(".ai-website-editor .ai-website-key").attr("data-key").trim();""!=c&&d.push({url:c,name:e,key:b64e(f)})});a("#ai-cancel-websites").hide();a("#ai-save-websites").hide();a("#ai-rearrange-websites").removeClass("blue");K("&save="+b64e(JSON.stringify(d))+b)});a("#ai-rearrange-websites").click(function(){a(this).toggleClass("blue");var b=a("#ai-website-data");a(this).hasClass("blue")?(a("#ai-website-list-table .ai-delete-website").each(function(){a(this).closest("tr.ai-website-list").find(".ai-connect-website .checkbox-icon").hasClass("on")||
265
+ a(this).show()}),b.find("tbody").sortable({start:function(d,f){a("#ai-cancel-websites").show();a("#ai-save-websites").show()},placeholder:"ui-state-highlight"}).css("cursor","move")):(b.find("tbody").sortable("disable"),K())});a(".ai-managing").length&&(setTimeout(function(){window.location.href=ai_settings},18E5),check_managing_slave(),a("#ai-connected").click(function(){a(this).css("color","#ababab");a("#ai-loading").show();ai_reload_websites_function=function(){0==a("#ai-website-data .ai-ajax-error").length&&
266
+ (window.location.href=ai_settings)};K("&connect=")}))});
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: adinserter, spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
  Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection, header code, banners, in-feed ads, sticky fixed widgets, hooks
6
  Requires at least: 4.9
7
- Tested up to: 5.9
8
- Requires PHP: 6.0
9
- Stable tag: 2.7.14
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
@@ -359,6 +359,13 @@ If you are not happy to reveal this information and you have opted in, simply di
359
 
360
  == Changelog ==
361
 
 
 
 
 
 
 
 
362
  = 2.7.14 =
363
  - Added support for demo settings
364
  - Added support for background transparency
@@ -646,6 +653,13 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
646
 
647
  == Upgrade Notice ==
648
 
 
 
 
 
 
 
 
649
  = 2.7.14 =
650
  Added support for demo settings;
651
  Added support for background transparency;
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
  Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection, header code, banners, in-feed ads, sticky fixed widgets, hooks
6
  Requires at least: 4.9
7
+ Tested up to: 6.0
8
+ Requires PHP: 5.6
9
+ Stable tag: 2.7.15
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
359
 
360
  == Changelog ==
361
 
362
+ = 2.7.15 =
363
+ - Added filter hooks for ad labels
364
+ - Added support for variables
365
+ - Added support for rotation option index attribute
366
+ - Added shortcodes for block number and block name
367
+ - Few minor bug fixes, cosmetic changes and code improvements
368
+
369
  = 2.7.14 =
370
  - Added support for demo settings
371
  - Added support for background transparency
653
 
654
  == Upgrade Notice ==
655
 
656
+ = 2.7.15 =
657
+ Added filter hooks for ad labels;
658
+ Added support for variables;
659
+ Added support for rotation option index attribute;
660
+ Added shortcodes for block number and block name;
661
+ Few minor bug fixes, cosmetic changes and code improvements
662
+
663
  = 2.7.14 =
664
  Added support for demo settings;
665
  Added support for background transparency;
settings.php CHANGED
@@ -37,6 +37,36 @@ function generate_settings_form (){
37
  }
38
  }
39
  @unlink ($ai_demo_settings_file);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  $save_url = $_SERVER ['REQUEST_URI'];
@@ -181,6 +211,8 @@ function generate_settings_form (){
181
 
182
  if (function_exists ('ai_admin_settings_notices')) ai_admin_settings_notices ();
183
 
 
 
184
  ?>
185
 
186
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" tab-setup-delay="<?php echo get_tab_setup_delay (); ?>" safe-mode="<?php echo defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode']) ? '1' : '0'; ?>" js_debugging="<?php echo $ai_wp_data [AI_BACKEND_JS_DEBUGGING] ? '1' : '0'; ?>"></div>
@@ -193,6 +225,8 @@ function generate_settings_form (){
193
 
194
  <div style="clear: both;"></div>
195
 
 
 
196
  <div id="ai-settings" style="float: left;" data-home-url="<?php echo home_url (); ?>/" data-home-relative-url="<?php echo wp_make_link_relative (get_site_url ()); ?>/">
197
 
198
  <form id="ai-form" class="no-select rounded<?php echo function_exists ('ai_settings_flags') ? ai_settings_flags () : ''; ?>" style="float: left;" action="<?php echo esc_attr ($save_url); ?>" method="post" name="ai_form" start="<?php echo $start; ?>" end="<?php echo $end; ?>" gmt="<?php echo get_option ('gmt_offset') * 3600 * 1000; ?>" ai-settings="<?php echo base64_encode (admin_url ('options-general.php?page=ad-inserter.php'.$url_safe_mode)); ?>" ai-value="<?php echo base64_encode (wp_create_nonce ("adinserter_data")); ?>">
@@ -201,21 +235,29 @@ function generate_settings_form (){
201
 
202
  <div id="header" class="ai-form header rounded">
203
  <div id= "ai-settings-header" style="float: left;">
204
- <h2 id="plugin_name" style="margin: 5px 0;"><?php echo function_exists ('ai_settings_version') ? ai_settings_version () : (AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION); ?></h2>
205
 
206
  <div id="block-ranges">
207
  <?php
 
 
 
 
208
  for ($range = 1; $range <= intval ((96 + 15) / 16); $range ++){
209
  $range_start = ($range - 1) * 16 + 1;
210
  $range_end = $range_start + 16 - 1;
211
  if ($range_end > 96) $range_end = 96;
212
  if (($active_tab >= $range_start && $active_tab <= $range_end) || ($start == $range_start && $active_tab == 0)) $style = "font-weight: bold; color: #44e; "; else $style = "";
213
  ?>
214
- <button type="button" class="ai-top-button" id="button-range-<?php echo $range; ?>" style="margin-right: 0px; outline: none;" onclick="window.location.href='<?php echo admin_url('options-general.php?page=ad-inserter.php&start='.$range_start.$url_safe_mode); ?>'">
215
  <span style="<?php echo $style; ?>"><?php echo $range_start, " - ", $range_end; ?></span>
216
  </button>
217
- <?php } ?>
 
 
 
218
  </div>
 
219
  </div>
220
 
221
  <div id="header-buttons">
@@ -2727,26 +2769,53 @@ function generate_settings_form (){
2727
 
2728
  </div>
2729
 
2730
- <div id="tab-viewports" class="rounded">
2731
- <div style="margin: 0 0 8px 0;">
2732
- <strong><?php _e ('Viewport Settings used for client-side device detection', 'ad-inserter'); ?></strong>
2733
- </div>
 
 
2734
  <?php
2735
 
2736
  for ($viewport = 1; $viewport <= 6; $viewport ++) {
2737
  $bottom_margin = $viewport == 6 ? 0 : 4;
2738
  ?>
2739
- <div style="margin: 4px 0 <?php echo $bottom_margin; ?>px 0;">
2740
  <?php /* Translators: %d: viewport number */ printf (__('Viewport %d name', 'ad-inserter'), $viewport); ?>&nbsp;&nbsp;&nbsp;
2741
- <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" />
2742
- <?php if ($viewport == 6) echo '<span style="display: none;">' ?>
2743
- &nbsp;&nbsp; <?php _e ('min width', 'ad-inserter'); ?>
2744
- <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
2745
- <?php if ($viewport == 6) echo '</span>' ?>
 
 
 
 
 
2746
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2747
  <?php
2748
  }
2749
  ?>
 
2750
  </div>
2751
 
2752
  <div id="tab-hooks" class="rounded">
@@ -3410,7 +3479,11 @@ function generate_settings_form (){
3410
  }
3411
 
3412
  }
 
3413
  ?>
 
 
 
3414
 
3415
  <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="[<?php echo $active_tab, ',', $active_tab_0; ?>]" />
3416
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
@@ -3425,6 +3498,7 @@ function generate_settings_form (){
3425
 
3426
  <?php
3427
  if ($subpage == 'main') {
 
3428
  page_checker_container ();
3429
  ads_txt_container ();
3430
  if (defined ('AI_ADSENSE_API')) {
@@ -3472,6 +3546,8 @@ function generate_settings_form (){
3472
  <img id="ai-dummy-2" src="<?php echo AD_INSERTER_PLUGIN_URL, 'css/images/'; ?>blank.png" style="width: 1px; height: 1px; display: block; margin-top: -1px;" />
3473
  </div>
3474
 
 
 
3475
  <script type="text/javascript">
3476
  jQuery(document).ready(function($) {
3477
  setTimeout (check_blocked_images, 400);
@@ -4441,9 +4517,13 @@ function code_block_list ($start, $end, $search_text, $show_all_blocks, $active_
4441
 
4442
  if (ai_pro ()) {
4443
  $limits =
4444
- $obj->get_visitor_max_impressions () || ($obj->get_visitor_limit_impressions_per_time_period () && $obj->get_visitor_limit_impressions_time_period ()) ||
4445
- $obj->get_visitor_max_clicks () || ($obj->get_visitor_limit_clicks_per_time_period () && $obj->get_visitor_limit_clicks_time_period ());
4446
-
 
 
 
 
4447
  }
4448
 
4449
  $block_text = $block . ' '. $obj->get_ad_name () . ' ' . $obj->get_automatic_insertion_text() . ' ' . implode (', ', $sidebars_with_widget [$block]);
@@ -4515,7 +4595,8 @@ function code_block_list ($start, $end, $search_text, $show_all_blocks, $active_
4515
  <?php if ($visible_tab): ?>
4516
  <td class="ai-tab-link" data-tab="<?php echo $block; ?>" style=" min-width: 120px; color: #0073aa; cursor: pointer; text-align: left; padding-left: 5px; max-width: 220px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name(); ?></td>
4517
  <?php else: ?>
4518
- <td style="min-width: 120px; text-align: left; padding-left: 5px; max-width: 250px; white-space: nowrap; overflow: hidden;"><a href="<?php echo $edit_url; ?>" style="text-decoration: none; box-shadow: 0 0 0;"><?php echo $obj->get_ad_name(); ?></a></td>
 
4519
  <?php endif ?>
4520
  <td style="min-width: 80px; text-align: left; padding-left: 5px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>" title="<?php echo $insertion_title; ?>"><?php echo $obj->get_automatic_insertion_text(), $insertion_parameter; ?></td>
4521
  <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top;"><span class="<?php echo $process_php ? 'checkbox-icon size-img16 icon-php on' : ''; ?>" style="margin-top: 1px;"></span></td>
37
  }
38
  }
39
  @unlink ($ai_demo_settings_file);
40
+
41
+ $download_url = "https://adinserter.pro/downloads/ai-articles.txt";
42
+ $ai_articles = download_url ($download_url);
43
+
44
+ if (is_string ($ai_articles) && file_exists ($ai_articles)) {
45
+ $articles = explode ('[AI]', file_get_contents ($ai_articles));
46
+
47
+ if (!empty ($articles) && isset ($articles [0]) && substr ($articles [0], 0, 5) === '<!--|') {
48
+ foreach ($articles as $index => $article) {
49
+ $title = '';
50
+ if (preg_match ('#<!--\| ([^|]+?) \|-->#', $article, $match)) {
51
+ $title = trim ($match [1]);
52
+ }
53
+
54
+ if ($title != '' && strlen ($article) > 100) {
55
+ $postarr = array (
56
+ 'ID' => 0,
57
+ 'post_content' => $article,
58
+ 'post_title' => $title,
59
+ 'post_status' => 'publish',
60
+ );
61
+ $post_id = wp_insert_post ($postarr);
62
+ }
63
+ }
64
+
65
+ }
66
+ }
67
+ @unlink ($ai_articles);
68
+
69
+ update_option ('ai-notice-review', 'no');
70
  }
71
 
72
  $save_url = $_SERVER ['REQUEST_URI'];
211
 
212
  if (function_exists ('ai_admin_settings_notices')) ai_admin_settings_notices ();
213
 
214
+ $hide_settings_enabled = defined ('AI_HIDE_SETTINGS_ENABLED') && AI_HIDE_SETTINGS_ENABLED;
215
+ $settings_hidden = function_exists ('ai_block_list_buttons') && $hide_settings_enabled ? get_settings_hidden () : false;
216
  ?>
217
 
218
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" tab-setup-delay="<?php echo get_tab_setup_delay (); ?>" safe-mode="<?php echo defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode']) ? '1' : '0'; ?>" js_debugging="<?php echo $ai_wp_data [AI_BACKEND_JS_DEBUGGING] ? '1' : '0'; ?>"></div>
225
 
226
  <div style="clear: both;"></div>
227
 
228
+ <div id="ai-settings-wrapper" class="<?php echo $settings_hidden ? 'settings-hidden' : ''; ?>">
229
+
230
  <div id="ai-settings" style="float: left;" data-home-url="<?php echo home_url (); ?>/" data-home-relative-url="<?php echo wp_make_link_relative (get_site_url ()); ?>/">
231
 
232
  <form id="ai-form" class="no-select rounded<?php echo function_exists ('ai_settings_flags') ? ai_settings_flags () : ''; ?>" style="float: left;" action="<?php echo esc_attr ($save_url); ?>" method="post" name="ai_form" start="<?php echo $start; ?>" end="<?php echo $end; ?>" gmt="<?php echo get_option ('gmt_offset') * 3600 * 1000; ?>" ai-settings="<?php echo base64_encode (admin_url ('options-general.php?page=ad-inserter.php'.$url_safe_mode)); ?>" ai-value="<?php echo base64_encode (wp_create_nonce ("adinserter_data")); ?>">
235
 
236
  <div id="header" class="ai-form header rounded">
237
  <div id= "ai-settings-header" style="float: left;">
238
+ <h2 id="plugin_name" style="margin: 5px 0;"><?php do_action ('ai-settings-name-prefix'); echo ' ', function_exists ('ai_settings_version') ? ai_settings_version () : (AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION); ?></h2>
239
 
240
  <div id="block-ranges">
241
  <?php
242
+ if (function_exists ('ai_ranges') && $hide_settings_enabled) {
243
+ ai_ranges ($settings_hidden);
244
+ }
245
+
246
  for ($range = 1; $range <= intval ((96 + 15) / 16); $range ++){
247
  $range_start = ($range - 1) * 16 + 1;
248
  $range_end = $range_start + 16 - 1;
249
  if ($range_end > 96) $range_end = 96;
250
  if (($active_tab >= $range_start && $active_tab <= $range_end) || ($start == $range_start && $active_tab == 0)) $style = "font-weight: bold; color: #44e; "; else $style = "";
251
  ?>
252
+ <button type="button" class="ai-top-button ai-range-link" style="margin-right: 0px; outline: none;" data-address="<?php echo admin_url('options-general.php?page=ad-inserter.php&start='.$range_start.$url_safe_mode); ?>">
253
  <span style="<?php echo $style; ?>"><?php echo $range_start, " - ", $range_end; ?></span>
254
  </button>
255
+ <?php
256
+ }
257
+
258
+ ?>
259
  </div>
260
+
261
  </div>
262
 
263
  <div id="header-buttons">
2769
 
2770
  </div>
2771
 
2772
+ <div id="tab-viewports" style="padding: 0;">
2773
+
2774
+ <div class="rounded">
2775
+ <div style="margin: 0 0 8px 0;">
2776
+ <strong><?php _e ('Viewport Settings used for client-side device detection', 'ad-inserter'); ?></strong>
2777
+ </div>
2778
  <?php
2779
 
2780
  for ($viewport = 1; $viewport <= 6; $viewport ++) {
2781
  $bottom_margin = $viewport == 6 ? 0 : 4;
2782
  ?>
2783
+ <div style="margin: 4px 0 <?php echo $bottom_margin; ?>px 0;">
2784
  <?php /* Translators: %d: viewport number */ printf (__('Viewport %d name', 'ad-inserter'), $viewport); ?>&nbsp;&nbsp;&nbsp;
2785
+ <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" />
2786
+ <?php if ($viewport == 6) echo '<span style="display: none;">' ?>
2787
+ &nbsp;&nbsp; <?php _e ('min width', 'ad-inserter'); ?>
2788
+ <input type="text" 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
2789
+ <?php if ($viewport == 6) echo '</span>' ?>
2790
+ </div>
2791
+ <?php
2792
+ }
2793
+ ?>
2794
+
2795
  </div>
2796
+ <div class="rounded">
2797
+
2798
+ <div style="margin: 0 0 8px 0;">
2799
+ <strong><?php _e ('Variables', 'ad-inserter'); ?></strong> &nbsp;&nbsp;
2800
+ <pre class="select ai-block-number" style="display: inline-block; margin: 0 5px 0 35px; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;">[adinserter data="<?php _e('Variable name', 'ad-inserter'); ?>"]</pre>
2801
+ </div>
2802
+ <?php
2803
+
2804
+ for ($variable = 1; $variable <= 6; $variable ++) {
2805
+ $bottom_margin = $variable == 6 ? 0 : 4;
2806
+ $variable_name = get_variable_name ($variable);
2807
+
2808
+ ?>
2809
+ <div style="margin: 4px 0 <?php echo $bottom_margin; ?>px 0;">
2810
+ <?php /* Translators: %d: variable number */ printf (__('Variable %d name', 'ad-inserter'), $variable); ?>&nbsp;&nbsp;&nbsp;
2811
+ <input style="margin-left: 0px;" type="text" name="variable-name-<?php echo $variable; ?>" value="<?php echo $variable_name; ?>" default="" size="15" maxlength="40" />
2812
+ &nbsp;&nbsp; <?php _e ('Value', 'ad-inserter'); ?>
2813
+ <input type="text" name="variable-value-<?php echo $variable; ?>" value="<?php echo get_variable_value ($variable); ?>" default="" size="30" maxlength="50" />
2814
+ </div>
2815
  <?php
2816
  }
2817
  ?>
2818
+ </div>
2819
  </div>
2820
 
2821
  <div id="tab-hooks" class="rounded">
3479
  }
3480
 
3481
  }
3482
+
3483
  ?>
3484
+ <div id="ai-settings-bottom" class="ai-extra-settings">
3485
+ <?php do_action ('ai-settings-bottom'); ?>
3486
+ </div>
3487
 
3488
  <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="[<?php echo $active_tab, ',', $active_tab_0; ?>]" />
3489
  <?php wp_nonce_field ('save_adinserter_settings'); ?>
3498
 
3499
  <?php
3500
  if ($subpage == 'main') {
3501
+
3502
  page_checker_container ();
3503
  ads_txt_container ();
3504
  if (defined ('AI_ADSENSE_API')) {
3546
  <img id="ai-dummy-2" src="<?php echo AD_INSERTER_PLUGIN_URL, 'css/images/'; ?>blank.png" style="width: 1px; height: 1px; display: block; margin-top: -1px;" />
3547
  </div>
3548
 
3549
+ </div>
3550
+
3551
  <script type="text/javascript">
3552
  jQuery(document).ready(function($) {
3553
  setTimeout (check_blocked_images, 400);
4517
 
4518
  if (ai_pro ()) {
4519
  $limits =
4520
+ $tracking && (
4521
+ $obj->get_max_impressions () || ($obj->get_limit_impressions_per_time_period () && $obj->get_limit_impressions_time_period ()) ||
4522
+ $obj->get_max_clicks () || ($obj->get_limit_clicks_per_time_period () && $obj->get_limit_clicks_time_period ()) ||
4523
+ $obj->get_visitor_max_impressions () || ($obj->get_visitor_limit_impressions_per_time_period () && $obj->get_visitor_limit_impressions_time_period ()) ||
4524
+ $obj->get_visitor_max_clicks () || ($obj->get_visitor_limit_clicks_per_time_period () && $obj->get_visitor_limit_clicks_time_period ()) ||
4525
+ $obj->get_trigger_click_fraud_protection () && get_click_fraud_protection ()
4526
+ );
4527
  }
4528
 
4529
  $block_text = $block . ' '. $obj->get_ad_name () . ' ' . $obj->get_automatic_insertion_text() . ' ' . implode (', ', $sidebars_with_widget [$block]);
4595
  <?php if ($visible_tab): ?>
4596
  <td class="ai-tab-link" data-tab="<?php echo $block; ?>" style=" min-width: 120px; color: #0073aa; cursor: pointer; text-align: left; padding-left: 5px; max-width: 220px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name(); ?></td>
4597
  <?php else: ?>
4598
+ <td class="ai-range-link" style="min-width: 120px; text-align: left; padding-left: 5px; max-width: 250px; white-space: nowrap; overflow: hidden;" data-address="<?php echo $edit_url; ?>"><a style="text-decoration: none; box-shadow: 0 0 0; color: #0073aa; cursor: pointer"><?php echo $obj->get_ad_name(); ?></a></td>
4599
+
4600
  <?php endif ?>
4601
  <td style="min-width: 80px; text-align: left; padding-left: 5px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>" title="<?php echo $insertion_title; ?>"><?php echo $obj->get_automatic_insertion_text(), $insertion_parameter; ?></td>
4602
  <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top;"><span class="<?php echo $process_php ? 'checkbox-icon size-img16 icon-php on' : ''; ?>" style="margin-top: 1px;"></span></td>