Ad Injection - Version 1.2.0.18

Version Description

  • Fix some undeclared variable warnings.
Download this release

Release Info

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

Code changes from version 1.2.0.17 to 1.2.0.18

Files changed (5) hide show
  1. ad-injection-admin.php +4 -4
  2. ad-injection.php +13 -4
  3. adshow.php +6 -3
  4. readme.txt +5 -2
  5. ui-tab-main.php +5 -32
ad-injection-admin.php CHANGED
@@ -258,7 +258,9 @@ function adinj_options_page(){
258
 
259
  echo '<div style="width:258px; float:right;">';
260
 
261
- switch( $_GET[ 'tab' ] ) {
 
 
262
  case "adrotation":
263
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
264
  adinj_side_info_box();
@@ -280,7 +282,6 @@ function adinj_options_page(){
280
  case "main":
281
  default:
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();
@@ -413,7 +414,7 @@ function adinj_side_info_box(){
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>
@@ -1049,7 +1050,6 @@ function is_supported_caching_plugin_active(){
1049
  function adinj_get_test_ad_link_escaped($rnd){
1050
  echo htmlspecialchars(adinj_get_test_ad_link($rnd));
1051
  }
1052
- //? >&lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;www.reviewmylife.co.uk&lt;/a&gt;< ?php
1053
 
1054
  function adinj_get_test_ad_link($rnd){
1055
  if ($rnd == 0){
258
 
259
  echo '<div style="width:258px; float:right;">';
260
 
261
+ $tab = isset($_GET[ 'tab' ]) ? $_GET[ 'tab' ] : "";
262
+
263
+ switch( $tab ) {
264
  case "adrotation":
265
  require_once(ADINJ_PATH . '/ui-tab-adrotation.php');
266
  adinj_side_info_box();
282
  case "main":
283
  default:
284
  require_once(ADINJ_PATH . '/ui-tab-main.php');
 
285
  adinj_side_status_box();
286
  adinj_side_info_box();
287
  adinj_side_donate_box();
414
  <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>
415
 
416
  <h4><font color="red">Plugin status: parked</font></h4>
417
+ <p>I'm not expecting to make major changes to this plugin, so it is released on an as-is basis. You are welcome to send me feedback and that feedback may be used in the future. If this plugin works for you then do use it :) If not then perhaps try a different plugin.</p>
418
 
419
  <h4>More by this author</h4>
420
  <ul>
1050
  function adinj_get_test_ad_link_escaped($rnd){
1051
  echo htmlspecialchars(adinj_get_test_ad_link($rnd));
1052
  }
 
1053
 
1054
  function adinj_get_test_ad_link($rnd){
1055
  if ($rnd == 0){
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.17
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
@@ -282,8 +282,8 @@ function adinj_formatting_options($adtype, $ops, $output_type="string"){
282
  if ($adtype == 'footer') $prefix = 'footer_';
283
  //widgets have no prefix
284
 
285
- $align = $ops[$prefix.'align'];
286
- $clear = $ops[$prefix.'clear'];
287
  $margin_top = $ops[$prefix.'margin_top'];
288
  $margin_bottom = $ops[$prefix.'margin_bottom'];
289
  $padding_top = $ops[$prefix.'padding_top'];
@@ -403,6 +403,13 @@ function adinj($content, $message){
403
  $currentday = $currentdate / 24 / 60 / 60;
404
  $postday = $postdate / 24 / 60 / 60;
405
  }
 
 
 
 
 
 
 
406
  return $content."
407
  <!--
408
  ADINJ DEBUG
@@ -592,7 +599,8 @@ function adinj_allowed_in_author($scope, $ops){
592
  }
593
 
594
  function adinj_allowed_in_id($scope, $ops){
595
- $conditions = adinj_split_comma_list($ops[$scope.'_id_condition_entries']);
 
596
  if (empty($conditions)) return true;
597
 
598
  $postid = -1;
@@ -1244,6 +1252,7 @@ function adinj_num_rand_ads_to_insert($content_length, &$debug){
1244
 
1245
  function adinj_num_footer_ads_to_insert(){
1246
  if (adinj_excluded_by_tick_box('footer_')) return 0;
 
1247
  $reason = adinj_ads_completely_disabled_from_page('footer', $content);
1248
  if ($reason !== false){
1249
  return 0;
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.18
7
  Author: reviewmylife
8
  Author URI: http://www.reviewmylife.co.uk/
9
  License: GPLv2
282
  if ($adtype == 'footer') $prefix = 'footer_';
283
  //widgets have no prefix
284
 
285
+ $align = isset($ops[$prefix.'align']) ? $ops[$prefix.'align'] : "";
286
+ $clear = isset($ops[$prefix.'clear']) ? $ops[$prefix.'clear'] : "";
287
  $margin_top = $ops[$prefix.'margin_top'];
288
  $margin_bottom = $ops[$prefix.'margin_bottom'];
289
  $padding_top = $ops[$prefix.'padding_top'];
403
  $currentday = $currentdate / 24 / 60 / 60;
404
  $postday = $postdate / 24 / 60 / 60;
405
  }
406
+ else
407
+ {
408
+ $currentdate = "";
409
+ $postdate = "";
410
+ $currentday = "";
411
+ $postday = "";
412
+ }
413
  return $content."
414
  <!--
415
  ADINJ DEBUG
599
  }
600
 
601
  function adinj_allowed_in_id($scope, $ops){
602
+ $condition_entries = isset($ops[$scope.'_id_condition_entries']) ? $ops[$scope.'_id_condition_entries'] : "";
603
+ $conditions = adinj_split_comma_list($condition_entries);
604
  if (empty($conditions)) return true;
605
 
606
  $postid = -1;
1252
 
1253
  function adinj_num_footer_ads_to_insert(){
1254
  if (adinj_excluded_by_tick_box('footer_')) return 0;
1255
+ if (!isset($content)) $content = "";
1256
  $reason = adinj_ads_completely_disabled_from_page('footer', $content);
1257
  if ($reason !== false){
1258
  return 0;
adshow.php CHANGED
@@ -239,19 +239,22 @@ function adshow_show_adverts(){
239
  //echo 'ref:'.$_SERVER['HTTP_REFERER'];
240
  //if (adinj_config_block_after_ad_click() && adshow_clicked_ad()) return "click_blocked"; //TODO
241
 
242
- if ($_COOKIE["adlogblocked"]==1) {
 
243
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: no ads because adlogblocked cookie set-->\n"; }
244
  return "click_blocked";
245
  }
246
 
247
  if (adinj_config_block_ips() && adshow_blocked_ip()) return "blocked_ip";
248
 
249
- if ($_COOKIE["adinj"]==1) {
 
250
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: blocked check ignored because adinj cookie set-->\n"; }
251
  return true;
252
  }
253
 
254
- if ($_COOKIE["adinjblocked"]==1) {
 
255
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: no ads because adinjblocked cookie set-->\n"; }
256
  return "blocked_referrer";
257
  }
239
  //echo 'ref:'.$_SERVER['HTTP_REFERER'];
240
  //if (adinj_config_block_after_ad_click() && adshow_clicked_ad()) return "click_blocked"; //TODO
241
 
242
+ $adlogblocked_cookie = isset($_COOKIE["adlogblocked"]) ? $_COOKIE["adlogblocked"] : 0;
243
+ if ($adlogblocked_cookie==1) {
244
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: no ads because adlogblocked cookie set-->\n"; }
245
  return "click_blocked";
246
  }
247
 
248
  if (adinj_config_block_ips() && adshow_blocked_ip()) return "blocked_ip";
249
 
250
+ $adinj_cookie = isset($_COOKIE["adinj"]) ? $_COOKIE["adinj"] : 0;
251
+ if ($adinj_cookie==1) {
252
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: blocked check ignored because adinj cookie set-->\n"; }
253
  return true;
254
  }
255
 
256
+ $adinjblocked_cookie = isset($_COOKIE["adinjblocked"]) ? $_COOKIE["adinjblocked"] : 0;
257
+ if ($adinjblocked_cookie==1) {
258
  if (adinj_config_debug_mode()){ echo "<!--ADINJ DEBUG: no ads because adinjblocked cookie set-->\n"; }
259
  return "blocked_referrer";
260
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: reviewmylife
3
  Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
4
  Tags: ad injection, 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
 
@@ -630,6 +630,9 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
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
 
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.1
7
+ Stable tag: 1.2.0.18
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
 
630
 
631
  == Changelog ==
632
 
633
+ = 1.2.0.18 =
634
+ * Fix some undeclared variable warnings.
635
+
636
  = 1.2.0.17 =
637
  * 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.
638
 
ui-tab-main.php CHANGED
@@ -83,7 +83,7 @@ function adinj_placement_settings_box($ops){
83
  </td>
84
  <td>
85
  <?php
86
- adinj_selection_box("top_ad_position", array(0,1,2,3,4,5,100,200,300,400,500,750,1000,1500,2000,3000), " ");
87
  ?>
88
  </td></tr>
89
  </table>
@@ -197,7 +197,7 @@ JQUERYOPACITY;
197
  </td><td>
198
  <div class="random_ads_start_unit">
199
  <?php
200
- adinj_selection_box("random_ads_start_at", array(1,2,3,4,5,100,200,300,400,500,750,1000,1500,2000,3000,4000,5000,6000,7000,8000,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
201
  ?>
202
  </div>
203
  </td>
@@ -244,7 +244,7 @@ JQUERYOPACITY;
244
  </td><td>
245
  <div class="random_ads_end_unit">
246
  <?php
247
- adinj_selection_box("random_ads_end_at", array(1,2,3,4,5,100,200,300,400,500,750,1000,1500,2000,3000,4000,5000,6000,7000,8000,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
248
  ?>
249
  </div>
250
  </td>
@@ -355,7 +355,7 @@ JQUERYOPACITY;
355
  </td>
356
  <td>
357
  <?php
358
- adinj_selection_box("bottom_ad_position", array(0,1,2,3,4,5,100,200,300,400,500,750,1000,1500,2000,3000), " ");
359
  ?>
360
  </td>
361
  <td>
@@ -838,33 +838,6 @@ function adinj_unknown_cache_msg(){
838
  <?php
839
  }
840
 
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">
848
- <h3 class="hndle"><span><?php echo adinj_get_logo(); ?> Sponsors</span></h3>
849
- <div class="inside" style="margin:5px;">
850
-
851
- <?php
852
- //echo adinj_get_advert_1();
853
- ?>
854
-
855
- </div>
856
- </div>
857
- </div>
858
- </div>
859
- </div>
860
- //-->
861
- <?php
862
- }
863
-
864
- function adinj_get_advert_1(){
865
- return 'If you are interested in advertising here (a 220x220px would work) get <a href="http://www.reviewmylife.co.uk/contact-us/" target="_blank">in contact</a>.<!--<a href="http://www.reviewmylife.co.uk/contact-us/" target="_blank"><img src="'. WP_PLUGIN_URL . '/ad-injection/advert-1_placeholder.png" width="220" height="220" border="0" alt="Ad Injection advert" /></a>-->';
866
- }
867
-
868
  function adinj_side_status_box(){
869
  $ops = adinj_options();
870
  ?>
@@ -1032,7 +1005,7 @@ function adinj_docs(){
1032
 
1033
  <p>3. Make sure ads are enabled for the page types you want them to be enabled for. [<a href="#global">Goto global settings</a>]</p>
1034
 
1035
- <p>4. Check the ad insertion mode. You will probably want 'direct' mode unless you are 1) using a caching plugin AND 2) are using the dynamic features (dynamic restrictions or ad rotation). [<a href="#restrictions">Goto 'Ad insertion mode and dynamic ad display restriction'</a>]</p>
1036
 
1037
  <p>5. Enable your ads by selecting the 'on' option at the top. [<a href="#global">Goto global settings</a>]</p>
1038
 
83
  </td>
84
  <td>
85
  <?php
86
+ adinj_selection_box("top_ad_position", array(0,1,2,3,4,5,10,20,30,50,75,100,200,300,400,500,750,1000,1500,2000,3000), " ");
87
  ?>
88
  </td></tr>
89
  </table>
197
  </td><td>
198
  <div class="random_ads_start_unit">
199
  <?php
200
+ adinj_selection_box("random_ads_start_at", array(1,2,3,4,5,10,20,30,50,75,100,200,300,400,500,750,1000,1500,2000,3000,4000,5000,6000,7000,8000,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
201
  ?>
202
  </div>
203
  </td>
244
  </td><td>
245
  <div class="random_ads_end_unit">
246
  <?php
247
+ adinj_selection_box("random_ads_end_at", array(1,2,3,4,5,10,20,30,50,75,100,200,300,400,500,750,1000,1500,2000,3000,4000,5000,6000,7000,8000,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
248
  ?>
249
  </div>
250
  </td>
355
  </td>
356
  <td>
357
  <?php
358
+ adinj_selection_box("bottom_ad_position", array(0,1,2,3,4,5,10,20,30,50,75,100,200,300,400,500,750,1000,1500,2000,3000), " ");
359
  ?>
360
  </td>
361
  <td>
838
  <?php
839
  }
840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  function adinj_side_status_box(){
842
  $ops = adinj_options();
843
  ?>
1005
 
1006
  <p>3. Make sure ads are enabled for the page types you want them to be enabled for. [<a href="#global">Goto global settings</a>]</p>
1007
 
1008
+ <p>4. Check the ad insertion mode. You will probably want 'direct' mode unless you are 1) an advanced user who understands what mfunc is, 2) using a compatible caching plugin and 3) are using the dynamic features (dynamic restrictions or ad rotation). [<a href="#restrictions">Goto 'Ad insertion mode and dynamic ad display restriction'</a>]</p>
1009
 
1010
  <p>5. Enable your ads by selecting the 'on' option at the top. [<a href="#global">Goto global settings</a>]</p>
1011