Ad Injection - Version 0.9.3.2

Version Description

Add test mode, and further reduce unnecessary file access.

Download this release

Release Info

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

Code changes from version 0.9.3.1 to 0.9.3.2

ad-injection-admin.php CHANGED
@@ -37,8 +37,8 @@ function adinj_checkNonce(){
37
  }
38
  }
39
 
40
- function adinj_update_options($options){
41
- update_option('adinj_options', $options);
42
  // Refresh options from database as cached values are now invalidated
43
  global $adinj_data;
44
  $adinj_data = get_option('adinj_options');
@@ -54,47 +54,40 @@ case 'Save all settings':
54
  $default_options = adinj_default_options();
55
  foreach ($default_options as $key => $value){
56
  if (isset($_POST[$key])){
57
- $options[$key] = $_POST[$key];
58
  } else {
59
- $options[$key] = "";
60
  }
61
  }
62
 
63
- global $adinj_warning_msg_filewrite;
64
- if (!file_exists(ADINJ_AD_PATH)){
65
- mkdir(ADINJ_AD_PATH, 0750) //TODO is this the right permission?
66
- or $adinj_warning_msg_filewrite .= "<br />Error: could not create dir: ".ADINJ_AD_PATH.". Please create it manually and try again.";
67
- }
68
- if (!file_exists(ADINJ_AD_PATH2)){
69
- mkdir(ADINJ_AD_PATH2, 0750) //TODO is this the right permission?
70
- or $adinj_warning_msg_filewrite .= "<br />Error: could not create dir: ".ADINJ_AD_PATH2.". Please create it manually and try again.";
71
- }
72
-
73
- // TODO later stop saving to old ADINJ_AD_PATH
74
  $raw_ad_code_random = stripslashes($_POST['ad_code_random_1']);
75
- write_ad_to_file($raw_ad_code_random, ADINJ_AD_PATH.'/'.ADINJ_AD_RANDOM_FILE);
76
- write_ad_to_file($raw_ad_code_random, ADINJ_AD_PATH2.'/'.ADINJ_AD_RANDOM_FILE);
77
- $options['ad_code_random_1'] = $raw_ad_code_random;
78
 
79
  $raw_ad_code_top = stripslashes($_POST['ad_code_top_1']);
80
- write_ad_to_file($raw_ad_code_top, ADINJ_AD_PATH.'/'.ADINJ_AD_TOP_FILE);
81
- write_ad_to_file($raw_ad_code_top, ADINJ_AD_PATH2.'/'.ADINJ_AD_TOP_FILE);
82
- $options['ad_code_top_1'] = $raw_ad_code_top;
83
 
84
  $raw_ad_code_bottom = stripslashes($_POST['ad_code_bottom_1']);
85
- write_ad_to_file($raw_ad_code_bottom, ADINJ_AD_PATH.'/'.ADINJ_AD_BOTTOM_FILE);
86
- write_ad_to_file($raw_ad_code_bottom, ADINJ_AD_PATH2.'/'.ADINJ_AD_BOTTOM_FILE);
87
- $options['ad_code_bottom_1'] = $raw_ad_code_bottom;
88
 
89
  $ad_referrers = stripslashes($_POST['ad_referrers']); // TODO do i need strip slashes?
90
- $options['ad_referrers'] = $ad_referrers;
91
 
92
  $blocked_ips = stripslashes($_POST['blocked_ips']);
93
- $options['blocked_ips'] = $blocked_ips;
94
 
95
- adinj_update_options($options);
96
 
97
- adinj_write_config_file();
 
 
 
 
 
 
 
 
 
 
98
 
99
  break;
100
 
@@ -106,6 +99,10 @@ case 'Save all settings':
106
  case 'Delete settings from DB':
107
  adinj_checkNonce();
108
  delete_option('adinj_options');
 
 
 
 
109
  // TODO add option to delete ads files as well
110
  break;
111
  }
@@ -115,8 +112,8 @@ case 'Save all settings':
115
  // so be careful if adding any new ones - they might not exist yet, but could
116
  // still be referenced by adshow.
117
  function adinj_write_config_file(){
118
- $options = adinj_options();
119
- if ($options['ad_insertion_mode'] != 'mfunc') return;
120
  $referrer_list = adinj_quote_list('ad_referrers');
121
  $ip_list = adinj_quote_list('blocked_ips');
122
  $sevisitors_only = adinj_ticked('sevisitors_only')?'true':'false';
@@ -144,19 +141,14 @@ $bottom_func
144
 
145
  ?>
146
  CONFIG;
147
-
148
- adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640);
149
- // We write the second config file to the WP_CONTENT_DIR directory
150
- // so that it will persist after bulk plugin upgrades. In a later update
151
- // I'll get rid of the duplicate. This is the same directory that
152
- // WP Super Cache uses for its config file.
153
  adinj_write_file(ADINJ_CONFIG_FILE2, $config, 0640);
154
 
155
  }
156
 
157
  function adinj_write_file($path, $content, $permission){
158
- $options = adinj_options();
159
- if ($options['ad_insertion_mode'] != 'mfunc') return;
160
  global $adinj_warning_msg_filewrite;
161
  $handle = fopen($path, "w");
162
  fwrite($handle, $content) or $adinj_warning_msg_filewrite .= "<br />Error: could not write to file: $path";
@@ -178,13 +170,13 @@ function adinj_get_logo(){
178
  }
179
 
180
  function adinj_options_page(){
181
- $options = adinj_options();
182
- if ($options === false || adinj_options_need_upgrading($options)){
183
  // Upgraded via FTP without being deactivated/reactivated
184
  adinj_activate_hook();
185
  }
186
- $options = adinj_options(1);
187
- if (!file_exists(ADINJ_CONFIG_FILE)){
188
  adinj_write_config_file();
189
  }
190
 
@@ -207,7 +199,7 @@ function adinj_options_page(){
207
  echo "If you are using a caching plugin you might need to delete its cache for any changes to take effect.";
208
  }
209
  echo '</strong>';
210
- if ($options['ad_insertion_mode']=='mfunc'){
211
  global $adinj_warning_msg_filewrite;
212
  if (!empty($adinj_warning_msg_filewrite)){
213
  echo $adinj_warning_msg_filewrite;
@@ -218,9 +210,9 @@ function adinj_options_page(){
218
  if (!empty($adinj_warning_msg_chmod)){
219
  echo '<br />Info: Some warnings were generated by chmod. See the <a href="#debugging">debugging</a> section for more info.';
220
  }
221
- echo '<br />Info: <a href="#restrictions">injection mode</a>='.$options['ad_insertion_mode'];
222
- if (empty($options['ads_enabled'])){
223
- echo '<br /><font color="red">Warning: Ads are currently disabled. You need to tick the "Ads enabled" box to see them.</font>';
224
  }
225
  echo '</p></div>';
226
 
@@ -238,19 +230,25 @@ function adinj_options_page(){
238
  <ul>
239
  <li><a href="http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/" target="_new">Ad Injection Home</a></li>
240
  <li><a href="http://wordpress.org/extend/plugins/ad-injection/" target="_new">Ad Injection at WordPress</a></li>
241
- <li><a href="https://spreadsheets.google.com/viewform?formkey=dFUwZzBYcG1HNzNKMmJZdWFDdFhkY0E6MQ" target="_new">Report a bug or give feedback!</a></li>
242
  </ul>
243
- <h4>More by this author</h4>
244
  <ul>
245
- <li><a href="http://www.reviewmylife.co.uk/" target="_new">www.reviewmylife.co.uk</a></li>
246
- <li><a href="http://www.advancedhtml.co.uk/" target="_new">www.advancedhtml.co.uk</a></li>
247
  </ul>
248
 
249
  <h4><font color="red">Be careful!</font></h4>
250
  <p>Make sure that the ad settings and positioning you define are in compliance with your ad provider's terms of service!</p>
251
 
252
- <h4><font color="red">Beta version!</font></h4>
253
- <p>This plugin has only just been released - please bare with me if there are any bugs. I'm actively listening to your feedback and fixing any problems. Please let me know if you like the plugin too!</p>
 
 
 
 
 
 
254
  </div>
255
  </div>
256
  </div>
@@ -266,7 +264,10 @@ function adinj_options_page(){
266
 
267
  <p>These settings apply to all ads (random, top, bottom, and widget). They will override all other settings.</p>
268
 
269
- <p><input type="checkbox" name="ads_enabled" <?php echo adinj_ticked('ads_enabled'); ?> /><b><?php _e('Ads enabled', 'adinj') ?></b> - Tick this to turn your ads on!</p><br />
 
 
 
270
 
271
  <table border="0">
272
  <tr><td>
@@ -278,7 +279,7 @@ function adinj_options_page(){
278
  $older_than_days = array(0, 1, 2, 3, 5, 7, 10, 14, 21, 28, 40, 50);
279
  for ($value=0; $value<sizeof($older_than_days); ++$value){
280
  echo "<option value=\"$older_than_days[$value]\" ";
281
- if($options['ads_on_page_older_than'] == $older_than_days[$value]) echo 'selected="selected"';
282
  echo ">$older_than_days[$value]</option>";
283
  }
284
  ?>
@@ -303,7 +304,7 @@ function adinj_options_page(){
303
 
304
  <table border="0" cellspacing="5">
305
  <tr><td style="vertical-align: top">
306
- <textarea name="ad_code_random_1" rows="10" cols="60"><?php echo $options['ad_code_random_1']; ?></textarea>
307
  </td><td style="vertical-align: top">
308
  <?php adinj_add_alignment_options('rnd_'); ?>
309
  </td></tr>
@@ -314,8 +315,8 @@ function adinj_options_page(){
314
  </table>
315
 
316
 
317
- <p><b>Docs:</b> On individual posts or pages this advert is inserted between randomly selected paragraphs. On a multi-post page (e.g. home page), one ad is inserted into each post. Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</p>
318
- <p>Be especially careful if you decide to use the 'float' layout options. Make sure that you don't have adverts floated over the top of other page elements, or vice-versa.</p>
319
  </div>
320
 
321
  <input type="submit" style="float:right" name="adinj_action" value="<?php _e('Save all settings', 'adinj') ?>" />
@@ -338,7 +339,7 @@ function adinj_options_page(){
338
  <?php
339
  for ($value=0; $value<=6; ++$value){
340
  echo "<option value=\"$value\" ";
341
- if($options['max_num_of_ads'] == $value) echo 'selected="selected"';
342
  echo ">$value</option>";
343
  }
344
  ?>
@@ -387,7 +388,7 @@ function adinj_options_page(){
387
  </table>
388
 
389
  <br clear="all" />
390
- <p><b>Docs:</b> The above directives are processed in order from top to bottom.</p>
391
 
392
 
393
  <p></p>
@@ -404,13 +405,13 @@ function adinj_options_page(){
404
  <?php
405
  for ($value=0; $value<=6; ++$value){
406
  echo "<option value=\"$value\" ";
407
- if($options['max_num_of_ads_home_page'] == $value) echo 'selected="selected"';
408
  echo ">$value</option>";
409
  }
410
  ?>
411
  </select> <?php echo adinj_getdefault('max_num_of_ads_home_page'); ?><br />
412
 
413
- <p><b>Docs:</b> On multi-post pages such as the home page, one randomly positioned advert will be inserted into each page, up to the maximum number specified here.</p>
414
 
415
  <?php adinj_postbox_end(); ?>
416
 
@@ -429,14 +430,14 @@ function adinj_options_page(){
429
 
430
  <table border="0">
431
  <tr><td>
432
- <textarea name="ad_code_top_1" rows="10" cols="60"><?php echo $options['ad_code_top_1']; ?></textarea>
433
  </td><td style="vertical-align: top">
434
  <?php adinj_add_alignment_options('top_'); ?>
435
  </td></tr>
436
  </table>
437
  <span style="font-size:10px;">The top ad is in addition to the quantity of other ads selected.</span>
438
 
439
- <p><b>Docs:</b> The top ad will only appear on single posts and pages. It will not appear on multi-post pages. Try a <a href="#468x15">468x15</a> or <a href="#336x280">336x280</a> advert.</p>
440
 
441
  <?php adinj_postbox_end(); ?>
442
 
@@ -453,14 +454,14 @@ function adinj_options_page(){
453
 
454
  <table border="0">
455
  <tr><td>
456
- <textarea name="ad_code_bottom_1" rows="10" cols="60"><?php echo $options['ad_code_bottom_1']; ?></textarea>
457
  </td><td style="vertical-align: top">
458
  <?php adinj_add_alignment_options('bottom_'); ?>
459
  </td></tr>
460
  </table>
461
  <span style="font-size:10px;">The top ad is in addition to the quantity of other ads selected.</span>
462
 
463
- <p><b>Docs:</b> The bottom ad will only appear on single posts and pages. It will not appear on multi-post pages. Try a <a href="#336x280">336x280</a> advert.</p>
464
 
465
 
466
  <?php adinj_postbox_end(); ?>
@@ -492,9 +493,9 @@ function adinj_options_page(){
492
  <h4>Ad insertion mode</h4>
493
 
494
  <blockquote>
495
- <p><input type="radio" name="ad_insertion_mode" value="mfunc" <?php if ($options['ad_insertion_mode']=='mfunc') echo 'checked="checked"'; ?> /> <b>Use mfunc tags for dynamic features</b> - Dynamic features will work with WP Super Cache in legacy mode (or with a caching program that is compatible with WP Super Cache's mfunc tags). Dynamic features will also work if you don't use a caching program, although if you don't use a caching program 'direct' insertion will be more efficient.</p>
496
- <p><input type="radio" name="ad_insertion_mode" value="direct_dynamic" <?php if ($options['ad_insertion_mode']=='direct_dynamic') echo 'checked="checked"'; ?> /> <b>Direct ad insertion with dynamic features</b> - Dynamic features will work if no caching is used. Only select this if you are not using any caching plugin.</p>
497
- <p><input type="radio" name="ad_insertion_mode" value="direct_static" <?php if ($options['ad_insertion_mode']=='direct_static') echo 'checked="checked"'; ?> /> <b>Direct static ad insertion</b> - No dynamic feature support. Select this if you are using a caching plugin which is not compatible with WP Super Cache's mfunc tags.</p>
498
  </blockquote>
499
  </div>
500
 
@@ -504,14 +505,14 @@ function adinj_options_page(){
504
 
505
  <blockquote>
506
  <input type="checkbox" name="sevisitors_only" <?php echo adinj_ticked('sevisitors_only'); ?> /><?php _e("Only show ads to search engine visitors (customise search engine referrers below if necessary).", 'adinj') ?><br />
507
- <textarea name="ad_referrers" rows="2" cols="70"><?php echo $options['ad_referrers']; ?></textarea>
508
  <p>Comma separated list e.g.: <br /><code>.google., .bing., .yahoo., .ask., search?, search., /search/</code></p>
509
  </blockquote>
510
 
511
  <h4>Blocked IP addresses (dynamic feature)</h4>
512
 
513
  <blockquote>
514
- <textarea name="blocked_ips" rows="4" cols="70"><?php echo $options['blocked_ips']; ?></textarea>
515
  <p>Comma separated list e.g.: <br /><code>0.0.0.1, 0.0.0.2</code></p>
516
  <p>Or you can list one IP per line with optional comments e.g.</p>
517
  <code style="padding:0px 0px">192.168.0.1<br />0.0.0.2<br /><?php echo $_SERVER['REMOTE_ADDR'] ?> //my ip<br />0.0.0.3</code>
@@ -583,7 +584,7 @@ function adinj_options_page(){
583
  }
584
 
585
  function adinj_postbox_start($title, $anchor, $width='650px'){
586
- $options = adinj_options();
587
  ?>
588
  <div class='postbox-container' style='width:<?php echo $width; ?>;clear:left'>
589
  <div class="metabox-holder">
@@ -603,7 +604,7 @@ function adinj_postbox_start($title, $anchor, $width='650px'){
603
  });
604
  });
605
  </script>
606
- <input type='hidden' id='ui_<?php echo $anchor; ?>_hide' name='ui_<?php echo $anchor; ?>_hide' value='<?php echo $options['ui_'.$anchor.'_hide']; ?>' />
607
  <h3><a name="<?php echo $anchor ?>"></a><?php echo adinj_get_logo() . ' ' . $title; ?></h3>
608
  <div class="<?php echo $anchor; ?>-box">
609
  <div class="inside" style="margin:10px">
@@ -621,8 +622,8 @@ function adinj_postbox_end(){
621
 
622
  function adinj_selection_box($name, $values, $type=NULL){
623
  echo "<select name='$name'>";
624
- $options = adinj_options();
625
- $selected_value = $options[$name];
626
  foreach ($values as $value){
627
  echo "<option value=\"$value\" ";
628
  if($selected_value == "$value") echo 'selected="selected"';
@@ -691,7 +692,7 @@ function adinj_debug_information(){
691
  echo '<h4>Other settings</h4><blockquote>';
692
 
693
  echo 'ADINJ_PATH='.ADINJ_PATH.'<br />';
694
- echo 'ADINJ_CONFIG_FILE='.ADINJ_CONFIG_FILE.'<br />';
695
  echo 'ADINJ_AD_PATH='.ADINJ_AD_PATH.' (up to v0.9.1)<br />';
696
  echo 'ADINJ_AD_PATH2='.ADINJ_AD_PATH2.' (v0.9.2+)<br />';
697
 
@@ -768,27 +769,37 @@ function adinj_activate_hook() {
768
  }
769
  }
770
 
771
- // Restore data after automatic upgrade
772
- // TODO could remove this code further down the line when everyone
773
- // has moved to the new ad store location
774
- $random_file = ADINJ_AD_PATH.'/'.ADINJ_AD_RANDOM_FILE;
775
- if (!file_exists($random_file) && !empty($pending_options['ad_code_random_1'])){
776
- write_ad_to_file($pending_options['ad_code_random_1'], $random_file);
777
- }
778
- $top_file = ADINJ_AD_PATH.'/'.ADINJ_AD_TOP_FILE;
779
- if (!file_exists($top_file) && !empty($pending_options['ad_code_top_1'])){
780
- write_ad_to_file($pending_options['ad_code_top_1'], $top_file);
781
- }
782
- $bottom_file = ADINJ_AD_PATH.'/'.ADINJ_AD_BOTTOM_FILE;
783
- if (!file_exists($bottom_file) && !empty($pending_options['ad_code_bottom_1'])){
784
- write_ad_to_file($pending_options['ad_code_bottom_1'], $bottom_file);
785
- }
786
- if (!file_exists(ADINJ_CONFIG_FILE)){
787
- adinj_write_config_file();
 
 
 
 
 
 
 
788
  }
789
 
790
  // In case ads are saved on file and upgrading from first version on plugin
791
  // TODO maybe delete this in a few versions time?
 
 
 
792
  if (empty($pending_options['ad_code_random_1']) && file_exists($random_file)){
793
  $pending_options['ad_code_random_1'] = read_ad_from_file($random_file);
794
  }
@@ -821,7 +832,7 @@ function adinj_options_need_upgrading($stored_options){
821
 
822
  function adinj_default_options(){
823
  return array(
824
- 'ads_enabled' => '',
825
  'max_num_of_ads' => '2', // single posts and pages
826
  'max_num_of_ads_home_page' => '3',
827
  'no_random_ads_if_shorter_than' => '100',
@@ -1018,7 +1029,8 @@ function adinj_docs(){
1018
  }
1019
 
1020
  function adinj_init_hook() {
1021
- if (!adinj_ticked('ads_enabled')) {
 
1022
  add_action('admin_notices', 'adinj_init_warning');
1023
  }
1024
  }
37
  }
38
  }
39
 
40
+ function adinj_update_options($ops){
41
+ update_option('adinj_options', $ops);
42
  // Refresh options from database as cached values are now invalidated
43
  global $adinj_data;
44
  $adinj_data = get_option('adinj_options');
54
  $default_options = adinj_default_options();
55
  foreach ($default_options as $key => $value){
56
  if (isset($_POST[$key])){
57
+ $ops[$key] = $_POST[$key];
58
  } else {
59
+ $ops[$key] = "";
60
  }
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
63
  $raw_ad_code_random = stripslashes($_POST['ad_code_random_1']);
64
+ $ops['ad_code_random_1'] = $raw_ad_code_random;
 
 
65
 
66
  $raw_ad_code_top = stripslashes($_POST['ad_code_top_1']);
67
+ $ops['ad_code_top_1'] = $raw_ad_code_top;
 
 
68
 
69
  $raw_ad_code_bottom = stripslashes($_POST['ad_code_bottom_1']);
70
+ $ops['ad_code_bottom_1'] = $raw_ad_code_bottom;
 
 
71
 
72
  $ad_referrers = stripslashes($_POST['ad_referrers']); // TODO do i need strip slashes?
73
+ $ops['ad_referrers'] = $ad_referrers;
74
 
75
  $blocked_ips = stripslashes($_POST['blocked_ips']);
76
+ $ops['blocked_ips'] = $blocked_ips;
77
 
78
+ adinj_update_options($ops);
79
 
80
+ if ($ops['ad_insertion_mode'] == 'mfunc') {
81
+ global $adinj_warning_msg_filewrite;
82
+ if (!file_exists(ADINJ_AD_PATH2)){
83
+ mkdir(ADINJ_AD_PATH2, 0750) //TODO is this the right permission?
84
+ or $adinj_warning_msg_filewrite .= "<br />Error: could not create dir: ".ADINJ_AD_PATH2.". Please create it manually and try again.";
85
+ }
86
+ write_ad_to_file($raw_ad_code_random, ADINJ_AD_PATH2.'/'.ADINJ_AD_RANDOM_FILE);
87
+ write_ad_to_file($raw_ad_code_top, ADINJ_AD_PATH2.'/'.ADINJ_AD_TOP_FILE);
88
+ write_ad_to_file($raw_ad_code_bottom, ADINJ_AD_PATH2.'/'.ADINJ_AD_BOTTOM_FILE);
89
+ adinj_write_config_file();
90
+ }
91
 
92
  break;
93
 
99
  case 'Delete settings from DB':
100
  adinj_checkNonce();
101
  delete_option('adinj_options');
102
+
103
+ case 'Delete widget settings from DB':
104
+ adinj_checkNonce();
105
+ delete_option('widget_adinj');
106
  // TODO add option to delete ads files as well
107
  break;
108
  }
112
  // so be careful if adding any new ones - they might not exist yet, but could
113
  // still be referenced by adshow.
114
  function adinj_write_config_file(){
115
+ $ops = adinj_options();
116
+ if ($ops['ad_insertion_mode'] != 'mfunc') return;
117
  $referrer_list = adinj_quote_list('ad_referrers');
118
  $ip_list = adinj_quote_list('blocked_ips');
119
  $sevisitors_only = adinj_ticked('sevisitors_only')?'true':'false';
141
 
142
  ?>
143
  CONFIG;
144
+
 
 
 
 
 
145
  adinj_write_file(ADINJ_CONFIG_FILE2, $config, 0640);
146
 
147
  }
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
  fwrite($handle, $content) or $adinj_warning_msg_filewrite .= "<br />Error: could not write to file: $path";
170
  }
171
 
172
  function adinj_options_page(){
173
+ $ops = adinj_options();
174
+ if ($ops === false || adinj_options_need_upgrading($ops)){
175
  // Upgraded via FTP without being deactivated/reactivated
176
  adinj_activate_hook();
177
  }
178
+ $ops = adinj_options(1);
179
+ if (!file_exists(ADINJ_CONFIG_FILE2)){
180
  adinj_write_config_file();
181
  }
182
 
199
  echo "If you are using a caching plugin you might need to delete its cache for any changes to take effect.";
200
  }
201
  echo '</strong>';
202
+ if ($ops['ad_insertion_mode']=='mfunc'){
203
  global $adinj_warning_msg_filewrite;
204
  if (!empty($adinj_warning_msg_filewrite)){
205
  echo $adinj_warning_msg_filewrite;
210
  if (!empty($adinj_warning_msg_chmod)){
211
  echo '<br />Info: Some warnings were generated by chmod. See the <a href="#debugging">debugging</a> section for more info.';
212
  }
213
+ echo '<br />Info: <a href="#restrictions">injection mode</a>='.$ops['ad_insertion_mode'];
214
+ if ($ops['ads_enabled'] != 'on'){
215
+ echo '<br /><font color="red">Warning: Ads are not enabled. You need to turn the ads on for everyone to see them.</font>';
216
  }
217
  echo '</p></div>';
218
 
230
  <ul>
231
  <li><a href="http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/" target="_new">Ad Injection Home</a></li>
232
  <li><a href="http://wordpress.org/extend/plugins/ad-injection/" target="_new">Ad Injection at WordPress</a></li>
233
+ <li><b><a href="https://spreadsheets.google.com/viewform?formkey=dFUwZzBYcG1HNzNKMmJZdWFDdFhkY0E6MQ" target="_new">Report a bug / give feedback</a></b></li>
234
  </ul>
235
+ <h4>Coming soon</h4>
236
  <ul>
237
+ <li>More precise control over which categories and tags the ads are shown in.</li>
238
+ <li>Extra places where adverts can be inserted.</li>
239
  </ul>
240
 
241
  <h4><font color="red">Be careful!</font></h4>
242
  <p>Make sure that the ad settings and positioning you define are in compliance with your ad provider's terms of service!</p>
243
 
244
+ <h4><font color="red">Beta version</font></h4>
245
+ <p>This plugin has only only recently been released - please bare with me if there are any bugs. I'm actively listening to your feedback and fixing any problems, and adding new features that you request. Please let me know if you like the plugin too!</p>
246
+
247
+ <h4>More by this author</h4>
248
+ <ul>
249
+ <li><a href="http://www.reviewmylife.co.uk/" target="_new">www.reviewmylife.co.uk</a></li>
250
+ <li><a href="http://www.advancedhtml.co.uk/" target="_new">www.advancedhtml.co.uk</a></li>
251
+ </ul>
252
  </div>
253
  </div>
254
  </div>
264
 
265
  <p>These settings apply to all ads (random, top, bottom, and widget). They will override all other settings.</p>
266
 
267
+ <input type="radio" name="ads_enabled" value="on" <?php if ($ops['ads_enabled']=='on') echo 'checked="checked"'; ?> /> <b>On: <?php _e('Ads enabled', 'adinj') ?></b><br />
268
+ <input type="radio" name="ads_enabled" value="off" <?php if ($ops['ads_enabled']=='off' || $ops['ads_enabled']=='') echo 'checked="checked"'; ?> /> <b>Off</b><br />
269
+ <input type="radio" name="ads_enabled" value="test" <?php if ($ops['ads_enabled']=='test') echo 'checked="checked"'; ?> /> <b>Test mode</b> - Only show ads to admin.<br />
270
+ <span style="font-size:10px;color:red;">Warning: Turn any caching plugin *off* before using test mode. If you leave them on the test adverts will be cached and shown to your real visitors.</span><br />
271
 
272
  <table border="0">
273
  <tr><td>
279
  $older_than_days = array(0, 1, 2, 3, 5, 7, 10, 14, 21, 28, 40, 50);
280
  for ($value=0; $value<sizeof($older_than_days); ++$value){
281
  echo "<option value=\"$older_than_days[$value]\" ";
282
+ if($ops['ads_on_page_older_than'] == $older_than_days[$value]) echo 'selected="selected"';
283
  echo ">$older_than_days[$value]</option>";
284
  }
285
  ?>
304
 
305
  <table border="0" cellspacing="5">
306
  <tr><td style="vertical-align: top">
307
+ <textarea name="ad_code_random_1" rows="10" cols="60"><?php echo $ops['ad_code_random_1']; ?></textarea>
308
  </td><td style="vertical-align: top">
309
  <?php adinj_add_alignment_options('rnd_'); ?>
310
  </td></tr>
315
  </table>
316
 
317
 
318
+ <p><span style="font-size:10px;"><b>Docs:</b> On individual posts or pages this advert is inserted between randomly selected paragraphs. On a multi-post page (e.g. home page), one ad is inserted into each post. Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</span></p>
319
+ <p><span style="font-size:10px;">Be especially careful if you decide to use the 'float' layout options. Make sure that you don't have adverts floated over the top of other page elements, or vice-versa.</span></p>
320
  </div>
321
 
322
  <input type="submit" style="float:right" name="adinj_action" value="<?php _e('Save all settings', 'adinj') ?>" />
339
  <?php
340
  for ($value=0; $value<=6; ++$value){
341
  echo "<option value=\"$value\" ";
342
+ if($ops['max_num_of_ads'] == $value) echo 'selected="selected"';
343
  echo ">$value</option>";
344
  }
345
  ?>
388
  </table>
389
 
390
  <br clear="all" />
391
+ <p><span style="font-size:10px;"><b>Docs:</b> The above directives are processed in order from top to bottom.</span></p>
392
 
393
 
394
  <p></p>
405
  <?php
406
  for ($value=0; $value<=6; ++$value){
407
  echo "<option value=\"$value\" ";
408
+ if($ops['max_num_of_ads_home_page'] == $value) echo 'selected="selected"';
409
  echo ">$value</option>";
410
  }
411
  ?>
412
  </select> <?php echo adinj_getdefault('max_num_of_ads_home_page'); ?><br />
413
 
414
+ <p><span style="font-size:10px;"><b>Docs:</b> On a multi-post home page, one randomly positioned advert will be inserted into each post, up to the maximum number specified here.</span></p>
415
 
416
  <?php adinj_postbox_end(); ?>
417
 
430
 
431
  <table border="0">
432
  <tr><td>
433
+ <textarea name="ad_code_top_1" rows="10" cols="60"><?php echo $ops['ad_code_top_1']; ?></textarea>
434
  </td><td style="vertical-align: top">
435
  <?php adinj_add_alignment_options('top_'); ?>
436
  </td></tr>
437
  </table>
438
  <span style="font-size:10px;">The top ad is in addition to the quantity of other ads selected.</span>
439
 
440
+ <p><span style="font-size:10px;"><b>Docs:</b> The top ad will only appear on single posts and pages. It will not appear on multi-post pages. Try a <a href="#468x15">468x15</a> or <a href="#336x280">336x280</a> advert.</span></p>
441
 
442
  <?php adinj_postbox_end(); ?>
443
 
454
 
455
  <table border="0">
456
  <tr><td>
457
+ <textarea name="ad_code_bottom_1" rows="10" cols="60"><?php echo $ops['ad_code_bottom_1']; ?></textarea>
458
  </td><td style="vertical-align: top">
459
  <?php adinj_add_alignment_options('bottom_'); ?>
460
  </td></tr>
461
  </table>
462
  <span style="font-size:10px;">The top ad is in addition to the quantity of other ads selected.</span>
463
 
464
+ <p><span style="font-size:10px;"><b>Docs:</b> The bottom ad will only appear on single posts and pages. It will not appear on multi-post pages. Try a <a href="#336x280">336x280</a> advert.</span></p>
465
 
466
 
467
  <?php adinj_postbox_end(); ?>
493
  <h4>Ad insertion mode</h4>
494
 
495
  <blockquote>
496
+ <p><input type="radio" name="ad_insertion_mode" value="mfunc" <?php if ($ops['ad_insertion_mode']=='mfunc') echo 'checked="checked"'; ?> /> <b>Use mfunc tags for dynamic features</b> - Dynamic features will work with WP Super Cache in legacy mode (or with a caching program that is compatible with WP Super Cache's mfunc tags). Dynamic features will also work if you don't use a caching program, although if you don't use a caching program 'direct' insertion will be more efficient.</p>
497
+ <p><input type="radio" name="ad_insertion_mode" value="direct_dynamic" <?php if ($ops['ad_insertion_mode']=='direct_dynamic') echo 'checked="checked"'; ?> /> <b>Direct ad insertion with dynamic features</b> - Dynamic features will work if no caching is used. Only select this if you are not using any caching plugin.</p>
498
+ <p><input type="radio" name="ad_insertion_mode" value="direct_static" <?php if ($ops['ad_insertion_mode']=='direct_static') echo 'checked="checked"'; ?> /> <b>Direct static ad insertion</b> - No dynamic feature support. Select this if you are using a caching plugin which is not compatible with WP Super Cache's mfunc tags.</p>
499
  </blockquote>
500
  </div>
501
 
505
 
506
  <blockquote>
507
  <input type="checkbox" name="sevisitors_only" <?php echo adinj_ticked('sevisitors_only'); ?> /><?php _e("Only show ads to search engine visitors (customise search engine referrers below if necessary).", 'adinj') ?><br />
508
+ <textarea name="ad_referrers" rows="2" cols="70"><?php echo $ops['ad_referrers']; ?></textarea>
509
  <p>Comma separated list e.g.: <br /><code>.google., .bing., .yahoo., .ask., search?, search., /search/</code></p>
510
  </blockquote>
511
 
512
  <h4>Blocked IP addresses (dynamic feature)</h4>
513
 
514
  <blockquote>
515
+ <textarea name="blocked_ips" rows="4" cols="70"><?php echo $ops['blocked_ips']; ?></textarea>
516
  <p>Comma separated list e.g.: <br /><code>0.0.0.1, 0.0.0.2</code></p>
517
  <p>Or you can list one IP per line with optional comments e.g.</p>
518
  <code style="padding:0px 0px">192.168.0.1<br />0.0.0.2<br /><?php echo $_SERVER['REMOTE_ADDR'] ?> //my ip<br />0.0.0.3</code>
584
  }
585
 
586
  function adinj_postbox_start($title, $anchor, $width='650px'){
587
+ $ops = adinj_options();
588
  ?>
589
  <div class='postbox-container' style='width:<?php echo $width; ?>;clear:left'>
590
  <div class="metabox-holder">
604
  });
605
  });
606
  </script>
607
+ <input type='hidden' id='ui_<?php echo $anchor; ?>_hide' name='ui_<?php echo $anchor; ?>_hide' value='<?php echo $ops['ui_'.$anchor.'_hide']; ?>' />
608
  <h3><a name="<?php echo $anchor ?>"></a><?php echo adinj_get_logo() . ' ' . $title; ?></h3>
609
  <div class="<?php echo $anchor; ?>-box">
610
  <div class="inside" style="margin:10px">
622
 
623
  function adinj_selection_box($name, $values, $type=NULL){
624
  echo "<select name='$name'>";
625
+ $ops = adinj_options();
626
+ $selected_value = $ops[$name];
627
  foreach ($values as $value){
628
  echo "<option value=\"$value\" ";
629
  if($selected_value == "$value") echo 'selected="selected"';
692
  echo '<h4>Other settings</h4><blockquote>';
693
 
694
  echo 'ADINJ_PATH='.ADINJ_PATH.'<br />';
695
+ echo 'ADINJ_CONFIG_FILE2='.ADINJ_CONFIG_FILE2.'<br />';
696
  echo 'ADINJ_AD_PATH='.ADINJ_AD_PATH.' (up to v0.9.1)<br />';
697
  echo 'ADINJ_AD_PATH2='.ADINJ_AD_PATH2.' (v0.9.2+)<br />';
698
 
769
  }
770
  }
771
 
772
+ $random_file2 = ADINJ_AD_PATH2.'/'.ADINJ_AD_RANDOM_FILE;
773
+ $top_file2 = ADINJ_AD_PATH2.'/'.ADINJ_AD_TOP_FILE;
774
+ $bottom_file2 = ADINJ_AD_PATH2.'/'.ADINJ_AD_BOTTOM_FILE;
775
+ if ($pending_options['ad_insertion_mode'] == 'mfunc'){
776
+ if (!file_exists(ADINJ_AD_PATH2)){
777
+ mkdir(ADINJ_AD_PATH2, 0750) //TODO is this the right permission?
778
+ or $adinj_warning_msg_filewrite .= "<br />Error: could not create dir: ".ADINJ_AD_PATH2.". Please create it manually and try again.";
779
+ }
780
+
781
+ // Restore data after automatic upgrade
782
+ // TODO could remove this code further down the line when everyone
783
+ // has moved to the new ad store location
784
+ if (!file_exists($random_file2) && !empty($pending_options['ad_code_random_1'])){
785
+ write_ad_to_file($pending_options['ad_code_random_1'], $random_file2);
786
+ }
787
+ if (!file_exists($top_file2) && !empty($pending_options['ad_code_top_1'])){
788
+ write_ad_to_file($pending_options['ad_code_top_1'], $top_file2);
789
+ }
790
+ if (!file_exists($bottom_file2) && !empty($pending_options['ad_code_bottom_1'])){
791
+ write_ad_to_file($pending_options['ad_code_bottom_1'], $bottom_file2);
792
+ }
793
+ if (!file_exists(ADINJ_CONFIG_FILE2)){
794
+ adinj_write_config_file();
795
+ }
796
  }
797
 
798
  // In case ads are saved on file and upgrading from first version on plugin
799
  // TODO maybe delete this in a few versions time?
800
+ $random_file = ADINJ_AD_PATH.'/'.ADINJ_AD_RANDOM_FILE;
801
+ $top_file = ADINJ_AD_PATH.'/'.ADINJ_AD_TOP_FILE;
802
+ $bottom_file = ADINJ_AD_PATH.'/'.ADINJ_AD_BOTTOM_FILE;
803
  if (empty($pending_options['ad_code_random_1']) && file_exists($random_file)){
804
  $pending_options['ad_code_random_1'] = read_ad_from_file($random_file);
805
  }
832
 
833
  function adinj_default_options(){
834
  return array(
835
+ 'ads_enabled' => 'off',
836
  'max_num_of_ads' => '2', // single posts and pages
837
  'max_num_of_ads_home_page' => '3',
838
  'no_random_ads_if_shorter_than' => '100',
1029
  }
1030
 
1031
  function adinj_init_hook() {
1032
+ $ops = adinj_options();
1033
+ if ($ops['ads_enabled'] != 'on') {
1034
  add_action('admin_notices', 'adinj_init_warning');
1035
  }
1036
  }
ad-injection-widget.php CHANGED
@@ -60,9 +60,10 @@ class Ad_Injection_Widget extends WP_Widget {
60
  $instance['title'] = strip_tags( $new_instance['title'] );
61
  $instance['advert'] = $new_instance['advert'];
62
 
63
- // TODO later on stop saving to the old ad path
64
- write_ad_to_file($instance['advert'], $this->get_ad_file_path());
65
- write_ad_to_file($instance['advert'], $this->get_ad_file_path2());
 
66
 
67
  return $instance;
68
  }
@@ -101,10 +102,6 @@ class Ad_Injection_Widget extends WP_Widget {
101
  <?php
102
  }
103
 
104
- function get_ad_file_path(){
105
- return ADINJ_AD_PATH.'/'.$this->get_ad_file_name();
106
- }
107
-
108
  function get_ad_file_path2(){
109
  return ADINJ_AD_PATH2.'/'.$this->get_ad_file_name();
110
  }
60
  $instance['title'] = strip_tags( $new_instance['title'] );
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
  }
102
  <?php
103
  }
104
 
 
 
 
 
105
  function get_ad_file_path2(){
106
  return ADINJ_AD_PATH2.'/'.$this->get_ad_file_name();
107
  }
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.3.1
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -15,7 +15,6 @@ License: GPLv2
15
 
16
  // Files
17
  define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
18
- define('ADINJ_CONFIG_FILE', ADINJ_PATH . '/ad-injection-config.php');
19
  define('ADINJ_CONFIG_FILE2', WP_CONTENT_DIR . '/ad-injection-config.php'); // same directory as WP Super Cache config file
20
  define('ADINJ_AD_PATH', ADINJ_PATH . '/ads'); // old ad store
21
  define('ADINJ_AD_PATH2', WP_PLUGIN_DIR.'/ad-injection-data'); // ad store from 0.9.2
@@ -323,8 +322,13 @@ ADINJ_AD_PATH2=$path2
323
  }
324
 
325
  function adinj_ads_completely_disabled_from_page($content=NULL){
326
- if (!adinj_ticked('ads_enabled')){
327
- return "NOADS: ads_enabled not ticked";
 
 
 
 
 
328
  }
329
 
330
  // check for ads on certain page types being disabled
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.3.2
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
15
 
16
  // Files
17
  define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
 
18
  define('ADINJ_CONFIG_FILE2', WP_CONTENT_DIR . '/ad-injection-config.php'); // same directory as WP Super Cache config file
19
  define('ADINJ_AD_PATH', ADINJ_PATH . '/ads'); // old ad store
20
  define('ADINJ_AD_PATH2', WP_PLUGIN_DIR.'/ad-injection-data'); // ad store from 0.9.2
322
  }
323
 
324
  function adinj_ads_completely_disabled_from_page($content=NULL){
325
+ $ops = adinj_options();
326
+ if ($ops['ads_enabled'] == 'off' ||
327
+ $ops['ads_enabled'] == ''){
328
+ return "NOADS: Ads are not switched on";
329
+ }
330
+ if ($ops['ads_enabled'] == 'test' && !current_user_can('activate_plugins')){
331
+ return "NOADS: test mode enabled - ads only shown admins";
332
  }
333
 
334
  // check for ads on certain page types being disabled
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.3.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
 
@@ -56,6 +56,8 @@ As the plugin will inject whatever content you like into the page you can write
56
 
57
  If there are any panels on the admin screen that you don't need, you can click on the show/hide button to hide them until you need them.
58
 
 
 
59
  == Installation ==
60
 
61
  This section describes how to install the plugin and get it working.
@@ -67,6 +69,12 @@ This section describes how to install the plugin and get it working.
67
  5. Tick the box right at the top to enable your ads.
68
  6. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
69
 
 
 
 
 
 
 
70
  == Frequently Asked Questions ==
71
 
72
  = Why was this plugin created? =
@@ -142,26 +150,40 @@ Here are some things to check if the ads are not appearing, or are appearing whe
142
  5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
143
  6. The plugin inserts adverts after the closing HTML paragraph tag </p>. If the ads aren't appearing where you expect, check where your </p> tags are.
144
 
145
- If you are using WP Super Cache.
146
 
147
  1. Have you enabled the WP Super Cache 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
148
  2. Are your WP Super Cache settings correct? It must be in 'Legacy' mode.
149
  3. If you are using WP Minify as well then turn off the HTML minification as this strips out the mfunc tags that Ad Injection uses to check if the adverts should be inserted.
150
 
151
- If you are using WP Minify
152
 
153
  1. Turn off the HTML minification mode if you are also using WP Super Cache. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
154
  2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
155
 
156
- If you are getting errors when using the plugin check the following.
157
 
158
- 1. Is there an 'ads' directory in the plugin directory? The path will probably be: '/wp-content/plugins/ad-injection/ads/'. If not create the ads directory and make sure it is writeable by the plugin (chmod 0755 will do, chmod 0750 is better).
159
- 2. Are there text files in the ads directory? The ad code that you enter into the ad boxes should get saved in text files in the ads directory.
160
- 3. Has the config file been created? It should be at '/wp-content/plugins/ad-injection/ad-injection-config.php'. If not make sure the '/wp-content/plugins/ad-injection/' directory is writeable (chmod 0750 is best, chmod 0755 will do).
161
 
162
- If you do get any errors please use the 'Report a bug or give feedback' link on the plugin to send me the error details. If things go so badly wrong that you can't even get to the settings page please send me an email via [this contact form](http://www.reviewmylife.co.uk/contact-us/ "contact form").
163
 
164
- For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  == Screenshots ==
167
 
@@ -171,6 +193,9 @@ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/201
171
 
172
  == Changelog ==
173
 
 
 
 
174
  = 0.9.3.1 =
175
  Fix chmod comparison problem.
176
 
@@ -219,6 +244,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
219
 
220
  == Upgrade Notice ==
221
 
 
 
 
222
  = 0.9.3.1 =
223
  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).
224
 
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.3.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
 
56
 
57
  If there are any panels on the admin screen that you don't need, you can click on the show/hide button to hide them until you need them.
58
 
59
+ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
60
+
61
  == Installation ==
62
 
63
  This section describes how to install the plugin and get it working.
69
  5. Tick the box right at the top to enable your ads.
70
  6. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
71
 
72
+ = How to uninstall =
73
+
74
+ You can uninstall by deactivating the plugin and deleting from the WordPress plugins control panel.
75
+
76
+ If you have been using mfunc mode with WP Super Cache then you *must* also clear the cache afterwards, otherwise you'll get errors saying the Ad Injection includes can't be found.
77
+
78
  == Frequently Asked Questions ==
79
 
80
  = Why was this plugin created? =
150
  5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
151
  6. The plugin inserts adverts after the closing HTML paragraph tag </p>. If the ads aren't appearing where you expect, check where your </p> tags are.
152
 
153
+ = If you are using WP Super Cache. =
154
 
155
  1. Have you enabled the WP Super Cache 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
156
  2. Are your WP Super Cache settings correct? It must be in 'Legacy' mode.
157
  3. If you are using WP Minify as well then turn off the HTML minification as this strips out the mfunc tags that Ad Injection uses to check if the adverts should be inserted.
158
 
159
+ = If you are using WP Minify =
160
 
161
  1. Turn off the HTML minification mode if you are also using WP Super Cache. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
162
  2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
163
 
164
+ = If you are getting errors when using mfunc mode check the following =
165
 
166
+ 1. Are there ad data directories in the plugin directory? The path will be:
 
 
167
 
168
+ '/wp-content/plugins/ad-injection-data/.
169
 
170
+ If not create this directory and make sure it is writeable by the plugin (chmod 0755 will do, chmod 0750 is better).
171
+
172
+ 2. Are there text files in the ads directories? The ad code that you enter into the ad boxes should get saved in text files in the ads directory.
173
+
174
+ 3. Has the config file been created? It should be at '/wp-content/ad-injection-config.php'. If not make sure the '/wp-content/' directory is writeable (chmod 0750 is best, chmod 0755 will do).
175
+
176
+ = Errors after uninstalling the plugin =
177
+
178
+ If you get an error like:
179
+
180
+ 'Warning: include_once(/homepages/xx/dxxxx/htdocs/blog/wp-content/plugins/ad-injection/adshow.php) [function.include-once]: failed to open stream: No such file or directory in /homepages/xx/dxxxx/htdocs/blog/ on line xx'
181
+
182
+ Then you need to delete your cache. The references to the Ad Injection includes are still in your cached files, deleting the cache will get rid of them.
183
+
184
+ = Reporting bugs =
185
+
186
+ If you do get any errors please use the 'Report a bug or give feedback' link on the plugin to send me the error details. If things go so badly wrong that you can't even get to the settings page please send me an email via [this contact form](http://www.reviewmylife.co.uk/contact-us/ "contact form").
187
 
188
  == Screenshots ==
189
 
193
 
194
  == Changelog ==
195
 
196
+ = 0.9.3.2 =
197
+ Add test mode, and further reduce unnecessary file access.
198
+
199
  = 0.9.3.1 =
200
  Fix chmod comparison problem.
201
 
244
 
245
  == Upgrade Notice ==
246
 
247
+ = 0.9.3.2 =
248
+ 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).
249
+
250
  = 0.9.3.1 =
251
  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).
252
 
uninstall.php CHANGED
@@ -9,6 +9,7 @@ if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
9
 
10
  // Database cleanup
11
  delete_option('adinj_options');
 
12
 
13
  // Delete the configuration file
14
  $adinj_dir = dirname(__FILE__);
9
 
10
  // Database cleanup
11
  delete_option('adinj_options');
12
+ //delete_option('widget_adinj'); //TODO does WordPress do this automatically?
13
 
14
  // Delete the configuration file
15
  $adinj_dir = dirname(__FILE__);