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

Version Description

  • Added support for ad labels
  • Blocked search indexing while debugging
  • Close button setting moved to tab Display (Pro only)
  • 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.7
Comparing to
See all releases

Code changes from version 2.3.6 to 2.3.7

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.6
6
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -13,6 +13,11 @@ Plugin URI: http://adinserter.pro/documentation
13
 
14
  Change Log
15
 
 
 
 
 
 
16
  Ad Inserter 2.3.6 - 2018-03-20
17
  - Added widget for debugging tools
18
  - Fix for AdSense ad overlays not displayed with some themes
@@ -2372,6 +2377,14 @@ function get_adb_status_debug_info () {
2372
  }
2373
 
2374
 
 
 
 
 
 
 
 
 
2375
  function get_header_footer_debug_block ($name, $title, $code, $javascript = false) {
2376
  $message = '';
2377
  if (strpos ($code, 'enable_page_level_ads') !== false)
@@ -2425,9 +2438,12 @@ function ai_wp_head_hook () {
2425
  $start_time = microtime (true);
2426
  }
2427
 
 
 
 
 
2428
  add_head_inline_styles_and_scripts ();
2429
 
2430
- $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
2431
  $header_code = null;
2432
 
2433
  $obj = $block_object [AI_HEADER_OPTION_NAME];
@@ -2527,6 +2543,8 @@ function ai_amp_head_hook () {
2527
 
2528
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
2529
 
 
 
2530
  $obj = $block_object [AI_HEADER_OPTION_NAME];
2531
  // $obj->clear_code_cache (); // cleared at ai_http_header
2532
 
@@ -2549,26 +2567,6 @@ function ai_amp_head_hook () {
2549
  }
2550
  }
2551
 
2552
- // if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
2553
- // // No scripts on AMP pages
2554
- // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING_STATUS) != 0 && $ai_wp_data [AI_ADB_DETECTION] && !$ai_wp_data [AI_WP_AMP_PAGE]) {
2555
- // echo "<script>
2556
- // jQuery(document).ready(function($) {
2557
- // $('body').prepend (\"", get_adb_status_debug_info () , "\");
2558
- // });
2559
- //</script>\n";
2560
- // }
2561
- // }
2562
-
2563
- // // No scripts on AMP pages
2564
- // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0 & !$ai_wp_data [AI_WP_AMP_PAGE]) {
2565
- // echo "<script>
2566
- // jQuery(document).ready(function($) {
2567
- // $('body').prepend (\"", get_page_type_debug_info () , "\");
2568
- // });
2569
- //</script>\n";
2570
- // }
2571
-
2572
  if (defined ('AI_BUFFERING')) {
2573
  if (get_output_buffering ()) {
2574
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_AJAX) {
@@ -2909,6 +2907,7 @@ function ai_write_debug_info ($write_processing_log = false) {
2909
  }
2910
  echo "\n";
2911
  }
 
2912
  echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
2913
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2914
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
@@ -3310,6 +3309,7 @@ function ai_check_plugin_options ($plugin_options = array ()) {
3310
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
3311
  if (!isset ($plugin_options ['OUTPUT_BUFFERING'])) $plugin_options ['OUTPUT_BUFFERING'] = DEFAULT_OUTPUT_BUFFERING;
3312
  if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
 
3313
  if (!isset ($plugin_options ['ADB_ACTION'])) $plugin_options ['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
3314
  if (!isset ($plugin_options ['ADB_DELAY_ACTION'])) $plugin_options ['ADB_DELAY_ACTION'] = '';
3315
  if (!isset ($plugin_options ['ADB_NO_ACTION_PERIOD'])) $plugin_options ['ADB_NO_ACTION_PERIOD'] = AI_DEFAULT_ADB_NO_ACTION_PERIOD;
@@ -3547,6 +3547,16 @@ function get_no_paragraph_counting_inside () {
3547
  return (str_replace (array ('<', '>'), '', $ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE']));
3548
  }
3549
 
 
 
 
 
 
 
 
 
 
 
3550
  function get_admin_toolbar_debugging () {
3551
  global $ai_db_options;
3552
 
@@ -3854,10 +3864,10 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
3854
  $value = esc_html ($value);
3855
  }
3856
  elseif ($option == AI_OPTION_DOMAIN_LIST ||
3857
- $option == 'NO_PARAGRAPH_COUNTING_INSIDE' ||
3858
- $option == AI_OPTION_PARAGRAPH_TAGS ||
3859
- $option == AI_OPTION_IP_ADDRESS_LIST ||
3860
- $option == AI_OPTION_COUNTRY_LIST) {
3861
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]", "'", '"'), "", $value);
3862
  $value = esc_html ($value);
3863
  }
@@ -3901,9 +3911,13 @@ function filter_option ($option, $value, $delete_escaped_backslashes = true){
3901
  $option == 'HOOK_PRIORITY' ||
3902
  $option == 'ADB_OVERLAY_CSS' ||
3903
  $option == 'ADB_MESSAGE_CSS') {
3904
- $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
3905
- $value = esc_html ($value);
3906
- }
 
 
 
 
3907
 
3908
  return $value;
3909
  }
@@ -3960,6 +3974,7 @@ function ai_ajax_backend () {
3960
  isset ($_POST ["custom_css"]) ? base64_decode ($_POST ["custom_css"]) : null,
3961
  isset ($_POST ["code"]) ? base64_decode ($_POST ["code"]) : null,
3962
  isset ($_POST ["php"]) ? $_POST ["php"] == 1 : null,
 
3963
  isset ($_POST ["close"]) ? $_POST ["close"] : null,
3964
  isset ($_POST ["read_only"]) ? true : false
3965
  );
@@ -4076,6 +4091,10 @@ function ai_ajax_backend () {
4076
  update_option ('ai-notice-' . $_POST ["notice"], $_POST ["click"]);
4077
  }
4078
 
 
 
 
 
4079
  elseif (isset ($_GET ["list"])) {
4080
  code_block_list ();
4081
  }
@@ -4574,7 +4593,7 @@ section.ai-debug-block, .ai-debug-block section {
4574
  }
4575
  .ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace; font-size: 12px; line-height: 13px;}
4576
 
4577
- .ai-debug-block {border: 1px solid; line-height: 10px;}
4578
 
4579
  .ai-debug-block.ai-debug-default {border-color: #e00;}
4580
  .ai-debug-bar.ai-debug-default {background: #e00;}
@@ -4783,6 +4802,7 @@ function ai_settings () {
4783
  if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
4784
  if (isset ($_POST ['output-buffering'])) $options ['OUTPUT_BUFFERING'] = filter_option ('OUTPUT_BUFFERING', $_POST ['output-buffering']);
4785
  if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
 
4786
  if (isset ($_POST [AI_OPTION_ADB_ACTION])) $options ['ADB_ACTION'] = filter_option ('ADB_ACTION', $_POST [AI_OPTION_ADB_ACTION]);
4787
  if (isset ($_POST [AI_OPTION_ADB_DELAY_ACTION])) $options ['ADB_DELAY_ACTION'] = filter_option ('ADB_DELAY_ACTION', $_POST [AI_OPTION_ADB_DELAY_ACTION]);
4788
  if (isset ($_POST [AI_OPTION_ADB_NO_ACTION_PERIOD])) $options ['ADB_NO_ACTION_PERIOD'] = filter_option ('ADB_NO_ACTION_PERIOD', $_POST [AI_OPTION_ADB_NO_ACTION_PERIOD]);
@@ -6165,7 +6185,7 @@ ul.ai-debug-tools a, ul.ai-debug-tools a:link, ul.ai-debug-tools a:visited {
6165
  }
6166
 
6167
  ul.ai-debug-tools a:hover {
6168
- color: #2d8ae0!important;
6169
  }
6170
 
6171
  ul.ai-debug-tools .ab-icon {
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.7
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.7 - 2018-03-27
17
+ - Added support for ad labels
18
+ - Blocked search indexing while debugging
19
+ - Few minor bug fixes, cosmetic changes and code improvements
20
+
21
  Ad Inserter 2.3.6 - 2018-03-20
22
  - Added widget for debugging tools
23
  - Fix for AdSense ad overlays not displayed with some themes
2377
  }
2378
 
2379
 
2380
+ function ai_header_noindex () {
2381
+ global $ai_wp_data;
2382
+
2383
+ if ($ai_wp_data [AI_WP_DEBUGGING] != 0) {
2384
+ echo '<meta name="robots" content="noindex"> <!-- ', AD_INSERTER_NAME, ' debugging enabled (', $ai_wp_data [AI_WP_DEBUGGING], ') -->', "\n";
2385
+ }
2386
+ }
2387
+
2388
  function get_header_footer_debug_block ($name, $title, $code, $javascript = false) {
2389
  $message = '';
2390
  if (strpos ($code, 'enable_page_level_ads') !== false)
2438
  $start_time = microtime (true);
2439
  }
2440
 
2441
+ $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
2442
+
2443
+ ai_header_noindex ();
2444
+
2445
  add_head_inline_styles_and_scripts ();
2446
 
 
2447
  $header_code = null;
2448
 
2449
  $obj = $block_object [AI_HEADER_OPTION_NAME];
2543
 
2544
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
2545
 
2546
+ ai_header_noindex ();
2547
+
2548
  $obj = $block_object [AI_HEADER_OPTION_NAME];
2549
  // $obj->clear_code_cache (); // cleared at ai_http_header
2550
 
2567
  }
2568
  }
2569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2570
  if (defined ('AI_BUFFERING')) {
2571
  if (get_output_buffering ()) {
2572
  if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_AJAX) {
2907
  }
2908
  echo "\n";
2909
  }
2910
+ echo 'AD LABEL: ', get_ad_label (), "\n";
2911
  echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
2912
  echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2913
  echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
3309
  if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
3310
  if (!isset ($plugin_options ['OUTPUT_BUFFERING'])) $plugin_options ['OUTPUT_BUFFERING'] = DEFAULT_OUTPUT_BUFFERING;
3311
  if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
3312
+ if (!isset ($plugin_options ['AD_LABEL'])) $plugin_options ['AD_LABEL'] = DEFAULT_AD_TITLE;
3313
  if (!isset ($plugin_options ['ADB_ACTION'])) $plugin_options ['ADB_ACTION'] = AI_DEFAULT_ADB_ACTION;
3314
  if (!isset ($plugin_options ['ADB_DELAY_ACTION'])) $plugin_options ['ADB_DELAY_ACTION'] = '';
3315
  if (!isset ($plugin_options ['ADB_NO_ACTION_PERIOD'])) $plugin_options ['ADB_NO_ACTION_PERIOD'] = AI_DEFAULT_ADB_NO_ACTION_PERIOD;
3547
  return (str_replace (array ('<', '>'), '', $ai_db_options [AI_OPTION_GLOBAL]['NO_PARAGRAPH_COUNTING_INSIDE']));
3548
  }
3549
 
3550
+ function get_ad_label ($decode = false) {
3551
+ global $ai_db_options;
3552
+
3553
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['AD_LABEL'])) $ai_db_options [AI_OPTION_GLOBAL]['AD_LABEL'] = DEFAULT_AD_TITLE;
3554
+
3555
+ if ($decode) return (html_entity_decode ($ai_db_options [AI_OPTION_GLOBAL]['AD_LABEL']));
3556
+
3557
+ return ($ai_db_options [AI_OPTION_GLOBAL]['AD_LABEL']);
3558
+ }
3559
+
3560
  function get_admin_toolbar_debugging () {
3561
  global $ai_db_options;
3562
 
3864
  $value = esc_html ($value);
3865
  }
3866
  elseif ($option == AI_OPTION_DOMAIN_LIST ||
3867
+ $option == 'NO_PARAGRAPH_COUNTING_INSIDE' ||
3868
+ $option == AI_OPTION_PARAGRAPH_TAGS ||
3869
+ $option == AI_OPTION_IP_ADDRESS_LIST ||
3870
+ $option == AI_OPTION_COUNTRY_LIST) {
3871
  $value = str_replace (array ("\\", "/", "?", "\"", "'", "<", ">", "[", "]", "'", '"'), "", $value);
3872
  $value = esc_html ($value);
3873
  }
3911
  $option == 'HOOK_PRIORITY' ||
3912
  $option == 'ADB_OVERLAY_CSS' ||
3913
  $option == 'ADB_MESSAGE_CSS') {
3914
+ $value = str_replace (array ("\"", "<", ">", "[", "]"), "", $value);
3915
+ $value = esc_html ($value);
3916
+ }
3917
+ elseif ($option == 'AD_LABEL' ) {
3918
+ $value = str_replace (array ("\\", "?"), "", $value);
3919
+ $value = esc_html ($value);
3920
+ }
3921
 
3922
  return $value;
3923
  }
3974
  isset ($_POST ["custom_css"]) ? base64_decode ($_POST ["custom_css"]) : null,
3975
  isset ($_POST ["code"]) ? base64_decode ($_POST ["code"]) : null,
3976
  isset ($_POST ["php"]) ? $_POST ["php"] == 1 : null,
3977
+ isset ($_POST ["label"]) ? $_POST ["label"] == 1 : null,
3978
  isset ($_POST ["close"]) ? $_POST ["close"] : null,
3979
  isset ($_POST ["read_only"]) ? true : false
3980
  );
4091
  update_option ('ai-notice-' . $_POST ["notice"], $_POST ["click"]);
4092
  }
4093
 
4094
+ elseif (isset ($_POST ["notice-check"])) {
4095
+ echo $_POST ["notice-check"];
4096
+ }
4097
+
4098
  elseif (isset ($_GET ["list"])) {
4099
  code_block_list ();
4100
  }
4593
  }
4594
  .ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace; font-size: 12px; line-height: 13px;}
4595
 
4596
+ .ai-debug-block {border: 1px solid;}
4597
 
4598
  .ai-debug-block.ai-debug-default {border-color: #e00;}
4599
  .ai-debug-bar.ai-debug-default {background: #e00;}
4802
  if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
4803
  if (isset ($_POST ['output-buffering'])) $options ['OUTPUT_BUFFERING'] = filter_option ('OUTPUT_BUFFERING', $_POST ['output-buffering']);
4804
  if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
4805
+ if (isset ($_POST ['ad-label'])) $options ['AD_LABEL'] = filter_option ('AD_LABEL', $_POST ['ad-label']);
4806
  if (isset ($_POST [AI_OPTION_ADB_ACTION])) $options ['ADB_ACTION'] = filter_option ('ADB_ACTION', $_POST [AI_OPTION_ADB_ACTION]);
4807
  if (isset ($_POST [AI_OPTION_ADB_DELAY_ACTION])) $options ['ADB_DELAY_ACTION'] = filter_option ('ADB_DELAY_ACTION', $_POST [AI_OPTION_ADB_DELAY_ACTION]);
4808
  if (isset ($_POST [AI_OPTION_ADB_NO_ACTION_PERIOD])) $options ['ADB_NO_ACTION_PERIOD'] = filter_option ('ADB_NO_ACTION_PERIOD', $_POST [AI_OPTION_ADB_NO_ACTION_PERIOD]);
6185
  }
6186
 
6187
  ul.ai-debug-tools a:hover {
6188
+ color: #5faff9!important;
6189
  }
6190
 
6191
  ul.ai-debug-tools .ab-icon {
class.php CHANGED
@@ -407,6 +407,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
407
  parent::__construct();
408
 
409
  $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME;
 
410
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
411
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
412
  $this->wp_options [AI_OPTION_HTML_SELECTOR] = AD_EMPTY_DATA;
@@ -489,6 +490,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
489
  }
490
  }
491
 
 
 
 
 
 
 
492
  public function get_automatic_insertion (){
493
  global $ai_db_options;
494
 
@@ -1363,7 +1370,19 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1363
  return $counters;
1364
  }
1365
 
1366
- public function ai_getProcessedCode ($hide_label = false, $force_server_side_code = false, $client_code = null, $process_php = null){
 
 
 
 
 
 
 
 
 
 
 
 
1367
  global $ai_wp_data, $ad_inserter_globals, $block_object;
1368
 
1369
  $code = $this->ai_getCode ($client_code, $process_php);
@@ -1372,7 +1391,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1372
  $this->additional_code_before = '';
1373
  $this->additional_code_after = '';
1374
 
1375
- $close_button_code = '';
 
 
 
 
1376
  $alignment_type = $this->get_alignment_type ();
1377
  if ($this->get_close_button () != AI_CLOSE_NONE && !$ai_wp_data [AI_WP_AMP_PAGE] && $alignment_type != AI_ALIGNMENT_NO_WRAPPING && $client_code === null) {
1378
  switch ($this->get_close_button ()) {
@@ -1393,7 +1416,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1393
  break;
1394
  }
1395
 
1396
- $close_button_code = "<span class='$button_class'></span>\n";
1397
  }
1398
 
1399
  unset ($ai_wp_data [AI_SHORTCODES]['rotate']);
@@ -1454,16 +1477,16 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1454
  switch ($amp_dynamic_blocks) {
1455
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1456
  $this->code_version = mt_rand (1, count ($ads));
1457
- $processed_code = $close_button_code . trim ($ads [$this->code_version - 1]);
1458
  $this->version_name = $version_names [$this->code_version - 1];
1459
  break;
1460
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
1461
  $this->code_version = '""';
1462
 
1463
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1464
- $processed_code = "\n<div class='ai-rotate'>\n" . $close_button_code;
1465
  } else
1466
- $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n" . $close_button_code;
1467
 
1468
  foreach ($ads as $index => $ad) {
1469
 
@@ -1493,13 +1516,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1493
  $processed_code .= "</div>\n";
1494
  break;
1495
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1496
- $this->w3tc_code = '$ai_code = unserialize (base64_decode (\''.base64_encode (serialize ($ads)).'\')); $ai_index = mt_rand (1, count ($ai_code)); $ai_code = base64_decode (\''.base64_encode ($close_button_code).'\') . $ai_code [$ai_index - 1]; $ai_enabled = true;';
1497
  $processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
1498
  $processed_code .= $this->w3tc_code.' echo $ai_code;';
1499
  $processed_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
1500
  break;
1501
  }
1502
- } else $processed_code = $close_button_code . $processed_code;
1503
 
1504
 
1505
  $amp_dynamic_blocks = $dynamic_blocks;
407
  parent::__construct();
408
 
409
  $this->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME;
410
+ $this->wp_options [AI_OPTION_SHOW_LABEL] = AI_DISABLED;
411
  $this->wp_options [AI_OPTION_TRACKING] = AI_DISABLED;
412
  $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
413
  $this->wp_options [AI_OPTION_HTML_SELECTOR] = AD_EMPTY_DATA;
490
  }
491
  }
492
 
493
+ public function get_show_label (){
494
+ $show_label = isset ($this->wp_options [AI_OPTION_SHOW_LABEL]) ? $this->wp_options [AI_OPTION_SHOW_LABEL] : AI_DISABLED;
495
+ if ($show_label == '') $show_label = AI_DISABLED;
496
+ return $show_label;
497
+ }
498
+
499
  public function get_automatic_insertion (){
500
  global $ai_db_options;
501
 
1370
  return $counters;
1371
  }
1372
 
1373
+ public function ai_getAdLabel ($show_label = null) {
1374
+ $label_enabled = $show_label === null ? $this->get_show_label () : $show_label;
1375
+
1376
+ if (!$label_enabled) return '';
1377
+
1378
+ $ad_label = get_ad_label (true);
1379
+ if (strpos ($ad_label, '<') === false && strpos ($ad_label, '>') === false) {
1380
+ $ad_label = '<div class="' . get_block_class_name (true) . '-label">' . $ad_label . '</div>';
1381
+ }
1382
+ return $ad_label .= "\n";
1383
+ }
1384
+
1385
+ public function ai_getProcessedCode ($hide_label = false, $force_server_side_code = false, $client_code = null, $process_php = null, $show_label = null) {
1386
  global $ai_wp_data, $ad_inserter_globals, $block_object;
1387
 
1388
  $code = $this->ai_getCode ($client_code, $process_php);
1391
  $this->additional_code_before = '';
1392
  $this->additional_code_after = '';
1393
 
1394
+ // Code for ad label, close button
1395
+ $additional_code = '';
1396
+
1397
+ $additional_code .= $this->ai_getAdLabel ($show_label);
1398
+
1399
  $alignment_type = $this->get_alignment_type ();
1400
  if ($this->get_close_button () != AI_CLOSE_NONE && !$ai_wp_data [AI_WP_AMP_PAGE] && $alignment_type != AI_ALIGNMENT_NO_WRAPPING && $client_code === null) {
1401
  switch ($this->get_close_button ()) {
1416
  break;
1417
  }
1418
 
1419
+ $additional_code .= "<span class='$button_class'></span>\n";
1420
  }
1421
 
1422
  unset ($ai_wp_data [AI_SHORTCODES]['rotate']);
1477
  switch ($amp_dynamic_blocks) {
1478
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
1479
  $this->code_version = mt_rand (1, count ($ads));
1480
+ $processed_code = $additional_code . trim ($ads [$this->code_version - 1]);
1481
  $this->version_name = $version_names [$this->code_version - 1];
1482
  break;
1483
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
1484
  $this->code_version = '""';
1485
 
1486
  if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1487
+ $processed_code = "\n<div class='ai-rotate'>\n" . $additional_code;
1488
  } else
1489
+ $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n" . $additional_code;
1490
 
1491
  foreach ($ads as $index => $ad) {
1492
 
1516
  $processed_code .= "</div>\n";
1517
  break;
1518
  case AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC:
1519
+ $this->w3tc_code = '$ai_code = unserialize (base64_decode (\''.base64_encode (serialize ($ads)).'\')); $ai_index = mt_rand (1, count ($ai_code)); $ai_code = base64_decode (\''.base64_encode ($additional_code).'\') . $ai_code [$ai_index - 1]; $ai_enabled = true;';
1520
  $processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
1521
  $processed_code .= $this->w3tc_code.' echo $ai_code;';
1522
  $processed_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
1523
  break;
1524
  }
1525
+ } else $processed_code = $additional_code . $processed_code;
1526
 
1527
 
1528
  $amp_dynamic_blocks = $dynamic_blocks;
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.6');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -60,6 +60,7 @@ define ('AI_OPTION_ENABLE_MANUAL', 'enable_manual');
60
  define ('AI_OPTION_ENABLE_AMP', 'enable_amp');
61
  define ('AI_OPTION_ENABLE_WIDGET', 'enable_widget');
62
  define ('AI_OPTION_PROCESS_PHP', 'process_php');
 
63
  define ('AI_OPTION_TRACKING', 'tracking');
64
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
65
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
@@ -323,9 +324,9 @@ define('AI_TEXT_STICK_TO_THE_BOTTOM', 'Stick to the bottom');
323
  define('AI_STICKY_Z_INDEX', 9995); // update ad-inserter.js
324
 
325
  define('AI_ALIGNMENT_CSS_DEFAULT', 'margin: 8px 0; clear: both;');
326
- define('AI_ALIGNMENT_CSS_LEFT', 'margin: 8px auto 8px 0; text-align: left; clear: both;||margin: 8px 0; text-align: left; clear: both; display: flex; justify-content: flex-start;');
327
- define('AI_ALIGNMENT_CSS_RIGHT', 'margin: 8px 0 8px auto; text-align: right; clear: both;||margin: 8px 0; text-align: right; clear: both; display: flex; justify-content: flex-end;');
328
- define('AI_ALIGNMENT_CSS_CENTER', 'margin: 8px auto; text-align: center; clear: both;||margin: 8px 0; text-align: center; clear: both; display: flex; justify-content: center;');
329
  define('AI_ALIGNMENT_CSS_FLOAT_LEFT', 'margin: 8px 8px 8px 0; float: left;');
330
  define('AI_ALIGNMENT_CSS_FLOAT_RIGHT', 'margin: 8px 0 8px 8px; float: right;');
331
  define('AI_ALIGNMENT_CSS_STICKY_LEFT', 'position: fixed; left: 0px; top: 100px; z-index: 9999;');
@@ -560,6 +561,7 @@ define ('DEFAULT_PLUGIN_PRIORITY', 99999);
560
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
561
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
562
  define ('DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE', 'blockquote, figure, li');
 
563
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
564
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
565
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
24
  define ('AD_INSERTER_NAME', 'Ad Inserter');
25
 
26
  if (!defined( 'AD_INSERTER_VERSION'))
27
+ define ('AD_INSERTER_VERSION', '2.3.7');
28
 
29
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
30
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
60
  define ('AI_OPTION_ENABLE_AMP', 'enable_amp');
61
  define ('AI_OPTION_ENABLE_WIDGET', 'enable_widget');
62
  define ('AI_OPTION_PROCESS_PHP', 'process_php');
63
+ define ('AI_OPTION_SHOW_LABEL', 'show_label');
64
  define ('AI_OPTION_TRACKING', 'tracking');
65
  define ('AI_OPTION_ENABLE_AJAX', 'enable_ajax');
66
  define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
324
  define('AI_STICKY_Z_INDEX', 9995); // update ad-inserter.js
325
 
326
  define('AI_ALIGNMENT_CSS_DEFAULT', 'margin: 8px 0; clear: both;');
327
+ define('AI_ALIGNMENT_CSS_LEFT', 'margin: 8px auto 8px 0; text-align: left; clear: both;||margin: 8px 0; text-align: left; clear: both; display: flex; justify-content: flex-start; flex-direction: column; align-items: flex-start;');
328
+ define('AI_ALIGNMENT_CSS_RIGHT', 'margin: 8px 0 8px auto; text-align: right; clear: both;||margin: 8px 0; text-align: right; clear: both; display: flex; justify-content: flex-end; flex-direction: column; align-items: flex-end;');
329
+ define('AI_ALIGNMENT_CSS_CENTER', 'margin: 8px auto; text-align: center; clear: both;||margin: 8px 0; text-align: center; clear: both; display: flex; justify-content: center; flex-direction: column; align-items: center;');
330
  define('AI_ALIGNMENT_CSS_FLOAT_LEFT', 'margin: 8px 8px 8px 0; float: left;');
331
  define('AI_ALIGNMENT_CSS_FLOAT_RIGHT', 'margin: 8px 0 8px 8px; float: right;');
332
  define('AI_ALIGNMENT_CSS_STICKY_LEFT', 'position: fixed; left: 0px; top: 100px; z-index: 9999;');
561
  define ('DEFAULT_DYNAMIC_BLOCKS', AI_DYNAMIC_BLOCKS_SERVER_SIDE);
562
  define ('DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS', AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS);
563
  define ('DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE', 'blockquote, figure, li');
564
+ define ('DEFAULT_AD_TITLE', 'Advertisements');
565
  define ('DEFAULT_PARAGRAPH_TAGS', 'p');
566
  define ('DEFAULT_ADMIN_TOOLBAR_DEBUGGING', AI_ENABLED);
567
  define ('DEFAULT_REMOTE_DEBUGGING', AI_DISABLED);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.6"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
@@ -987,6 +987,15 @@ img.automatic-insertion.preview {
987
  background: url('images/icons.png') -180px 0;
988
  }
989
 
 
 
 
 
 
 
 
 
 
990
  .checkbox-icon.size-8.icon-stop {
991
  background: #ddd;
992
  }
1
  #ai-data {
2
+ font-family: "2.3.7"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
987
  background: url('images/icons.png') -180px 0;
988
  }
989
 
990
+ /*.checkbox-icon.icon-ad-label {*/
991
+ /* background: url('images/icons.png') -180px -80px;*/
992
+ /*}*/
993
+
994
+ /*.checkbox-icon.icon-ad-label.on {*/
995
+ /* background: url('images/icons.png') -180px -60px;*/
996
+ /*}*/
997
+
998
+
999
  .checkbox-icon.size-8.icon-stop {
1000
  background: #ddd;
1001
  }
css/images/icons.png CHANGED
Binary file
includes/js/ai-admin.js CHANGED
@@ -8,15 +8,40 @@ jQuery (function ($) {
8
  });
9
  }
10
 
11
- setTimeout (show_review_notice, 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  });
13
 
14
  $(document).on ('click', '.ai-notice .ai-notice-dismiss', function () {
 
15
  var notice_div = $(this).closest ('.ai-notice');
16
  var nonce = notice_div.attr ('nonce');
17
  var notice = notice_div.data ('notice');
18
  var action = $(this).data ('notice');
19
- // console.log ('CLICK', notice, action);
 
 
20
  notice_div.hide ();
21
 
22
  // Since WP 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
8
  });
9
  }
10
 
11
+ if (typeof ajaxurl !== 'undefined') {
12
+ var nonce = $('.ai-notice[nonce]').attr ('nonce');
13
+
14
+ // console.log ('AI NOTICE nonce', nonce, typeof nonce);
15
+
16
+ if (typeof nonce !== 'undefined') {
17
+ $.ajax (ajaxurl, {
18
+ type: 'POST',
19
+ data: {
20
+ action: 'ai_ajax_backend',
21
+ ai_check: nonce,
22
+ 'notice-check': nonce
23
+ }
24
+ }).done (function (data) {
25
+
26
+ // console.log ('AI NOTICE CHECK', nonce, data);
27
+
28
+ if (data == nonce) {
29
+ setTimeout (show_review_notice, 500);
30
+ }
31
+ });
32
+ }
33
+ }
34
  });
35
 
36
  $(document).on ('click', '.ai-notice .ai-notice-dismiss', function () {
37
+ var ai_debug = parseInt ($('#ai-data').attr ('js_debugging'));
38
  var notice_div = $(this).closest ('.ai-notice');
39
  var nonce = notice_div.attr ('nonce');
40
  var notice = notice_div.data ('notice');
41
  var action = $(this).data ('notice');
42
+
43
+ if (ai_debug) console.log ('AI NOTICE CLICK', notice, action);
44
+
45
  notice_div.hide ();
46
 
47
  // Since WP 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
includes/preview.php CHANGED
@@ -33,7 +33,19 @@ function padding_margin_code ($close_button, $class, $wrapper_css, $block_code)
33
  }
34
 
35
 
36
- function generate_code_preview ($block, $name = null, $alignment = null, $horizontal = null, $vertical = null, $alignment_css = null, $custom_css = null, $client_code = null, $process_php = null, $close = null, $read_only = false) {
 
 
 
 
 
 
 
 
 
 
 
 
37
  global $block_object, $ai_wp_data;
38
 
39
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
@@ -90,7 +102,7 @@ function generate_code_preview ($block, $name = null, $alignment = null, $horizo
90
  // Disable AdSense Auto ads (page level ads)
91
  $head_code = str_replace ('enable_page_level_ads', 'disabled_page_level_ads', $head_code);
92
 
93
- $block_code = $obj->ai_getProcessedCode (true, true, $client_code, $process_php);
94
 
95
  // Fix for relative urls
96
  $block_code = str_replace ('src="wp-content', 'src="../wp-content', $block_code);
33
  }
34
 
35
 
36
+ function generate_code_preview (
37
+ $block, $name = null,
38
+ $alignment = null,
39
+ $horizontal = null,
40
+ $vertical = null,
41
+ $alignment_css = null,
42
+ $custom_css = null,
43
+ $client_code = null,
44
+ $process_php = null,
45
+ $show_label = null,
46
+ $close = null,
47
+ $read_only = false) {
48
+
49
  global $block_object, $ai_wp_data;
50
 
51
  $ai_wp_data [AI_WP_DEBUGGING] = 0;
102
  // Disable AdSense Auto ads (page level ads)
103
  $head_code = str_replace ('enable_page_level_ads', 'disabled_page_level_ads', $head_code);
104
 
105
+ $block_code = $obj->ai_getProcessedCode (true, true, $client_code, $process_php, $show_label);
106
 
107
  // Fix for relative urls
108
  $block_code = str_replace ('src="wp-content', 'src="../wp-content', $block_code);
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.6";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -1535,6 +1535,10 @@ jQuery(document).ready(function($) {
1535
  var block = $(this).attr('id').replace ("process-php-", "");
1536
  process_display_elements (block);
1537
  });
 
 
 
 
1538
  $("#enable-shortcode-"+tab).change (function() {
1539
  var block = $(this).attr('id').replace ("enable-shortcode-", "");
1540
  process_display_elements (block);
@@ -1899,8 +1903,10 @@ jQuery(document).ready(function($) {
1899
 
1900
  var name = $("#name-label-"+block).text ();
1901
 
1902
- var code = $.base64Encode (get_editor_text (block));
1903
- var php = $("input#process-php-"+block).is(":checked") ? 1 : 0;
 
 
1904
  var close_button = $("#close-button-"+block+" option:selected").attr('value');
1905
 
1906
  if (!sticky) {
@@ -1917,7 +1923,7 @@ jQuery(document).ready(function($) {
1917
 
1918
  var nonce = $("#ai-form").attr ('nonce');
1919
 
1920
- var param = {'action': 'ai_ajax_backend', 'preview': block, 'ai_check': nonce, 'name': $.base64Encode (name), 'alignment': btoa (alignment), 'horizontal': btoa (horizontal), 'vertical': btoa (vertical), 'alignment_css': btoa (alignment_css), 'custom_css': btoa (custom_css), 'code': code, 'php': php, 'close': close_button};
1921
  window_open_post (ajaxurl, 'width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no', 'preview', param);
1922
  });
1923
 
@@ -1945,6 +1951,7 @@ jQuery(document).ready(function($) {
1945
  }
1946
 
1947
  $('#process-php-' + tab).checkboxButton ();
 
1948
 
1949
  $('#ai-misc-container-' + tab).tabs();
1950
  $('#ai-misc-tabs-' + tab).show();
1
+ var javascript_version = "2.3.7";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1535
  var block = $(this).attr('id').replace ("process-php-", "");
1536
  process_display_elements (block);
1537
  });
1538
+ $("input#show-label-"+tab).change (function() {
1539
+ var block = $(this).attr('id').replace ("show-label-", "");
1540
+ process_display_elements (block);
1541
+ });
1542
  $("#enable-shortcode-"+tab).change (function() {
1543
  var block = $(this).attr('id').replace ("enable-shortcode-", "");
1544
  process_display_elements (block);
1903
 
1904
  var name = $("#name-label-"+block).text ();
1905
 
1906
+ var code = $.base64Encode (get_editor_text (block));
1907
+ var php = $("input#process-php-"+block).is(":checked") ? 1 : 0;
1908
+ var label = $("input#show-label-"+block).is(":checked") ? 1 : 0;
1909
+
1910
  var close_button = $("#close-button-"+block+" option:selected").attr('value');
1911
 
1912
  if (!sticky) {
1923
 
1924
  var nonce = $("#ai-form").attr ('nonce');
1925
 
1926
+ var param = {'action': 'ai_ajax_backend', 'preview': block, 'ai_check': nonce, 'name': $.base64Encode (name), 'alignment': btoa (alignment), 'horizontal': btoa (horizontal), 'vertical': btoa (vertical), 'alignment_css': btoa (alignment_css), 'custom_css': btoa (custom_css), 'code': code, 'php': php, 'label': label, 'close': close_button};
1927
  window_open_post (ajaxurl, 'width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no', 'preview', param);
1928
  });
1929
 
1951
  }
1952
 
1953
  $('#process-php-' + tab).checkboxButton ();
1954
+ $('#show-label-' + tab).checkboxButton ();
1955
 
1956
  $('#ai-misc-container-' + tab).tabs();
1957
  $('#ai-misc-tabs-' + tab).show();
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
- Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, advanced contextual ads, amp adverts ad rotation, advertising manager, amazon banners ad injection, ad blocking detection, PHP Javascript HTML insertion, custom fields posts
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.3
9
- Stable tag: 2.3.5
10
  License: GPLv3
11
 
12
  Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
@@ -223,23 +223,6 @@ If you are using free Ad Inserter then first uninstall it. The Pro version will
223
  After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to Wordpress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
224
  activate it and then click "Enter License Key" and enter license key you got in the email.
225
 
226
- = Uploading plugin file =
227
-
228
- 1. Go to Wordpress Plugins menu, click Add New button
229
- 2. Click Upload Plugin
230
- 3. Select `ad-inserter-pro.zip` from your computer
231
- 4. Click 'Install Now'
232
- 5. Activate Ad Inserter Pro in the Plugin dashboard
233
- 5. Click "Enter License Key" or go to plugin Settings / tab * and enter license key you got in the email
234
-
235
- = Using FTP =
236
-
237
- 1. Download `ad-inserter-pro.zip`
238
- 2. Extract `ad-inserter-pro` directory to your computer
239
- 3. Upload `ad-inserter-pro` directory to the `/wp-content/plugins/` directory
240
- 4. Activate Ad Inserter Pro in the Plugin dashboard
241
-
242
-
243
  **Uninstall**
244
 
245
  If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
@@ -252,7 +235,7 @@ If you deactivate and delete Ad Inserter, the settings will stay in the database
252
  *Please Note*
253
 
254
  Ad Inserter inserts only the code you configure (blocks 1 - 16, Header, Footer). The code you see is the code that will be inserted (+ some internal scripts for plugin features).
255
- When you deactivate Ad Inserter it cant insert anything as WordPress doesn't call it. Please check page source code before you make any conclusion.
256
  Of course, if you configure code block with some javacript ad code, then this code may generate ads. But please, don't blame the plugin for this.
257
  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!**
258
  [https://adinserter.pro/adsense-ads#auto-ads](https://adinserter.pro/adsense-ads#auto-ads)
@@ -260,7 +243,7 @@ You can also use Ad Inserter to insert code for AdSense Auto ads on each page (u
260
  The easiest way to check Ad Inserter code blocks is to use **Label blocks** debugging function:
261
  [https://adinserter.pro/documentation#debugging](https://adinserter.pro/documentation#debugging)
262
 
263
- When you deactivate Ad Inserter it cant 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.
264
  If you still see those ads after you have disabled Ad Inserter and cleared all the caches, then the ads were not inserted by Ad Inserter.
265
 
266
 
@@ -417,15 +400,21 @@ This happens because Ad Inserter processes posts last and therefore "sees" also
417
  Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab * / tab General).
418
 
419
 
420
- = How can I add some text or title (e.g. Advertisement) above the ad? =
421
 
422
- If this is a sidebar widget then you can simply name the widget. In other cases you can add title HTML code above ad code. For example:
423
 
424
- `<h3>Advertisement</h3>
 
425
 
426
- AD_CODE`
 
 
 
427
 
428
- Change the title tag according to the theme style.
 
 
429
 
430
 
431
  = I like the plugin. How can I support it? =
@@ -637,6 +626,12 @@ AD CODE RIGHT
637
 
638
  == Changelog ==
639
 
 
 
 
 
 
 
640
  = 2.3.6 =
641
  - Added widget for debugging tools
642
  - Fix for AdSense ad overlays not displayed with some themes
@@ -719,6 +714,12 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
719
 
720
  == Upgrade Notice ==
721
 
 
 
 
 
 
 
722
  = 2.3.6 =
723
  Added widget for debugging tools;
724
  Fix for AdSense ad overlays not displayed with some themes;
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
+ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, advanced geo targeting ads, amp adverts ad rotation, advertising manager, amazon banners ad injection, ad blocking detection, PHP Javascript HTML insertion, custom fields posts
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.3
9
+ Stable tag: 2.3.6
10
  License: GPLv3
11
 
12
  Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
223
  After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to Wordpress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
224
  activate it and then click "Enter License Key" and enter license key you got in the email.
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  **Uninstall**
227
 
228
  If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:
235
  *Please Note*
236
 
237
  Ad Inserter inserts only the code you configure (blocks 1 - 16, Header, Footer). The code you see is the code that will be inserted (+ some internal scripts for plugin features).
238
+ When you deactivate Ad Inserter it can't insert anything as WordPress doesn't call it. Please check page source code before you make any conclusion.
239
  Of course, if you configure code block with some javacript ad code, then this code may generate ads. But please, don't blame the plugin for this.
240
  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!**
241
  [https://adinserter.pro/adsense-ads#auto-ads](https://adinserter.pro/adsense-ads#auto-ads)
243
  The easiest way to check Ad Inserter code blocks is to use **Label blocks** debugging function:
244
  [https://adinserter.pro/documentation#debugging](https://adinserter.pro/documentation#debugging)
245
 
246
+ 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.
247
  If you still see those ads after you have disabled Ad Inserter and cleared all the caches, then the ads were not inserted by Ad Inserter.
248
 
249
 
400
  Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings - tab * / tab General).
401
 
402
 
403
+ = How can I add some title or label (e.g. Advertisements) above the ad? =
404
 
405
+ If this is a sidebar widget then you can simply name the widget.
406
 
407
+ 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**.
408
+ 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**.
409
 
410
+ 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).
411
+ You can then style the label using CSS for class `.code-block-label` (the best place for this code is Header section). If HTML code is configured for ad label then this code will be used (instead of the div code above).
412
+
413
+ In case you need a different label for some ad you can simply add label HTML code above the ad code. For example:
414
 
415
+ `<h3>Advertisements</h3>
416
+
417
+ AD_CODE`
418
 
419
 
420
  = I like the plugin. How can I support it? =
626
 
627
  == Changelog ==
628
 
629
+ = 2.3.7 =
630
+ - Added support for ad labels
631
+ - Blocked search indexing while debugging
632
+ - Close button setting moved to tab Display (Pro only)
633
+ - Few minor bug fixes, cosmetic changes and code improvements
634
+
635
  = 2.3.6 =
636
  - Added widget for debugging tools
637
  - Fix for AdSense ad overlays not displayed with some themes
714
 
715
  == Upgrade Notice ==
716
 
717
+ = 2.3.7 =
718
+ Added support for ad labels;
719
+ Blocked search indexing while debugging;
720
+ Close button setting moved to tab Display (Pro only);
721
+ Few minor bug fixes, cosmetic changes and code improvements;
722
+
723
  = 2.3.6 =
724
  Added widget for debugging tools;
725
  Fix for AdSense ad overlays not displayed with some themes;
settings.php CHANGED
@@ -424,7 +424,7 @@ function generate_settings_form (){
424
 
425
  $adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING;
426
 
427
- $general_options = $obj->get_close_button ();
428
 
429
  $show_misc =
430
  $insertion_options ||
@@ -432,7 +432,7 @@ function generate_settings_form (){
432
  $scheduling_active ||
433
  $filter_active ||
434
  $adb_block_action_active ||
435
- $general_options;
436
 
437
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
438
 
@@ -441,7 +441,7 @@ function generate_settings_form (){
441
  if ($scheduling_active) $scheduling_style = "font-weight: bold; color: #66f;"; else $scheduling_style = "";
442
  if ($filter_active) $filter_style = "font-weight: bold; color: #66f;"; else $filter_style = "";
443
  if ($adb_block_action_active) $adb_style = "font-weight: bold; color: #66f;"; else $adb_style = "";
444
- if ($general_options) $general_style = "font-weight: bold; color: #66f;"; else $general_style = "";
445
 
446
  $automatic_insertion = $obj->get_automatic_insertion();
447
 
@@ -1608,9 +1608,10 @@ function generate_settings_form (){
1608
  <div id="ai-misc-container-<?php echo $block; ?>" style="padding: 0; margin 8px 0 0 0; border: 0;">
1609
  <ul id="ai-misc-tabs-<?php echo $block; ?>" style="display: none;">
1610
  <li id="ai-misc-insertion-<?php echo $block; ?>"><a href="#tab-insertion-<?php echo $block; ?>"><span style="<?php echo $insertion_style; ?>">Insertion</span></a></li>
 
 
1611
  <li id="ai-misc-word-count-<?php echo $block; ?>"><a href="#tab-word-count-<?php echo $block; ?>"><span style="<?php echo $word_count_style; ?>">Word Count</span></a></li>
1612
  <li id="ai-misc-filter-<?php echo $block; ?>"><a href="#tab-filter-<?php echo $block; ?>"><span style="<?php echo $filter_style; ?>">Filter</span></a></li>
1613
- <li id="ai-misc-scheduling-<?php echo $block; ?>"><a href="#tab-scheduling-<?php echo $block; ?>"><span style="<?php echo $scheduling_style; ?>">Scheduling</span></a></li>
1614
  <?php if (function_exists ('ai_adb_action_0')) ai_adb_action_0 ($block, $adb_style); ?>
1615
  <li id="ai-misc-general-<?php echo $block; ?>"><a href="#tab-general-<?php echo $block; ?>"><span style="<?php echo $general_style; ?>">General</span></a></li>
1616
  </ul>
@@ -1676,11 +1677,38 @@ function generate_settings_form (){
1676
  </div>
1677
  </div>
1678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1679
  <div id="tab-word-count-<?php echo $block; ?>" class="rounded">
1680
  Post/Static page must have between
1681
- <input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" title="Minimum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
1682
  and
1683
- <input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" title="Maximum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
1684
  words
1685
  </div>
1686
 
@@ -1717,21 +1745,6 @@ function generate_settings_form (){
1717
  </div>
1718
  </div>
1719
 
1720
- <div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
1721
- <select id="scheduling-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
1722
- <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
1723
- <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
1724
- <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
1725
- </select>
1726
-
1727
- <span id="scheduling-delay-<?php echo $block; ?>">
1728
- for <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" size="2" maxlength="3" /> days after publishing
1729
- </span>
1730
- <span id="scheduling-delay-warning-<?php echo $block; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
1731
-
1732
- <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($block, $obj, $default); ?>
1733
- </div>
1734
-
1735
  <?php if (function_exists ('ai_adb_action')) ai_adb_action ($block, $obj, $default); ?>
1736
 
1737
  <div id="tab-general-<?php echo $block; ?>" class="rounded">
@@ -1741,10 +1754,7 @@ function generate_settings_form (){
1741
  &nbsp;
1742
  </span>
1743
  <span style="display: table-cell;">
1744
- <input style="width: 100%;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" size="8" maxlength="40" title="Used for [adinserter data=''] shortcodes when no data is found" />
1745
- </span>
1746
- <?php if (function_exists ('ai_tab_general')) ai_tab_general ($block, $obj, $default); ?>
1747
- <span style="display: table-cell; width: 300px; white-space: nowrap;">
1748
  </span>
1749
  </div>
1750
  </div>
@@ -1943,7 +1953,15 @@ function generate_settings_form (){
1943
  No paragraph counting inside
1944
  </td>
1945
  <td>
1946
- <input type="text" name="no-paragraph-counting-inside" value="<?php echo get_no_paragraph_counting_inside (); ?>" default="<?php echo DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE; ?>" size="40" maxlength="80" />
 
 
 
 
 
 
 
 
1947
  </td>
1948
  </tr>
1949
  </table>
424
 
425
  $adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING;
426
 
427
+ $display_options = $obj->get_show_label () || $obj->get_close_button ();
428
 
429
  $show_misc =
430
  $insertion_options ||
432
  $scheduling_active ||
433
  $filter_active ||
434
  $adb_block_action_active ||
435
+ $display_options;
436
 
437
  if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
438
 
441
  if ($scheduling_active) $scheduling_style = "font-weight: bold; color: #66f;"; else $scheduling_style = "";
442
  if ($filter_active) $filter_style = "font-weight: bold; color: #66f;"; else $filter_style = "";
443
  if ($adb_block_action_active) $adb_style = "font-weight: bold; color: #66f;"; else $adb_style = "";
444
+ if ($display_options) $display_style = "font-weight: bold; color: #66f;"; else $display_style = "";
445
 
446
  $automatic_insertion = $obj->get_automatic_insertion();
447
 
1608
  <div id="ai-misc-container-<?php echo $block; ?>" style="padding: 0; margin 8px 0 0 0; border: 0;">
1609
  <ul id="ai-misc-tabs-<?php echo $block; ?>" style="display: none;">
1610
  <li id="ai-misc-insertion-<?php echo $block; ?>"><a href="#tab-insertion-<?php echo $block; ?>"><span style="<?php echo $insertion_style; ?>">Insertion</span></a></li>
1611
+ <li id="ai-misc-scheduling-<?php echo $block; ?>"><a href="#tab-scheduling-<?php echo $block; ?>"><span style="<?php echo $scheduling_style; ?>">Scheduling</span></a></li>
1612
+ <li id="ai-misc-displey-<?php echo $block; ?>"><a href="#tab-display-<?php echo $block; ?>"><span style="<?php echo $display_style; ?>">Display</span></a></li>
1613
  <li id="ai-misc-word-count-<?php echo $block; ?>"><a href="#tab-word-count-<?php echo $block; ?>"><span style="<?php echo $word_count_style; ?>">Word Count</span></a></li>
1614
  <li id="ai-misc-filter-<?php echo $block; ?>"><a href="#tab-filter-<?php echo $block; ?>"><span style="<?php echo $filter_style; ?>">Filter</span></a></li>
 
1615
  <?php if (function_exists ('ai_adb_action_0')) ai_adb_action_0 ($block, $adb_style); ?>
1616
  <li id="ai-misc-general-<?php echo $block; ?>"><a href="#tab-general-<?php echo $block; ?>"><span style="<?php echo $general_style; ?>">General</span></a></li>
1617
  </ul>
1677
  </div>
1678
  </div>
1679
 
1680
+ <div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
1681
+ <select id="scheduling-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
1682
+ <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
1683
+ <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
1684
+ <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
1685
+ </select>
1686
+
1687
+ <span id="scheduling-delay-<?php echo $block; ?>">
1688
+ for <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" size="2" maxlength="3" /> days after publishing
1689
+ </span>
1690
+ <span id="scheduling-delay-warning-<?php echo $block; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; Not available</span>
1691
+
1692
+ <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($block, $obj, $default); ?>
1693
+ </div>
1694
+
1695
+ <div id="tab-display-<?php echo $block; ?>" class="rounded">
1696
+ <div class="max-input">
1697
+ <span style="display: table-cell; width: 1px; white-space: nowrap;">
1698
+ <input type="hidden" name="<?php echo AI_OPTION_SHOW_LABEL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1699
+ <input style="" id="show-label-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_SHOW_LABEL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_show_label (); ?>" <?php if ($obj->get_show_label () == AI_ENABLED) echo 'checked '; ?> />
1700
+ <label for="show-label-<?php echo $block; ?>" style="vertical-align: top;">Ad label</label>
1701
+ </span>
1702
+
1703
+ <?php if (function_exists ('ai_tab_general')) ai_tab_general ($block, $obj, $default); ?>
1704
+ </div>
1705
+ </div>
1706
+
1707
  <div id="tab-word-count-<?php echo $block; ?>" class="rounded">
1708
  Post/Static page must have between
1709
+ <input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: 0 1px;" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" title="Minimum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
1710
  and
1711
+ <input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: 0 1px;" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" title="Maximum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
1712
  words
1713
  </div>
1714
 
1745
  </div>
1746
  </div>
1747
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1748
  <?php if (function_exists ('ai_adb_action')) ai_adb_action ($block, $obj, $default); ?>
1749
 
1750
  <div id="tab-general-<?php echo $block; ?>" class="rounded">
1754
  &nbsp;
1755
  </span>
1756
  <span style="display: table-cell;">
1757
+ <input style="width: 100%; max-width: 140px;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" size="12" maxlength="40" title="Used for [adinserter data=''] shortcodes when no data is found" />
 
 
 
1758
  </span>
1759
  </div>
1760
  </div>
1953
  No paragraph counting inside
1954
  </td>
1955
  <td>
1956
+ <input type="text" name="no-paragraph-counting-inside" style="width: 100%;" value="<?php echo get_no_paragraph_counting_inside (); ?>" default="<?php echo DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE; ?>" size="60" maxlength="80" />
1957
+ </td>
1958
+ </tr>
1959
+ <tr>
1960
+ <td>
1961
+ Ad label
1962
+ </td>
1963
+ <td>
1964
+ <input type="text" name="ad-label" style="width: 100%;" value="<?php echo get_ad_label (); ?>" default="<?php echo DEFAULT_AD_TITLE; ?>" size="60" maxlength="500" />
1965
  </td>
1966
  </tr>
1967
  </table>