Version Description
- Filter ads by post/page ID
- Other misc bug fixes
Download this release
Release Info
Developer | reviewmylife |
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
- ad-injection-admin.php +70 -11
- ad-injection-widget.php +7 -2
- ad-injection.php +39 -7
- readme.txt +615 -608
- 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 "
|
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 -
|
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('
|
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 |
-
|
|
|
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
|
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.
|
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 |
-
|
|
|
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 (
|
464 |
-
if (
|
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.
|
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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
*
|
25 |
-
*
|
26 |
-
*
|
27 |
-
*
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
*
|
110 |
-
*
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
*
|
132 |
-
*
|
133 |
-
* Can
|
134 |
-
*
|
135 |
-
*
|
136 |
-
*
|
137 |
-
*
|
138 |
-
*
|
139 |
-
*
|
140 |
-
*
|
141 |
-
*
|
142 |
-
* Compatible with in-page tags from
|
143 |
-
*
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
<?php }
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
<?php }
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
This is
|
289 |
-
<?php }
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
If
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
*
|
357 |
-
*
|
358 |
-
*
|
359 |
-
*
|
360 |
-
*
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
*
|
430 |
-
*
|
431 |
-
|
432 |
-
= 0.9.7.
|
433 |
-
*
|
434 |
-
*
|
435 |
-
*
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
*
|
440 |
-
*
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
*
|
445 |
-
*
|
446 |
-
|
447 |
-
= 0.9.7.
|
448 |
-
*
|
449 |
-
*
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
*
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
*
|
474 |
-
*
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
*
|
480 |
-
*
|
481 |
-
*
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
*
|
486 |
-
*
|
487 |
-
*
|
488 |
-
|
489 |
-
= 0.9.6.
|
490 |
-
*
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
*
|
499 |
-
|
500 |
-
= 0.9.
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
New options for
|
511 |
-
|
512 |
-
|
513 |
-
= 0.9.
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
= 0.9.4.
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
= 0.9.4.
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
More
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
= 0.
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
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) <!--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.
|
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>
|
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>
|
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(
|
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>
|
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>
|
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>
|
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>';
|