Version Description
- Fix (hopefully) for the disappearing top/bottom adverts that affected some users. Special thanks to numaga.com for the debug access.
Download this release
Release Info
Developer | reviewmylife |
Plugin | Ad Injection |
Version | 0.9.7.3 |
Comparing to | |
See all releases |
Code changes from version 0.9.7.2 to 0.9.7.3
- ad-injection-admin.php +1 -1
- ad-injection.php +25 -44
- readme.txt +6 -3
ad-injection-admin.php
CHANGED
@@ -331,7 +331,7 @@ function adinj_top_message_box(){
|
|
331 |
|
332 |
} else {
|
333 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
334 |
-
echo "1st March 2011: <font color='red'>If you are one of the people whose top/bottom ads have dissapeared with the 0.9.7.x release I'm very sorry - I
|
335 |
echo '</strong></p></div>';
|
336 |
}
|
337 |
}
|
331 |
|
332 |
} else {
|
333 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
334 |
+
echo "1st March 2011: <font color='red'>If you are one of the people whose top/bottom ads have dissapeared with the 0.9.7.x release I'm very sorry - I hope this release will fix it. If it doesn't please email me a link via the <a href='".adinj_feedback_url()."' target='_new'>quick feedback form</a> to one of your affected pages.</font> There are a some other bugs I've found whilst fixing this, I'll hopefully get them fixed this week/next week.<br />Archives and home ads now fully supported - you can add top/random/bottom ads to them. Big UI updates to support this. And fixes for when/where widget ads appear. I'd recommend you re-check that your ads appear where you expect them to. 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>.';
|
335 |
echo '</strong></p></div>';
|
336 |
}
|
337 |
}
|
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.
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
@@ -132,7 +132,6 @@ function adinj_addsevjs_hook(){
|
|
132 |
}
|
133 |
|
134 |
function adinj_get_ad_code($adtype, $ads_db){
|
135 |
-
echo "\n<!--*adinj_get_ad_code:".$adtype."-->";
|
136 |
$ops = adinj_options();
|
137 |
$ads_live = NULL;
|
138 |
$ads_split = NULL;
|
@@ -140,14 +139,12 @@ function adinj_get_ad_code($adtype, $ads_db){
|
|
140 |
$alt_split = NULL;
|
141 |
$formatting = NULL;
|
142 |
if ($ops['ad_insertion_mode'] == 'mfunc'){
|
143 |
-
echo "<!--ga1-->";
|
144 |
adinj_live_ads_array($adtype, $ads_db, $ads_live, $ads_split, 'string');
|
145 |
if (adinj_db_version($ads_db) >= 2){
|
146 |
adinj_live_ads_array($adtype.'_alt', $ads_db, $alt_live, $alt_split, 'string');
|
147 |
}
|
148 |
$formatting = adinj_formatting_options($adtype, $ads_db, 'string');
|
149 |
} else {
|
150 |
-
echo "<!--ga2-->";
|
151 |
$ads_live = array();
|
152 |
$ads_split = array();
|
153 |
$alt_live = array();
|
@@ -158,14 +155,10 @@ function adinj_get_ad_code($adtype, $ads_db){
|
|
158 |
}
|
159 |
$formatting = adinj_formatting_options($adtype, $ads_db, 'array');
|
160 |
}
|
161 |
-
echo "<!--ga3-->";
|
162 |
if (empty($ads_live) && empty($alt_live)){
|
163 |
-
echo "<!--ga4-->";
|
164 |
return "";
|
165 |
}
|
166 |
-
echo "<!--ga5-->";
|
167 |
if ($ops['ad_insertion_mode'] == 'mfunc'){
|
168 |
-
echo "<!--ga6-->";
|
169 |
return adinj_ad_code_eval("\n
|
170 |
<!--mfunc adshow_display_ad_file_v2(array($ads_live), array($ads_split), array($formatting), array($alt_live), array($alt_split)) -->
|
171 |
<?php adshow_display_ad_file_v2(array($ads_live), array($ads_split), array($formatting), array($alt_live), array($alt_split)); ?>
|
@@ -176,22 +169,16 @@ function adinj_get_ad_code($adtype, $ads_db){
|
|
176 |
// else dynamic ad
|
177 |
if ($ops['ad_insertion_mode'] == 'direct_dynamic' && adshow_show_adverts() !== true){
|
178 |
$adname = adshow_pick_value($alt_live, $alt_split);
|
179 |
-
echo "<!--ga7".$adname."-->";
|
180 |
} else {
|
181 |
$adname = adshow_pick_value($ads_live, $ads_split);
|
182 |
-
echo "<!--ga8".$adname."-->";
|
183 |
}
|
184 |
$ad = $ads_db[$adname];
|
185 |
-
echo "<!--ga9:".strlen($ad)."-->";
|
186 |
|
187 |
if (empty($ad)){
|
188 |
-
echo "<!--ga10-->";
|
189 |
return "";
|
190 |
}
|
191 |
|
192 |
-
echo "<!--ga11-->";
|
193 |
$ad = adshow_add_formatting($ad, $formatting);
|
194 |
-
echo "<!--ga12:".strlen($ad)."-->";
|
195 |
return adinj_ad_code_eval($ad);
|
196 |
}
|
197 |
|
@@ -200,18 +187,14 @@ function adinj_ad_code_random(){
|
|
200 |
}
|
201 |
|
202 |
function adinj_ad_code_top(){
|
203 |
-
echo "\n<!--xxxadinj_ad_code_top2b-->";
|
204 |
$ad = adinj_get_ad_code('top', adinj_options());
|
205 |
-
echo "<!--c: ".strlen($ad)."-->";
|
206 |
global $adinj_total_all_ads_used;
|
207 |
++$adinj_total_all_ads_used;
|
208 |
return $ad;
|
209 |
}
|
210 |
|
211 |
function adinj_ad_code_bottom(){
|
212 |
-
echo "\n<!--xxxadinj_ad_code_bottom2b-->";
|
213 |
$ad = adinj_get_ad_code('bottom', adinj_options());
|
214 |
-
echo "<!--c: ".strlen($ad)."-->";
|
215 |
global $adinj_total_all_ads_used;
|
216 |
++$adinj_total_all_ads_used;
|
217 |
return $ad;
|
@@ -565,20 +548,26 @@ function adinj_split_comma_list($list){
|
|
565 |
function adinj_inject_hook($content){
|
566 |
if (is_feed()) return $content; // TODO feed specific ads
|
567 |
|
|
|
|
|
|
|
|
|
568 |
adinj_upgrade_db_if_necessary();
|
569 |
|
570 |
-
global $adinj_total_random_ads_used, $adinj_total_top_ads_used, $adinj_total_bottom_ads_used;
|
571 |
if(!is_archive && (is_page() || is_single())){
|
572 |
-
//
|
|
|
|
|
|
|
573 |
$adinj_total_random_ads_used = 0;
|
|
|
574 |
}
|
575 |
|
576 |
$reason = adinj_ads_completely_disabled_from_page($content);
|
577 |
if ($reason !== false){
|
578 |
return adinj($content, $reason);
|
579 |
}
|
580 |
-
|
581 |
-
$ops = adinj_options();
|
582 |
|
583 |
$debug_on = $ops['debug_mode'];
|
584 |
$debug = "";
|
@@ -613,16 +602,12 @@ function adinj_inject_hook($content){
|
|
613 |
if ($debug_on) $debug .= "\nnum words: = $length";
|
614 |
}
|
615 |
# Insert top and bottom ads if necesary
|
616 |
-
echo "<!--1-->";
|
617 |
if (adinj_num_top_ads_to_insert($length) > 0){
|
618 |
-
echo "<!--2-->";
|
619 |
$content = $ad_include.adinj_ad_code_top().$content;
|
620 |
$ad_include = "";
|
621 |
++$adinj_total_top_ads_used;
|
622 |
}
|
623 |
-
echo "<!--3-->";
|
624 |
if (adinj_num_bottom_ads_to_insert($length) > 0){
|
625 |
-
echo "<!--4-->";
|
626 |
$content = $content.adinj_ad_code_bottom();
|
627 |
++$adinj_total_bottom_ads_used;
|
628 |
}
|
@@ -787,46 +772,42 @@ function adinj_get_current_page_type_prefix(){
|
|
787 |
}
|
788 |
|
789 |
function adinj_num_top_ads_to_insert($content_length){
|
790 |
-
echo "\n<!--adinj_num_top_ads_to_insert(".$content_length.")-->";
|
791 |
-
global $adinj_total_top_ads_used;
|
792 |
$ops = adinj_options();
|
793 |
$prefix = adinj_get_current_page_type_prefix();
|
794 |
$max_num_ads_to_insert = 0;
|
795 |
if (is_single() || is_page()){
|
796 |
-
$max_num_ads_to_insert = 1
|
797 |
} else {
|
|
|
798 |
$max_num_ads_to_insert = $ops[$prefix.'max_num_top_ads_per_page'] - $adinj_total_top_ads_used;
|
799 |
}
|
800 |
-
echo "<!--num1:".$max_num_ads_to_insert."-->";
|
801 |
if ($max_num_ads_to_insert <= 0) return 0;
|
802 |
-
|
803 |
-
if (!adinj_allowed_in_category('top', $ops)) return
|
804 |
-
if (!adinj_allowed_in_tag('top', $ops)) return
|
805 |
-
if (!adinj_allowed_in_author('top', $ops)) return
|
806 |
|
807 |
if (adinj_do_rule_if($ops[$prefix.'top_ad_if_longer_than'], '<', $content_length)){
|
808 |
-
echo "<!--num3:-->";
|
809 |
return 1;
|
810 |
}
|
811 |
-
echo "<!--num4:-->";
|
812 |
return 0;
|
813 |
}
|
814 |
|
815 |
function adinj_num_bottom_ads_to_insert($content_length){
|
816 |
-
global $adinj_total_bottom_ads_used;
|
817 |
$ops = adinj_options();
|
818 |
$prefix = adinj_get_current_page_type_prefix();
|
819 |
$max_num_ads_to_insert = 0;
|
820 |
if (is_single() || is_page()){
|
821 |
-
$max_num_ads_to_insert = 1
|
822 |
} else {
|
|
|
823 |
$max_num_ads_to_insert = $ops[$prefix.'max_num_bottom_ads_per_page'] - $adinj_total_bottom_ads_used;
|
824 |
}
|
825 |
if ($max_num_ads_to_insert <= 0) return 0;
|
826 |
|
827 |
-
if (!adinj_allowed_in_category('bottom', $ops)) return
|
828 |
-
if (!adinj_allowed_in_tag('bottom', $ops)) return
|
829 |
-
if (!adinj_allowed_in_author('bottom', $ops)) return
|
830 |
|
831 |
if (adinj_do_rule_if($ops[$prefix.'bottom_ad_if_longer_than'], '<', $content_length)){
|
832 |
return 1;
|
@@ -855,9 +836,9 @@ function adinj_num_rand_ads_to_insert($content_length){
|
|
855 |
return 0;
|
856 |
}
|
857 |
|
858 |
-
if (!adinj_allowed_in_category('random', $ops)) return
|
859 |
-
if (!adinj_allowed_in_tag('random', $ops)) return
|
860 |
-
if (!adinj_allowed_in_author('random', $ops)) return
|
861 |
|
862 |
$length = $content_length;
|
863 |
if (adinj_do_rule_if($ops[$prefix.'no_random_ads_if_shorter_than'], '>', $length)){
|
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.3
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
132 |
}
|
133 |
|
134 |
function adinj_get_ad_code($adtype, $ads_db){
|
|
|
135 |
$ops = adinj_options();
|
136 |
$ads_live = NULL;
|
137 |
$ads_split = NULL;
|
139 |
$alt_split = NULL;
|
140 |
$formatting = NULL;
|
141 |
if ($ops['ad_insertion_mode'] == 'mfunc'){
|
|
|
142 |
adinj_live_ads_array($adtype, $ads_db, $ads_live, $ads_split, 'string');
|
143 |
if (adinj_db_version($ads_db) >= 2){
|
144 |
adinj_live_ads_array($adtype.'_alt', $ads_db, $alt_live, $alt_split, 'string');
|
145 |
}
|
146 |
$formatting = adinj_formatting_options($adtype, $ads_db, 'string');
|
147 |
} else {
|
|
|
148 |
$ads_live = array();
|
149 |
$ads_split = array();
|
150 |
$alt_live = array();
|
155 |
}
|
156 |
$formatting = adinj_formatting_options($adtype, $ads_db, 'array');
|
157 |
}
|
|
|
158 |
if (empty($ads_live) && empty($alt_live)){
|
|
|
159 |
return "";
|
160 |
}
|
|
|
161 |
if ($ops['ad_insertion_mode'] == 'mfunc'){
|
|
|
162 |
return adinj_ad_code_eval("\n
|
163 |
<!--mfunc adshow_display_ad_file_v2(array($ads_live), array($ads_split), array($formatting), array($alt_live), array($alt_split)) -->
|
164 |
<?php adshow_display_ad_file_v2(array($ads_live), array($ads_split), array($formatting), array($alt_live), array($alt_split)); ?>
|
169 |
// else dynamic ad
|
170 |
if ($ops['ad_insertion_mode'] == 'direct_dynamic' && adshow_show_adverts() !== true){
|
171 |
$adname = adshow_pick_value($alt_live, $alt_split);
|
|
|
172 |
} else {
|
173 |
$adname = adshow_pick_value($ads_live, $ads_split);
|
|
|
174 |
}
|
175 |
$ad = $ads_db[$adname];
|
|
|
176 |
|
177 |
if (empty($ad)){
|
|
|
178 |
return "";
|
179 |
}
|
180 |
|
|
|
181 |
$ad = adshow_add_formatting($ad, $formatting);
|
|
|
182 |
return adinj_ad_code_eval($ad);
|
183 |
}
|
184 |
|
187 |
}
|
188 |
|
189 |
function adinj_ad_code_top(){
|
|
|
190 |
$ad = adinj_get_ad_code('top', adinj_options());
|
|
|
191 |
global $adinj_total_all_ads_used;
|
192 |
++$adinj_total_all_ads_used;
|
193 |
return $ad;
|
194 |
}
|
195 |
|
196 |
function adinj_ad_code_bottom(){
|
|
|
197 |
$ad = adinj_get_ad_code('bottom', adinj_options());
|
|
|
198 |
global $adinj_total_all_ads_used;
|
199 |
++$adinj_total_all_ads_used;
|
200 |
return $ad;
|
548 |
function adinj_inject_hook($content){
|
549 |
if (is_feed()) return $content; // TODO feed specific ads
|
550 |
|
551 |
+
$ops = adinj_options();
|
552 |
+
if(empty($ops)){
|
553 |
+
return $content;
|
554 |
+
}
|
555 |
adinj_upgrade_db_if_necessary();
|
556 |
|
557 |
+
global $adinj_total_all_ads_used, $adinj_total_random_ads_used, $adinj_total_top_ads_used, $adinj_total_bottom_ads_used;
|
558 |
if(!is_archive && (is_page() || is_single())){
|
559 |
+
// On single page the_content may be called more than once - e.g. for
|
560 |
+
// description meta tag and for content.
|
561 |
+
$adinj_total_all_ads_used = 0;
|
562 |
+
$adinj_total_top_ads_used = 0;
|
563 |
$adinj_total_random_ads_used = 0;
|
564 |
+
$adinj_total_bottom_ads_used = 0;
|
565 |
}
|
566 |
|
567 |
$reason = adinj_ads_completely_disabled_from_page($content);
|
568 |
if ($reason !== false){
|
569 |
return adinj($content, $reason);
|
570 |
}
|
|
|
|
|
571 |
|
572 |
$debug_on = $ops['debug_mode'];
|
573 |
$debug = "";
|
602 |
if ($debug_on) $debug .= "\nnum words: = $length";
|
603 |
}
|
604 |
# Insert top and bottom ads if necesary
|
|
|
605 |
if (adinj_num_top_ads_to_insert($length) > 0){
|
|
|
606 |
$content = $ad_include.adinj_ad_code_top().$content;
|
607 |
$ad_include = "";
|
608 |
++$adinj_total_top_ads_used;
|
609 |
}
|
|
|
610 |
if (adinj_num_bottom_ads_to_insert($length) > 0){
|
|
|
611 |
$content = $content.adinj_ad_code_bottom();
|
612 |
++$adinj_total_bottom_ads_used;
|
613 |
}
|
772 |
}
|
773 |
|
774 |
function adinj_num_top_ads_to_insert($content_length){
|
|
|
|
|
775 |
$ops = adinj_options();
|
776 |
$prefix = adinj_get_current_page_type_prefix();
|
777 |
$max_num_ads_to_insert = 0;
|
778 |
if (is_single() || is_page()){
|
779 |
+
$max_num_ads_to_insert = 1;
|
780 |
} else {
|
781 |
+
global $adinj_total_top_ads_used;
|
782 |
$max_num_ads_to_insert = $ops[$prefix.'max_num_top_ads_per_page'] - $adinj_total_top_ads_used;
|
783 |
}
|
|
|
784 |
if ($max_num_ads_to_insert <= 0) return 0;
|
785 |
+
|
786 |
+
if (!adinj_allowed_in_category('top', $ops)) return 0;
|
787 |
+
if (!adinj_allowed_in_tag('top', $ops)) return 0;
|
788 |
+
if (!adinj_allowed_in_author('top', $ops)) return 0;
|
789 |
|
790 |
if (adinj_do_rule_if($ops[$prefix.'top_ad_if_longer_than'], '<', $content_length)){
|
|
|
791 |
return 1;
|
792 |
}
|
|
|
793 |
return 0;
|
794 |
}
|
795 |
|
796 |
function adinj_num_bottom_ads_to_insert($content_length){
|
|
|
797 |
$ops = adinj_options();
|
798 |
$prefix = adinj_get_current_page_type_prefix();
|
799 |
$max_num_ads_to_insert = 0;
|
800 |
if (is_single() || is_page()){
|
801 |
+
$max_num_ads_to_insert = 1;
|
802 |
} else {
|
803 |
+
global $adinj_total_bottom_ads_used;
|
804 |
$max_num_ads_to_insert = $ops[$prefix.'max_num_bottom_ads_per_page'] - $adinj_total_bottom_ads_used;
|
805 |
}
|
806 |
if ($max_num_ads_to_insert <= 0) return 0;
|
807 |
|
808 |
+
if (!adinj_allowed_in_category('bottom', $ops)) return 0;
|
809 |
+
if (!adinj_allowed_in_tag('bottom', $ops)) return 0;
|
810 |
+
if (!adinj_allowed_in_author('bottom', $ops)) return 0;
|
811 |
|
812 |
if (adinj_do_rule_if($ops[$prefix.'bottom_ad_if_longer_than'], '<', $content_length)){
|
813 |
return 1;
|
836 |
return 0;
|
837 |
}
|
838 |
|
839 |
+
if (!adinj_allowed_in_category('random', $ops)) return 0;
|
840 |
+
if (!adinj_allowed_in_tag('random', $ops)) return 0;
|
841 |
+
if (!adinj_allowed_in_author('random', $ops)) return 0;
|
842 |
|
843 |
$length = $content_length;
|
844 |
if (adinj_do_rule_if($ops[$prefix.'no_random_ads_if_shorter_than'], '>', $length)){
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-w
|
|
4 |
Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
|
5 |
Requires at least: 2.8.6
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 0.9.7.
|
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 |
|
@@ -372,6 +372,9 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
|
|
372 |
|
373 |
== Changelog ==
|
374 |
|
|
|
|
|
|
|
375 |
= 0.9.7.2 =
|
376 |
Release with more debugging to try to track down top/bottom ads which have gone missing on some blogs.
|
377 |
|
@@ -507,8 +510,8 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
|
|
507 |
|
508 |
== Upgrade Notice ==
|
509 |
|
510 |
-
= 0.9.7.
|
511 |
-
|
512 |
|
513 |
= 0.8.3 =
|
514 |
First public release.
|
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.1
|
7 |
+
Stable tag: 0.9.7.3
|
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 |
|
372 |
|
373 |
== Changelog ==
|
374 |
|
375 |
+
= 0.9.7.3 =
|
376 |
+
* Fix (hopefully) for the disappearing top/bottom adverts that affected some users. Special thanks to numaga.com for the debug access.
|
377 |
+
|
378 |
= 0.9.7.2 =
|
379 |
Release with more debugging to try to track down top/bottom ads which have gone missing on some blogs.
|
380 |
|
510 |
|
511 |
== Upgrade Notice ==
|
512 |
|
513 |
+
= 0.9.7.3 =
|
514 |
+
* Fix (hopefully) for the disappearing top/bottom adverts that affected some users.
|
515 |
|
516 |
= 0.8.3 =
|
517 |
First public release.
|