Ad Injection - Version 0.8.9

Version Description

Prevent config file being lost by bulk automatic update. Error messages from adshow.php are hidden in HTML now rather than being visible to everyone.

Download this release

Release Info

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

Code changes from version 0.8.8 to 0.8.9

Files changed (5) hide show
  1. ad-injection-admin.php +5 -0
  2. ad-injection.php +2 -1
  3. adshow.php +10 -3
  4. readme.txt +9 -2
  5. uninstall.php +6 -1
ad-injection-admin.php CHANGED
@@ -116,6 +116,11 @@ $bottom_func
116
  CONFIG;
117
 
118
  adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640);
 
 
 
 
 
119
 
120
  }
121
 
116
  CONFIG;
117
 
118
  adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640);
119
+ // We write the second config file to the WP_CONTENT_DIR directory
120
+ // so that it will persist after bulk plugin upgrades. In a later update
121
+ // I'll get rid of the duplicate. This is the same directory that
122
+ // WP Super Cache uses for its config file.
123
+ adinj_write_file(ADINJ_CONFIG_FILE2, $config, 0640);
124
 
125
  }
126
 
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: Inserts any advert into your blog. Options to exclude by post age, visitor IP, and visitor referrer. Works with WP Super Cache.
6
- Version: 0.8.8
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -31,6 +31,7 @@ License: GPLv2
31
  // Files
32
  define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
33
  define('ADINJ_CONFIG_FILE', ADINJ_PATH . '/ad-injection-config.php');
 
34
  define('ADINJ_AD_PATH', ADINJ_PATH . '/ads');
35
  define('ADINJ_AD_RANDOM_FILE', 'ad_random_1.txt');
36
  define('ADINJ_AD_TOP_FILE', 'ad_top_1.txt');
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Inserts any advert into your blog. Options to exclude by post age, visitor IP, and visitor referrer. Works with WP Super Cache.
6
+ Version: 0.8.9
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
31
  // Files
32
  define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
33
  define('ADINJ_CONFIG_FILE', ADINJ_PATH . '/ad-injection-config.php');
34
+ define('ADINJ_CONFIG_FILE2', WP_CONTENT_DIR . '/ad-injection-config.php'); // same directory as WP Super Cache config file
35
  define('ADINJ_AD_PATH', ADINJ_PATH . '/ads');
36
  define('ADINJ_AD_RANDOM_FILE', 'ad_random_1.txt');
37
  define('ADINJ_AD_TOP_FILE', 'ad_top_1.txt');
adshow.php CHANGED
@@ -4,7 +4,14 @@ Part of the Ad Injection plugin for WordPress
4
  http://www.reviewmylife.co.uk/
5
  */
6
 
7
- include_once('ad-injection-config.php');
 
 
 
 
 
 
 
8
 
9
  //////////////////////////////////////////////////////////////////////////////
10
 
@@ -23,7 +30,7 @@ function adshow_functions_exist(){
23
  }
24
  function adshow_functions_exist_impl($function){
25
  if (!function_exists($function)){
26
- echo "<b>".__FILE__." Error: $function does not exist.</b>";
27
  return false;
28
  }
29
  return true;
@@ -66,7 +73,7 @@ function adshow_display_ad_full_path($ad_path){
66
  echo adshow_eval_php($ad);
67
  }
68
  } else {
69
- echo "ADINJ WARNING: file does not exist: $ad_path";
70
  }
71
  }
72
  }
4
  http://www.reviewmylife.co.uk/
5
  */
6
 
7
+ $adinj_dir = dirname(__FILE__);
8
+ if (file_exists($adinj_dir.'/ad-injection-config.php')){
9
+ include_once($adinj_dir.'/ad-injection-config.php');
10
+ } else if (file_exists($adinj_dir.'/../../ad-injection-config.php')) {
11
+ include_once($adinj_dir.'/../../ad-injection-config.php');
12
+ } else {
13
+ echo '<!--ADINJ DEBUG: ad-injection-config.php could not be found. Re-save your settings to re-generate it.-->';
14
+ }
15
 
16
  //////////////////////////////////////////////////////////////////////////////
17
 
30
  }
31
  function adshow_functions_exist_impl($function){
32
  if (!function_exists($function)){
33
+ echo "<!--ADINJ DEBUG:".__FILE__." Error: $function does not exist. Might be because config file is missing. Re-save settings to fix. -->";
34
  return false;
35
  }
36
  return true;
73
  echo adshow_eval_php($ad);
74
  }
75
  } else {
76
+ echo "<!--ADINJ DEBUG: file does not exist: $ad_path-->";
77
  }
78
  }
79
  }
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, advert injection, advert, ad, injection, adsense, advertising, affiliate, inject, injection, insert, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, free
5
  Requires at least: 3.0.0
6
- Tested up to: 3.0.2
7
- Stable tag: 0.8.8
8
 
9
  Injects any kind of advert into existing WordPress posts. Can restrict who sees the ads by post age, visitor referrer, IP address. Cache compatible.
10
 
@@ -157,6 +157,10 @@ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/201
157
 
158
  == Changelog ==
159
 
 
 
 
 
160
  = 0.8.8 =
161
  Try to make sure ads don't appear on archive pages, 404s or search results, in case theme is working in a non-standard way. Reduce dependency on files.
162
 
@@ -180,6 +184,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
180
 
181
  == Upgrade Notice ==
182
 
 
 
 
183
  = 0.8.8 =
184
  Try to make sure ads don't appear on archive pages, 404s or search results, in case theme is working in a non-standard way. Reduce dependency on files.
185
 
3
  Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
4
  Tags: ad injection, advert injection, advert, ad, injection, adsense, advertising, affiliate, inject, injection, insert, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, free
5
  Requires at least: 3.0.0
6
+ Tested up to: 3.0.3
7
+ Stable tag: 0.8.9
8
 
9
  Injects any kind of advert into existing WordPress posts. Can restrict who sees the ads by post age, visitor referrer, IP address. Cache compatible.
10
 
157
 
158
  == Changelog ==
159
 
160
+ = 0.8.9 =
161
+ Prevent config file being lost by bulk automatic update.
162
+ Error messages from adshow.php are hidden in HTML now rather than being visible to everyone.
163
+
164
  = 0.8.8 =
165
  Try to make sure ads don't appear on archive pages, 404s or search results, in case theme is working in a non-standard way. Reduce dependency on files.
166
 
184
 
185
  == Upgrade Notice ==
186
 
187
+ = 0.8.9 =
188
+ Upgrade to this version by going to the plugins tab and upgrading the individual plugin. If you upgrade from the bulk updator the mfunc config file will be lost and you would have to go to 'Save all settings' to re-generate it. This version attempts to solve the bulk update problem.
189
+
190
  = 0.8.8 =
191
  Try to make sure ads don't appear on archive pages, 404s or search results, in case theme is working in a non-standard way. Reduce dependency on files.
192
 
uninstall.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Part of the Ad Injection plugin for WordPress
4
- http://www.reviewmylife.co.uk/blog/
5
  */
6
 
7
  if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
@@ -9,4 +9,9 @@ if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
9
 
10
  delete_option('adinj_options');
11
 
 
 
 
 
 
12
  ?>
1
  <?php
2
  /*
3
  Part of the Ad Injection plugin for WordPress
4
+ http://www.reviewmylife.co.uk/
5
  */
6
 
7
  if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
9
 
10
  delete_option('adinj_options');
11
 
12
+ $adinj_dir = dirname(__FILE__);
13
+ if (file_exists($adinj_dir.'/../../ad-injection-config.php')) {
14
+ unlink($adinj_dir.'/../../ad-injection-config.php');
15
+ }
16
+
17
  ?>