Ad Injection - Version 1.2.0.17

Version Description

  • A few cleanups to make it clear that direct ad insertion mode is the recommended mode. mfunc mode is left in for people who know what they are doing.
Download this release

Release Info

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

Code changes from version 1.2.0.16 to 1.2.0.17

Files changed (4) hide show
  1. ad-injection-admin.php +18 -18
  2. ad-injection.php +1 -1
  3. readme.txt +32 -23
  4. ui-tab-main.php +8 -4
ad-injection-admin.php CHANGED
@@ -261,8 +261,8 @@ function adinj_options_page(){
261
  switch( $_GET[ 'tab' ] ) {
262
  case "adrotation":
263
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
264
- adinj_side_donate_box();
265
  adinj_side_info_box();
 
266
  echo '</div>';
267
  echo '<form name="adinjform" method="post" action="">';
268
  wp_nonce_field('_adinj_form');
@@ -270,8 +270,8 @@ function adinj_options_page(){
270
  break;
271
  case "debug":
272
  require_once(ADINJ_PATH . '/ui-tab-debug.php');
273
- adinj_side_donate_box();
274
  adinj_side_info_box();
 
275
  echo '</div>';
276
  echo '<form name="adinjform" method="post" action="">';
277
  wp_nonce_field('_adinj_form');
@@ -282,8 +282,8 @@ function adinj_options_page(){
282
  require_once(ADINJ_PATH . '/ui-tab-main.php');
283
  adinj_side_advert_box();
284
  adinj_side_status_box();
285
- adinj_side_donate_box();
286
  adinj_side_info_box();
 
287
  echo '</div>';
288
  echo '<form name="adinjform" method="post" action="">';
289
  wp_nonce_field('_adinj_form');
@@ -342,9 +342,9 @@ function adinj_top_message_box(){
342
  echo '</p></div>';
343
 
344
  } else if (!isset($_GET['tab'])){
345
- echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
346
- echo "11th August 2012: Add table exclusion option. Remove old advert - the space is now available. Please contact me ASAP if you spot any bugs, or odd behaviour via the <a href='http://wordpress.org/tags/ad-injection?forum_id=10'target='_new'>Ad Injection WordPress forum</a> or my ".'<a href="'.adinj_feedback_url().'" target="_new">quick feedback form</a>. If you like the plugin please consider making a donation using the PayPal box below :)'."<br/>And finally I've just released an app to help you try Facebook Likes, Twitter Tweets and Google +1s on your website. It is called <a href='http://www.reviewmylife.co.uk/blog/2012/07/14/web-social-stats-for-seo/' target='_new'>Web Social Stats for SEO</a>.";
347
- echo '</strong></p></div>';
348
  }
349
  }
350
 
@@ -356,7 +356,7 @@ function adinj_side_donate_box(){
356
  <div class="postbox">
357
  <h3 class="hndle"><span><?php echo adinj_get_logo(); ?> Donate $10, $20 or $50!</span></h3>
358
  <div class="inside" style="margin:5px;">
359
- I have spent many hundreds of hours creating this plugin. If it helps you to make money please consider making a donation. Thank you!
360
 
361
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
362
  <input type="hidden" name="cmd" value="_donations">
@@ -412,8 +412,8 @@ function adinj_side_info_box(){
412
  <h4><font color="red">Important!</font></h4>
413
  <p>You are responsible for making sure the ad settings and positioning you define are in compliance with your ad provider's terms of service! Failure to do so could get you banned by them!</p>
414
 
415
- <h4><font color="red">Still in development</font></h4>
416
- <p>I'm actively listening to your feedback and fixing problems, and will be adding new features later in 2012. Please let me know if you like the plugin too!</p>
417
 
418
  <h4>More by this author</h4>
419
  <ul>
@@ -1088,7 +1088,7 @@ function adinj_testads(){
1088
  <div style="background-color:#ff9999; width:728px; height:90px;">
1089
  <h5>AD INJECTION TEST ADVERT 728x90</h5>
1090
  <?php adinj_get_test_ad_link($rnd); ?><br />
1091
- <a href="http://www.advancedhtml.co.uk/">www.advancedhtml.co.uk</a>
1092
  </div><p></p>
1093
 
1094
  <h4>160x90 link unit</h4>
@@ -1096,13 +1096,13 @@ function adinj_testads(){
1096
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ccff99; width:160px; height:90px;&quot;&gt;
1097
  &lt;h5&gt;TEST ADVERT 160x90&lt;/h5&gt;
1098
  <?php adinj_get_test_ad_link_escaped($rnd); ?>&lt;br /&gt;
1099
- &lt;a href=&quot;http://www.advancedhtml.co.uk/&quot;&gt;advancedhtml.co.uk&lt;/a&gt;
1100
  &lt;/div&gt;</textarea></p>
1101
 
1102
  <div style="background-color:#ccff99; width:160px; height:90px;">
1103
  <h5>TEST ADVERT 160x90</h5>
1104
  <?php adinj_get_test_ad_link($rnd); ?><br />
1105
- <a href="http://www.advancedhtml.co.uk/">advancedhtml.co.uk</a><br />
1106
  </div><p></p>
1107
 
1108
  <h4><a name="468x15"></a>468x15 link unit</h4>
@@ -1127,18 +1127,18 @@ function adinj_testads(){
1127
 
1128
  <h4>468x60 banner with dynamic PHP</h4>
1129
 
1130
- <p>The PHP will execute if you use a mfunc compatible caching plugin which is correctly configured, or if you don't use any caching plugin at all.</p>
1131
 
1132
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="5">&lt;div style=&quot;background-color:#ffff99; width:468px; height:60px;&quot;&gt;
1133
  &lt;b&gt;TEST ADVERT 468x60 with date() and rand()&lt;/b&gt;&lt;br /&gt;
1134
  &lt;?php echo &quot;date=&quot;.date(&quot;Y-m-d H:i:s&quot;) .&quot; rand=&quot;.rand(); ?&gt;&lt;br /&gt;
1135
- &lt;a href=&quot;http://www.advancedhtml.co.uk/&quot;&gt;www.advancedhtml.co.uk&lt;/a&gt;
1136
  &lt;/div&gt;</textarea></p>
1137
 
1138
  <div style="background-color:#ffff99; width:468px; height:60px;">
1139
  <b>TEST ADVERT 468x60 with date() and rand()</b><br />
1140
  <?php echo "date=".date("Y-m-d H:i:s") ." rand=".rand(); ?><br />
1141
- <a href="http://www.advancedhtml.co.uk/">www.advancedhtml.co.uk</a>
1142
  </div><p></p>
1143
 
1144
 
@@ -1148,7 +1148,7 @@ function adinj_testads(){
1148
 
1149
  <b>Simple examples for loading top, random, bottom or footer ads</b><br />
1150
 
1151
- <p>If you are using mfunc mode (for caching plugins) you may need to include the ad framework loading code snippet below. You would have to include this snippet above the ad display code.</p>
1152
 
1153
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="1">
1154
  &lt;?php if (function_exists('adinj_print_ad')){ adinj_print_ad('top'); } ?&gt;</textarea></p>
@@ -1160,7 +1160,7 @@ function adinj_testads(){
1160
 
1161
  <p>Or you can load ads stored as text files in the ad-injection-data directory (<?php echo ADINJ_AD_PATH; ?>/)</p>
1162
 
1163
- <b>Ad framework loading code for mfunc mode with caching plugins + 1 random ad</b><br />
1164
 
1165
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="110" rows="5">&lt;!--mfunc include_once('<?php echo ADINJ_PATH; ?>/adshow.php') --&gt;
1166
  &lt;?php include_once('<?php echo ADINJ_PATH; ?>/adshow.php'); ?&gt;
@@ -1568,7 +1568,7 @@ function adinj_default_options(){
1568
  'ad_code_footer_alt_1_split' => '100',
1569
  'ad_code_footer_alt_2_split' => '100',
1570
  // dynamic features
1571
- 'ad_insertion_mode' => 'mfunc',
1572
  'sevisitors_only' => 'off',
1573
  'ad_referrers' => '.google., .bing., .yahoo., .ask., search?, search.',
1574
  'block_keywords' => 'off',
261
  switch( $_GET[ 'tab' ] ) {
262
  case "adrotation":
263
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
 
264
  adinj_side_info_box();
265
+ adinj_side_donate_box();
266
  echo '</div>';
267
  echo '<form name="adinjform" method="post" action="">';
268
  wp_nonce_field('_adinj_form');
270
  break;
271
  case "debug":
272
  require_once(ADINJ_PATH . '/ui-tab-debug.php');
 
273
  adinj_side_info_box();
274
+ adinj_side_donate_box();
275
  echo '</div>';
276
  echo '<form name="adinjform" method="post" action="">';
277
  wp_nonce_field('_adinj_form');
282
  require_once(ADINJ_PATH . '/ui-tab-main.php');
283
  adinj_side_advert_box();
284
  adinj_side_status_box();
 
285
  adinj_side_info_box();
286
+ adinj_side_donate_box();
287
  echo '</div>';
288
  echo '<form name="adinjform" method="post" action="">';
289
  wp_nonce_field('_adinj_form');
342
  echo '</p></div>';
343
 
344
  } else if (!isset($_GET['tab'])){
345
+ //echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
346
+ //echo "19th November 2014: Minor updates to make it clear that 'direct' insertion mode is recommended.";
347
+ //echo '</strong></p></div>';
348
  }
349
  }
350
 
356
  <div class="postbox">
357
  <h3 class="hndle"><span><?php echo adinj_get_logo(); ?> Donate $10, $20 or $50!</span></h3>
358
  <div class="inside" style="margin:5px;">
359
+ I have spent many hundreds of hours creating this plugin. If you would like to leave a donation you can use Paypal. Thank you!
360
 
361
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
362
  <input type="hidden" name="cmd" value="_donations">
412
  <h4><font color="red">Important!</font></h4>
413
  <p>You are responsible for making sure the ad settings and positioning you define are in compliance with your ad provider's terms of service! Failure to do so could get you banned by them!</p>
414
 
415
+ <h4><font color="red">Plugin status: parked</font></h4>
416
+ <p>I'm not expecting to make regular changes to this plugin, so it is released on an as-is basis. You are welcome to send me feedback but it is not likely that I'll have time to act on it. If this plugin works for you then do use it, if not then try a different plugin.</p>
417
 
418
  <h4>More by this author</h4>
419
  <ul>
1088
  <div style="background-color:#ff9999; width:728px; height:90px;">
1089
  <h5>AD INJECTION TEST ADVERT 728x90</h5>
1090
  <?php adinj_get_test_ad_link($rnd); ?><br />
1091
+ <a href="http://www.reviewmylife.co.uk/">www.reviewmylife.co.uk</a>
1092
  </div><p></p>
1093
 
1094
  <h4>160x90 link unit</h4>
1096
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ccff99; width:160px; height:90px;&quot;&gt;
1097
  &lt;h5&gt;TEST ADVERT 160x90&lt;/h5&gt;
1098
  <?php adinj_get_test_ad_link_escaped($rnd); ?>&lt;br /&gt;
1099
+ &lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;reviewmylife.co.uk&lt;/a&gt;
1100
  &lt;/div&gt;</textarea></p>
1101
 
1102
  <div style="background-color:#ccff99; width:160px; height:90px;">
1103
  <h5>TEST ADVERT 160x90</h5>
1104
  <?php adinj_get_test_ad_link($rnd); ?><br />
1105
+ <a href="http://www.reviewmylife.co.uk/">reviewmylife.co.uk</a><br />
1106
  </div><p></p>
1107
 
1108
  <h4><a name="468x15"></a>468x15 link unit</h4>
1127
 
1128
  <h4>468x60 banner with dynamic PHP</h4>
1129
 
1130
+ <p>The PHP will execute if you use as long as you don't use an caching plugin.</p>
1131
 
1132
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="5">&lt;div style=&quot;background-color:#ffff99; width:468px; height:60px;&quot;&gt;
1133
  &lt;b&gt;TEST ADVERT 468x60 with date() and rand()&lt;/b&gt;&lt;br /&gt;
1134
  &lt;?php echo &quot;date=&quot;.date(&quot;Y-m-d H:i:s&quot;) .&quot; rand=&quot;.rand(); ?&gt;&lt;br /&gt;
1135
+ &lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;www.reviewmylife.co.uk&lt;/a&gt;
1136
  &lt;/div&gt;</textarea></p>
1137
 
1138
  <div style="background-color:#ffff99; width:468px; height:60px;">
1139
  <b>TEST ADVERT 468x60 with date() and rand()</b><br />
1140
  <?php echo "date=".date("Y-m-d H:i:s") ." rand=".rand(); ?><br />
1141
+ <a href="http://www.reviewmylife.co.uk/">www.reviewmylife.co.uk</a>
1142
  </div><p></p>
1143
 
1144
 
1148
 
1149
  <b>Simple examples for loading top, random, bottom or footer ads</b><br />
1150
 
1151
+ <p>If you are using mfunc mode (for selected caching plugins) you may need to include the ad framework loading code snippet below. You would have to include this snippet above the ad display code.</p>
1152
 
1153
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="1">
1154
  &lt;?php if (function_exists('adinj_print_ad')){ adinj_print_ad('top'); } ?&gt;</textarea></p>
1160
 
1161
  <p>Or you can load ads stored as text files in the ad-injection-data directory (<?php echo ADINJ_AD_PATH; ?>/)</p>
1162
 
1163
+ <b>Ad framework loading code for mfunc mode with caching plugins + 1 random ad <font color="red">(mfunc mode not recommended unless you really know what it is for!</font></b><br />
1164
 
1165
  <p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="110" rows="5">&lt;!--mfunc include_once('<?php echo ADINJ_PATH; ?>/adshow.php') --&gt;
1166
  &lt;?php include_once('<?php echo ADINJ_PATH; ?>/adshow.php'); ?&gt;
1568
  'ad_code_footer_alt_1_split' => '100',
1569
  'ad_code_footer_alt_2_split' => '100',
1570
  // dynamic features
1571
+ 'ad_insertion_mode' => 'direct',
1572
  'sevisitors_only' => 'off',
1573
  'ad_referrers' => '.google., .bing., .yahoo., .ask., search?, search.',
1574
  'block_keywords' => 'off',
ad-injection.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
- Version: 1.2.0.16
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
3
  Plugin Name: Ad Injection
4
  Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
5
  Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
6
+ Version: 1.2.0.17
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
readme.txt CHANGED
@@ -3,14 +3,14 @@ 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.4.1
7
- Stable tag: 1.2.0.16
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 or other content (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 1.2.x.x**
16
 
@@ -135,10 +135,6 @@ If there are any panels on the admin screen that you don't need, you can click o
135
 
136
  For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
137
 
138
- = Actively being developed =
139
-
140
- 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.
141
-
142
  == Installation ==
143
 
144
  This section describes how to install the plugin and get it working.
@@ -146,18 +142,9 @@ This section describes how to install the plugin and get it working.
146
  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
147
  2. Activate the plugin through the 'Plugins' menu in WordPress.
148
  3. Configure your ads. Carefully go through all the sections to setup your ad placements.
149
- 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.
150
- 5. Tick the box right at the top to enable your ads.
151
- 6. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
152
- 7. If something doesn't work as expected turn on debug mode and look for the debug messages in the HTML source.
153
-
154
- **Recommended cache plugin settings**
155
-
156
- * WP Super Cache - 0.9.9.8+ using mod_rewrite mode.
157
- * W3 Total Cache - Page Cache: 'Disk (basic)' mode.
158
- * WP Cache - Just turn the caching on.
159
-
160
- 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).
161
 
162
  = How to uninstall =
163
 
@@ -189,7 +176,6 @@ One a basic level it can do the same job as Dax's Adsense Injection. If you want
189
  * Vary number of adverts based on post length.
190
  * You can inject raw JavaScript and PHP.
191
  * Include ads anywhere in the theme template if you edit your theme's PHP.
192
- * The dynamic features (ad rotation, restricting ads by referrer and IP) work with WP Super Cache, W3 Total Cache and WP Cache.
193
  * Define alternate content for users who are dynamically restricted from seeing ads.
194
  * Compatible with the <!--noadsense--> <!--adsensestart--> in-page tags from Adsense Injection to make migration easy.
195
  * Compatible with in-page tags from Whydowork Adsense and Quick Adsense.
@@ -229,14 +215,28 @@ Using a second browser in 'privacy mode' is also a good way of testing your site
229
 
230
  = Do I need to have WP Super Cache (or anther caching plugin) installed? =
231
 
232
- 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 (probably) run a lot faster than with no caching plugin. Usually caching plugin prevent dynamic plugin features from working - but I've spent a lot of time creating a framework to allow this plugin's dynamic features to work with some of the most common caching plugins. Just make sure you choose the mfunc dynamic insertion mode from the Ad Injection settings screen.
 
 
 
 
 
 
 
 
 
 
233
 
234
  = Will the dynamic features work with other caching plugins? =
235
 
 
 
236
  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.
237
 
238
  = Which caching plugin is best? =
239
 
 
 
240
  Both WP Super Cache and W3 Total Cache are likely to be faster than WP Cache.
241
 
242
  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.
@@ -492,6 +492,8 @@ If you are using a 3rd party ad provider (e.g. AdSense) then statistics such as
492
 
493
  Problem: No ads appear when using mfunc mode.
494
 
 
 
495
  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.
496
 
497
  **FeedWordPress**
@@ -536,7 +538,7 @@ The multi-user version of WordPress are not supported - yet, however I have hear
536
  * Uninstall support is provided to delete this option if you uninstall the plugin.
537
  * Admin code is separated into a separate file so it is not loaded when your visitors view your pages.
538
  * 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.
539
- * 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.
540
  * The JavaScript for setting the referrer cookie is inserted using wp_enqueue_scripts.
541
  * 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!
542
 
@@ -577,6 +579,8 @@ Ad Injection does not currently have support for inserting adverts into snippets
577
 
578
  = If you are using a caching plugin =
579
 
 
 
580
  1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
581
  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).
582
  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.
@@ -592,6 +596,8 @@ You are probably running out of memory. View the HTML source of the settings pag
592
 
593
  = If you are getting errors when using mfunc mode check the following =
594
 
 
 
595
  1. Are there ad data directories in the plugin directory? The path will be:
596
 
597
  '/wp-content/plugins/ad-injection-data/.
@@ -624,6 +630,9 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
624
 
625
  == Changelog ==
626
 
 
 
 
627
  = 1.2.0.16 =
628
  * New options to exclude ads from table tags.
629
 
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: 4.0.1
7
+ Stable tag: 1.2.0.17
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.
10
 
11
  == Description ==
12
 
13
+ Ad Injection from [reviewmylife](http://www.reviewmylife.co.uk/ "reviewmylife") injects any kind of advert or other content (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 support for dynamic restrictions (by IP address and referrer). Note that this is an advanced plugin with loads of options. If you want a really simple plugin this might not be the one for you!
14
 
15
  **New Features 1.2.x.x**
16
 
135
 
136
  For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/ "reviewmylife blog").
137
 
 
 
 
 
138
  == Installation ==
139
 
140
  This section describes how to install the plugin and get it working.
142
  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
143
  2. Activate the plugin through the 'Plugins' menu in WordPress.
144
  3. Configure your ads. Carefully go through all the sections to setup your ad placements.
145
+ 4. Tick the box right at the top to enable your ads.
146
+ 5. If you are using a caching plugin you may need to clear the cache to see your ads immediately.
147
+ 6. If something doesn't work as expected turn on debug mode and look for the debug messages in the HTML source.
 
 
 
 
 
 
 
 
 
148
 
149
  = How to uninstall =
150
 
176
  * Vary number of adverts based on post length.
177
  * You can inject raw JavaScript and PHP.
178
  * Include ads anywhere in the theme template if you edit your theme's PHP.
 
179
  * Define alternate content for users who are dynamically restricted from seeing ads.
180
  * Compatible with the <!--noadsense--> <!--adsensestart--> in-page tags from Adsense Injection to make migration easy.
181
  * Compatible with in-page tags from Whydowork Adsense and Quick Adsense.
215
 
216
  = Do I need to have WP Super Cache (or anther caching plugin) installed? =
217
 
218
+ Note: mfunc mode is now deprecated - only use if you really understand what it does!
219
+
220
+ No! All the features of this plugin will work with no caching plugin installed.
221
+
222
+ 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 (probably) run a lot faster than with no caching plugin. Usually caching plugin prevent dynamic plugin features from working - but I've spent a lot of time creating a framework to allow this plugin's dynamic features to work with some of the most common caching plugins. Just make sure you choose the mfunc dynamic insertion mode from the Ad Injection settings screen.
223
+
224
+ * WP Super Cache - 0.9.9.8+ using mod_rewrite mode. Note that mfunc tags were removed from later versions of WP Super Cache so I no longer recommend using Ad Injection's mfunc mode.
225
+ * W3 Total Cache - Page Cache: 'Disk (basic)' mode.
226
+ * WP Cache - Just turn the caching on.
227
+
228
+ 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).
229
 
230
  = Will the dynamic features work with other caching plugins? =
231
 
232
+ Note: mfunc mode is now deprecated - only use if you really understand what it does!
233
+
234
  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.
235
 
236
  = Which caching plugin is best? =
237
 
238
+ Note: mfunc mode is now deprecated - only use if you really understand what it does!
239
+
240
  Both WP Super Cache and W3 Total Cache are likely to be faster than WP Cache.
241
 
242
  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.
492
 
493
  Problem: No ads appear when using mfunc mode.
494
 
495
+ Note: mfunc mode is now deprecated - only use if you really understand what it does!
496
+
497
  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.
498
 
499
  **FeedWordPress**
538
  * Uninstall support is provided to delete this option if you uninstall the plugin.
539
  * Admin code is separated into a separate file so it is not loaded when your visitors view your pages.
540
  * 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.
541
+ * When mfunc mode (deprecated) is used the ads are saved as text files into the plugin folder. The plugin will therefore need write access to the plugins folder.
542
  * The JavaScript for setting the referrer cookie is inserted using wp_enqueue_scripts.
543
  * 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!
544
 
579
 
580
  = If you are using a caching plugin =
581
 
582
+ Note that mfunc mode is now deprecated and so you use it at your own risk. I recommend using direct insertion mode. This does mean that if you use a caching plugin the dynamic features won't work.
583
+
584
  1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
585
  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).
586
  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.
596
 
597
  = If you are getting errors when using mfunc mode check the following =
598
 
599
+ Note: mfunc mode is now deprecated - only use if you really understand what it does!
600
+
601
  1. Are there ad data directories in the plugin directory? The path will be:
602
 
603
  '/wp-content/plugins/ad-injection-data/.
630
 
631
  == Changelog ==
632
 
633
+ = 1.2.0.17 =
634
+ * A few cleanups to make it clear that direct ad insertion mode is the recommended mode. mfunc mode is left in for people who know what they are doing.
635
+
636
  = 1.2.0.16 =
637
  * New options to exclude ads from table tags.
638
 
ui-tab-main.php CHANGED
@@ -616,7 +616,9 @@ function adinj_insertion_mode_box($ops){
616
  adinj_postbox_start(__("Ad insertion mode and dynamic ad display restrictions", 'adinj'), 'restrictions'); ?>
617
  <h4>Ad insertion mode</h4>
618
  <blockquote>
619
- <input type="radio" name="ad_insertion_mode" value="mfunc" <?php if (adinj_mfunc_mode()) echo 'checked="checked"'; ?> /> <b>mfunc: Insert ads using cache compatible mfunc tags</b> - Dynamic features will work with WP Super Cache, W3 Total Cache and WP Cache. Only select this mode if you are using one of those caching plugins and want to use dynamic features (IP / referrer restriction, alt content and ad roatation). If you aren't using dynamic features select direct mode.
 
 
620
 
621
  <?php if (!adinj_mfunc_mode()) { ?>
622
  <script type="text/javascript">
@@ -626,6 +628,7 @@ function adinj_insertion_mode_box($ops){
626
  <br />
627
 
628
  <div id="caching_plugin_msg" class="caching_plugin_msg">
 
629
  <?php if (!is_supported_caching_plugin_active()) {
630
  echo '<p><b><span style="font-size:10px;color:red;">Note: A supported caching plugin does not appear to be active. If you are not using WP Super Cache / W3 Total Cache / WP Cache you should use one of the direct insertion modes below.</span></b></p>';
631
  } ?>
@@ -643,7 +646,7 @@ function adinj_insertion_mode_box($ops){
643
 
644
  <br />
645
 
646
- <input type="radio" name="ad_insertion_mode" value="direct" <?php if (adinj_direct_mode()) echo 'checked="checked"'; ?> /> <b>direct: Direct ad code insertion</b> - Select this if you are not using an mfunc compatible caching plugin OR if you are not using the dynamic features.<br />
647
  </blockquote>
648
 
649
  <p></p>
@@ -838,7 +841,7 @@ function adinj_unknown_cache_msg(){
838
  function adinj_side_advert_box(){
839
  $ops = adinj_options();
840
  ?>
841
- <div class="postbox-container" style="width:258px;">
842
  <div class="metabox-holder">
843
  <div class="meta-box-sortables" style="min-height:50px;">
844
  <div class="postbox">
@@ -846,7 +849,7 @@ function adinj_side_advert_box(){
846
  <div class="inside" style="margin:5px;">
847
 
848
  <?php
849
- echo adinj_get_advert_1();
850
  ?>
851
 
852
  </div>
@@ -854,6 +857,7 @@ function adinj_side_advert_box(){
854
  </div>
855
  </div>
856
  </div>
 
857
  <?php
858
  }
859
 
616
  adinj_postbox_start(__("Ad insertion mode and dynamic ad display restrictions", 'adinj'), 'restrictions'); ?>
617
  <h4>Ad insertion mode</h4>
618
  <blockquote>
619
+ <input type="radio" name="ad_insertion_mode" value="direct" <?php if (adinj_direct_mode()) echo 'checked="checked"'; ?> /> <b>direct: Direct ad code insertion <font color="green">(recommended)</font></b> - Adds are directly inserted into the page. Note that dynamic features (the ones in this section) will not work if you are using a caching plugin as dynamic features require that the page is dynamically generated each time a user views it.<br />
620
+
621
+ <input type="radio" name="ad_insertion_mode" value="mfunc" <?php if (adinj_mfunc_mode()) echo 'checked="checked"'; ?> /> <b>mfunc: Insert ads using cache compatible mfunc tags <font color="red">(not recommended)</font></b> - unless you are 100% certain you understand mfunc mode and know what you are doing!<br />
622
 
623
  <?php if (!adinj_mfunc_mode()) { ?>
624
  <script type="text/javascript">
628
  <br />
629
 
630
  <div id="caching_plugin_msg" class="caching_plugin_msg">
631
+ Dynamic features may work with older versions of WP Super Cache, W3 Total Cache and WP Cache. Only select this mode if you are using an older version of one of those caching plugins that you know supports mfunc and want to use dynamic features (IP / referrer restriction, alt content and ad roatation). If you aren't using dynamic features or don't understand what mfunc is then select direct mode. This mode is left in for people who know exactly what mfunc mode is and understand the risks of using it. If you have to ask then use direct mode.
632
  <?php if (!is_supported_caching_plugin_active()) {
633
  echo '<p><b><span style="font-size:10px;color:red;">Note: A supported caching plugin does not appear to be active. If you are not using WP Super Cache / W3 Total Cache / WP Cache you should use one of the direct insertion modes below.</span></b></p>';
634
  } ?>
646
 
647
  <br />
648
 
649
+
650
  </blockquote>
651
 
652
  <p></p>
841
  function adinj_side_advert_box(){
842
  $ops = adinj_options();
843
  ?>
844
+ <!--<div class="postbox-container" style="width:258px;">
845
  <div class="metabox-holder">
846
  <div class="meta-box-sortables" style="min-height:50px;">
847
  <div class="postbox">
849
  <div class="inside" style="margin:5px;">
850
 
851
  <?php
852
+ //echo adinj_get_advert_1();
853
  ?>
854
 
855
  </div>
857
  </div>
858
  </div>
859
  </div>
860
+ //-->
861
  <?php
862
  }
863