Version Description
More fault tolerant mfunc support.
Download this release
Release Info
Developer | reviewmylife |
Plugin | Ad Injection |
Version | 0.8.7 |
Comparing to | |
See all releases |
Code changes from version 0.8.6 to 0.8.7
- ad-injection.php +8 -6
- adshow.php +36 -1
- readme.txt +7 -1
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: Inserts any advert into your blog. Options to exclude by post age, visitor IP, and visitor referrer. Works with WP Super Cache.
|
6 |
-
Version: 0.8.
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
@@ -128,8 +128,7 @@ function adinj_get_mfunc_code($adfile){
|
|
128 |
";
|
129 |
}
|
130 |
|
131 |
-
function adinj_ad_code_eval($adcode
|
132 |
-
$adcode = adinj_add_tags($adcode, $prefix);
|
133 |
if (stripos($adcode, '<?php') !== false){
|
134 |
return adinj_eval_php($adcode);
|
135 |
}
|
@@ -196,8 +195,9 @@ function adinj_ad_code_random(){
|
|
196 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_RANDOM_FILE);
|
197 |
} else {
|
198 |
$adcode = $options['ad_code_random_1'];
|
|
|
199 |
}
|
200 |
-
return adinj_ad_code_eval($adcode
|
201 |
}
|
202 |
|
203 |
function adinj_ad_code_top(){
|
@@ -209,8 +209,9 @@ function adinj_ad_code_top(){
|
|
209 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_TOP_FILE);
|
210 |
} else {
|
211 |
$adcode = $options['ad_code_top_1'];
|
|
|
212 |
}
|
213 |
-
return adinj_ad_code_eval($adcode
|
214 |
}
|
215 |
|
216 |
function adinj_ad_code_bottom(){
|
@@ -222,8 +223,9 @@ function adinj_ad_code_bottom(){
|
|
222 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_BOTTOM_FILE);
|
223 |
} else {
|
224 |
$adcode = $options['ad_code_bottom_1'];
|
|
|
225 |
}
|
226 |
-
return adinj_ad_code_eval($adcode
|
227 |
}
|
228 |
|
229 |
function read_ad_from_file($ad_path){
|
3 |
Plugin Name: Ad Injection
|
4 |
Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
|
5 |
Description: Inserts any advert into your blog. Options to exclude by post age, visitor IP, and visitor referrer. Works with WP Super Cache.
|
6 |
+
Version: 0.8.7
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
128 |
";
|
129 |
}
|
130 |
|
131 |
+
function adinj_ad_code_eval($adcode){
|
|
|
132 |
if (stripos($adcode, '<?php') !== false){
|
133 |
return adinj_eval_php($adcode);
|
134 |
}
|
195 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_RANDOM_FILE);
|
196 |
} else {
|
197 |
$adcode = $options['ad_code_random_1'];
|
198 |
+
$adcode = adinj_add_tags($adcode, 'rnd_');
|
199 |
}
|
200 |
+
return adinj_ad_code_eval($adcode);
|
201 |
}
|
202 |
|
203 |
function adinj_ad_code_top(){
|
209 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_TOP_FILE);
|
210 |
} else {
|
211 |
$adcode = $options['ad_code_top_1'];
|
212 |
+
$adcode = adinj_add_tags($adcode, 'top_');
|
213 |
}
|
214 |
+
return adinj_ad_code_eval($adcode);
|
215 |
}
|
216 |
|
217 |
function adinj_ad_code_bottom(){
|
223 |
$adcode = adinj_get_mfunc_code(ADINJ_AD_BOTTOM_FILE);
|
224 |
} else {
|
225 |
$adcode = $options['ad_code_bottom_1'];
|
226 |
+
$adcode = adinj_add_tags($adcode, 'bottom_');
|
227 |
}
|
228 |
+
return adinj_ad_code_eval($adcode);
|
229 |
}
|
230 |
|
231 |
function read_ad_from_file($ad_path){
|
adshow.php
CHANGED
@@ -1,15 +1,42 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Part of the Ad Injection plugin for WordPress
|
4 |
-
http://www.reviewmylife.co.uk/
|
5 |
*/
|
6 |
|
7 |
include_once('ad-injection-config.php');
|
8 |
|
9 |
//////////////////////////////////////////////////////////////////////////////
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
if (!function_exists('adshow_display_ad_file')){
|
12 |
function adshow_display_ad_file($adfile){
|
|
|
|
|
|
|
|
|
|
|
13 |
$ad_path = dirname(__FILE__).'/ads/'.$adfile;
|
14 |
adshow_display_ad_full_path($ad_path);
|
15 |
}
|
@@ -17,6 +44,8 @@ function adshow_display_ad_file($adfile){
|
|
17 |
|
18 |
if (!function_exists('adshow_display_ad_full_path')){
|
19 |
function adshow_display_ad_full_path($ad_path){
|
|
|
|
|
20 |
$showads = adshow_show_adverts();
|
21 |
if ($showads !== true){
|
22 |
if (adinj_config_debug_mode()){
|
@@ -46,6 +75,8 @@ function adshow_display_ad_full_path($ad_path){
|
|
46 |
|
47 |
if (!function_exists('adshow_fromasearchengine')){
|
48 |
function adshow_fromasearchengine(){
|
|
|
|
|
49 |
$referrer = $_SERVER['HTTP_REFERER'];
|
50 |
$searchengines = adinj_config_search_engine_referrers();
|
51 |
foreach ($searchengines as $se) {
|
@@ -61,6 +92,8 @@ function adshow_fromasearchengine(){
|
|
61 |
|
62 |
if (!function_exists('adshow_blocked_ip')){
|
63 |
function adshow_blocked_ip(){
|
|
|
|
|
64 |
$visitorIP = $_SERVER['REMOTE_ADDR'];
|
65 |
return in_array($visitorIP, adinj_config_blocked_ips());
|
66 |
}
|
@@ -68,6 +101,8 @@ function adshow_blocked_ip(){
|
|
68 |
|
69 |
if (!function_exists('adshow_show_adverts')){
|
70 |
function adshow_show_adverts(){
|
|
|
|
|
71 |
if (adshow_blocked_ip()) return "blockedip";
|
72 |
if (adinj_config_sevisitors_only()){
|
73 |
if (!adshow_fromasearchengine()) return "referrer";
|
1 |
<?php
|
2 |
/*
|
3 |
Part of the Ad Injection plugin for WordPress
|
4 |
+
http://www.reviewmylife.co.uk/
|
5 |
*/
|
6 |
|
7 |
include_once('ad-injection-config.php');
|
8 |
|
9 |
//////////////////////////////////////////////////////////////////////////////
|
10 |
|
11 |
+
if (!function_exists('adshow_functions_exist')){
|
12 |
+
// Used to downgrade fatal errors to printed errors to make debugging easier
|
13 |
+
// and so that a problem doesn't disable the whole website.
|
14 |
+
function adshow_functions_exist(){
|
15 |
+
if (!adshow_functions_exist_impl('adinj_config_add_tags_rnd')){ return false; }
|
16 |
+
if (!adshow_functions_exist_impl('adinj_config_add_tags_top')){ return false; }
|
17 |
+
if (!adshow_functions_exist_impl('adinj_config_add_tags_bottom')){ return false; }
|
18 |
+
if (!adshow_functions_exist_impl('adinj_config_sevisitors_only')){ return false; }
|
19 |
+
if (!adshow_functions_exist_impl('adinj_config_search_engine_referrers')){ return false; }
|
20 |
+
if (!adshow_functions_exist_impl('adinj_config_blocked_ips')){ return false; }
|
21 |
+
if (!adshow_functions_exist_impl('adinj_config_debug_mode')){ return false; }
|
22 |
+
return true;
|
23 |
+
}
|
24 |
+
function adshow_functions_exist_impl($function){
|
25 |
+
if (!function_exists($function)){
|
26 |
+
echo "<b>".__FILE__." Error: $function does not exist.</b>";
|
27 |
+
return false;
|
28 |
+
}
|
29 |
+
return true;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
if (!function_exists('adshow_display_ad_file')){
|
34 |
function adshow_display_ad_file($adfile){
|
35 |
+
if (!adshow_functions_exist()){ return false; }
|
36 |
+
|
37 |
+
if (adinj_config_debug_mode()){
|
38 |
+
echo "<!--ADINJ DEBUG: adshow_display_ad_file($adfile)-->";
|
39 |
+
}
|
40 |
$ad_path = dirname(__FILE__).'/ads/'.$adfile;
|
41 |
adshow_display_ad_full_path($ad_path);
|
42 |
}
|
44 |
|
45 |
if (!function_exists('adshow_display_ad_full_path')){
|
46 |
function adshow_display_ad_full_path($ad_path){
|
47 |
+
if (!adshow_functions_exist()){ return false; }
|
48 |
+
|
49 |
$showads = adshow_show_adverts();
|
50 |
if ($showads !== true){
|
51 |
if (adinj_config_debug_mode()){
|
75 |
|
76 |
if (!function_exists('adshow_fromasearchengine')){
|
77 |
function adshow_fromasearchengine(){
|
78 |
+
if (!adshow_functions_exist()){ return false; }
|
79 |
+
|
80 |
$referrer = $_SERVER['HTTP_REFERER'];
|
81 |
$searchengines = adinj_config_search_engine_referrers();
|
82 |
foreach ($searchengines as $se) {
|
92 |
|
93 |
if (!function_exists('adshow_blocked_ip')){
|
94 |
function adshow_blocked_ip(){
|
95 |
+
if (!adshow_functions_exist()){ return false; }
|
96 |
+
|
97 |
$visitorIP = $_SERVER['REMOTE_ADDR'];
|
98 |
return in_array($visitorIP, adinj_config_blocked_ips());
|
99 |
}
|
101 |
|
102 |
if (!function_exists('adshow_show_adverts')){
|
103 |
function adshow_show_adverts(){
|
104 |
+
if (!adshow_functions_exist()){ return false; }
|
105 |
+
|
106 |
if (adshow_blocked_ip()) return "blockedip";
|
107 |
if (adinj_config_sevisitors_only()){
|
108 |
if (!adshow_fromasearchengine()) return "referrer";
|
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, advert injection, advert, ad, injection, adsense, advertising, affiliate, inject, injection, insert, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, free
|
5 |
Requires at least: 3.0.0
|
6 |
Tested up to: 3.0.2
|
7 |
-
Stable tag: 0.8.
|
8 |
|
9 |
Injects any kind of advert into existing WordPress posts. Can restrict who sees the ads by post age, visitor referrer, IP address. Cache compatible.
|
10 |
|
@@ -157,6 +157,9 @@ For more information visit [reviewmylife](http://www.reviewmylife.co.uk/blog/201
|
|
157 |
|
158 |
== Changelog ==
|
159 |
|
|
|
|
|
|
|
160 |
= 0.8.6 =
|
161 |
Fix problems relating to over strict chmod usage.
|
162 |
Add save message.
|
@@ -174,6 +177,9 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
|
|
174 |
|
175 |
== Upgrade Notice ==
|
176 |
|
|
|
|
|
|
|
177 |
= 0.8.6 =
|
178 |
Fix problems relating to over strict chmod usage. And add save message.
|
179 |
|
4 |
Tags: ad injection, advert injection, advert, ad, injection, adsense, advertising, affiliate, inject, injection, insert, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, free
|
5 |
Requires at least: 3.0.0
|
6 |
Tested up to: 3.0.2
|
7 |
+
Stable tag: 0.8.7
|
8 |
|
9 |
Injects any kind of advert into existing WordPress posts. Can restrict who sees the ads by post age, visitor referrer, IP address. Cache compatible.
|
10 |
|
157 |
|
158 |
== Changelog ==
|
159 |
|
160 |
+
= 0.8.7 =
|
161 |
+
More fault tolerant mfunc support.
|
162 |
+
|
163 |
= 0.8.6 =
|
164 |
Fix problems relating to over strict chmod usage.
|
165 |
Add save message.
|
177 |
|
178 |
== Upgrade Notice ==
|
179 |
|
180 |
+
= 0.8.7 =
|
181 |
+
More fault tolerant mfunc support.
|
182 |
+
|
183 |
= 0.8.6 =
|
184 |
Fix problems relating to over strict chmod usage. And add save message.
|
185 |
|