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

Version Description

  • Added support for author:author-username items in taxonomy list
  • Fixed errors when downgrading from Pro
  • Few minor bug fixes
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.3
6
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -13,6 +13,11 @@ Plugin URI: http://adinserter.pro/documentation
13
 
14
  Change Log
15
 
 
 
 
 
 
16
  Ad Inserter 2.3.3 - 2018-02-08
17
  - Added list editors
18
  - Added Label blocks debugging function for AdSense Auto ads
@@ -604,6 +609,7 @@ $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
604
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
605
  $ai_wp_data [AI_TRACKING] = false;
606
  $ai_wp_data [AI_STICKY_WIDGETS] = false;
 
607
  $ai_wp_data [AI_CLOSE_BUTTONS] = false;
608
  $ai_wp_data [AI_DISABLE_CACHING] = false;
609
  $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
@@ -1276,6 +1282,11 @@ function ai_post_check ($post, $action) {
1276
  return true;
1277
  }
1278
 
 
 
 
 
 
1279
  function ai_hook_function_loop_start ($hook_parameter) {
1280
  ai_custom_hook ('loop_start', AI_TEXT_BEFORE_POST, $hook_parameter, 'ai_loop_check');
1281
  }
@@ -1484,6 +1495,11 @@ function ai_wp_hook () {
1484
  add_action ($custom_hook ['action'], 'ai_custom_hook_function_' . $index, $custom_hook ['priority']);
1485
  }
1486
 
 
 
 
 
 
1487
 
1488
  if ($ai_wp_data [AI_WP_AMP_PAGE] ) {
1489
  // AMP, Accelerated Mobile Pages
@@ -1653,6 +1669,8 @@ function ai_wp_enqueue_scripts_hook () {
1653
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
1654
  $ai_wp_data [AI_TRACKING] ||
1655
  $ai_wp_data [AI_STICKY_WIDGETS] ||
 
 
1656
  (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION]);
1657
 
1658
  if ($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION] || $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] || ($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0) {
@@ -1915,7 +1933,13 @@ function add_footer_inline_scripts () {
1915
 
1916
  }
1917
 
1918
- $footer_inline_scripts = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE || $ai_wp_data [AI_TRACKING] || $ai_wp_data [AI_STICKY_WIDGETS] || $ai_wp_data [AI_CLOSE_BUTTONS] || (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION]);
 
 
 
 
 
 
1919
 
1920
  if (($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION]) && !wp_script_is ('jquery', 'done')) {
1921
  // Should not insert as it is forced in the header if jquery needed in the footer
@@ -1935,6 +1959,10 @@ function add_footer_inline_scripts () {
1935
  }
1936
 
1937
  if ($ai_wp_data [AI_STICKY_WIDGETS]) {
 
 
 
 
1938
  echo ai_get_js ('ai-sticky');
1939
  }
1940
 
@@ -1957,6 +1985,7 @@ function add_footer_inline_scripts () {
1957
 
1958
  function ai_admin_notice_hook () {
1959
  global $current_screen, $ai_db_options, $ai_wp_data, $ai_db_options_extract;
 
1960
 
1961
  // $sidebar_widgets = wp_get_sidebars_widgets();
1962
  // $sidebars_with_deprecated_widgets = array ();
@@ -1982,7 +2011,7 @@ function ai_admin_notice_hook () {
1982
  // }
1983
 
1984
  if (function_exists ('ai_admin_notices')) ai_admin_notices (); else {
1985
- if (is_super_admin () && !wp_is_mobile () && isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL])) {
1986
 
1987
  $used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
1988
 
@@ -3829,6 +3858,10 @@ function ai_ajax_backend () {
3829
  isset ($_POST ["name"]) ? base64_decode ($_POST ["name"]) : null,
3830
  // urldecode ($_POST ["alignment"]),
3831
  isset ($_POST ["alignment"]) ? base64_decode ($_POST ["alignment"]) : null,
 
 
 
 
3832
  // wp_unslash (urldecode ($_POST ["alignment_css"])),
3833
  isset ($_POST ["alignment_css"]) ? base64_decode ($_POST ["alignment_css"]) : null,
3834
  // wp_unslash (urldecode ($_POST ["custom_css"])),
@@ -4264,8 +4297,11 @@ function ai_load_settings () {
4264
  }
4265
  }
4266
 
4267
- if ($obj->get_tracking ()) $ai_wp_data [AI_TRACKING] = true;
4268
- if ($obj->get_close_button () != AI_CLOSE_NONE) $ai_wp_data [AI_CLOSE_BUTTONS] = true;
 
 
 
4269
 
4270
  switch ($obj->get_automatic_insertion()) {
4271
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
@@ -4390,12 +4426,18 @@ function generate_alignment_css () {
4390
  $alignments []= $alignment_name;
4391
  $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $styles [$alignment_type][1] . "}\n";
4392
  break;
 
 
 
 
 
 
 
4393
  case AI_ALIGNMENT_CUSTOM_CSS:
4394
  $custom_css = $obj->get_custom_css ();
4395
  $alignment_name = strtolower (md5 ($custom_css));
4396
  if (in_array ($alignment_name, $alignments)) continue;
4397
  $alignments []= $alignment_name;
4398
- // $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $custom_css . "}\n";
4399
  $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . str_replace (''', "'", $custom_css) . "}\n";
4400
  break;
4401
  }
@@ -5897,7 +5939,7 @@ function ai_widget_draw ($args, $instance, &$block) {
5897
  if ($block == - 1) {
5898
  $before_widget = $args ['before_widget'];
5899
  ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
5900
- ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
5901
  echo $before_widget;
5902
  echo $args ['after_widget'];
5903
  return;
@@ -5941,7 +5983,7 @@ function ai_widget_draw ($args, $instance, &$block) {
5941
  if ($sticky) {
5942
  $before_widget = $args ['before_widget'];
5943
  ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
5944
- ai_add_attr_data ($before_widget, 'class', 'ai-sticky');
5945
  echo $before_widget;
5946
  echo $args ['after_widget'];
5947
  }
@@ -5955,7 +5997,7 @@ function ai_widget_draw ($args, $instance, &$block) {
5955
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5956
 
5957
  $viewport_classes = $obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT ? '' : trim ($obj->get_viewport_classes ());
5958
- $sticky_class = $sticky ? ' ai-sticky' : '';
5959
  $widget_classes = trim ($viewport_classes . $sticky_class);
5960
 
5961
  if ($widget_classes != "") {
@@ -5986,7 +6028,7 @@ function ai_widget_draw_debugger ($args, $instance, &$block) {
5986
 
5987
  if ($sticky) {
5988
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
5989
- echo ai_add_attr_data ($args ['before_widget'], 'class', 'ai-sticky');
5990
  } else echo $args ['before_widget'];
5991
 
5992
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.4
6
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
13
 
14
  Change Log
15
 
16
+ Ad Inserter 2.3.4 - 2018-03-05
17
+ - Added support for author:author-username items in taxonomy list
18
+ - Fixed errors when downgrading from Pro
19
+ - Few minor bug fixes
20
+
21
  Ad Inserter 2.3.3 - 2018-02-08
22
  - Added list editors
23
  - Added Label blocks debugging function for AdSense Auto ads
609
  $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
610
  $ai_wp_data [AI_TRACKING] = false;
611
  $ai_wp_data [AI_STICKY_WIDGETS] = false;
612
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] = false;
613
  $ai_wp_data [AI_CLOSE_BUTTONS] = false;
614
  $ai_wp_data [AI_DISABLE_CACHING] = false;
615
  $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
1282
  return true;
1283
  }
1284
 
1285
+
1286
+ function ai_content_marker () {
1287
+ echo '<span class="ai-content"></span>', "\n";
1288
+ }
1289
+
1290
  function ai_hook_function_loop_start ($hook_parameter) {
1291
  ai_custom_hook ('loop_start', AI_TEXT_BEFORE_POST, $hook_parameter, 'ai_loop_check');
1292
  }
1495
  add_action ($custom_hook ['action'], 'ai_custom_hook_function_' . $index, $custom_hook ['priority']);
1496
  }
1497
 
1498
+ if ($ai_wp_data [AI_STICK_TO_THE_CONTENT]) {
1499
+ add_action ('loop_start', 'ai_content_marker');
1500
+ add_action ('loop_end', 'ai_content_marker');
1501
+ add_action ('get_sidebar', 'ai_content_marker');
1502
+ }
1503
 
1504
  if ($ai_wp_data [AI_WP_AMP_PAGE] ) {
1505
  // AMP, Accelerated Mobile Pages
1669
  get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
1670
  $ai_wp_data [AI_TRACKING] ||
1671
  $ai_wp_data [AI_STICKY_WIDGETS] ||
1672
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
1673
+ $ai_wp_data [AI_CLOSE_BUTTONS] ||
1674
  (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION]);
1675
 
1676
  if ($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION] || $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] || ($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0) {
1933
 
1934
  }
1935
 
1936
+ $footer_inline_scripts =
1937
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
1938
+ $ai_wp_data [AI_TRACKING] ||
1939
+ $ai_wp_data [AI_STICKY_WIDGETS] ||
1940
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
1941
+ $ai_wp_data [AI_CLOSE_BUTTONS] ||
1942
+ (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION]);
1943
 
1944
  if (($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION]) && !wp_script_is ('jquery', 'done')) {
1945
  // Should not insert as it is forced in the header if jquery needed in the footer
1959
  }
1960
 
1961
  if ($ai_wp_data [AI_STICKY_WIDGETS]) {
1962
+ echo ai_get_js ('ai-sidebar');
1963
+ }
1964
+
1965
+ if ($ai_wp_data [AI_STICK_TO_THE_CONTENT]) {
1966
  echo ai_get_js ('ai-sticky');
1967
  }
1968
 
1985
 
1986
  function ai_admin_notice_hook () {
1987
  global $current_screen, $ai_db_options, $ai_wp_data, $ai_db_options_extract;
1988
+ global $ai_settings_page, $hook_suffix;
1989
 
1990
  // $sidebar_widgets = wp_get_sidebars_widgets();
1991
  // $sidebars_with_deprecated_widgets = array ();
2011
  // }
2012
 
2013
  if (function_exists ('ai_admin_notices')) ai_admin_notices (); else {
2014
+ if ($hook_suffix == $ai_settings_page && is_super_admin () && !wp_is_mobile () && isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL])) {
2015
 
2016
  $used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
2017
 
3858
  isset ($_POST ["name"]) ? base64_decode ($_POST ["name"]) : null,
3859
  // urldecode ($_POST ["alignment"]),
3860
  isset ($_POST ["alignment"]) ? base64_decode ($_POST ["alignment"]) : null,
3861
+
3862
+ isset ($_POST ["horizontal"]) ? base64_decode ($_POST ["horizontal"]) : null,
3863
+ isset ($_POST ["vertical"]) ? base64_decode ($_POST ["vertical"]) : null,
3864
+
3865
  // wp_unslash (urldecode ($_POST ["alignment_css"])),
3866
  isset ($_POST ["alignment_css"]) ? base64_decode ($_POST ["alignment_css"]) : null,
3867
  // wp_unslash (urldecode ($_POST ["custom_css"])),
4297
  }
4298
  }
4299
 
4300
+ // if ($obj->get_tracking ()) $ai_wp_data [AI_TRACKING] = true;
4301
+ // if ($obj->get_close_button () != AI_CLOSE_NONE) $ai_wp_data [AI_CLOSE_BUTTONS] = true;
4302
+ if (function_exists ('ai_load_settings_2')) ai_load_settings_2 ($obj);
4303
+
4304
+ if ($obj->stick_to_the_content_class () != '') $ai_wp_data [AI_STICK_TO_THE_CONTENT] = true;
4305
 
4306
  switch ($obj->get_automatic_insertion()) {
4307
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
4426
  $alignments []= $alignment_name;
4427
  $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $styles [$alignment_type][1] . "}\n";
4428
  break;
4429
+ case AI_ALIGNMENT_STICKY:
4430
+ $sticky_css = $obj->alignment_style ($alignment_type);
4431
+ $alignment_name = strtolower (md5 ($sticky_css));
4432
+ if (in_array ($alignment_name, $alignments)) continue;
4433
+ $alignments []= $alignment_name;
4434
+ $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $sticky_css . "}\n";
4435
+ break;
4436
  case AI_ALIGNMENT_CUSTOM_CSS:
4437
  $custom_css = $obj->get_custom_css ();
4438
  $alignment_name = strtolower (md5 ($custom_css));
4439
  if (in_array ($alignment_name, $alignments)) continue;
4440
  $alignments []= $alignment_name;
 
4441
  $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . str_replace ('&#039;', "'", $custom_css) . "}\n";
4442
  break;
4443
  }
5939
  if ($block == - 1) {
5940
  $before_widget = $args ['before_widget'];
5941
  ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
5942
+ ai_add_attr_data ($before_widget, 'class', 'ai-sticky-widget');
5943
  echo $before_widget;
5944
  echo $args ['after_widget'];
5945
  return;
5983
  if ($sticky) {
5984
  $before_widget = $args ['before_widget'];
5985
  ai_add_attr_data ($before_widget, 'style', 'padding: 0; border: 0; margin: 0; color: transparent; background: transparent;');
5986
+ ai_add_attr_data ($before_widget, 'class', 'ai-sticky-widget');
5987
  echo $before_widget;
5988
  echo $args ['after_widget'];
5989
  }
5997
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5998
 
5999
  $viewport_classes = $obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT ? '' : trim ($obj->get_viewport_classes ());
6000
+ $sticky_class = $sticky ? ' ai-sticky-widget' : '';
6001
  $widget_classes = trim ($viewport_classes . $sticky_class);
6002
 
6003
  if ($widget_classes != "") {
6028
 
6029
  if ($sticky) {
6030
  $ai_wp_data [AI_STICKY_WIDGETS] = true;
6031
+ echo ai_add_attr_data ($args ['before_widget'], 'class', 'ai-sticky-widget');
6032
  } else echo $args ['before_widget'];
6033
 
6034
  $title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
class.php CHANGED
@@ -433,6 +433,10 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
433
  $this->wp_options [AI_OPTION_INVERTED_FILTER] = AI_DISABLED;
434
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
435
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
 
 
 
 
436
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
437
  $this->wp_options [AI_OPTION_SCHEDULING] = AI_SCHEDULING_OFF;
438
  $this->wp_options [AI_OPTION_AFTER_DAYS] = AD_EMPTY_DATA;
@@ -593,6 +597,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
593
  elseif ($option == AD_ALIGNMENT_NO_WRAPPING) $option = AI_ALIGNMENT_NO_WRAPPING;
594
  elseif ($option == AD_ALIGNMENT_CUSTOM_CSS) $option = AI_ALIGNMENT_CUSTOM_CSS;
595
 
 
 
 
 
 
 
 
596
  return $option;
597
  }
598
 
@@ -628,6 +639,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
628
  case AI_ALIGNMENT_STICKY_BOTTOM:
629
  return AI_TEXT_STICKY_BOTTOM;
630
  break;
 
 
 
631
  case AI_ALIGNMENT_NO_WRAPPING:
632
  return AI_TEXT_NO_WRAPPING;
633
  break;
@@ -640,7 +654,116 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
640
  }
641
  }
642
 
643
- public function alignment_style ($alignment_type, $all_styles = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
  $style = "";
646
  switch ($alignment_type) {
@@ -674,6 +797,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
674
  case AI_ALIGNMENT_STICKY_BOTTOM:
675
  $style = AI_ALIGNMENT_CSS_STICKY_BOTTOM;
676
  break;
 
 
 
 
 
 
677
  case AI_ALIGNMENT_CUSTOM_CSS:
678
  $style = $this->get_custom_css ();
679
  break;
@@ -689,6 +818,60 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
689
  return $style;
690
  }
691
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  public function get_tracking ($saved_value = false){
693
  $tracking = AI_DISABLED;
694
  if (function_exists ('get_global_tracking')) {
@@ -1375,7 +1558,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1375
 
1376
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
1377
  $debug_ip = new ai_block_labels ('ai-debug-ip');
1378
- $processed_code = $debug_ip->bar ($country_attributes . ' ' . $ip_address_attributes, '', '<span class="ai-debug-name ai-ip-status"></span>', '<span class="ai-debug-name ai-ip-country"></span>') . $processed_code;
1379
  }
1380
  break;
1381
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
@@ -1417,11 +1600,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1417
 
1418
  $counters = $this->ai_get_counters ($title);
1419
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
1420
- $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<span data-separator=" - " class="ai-option-name">' . $version_name . '</span>' . $fallback_block_name;
1421
 
1422
  $this->additional_code_before =
1423
  $this->labels->block_start () .
1424
- $this->labels->bar ($block_name, '', '<span class="ai-debug-name ai-main"></span>', $counters, $title) .
1425
  $this->additional_code_before;
1426
 
1427
  $this->additional_code_after .= $this->labels->block_end ();
@@ -1457,8 +1640,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1457
  $visible_viewports .=
1458
  '<section class="' . $viewport_class_name .'">' .
1459
  $this->labels->bar (
1460
- $this->number . ' ' . $this->get_ad_name () . '<span data-separator=" - " class="ai-option-name">' . $version_name . '</span>', '',
1461
- $viewport_name . ' <span class="ai-debug-name ai-main"></span>',
1462
  $counters, $title) .
1463
  '</section>';
1464
  } else {
@@ -1472,8 +1655,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1472
  $hidden_viewports .=
1473
  $hidden_wrapper_start .
1474
  $this->labels->bar_hidden_viewport (
1475
- $this->number . ' ' . $this->get_ad_name () . '<span data-separator=" - " class="ai-option-name">' . $version_name . '</span>', '',
1476
- $viewport_name . ' <span class="ai-debug-name ai-main"></span>',
1477
  $counters, $title) .
1478
  $this->labels->message (($hidden_widgets ? 'WIDGET':'BLOCK').' INSERTED BUT NOT VISIBLE') .
1479
  '</section>';
@@ -1532,6 +1715,20 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1532
  $additional_block_style = '';
1533
  }
1534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1535
  if ($this->get_close_button () && !$ai_wp_data [AI_WP_AMP_PAGE]) {
1536
  $classes [] = 'ai-close';
1537
  }
@@ -1570,9 +1767,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1570
  if ($this->get_tracking ()) $tracking_code_data = '[#AI_DATA#]';
1571
 
1572
  if ($ai_wp_data [AI_WP_AMP_PAGE] || ($alignment_class != '' && defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ())) {
1573
- $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . ">\n";
1574
  } else {
1575
- $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
1576
  }
1577
 
1578
 
@@ -1603,9 +1800,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1603
  } else {
1604
 
1605
  if ($ai_wp_data [AI_WP_AMP_PAGE] || ($alignment_class != '' && defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ())) {
1606
- $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . ">\n";
1607
  } else {
1608
- $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
1609
  }
1610
 
1611
  // TO TEST
@@ -2037,6 +2234,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2037
  case AI_ALIGNMENT_STICKY_BOTTOM:
2038
  return $block_class_name . str_replace (' ', '-', strtolower ($this->get_alignment_type_text ()));
2039
  break;
 
 
 
2040
  case AI_ALIGNMENT_CUSTOM_CSS:
2041
  return $block_class_name . str_replace (' ', '-', strtolower (md5 ($this->get_custom_css ())));
2042
  break;
@@ -3366,6 +3566,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3366
  }
3367
 
3368
  function check_taxonomy () {
 
3369
 
3370
  $taxonomies = trim (strtolower ($this->get_ad_block_taxonomy()));
3371
  $taxonomy_type = $this->get_ad_block_taxonomy_type();
@@ -3385,6 +3586,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3385
  $terms = explode (':', $taxonomy_disabled);
3386
  if ($terms [1] == $current_user->user_login) return false;
3387
  }
 
 
 
 
 
 
 
3388
  elseif (strpos ($taxonomy_disabled, 'user-role:') === 0) {
3389
  $current_user = wp_get_current_user();
3390
  $terms = explode (':', $taxonomy_disabled);
@@ -3434,6 +3642,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3434
  $terms = explode (':', $taxonomy_enabled);
3435
  if ($terms [1] == $current_user->user_login) return true;
3436
  }
 
 
 
 
 
 
 
3437
  elseif (strpos ($taxonomy_enabled, 'user-role:') === 0) {
3438
  $current_user = wp_get_current_user();
3439
  $terms = explode (':', $taxonomy_enabled);
@@ -4782,7 +4997,7 @@ class ai_block_labels {
4782
  }
4783
 
4784
  public function bar_text_center ($text) {
4785
- return "<span class='ai-debug-text-center'>&nbsp;$text&nbsp;</span>";
4786
  }
4787
 
4788
  public function bar_text_right ($text, $title) {
433
  $this->wp_options [AI_OPTION_INVERTED_FILTER] = AI_DISABLED;
434
  $this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
435
  $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
436
+ if (defined ('AI_STICKY_SETTINGS') && AI_STICKY_SETTINGS) {
437
+ $this->wp_options [AI_OPTION_HORIZONTAL_POSITION] = DEFAULT_HORIZONTAL_POSITION;
438
+ $this->wp_options [AI_OPTION_VERTICAL_POSITION] = DEFAULT_VERTICAL_POSITION;
439
+ }
440
  $this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
441
  $this->wp_options [AI_OPTION_SCHEDULING] = AI_SCHEDULING_OFF;
442
  $this->wp_options [AI_OPTION_AFTER_DAYS] = AD_EMPTY_DATA;
597
  elseif ($option == AD_ALIGNMENT_NO_WRAPPING) $option = AI_ALIGNMENT_NO_WRAPPING;
598
  elseif ($option == AD_ALIGNMENT_CUSTOM_CSS) $option = AI_ALIGNMENT_CUSTOM_CSS;
599
 
600
+ if (defined ('AI_STICKY_SETTINGS') && AI_STICKY_SETTINGS) {
601
+ if ($option == AI_ALIGNMENT_STICKY_LEFT) $option = AI_ALIGNMENT_STICKY;
602
+ elseif ($option == AI_ALIGNMENT_STICKY_RIGHT) $option = AI_ALIGNMENT_STICKY;
603
+ elseif ($option == AI_ALIGNMENT_STICKY_TOP) $option = AI_ALIGNMENT_STICKY;
604
+ elseif ($option == AI_ALIGNMENT_STICKY_BOTTOM) $option = AI_ALIGNMENT_STICKY;
605
+ }
606
+
607
  return $option;
608
  }
609
 
639
  case AI_ALIGNMENT_STICKY_BOTTOM:
640
  return AI_TEXT_STICKY_BOTTOM;
641
  break;
642
+ case AI_ALIGNMENT_STICKY:
643
+ return AI_TEXT_STICKY;
644
+ break;
645
  case AI_ALIGNMENT_NO_WRAPPING:
646
  return AI_TEXT_NO_WRAPPING;
647
  break;
654
  }
655
  }
656
 
657
+ public function sticky_style ($vertical_position, $horizontal_position) {
658
+ $style = "";
659
+
660
+ switch ($vertical_position) {
661
+ case AI_STICK_TO_THE_TOP:
662
+ switch ($horizontal_position) {
663
+ case AI_STICK_HORIZONTAL_CENTER:
664
+ $style = AI_ALIGNMENT_CSS_STICK_TO_THE_TOP;
665
+ break;
666
+ default:
667
+ $style = AI_ALIGNMENT_CSS_STICK_TO_THE_TOP_OFFSET;
668
+ break;
669
+ }
670
+ break;
671
+ case AI_STICK_VERTICAL_CENTER:
672
+ switch ($horizontal_position) {
673
+ case AI_STICK_HORIZONTAL_CENTER:
674
+ $style = AI_ALIGNMENT_CSS_CENTER_VERTICAL_H;
675
+ break;
676
+ default:
677
+ $style = AI_ALIGNMENT_CSS_CENTER_VERTICAL;
678
+ break;
679
+ }
680
+ break;
681
+ case AI_SCROLL_WITH_THE_CONTENT:
682
+ $style = AI_ALIGNMENT_CSS_SCROLL_WITH_THE_CONTENT;
683
+ break;
684
+ case AI_STICK_TO_THE_BOTTOM:
685
+ switch ($horizontal_position) {
686
+ case AI_STICK_HORIZONTAL_CENTER:
687
+ $style = AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM;
688
+ break;
689
+ default:
690
+ $style = AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM_OFFSET;
691
+ break;
692
+ }
693
+ break;
694
+ }
695
+
696
+ switch ($horizontal_position) {
697
+ case AI_STICK_TO_THE_LEFT:
698
+ $style .= AI_ALIGNMENT_CSS_STICK_TO_THE_LEFT;
699
+ break;
700
+ case AI_STICK_TO_THE_CONTENT_LEFT:
701
+ $style .= AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_LEFT;
702
+ break;
703
+ case AI_STICK_HORIZONTAL_CENTER:
704
+ switch ($vertical_position) {
705
+ case AI_STICK_VERTICAL_CENTER:
706
+ $style .= AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL_V;
707
+ break;
708
+ default:
709
+ $style .= AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL;
710
+ break;
711
+ }
712
+ break;
713
+ case AI_STICK_TO_THE_CONTENT_RIGHT:
714
+ $style .= AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_RIGHT;
715
+ break;
716
+ case AI_STICK_TO_THE_RIGHT:
717
+ switch ($vertical_position) {
718
+ case AI_SCROLL_WITH_THE_CONTENT:
719
+ $style .= AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT_SCROLL;
720
+ break;
721
+ default:
722
+ $style .= AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT;
723
+ break;
724
+ }
725
+ break;
726
+ }
727
+
728
+ return $style;
729
+ }
730
+
731
+ public function stick_to_the_content_class () {
732
+ $classes = array ();
733
+
734
+ switch ($this->get_alignment_type ()) {
735
+ case AI_ALIGNMENT_STICKY:
736
+ switch ($this->get_horizontal_position ()) {
737
+ case AI_STICK_TO_THE_CONTENT_LEFT:
738
+ $classes []= 'ai-sticky-left';
739
+ break;
740
+ case AI_STICK_TO_THE_CONTENT_RIGHT:
741
+ $classes []= 'ai-sticky-right';
742
+ break;
743
+ }
744
+ switch ($this->get_vertical_position ()) {
745
+ case AI_SCROLL_WITH_THE_CONTENT:
746
+ $classes []= 'ai-sticky-scroll';
747
+ break;
748
+ }
749
+ break;
750
+ case AI_ALIGNMENT_CUSTOM_CSS:
751
+ $custom_css = str_replace (' ', '', $this->get_custom_css ());
752
+ if (strpos ($custom_css, 'position:fixed') !== false &&
753
+ strpos ($custom_css, 'z-index:' . AI_STICKY_Z_INDEX) !== false &&
754
+ strpos ($custom_css, 'display:none') !== false) {
755
+ if (strpos ($custom_css, ';left:auto') !== false) $classes []= 'ai-sticky-left'; // ; to avoid margin-left:auto
756
+ elseif (strpos ($custom_css, 'right:auto') !== false) $classes []= 'ai-sticky-right';
757
+
758
+ if (strpos ($custom_css, 'margin-bottom:auto') !== false) $classes []= 'ai-sticky-scroll';
759
+ }
760
+ break;
761
+ }
762
+
763
+ return implode (' ', $classes);
764
+ }
765
+
766
+ public function alignment_style ($alignment_type, $all_styles = false, $full_sticky_style = true) {
767
 
768
  $style = "";
769
  switch ($alignment_type) {
797
  case AI_ALIGNMENT_STICKY_BOTTOM:
798
  $style = AI_ALIGNMENT_CSS_STICKY_BOTTOM;
799
  break;
800
+ case AI_ALIGNMENT_STICKY:
801
+ $style = AI_ALIGNMENT_CSS_STICKY;
802
+ if ($full_sticky_style) {
803
+ $style .= $this->sticky_style ($this->get_vertical_position (), $this->get_horizontal_position ());
804
+ }
805
+ break;
806
  case AI_ALIGNMENT_CUSTOM_CSS:
807
  $style = $this->get_custom_css ();
808
  break;
818
  return $style;
819
  }
820
 
821
+ public function get_horizontal_position (){
822
+ $option = - 1;
823
+
824
+ if (isset ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE])) {
825
+ switch ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE]) {
826
+ case AI_ALIGNMENT_STICKY_LEFT:
827
+ $option = AI_STICK_TO_THE_LEFT;
828
+ break;
829
+ case AI_ALIGNMENT_STICKY_RIGHT:
830
+ $option = AI_STICK_TO_THE_RIGHT;
831
+ break;
832
+ case AI_ALIGNMENT_STICKY_TOP:
833
+ $option = AI_STICK_HORIZONTAL_CENTER;
834
+ break;
835
+ case AI_ALIGNMENT_STICKY_BOTTOM:
836
+ $option = AI_STICK_HORIZONTAL_CENTER;
837
+ break;
838
+ }
839
+ }
840
+
841
+ if ($option == - 1) {
842
+ $option = isset ($this->wp_options [AI_OPTION_HORIZONTAL_POSITION]) ? $this->wp_options [AI_OPTION_HORIZONTAL_POSITION] : DEFAULT_HORIZONTAL_POSITION;
843
+ }
844
+
845
+ return $option;
846
+ }
847
+
848
+ public function get_vertical_position (){
849
+ $option = - 1;
850
+
851
+ if (isset ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE])) {
852
+ switch ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE]) {
853
+ case AI_ALIGNMENT_STICKY_LEFT:
854
+ $option = AI_STICK_TO_THE_TOP;
855
+ break;
856
+ case AI_ALIGNMENT_STICKY_RIGHT:
857
+ $option = AI_STICK_TO_THE_TOP;
858
+ break;
859
+ case AI_ALIGNMENT_STICKY_TOP:
860
+ $option = AI_STICK_TO_THE_TOP;
861
+ break;
862
+ case AI_ALIGNMENT_STICKY_BOTTOM:
863
+ $option = AI_STICK_TO_THE_BOTTOM;
864
+ break;
865
+ }
866
+ }
867
+
868
+ if ($option == - 1) {
869
+ $option = isset ($this->wp_options [AI_OPTION_VERTICAL_POSITION]) ? $this->wp_options [AI_OPTION_VERTICAL_POSITION] : DEFAULT_VERTICAL_POSITION;
870
+ }
871
+
872
+ return $option;
873
+ }
874
+
875
  public function get_tracking ($saved_value = false){
876
  $tracking = AI_DISABLED;
877
  if (function_exists ('get_global_tracking')) {
1558
 
1559
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
1560
  $debug_ip = new ai_block_labels ('ai-debug-ip');
1561
+ $processed_code = $debug_ip->bar ($country_attributes . ' ' . $ip_address_attributes, '', '<kbd class="ai-debug-name ai-ip-status"></kbd>', '<kbd class="ai-debug-name ai-ip-country"></kbd>') . $processed_code;
1562
  }
1563
  break;
1564
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1600
 
1601
  $counters = $this->ai_get_counters ($title);
1602
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
1603
+ $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>' . $fallback_block_name;
1604
 
1605
  $this->additional_code_before =
1606
  $this->labels->block_start () .
1607
+ $this->labels->bar ($block_name, '', '<kbd class="ai-debug-name ai-main"></kbd>', $counters, $title) .
1608
  $this->additional_code_before;
1609
 
1610
  $this->additional_code_after .= $this->labels->block_end ();
1640
  $visible_viewports .=
1641
  '<section class="' . $viewport_class_name .'">' .
1642
  $this->labels->bar (
1643
+ $this->number . ' ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>', '',
1644
+ $viewport_name . ' <kbd class="ai-debug-name ai-main"></kbd>',
1645
  $counters, $title) .
1646
  '</section>';
1647
  } else {
1655
  $hidden_viewports .=
1656
  $hidden_wrapper_start .
1657
  $this->labels->bar_hidden_viewport (
1658
+ $this->number . ' ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>', '',
1659
+ $viewport_name . ' <kbd class="ai-debug-name ai-main"></kbd>',
1660
  $counters, $title) .
1661
  $this->labels->message (($hidden_widgets ? 'WIDGET':'BLOCK').' INSERTED BUT NOT VISIBLE') .
1662
  '</section>';
1715
  $additional_block_style = '';
1716
  }
1717
 
1718
+ $sticky_parameters = '';
1719
+
1720
+ if (!$ai_wp_data [AI_WP_AMP_PAGE]) {
1721
+ $stick_to_the_content_class = $this->stick_to_the_content_class ();
1722
+
1723
+ if ($stick_to_the_content_class != '') {
1724
+ $classes [] = 'ai-sticky-content';
1725
+ $classes [] = $stick_to_the_content_class;
1726
+
1727
+ // $classes [] = 'ai-sticky-parameters';
1728
+ // $sticky_parameters = ' data-ai-parameters="'.base64_encode ('[3500,0,1500]').'"';
1729
+ }
1730
+ }
1731
+
1732
  if ($this->get_close_button () && !$ai_wp_data [AI_WP_AMP_PAGE]) {
1733
  $classes [] = 'ai-close';
1734
  }
1767
  if ($this->get_tracking ()) $tracking_code_data = '[#AI_DATA#]';
1768
 
1769
  if ($ai_wp_data [AI_WP_AMP_PAGE] || ($alignment_class != '' && defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ())) {
1770
+ $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . $sticky_parameters . ">\n";
1771
  } else {
1772
+ $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . $sticky_parameters . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
1773
  }
1774
 
1775
 
1800
  } else {
1801
 
1802
  if ($ai_wp_data [AI_WP_AMP_PAGE] || ($alignment_class != '' && defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ())) {
1803
+ $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . $sticky_parameters . ">\n";
1804
  } else {
1805
+ $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . $sticky_parameters . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
1806
  }
1807
 
1808
  // TO TEST
2234
  case AI_ALIGNMENT_STICKY_BOTTOM:
2235
  return $block_class_name . str_replace (' ', '-', strtolower ($this->get_alignment_type_text ()));
2236
  break;
2237
+ case AI_ALIGNMENT_STICKY:
2238
+ return $block_class_name . str_replace (' ', '-', strtolower (md5 ($this->alignment_style ($this->get_alignment_type ()))));
2239
+ break;
2240
  case AI_ALIGNMENT_CUSTOM_CSS:
2241
  return $block_class_name . str_replace (' ', '-', strtolower (md5 ($this->get_custom_css ())));
2242
  break;
3566
  }
3567
 
3568
  function check_taxonomy () {
3569
+ global $ai_wp_data;
3570
 
3571
  $taxonomies = trim (strtolower ($this->get_ad_block_taxonomy()));
3572
  $taxonomy_type = $this->get_ad_block_taxonomy_type();
3586
  $terms = explode (':', $taxonomy_disabled);
3587
  if ($terms [1] == $current_user->user_login) return false;
3588
  }
3589
+ elseif (strpos ($taxonomy_disabled, 'author:') === 0) {
3590
+ if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC)
3591
+ $current_author = get_the_author_meta ('user_login'); else
3592
+ $current_author = '';
3593
+ $terms = explode (':', $taxonomy_disabled);
3594
+ if ($terms [1] == $current_author) return false;
3595
+ }
3596
  elseif (strpos ($taxonomy_disabled, 'user-role:') === 0) {
3597
  $current_user = wp_get_current_user();
3598
  $terms = explode (':', $taxonomy_disabled);
3642
  $terms = explode (':', $taxonomy_enabled);
3643
  if ($terms [1] == $current_user->user_login) return true;
3644
  }
3645
+ elseif (strpos ($taxonomy_enabled, 'author:') === 0) {
3646
+ if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC)
3647
+ $current_author = get_the_author_meta ('user_login'); else
3648
+ $current_author = '';
3649
+ $terms = explode (':', $taxonomy_enabled);
3650
+ if ($terms [1] == $current_author) return true;
3651
+ }
3652
  elseif (strpos ($taxonomy_enabled, 'user-role:') === 0) {
3653
  $current_user = wp_get_current_user();
3654
  $terms = explode (':', $taxonomy_enabled);
4997
  }
4998
 
4999
  public function bar_text_center ($text) {
5000
+ return "<kbd class='ai-debug-text-center'>&nbsp;$text&nbsp;</kbd>";
5001
  }
5002
 
5003
  public function bar_text_right ($text, $title) {
constants.php CHANGED
@@ -24,7 +24,7 @@ if (!defined( 'AD_INSERTER_NAME'))
24
  define ('AD_INSERTER_NAME', 'Ad Inserter');
25
 
26
  if (!defined( 'AD_INSERTER_VERSION'))
27
- define ('AD_INSERTER_VERSION', '2.3.3');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -91,6 +91,8 @@ define ('AI_OPTION_FILTER_TYPE', 'filter_type');
91
  define ('AI_OPTION_INVERTED_FILTER', 'inverted_filter');
92
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
93
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
 
 
94
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
95
  define ('AI_OPTION_SCHEDULING', 'scheduling');
96
  define ('AI_OPTION_AFTER_DAYS', 'after_days');
@@ -281,6 +283,7 @@ define('AI_ALIGNMENT_STICKY_LEFT', 8);
281
  define('AI_ALIGNMENT_STICKY_RIGHT', 9);
282
  define('AI_ALIGNMENT_STICKY_TOP', 10);
283
  define('AI_ALIGNMENT_STICKY_BOTTOM', 11);
 
284
 
285
  // Used also for alignment class names
286
  define('AI_TEXT_DEFAULT', 'Default');
@@ -295,6 +298,29 @@ define('AI_TEXT_STICKY_LEFT', 'Sticky Left');
295
  define('AI_TEXT_STICKY_RIGHT', 'Sticky Right');
296
  define('AI_TEXT_STICKY_TOP', 'Sticky Top');
297
  define('AI_TEXT_STICKY_BOTTOM', 'Sticky Bottom');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  define('AI_ALIGNMENT_CSS_DEFAULT', 'margin: 8px 0; clear: both;');
300
  define('AI_ALIGNMENT_CSS_LEFT', 'margin: 8px auto 8px 0; text-align: left; clear: both;||margin: 8px 0; text-align: left; clear: both; display: flex; justify-content: flex-start;');
@@ -306,6 +332,23 @@ define('AI_ALIGNMENT_CSS_STICKY_LEFT', 'position: fixed; left: 0px; top: 100p
306
  define('AI_ALIGNMENT_CSS_STICKY_RIGHT', 'position: fixed; right: 0px; top: 100px; z-index: 9999;');
307
  define('AI_ALIGNMENT_CSS_STICKY_TOP', 'position: fixed; top: 0; text-align: center; left: 50%; transform: translate(-50%); width: 100%; z-index: 9999;||position: fixed; top: 0; left: 0; width: 100%; text-align: center; z-index: 9999;||position: fixed; top: 0; left: 0; width: 100%; text-align: center; display: flex; justify-content: center; z-index: 9999;');
308
  define('AI_ALIGNMENT_CSS_STICKY_BOTTOM', 'position: fixed; bottom: 0; text-align: center; left: 50%; transform: translate(-50%); width: 100%; z-index: 9999;||position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; z-index: 9999;||position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; display: flex; justify-content: center; z-index: 9999;');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
 
310
  define('AI_ALIGNMENT_CSS_AMP_LEFT', 'display: flex; justify-content: flex-start;');
311
  define('AI_ALIGNMENT_CSS_AMP_RIGHT', 'display: flex; justify-content: flex-end;');
@@ -543,6 +586,8 @@ define ('DEFAULT_CLOSE_BUTTON', AI_CLOSE_NONE);
543
  define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
544
  define ('DEFAULT_HTML_ELEMENT_INSERTION', AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY);
545
  define ('DEFAULT_CLIENT_SIDE_ACTION', AI_CLIENT_SIDE_ACTION_SHOW);
 
 
546
 
547
  define ('AI_ADBLOCKING_DETECTION', true);
548
  define ('AI_NORMAL_HEADER_STYLES', true);
@@ -550,6 +595,7 @@ define ('AI_AMP_HEADER_STYLES', true);
550
  define ('AI_CODE_GENERATOR', true);
551
  define ('AI_BUFFERING', true);
552
  define ('AI_ADSENSE_API', true);
 
553
  define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
554
  define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
555
  define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
@@ -705,6 +751,7 @@ define ('AI_DISABLE_CACHING', 27);
705
  define ('AI_COUNT', 28);
706
  define ('AI_CLIENT_SIDE_INSERTION', 29);
707
  define ('AI_USER_AGENT', 30);
 
708
 
709
  define ('AI_CONTEXT_NONE', 0);
710
  define ('AI_CONTEXT_CONTENT', 1);
24
  define ('AD_INSERTER_NAME', 'Ad Inserter');
25
 
26
  if (!defined( 'AD_INSERTER_VERSION'))
27
+ define ('AD_INSERTER_VERSION', '2.3.4');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
91
  define ('AI_OPTION_INVERTED_FILTER', 'inverted_filter');
92
  define ('AI_OPTION_DIRECTION_TYPE', 'direction_type');
93
  define ('AI_OPTION_ALIGNMENT_TYPE', 'alignment_type');
94
+ define ('AI_OPTION_HORIZONTAL_POSITION', 'horizontal_position');
95
+ define ('AI_OPTION_VERTICAL_POSITION', 'vertical_position');
96
  define ('AI_OPTION_GENERAL_TAG', 'general_tag');
97
  define ('AI_OPTION_SCHEDULING', 'scheduling');
98
  define ('AI_OPTION_AFTER_DAYS', 'after_days');
283
  define('AI_ALIGNMENT_STICKY_RIGHT', 9);
284
  define('AI_ALIGNMENT_STICKY_TOP', 10);
285
  define('AI_ALIGNMENT_STICKY_BOTTOM', 11);
286
+ define('AI_ALIGNMENT_STICKY', 12);
287
 
288
  // Used also for alignment class names
289
  define('AI_TEXT_DEFAULT', 'Default');
298
  define('AI_TEXT_STICKY_RIGHT', 'Sticky Right');
299
  define('AI_TEXT_STICKY_TOP', 'Sticky Top');
300
  define('AI_TEXT_STICKY_BOTTOM', 'Sticky Bottom');
301
+ define('AI_TEXT_STICKY', 'Sticky');
302
+
303
+ define('AI_STICK_TO_THE_LEFT', 0);
304
+ define('AI_STICK_TO_THE_CONTENT_LEFT', 1);
305
+ define('AI_STICK_HORIZONTAL_CENTER', 2);
306
+ define('AI_STICK_TO_THE_CONTENT_RIGHT', 3);
307
+ define('AI_STICK_TO_THE_RIGHT', 4);
308
+
309
+ define('AI_TEXT_STICK_TO_THE_LEFT', 'Stick to the left');
310
+ define('AI_TEXT_STICK_TO_THE_CONTENT_LEFT', 'Stick to the content left');
311
+ define('AI_TEXT_STICK_TO_THE_CONTENT_RIGHT', 'Stick to the content right');
312
+ define('AI_TEXT_STICK_TO_THE_RIGHT', 'Stick to the right');
313
+
314
+ define('AI_STICK_TO_THE_TOP', 0);
315
+ define('AI_STICK_VERTICAL_CENTER', 1);
316
+ define('AI_SCROLL_WITH_THE_CONTENT', 2);
317
+ define('AI_STICK_TO_THE_BOTTOM', 3);
318
+
319
+ define('AI_TEXT_STICK_TO_THE_TOP', 'Stick to the top');
320
+ define('AI_TEXT_SCROLL_WITH_THE_CONTENT', 'Scroll with the content');
321
+ define('AI_TEXT_STICK_TO_THE_BOTTOM', 'Stick to the bottom');
322
+
323
+ define('AI_STICKY_Z_INDEX', 9995); // update ad-inserter.js
324
 
325
  define('AI_ALIGNMENT_CSS_DEFAULT', 'margin: 8px 0; clear: both;');
326
  define('AI_ALIGNMENT_CSS_LEFT', 'margin: 8px auto 8px 0; text-align: left; clear: both;||margin: 8px 0; text-align: left; clear: both; display: flex; justify-content: flex-start;');
332
  define('AI_ALIGNMENT_CSS_STICKY_RIGHT', 'position: fixed; right: 0px; top: 100px; z-index: 9999;');
333
  define('AI_ALIGNMENT_CSS_STICKY_TOP', 'position: fixed; top: 0; text-align: center; left: 50%; transform: translate(-50%); width: 100%; z-index: 9999;||position: fixed; top: 0; left: 0; width: 100%; text-align: center; z-index: 9999;||position: fixed; top: 0; left: 0; width: 100%; text-align: center; display: flex; justify-content: center; z-index: 9999;');
334
  define('AI_ALIGNMENT_CSS_STICKY_BOTTOM', 'position: fixed; bottom: 0; text-align: center; left: 50%; transform: translate(-50%); width: 100%; z-index: 9999;||position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; z-index: 9999;||position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; display: flex; justify-content: center; z-index: 9999;');
335
+ define('AI_ALIGNMENT_CSS_STICKY', 'position: fixed; z-index: '.AI_STICKY_Z_INDEX.';');
336
+
337
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_TOP', ' top: 0px;');
338
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_TOP_OFFSET', ' top: 100px;');
339
+ define('AI_ALIGNMENT_CSS_CENTER_VERTICAL', ' top: 50%; transform: translate(0, -50%);');
340
+ define('AI_ALIGNMENT_CSS_CENTER_VERTICAL_H', ' top: 50%;');
341
+ define('AI_ALIGNMENT_CSS_SCROLL_WITH_THE_CONTENT', ' position: relative; margin-bottom: auto; width: fit-content; top: 100px; display: none;');
342
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM', ' bottom: 0px;');
343
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM_OFFSET', ' bottom: 100px;');
344
+
345
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_LEFT', ' left: 0px;');
346
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_LEFT', ' left: auto; margin-right: 10px; width: fit-content; display: none;');
347
+ define('AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL', ' text-align: center; left: 50%; transform: translate(-50%);');
348
+ define('AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL_V', ' text-align: center; left: 50%; transform: translate(-50%, -50%);');
349
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_RIGHT', ' right: auto; margin-left: 10px; width: fit-content; display: none;');
350
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT', ' right: 0px;');
351
+ define('AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT_SCROLL', ' margin-left: auto;');
352
 
353
  define('AI_ALIGNMENT_CSS_AMP_LEFT', 'display: flex; justify-content: flex-start;');
354
  define('AI_ALIGNMENT_CSS_AMP_RIGHT', 'display: flex; justify-content: flex-end;');
586
  define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
587
  define ('DEFAULT_HTML_ELEMENT_INSERTION', AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY);
588
  define ('DEFAULT_CLIENT_SIDE_ACTION', AI_CLIENT_SIDE_ACTION_SHOW);
589
+ define ('DEFAULT_HORIZONTAL_POSITION', AI_STICK_TO_THE_LEFT);
590
+ define ('DEFAULT_VERTICAL_POSITION', AI_STICK_TO_THE_TOP);
591
 
592
  define ('AI_ADBLOCKING_DETECTION', true);
593
  define ('AI_NORMAL_HEADER_STYLES', true);
595
  define ('AI_CODE_GENERATOR', true);
596
  define ('AI_BUFFERING', true);
597
  define ('AI_ADSENSE_API', true);
598
+ //define ('AI_STICKY_SETTINGS', true);
599
  define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
600
  define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
601
  define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
751
  define ('AI_COUNT', 28);
752
  define ('AI_CLIENT_SIDE_INSERTION', 29);
753
  define ('AI_USER_AGENT', 30);
754
+ define ('AI_STICK_TO_THE_CONTENT', 31);
755
 
756
  define ('AI_CONTEXT_NONE', 0);
757
  define ('AI_CONTEXT_CONTENT', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.3"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
@@ -341,7 +341,7 @@ textarea.simple-editor.small {
341
  margin-bottom: 4px;
342
  }
343
 
344
- .feature-list li {
345
  margin-bottom: 2px;
346
  }
347
 
@@ -530,194 +530,271 @@ div.automatic-insertion img {
530
  background-image: url(images/ui-icons_888888_256x240.png)
531
  }
532
 
533
- img.automatic-insertion.disabled {
534
  background: url('images/insertions-alignmets.png') 0 0;
535
  }
536
 
537
- img.automatic-insertion.before-post {
538
  background: url('images/insertions-alignmets.png') -56px 0;
539
  }
540
 
541
- img.automatic-insertion.after-post {
542
  background: url('images/insertions-alignmets.png') -112px 0;
543
  }
544
 
545
- img.automatic-insertion.before-content {
546
  background: url('images/insertions-alignmets.png') -168px 0;
547
  }
548
 
549
- img.automatic-insertion.after-content {
550
  background: url('images/insertions-alignmets.png') -224px 0;
551
  }
552
 
553
- img.automatic-insertion.before-paragraph {
554
  background: url('images/insertions-alignmets.png') -280px 0;
555
  }
556
 
557
- img.automatic-insertion.after-paragraph {
558
  background: url('images/insertions-alignmets.png') -336px 0;
559
  }
560
 
561
- img.automatic-insertion.before-excerpts {
562
  background: url('images/insertions-alignmets.png') -392px 0;
563
  }
564
 
565
- img.automatic-insertion.after-excerpts {
566
  background: url('images/insertions-alignmets.png') 0 -56px;
567
  }
568
 
569
- img.automatic-insertion.between-posts {
570
  background: url('images/insertions-alignmets.png') -56px -56px;
571
  }
572
 
573
- img.automatic-insertion.before-comments {
574
  background: url('images/insertions-alignmets.png') -112px -56px;
575
  }
576
 
577
- img.automatic-insertion.between-comments {
578
  background: url('images/insertions-alignmets.png') -168px -56px;
579
  }
580
 
581
- img.automatic-insertion.after-comments {
582
  background: url('images/insertions-alignmets.png') -224px -56px;
583
  }
584
 
585
- img.automatic-insertion.footer {
586
  background: url('images/insertions-alignmets.png') -280px -56px;
587
  }
588
 
589
- img.automatic-insertion.custom-hook {
590
  background: url('images/insertions-alignmets.png') -336px -56px;
591
  }
592
 
593
- img.automatic-insertion.no-wrapping {
594
  background: url('images/insertions-alignmets.png') -392px -56px;
595
  }
596
 
597
- img.automatic-insertion.custom-css {
598
  background: url('images/insertions-alignmets.png') 0 -112px;
599
  }
600
 
601
- img.automatic-insertion.default {
602
  background: url('images/insertions-alignmets.png') -56px -112px;
603
  }
604
 
605
- img.automatic-insertion.align-left {
606
  background: url('images/insertions-alignmets.png') -112px -112px;
607
  }
608
 
609
- img.automatic-insertion.center {
610
  background: url('images/insertions-alignmets.png') -168px -112px;
611
  }
612
 
613
- img.automatic-insertion.align-right {
614
  background: url('images/insertions-alignmets.png') -224px -112px;
615
  }
616
 
617
- img.automatic-insertion.float-left {
618
  background: url('images/insertions-alignmets.png') -280px -112px;
619
  }
620
 
621
- img.automatic-insertion.float-right {
622
  background: url('images/insertions-alignmets.png') -336px -112px;
623
  }
624
 
625
- img.automatic-insertion.sticky-left {
626
  background: url('images/insertions-alignmets.png') -392px -112px;
627
  }
628
 
629
- img.automatic-insertion.sticky-right {
630
  background: url('images/insertions-alignmets.png') 0 -168px;
631
  }
632
 
633
- img.automatic-insertion.sticky-top {
634
  background: url('images/insertions-alignmets.png') -56px -168px;
635
  }
636
 
637
- img.automatic-insertion.sticky-bottom {
638
  background: url('images/insertions-alignmets.png') -112px -168px;
639
  }
640
 
641
- img.automatic-insertion.above-header {
642
  background: url('images/insertions-alignmets.png') -168px -168px;
643
  }
644
 
645
- img.automatic-insertion.before-html {
646
  background: url('images/insertions-alignmets.png') -224px -168px;
647
  }
648
 
649
- img.automatic-insertion.after-html {
650
  background: url('images/insertions-alignmets.png') -280px -168px;
651
  }
652
 
653
- /*img.automatic-insertion.float-right {*/
654
- /* background: url('images/insertions-alignmets.png') -336px -168px;*/
655
- /*}*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
 
657
- /*img.automatic-insertion.sticky-left {*/
658
- /* background: url('images/insertions-alignmets.png') -392px -168px;*/
659
- /*}*/
660
 
661
  img.automatic-insertion {
662
  background-size: 448px!important;
663
  }
664
 
665
 
666
- img.automatic-insertion.preview.no-wrapping {
667
  background: url('images/insertions-alignmets.png') -350px -50px;
668
  }
669
 
670
- img.automatic-insertion.preview.custom-css {
671
  background: url('images/insertions-alignmets.png') 0 -100px;
672
  }
673
 
674
- img.automatic-insertion.preview.default {
675
  background: url('images/insertions-alignmets.png') -50px -100px;
676
  }
677
 
678
- img.automatic-insertion.preview.align-left {
679
  background: url('images/insertions-alignmets.png') -100px -100px;
680
  }
681
 
682
- img.automatic-insertion.preview.center {
683
  background: url('images/insertions-alignmets.png') -150px -100px;
684
  }
685
 
686
- img.automatic-insertion.preview.align-right {
687
  background: url('images/insertions-alignmets.png') -200px -100px;
688
  }
689
 
690
- img.automatic-insertion.preview.float-left {
691
  background: url('images/insertions-alignmets.png') -250px -100px;
692
  }
693
 
694
- img.automatic-insertion.preview.float-right {
695
  background: url('images/insertions-alignmets.png') -300px -100px;
696
  }
697
 
698
- img.automatic-insertion.preview.sticky-left {
699
  background: url('images/insertions-alignmets.png') -350px -100px;
700
  }
701
 
702
- img.automatic-insertion.preview.sticky-right {
703
  background: url('images/insertions-alignmets.png') 0 -150px;
704
  }
705
 
706
- img.automatic-insertion.preview.sticky-top {
707
  background: url('images/insertions-alignmets.png') -50px -150px;
708
  }
709
 
710
- img.automatic-insertion.preview.sticky-bottom {
711
  background: url('images/insertions-alignmets.png') -100px -150px;
712
  }
713
 
714
- /*img.automatic-insertion.preview.before-html {*/
715
- /* background: url('images/insertions-alignmets.png') -150px -150px;*/
716
- /*}*/
717
 
718
- /*img.automatic-insertion.preview.after-html {*/
719
- /* background: url('images/insertions-alignmets.png') -200px -150px;*/
720
- /*}*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
 
722
 
723
  img.automatic-insertion.preview {
1
  #ai-data {
2
+ font-family: "2.3.4"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
341
  margin-bottom: 4px;
342
  }
343
 
344
+ .feature-list li, .ai-help li {
345
  margin-bottom: 2px;
346
  }
347
 
530
  background-image: url(images/ui-icons_888888_256x240.png)
531
  }
532
 
533
+ img.automatic-insertion.im-disabled {
534
  background: url('images/insertions-alignmets.png') 0 0;
535
  }
536
 
537
+ img.automatic-insertion.im-before-post {
538
  background: url('images/insertions-alignmets.png') -56px 0;
539
  }
540
 
541
+ img.automatic-insertion.im-after-post {
542
  background: url('images/insertions-alignmets.png') -112px 0;
543
  }
544
 
545
+ img.automatic-insertion.im-before-content {
546
  background: url('images/insertions-alignmets.png') -168px 0;
547
  }
548
 
549
+ img.automatic-insertion.im-after-content {
550
  background: url('images/insertions-alignmets.png') -224px 0;
551
  }
552
 
553
+ img.automatic-insertion.im-before-paragraph {
554
  background: url('images/insertions-alignmets.png') -280px 0;
555
  }
556
 
557
+ img.automatic-insertion.im-after-paragraph {
558
  background: url('images/insertions-alignmets.png') -336px 0;
559
  }
560
 
561
+ img.automatic-insertion.im-before-excerpts {
562
  background: url('images/insertions-alignmets.png') -392px 0;
563
  }
564
 
565
+ img.automatic-insertion.im-after-excerpts {
566
  background: url('images/insertions-alignmets.png') 0 -56px;
567
  }
568
 
569
+ img.automatic-insertion.im-between-posts {
570
  background: url('images/insertions-alignmets.png') -56px -56px;
571
  }
572
 
573
+ img.automatic-insertion.im-before-comments {
574
  background: url('images/insertions-alignmets.png') -112px -56px;
575
  }
576
 
577
+ img.automatic-insertion.im-between-comments {
578
  background: url('images/insertions-alignmets.png') -168px -56px;
579
  }
580
 
581
+ img.automatic-insertion.im-after-comments {
582
  background: url('images/insertions-alignmets.png') -224px -56px;
583
  }
584
 
585
+ img.automatic-insertion.im-footer {
586
  background: url('images/insertions-alignmets.png') -280px -56px;
587
  }
588
 
589
+ img.automatic-insertion.im-custom-hook {
590
  background: url('images/insertions-alignmets.png') -336px -56px;
591
  }
592
 
593
+ img.automatic-insertion.im-no-wrapping {
594
  background: url('images/insertions-alignmets.png') -392px -56px;
595
  }
596
 
597
+ img.automatic-insertion.im-custom-css {
598
  background: url('images/insertions-alignmets.png') 0 -112px;
599
  }
600
 
601
+ img.automatic-insertion.im-default {
602
  background: url('images/insertions-alignmets.png') -56px -112px;
603
  }
604
 
605
+ img.automatic-insertion.im-align-left {
606
  background: url('images/insertions-alignmets.png') -112px -112px;
607
  }
608
 
609
+ img.automatic-insertion.im-center {
610
  background: url('images/insertions-alignmets.png') -168px -112px;
611
  }
612
 
613
+ img.automatic-insertion.im-align-right {
614
  background: url('images/insertions-alignmets.png') -224px -112px;
615
  }
616
 
617
+ img.automatic-insertion.im-float-left {
618
  background: url('images/insertions-alignmets.png') -280px -112px;
619
  }
620
 
621
+ img.automatic-insertion.im-float-right {
622
  background: url('images/insertions-alignmets.png') -336px -112px;
623
  }
624
 
625
+ img.automatic-insertion.im-sticky-left {
626
  background: url('images/insertions-alignmets.png') -392px -112px;
627
  }
628
 
629
+ img.automatic-insertion.im-sticky-right {
630
  background: url('images/insertions-alignmets.png') 0 -168px;
631
  }
632
 
633
+ img.automatic-insertion.im-sticky-top {
634
  background: url('images/insertions-alignmets.png') -56px -168px;
635
  }
636
 
637
+ img.automatic-insertion.im-sticky-bottom {
638
  background: url('images/insertions-alignmets.png') -112px -168px;
639
  }
640
 
641
+ img.automatic-insertion.im-above-header {
642
  background: url('images/insertions-alignmets.png') -168px -168px;
643
  }
644
 
645
+ img.automatic-insertion.im-before-html {
646
  background: url('images/insertions-alignmets.png') -224px -168px;
647
  }
648
 
649
+ img.automatic-insertion.im-after-html {
650
  background: url('images/insertions-alignmets.png') -280px -168px;
651
  }
652
 
653
+ img.automatic-insertion.im-sticky-content-left {
654
+ background: url('images/insertions-alignmets.png') -336px -168px;
655
+ }
656
+
657
+ img.automatic-insertion.im-sticky-content-right {
658
+ background: url('images/insertions-alignmets.png') -392px -168px;
659
+ }
660
+
661
+ img.automatic-insertion.im-sticky-center-horizontal {
662
+ background: url('images/insertions-alignmets.png') 0 -224px;
663
+ }
664
+
665
+ img.automatic-insertion.im-sticky-center-vertical {
666
+ background: url('images/insertions-alignmets.png') -56px -224px;
667
+ }
668
+
669
+ img.automatic-insertion.im-sticky-scroll {
670
+ background: url('images/insertions-alignmets.png') -112px -224px;
671
+ }
672
+
673
+ img.automatic-insertion.im-sticky {
674
+ background: url('images/insertions-alignmets.png') -168px -224px;
675
+ }
676
+
677
+ img.automatic-insertion.im-close-top-left {
678
+ background: url('images/insertions-alignmets.png') -224px -224px;
679
+ }
680
+
681
+ img.automatic-insertion.im-close-top-right {
682
+ background: url('images/insertions-alignmets.png') -280px -224px;
683
+ }
684
+
685
+ img.automatic-insertion.im-close-bottom-right {
686
+ background: url('images/insertions-alignmets.png') -336px -224px;
687
+ }
688
+
689
+ img.automatic-insertion.im-close-bottom-left {
690
+ background: url('images/insertions-alignmets.png') -392px -224px;
691
+ }
692
+
693
+ img.automatic-insertion.im-close-none {
694
+ background: url('images/insertions-alignmets.png') -0px -280px;
695
+ }
696
 
 
 
 
697
 
698
  img.automatic-insertion {
699
  background-size: 448px!important;
700
  }
701
 
702
 
703
+ img.automatic-insertion.preview.im-no-wrapping {
704
  background: url('images/insertions-alignmets.png') -350px -50px;
705
  }
706
 
707
+ img.automatic-insertion.preview.im-custom-css {
708
  background: url('images/insertions-alignmets.png') 0 -100px;
709
  }
710
 
711
+ img.automatic-insertion.preview.im-default {
712
  background: url('images/insertions-alignmets.png') -50px -100px;
713
  }
714
 
715
+ img.automatic-insertion.preview.im-align-left {
716
  background: url('images/insertions-alignmets.png') -100px -100px;
717
  }
718
 
719
+ img.automatic-insertion.preview.im-center {
720
  background: url('images/insertions-alignmets.png') -150px -100px;
721
  }
722
 
723
+ img.automatic-insertion.preview.im-align-right {
724
  background: url('images/insertions-alignmets.png') -200px -100px;
725
  }
726
 
727
+ img.automatic-insertion.preview.im-float-left {
728
  background: url('images/insertions-alignmets.png') -250px -100px;
729
  }
730
 
731
+ img.automatic-insertion.preview.im-float-right {
732
  background: url('images/insertions-alignmets.png') -300px -100px;
733
  }
734
 
735
+ img.automatic-insertion.preview.im-sticky-left {
736
  background: url('images/insertions-alignmets.png') -350px -100px;
737
  }
738
 
739
+ img.automatic-insertion.preview.im-sticky-right {
740
  background: url('images/insertions-alignmets.png') 0 -150px;
741
  }
742
 
743
+ img.automatic-insertion.preview.im-sticky-top {
744
  background: url('images/insertions-alignmets.png') -50px -150px;
745
  }
746
 
747
+ img.automatic-insertion.preview.im-sticky-bottom {
748
  background: url('images/insertions-alignmets.png') -100px -150px;
749
  }
750
 
751
+ img.automatic-insertion.preview.im-sticky-content-left {
752
+ background: url('images/insertions-alignmets.png') -300px -150px;
753
+ }
754
 
755
+ img.automatic-insertion.preview.im-sticky-content-right {
756
+ background: url('images/insertions-alignmets.png') -350px -150px;
757
+ }
758
+
759
+ img.automatic-insertion.preview.im-sticky-content-right {
760
+ background: url('images/insertions-alignmets.png') -350px -150px;
761
+ }
762
+
763
+ img.automatic-insertion.preview.im-sticky-center-horizontal {
764
+ background: url('images/insertions-alignmets.png') 0 -200px;
765
+ }
766
+
767
+ img.automatic-insertion.preview.im-sticky-center-vertical {
768
+ background: url('images/insertions-alignmets.png') -50px -200px;
769
+ }
770
+
771
+ img.automatic-insertion.preview.im-sticky-scroll {
772
+ background: url('images/insertions-alignmets.png') -100px -200px;
773
+ }
774
+
775
+ img.automatic-insertion.preview.im-sticky {
776
+ background: url('images/insertions-alignmets.png') -150px -200px;
777
+ }
778
+
779
+ img.automatic-insertion.preview.im-close-top-left {
780
+ background: url('images/insertions-alignmets.png') -200px -200px;
781
+ }
782
+
783
+ img.automatic-insertion.preview.im-close-top-right {
784
+ background: url('images/insertions-alignmets.png') -250px -200px;
785
+ }
786
+
787
+ img.automatic-insertion.preview.im-close-bottom-right {
788
+ background: url('images/insertions-alignmets.png') -300px -200px;
789
+ }
790
+
791
+ img.automatic-insertion.preview.im-close-bottom-left {
792
+ background: url('images/insertions-alignmets.png') -350px -200px;
793
+ }
794
+
795
+ img.automatic-insertion.preview.im-close-none {
796
+ background: url('images/insertions-alignmets.png') -0px -250px;
797
+ }
798
 
799
 
800
  img.automatic-insertion.preview {
css/images/insertions-alignmets.png CHANGED
Binary file
includes/js/ai-rotate.js CHANGED
@@ -16,11 +16,11 @@ jQuery (function ($) {
16
  var debug_block_frame = $(this).closest ('.ai-debug-block');
17
  if (typeof debug_block_frame != "undefined") {
18
  var option_name = atob (option.data ('name'));
19
- var name_tag = debug_block_frame.find ('span.ai-option-name');
20
  // Do not set option name in nested debug blocks
21
  var nested_debug_block = debug_block_frame.find ('.ai-debug-block');
22
  if (typeof nested_debug_block != 'undefined') {
23
- var name_tag2 = nested_debug_block.find ('span.ai-option-name');
24
  name_tag = name_tag.slice (0, name_tag.length - name_tag2.length);
25
  }
26
  if (typeof name_tag != 'undefined') {
16
  var debug_block_frame = $(this).closest ('.ai-debug-block');
17
  if (typeof debug_block_frame != "undefined") {
18
  var option_name = atob (option.data ('name'));
19
+ var name_tag = debug_block_frame.find ('kbd.ai-option-name');
20
  // Do not set option name in nested debug blocks
21
  var nested_debug_block = debug_block_frame.find ('.ai-debug-block');
22
  if (typeof nested_debug_block != 'undefined') {
23
+ var name_tag2 = nested_debug_block.find ('kbd.ai-option-name');
24
  name_tag = name_tag.slice (0, name_tag.length - name_tag2.length);
25
  }
26
  if (typeof name_tag != 'undefined') {
includes/js/ai-rotate.min.js CHANGED
@@ -1,4 +1,4 @@
1
  jQuery(function($){$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();if(n%2)random_index=rotate_options.length-random_index-1;rotate_options.hide();var option=$(rotate_options[random_index]);option.css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""}).removeClass("ai-rotate-option").removeClass("ai-rotate-options");$(this).css({"position":""}).removeClass("ai-rotate");
2
- var option_name="";var debug_block_frame=$(this).closest(".ai-debug-block");if(typeof debug_block_frame!="undefined"){var option_name=atob(option.data("name"));var name_tag=debug_block_frame.find("span.ai-option-name");var nested_debug_block=debug_block_frame.find(".ai-debug-block");if(typeof nested_debug_block!="undefined"){var name_tag2=nested_debug_block.find("span.ai-option-name");name_tag=name_tag.slice(0,name_tag.length-name_tag2.length)}if(typeof name_tag!="undefined"){var separator=name_tag.first().data("separator");
3
  if(typeof separator=="undefined")separator="";name_tag.html(separator+option_name)}}var tracking_updated=false;var adb_show_wrapping_div=$(this).closest(".ai-adb-show");if(typeof adb_show_wrapping_div!="undefined")if(typeof adb_show_wrapping_div.data("ai-tracking")!="undefined"){var data=JSON.parse(atob(adb_show_wrapping_div.data("ai-tracking")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;adb_show_wrapping_div.data("ai-tracking",btoa(JSON.stringify(data)));
4
  tracking_updated=true}}if(!tracking_updated){var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}}})});
1
  jQuery(function($){$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();if(n%2)random_index=rotate_options.length-random_index-1;rotate_options.hide();var option=$(rotate_options[random_index]);option.css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""}).removeClass("ai-rotate-option").removeClass("ai-rotate-options");$(this).css({"position":""}).removeClass("ai-rotate");
2
+ var option_name="";var debug_block_frame=$(this).closest(".ai-debug-block");if(typeof debug_block_frame!="undefined"){var option_name=atob(option.data("name"));var name_tag=debug_block_frame.find("kbd.ai-option-name");var nested_debug_block=debug_block_frame.find(".ai-debug-block");if(typeof nested_debug_block!="undefined"){var name_tag2=nested_debug_block.find("kbd.ai-option-name");name_tag=name_tag.slice(0,name_tag.length-name_tag2.length)}if(typeof name_tag!="undefined"){var separator=name_tag.first().data("separator");
3
  if(typeof separator=="undefined")separator="";name_tag.html(separator+option_name)}}var tracking_updated=false;var adb_show_wrapping_div=$(this).closest(".ai-adb-show");if(typeof adb_show_wrapping_div!="undefined")if(typeof adb_show_wrapping_div.data("ai-tracking")!="undefined"){var data=JSON.parse(atob(adb_show_wrapping_div.data("ai-tracking")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;adb_show_wrapping_div.data("ai-tracking",btoa(JSON.stringify(data)));
4
  tracking_updated=true}}if(!tracking_updated){var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}}})});
includes/js/{ai-sticky.js → ai-sidebar.js} RENAMED
@@ -4,7 +4,7 @@ jQuery(document).ready(function($) {
4
  var document_width = $(document).width();
5
  var ai_debug = typeof ai_debugging !== 'undefined';
6
 
7
- $(".ai-sticky").each (function () {
8
  var widget = $(this);
9
  var widget_width = widget.width();
10
 
@@ -53,5 +53,6 @@ jQuery(document).ready(function($) {
53
  if (ai_debug) console.log ("JS STICKY SIDEBAR, TOP:", new_sidebar_top);
54
  }
55
  });
 
56
  });
57
 
4
  var document_width = $(document).width();
5
  var ai_debug = typeof ai_debugging !== 'undefined';
6
 
7
+ $(".ai-sticky-widget").each (function () {
8
  var widget = $(this);
9
  var widget_width = widget.width();
10
 
53
  if (ai_debug) console.log ("JS STICKY SIDEBAR, TOP:", new_sidebar_top);
54
  }
55
  });
56
+
57
  });
58
 
includes/js/ai-sidebar.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ jQuery(document).ready(function($){var sticky_widget_mode=AI_FUNC_GET_STICKY_WIDGET_MODE;var sticky_widget_margin=AI_FUNC_GET_STICKY_WIDGET_MARGIN;var document_width=$(document).width();var ai_debug=typeof ai_debugging!=="undefined";$(".ai-sticky-widget").each(function(){var widget=$(this);var widget_width=widget.width();if(ai_debug)console.log("WIDGET:",widget.width(),widget.prop("tagName"),widget.attr("id"));var already_sticky_js=false;var sidebar=widget.parent();while(sidebar.prop("tagName")!=
2
+ "BODY"){if(sidebar.hasClass("theiaStickySidebar")){already_sticky_js=true;break}if(ai_debug)console.log("SIDEBAR:",sidebar.width(),sidebar.prop("tagName"),sidebar.attr("id"));var parent_element=sidebar.parent();var parent_element_width=parent_element.width();if(parent_element_width>widget_width*1.2||parent_element_width>document_width/2)break;sidebar=parent_element}if(already_sticky_js){if(ai_debug)console.log("JS STICKY SIDEBAR ALREADY SET");return}var new_sidebar_top=sidebar.offset().top-widget.offset().top+
3
+ sticky_widget_margin;if(ai_debug)console.log("NEW SIDEBAR TOP:",new_sidebar_top);if(sticky_widget_mode==0)if(sidebar.css("position")!="sticky"||isNaN(parseInt(sidebar.css("top")))||sidebar.css("top")<new_sidebar_top){sidebar.css("position","sticky").css("top",new_sidebar_top);if(ai_debug)console.log("CSS STICKY SIDEBAR, TOP:",new_sidebar_top)}else{if(ai_debug)console.log("CSS STICKY SIDEBAR ALREADY SET")}else{sidebar.theiaStickySidebar({additionalMarginTop:new_sidebar_top,sidebarBehavior:"stick-to-top"});
4
+ if(ai_debug)console.log("JS STICKY SIDEBAR, TOP:",new_sidebar_top)}})});
includes/js/ai-sticky.min.js DELETED
@@ -1,3 +0,0 @@
1
- jQuery(document).ready(function($){var sticky_widget_mode=AI_FUNC_GET_STICKY_WIDGET_MODE;var sticky_widget_margin=AI_FUNC_GET_STICKY_WIDGET_MARGIN;var document_width=$(document).width();var ai_debug=typeof ai_debugging!=="undefined";$(".ai-sticky").each(function(){var widget=$(this);var widget_width=widget.width();if(ai_debug)console.log("WIDGET:",widget.width(),widget.prop("tagName"),widget.attr("id"));var already_sticky_js=false;var sidebar=widget.parent();while(sidebar.prop("tagName")!="BODY"){if(sidebar.hasClass("theiaStickySidebar")){already_sticky_js=
2
- true;break}if(ai_debug)console.log("SIDEBAR:",sidebar.width(),sidebar.prop("tagName"),sidebar.attr("id"));var parent_element=sidebar.parent();var parent_element_width=parent_element.width();if(parent_element_width>widget_width*1.2||parent_element_width>document_width/2)break;sidebar=parent_element}if(already_sticky_js){if(ai_debug)console.log("JS STICKY SIDEBAR ALREADY SET");return}var new_sidebar_top=sidebar.offset().top-widget.offset().top+sticky_widget_margin;if(ai_debug)console.log("NEW SIDEBAR TOP:",
3
- new_sidebar_top);if(sticky_widget_mode==0)if(sidebar.css("position")!="sticky"||isNaN(parseInt(sidebar.css("top")))||sidebar.css("top")<new_sidebar_top){sidebar.css("position","sticky").css("top",new_sidebar_top);if(ai_debug)console.log("CSS STICKY SIDEBAR, TOP:",new_sidebar_top)}else{if(ai_debug)console.log("CSS STICKY SIDEBAR ALREADY SET")}else{sidebar.theiaStickySidebar({additionalMarginTop:new_sidebar_top,sidebarBehavior:"stick-to-top"});if(ai_debug)console.log("JS STICKY SIDEBAR, TOP:",new_sidebar_top)}})});
 
 
 
includes/preview.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function alt_styles_data ($alt_styles_text) {
4
  if (strpos ($alt_styles_text, "||") !== false) {
5
  $styles = explode ("||", $alt_styles_text);
@@ -11,23 +14,65 @@ function alt_styles_data ($alt_styles_text) {
11
  }
12
  }
13
 
14
- function generate_code_preview ($block, $name = null, $alignment = null, $alignment_css = null, $custom_css = null, $client_code = null, $process_php = null, $close = null, $read_only = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  global $block_object, $ai_wp_data;
16
 
17
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
18
 
19
  $obj = $block_object [$block];
20
 
21
- $block_name = $name !== null ? $name : $obj->get_ad_name();
22
- $alignment_type = $alignment !== null ? $alignment : $obj->get_alignment_type();
23
- $wrapper_css = $alignment_css !== null ? $alignment_css : $obj->get_alignment_style ();
24
- $custom_css_code = $custom_css !== null ? $custom_css : $obj->get_custom_css();
25
- $close_button = $close !== null ? $close : $obj->get_close_button ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  $classes = array ();
28
 
29
- // Show close button only if enabled in block settings
30
- if ($close_button != AI_CLOSE_NONE) {
 
 
 
 
 
 
 
 
31
  $classes [] = 'ai-close';
32
  }
33
 
@@ -53,7 +98,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
53
 
54
  ?><html>
55
  <head>
56
- <title><?php echo AD_INSERTER_NAME; ?> Code Preview</title>
57
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
58
  <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
59
  <script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>
@@ -68,6 +113,9 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
68
  <script>
69
 
70
  // initialize_preview ();
 
 
 
71
 
72
  window.onkeydown = function( event ) {
73
  if (event.keyCode === 27 ) {
@@ -106,6 +154,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
106
  var AI_ALIGNMENT_STICKY_RIGHT = 9;
107
  var AI_ALIGNMENT_STICKY_TOP = 10;
108
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
 
109
 
110
  var AI_CLOSE_NONE = 0;
111
  var AI_CLOSE_TOP_RIGHT = 1;
@@ -113,6 +162,26 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
113
  var AI_CLOSE_BOTTOM_RIGHT = 3;
114
  var AI_CLOSE_BOTTOM_LEFT = 4;
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  var id_css_alignment_default = "#css-" + AI_ALIGNMENT_DEFAULT;
117
  var id_css_alignment_left = "#css-" + AI_ALIGNMENT_LEFT;
118
  var id_css_alignment_right = "#css-" + AI_ALIGNMENT_RIGHT;
@@ -123,6 +192,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
123
  var id_css_alignment_sticky_right = "#css-" + AI_ALIGNMENT_STICKY_RIGHT;
124
  var id_css_alignment_sticky_top = "#css-" + AI_ALIGNMENT_STICKY_TOP;
125
  var id_css_alignment_sticky_bottom = "#css-" + AI_ALIGNMENT_STICKY_BOTTOM;
 
126
 
127
  function update_highlighting () {
128
  if ($('body').hasClass ("highlighted")) {
@@ -177,12 +247,18 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
177
  // document.write = oldDocumentWrite
178
  // }, 1000);
179
 
 
180
  $("select#block-alignment").val (settings.find ("select#block-alignment-" + block + " option:selected").attr('value')).change();
181
  $("select#block-alignment option:selected").data ('alt-style', '1');
182
  $("#custom-css").val (settings.find ("#custom-css-" + block).val ());
183
  $("#block-name").text (settings.find ("#name-label-" + block).text ());
184
  $("select#close-button-0").val (settings.find ("select#close-button-" + block + " option:selected").attr('value')).change();
185
 
 
 
 
 
 
186
  process_display_elements ();
187
  }
188
  }
@@ -211,6 +287,14 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
211
  }
212
  settings.find ("select#close-button-" + block).val (new_close_button);
213
 
 
 
 
 
 
 
 
 
214
  window.opener.change_block_alignment (block);
215
  }
216
  }
@@ -257,6 +341,8 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
257
 
258
  function process_display_elements () {
259
 
 
 
260
  var style = "";
261
  $("#css-label").css('display', 'inline-block');
262
  $("#edit-css-button").css('display', 'inline-block');
@@ -271,6 +357,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
271
  $("#css-" + AI_ALIGNMENT_STICKY_RIGHT).hide();
272
  $("#css-" + AI_ALIGNMENT_STICKY_TOP).hide();
273
  $("#css-" + AI_ALIGNMENT_STICKY_BOTTOM).hide();
 
274
  $("#custom-css").hide();
275
  $("#css-no-wrapping").hide();
276
 
@@ -335,6 +422,10 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
335
  $(id_css_alignment_sticky_bottom).css('display', 'inline-block');
336
  style = $(id_css_alignment_sticky_bottom).text ();
337
  } else
 
 
 
 
338
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
339
  // $("#alignment-editor").show();
340
  $("#custom-css").show();
@@ -354,7 +445,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
354
 
355
  $("#wrapper").attr ("style", style);
356
 
357
- $("#wrapper").css ('border', '1px solid red;');
358
 
359
  if (wrapping) update_margin_padding ();
360
 
@@ -363,6 +454,9 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
363
  }
364
 
365
  function update_custom_css () {
 
 
 
366
  $("#custom-css").val ($("#wrapper").attr ("style"));
367
  $("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
368
  $("#edit-css-button").click ();
@@ -420,6 +514,76 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
420
  }
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  var start_time = new Date().getTime();
424
 
425
  spinner_margin_top = create_spinner ("#spinner-margin-top", "margin-top", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
@@ -432,8 +596,21 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
432
  spinner_padding_right = create_spinner ("#spinner-padding-right", "padding-right", "vertical");
433
 
434
  $("select#block-alignment").change (function() {
 
 
 
 
 
 
 
435
  process_display_elements ();
436
  update_close_button ();
 
 
 
 
 
 
437
  });
438
 
439
  $("select#close-button-0").change (function() {
@@ -441,6 +618,43 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
441
  update_highlighting ();
442
  });
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  $('.ai-close-button').click (function () {
445
  if ($('body').hasClass ("highlighted")) {
446
  setTimeout (function () {
@@ -469,6 +683,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
469
  $(id_css_alignment_sticky_right).hide();
470
  $(id_css_alignment_sticky_top).hide();
471
  $(id_css_alignment_sticky_bottom).hide();
 
472
 
473
  var alignment = $("select#block-alignment"+" option:selected").attr('value');
474
 
@@ -511,15 +726,30 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
511
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
512
  $("#custom-css").show().val ($(id_css_alignment_sticky_bottom).text ());
513
  $("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
 
 
 
 
514
  }
515
  });
516
 
517
  $("#custom-css").on ('input', function() {
 
 
 
 
518
  if (wrapping) $("#wrapper").attr ("style", $("#custom-css").val ());
 
 
 
 
 
519
  update_margin_padding ();
520
  update_close_button ();
521
  update_highlighting ();
522
  update_wrapper_size ();
 
 
523
  });
524
 
525
  $("#highlight-button").button ({
@@ -715,12 +945,17 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
715
  });
716
 
717
  update_width ();
 
718
  update_close_button ();
719
 
 
 
720
  <?php if (!$read_only) : ?>
721
  load_from_settings ();
722
  <?php endif; ?>
723
 
 
 
724
  setTimeout (update_wrapper_size, 500);
725
 
726
  var current_time = new Date().getTime();
@@ -734,6 +969,33 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
734
  $(this).attr ('title', titles [index]);
735
  });
736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  $("div.automatic-insertion").dblclick (function () {
738
  var selected_alignment = $("select#block-alignment option:selected");
739
  var alignment_value = selected_alignment.val ();
@@ -747,6 +1009,11 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
747
  process_display_elements ();
748
  }
749
  });
 
 
 
 
 
750
  }
751
 
752
  jQuery(document).ready(function($) {
@@ -775,6 +1042,15 @@ a, img {
775
  vertical-align: baseline;
776
  }
777
 
 
 
 
 
 
 
 
 
 
778
  .responsive-table td {
779
  white-space: nowrap;
780
  }
@@ -949,7 +1225,10 @@ select {
949
  </style>
950
  <?php echo $head_code; ?>
951
  </head>
952
- <body style='font-family: arial; text-align: justify; overflow-x: hidden;'>
 
 
 
953
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>"></div>
954
 
955
  <div style="margin: 0 -8px 10px; display: none;">
@@ -957,6 +1236,7 @@ select {
957
  <tr>
958
  <?php
959
  $previous_width = 0;
 
960
  for ($viewport = AD_INSERTER_VIEWPORTS - 1; $viewport > 0; $viewport --) {
961
  $viewport_name = get_viewport_name ($viewport);
962
  $viewport_width = get_viewport_width ($viewport);
@@ -973,15 +1253,6 @@ select {
973
  </table>
974
  </div>
975
 
976
- <div id="blocked-warning" class="warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
977
- <div style="float: right; text-align: right; margin: 20px 0px 0px 0;">
978
- This page was not loaded properly. Please check browser, plugins and ad blockers.
979
- </div>
980
- <h3 style="color: red;" title="Error loading page">PAGE BLOCKED</h3>
981
-
982
- <div style="clear: both;"></div>
983
- </div>
984
-
985
  <?php if (!$read_only) : ?>
986
  <div style="margin: 10px -8px">
987
  <table class="screen" cellspacing=0 cellspacing="0">
@@ -996,6 +1267,17 @@ select {
996
  </div>
997
  <?php endif; ?>
998
 
 
 
 
 
 
 
 
 
 
 
 
999
  <div style="float: right; width: 90px; margin-left: 20px;">
1000
  <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
1001
  <?php if (!$read_only) : ?>
@@ -1091,20 +1373,135 @@ select {
1091
  <?php else : ?>
1092
  <div id="alignment-editor" style="margin: 20px 0; display: none;">
1093
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1094
  <div style="margin: 20px 0 0 0;">
1095
  Alignment and Style&nbsp;&nbsp;&nbsp;
1096
  <select id="block-alignment" style="width:120px;">
1097
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview default" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_DEFAULT, true)); ?> value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
1098
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview align-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
1099
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview center" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_CENTER, true)); ?> value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
1100
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview align-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
1101
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview float-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
1102
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview float-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
1103
  <?php if (function_exists ('ai_preview_style_options')) ai_preview_style_options ($obj, $alignment_type); ?>
1104
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
1105
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
1106
  </select>
1107
  <span id="css-index" style="display: inline-block; min-width: 30px; min-height: 12px; margin: 0 0 0 10px; font-size: 14px;" title="CSS code index"></span>
 
1108
  <span id="close-button-selection" style="display: <?php echo $alignment_type == AI_ALIGNMENT_NO_WRAPPING || $close_button == AI_CLOSE_NONE ? 'none': 'inline'; ?>;">
1109
  <?php if (function_exists ('ai_close_button')) ai_close_button (0, $close_button, $close_button); ?>
1110
  </span>
@@ -1112,14 +1509,16 @@ select {
1112
 
1113
  <div id="alignment-style" style="margin: 4px 0; min-height: 74px;"></div>
1114
 
 
 
1115
  <table class="responsive-table">
1116
  <tr>
1117
  <td style="vertical-align: middle; padding:0;">
1118
  <span id="css-label" style="vertical-align: middle; margin: 4px 0 0 0 0; width: 36px; font-size: 14px; font-weight: bold; display: none;">CSS</span>
1119
  </td>
1120
  <td style="width: 100%; height: 32px; padding:0;">
1121
- <input id="custom-css" style="width: 100%; display: inline-block; padding: 5px 0 0 3px; border-radius: 4px; display: none; font-size: 12px; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" value="<?php echo $custom_css_code; ?>" size="70" maxlength="160" title="Custom CSS code for wrapping div" />
1122
- <span style="width: 100%; display: inline-block; padding: 5px 0 0 2px; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
1123
  <span id="css-no-wrapping" style="vertical-align: middle; display: none;"></span>
1124
  <span id="css-<?php echo AI_ALIGNMENT_DEFAULT; ?>" class="css-code" style="vertical-align: middle; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
1125
  <span id="css-<?php echo AI_ALIGNMENT_LEFT; ?>" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_LEFT); ?></span>
@@ -1137,6 +1536,8 @@ select {
1137
  </table>
1138
  </div>
1139
 
 
 
1140
  <?php if (!$read_only) : ?>
1141
  <p id="p1">This is a preview of the code between dummy paragraphs. Here you can test various block alignments, visually edit margin and padding values of the wrapping div
1142
  or write CSS code directly and watch live preview. Highlight button highlights background, wrapping div margin and code area, while Reset button restores all the values to those of the current block.</p>
@@ -1146,16 +1547,7 @@ select {
1146
  <p id="p1">This is a preview of AdSense ad block between dummy paragraphs. AdSense ad code was loaded from your AdSense account. The ad block is displayed on a dummy page so it may be blank (no ads).</p>
1147
  <?php endif; ?>
1148
 
1149
- <div id='padding-background'></div>
1150
- <div id='margin-background'></div>
1151
- <div id='padding-background-white'></div>
1152
- <div id='wrapper'<?php echo $class; ?> style='<?php echo $wrapper_css; ?>'>
1153
- <?php if ($close_button != AI_CLOSE_NONE) : ?><span class='ai-close-button ai-close-hidden' style='display: none'></span><?php endif; ?>
1154
- <?php echo $block_code; ?>
1155
- </div>
1156
- <!-- IE bug: use inline CSS: position: absolute;-->
1157
- <div id='code-background-white' class= "code-background-white" style="position: absolute;"></div>
1158
- <div id='code-overlay' class="code-overlay" style="position: absolute;"></div>
1159
 
1160
  <?php if (!$read_only) : ?>
1161
  <p id="p2">You can resize the window (and refresh the page to reload ads) to check display with different screen widths.
@@ -1175,9 +1567,39 @@ Enable and use at least one display option (Automatic Display, Widget, Shortcode
1175
  Enable display on at least one Wordpress page type (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages).
1176
  Single pages (posts and static pages) have also additional setting for individual exceptions. Use default blank value unless you are using individual post/page exceptions.</p>
1177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1178
  <?php ai_wp_footer_hook (); ?>
1179
  <script>
1180
- <?php echo ai_get_js ('ai-close'); ?>
 
1181
  </script>
1182
  </body>
1183
  </html>
1
  <?php
2
 
3
+ //ini_set ('display_errors', 1);
4
+ //error_reporting (E_ALL);
5
+
6
  function alt_styles_data ($alt_styles_text) {
7
  if (strpos ($alt_styles_text, "||") !== false) {
8
  $styles = explode ("||", $alt_styles_text);
14
  }
15
  }
16
 
17
+ function padding_margin_code ($close_button, $class, $wrapper_css, $block_code) {
18
+ ?>
19
+ <div id='padding-background'></div>
20
+ <div id='margin-background'></div>
21
+ <div id='padding-background-white'></div>
22
+ <div id='wrapper'<?php echo $class; ?> style='<?php echo $wrapper_css;
23
+ ?>'>
24
+ <span class='ai-close-button ai-close-hidden' style='display: none'></span>
25
+ <?php echo $block_code; ?>
26
+ </div>
27
+ <!-- IE bug: use inline CSS: position: absolute;-->
28
+ <div id='code-background-white' class= "code-background-white" style="position: absolute;"></div>
29
+ <div id='code-overlay' class="code-overlay" style="position: absolute;"></div>
30
+ <?php
31
+ }
32
+
33
+
34
+ function generate_code_preview ($block, $name = null, $alignment = null, $horizontal = null, $vertical = null, $alignment_css = null, $custom_css = null, $client_code = null, $process_php = null, $close = null, $read_only = false) {
35
  global $block_object, $ai_wp_data;
36
 
37
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
38
 
39
  $obj = $block_object [$block];
40
 
41
+ $block_name = $name !== null ? $name : $obj->get_ad_name();
42
+ $alignment_type = $alignment !== null ? $alignment : $obj->get_alignment_type();
43
+ $horizontal_position = $horizontal !== null ? $horizontal : $obj->get_horizontal_position();
44
+ $vertical_position = $vertical !== null ? $vertical : $obj->get_vertical_position();
45
+ $wrapper_css = $alignment_css !== null ? $alignment_css : $obj->get_alignment_style ();
46
+ $custom_css_code = $custom_css !== null ? $custom_css : $obj->get_custom_css();
47
+ $close_button = $close !== null ? $close : $obj->get_close_button ();
48
+
49
+ $sticky = false;
50
+
51
+ switch ($alignment_type) {
52
+ case AI_ALIGNMENT_STICKY:
53
+ $sticky = true;
54
+ break;
55
+ case AI_ALIGNMENT_CUSTOM_CSS:
56
+ $custom_css = str_replace (' ', '', $custom_css_code);
57
+ if (strpos ($custom_css, 'position:fixed') !== false &&
58
+ strpos ($custom_css, 'z-index:' . AI_STICKY_Z_INDEX) !== false) {
59
+ $sticky = true;
60
+ }
61
+ break;
62
+ }
63
 
64
  $classes = array ();
65
 
66
+ $stick_to_the_content_class = $obj->stick_to_the_content_class ();
67
+
68
+ if ($stick_to_the_content_class != '') {
69
+ $sticky = true;
70
+ $classes [] = 'ai-sticky-content';
71
+ $classes [] = $stick_to_the_content_class;
72
+ }
73
+
74
+ // For non-sticky preview show close button only if enabled in block settings
75
+ if ($sticky || $close_button != AI_CLOSE_NONE) {
76
  $classes [] = 'ai-close';
77
  }
78
 
98
 
99
  ?><html>
100
  <head>
101
+ <title><?php echo AD_INSERTER_NAME; ?> <?php if ($sticky) echo 'Sticky '; ?>Code Preview</title>
102
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
103
  <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
104
  <script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>
113
  <script>
114
 
115
  // initialize_preview ();
116
+ <?php echo get_frontend_javascript_debugging () ? 'ai_debugging = true;' : ''; ?>;
117
+ var sticky = <?php echo $sticky ? 'true' : 'false'; ?>;
118
+ if (sticky) window.resizeTo (screen.width, screen.height);
119
 
120
  window.onkeydown = function( event ) {
121
  if (event.keyCode === 27 ) {
154
  var AI_ALIGNMENT_STICKY_RIGHT = 9;
155
  var AI_ALIGNMENT_STICKY_TOP = 10;
156
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
157
+ var AI_ALIGNMENT_STICKY = 12;
158
 
159
  var AI_CLOSE_NONE = 0;
160
  var AI_CLOSE_TOP_RIGHT = 1;
162
  var AI_CLOSE_BOTTOM_RIGHT = 3;
163
  var AI_CLOSE_BOTTOM_LEFT = 4;
164
 
165
+ var AI_STICK_TO_THE_LEFT = 0;
166
+ var AI_STICK_TO_THE_CONTENT_LEFT = 1;
167
+ var AI_STICK_HORIZONTAL_CENTER = 2;
168
+ var AI_STICK_TO_THE_CONTENT_RIGHT = 3;
169
+ var AI_STICK_TO_THE_RIGHT = 4;
170
+
171
+ var AI_STICK_TO_THE_TOP = 0;
172
+ var AI_STICK_VERTICAL_CENTER = 1;
173
+ var AI_SCROLL_WITH_THE_CONTENT = 2;
174
+ var AI_STICK_TO_THE_BOTTOM = 3;
175
+
176
+ var STICKY_CONTEXT_NONE = 0;
177
+ var STICKY_CONTEXT_INIT = 1;
178
+ var STICKY_CONTEXT_BLOCK_ALIGNMENT = 2;
179
+ var STICKY_CONTEXT_HORIZONTAL_POSITION = 3;
180
+ var STICKY_CONTEXT_VERTICAL_POSITION = 4;
181
+ var STICKY_CONTEXT_CUSTOM_CSS = 5;
182
+
183
+ var sticky_context = STICKY_CONTEXT_INIT;
184
+
185
  var id_css_alignment_default = "#css-" + AI_ALIGNMENT_DEFAULT;
186
  var id_css_alignment_left = "#css-" + AI_ALIGNMENT_LEFT;
187
  var id_css_alignment_right = "#css-" + AI_ALIGNMENT_RIGHT;
192
  var id_css_alignment_sticky_right = "#css-" + AI_ALIGNMENT_STICKY_RIGHT;
193
  var id_css_alignment_sticky_top = "#css-" + AI_ALIGNMENT_STICKY_TOP;
194
  var id_css_alignment_sticky_bottom = "#css-" + AI_ALIGNMENT_STICKY_BOTTOM;
195
+ var id_css_alignment_sticky = "#css-" + AI_ALIGNMENT_STICKY;
196
 
197
  function update_highlighting () {
198
  if ($('body').hasClass ("highlighted")) {
247
  // document.write = oldDocumentWrite
248
  // }, 1000);
249
 
250
+ console.log (settings.find ("select#block-alignment-" + block + " option:selected").attr('value'));
251
  $("select#block-alignment").val (settings.find ("select#block-alignment-" + block + " option:selected").attr('value')).change();
252
  $("select#block-alignment option:selected").data ('alt-style', '1');
253
  $("#custom-css").val (settings.find ("#custom-css-" + block).val ());
254
  $("#block-name").text (settings.find ("#name-label-" + block).text ());
255
  $("select#close-button-0").val (settings.find ("select#close-button-" + block + " option:selected").attr('value')).change();
256
 
257
+ if (sticky) {
258
+ $("select#horizontal-position").val (settings.find ("select#horizontal-position-" + block + " option:selected").attr('value')).change();
259
+ $("select#vertical-position").val (settings.find ("select#vertical-position-" + block + " option:selected").attr('value')).change();
260
+ }
261
+
262
  process_display_elements ();
263
  }
264
  }
287
  }
288
  settings.find ("select#close-button-" + block).val (new_close_button);
289
 
290
+ if (sticky) {
291
+ var new_horizontal_position = $("select#horizontal-position option:selected").attr('value');
292
+ settings.find ("select#horizontal-position-" + block).val (new_horizontal_position);
293
+
294
+ var new_vertical_position = $("select#vertical-position option:selected").attr('value');
295
+ settings.find ("select#vertical-position-" + block).val (new_vertical_position);
296
+ }
297
+
298
  window.opener.change_block_alignment (block);
299
  }
300
  }
341
 
342
  function process_display_elements () {
343
 
344
+ console.log ('process_display_elements');
345
+
346
  var style = "";
347
  $("#css-label").css('display', 'inline-block');
348
  $("#edit-css-button").css('display', 'inline-block');
357
  $("#css-" + AI_ALIGNMENT_STICKY_RIGHT).hide();
358
  $("#css-" + AI_ALIGNMENT_STICKY_TOP).hide();
359
  $("#css-" + AI_ALIGNMENT_STICKY_BOTTOM).hide();
360
+ $("#css-" + AI_ALIGNMENT_STICKY).hide();
361
  $("#custom-css").hide();
362
  $("#css-no-wrapping").hide();
363
 
422
  $(id_css_alignment_sticky_bottom).css('display', 'inline-block');
423
  style = $(id_css_alignment_sticky_bottom).text ();
424
  } else
425
+ if (alignment == AI_ALIGNMENT_STICKY) {
426
+ $(id_css_alignment_sticky).css('display', 'inline-block');
427
+ style = $(id_css_alignment_sticky).text ();
428
+ } else
429
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
430
  // $("#alignment-editor").show();
431
  $("#custom-css").show();
445
 
446
  $("#wrapper").attr ("style", style);
447
 
448
+ console.log ('process_display_elements');
449
 
450
  if (wrapping) update_margin_padding ();
451
 
454
  }
455
 
456
  function update_custom_css () {
457
+
458
+ console.log ('update_custom_css');
459
+
460
  $("#custom-css").val ($("#wrapper").attr ("style"));
461
  $("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
462
  $("#edit-css-button").click ();
514
  }
515
  }
516
 
517
+ function update_sticky_css (context) {
518
+
519
+ console.log ('update_sticky_css', context, 'sticky_context', sticky_context);
520
+
521
+ if (sticky_context != context) return;
522
+
523
+
524
+ var horizontal_position = $("select#horizontal-position option:selected").attr('value');
525
+ var selected_horizontal_position = $("select#horizontal-position option:selected");
526
+
527
+ var vertical_position = $("select#vertical-position option:selected").attr('value');
528
+ var selected_vertical_position = $("select#vertical-position option:selected");
529
+
530
+ var custom_vertical_position_css = selected_vertical_position.data ('css-' + horizontal_position);
531
+
532
+ if (typeof custom_vertical_position_css != 'undefined') var vertical_position_css = custom_vertical_position_css; else
533
+ var vertical_position_css = selected_vertical_position.data ('css');
534
+
535
+ var custom_horizontal_position_css = selected_horizontal_position.data ('css-' + vertical_position);
536
+
537
+ if (typeof custom_horizontal_position_css != 'undefined') var horizontal_position_css = custom_horizontal_position_css; else
538
+ var horizontal_position_css = selected_horizontal_position.data ('css');
539
+
540
+ $('#css-' + AI_ALIGNMENT_STICKY + ' .ai-sticky-css').text (vertical_position_css + horizontal_position_css);
541
+
542
+ console.log ('#css-' + AI_ALIGNMENT_STICKY + ' .ai-sticky-css', vertical_position_css + horizontal_position_css);
543
+
544
+
545
+ $('#wrapper').removeClass ('ai-sticky-content').removeClass ('ai-sticky-left').removeClass ('ai-sticky-right').removeClass ('ai-sticky-scroll');
546
+
547
+ switch (parseInt ($("select#block-alignment option:selected").attr('value'))) {
548
+ case AI_ALIGNMENT_STICKY:
549
+ if (horizontal_position == AI_STICK_TO_THE_CONTENT_LEFT) {
550
+ $('#wrapper').addClass ('ai-sticky-content');
551
+ $('#wrapper').addClass ('ai-sticky-left');
552
+ } else
553
+ if (horizontal_position == AI_STICK_TO_THE_CONTENT_RIGHT) {
554
+ $('#wrapper').addClass ('ai-sticky-content');
555
+ $('#wrapper').addClass ('ai-sticky-right');
556
+ }
557
+
558
+ if (vertical_position == AI_SCROLL_WITH_THE_CONTENT) {
559
+ $('#wrapper').addClass ('ai-sticky-content');
560
+ $('#wrapper').addClass ('ai-sticky-scroll');
561
+ }
562
+ break;
563
+ case AI_ALIGNMENT_CUSTOM_CSS:
564
+ var custom_css = $("#custom-css").val ().replace (/\s+/g, '');
565
+
566
+ sticky_classes = [];
567
+ if (window.opener != null && !window.opener.closed) {
568
+ sticky_classes = window.opener.get_sticky_classes (custom_css);
569
+ }
570
+
571
+ sticky_classes.forEach(function (sticky_class) {
572
+ $('#wrapper').addClass (sticky_class);
573
+ });
574
+ break;
575
+ }
576
+ }
577
+
578
+ function update_sticky_elements (context) {
579
+
580
+ console.log ('update_sticky_elements', context, 'sticky_context', sticky_context);
581
+
582
+ if (sticky_context != context) return;
583
+
584
+ process_sticky_elements (jQuery);
585
+ }
586
+
587
  var start_time = new Date().getTime();
588
 
589
  spinner_margin_top = create_spinner ("#spinner-margin-top", "margin-top", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
596
  spinner_padding_right = create_spinner ("#spinner-padding-right", "padding-right", "vertical");
597
 
598
  $("select#block-alignment").change (function() {
599
+
600
+ if (sticky_context == STICKY_CONTEXT_NONE) sticky_context = STICKY_CONTEXT_BLOCK_ALIGNMENT;
601
+
602
+ console.log ('select#block-alignment change', $("select#block-alignment option:selected").attr ('value'));
603
+
604
+ if (sticky) update_sticky_css (STICKY_CONTEXT_BLOCK_ALIGNMENT);
605
+
606
  process_display_elements ();
607
  update_close_button ();
608
+
609
+ console.log ('select#block-alignment');
610
+
611
+ if (sticky) update_sticky_elements (STICKY_CONTEXT_BLOCK_ALIGNMENT);
612
+
613
+ if (sticky_context == STICKY_CONTEXT_BLOCK_ALIGNMENT) sticky_context = STICKY_CONTEXT_NONE;
614
  });
615
 
616
  $("select#close-button-0").change (function() {
618
  update_highlighting ();
619
  });
620
 
621
+ $("select#horizontal-position").change (function() {
622
+ if (sticky_context == STICKY_CONTEXT_NONE) sticky_context = STICKY_CONTEXT_HORIZONTAL_POSITION;
623
+
624
+ console.log ('select#horizontal-position change');
625
+
626
+ if (sticky_context == STICKY_CONTEXT_HORIZONTAL_POSITION) $("select#block-alignment").val (AI_ALIGNMENT_STICKY).change();
627
+ update_sticky_css (STICKY_CONTEXT_HORIZONTAL_POSITION);
628
+ process_display_elements ();
629
+ update_close_button ();
630
+
631
+ console.log ('select#horizontal-position');
632
+
633
+ update_sticky_elements (STICKY_CONTEXT_HORIZONTAL_POSITION);
634
+ update_highlighting ();
635
+
636
+ if (sticky_context == STICKY_CONTEXT_HORIZONTAL_POSITION) sticky_context = STICKY_CONTEXT_NONE;
637
+ });
638
+
639
+ $("select#vertical-position").change (function() {
640
+ if (sticky_context == STICKY_CONTEXT_NONE) sticky_context = STICKY_CONTEXT_VERTICAL_POSITION;
641
+
642
+ console.log ('select#vertical-position change');
643
+
644
+ if (sticky_context == STICKY_CONTEXT_VERTICAL_POSITION) $("select#block-alignment").val (AI_ALIGNMENT_STICKY).change();
645
+ update_sticky_css (STICKY_CONTEXT_VERTICAL_POSITION);
646
+ process_display_elements ();
647
+ update_close_button ();
648
+
649
+ console.log ('select#vertical-position');
650
+
651
+ update_sticky_elements (STICKY_CONTEXT_VERTICAL_POSITION);
652
+ update_highlighting ();
653
+
654
+ if (sticky_context == STICKY_CONTEXT_VERTICAL_POSITION) sticky_context = STICKY_CONTEXT_NONE;
655
+ });
656
+
657
+
658
  $('.ai-close-button').click (function () {
659
  if ($('body').hasClass ("highlighted")) {
660
  setTimeout (function () {
683
  $(id_css_alignment_sticky_right).hide();
684
  $(id_css_alignment_sticky_top).hide();
685
  $(id_css_alignment_sticky_bottom).hide();
686
+ $(id_css_alignment_sticky).hide();
687
 
688
  var alignment = $("select#block-alignment"+" option:selected").attr('value');
689
 
726
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
727
  $("#custom-css").show().val ($(id_css_alignment_sticky_bottom).text ());
728
  $("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
729
+ } else
730
+ if (alignment == AI_ALIGNMENT_STICKY) {
731
+ $("#custom-css").show().val ($(id_css_alignment_sticky).text ());
732
+ $("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
733
  }
734
  });
735
 
736
  $("#custom-css").on ('input', function() {
737
+ if (sticky_context == STICKY_CONTEXT_NONE) sticky_context = STICKY_CONTEXT_CUSTOM_CSS;
738
+
739
+ console.log ('#custom-css input');
740
+
741
  if (wrapping) $("#wrapper").attr ("style", $("#custom-css").val ());
742
+ if (sticky) update_sticky_css (STICKY_CONTEXT_CUSTOM_CSS);
743
+
744
+ console.log ('#custom-css');
745
+
746
+ if (sticky) update_sticky_elements (STICKY_CONTEXT_CUSTOM_CSS);
747
  update_margin_padding ();
748
  update_close_button ();
749
  update_highlighting ();
750
  update_wrapper_size ();
751
+
752
+ if (sticky_context == STICKY_CONTEXT_CUSTOM_CSS) sticky_context = STICKY_CONTEXT_NONE;
753
  });
754
 
755
  $("#highlight-button").button ({
945
  });
946
 
947
  update_width ();
948
+
949
  update_close_button ();
950
 
951
+ if (sticky) update_sticky_css (STICKY_CONTEXT_INIT);
952
+
953
  <?php if (!$read_only) : ?>
954
  load_from_settings ();
955
  <?php endif; ?>
956
 
957
+ if (sticky) update_sticky_elements (STICKY_CONTEXT_INIT);
958
+
959
  setTimeout (update_wrapper_size, 500);
960
 
961
  var current_time = new Date().getTime();
969
  $(this).attr ('title', titles [index]);
970
  });
971
 
972
+ if (sticky) {
973
+ var titles = new Array();
974
+ $("select#close-button-0").imagepicker({hide_select: false}).find ('option').each (function (index) {
975
+ titles.push ($(this).data ('title'));
976
+ });
977
+ $("select#close-button-0 + ul").appendTo("#close-buttons").css ('padding-top', '10px').find ('li').each (function (index) {
978
+ $(this).attr ('title', titles [index]);
979
+ });
980
+ }
981
+
982
+ var titles = new Array();
983
+ $("select#horizontal-position").imagepicker({hide_select: false}).find ('option').each (function (index) {
984
+ titles.push ($(this).data ('title'));
985
+ });
986
+ $("select#horizontal-position + ul").appendTo("#horizontal-positions").css ('padding-top', '10px').find ('li').each (function (index) {
987
+ $(this).attr ('title', titles [index]);
988
+ });
989
+
990
+ var titles = new Array();
991
+ $("select#vertical-position").imagepicker({hide_select: false}).find ('option').each (function (index) {
992
+ titles.push ($(this).data ('title'));
993
+ });
994
+ $("select#vertical-position + ul").appendTo("#vertical-positions").css ('padding-top', '10px').find ('li').each (function (index) {
995
+ $(this).attr ('title', titles [index]);
996
+ });
997
+
998
+
999
  $("div.automatic-insertion").dblclick (function () {
1000
  var selected_alignment = $("select#block-alignment option:selected");
1001
  var alignment_value = selected_alignment.val ();
1009
  process_display_elements ();
1010
  }
1011
  });
1012
+
1013
+ // Prevent anoter initialization of sticky elements on document ready
1014
+ $('#wrapper').removeClass ('ai-sticky-content');
1015
+
1016
+ sticky_context = STICKY_CONTEXT_NONE;
1017
  }
1018
 
1019
  jQuery(document).ready(function($) {
1042
  vertical-align: baseline;
1043
  }
1044
 
1045
+ body.sticky {
1046
+ margin: 0;
1047
+ }
1048
+
1049
+ #main.sticky {
1050
+ width: 728px;
1051
+ margin: 100px auto;
1052
+ }
1053
+
1054
  .responsive-table td {
1055
  white-space: nowrap;
1056
  }
1225
  </style>
1226
  <?php echo $head_code; ?>
1227
  </head>
1228
+ <body class="<?php if ($sticky) echo 'sticky'; ?>" style='font-family: arial; text-align: justify; overflow-x: hidden;'>
1229
+
1230
+ <?php if ($sticky) padding_margin_code ($close_button, $class, $wrapper_css, $block_code); ?>
1231
+
1232
  <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>"></div>
1233
 
1234
  <div style="margin: 0 -8px 10px; display: none;">
1236
  <tr>
1237
  <?php
1238
  $previous_width = 0;
1239
+ $previous_name = '';
1240
  for ($viewport = AD_INSERTER_VIEWPORTS - 1; $viewport > 0; $viewport --) {
1241
  $viewport_name = get_viewport_name ($viewport);
1242
  $viewport_width = get_viewport_width ($viewport);
1253
  </table>
1254
  </div>
1255
 
 
 
 
 
 
 
 
 
 
1256
  <?php if (!$read_only) : ?>
1257
  <div style="margin: 10px -8px">
1258
  <table class="screen" cellspacing=0 cellspacing="0">
1267
  </div>
1268
  <?php endif; ?>
1269
 
1270
+ <div id="main" class="<?php if ($sticky) echo 'sticky'; ?>">
1271
+
1272
+ <div id="blocked-warning" class="warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
1273
+ <div style="float: right; text-align: right; margin: 20px 0px 0px 0;">
1274
+ This page was not loaded properly. Please check browser, plugins and ad blockers.
1275
+ </div>
1276
+ <h3 style="color: red;" title="Error loading page">PAGE BLOCKED</h3>
1277
+
1278
+ <div style="clear: both;"></div>
1279
+ </div>
1280
+
1281
  <div style="float: right; width: 90px; margin-left: 20px;">
1282
  <button id="highlight-button" type="button" style="margin: 0 0 10px 0; font-size: 12px; width: 90px; height: 35px; float: right;" title="Highlight inserted code" >Highlight</button>
1283
  <?php if (!$read_only) : ?>
1373
  <?php else : ?>
1374
  <div id="alignment-editor" style="margin: 20px 0; display: none;">
1375
  <?php endif; ?>
1376
+ <?php if (defined ('AI_STICKY_SETTINGS') && AI_STICKY_SETTINGS && $sticky) : ?>
1377
+
1378
+ <div style="">
1379
+
1380
+ <div style="float: left;">
1381
+ Alignment and Style&nbsp;&nbsp;&nbsp;
1382
+ <select id="block-alignment" style="width:120px;">
1383
+ <?php if (function_exists ('ai_preview_style_options')) ai_preview_style_options ($obj, $alignment_type, true); ?>
1384
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
1385
+ </select>
1386
+ <span id="css-index" style="display: inline-block; min-width: 30px; min-height: 12px; margin: 0 0 0 10px; font-size: 14px;" title="CSS code index"></span>
1387
+ <div id="alignment-style" style="margin: 4px 0; min-height: 74px;"></div>
1388
+ </div>
1389
+
1390
+ <div style="float: right;">
1391
+ <?php if (function_exists ('ai_close_button')) ai_close_button (0, $close_button, $close_button); ?>
1392
+ <div id="close-buttons" style="margin: 4px 0; min-height: 74px;"></div>
1393
+ </div>
1394
+ <div style="clear: both;"></div>
1395
+
1396
+ </div>
1397
+
1398
+ <div style="float: left;">
1399
+ <div style="margin: 4px 0;">
1400
+ Horizontal position
1401
+ <select class="ai-image-selection" id="horizontal-position">
1402
+ <option
1403
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1404
+ data-img-class="automatic-insertion preview im-sticky-left"
1405
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_LEFT; ?>"
1406
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_LEFT; ?>"
1407
+ value="<?php echo AI_STICK_TO_THE_LEFT; ?>"
1408
+ <?php echo ($horizontal_position == AI_STICK_TO_THE_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_LEFT; ?></option>
1409
+ <option
1410
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1411
+ data-img-class="automatic-insertion preview im-sticky-content-left"
1412
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_LEFT; ?>"
1413
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_CONTENT_LEFT; ?>"
1414
+ value="<?php echo AI_STICK_TO_THE_CONTENT_LEFT; ?>"
1415
+ <?php echo ($horizontal_position == AI_STICK_TO_THE_CONTENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_CONTENT_LEFT; ?></option>
1416
+ <option
1417
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1418
+ data-img-class="automatic-insertion preview im-sticky-center-horizontal"
1419
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL; ?>"
1420
+ data-css-<?php echo AI_STICK_VERTICAL_CENTER; ?>="<?php echo AI_ALIGNMENT_CSS_STICK_CENTER_HORIZONTAL_V; ?>"
1421
+ data-title="<?php echo AI_TEXT_CENTER; ?>"
1422
+ value="<?php echo AI_STICK_HORIZONTAL_CENTER; ?>"
1423
+ <?php echo ($horizontal_position == AI_STICK_HORIZONTAL_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
1424
+ <option
1425
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1426
+ data-img-class="automatic-insertion preview im-sticky-content-right"
1427
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_CONTENT_RIGHT; ?>"
1428
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_CONTENT_RIGHT; ?>"
1429
+ value="<?php echo AI_STICK_TO_THE_CONTENT_RIGHT; ?>"
1430
+ <?php echo ($horizontal_position == AI_STICK_TO_THE_CONTENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_CONTENT_RIGHT; ?></option>
1431
+ <option
1432
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1433
+ data-img-class="automatic-insertion preview im-sticky-right"
1434
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT; ?>"
1435
+ data-css-<?php echo AI_SCROLL_WITH_THE_CONTENT; ?>="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_RIGHT_SCROLL; ?>"
1436
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_RIGHT; ?>"
1437
+ value="<?php echo AI_STICK_TO_THE_RIGHT; ?>"
1438
+ <?php echo ($horizontal_position == AI_STICK_TO_THE_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_RIGHT; ?></option>
1439
+ </select>
1440
+ <div style="clear: both;"></div>
1441
+ </div>
1442
+
1443
+ <div id="horizontal-positions"></div>
1444
+ </div>
1445
+
1446
+ <div style="float: right;">
1447
+ <div style="margin: 4px 0;">
1448
+ Vertical position
1449
+ <select id="vertical-position">
1450
+ <option
1451
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1452
+ data-img-class="automatic-insertion preview im-sticky-top"
1453
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_TOP_OFFSET; ?>"
1454
+ data-css-<?php echo AI_STICK_HORIZONTAL_CENTER; ?>="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_TOP; ?>"
1455
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_TOP; ?>"
1456
+ value="<?php echo AI_STICK_TO_THE_TOP; ?>"
1457
+ <?php echo ($vertical_position == AI_STICK_TO_THE_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_TOP; ?></option>
1458
+ <option
1459
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-sticky-center-vertical"
1460
+ data-css="<?php echo AI_ALIGNMENT_CSS_CENTER_VERTICAL; ?>"
1461
+ data-css-<?php echo AI_STICK_HORIZONTAL_CENTER; ?>="<?php echo AI_ALIGNMENT_CSS_CENTER_VERTICAL_H; ?>"
1462
+ data-title="<?php echo AI_TEXT_CENTER; ?>"
1463
+ value="<?php echo AI_STICK_VERTICAL_CENTER; ?>"
1464
+ <?php echo ($vertical_position == AI_STICK_VERTICAL_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
1465
+ <option
1466
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1467
+ data-img-class="automatic-insertion preview im-sticky-scroll"
1468
+ data-css="<?php echo AI_ALIGNMENT_CSS_SCROLL_WITH_THE_CONTENT; ?>"
1469
+ data-title="<?php echo AI_TEXT_SCROLL_WITH_THE_CONTENT; ?>"
1470
+ value="<?php echo AI_SCROLL_WITH_THE_CONTENT; ?>"
1471
+ <?php echo ($vertical_position == AI_SCROLL_WITH_THE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SCROLL_WITH_THE_CONTENT; ?></option>
1472
+ <option
1473
+ data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>"
1474
+ data-img-class="automatic-insertion preview im-sticky-bottom"
1475
+ data-css="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM_OFFSET; ?>"
1476
+ data-css-<?php echo AI_STICK_HORIZONTAL_CENTER; ?>="<?php echo AI_ALIGNMENT_CSS_STICK_TO_THE_BOTTOM; ?>"
1477
+ data-title="<?php echo AI_TEXT_STICK_TO_THE_BOTTOM; ?>"
1478
+ value="<?php echo AI_STICK_TO_THE_BOTTOM; ?>"
1479
+ <?php echo ($vertical_position == AI_STICK_TO_THE_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_STICK_TO_THE_BOTTOM; ?></option>
1480
+ </select>
1481
+ <div style="clear: both;"></div>
1482
+ </div>
1483
+
1484
+ <div id="vertical-positions" style="margin-bottom: 4px;"></div>
1485
+ </div>
1486
+ <div style="clear: both;"></div>
1487
+
1488
+ <?php else : ?>
1489
+
1490
  <div style="margin: 20px 0 0 0;">
1491
  Alignment and Style&nbsp;&nbsp;&nbsp;
1492
  <select id="block-alignment" style="width:120px;">
1493
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-default" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_DEFAULT, true)); ?> value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
1494
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-align-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
1495
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-center" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_CENTER, true)); ?> value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
1496
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-align-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
1497
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-float-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
1498
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-float-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
1499
  <?php if (function_exists ('ai_preview_style_options')) ai_preview_style_options ($obj, $alignment_type); ?>
1500
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
1501
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', AD_INSERTER_FILE); ?>" data-img-class="automatic-insertion preview im-no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
1502
  </select>
1503
  <span id="css-index" style="display: inline-block; min-width: 30px; min-height: 12px; margin: 0 0 0 10px; font-size: 14px;" title="CSS code index"></span>
1504
+ &nbsp;&nbsp;&nbsp;
1505
  <span id="close-button-selection" style="display: <?php echo $alignment_type == AI_ALIGNMENT_NO_WRAPPING || $close_button == AI_CLOSE_NONE ? 'none': 'inline'; ?>;">
1506
  <?php if (function_exists ('ai_close_button')) ai_close_button (0, $close_button, $close_button); ?>
1507
  </span>
1509
 
1510
  <div id="alignment-style" style="margin: 4px 0; min-height: 74px;"></div>
1511
 
1512
+ <?php endif; ?>
1513
+
1514
  <table class="responsive-table">
1515
  <tr>
1516
  <td style="vertical-align: middle; padding:0;">
1517
  <span id="css-label" style="vertical-align: middle; margin: 4px 0 0 0 0; width: 36px; font-size: 14px; font-weight: bold; display: none;">CSS</span>
1518
  </td>
1519
  <td style="width: 100%; height: 32px; padding:0;">
1520
+ <input id="custom-css" style="width: 100%; display: inline-block; padding: 5px 0 0 3px; border-radius: 4px; display: none; font-size: 12px; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" value="<?php echo $custom_css_code; ?>" size="70" maxlength="500" title="Custom CSS code for wrapping div" />
1521
+ <span style="width: 100%; display: inline-block; padding: 5px 0 0 2px; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer; white-space: normal;">
1522
  <span id="css-no-wrapping" style="vertical-align: middle; display: none;"></span>
1523
  <span id="css-<?php echo AI_ALIGNMENT_DEFAULT; ?>" class="css-code" style="vertical-align: middle; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
1524
  <span id="css-<?php echo AI_ALIGNMENT_LEFT; ?>" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_LEFT); ?></span>
1536
  </table>
1537
  </div>
1538
 
1539
+ <?php if (!$sticky) { ?>
1540
+
1541
  <?php if (!$read_only) : ?>
1542
  <p id="p1">This is a preview of the code between dummy paragraphs. Here you can test various block alignments, visually edit margin and padding values of the wrapping div
1543
  or write CSS code directly and watch live preview. Highlight button highlights background, wrapping div margin and code area, while Reset button restores all the values to those of the current block.</p>
1547
  <p id="p1">This is a preview of AdSense ad block between dummy paragraphs. AdSense ad code was loaded from your AdSense account. The ad block is displayed on a dummy page so it may be blank (no ads).</p>
1548
  <?php endif; ?>
1549
 
1550
+ <?php if (!$sticky) padding_margin_code ($close_button, $class, $wrapper_css, $block_code); ?>
 
 
 
 
 
 
 
 
 
1551
 
1552
  <?php if (!$read_only) : ?>
1553
  <p id="p2">You can resize the window (and refresh the page to reload ads) to check display with different screen widths.
1567
  Enable display on at least one Wordpress page type (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages).
1568
  Single pages (posts and static pages) have also additional setting for individual exceptions. Use default blank value unless you are using individual post/page exceptions.</p>
1569
 
1570
+ <?php } else { ?>
1571
+ <p id="p1">This is a preview of the code for sticky ads. Here you can test various horizontal and vertical alignments, close button locations, visually edit margin values
1572
+ or write CSS code directly and watch live preview. Highlight button highlights background, margin and code area, while Reset button restores all the values to those of the current block.</p>
1573
+
1574
+ <p id="p2">Ad Inserter can be configured to insert any code anywhere on the page. Each code with it's settings is called a code block.
1575
+ Free Ad Inserter supports 16 code blocks, Ad Inserter Pro supports up to 96 code blocks (depending on the license type).
1576
+ The settings page is divided into tabs - 16 code blocks and general plugin settings. Black number means inactive code block (code is not inserted anywhere),
1577
+ red number means block is using automatic insertion, blue number means block is using manual insertion while violet number means block is using automatic and manual insertion.</p>
1578
+
1579
+ <p id="p3">Few very important things you need to know in order to insert code and display some ad:
1580
+ Enable and use at least one display option (Automatic Display, Widget, Shortcode, PHP function call).
1581
+ Enable display on at least one Wordpress page type (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages).
1582
+ Single pages (posts and static pages) have also additional setting for individual exceptions. Use default blank value unless you are using individual post/page exceptions.</p>
1583
+
1584
+ <p id="p4">Ad Inserter can be configured to insert any code anywhere on the page. Each code with it's settings is called a code block.
1585
+ Free Ad Inserter supports 16 code blocks, Ad Inserter Pro supports up to 96 code blocks (depending on the license type).
1586
+ The settings page is divided into tabs - 16 code blocks and general plugin settings. Black number means inactive code block (code is not inserted anywhere),
1587
+ red number means block is using automatic insertion, blue number means block is using manual insertion while violet number means block is using automatic and manual insertion.</p>
1588
+
1589
+ <p id="p5">Few very important things you need to know in order to insert code and display some ad:
1590
+ Enable and use at least one display option (Automatic Display, Widget, Shortcode, PHP function call).
1591
+ Enable display on at least one Wordpress page type (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages).
1592
+ Single pages (posts and static pages) have also additional setting for individual exceptions. Use default blank value unless you are using individual post/page exceptions.</p>
1593
+ <?php } ?>
1594
+
1595
+
1596
+ <span class="ai-content"></span>
1597
+ </div>
1598
+
1599
  <?php ai_wp_footer_hook (); ?>
1600
  <script>
1601
+ <?php if (function_exists ('ai_load_settings_2')) echo ai_get_js ('ai-close'); ?>
1602
+ <?php if ($sticky) echo ai_get_js ('ai-sticky'); ?>
1603
  </script>
1604
  </body>
1605
  </html>
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.3";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -32,6 +32,7 @@ var AI_BEFORE_COMMENTS = 10;
32
  var AI_BETWEEN_COMMENTS = 11;
33
  var AI_AFTER_COMMENTS = 12;
34
  var AI_FOOTER = 13;
 
35
  var AI_BEFORE_HTML_ELEMENT = 15;
36
  var AI_AFTER_HTML_ELEMENT = 16;
37
 
@@ -48,6 +49,7 @@ var AI_ALIGNMENT_STICKY_LEFT = 8;
48
  var AI_ALIGNMENT_STICKY_RIGHT = 9;
49
  var AI_ALIGNMENT_STICKY_TOP = 10;
50
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
 
51
 
52
  var AI_ADB_ACTION_NONE = 0;
53
  var AI_ADB_ACTION_MESSAGE = 1;
@@ -76,6 +78,11 @@ var AI_HTML_INSERTION_CLIENT_SIDE = 0;
76
  var AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY = 1;
77
  var AI_HTML_INSERTION_SEREVR_SIDE = 2;
78
 
 
 
 
 
 
79
 
80
 
81
  /**
@@ -310,8 +317,33 @@ SyntaxHighlight.prototype.applySettings = function () {
310
  session.setUseSoftTabs(settings['use_soft_tabs'] == 1);
311
  };
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  function change_block_alignment (block) {
314
  jQuery ("select#block-alignment-" + block).change ();
 
 
315
  }
316
 
317
  function change_banner_image (block) {
@@ -960,10 +992,13 @@ jQuery(document).ready(function($) {
960
  $("#css-sticky-right-"+block).hide();
961
  $("#css-sticky-top-"+block).hide();
962
  $("#css-sticky-bottom-"+block).hide();
 
963
  $("#css-no-wrapping-"+block).hide();
964
 
965
  $("#no-wrapping-warning-"+block).hide();
966
 
 
 
967
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
968
 
969
  if (alignment == AI_ALIGNMENT_NO_WRAPPING) {
@@ -978,8 +1013,9 @@ jQuery(document).ready(function($) {
978
  $("#css-none-"+block).css('display', 'table-cell');
979
  } else
980
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
981
- $("#css-code-" + block).show();
982
  $("#custom-css-"+block).show();
 
983
  } else
984
  if (alignment == AI_ALIGNMENT_LEFT) {
985
  $("#css-left-"+block).css('display', 'table-cell');
@@ -1007,10 +1043,16 @@ jQuery(document).ready(function($) {
1007
  } else
1008
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
1009
  $("#css-sticky-bottom-"+block).css('display', 'table-cell');
 
 
 
 
 
 
1010
  }
1011
 
1012
 
1013
- if ($('#css-code-'+block).is(':visible')) {
1014
  $("#show-css-button-"+block+" span").text ("Hide");
1015
  } else {
1016
  $("#show-css-button-"+block+" span").text ("Show");
@@ -1047,6 +1089,8 @@ jQuery(document).ready(function($) {
1047
  }
1048
 
1049
  if (syntax_highlighting) configure_editor_language (block);
 
 
1050
  }
1051
 
1052
  function process_adsense_elements (block) {
@@ -1455,22 +1499,6 @@ jQuery(document).ready(function($) {
1455
 
1456
  configure_editor (tab);
1457
 
1458
- var titles = new Array();
1459
- $("select#display-type-"+tab).imagepicker({hide_select: false}).find ('option').each (function (index) {
1460
- titles.push ($(this).data ('title'));
1461
- });
1462
- $("select#display-type-"+tab+" + ul").appendTo("#automatic-insertion-"+tab).css ('padding-top', '10px').find ('li').each (function (index) {
1463
- $(this).attr ('title', titles [index]);
1464
- });
1465
-
1466
- var titles = new Array();
1467
- $("select#block-alignment-"+tab).imagepicker({hide_select: false}).find ('option').each (function (index) {
1468
- titles.push ($(this).data ('title'));
1469
- });
1470
- $("select#block-alignment-"+tab+" + ul").appendTo("#alignment-style-"+tab).css ('padding-top', '10px').find ('li').each (function (index) {
1471
- $(this).attr ('title', titles [index]);
1472
- });
1473
-
1474
  $("select#display-type-"+tab).change (function() {
1475
  var block = $(this).attr('id').replace ("display-type-", "");
1476
  process_display_elements (block);
@@ -1479,11 +1507,30 @@ jQuery(document).ready(function($) {
1479
  $("select#block-alignment-"+tab).change (function() {
1480
  var block = $(this).attr('id').replace ("block-alignment-", "");
1481
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1482
- if (alignment == AI_ALIGNMENT_STICKY_LEFT || alignment == AI_ALIGNMENT_STICKY_RIGHT || alignment == AI_ALIGNMENT_STICKY_TOP || alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
 
 
 
 
 
 
 
1483
  $("select#display-type-"+block).val (AI_FOOTER).change ();
1484
  }
1485
  process_display_elements (block);
1486
  });
 
 
 
 
 
 
 
 
 
 
 
 
1487
  $("input#process-php-"+tab).change (function() {
1488
  var block = $(this).attr('id').replace ("process-php-", "");
1489
  process_display_elements (block);
@@ -1558,10 +1605,11 @@ jQuery(document).ready(function($) {
1558
  $("#show-css-button-"+tab).button ({
1559
  }).show ().click (function () {
1560
  var block = $(this).attr ("id").replace ("show-css-button-","");
1561
- $("#css-code-" + block).toggle ();
1562
 
1563
- if ($('#css-code-'+block).is(':visible')) {
1564
  $("#show-css-button-"+block+" span").text ("Hide");
 
1565
  } else {
1566
  $("#show-css-button-"+block+" span").text ("Show");
1567
  }
@@ -1602,6 +1650,7 @@ jQuery(document).ready(function($) {
1602
  $("#css-sticky-right-"+block).hide();
1603
  $("#css-sticky-top-"+block).hide();
1604
  $("#css-sticky-bottom-"+block).hide();
 
1605
 
1606
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1607
 
@@ -1654,6 +1703,11 @@ jQuery(document).ready(function($) {
1654
  $("#css-sticky-bottom-"+block).hide();
1655
  $("#custom-css-"+block).show().val ($("#css-sticky-bottom-"+block).text ());
1656
  $("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
 
 
 
 
 
1657
  }
1658
  });
1659
 
@@ -1795,8 +1849,12 @@ jQuery(document).ready(function($) {
1795
 
1796
  $(this).blur ();
1797
 
 
1798
 
1799
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
 
 
 
1800
  var custom_css = $("#custom-css-"+block).val ();
1801
 
1802
  var alignment_css = "";
@@ -1805,6 +1863,7 @@ jQuery(document).ready(function($) {
1805
  } else
1806
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
1807
  alignment_css = $("#custom-css-"+block).val();
 
1808
  } else
1809
  if (alignment == AI_ALIGNMENT_LEFT) {
1810
  alignment_css = $("#css-left-"+block).text ();
@@ -1832,6 +1891,10 @@ jQuery(document).ready(function($) {
1832
  } else
1833
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
1834
  alignment_css = $("#css-sticky-bottom-"+block).text ();
 
 
 
 
1835
  }
1836
 
1837
  var name = $("#name-label-"+block).text ();
@@ -1840,13 +1903,21 @@ jQuery(document).ready(function($) {
1840
  var php = $("input#process-php-"+block).is(":checked") ? 1 : 0;
1841
  var close_button = $("#close-button-"+block+" option:selected").attr('value');
1842
 
1843
- var window_width = 820;
1844
- var window_height = 820;
1845
- var window_left = 100;
1846
- var window_top = (screen.height / 2) - (820 / 2);
 
 
 
 
 
 
 
 
1847
  var nonce = $("#ai-form").attr ('nonce');
1848
 
1849
- var param = {'action': 'ai_ajax_backend', 'preview': block, 'ai_check': nonce, 'name': $.base64Encode (name), 'alignment': btoa (alignment), 'alignment_css': btoa (alignment_css), 'custom_css': btoa (custom_css), 'code': code, 'php': php, 'close': close_button};
1850
  window_open_post (ajaxurl, 'width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no', 'preview', param);
1851
  });
1852
 
@@ -2279,6 +2350,78 @@ jQuery(document).ready(function($) {
2279
  });
2280
  }
2281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2282
  function import_rotation_code (block) {
2283
  $("#rotation-"+block).next ("label").find ('.checkbox-icon').addClass("active");
2284
 
1
+ var javascript_version = "2.3.4";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
32
  var AI_BETWEEN_COMMENTS = 11;
33
  var AI_AFTER_COMMENTS = 12;
34
  var AI_FOOTER = 13;
35
+ var AI_ABOVE_HEADER = 14;
36
  var AI_BEFORE_HTML_ELEMENT = 15;
37
  var AI_AFTER_HTML_ELEMENT = 16;
38
 
49
  var AI_ALIGNMENT_STICKY_RIGHT = 9;
50
  var AI_ALIGNMENT_STICKY_TOP = 10;
51
  var AI_ALIGNMENT_STICKY_BOTTOM = 11;
52
+ var AI_ALIGNMENT_STICKY = 12;
53
 
54
  var AI_ADB_ACTION_NONE = 0;
55
  var AI_ADB_ACTION_MESSAGE = 1;
78
  var AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY = 1;
79
  var AI_HTML_INSERTION_SEREVR_SIDE = 2;
80
 
81
+ var AI_STICK_TO_THE_TOP = 0;
82
+ var AI_STICK_VERTICAL_CENTER = 1;
83
+ var AI_SCROLL_WITH_THE_CONTENT = 2;
84
+ var AI_STICK_TO_THE_BOTTOM = 3;
85
+
86
 
87
 
88
  /**
317
  session.setUseSoftTabs(settings['use_soft_tabs'] == 1);
318
  };
319
 
320
+ function get_sticky_classes (custom_css) {
321
+ custom_css = custom_css.replace (/\s+/g, '');
322
+ var sticky_classes = [];
323
+ if (custom_css.indexOf ("position:fixed") != - 1 &&
324
+ custom_css.indexOf ("z-index:9995") != - 1 &&
325
+ custom_css.indexOf ("display:none") != - 1) {
326
+ if (custom_css.indexOf (";left:auto") != - 1) {
327
+ sticky_classes.push ('ai-sticky-content');
328
+ sticky_classes.push ('ai-sticky-left');
329
+ } else
330
+ if (custom_css.indexOf ("right:auto") != - 1) {
331
+ sticky_classes.push ('ai-sticky-content');
332
+ sticky_classes.push ('ai-sticky-right');
333
+ };
334
+
335
+ if (custom_css.indexOf ("margin-bottom:auto") != - 1) {
336
+ sticky_classes.push ('ai-sticky-content');
337
+ sticky_classes.push ('ai-sticky-scroll');
338
+ };
339
+ }
340
+ return sticky_classes;
341
+ }
342
+
343
  function change_block_alignment (block) {
344
  jQuery ("select#block-alignment-" + block).change ();
345
+ jQuery ("select#horizontal-position-" + block).change ();
346
+ jQuery ("select#vertical-position-" + block).change ();
347
  }
348
 
349
  function change_banner_image (block) {
992
  $("#css-sticky-right-"+block).hide();
993
  $("#css-sticky-top-"+block).hide();
994
  $("#css-sticky-bottom-"+block).hide();
995
+ $("#css-sticky-"+block).hide();
996
  $("#css-no-wrapping-"+block).hide();
997
 
998
  $("#no-wrapping-warning-"+block).hide();
999
 
1000
+ $("#sticky-settings-"+block).hide();
1001
+
1002
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1003
 
1004
  if (alignment == AI_ALIGNMENT_NO_WRAPPING) {
1013
  $("#css-none-"+block).css('display', 'table-cell');
1014
  } else
1015
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
1016
+ $("#icons-css-code-" + block).show();
1017
  $("#custom-css-"+block).show();
1018
+ configure_selection_icons (block);
1019
  } else
1020
  if (alignment == AI_ALIGNMENT_LEFT) {
1021
  $("#css-left-"+block).css('display', 'table-cell');
1043
  } else
1044
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
1045
  $("#css-sticky-bottom-"+block).css('display', 'table-cell');
1046
+ } else
1047
+ if (alignment == AI_ALIGNMENT_STICKY) {
1048
+ $("#icons-css-code-" + block).show();
1049
+ $("#sticky-settings-"+block).show();
1050
+ $("#css-sticky-"+block).css('display', 'table-cell');
1051
+ configure_selection_icons (block);
1052
  }
1053
 
1054
 
1055
+ if ($('#icons-css-code-'+block).css ('display') != 'none') {
1056
  $("#show-css-button-"+block+" span").text ("Hide");
1057
  } else {
1058
  $("#show-css-button-"+block+" span").text ("Show");
1089
  }
1090
 
1091
  if (syntax_highlighting) configure_editor_language (block);
1092
+
1093
+ check_insertion (block);
1094
  }
1095
 
1096
  function process_adsense_elements (block) {
1499
 
1500
  configure_editor (tab);
1501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1502
  $("select#display-type-"+tab).change (function() {
1503
  var block = $(this).attr('id').replace ("display-type-", "");
1504
  process_display_elements (block);
1507
  $("select#block-alignment-"+tab).change (function() {
1508
  var block = $(this).attr('id').replace ("block-alignment-", "");
1509
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1510
+ var automatic_insertion = $("select#display-type-"+block+" option:selected").attr('value');
1511
+
1512
+ if (automatic_insertion != AI_ABOVE_HEADER &&
1513
+ (alignment == AI_ALIGNMENT_STICKY_LEFT ||
1514
+ alignment == AI_ALIGNMENT_STICKY_RIGHT ||
1515
+ alignment == AI_ALIGNMENT_STICKY_TOP || alignment ==
1516
+ AI_ALIGNMENT_STICKY_BOTTOM || alignment == AI_ALIGNMENT_STICKY)
1517
+ ) {
1518
  $("select#display-type-"+block).val (AI_FOOTER).change ();
1519
  }
1520
  process_display_elements (block);
1521
  });
1522
+
1523
+ $("select#vertical-position-"+tab).change (function() {
1524
+ var block = $(this).attr('id').replace ("vertical-position-", "");
1525
+ configure_sticky_css (block);
1526
+ });
1527
+
1528
+ $("select#horizontal-position-"+tab).change (function() {
1529
+ var block = $(this).attr('id').replace ("horizontal-position-", "");
1530
+ configure_sticky_css (block);
1531
+ });
1532
+
1533
+
1534
  $("input#process-php-"+tab).change (function() {
1535
  var block = $(this).attr('id').replace ("process-php-", "");
1536
  process_display_elements (block);
1605
  $("#show-css-button-"+tab).button ({
1606
  }).show ().click (function () {
1607
  var block = $(this).attr ("id").replace ("show-css-button-","");
1608
+ $("#icons-css-code-" + block).toggle ();
1609
 
1610
+ if ($('#icons-css-code-'+block).is(':visible')) {
1611
  $("#show-css-button-"+block+" span").text ("Hide");
1612
+ configure_selection_icons (block);
1613
  } else {
1614
  $("#show-css-button-"+block+" span").text ("Show");
1615
  }
1650
  $("#css-sticky-right-"+block).hide();
1651
  $("#css-sticky-top-"+block).hide();
1652
  $("#css-sticky-bottom-"+block).hide();
1653
+ $("#css-sticky-"+block).hide();
1654
 
1655
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1656
 
1703
  $("#css-sticky-bottom-"+block).hide();
1704
  $("#custom-css-"+block).show().val ($("#css-sticky-bottom-"+block).text ());
1705
  $("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
1706
+ } else
1707
+ if (alignment == AI_ALIGNMENT_STICKY) {
1708
+ $("#css-sticky-"+block).hide();
1709
+ $("#custom-css-"+block).show().val ($("#css-sticky-"+block).text ());
1710
+ $("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
1711
  }
1712
  });
1713
 
1849
 
1850
  $(this).blur ();
1851
 
1852
+ var sticky = false;
1853
 
1854
  var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
1855
+ var horizontal = $("select#horizontal-position-"+block+" option:selected").attr('value');
1856
+ var vertical = $("select#vertical-position-"+block+" option:selected").attr('value');
1857
+
1858
  var custom_css = $("#custom-css-"+block).val ();
1859
 
1860
  var alignment_css = "";
1863
  } else
1864
  if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
1865
  alignment_css = $("#custom-css-"+block).val();
1866
+ sticky = get_sticky_classes (custom_css).length != 0;
1867
  } else
1868
  if (alignment == AI_ALIGNMENT_LEFT) {
1869
  alignment_css = $("#css-left-"+block).text ();
1891
  } else
1892
  if (alignment == AI_ALIGNMENT_STICKY_BOTTOM) {
1893
  alignment_css = $("#css-sticky-bottom-"+block).text ();
1894
+ } else
1895
+ if (alignment == AI_ALIGNMENT_STICKY) {
1896
+ alignment_css = $("#css-sticky-"+block).text ();
1897
+ sticky = true;
1898
  }
1899
 
1900
  var name = $("#name-label-"+block).text ();
1903
  var php = $("input#process-php-"+block).is(":checked") ? 1 : 0;
1904
  var close_button = $("#close-button-"+block+" option:selected").attr('value');
1905
 
1906
+ if (!sticky) {
1907
+ var window_top = (screen.height / 2) - (820 / 2);
1908
+ var window_left = 100;
1909
+ var window_width = 820;
1910
+ var window_height = 820;
1911
+ } else {
1912
+ var window_top = screen.availTop;
1913
+ var window_left = screen.availLeft;
1914
+ var window_width = screen.availWidth;
1915
+ var window_height = screen.availHeight;
1916
+ }
1917
+
1918
  var nonce = $("#ai-form").attr ('nonce');
1919
 
1920
+ var param = {'action': 'ai_ajax_backend', 'preview': block, 'ai_check': nonce, 'name': $.base64Encode (name), 'alignment': btoa (alignment), 'horizontal': btoa (horizontal), 'vertical': btoa (vertical), 'alignment_css': btoa (alignment_css), 'custom_css': btoa (custom_css), 'code': code, 'php': php, 'close': close_button};
1921
  window_open_post (ajaxurl, 'width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no', 'preview', param);
1922
  });
1923
 
2350
  });
2351
  }
2352
 
2353
+ function configure_sticky_css (block) {
2354
+ var horizontal_position = $("select#horizontal-position-"+block+" option:selected").attr('value');
2355
+ var selected_horizontal_position = $("select#horizontal-position-"+block+" option:selected");
2356
+
2357
+ var vertical_position = $("select#vertical-position-"+block+" option:selected").attr('value');
2358
+ var selected_vertical_position = $("select#vertical-position-"+block+" option:selected");
2359
+
2360
+ var custom_vertical_position_css = selected_vertical_position.data ('css-' + horizontal_position);
2361
+
2362
+ if (typeof custom_vertical_position_css != 'undefined') var vertical_position_css = custom_vertical_position_css; else
2363
+ var vertical_position_css = selected_vertical_position.data ('css');
2364
+
2365
+ var custom_horizontal_position_css = selected_horizontal_position.data ('css-' + vertical_position);
2366
+
2367
+ if (typeof custom_horizontal_position_css != 'undefined') var horizontal_position_css = custom_horizontal_position_css; else
2368
+ var horizontal_position_css = selected_horizontal_position.data ('css');
2369
+
2370
+ $('#css-sticky-' + block + ' .ai-sticky-css').text (vertical_position_css + horizontal_position_css);
2371
+
2372
+ check_insertion (block);
2373
+ }
2374
+
2375
+ function check_insertion (block) {
2376
+ $('#sticky-scroll-warning-' + block).hide ();
2377
+ var automatic_insertion = $("select#display-type-"+block+" option:selected").attr('value');
2378
+ var alignment_style = $("select#block-alignment-"+block+" option:selected").attr('value');
2379
+ var vertical_position = $("select#vertical-position-"+block+" option:selected").attr('value');
2380
+
2381
+ if (alignment_style == AI_ALIGNMENT_STICKY && vertical_position == AI_SCROLL_WITH_THE_CONTENT && automatic_insertion != AI_ABOVE_HEADER && automatic_insertion != AI_DISABLED) {
2382
+ $('#sticky-scroll-warning-' + block).show ();
2383
+ }
2384
+ }
2385
+
2386
+ function configure_selection_icons (block) {
2387
+ var css_code_container = $('#icons-css-code-'+block);
2388
+ if (!css_code_container.hasClass ('configured')) {
2389
+ var titles = new Array();
2390
+ $("select#display-type-"+block).imagepicker({hide_select: false}).find ('option').each (function (index) {
2391
+ titles.push ($(this).data ('title'));
2392
+ });
2393
+ $("select#display-type-"+block+" + ul").appendTo("#automatic-insertion-"+block).css ('padding-top', '10px').find ('li').each (function (index) {
2394
+ $(this).attr ('title', titles [index]);
2395
+ });
2396
+
2397
+ var titles = new Array();
2398
+ $("select#block-alignment-"+block).imagepicker({hide_select: false}).find ('option').each (function (index) {
2399
+ titles.push ($(this).data ('title'));
2400
+ });
2401
+ $("select#block-alignment-"+block+" + ul").appendTo("#alignment-style-"+block).css ('padding-top', '10px').find ('li').each (function (index) {
2402
+ $(this).attr ('title', titles [index]);
2403
+ });
2404
+
2405
+ var titles = new Array();
2406
+ $("select#horizontal-position-"+block).imagepicker({hide_select: false}).find ('option').each (function (index) {
2407
+ titles.push ($(this).data ('title'));
2408
+ });
2409
+ $("select#horizontal-position-"+block+" + ul").appendTo("#horizontal-positions-"+block).css ('padding-top', '10px').find ('li').each (function (index) {
2410
+ $(this).attr ('title', titles [index]);
2411
+ });
2412
+
2413
+ var titles = new Array();
2414
+ $("select#vertical-position-"+block).imagepicker({hide_select: false}).find ('option').each (function (index) {
2415
+ titles.push ($(this).data ('title'));
2416
+ });
2417
+ $("select#vertical-position-"+block+" + ul").appendTo("#vertical-positions-"+block).css ('padding-top', '10px').find ('li').each (function (index) {
2418
+ $(this).attr ('title', titles [index]);
2419
+ });
2420
+
2421
+ css_code_container.addClass ('configured');
2422
+ }
2423
+ }
2424
+
2425
  function import_rotation_code (block) {
2426
  $("#rotation-"+block).next ("label").find ('.checkbox-icon').addClass("active");
2427
 
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
- === Ad Inserter - WordPress Ads Management ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
- Tags: ads, adsense, ad management, advertising manager, advanced contextual ads, ad rotation, ad injection, adverts, sticky widgets, sticky sidebar, hook, amazon, banners, automatic insertion, amp, geo targeting, multisite, shortcodes, PHP, Javascript, HTML, header, footer, tracking, ad blocking, custom fields, custom posts
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.3
9
- Stable tag: 2.3.2
10
  License: GPLv3
11
 
12
  Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
@@ -28,9 +28,13 @@ Average Rating: 5 out of 5 stars
28
 
29
  Check Ad Inserter <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">reviews</a>
30
 
31
- **AdSense integration**
32
 
33
- Get <a href="https://adinserter.pro/adsense-ads#integration">AdSense ad codes</a> from the plugin settings page - no need to copy ad codes from the AdSense admin pages and paste them to code blocks. List ad units, preview AdSense ads and get ad codes where you need them.
 
 
 
 
34
 
35
  **Endorsed by Amazon**
36
 
@@ -44,7 +48,7 @@ Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_bl
44
  **Features**
45
 
46
  * 16 code (ad) blocks
47
- * AdSense integration
48
  * Syntax highlighting editor
49
  * Code preview with visual CSS editor
50
  * Automatically inserts ads on posts and pages
@@ -151,8 +155,9 @@ Maintaining several plugins (often from different vendors) is not easy. And each
151
 
152
  Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
153
 
154
- * Code block is any code (for example Google AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
155
  * To rename block click on the name
 
156
  * Paste ad code into the code window or use <a href="https://adinserter.pro/code-editing" target="_blank">code generator</a> to generate code for banners, AdSense or any other HTML advert
157
  * **Enable and use at least one insertion option** (<a href="https://adinserter.pro/documentation#automatic-insertion" target="_blank">Automatic insertion</a>, Widget, <a href="https://adinserter.pro/documentation#manual" target="_blank">Shortcode</a>, PHP function call)
158
  * **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
@@ -452,6 +457,18 @@ Support the advancement of this plugin:
452
  8. Ads are not showing? Check <a href="https://adinserter.pro/documentation#ads-not-displayed" target="_blank">troubleshooting guide</a> to find out what to check to fix the problem.
453
 
454
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  = I have installed code for AdSense ads but the ad blocks are blank. =
456
 
457
  If you get blank ads then this might be because there is some error in the code (wrong IDs), your AdSense account is not fully approved yet, your website was not accepted or your AdSense account is banned.
@@ -785,6 +802,11 @@ AD CODE RIGHT
785
 
786
  == Changelog ==
787
 
 
 
 
 
 
788
  = 2.3.3 =
789
  - Added list editors
790
  - Added Label blocks debugging function for AdSense Auto ads
@@ -992,6 +1014,11 @@ AD CODE RIGHT
992
 
993
  == Upgrade Notice ==
994
 
 
 
 
 
 
995
  = 2.3.3 =
996
  Added list editors;
997
  Added Label blocks debugging function for AdSense Auto ads
1
+ === Ad Inserter - WordPress Ads Management with AdSense Header Integration ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
+ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, advanced contextual ads, amp adverts ad rotation, advertising manager, amazon banners ad injection, ad blocking detection, PHP Javascript HTML insertion, custom fields posts
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.3
9
+ Stable tag: 2.3.4
10
  License: GPLv3
11
 
12
  Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
28
 
29
  Check Ad Inserter <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">reviews</a>
30
 
31
+ **Endorsed by Google**
32
 
33
+ Google lists Ad Inserter plugin as possible solution to place AdSense ad code into your WordPress site.
34
+
35
+ > If you're new to AdSense, one of your first tasks is to connect your site to AdSense. This requires you to copy the code on your AdSense homepage and paste it into the HTML of your page, between the `<head>` and `</head>` tags.
36
+
37
+ Check [How to insert ad code in your WordPress site](https://support.google.com/adsense/answer/7527509). Advanced users can enable **AdSense integration**: get <a href="https://adinserter.pro/adsense-ads#integration">AdSense ad codes</a> from the plugin settings page - no need to copy ad codes from the AdSense admin pages and paste them to code blocks. List ad units, preview AdSense ads and get ad codes where you need them.
38
 
39
  **Endorsed by Amazon**
40
 
48
  **Features**
49
 
50
  * 16 code (ad) blocks
51
+ * [AdSense](https://adinserter.pro/adsense-ads) integration
52
  * Syntax highlighting editor
53
  * Code preview with visual CSS editor
54
  * Automatically inserts ads on posts and pages
155
 
156
  Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
157
 
158
+ * [Code block](https://adinserter.pro/code-editing) is any code (for example Google AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
159
  * To rename block click on the name
160
+ * If you are using AdSense check available tools and code generator for [AdSense code](https://adinserter.pro/adsense-ads)
161
  * Paste ad code into the code window or use <a href="https://adinserter.pro/code-editing" target="_blank">code generator</a> to generate code for banners, AdSense or any other HTML advert
162
  * **Enable and use at least one insertion option** (<a href="https://adinserter.pro/documentation#automatic-insertion" target="_blank">Automatic insertion</a>, Widget, <a href="https://adinserter.pro/documentation#manual" target="_blank">Shortcode</a>, PHP function call)
163
  * **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
457
  8. Ads are not showing? Check <a href="https://adinserter.pro/documentation#ads-not-displayed" target="_blank">troubleshooting guide</a> to find out what to check to fix the problem.
458
 
459
 
460
+ = Does Ad Inserter insert any internal ads? =
461
+
462
+ No revenue sharing and no such thing as "internal ads" or "our ads" on your website. Period. What you configure is what will be inserted (+ some internal scripts for plugin features).
463
+ Ad Inserter is free, open source plugin and inserts only the code you configure (blocks 1 - 16, Header, Footer). The code you see is the code that will be inserted. Please check page source code before you make any conclusion.
464
+ Of course, if you configure code block with some javacript ad code, then this code may generate ads. But please, don't blame the plugin for this.
465
+ You can also use Ad Inserter to insert code for AdSense Auto ads on each page (usually in the header). However, **the exact placement of ads will be done by the ad code, not Ad Inserter!**
466
+ [https://adinserter.pro/adsense-ads#auto-ads](https://adinserter.pro/adsense-ads#auto-ads)
467
+
468
+ The easiest way to check Ad Inserter code blocks is to use **Label blocks** debugging function:
469
+ [https://adinserter.pro/documentation#debugging](https://adinserter.pro/documentation#debugging)
470
+
471
+
472
  = I have installed code for AdSense ads but the ad blocks are blank. =
473
 
474
  If you get blank ads then this might be because there is some error in the code (wrong IDs), your AdSense account is not fully approved yet, your website was not accepted or your AdSense account is banned.
802
 
803
  == Changelog ==
804
 
805
+ = 2.3.4 =
806
+ - Added support for author:author-username items in taxonomy list
807
+ - Fixed errors when downgrading from Pro
808
+ - Few minor bug fixes
809
+
810
  = 2.3.3 =
811
  - Added list editors
812
  - Added Label blocks debugging function for AdSense Auto ads
1014
 
1015
  == Upgrade Notice ==
1016
 
1017
+ = 2.3.4 =
1018
+ Added support for author:author-username items in taxonomy list;
1019
+ Fixed errors when downgrading from Pro;
1020
+ Few minor bug fixes
1021
+
1022
  = 2.3.3 =
1023
  Added list editors;
1024
  Added Label blocks debugging function for AdSense Auto ads
settings.php CHANGED
@@ -860,27 +860,27 @@ function generate_settings_form (){
860
  <div style="float: left;">
861
  Automatic Insertion
862
  <select class="ai-image-selection" style="width:200px; margin-bottom: 3px;" id="display-type-<?php echo $block; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_automatic_insertion(); ?>">
863
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion disabled" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" data-title="<?php echo AI_TEXT_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
864
  <?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
865
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion above-header" value="<?php echo AI_AUTOMATIC_INSERTION_ABOVE_HEADER; ?>" data-title="<?php echo AI_TEXT_ABOVE_HEADER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_ABOVE_HEADER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE_HEADER; ?></option>
866
  <?php endif; ?>
867
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-post" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" data-title="<?php echo AI_TEXT_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
868
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-content" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
869
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_BEFORE_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_PARAGRAPH; ?></option>
870
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_AFTER_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_PARAGRAPH; ?></option>
871
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-content" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_CONTENT; ?>" data-title="<?php echo AI_TEXT_AFTER_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_CONTENT; ?></option>
872
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-post" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" data-title="<?php echo AI_TEXT_AFTER_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
873
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" data-title="<?php echo AI_TEXT_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
874
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" data-title="<?php echo AI_TEXT_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
875
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion between-posts" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
876
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BEFORE_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_COMMENTS; ?></option>
877
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion between-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_COMMENTS; ?></option>
878
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-comments" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_COMMENTS; ?>" data-title="<?php echo AI_TEXT_AFTER_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_COMMENTS; ?></option>
879
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion footer" value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" data-title="<?php echo AI_TEXT_FOOTER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
880
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-html" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?></option>
881
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-html" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?></option>
882
  <?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
883
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion custom-hook" value="<?php echo AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1; ?>" data-title="<?php echo $custom_hook ['name']; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo $custom_hook ['name']; ?></option>
884
  <?php } ?>
885
  </select>
886
  </div>
@@ -888,28 +888,30 @@ function generate_settings_form (){
888
  <div style="float: right;">
889
  Alignment and Style&nbsp;&nbsp;&nbsp;
890
  <select style="width:130px;" id="block-alignment-<?php echo $block; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_alignment_type(); ?>">
891
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion default" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
892
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion align-left" value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
893
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion center" value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
894
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion align-right" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
895
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion float-left" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
896
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion float-right" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
897
- <?php $css_code_height = 260; if (function_exists ('ai_style_options')) $css_code_height = ai_style_options ($obj); ?>
898
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
899
- <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
900
  </select>
901
  &nbsp;
902
  <button id="show-css-button-<?php echo $block; ?>" type="button" class='ai-button' style="min-width: 60px; margin-right: 0px;">Show</button>
903
  </div>
904
  <div style="clear: both;"></div>
905
 
906
- <!-- <div id="css-code-<?php echo $block; ?>" style="height: <?php echo $css_code_height; ?>px; margin: 4px 0 2px; display: none;">-->
907
- <div id="css-code-<?php echo $block; ?>" style="margin: 4px 0 2px; display: none;">
908
  <div id="automatic-insertion-<?php echo $block; ?>"></div>
909
  <div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
 
 
 
910
  <div class="max-input">
911
  <span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
912
- <input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="200" title="Custom CSS code for wrapping div" />
913
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
914
  <span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
915
  <span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
@@ -925,6 +927,10 @@ function generate_settings_form (){
925
  </div>
926
  </div>
927
 
 
 
 
 
928
  <div class="responsive-table small-button rounded">
929
  <table>
930
  <tr>
@@ -1682,7 +1688,7 @@ function generate_settings_form (){
1682
  Filter insertions
1683
  </span>
1684
  <span style="display: table-cell;">
1685
- <input style="width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "Filter insertions by specifying wanted calls for this block - single number or comma separated numbers, empty means all / no limits. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="24" />
1686
  </span>
1687
  <span style="display: table-cell;">
1688
  &nbsp;&nbsp;&nbsp;using
@@ -3090,7 +3096,8 @@ function generate_list_options ($options) {
3090
 
3091
  $users = get_users ();
3092
  foreach ($users as $user) {
3093
- $taxonomies ['user:' . strtolower ($user->data->user_login)] = $user->data->display_name;
 
3094
  if (count ($taxonomies) >= $max_items) break;
3095
  }
3096
 
@@ -3215,11 +3222,24 @@ function sidebar_support_plugin () {
3215
 
3216
  function sidebar_help () { ?>
3217
 
3218
- <div class="ai-form header rounded">
3219
  <div style="float: left;">
3220
- <h2 style="display: inline-block; margin: 5px 0;">Need help with settings? Check plugin features with documentation links below.</h2>
3221
- <div style="margin-bottom: 10px;">Most of these features are available in the free Ad Inserter you are using. Check <a href="https://adinserter.pro/documentation" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">feature list</a> for details.</div>
3222
- <div>Ads are not showing? Check <a href="https://adinserter.pro/documentation#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">troubleshooting guide</a> to find out how to fix the problem.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
3223
  <div>If you need any kind of help or support, please do not hesitate to open a thread on the <a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">support forum</a>.</div>
3224
  </div>
3225
  <div style="clear: both;"></div>
@@ -3268,7 +3288,7 @@ function sidebar_pro () {
3268
 
3269
  <ul>
3270
  <li>64 code (ad) blocks</li>
3271
- <li><a href="https://adinserter.pro/adsense-ads" class="simple-link" target="_blank">AdSense Integration</a></li>
3272
  <li>Syntax highlighting editor</li>
3273
  <li><a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
3274
  <li>Simple user interface - all settings on a single page</li>
860
  <div style="float: left;">
861
  Automatic Insertion
862
  <select class="ai-image-selection" style="width:200px; margin-bottom: 3px;" id="display-type-<?php echo $block; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_automatic_insertion(); ?>">
863
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-disabled" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" data-title="<?php echo AI_TEXT_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
864
  <?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
865
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-above-header" value="<?php echo AI_AUTOMATIC_INSERTION_ABOVE_HEADER; ?>" data-title="<?php echo AI_TEXT_ABOVE_HEADER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_ABOVE_HEADER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE_HEADER; ?></option>
866
  <?php endif; ?>
867
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-post" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" data-title="<?php echo AI_TEXT_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
868
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-content" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
869
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_BEFORE_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_PARAGRAPH; ?></option>
870
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_AFTER_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_PARAGRAPH; ?></option>
871
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-content" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_CONTENT; ?>" data-title="<?php echo AI_TEXT_AFTER_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_CONTENT; ?></option>
872
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-post" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" data-title="<?php echo AI_TEXT_AFTER_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
873
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" data-title="<?php echo AI_TEXT_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
874
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" data-title="<?php echo AI_TEXT_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
875
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-between-posts" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
876
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BEFORE_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_COMMENTS; ?></option>
877
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-between-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_COMMENTS; ?></option>
878
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-comments" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_COMMENTS; ?>" data-title="<?php echo AI_TEXT_AFTER_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_COMMENTS; ?></option>
879
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-footer" value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" data-title="<?php echo AI_TEXT_FOOTER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
880
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-html" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?></option>
881
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-html" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?></option>
882
  <?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
883
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-custom-hook" value="<?php echo AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1; ?>" data-title="<?php echo $custom_hook ['name']; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo $custom_hook ['name']; ?></option>
884
  <?php } ?>
885
  </select>
886
  </div>
888
  <div style="float: right;">
889
  Alignment and Style&nbsp;&nbsp;&nbsp;
890
  <select style="width:130px;" id="block-alignment-<?php echo $block; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_alignment_type(); ?>">
891
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-default" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
892
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-align-left" value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
893
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-center" value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
894
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-align-right" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
895
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-float-left" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
896
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-float-right" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
897
+ <?php if (function_exists ('ai_style_options')) ai_style_options ($obj); ?>
898
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
899
+ <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
900
  </select>
901
  &nbsp;
902
  <button id="show-css-button-<?php echo $block; ?>" type="button" class='ai-button' style="min-width: 60px; margin-right: 0px;">Show</button>
903
  </div>
904
  <div style="clear: both;"></div>
905
 
906
+ <div id="icons-css-code-<?php echo $block; ?>" style="margin: 4px 0 2px; display: none;">
 
907
  <div id="automatic-insertion-<?php echo $block; ?>"></div>
908
  <div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
909
+
910
+ <?php if (function_exists ('ai_sticky_options')) ai_sticky_options ($block, $obj, $default); ?>
911
+
912
  <div class="max-input">
913
  <span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
914
+ <input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="500" title="Custom CSS code for wrapping div" />
915
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
916
  <span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
917
  <span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
927
  </div>
928
  </div>
929
 
930
+ <div id="sticky-scroll-warning-<?php echo $block; ?>" class="rounded" style="display: none;">
931
+ <span style="margin-top: 5px;"><strong><span style="color: red;">WARNING:</span></strong> vertical position <strong><?php echo AI_TEXT_SCROLL_WITH_THE_CONTENT; ?></strong> needs <strong>Output buffering</strong> enabled and automatic insertion <strong><?php echo AI_TEXT_ABOVE_HEADER; ?></strong>!</span>
932
+ </div>
933
+
934
  <div class="responsive-table small-button rounded">
935
  <table>
936
  <tr>
1688
  Filter insertions
1689
  </span>
1690
  <span style="display: table-cell;">
1691
+ <input style="width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "Filter insertions by specifying wanted calls for this block - single number, comma separated numbers or %N for every N insertions - empty means all insertions / no filter. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="36" />
1692
  </span>
1693
  <span style="display: table-cell;">
1694
  &nbsp;&nbsp;&nbsp;using
3096
 
3097
  $users = get_users ();
3098
  foreach ($users as $user) {
3099
+ $taxonomies ['user:' . strtolower ($user->data->user_login)] = $user->data->display_name;
3100
+ $taxonomies ['author:' . strtolower ($user->data->user_login)] = $user->data->display_name;
3101
  if (count ($taxonomies) >= $max_items) break;
3102
  }
3103
 
3222
 
3223
  function sidebar_help () { ?>
3224
 
3225
+ <div class="ai-form header rounded ai-help">
3226
  <div style="float: left;">
3227
+ <h2 style="display: inline-block; margin: 5px 0;">
3228
+ Need help with settings?
3229
+ For quick start check <a href="https://adinserter.pro/code-editing" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Code Editing</a> and
3230
+ <a href="https://adinserter.pro/settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Common Settings</a>
3231
+ </h2>
3232
+ <div>
3233
+ <strong>New to <a href="https://adinserter.pro/adsense-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense</a>?</strong>
3234
+ <a href="https://adinserter.pro/adsense-ads#connect-your-site" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Connect your site</a> - Advanced
3235
+ <a href="https://adinserter.pro/adsense-ads#ad-code" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense code</a>:
3236
+ <a href="https://adinserter.pro/adsense-ads#in-feed-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">In-feed ads</a>,
3237
+ <a href="https://adinserter.pro/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Auto ads</a>,
3238
+ <a href="https://adinserter.pro/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AMP ads</a>, optional
3239
+ <a href="https://adinserter.pro/adsense-ads#integration" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense Integration</a>
3240
+ </div>
3241
+ <hr />
3242
+ <div>Ads are not showing? Check <a href="https://adinserter.pro/adsense-ads#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">troubleshooting guide</a> to find out how to diagnose and fix the problem.</div>
3243
  <div>If you need any kind of help or support, please do not hesitate to open a thread on the <a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">support forum</a>.</div>
3244
  </div>
3245
  <div style="clear: both;"></div>
3288
 
3289
  <ul>
3290
  <li>64 code (ad) blocks</li>
3291
+ <li><a href="https://adinserter.pro/adsense-ads#integration" class="simple-link" target="_blank">AdSense Integration</a></li>
3292
  <li>Syntax highlighting editor</li>
3293
  <li><a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
3294
  <li>Simple user interface - all settings on a single page</li>