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

Version Description

  • Bug fix: Shortcodes called by name were not displayed
Download this release

Release Info

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

Code changes from version 2.0.0 to 2.0.1

Files changed (5) hide show
  1. ad-inserter.php +14 -8
  2. constants.php +2 -1
  3. js/ad-inserter.js +1 -1
  4. readme.txt +12 -4
  5. settings.php +10 -12
ad-inserter.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
- Version: 2.0.0
5
  Description: Insert any ad or code into Wordpress. Perfect for all kinds of ads. Simply enter any ad or HTML/Javascript/PHP code and select where and how you want to display it.
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
@@ -11,6 +11,9 @@ Plugin URI: http://tinymonitor.com/ad-inserter
11
  /*
12
  Change Log
13
 
 
 
 
14
  Ad Inserter 2.0.0 - 23 September 2016
15
  - Redesigned user interface
16
  - Added many debugging tools for easier troubleshooting
@@ -590,6 +593,7 @@ function ai_log_block_status ($block, $ai_last_check) {
590
  case AI_CHECK_DO_NOT_INSERT: $status .= "PARAGRAPH CLEARANCE"; break;
591
  case AI_CHECK_AD_ABOVE: $status .= "PARAGRAPH CLEARANCE ABOVE"; break;
592
  case AI_CHECK_AD_BELOW: $status .= "PARAGRAPH CLEARANCE BELOW"; break;
 
593
 
594
  case AI_CHECK_ENABLED: $status .= "ENABLED"; break;
595
  case AI_CHECK_NONE: $status = "BLOCK $block"; break;
@@ -2342,9 +2346,9 @@ function process_shortcode (&$block, $atts) {
2342
  "ignore" => "",
2343
  ), $atts);
2344
 
2345
- if (is_numeric ($parameters ['block'])) $block = intval ($parameters ['block']); else $block = 0;
2346
- if ($block < 1 || $block > AD_INSERTER_BLOCKS) {
2347
- $block = 0;
2348
  } elseif ($parameters ['name'] != '') {
2349
  $shortcode_name = strtolower ($parameters ['name']);
2350
  for ($counter = 1; $counter <= AD_INSERTER_BLOCKS; $counter ++) {
@@ -2357,9 +2361,10 @@ function process_shortcode (&$block, $atts) {
2357
  }
2358
  }
2359
 
2360
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("SHORTCODE $block");
 
2361
 
2362
- if ($block == 0) return "";
2363
 
2364
  // IGNORE SETTINGS
2365
  // page_type
@@ -2396,11 +2401,12 @@ function process_shortcodes ($atts) {
2396
  global $ai_last_check, $ai_wp_data;
2397
 
2398
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
 
2399
  $ai_last_check = AI_CHECK_NONE;
2400
- $block = 0;
2401
  $shortcode = process_shortcode ($block, $atts);
2402
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($block, $ai_last_check));
2403
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("SHORTCODE END\n");
2404
  return $shortcode;
2405
  }
2406
 
1
  <?php
2
  /*
3
  Plugin Name: Ad Inserter
4
+ Version: 2.0.1
5
  Description: Insert any ad or code into Wordpress. Perfect for all kinds of ads. Simply enter any ad or HTML/Javascript/PHP code and select where and how you want to display it.
6
  Author: Igor Funa
7
  Author URI: http://igorfuna.com/
11
  /*
12
  Change Log
13
 
14
+ Ad Inserter 2.0.1 - 24 September 2016
15
+ - Bug fix: Shortcodes called by name were not displayed
16
+
17
  Ad Inserter 2.0.0 - 23 September 2016
18
  - Redesigned user interface
19
  - Added many debugging tools for easier troubleshooting
593
  case AI_CHECK_DO_NOT_INSERT: $status .= "PARAGRAPH CLEARANCE"; break;
594
  case AI_CHECK_AD_ABOVE: $status .= "PARAGRAPH CLEARANCE ABOVE"; break;
595
  case AI_CHECK_AD_BELOW: $status .= "PARAGRAPH CLEARANCE BELOW"; break;
596
+ case AI_CHECK_SHORTCODE_ATTRIBUTES: $status .= "SHORTCODE ATTRIBUTES"; break;
597
 
598
  case AI_CHECK_ENABLED: $status .= "ENABLED"; break;
599
  case AI_CHECK_NONE: $status = "BLOCK $block"; break;
2346
  "ignore" => "",
2347
  ), $atts);
2348
 
2349
+ $block = - 1;
2350
+ if (is_numeric ($parameters ['block'])) {
2351
+ $block = intval ($parameters ['block']);
2352
  } elseif ($parameters ['name'] != '') {
2353
  $shortcode_name = strtolower ($parameters ['name']);
2354
  for ($counter = 1; $counter <= AD_INSERTER_BLOCKS; $counter ++) {
2361
  }
2362
  }
2363
 
2364
+ $ai_last_check = AI_CHECK_SHORTCODE_ATTRIBUTES;
2365
+ if ($block < 1 || $block > AD_INSERTER_BLOCKS) return "";
2366
 
2367
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("SHORTCODE $block (".($parameters ['block'] != '' ? 'block="'.$parameters ['block'].'"' : '').($parameters ['name'] != '' ? 'name="'.$parameters ['name'].'"' : '').")");
2368
 
2369
  // IGNORE SETTINGS
2370
  // page_type
2401
  global $ai_last_check, $ai_wp_data;
2402
 
2403
  $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
2404
+ if ($debug_processing) ai_log ("PROCESS SHORTCODES ".serialize ($atts));
2405
  $ai_last_check = AI_CHECK_NONE;
2406
+ $block = - 1;
2407
  $shortcode = process_shortcode ($block, $atts);
2408
  if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($block, $ai_last_check));
2409
+ if ($debug_processing) ai_log ("SHORTCODE END\n");
2410
  return $shortcode;
2411
  }
2412
 
constants.php CHANGED
@@ -11,7 +11,7 @@ if (!defined( 'AD_INSERTER_NAME'))
11
  define ('AD_INSERTER_NAME', 'Ad Inserter');
12
 
13
  if (!defined( 'AD_INSERTER_VERSION'))
14
- define ('AD_INSERTER_VERSION', '2.0.0');
15
 
16
  if (!defined ('AD_INSERTER_BLOCKS'))
17
  define ('AD_INSERTER_BLOCKS', 16);
@@ -305,6 +305,7 @@ define ('AI_CHECK_URL_PARAMETER', 41);
305
  define ('AI_CHECK_DO_NOT_INSERT', 42);
306
  define ('AI_CHECK_AD_ABOVE', 43);
307
  define ('AI_CHECK_AD_BELOW', 44);
 
308
 
309
  define ('AI_PT_NONE', - 1);
310
  define ('AI_PT_ANY', 0);
11
  define ('AD_INSERTER_NAME', 'Ad Inserter');
12
 
13
  if (!defined( 'AD_INSERTER_VERSION'))
14
+ define ('AD_INSERTER_VERSION', '2.0.1');
15
 
16
  if (!defined ('AD_INSERTER_BLOCKS'))
17
  define ('AD_INSERTER_BLOCKS', 16);
305
  define ('AI_CHECK_DO_NOT_INSERT', 42);
306
  define ('AI_CHECK_AD_ABOVE', 43);
307
  define ('AI_CHECK_AD_BELOW', 44);
308
+ define ('AI_CHECK_SHORTCODE_ATTRIBUTES', 45);
309
 
310
  define ('AI_PT_NONE', - 1);
311
  define ('AI_PT_ANY', 0);
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.0.0";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1
+ var javascript_version = "2.0.1";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: adsense, amazon, clickbank, cj, ad, ads, html, javascript, php, code, widget, sidebar, responsive, viewport, rotating, banner, banner rotation, multisite, contextual, shortcodes, widgets, header, footer, users, logged in, not logged in, mobile, desktop, phone, tablet, custom css, category, tag, filter, url, skip
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
- Stable tag: 1.7.0
8
  License: GPLv3
9
 
10
  Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
@@ -158,7 +158,7 @@ If more than one text is defined (comma separated) and "contain" is selected the
158
  Paragraphs are not counted inside `<blockquote>` elements. Of course, there is an option to enable counting also inside `<blockquote>`.
159
 
160
  **Please Note** Paragraph processing works on **every** post or page according to settings. Therefore, if you enable display also on blog pages (home, category, archive, search pages) and your theme does not display post excerpts but complete posts,
161
- Ad Inserter will by default insert code blocks into ALL posts on the blog page (according to settings). To enable insertion only into specific post(s) on blog pages define Filter. You can also leave Filter (click Misc button) to 0 (means all posts on the blog page) and define maximum number of insertions.
162
 
163
  You can also define paragraph HTML tags. Normally only `<p>` tags are used. If your post contains also `<div>` or header tags, you can define comma separated list of tags used to count paragraphs (e.g. **p, div, h2, h3**).
164
 
@@ -173,13 +173,15 @@ You can define parameters to avoid insertion at paragraph positions where above
173
 
174
  You can define in how many paragraphs above and below should specified text be avoided. And if the text is found you can choose to either skip insertion or try to shift insertion position up or down up to the specified number of paragraphs.
175
 
176
- Display only for posts published after N days checks the date when the post was published.
177
-
178
  On every post/page there is a toolbar on the top. Ad Inserter menu item has few functions to visualize tags and positions for automatic insertion:
179
 
180
  * Show HTML tags: visualizes HTML tags
181
  * Show positions: shows available positions for automatic insertion. It uses paragraph tags for blocks configured for After or Before paragraph.
182
 
 
 
 
 
183
  Additional Options for code blocks:
184
 
185
  PHP processing: Enabled or Disabled - Enable processing of PHP code. If there is a non-fatal error in the PHP code, it will not break the website.
@@ -764,6 +766,9 @@ AD CODE RIGHT
764
 
765
  == Changelog ==
766
 
 
 
 
767
  = 2.0.0 =
768
  - Redesigned user interface
769
  - Added many debugging tools for easier troubleshooting
@@ -999,6 +1004,9 @@ AD CODE RIGHT
999
 
1000
  == Upgrade Notice ==
1001
 
 
 
 
1002
  = 2.0.0 =
1003
  Redesigned user interface;
1004
  Added many debugging tools for easier troubleshooting;
4
  Tags: adsense, amazon, clickbank, cj, ad, ads, html, javascript, php, code, widget, sidebar, responsive, viewport, rotating, banner, banner rotation, multisite, contextual, shortcodes, widgets, header, footer, users, logged in, not logged in, mobile, desktop, phone, tablet, custom css, category, tag, filter, url, skip
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
+ Stable tag: 2.0.0
8
  License: GPLv3
9
 
10
  Insert any ad or HTML/Javascript/PHP code into Wordpress. Perfect for all kinds of ads. 16 code blocks, many display options and features.
158
  Paragraphs are not counted inside `<blockquote>` elements. Of course, there is an option to enable counting also inside `<blockquote>`.
159
 
160
  **Please Note** Paragraph processing works on **every** post or page according to settings. Therefore, if you enable display also on blog pages (home, category, archive, search pages) and your theme does not display post excerpts but complete posts,
161
+ Ad Inserter will by default insert code blocks into ALL posts on the blog page (according to settings). To enable insertion only into specific post(s) on blog pages define Filter. You can also leave Filter (click Misc button) empty (means all posts on the blog page) and define maximum number of insertions.
162
 
163
  You can also define paragraph HTML tags. Normally only `<p>` tags are used. If your post contains also `<div>` or header tags, you can define comma separated list of tags used to count paragraphs (e.g. **p, div, h2, h3**).
164
 
173
 
174
  You can define in how many paragraphs above and below should specified text be avoided. And if the text is found you can choose to either skip insertion or try to shift insertion position up or down up to the specified number of paragraphs.
175
 
 
 
176
  On every post/page there is a toolbar on the top. Ad Inserter menu item has few functions to visualize tags and positions for automatic insertion:
177
 
178
  * Show HTML tags: visualizes HTML tags
179
  * Show positions: shows available positions for automatic insertion. It uses paragraph tags for blocks configured for After or Before paragraph.
180
 
181
+ **Additional Post/Static Page Options**
182
+
183
+ You can define post/page minimum and maximum word length. Display after N days checks the date when the post was published and delays publishing.
184
+
185
  Additional Options for code blocks:
186
 
187
  PHP processing: Enabled or Disabled - Enable processing of PHP code. If there is a non-fatal error in the PHP code, it will not break the website.
766
 
767
  == Changelog ==
768
 
769
+ = 2.0.1 =
770
+ - Bug fix: Shortcodes called by name were not displayed
771
+
772
  = 2.0.0 =
773
  - Redesigned user interface
774
  - Added many debugging tools for easier troubleshooting
1004
 
1005
  == Upgrade Notice ==
1006
 
1007
+ = 2.0.1 =
1008
+ Bug fix: Shortcodes called by name were not displayed
1009
+
1010
  = 2.0.0 =
1011
  Redesigned user interface;
1012
  Added many debugging tools for easier troubleshooting;
settings.php CHANGED
@@ -63,23 +63,21 @@ function generate_settings_form (){
63
  </div>
64
 
65
  <div id="javascript-warning" class="ai-form" style="width: 735px; padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; display: none;">
 
66
  <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
67
- Incompatible javscript file loaded, probably due to caching. Please try to delete
68
- </div>
69
- <div style="float: right; text-align: right; margin: 0px 18px 0px 0;">
70
  browser's cache and reload this page to see if this warning will disappear.
71
  </div>
72
- <h2 id="javascript-version" style="color: red;" title="Plugin javascript version">&nbsp;</h2>
73
  </div>
74
 
75
- <div id="blocked-warning" class="ai-form warning-enabled" style="width: 735px; padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
 
76
  <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
77
- This page was not loaded properly. Please check browser and plugins that may block this page.
78
- </div>
79
- <div style="float: right; text-align: right; margin: 0px 18px 0px 0;">
80
  If you are using <strong>Ad Blocker</strong> please select "Disable on this page" or "Don't run on this page".
81
  </div>
82
- <h2 style="color: red;" title="Error loading page">PAGE BLOCKED</h2>
83
  </div>
84
 
85
  <?php
@@ -781,9 +779,9 @@ function generate_settings_form (){
781
  Shortcode
782
  </label>
783
  </td>
784
- <td class="select">
785
- <pre style= "margin: 0; display: inline; color: blue; font-size: 11px;">[adinserter block="<?php echo $ad_number; ?>"]</pre>
786
- or <pre style= "margin: 0; display: inline; color: blue;">[adinserter name="<?php echo $obj->get_ad_name(); ?>"]</pre>
787
  </td>
788
  </tr>
789
  <tr>
63
  </div>
64
 
65
  <div id="javascript-warning" class="ai-form" style="width: 735px; padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px; display: none;">
66
+ <h2 id="javascript-version" style="float: left; color: red;" title="Plugin javascript version">&nbsp;</h2>
67
  <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
68
+ Incompatible javscript file loaded, probably due to caching. Please try to delete<br />
 
 
69
  browser's cache and reload this page to see if this warning will disappear.
70
  </div>
71
+ <div style="clear: both;"></div>
72
  </div>
73
 
74
+ <div id="blocked-warning" class="ai-form warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
75
+ <h2 style="float: left; color: red;" title="Error loading page">PAGE BLOCKED</h2>
76
  <div style="float: right; text-align: right; margin: 8px 18px 0px 0;">
77
+ This page was not loaded properly. Please check browser and plugins that may block this page.<br />
 
 
78
  If you are using <strong>Ad Blocker</strong> please select "Disable on this page" or "Don't run on this page".
79
  </div>
80
+ <div style="clear: both;"></div>
81
  </div>
82
 
83
  <?php
779
  Shortcode
780
  </label>
781
  </td>
782
+ <td>
783
+ <pre class="select" style="margin: 0; display: inline; color: blue; font-size: 11px;">[adinserter block="<?php echo $ad_number; ?>"]</pre>
784
+ or <pre class="select" style="margin: 0; display: inline; color: blue;">[adinserter name="<?php echo $obj->get_ad_name(); ?>"]</pre>
785
  </td>
786
  </tr>
787
  <tr>