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

Version Description

  • Added support for timed rotation
  • Added support for client-side insertion of dynamic blocks
  • Improved word count function
  • Few minor bug fixes, cosmetic changes and code improvements
Download this release

Release Info

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

Code changes from version 2.3.9 to 2.3.10

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.9
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,12 @@ Plugin URI: http://adinserter.pro/documentation
13
 
14
  Change Log
15
 
 
 
 
 
 
 
16
  Ad Inserter 2.3.9 - 2018-05-29
17
  - Added option to easily disable insertion of individual code block
18
  - Changes for compatibility with PHP 7.2
@@ -694,7 +700,7 @@ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
694
 
695
  if (function_exists ('ai_load_globals')) ai_load_globals ();
696
 
697
- if (get_dynamic_blocks ()) {
698
  if (!in_array ('w3-total-cache/w3-total-cache.php', get_option ('active_plugins'))) {
699
  define ('AI_NO_W3TC', true);
700
  if (!defined ('W3TC_DYNAMIC_SECURITY')) define ('W3TC_DYNAMIC_SECURITY', 'W3 Total Cache plugin not active');
@@ -1031,8 +1037,8 @@ function ai_log_filter_content ($content_string) {
1031
  }
1032
 
1033
  function ai_log_content (&$content) {
1034
- if (strlen ($content) < 100) ai_log (ai_log_filter_content ($content) . ' ['.number_of_words ($content).']'); else
1035
- ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).']');
1036
  }
1037
 
1038
  function ai_block_insertion_status ($block, $ai_last_check) {
@@ -1152,10 +1158,15 @@ function set_url_parameter ($parameter, $value) {
1152
  function number_of_words (&$content) {
1153
  $text = str_replace ("\r", "", $content);
1154
  $text = str_replace (array ("\n", " "), " ", $text);
1155
- $text = str_replace (" ", " ", $text);
 
 
1156
  $text = strip_tags ($text);
 
 
1157
  if ($text == '') return 0;
1158
- return count (explode (" ", $text));
 
1159
  }
1160
 
1161
  function ai_loop_check ($query, $action) {
@@ -1737,7 +1748,9 @@ function ai_wp_enqueue_scripts_hook () {
1737
  global $ai_wp_data;
1738
 
1739
  $footer_inline_scripts =
1740
- get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
 
 
1741
  $ai_wp_data [AI_TRACKING] ||
1742
  $ai_wp_data [AI_STICKY_WIDGETS] ||
1743
  $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
@@ -1786,11 +1799,20 @@ function ai_clean_url ( $url, $original_url){
1786
  return $url;
1787
  }
1788
 
 
 
 
 
 
 
 
 
1789
  function add_head_inline_styles_and_scripts () {
1790
  global $ai_wp_data;
1791
 
1792
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
1793
- get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
 
1794
  $ai_wp_data [AI_CLOSE_BUTTONS] ||
1795
  !get_inline_styles () ||
1796
  get_admin_toolbar_debugging () && (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0) ||
@@ -1800,11 +1822,15 @@ function add_head_inline_styles_and_scripts () {
1800
 
1801
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION]) echo get_viewport_css ();
1802
 
1803
- if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE) {
1804
- echo ".ai-rotate {position: relative;}\n";
1805
- echo ".ai-rotate-option {visibility: hidden;}\n";
1806
- echo ".ai-rotate-options {visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n";
1807
- echo ".ai-ip-data, .ai-ip-data-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
 
 
 
 
1808
  }
1809
 
1810
  if ($ai_wp_data [AI_CLOSE_BUTTONS]) {
@@ -2040,7 +2066,9 @@ function add_footer_inline_scripts () {
2040
 
2041
  // Update also $footer_inline_scripts in ai_wp_enqueue_scripts_hook
2042
  $footer_inline_scripts =
2043
- get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ||
 
 
2044
  $ai_wp_data [AI_TRACKING] ||
2045
  $ai_wp_data [AI_STICKY_WIDGETS] ||
2046
  $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
@@ -2061,7 +2089,7 @@ function add_footer_inline_scripts () {
2061
 
2062
  if ($footer_inline_scripts) echo "<script type='text/javascript'>\n";
2063
 
2064
- if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE) {
2065
  echo ai_get_js ('ai-rotate');
2066
  }
2067
 
@@ -2948,8 +2976,11 @@ function ai_write_debug_info ($write_processing_log = false) {
2948
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
2949
  echo AI_TEXT_SERVER_SIDE_W3TC;
2950
  break;
2951
- case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
2952
- echo AI_TEXT_CLIENT_SIDE;
 
 
 
2953
  break;
2954
  }
2955
  echo "\n";
@@ -3589,7 +3620,7 @@ function get_plugin_priority () {
3589
  }
3590
 
3591
  function get_dynamic_blocks(){
3592
- global $ai_db_options;
3593
 
3594
  if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
3595
 
@@ -4414,10 +4445,11 @@ function ai_generate_extract (&$settings) {
4414
  }
4415
 
4416
  $automatic = $automatic_insertion != AI_AUTOMATIC_INSERTION_DISABLED;
4417
- $manual_widget = $obj->get_enable_widget() == AI_ENABLED;
4418
- $manual_shortcode = $obj->get_enable_manual() == AI_ENABLED;
4419
- $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED;
4420
- if ($automatic || ($manual_widget && in_array ($block, $widget_blocks)) || $manual_shortcode || $manual_php_function) {
 
4421
  $active_blocks []= $block;
4422
  }
4423
  }
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.10
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.10 - 2018-06-16
17
+ - Added support for timed rotation
18
+ - Added support for client-side insertion of dynamic blocks
19
+ - Improved word count function
20
+ - Few minor bug fixes, cosmetic changes and code improvements
21
+
22
  Ad Inserter 2.3.9 - 2018-05-29
23
  - Added option to easily disable insertion of individual code block
24
  - Changes for compatibility with PHP 7.2
700
 
701
  if (function_exists ('ai_load_globals')) ai_load_globals ();
702
 
703
+ if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC) {
704
  if (!in_array ('w3-total-cache/w3-total-cache.php', get_option ('active_plugins'))) {
705
  define ('AI_NO_W3TC', true);
706
  if (!defined ('W3TC_DYNAMIC_SECURITY')) define ('W3TC_DYNAMIC_SECURITY', 'W3 Total Cache plugin not active');
1037
  }
1038
 
1039
  function ai_log_content (&$content) {
1040
+ if (strlen ($content) < 100) ai_log (ai_log_filter_content ($content) . ' ['.number_of_words ($content).' words]'); else
1041
+ ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).' words]');
1042
  }
1043
 
1044
  function ai_block_insertion_status ($block, $ai_last_check) {
1158
  function number_of_words (&$content) {
1159
  $text = str_replace ("\r", "", $content);
1160
  $text = str_replace (array ("\n", " "), " ", $text);
1161
+ $text = preg_replace('#<style.*?'.'>(.*?)</style>#i', '', $text);
1162
+ $text = preg_replace('#<script.*?'.'>(.*?)</script>#i', '', $text);
1163
+ $text = htmlspecialchars_decode ($text);
1164
  $text = strip_tags ($text);
1165
+ $text = preg_replace ('#\s+#', ' ', $text);
1166
+
1167
  if ($text == '') return 0;
1168
+
1169
+ return count (explode (' ', $text));
1170
  }
1171
 
1172
  function ai_loop_check ($query, $action) {
1748
  global $ai_wp_data;
1749
 
1750
  $footer_inline_scripts =
1751
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
1752
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ||
1753
+ isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION]) ||
1754
  $ai_wp_data [AI_TRACKING] ||
1755
  $ai_wp_data [AI_STICKY_WIDGETS] ||
1756
  $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
1799
  return $url;
1800
  }
1801
 
1802
+ function ai_get_client_side_styles () {
1803
+ return
1804
+ ".ai-rotate {position: relative;}\n" .
1805
+ ".ai-rotate-hidden {visibility: hidden;}\n" .
1806
+ ".ai-rotate-hidden-2 {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n" .
1807
+ ".ai-ip-data, .ai-ip-data-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
1808
+ }
1809
+
1810
  function add_head_inline_styles_and_scripts () {
1811
  global $ai_wp_data;
1812
 
1813
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] ||
1814
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
1815
+ isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION]) ||
1816
  $ai_wp_data [AI_CLOSE_BUTTONS] ||
1817
  !get_inline_styles () ||
1818
  get_admin_toolbar_debugging () && (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != 0) ||
1822
 
1823
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION]) echo get_viewport_css ();
1824
 
1825
+ if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION])) {
1826
+ // echo ".ai-rotate {position: relative;}\n";
1827
+ // echo ".ai-rotate-hidden {visibility: hidden;}\n";
1828
+ // echo ".ai-rotate-hidden-2 {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n";
1829
+ // echo ".ai-ip-data, .ai-ip-data-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
1830
+
1831
+ echo ai_get_client_side_styles ();
1832
+
1833
+ $ai_wp_data [AI_CLIENT_SIDE_CSS] = true;
1834
  }
1835
 
1836
  if ($ai_wp_data [AI_CLOSE_BUTTONS]) {
2066
 
2067
  // Update also $footer_inline_scripts in ai_wp_enqueue_scripts_hook
2068
  $footer_inline_scripts =
2069
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
2070
+ get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ||
2071
+ isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION]) ||
2072
  $ai_wp_data [AI_TRACKING] ||
2073
  $ai_wp_data [AI_STICKY_WIDGETS] ||
2074
  $ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
2089
 
2090
  if ($footer_inline_scripts) echo "<script type='text/javascript'>\n";
2091
 
2092
+ if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION])) {
2093
  echo ai_get_js ('ai-rotate');
2094
  }
2095
 
2976
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
2977
  echo AI_TEXT_SERVER_SIDE_W3TC;
2978
  break;
2979
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
2980
+ echo AI_TEXT_CLIENT_SIDE_SHOW;
2981
+ break;
2982
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
2983
+ echo AI_TEXT_CLIENT_SIDE_INSERT;
2984
  break;
2985
  }
2986
  echo "\n";
3620
  }
3621
 
3622
  function get_dynamic_blocks(){
3623
+ global $ai_db_options, $ai_wp_data;
3624
 
3625
  if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_OPTION_GLOBAL]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
3626
 
4445
  }
4446
 
4447
  $automatic = $automatic_insertion != AI_AUTOMATIC_INSERTION_DISABLED;
4448
+ $manual_widget = $obj->get_enable_widget() == AI_ENABLED;
4449
+ $manual_shortcode = $obj->get_enable_manual() == AI_ENABLED;
4450
+ $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED;
4451
+ $enabled_insertion = $obj->get_disable_insertion() == AI_DISABLED;
4452
+ if ($enabled_insertion && ($automatic || ($manual_widget && in_array ($block, $widget_blocks)) || $manual_shortcode || $manual_php_function)) {
4453
  $active_blocks []= $block;
4454
  }
4455
  }
class.php CHANGED
@@ -1688,12 +1688,21 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1688
  } else array_unshift ($ai_wp_data [AI_SHORTCODES]['rotate'], array ('name' => ''));
1689
 
1690
  $shares = false;
 
1691
  $version_names = array ();
1692
  $version_shares = array ();
 
 
1693
  foreach ($ai_wp_data [AI_SHORTCODES]['rotate'] as $index => $option) {
1694
  $version_names []= isset ($option ['name']) && trim ($option ['name']) != '' ? $option ['name'] : chr (ord ('A') + $index);
1695
- if (isset ($option ['share'])) $shares = true;
1696
- $version_shares []= isset ($option ['share']) && is_numeric ($option ['share']) ? intval ($option ['share']) : - 1;
 
 
 
 
 
 
1697
  }
1698
 
1699
  if ($shares) {
@@ -1725,10 +1734,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1725
  }
1726
  }
1727
 
1728
- $amp_dynamic_blocks = $dynamic_blocks;
1729
- if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
 
 
1730
 
1731
- switch ($amp_dynamic_blocks) {
 
 
 
1732
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1733
  if ($shares) {
1734
  $random_threshold = mt_rand (0, 100);
@@ -1741,22 +1755,36 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1741
  $processed_code = $additional_code . trim ($ads [$this->code_version - 1]);
1742
  $this->version_name = $version_names [$this->code_version - 1];
1743
  break;
1744
- case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
 
 
1745
  $this->code_version = '""';
1746
 
1747
- $version_share_data = '';
1748
  if ($shares) {
1749
- $version_share_data = " data-shares='".base64_encode (json_encode ($thresholds))."'";
 
 
 
 
 
 
 
 
 
 
 
 
1750
  }
1751
 
1752
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1753
- $processed_code = "\n<div class='ai-rotate'".$version_share_data.">\n" . $additional_code;
1754
  } else
1755
- $processed_code = "\n<div class='ai-rotate'".$version_share_data." style='position: relative;'>\n" . $additional_code;
1756
 
1757
  foreach ($ads as $index => $ad) {
1758
 
1759
- // If AMP separator use only code for normal pages
1760
  if (strpos ($ad, AD_AMP_SEPARATOR) !== false) {
1761
  $codes = explode (AD_AMP_SEPARATOR, $ad);
1762
  $ad = trim ($codes [0]);
@@ -1764,23 +1792,35 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1764
 
1765
  $version_name_data = " data-name='".base64_encode ($version_names [$index])."'";
1766
 
1767
- switch ($index) {
1768
- case 0:
1769
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1770
- $processed_code .= "<div class='ai-rotate-option'".$version_name_data.">\n".trim ($ad, "\n\r")."</div>\n";
1771
- } else
1772
- $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.">\n".trim ($ad, "\n\r")."</div>\n";
 
 
 
 
 
 
 
 
 
 
 
 
1773
  break;
1774
- default:
1775
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1776
- $processed_code .= "<div class='ai-rotate-option ai-rotate-options'".$version_name_data.">\n".trim ($ad, "\n\r")."</div>\n";
1777
- } else
1778
- $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.">\n".trim ($ad, "\n\r")."</div>\n";
1779
  break;
1780
  }
 
1781
  }
1782
  $processed_code .= "</div>\n";
1783
  break;
 
1784
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1785
  if ($shares) {
1786
  $ad_index_code = ' $ai_random_threshold = mt_rand (0, 100); $ai_thresholds = unserialize (\''.
@@ -1795,12 +1835,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1795
  }
1796
  } else $processed_code = $additional_code . $processed_code;
1797
 
 
 
 
 
1798
 
1799
- $amp_dynamic_blocks = $dynamic_blocks;
1800
- if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && $this->w3tc_code == '') $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1801
- elseif ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1802
-
1803
- switch ($amp_dynamic_blocks) {
1804
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1805
  if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
1806
  $codes = explode (AD_AMP_SEPARATOR, $processed_code);
@@ -1826,10 +1866,10 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1826
  break;
1827
  }
1828
 
1829
- $amp_dynamic_blocks = $dynamic_blocks;
1830
- if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1831
 
1832
- if ($amp_dynamic_blocks != AI_DYNAMIC_BLOCKS_SERVER_SIDE) {
1833
  $countries = trim (str_replace (' ', '', strtoupper ($this->get_ad_country_list (true))));
1834
  $country_list_type = $this->get_ad_country_list_type ();
1835
 
@@ -1838,7 +1878,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1838
 
1839
  if ($countries != '' || $country_list_type == AD_WHITE_LIST || $ip_addresses != '' || $ip_address_list_type == AD_WHITE_LIST) {
1840
  switch ($dynamic_blocks) {
1841
- case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
 
1842
  if ($country_list_type == AD_BLACK_LIST) $country_list_type = 'B'; else $country_list_type = 'W';
1843
  if ($ip_address_list_type == AD_BLACK_LIST) $ip_address_list_type = 'B'; else $ip_address_list_type = 'W';
1844
 
@@ -1847,14 +1888,24 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1847
 
1848
  $this->client_side_ip_address_detection = true;
1849
 
1850
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1851
- $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes>$processed_code</div>\n";
1852
- } else $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
 
 
 
 
 
 
 
 
 
1853
 
1854
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
1855
  $debug_ip = new ai_block_labels ('ai-debug-ip');
1856
  $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;
1857
  }
 
1858
  break;
1859
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1860
  if ($this->w3tc_code == '') $this->w3tc_code = '$ai_code = base64_decode (\''.base64_encode ($processed_code).'\'); $ai_index = 0; $ai_enabled = true;';
@@ -2127,12 +2178,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2127
  switch ($this->get_automatic_insertion()) {
2128
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
2129
  $insertion = 'before';
2130
- if ($server_side_html_insertion) return $this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only);
2131
  $html_element_insertion = true;
2132
  break;
2133
  case AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT:
2134
  $insertion = 'after';
2135
- if ($server_side_html_insertion) return $this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only);
2136
  $html_element_insertion = true;
2137
  break;
2138
  default:
@@ -5213,6 +5264,7 @@ class ai_code_generator {
5213
  'code' => $code,
5214
  'name' => '',
5215
  'share' => '',
 
5216
  ),
5217
  ),
5218
  );
@@ -5229,8 +5281,9 @@ class ai_code_generator {
5229
  $option_code = trim ($option, "\n");
5230
  $option_name = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name']) ? $ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name'] : '';
5231
  $option_share = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) && is_numeric ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) ? intval ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) : '';
 
5232
  if ($index == 0 && $option_code == '') continue;
5233
- $data ['options'] []= array ('code' => $option_code, 'name' => $option_name, 'share' => $option_share);
5234
  }
5235
  }
5236
 
@@ -5247,9 +5300,10 @@ class ai_code_generator {
5247
 
5248
  $name = trim ($rotation_data_row ['name']);
5249
  $share = trim ($rotation_data_row ['share']);
 
5250
  $code = trim ($rotation_data_row ['code'], "\n");
5251
 
5252
- if ($index != 0 || $name != '' || $share != '') {
5253
 
5254
  $shortcode = "" ;
5255
  if ($index != 0) $shortcode .= "\n\n";
@@ -5258,6 +5312,7 @@ class ai_code_generator {
5258
 
5259
  if ($name != '') $shortcode .= ' name="'.str_replace ('"', '\'', $name).'"';
5260
  if ($share != '') $shortcode .= ' share="'.str_replace ('"', '\'', $share).'"';
 
5261
  $shortcode .= "]\n\n";
5262
  } else $shortcode = '';
5263
 
1688
  } else array_unshift ($ai_wp_data [AI_SHORTCODES]['rotate'], array ('name' => ''));
1689
 
1690
  $shares = false;
1691
+ $times = false;
1692
  $version_names = array ();
1693
  $version_shares = array ();
1694
+ $version_times = array ();
1695
+
1696
  foreach ($ai_wp_data [AI_SHORTCODES]['rotate'] as $index => $option) {
1697
  $version_names []= isset ($option ['name']) && trim ($option ['name']) != '' ? $option ['name'] : chr (ord ('A') + $index);
1698
+
1699
+ $option_share = isset ($option ['share']) && is_numeric ($option ['share']);
1700
+ if ($option_share) $shares = true;
1701
+ $version_shares []= $option_share ? intval ($option ['share']) : - 1;
1702
+
1703
+ $option_time = isset ($option ['time']) && is_numeric ($option ['time']);
1704
+ if ($option_time) $times = true;
1705
+ $version_times []= $option_time ? intval ($option ['time']) : - 1;
1706
  }
1707
 
1708
  if ($shares) {
1734
  }
1735
  }
1736
 
1737
+ if ($times) {
1738
+ $dynamic_blocks = AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW;
1739
+ $ai_wp_data [AI_CLIENT_SIDE_ROTATION] = true;
1740
+ }
1741
 
1742
+ $temp_dynamic_blocks = $dynamic_blocks;
1743
+ if (($temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || $temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) && $ai_wp_data [AI_WP_AMP_PAGE]) $temp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1744
+
1745
+ switch ($temp_dynamic_blocks) {
1746
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1747
  if ($shares) {
1748
  $random_threshold = mt_rand (0, 100);
1755
  $processed_code = $additional_code . trim ($ads [$this->code_version - 1]);
1756
  $this->version_name = $version_names [$this->code_version - 1];
1757
  break;
1758
+
1759
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
1760
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
1761
  $this->code_version = '""';
1762
 
1763
+ $rotation_data = '';
1764
  if ($shares) {
1765
+ $rotation_data = " data-shares='".base64_encode (json_encode ($thresholds))."'";
1766
+ }
1767
+
1768
+ // Additional class to identify rotation code block in case of timed rotation
1769
+ $rotation_class = '';
1770
+ if ($times) {
1771
+ $rotation_class = ' ai-'.$this->number;
1772
+ $rotation_data .= " data-info='".base64_encode ('['.$this->number.','.count ($ads).']')."'";
1773
+ }
1774
+
1775
+ $processed_code = '';
1776
+ if ($times && !isset ($ai_wp_data [AI_CLIENT_SIDE_CSS])) {
1777
+ $processed_code = "\n<style type='text/css'>\n" . ai_get_client_side_styles () . "</style>";
1778
  }
1779
 
1780
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1781
+ $processed_code .= "\n<div class='ai-rotate{$rotation_class}'".$rotation_data.">\n" . $additional_code;
1782
  } else
1783
+ $processed_code .= "\n<div class='ai-rotate{$rotation_class}'".$rotation_data." style='position: relative;'>\n" . $additional_code;
1784
 
1785
  foreach ($ads as $index => $ad) {
1786
 
1787
+ // If AMP separator is present use only code for normal pages
1788
  if (strpos ($ad, AD_AMP_SEPARATOR) !== false) {
1789
  $codes = explode (AD_AMP_SEPARATOR, $ad);
1790
  $ad = trim ($codes [0]);
1792
 
1793
  $version_name_data = " data-name='".base64_encode ($version_names [$index])."'";
1794
 
1795
+ switch ($temp_dynamic_blocks) {
1796
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
1797
+ $version_time_data = $version_times [$index] >= 0 ? " data-time='".base64_encode ($version_times [$index])."'" : '';
1798
+
1799
+ switch ($index) {
1800
+ case 0:
1801
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1802
+ $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden'".$version_name_data.$version_time_data.">\n".trim ($ad, "\n\r")."</div>\n";
1803
+ } else
1804
+ $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.$version_time_data.">\n".trim ($ad, "\n\r")."</div>\n";
1805
+ break;
1806
+ default:
1807
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1808
+ $processed_code .= "<div class='ai-rotate-option ai-rotate-hidden ai-rotate-hidden-2'".$version_name_data.$version_time_data.">\n".trim ($ad, "\n\r")."</div>\n";
1809
+ } else
1810
+ $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.$version_time_data.">\n".trim ($ad, "\n\r")."</div>\n";
1811
+ break;
1812
+ }
1813
  break;
1814
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
1815
+ $version_code_data = " data-code='".base64_encode ($ad)."'";
1816
+ $processed_code .= "<div class='ai-rotate-option'".$version_name_data.$version_code_data.">\n</div>\n";
 
 
1817
  break;
1818
  }
1819
+
1820
  }
1821
  $processed_code .= "</div>\n";
1822
  break;
1823
+
1824
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1825
  if ($shares) {
1826
  $ad_index_code = ' $ai_random_threshold = mt_rand (0, 100); $ai_thresholds = unserialize (\''.
1835
  }
1836
  } else $processed_code = $additional_code . $processed_code;
1837
 
1838
+ $temp_dynamic_blocks = $dynamic_blocks;
1839
+ if ($temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && $this->w3tc_code == '') $temp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1840
+ elseif ($temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW) $temp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1841
+ elseif ($temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) $temp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1842
 
1843
+ switch ($temp_dynamic_blocks) {
 
 
 
 
1844
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1845
  if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
1846
  $codes = explode (AD_AMP_SEPARATOR, $processed_code);
1866
  break;
1867
  }
1868
 
1869
+ $temp_dynamic_blocks = $dynamic_blocks;
1870
+ if (($temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || $temp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) && $ai_wp_data [AI_WP_AMP_PAGE]) $temp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
1871
 
1872
+ if ($temp_dynamic_blocks != AI_DYNAMIC_BLOCKS_SERVER_SIDE) {
1873
  $countries = trim (str_replace (' ', '', strtoupper ($this->get_ad_country_list (true))));
1874
  $country_list_type = $this->get_ad_country_list_type ();
1875
 
1878
 
1879
  if ($countries != '' || $country_list_type == AD_WHITE_LIST || $ip_addresses != '' || $ip_address_list_type == AD_WHITE_LIST) {
1880
  switch ($dynamic_blocks) {
1881
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
1882
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
1883
  if ($country_list_type == AD_BLACK_LIST) $country_list_type = 'B'; else $country_list_type = 'W';
1884
  if ($ip_address_list_type == AD_BLACK_LIST) $ip_address_list_type = 'B'; else $ip_address_list_type = 'W';
1885
 
1888
 
1889
  $this->client_side_ip_address_detection = true;
1890
 
1891
+ switch ($dynamic_blocks) {
1892
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
1893
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1894
+ $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes>$processed_code</div>\n";
1895
+ } else $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
1896
+ break;
1897
+ case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
1898
+ $code_data = "data-code='".base64_encode ($processed_code)."'";
1899
+
1900
+ $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes $code_data></div>\n";
1901
+ break;
1902
+ }
1903
 
1904
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
1905
  $debug_ip = new ai_block_labels ('ai-debug-ip');
1906
  $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;
1907
  }
1908
+
1909
  break;
1910
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1911
  if ($this->w3tc_code == '') $this->w3tc_code = '$ai_code = base64_decode (\''.base64_encode ($processed_code).'\'); $ai_index = 0; $ai_enabled = true;';
2178
  switch ($this->get_automatic_insertion()) {
2179
  case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
2180
  $insertion = 'before';
2181
+ if ($server_side_html_insertion && !$viewports_insertion) return $this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only);
2182
  $html_element_insertion = true;
2183
  break;
2184
  case AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT:
2185
  $insertion = 'after';
2186
+ if ($server_side_html_insertion && !$viewports_insertion) return $this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only);
2187
  $html_element_insertion = true;
2188
  break;
2189
  default:
5264
  'code' => $code,
5265
  'name' => '',
5266
  'share' => '',
5267
+ 'time' => '',
5268
  ),
5269
  ),
5270
  );
5281
  $option_code = trim ($option, "\n");
5282
  $option_name = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name']) ? $ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name'] : '';
5283
  $option_share = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) && is_numeric ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) ? intval ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['share']) : '';
5284
+ $option_time = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['time']) && is_numeric ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['time']) ? intval ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['time']) : '';
5285
  if ($index == 0 && $option_code == '') continue;
5286
+ $data ['options'] []= array ('code' => $option_code, 'name' => $option_name, 'share' => $option_share, 'time' => $option_time);
5287
  }
5288
  }
5289
 
5300
 
5301
  $name = trim ($rotation_data_row ['name']);
5302
  $share = trim ($rotation_data_row ['share']);
5303
+ $time = trim ($rotation_data_row ['time']);
5304
  $code = trim ($rotation_data_row ['code'], "\n");
5305
 
5306
+ if ($index != 0 || $name != '' || $share != '' || $time != '') {
5307
 
5308
  $shortcode = "" ;
5309
  if ($index != 0) $shortcode .= "\n\n";
5312
 
5313
  if ($name != '') $shortcode .= ' name="'.str_replace ('"', '\'', $name).'"';
5314
  if ($share != '') $shortcode .= ' share="'.str_replace ('"', '\'', $share).'"';
5315
+ if ($time != '') $shortcode .= ' time="'.str_replace ('"', '\'', $time).'"';
5316
  $shortcode .= "]\n\n";
5317
  } else $shortcode = '';
5318
 
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.9');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -476,12 +476,15 @@ define('AI_TEXT_DELAY_INSERTION', 'Delay insertion');
476
  define('AI_TEXT_INSERT_BETWEEN_DATES', 'Insert between dates');
477
 
478
  // Dynamic blocks
479
- define('AI_DYNAMIC_BLOCKS_SERVER_SIDE', 0);
480
- define('AI_DYNAMIC_BLOCKS_CLIENT_SIDE', 1);
481
- define('AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC', 2);
 
482
 
483
  define('AI_TEXT_SERVER_SIDE', 'Server-side');
484
  define('AI_TEXT_CLIENT_SIDE', 'Client-side');
 
 
485
  define('AI_TEXT_SERVER_SIDE_W3TC', 'Server-side using W3 Total Cache');
486
 
487
  // Paragraph counting functions
@@ -810,6 +813,8 @@ define ('AI_STICK_TO_THE_CONTENT', 31);
810
  define ('AI_DEBUG_MENU_ITEMS', 32);
811
  define ('AI_ANIMATION', 33);
812
  define ('AI_TRIGGER_ELEMENTS', 34);
 
 
813
 
814
  define ('AI_CONTEXT_NONE', 0);
815
  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.10');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
476
  define('AI_TEXT_INSERT_BETWEEN_DATES', 'Insert between dates');
477
 
478
  // Dynamic blocks
479
+ define('AI_DYNAMIC_BLOCKS_SERVER_SIDE', 0);
480
+ define('AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW', 1);
481
+ define('AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC', 2);
482
+ define('AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT', 3);
483
 
484
  define('AI_TEXT_SERVER_SIDE', 'Server-side');
485
  define('AI_TEXT_CLIENT_SIDE', 'Client-side');
486
+ define('AI_TEXT_CLIENT_SIDE_SHOW', 'Client-side show');
487
+ define('AI_TEXT_CLIENT_SIDE_INSERT', 'Client-side insert');
488
  define('AI_TEXT_SERVER_SIDE_W3TC', 'Server-side using W3 Total Cache');
489
 
490
  // Paragraph counting functions
813
  define ('AI_DEBUG_MENU_ITEMS', 32);
814
  define ('AI_ANIMATION', 33);
815
  define ('AI_TRIGGER_ELEMENTS', 34);
816
+ define ('AI_CLIENT_SIDE_ROTATION', 35);
817
+ define ('AI_CLIENT_SIDE_CSS', 36);
818
 
819
  define ('AI_CONTEXT_NONE', 0);
820
  define ('AI_CONTEXT_CONTENT', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.9"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.3.10"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
css/images/index.html CHANGED
@@ -9,8 +9,8 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
css/index.html CHANGED
@@ -9,8 +9,8 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code Anywhere on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Ad Inserter is also a perfect <a href="https://adinserter.pro/adsense-ads" target="_blank">WordPress AdSense plugin</a> that can insert ads where other plugins fail.
14
  </p>
15
  <div>
16
  <img style="display: block;margin: 0 auto;" src="https://adinserter.pro/images/pages/ad-inserter/ad-inserter-adsense-code-generator.png" />
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code Anywhere on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Ad Inserter is also a perfect <a href="https://adinserter.pro/adsense-ads" target="_blank" rel="nofollow">WordPress AdSense plugin</a> that can insert ads where other plugins fail.
14
  </p>
15
  <div>
16
  <img style="display: block;margin: 0 auto;" src="https://adinserter.pro/images/pages/ad-inserter/ad-inserter-adsense-code-generator.png" />
images/ai-preview-250.png ADDED
Binary file
images/index.html CHANGED
@@ -9,8 +9,8 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
images/manual.png ADDED
Binary file
includes/ace/index.html CHANGED
@@ -9,12 +9,12 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
- <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
includes/index.html CHANGED
@@ -9,12 +9,12 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
- <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
includes/js/ai-insert.js CHANGED
@@ -1,5 +1,6 @@
1
  function ai_insert (insertion, selector, insertion_code) {
2
  jQuery (selector).each (function (index, element) {
 
3
 
4
  if (typeof jQuery(this).attr ('id') != 'undefined') {
5
  selector_string = '#' + jQuery(this).attr ('id');
@@ -16,6 +17,8 @@ function ai_insert (insertion, selector, insertion_code) {
16
  jQuery ('.ai-debug-name.ai-main', ai_code).text (insertion.toUpperCase () + ' ' + jQuery(this).prop ('tagName').toLowerCase() + selector_string);
17
 
18
  jQuery(this)[insertion_function] (ai_code);
 
 
19
  });
20
  }
21
 
1
  function ai_insert (insertion, selector, insertion_code) {
2
  jQuery (selector).each (function (index, element) {
3
+ var ai_debug = typeof ai_debugging !== 'undefined';
4
 
5
  if (typeof jQuery(this).attr ('id') != 'undefined') {
6
  selector_string = '#' + jQuery(this).attr ('id');
17
  jQuery ('.ai-debug-name.ai-main', ai_code).text (insertion.toUpperCase () + ' ' + jQuery(this).prop ('tagName').toLowerCase() + selector_string);
18
 
19
  jQuery(this)[insertion_function] (ai_code);
20
+
21
+ if (ai_debug) console.log ('AI INSERT', insertion, selector);
22
  });
23
  }
24
 
includes/js/ai-insert.min.js CHANGED
@@ -4,8 +4,8 @@
4
  @param {jQuery} {base64Decode:function(input))
5
  @return string
6
  */
7
- function ai_insert(insertion,selector,insertion_code){jQuery(selector).each(function(index,element){if(typeof jQuery(this).attr("id")!="undefined")selector_string="#"+jQuery(this).attr("id");else if(typeof jQuery(this).attr("class")!="undefined")selector_string="."+jQuery(this).attr("class").replace(" ",".");else selector_string="";var insertion_function=insertion;var ai_code=jQuery(insertion_code);jQuery(".ai-selector-counter",ai_code).text(index+1);jQuery(".ai-debug-name.ai-main",ai_code).text(insertion.toUpperCase()+
8
- " "+jQuery(this).prop("tagName").toLowerCase()+selector_string);jQuery(this)[insertion_function](ai_code)})}
9
  function ai_insert_viewport(element){var ai_debug=typeof ai_debugging!=="undefined";if(ai_debug)console.log("AI VIEWPORT INSERTION: class",element.attr("class"));var visible=element.is(":visible");var block=element.data("block");if(visible){var insertion_code=element.data("code");var insertion_type=element.data("insertion");var selector=element.data("selector");if(typeof insertion_code!="undefined")if(typeof insertion_type!="undefined"&&typeof selector!="undefined"){var selector_exists=jQuery(selector).length;
10
  if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block,insertion_type,selector,selector_exists?"":"NOT FOUND");ai_insert(insertion_type,selector,jQuery.base64Decode(insertion_code));if(selector_exists)element.removeClass("ai-viewports")}else{if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block);var ai_code=jQuery(jQuery.base64Decode(insertion_code));element.after(ai_code);element.removeClass("ai-viewports")}}else{if(ai_debug)console.log("AI VIEWPORT NOT VISIBLE: block",block);var debug_bar=
11
  element.prev();if(debug_bar.hasClass("ai-debug-bar")&&debug_bar.hasClass("ai-debug-script")){debug_bar.removeClass("ai-debug-script");debug_bar.addClass("ai-debug-viewport-invisible")}}}(function($){$(document).ready(function(){$(".ai-viewports").each(function(index,element){ai_insert_viewport($(this))})})})(jQuery);(function($){$(document).ready(function(){$(".ai-viewports").each(function(index,element){ai_insert_viewport($(this))})})})(jQuery);
4
  @param {jQuery} {base64Decode:function(input))
5
  @return string
6
  */
7
+ function ai_insert(insertion,selector,insertion_code){jQuery(selector).each(function(index,element){var ai_debug=typeof ai_debugging!=="undefined";if(typeof jQuery(this).attr("id")!="undefined")selector_string="#"+jQuery(this).attr("id");else if(typeof jQuery(this).attr("class")!="undefined")selector_string="."+jQuery(this).attr("class").replace(" ",".");else selector_string="";var insertion_function=insertion;var ai_code=jQuery(insertion_code);jQuery(".ai-selector-counter",ai_code).text(index+1);
8
+ jQuery(".ai-debug-name.ai-main",ai_code).text(insertion.toUpperCase()+" "+jQuery(this).prop("tagName").toLowerCase()+selector_string);jQuery(this)[insertion_function](ai_code);if(ai_debug)console.log("AI INSERT",insertion,selector)})}
9
  function ai_insert_viewport(element){var ai_debug=typeof ai_debugging!=="undefined";if(ai_debug)console.log("AI VIEWPORT INSERTION: class",element.attr("class"));var visible=element.is(":visible");var block=element.data("block");if(visible){var insertion_code=element.data("code");var insertion_type=element.data("insertion");var selector=element.data("selector");if(typeof insertion_code!="undefined")if(typeof insertion_type!="undefined"&&typeof selector!="undefined"){var selector_exists=jQuery(selector).length;
10
  if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block,insertion_type,selector,selector_exists?"":"NOT FOUND");ai_insert(insertion_type,selector,jQuery.base64Decode(insertion_code));if(selector_exists)element.removeClass("ai-viewports")}else{if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block);var ai_code=jQuery(jQuery.base64Decode(insertion_code));element.after(ai_code);element.removeClass("ai-viewports")}}else{if(ai_debug)console.log("AI VIEWPORT NOT VISIBLE: block",block);var debug_bar=
11
  element.prev();if(debug_bar.hasClass("ai-debug-bar")&&debug_bar.hasClass("ai-debug-script")){debug_bar.removeClass("ai-debug-script");debug_bar.addClass("ai-debug-viewport-invisible")}}}(function($){$(document).ready(function(){$(".ai-viewports").each(function(index,element){ai_insert_viewport($(this))})})})(jQuery);(function($){$(document).ready(function(){$(".ai-viewports").each(function(index,element){ai_insert_viewport($(this))})})})(jQuery);
includes/js/ai-jquery.js CHANGED
@@ -0,0 +1 @@
 
1
+ ai_dummy = true;
includes/js/ai-rotate.js CHANGED
@@ -1,29 +1,127 @@
1
  jQuery (function ($) {
2
- $("div.ai-rotate").each (function () {
3
- var rotate_options = $(".ai-rotate-option", this);
4
-
5
- var thresholds_data = $(this).data ('shares');
6
- if (typeof thresholds_data === 'string') {
7
- var thresholds = JSON.parse (atob (thresholds_data));
8
- var random_threshold = Math.round (Math.random () * 100);
9
- for (var index = 0; index < thresholds.length; index ++) {
10
- var random_index = index;
11
- if (random_threshold <= thresholds [index]) break;
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  } else {
14
- var random_index = Math.floor (Math.random () * rotate_options.length);
15
- var d = new Date();
16
- var n = d.getMilliseconds();
17
- if (n % 2) random_index = rotate_options.length - random_index - 1;
18
  }
19
 
20
- rotate_options.hide ();
21
  var option = $(rotate_options [random_index]);
22
- option.css ({"display": "", "visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""}).removeClass ('ai-rotate-option').removeClass ('ai-rotate-options');
23
- $(this).css ({"position": ""}).removeClass ('ai-rotate');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  var option_name = '';
26
- var debug_block_frame = $(this).closest ('.ai-debug-block');
27
  if (typeof debug_block_frame != "undefined") {
28
  var option_name = atob (option.data ('name'));
29
  var name_tag = debug_block_frame.find ('kbd.ai-option-name');
@@ -36,12 +134,12 @@ jQuery (function ($) {
36
  if (typeof name_tag != 'undefined') {
37
  var separator = name_tag.first ().data ('separator');
38
  if (typeof separator == 'undefined') separator = '';
39
- name_tag.html (separator + option_name);
40
  }
41
  }
42
 
43
  var tracking_updated = false;
44
- var adb_show_wrapping_div = $(this).closest ('.ai-adb-show');
45
  if (typeof adb_show_wrapping_div != "undefined") {
46
  if (typeof adb_show_wrapping_div.data ("ai-tracking") != "undefined") {
47
  var data = JSON.parse (atob (adb_show_wrapping_div.data ("ai-tracking")));
@@ -55,9 +153,10 @@ jQuery (function ($) {
55
  }
56
 
57
  if (!tracking_updated) {
58
- var wrapping_div = $(this).closest ('div[data-ai]');
59
  if (typeof wrapping_div.data ("ai") != "undefined") {
60
  var data = JSON.parse (atob (wrapping_div.data ("ai")));
 
61
  if (typeof data !== "undefined" && data.constructor === Array) {
62
  data [1] = random_index + 1;
63
  data [3] = option_name;
@@ -65,6 +164,17 @@ jQuery (function ($) {
65
  }
66
  }
67
  }
 
 
 
 
 
 
 
 
 
 
68
  });
 
69
  });
70
 
1
  jQuery (function ($) {
2
+
3
+ ai_process_rotation = function (rotation_block) {
4
+ var ai_debug = typeof ai_debugging !== 'undefined';
5
+ var rotate_options = $(".ai-rotate-option", rotation_block);
6
+
7
+ if (ai_debug) console.log ('AI ROTATE process rotation:', rotate_options.length, 'options');
8
+
9
+ rotate_options.hide ();
10
+
11
+ // rotate_options.css ({"visibility": "hidden"});
12
+
13
+ // rotate_options.animate ({
14
+ // opacity: 0,
15
+ // }, 500, function() {
16
+ // });
17
+
18
+ if (typeof $(rotation_block).data ('next') == 'undefined') {
19
+ var thresholds_data = $(rotation_block).data ('shares');
20
+ if (typeof thresholds_data === 'string') {
21
+ var thresholds = JSON.parse (atob (thresholds_data));
22
+ var random_threshold = Math.round (Math.random () * 100);
23
+ for (var index = 0; index < thresholds.length; index ++) {
24
+ var random_index = index;
25
+ if (random_threshold <= thresholds [index]) break;
26
+ }
27
+ } else {
28
+ var random_index = Math.floor (Math.random () * rotate_options.length);
29
+ var d = new Date();
30
+ var n = d.getMilliseconds();
31
+ if (n % 2) random_index = rotate_options.length - random_index - 1;
32
+ }
33
  } else {
34
+ var random_index = parseInt ($(rotation_block).attr ('data-next'));
35
+
36
+ if (ai_debug) console.log ('AI TIMED ROTATE next: ', random_index);
 
37
  }
38
 
 
39
  var option = $(rotate_options [random_index]);
40
+ var option_time_text = '';
41
+
42
+ if (typeof option.data ('time') != 'undefined') {
43
+ var rotation_time = atob (option.data ('time'));
44
+
45
+ if (ai_debug) console.log ('AI TIMED ROTATE index:', random_index, 'time:', rotation_time);
46
+
47
+ if (rotation_time == 0 && rotate_options.length > 1) {
48
+ var next_random_index = random_index;
49
+ do {
50
+ next_random_index++;
51
+ if (next_random_index >= rotate_options.length) next_random_index = 0;
52
+
53
+ var next_option = $(rotate_options [next_random_index]);
54
+ if (typeof next_option.data ('time') == 'undefined') {
55
+ random_index = next_random_index;
56
+ option = $(rotate_options [random_index]);
57
+ rotation_time = 0;
58
+
59
+ if (ai_debug) console.log ('AI TIMED ROTATE next option has no time: ', next_random_index);
60
+
61
+ break;
62
+ }
63
+ var next_rotation_time = atob (next_option.data ('time'));
64
+
65
+ if (ai_debug) console.log ('AI TIMED ROTATE check:', next_random_index, 'time:', next_rotation_time);
66
+ } while (next_rotation_time == 0 && next_random_index != random_index);
67
+
68
+ if (rotation_time != 0) {
69
+ random_index = next_random_index;
70
+ option = $(rotate_options [random_index]);
71
+ rotation_time = atob (option.data ('time'));
72
+ }
73
+
74
+ if (ai_debug) console.log ('AI TIMED ROTATE index:', random_index, 'time:', rotation_time);
75
+ }
76
+
77
+ if (rotation_time > 0) {
78
+ var next_random_index = random_index + 1;
79
+ if (next_random_index >= rotate_options.length) next_random_index = 0;
80
+
81
+ if (typeof $(rotation_block).data ('info') != 'undefined') {
82
+ var block_info = JSON.parse (atob ($(rotation_block).data ('info')));
83
+ var rotation_id = block_info [0];
84
+
85
+ $(rotation_block).attr ('data-next', next_random_index);
86
+ setTimeout (function() {ai_process_rotation ($("div.ai-rotate.ai-" + rotation_id));}, rotation_time * 1000);
87
+ option_time_text = ' (' + rotation_time + ' s)';
88
+ }
89
+ }
90
+ } else {
91
+ // Remove unused options
92
+ if (!ai_debug) {
93
+ rotate_options.each (function (index) {
94
+ if (index != random_index) $(this).remove ();
95
+ });
96
+ }
97
+
98
+ if (ai_debug) console.log ('AI ROTATE no time');
99
+ if (ai_debug) console.log ('AI ROTATE index:', random_index);
100
+ }
101
+
102
+
103
+ option.css ({"display": "", "visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""}).removeClass ('ai-rotate-hidden').removeClass ('ai-rotate-hidden-2');
104
+ // option.css ({"visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""}).removeClass ('ai-rotate-hidden').removeClass ('ai-rotate-hidden-2');
105
+ // $(rotation_block).css ({"position": ""}).removeClass ('ai-rotate');
106
+ $(rotation_block).css ({"position": ""});
107
+
108
+ // option.css ({"visibility": "visible"});
109
+
110
+ // option.stop ().animate ({
111
+ // opacity: 1,
112
+ // }, 500, function() {
113
+ // });
114
+
115
+
116
+ if (typeof option.data ('code') != 'undefined') {
117
+ var option_code = atob (option.data ('code'));
118
+ option.append (option_code);
119
+
120
+ if (!ai_debug) option.attr ('data-code', '');
121
+ }
122
 
123
  var option_name = '';
124
+ var debug_block_frame = $(rotation_block).closest ('.ai-debug-block');
125
  if (typeof debug_block_frame != "undefined") {
126
  var option_name = atob (option.data ('name'));
127
  var name_tag = debug_block_frame.find ('kbd.ai-option-name');
134
  if (typeof name_tag != 'undefined') {
135
  var separator = name_tag.first ().data ('separator');
136
  if (typeof separator == 'undefined') separator = '';
137
+ name_tag.html (separator + option_name + option_time_text);
138
  }
139
  }
140
 
141
  var tracking_updated = false;
142
+ var adb_show_wrapping_div = $(rotation_block).closest ('.ai-adb-show');
143
  if (typeof adb_show_wrapping_div != "undefined") {
144
  if (typeof adb_show_wrapping_div.data ("ai-tracking") != "undefined") {
145
  var data = JSON.parse (atob (adb_show_wrapping_div.data ("ai-tracking")));
153
  }
154
 
155
  if (!tracking_updated) {
156
+ var wrapping_div = $(rotation_block).closest ('div[data-ai]');
157
  if (typeof wrapping_div.data ("ai") != "undefined") {
158
  var data = JSON.parse (atob (wrapping_div.data ("ai")));
159
+
160
  if (typeof data !== "undefined" && data.constructor === Array) {
161
  data [1] = random_index + 1;
162
  data [3] = option_name;
164
  }
165
  }
166
  }
167
+ }
168
+
169
+ function ai_process_rotations () {
170
+ $("div.ai-rotate").each (function (index, element) {
171
+ ai_process_rotation (this);
172
+ });
173
+ }
174
+
175
+ $(document).ready(function($) {
176
+ setTimeout (function() {ai_process_rotations ();}, 10);
177
  });
178
+
179
  });
180
 
includes/js/ai-rotate.min.js CHANGED
@@ -1,5 +1,10 @@
1
- jQuery(function($){$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var thresholds_data=$(this).data("shares");if(typeof thresholds_data==="string"){var thresholds=JSON.parse(atob(thresholds_data));var random_threshold=Math.round(Math.random()*100);for(var index=0;index<thresholds.length;index++){var random_index=index;if(random_threshold<=thresholds[index])break}}else{var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();
2
- 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");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=
3
- 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");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");
4
- 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)));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")));
5
- 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($){ai_process_rotation=function(rotation_block){var ai_debug=typeof ai_debugging!=="undefined";var rotate_options=$(".ai-rotate-option",rotation_block);if(ai_debug)console.log("AI ROTATE process rotation:",rotate_options.length,"options");rotate_options.hide();if(typeof $(rotation_block).data("next")=="undefined"){var thresholds_data=$(rotation_block).data("shares");if(typeof thresholds_data==="string"){var thresholds=JSON.parse(atob(thresholds_data));var random_threshold=Math.round(Math.random()*
2
+ 100);for(var index=0;index<thresholds.length;index++){var random_index=index;if(random_threshold<=thresholds[index])break}}else{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}}else{var random_index=parseInt($(rotation_block).attr("data-next"));if(ai_debug)console.log("AI TIMED ROTATE next: ",random_index)}var option=$(rotate_options[random_index]);var option_time_text="";if(typeof option.data("time")!=
3
+ "undefined"){var rotation_time=atob(option.data("time"));if(ai_debug)console.log("AI TIMED ROTATE index:",random_index,"time:",rotation_time);if(rotation_time==0&&rotate_options.length>1){var next_random_index=random_index;do{next_random_index++;if(next_random_index>=rotate_options.length)next_random_index=0;var next_option=$(rotate_options[next_random_index]);if(typeof next_option.data("time")=="undefined"){random_index=next_random_index;option=$(rotate_options[random_index]);rotation_time=0;if(ai_debug)console.log("AI TIMED ROTATE next option has no time: ",
4
+ next_random_index);break}var next_rotation_time=atob(next_option.data("time"));if(ai_debug)console.log("AI TIMED ROTATE check:",next_random_index,"time:",next_rotation_time)}while(next_rotation_time==0&&next_random_index!=random_index);if(rotation_time!=0){random_index=next_random_index;option=$(rotate_options[random_index]);rotation_time=atob(option.data("time"))}if(ai_debug)console.log("AI TIMED ROTATE index:",random_index,"time:",rotation_time)}if(rotation_time>0){var next_random_index=random_index+
5
+ 1;if(next_random_index>=rotate_options.length)next_random_index=0;if(typeof $(rotation_block).data("info")!="undefined"){var block_info=JSON.parse(atob($(rotation_block).data("info")));var rotation_id=block_info[0];$(rotation_block).attr("data-next",next_random_index);setTimeout(function(){ai_process_rotation($("div.ai-rotate.ai-"+rotation_id))},rotation_time*1E3);option_time_text=" ("+rotation_time+" s)"}}}else{if(!ai_debug)rotate_options.each(function(index){if(index!=random_index)$(this).remove()});
6
+ if(ai_debug)console.log("AI ROTATE no time");if(ai_debug)console.log("AI ROTATE index:",random_index)}option.css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""}).removeClass("ai-rotate-hidden").removeClass("ai-rotate-hidden-2");$(rotation_block).css({"position":""});if(typeof option.data("code")!="undefined"){var option_code=atob(option.data("code"));option.append(option_code);if(!ai_debug)option.attr("data-code","")}var option_name="";var debug_block_frame=
7
+ $(rotation_block).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");if(typeof separator==
8
+ "undefined")separator="";name_tag.html(separator+option_name+option_time_text)}}var tracking_updated=false;var adb_show_wrapping_div=$(rotation_block).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)));
9
+ tracking_updated=true}}if(!tracking_updated){var wrapping_div=$(rotation_block).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)))}}}};function ai_process_rotations(){$("div.ai-rotate").each(function(index,element){ai_process_rotation(this)})}$(document).ready(function($){setTimeout(function(){ai_process_rotations()},
10
+ 10)})});
includes/js/index.html CHANGED
@@ -9,12 +9,12 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
- <a href="https://adinserter.pro/alignments-and-styles" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
+ <a href="https://adinserter.pro/alignments-and-styles" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800" alt="Alignments and styles"/></a>
18
  </div>
19
  <p>
20
  Code preview with visual CSS editor - highlighted code
includes/preview.php CHANGED
@@ -2131,6 +2131,7 @@ Single pages (posts and static pages) have also additional setting for individua
2131
  <?php if (function_exists ('ai_load_settings_2')) echo ai_get_js ('ai-close'); ?>
2132
  <?php
2133
  if ($sticky) echo ai_get_js ('ai-sticky');
 
2134
  if ($sticky) echo "setTimeout (function() {AOS.init();}, 200);\n";
2135
  if (defined ('AI_ADSENSE_OVERLAY')) {
2136
  echo ai_get_js ('ai-ads');
2131
  <?php if (function_exists ('ai_load_settings_2')) echo ai_get_js ('ai-close'); ?>
2132
  <?php
2133
  if ($sticky) echo ai_get_js ('ai-sticky');
2134
+ echo ai_get_js ('ai-rotate');
2135
  if ($sticky) echo "setTimeout (function() {AOS.init();}, 200);\n";
2136
  if (defined ('AI_ADSENSE_OVERLAY')) {
2137
  echo ai_get_js ('ai-ads');
index.html CHANGED
@@ -9,12 +9,12 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks? Ad Inserter Pro supports
14
  64 blocks, GEO targeting, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
- <a href="http://adinserter.pro/documentation" target="_blank"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.png" alt="Ad Inserter Documentation" /></a>
18
  </div>
19
  <p>
20
  Settings for one code block. Up to 16 blocks can be configured.
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks? Ad Inserter Pro supports
14
  64 blocks, GEO targeting, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
17
+ <a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.png" alt="Ad Inserter Documentation" /></a>
18
  </div>
19
  <p>
20
  Settings for one code block. Up to 16 blocks can be configured.
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.9";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -2398,6 +2398,9 @@ jQuery(document).ready(function($) {
2398
  add_rotate_options (block, 1);
2399
  option_tabs.tabs ("option", "active", 0);
2400
 
 
 
 
2401
  setTimeout (function() {import_rotation_code (block);}, 5);
2402
  } else {
2403
  // set_editor_text (block, $.base64Decode (rotation_container.data ('code')));
@@ -2583,6 +2586,9 @@ jQuery(document).ready(function($) {
2583
  rotation_container.find ('input.option-share').each (function (index) {
2584
  if (index < options) $(this).val (code_data ['options'][index]['share']);
2585
  });
 
 
 
2586
  }
2587
  }
2588
  }).fail (function (xhr, status, error) {
@@ -2615,7 +2621,7 @@ jQuery(document).ready(function($) {
2615
  rotation_container.find ("div.rounded").each (function (index) {
2616
  var code_data = $('#option-' + block + '-' + (index + 1)).data ('code');
2617
  var code = typeof code_data == 'undefined' ? '' : $.base64Decode (code_data);
2618
- var option_data = {'name': $(this).find ('input.option-name').val (), 'share': $(this).find ('input.option-share').val (), 'code': code};
2619
 
2620
  rotation_data.push (option_data);
2621
  });
@@ -2647,6 +2653,9 @@ jQuery(document).ready(function($) {
2647
  rotation_container.find ("div.rounded").remove ();
2648
  }).always (function() {
2649
  $("#rotation-"+block).next ("label").find ('.checkbox-icon').removeClass("active");
 
 
 
2650
  });
2651
  }
2652
 
1
+ var javascript_version = "2.3.10";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
2398
  add_rotate_options (block, 1);
2399
  option_tabs.tabs ("option", "active", 0);
2400
 
2401
+ $('input[name=ai_save]').css ('color', '#f00');
2402
+ $('.ai-rotation-warning').show ();
2403
+
2404
  setTimeout (function() {import_rotation_code (block);}, 5);
2405
  } else {
2406
  // set_editor_text (block, $.base64Decode (rotation_container.data ('code')));
2586
  rotation_container.find ('input.option-share').each (function (index) {
2587
  if (index < options) $(this).val (code_data ['options'][index]['share']);
2588
  });
2589
+ rotation_container.find ('input.option-time').each (function (index) {
2590
+ if (index < options) $(this).val (code_data ['options'][index]['time']);
2591
+ });
2592
  }
2593
  }
2594
  }).fail (function (xhr, status, error) {
2621
  rotation_container.find ("div.rounded").each (function (index) {
2622
  var code_data = $('#option-' + block + '-' + (index + 1)).data ('code');
2623
  var code = typeof code_data == 'undefined' ? '' : $.base64Decode (code_data);
2624
+ var option_data = {'name': $(this).find ('input.option-name').val (), 'share': $(this).find ('input.option-share').val (), 'time': $(this).find ('input.option-time').val (), 'code': code};
2625
 
2626
  rotation_data.push (option_data);
2627
  });
2653
  rotation_container.find ("div.rounded").remove ();
2654
  }).always (function() {
2655
  $("#rotation-"+block).next ("label").find ('.checkbox-icon').removeClass("active");
2656
+
2657
+ $('input[name=ai_save]').css ('color', '#555');
2658
+ $('.ai-rotation-warning').hide ();
2659
  });
2660
  }
2661
 
js/index.html CHANGED
@@ -9,8 +9,8 @@
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
- <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
- Need a powerful <a href="https://adinserter.pro/" target="_blank">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
9
  <h1 style="text-align: center;">Ad Inserter</h1>
10
  <h2 style="text-align: center;">Insert Any Code on Any WordPress Page</h2>
11
  <p style="text-align: justify;">
12
+ <a href="https://wordpress.org/plugins/ad-inserter/" target="_blank" rel="nofollow">Free Ad Inserter</a> - Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
13
+ Need a powerful <a href="https://adinserter.pro/" target="_blank" rel="nofollow">WordPress ad management plugin</a> and more than 64 code blocks - Ad Inserter Pro supports
14
  64 blocks, impression and click tracking (supports also Javascript ads like AdSense), A/B testing, sticky positions, 6 viewports, import/export of plugin settings and has additional multisite support.
15
  </p>
16
  <div>
readme.txt CHANGED
@@ -6,53 +6,48 @@ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, adv
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
- Stable tag: 2.3.8
10
  License: GPLv3
11
 
12
- Insert and manage ads: Amazon, AdSense ads, banner rotation, sticky widget ads, shortcodes, AMP, PHP, HTML, CSS, form, tracking, footer, header code
13
 
14
  == Description ==
15
 
16
- Ad management plugin with many advanced advertising features. Supports all kinds of WordPress ads including **Google AdSense**, contextual **Amazon Native Shopping Ads, Media.net** and **rotating banners.**
17
 
18
- Ad Inserter is more than just ad manager plugin. It provides many advanced options to insert ads, opt-in forms, Javascript, CSS, HTML, PHP, analytics, tracking or advert code anywhere on the page.
 
 
19
 
20
  **Ad Inserter can insert ads where other plugins fail**.
21
  It's all about the settings.
22
 
23
- **Endorsed by WordPress users**
24
-
25
- Average Rating: 5 out of 5 stars
26
-
27
- > Perfect plugin to insert anything anywhere on your WordPress website
28
-
29
- Check <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">Ad Inserter reviews</a>
30
-
31
- > The Best WordPress Ad Management Plugin?
32
-
33
- Check <a href="https://wpmayor.com/ad-inserter-review-the-best-wordpress-ad-management-plugin/">Ad Inserter review</a> on WP Mayor
34
-
35
- **Endorsed by Google**
36
-
37
- Google lists Ad Inserter plugin as possible solution to place AdSense ad code into your WordPress site.
38
-
39
- > 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.
40
-
41
- Check [How to insert ad code in your WordPress site](https://support.google.com/adsense/answer/7527509). Advanced users can enable [AdSense integration](https://adinserter.pro/adsense-ads#integration): get AdSense ad codes 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.
42
-
43
- **Endorsed by Amazon**
44
-
45
- Amazon suggests to use Ad Inserter to add Native Shopping Ads to Wordpress posts.
46
-
47
- > Native Shopping Ads provide highly relevant and dynamic product recommendations in a stylishly designed and responsive ad unit that can be placed at the end of your content or within your content to create a more compelling visitor experience and shopping opportunity.
48
-
49
- Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>. Ad Inserter supports also advanced contextual ads: check settings for <a href="https://adinserter.pro/settings#amazon">contextual Native Shopping Ads</a> that show items related to the post content (using post tags).
50
-
51
 
52
  **Features**
53
 
54
- * 16 code (ad) blocks
55
- * [AdSense](https://adinserter.pro/adsense-ads) integration
56
  * Syntax highlighting [editor](https://adinserter.pro/code-editing)
57
  * Code preview with visual CSS editor
58
  * Automatically inserts ads on posts and pages
@@ -63,7 +58,7 @@ Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_bl
63
  * Insert ads before or after multiple paragraphs
64
  * Insert ads before or after comments
65
  * Insert ads before or after excerpt
66
- * Insert ads before or after any HTML element on page
67
  * Insert ads above the header (after `<body>` tag)
68
  * Insert ads in the footer (before `</body>` tag)
69
  * Insert ads at relative positions in posts
@@ -71,87 +66,119 @@ Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_bl
71
  * Insert ads between excerpts on blog pages
72
  * Insert ads between comments
73
  * Insert ads at custom hook positions (`do_action ()` WP function)
74
- * Clearance options to avoid insertion near images or headers
75
- * Insertion exceptions for posts and pages
76
  * Insert header (`<head>` section) and footer code
77
  * Insert raw HTTP response header lines
78
- * Insert Google Analytics, Piwik or any other web analytics code
79
  * Insert HTML, CSS, Javascript or PHP code
80
  * Code generator for banners and placeholders
81
- * Visual advert editor
82
  * Manual insertion: widgets, shortcodes, PHP function call
83
  * Sticky (fixed) widgets (sticky sidebar - the sidebar does not move when the page is scrolled)
84
- * Custom block alignments and styles
85
  * Insert ads (different ad code) on AMP pages
86
  * Custom CSS class name for wrapping divs to avoid ad blockers
87
  * Use shortcodes from other plugins
88
  * Use custom fields as defined in posts
89
- * Use post title, tags or categories to create contextual ads
90
  * PHP code processing
91
- * Ad labels
92
  * Ad rotation (server-side and client-side - works with caching)
 
 
93
  * Ad blocking detection - popup message, page redirection
94
  * Desktop/mobile device detection (server-side and client-side - works with caching)
95
  * [Black/White-list](https://adinserter.pro/lists) categories, tags, taxonomies, post IDs, urls, url query parameters, cookies, referers
96
- * Easy copying and pasting code blocks or settings using internal clipboard
97
  * Simple troubleshooting with many debugging functions
98
- * Function to visualize inserted code blocks
99
  * Function to visualize available insertion positions
100
  * Function to visualize HTML tags
101
  * You name it :)
102
 
103
- And Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank">WordPress ad management plugin</a> has even more advanced features:
 
 
104
 
105
- * 64 code (ad) blocks
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  * Geolocation using Webnet77 or <a href="http://www.maxmind.com/" target="_blank">MaxMind</a> databases (works also with caching)
107
  * Black/White-list IP addresses or countries (works also with caching)
108
  * Ad impression and click tracking (works also with `<iframe>` Javascript ads like Google AdSense)
109
- * External tracking via Google Analytics or Piwik
110
- * A/B testing
111
- * Sticky ads with optional close button
112
  * Sticky sidebar ads (stick to the screen or to the content)
113
- * Sticky ad trigger (page scroll in % or px, HTML element visible)
114
- * Sticky ad animations (fade, slide, turn, flip, zoom)
 
115
  * Scheduling with fallback option
116
- * Ad blocking detection - ad replacement, content protection
117
  * Ad blocking statistics
118
  * Multisite options to limit settings on the sites
119
- * Post/page exception management
120
  * More custom viewports for client-side desktop/mobile device detection
121
  * More custom hooks for custom theme insertions
122
  * Export and import of settings
123
  * Support via email
124
 
125
- Run a WordPress related blog? Interested in reviewing Ad Inserter Pro? <a href="https://adinserter.pro/contact" target="_blank">Introduce yourself</a>.
126
 
127
- Ad Inserter Wordpress plugin is an advanced advertising manager - it has many features and options to automate ad insertion and to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any Javascript, HTML, PHP or advert code anywhere on the page. For best ad placement and to use optimal advertising positions please read the user manual to get the most of the plugin.
128
 
129
  * Check <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation pages</a> for detailed description of all the features and some <a href="http://adinserter.pro/settings" target="_blank">common settings</a> for quick start
130
- * Download **PDF user guide** for Ad Inserter: go to <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro plugin</a> page and below you can find button for free download of Ad Inserter User Guide
131
 
132
- **Ad Inserter Ad Manager - One Plugin - Many Functions**
 
 
 
 
 
133
 
134
  Ad Inserter is not just another plugin for WordPress ads. Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
135
 
136
  * for ad management and ad injection
137
- * to insert AdSense or Media.net ads
 
138
  * to insert affiliate ads (CJ Affiliate by Conversant, ClickBank, ShareASale, Rakuten LinkShare, etc.)
139
  * to insert ads between paragraphs
140
  * to insert ads between posts
141
  * to insert ads between comments
142
  * to insert ads on custom posts
143
- * to insert ads on AMP pages
144
  * to insert different ads for mobile devices
145
  * to insert ads at custom action hooks (e.g. using <a href="https://genesistutorials.com/visual-hook-guide/" target="_blank">Genesis Theme Framework Hook Guide</a>)
146
  * to hide ads on specific pages
147
- * for ad rotation
148
  * for PHP code widgets
149
  * for sticky (fixed) widgets
150
  * for widget logic
151
  * to restrict widgets
152
  * to detect ad blocking
 
153
  * to insert PHP or HTML code into posts
154
- * to insert header, footer or tracking code
155
  * to insert PHP, HTML, CSS, shortcodes
156
  * to insert Google analytics code
157
  * to insert various opt-in forms (MailChimp, AWeber, GetResponse, etc.)
@@ -162,21 +189,22 @@ Maintaining several plugins (often from different vendors) is not easy. And each
162
 
163
  **Quick Start**
164
 
165
- 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>:
166
 
167
- * [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
 
168
  * To rename block click on the name
169
- * If you are using AdSense check available tools and code generator for [AdSense code](https://adinserter.pro/adsense-ads)
170
- * 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
171
  * **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)
172
  * **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)
173
  * For Posts and Static pages **leave default BLANK selection value** after the checkbox unless you really know what are you doing (using individual exceptions)
174
- * If you don't see inserted code block, turn on **debugging functions**: Label inserted blocks, Show available positions for automatic insertion (Ad Inserter menu item in the Wordpress toolbar on the top of every post/page)
175
- * If you are using <a href="https://adinserter.pro/adsense-ads" target="_blank">AdSense</a> you may get blank (empty) ad blocks. This might be because there is some error in the code (wrong IDs), your Google AdSense account is not fully approved yet, your website was not accepted or your Google AdSense account is banned. In such case you can try other ad networks for contextual ads. Check <a href="https://adinserter.pro/documentation#ads-not-displayed">Ads Not Displayed</a> for more information.
176
 
177
  Few typical settings are described on the <a href="https://adinserter.pro/settings" target="_blank">Common Settings</a> page. Please make sure you have also read <a href="https://wordpress.org/plugins/ad-inserter/installation/">Installation</a> page. For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
178
 
179
- **Insert Any Code Anywhere on the Page**
180
 
181
  * Automatic insertion using standard WP hooks (the_content, the_excerpt, loop_start, loop_end, the_post,...)
182
  * Automatic insertion using custom WP hooks provided by themes (e.g. using <a href="https://genesistutorials.com/visual-hook-guide/" target="_blank">Genesis Theme Framework Hooks</a>)
@@ -185,9 +213,12 @@ Few typical settings are described on the <a href="https://adinserter.pro/settin
185
  * Insertion with widgets
186
  * Insertion by placing PHP function calls or custom hooks in your theme files
187
 
188
- Ad Inserter is the only WordPress plugin that can insert any code anywhere on the page. If standard insertions before/after post, content or paragraph fail you can use advanced insertion before/after arbitrary HTML element.
189
- If you can create a CSS slector for it (#id, .class) then you can insert before or after that element. By default this approach uses client-side insertion using Javascript to insert code block after the page loads.
190
- However, if you enable Output buffering (tab * / tab General) you can select also Server-side insertion which will insert code block the same way as other insertions when the plugin is called and the page is created.
 
 
 
191
  Please note that **Output buffering** may not work with all themes - in such case you can still use client-side insertion.
192
 
193
  **Please support plugin development**
@@ -199,8 +230,8 @@ Positive reviews are a great way to show your appreciation for my work. Besides
199
  Support the advancement of this plugin:
200
 
201
  * Write a short <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
202
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
203
- * Buy license for Ad Inserter Pro - all-in-one <a href="http://adinserter.pro/" target="_blank">Wordpress plugin for ads</a>
204
 
205
  == Installation ==
206
 
@@ -236,8 +267,8 @@ activate it and then click "Enter License Key" and enter license key you got in
236
 
237
  If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
238
 
239
- 1. Go to Ad Inserter general settings (tab *) and click on Reset All Settings
240
- 1. Go to Ad Inserter general settings (tab *) and click on Clear All Statistics Data (Pro only)
241
  2. Deactivate Ad Inserter
242
  3. Delete Ad Inserter plugin
243
 
@@ -249,7 +280,7 @@ Of course, if you configure code block with some javacript ad code, then this co
249
  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!**
250
  [https://adinserter.pro/adsense-ads#auto-ads](https://adinserter.pro/adsense-ads#auto-ads)
251
 
252
- The easiest way to check Ad Inserter code blocks is to use **Label blocks** debugging function:
253
  [https://adinserter.pro/documentation#debugging](https://adinserter.pro/documentation#debugging)
254
 
255
  When you deactivate Ad Inserter it can't insert anything - WordPress doesn't call it. If you still see some ads that were inserted by Ad Inserter, make sure you have cleared all the caches.
@@ -271,19 +302,6 @@ If you still see those ads after you have disabled Ad Inserter and cleared all t
271
  * [Ads not displayed](https://adinserter.pro/documentation#ads-not-displayed)
272
 
273
 
274
- **Please support plugin development**
275
-
276
- If you are using Ad Inserter and you like it, then please write about it and spread the word on the <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review page</a>.
277
-
278
- Positive reviews are a great way to show your appreciation for my work. Besides being an incredible boost to my morale, they are also a great incentive to fix any bug found in the software and to add new features for better monetization of your website.
279
-
280
- Support the advancement of this plugin:
281
-
282
- * Write a short <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
283
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
284
- * Buy license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
285
-
286
-
287
  == Frequently Asked Questions ==
288
 
289
  = I have activated Ad Inserter. How can I use it? =
@@ -322,7 +340,7 @@ Auto ads may not be suitable for some WordPress themes or layouts. In such cases
322
 
323
  = I have installed code for AdSense ads but the ad blocks are blank. =
324
 
325
- Blank AdSense ad block means that the code is inserted properly only the ad code doesn't display anything. Typical reasons for this are the following:
326
 
327
  * After the ad code is inserted Google needs some time (hours) to check the pages before it starts to serve ads.
328
  * AdSense account is not fully approved yet - if your account is new you need to wait until Google checks ad codes on your website and and confirms your account. Usually this takes few days.
@@ -341,11 +359,11 @@ See [AdSense ads not displayed](https://adinserter.pro/adsense-ads#ads-not-displ
341
  * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
342
  * Optionally you can enable Sticky widget - this means that this widget (and widgets below) will stay fixed in the sidebar when the page is scrolled - Sticky Sidebar
343
  * You can also make other widgets sticky even if you don't use Ad Inserter widgets - drag Ad Inserter widget to the sidebar ABOVE the top widget that needs to be sticky, select Dummy Widget for Block, check Sticky and save widget
344
- * In general plugin settings (tab *) you can also define Sticky Widget Top Margin to precisely define top position where the first sticky widget will stick
345
 
346
  Additional note regarding *Sticky Widgets* - *Sticky Sidebars*:
347
 
348
- There are two modes for sticky widgets (or sticky sidebars) available as **Sticky widget mode** in general plugin settings (tab *):
349
 
350
  * CSS mode - This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to `position: sticky`. This works with most themes but not all. If your widgets and sidebar aren't sticking as expected you can use **JavaScript mode** described below.
351
  * JavaScript mode - This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized.
@@ -413,14 +431,14 @@ Use block 3 to insert ads and make sure all 3 blocks are enabled for the same pa
413
 
414
  This happens because Ad Inserter processes posts last and therefore "sees" also content added by other plugins.
415
 
416
- Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab * / tab General).
417
 
418
 
419
  = How can I add some title or label (e.g. Advertisements) above the ad? =
420
 
421
  If this is a sidebar widget then you can simply name the widget.
422
 
423
- For each code block you can also show a label above each ad. Default text (or HTML code) for ad labels can be set on the general plugin settings tab (tab * / tab General / **Ad label**.
424
  To enable ad label above the ad go to code block for this ad, click on the Misc button and then on the Display tab check **Ad label**.
425
 
426
  If you configured only text for ad label then the following code will be added above ad code: `<div class="code-block-label">AD_LABEL_TEXT</div>` (`code-block` is the block class name used, AD_LABEL_TEXT is the text for Ad Label).
@@ -433,13 +451,6 @@ In case you need a different label for some ad you can simply add label HTML cod
433
  AD_CODE`
434
 
435
 
436
- = I like the plugin. How can I support it? =
437
-
438
- * Write a short <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
439
- * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a>
440
- * Buy the license for <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>
441
-
442
-
443
  = How can I enable/disable ads on specific posts/pages? =
444
 
445
  There are two possible approaches.
@@ -472,11 +483,6 @@ For details check <a href="https://adinserter.pro/exceptions" target="_blank">In
472
  Select device types (desktop, tablet or phone) for which you need to show ads and enable **only client-side** device detection.
473
 
474
 
475
- = Which device type detection should I use? =
476
-
477
- In most cases you should use ONLY client-side detection. All code blocks are generated, however, they are displayed according to settings and browser's screen width using CSS Media Queries. This works perfectly in responsive designs.
478
-
479
-
480
  = How can I enable or disable ads on group of similar pages? =
481
 
482
  If those pages have something in common in the url (page address) then you can block them with url patterns.
@@ -489,17 +495,17 @@ Use `*` to define url pattern to whitelist (enable) or blacklist (disable).
489
  For example, to exclude ads on pages that have /shop/ in url (page address) blacklist the following url: `*/shop/*`
490
 
491
 
492
- = How can I put an ad in the middle of the post regardless of the number of paragraphs? =
493
 
494
  Use Before paragraph automatic insertion and put 0.5 as paragraph number. Value between 0 and 1 means relative position in post or page (e.g. 0.3 means paragraph 30% from top or bottom)
495
 
496
 
497
- = How can I put an ad before the second paragraph and one in the middle of post with single ad block? =
498
 
499
  Use Before paragraph automatic insertion and put `2, 0.5` as paragraph number. You can specify multiple paragraphs as comma separated paragraph numbers (or relative postions).
500
 
501
 
502
- = I'd like to rotate my ad codes based on percentage, for example show one ad 75% of the time and another one 25% of the time. Is that possible? =
503
 
504
  Yes. Either use rotation code generator and define shares in percents or create code using `ROTATE` separator with attribute *share* where you define percentage of the rotation share:
505
 
@@ -533,31 +539,6 @@ Some HTML/Javascript code
533
  <?php echo "PHP code by Ad Inserter"; ?>`
534
 
535
 
536
- = How can I insert post category name into my ad code? =
537
-
538
- 1. Use `[adinserter data='category']` in the ad. This will be replaced with the post category name.
539
- 2. You can also use
540
-
541
- * `[adinserter data='title']` - Title of the post
542
- * `[adinserter data='short-title']` - Short title (first 3 words) of the post title
543
- * `[adinserter data='category']` - Category of the post (or short title if there is no category)
544
- * `[adinserter data='short-category']` - First words before "," or "and" of the category of the post (or short title if there is no category)
545
- * `[adinserter data='tag']` - The first tag or general tag (button Misc / tab General) if the post has no tags (**works only inside posts**)
546
- * `[adinserter data='smart-tag']` - Smart selection of post tag in the following order:
547
- * If there is no tag then the category is used;
548
- * If there is a two-word tag then it is used;
549
- * If the first tag is a substring of the second (or vice versa) then the first tag is not taken into account
550
- * If the first and second tags are single words then both words are used
551
- * First three words of the first tag
552
- * General tag (button Misc / tab General)
553
- * `[adinserter data='search-query']` - Search engine query that brought visitor to your website (supports Google, Yahoo, Bing and Ask search engines), [adinserter data='smart_tag} is used when there is no search query. You need to disable caching to use this tag. Please note that most search queries are now encrypted.
554
- * `[adinserter data='author']` - Post author username (**works only inside posts**)
555
- * `[adinserter data='author-name']` Post author name (**works only inside posts**)
556
- * `[adinserter custom-field='CUSTOM_FIELD_NAME']` - Custom fields as <a href="https://codex.wordpress.org/Custom_Fields">defined in posts</a>
557
-
558
- For all options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
559
-
560
-
561
  = How can I rotate few versions of the same ad? =
562
 
563
  Enter them into the ad box and separate them with `[ADINSERTER ROTATE]`. Ad Inserter will insert them randomly.
@@ -597,7 +578,7 @@ Configure ad block with the following options:
597
  Check source code of your website for proper "read more" tag.
598
 
599
 
600
- = How can I insert code block directly into template php file? =
601
 
602
  Enable PHP function adinserter for code block and call adinserter function with code block number as parameter.
603
  Example for block 3:
@@ -634,7 +615,7 @@ AD CODE RIGHT
634
  1. Settings for one code block (Before content). Up to 16 blocks can be configured (up to 64 in <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>)
635
  2. Code preview with visual CSS editor
636
  3. Code preview with visual CSS editor - highlighted code
637
- 4. Post / Page Ad Inserter Exceptions
638
  5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
639
  6. Ad Inserter plugin settings
640
  7. Visualization of HTML tags in post
@@ -652,6 +633,12 @@ AD CODE RIGHT
652
 
653
  == Changelog ==
654
 
 
 
 
 
 
 
655
  = 2.3.9 =
656
  - Added option to easily disable insertion of individual code block
657
  - Changes for compatibility with PHP 7.2
@@ -710,40 +697,6 @@ AD CODE RIGHT
710
  - Fix for errors when importing code
711
  - Few minor bug fixes, cosmetic changes and code improvements
712
 
713
- = 2.2.16 =
714
- - Fix for error when saving settings on multisite installation
715
-
716
- = 2.2.15 =
717
- - Fix for responsive AMP ads using center alignment
718
-
719
- = 2.2.14 =
720
- - Added code generator for placeholders
721
- - Added option to disable caching (works with WP Super Cache, W3 Total Cache and WP Rocket)
722
- - Added options to configure classes for wrapping div
723
- - Added support for external tracking via Google Analytics and Piwik (Pro only)
724
- - Added support for MaxMind geolocation databases (Pro only)
725
- - Added option for close button on sticky ads (Pro only)
726
- - Fix for no paragraph counting inside nested elements
727
- - Few minor bug fixes, cosmetic changes and code improvements
728
-
729
- = 2.2.13 =
730
- - Added option to disable inline alignment styles for code blocks (using alignment classes)
731
- - Fix for custom CSS codes with single quotation marks
732
-
733
- = 2.2.12 =
734
- - Fix for code block styles when block class name was not set
735
-
736
- = 2.2.11 =
737
- - Code block styles moved to classes
738
- - Code block list moved to the sidebar
739
- - Added preview buttons in code block list
740
- - Fix for ad blocking detection when using https (Pro only)
741
- - Few minor bug fixes, cosmetic changes and code improvements
742
-
743
- = 2.2.10 =
744
- - Fix for rotation editor code import/export
745
- - Fix for errors when using old |rotate| separator
746
- - Few minor bug fixes, cosmetic changes and code improvements
747
 
748
  = Earlier versions =
749
 
@@ -751,6 +704,12 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
751
 
752
  == Upgrade Notice ==
753
 
 
 
 
 
 
 
754
  = 2.3.9 =
755
  Added option to easily disable insertion of individual code block;
756
  Changes for compatibility with PHP 7.2;
@@ -809,36 +768,3 @@ Fix for errors when rearranging blocks;
809
  Fix for errors when importing code;
810
  Few minor bug fixes, cosmetic changes and code improvements;
811
 
812
- = 2.2.16 =
813
- Fix for error when saving settings on multisite installation
814
-
815
- = 2.2.15 =
816
- Fix for responsive AMP ads using center alignment
817
-
818
- = 2.2.14 =
819
- Added code generator for placeholders;
820
- Added option to disable caching (works with WP Super Cache, W3 Total Cache and WP Rocket);
821
- Added options to configure classes for wrapping div;
822
- Added support for external tracking via Google Analytics and Piwik (Pro only);
823
- Added support for MaxMind geolocation databases (Pro only);
824
- Added option for close button on sticky ads (Pro only);
825
- Fix for no paragraph counting inside nested elements;
826
- Few minor bug fixes, cosmetic changes and code improvements
827
-
828
- = 2.2.13 =
829
- Added option to disable inline alignment styles for code blocks (using alignment classes);
830
- Fix for custom CSS codes with single quotation marks
831
-
832
- = 2.2.12 =
833
- Fix for code block styles when block class name was not set
834
-
835
- = 2.2.11 =
836
- Code block styles moved to classes;
837
- Code block list moved to the sidebar;
838
- Added preview buttons in code block list;
839
- Fix for ad blocking detection when using https (Pro only)
840
-
841
- = 2.2.10 =
842
- Fix for rotation editor code import/export;
843
- Fix for errors when using old |rotate| separator
844
-
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
+ Stable tag: 2.3.9
10
  License: GPLv3
11
 
12
+ Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
13
 
14
  == Description ==
15
 
16
+ Ad management plugin with many advanced advertising features to insert ads at optimal positions.
17
 
18
+ Supports all kinds of ads including **Google AdSense ads**, contextual **Amazon Native Shopping Ads**, **Media.net ads** and **rotating banner ads.**
19
+
20
+ Ad Inserter is more than just ad manager plugin for ads. It provides many advanced options to insert opt-in forms, header scripts, AMP ads, Javascript, CSS, HTML, PHP, analytics, tracking or advert code anywhere on the page.
21
 
22
  **Ad Inserter can insert ads where other plugins fail**.
23
  It's all about the settings.
24
 
25
+ Average Rating: 5 out of 5 stars - check <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">Ad Inserter reviews</a>
26
+
27
+ > One of the best adsense plugins [...](https://wordpress.org/support/topic/one-of-the-best-adsense-plugins/)
28
+ > Most comprehensive Ad plugin available [...](https://wordpress.org/support/topic/most-comprehensive-ad-plugin-available/)
29
+ > Better than the old Google adsense plugin [...](https://wordpress.org/support/topic/better-than-the-old-google-adsense-plugin/)
30
+ > The best WP Ad management plugin [...](https://wordpress.org/support/topic/the-best-wp-ad-management-plugin/)
31
+ > Very flexible and excellent documentation [...](https://wordpress.org/support/topic/very-flexible-and-excellent-documentation/)
32
+ > Excellent Ad Plugin [...](https://wordpress.org/support/topic/excellent-ad-plugin-2/)
33
+ > Easy to use and also does more than I need [...](https://wordpress.org/support/topic/easy-to-use-and-also-does-more-than-i-need/)
34
+ > Exactly what I needed to sell advertising spots [...](https://wordpress.org/support/topic/exactly-what-i-needed-to-sell-advertising-spots-on-our-site/)
35
+ > Awesome Plugin and Super Support! [...](https://wordpress.org/support/topic/awesome-plugin-and-super-support/)
36
+ > Lots of options and easy to use [...](https://wordpress.org/support/topic/lots-of-options-and-easy-to-use/)
37
+ > Crazy flexible [...](https://wordpress.org/support/topic/crazy-flexible/)
38
+ > Great plugin that makes it simple [...](https://wordpress.org/support/topic/great-plugin-that-makes-it-simple/)
39
+ > Superb Plugin and Support team also so good [...](https://wordpress.org/support/topic/superb-plugin-and-support-team-also-so-good/)
40
+ > Best in same kind of plugins [...](https://wordpress.org/support/topic/best-in-same-kind-of-plugins/)
41
+ > Must Have Plugin for Each WP Site [...](https://wordpress.org/support/topic/must-have-plugin-for-each-wp-site/)
42
+ > Best Ad Placement Plugin [...](https://wordpress.org/support/topic/best-ad-placement-plugin/)
43
+ > Best Solution for Advertisement Management [...](https://wordpress.org/support/topic/best-solution-for-advertisement-management/)
44
+ > Comprehensive, flexible and well supported [...](https://wordpress.org/support/topic/comprehensive-flexible-and-well-supported/)
45
+ > God bless these guys! [...](https://wordpress.org/support/topic/god-bless-these-guys-2/)
46
+ > PRO for Free [...](https://wordpress.org/support/topic/pro-for-free/)
 
 
 
 
 
 
47
 
48
  **Features**
49
 
50
+ * [AdSense integration](https://adinserter.pro/adsense-ads) - get ads form your AdSense account
 
51
  * Syntax highlighting [editor](https://adinserter.pro/code-editing)
52
  * Code preview with visual CSS editor
53
  * Automatically inserts ads on posts and pages
58
  * Insert ads before or after multiple paragraphs
59
  * Insert ads before or after comments
60
  * Insert ads before or after excerpt
61
+ * Insert ads near any element on the page (using CSS selectors)
62
  * Insert ads above the header (after `<body>` tag)
63
  * Insert ads in the footer (before `</body>` tag)
64
  * Insert ads at relative positions in posts
66
  * Insert ads between excerpts on blog pages
67
  * Insert ads between comments
68
  * Insert ads at custom hook positions (`do_action ()` WP function)
69
+ * Avoid inserting ads near images or headers (AdSense TOS)
70
+ * Disable ads on individual posts or pages
71
  * Insert header (`<head>` section) and footer code
72
  * Insert raw HTTP response header lines
73
+ * Insert Google Analytics, Matomo (Piwik) or any other tracking code
74
  * Insert HTML, CSS, Javascript or PHP code
75
  * Code generator for banners and placeholders
76
+ * Visual advert editor - create ads from scratch
77
  * Manual insertion: widgets, shortcodes, PHP function call
78
  * Sticky (fixed) widgets (sticky sidebar - the sidebar does not move when the page is scrolled)
79
+ * Custom alignments and styles for ads
80
  * Insert ads (different ad code) on AMP pages
81
  * Custom CSS class name for wrapping divs to avoid ad blockers
82
  * Use shortcodes from other plugins
83
  * Use custom fields as defined in posts
84
+ * Use post title, tags or category names to create contextual ads
85
  * PHP code processing
86
+ * Ad labels - show customized label above ads
87
  * Ad rotation (server-side and client-side - works with caching)
88
+ * Timed ad rotation - define times to rotate ads in a single ad block
89
+ * Create rich media ads with standard WordPress TinyMCE editor
90
  * Ad blocking detection - popup message, page redirection
91
  * Desktop/mobile device detection (server-side and client-side - works with caching)
92
  * [Black/White-list](https://adinserter.pro/lists) categories, tags, taxonomies, post IDs, urls, url query parameters, cookies, referers
93
+ * Easy copying and pasting ads or settings using internal clipboard
94
  * Simple troubleshooting with many debugging functions
95
+ * Function to visualize inserted code blocks and ads
96
  * Function to visualize available insertion positions
97
  * Function to visualize HTML tags
98
  * You name it :)
99
 
100
+ [Ad Inserter review](https://wpmayor.com/ad-inserter-review-the-best-wordpress-ad-management-plugin/) on WP Mayor
101
+
102
+ > The Best WordPress Ad Management Plugin?
103
 
104
+ **Endorsed by Google**
105
+
106
+ Google lists Ad Inserter plugin as possible solution to place code for AdSense ads into your WordPress site.
107
+
108
+ Ad Inserter is a perfect plugin to place code for Google AdSense ads at top positions for optimal monetization of your website: ordinary AdSense ads (ad units), AMP ads, Auto ads (page level ads), In-feed ads, in-article ads, responsive ads, AdSense ads that need page-specific header code, etc.
109
+
110
+ > 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.
111
+
112
+ Check [How to insert ad code in your WordPress site](https://support.google.com/adsense/answer/7527509). Advanced users can enable [AdSense integration](https://adinserter.pro/adsense-ads#integration): import AdSense ads from the plugin settings page - no need to copy codes for AdSense ads from the AdSense admin pages. List ad units, preview AdSense ads and get ad codes where you need them.
113
+
114
+ **Endorsed by Amazon**
115
+
116
+ Amazon suggests to use Ad Inserter to add Native Shopping Ads to Wordpress posts.
117
+
118
+ > Native Shopping Ads provide highly relevant and dynamic product recommendations in a stylishly designed and responsive ad unit that can be placed at the end of your content or within your content to create a more compelling visitor experience and shopping opportunity.
119
+
120
+ Check <a href="https://affiliate-program.amazon.com/help/topic/t405" target="_blank">Wordpress Integration Guide for Native Shopping Ads</a>. Ad Inserter supports also advanced contextual ads: check settings for <a href="https://adinserter.pro/settings#amazon">contextual Native Shopping Ads</a> that show ads with items related to the post content (using post tags).
121
+
122
+ And if you need more ads with page/category specific settings, ad statistics for impressions and clicks, A/B testing, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, functions to protect content from users using ad blockers, functions to serve different ads for users using ad blockers, multisite options to limit settings for ads, to block some IP addresses, to schedule ads, there is **Ad Inserter Pro** - all-in-one <a href="http://adinserter.pro/" target="_blank">WordPress ad management plugin</a> that has many advanced features:
123
+
124
+ * 64 code (ad) blocks (64 different insertion configurations for ads)
125
  * Geolocation using Webnet77 or <a href="http://www.maxmind.com/" target="_blank">MaxMind</a> databases (works also with caching)
126
  * Black/White-list IP addresses or countries (works also with caching)
127
  * Ad impression and click tracking (works also with `<iframe>` Javascript ads like Google AdSense)
128
+ * External tracking via Google Analytics or Matomo (Piwik)
129
+ * A/B testing - discover ads and settings that perform best
130
+ * [Sticky ads](https://adinserter.pro/alignments-and-styles#sticky-ads) with optional close button
131
  * Sticky sidebar ads (stick to the screen or to the content)
132
+ * Floating slide-in banner ads
133
+ * [Sticky (floating) ads](https://adinserter.pro/alignments-and-styles#sticky-ads) with animations (fade, slide, turn, flip, zoom)
134
+ * Animation trigger for sticky ads (page scroll in % or px, HTML element becomes visible)
135
  * Scheduling with fallback option
136
+ * Ad blocking detection - replace ads, protect content
137
  * Ad blocking statistics
138
  * Multisite options to limit settings on the sites
139
+ * Individual post/page exception management
140
  * More custom viewports for client-side desktop/mobile device detection
141
  * More custom hooks for custom theme insertions
142
  * Export and import of settings
143
  * Support via email
144
 
145
+ Run a WordPress related blog? Have experience with AdSense ads? Interested in reviewing Ad Inserter Pro? <a href="https://adinserter.pro/contact" target="_blank">Introduce yourself</a>.
146
 
147
+ Ad Inserter Wordpress plugin is an advanced advertising manager for all kind of ads - it has many features and options to automate placing ads in order to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any kind of ads, Javascript, HTML, PHP or advert code anywhere on the page. For best placement of ads please read the user manual to get the most of the plugin.
148
 
149
  * Check <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation pages</a> for detailed description of all the features and some <a href="http://adinserter.pro/settings" target="_blank">common settings</a> for quick start
150
+ * Download [Ad Inserter user manual](http://adinserter.pro/Ad_Inserter_User_Manual.pdf)
151
 
152
+ You can also use shortcodes from other plugins (for example, to insert ads from other ad plugins like AdRotate, Advanced Ads, Quick Adsense, AdSense Plugin WP QUADS, Insert Post Ads).
153
+
154
+ **Ad Inserter can insert ads where other plugins fail**.
155
+ It's all about the settings.
156
+
157
+ **Ad Inserter Ad Manager - One Plugin - Many Functions - All Ads**
158
 
159
  Ad Inserter is not just another plugin for WordPress ads. Do you enjoy finding the right plugin to solve a particular problem on your site? For example:
160
 
161
  * for ad management and ad injection
162
+ * to insert Google AdSense ads or Media.net ads
163
+ * to insert Amazon Native Shopping ads
164
  * to insert affiliate ads (CJ Affiliate by Conversant, ClickBank, ShareASale, Rakuten LinkShare, etc.)
165
  * to insert ads between paragraphs
166
  * to insert ads between posts
167
  * to insert ads between comments
168
  * to insert ads on custom posts
169
+ * to insert AMP ads on AMP pages
170
  * to insert different ads for mobile devices
171
  * to insert ads at custom action hooks (e.g. using <a href="https://genesistutorials.com/visual-hook-guide/" target="_blank">Genesis Theme Framework Hook Guide</a>)
172
  * to hide ads on specific pages
173
+ * for ad rotation - to rotate different ads in a single ad position
174
  * for PHP code widgets
175
  * for sticky (fixed) widgets
176
  * for widget logic
177
  * to restrict widgets
178
  * to detect ad blocking
179
+ * to insert banner ads
180
  * to insert PHP or HTML code into posts
181
+ * to insert tracking, footer or header code
182
  * to insert PHP, HTML, CSS, shortcodes
183
  * to insert Google analytics code
184
  * to insert various opt-in forms (MailChimp, AWeber, GetResponse, etc.)
189
 
190
  **Quick Start**
191
 
192
+ Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ads</a>:
193
 
194
+ * Completely **disable AdBlocker!** You don't need it when working with ads! Ad blockers prevent displaying ads and also block all AdSense pages!
195
+ * [Code block](https://adinserter.pro/code-editing) is any code (for example for Google AdSense ads) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code (or ads) at almost any position supported by Wordpress
196
  * To rename block click on the name
197
+ * If you are using AdSense ads check available tools and code generator for [AdSense ads](https://adinserter.pro/adsense-ads)
198
+ * 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 ads or any other HTML advert
199
  * **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)
200
  * **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)
201
  * For Posts and Static pages **leave default BLANK selection value** after the checkbox unless you really know what are you doing (using individual exceptions)
202
+ * If you don't see inserted code block or ads, turn on **debugging functions**: Label inserted blocks, Show available positions for automatic insertion (Ad Inserter menu item in the Wordpress toolbar on the top of every post/page)
203
+ * If you are using <a href="https://adinserter.pro/adsense-ads" target="_blank">AdSense ads</a> you may get blank (empty) ad blocks - no ads are displayed. This might be because there is some error in the code (wrong IDs), your Google AdSense account is not fully approved yet, your website was not accepted or your Google AdSense account is banned. In such case you can try other ad networks for contextual ads. Check <a href="https://adinserter.pro/documentation#ads-not-displayed">Ads Not Displayed</a> for more information.
204
 
205
  Few typical settings are described on the <a href="https://adinserter.pro/settings" target="_blank">Common Settings</a> page. Please make sure you have also read <a href="https://wordpress.org/plugins/ad-inserter/installation/">Installation</a> page. For more detailed instructions please read <a href="http://adinserter.pro/documentation" target="_blank">Ad Inserter documentation page</a>.
206
 
207
+ **Insert Any Code Anywhere on the Page - Automate Insertion of Ads**
208
 
209
  * Automatic insertion using standard WP hooks (the_content, the_excerpt, loop_start, loop_end, the_post,...)
210
  * Automatic insertion using custom WP hooks provided by themes (e.g. using <a href="https://genesistutorials.com/visual-hook-guide/" target="_blank">Genesis Theme Framework Hooks</a>)
213
  * Insertion with widgets
214
  * Insertion by placing PHP function calls or custom hooks in your theme files
215
 
216
+ Ad Inserter is **the only WordPress plugin that can insert any code or ads anywhere on the page**. If standard insertions before/after post, content or paragraph can't be used, you can use advanced insertion [before/after arbitrary HTML element](https://adinserter.pro/documentation#insertion-before-after-html-element).
217
+
218
+ If you can create a CSS slector for the page element (#id, .class) then you can insert ads before or after that element. By default this approach uses client-side insertion using Javascript to insert code block after the page loads.
219
+
220
+ However, if you enable Output buffering (tab &#9881; / tab General) you can select also Server-side insertion which will insert code block the same way as other insertions when the plugin is called and the page is created.
221
+
222
  Please note that **Output buffering** may not work with all themes - in such case you can still use client-side insertion.
223
 
224
  **Please support plugin development**
230
  Support the advancement of this plugin:
231
 
232
  * Write a short <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/">review</a>
233
+ * <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4">Donate</a> if Ad Inserter helps you to make money with ads
234
+ * Buy license for [Ad Inserter Pro](http://adinserter.pro/) - Top WordPress plugin for ads
235
 
236
  == Installation ==
237
 
267
 
268
  If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
269
 
270
+ 1. Go to Ad Inserter general settings (tab &#9881;) and click on Reset All Settings
271
+ 1. Go to Ad Inserter general settings (tab &#9881;) and click on Clear All Statistics Data (Pro only)
272
  2. Deactivate Ad Inserter
273
  3. Delete Ad Inserter plugin
274
 
280
  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!**
281
  [https://adinserter.pro/adsense-ads#auto-ads](https://adinserter.pro/adsense-ads#auto-ads)
282
 
283
+ The easiest way to check Ad Inserter code blocks or ads is to use **Label blocks** debugging function:
284
  [https://adinserter.pro/documentation#debugging](https://adinserter.pro/documentation#debugging)
285
 
286
  When you deactivate Ad Inserter it can't insert anything - WordPress doesn't call it. If you still see some ads that were inserted by Ad Inserter, make sure you have cleared all the caches.
302
  * [Ads not displayed](https://adinserter.pro/documentation#ads-not-displayed)
303
 
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  == Frequently Asked Questions ==
306
 
307
  = I have activated Ad Inserter. How can I use it? =
340
 
341
  = I have installed code for AdSense ads but the ad blocks are blank. =
342
 
343
+ Blank AdSense ad block means that the code is inserted properly only the ad code doesn't display ads. Typical reasons for this are the following:
344
 
345
  * After the ad code is inserted Google needs some time (hours) to check the pages before it starts to serve ads.
346
  * AdSense account is not fully approved yet - if your account is new you need to wait until Google checks ad codes on your website and and confirms your account. Usually this takes few days.
359
  * Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select code block and click on Save
360
  * Optionally you can enable Sticky widget - this means that this widget (and widgets below) will stay fixed in the sidebar when the page is scrolled - Sticky Sidebar
361
  * You can also make other widgets sticky even if you don't use Ad Inserter widgets - drag Ad Inserter widget to the sidebar ABOVE the top widget that needs to be sticky, select Dummy Widget for Block, check Sticky and save widget
362
+ * In general plugin settings (tab &#9881;) you can also define Sticky Widget Top Margin to precisely define top position where the first sticky widget will stick
363
 
364
  Additional note regarding *Sticky Widgets* - *Sticky Sidebars*:
365
 
366
+ There are two modes for sticky widgets (or sticky sidebars) available as **Sticky widget mode** in general plugin settings (tab &#9881;):
367
 
368
  * CSS mode - This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to `position: sticky`. This works with most themes but not all. If your widgets and sidebar aren't sticking as expected you can use **JavaScript mode** described below.
369
  * JavaScript mode - This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized.
431
 
432
  This happens because Ad Inserter processes posts last and therefore "sees" also content added by other plugins.
433
 
434
+ Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab &#9881; / tab General).
435
 
436
 
437
  = How can I add some title or label (e.g. Advertisements) above the ad? =
438
 
439
  If this is a sidebar widget then you can simply name the widget.
440
 
441
+ For each code block you can also show a label above each ad. Default text (or HTML code) for ad labels can be set on the general plugin settings tab (tab &#9881; / tab General / **Ad label**.
442
  To enable ad label above the ad go to code block for this ad, click on the Misc button and then on the Display tab check **Ad label**.
443
 
444
  If you configured only text for ad label then the following code will be added above ad code: `<div class="code-block-label">AD_LABEL_TEXT</div>` (`code-block` is the block class name used, AD_LABEL_TEXT is the text for Ad Label).
451
  AD_CODE`
452
 
453
 
 
 
 
 
 
 
 
454
  = How can I enable/disable ads on specific posts/pages? =
455
 
456
  There are two possible approaches.
483
  Select device types (desktop, tablet or phone) for which you need to show ads and enable **only client-side** device detection.
484
 
485
 
 
 
 
 
 
486
  = How can I enable or disable ads on group of similar pages? =
487
 
488
  If those pages have something in common in the url (page address) then you can block them with url patterns.
495
  For example, to exclude ads on pages that have /shop/ in url (page address) blacklist the following url: `*/shop/*`
496
 
497
 
498
+ = How can I put ads in the middle of the post regardless of the number of paragraphs? =
499
 
500
  Use Before paragraph automatic insertion and put 0.5 as paragraph number. Value between 0 and 1 means relative position in post or page (e.g. 0.3 means paragraph 30% from top or bottom)
501
 
502
 
503
+ = How can I put ads before the second paragraph and also in the middle of post with single ad block? =
504
 
505
  Use Before paragraph automatic insertion and put `2, 0.5` as paragraph number. You can specify multiple paragraphs as comma separated paragraph numbers (or relative postions).
506
 
507
 
508
+ = I'd like to rotate my ads based on percentage, for example show one ad 75% of the time and another one 25% of the time. Is that possible? =
509
 
510
  Yes. Either use rotation code generator and define shares in percents or create code using `ROTATE` separator with attribute *share* where you define percentage of the rotation share:
511
 
539
  <?php echo "PHP code by Ad Inserter"; ?>`
540
 
541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  = How can I rotate few versions of the same ad? =
543
 
544
  Enter them into the ad box and separate them with `[ADINSERTER ROTATE]`. Ad Inserter will insert them randomly.
578
  Check source code of your website for proper "read more" tag.
579
 
580
 
581
+ = How can I insert ads or code block directly into template php file? =
582
 
583
  Enable PHP function adinserter for code block and call adinserter function with code block number as parameter.
584
  Example for block 3:
615
  1. Settings for one code block (Before content). Up to 16 blocks can be configured (up to 64 in <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>)
616
  2. Code preview with visual CSS editor
617
  3. Code preview with visual CSS editor - highlighted code
618
+ 4. Post / Page Ad Inserter Individual Exceptions
619
  5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
620
  6. Ad Inserter plugin settings
621
  7. Visualization of HTML tags in post
633
 
634
  == Changelog ==
635
 
636
+ = 2.3.10 =
637
+ - Added support for timed rotation
638
+ - Added support for client-side insertion of dynamic blocks
639
+ - Improved word count function
640
+ - Few minor bug fixes, cosmetic changes and code improvements
641
+
642
  = 2.3.9 =
643
  - Added option to easily disable insertion of individual code block
644
  - Changes for compatibility with PHP 7.2
697
  - Fix for errors when importing code
698
  - Few minor bug fixes, cosmetic changes and code improvements
699
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
700
 
701
  = Earlier versions =
702
 
704
 
705
  == Upgrade Notice ==
706
 
707
+ = 2.3.10 =
708
+ Added support for timed rotation;
709
+ Added support for client-side insertion of dynamic blocks;
710
+ Improved word count function;
711
+ Few minor bug fixes, cosmetic changes and code improvements
712
+
713
  = 2.3.9 =
714
  Added option to easily disable insertion of individual code block;
715
  Changes for compatibility with PHP 7.2;
768
  Fix for errors when importing code;
769
  Few minor bug fixes, cosmetic changes and code improvements;
770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings.php CHANGED
@@ -209,7 +209,13 @@ function generate_settings_form (){
209
  Share
210
  </td>
211
  <td>
212
- <input class="option-share" style="width: 42px;" type="text" maxlength="2" title="Option share in percents - 0 means option disabled, if share for one option is not defined it will be calculated automatically. Leave all share fields empty for equal option shares." /> %
 
 
 
 
 
 
213
  </td>
214
  </tr>
215
  </table>
@@ -865,6 +871,7 @@ function generate_settings_form (){
865
  <button id="preview-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Preview code and alignment" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
866
  </div>
867
  <div style="float: right;">
 
868
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
869
  <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
870
  <?php } ?>
@@ -1802,6 +1809,7 @@ function generate_settings_form (){
1802
 
1803
  <div style="margin: 16px 0;">
1804
  <div style="float: right;">
 
1805
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1806
  <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save Settings" type="submit" style="width:120px; font-weight: bold;" />
1807
  </div>
@@ -1953,7 +1961,8 @@ function generate_settings_form (){
1953
  <select id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
1954
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
1955
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
1956
- <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
 
1957
  </select>
1958
  </td>
1959
  </tr>
@@ -2566,9 +2575,11 @@ function generate_settings_form (){
2566
  replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg', 'block');
2567
  replace_blocked_image ('ai-pro-2', 'ai-charts-250.png', 'block');
2568
  replace_blocked_image ('ai-pro-3', 'ai-countries-250.png', 'block');
 
2569
  replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
2570
  replace_blocked_image ('ai-tw', 'twitter.png', 'inline');
2571
  replace_blocked_image ('ai-fb', 'facebook.png', 'inline');
 
2572
  if (blocking_counter > 5) {
2573
  var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
2574
  console.log ('AD INSERTER:', message);
@@ -2825,7 +2836,7 @@ function code_block_list () {
2825
 
2826
  $disabled = $obj->get_disable_insertion ();
2827
 
2828
- $block_used = !$disabled && $automatic_insertion || $manual_php_function || $manual_shortcode || $manual_widget && !empty ($sidebars_with_widget [$block]);
2829
 
2830
  if (!$show_all_blocks && !$block_used) continue;
2831
 
@@ -2864,7 +2875,7 @@ function code_block_list () {
2864
  <td style="min-width: 120px; text-align: left; padding-left: 5px; max-width: 280px; white-space: nowrap; overflow: hidden;"><a href="<?php echo $edit_url; ?>" style="text-decoration: none; box-shadow: 0 0 0;"><?php echo $obj->wp_options [AI_OPTION_BLOCK_NAME]; ?></a></td>
2865
  <?php endif ?>
2866
  <td style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: #f00;" title="Insertion disabled"><?php echo $disabled ? '&#10074;&#10074;' : ''; ?></td>
2867
- <td style="min-width: 180px; text-align: left; padding-left: 5px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>"><?php echo $obj->get_automatic_insertion_text(); ?></td>
2868
  <td style="min-width: 110px; text-align: left; padding-left: 10px; max-width: 80px; white-space: nowrap; overflow: hidden; color: <?php echo $block_used ? '#444' : '#ccc'; ?>"><?php echo $obj->get_alignment_type_text (); ?></td>
2869
  <td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_php_function ? '#8080ff' : '#ddd'; ?>;">&#9679;</td>
2870
  <td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_shortcode ? '#ff8b8b' : '#ddd'; ?>;">&#9679;</td>
@@ -3344,8 +3355,8 @@ function sidebar_help () { ?>
3344
  <div class="ai-form header rounded ai-help">
3345
  <div style="float: left;">
3346
  <h2 style="display: inline-block; margin: 5px 0;">
3347
- Need help with settings?
3348
- 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
3349
  <a href="https://adinserter.pro/settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Common Settings</a>
3350
  </h2>
3351
  <div>
@@ -3354,13 +3365,16 @@ function sidebar_help () { ?>
3354
  <a href="https://adinserter.pro/adsense-ads#ad-code" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense code</a>:
3355
  <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>,
3356
  <a href="https://adinserter.pro/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Auto ads</a>,
3357
- <a href="https://adinserter.pro/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AMP ads</a>, optional
3358
- <a href="https://adinserter.pro/adsense-ads#integration" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense Integration</a>
3359
  </div>
3360
  <hr />
3361
  <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>
3362
  <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>
3363
  </div>
 
 
 
 
3364
  <div style="clear: both;"></div>
3365
  </div>
3366
 
@@ -3387,7 +3401,7 @@ function sidebar_pro () {
3387
  case 0: ?>
3388
  <a href="https://adinserter.pro/tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3389
  <?php break; case 1: ?>
3390
- <a href="http://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>
3391
  <?php break;
3392
  } ?>
3393
  </div>
@@ -3397,6 +3411,15 @@ function sidebar_pro () {
3397
  <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3398
  <?php break; case 1: ?>
3399
  <a href="https://adinserter.pro/lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>
 
 
 
 
 
 
 
 
 
3400
  <?php break;
3401
  } ?>
3402
  </div>
@@ -3416,10 +3439,13 @@ function sidebar_pro () {
3416
  <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
3417
  <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> below <code>&lt;body&gt;</code> or above <code>&lt;/body&gt;</code> tags</li>
3418
  <li>Automatic insertion at <a href="https://adinserter.pro/documentation#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
3419
- <li>Automatic insertion before or after any HTML element on page</li>
3420
  <li><a href="https://adinserter.pro/exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
3421
  <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
3422
- <li><a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">Sticky positions</a> (left, top, right, bottom - ads stay fixed when the page scrolls)</li>
 
 
 
3423
  <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Sticky (fixed) widgets</a> (sidebar does not move when the page scrolls)</li>
3424
  <li>Block <a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">alignment and style</a> customizations</li>
3425
  <li><a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers (AdSense TOS)</li>
@@ -3453,8 +3479,10 @@ function sidebar_pro () {
3453
  </ul>
3454
 
3455
  <p style="text-align: justify;">Ad Inserter Pro is a complete all-in-one ad management plugin for WordPress website with many advertising features to automatically insert adverts on posts and pages.
3456
- With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, GEO targeting,
3457
- impression and click tracking, ad blocking detection actions or multisite support then you can simply upgrade to <a href="http://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
 
 
3458
  </div>
3459
 
3460
  <?php
209
  Share
210
  </td>
211
  <td>
212
+ <input class="option-share" style="width: 42px;" type="text" maxlength="2" title="Option share in percents - 0 means option is disabled, if share for one option is not defined it will be calculated automatically. Leave all share fields empty for equal option shares." /> %
213
+ </td>
214
+ <td style="padding-left: 7px;">
215
+ Time
216
+ </td>
217
+ <td>
218
+ <input class="option-time" style="width: 42px;" type="text" maxlength="3" title="Option time in seconds - 0 means option is disabled and will be skipped. Leave all time fields empty for no timed rotation." /> s
219
  </td>
220
  </tr>
221
  </table>
871
  <button id="preview-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Preview code and alignment" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
872
  </div>
873
  <div style="float: right;">
874
+ <div title='Rotation editor active - rotation code not generated! Make sure no rotation editor is active before saving settings.' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>&#x26A0;</div>
875
  <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
876
  <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save All Settings" type="submit" />
877
  <?php } ?>
1809
 
1810
  <div style="margin: 16px 0;">
1811
  <div style="float: right;">
1812
+ <div title='Rotation editor active - rotation code not generated! Make sure no rotation editor is active before saving settings.' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>&#x26A0;</div>
1813
  <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
1814
  <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="Save Settings" type="submit" style="width:120px; font-weight: bold;" />
1815
  </div>
1961
  <select id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
1962
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
1963
  <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
1964
+ <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_SHOW; ?></option>
1965
+ <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_INSERT; ?></option>
1966
  </select>
1967
  </td>
1968
  </tr>
2575
  replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg', 'block');
2576
  replace_blocked_image ('ai-pro-2', 'ai-charts-250.png', 'block');
2577
  replace_blocked_image ('ai-pro-3', 'ai-countries-250.png', 'block');
2578
+ replace_blocked_image ('ai-preview', 'ai-preview-250.png', 'block');
2579
  replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
2580
  replace_blocked_image ('ai-tw', 'twitter.png', 'inline');
2581
  replace_blocked_image ('ai-fb', 'facebook.png', 'inline');
2582
+ replace_blocked_image ('ai-pdf', 'manual.png', 'inline');
2583
  if (blocking_counter > 5) {
2584
  var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
2585
  console.log ('AD INSERTER:', message);
2836
 
2837
  $disabled = $obj->get_disable_insertion ();
2838
 
2839
+ $block_used = !$disabled && ($automatic_insertion || $manual_php_function || $manual_shortcode || $manual_widget && !empty ($sidebars_with_widget [$block]));
2840
 
2841
  if (!$show_all_blocks && !$block_used) continue;
2842
 
2875
  <td style="min-width: 120px; text-align: left; padding-left: 5px; max-width: 280px; white-space: nowrap; overflow: hidden;"><a href="<?php echo $edit_url; ?>" style="text-decoration: none; box-shadow: 0 0 0;"><?php echo $obj->wp_options [AI_OPTION_BLOCK_NAME]; ?></a></td>
2876
  <?php endif ?>
2877
  <td style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: #f00;" title="Insertion disabled"><?php echo $disabled ? '&#10074;&#10074;' : ''; ?></td>
2878
+ <td style="min-width: 80px; text-align: left; padding-left: 5px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>"><?php echo $obj->get_automatic_insertion_text(); ?></td>
2879
  <td style="min-width: 110px; text-align: left; padding-left: 10px; max-width: 80px; white-space: nowrap; overflow: hidden; color: <?php echo $block_used ? '#444' : '#ccc'; ?>"><?php echo $obj->get_alignment_type_text (); ?></td>
2880
  <td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_php_function ? '#8080ff' : '#ddd'; ?>;">&#9679;</td>
2881
  <td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_shortcode ? '#ff8b8b' : '#ddd'; ?>;">&#9679;</td>
3355
  <div class="ai-form header rounded ai-help">
3356
  <div style="float: left;">
3357
  <h2 style="display: inline-block; margin: 5px 0;">
3358
+ Need help with <a href="https://adinserter.pro/documentation" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">settings</a>?
3359
+ For <a href="https://adinserter.pro/documentation#quick-start" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">quick start</a> check <a href="https://adinserter.pro/code-editing" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Code Editing</a> and
3360
  <a href="https://adinserter.pro/settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Common Settings</a>
3361
  </h2>
3362
  <div>
3365
  <a href="https://adinserter.pro/adsense-ads#ad-code" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense code</a>:
3366
  <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>,
3367
  <a href="https://adinserter.pro/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Auto ads</a>,
3368
+ <a href="https://adinserter.pro/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AMP ads</a>
 
3369
  </div>
3370
  <hr />
3371
  <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>
3372
  <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>
3373
  </div>
3374
+ <div style="float: right; margin: -5px -5px 0 0;">
3375
+ <a href="https://adinserter.pro/Ad_Inserter_User_Manual.pdf" class="clear-link" target="_blank"><img id="ai-pdf" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>manual.png" title="Download user manual"/></a>
3376
+ <div style="text-align: center; font-size: 12px;">User Manual</div>
3377
+ </div>
3378
  <div style="clear: both;"></div>
3379
  </div>
3380
 
3401
  case 0: ?>
3402
  <a href="https://adinserter.pro/tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3403
  <?php break; case 1: ?>
3404
+ <a href='https://adinserter.pro/documentation#code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3405
  <?php break;
3406
  } ?>
3407
  </div>
3411
  <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3412
  <?php break; case 1: ?>
3413
  <a href="https://adinserter.pro/lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>
3414
+ <?php break;
3415
+ } ?>
3416
+ </div>
3417
+ <div>
3418
+ <?php switch ($version) {
3419
+ case 0: ?>
3420
+ <a href='https://adinserter.pro/documentation#code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3421
+ <?php break; case 1: ?>
3422
+ <a href="https://adinserter.pro/tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3423
  <?php break;
3424
  } ?>
3425
  </div>
3439
  <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
3440
  <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> below <code>&lt;body&gt;</code> or above <code>&lt;/body&gt;</code> tags</li>
3441
  <li>Automatic insertion at <a href="https://adinserter.pro/documentation#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
3442
+ <li>Insertion <a href="https://adinserter.pro/documentation#insertion-before-after-html-element" class="simple-link" target="_blank">before or after any HTML element on the page</a> (using CSS selectors)</li>
3443
  <li><a href="https://adinserter.pro/exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
3444
  <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
3445
+ <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ads</a> with optional close button (ads stay fixed when the page scrolls)</li>
3446
+ <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky sidebar ads</a> (stick to the screen or to the content)</li>
3447
+ <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad animations</a> (fade, slide, turn, flip, zoom)</li>
3448
+ <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad trigger</a> (page scroll in % or px, HTML element becomes visible)</li>
3449
  <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Sticky (fixed) widgets</a> (sidebar does not move when the page scrolls)</li>
3450
  <li>Block <a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">alignment and style</a> customizations</li>
3451
  <li><a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers (AdSense TOS)</li>
3479
  </ul>
3480
 
3481
  <p style="text-align: justify;">Ad Inserter Pro is a complete all-in-one ad management plugin for WordPress website with many advertising features to automatically insert adverts on posts and pages.
3482
+ With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, ad statistics for impressions and clicks,
3483
+ A/B testing, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, to protect content from users using ad blockers, to serve different ads for users using ad blockers,
3484
+ multisite options to limit settings for ads, to block some IP addresses, to schedule ads, then you can simply upgrade to
3485
+ <a href="http://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
3486
  </div>
3487
 
3488
  <?php