Ad Injection - Version 1.1.0.2

Version Description

  • Remove confusing Disabled/Enabled drop down options as all ads can be enabled/disabled from the tick boxes. Please check your ads after this update and report any problems!
  • Hide certain parts of the UI when the 'All' exclude boxes are ticked.
  • New configured/empty indicator on the category/tag/author/id settings.
Download this release

Release Info

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

Code changes from version 1.1.0.1 to 1.1.0.2

Files changed (4) hide show
  1. ad-injection-admin.php +84 -13
  2. ad-injection.php +34 -28
  3. readme.txt +11 -3
  4. ui-tab-main.php +61 -56
ad-injection-admin.php CHANGED
@@ -339,7 +339,7 @@ function adinj_top_message_box(){
339
 
340
  } else if (!isset($_GET['tab'])){
341
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
342
- echo "22nd July 2011: You can now put ads anywhere in your theme template - you just need to add some simple PHP - see the readme.txt for details (search for 'adinj_print_ad'. Also UI updates. 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>.';
343
  echo '</strong></p></div>';
344
  }
345
  }
@@ -362,7 +362,7 @@ function adinj_side_donate_box(){
362
  <input type="hidden" name="currency_code" value="USD">
363
  <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
364
  <p>Amount:<br>
365
- <input class="omni_donate_field" type="text" name="amount" size="9" title="The amount you wish to donate" value="10">
366
  <select id="currency_code" name="currency_code">
367
  <option value="USD">U.S. Dollars</option>
368
  <option value="GBP">Pounds Sterling</option>
@@ -425,9 +425,20 @@ function adinj_feedback_url(){
425
  return "https://spreadsheets.google.com/viewform?formkey=dFUwZzBYcG1HNzNKMmJZdWFDdFhkY0E6MQ&amp;entry_3=$data";
426
  }
427
 
428
- function adinj_add_checkbox($name){
 
 
 
 
429
  echo '<input type="hidden" name="'.$name.'" value="off" />';
430
- echo '<input type="checkbox" name="'.$name.'" '.adinj_ticked($name).' />';
 
 
 
 
 
 
 
431
  }
432
 
433
  // From WP Super cache
@@ -608,9 +619,9 @@ function adinj_max_num_ads($adtype, $pagetype){
608
  }
609
  if ($adtype == 'top' || $adtype == 'bottom'){
610
  if ($pagetype == "single" || $pagetype == "page"){
611
- if (!adinj_disabled($ops[$adtype.'_ad_if_longer_than'])) return 1;
612
  } else if ($pagetype == 'home' || $pagetype == 'archive'){
613
- if (!adinj_disabled($ops[$pagetype.'_'.$adtype.'_ad_if_longer_than'])) return $ops[$pagetype.'_max_num_'.$adtype.'_ads_per_page'];
614
  } else if ($pagetype == "excerpt"){
615
  //TODO
616
  }
@@ -650,17 +661,18 @@ function adinj_selection_box($name, $values, $type="", $selected_value=NULL){
650
  }
651
  echo "<option value=\"$option_value\" ";
652
  if("$selected_value" == "$option_value" ||
653
- "$selected_value" == ADINJ_ALWAYS_SHOW && "$option_value" == 'a' ||
654
- "$selected_value" == ADINJ_DISABLED && "$option_value" == 'd' ||
655
- "$selected_value" == ADINJ_RULE_DISABLED && "$option_value" == 'd' ||
 
656
  "$selected_value" == ADINJ_ONLY_SHOW_IN && "$option_value" == 'o' ||
657
  "$selected_value" == ADINJ_NEVER_SHOW_IN && "$option_value" == 'n'){
658
  echo 'selected="selected"';
659
  }
660
  $typetxt = $type;
661
- if (adinj_disabled($option_value) || adinj_alwaysshow($display_value)) $typetxt = "";
662
- if ("$option_value" === 'a') { $display_value = ADINJ_ALWAYS_SHOW; }
663
- if ("$option_value" === 'd') { $display_value = ADINJ_DISABLED; }
664
  if ("$option_value" === 'o') { $display_value = ADINJ_ONLY_SHOW_IN; }
665
  if ("$option_value" === 'n') { $display_value = ADINJ_NEVER_SHOW_IN; }
666
  echo ">$display_value $typetxt</option>";
@@ -679,6 +691,13 @@ function adinj_javascript_addtext(){
679
  }
680
  element.value += (separator + value);
681
  }
 
 
 
 
 
 
 
682
  </script>
683
  <?php
684
  }
@@ -708,7 +727,13 @@ HTML;
708
 
709
  function adinj_condition_tables($prefix, $show_setting){
710
  $ops = adinj_options();
711
- echo "Category tag, author, and post id conditions";
 
 
 
 
 
 
712
  adinj_add_show_hide_section('ad_conditions_'.uniqid(''), $show_setting, $show_setting, $ops);
713
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
714
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
@@ -1158,6 +1183,52 @@ function adinj_upgrade_db(){
1158
  $new_options['rnd_allow_ads_on_last_paragraph'] = 'on';
1159
  }
1160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1161
  // 3. Bump up db version number.
1162
  $new_options['db_version'] = $new_dbversion;
1163
 
339
 
340
  } else if (!isset($_GET['tab'])){
341
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
342
+ echo "22nd August 2011: Please check your ads after this update! I've attempted to make the settings less confusing by removing some duplicate ways to enable/disable ads. Instead of 'Disabled/Always show' options on the pull down boxes I now have an 'n/a' value to signify that the settings isn't being used. Ads can be disabled using the tick boxes instead. If you have disabled ads using the 'Disabled' option the correct tick boxes should now be checked. I've tested as much as I can but there is a risk with this update so do check your settings/ads. Also some parts of the UI will now dissapear if the 'All' boxes are ticked. 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>.';
343
  echo '</strong></p></div>';
344
  }
345
  }
362
  <input type="hidden" name="currency_code" value="USD">
363
  <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
364
  <p>Amount:<br>
365
+ <input class="omni_donate_field" type="text" name="amount" size="9" title="The amount you wish to donate" value="20">
366
  <select id="currency_code" name="currency_code">
367
  <option value="USD">U.S. Dollars</option>
368
  <option value="GBP">Pounds Sterling</option>
425
  return "https://spreadsheets.google.com/viewform?formkey=dFUwZzBYcG1HNzNKMmJZdWFDdFhkY0E6MQ&amp;entry_3=$data";
426
  }
427
 
428
+ function adinj_add_checkbox($name, $class=NULL, $all=NULL){
429
+ $classhtml = '';
430
+ $jshtml = '';
431
+ if ($class != NULL) $classhtml=' class="'.$all.$class.'"';
432
+ if ($all != NULL) $jshtml = 'onClick="javascript:adinj_toggle_tick_boxes('."'".$class."',this.checked".');"';
433
  echo '<input type="hidden" name="'.$name.'" value="off" />';
434
+ echo '<input type="checkbox" name="'.$name.'" '.adinj_ticked($name)."$classhtml $jshtml />";
435
+ if ($all != NULL && adinj_ticked($name)){
436
+ ?>
437
+ <script type="text/javascript">
438
+ document.write('<style type="text/css" media="screen">.<?php echo $class; ?> { display: none; }</style>');
439
+ </script>
440
+ <?php
441
+ }
442
  }
443
 
444
  // From WP Super cache
619
  }
620
  if ($adtype == 'top' || $adtype == 'bottom'){
621
  if ($pagetype == "single" || $pagetype == "page"){
622
+ return 1;
623
  } else if ($pagetype == 'home' || $pagetype == 'archive'){
624
+ return $ops[$pagetype.'_max_num_'.$adtype.'_ads_per_page'];
625
  } else if ($pagetype == "excerpt"){
626
  //TODO
627
  }
661
  }
662
  echo "<option value=\"$option_value\" ";
663
  if("$selected_value" == "$option_value" ||
664
+ "$selected_value" == ADINJ_ALWAYS_SHOW && "$option_value" == 'a' || //todo remove?
665
+ "$selected_value" == ADINJ_DISABLED && "$option_value" == 'd' || //todo remove?
666
+ "$selected_value" == ADINJ_NA && "$option_value" == 'd' ||
667
+ "$selected_value" == ADINJ_RULE_DISABLED && "$option_value" == 'd' || //todo remove?
668
  "$selected_value" == ADINJ_ONLY_SHOW_IN && "$option_value" == 'o' ||
669
  "$selected_value" == ADINJ_NEVER_SHOW_IN && "$option_value" == 'n'){
670
  echo 'selected="selected"';
671
  }
672
  $typetxt = $type;
673
+ if (adinj_not_set($option_value) || adinj_alwaysshow($display_value)) $typetxt = "";
674
+ if ("$option_value" === 'a') { $display_value = ADINJ_NA; } //TODO remove?
675
+ if ("$option_value" === 'd') { $display_value = ADINJ_NA; }
676
  if ("$option_value" === 'o') { $display_value = ADINJ_ONLY_SHOW_IN; }
677
  if ("$option_value" === 'n') { $display_value = ADINJ_NEVER_SHOW_IN; }
678
  echo ">$display_value $typetxt</option>";
691
  }
692
  element.value += (separator + value);
693
  }
694
+ function adinj_toggle_tick_boxes(name, hide){
695
+ if (hide){
696
+ jQuery('.'+name).hide();
697
+ } else {
698
+ jQuery('.'+name).show();
699
+ }
700
+ }
701
  </script>
702
  <?php
703
  }
727
 
728
  function adinj_condition_tables($prefix, $show_setting){
729
  $ops = adinj_options();
730
+ if (strlen($ops[$prefix.'category_condition_entries'])>0 || strlen($ops[$prefix.'tag_condition_entries'])>0 &&
731
+ strlen($ops[$prefix.'author_condition_entries'])>0 || strlen($ops[$prefix.'id_condition_entries'])>0){
732
+ $msg = "configured";
733
+ } else {
734
+ $msg = "empty";
735
+ }
736
+ echo "Category tag, author, and post id conditions [<b>".$msg."</b>]";
737
  adinj_add_show_hide_section('ad_conditions_'.uniqid(''), $show_setting, $show_setting, $ops);
738
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
739
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
1183
  $new_options['rnd_allow_ads_on_last_paragraph'] = 'on';
1184
  }
1185
 
1186
+ if ($stored_dbversion < 15){
1187
+ // values deliberately hard coded here to fix them on constants used for this version of db
1188
+
1189
+ // if set to disabled
1190
+ if ($stored_options['top_ad_if_longer_than'] == 'd' || $stored_options['top_ad_if_longer_than'] == 'Disabled' || $stored_options['top_ad_if_longer_than'] == 'Rule Disabled'){
1191
+ $new_options['top_exclude_single'] = 'on';
1192
+ $new_options['top_exclude_page'] = 'on';
1193
+ }
1194
+ if ($stored_options['home_top_ad_if_longer_than'] == 'd' || $stored_options['home_top_ad_if_longer_than'] == 'Disabled' || $stored_option['home_top_ad_if_longer_than'] == 'Rule Disabled'){
1195
+ $new_options['top_exclude_home'] = 'on';
1196
+ }
1197
+ if ($stored_options['archive_top_ad_if_longer_than'] == 'd' || $stored_options['archive_top_ad_if_longer_than'] == 'Disabled' || $stored_options['archive_top_ad_if_longer_than'] == 'Rule Disabled'){
1198
+ $new_options['top_exclude_archive'] = 'on';
1199
+ }
1200
+ if ($stored_options['bottom_ad_if_longer_than'] == 'd' || $stored_options['bottom_ad_if_longer_than'] == 'Disabled' || $stored_options['bottom_ad_if_longer_than'] == 'Rule Disabled'){
1201
+ $new_options['bottom_exclude_single'] = 'on';
1202
+ $new_options['bottom_exclude_page'] = 'on';
1203
+ }
1204
+ if ($stored_options['home_bottom_ad_if_longer_than'] == 'd' || $stored_options['home_bottom_ad_if_longer_than'] == 'Disabled' || $stored_options['home_bottom_ad_if_longer_than'] == 'Rule Disabled'){
1205
+ $new_options['bottom_exclude_home'] = 'on';
1206
+ }
1207
+ if ($stored_options['archive_bottom_ad_if_longer_than'] == 'd' || $stored_options['archive_bottom_ad_if_longer_than'] == 'Disabled' || $stored_options['archive_bottom_ad_if_longer_than'] == 'Rule Disabled'){
1208
+ $new_options['bottom_exclude_archive'] = 'on';
1209
+ }
1210
+
1211
+ // if set to always show
1212
+ if ($stored_options['top_ad_if_longer_than'] == 'a' || $stored_options['top_ad_if_longer_than'] == 'Always show'){
1213
+ $new_options['top_ad_if_longer_than'] = 'd';
1214
+ }
1215
+ if ($stored_options['home_top_ad_if_longer_than'] == 'a' || $stored_options['home_top_ad_if_longer_than'] == 'Always show'){
1216
+ $new_options['home_top_ad_if_longer_than'] = 'd';
1217
+ }
1218
+ if ($stored_options['archive_top_ad_if_longer_than'] == 'a' || $stored_options['archive_top_ad_if_longer_than'] == 'Always show'){
1219
+ $new_options['archive_top_ad_if_longer_than'] = 'd';
1220
+ }
1221
+ if ($stored_options['bottom_ad_if_longer_than'] == 'a' || $stored_options['bottom_ad_if_longer_than'] == 'Always show'){
1222
+ $new_options['bottom_ad_if_longer_than'] = 'd';
1223
+ }
1224
+ if ($stored_options['home_bottom_ad_if_longer_than'] == 'a' || $stored_options['home_bottom_ad_if_longer_than'] == 'Always show'){
1225
+ $new_options['home_bottom_ad_if_longer_than'] = 'd';
1226
+ }
1227
+ if ($stored_options['archive_bottom_ad_if_longer_than'] == 'a' || $stored_options['archive_bottom_ad_if_longer_than'] == 'Always show'){
1228
+ $new_options['archive_bottom_ad_if_longer_than'] = 'd';
1229
+ }
1230
+ }
1231
+
1232
  // 3. Bump up db version number.
1233
  $new_options['db_version'] = $new_dbversion;
1234
 
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: 1.1.0.1
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -30,7 +30,8 @@ define('ADINJ_NO_CONFIG_FILE', 1);
30
  // 11 = options to disable rnd ad at bottom, and to get new ad for each rnd slot
31
  // 13 = post/page id restrictions
32
  // 14 = template ads
33
- define('ADINJ_DB_VERSION', 14);
 
34
 
35
  // Files
36
  // TODO will these paths work on windows?
@@ -39,12 +40,13 @@ define('ADINJ_CONFIG_FILE', WP_CONTENT_DIR . '/ad-injection-config.php');
39
  define('ADINJ_AD_PATH', WP_PLUGIN_DIR.'/ad-injection-data');
40
 
41
  // Constants
42
- define('ADINJ_DISABLED', 'Disabled');
43
- define('ADINJ_RULE_DISABLED', 'Rule Disabled');
44
- define('ADINJ_ALWAYS_SHOW', 'Always show');
45
  //
46
  define('ADINJ_ONLY_SHOW_IN', 'Only show in');
47
  define('ADINJ_NEVER_SHOW_IN', 'Never show in');
 
48
 
49
  // Global variables
50
  $adinj_total_top_ads_used = 0;
@@ -298,12 +300,12 @@ function adinj_formatting_options($adtype, $ops, $output_type="string"){
298
  $padding_top = $ops[$prefix.'padding_top'];
299
  $padding_bottom = $ops[$prefix.'padding_bottom'];
300
 
301
- if (adinj_disabled($align)) $align = "";
302
- if (adinj_disabled($clear)) $clear = "";
303
- if (adinj_disabled($margin_top)) $margin_top = "";
304
- if (adinj_disabled($margin_bottom)) $margin_bottom = "";
305
- if (adinj_disabled($padding_top)) $padding_top = "";
306
- if (adinj_disabled($padding_bottom)) $padding_bottom = "";
307
 
308
  if ($output_type == "string"){
309
  return "'align' => '$align', 'clear' => '$clear', 'margin_top' => '$margin_top', 'margin_bottom' => '$margin_bottom', 'padding_top' => '$padding_top', 'padding_bottom' => '$padding_bottom'";
@@ -844,7 +846,7 @@ function adinj_paragraph_to_start_ads(){
844
  if (adinj_ticked('first_paragraph_ad')) return 1;
845
  return -1;
846
  }
847
- if (adinj_disabled('start_from_paragraph')){
848
  return -1;
849
  } else {
850
  return $ops['start_from_paragraph'];
@@ -888,7 +890,8 @@ function adinj_num_top_ads_to_insert($content_length){
888
  if (!adinj_allowed_in_author('top', $ops)) return 0;
889
  if (!adinj_allowed_in_id('top', $ops)) return 0;
890
 
891
- if (adinj_do_rule_if($ops[$prefix.'top_ad_if_longer_than'], '<', $content_length)){
 
892
  return 1;
893
  }
894
  return 0;
@@ -912,7 +915,8 @@ function adinj_num_bottom_ads_to_insert($content_length){
912
  if (!adinj_allowed_in_author('bottom', $ops)) return 0;
913
  if (!adinj_allowed_in_id('bottom', $ops)) return 0;
914
 
915
- if (adinj_do_rule_if($ops[$prefix.'bottom_ad_if_longer_than'], '<', $content_length)){
 
916
  return 1;
917
  }
918
  return 0;
@@ -944,18 +948,17 @@ function adinj_num_rand_ads_to_insert($content_length){
944
  if (!adinj_allowed_in_tag('random', $ops)) return 0;
945
  if (!adinj_allowed_in_author('random', $ops)) return 0;
946
  if (!adinj_allowed_in_id('random', $ops)) return 0;
947
-
948
  $length = $content_length;
949
- if (adinj_do_rule_if($ops[$prefix.'no_random_ads_if_shorter_than'], '>', $length)){
950
  return 0;
951
  }
952
- if (adinj_do_rule_if($ops[$prefix.'one_ad_if_shorter_than'], '>', $length)){
953
  return 1;
954
  }
955
- if (adinj_do_rule_if($ops[$prefix.'two_ads_if_shorter_than'], '>', $length)){
956
  return min(2, $max_num_rand_ads_to_insert);
957
  }
958
- if (adinj_do_rule_if($ops[$prefix.'three_ads_if_shorter_than'], '>', $length)){
959
  return min(3, $max_num_rand_ads_to_insert);
960
  }
961
  return $max_num_rand_ads_to_insert;
@@ -975,15 +978,14 @@ function adinj_num_footer_ads_to_insert(){
975
  return 1;
976
  }
977
 
978
- function adinj_do_rule_if($rule_value, $condition, $content_length){
979
- if (adinj_alwaysshow($rule_value)) return true;
980
- if (adinj_disabled($rule_value)) return false;
981
  if ($condition == '>'){
982
- return ($rule_value > $content_length);
983
  } else if ($condition == '<'){
984
- return ($rule_value < $content_length);
985
  } else {
986
- die("adinj_do_rule_if bad condition: $condition");
987
  }
988
  }
989
 
@@ -997,12 +999,16 @@ function adinj_mfunc_mode(){
997
  return ($ops['ad_insertion_mode'] == 'mfunc');
998
  }
999
 
1000
- function adinj_disabled($value){
 
 
 
 
1001
  return "$value" == ADINJ_RULE_DISABLED || "$value" == ADINJ_DISABLED || "$value" == 'd' || "$value" == '';
1002
  }
1003
 
1004
- function adinj_alwaysshow($value){
1005
- return "$value" == ADINJ_ALWAYS_SHOW || "$value" == 'a';
1006
  }
1007
 
1008
  function adinj_ticked($option, $ops=array()){
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: 1.1.0.2
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
30
  // 11 = options to disable rnd ad at bottom, and to get new ad for each rnd slot
31
  // 13 = post/page id restrictions
32
  // 14 = template ads
33
+ // 15 = Remove duplicate 'Disabled' option from top/bottom ad section
34
+ define('ADINJ_DB_VERSION', 15);
35
 
36
  // Files
37
  // TODO will these paths work on windows?
40
  define('ADINJ_AD_PATH', WP_PLUGIN_DIR.'/ad-injection-data');
41
 
42
  // Constants
43
+ define('ADINJ_DISABLED', 'Disabled'); // todo deprecated?
44
+ define('ADINJ_RULE_DISABLED', 'Rule Disabled'); // todo depreacated?
45
+ define('ADINJ_ALWAYS_SHOW', 'Always show'); // todo deprecated?
46
  //
47
  define('ADINJ_ONLY_SHOW_IN', 'Only show in');
48
  define('ADINJ_NEVER_SHOW_IN', 'Never show in');
49
+ define('ADINJ_NA', 'n/a');
50
 
51
  // Global variables
52
  $adinj_total_top_ads_used = 0;
300
  $padding_top = $ops[$prefix.'padding_top'];
301
  $padding_bottom = $ops[$prefix.'padding_bottom'];
302
 
303
+ if (adinj_not_set($align)) $align = "";
304
+ if (adinj_not_set($clear)) $clear = "";
305
+ if (adinj_not_set($margin_top)) $margin_top = "";
306
+ if (adinj_not_set($margin_bottom)) $margin_bottom = "";
307
+ if (adinj_not_set($padding_top)) $padding_top = "";
308
+ if (adinj_not_set($padding_bottom)) $padding_bottom = "";
309
 
310
  if ($output_type == "string"){
311
  return "'align' => '$align', 'clear' => '$clear', 'margin_top' => '$margin_top', 'margin_bottom' => '$margin_bottom', 'padding_top' => '$padding_top', 'padding_bottom' => '$padding_bottom'";
846
  if (adinj_ticked('first_paragraph_ad')) return 1;
847
  return -1;
848
  }
849
+ if (adinj_rule_disabled('start_from_paragraph')){
850
  return -1;
851
  } else {
852
  return $ops['start_from_paragraph'];
890
  if (!adinj_allowed_in_author('top', $ops)) return 0;
891
  if (!adinj_allowed_in_id('top', $ops)) return 0;
892
 
893
+ $val = $ops[$prefix.'top_ad_if_longer_than'];
894
+ if (adinj_not_set($val) || adinj_true_if($content_length, '>', $val)){
895
  return 1;
896
  }
897
  return 0;
915
  if (!adinj_allowed_in_author('bottom', $ops)) return 0;
916
  if (!adinj_allowed_in_id('bottom', $ops)) return 0;
917
 
918
+ $val = $ops[$prefix.'bottom_ad_if_longer_than'];
919
+ if (adinj_not_set($val) || adinj_true_if($content_length, '>', $val)){
920
  return 1;
921
  }
922
  return 0;
948
  if (!adinj_allowed_in_tag('random', $ops)) return 0;
949
  if (!adinj_allowed_in_author('random', $ops)) return 0;
950
  if (!adinj_allowed_in_id('random', $ops)) return 0;
 
951
  $length = $content_length;
952
+ if (adinj_true_if($length, '<', $ops[$prefix.'no_random_ads_if_shorter_than'])){
953
  return 0;
954
  }
955
+ if (adinj_true_if($length, '<', $ops[$prefix.'one_ad_if_shorter_than'])){
956
  return 1;
957
  }
958
+ if (adinj_true_if($length, '<', $ops[$prefix.'two_ads_if_shorter_than'])){
959
  return min(2, $max_num_rand_ads_to_insert);
960
  }
961
+ if (adinj_true_if($length, '<', $ops[$prefix.'three_ads_if_shorter_than'])){
962
  return min(3, $max_num_rand_ads_to_insert);
963
  }
964
  return $max_num_rand_ads_to_insert;
978
  return 1;
979
  }
980
 
981
+ function adinj_true_if($rule_value, $condition, $content_length){
982
+ if (adinj_alwaysshow($rule_value)) return true; // todo deprecated
 
983
  if ($condition == '>'){
984
+ return ($rule_value >= $content_length);
985
  } else if ($condition == '<'){
986
+ return ($rule_value <= $content_length);
987
  } else {
988
+ die("adinj_true_if bad condition: $condition");
989
  }
990
  }
991
 
999
  return ($ops['ad_insertion_mode'] == 'mfunc');
1000
  }
1001
 
1002
+ function adinj_alwaysshow($value){ // todo deprecated?
1003
+ return "$value" == ADINJ_ALWAYS_SHOW || "$value" == 'a';
1004
+ }
1005
+
1006
+ function adinj_rule_disabled($value){
1007
  return "$value" == ADINJ_RULE_DISABLED || "$value" == ADINJ_DISABLED || "$value" == 'd' || "$value" == '';
1008
  }
1009
 
1010
+ function adinj_not_set($value){
1011
+ return adinj_rule_disabled($value);
1012
  }
1013
 
1014
  function adinj_ticked($option, $ops=array()){
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.2.1
7
- Stable tag: 1.1.0.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
 
@@ -47,9 +47,9 @@ You can define multiple adverts for the same ad space which are rotated accordin
47
 
48
  The number of adverts can be set based on the length of the post. It is a good idea for longer posts to have more adverts than shorter posts for example. Adverts can also be turned off for very short posts.
49
 
50
- = Search engines only mode =
51
 
52
- You can specify that ads should only be shown to search engine visitors (or from any other referring websites) so that your regular visitors (who are unlikely to click your ads) get a better experience of your site. You can define which search engines or any other referring sites see your adverts. A visitor who enters the site by a search engine will see ads for the next hour.
53
 
54
  = Ads on old posts only =
55
 
@@ -487,6 +487,11 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
487
 
488
  == Changelog ==
489
 
 
 
 
 
 
490
  = 1.1.0.1 =
491
  * Template ads - you can now include ads anywhere in your theme template with some simple tags. You can load the top/random/bottom/footer ads, or you can load an ad from a text file on disk. Template ads inherit the same restrictions as for ads configured via the UI.
492
  * UI usability improvements.
@@ -664,6 +669,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
664
 
665
  == Upgrade Notice ==
666
 
 
 
 
667
  = 1.1.0.1 =
668
  * Template ads - you can now include ads anywhere in your theme template with some simple tags. UI usability improvements.
669
 
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.2.1
7
+ Stable tag: 1.1.0.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
 
47
 
48
  The number of adverts can be set based on the length of the post. It is a good idea for longer posts to have more adverts than shorter posts for example. Adverts can also be turned off for very short posts.
49
 
50
+ = Search engines only mode (restrict by referrer) =
51
 
52
+ You can specify that ads should only be shown to search engine visitors, or to visitors from defined referring websites - e.g. Facebook, Wikipedia, etc. This will give your regular visitors (who are unlikely to click your ads) a better experience of your site. You can define which search engines or referring sites see your adverts. A visitor who enters the site by one of these referrers will see ads for the next hour.
53
 
54
  = Ads on old posts only =
55
 
487
 
488
  == Changelog ==
489
 
490
+ = 1.1.0.2 =
491
+ * Remove confusing Disabled/Enabled drop down options as all ads can be enabled/disabled from the tick boxes. Please check your ads after this update and report any problems!
492
+ * Hide certain parts of the UI when the 'All' exclude boxes are ticked.
493
+ * New configured/empty indicator on the category/tag/author/id settings.
494
+
495
  = 1.1.0.1 =
496
  * Template ads - you can now include ads anywhere in your theme template with some simple tags. You can load the top/random/bottom/footer ads, or you can load an ad from a text file on disk. Template ads inherit the same restrictions as for ads configured via the UI.
497
  * UI usability improvements.
669
 
670
  == Upgrade Notice ==
671
 
672
+ = 1.1.0.2 =
673
+ * Remove confusing Disabled/Enabled drop down options as all ads can be enabled/disabled from the tick boxes. Please check your ads after this update and report any problems!
674
+
675
  = 1.1.0.1 =
676
  * Template ads - you can now include ads anywhere in your theme template with some simple tags. UI usability improvements.
677
 
ui-tab-main.php CHANGED
@@ -50,36 +50,35 @@ function adinj_tab_main(){
50
 
51
  </p>
52
 
53
- <p><span style="font-size:10px;"><b>Notes:</b> Your home page is the page displaying your latest posts. It may be different to your front page if you have configured your front page to be a static page.</span></p>
54
- <p><span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p>
55
  <p><span style="font-size:10px;">Archive pages are the categories, tags, authors and date pages.</span></p>
56
 
57
  <p></p>
58
 
59
- <table border="0" class="adinjtable">
60
- <tr><td></td><td><b>Single/Page</b></td><td><b>Home</b></td><td><b>Archive</b></td></tr>
61
  <tr><td colspan="4"><h3><a name="topadplacement"></a>Top ad [<a href="#topadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
62
 
63
- <tr><td><b>Enabled/disabled</b> (on posts longer than):</td><td>
64
  <?php
65
  $unit = adinj_counting_unit_description();
66
- $ad_if_longer_settings = array('d','a',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
67
  adinj_selection_box("top_ad_if_longer_than", $ad_if_longer_settings, $unit);
68
- echo '</td><td>';
69
  adinj_selection_box("home_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
70
- echo '</td><td>';
71
  adinj_selection_box("archive_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
72
  ?>
73
- </td></tr>
74
 
75
- <tr><td><b>|_</b> Max num of top ads on whole page:</td><td>1</td><td>
76
  <?php
77
  $num_ads_array = array(0,1,2,3,4,5,6,7,8,9,10);
78
  adinj_selection_box("home_max_num_top_ads_per_page", $num_ads_array);
79
- echo '</td><td>';
80
  adinj_selection_box("archive_max_num_top_ads_per_page", $num_ads_array);
81
  ?>
82
- </td></tr>
83
 
84
 
85
  <tr><td colspan="4">
@@ -88,24 +87,24 @@ function adinj_tab_main(){
88
  </td></tr>
89
 
90
  <tr><td colspan="4"><h3><a name="randomadplacement"></a>Random ads [<a href="#randomadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
91
- <tr><td>Max num of random ads on whole page:</td><td>
92
  n/a
93
- </td><td>
94
  <?php
95
  adinj_selection_box("home_max_num_random_ads_per_page", $num_ads_array);
96
- echo '</td><td>';
97
  adinj_selection_box("archive_max_num_random_ads_per_page", $num_ads_array);
98
  ?>
99
- </td></tr>
100
  <tr><td><b>|_ </b>Max num of random ads per post:</td><td>
101
  <?php
102
  adinj_selection_box("max_num_of_ads", $num_ads_array);
103
- echo '</td><td>';
104
  adinj_selection_box("home_max_num_random_ads_per_post", $num_ads_array);
105
- echo '</td><td>';
106
  adinj_selection_box("archive_max_num_random_ads_per_post", $num_ads_array);
107
  ?>
108
- </td></tr>
109
  <?php
110
  adinj_random_ad_limit_table();
111
  ?>
@@ -115,7 +114,7 @@ function adinj_tab_main(){
115
  echo '<tr><td>';
116
  _e("Always put the first ad immediately after paragraph: ", 'adinj');
117
  echo '</td><td>';
118
- 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), " ");
119
  echo '</td></tr>';
120
  ?>
121
  </table>
@@ -128,23 +127,23 @@ function adinj_tab_main(){
128
 
129
  <tr><td colspan="4"><h3><a name="bottomadplacement"></a>Bottom ad [<a href="#bottomadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
130
 
131
- <tr><td><b>Enabled/disabled</b> (on posts longer than):</td><td>
132
  <?php
133
  adinj_selection_box("bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
134
- echo '</td><td>';
135
  adinj_selection_box("home_bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
136
- echo '</td><td>';
137
  adinj_selection_box("archive_bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
138
  ?>
139
- </td></tr>
140
 
141
- <tr><td><b>|_ </b>Max num of bottom ads on whole page:</td><td>1</td><td>
142
  <?php
143
  adinj_selection_box("home_max_num_bottom_ads_per_page", $num_ads_array);
144
- echo '</td><td>';
145
  adinj_selection_box("archive_max_num_bottom_ads_per_page", $num_ads_array);
146
  ?>
147
- </td></tr>
148
 
149
  <tr><td colspan="4">
150
  <b>|_ </b><?php adinj_condition_tables('bottom_', 'ui_bottom_conditions_show'); ?>
@@ -167,8 +166,8 @@ function adinj_tab_main(){
167
 
168
  <?php adinj_postbox_start(__("Adverts", 'adinj'), 'adverts'); ?>
169
 
170
- <h3><a name="topadcode"></a>Top ad (above the post content - this is not a 'header' ad) [<a href="#topadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_top'>pool</a>]--></h3>
171
- <table border="0" class="adinjtable">
172
  <tr><td>
173
  <textarea name="ad_code_top_1" rows="10" cols="60"><?php echo $ops['ad_code_top_1']; ?></textarea>
174
  <br />
@@ -183,7 +182,7 @@ function adinj_tab_main(){
183
  <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>
184
 
185
  <h3><a name="randomadcode"></a>Random ad (inserted randomly between paragraphs) [<a href="#randomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_random'>pool</a>]--></h3>
186
- <table border="0" class="adinjtable">
187
  <tr><td>
188
  <textarea name="ad_code_random_1" rows="10" cols="60"><?php echo $ops['ad_code_random_1']; ?></textarea>
189
  <br />
@@ -197,7 +196,7 @@ function adinj_tab_main(){
197
  </table>
198
 
199
  <h3><a name="bottomadcode"></a>Bottom ad (below the post content) [<a href="#bottomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_bottom'>pool</a>]--></h3>
200
- <table border="0" class="adinjtable">
201
  <tr><td>
202
  <textarea name="ad_code_bottom_1" rows="10" cols="60"><?php echo $ops['ad_code_bottom_1']; ?></textarea>
203
  <br />
@@ -212,7 +211,7 @@ function adinj_tab_main(){
212
 
213
 
214
  <h3><a name="footeradcode"></a>Footer ad (put into 'the_footer' hook - not supported by all themes) [<a href="#footeradplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_footer'>pool</a>]--></h3>
215
- <table border="0" class="adinjtable">
216
  <tr><td>
217
  <textarea name="ad_code_footer_1" rows="10" cols="60"><?php echo $ops['ad_code_footer_1']; ?></textarea>
218
  <br />
@@ -349,12 +348,12 @@ function adinj_insertion_mode_box($ops){
349
  </script>
350
 
351
 
352
- <h4><a name="dynamic"></a>Show ads only to search engine visitors (dynamic feature)</h4>
353
 
354
  <blockquote>
355
- <?php adinj_add_checkbox('sevisitors_only') ?><?php _e("Only show ads to search engine visitors (customise search engine referrers below if necessary).", 'adinj') ?><br />
356
  <textarea name="ad_referrers" rows="2" cols="70"><?php echo $ops['ad_referrers']; ?></textarea>
357
- <p>Comma separated list e.g.: <br /><code>.google., .bing., .yahoo., .ask., search?, search.</code></p>
358
  </blockquote>
359
 
360
  <h4>Blocked IP addresses (dynamic feature)</h4>
@@ -373,57 +372,63 @@ function adinj_insertion_mode_box($ops){
373
  }
374
 
375
  function adinj_add_exclude_row($name, $prefix=''){
 
 
376
  ?>
377
  <tr>
378
  <td><b><?php echo $name; ?></b></td>
379
- <td><?php adinj_add_checkbox($prefix.'exclude_single') ?></td>
380
- <td><?php adinj_add_checkbox($prefix.'exclude_page') ?></td>
381
- <td><?php adinj_add_checkbox($prefix.'exclude_home') ?></td>
382
- <td><?php adinj_add_checkbox($prefix.'exclude_archive') ?></td>
383
- <td><?php adinj_add_checkbox($prefix.'exclude_front') ?></td>
384
- <td><?php adinj_add_checkbox($prefix.'exclude_404') ?></td>
385
- <td><?php adinj_add_checkbox($prefix.'exclude_search') ?></td>
386
  </tr>
387
  <?php
388
  }
389
 
390
  function adinj_random_ad_limit_table(){
391
  ?>
392
- <tr><td>&nbsp;<b>|_</b> No ads if shorter than:</td>
393
  <?php
394
- $prefixes = array("", "home_", "archive_");
395
  $unit = adinj_counting_unit_description();
396
- $ad_limit_settings = array('d',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
397
 
398
  foreach ($prefixes as $prefix){
399
- echo '<td>';
 
400
  adinj_selection_box($prefix."no_random_ads_if_shorter_than", $ad_limit_settings, $unit);
401
- echo '</td>';
402
  } ?>
403
  </tr>
404
- <tr><td>&nbsp;&nbsp;<b>|_</b> Only 1 ad if post shorter than:</td>
405
  <?php
406
  foreach ($prefixes as $prefix){
407
- echo '<td>';
 
408
  adinj_selection_box($prefix."one_ad_if_shorter_than", $ad_limit_settings, $unit);
409
- echo '</td>';
410
  } ?>
411
  </tr>
412
- <tr><td>&nbsp;&nbsp;&nbsp;<b>|_</b> Only 2 ads if post shorter than:</td>
413
  <?php
414
  foreach ($prefixes as $prefix){
415
- echo '<td>';
 
416
  adinj_selection_box($prefix."two_ads_if_shorter_than", $ad_limit_settings, $unit);
417
- echo '</td>';
418
  }
419
  ?>
420
  </tr>
421
- <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<b>|_</b> Only 3 ads if post shorter than:</td>
422
  <?php
423
  foreach ($prefixes as $prefix){
424
- echo '<td>';
 
425
  adinj_selection_box($prefix."three_ads_if_shorter_than", $ad_limit_settings, $unit);
426
- echo '</td>';
427
  } ?>
428
  </tr>
429
  <?php
50
 
51
  </p>
52
 
53
+ <p><span style="font-size:10px;"><b>Notes:</b> Your home page is the page displaying your latest posts. It may be different to your front page if you have configured your front page to be a static page. If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p>
 
54
  <p><span style="font-size:10px;">Archive pages are the categories, tags, authors and date pages.</span></p>
55
 
56
  <p></p>
57
 
58
+ <table border="0" class="adinjtable" width="95%">
59
+ <tr><td></td><td width="20%"><b>Single/Page</b></td><td width="20%"><b>Home</b></td><td width="20%"><b>Archive</b></td></tr>
60
  <tr><td colspan="4"><h3><a name="topadplacement"></a>Top ad [<a href="#topadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
61
 
62
+ <tr><td>Only show on posts longer than:</td><td>
63
  <?php
64
  $unit = adinj_counting_unit_description();
65
+ $ad_if_longer_settings = array('d',100,200,300,500,750,1000,1500,2000,2500,3000,5000,10000,15000,20000);
66
  adinj_selection_box("top_ad_if_longer_than", $ad_if_longer_settings, $unit);
67
+ echo '</td><td><div class="adinj_home">';
68
  adinj_selection_box("home_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
69
+ echo '</div></td><td><div class="adinj_archive">';
70
  adinj_selection_box("archive_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
71
  ?>
72
+ </div></td></tr>
73
 
74
+ <tr><td><b>|_</b> Max num of ads on whole page:</td><td>1</td><td><div class="adinj_home">
75
  <?php
76
  $num_ads_array = array(0,1,2,3,4,5,6,7,8,9,10);
77
  adinj_selection_box("home_max_num_top_ads_per_page", $num_ads_array);
78
+ echo '</div></td><td><div class="adinj_archive">';
79
  adinj_selection_box("archive_max_num_top_ads_per_page", $num_ads_array);
80
  ?>
81
+ </div></td></tr>
82
 
83
 
84
  <tr><td colspan="4">
87
  </td></tr>
88
 
89
  <tr><td colspan="4"><h3><a name="randomadplacement"></a>Random ads [<a href="#randomadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
90
+ <tr><td>Max num of ads on whole page:</td><td>
91
  n/a
92
+ </td><td><div class="adinj_home">
93
  <?php
94
  adinj_selection_box("home_max_num_random_ads_per_page", $num_ads_array);
95
+ echo '</div></td><td><div class="adinj_archive">';
96
  adinj_selection_box("archive_max_num_random_ads_per_page", $num_ads_array);
97
  ?>
98
+ </div></td></tr>
99
  <tr><td><b>|_ </b>Max num of random ads per post:</td><td>
100
  <?php
101
  adinj_selection_box("max_num_of_ads", $num_ads_array);
102
+ echo '</td><td><div class="adinj_home">';
103
  adinj_selection_box("home_max_num_random_ads_per_post", $num_ads_array);
104
+ echo '</div></td><td><div class="adinj_archive">';
105
  adinj_selection_box("archive_max_num_random_ads_per_post", $num_ads_array);
106
  ?>
107
+ </div></td></tr>
108
  <?php
109
  adinj_random_ad_limit_table();
110
  ?>
114
  echo '<tr><td>';
115
  _e("Always put the first ad immediately after paragraph: ", 'adinj');
116
  echo '</td><td>';
117
+ adinj_selection_box("start_from_paragraph", array('d',1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
118
  echo '</td></tr>';
119
  ?>
120
  </table>
127
 
128
  <tr><td colspan="4"><h3><a name="bottomadplacement"></a>Bottom ad [<a href="#bottomadcode">code</a>] [<a href="#pagetypefilters">page type filters</a>]</h3></td></tr>
129
 
130
+ <tr><td>Only show on posts longer than:</td><td>
131
  <?php
132
  adinj_selection_box("bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
133
+ echo '</td><td><div class="adinj_home">';
134
  adinj_selection_box("home_bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
135
+ echo '</div></td><td><div class="adinj_archive">';
136
  adinj_selection_box("archive_bottom_ad_if_longer_than", $ad_if_longer_settings, $unit);
137
  ?>
138
+ </div></td></tr>
139
 
140
+ <tr><td><b>|_ </b>Max num of ads on whole page:</td><td>1</td><td><div class="adinj_home">
141
  <?php
142
  adinj_selection_box("home_max_num_bottom_ads_per_page", $num_ads_array);
143
+ echo '</div></td><td><div class="adinj_archive">';
144
  adinj_selection_box("archive_max_num_bottom_ads_per_page", $num_ads_array);
145
  ?>
146
+ </div></td></tr>
147
 
148
  <tr><td colspan="4">
149
  <b>|_ </b><?php adinj_condition_tables('bottom_', 'ui_bottom_conditions_show'); ?>
166
 
167
  <?php adinj_postbox_start(__("Adverts", 'adinj'), 'adverts'); ?>
168
 
169
+ <h3><a name="topadcode"></a>Top ad (below post title - this is not a 'header' ad) [<a href="#topadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_top'>pool</a>]--></h3>
170
+ <table border="0" class="adinjtable" width="95%">
171
  <tr><td>
172
  <textarea name="ad_code_top_1" rows="10" cols="60"><?php echo $ops['ad_code_top_1']; ?></textarea>
173
  <br />
182
  <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>
183
 
184
  <h3><a name="randomadcode"></a>Random ad (inserted randomly between paragraphs) [<a href="#randomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_random'>pool</a>]--></h3>
185
+ <table border="0" class="adinjtable" width="95%">
186
  <tr><td>
187
  <textarea name="ad_code_random_1" rows="10" cols="60"><?php echo $ops['ad_code_random_1']; ?></textarea>
188
  <br />
196
  </table>
197
 
198
  <h3><a name="bottomadcode"></a>Bottom ad (below the post content) [<a href="#bottomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_bottom'>pool</a>]--></h3>
199
+ <table border="0" class="adinjtable" width="95%">
200
  <tr><td>
201
  <textarea name="ad_code_bottom_1" rows="10" cols="60"><?php echo $ops['ad_code_bottom_1']; ?></textarea>
202
  <br />
211
 
212
 
213
  <h3><a name="footeradcode"></a>Footer ad (put into 'the_footer' hook - not supported by all themes) [<a href="#footeradplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_footer'>pool</a>]--></h3>
214
+ <table border="0" class="adinjtable" width="95%">
215
  <tr><td>
216
  <textarea name="ad_code_footer_1" rows="10" cols="60"><?php echo $ops['ad_code_footer_1']; ?></textarea>
217
  <br />
348
  </script>
349
 
350
 
351
+ <h4><a name="dynamic"></a>Show ads only to visitors from these websites (dynamic feature)</h4>
352
 
353
  <blockquote>
354
+ <?php adinj_add_checkbox('sevisitors_only') ?><?php _e("Only show ads to visitors from these websites (customise search engine or website referrers below if necessary).", 'adinj') ?><br />
355
  <textarea name="ad_referrers" rows="2" cols="70"><?php echo $ops['ad_referrers']; ?></textarea>
356
+ <p>Comma separated list e.g.: <br /><code>.google., .bing., .yahoo., .ask., search?, search., facebook.com</code></p>
357
  </blockquote>
358
 
359
  <h4>Blocked IP addresses (dynamic feature)</h4>
372
  }
373
 
374
  function adinj_add_exclude_row($name, $prefix=''){
375
+ $all = '';
376
+ if ($name == 'All ads') $all='all';
377
  ?>
378
  <tr>
379
  <td><b><?php echo $name; ?></b></td>
380
+ <td><?php adinj_add_checkbox($prefix.'exclude_single', 'adinj_single', $all) ?></td>
381
+ <td><?php adinj_add_checkbox($prefix.'exclude_page', 'adinj_page', $all) ?></td>
382
+ <td><?php adinj_add_checkbox($prefix.'exclude_home', 'adinj_home', $all) ?></td>
383
+ <td><?php adinj_add_checkbox($prefix.'exclude_archive', 'adinj_archive', $all) ?></td>
384
+ <td><?php adinj_add_checkbox($prefix.'exclude_front', 'adinj_front', $all) ?></td>
385
+ <td><?php adinj_add_checkbox($prefix.'exclude_404', 'adinj_404', $all) ?></td>
386
+ <td><?php adinj_add_checkbox($prefix.'exclude_search', 'adinj_search', $all) ?></td>
387
  </tr>
388
  <?php
389
  }
390
 
391
  function adinj_random_ad_limit_table(){
392
  ?>
393
+ <tr><td>&nbsp;<b>|_</b> No ads if post shorter than:</td>
394
  <?php
395
+ $prefixes = array("", "home", "archive");
396
  $unit = adinj_counting_unit_description();
397
+ $ad_limit_settings = array('d',100,200,300,500,750,1000,1500,2000,2500,3000,5000,10000,15000,20000);
398
 
399
  foreach ($prefixes as $prefix){
400
+ echo '<td><div class="adinj_'.$prefix.'">';
401
+ if (!empty($prefix)) $prefix = $prefix.'_';
402
  adinj_selection_box($prefix."no_random_ads_if_shorter_than", $ad_limit_settings, $unit);
403
+ echo '</div></td>';
404
  } ?>
405
  </tr>
406
+ <tr><td>&nbsp;<b>|_</b> Only 1 ad if post shorter than:</td>
407
  <?php
408
  foreach ($prefixes as $prefix){
409
+ echo '<td><div class="adinj_'.$prefix.'">';
410
+ if (!empty($prefix)) $prefix = $prefix.'_';
411
  adinj_selection_box($prefix."one_ad_if_shorter_than", $ad_limit_settings, $unit);
412
+ echo '</div></td>';
413
  } ?>
414
  </tr>
415
+ <tr><td>&nbsp;<b>|_</b> Only 2 ads if post shorter than:</td>
416
  <?php
417
  foreach ($prefixes as $prefix){
418
+ echo '<td><div class="adinj_'.$prefix.'">';
419
+ if (!empty($prefix)) $prefix = $prefix.'_';
420
  adinj_selection_box($prefix."two_ads_if_shorter_than", $ad_limit_settings, $unit);
421
+ echo '</div></td>';
422
  }
423
  ?>
424
  </tr>
425
+ <tr><td>&nbsp;<b>|_</b> Only 3 ads if post shorter than:</td>
426
  <?php
427
  foreach ($prefixes as $prefix){
428
+ echo '<td><div class="adinj_'.$prefix.'">';
429
+ if (!empty($prefix)) $prefix = $prefix.'_';
430
  adinj_selection_box($prefix."three_ads_if_shorter_than", $ad_limit_settings, $unit);
431
+ echo '</div></td>';
432
  } ?>
433
  </tr>
434
  <?php