Ad Injection - Version 0.9.7.9

Version Description

  • Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
  • New option to randomly pick again from pool for each random ad position.
  • Modify default list of search referrers to remove /search/. Could cause problem with Google Webmaster Tools.
  • Revert a change which unconditionally printed a debug message in hook after receiving report of a problem with it.
Download this release

Release Info

Developer reviewmylife
Plugin Icon wp plugin Ad Injection
Version 0.9.7.9
Comparing to
See all releases

Code changes from version 0.9.7.8 to 0.9.7.9

Files changed (4) hide show
  1. ad-injection-admin.php +8 -2
  2. ad-injection.php +12 -3
  3. readme.txt +24 -6
  4. ui-tab-adrotation.php +13 -0
ad-injection-admin.php CHANGED
@@ -333,7 +333,7 @@ function adinj_top_message_box(){
333
 
334
  } else if (!isset($_GET['tab'])){
335
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
336
- echo "6th May 2011: Fix bug that prevented ads appearing on archive/home pages when used with certain plugins/themes. Please contact me ASAP if you spot any bugs, or odd behaviour via the ".'<a href="'.adinj_feedback_url().'" target="_new">quick feedback form</a>.';
337
  echo '</strong></p></div>';
338
  }
339
  }
@@ -1103,6 +1103,10 @@ function adinj_upgrade_db(){
1103
  }
1104
  }
1105
 
 
 
 
 
1106
  // 3. Bump up db version number.
1107
  $new_options['db_version'] = $new_dbversion;
1108
 
@@ -1168,6 +1172,8 @@ function adinj_default_options(){
1168
  'rnd_padding_top' => 'd',
1169
  'rnd_padding_bottom' => 'd',
1170
  'start_from_paragraph' => 'd',
 
 
1171
  'multiple_ads_at_same_position' => '',
1172
  'random_category_condition_mode' => 'o',
1173
  'random_category_condition_entries' => '',
@@ -1355,7 +1361,7 @@ function adinj_default_options(){
1355
  // dynamic features
1356
  'ad_insertion_mode' => 'mfunc',
1357
  'sevisitors_only' => 'off',
1358
- 'ad_referrers' => '.google., .bing., .yahoo., .ask., search?, search., /search/',
1359
  'block_keywords' => 'off', //TODO change to blocked referrers?
1360
  'blocked_keywords' => '', //TODO
1361
  'block_ips' => 'off',
333
 
334
  } else if (!isset($_GET['tab'])){
335
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
336
+ echo "20th May 2011: Two new options for ad placement (exclude random ad from bottom, and re-pick random ad for each position). See the misc options on the ad rotation tab. Please contact me ASAP if you spot any bugs, or odd behaviour via the ".'<a href="'.adinj_feedback_url().'" target="_new">quick feedback form</a>.';
337
  echo '</strong></p></div>';
338
  }
339
  }
1103
  }
1104
  }
1105
 
1106
+ if ($stored_dbversion < 11){
1107
+ $new_options['rnd_allow_ads_on_last_paragraph'] = 'on';
1108
+ }
1109
+
1110
  // 3. Bump up db version number.
1111
  $new_options['db_version'] = $new_dbversion;
1112
 
1172
  'rnd_padding_top' => 'd',
1173
  'rnd_padding_bottom' => 'd',
1174
  'start_from_paragraph' => 'd',
1175
+ 'rnd_allow_ads_on_last_paragraph' => '',
1176
+ 'rnd_reselect_ad_per_position_in_post' => '',
1177
  'multiple_ads_at_same_position' => '',
1178
  'random_category_condition_mode' => 'o',
1179
  'random_category_condition_entries' => '',
1361
  // dynamic features
1362
  'ad_insertion_mode' => 'mfunc',
1363
  'sevisitors_only' => 'off',
1364
+ 'ad_referrers' => '.google., .bing., .yahoo., .ask., search?, search.',
1365
  'block_keywords' => 'off', //TODO change to blocked referrers?
1366
  'blocked_keywords' => '', //TODO
1367
  'block_ips' => 'off',
ad-injection.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
- Version: 0.9.7.8
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -27,7 +27,8 @@ define('ADINJ_NO_CONFIG_FILE', 1);
27
  // 8 = ui options for new layout
28
  // 9 = replace the two direct modes with 'direct'
29
  // 10 = exclusion tick boxes for top, random, bottom, and new footer ad
30
- define('ADINJ_DB_VERSION', 10);
 
31
 
32
  // Files
33
  // TODO will these paths work on windows?
@@ -605,7 +606,7 @@ function adinj_content_hook($content){
605
  return $content;
606
  }
607
  $debug_on = $ops['debug_mode'];
608
- echo "<!--adinj-->";
609
 
610
  adinj_upgrade_db_if_necessary();
611
 
@@ -732,6 +733,10 @@ function adinj_content_hook($content){
732
  return adinj($content, "Error: no potential inj positions");
733
  }
734
 
 
 
 
 
735
  $inj_positions = array();
736
 
737
  $startparagraph = adinj_paragraph_to_start_ads();
@@ -789,6 +794,10 @@ function adinj_content_hook($content){
789
  $content = substr_replace($content, $ad, $inj_positions[$adnum], 0);
790
  ++$adinj_total_random_ads_used;
791
  ++$adinj_total_all_ads_used;
 
 
 
 
792
  }
793
 
794
  return adinj($content_adfree_header.$content.$content_adfree_footer, "Ads injected: " . $debug);
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
+ Version: 0.9.7.9
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
27
  // 8 = ui options for new layout
28
  // 9 = replace the two direct modes with 'direct'
29
  // 10 = exclusion tick boxes for top, random, bottom, and new footer ad
30
+ // 11 = options to disable rnd ad at bottom, and to get new ad for each rnd slot
31
+ define('ADINJ_DB_VERSION', 11);
32
 
33
  // Files
34
  // TODO will these paths work on windows?
606
  return $content;
607
  }
608
  $debug_on = $ops['debug_mode'];
609
+ if ($debug_on) echo "<!--adinj-->"; //TODO remove?
610
 
611
  adinj_upgrade_db_if_necessary();
612
 
733
  return adinj($content, "Error: no potential inj positions");
734
  }
735
 
736
+ if (!adinj_ticked('rnd_allow_ads_on_last_paragraph')){
737
+ array_pop($potential_inj_positions);
738
+ }
739
+
740
  $inj_positions = array();
741
 
742
  $startparagraph = adinj_paragraph_to_start_ads();
794
  $content = substr_replace($content, $ad, $inj_positions[$adnum], 0);
795
  ++$adinj_total_random_ads_used;
796
  ++$adinj_total_all_ads_used;
797
+
798
+ if (adinj_ticked('rnd_reselect_ad_per_position_in_post')){
799
+ $ad = adinj_ad_code_random();
800
+ }
801
  }
802
 
803
  return adinj($content_adfree_header.$content.$content_adfree_footer, "Ads injected: " . $debug);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-w
4
  Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
5
  Requires at least: 2.8.6
6
  Tested up to: 3.1.2
7
- Stable tag: 0.9.7.8
8
 
9
  Injects any adverts (e.g. AdSense) into the WordPress posts or widget area. Restrict who sees ads by post length/age/referrer or IP. Cache compatible.
10
 
@@ -213,6 +213,14 @@ To stop ads appearing on the contact page (or any other post/page) you have many
213
  2. Add a disable_adverts custom field to the post/page containing the contact form and set the value to 1 (the number one as a single digit).
214
  3. Add a tag to the page to mean that it shouldn't have adverts, and then add that tag to the tag filtering condition in the global settings area of the plugin configuration page.
215
 
 
 
 
 
 
 
 
 
216
  = My adverts are overlapping with other page elements (e.g. images) =
217
 
218
  You can try defining the 'clear' display setting so that multiple floated parts of your page do not overlap.
@@ -240,8 +248,6 @@ If you aren't interested in these features then it doesn't matter! Just make sur
240
 
241
  If you want to show different ads for different categories using widgets you can set up filters for the different ads from the widget UI. If you want to show different top, random, or bottom adverts on different categories you can use some very simple PHP in the ad box (this will also work for the widgets as well if you don't like the UI method).
242
 
243
- Note this will only work in the direct insertion mode. It won�t work in mfunc mode!
244
-
245
  Example 1 - one category specific ad and a general ad.
246
 
247
  `<?php if (in_category('japan')) { ?>
@@ -293,6 +299,12 @@ Global advert
293
 
294
  You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
295
 
 
 
 
 
 
 
296
  = Are there any known plugin conflicts? =
297
 
298
  **WP Minify**
@@ -381,6 +393,12 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
381
 
382
  == Changelog ==
383
 
 
 
 
 
 
 
384
  = 0.9.7.8 =
385
  * Fix bug that prevents ads appearing on archive/home pages when certain plugins/themes are installed.
386
  * A PHP4 compatibility fix.
@@ -539,12 +557,12 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
539
 
540
  == Upgrade Notice ==
541
 
 
 
 
542
  = 0.9.7.8 =
543
  * Fix bug that prevented ads appearing on archive/home pages when used with certain plugins/themes.
544
 
545
- = 0.9.7.7 =
546
- * Footer ad support. Clear and align options for widgets. And word counting for non-Latin languages.
547
-
548
  = 0.8.3 =
549
  First public release.
550
 
4
  Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
5
  Requires at least: 2.8.6
6
  Tested up to: 3.1.2
7
+ Stable tag: 0.9.7.9
8
 
9
  Injects any adverts (e.g. AdSense) into the WordPress posts or widget area. Restrict who sees ads by post length/age/referrer or IP. Cache compatible.
10
 
213
  2. Add a disable_adverts custom field to the post/page containing the contact form and set the value to 1 (the number one as a single digit).
214
  3. Add a tag to the page to mean that it shouldn't have adverts, and then add that tag to the tag filtering condition in the global settings area of the plugin configuration page.
215
 
216
+ = How can I put ads on category (or other archive pages)? =
217
+
218
+ The top, random and bottom ads can be placed into the category pages. Category pages are a type of archive.
219
+
220
+ On the main settings page for Ad Injection just enter the number of adverts you want on these page types using the Archives column in the 'Ad placement settings' section.
221
+
222
+ Ads will only appear on archives/category pages if you are showing the full post contents on these pages. They won't work if you are showing excerpts.
223
+
224
  = My adverts are overlapping with other page elements (e.g. images) =
225
 
226
  You can try defining the 'clear' display setting so that multiple floated parts of your page do not overlap.
248
 
249
  If you want to show different ads for different categories using widgets you can set up filters for the different ads from the widget UI. If you want to show different top, random, or bottom adverts on different categories you can use some very simple PHP in the ad box (this will also work for the widgets as well if you don't like the UI method).
250
 
 
 
251
  Example 1 - one category specific ad and a general ad.
252
 
253
  `<?php if (in_category('japan')) { ?>
299
 
300
  You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
301
 
302
+ = How can I sell my ads / track my ad clicks? =
303
+
304
+ These are advanced features which I have no plans for adding into the core Ad Injection. You might however be able to use Ad Injection with Google Ad Manager or OpenX Ad Server that should allow you to sell your own ads and track their clicks.
305
+
306
+ If you are using a 3rd party ad provider (e.g. AdSense) then statistics such as ad clicks will be available from the ad provider.
307
+
308
  = Are there any known plugin conflicts? =
309
 
310
  **WP Minify**
393
 
394
  == Changelog ==
395
 
396
+ = 0.9.7.9 =
397
+ * Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
398
+ * New option to randomly pick again from pool for each random ad position.
399
+ * Modify default list of search referrers to remove /search/. Could cause problem with Google Webmaster Tools.
400
+ * Revert a change which unconditionally printed a debug message in hook after receiving report of a problem with it.
401
+
402
  = 0.9.7.8 =
403
  * Fix bug that prevents ads appearing on archive/home pages when certain plugins/themes are installed.
404
  * A PHP4 compatibility fix.
557
 
558
  == Upgrade Notice ==
559
 
560
+ = 0.9.7.9 =
561
+ * New options to disable last paragraph random ad, re-pick random ad for each position, and other minor fixes.
562
+
563
  = 0.9.7.8 =
564
  * Fix bug that prevented ads appearing on archive/home pages when used with certain plugins/themes.
565
 
 
 
 
566
  = 0.8.3 =
567
  First public release.
568
 
ui-tab-adrotation.php CHANGED
@@ -99,6 +99,19 @@ DOCS;
99
  <tr><td>
100
  <?php _e("Allow multiple random ads to be injected at the same positions.", 'adinj') ?></td><td><?php adinj_add_checkbox('multiple_ads_at_same_position') ?> (default is to inject ads at unique positions)
101
  </td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  </table>
103
  <?php adinj_postbox_end();
104
 
99
  <tr><td>
100
  <?php _e("Allow multiple random ads to be injected at the same positions.", 'adinj') ?></td><td><?php adinj_add_checkbox('multiple_ads_at_same_position') ?> (default is to inject ads at unique positions)
101
  </td></tr>
102
+
103
+ <tr><td>
104
+ <?php _e("Allow random ad on last paragraph");
105
+ echo '</td><td>';
106
+ adinj_add_checkbox('rnd_allow_ads_on_last_paragraph'); ?>
107
+
108
+ <td></tr>
109
+ <tr><td>
110
+ <?php _e("Re-select an ad for each position on post");
111
+ echo '</td><td>';
112
+ adinj_add_checkbox('rnd_reselect_ad_per_position_in_post'); ?>
113
+ </td></tr>
114
+
115
  </table>
116
  <?php adinj_postbox_end();
117