Ad Injection - Version 0.9.4.2

Version Description

Allow plugin to work with PHP4. Increase allowed home page ads to 10. Must always save widget ads to disk in case mode is changed to mfunc later on.

Download this release

Release Info

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

Code changes from version 0.9.4.1 to 0.9.4.2

ad-injection-admin.php CHANGED
@@ -148,7 +148,6 @@ CONFIG;
148
 
149
  function adinj_write_file($path, $content, $permission){
150
  $ops = adinj_options();
151
- if ($ops['ad_insertion_mode'] != 'mfunc') return;
152
  global $adinj_warning_msg_filewrite;
153
  $handle = fopen($path, "w");
154
  if (strlen($content) > 0){
@@ -384,8 +383,12 @@ function adinj_options_page(){
384
  Don't show ads on these page types:
385
  </td><td>
386
  <input type="checkbox" name="exclude_home" <?php echo adinj_ticked('exclude_home'); ?> />home - <?php echo get_bloginfo('url'); ?><br />
387
- <input type="checkbox" name="exclude_page" <?php echo adinj_ticked('exclude_page'); ?> />page - <?php echo wp_count_posts('page', 'readable')->publish; ?> page(s)<br />
388
- <input type="checkbox" name="exclude_single" <?php echo adinj_ticked('exclude_single'); ?> />single -<?php echo wp_count_posts('post', 'readable')->publish; ?> individual blog post(s)<br />
 
 
 
 
389
  <input type="checkbox" name="exclude_archive" <?php echo adinj_ticked('exclude_archive'); ?> />archive - only <a href="#widgets">widgets</a> currently appear on archives<br />
390
  </td></tr>
391
  </table>
@@ -504,7 +507,7 @@ function adinj_options_page(){
504
  <?php _e("Maximum number of injected ads: ", 'adinj') ?>
505
  <select name='max_num_of_ads_home_page'>
506
  <?php
507
- for ($value=0; $value<=6; ++$value){
508
  echo "<option value=\"$value\" ";
509
  if($ops['max_num_of_ads_home_page'] == $value) echo 'selected="selected"';
510
  echo ">$value</option>";
@@ -568,7 +571,7 @@ function adinj_options_page(){
568
  <?php adinj_postbox_end(); ?>
569
 
570
 
571
- <?php adinj_postbox_start(__("Widget settings", 'adinj'), 'widgets'); ?>
572
 
573
  <p>You must configure your individual widgets from the <a href="widgets.php">widgets control panel</a>. However these settings are global to all widgets. Also note that the main set of <a href="#global">global settings</a> will override these ones.</p>
574
 
@@ -577,10 +580,10 @@ function adinj_options_page(){
577
  <tr><td>
578
  <p>Don't show widget ads on these page types:</p>
579
  </td><td>
580
- <input type="checkbox" name="widget_exclude_home" <?php echo adinj_ticked('widget_exclude_home'); ?> />home<br />
581
- <input type="checkbox" name="widget_exclude_page" <?php echo adinj_ticked('widget_exclude_page'); ?> />page (<?php echo wp_count_posts('page', 'readable')->publish; ?> page(s))<br />
582
- <input type="checkbox" name="widget_exclude_single" <?php echo adinj_ticked('widget_exclude_single'); ?> />single (<?php echo wp_count_posts('post', 'readable')->publish; ?> individual blog post(s))<br />
583
- <input type="checkbox" name="widget_exclude_archive" <?php echo adinj_ticked('widget_exclude_archive'); ?> />archive (includes category, tag, author, and date pages types)<br />
584
  </td></tr>
585
 
586
  </table>
148
 
149
  function adinj_write_file($path, $content, $permission){
150
  $ops = adinj_options();
 
151
  global $adinj_warning_msg_filewrite;
152
  $handle = fopen($path, "w");
153
  if (strlen($content) > 0){
383
  Don't show ads on these page types:
384
  </td><td>
385
  <input type="checkbox" name="exclude_home" <?php echo adinj_ticked('exclude_home'); ?> />home - <?php echo get_bloginfo('url'); ?><br />
386
+ <?php
387
+ $count_pages = wp_count_posts('page', 'readable');
388
+ $count_posts = wp_count_posts('post', 'readable');
389
+ ?>
390
+ <input type="checkbox" name="exclude_page" <?php echo adinj_ticked('exclude_page'); ?> />page - <?php echo $count_pages->publish; ?> page(s)<br />
391
+ <input type="checkbox" name="exclude_single" <?php echo adinj_ticked('exclude_single'); ?> />single -<?php echo $count_posts->publish; ?> individual blog post(s)<br />
392
  <input type="checkbox" name="exclude_archive" <?php echo adinj_ticked('exclude_archive'); ?> />archive - only <a href="#widgets">widgets</a> currently appear on archives<br />
393
  </td></tr>
394
  </table>
507
  <?php _e("Maximum number of injected ads: ", 'adinj') ?>
508
  <select name='max_num_of_ads_home_page'>
509
  <?php
510
+ for ($value=0; $value<=10; ++$value){
511
  echo "<option value=\"$value\" ";
512
  if($ops['max_num_of_ads_home_page'] == $value) echo 'selected="selected"';
513
  echo ">$value</option>";
571
  <?php adinj_postbox_end(); ?>
572
 
573
 
574
+ <?php adinj_postbox_start(__("Widget settings (sidebar ads)", 'adinj'), 'widgets'); ?>
575
 
576
  <p>You must configure your individual widgets from the <a href="widgets.php">widgets control panel</a>. However these settings are global to all widgets. Also note that the main set of <a href="#global">global settings</a> will override these ones.</p>
577
 
580
  <tr><td>
581
  <p>Don't show widget ads on these page types:</p>
582
  </td><td>
583
+ <input type="checkbox" name="widget_exclude_home" <?php echo adinj_ticked('widget_exclude_home'); ?> />home - <?php echo get_bloginfo('url'); ?><br />
584
+ <input type="checkbox" name="widget_exclude_page" <?php echo adinj_ticked('widget_exclude_page'); ?> />page - <?php echo $count_pages->publish; ?> page(s)<br />
585
+ <input type="checkbox" name="widget_exclude_single" <?php echo adinj_ticked('widget_exclude_single'); ?> />single - <?php echo $count_posts->publish; ?> individual blog post(s)<br />
586
+ <input type="checkbox" name="widget_exclude_archive" <?php echo adinj_ticked('widget_exclude_archive'); ?> />archive - includes category, tag, author, and date pages types<br />
587
  </td></tr>
588
 
589
  </table>
ad-injection-widget.php CHANGED
@@ -61,9 +61,7 @@ class Ad_Injection_Widget extends WP_Widget {
61
  $instance['advert'] = $new_instance['advert'];
62
 
63
  $options = adinj_options();
64
- if ($options['ad_insertion_mode'] == 'mfunc'){
65
- write_ad_to_file($instance['advert'], $this->get_ad_file_path2());
66
- }
67
 
68
  return $instance;
69
  }
61
  $instance['advert'] = $new_instance['advert'];
62
 
63
  $options = adinj_options();
64
+ write_ad_to_file($instance['advert'], $this->get_ad_file_path2());
 
 
65
 
66
  return $instance;
67
  }
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.4.1
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
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.4.2
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
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, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free
5
  Requires at least: 3.0.0
6
  Tested up to: 3.0.3
7
- Stable tag: 0.9.4.1
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
 
@@ -197,6 +197,11 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
197
 
198
  == Changelog ==
199
 
 
 
 
 
 
200
  = 0.9.4.1 =
201
  Fix: Remove file contents if ad is 0 length.
202
 
@@ -261,6 +266,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
261
 
262
  == Upgrade Notice ==
263
 
 
 
 
264
  = 0.9.4.1 =
265
  If you are using mfunc mode and have added ad widgets with a version prior to 0.9.2 please re-save them to regenerate the ad files (fixed for upgrades from 0.9.2).
266
 
4
  Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free
5
  Requires at least: 3.0.0
6
  Tested up to: 3.0.3
7
+ Stable tag: 0.9.4.2
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
 
197
 
198
  == Changelog ==
199
 
200
+ = 0.9.4.2 =
201
+ Allow plugin to work with PHP4.
202
+ Increase allowed home page ads to 10.
203
+ Must always save widget ads to disk in case mode is changed to mfunc later on.
204
+
205
  = 0.9.4.1 =
206
  Fix: Remove file contents if ad is 0 length.
207
 
266
 
267
  == Upgrade Notice ==
268
 
269
+ = 0.9.4.2 =
270
+ If you are using mfunc mode and have added ad widgets with a version prior to 0.9.2 please re-save them to regenerate the ad files (fixed for upgrades from 0.9.2).
271
+
272
  = 0.9.4.1 =
273
  If you are using mfunc mode and have added ad widgets with a version prior to 0.9.2 please re-save them to regenerate the ad files (fixed for upgrades from 0.9.2).
274