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

Version Description

  • Added option to disable inline alignment styles for code blocks (using alignment classes)
  • Fix for custom CSS codes with single quotation marks
Download this release

Release Info

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

Code changes from version 2.2.12 to 2.2.13

Files changed (7) hide show
  1. ad-inserter.php +29 -5
  2. class.php +13 -11
  3. constants.php +4 -1
  4. css/ad-inserter.css +1 -1
  5. js/ad-inserter.js +1 -1
  6. readme.txt +9 -1
  7. settings.php +17 -1
ad-inserter.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
- Version: 2.2.12
5
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
@@ -12,6 +12,10 @@ Plugin URI: http://adinserter.pro/documentation
12
 
13
  Change Log
14
 
 
 
 
 
15
  Ad Inserter 2.2.12 - 2017-12-25
16
  - Fix for code block styles when block class name was not set
17
 
@@ -1643,19 +1647,27 @@ function ai_replace_js_data ($js) {
1643
  $js = str_replace ('AI_NONCE', wp_create_nonce ("adinserter_data"), $js);
1644
  $js = str_replace ('AI_SITE_URL', wp_make_link_relative (get_site_url()), $js);
1645
  if (defined ('AI_STATISTICS') && AI_STATISTICS) {
 
 
1646
  $js = str_replace ('AI_TRACK_PAGEVIEWS', get_track_pageviews () == AI_TRACKING_ENABLED ? 1 : 0, $js);
1647
  $js = str_replace ('AI_ADVANCED_CLICK_DETECTION', get_click_detection () == AI_CLICK_DETECTION_ADVANCED ? 1 : 0, $js);
1648
 
1649
  if (!isset ($ai_wp_data [AI_VIEWPORTS])) {
1650
  $viewports = array ();
 
1651
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
1652
  $viewport_name = get_viewport_name ($viewport);
1653
  $viewport_width = get_viewport_width ($viewport);
1654
- if ($viewport_name != '') $viewports [$viewport] = $viewport_width;
 
 
 
1655
  }
1656
- $ai_wp_data [AI_VIEWPORTS] = $viewports;
 
1657
  }
1658
  $js = str_replace ('AI_VIEWPORTS', '[' . implode (',', $ai_wp_data [AI_VIEWPORTS]) . ']', $js);
 
1659
  }
1660
  $js = str_replace ('AI_BLOCK_CLASS_NAME', get_block_class_name () != '' ? get_block_class_name () : DEFAULT_BLOCK_CLASS_NAME, $js);
1661
 
@@ -2851,6 +2863,8 @@ function ai_check_plugin_options ($plugin_options = array ()) {
2851
 
2852
  if (!isset ($plugin_options ['BLOCK_CLASS_NAME'])) $plugin_options ['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
2853
 
 
 
2854
  if (!isset ($plugin_options ['MINIMUM_USER_ROLE'])) $plugin_options ['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2855
 
2856
  if (!isset ($plugin_options ['STICKY_WIDGET_MODE'])) $plugin_options ['STICKY_WIDGET_MODE'] = DEFAULT_STICKY_WIDGET_MODE;
@@ -3016,7 +3030,7 @@ function get_alignment_css () {
3016
  isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '020211'
3017
  ) $ai_db_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS'] = generate_alignment_css ();
3018
 
3019
- return ($ai_db_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS']);
3020
  }
3021
 
3022
  function get_syntax_highlighter_theme () {
@@ -3035,6 +3049,14 @@ function get_block_class_name () {
3035
  return ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME']);
3036
  }
3037
 
 
 
 
 
 
 
 
 
3038
  function get_minimum_user_role () {
3039
  global $ai_db_options;
3040
 
@@ -3960,7 +3982,8 @@ function generate_alignment_css () {
3960
  $alignment_name = strtolower (md5 ($custom_css));
3961
  if (in_array ($alignment_name, $alignments)) continue;
3962
  $alignments []= $alignment_name;
3963
- $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $custom_css . "}\n";
 
3964
  break;
3965
  }
3966
  }
@@ -4147,6 +4170,7 @@ function ai_settings () {
4147
 
4148
  if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
4149
  if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
 
4150
  if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
4151
  if (isset ($_POST ['sticky-widget-mode'])) $options ['STICKY_WIDGET_MODE'] = filter_option ('STICKY_WIDGET_MODE', $_POST ['sticky-widget-mode']);
4152
  if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('STICKY_WIDGET_MARGIN', $_POST ['sticky-widget-margin']);
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
+ Version: 2.2.13
5
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
12
 
13
  Change Log
14
 
15
+ Ad Inserter 2.2.13 - 2017-12-25
16
+ - Added option to disable inline alignment styles for code blocks (using alignment classes)
17
+ - Fix for custom CSS codes with single quotation marks
18
+
19
  Ad Inserter 2.2.12 - 2017-12-25
20
  - Fix for code block styles when block class name was not set
21
 
1647
  $js = str_replace ('AI_NONCE', wp_create_nonce ("adinserter_data"), $js);
1648
  $js = str_replace ('AI_SITE_URL', wp_make_link_relative (get_site_url()), $js);
1649
  if (defined ('AI_STATISTICS') && AI_STATISTICS) {
1650
+ $js = str_replace ('AI_INTERNAL_TRACKING', get_internal_tracking () == AI_ENABLED ? 1 : 0, $js);
1651
+ $js = str_replace ('AI_EXTERNAL_TRACKING', get_external_tracking () == AI_ENABLED ? 1 : 0, $js);
1652
  $js = str_replace ('AI_TRACK_PAGEVIEWS', get_track_pageviews () == AI_TRACKING_ENABLED ? 1 : 0, $js);
1653
  $js = str_replace ('AI_ADVANCED_CLICK_DETECTION', get_click_detection () == AI_CLICK_DETECTION_ADVANCED ? 1 : 0, $js);
1654
 
1655
  if (!isset ($ai_wp_data [AI_VIEWPORTS])) {
1656
  $viewports = array ();
1657
+ $viewport_names = array ();
1658
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
1659
  $viewport_name = get_viewport_name ($viewport);
1660
  $viewport_width = get_viewport_width ($viewport);
1661
+ if ($viewport_name != '') {
1662
+ $viewports [$viewport] = $viewport_width;
1663
+ $viewport_names [$viewport] = $viewport_name;
1664
+ }
1665
  }
1666
+ $ai_wp_data [AI_VIEWPORTS] = $viewports;
1667
+ $ai_wp_data [AI_VIEWPORT_NAMES] = $viewport_names;
1668
  }
1669
  $js = str_replace ('AI_VIEWPORTS', '[' . implode (',', $ai_wp_data [AI_VIEWPORTS]) . ']', $js);
1670
+ $js = str_replace ('AI_VIEWPORT_NAMES', base64_encode ('["' . implode ('","', $ai_wp_data [AI_VIEWPORT_NAMES]) . '"]'), $js);
1671
  }
1672
  $js = str_replace ('AI_BLOCK_CLASS_NAME', get_block_class_name () != '' ? get_block_class_name () : DEFAULT_BLOCK_CLASS_NAME, $js);
1673
 
2863
 
2864
  if (!isset ($plugin_options ['BLOCK_CLASS_NAME'])) $plugin_options ['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
2865
 
2866
+ if (!isset ($plugin_options ['INLINE_STYLES'])) $plugin_options ['INLINE_STYLES'] = DEFAULT_INLINE_STYLES;
2867
+
2868
  if (!isset ($plugin_options ['MINIMUM_USER_ROLE'])) $plugin_options ['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
2869
 
2870
  if (!isset ($plugin_options ['STICKY_WIDGET_MODE'])) $plugin_options ['STICKY_WIDGET_MODE'] = DEFAULT_STICKY_WIDGET_MODE;
3030
  isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] < '020211'
3031
  ) $ai_db_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS'] = generate_alignment_css ();
3032
 
3033
+ return (str_replace ('&#039;', "'", $ai_db_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS']));
3034
  }
3035
 
3036
  function get_syntax_highlighter_theme () {
3049
  return ($ai_db_options [AI_OPTION_GLOBAL]['BLOCK_CLASS_NAME']);
3050
  }
3051
 
3052
+ function get_inline_styles () {
3053
+ global $ai_db_options;
3054
+
3055
+ if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['INLINE_STYLES'])) $ai_db_options [AI_OPTION_GLOBAL]['INLINE_STYLES'] = DEFAULT_INLINE_STYLES;
3056
+
3057
+ return ($ai_db_options [AI_OPTION_GLOBAL]['INLINE_STYLES']);
3058
+ }
3059
+
3060
  function get_minimum_user_role () {
3061
  global $ai_db_options;
3062
 
3982
  $alignment_name = strtolower (md5 ($custom_css));
3983
  if (in_array ($alignment_name, $alignments)) continue;
3984
  $alignments []= $alignment_name;
3985
+ // $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . $custom_css . "}\n";
3986
+ $alignment_css .= '.' . $block_class_name . str_replace (' ', '-', $alignment_name) .' {' . str_replace ('&#039;', "'", $custom_css) . "}\n";
3987
  break;
3988
  }
3989
  }
4170
 
4171
  if (isset ($_POST ['syntax-highlighter-theme'])) $options ['SYNTAX_HIGHLIGHTER_THEME'] = filter_string ($_POST ['syntax-highlighter-theme']);
4172
  if (isset ($_POST ['block-class-name'])) $options ['BLOCK_CLASS_NAME'] = filter_html_class ($_POST ['block-class-name']);
4173
+ if (isset ($_POST ['inline-styles'])) $options ['INLINE_STYLES'] = filter_option ('INLINE_STYLES', $_POST ['inline-styles']);
4174
  if (isset ($_POST ['minimum-user-role'])) $options ['MINIMUM_USER_ROLE'] = filter_string ($_POST ['minimum-user-role']);
4175
  if (isset ($_POST ['sticky-widget-mode'])) $options ['STICKY_WIDGET_MODE'] = filter_option ('STICKY_WIDGET_MODE', $_POST ['sticky-widget-mode']);
4176
  if (isset ($_POST ['sticky-widget-margin'])) $options ['STICKY_WIDGET_MARGIN'] = filter_option ('STICKY_WIDGET_MARGIN', $_POST ['sticky-widget-margin']);
class.php CHANGED
@@ -1177,7 +1177,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1177
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
1178
  $this->code_version = '""';
1179
 
1180
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1181
  $processed_code = "\n<div class='ai-rotate'>\n";
1182
  } else
1183
  $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n";
@@ -1194,13 +1194,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1194
 
1195
  switch ($index) {
1196
  case 0:
1197
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1198
  $processed_code .= "<div class='ai-rotate-option'".$version_name_data.">\n".trim ($ad, "\n")."\n</div>\n";
1199
  } else
1200
  $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.">\n".trim ($ad, "\n")."\n</div>\n";
1201
  break;
1202
  default:
1203
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1204
  $processed_code .= "<div class='ai-rotate-option ai-rotate-options'".$version_name_data.">".trim ($ad, "\n")."\n</div>\n";
1205
  } else
1206
  $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.">".trim ($ad, "\n")."\n</div>\n";
@@ -1279,7 +1279,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1279
  $this->client_side_ip_address_detection = true;
1280
  $this->needs_class = true;
1281
 
1282
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1283
  $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes class-name='$block_class_name'>$processed_code</div>\n";
1284
  } else $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes class-name='$block_class_name' style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
1285
  }
@@ -1366,7 +1366,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1366
  if ($this->get_detection_viewport ($viewport))
1367
  $visible_viewports .= '<section class="ai-viewport-' . $viewport .'"><section class="ai-debug-bar '.$this->color_class.'"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section></section>'; else
1368
  if (!$ai_wp_data [AI_WP_AMP_PAGE]) {
1369
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1370
  $hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible '.$alignment_class.'"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
1371
  } else $hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible" style="' . $this->get_alignment_style() . '"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
1372
  }
@@ -1398,7 +1398,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1398
  if ($hidden_widgets) return $hidden_viewports; else {
1399
  if ($this->client_side_ip_address_detection && !$ai_wp_data [AI_WP_AMP_PAGE]) {
1400
  $additional_block_style = 'visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999; ';
1401
- if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES) {
1402
  $classes [] = 'ai-ip-data-block';
1403
  }
1404
  } else {
@@ -1409,7 +1409,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1409
  if (trim ($class_name) == '') unset ($classes [$index]);
1410
  }
1411
  // $class = " class='" . str_replace (' ', ' ', implode (' ', $classes)) . "'";
1412
- $class = " class='" . implode (' ', $classes) . "'";
 
 
1413
 
1414
  $tracking_code_pre = '';
1415
  $tracking_code_data = '';
@@ -1419,7 +1421,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1419
  if ($this->fallback != 0) {
1420
  if ($block_object [$this->fallback]->get_tracking ()) {
1421
  $tracking_code_pre = " data-ai='";
1422
- $tracking_code_data = "[{$this->fallback},{$this->code_version}]";
1423
  $tracking_code_post = "'";
1424
 
1425
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
@@ -1427,14 +1429,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1427
  } else {
1428
  if ($this->get_tracking ()) {
1429
  $tracking_code_pre = " data-ai='";
1430
- $tracking_code_data = "[{$this->number},{$this->code_version}]";
1431
  $tracking_code_post = "'";
1432
 
1433
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
1434
  }
1435
  }
1436
 
1437
- if ($alignment_class != '') {
1438
  $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . ">\n";
1439
  } else {
1440
  $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
@@ -1725,7 +1727,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1725
  // if (defined ('AI_AMP_HEADER_STYLES') && AI_AMP_HEADER_STYLES && $ai_wp_data [AI_WP_AMP_PAGE]) {
1726
 
1727
  if (defined ('AI_AMP_HEADER_STYLES') && AI_AMP_HEADER_STYLES && $ai_wp_data [AI_WP_AMP_PAGE] ||
1728
- defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !$ai_wp_data [AI_WP_AMP_PAGE]) {
1729
 
1730
  $block_class_name = get_block_class_name ();
1731
  if ($block_class_name == '') $block_class_name = DEFAULT_BLOCK_CLASS_NAME . '-'; else $block_class_name .= '-';
1177
  case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
1178
  $this->code_version = '""';
1179
 
1180
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1181
  $processed_code = "\n<div class='ai-rotate'>\n";
1182
  } else
1183
  $processed_code = "\n<div class='ai-rotate' style='position: relative;'>\n";
1194
 
1195
  switch ($index) {
1196
  case 0:
1197
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1198
  $processed_code .= "<div class='ai-rotate-option'".$version_name_data.">\n".trim ($ad, "\n")."\n</div>\n";
1199
  } else
1200
  $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.">\n".trim ($ad, "\n")."\n</div>\n";
1201
  break;
1202
  default:
1203
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1204
  $processed_code .= "<div class='ai-rotate-option ai-rotate-options'".$version_name_data.">".trim ($ad, "\n")."\n</div>\n";
1205
  } else
1206
  $processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.">".trim ($ad, "\n")."\n</div>\n";
1279
  $this->client_side_ip_address_detection = true;
1280
  $this->needs_class = true;
1281
 
1282
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1283
  $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes class-name='$block_class_name'>$processed_code</div>\n";
1284
  } else $processed_code = "\n<div class='ai-ip-data' $ip_address_attributes $country_attributes class-name='$block_class_name' style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
1285
  }
1366
  if ($this->get_detection_viewport ($viewport))
1367
  $visible_viewports .= '<section class="ai-viewport-' . $viewport .'"><section class="ai-debug-bar '.$this->color_class.'"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section></section>'; else
1368
  if (!$ai_wp_data [AI_WP_AMP_PAGE]) {
1369
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1370
  $hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible '.$alignment_class.'"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
1371
  } else $hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible" style="' . $this->get_alignment_style() . '"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a>&nbsp;'.$viewport_name.'&nbsp;</a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
1372
  }
1398
  if ($hidden_widgets) return $hidden_viewports; else {
1399
  if ($this->client_side_ip_address_detection && !$ai_wp_data [AI_WP_AMP_PAGE]) {
1400
  $additional_block_style = 'visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999; ';
1401
+ if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1402
  $classes [] = 'ai-ip-data-block';
1403
  }
1404
  } else {
1409
  if (trim ($class_name) == '') unset ($classes [$index]);
1410
  }
1411
  // $class = " class='" . str_replace (' ', ' ', implode (' ', $classes)) . "'";
1412
+ if (count ($classes) != 0) {
1413
+ $class = " class='" . implode (' ', $classes) . "'";
1414
+ } else $class = "";
1415
 
1416
  $tracking_code_pre = '';
1417
  $tracking_code_data = '';
1421
  if ($this->fallback != 0) {
1422
  if ($block_object [$this->fallback]->get_tracking ()) {
1423
  $tracking_code_pre = " data-ai='";
1424
+ $tracking_code_data = "[{$this->fallback},{$this->code_version},\"{$block_object [$this->fallback]->get_ad_name ()}\",\"{$this->version_name}\"]";
1425
  $tracking_code_post = "'";
1426
 
1427
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
1429
  } else {
1430
  if ($this->get_tracking ()) {
1431
  $tracking_code_pre = " data-ai='";
1432
+ $tracking_code_data = "[{$this->number},{$this->code_version},\"{$this->get_ad_name ()}\",\"{$this->version_name}\"]";
1433
  $tracking_code_post = "'";
1434
 
1435
  $tracking_code = $tracking_code_pre . base64_encode ($tracking_code_data) . $tracking_code_post;
1436
  }
1437
  }
1438
 
1439
+ if ($alignment_class != '' && defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
1440
  $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . ">\n";
1441
  } else {
1442
  $wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
1727
  // if (defined ('AI_AMP_HEADER_STYLES') && AI_AMP_HEADER_STYLES && $ai_wp_data [AI_WP_AMP_PAGE]) {
1728
 
1729
  if (defined ('AI_AMP_HEADER_STYLES') && AI_AMP_HEADER_STYLES && $ai_wp_data [AI_WP_AMP_PAGE] ||
1730
+ defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !$ai_wp_data [AI_WP_AMP_PAGE] && !get_inline_styles ()) {
1731
 
1732
  $block_class_name = get_block_class_name ();
1733
  if ($block_class_name == '') $block_class_name = DEFAULT_BLOCK_CLASS_NAME . '-'; else $block_class_name .= '-';
constants.php CHANGED
@@ -20,7 +20,7 @@ if (!defined( 'AD_INSERTER_NAME'))
20
  define ('AD_INSERTER_NAME', 'Ad Inserter');
21
 
22
  if (!defined( 'AD_INSERTER_VERSION'))
23
- define ('AD_INSERTER_VERSION', '2.2.12');
24
 
25
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
26
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -266,6 +266,7 @@ define('AI_ALIGNMENT_STICKY_RIGHT', 9);
266
  define('AI_ALIGNMENT_STICKY_TOP', 10);
267
  define('AI_ALIGNMENT_STICKY_BOTTOM', 11);
268
 
 
269
  define('AI_TEXT_DEFAULT', 'Default');
270
  define('AI_TEXT_LEFT', 'Align Left');
271
  define('AI_TEXT_RIGHT', 'Align Right');
@@ -458,6 +459,7 @@ define ('AI_TRANSIENT_ADB_FILES_VERSION', 'ai-adb-version');
458
  define ('AI_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
459
  define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', AI_SYNTAX_HIGHLIGHTER_THEME);
460
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
 
461
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
462
  define ('DEFAULT_STICKY_WIDGET_MODE', AI_STICKY_WIDGET_MODE_CSS);
463
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
@@ -635,6 +637,7 @@ define ('AI_VIEWPORTS', 20);
635
  define ('AI_WORD_COUNT', 21);
636
  define ('AI_ADB_SHORTCODE_ACTION', 22);
637
  define ('AI_SHORTCODES', 23);
 
638
 
639
  define ('AI_CONTEXT_NONE', 0);
640
  define ('AI_CONTEXT_CONTENT', 1);
20
  define ('AD_INSERTER_NAME', 'Ad Inserter');
21
 
22
  if (!defined( 'AD_INSERTER_VERSION'))
23
+ define ('AD_INSERTER_VERSION', '2.2.13');
24
 
25
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
26
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
266
  define('AI_ALIGNMENT_STICKY_TOP', 10);
267
  define('AI_ALIGNMENT_STICKY_BOTTOM', 11);
268
 
269
+ // Used also for alignment class names
270
  define('AI_TEXT_DEFAULT', 'Default');
271
  define('AI_TEXT_LEFT', 'Align Left');
272
  define('AI_TEXT_RIGHT', 'Align Right');
459
  define ('AI_SYNTAX_HIGHLIGHTER_THEME', 'ad_inserter');
460
  define ('DEFAULT_SYNTAX_HIGHLIGHTER_THEME', AI_SYNTAX_HIGHLIGHTER_THEME);
461
  define ('DEFAULT_BLOCK_CLASS_NAME', 'code-block');
462
+ define ('DEFAULT_INLINE_STYLES', AI_ENABLED);
463
  define ('DEFAULT_MINIMUM_USER_ROLE', 'administrator');
464
  define ('DEFAULT_STICKY_WIDGET_MODE', AI_STICKY_WIDGET_MODE_CSS);
465
  define ('DEFAULT_STICKY_WIDGET_MARGIN', 15);
637
  define ('AI_WORD_COUNT', 21);
638
  define ('AI_ADB_SHORTCODE_ACTION', 22);
639
  define ('AI_SHORTCODES', 23);
640
+ define ('AI_VIEWPORT_NAMES', 24);
641
 
642
  define ('AI_CONTEXT_NONE', 0);
643
  define ('AI_CONTEXT_CONTENT', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.2.12"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.2.13"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.2.12";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1
+ var javascript_version = "2.2.13";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad management, advertising manager, advanced contextual ads,
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.2.4
9
- Stable tag: 2.2.11
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
@@ -756,6 +756,10 @@ AD CODE RIGHT
756
 
757
  == Changelog ==
758
 
 
 
 
 
759
  = 2.2.12 =
760
  - Fix for code block styles when block class name was not set
761
 
@@ -919,6 +923,10 @@ AD CODE RIGHT
919
 
920
  == Upgrade Notice ==
921
 
 
 
 
 
922
  = 2.2.12 =
923
  Fix for code block styles when block class name was not set
924
 
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.2.4
9
+ Stable tag: 2.2.12
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
756
 
757
  == Changelog ==
758
 
759
+ = 2.2.13 =
760
+ - Added option to disable inline alignment styles for code blocks (using alignment classes)
761
+ - Fix for custom CSS codes with single quotation marks
762
+
763
  = 2.2.12 =
764
  - Fix for code block styles when block class name was not set
765
 
923
 
924
  == Upgrade Notice ==
925
 
926
+ = 2.2.13 =
927
+ Added option to disable inline alignment styles for code blocks (using alignment classes);
928
+ Fix for custom CSS codes with single quotation marks
929
+
930
  = 2.2.12 =
931
  Fix for code block styles when block class name was not set
932
 
settings.php CHANGED
@@ -55,6 +55,7 @@ function generate_settings_form (){
55
 
56
  $syntax_highlighter_theme = get_syntax_highlighter_theme ();
57
  $block_class_name = get_block_class_name ();
 
58
 
59
  $default = $block_object [0];
60
 
@@ -785,7 +786,7 @@ function generate_settings_form (){
785
  <div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
786
  <div class="max-input">
787
  <span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
788
- <input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
789
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
790
  <span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
791
  <span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
@@ -1606,6 +1607,21 @@ function generate_settings_form (){
1606
  <input style="margin-left: 0px;" title="CSS Class Name for the wrapping div" type="text" id="block-class-name" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="15" maxlength="40" />
1607
  </td>
1608
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1609
  <tr>
1610
  <td>
1611
  Min. user role for ind. exceptions editing
55
 
56
  $syntax_highlighter_theme = get_syntax_highlighter_theme ();
57
  $block_class_name = get_block_class_name ();
58
+ $inline_styles = get_inline_styles ();
59
 
60
  $default = $block_object [0];
61
 
786
  <div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
787
  <div class="max-input">
788
  <span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
789
+ <input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="200" title="Custom CSS code for wrapping div" />
790
  <span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
791
  <span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
792
  <span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
1607
  <input style="margin-left: 0px;" title="CSS Class Name for the wrapping div" type="text" id="block-class-name" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="15" maxlength="40" />
1608
  </td>
1609
  </tr>
1610
+ <tr>
1611
+ <td>
1612
+ Inline styles
1613
+ </td>
1614
+ <td>
1615
+ <select
1616
+ id="inline-styles"
1617
+ name="inline-styles"
1618
+ title="Instead of alignment classes generate inline alignment styles for code blocks"
1619
+ default="<?php echo DEFAULT_INLINE_STYLES; ?>">
1620
+ <option value="<?php echo AI_DISABLED; ?>" <?php echo ($inline_styles == AI_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
1621
+ <option value="<?php echo AI_ENABLED; ?>" <?php echo ($inline_styles == AI_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
1622
+ </select>
1623
+ </td>
1624
+ </tr>
1625
  <tr>
1626
  <td>
1627
  Min. user role for ind. exceptions editing