Ad Injection - Version 0.9.7.11

Version Description

  • Filter ads by post/page ID
  • Other misc bug fixes
Download this release

Release Info

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

Code changes from version 0.9.7.10 to 0.9.7.11

Files changed (5) hide show
  1. ad-injection-admin.php +70 -11
  2. ad-injection-widget.php +7 -2
  3. ad-injection.php +39 -7
  4. readme.txt +615 -608
  5. ui-tab-main.php +6 -6
ad-injection-admin.php CHANGED
@@ -262,34 +262,39 @@ function adinj_options_page(){
262
 
263
  adinj_admin_tabs();
264
 
265
- echo '<form name="adinjform" method="post" action="">';
266
- wp_nonce_field('_adinj_form');
267
-
268
  echo '<div style="width:258px; float:right;">';
269
 
270
  switch( $_GET[ 'tab' ] ) {
271
  case "adrotation":
272
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
 
273
  adinj_side_info_box();
274
  echo '</div>';
 
 
275
  adinj_tab_adrotation();
276
  break;
277
  case "debug":
278
  require_once(ADINJ_PATH . '/ui-tab-debug.php');
 
279
  adinj_side_info_box();
280
  echo '</div>';
 
 
281
  adinj_tab_debug();
282
  break;
283
  case "main":
284
  default:
285
  require_once(ADINJ_PATH . '/ui-tab-main.php');
286
  adinj_side_status_box();
 
287
  adinj_side_info_box();
288
  echo '</div>';
 
 
289
  adinj_tab_main();
290
  break;
291
  }
292
-
293
  echo '</form>';
294
  echo '</div> <!--wrap-->';
295
  }
@@ -334,11 +339,50 @@ function adinj_top_message_box(){
334
 
335
  } else if (!isset($_GET['tab'])){
336
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
337
- echo "17th June 2011: UI fixes for WordPress 3.2 and other minor 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>.';
338
  echo '</strong></p></div>';
339
  }
340
  }
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  function adinj_side_info_box(){
343
  ?>
344
  <div class="postbox-container" style="width:258px;">
@@ -614,8 +658,8 @@ function adinj_selection_box($name, $values, $type="", $selected_value=NULL){
614
  }
615
  $typetxt = $type;
616
  if (adinj_disabled($option_value) || adinj_alwaysshow($display_value)) $typetxt = "";
617
- if ("$option_value" === 'd') { $display_value = ADINJ_DISABLED; }
618
  if ("$option_value" === 'a') { $display_value = ADINJ_ALWAYS_SHOW; }
 
619
  if ("$option_value" === 'o') { $display_value = ADINJ_ONLY_SHOW_IN; }
620
  if ("$option_value" === 'n') { $display_value = ADINJ_NEVER_SHOW_IN; }
621
  echo ">$display_value $typetxt</option>";
@@ -663,13 +707,12 @@ HTML;
663
 
664
  function adinj_condition_tables($prefix, $show_setting){
665
  $ops = adinj_options();
666
- ?>
667
- Category tag, and author conditions
668
- <?php
669
  adinj_add_show_hide_section('ad_conditions_'.uniqid(''), $show_setting, $show_setting, $ops);
670
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
671
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
672
  adinj_condition_table($prefix.'author', 'author nicknames. e.g: john, paul', 'author', $ops);
 
673
  echo '</div>';
674
  }
675
 
@@ -677,7 +720,7 @@ function adinj_condition_table($name, $description, $type, $ops, $dropdown_field
677
  $style = "";
678
  if ($dropdown_fieldname == NULL){
679
  $dropdown_fieldname = $name."_condition_mode";
680
- // Only for the main screen - now for widgets screen.
681
  $style = "style='width:280px'";
682
  }
683
  if ($textarea_fieldname == NULL){
@@ -693,9 +736,13 @@ function adinj_condition_table($name, $description, $type, $ops, $dropdown_field
693
 
694
  <?php
695
  adinj_selection_box($dropdown_fieldname,
696
- array('Only show in', 'Never show in'), "", $ops[$name.'_condition_mode']);
697
  ?>
698
 
 
 
 
 
699
  <br />
700
  <select name="<?php echo $name; ?>_dropdown" <?php echo $style; ?> onchange='adinj_addtext(getElementsByName("<?php echo $textarea_fieldname; ?>")[0], this.options[this.selectedIndex].value);'>
701
  <option value=""><?php echo 'Add ' . $type; ?></option>
@@ -727,6 +774,8 @@ function adinj_condition_table($name, $description, $type, $ops, $dropdown_field
727
  </select>
728
  <NOSCRIPT><br /><span style="font-size:10px">As JavaScript is disabled you will have to manually type in the values.</span></NOSCRIPT>
729
 
 
 
730
  </td></tr>
731
  <tr><td colspan="2">
732
  <span style="font-size:10px;">Comma separated list of <?php echo $description; ?></span>
@@ -1140,6 +1189,8 @@ function adinj_default_options(){
1140
  'global_tag_condition_entries' => '',
1141
  'global_author_condition_mode' => 'o',
1142
  'global_author_condition_entries' => '',
 
 
1143
  'content_length_unit' => 'words',
1144
  // Random ads
1145
  'ad_code_random_1' => '',
@@ -1182,6 +1233,8 @@ function adinj_default_options(){
1182
  'random_tag_condition_entries' => '',
1183
  'random_author_condition_mode' => 'o',
1184
  'random_author_condition_entries' => '',
 
 
1185
  'random_exclude_front' => '',
1186
  'random_exclude_home' => '',
1187
  'random_exclude_page' => '',
@@ -1256,6 +1309,8 @@ function adinj_default_options(){
1256
  'top_tag_condition_entries' => '',
1257
  'top_author_condition_mode' => 'o',
1258
  'top_author_condition_entries' => '',
 
 
1259
  'top_exclude_front' => '',
1260
  'top_exclude_home' => '',
1261
  'top_exclude_page' => '',
@@ -1300,6 +1355,8 @@ function adinj_default_options(){
1300
  'bottom_tag_condition_entries' => '',
1301
  'bottom_author_condition_mode' => 'o',
1302
  'bottom_author_condition_entries' => '',
 
 
1303
  'bottom_exclude_front' => '',
1304
  'bottom_exclude_home' => '',
1305
  'bottom_exclude_page' => '',
@@ -1344,6 +1401,8 @@ function adinj_default_options(){
1344
  'footer_tag_condition_entries' => '',
1345
  'footer_author_condition_mode' => 'o',
1346
  'footer_author_condition_entries' => '',
 
 
1347
  'footer_exclude_front' => '',
1348
  'footer_exclude_home' => '',
1349
  'footer_exclude_page' => '',
262
 
263
  adinj_admin_tabs();
264
 
 
 
 
265
  echo '<div style="width:258px; float:right;">';
266
 
267
  switch( $_GET[ 'tab' ] ) {
268
  case "adrotation":
269
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
270
+ adinj_side_donate_box();
271
  adinj_side_info_box();
272
  echo '</div>';
273
+ echo '<form name="adinjform" method="post" action="">';
274
+ wp_nonce_field('_adinj_form');
275
  adinj_tab_adrotation();
276
  break;
277
  case "debug":
278
  require_once(ADINJ_PATH . '/ui-tab-debug.php');
279
+ adinj_side_donate_box();
280
  adinj_side_info_box();
281
  echo '</div>';
282
+ echo '<form name="adinjform" method="post" action="">';
283
+ wp_nonce_field('_adinj_form');
284
  adinj_tab_debug();
285
  break;
286
  case "main":
287
  default:
288
  require_once(ADINJ_PATH . '/ui-tab-main.php');
289
  adinj_side_status_box();
290
+ adinj_side_donate_box();
291
  adinj_side_info_box();
292
  echo '</div>';
293
+ echo '<form name="adinjform" method="post" action="">';
294
+ wp_nonce_field('_adinj_form');
295
  adinj_tab_main();
296
  break;
297
  }
 
298
  echo '</form>';
299
  echo '</div> <!--wrap-->';
300
  }
339
 
340
  } else if (!isset($_GET['tab'])){
341
  echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
342
+ echo "1st July 2011: New options to filter ads based on post/page IDs and other minor fixes. 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
  }
346
 
347
+ function adinj_side_donate_box(){
348
+ ?>
349
+ <div class="postbox-container" style="width:258px;">
350
+ <div class="metabox-holder">
351
+ <div class="meta-box-sortables" style="min-height:200px;">
352
+ <div class="postbox">
353
+ <h3 class="hndle"><span><?php echo adinj_get_logo(); ?> Donate $10, $20 or $50!</span></h3>
354
+ <div class="inside" style="margin:5px;">
355
+ I have spent many hundreds of hours creating this plugin. If it helps you to make money please consider making a donation. Thank you!
356
+
357
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
358
+ <input type="hidden" name="cmd" value="_donations">
359
+ <input type="hidden" name="business" value="JP5ECV7NX7GSY">
360
+ <input type="hidden" name="item_name" value="Ad Injection">
361
+ <input type="hidden" name="item_number" value="Ad Injection">
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>
369
+ <option value="AUD">Australian Dollars</option>
370
+ <option value="CAD">Canadian Dollars</option>
371
+ <option value="EUR">Euros</option>
372
+ <option value="JPY">Yen</option></select>
373
+ </p>
374
+ <center>
375
+ <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" width="166" height="53" name="submit" alt="PayPal - The safer, easier way to pay online."></center>
376
+ </form>
377
+
378
+ </div>
379
+ </div>
380
+ </div>
381
+ </div>
382
+ </div>
383
+ <?php
384
+ }
385
+
386
  function adinj_side_info_box(){
387
  ?>
388
  <div class="postbox-container" style="width:258px;">
658
  }
659
  $typetxt = $type;
660
  if (adinj_disabled($option_value) || adinj_alwaysshow($display_value)) $typetxt = "";
 
661
  if ("$option_value" === 'a') { $display_value = ADINJ_ALWAYS_SHOW; }
662
+ if ("$option_value" === 'd') { $display_value = ADINJ_DISABLED; }
663
  if ("$option_value" === 'o') { $display_value = ADINJ_ONLY_SHOW_IN; }
664
  if ("$option_value" === 'n') { $display_value = ADINJ_NEVER_SHOW_IN; }
665
  echo ">$display_value $typetxt</option>";
707
 
708
  function adinj_condition_tables($prefix, $show_setting){
709
  $ops = adinj_options();
710
+ echo "Category tag, author, and post id conditions";
 
 
711
  adinj_add_show_hide_section('ad_conditions_'.uniqid(''), $show_setting, $show_setting, $ops);
712
  adinj_condition_table($prefix.'category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $ops);
713
  adinj_condition_table($prefix.'tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $ops);
714
  adinj_condition_table($prefix.'author', 'author nicknames. e.g: john, paul', 'author', $ops);
715
+ adinj_condition_table($prefix.'id', 'post or page ids. e.g: 7, 38, 243', 'id', $ops);
716
  echo '</div>';
717
  }
718
 
720
  $style = "";
721
  if ($dropdown_fieldname == NULL){
722
  $dropdown_fieldname = $name."_condition_mode";
723
+ // Only for the main screen - not for widgets screen.
724
  $style = "style='width:280px'";
725
  }
726
  if ($textarea_fieldname == NULL){
736
 
737
  <?php
738
  adinj_selection_box($dropdown_fieldname,
739
+ array('o','n'), "", $ops[$name.'_condition_mode']);
740
  ?>
741
 
742
+ <?php
743
+ if ($type == 'category' || $type == 'tag' || $type == 'author') {
744
+ ?>
745
+
746
  <br />
747
  <select name="<?php echo $name; ?>_dropdown" <?php echo $style; ?> onchange='adinj_addtext(getElementsByName("<?php echo $textarea_fieldname; ?>")[0], this.options[this.selectedIndex].value);'>
748
  <option value=""><?php echo 'Add ' . $type; ?></option>
774
  </select>
775
  <NOSCRIPT><br /><span style="font-size:10px">As JavaScript is disabled you will have to manually type in the values.</span></NOSCRIPT>
776
 
777
+ <?php } ?>
778
+
779
  </td></tr>
780
  <tr><td colspan="2">
781
  <span style="font-size:10px;">Comma separated list of <?php echo $description; ?></span>
1189
  'global_tag_condition_entries' => '',
1190
  'global_author_condition_mode' => 'o',
1191
  'global_author_condition_entries' => '',
1192
+ 'global_id_condition_mode' => 'o',
1193
+ 'global_id_condition_entries' => '',
1194
  'content_length_unit' => 'words',
1195
  // Random ads
1196
  'ad_code_random_1' => '',
1233
  'random_tag_condition_entries' => '',
1234
  'random_author_condition_mode' => 'o',
1235
  'random_author_condition_entries' => '',
1236
+ 'random_id_condition_mode' => 'o',
1237
+ 'random_id_condition_entries' => '',
1238
  'random_exclude_front' => '',
1239
  'random_exclude_home' => '',
1240
  'random_exclude_page' => '',
1309
  'top_tag_condition_entries' => '',
1310
  'top_author_condition_mode' => 'o',
1311
  'top_author_condition_entries' => '',
1312
+ 'top_id_condition_mode' => 'o',
1313
+ 'top_id_condition_entries' => '',
1314
  'top_exclude_front' => '',
1315
  'top_exclude_home' => '',
1316
  'top_exclude_page' => '',
1355
  'bottom_tag_condition_entries' => '',
1356
  'bottom_author_condition_mode' => 'o',
1357
  'bottom_author_condition_entries' => '',
1358
+ 'bottom_id_condition_mode' => 'o',
1359
+ 'bottom_id_condition_entries' => '',
1360
  'bottom_exclude_front' => '',
1361
  'bottom_exclude_home' => '',
1362
  'bottom_exclude_page' => '',
1401
  'footer_tag_condition_entries' => '',
1402
  'footer_author_condition_mode' => 'o',
1403
  'footer_author_condition_entries' => '',
1404
+ 'footer_id_condition_mode' => 'o',
1405
+ 'footer_id_condition_entries' => '',
1406
  'footer_exclude_front' => '',
1407
  'footer_exclude_home' => '',
1408
  'footer_exclude_page' => '',
ad-injection-widget.php CHANGED
@@ -11,7 +11,8 @@ http://www.reviewmylife.co.uk/
11
  // 5 = ad/alt pool show fields
12
  // 6 = page type restrictions
13
  // 7 = align and clear
14
- define('ADINJ_WIDGET_DB_VERSION', 7);
 
15
 
16
  class Ad_Injection_Widget extends WP_Widget {
17
  function Ad_Injection_Widget() {
@@ -46,6 +47,7 @@ class Ad_Injection_Widget extends WP_Widget {
46
  if (!adinj_allowed_in_category('widget', $instance)) return;
47
  if (!adinj_allowed_in_tag('widget', $instance)) return;
48
  if (!adinj_allowed_in_author('widget', $instance)) return;
 
49
 
50
  extract( $args );
51
 
@@ -140,6 +142,8 @@ class Ad_Injection_Widget extends WP_Widget {
140
  'widget_tag_condition_entries' => '',
141
  'widget_author_condition_mode' => 'o',
142
  'widget_author_condition_entries' => '',
 
 
143
  'exclude_front' => '',
144
  'exclude_home' => '',
145
  'exclude_page' => '',
@@ -246,12 +250,13 @@ class Ad_Injection_Widget extends WP_Widget {
246
  </div>
247
 
248
  <br />
249
- <b> Category, tag and author conditions</b>
250
  <?php
251
  $this->add_show_hide_section('ad_restrictions_'.uniqid(''), 'ui_conditions_show', $instance);
252
  adinj_condition_table('widget_category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $instance, $this->get_field_name('widget_category_condition_mode'), $this->get_field_name('widget_category_condition_entries'));
253
  adinj_condition_table('widget_tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $instance, $this->get_field_name('widget_tag_condition_mode'), $this->get_field_name('widget_tag_condition_entries'));
254
  adinj_condition_table('widget_author', 'author nicknames. e.g: john, paul', 'author', $instance, $this->get_field_name('widget_author_condition_mode'), $this->get_field_name('widget_author_condition_entries'));
 
255
  echo '</div>'
256
  ?>
257
 
11
  // 5 = ad/alt pool show fields
12
  // 6 = page type restrictions
13
  // 7 = align and clear
14
+ // 8 = post/page id restrictions
15
+ define('ADINJ_WIDGET_DB_VERSION', 8);
16
 
17
  class Ad_Injection_Widget extends WP_Widget {
18
  function Ad_Injection_Widget() {
47
  if (!adinj_allowed_in_category('widget', $instance)) return;
48
  if (!adinj_allowed_in_tag('widget', $instance)) return;
49
  if (!adinj_allowed_in_author('widget', $instance)) return;
50
+ if (!adinj_allowed_in_id('widget', $instance)) return;
51
 
52
  extract( $args );
53
 
142
  'widget_tag_condition_entries' => '',
143
  'widget_author_condition_mode' => 'o',
144
  'widget_author_condition_entries' => '',
145
+ 'widget_id_condition_mode' => 'o',
146
+ 'widget_id_condition_entries' => '',
147
  'exclude_front' => '',
148
  'exclude_home' => '',
149
  'exclude_page' => '',
250
  </div>
251
 
252
  <br />
253
+ <b> Category, tag, author and id conditions</b>
254
  <?php
255
  $this->add_show_hide_section('ad_restrictions_'.uniqid(''), 'ui_conditions_show', $instance);
256
  adinj_condition_table('widget_category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $instance, $this->get_field_name('widget_category_condition_mode'), $this->get_field_name('widget_category_condition_entries'));
257
  adinj_condition_table('widget_tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $instance, $this->get_field_name('widget_tag_condition_mode'), $this->get_field_name('widget_tag_condition_entries'));
258
  adinj_condition_table('widget_author', 'author nicknames. e.g: john, paul', 'author', $instance, $this->get_field_name('widget_author_condition_mode'), $this->get_field_name('widget_author_condition_entries'));
259
+ adinj_condition_table('widget_id', 'post/page ids. e.g: 7, 23, 276', 'id', $instance, $this->get_field_name('widget_id_condition_mode'), $this->get_field_name('widget_id_condition_entries'));
260
  echo '</div>'
261
  ?>
262
 
ad-injection.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
- Version: 0.9.7.10
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -28,7 +28,8 @@ define('ADINJ_NO_CONFIG_FILE', 1);
28
  // 9 = replace the two direct modes with 'direct'
29
  // 10 = exclusion tick boxes for top, random, bottom, and new footer ad
30
  // 11 = options to disable rnd ad at bottom, and to get new ad for each rnd slot
31
- define('ADINJ_DB_VERSION', 11);
 
32
 
33
  // Files
34
  // TODO will these paths work on windows?
@@ -182,7 +183,7 @@ function adinj_get_ad_code($adtype, $ads_db){
182
  }
183
 
184
  $ad = adshow_add_formatting($ad, $formatting);
185
- return adinj_ad_code_eval($ad);
186
  }
187
 
188
  function adinj_ad_code_random(){
@@ -457,11 +458,12 @@ function adinj_ads_completely_disabled_from_page($content=NULL){
457
  if (!adinj_allowed_in_category('global', $ops)) return "NOADS: globally blocked from category";
458
  if (!adinj_allowed_in_tag('global', $ops)) return "NOADS: globally blocked from tag";
459
  if (!adinj_allowed_in_author('global', $ops)) return "NOADS: globally blocked from author";
 
460
 
461
  // manual ad disabling tags
462
  if ($content == NULL) return false;
463
- if (strpos($content, "<!--noadsense-->") !== false) return "NOADS: noadsense tag"; // 'Adsense Injection' tag
464
- if (strpos($content, "<!-no-adsense-->") !== false) return "NOADS: no-adsense tag"; // 'Whydowork Adsense' tag
465
  if (stripos($content,'<!--NoAds-->') !== false) return "NOADS: NoAds tag"; // 'Quick Adsense' tag
466
  if (stripos($content,'<!--OffAds-->') !== false) return "NOADS: OffAds tag"; // 'Quick Adsense' tag
467
 
@@ -487,7 +489,7 @@ function adinj_allowed_in_list($all_entries, $config_entries, $mode, $func){
487
  } else if (adinj_mode_never_show_in($mode)){
488
  return true;
489
  }
490
- echo ("<!--ADINJ DEBUG: error in adinj_allowed_in_list-->");
491
  return true;
492
  }
493
 
@@ -583,10 +585,32 @@ function adinj_allowed_in_author($scope, $ops){
583
  return adinj_allowed_in_list($user, $conditions, $mode, 'adinj_author_data');
584
  }
585
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
586
  //function parameters
587
  function adinj_category_nicename($category){ return $category->category_nicename; }
588
  function adinj_tag_slug($tag){ return $tag->slug; }
589
  function adinj_author_data($data){ return $data; }
 
590
 
591
  function adinj_split_comma_list($list){
592
  return preg_split("/[\s,]+/", $list, -1, PREG_SPLIT_NO_EMPTY);
@@ -861,6 +885,7 @@ function adinj_num_top_ads_to_insert($content_length){
861
  if (!adinj_allowed_in_category('top', $ops)) return 0;
862
  if (!adinj_allowed_in_tag('top', $ops)) return 0;
863
  if (!adinj_allowed_in_author('top', $ops)) return 0;
 
864
 
865
  if (adinj_do_rule_if($ops[$prefix.'top_ad_if_longer_than'], '<', $content_length)){
866
  return 1;
@@ -884,6 +909,7 @@ function adinj_num_bottom_ads_to_insert($content_length){
884
  if (!adinj_allowed_in_category('bottom', $ops)) return 0;
885
  if (!adinj_allowed_in_tag('bottom', $ops)) return 0;
886
  if (!adinj_allowed_in_author('bottom', $ops)) return 0;
 
887
 
888
  if (adinj_do_rule_if($ops[$prefix.'bottom_ad_if_longer_than'], '<', $content_length)){
889
  return 1;
@@ -916,6 +942,7 @@ function adinj_num_rand_ads_to_insert($content_length){
916
  if (!adinj_allowed_in_category('random', $ops)) return 0;
917
  if (!adinj_allowed_in_tag('random', $ops)) return 0;
918
  if (!adinj_allowed_in_author('random', $ops)) return 0;
 
919
 
920
  $length = $content_length;
921
  if (adinj_do_rule_if($ops[$prefix.'no_random_ads_if_shorter_than'], '>', $length)){
@@ -939,6 +966,11 @@ function adinj_num_footer_ads_to_insert(){
939
  if ($reason !== false){
940
  return 0;
941
  }
 
 
 
 
 
942
  return 1;
943
  }
944
 
@@ -1016,7 +1048,7 @@ function adinj_widgets_init() {
1016
  register_activation_hook(__FILE__, 'adinj_activate_hook');
1017
  // Content injection
1018
  add_action('wp_enqueue_scripts', 'adinj_addsevjs_hook');
1019
- add_filter('the_content', 'adinj_content_hook');
1020
  add_action('wp_footer', 'adinj_footer_hook');
1021
  add_action('wp_footer', 'adinj_print_referrers_hook');
1022
 
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
+ Version: 0.9.7.11
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
28
  // 9 = replace the two direct modes with 'direct'
29
  // 10 = exclusion tick boxes for top, random, bottom, and new footer ad
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
+ define('ADINJ_DB_VERSION', 13);
33
 
34
  // Files
35
  // TODO will these paths work on windows?
183
  }
184
 
185
  $ad = adshow_add_formatting($ad, $formatting);
186
+ return "<!--Ad Injection:$adtype-->".adinj_ad_code_eval($ad);
187
  }
188
 
189
  function adinj_ad_code_random(){
458
  if (!adinj_allowed_in_category('global', $ops)) return "NOADS: globally blocked from category";
459
  if (!adinj_allowed_in_tag('global', $ops)) return "NOADS: globally blocked from tag";
460
  if (!adinj_allowed_in_author('global', $ops)) return "NOADS: globally blocked from author";
461
+ if (!adinj_allowed_in_id('global', $ops)) return "NOADS: globally blocked from post/page id";
462
 
463
  // manual ad disabling tags
464
  if ($content == NULL) return false;
465
+ if (stripos($content, "<!--noadsense-->") !== false) return "NOADS: noadsense tag"; // 'Adsense Injection' tag
466
+ if (stripos($content, "<!-no-adsense-->") !== false) return "NOADS: no-adsense tag"; // 'Whydowork Adsense' tag
467
  if (stripos($content,'<!--NoAds-->') !== false) return "NOADS: NoAds tag"; // 'Quick Adsense' tag
468
  if (stripos($content,'<!--OffAds-->') !== false) return "NOADS: OffAds tag"; // 'Quick Adsense' tag
469
 
489
  } else if (adinj_mode_never_show_in($mode)){
490
  return true;
491
  }
492
+ echo ("<!--ADINJ DEBUG: error in adinj_allowed_in_list($func)-->");
493
  return true;
494
  }
495
 
585
  return adinj_allowed_in_list($user, $conditions, $mode, 'adinj_author_data');
586
  }
587
 
588
+ function adinj_allowed_in_id($scope, $ops){
589
+ $conditions = adinj_split_comma_list($ops[$scope.'_id_condition_entries']);
590
+ if (empty($conditions)) return true;
591
+
592
+ if (!is_single() && !is_page()){
593
+ return true;
594
+ }
595
+
596
+ $postid = -1;
597
+ if (in_the_loop()){
598
+ global $post;
599
+ $postid = $post->ID;
600
+ } else {
601
+ global $wp_query;
602
+ $postid = $wp_query->post->ID;
603
+ }
604
+
605
+ $mode = $ops[$scope.'_id_condition_mode'];
606
+ return adinj_allowed_in_list(array($postid), $conditions, $mode, 'adinj_post_id');
607
+ }
608
+
609
  //function parameters
610
  function adinj_category_nicename($category){ return $category->category_nicename; }
611
  function adinj_tag_slug($tag){ return $tag->slug; }
612
  function adinj_author_data($data){ return $data; }
613
+ function adinj_post_id($data){ return $data; }
614
 
615
  function adinj_split_comma_list($list){
616
  return preg_split("/[\s,]+/", $list, -1, PREG_SPLIT_NO_EMPTY);
885
  if (!adinj_allowed_in_category('top', $ops)) return 0;
886
  if (!adinj_allowed_in_tag('top', $ops)) return 0;
887
  if (!adinj_allowed_in_author('top', $ops)) return 0;
888
+ if (!adinj_allowed_in_id('top', $ops)) return 0;
889
 
890
  if (adinj_do_rule_if($ops[$prefix.'top_ad_if_longer_than'], '<', $content_length)){
891
  return 1;
909
  if (!adinj_allowed_in_category('bottom', $ops)) return 0;
910
  if (!adinj_allowed_in_tag('bottom', $ops)) return 0;
911
  if (!adinj_allowed_in_author('bottom', $ops)) return 0;
912
+ if (!adinj_allowed_in_id('bottom', $ops)) return 0;
913
 
914
  if (adinj_do_rule_if($ops[$prefix.'bottom_ad_if_longer_than'], '<', $content_length)){
915
  return 1;
942
  if (!adinj_allowed_in_category('random', $ops)) return 0;
943
  if (!adinj_allowed_in_tag('random', $ops)) return 0;
944
  if (!adinj_allowed_in_author('random', $ops)) return 0;
945
+ if (!adinj_allowed_in_id('random', $ops)) return 0;
946
 
947
  $length = $content_length;
948
  if (adinj_do_rule_if($ops[$prefix.'no_random_ads_if_shorter_than'], '>', $length)){
966
  if ($reason !== false){
967
  return 0;
968
  }
969
+ $ops = adinj_options();
970
+ if (!adinj_allowed_in_category('footer', $ops)) return 0;
971
+ if (!adinj_allowed_in_tag('footer', $ops)) return 0;
972
+ if (!adinj_allowed_in_author('footer', $ops)) return 0;
973
+ if (!adinj_allowed_in_id('footer', $ops)) return 0;
974
  return 1;
975
  }
976
 
1048
  register_activation_hook(__FILE__, 'adinj_activate_hook');
1049
  // Content injection
1050
  add_action('wp_enqueue_scripts', 'adinj_addsevjs_hook');
1051
+ add_filter('the_content', 'adinj_content_hook'); // TODO allow priority to be changed? e.g. TheTravelTheme is setting its formatting at priority 99
1052
  add_action('wp_footer', 'adinj_footer_hook');
1053
  add_action('wp_footer', 'adinj_print_referrers_hook');
1054
 
readme.txt CHANGED
@@ -1,608 +1,615 @@
1
- === Ad Injection ===
2
- Contributors: reviewmylife
3
- Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
4
- Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
5
- Requires at least: 2.8.6
6
- Tested up to: 3.2
7
- Stable tag: 0.9.7.10
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
-
11
- == Description ==
12
-
13
- Ad Injection injects any kind of advert (e.g. Google AdSense, Amazon Associates, ClickBank, TradeDoubler, etc) into the existing content of your WordPress posts and pages. You can control the number of adverts based on the post length, and it can restrict who sees adverts by post age, visitor referrer and IP address. Adverts can be configured in the post (random, top, and bottom positions) or in any widget/sidebar area. There's support for A:B split testing / ad rotation. And the dynamic restrictions (by IP and referrer) work with WP Super Cache, W3 Total Cache and WP Cache.
14
-
15
- **New Features 0.9.7.x**
16
-
17
- * Archive and home page ads now fully supported with the same controls as ads for single posts/pages.
18
- * Category, tag and author restrictions for top, random and bottom ads.
19
- * Footer ads.
20
-
21
- **New Features 0.9.6.x**
22
-
23
- * Ad rotation / A:B split testing support for random, top, bottom and widget/sidebar adverts.
24
- * Alternate content which can be defined for users who are dynamically blocked (by IP or referrer) from seeing adverts.
25
- * Choose which paragraph to start the random ads via the UI.
26
- * Dynamic features will work with W3 Total Cache and WP Cache as well as the previously suppoted WP Super Cache.
27
- * Widgets can be conditionally included on pages by category, tag, and author.
28
-
29
- = Automatic advert injection =
30
-
31
- The ads can be injected into existing posts without requiring any modification of the post. The injection can be done randomly between paragraphs, and there is an option to always inject the first advert at a specified paragraph (e.g. the first or second). Randomly positioning the adverts helps to reduce 'ad blindness'. Two additional adverts can be defined for the top and bottom of the content. Widget adverts can be defined as well.
32
-
33
- = Widget support =
34
-
35
- Widgets can be added to your sidebars, or other widget areas on any pages. The same ad display restrictions that you setup for your other ads will also apply to the widgets.
36
-
37
- = Ad rotation / split testing =
38
-
39
- You can define multiple adverts for the same ad space which are rotated according to the ratios you define. Works with random, top, bottom and sidget/sidebar ads.
40
-
41
- = Ad quantity by post length =
42
-
43
- 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.
44
-
45
- = Search engines only mode =
46
-
47
- 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.
48
-
49
- = Ads on old posts only =
50
-
51
- Adverts can be restricted to posts that are more than a defined numbers of days old. This prevents your regular visitors from having to see your ads.
52
-
53
- = Category, tag and post type filters =
54
-
55
- You can configure the adverts to only appear on specific categories, tags, or post types, or block the adverts from specific categories, tags or post types.
56
-
57
- = Block ads from IP addresses =
58
-
59
- IP addresses of people who shouldn't see your ads can be defined. These could be the IP addresses of your friends, family, or even yourself.
60
-
61
- = Alternate content =
62
-
63
- This is content that is displayed when ads are blocked for the user. You could use this alternate content to show other content, some kind of layout filler, or even a different type of ad. I've added support for rotation of alternate content as well.
64
-
65
- = Not tied to any ad provider =
66
-
67
- The advert code can be copied and pasted directly from your ad provider (Google AdSense, adBrite, ClickBank, etc) which will help you to comply with any terms of service (TOS) that state their ad code may not be modified.
68
-
69
- = Flexible ad positioning =
70
-
71
- Easy positioning options are provided for left, right, center, float left, and float right (or a random variant of these). Extra spacing can be set above and below the ad using the CSS margin and padding boxes. Or if that isn't flexible enough, you can write your own positioning code using HTML and CSS. And you can select which paragraph random ads should start from.
72
-
73
- = Works with WP Super Cache, W3 Total Cache and WP Cache =
74
-
75
- The dynamic features that require code to be executed for each page view (i.e. ad rotation, search engine visitors only, and ad blocking based on IP address) work with WP Super Cache, W3 Total Cache and WP Cache.
76
-
77
- This plugin will automatically use the dynamic mfunc tag to ensure that the dynamic ad features still work when caching is on.
78
-
79
- If you use WP Super Cache in mod_rewrite mode displaying the adverts (even with the dynamic restrictions) whilst caching requires no MySQL database access. For W3 Total Cache and WP Cache Ad Injection will not require any extra MySQL database access for cached pages other than what these plugin already use.
80
-
81
- = Inject PHP and JavaScript =
82
-
83
- As the plugin will inject whatever content you like into the page you can write your own ad rotation or a/b split testing code for the ads you inject. PHP code can be automatically executed, even when using WP Super Cache.
84
-
85
- = Hide UI panels that you don't need =
86
-
87
- 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.
88
-
89
- For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
90
-
91
- = Actively being developed =
92
-
93
- As of 2011 this plugin is being actively developed and maintained. New features are planned for later on in 2011. If you have ideas for new features do let me know - I can't promise to do them any time soon - but if they are good and practical I can add them to my list.
94
-
95
- == Installation ==
96
-
97
- This section describes how to install the plugin and get it working.
98
-
99
- 1. Upload the ad-injection folder to the '/wp-content/plugins/' directory (or just use the WordPress plugin installer to do it for you). The plugin must be in a folder called 'ad-injection'. So the main plugin file will be at /wp-content/plugins/ad-injection/ad-injection.php
100
- 2. Activate the plugin through the 'Plugins' menu in WordPress.
101
- 3. Configure your ads. Carefully go through all the sections to setup your ad placements.
102
- 4. Make sure you select the option to say which ad injection mode to use. Dynamic features (ad rotation, and referrer/IP ad filtering) will only work with either 1) WP Super Cache/W3 Total Cache/WP Cache or 2) no caching plugin.
103
- 5. Tick the box right at the top to enable your ads.
104
- 6. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
105
-
106
- **Recommended cache plugin settings**
107
-
108
- * WP Super Cache - 0.9.9.8+ using mod_rewrite mode.
109
- * W3 Total Cache - Page Cache: 'Disk (basic)' mode.
110
- * WP Cache - Just turn the caching on.
111
-
112
- Note: If you use a version of WP Super Cache prior to 0.9.9.8 it must be configured in 'Legacy' mode for the dynamic features to work. If you use WP Super Cache 0.9.9.8 or above you can use any of the caching modes (mod_rewrite and PHP are faster than legacy).
113
-
114
- = How to uninstall =
115
-
116
- You can uninstall by deactivating the plugin and deleting from the WordPress plugins control panel.
117
-
118
- If you have been using mfunc mode with a caching plugin then you *must* also clear the cache afterwards, otherwise you'll get errors saying the Ad Injection includes can't be found.
119
-
120
- == Frequently Asked Questions ==
121
-
122
- = Why was this plugin created? =
123
-
124
- I used to use the excellent Adsense Injection by Dax Herrera, but found I needed more features and flexibility. His plugin inspired this one.
125
-
126
- = How is this plugin different to Adsense Injection by Dax Herrera? =
127
-
128
- One a basic level it can do the same job as Dax's excellent Adsense Injection. If you want it can just inject Adsense like his plugin does. I used to use his plugin, but found that I wanted a lot more features. Here is a quick list of the extra features.
129
-
130
- * Inject any type of advert from any ad provider.
131
- * Restrict ad display by referrer (e.g. can restrict display to search engine visitors).
132
- * Can prevent specific IP addresses from seeing adverts.
133
- * Can define randomly positioned adverts, and adverts at the top and bottom of the posts.
134
- * Add adverts to the widget area.
135
- * Ad rotation / split testing.
136
- * Restrict adverts by category and tag.
137
- * Vary number of adverts based on post length.
138
- * You can inject raw JavaScript and PHP.
139
- * The dynamic features (ad rotation, restricting ads by referrer and IP) work with WP Super Cache, W3 Total Cache and WP Cache.
140
- * Define alternate content for users who are dynamically restricted from seeing ads.
141
- * Compatible with the <!--noadsense--> <!--adsensestart--> in-page tags from Adsense Injection to make migration easy.
142
- * Compatible with in-page tags from Whydowork Adsense and Quick Adsense.
143
- * Extra positioning options - for example you can force the first advert to be right after the first paragraph so that it will be 'above the fold'.
144
-
145
- Thanks to Dax by the way for providing the inspiration for this plugin!
146
-
147
- = Does this plugin 'take' a percentage of my ad earnings? =
148
-
149
- No! Absolutely not. Some ad plugins replace your publisher ID with their own for a certain percentage of adverts. Ad Injection does NOT do this. All your earnings are your own. Ad Injection makes no modifications to your ad code. What you paste into the ad boxes is what is injected into your pages.
150
-
151
- = Is using this plugin allowed for Google AdSense? =
152
-
153
- As far as I can tell using this plugin should be legal for AdSense **as long as you** make sure the ad quantities/placements comply with their TOS. However it is up to you to make sure that your website complies.
154
-
155
- Ad Injection is designed as a generic plugin for injecting all types of adverts. It will not specifically check that the defined ad quantities or positions are in compliance of the AdSense TOS for you. For example Ad Injection will allow you to inject more ads than Google allows if you configure it to do so.
156
-
157
- Be careful if you use the float left/right positioning options. These options could cause your AdSense adverts to appear under other elements of your page if you have also set a float value for them (e.g. floating images, and adverts together could be problematic). However the new 'clear' option should allow you to make sure this doesn't happen.
158
-
159
- The best advice for any advert plugin is to manually check that you are happy with the advert quantities and positioning it produces, to ensure that you comply with the TOS for your ad program.
160
-
161
- You use this plugin at your own risk.
162
-
163
- = Do you have any testing recommendations? =
164
-
165
- For testing your ad settings I'd recommend that you first disable any caching plugin, and then set Ad Injection to test mode.
166
-
167
- If you are unsure as to why ads are appearing (or aren't) enable debug mode from the UI and look for the 'ADINJ DEBUG' tags in the HTML source of your webpage.
168
-
169
- When you are happy with the ad quantities / positions you can disable debug mode, re-enable your caching plugin, and set the Ad Injection mode to 'On'.
170
-
171
- If you are testing the search engine referrer settings be aware that Ad Injection sets a one hour cookie when you visit via a site with a matching referrer. This means that after you have visited the site via the matching referrer the adverts will keep showing for the next hour. Clear your cookies to reset the behaviour. The Firefox 'Cookie Monster' plugin is very useful if you want to check the status of the cookie. Look for the 'adinj' cookie. Instead of clearing all your cookies you can just delete this one.
172
-
173
- Using a second browser in 'privacy mode' is also a good way of testing your site with a clean slate. A browser like Google Chrome will allow you to test your site with no cookies definied if you start a new private browsing session.
174
-
175
- = Do I need to have WP Super Cache (or anther caching plugin) installed? =
176
-
177
- No! All the features of this plugin will work with no caching plugin installed. But if you do have WP Super Cache the dynamic features (ad rotation and enabling ads based on IP address and referrer) will still work. And your blog will run a lot faster than with no caching plugin. Usually a caching plugin would prevent dynamic plugin features from working. Just make sure you choose the mfunc dynamic insertion mode in the Ad Injection settings screen.
178
-
179
- = Will the dynamic features work with other caching plugins? =
180
-
181
- The dynamic features will work with any caching program that supports the mfunc tag. At the moment that is WP Super Cache, W3 Total Cache, and WP Cache.
182
-
183
- = Which caching plugin is best? =
184
-
185
- Both WP Super Cache and W3 Total Cache are likely to be faster than WP Cache.
186
-
187
- If you aren't using the dynamic features then the only way to find out which is best between WP Super Cache and W3 Total Cache is to measure the performance yourself, as the speed depends on many factors that will be unique to your web server and web site.
188
-
189
- If you are using dynamic features with mfunc mode then WP Super Cache (in mod_rewrite mode) and W3 Total Cache (in Page Cache: Disk (basic) mode) are likely to offer similar performance as they both return the dynamic files via PHP.
190
-
191
- Note that W3 Total Cache will not cache pages with mfunc tags if you use the Page Cache: Disk (enhanced) mode.
192
-
193
- The speed of your website does depend on more factors than just page serve time so other features that the caching plugins offer (such as CDN and minification support) may swing the advantage either way.
194
-
195
- WP Hyper Cache does not support mfunc tags so only use it if you don't want to use any of the dynamic features. If using WP Hyper Cache set the Ad Injection mode to 'direct_static'.
196
-
197
- For reference: dynamic features are ad rotation, and blocking ad views by IP and referrer.
198
-
199
- = Can I just have adverts on the home page? =
200
-
201
- i.e. adverts on the home page, but not on single posts or pages.
202
-
203
- Yes you can do this, there are two ways.
204
-
205
- 1. In the 'Single posts and pages' setting set the number of injected ads to 0. Then in the 'Home page' settings set the number of ads to whatever you want.
206
- 2. Alternatively use the global exclude options at the top to exclude ads from all page types except the home page.
207
-
208
- = Why aren't adverts appearing on my front / home / archives page? =
209
-
210
- Ads will only appear if your front, home or archives page if you show the full post - not if you show excerpts*.
211
-
212
- * However if your theme leaves the HTML tags intact then you may in fact see the top ad in your excerpt. Whether you do or not depends on how your theme deals with excerpts.
213
-
214
- = How do I stop adverts from appearing on my contacts form page? =
215
-
216
- To stop ads appearing on the contact page (or any other post/page) you have many of options. Here are three to choose from:
217
-
218
- 1. Add (copy and paste) <!--NoAds--> into the content of the post/page with the contact form. Just edit the contact page and paste this in - it will be invisible to the reader.
219
- 2. Add a disable_adverts custom field to the post/page containing the contact form and set the value to 1 (the number one as a single digit).
220
- 3. Add a tag to the page to mean that it shouldn't have adverts, and then add that tag to the tag filtering condition in the global settings area of the plugin configuration page.
221
-
222
- = How can I put ads on category (or other archive pages)? =
223
-
224
- The top, random and bottom ads can be placed into the category pages. Category pages are a type of archive.
225
-
226
- On the main settings page for Ad Injection just enter the number of adverts you want on these page types using the Archives column in the 'Ad placement settings' section.
227
-
228
- Ads will only appear on archives/category pages if you are showing the full post contents on these pages. They won't work if you are showing excerpts.
229
-
230
- = My adverts are overlapping with other page elements (e.g. images) =
231
-
232
- You can try defining the 'clear' display setting so that multiple floated parts of your page do not overlap.
233
-
234
- If you always have a floated image at the top of the page you can set which paragraph the first random advert will start from. If you needed finer control over where the random adverts appear you can use the <!--adstart--> and <!--adend--> tags in the page.
235
-
236
- = I have set the ads to float but the text/headings aren't flowing around them =
237
-
238
- Check your style sheet to see if either the text or headings have the 'clear' attribute set. This may be preventing your text / headings from flowing around the advert.
239
-
240
- = I have configured four Google AdSense ad units but only three are showing. Why? =
241
-
242
- Google's AdSense TOS only allow allow three ad units, and three link units per page. If you have for example tried to insert four ad units on your page then Google will (probably) disable the forth one automatically. Read Google's AdSense [program policies](https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=48182 "AdSense program policies") for more info.
243
-
244
- = What if I am using an incompatible caching plugin? =
245
-
246
- Don't worry - everything will still work except for:
247
-
248
- 1. Filtering ads based on the IP address of the visitor.
249
- 2. Filtering the ads based on the HTTP referrer of the visitor.
250
-
251
- If you aren't interested in these features then it doesn't matter! Just make sure you tick the box to say that you to use 'Direct static ad insertion' on the Ad Injection settings screen.
252
-
253
- = How can I show different ads for different categories? =
254
-
255
- If you want to show different ads for different categories using widgets you can set up filters for the different ads from the widget UI. If you want to show different top, random, or bottom adverts on different categories you can use some very simple PHP in the ad box (this will also work for the widgets as well if you don't like the UI method).
256
-
257
- Example 1 - one category specific ad and a general ad.
258
-
259
- `<?php if (in_category('japan')) { ?>
260
- Japan advert
261
- <?php } else { ?>
262
- General advert
263
- <?php } ?>`
264
-
265
- Example 2 - Two different ads in two different categories. Pages which aren't in either category have no ads.
266
-
267
- `<?php if (in_category('cheese')) { ?>
268
- Cheese advert
269
- <?php } else if (in_category('milk')) { ?>
270
- Milk advert
271
- <?php } ?>`
272
-
273
- See http://codex.wordpress.org/Function_Reference/in_category for more information on in_category.
274
-
275
- You can do the same for tags using has_tag. See http://codex.wordpress.org/Function_Reference/has_tag for info.
276
-
277
- Note - this will only work in direct insertion mode.
278
-
279
- = How can I show different ads for different post authors? =
280
-
281
- This is something I hope to build into the UI at some point. But in the mean time you can use PHP in the ad code boxes to do this: e.g.
282
-
283
- `<?php
284
- $author = get_the_author();
285
- if ($author == "john"){ ?>
286
- This is John's Ad.
287
- <?php } else if ($author == "paul") { ?>
288
- This is Paul's Ad.
289
- <?php } ?>`
290
-
291
- Note this will only work in direct insertion mode. It won�t work in mfunc mode unless you also load in the WordPress database dependencies.
292
-
293
- = How can I show different ads to people in different countries? =
294
-
295
- If you install the Country Filter plugin (with the IP database) then you can use the following code in the direct ad insertion modes. This will not work in mfunc mode!
296
-
297
- <?php if (function_exists('isCountryInFilter')) { ?>
298
- <?php if(isCountryInFilter(array("uk"))) { ?>
299
-
300
- UK advert
301
-
302
- <?php } else { ?>
303
-
304
- Global advert
305
-
306
- <?php } } ?>
307
-
308
- You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
309
-
310
- = If I restrict a widget to both a category and a tag it doesn't appear in the relevant category/tag archives. Why? =
311
-
312
- If you set an with a tag restriction of 'tag1' and a category restriction of 'cat1', then it will only appear on pages that have BOTH the tag1 and cat1 property.
313
-
314
- A post in this category with that tag will work as you spotted.
315
-
316
- But if will not show in the 'tag1' archive or 'cat1' category. This is because the 'tag1' archive is not part of the 'cat1' category. A tag archive can't be part of a category, and a category archive can't be part of a tag.
317
-
318
- This means that if you add both a tag and a category restriction the ad won't appear in the tag or category archives.
319
-
320
- If this restriction wasn't in place then it would mean the category and tag archives would start showing all ads that were set to appear in the category/tag - which could be loads! And there would be no way to remove selected ones from the archives.
321
-
322
- Therefore if you are defining ads with both a category and a tag, you will need* to define a separate one for the category/tag archive.
323
-
324
- I know this might cause extra work for you, but having this restriction allows more precise control of where the ads appear. This is a deliberate design decision, rather than some random behaviour.
325
-
326
- = How can I sell my ads / track my ad clicks? =
327
-
328
- These are advanced features which I have no plans for adding into the core Ad Injection. You might however be able to use Ad Injection with Google Ad Manager or OpenX Ad Server that should allow you to sell your own ads and track their clicks.
329
-
330
- If you are using a 3rd party ad provider (e.g. AdSense) then statistics such as ad clicks will be available from the ad provider.
331
-
332
- = Are there any known plugin conflicts? =
333
-
334
- **WP Minify**
335
-
336
- Problem: No ads appear when using mfunc mode.
337
-
338
- If you use WP Minify and a caching plugin in combination with Ad Injection, you'll need to turn off the HTML minification in WP Minify. This is because HTML minification strips out the mfunc tags that Ad Injection uses. You can leave the CSS and JavaScript minification on if you already use them.
339
-
340
- **FeedWordPress**
341
-
342
- Problem: Random, top and bottom ads don't appear on syndicated posts.
343
-
344
- By default FeedWordPress prevents the syndicated post contents from being passed to 'the_content' hook which is where the random, top and bottom ads are added. There's an easy fix:
345
-
346
- From the FeedWordPress settings page go to 'Posts & Links' and then in the 'Formatting' section set 'Formatting filters' to 'Expose syndicated posts to formatting filters'.
347
-
348
- = Will Ad Injection work with the multi-blog version of WordPress? =
349
-
350
- The multi-user version of WordPress are not supported - yet, however I have heard that some people have got it to work when using the 'direct' insertion mode. I hope to make it work properly with multi-blog versions of WordPress in the future.
351
-
352
- = Some technical details =
353
-
354
- * Plugin stores all its settings in a single option (adinj_options).
355
- * Uninstall support is provided to delete this option if you uninstall the plugin.
356
- * Admin code is separated into a separate file so it is not loaded when your visitors view your pages.
357
- * When used with a compatible caching plugin Ad Injection loads its dynamic settings from a static PHP file, and the ads from disk so no extra MySQL database queries are required.
358
- * When mfunc mode is used the ads are saved as text files into the plugin folder. The plugin will therefore need write access to the plugins folder.
359
- * The JavaScript for setting the referrer cookie is inserted using wp_enqueue_scripts.
360
- * If there is anything I can do better please let me know - this is my first plugin so I still have a lot to learn!
361
-
362
- == Troubleshooting ==
363
-
364
- Here are some things to check if the ads are not appearing, or are appearing when you think they shouldn't.
365
-
366
- 1. Have you clicked the box to enable your ads?
367
- 2. Would the options you have selected allow the ads to appear on that page?
368
- 3. Have you cleared your cache (if you are using a caching plugin) to make sure that the page has the ads injected into it?
369
- 4. If you still aren't sure why the ads aren't there (or why they are), click 'Enable debug mode'. Make sure the page gets regenerated (either by reloading, or by clearing the cache and reloading). The search the source code of the page (the HTML) for 'ADINJ DEBUG' tags. This will give you information about the decisions that the plugin made.
370
- 5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
371
- 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.
372
-
373
- = If ads aren't appearing on your archive (category, tag, author) pages =
374
-
375
- Ad Injection can only (with most themes) insert ads into archive pages if you are showing the full post. The ads will almost certainly get truncated or stripped out if you are showing excerpts.
376
-
377
- I hope to add proper support for ads in excerpts in a later release.
378
-
379
- = If you are using a caching plugin =
380
-
381
- 1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
382
- 2. If you use a version of WP Super Cache prior to 0.9.9.8 it must be configured in 'Legacy' mode for the dynamic features to work. If you use WP Super Cache 0.9.9.8 or above you can use any of the caching modes (mod_rewrite and PHP are faster than legacy).
383
- 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.
384
-
385
- = If you are using WP Minify =
386
-
387
- 1. Turn off the HTML minification mode if you are also using a caching plugin. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
388
- 2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
389
-
390
- = Only part of the setting screen is appearing =
391
-
392
- You are probably running out of memory. View the HTML source of the settings page (usually right click and View Source) and see if there is an out of memory message. You might have to delete/deactivate some other plugins, or search Google for advise specific to your web host.
393
-
394
- = If you are getting errors when using mfunc mode check the following =
395
-
396
- 1. Are there ad data directories in the plugin directory? The path will be:
397
-
398
- '/wp-content/plugins/ad-injection-data/.
399
-
400
- If not create this directory and make sure it is writeable by the plugin (chmod 0755 will do, chmod 0750 is better).
401
-
402
- 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.
403
-
404
- 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).
405
-
406
- = Errors after uninstalling the plugin =
407
-
408
- If you get an error like:
409
-
410
- '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'
411
-
412
- 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.
413
-
414
- = Reporting bugs =
415
-
416
- 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").
417
-
418
- == Screenshots ==
419
-
420
- 1. Easy to use interface which allows you to copy and paste your ad code directly from your ad provider. Options are provided to control when and where your ads appear.
421
- 2. The ads are automatically injected into the pages of your blog.
422
- 3. Can choose to show the ads only to search engine visitors, or define IP addresses that ads aren't shown to.
423
-
424
- == Changelog ==
425
-
426
- = 0.9.7.10 =
427
-
428
- * UI fix for WordPress 3.2
429
- * fix for users who are running PHP with no UTF8 support
430
- * file error code message fix
431
-
432
- = 0.9.7.9 =
433
- * Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
434
- * New option to randomly pick again from pool for each random ad position.
435
- * Modify default list of search referrers to remove /search/. Could cause problem with Google Webmaster Tools.
436
- * Revert a change which unconditionally printed a debug message in hook after receiving report of a problem with it.
437
-
438
- = 0.9.7.8 =
439
- * Fix bug that prevents ads appearing on archive/home pages when certain plugins/themes are installed.
440
- * A PHP4 compatibility fix.
441
-
442
- = 0.9.7.7 =
443
- * Footer ad support (only for themes that correctly use the wp_footer hook).
444
- * Align and clear options for widgets.
445
- * Word counting code now works for non-Latin languages.
446
-
447
- = 0.9.7.6 =
448
- * Category, tag and author exclusions now apply to home page posts.
449
- * Fixes for widget category exclusions.
450
-
451
- = 0.9.7.5 =
452
- * Simplify the ad insertion modes. Replace the two previous direct modes with one.
453
- * Other minor bug fixes.
454
-
455
- = 0.9.7.4 =
456
- * UI fixes.
457
-
458
- = 0.9.7.3 =
459
- * Fix (hopefully) for the disappearing top/bottom adverts that affected some users. Special thanks to numaga.com for the debug access.
460
-
461
- = 0.9.7.2 =
462
- Release with more debugging to try to track down top/bottom ads which have gone missing on some blogs.
463
-
464
- = 0.9.7.1 =
465
- Fix for disappearing top / bottom ad.
466
-
467
- = 0.9.7 =
468
- * Archive and home page ads now fully supported with the same controls as ads for single posts/pages.
469
- * Category, tag and author restrictions for top, random and bottom ads.
470
-
471
- = 0.9.6.6 =
472
- * Widgets can be conditionally included on pages by category, tag, and author.
473
- * Widget ad pool size increased to 10.
474
- * Fix for using just bottom ad in mfunc mode.
475
- * Less JavaScript on admin pages.
476
- * Global author exclude option.
477
-
478
- = 0.9.6.5 =
479
- * Add 'words' to content length counting options.
480
- * Fixes for categories/tags and ads with UTF-8 characters.
481
- * Search/404 exclusion options for global and widget settngs.
482
- * Ad pool size for top/random/bottom ads increased to 10.
483
-
484
- = 0.9.6.4 =
485
- * Can choose between page lengths based on viewable characters or all characters (includes HTML markup).
486
- * Fixes for widget padding options.
487
- * Enable alt content for random ads.
488
-
489
- = 0.9.6.3 =
490
- * Option to enable/disable front page ads in case your front and home pages are different.
491
-
492
- = 0.9.6.2 =
493
- * Support for W3 Total Cache and WP Cache (as well as the already supported WP Super Cache).
494
-
495
- = 0.9.6.1 =
496
- * Ad rotation / A:B split testing support for random, top, bottom and widget adverts.
497
- * Alternate content which can be defined for users who are dynamically blocked (by IP or referrer) from seeing adverts.
498
- * Choose which paragraph to start the random ads via the UI.
499
-
500
- = 0.9.5.2 =
501
- New CSS padding options for widgets. Fixes for CSS margin options.
502
- Update docs for due to new mfunc support in WP Super Cache. If you are using mfunc mode and upgrade to the latest version of WP Super Cache (0.9.9.8) you can now use the faster mod_rewrite mode or PHP mode instead of legacy mode.
503
-
504
- = 0.9.5.1 =
505
- New CSS padding options for widgets. Fixes for CSS margin options.
506
- Update docs for due to new mfunc support in WP Super Cache. If you are using mfunc mode and upgrade to the latest version of WP Super Cache (0.9.9.8) you can now use the faster mod_rewrite mode or PHP mode instead of legacy mode.
507
-
508
- = 0.9.5 =
509
- New option to add spacing above and below widgets.
510
- New options for randomly aligning random/top/bottom ads.
511
- Fixes for several bugs reported over Christmas.
512
-
513
- = 0.9.4.6 =
514
- Save options in admin_menu hook so that WordPress is correctly initialised when saving. Allows 'pluggable' include to be removed, which should fix 'Cannot redeclare get_userdatabylogin' conflict with vbbridge.
515
-
516
- = 0.9.4.5 =
517
- Fix problem with mfunc mode widgets on archive pages.
518
-
519
- = 0.9.4.4 =
520
- New display option for defining CSS clear as left, right or both.
521
- Suppress file system warnings.
522
- Tested on WordPress 2.8.6 - it works!
523
-
524
- = 0.9.4.3 =
525
- Only write to config file in mfunc mode.
526
-
527
- = 0.9.4.2 =
528
- Allow plugin to work with PHP4.
529
- Increase allowed home page ads to 10.
530
- Must always save widget ads to disk in case mode is changed to mfunc later on.
531
-
532
- = 0.9.4.1 =
533
- Fix: Remove file contents if ad is 0 length.
534
-
535
- = 0.9.4 =
536
- Global tag and category restrictions.
537
- Smoother JQuery show/hide blocks (especially on IE)
538
-
539
- = 0.9.3.4 =
540
- Clean up old settings restore block.
541
-
542
- = 0.9.3.3 =
543
- Add a status box to make it easy to see what the main settings are.
544
-
545
- = 0.9.3.2 =
546
- Add test mode, and further reduce unnecessary file access.
547
-
548
- = 0.9.3.1 =
549
- Fix chmod comparison problem.
550
-
551
- = 0.9.3 =
552
- Invalidate the options cache after saving.
553
-
554
- = 0.9.2 =
555
- If you are using mfunc mode and have added ad widgets please re-save them to regenerate the ad files.
556
- Save ad files to a new directory so they don't need to be re-created after upgrade.
557
-
558
- = 0.9.1 =
559
- Fix dynamic checking for widgets.
560
- Fix potential PHP error message with widgets.
561
-
562
- = 0.9.0 =
563
- Widget support.
564
- Only write to the ad files if necessary.
565
- Chrome display fixes.
566
- More informative save messages.
567
- Other fixes.
568
-
569
- = 0.8.9 =
570
- Prevent config file being lost by bulk automatic update.
571
- Error messages from adshow.php are hidden in HTML now rather than being visible to everyone.
572
-
573
- = 0.8.8 =
574
- 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.
575
-
576
- = 0.8.7 =
577
- More fault tolerant mfunc support.
578
-
579
- = 0.8.6 =
580
- Fix problems relating to over strict chmod usage.
581
- Add save message.
582
- More informative warnings.
583
- Update links to reviewmylife.
584
-
585
- = 0.8.5 =
586
- Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on page types that I haven't taken account of.
587
-
588
- = 0.8.4 =
589
- * Fix deletion of ad code and config file that happens during automatic update.
590
-
591
- = 0.8.3 =
592
- * First public release
593
-
594
- == Upgrade Notice ==
595
-
596
- = 0.9.7.10 =
597
-
598
- * UI fix for WordPress 3.2 and fix for users who are running PHP with no UTF8 support.
599
-
600
- = 0.9.7.9 =
601
- * New options to disable last paragraph random ad, re-pick random ad for each position, and other minor fixes.
602
-
603
- = 0.9.7.8 =
604
- * Fix bug that prevented ads appearing on archive/home pages when used with certain plugins/themes.
605
-
606
- = 0.8.3 =
607
- First public release.
608
-
 
 
 
 
 
 
 
1
+ === Ad Injection ===
2
+ Contributors: reviewmylife
3
+ Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
4
+ Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
5
+ Requires at least: 2.8.6
6
+ Tested up to: 3.2
7
+ Stable tag: 0.9.7.11
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
+
11
+ == Description ==
12
+
13
+ Ad Injection from [reviewmylife](http://www.reviewmylife.co.uk/ "reviewmylife") injects any kind of advert (e.g. Google AdSense, Amazon Associates, ClickBank, TradeDoubler, etc) into the existing content of your WordPress posts and pages. You can control the number of adverts based on the post length, and it can restrict who sees adverts by post age, visitor referrer and IP address. Adverts can be configured in the post (random, top, and bottom positions) or in any widget/sidebar area. There's support for A:B split testing / ad rotation. And the dynamic restrictions (by IP and referrer) work with WP Super Cache, W3 Total Cache and WP Cache.
14
+
15
+ **New Features 0.9.7.x**
16
+
17
+ * Archive and home page ads now fully supported with the same controls as ads for single posts/pages.
18
+ * Category, tag and author restrictions for top, random and bottom ads.
19
+ * Footer ads.
20
+ * Restrict ads by page/post id
21
+
22
+ **New Features 0.9.6.x**
23
+
24
+ * Ad rotation / A:B split testing support for random, top, bottom and widget/sidebar adverts.
25
+ * Alternate content which can be defined for users who are dynamically blocked (by IP or referrer) from seeing adverts.
26
+ * Choose which paragraph to start the random ads via the UI.
27
+ * Dynamic features will work with W3 Total Cache and WP Cache as well as the previously suppoted WP Super Cache.
28
+ * Widgets can be conditionally included on pages by category, tag, and author.
29
+
30
+ = Automatic advert injection =
31
+
32
+ The ads can be injected into existing posts without requiring any modification of the post. The injection can be done randomly between paragraphs, and there is an option to always inject the first advert at a specified paragraph (e.g. the first or second). Randomly positioning the adverts helps to reduce 'ad blindness'. Two additional adverts can be defined for the top and bottom of the content. Widget adverts can be defined as well.
33
+
34
+ = Widget support =
35
+
36
+ Widgets can be added to your sidebars, or other widget areas on any pages. The same ad display restrictions that you setup for your other ads will also apply to the widgets.
37
+
38
+ = Ad rotation / split testing =
39
+
40
+ You can define multiple adverts for the same ad space which are rotated according to the ratios you define. Works with random, top, bottom and sidget/sidebar ads.
41
+
42
+ = Ad quantity by post length =
43
+
44
+ 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.
45
+
46
+ = Search engines only mode =
47
+
48
+ 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.
49
+
50
+ = Ads on old posts only =
51
+
52
+ Adverts can be restricted to posts that are more than a defined numbers of days old. This prevents your regular visitors from having to see your ads.
53
+
54
+ = Category, tag and post type filters =
55
+
56
+ You can configure the adverts to only appear on specific categories, tags, or post types, or block the adverts from specific categories, tags or post types.
57
+
58
+ = Block ads from IP addresses =
59
+
60
+ IP addresses of people who shouldn't see your ads can be defined. These could be the IP addresses of your friends, family, or even yourself.
61
+
62
+ = Alternate content =
63
+
64
+ This is content that is displayed when ads are blocked for the user. You could use this alternate content to show other content, some kind of layout filler, or even a different type of ad. I've added support for rotation of alternate content as well.
65
+
66
+ = Not tied to any ad provider =
67
+
68
+ The advert code can be copied and pasted directly from your ad provider (Google AdSense, adBrite, ClickBank, etc) which will help you to comply with any terms of service (TOS) that state their ad code may not be modified.
69
+
70
+ = Flexible ad positioning =
71
+
72
+ Easy positioning options are provided for left, right, center, float left, and float right (or a random variant of these). Extra spacing can be set above and below the ad using the CSS margin and padding boxes. Or if that isn't flexible enough, you can write your own positioning code using HTML and CSS. And you can select which paragraph random ads should start from.
73
+
74
+ = Works with WP Super Cache, W3 Total Cache and WP Cache =
75
+
76
+ The dynamic features that require code to be executed for each page view (i.e. ad rotation, search engine visitors only, and ad blocking based on IP address) work with WP Super Cache, W3 Total Cache and WP Cache.
77
+
78
+ This plugin will automatically use the dynamic mfunc tag to ensure that the dynamic ad features still work when caching is on.
79
+
80
+ If you use WP Super Cache in mod_rewrite mode displaying the adverts (even with the dynamic restrictions) whilst caching requires no MySQL database access. For W3 Total Cache and WP Cache Ad Injection will not require any extra MySQL database access for cached pages other than what these plugin already use.
81
+
82
+ = Inject PHP and JavaScript =
83
+
84
+ As the plugin will inject whatever content you like into the page you can write your own ad rotation or a/b split testing code for the ads you inject. PHP code can be automatically executed, even when using WP Super Cache.
85
+
86
+ = Hide UI panels that you don't need =
87
+
88
+ 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.
89
+
90
+ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
91
+
92
+ = Actively being developed =
93
+
94
+ As of 2011 this plugin is being actively developed and maintained. New features are planned for later on in 2011. If you have ideas for new features do let me know - I can't promise to do them any time soon - but if they are good and practical I can add them to my list.
95
+
96
+ == Installation ==
97
+
98
+ This section describes how to install the plugin and get it working.
99
+
100
+ 1. Upload the ad-injection folder to the '/wp-content/plugins/' directory (or just use the WordPress plugin installer to do it for you). The plugin must be in a folder called 'ad-injection'. So the main plugin file will be at /wp-content/plugins/ad-injection/ad-injection.php
101
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
102
+ 3. Configure your ads. Carefully go through all the sections to setup your ad placements.
103
+ 4. Make sure you select the option to say which ad injection mode to use. Dynamic features (ad rotation, and referrer/IP ad filtering) will only work with either 1) WP Super Cache/W3 Total Cache/WP Cache or 2) no caching plugin.
104
+ 5. Tick the box right at the top to enable your ads.
105
+ 6. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
106
+
107
+ **Recommended cache plugin settings**
108
+
109
+ * WP Super Cache - 0.9.9.8+ using mod_rewrite mode.
110
+ * W3 Total Cache - Page Cache: 'Disk (basic)' mode.
111
+ * WP Cache - Just turn the caching on.
112
+
113
+ Note: If you use a version of WP Super Cache prior to 0.9.9.8 it must be configured in 'Legacy' mode for the dynamic features to work. If you use WP Super Cache 0.9.9.8 or above you can use any of the caching modes (mod_rewrite and PHP are faster than legacy).
114
+
115
+ = How to uninstall =
116
+
117
+ You can uninstall by deactivating the plugin and deleting from the WordPress plugins control panel.
118
+
119
+ If you have been using mfunc mode with a caching plugin then you *must* also clear the cache afterwards, otherwise you'll get errors saying the Ad Injection includes can't be found.
120
+
121
+ == Frequently Asked Questions ==
122
+
123
+ = Why was this plugin created? =
124
+
125
+ I used to use the excellent Adsense Injection by Dax Herrera, but found I needed more features and flexibility. His plugin inspired this one.
126
+
127
+ = How is this plugin different to Adsense Injection by Dax Herrera? =
128
+
129
+ One a basic level it can do the same job as Dax's excellent Adsense Injection. If you want it can just inject Adsense like his plugin does. I used to use his plugin, but found that I wanted a lot more features. Here is a quick list of the extra features.
130
+
131
+ * Inject any type of advert from any ad provider.
132
+ * Restrict ad display by referrer (e.g. can restrict display to search engine visitors).
133
+ * Can prevent specific IP addresses from seeing adverts.
134
+ * Can define randomly positioned adverts, and adverts at the top and bottom of the posts.
135
+ * Add adverts to the widget area.
136
+ * Ad rotation / split testing.
137
+ * Restrict adverts by category and tag.
138
+ * Vary number of adverts based on post length.
139
+ * You can inject raw JavaScript and PHP.
140
+ * The dynamic features (ad rotation, restricting ads by referrer and IP) work with WP Super Cache, W3 Total Cache and WP Cache.
141
+ * Define alternate content for users who are dynamically restricted from seeing ads.
142
+ * Compatible with the <!--noadsense--> <!--adsensestart--> in-page tags from Adsense Injection to make migration easy.
143
+ * Compatible with in-page tags from Whydowork Adsense and Quick Adsense.
144
+ * Extra positioning options - for example you can force the first advert to be right after the first paragraph so that it will be 'above the fold'.
145
+
146
+ Thanks to Dax by the way for providing the inspiration for this plugin!
147
+
148
+ = Does this plugin 'take' a percentage of my ad earnings? =
149
+
150
+ No! Absolutely not. Some ad plugins replace your publisher ID with their own for a certain percentage of adverts. Ad Injection does NOT do this. All your earnings are your own. Ad Injection makes no modifications to your ad code. What you paste into the ad boxes is what is injected into your pages.
151
+
152
+ = Is using this plugin allowed for Google AdSense? =
153
+
154
+ As far as I can tell using this plugin should be legal for AdSense **as long as you** make sure the ad quantities/placements comply with their TOS. However it is up to you to make sure that your website complies.
155
+
156
+ Ad Injection is designed as a generic plugin for injecting all types of adverts. It will not specifically check that the defined ad quantities or positions are in compliance of the AdSense TOS for you. For example Ad Injection will allow you to inject more ads than Google allows if you configure it to do so.
157
+
158
+ Be careful if you use the float left/right positioning options. These options could cause your AdSense adverts to appear under other elements of your page if you have also set a float value for them (e.g. floating images, and adverts together could be problematic). However the new 'clear' option should allow you to make sure this doesn't happen.
159
+
160
+ The best advice for any advert plugin is to manually check that you are happy with the advert quantities and positioning it produces, to ensure that you comply with the TOS for your ad program.
161
+
162
+ You use this plugin at your own risk.
163
+
164
+ = Do you have any testing recommendations? =
165
+
166
+ For testing your ad settings I'd recommend that you first disable any caching plugin, and then set Ad Injection to test mode.
167
+
168
+ If you are unsure as to why ads are appearing (or aren't) enable debug mode from the UI and look for the 'ADINJ DEBUG' tags in the HTML source of your webpage.
169
+
170
+ When you are happy with the ad quantities / positions you can disable debug mode, re-enable your caching plugin, and set the Ad Injection mode to 'On'.
171
+
172
+ If you are testing the search engine referrer settings be aware that Ad Injection sets a one hour cookie when you visit via a site with a matching referrer. This means that after you have visited the site via the matching referrer the adverts will keep showing for the next hour. Clear your cookies to reset the behaviour. The Firefox 'Cookie Monster' plugin is very useful if you want to check the status of the cookie. Look for the 'adinj' cookie. Instead of clearing all your cookies you can just delete this one.
173
+
174
+ Using a second browser in 'privacy mode' is also a good way of testing your site with a clean slate. A browser like Google Chrome will allow you to test your site with no cookies definied if you start a new private browsing session.
175
+
176
+ = Do I need to have WP Super Cache (or anther caching plugin) installed? =
177
+
178
+ No! All the features of this plugin will work with no caching plugin installed. But if you do have WP Super Cache the dynamic features (ad rotation and enabling ads based on IP address and referrer) will still work. And your blog will run a lot faster than with no caching plugin. Usually a caching plugin would prevent dynamic plugin features from working. Just make sure you choose the mfunc dynamic insertion mode in the Ad Injection settings screen.
179
+
180
+ = Will the dynamic features work with other caching plugins? =
181
+
182
+ The dynamic features will work with any caching program that supports the mfunc tag. At the moment that is WP Super Cache, W3 Total Cache, and WP Cache.
183
+
184
+ = Which caching plugin is best? =
185
+
186
+ Both WP Super Cache and W3 Total Cache are likely to be faster than WP Cache.
187
+
188
+ If you aren't using the dynamic features then the only way to find out which is best between WP Super Cache and W3 Total Cache is to measure the performance yourself, as the speed depends on many factors that will be unique to your web server and web site.
189
+
190
+ If you are using dynamic features with mfunc mode then WP Super Cache (in mod_rewrite mode) and W3 Total Cache (in Page Cache: Disk (basic) mode) are likely to offer similar performance as they both return the dynamic files via PHP.
191
+
192
+ Note that W3 Total Cache will not cache pages with mfunc tags if you use the Page Cache: Disk (enhanced) mode.
193
+
194
+ The speed of your website does depend on more factors than just page serve time so other features that the caching plugins offer (such as CDN and minification support) may swing the advantage either way.
195
+
196
+ WP Hyper Cache does not support mfunc tags so only use it if you don't want to use any of the dynamic features. If using WP Hyper Cache set the Ad Injection mode to 'direct_static'.
197
+
198
+ For reference: dynamic features are ad rotation, and blocking ad views by IP and referrer.
199
+
200
+ = Can I just have adverts on the home page? =
201
+
202
+ i.e. adverts on the home page, but not on single posts or pages.
203
+
204
+ Yes you can do this, there are two ways.
205
+
206
+ 1. In the 'Single posts and pages' setting set the number of injected ads to 0. Then in the 'Home page' settings set the number of ads to whatever you want.
207
+ 2. Alternatively use the global exclude options at the top to exclude ads from all page types except the home page.
208
+
209
+ = Why aren't adverts appearing on my front / home / archives page? =
210
+
211
+ Ads will only appear if your front, home or archives page if you show the full post - not if you show excerpts*.
212
+
213
+ * However if your theme leaves the HTML tags intact then you may in fact see the top ad in your excerpt. Whether you do or not depends on how your theme deals with excerpts.
214
+
215
+ = How do I stop adverts from appearing on my contacts form page? =
216
+
217
+ To stop ads appearing on the contact page (or any other post/page) you have many of options. Here are 4 to choose from:
218
+
219
+ 1. Add the post/page id to the post/page id ad filtering box.
220
+ 2. Add (copy and paste) &lt;!--NoAds--&gt; into the content of the post/page with the contact form. Just edit the contact page and paste this in - it will be invisible to the reader.
221
+ 3. Add a disable_adverts custom field to the post/page containing the contact form and set the value to 1 (the number one as a single digit). If you can't see the custom fields click on 'Screen Options' at the top right on the post/page editing screen, and tick 'Custom Fields.
222
+ 4. Add a tag to the page to mean that it shouldn't have adverts, and then add that tag to the tag filtering condition in the global settings area of the plugin configuration page.
223
+
224
+ = How can I put ads on category (or other archive pages)? =
225
+
226
+ The top, random and bottom ads can be placed into the category pages. Category pages are a type of archive.
227
+
228
+ On the main settings page for Ad Injection just enter the number of adverts you want on these page types using the Archives column in the 'Ad placement settings' section.
229
+
230
+ Ads will only appear on archives/category pages if you are showing the full post contents on these pages. They won't work if you are showing excerpts.
231
+
232
+ = My adverts are overlapping with other page elements (e.g. images) =
233
+
234
+ You can try defining the 'clear' display setting so that multiple floated parts of your page do not overlap.
235
+
236
+ If you always have a floated image at the top of the page you can set which paragraph the first random advert will start from. If you needed finer control over where the random adverts appear you can use the <!--adstart--> and <!--adend--> tags in the page.
237
+
238
+ = I have set the ads to float but the text/headings aren't flowing around them =
239
+
240
+ Check your style sheet to see if either the text or headings have the 'clear' attribute set. This may be preventing your text / headings from flowing around the advert.
241
+
242
+ = I have configured four Google AdSense ad units but only three are showing. Why? =
243
+
244
+ Google's AdSense TOS only allow allow three ad units, and three link units per page. If you have for example tried to insert four ad units on your page then Google will (probably) disable the forth one automatically. Read Google's AdSense [program policies](https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=48182 "AdSense program policies") for more info.
245
+
246
+ = What if I am using an incompatible caching plugin? =
247
+
248
+ Don't worry - everything will still work except for:
249
+
250
+ 1. Filtering ads based on the IP address of the visitor.
251
+ 2. Filtering the ads based on the HTTP referrer of the visitor.
252
+
253
+ If you aren't interested in these features then it doesn't matter! Just make sure you tick the box to say that you to use 'Direct static ad insertion' on the Ad Injection settings screen.
254
+
255
+ = How can I show different ads for different categories? =
256
+
257
+ If you want to show different ads for different categories using widgets you can set up filters for the different ads from the widget UI. If you want to show different top, random, or bottom adverts on different categories you can use some very simple PHP in the ad box (this will also work for the widgets as well if you don't like the UI method).
258
+
259
+ Example 1 - one category specific ad and a general ad.
260
+
261
+ `<?php if (in_category('japan')) { ?>
262
+ Japan advert
263
+ <?php } else { ?>
264
+ General advert
265
+ <?php } ?>`
266
+
267
+ Example 2 - Two different ads in two different categories. Pages which aren't in either category have no ads.
268
+
269
+ `<?php if (in_category('cheese')) { ?>
270
+ Cheese advert
271
+ <?php } else if (in_category('milk')) { ?>
272
+ Milk advert
273
+ <?php } ?>`
274
+
275
+ See http://codex.wordpress.org/Function_Reference/in_category for more information on in_category.
276
+
277
+ You can do the same for tags using has_tag. See http://codex.wordpress.org/Function_Reference/has_tag for info.
278
+
279
+ Note - this will only work in direct insertion mode.
280
+
281
+ = How can I show different ads for different post authors? =
282
+
283
+ This is something I hope to build into the UI at some point. But in the mean time you can use PHP in the ad code boxes to do this: e.g.
284
+
285
+ `<?php
286
+ $author = get_the_author();
287
+ if ($author == "john"){ ?>
288
+ This is John's Ad.
289
+ <?php } else if ($author == "paul") { ?>
290
+ This is Paul's Ad.
291
+ <?php } ?>`
292
+
293
+ Note this will only work in direct insertion mode. It won�t work in mfunc mode unless you also load in the WordPress database dependencies.
294
+
295
+ = How can I show different ads to people in different countries? =
296
+
297
+ If you install the Country Filter plugin (with the IP database) then you can use the following code in the direct ad insertion modes. This will not work in mfunc mode!
298
+
299
+ `<?php if (function_exists('isCountryInFilter')) { ?>
300
+ <?php if(isCountryInFilter(array("uk"))) { ?>
301
+
302
+ UK advert
303
+
304
+ <?php } else { ?>
305
+
306
+ Global advert
307
+
308
+ <?php } } ?>`
309
+
310
+ You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
311
+
312
+ = If I restrict a widget to both a category and a tag it doesn't appear in the relevant category/tag archives. Why? =
313
+
314
+ If you set an with a tag restriction of 'tag1' and a category restriction of 'cat1', then it will only appear on pages that have BOTH the tag1 and cat1 property.
315
+
316
+ A post in this category with that tag will work as you spotted.
317
+
318
+ But if will not show in the 'tag1' archive or 'cat1' category. This is because the 'tag1' archive is not part of the 'cat1' category. A tag archive can't be part of a category, and a category archive can't be part of a tag.
319
+
320
+ This means that if you add both a tag and a category restriction the ad won't appear in the tag or category archives.
321
+
322
+ If this restriction wasn't in place then it would mean the category and tag archives would start showing all ads that were set to appear in the category/tag - which could be loads! And there would be no way to remove selected ones from the archives.
323
+
324
+ Therefore if you are defining ads with both a category and a tag, you will need* to define a separate one for the category/tag archive.
325
+
326
+ I know this might cause extra work for you, but having this restriction allows more precise control of where the ads appear. This is a deliberate design decision, rather than some random behaviour.
327
+
328
+ = How can I sell my ads / track my ad clicks? =
329
+
330
+ These are advanced features which I have no plans for adding into the core Ad Injection. You might however be able to use Ad Injection with Google Ad Manager or OpenX Ad Server that should allow you to sell your own ads and track their clicks.
331
+
332
+ If you are using a 3rd party ad provider (e.g. AdSense) then statistics such as ad clicks will be available from the ad provider.
333
+
334
+ = Are there any known plugin conflicts? =
335
+
336
+ **WP Minify**
337
+
338
+ Problem: No ads appear when using mfunc mode.
339
+
340
+ If you use WP Minify and a caching plugin in combination with Ad Injection, you'll need to turn off the HTML minification in WP Minify. This is because HTML minification strips out the mfunc tags that Ad Injection uses. You can leave the CSS and JavaScript minification on if you already use them.
341
+
342
+ **FeedWordPress**
343
+
344
+ Problem: Random, top and bottom ads don't appear on syndicated posts.
345
+
346
+ By default FeedWordPress prevents the syndicated post contents from being passed to 'the_content' hook which is where the random, top and bottom ads are added. There's an easy fix:
347
+
348
+ From the FeedWordPress settings page go to 'Posts & Links' and then in the 'Formatting' section set 'Formatting filters' to 'Expose syndicated posts to formatting filters'.
349
+
350
+ = Will Ad Injection work with the multi-blog version of WordPress? =
351
+
352
+ The multi-user version of WordPress are not supported - yet, however I have heard that some people have got it to work when using the 'direct' insertion mode. I hope to make it work properly with multi-blog versions of WordPress in the future.
353
+
354
+ = Some technical details =
355
+
356
+ * Plugin stores all its settings in a single option (adinj_options).
357
+ * Uninstall support is provided to delete this option if you uninstall the plugin.
358
+ * Admin code is separated into a separate file so it is not loaded when your visitors view your pages.
359
+ * When used with a compatible caching plugin Ad Injection loads its dynamic settings from a static PHP file, and the ads from disk so no extra MySQL database queries are required.
360
+ * When mfunc mode is used the ads are saved as text files into the plugin folder. The plugin will therefore need write access to the plugins folder.
361
+ * The JavaScript for setting the referrer cookie is inserted using wp_enqueue_scripts.
362
+ * If there is anything I can do better please let me know - this is my first plugin so I still have a lot to learn!
363
+
364
+ == Troubleshooting ==
365
+
366
+ Here are some things to check if the ads are not appearing, or are appearing when you think they shouldn't.
367
+
368
+ 1. Have you clicked the box to enable your ads?
369
+ 2. Would the options you have selected allow the ads to appear on that page?
370
+ 3. Have you cleared your cache (if you are using a caching plugin) to make sure that the page has the ads injected into it?
371
+ 4. If you still aren't sure why the ads aren't there (or why they are), click 'Enable debug mode'. Make sure the page gets regenerated (either by reloading, or by clearing the cache and reloading). The search the source code of the page (the HTML) for 'ADINJ DEBUG' tags. This will give you information about the decisions that the plugin made.
372
+ 5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
373
+ 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.
374
+
375
+ = If ads aren't appearing on your archive (category, tag, author) pages =
376
+
377
+ Ad Injection can only (with most themes) insert ads into archive pages if you are showing the full post. The ads will almost certainly get truncated or stripped out if you are showing excerpts.
378
+
379
+ I hope to add proper support for ads in excerpts in a later release.
380
+
381
+ = If you are using a caching plugin =
382
+
383
+ 1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
384
+ 2. If you use a version of WP Super Cache prior to 0.9.9.8 it must be configured in 'Legacy' mode for the dynamic features to work. If you use WP Super Cache 0.9.9.8 or above you can use any of the caching modes (mod_rewrite and PHP are faster than legacy).
385
+ 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.
386
+
387
+ = If you are using WP Minify =
388
+
389
+ 1. Turn off the HTML minification mode if you are also using a caching plugin. HTML minification strips out the mfunc tags that Ad Injection needs to inject its ads.
390
+ 2. If you use the 'Place Minified JavaScript in footer' then try turning it off.
391
+
392
+ = Only part of the setting screen is appearing =
393
+
394
+ You are probably running out of memory. View the HTML source of the settings page (usually right click and View Source) and see if there is an out of memory message. You might have to delete/deactivate some other plugins, or search Google for advise specific to your web host.
395
+
396
+ = If you are getting errors when using mfunc mode check the following =
397
+
398
+ 1. Are there ad data directories in the plugin directory? The path will be:
399
+
400
+ '/wp-content/plugins/ad-injection-data/.
401
+
402
+ If not create this directory and make sure it is writeable by the plugin (chmod 0755 will do, chmod 0750 is better).
403
+
404
+ 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.
405
+
406
+ 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).
407
+
408
+ = Errors after uninstalling the plugin =
409
+
410
+ If you get an error like:
411
+
412
+ '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'
413
+
414
+ 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.
415
+
416
+ = Reporting bugs =
417
+
418
+ 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").
419
+
420
+ == Screenshots ==
421
+
422
+ 1. Easy to use interface which allows you to copy and paste your ad code directly from your ad provider. Options are provided to control when and where your ads appear.
423
+ 2. The ads are automatically injected into the pages of your blog.
424
+ 3. Can choose to show the ads only to search engine visitors, or define IP addresses that ads aren't shown to.
425
+
426
+ == Changelog ==
427
+
428
+ = 0.9.7.11 =
429
+ * Filter ads by post/page ID
430
+ * Other misc bug fixes
431
+
432
+ = 0.9.7.10 =
433
+ * UI fix for WordPress 3.2
434
+ * fix for users who are running PHP with no UTF8 support
435
+ * file error code message fix
436
+
437
+ = 0.9.7.9 =
438
+ * Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
439
+ * New option to randomly pick again from pool for each random ad position.
440
+ * Modify default list of search referrers to remove /search/. Could cause problem with Google Webmaster Tools.
441
+ * Revert a change which unconditionally printed a debug message in hook after receiving report of a problem with it.
442
+
443
+ = 0.9.7.8 =
444
+ * Fix bug that prevents ads appearing on archive/home pages when certain plugins/themes are installed.
445
+ * A PHP4 compatibility fix.
446
+
447
+ = 0.9.7.7 =
448
+ * Footer ad support (only for themes that correctly use the wp_footer hook).
449
+ * Align and clear options for widgets.
450
+ * Word counting code now works for non-Latin languages.
451
+
452
+ = 0.9.7.6 =
453
+ * Category, tag and author exclusions now apply to home page posts.
454
+ * Fixes for widget category exclusions.
455
+
456
+ = 0.9.7.5 =
457
+ * Simplify the ad insertion modes. Replace the two previous direct modes with one.
458
+ * Other minor bug fixes.
459
+
460
+ = 0.9.7.4 =
461
+ * UI fixes.
462
+
463
+ = 0.9.7.3 =
464
+ * Fix (hopefully) for the disappearing top/bottom adverts that affected some users. Special thanks to numaga.com for the debug access.
465
+
466
+ = 0.9.7.2 =
467
+ Release with more debugging to try to track down top/bottom ads which have gone missing on some blogs.
468
+
469
+ = 0.9.7.1 =
470
+ Fix for disappearing top / bottom ad.
471
+
472
+ = 0.9.7 =
473
+ * Archive and home page ads now fully supported with the same controls as ads for single posts/pages.
474
+ * Category, tag and author restrictions for top, random and bottom ads.
475
+
476
+ = 0.9.6.6 =
477
+ * Widgets can be conditionally included on pages by category, tag, and author.
478
+ * Widget ad pool size increased to 10.
479
+ * Fix for using just bottom ad in mfunc mode.
480
+ * Less JavaScript on admin pages.
481
+ * Global author exclude option.
482
+
483
+ = 0.9.6.5 =
484
+ * Add 'words' to content length counting options.
485
+ * Fixes for categories/tags and ads with UTF-8 characters.
486
+ * Search/404 exclusion options for global and widget settngs.
487
+ * Ad pool size for top/random/bottom ads increased to 10.
488
+
489
+ = 0.9.6.4 =
490
+ * Can choose between page lengths based on viewable characters or all characters (includes HTML markup).
491
+ * Fixes for widget padding options.
492
+ * Enable alt content for random ads.
493
+
494
+ = 0.9.6.3 =
495
+ * Option to enable/disable front page ads in case your front and home pages are different.
496
+
497
+ = 0.9.6.2 =
498
+ * Support for W3 Total Cache and WP Cache (as well as the already supported WP Super Cache).
499
+
500
+ = 0.9.6.1 =
501
+ * Ad rotation / A:B split testing support for random, top, bottom and widget adverts.
502
+ * Alternate content which can be defined for users who are dynamically blocked (by IP or referrer) from seeing adverts.
503
+ * Choose which paragraph to start the random ads via the UI.
504
+
505
+ = 0.9.5.2 =
506
+ New CSS padding options for widgets. Fixes for CSS margin options.
507
+ Update docs for due to new mfunc support in WP Super Cache. If you are using mfunc mode and upgrade to the latest version of WP Super Cache (0.9.9.8) you can now use the faster mod_rewrite mode or PHP mode instead of legacy mode.
508
+
509
+ = 0.9.5.1 =
510
+ New CSS padding options for widgets. Fixes for CSS margin options.
511
+ Update docs for due to new mfunc support in WP Super Cache. If you are using mfunc mode and upgrade to the latest version of WP Super Cache (0.9.9.8) you can now use the faster mod_rewrite mode or PHP mode instead of legacy mode.
512
+
513
+ = 0.9.5 =
514
+ New option to add spacing above and below widgets.
515
+ New options for randomly aligning random/top/bottom ads.
516
+ Fixes for several bugs reported over Christmas.
517
+
518
+ = 0.9.4.6 =
519
+ Save options in admin_menu hook so that WordPress is correctly initialised when saving. Allows 'pluggable' include to be removed, which should fix 'Cannot redeclare get_userdatabylogin' conflict with vbbridge.
520
+
521
+ = 0.9.4.5 =
522
+ Fix problem with mfunc mode widgets on archive pages.
523
+
524
+ = 0.9.4.4 =
525
+ New display option for defining CSS clear as left, right or both.
526
+ Suppress file system warnings.
527
+ Tested on WordPress 2.8.6 - it works!
528
+
529
+ = 0.9.4.3 =
530
+ Only write to config file in mfunc mode.
531
+
532
+ = 0.9.4.2 =
533
+ Allow plugin to work with PHP4.
534
+ Increase allowed home page ads to 10.
535
+ Must always save widget ads to disk in case mode is changed to mfunc later on.
536
+
537
+ = 0.9.4.1 =
538
+ Fix: Remove file contents if ad is 0 length.
539
+
540
+ = 0.9.4 =
541
+ Global tag and category restrictions.
542
+ Smoother JQuery show/hide blocks (especially on IE)
543
+
544
+ = 0.9.3.4 =
545
+ Clean up old settings restore block.
546
+
547
+ = 0.9.3.3 =
548
+ Add a status box to make it easy to see what the main settings are.
549
+
550
+ = 0.9.3.2 =
551
+ Add test mode, and further reduce unnecessary file access.
552
+
553
+ = 0.9.3.1 =
554
+ Fix chmod comparison problem.
555
+
556
+ = 0.9.3 =
557
+ Invalidate the options cache after saving.
558
+
559
+ = 0.9.2 =
560
+ If you are using mfunc mode and have added ad widgets please re-save them to regenerate the ad files.
561
+ Save ad files to a new directory so they don't need to be re-created after upgrade.
562
+
563
+ = 0.9.1 =
564
+ Fix dynamic checking for widgets.
565
+ Fix potential PHP error message with widgets.
566
+
567
+ = 0.9.0 =
568
+ Widget support.
569
+ Only write to the ad files if necessary.
570
+ Chrome display fixes.
571
+ More informative save messages.
572
+ Other fixes.
573
+
574
+ = 0.8.9 =
575
+ Prevent config file being lost by bulk automatic update.
576
+ Error messages from adshow.php are hidden in HTML now rather than being visible to everyone.
577
+
578
+ = 0.8.8 =
579
+ 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.
580
+
581
+ = 0.8.7 =
582
+ More fault tolerant mfunc support.
583
+
584
+ = 0.8.6 =
585
+ Fix problems relating to over strict chmod usage.
586
+ Add save message.
587
+ More informative warnings.
588
+ Update links to reviewmylife.
589
+
590
+ = 0.8.5 =
591
+ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on page types that I haven't taken account of.
592
+
593
+ = 0.8.4 =
594
+ * Fix deletion of ad code and config file that happens during automatic update.
595
+
596
+ = 0.8.3 =
597
+ * First public release
598
+
599
+ == Upgrade Notice ==
600
+
601
+ = 0.9.7.11 =
602
+ * Filter ads by post/page ID and other misc fixes.
603
+
604
+ = 0.9.7.10 =
605
+ * UI fix for WordPress 3.2 and fix for users who are running PHP with no UTF8 support.
606
+
607
+ = 0.9.7.9 =
608
+ * New options to disable last paragraph random ad, re-pick random ad for each position, and other minor fixes.
609
+
610
+ = 0.9.7.8 =
611
+ * Fix bug that prevented ads appearing on archive/home pages when used with certain plugins/themes.
612
+
613
+ = 0.8.3 =
614
+ First public release.
615
+
ui-tab-main.php CHANGED
@@ -59,7 +59,7 @@ function adinj_tab_main(){
59
  <tr><td></td><td><b>Single/Page</b></td><td><b>Home</b></td><td><b>Archive</b></td></tr>
60
  <tr><td colspan="4"><h3>Top ad</h3></td></tr>
61
 
62
- <tr><td>Only show top ad on posts longer than:</td><td>
63
  <?php
64
  $unit = adinj_counting_unit_description();
65
  $ad_if_longer_settings = array('d','a',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
@@ -127,7 +127,7 @@ function adinj_tab_main(){
127
 
128
  <tr><td colspan="4"><h3>Bottom ad</h3></td></tr>
129
 
130
- <tr><td>Only show bottom ad 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>';
@@ -394,7 +394,7 @@ function adinj_random_ad_limit_table(){
394
  <?php
395
  $prefixes = array("", "home_", "archive_");
396
  $unit = adinj_counting_unit_description();
397
- $ad_limit_settings = array(ADINJ_RULE_DISABLED,100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
398
 
399
  foreach ($prefixes as $prefix){
400
  echo '<td>';
@@ -402,7 +402,7 @@ function adinj_random_ad_limit_table(){
402
  echo '</td>';
403
  } ?>
404
  </tr>
405
- <tr><td>One ad if shorter than:</td>
406
  <?php
407
  foreach ($prefixes as $prefix){
408
  echo '<td>';
@@ -410,7 +410,7 @@ function adinj_random_ad_limit_table(){
410
  echo '</td>';
411
  } ?>
412
  </tr>
413
- <tr><td>Two ads if shorter than:</td>
414
  <?php
415
  foreach ($prefixes as $prefix){
416
  echo '<td>';
@@ -419,7 +419,7 @@ function adinj_random_ad_limit_table(){
419
  }
420
  ?>
421
  </tr>
422
- <tr><td>Three ads if shorter than:</td>
423
  <?php
424
  foreach ($prefixes as $prefix){
425
  echo '<td>';
59
  <tr><td></td><td><b>Single/Page</b></td><td><b>Home</b></td><td><b>Archive</b></td></tr>
60
  <tr><td colspan="4"><h3>Top ad</h3></td></tr>
61
 
62
+ <tr><td><b>Enabled/disabled</b> (on posts longer than):</td><td>
63
  <?php
64
  $unit = adinj_counting_unit_description();
65
  $ad_if_longer_settings = array('d','a',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
127
 
128
  <tr><td colspan="4"><h3>Bottom ad</h3></td></tr>
129
 
130
+ <tr><td><b>Enabled/disabled</b> (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>';
394
  <?php
395
  $prefixes = array("", "home_", "archive_");
396
  $unit = adinj_counting_unit_description();
397
+ $ad_limit_settings = array('d',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
398
 
399
  foreach ($prefixes as $prefix){
400
  echo '<td>';
402
  echo '</td>';
403
  } ?>
404
  </tr>
405
+ <tr><td>Only 1 ad if content shorter than:</td>
406
  <?php
407
  foreach ($prefixes as $prefix){
408
  echo '<td>';
410
  echo '</td>';
411
  } ?>
412
  </tr>
413
+ <tr><td>Only 2 ads if content shorter than:</td>
414
  <?php
415
  foreach ($prefixes as $prefix){
416
  echo '<td>';
419
  }
420
  ?>
421
  </tr>
422
+ <tr><td>Only 3 ads if content shorter than:</td>
423
  <?php
424
  foreach ($prefixes as $prefix){
425
  echo '<td>';