Ad Injection - Version 0.9.7.8

Version Description

  • Fix bug that prevents ads appearing on archive/home pages when certain plugins/themes are installed.
  • A PHP4 compatibility fix.
Download this release

Release Info

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

Code changes from version 0.9.7.7 to 0.9.7.8

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 "18th March 2011: New footer ad support (will only work on themes that correctly use the wp_footer hook). New align and clear options for widgets. And the word counting code now works for non-Latin languages. Also I'll mention that during the rest of March and the first part of April I won't have full internet access due to travelling, so I will take longer to respond and fix any bugs. But please still 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
  }
@@ -665,7 +665,7 @@ function adinj_condition_tables($prefix, $show_setting){
665
  ?>
666
  Category tag, and author conditions
667
  <?php
668
- adinj_add_show_hide_section('ad_conditions_'.uniqid(), $show_setting, $show_setting, $ops);
669
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
670
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
671
  adinj_condition_table($prefix.'author', 'author nicknames. e.g: john, paul', 'author', $ops);
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
  }
665
  ?>
666
  Category tag, and author conditions
667
  <?php
668
+ adinj_add_show_hide_section('ad_conditions_'.uniqid(''), $show_setting, $show_setting, $ops);
669
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
670
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
671
  adinj_condition_table($prefix.'author', 'author nicknames. e.g: john, paul', 'author', $ops);
ad-injection-widget.php CHANGED
@@ -229,7 +229,7 @@ class Ad_Injection_Widget extends WP_Widget {
229
 
230
  <br />
231
  <b> Exclude this widget from page types</b>
232
- <?php $this->add_show_hide_section('ad_pagetypes_'.uniqid(), 'ui_pagetypes_show', $instance); ?>
233
  <?php
234
  $count_pages = wp_count_posts('page', 'readable');
235
  $count_posts = wp_count_posts('post', 'readable');
@@ -248,7 +248,7 @@ class Ad_Injection_Widget extends WP_Widget {
248
  <br />
249
  <b> Category, tag and author conditions</b>
250
  <?php
251
- $this->add_show_hide_section('ad_restrictions_'.uniqid(), 'ui_conditions_show', $instance);
252
  adinj_condition_table('widget_category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $instance, $this->get_field_name('widget_category_condition_mode'), $this->get_field_name('widget_category_condition_entries'));
253
  adinj_condition_table('widget_tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $instance, $this->get_field_name('widget_tag_condition_mode'), $this->get_field_name('widget_tag_condition_entries'));
254
  adinj_condition_table('widget_author', 'author nicknames. e.g: john, paul', 'author', $instance, $this->get_field_name('widget_author_condition_mode'), $this->get_field_name('widget_author_condition_entries'));
@@ -257,7 +257,7 @@ class Ad_Injection_Widget extends WP_Widget {
257
 
258
  <br />
259
  <b> Spacing and alignment options</b>
260
- <?php $this->add_show_hide_section('ad_spacing_'.uniqid(), 'ui_spacing_show', $instance); ?>
261
  <table border="0" width="490px" class="adinjtable">
262
  <tr><td>
263
  <?php adinj_add_alignment_clear_options('widget_', $instance, $this->get_field_name('align'), $this->get_field_name('clear') ); ?>
@@ -271,7 +271,7 @@ class Ad_Injection_Widget extends WP_Widget {
271
 
272
  <br />
273
  <b> Ad rotation pool</b>
274
- <?php $this->add_show_hide_section('ad_pool_'.uniqid(), 'ui_ad_pool_show', $instance); ?>
275
  <table border="0" width="490px" class="adinjtable">
276
  <?php
277
  for ($i=2; $i<=10; ++$i){
@@ -282,7 +282,7 @@ class Ad_Injection_Widget extends WP_Widget {
282
 
283
  <br />
284
  <b> Alt content pool</b>
285
- <?php $this->add_show_hide_section('alt_pool_'.uniqid(), 'ui_alt_pool_show', $instance); ?>
286
  <table border="0" cellspacing="5" width="490px" class="adinjtable">
287
  <?php
288
  $total_alt_split = adinj_total_split('advert_alt_', $instance);
@@ -309,7 +309,7 @@ class Ad_Injection_Widget extends WP_Widget {
309
  function add_row($op_stem, $num, $label, $show_op, $total_split, $ops){
310
  $op = $op_stem.$num;
311
  $op_split = $op.'_split';
312
- $anchorid = $op.'_'.uniqid();
313
 
314
  $percentage_split = adinj_percentage_split($op_stem, $num, $ops, $total_split);
315
  ?>
229
 
230
  <br />
231
  <b> Exclude this widget from page types</b>
232
+ <?php $this->add_show_hide_section('ad_pagetypes_'.uniqid(''), 'ui_pagetypes_show', $instance); ?>
233
  <?php
234
  $count_pages = wp_count_posts('page', 'readable');
235
  $count_posts = wp_count_posts('post', 'readable');
248
  <br />
249
  <b> Category, tag and author conditions</b>
250
  <?php
251
+ $this->add_show_hide_section('ad_restrictions_'.uniqid(''), 'ui_conditions_show', $instance);
252
  adinj_condition_table('widget_category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $instance, $this->get_field_name('widget_category_condition_mode'), $this->get_field_name('widget_category_condition_entries'));
253
  adinj_condition_table('widget_tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $instance, $this->get_field_name('widget_tag_condition_mode'), $this->get_field_name('widget_tag_condition_entries'));
254
  adinj_condition_table('widget_author', 'author nicknames. e.g: john, paul', 'author', $instance, $this->get_field_name('widget_author_condition_mode'), $this->get_field_name('widget_author_condition_entries'));
257
 
258
  <br />
259
  <b> Spacing and alignment options</b>
260
+ <?php $this->add_show_hide_section('ad_spacing_'.uniqid(''), 'ui_spacing_show', $instance); ?>
261
  <table border="0" width="490px" class="adinjtable">
262
  <tr><td>
263
  <?php adinj_add_alignment_clear_options('widget_', $instance, $this->get_field_name('align'), $this->get_field_name('clear') ); ?>
271
 
272
  <br />
273
  <b> Ad rotation pool</b>
274
+ <?php $this->add_show_hide_section('ad_pool_'.uniqid(''), 'ui_ad_pool_show', $instance); ?>
275
  <table border="0" width="490px" class="adinjtable">
276
  <?php
277
  for ($i=2; $i<=10; ++$i){
282
 
283
  <br />
284
  <b> Alt content pool</b>
285
+ <?php $this->add_show_hide_section('alt_pool_'.uniqid(''), 'ui_alt_pool_show', $instance); ?>
286
  <table border="0" cellspacing="5" width="490px" class="adinjtable">
287
  <?php
288
  $total_alt_split = adinj_total_split('advert_alt_', $instance);
309
  function add_row($op_stem, $num, $label, $show_op, $total_split, $ops){
310
  $op = $op_stem.$num;
311
  $op_split = $op.'_split';
312
+ $anchorid = $op.'_'.uniqid('');
313
 
314
  $percentage_split = adinj_percentage_split($op_stem, $num, $ops, $total_split);
315
  ?>
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.7
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -592,6 +592,7 @@ function adinj_split_comma_list($list){
592
  }
593
 
594
  function adinj_footer_hook(){
 
595
  if (adinj_num_footer_ads_to_insert() <= 0) return;
596
  echo adinj_ad_code_footer();
597
  }
@@ -604,12 +605,12 @@ function adinj_content_hook($content){
604
  return $content;
605
  }
606
  $debug_on = $ops['debug_mode'];
607
- if ($debug_on) echo "<!--adinj_inject_hook-->";
608
 
609
  adinj_upgrade_db_if_necessary();
610
 
611
  global $adinj_total_all_ads_used, $adinj_total_random_ads_used, $adinj_total_top_ads_used, $adinj_total_bottom_ads_used;
612
- if(!is_archive && (is_page() || is_single())){
613
  // On single page the_content may be called more than once - e.g. for
614
  // description meta tag and for content.
615
  $adinj_total_all_ads_used = 0;
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
592
  }
593
 
594
  function adinj_footer_hook(){
595
+ if (is_feed()) return; // TODO feed specific ads
596
  if (adinj_num_footer_ads_to_insert() <= 0) return;
597
  echo adinj_ad_code_footer();
598
  }
605
  return $content;
606
  }
607
  $debug_on = $ops['debug_mode'];
608
+ echo "<!--adinj-->";
609
 
610
  adinj_upgrade_db_if_necessary();
611
 
612
  global $adinj_total_all_ads_used, $adinj_total_random_ads_used, $adinj_total_top_ads_used, $adinj_total_bottom_ads_used;
613
+ if(!is_archive() && (is_page() || is_single())){
614
  // On single page the_content may be called more than once - e.g. for
615
  // description meta tag and for content.
616
  $adinj_total_all_ads_used = 0;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: reviewmylife
3
  Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
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
7
- Stable tag: 0.9.7.7
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
 
@@ -90,7 +90,7 @@ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/201
90
 
91
  = Actively being developed =
92
 
93
- As of January 2011 this plugin is being actively developed and maintained. Some major new features are planned for January / February 2011. I'm very open to implementing your feature requests.
94
 
95
  == Installation ==
96
 
@@ -345,6 +345,10 @@ Here are some things to check if the ads are not appearing, or are appearing whe
345
  1. Turn off the HTML minification mode if you are also using a caching plugin. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
346
  2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
347
 
 
 
 
 
348
  = If you are getting errors when using mfunc mode check the following =
349
 
350
  1. Are there ad data directories in the plugin directory? The path will be:
@@ -377,6 +381,10 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
377
 
378
  == Changelog ==
379
 
 
 
 
 
380
  = 0.9.7.7 =
381
  * Footer ad support (only for themes that correctly use the wp_footer hook).
382
  * Align and clear options for widgets.
@@ -531,6 +539,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
531
 
532
  == Upgrade Notice ==
533
 
 
 
 
534
  = 0.9.7.7 =
535
  * Footer ad support. Clear and align options for widgets. And word counting for non-Latin languages.
536
 
3
  Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
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
 
90
 
91
  = Actively being developed =
92
 
93
+ As of 2011 this plugin is being actively developed and maintained. New features are planned for later on in 2011. If you have ideas for new features do let me know - I can't promise to do them any time soon - but if they are good and practical I can add them to my list.
94
 
95
  == Installation ==
96
 
345
  1. Turn off the HTML minification mode if you are also using a caching plugin. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
346
  2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
347
 
348
+ = Only part of the setting screen is appearing =
349
+
350
+ You are probably running out of memory. View the HTML source of the settings page (usually right click and View Source) and see if there is an out of memory message. You might have to delete/deactivate some other plugins, or search Google for advise specific to your web host.
351
+
352
  = If you are getting errors when using mfunc mode check the following =
353
 
354
  1. Are there ad data directories in the plugin directory? The path will be:
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.
387
+
388
  = 0.9.7.7 =
389
  * Footer ad support (only for themes that correctly use the wp_footer hook).
390
  * Align and clear options for widgets.
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
 
ui-tab-main.php CHANGED
@@ -159,12 +159,18 @@ function adinj_tab_main(){
159
  adinj_random_ad_limit_table();
160
  ?>
161
  <tr><td colspan="4">
162
- <?php
163
- _e("Always put the first ad immediately after paragraph: ", 'adinj');
164
- adinj_selection_box("start_from_paragraph", array(ADINJ_RULE_DISABLED,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
165
- ?>
 
 
 
 
 
166
  </td></tr>
167
  <tr><td colspan="4">
 
168
  <?php adinj_condition_tables('random_', 'ui_random_conditions_show'); ?>
169
  <p></p>
170
  </td></tr>
@@ -260,7 +266,7 @@ function adinj_tab_main(){
260
  <textarea name="ad_code_footer_1" rows="10" cols="60"><?php echo $ops['ad_code_footer_1']; ?></textarea>
261
  <br />
262
  Docs: footer ad information and troubleshooting
263
- <?php adinj_add_show_hide_section('footer_docs_'.uniqid(), 'ui_footer_docs_show', 'ui_footer_docs_show', $ops); ?>
264
  <blockquote>
265
  <p><span style="font-size:10px;">Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</span></p>
266
  <p><span style="font-size:10px;">The footer ad will only work if your theme supports it.</span></p>
159
  adinj_random_ad_limit_table();
160
  ?>
161
  <tr><td colspan="4">
162
+ <table class="adinjtable">
163
+ <?php
164
+ echo '<tr><td>';
165
+ _e("Always put the first ad immediately after paragraph: ", 'adinj');
166
+ echo '</td><td>';
167
+ adinj_selection_box("start_from_paragraph", array(ADINJ_RULE_DISABLED,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
168
+ echo '</tr><tr>';
169
+ ?>
170
+ </table>
171
  </td></tr>
172
  <tr><td colspan="4">
173
+ <br />
174
  <?php adinj_condition_tables('random_', 'ui_random_conditions_show'); ?>
175
  <p></p>
176
  </td></tr>
266
  <textarea name="ad_code_footer_1" rows="10" cols="60"><?php echo $ops['ad_code_footer_1']; ?></textarea>
267
  <br />
268
  Docs: footer ad information and troubleshooting
269
+ <?php adinj_add_show_hide_section('footer_docs_'.uniqid(''), 'ui_footer_docs_show', 'ui_footer_docs_show', $ops); ?>
270
  <blockquote>
271
  <p><span style="font-size:10px;">Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</span></p>
272
  <p><span style="font-size:10px;">The footer ad will only work if your theme supports it.</span></p>