Version Description
- Fix problem with debug output.
- Reduce memory on admin side for blogs with large numbers of tags.
- More detailed debug for PHP exec errors.
- Colour debug table changes.
Download this release
Release Info
Developer | reviewmylife |
Plugin | Ad Injection |
Version | 1.2.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.2.0.5 to 1.2.0.6
- ad-injection-admin.php +68 -55
- ad-injection.php +18 -14
- adshow.php +4 -1
- readme.txt +35 -3
- ui-tab-debug.php +6 -3
ad-injection-admin.php
CHANGED
@@ -342,7 +342,7 @@ function adinj_top_message_box(){
|
|
342 |
|
343 |
} else if (!isset($_GET['tab'])){
|
344 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
345 |
-
echo "
|
346 |
echo '</strong></p></div>';
|
347 |
}
|
348 |
}
|
@@ -368,7 +368,13 @@ function adinj_side_donate_box(){
|
|
368 |
<input class="omni_donate_field" type="text" name="amount" size="9" title="The amount you wish to donate" value="10">
|
369 |
<select id="currency_code" name="currency_code">
|
370 |
<option value="USD">U.S. Dollars</option>
|
371 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
<option value="AUD">Australian Dollars</option>
|
373 |
<option value="CAD">Canadian Dollars</option>
|
374 |
<option value="EUR">Euros</option>
|
@@ -852,7 +858,14 @@ function adinj_condition_table($name, $description, $type, $ops, $dropdown_field
|
|
852 |
}
|
853 |
|
854 |
function adinj_print_tags($quantity, $offset){
|
855 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
if (count($tags) == 0) return false;
|
857 |
$tag = NULL;
|
858 |
foreach ($tags as $tag) {
|
@@ -1377,7 +1390,7 @@ function adinj_upgrade_db(){
|
|
1377 |
function adinj_default_options(){
|
1378 |
return array(
|
1379 |
// Global settings
|
1380 |
-
'ads_enabled' => '
|
1381 |
'ads_on_page_older_than' => '0',
|
1382 |
'widgets_on_page_older_than' => '0',
|
1383 |
'content_length_unit' => 'words',
|
@@ -1389,9 +1402,9 @@ function adinj_default_options(){
|
|
1389 |
'random_ads_end_unit' => 'paragraph',
|
1390 |
'random_ads_end_at' => '20',
|
1391 |
'random_ads_end_direction' => 'fromstart',
|
1392 |
-
'rnd_allow_ads_on_last_paragraph' => '',
|
1393 |
-
'rnd_reselect_ad_per_position_in_post' => '',
|
1394 |
-
'multiple_ads_at_same_position' => '',
|
1395 |
// top/bottom ad position
|
1396 |
'top_ad_position' => '0',
|
1397 |
'top_ad_position_unit' => 'paragraph',
|
@@ -1603,55 +1616,55 @@ function adinj_default_options(){
|
|
1603 |
'footer_id_condition_mode' => 'o',
|
1604 |
'footer_id_condition_entries' => '',
|
1605 |
// exclusion tick boxes
|
1606 |
-
'exclude_front' => '',
|
1607 |
-
'exclude_home' => '',
|
1608 |
-
'exclude_page' => '',
|
1609 |
-
'exclude_single' => '',
|
1610 |
-
'exclude_archive' => '',
|
1611 |
'exclude_search' => 'on',
|
1612 |
'exclude_404' => 'on',
|
1613 |
-
'top_exclude_front' => '',
|
1614 |
-
'top_exclude_home' => '',
|
1615 |
-
'top_exclude_page' => '',
|
1616 |
-
'top_exclude_single' => '',
|
1617 |
-
'top_exclude_archive' => '',
|
1618 |
-
'top_exclude_search' => '',
|
1619 |
-
'top_exclude_404' => '',
|
1620 |
-
'random_exclude_front' => '',
|
1621 |
-
'random_exclude_home' => '',
|
1622 |
-
'random_exclude_page' => '',
|
1623 |
-
'random_exclude_single' => '',
|
1624 |
-
'random_exclude_archive' => '',
|
1625 |
-
'random_exclude_search' => '',
|
1626 |
-
'random_exclude_404' => '',
|
1627 |
-
'bottom_exclude_front' => '',
|
1628 |
-
'bottom_exclude_home' => '',
|
1629 |
-
'bottom_exclude_page' => '',
|
1630 |
-
'bottom_exclude_single' => '',
|
1631 |
-
'bottom_exclude_archive' => '',
|
1632 |
-
'bottom_exclude_search' => '',
|
1633 |
-
'bottom_exclude_404' => '',
|
1634 |
-
'footer_exclude_front' => '',
|
1635 |
-
'footer_exclude_home' => '',
|
1636 |
-
'footer_exclude_page' => '',
|
1637 |
-
'footer_exclude_single' => '',
|
1638 |
-
'footer_exclude_archive' => '',
|
1639 |
-
'footer_exclude_search' => '',
|
1640 |
-
'footer_exclude_404' => '',
|
1641 |
-
'widget_exclude_front' => '',
|
1642 |
-
'widget_exclude_home' => '',
|
1643 |
-
'widget_exclude_page' => '',
|
1644 |
-
'widget_exclude_single' => '',
|
1645 |
-
'widget_exclude_archive' => '',
|
1646 |
-
'widget_exclude_search' => '',
|
1647 |
-
'widget_exclude_404' => '',
|
1648 |
-
'template_exclude_front' => '',
|
1649 |
-
'template_exclude_home' => '',
|
1650 |
-
'template_exclude_page' => '',
|
1651 |
-
'template_exclude_single' => '',
|
1652 |
-
'template_exclude_archive' => '',
|
1653 |
-
'template_exclude_search' => '',
|
1654 |
-
'template_exclude_404' => '',
|
1655 |
// advanced settings
|
1656 |
'the_content_filter_priority' => '10', // 10 is the default for add_filter
|
1657 |
// ui main tab
|
@@ -1679,7 +1692,7 @@ function adinj_default_options(){
|
|
1679 |
// ui debug tab
|
1680 |
'ui_debugging_hide' => 'false',
|
1681 |
// debug
|
1682 |
-
'debug_mode' => '',
|
1683 |
// version
|
1684 |
'db_version' => ADINJ_DB_VERSION
|
1685 |
);
|
342 |
|
343 |
} else if (!isset($_GET['tab'])){
|
344 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
345 |
+
echo "26th October 2011: Minor fixes relating to debug output, memory usage when loading tags and the debug table. Support for my new <a href='http://wordpress.org/extend/plugins/ad-logger/' target='_new'>Ad Logger</a> plugin's AdSense click blocking feature. 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>.';
|
346 |
echo '</strong></p></div>';
|
347 |
}
|
348 |
}
|
368 |
<input class="omni_donate_field" type="text" name="amount" size="9" title="The amount you wish to donate" value="10">
|
369 |
<select id="currency_code" name="currency_code">
|
370 |
<option value="USD">U.S. Dollars</option>
|
371 |
+
<?php
|
372 |
+
if (strpos(home_url(), '.co.uk') !== false){
|
373 |
+
echo '<option value="GBP" selected="selected">Pounds Sterling</option>';
|
374 |
+
} else {
|
375 |
+
echo '<option value="GBP">Pounds Sterling</option>';
|
376 |
+
}
|
377 |
+
?>
|
378 |
<option value="AUD">Australian Dollars</option>
|
379 |
<option value="CAD">Canadian Dollars</option>
|
380 |
<option value="EUR">Euros</option>
|
858 |
}
|
859 |
|
860 |
function adinj_print_tags($quantity, $offset){
|
861 |
+
//$tags = get_tags(array('number' => $quantity, 'offset' => $offset));
|
862 |
+
global $wpdb;
|
863 |
+
$sql = "SELECT t.slug, tt.count FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_tag') AND tt.count > 0 ORDER BY t.name ASC LIMIT $offset,$quantity";
|
864 |
+
$tags = $wpdb->get_results($sql);
|
865 |
+
if (!$tags){
|
866 |
+
return false;
|
867 |
+
}
|
868 |
+
|
869 |
if (count($tags) == 0) return false;
|
870 |
$tag = NULL;
|
871 |
foreach ($tags as $tag) {
|
1390 |
function adinj_default_options(){
|
1391 |
return array(
|
1392 |
// Global settings
|
1393 |
+
'ads_enabled' => 'on',
|
1394 |
'ads_on_page_older_than' => '0',
|
1395 |
'widgets_on_page_older_than' => '0',
|
1396 |
'content_length_unit' => 'words',
|
1402 |
'random_ads_end_unit' => 'paragraph',
|
1403 |
'random_ads_end_at' => '20',
|
1404 |
'random_ads_end_direction' => 'fromstart',
|
1405 |
+
'rnd_allow_ads_on_last_paragraph' => 'off',
|
1406 |
+
'rnd_reselect_ad_per_position_in_post' => 'off',
|
1407 |
+
'multiple_ads_at_same_position' => 'off',
|
1408 |
// top/bottom ad position
|
1409 |
'top_ad_position' => '0',
|
1410 |
'top_ad_position_unit' => 'paragraph',
|
1616 |
'footer_id_condition_mode' => 'o',
|
1617 |
'footer_id_condition_entries' => '',
|
1618 |
// exclusion tick boxes
|
1619 |
+
'exclude_front' => 'off',
|
1620 |
+
'exclude_home' => 'off',
|
1621 |
+
'exclude_page' => 'off',
|
1622 |
+
'exclude_single' => 'off',
|
1623 |
+
'exclude_archive' => 'off',
|
1624 |
'exclude_search' => 'on',
|
1625 |
'exclude_404' => 'on',
|
1626 |
+
'top_exclude_front' => 'off',
|
1627 |
+
'top_exclude_home' => 'off',
|
1628 |
+
'top_exclude_page' => 'off',
|
1629 |
+
'top_exclude_single' => 'off',
|
1630 |
+
'top_exclude_archive' => 'off',
|
1631 |
+
'top_exclude_search' => 'off',
|
1632 |
+
'top_exclude_404' => 'off',
|
1633 |
+
'random_exclude_front' => 'off',
|
1634 |
+
'random_exclude_home' => 'off',
|
1635 |
+
'random_exclude_page' => 'off',
|
1636 |
+
'random_exclude_single' => 'off',
|
1637 |
+
'random_exclude_archive' => 'off',
|
1638 |
+
'random_exclude_search' => 'off',
|
1639 |
+
'random_exclude_404' => 'off',
|
1640 |
+
'bottom_exclude_front' => 'off',
|
1641 |
+
'bottom_exclude_home' => 'off',
|
1642 |
+
'bottom_exclude_page' => 'off',
|
1643 |
+
'bottom_exclude_single' => 'off',
|
1644 |
+
'bottom_exclude_archive' => 'off',
|
1645 |
+
'bottom_exclude_search' => 'off',
|
1646 |
+
'bottom_exclude_404' => 'off',
|
1647 |
+
'footer_exclude_front' => 'off',
|
1648 |
+
'footer_exclude_home' => 'off',
|
1649 |
+
'footer_exclude_page' => 'off',
|
1650 |
+
'footer_exclude_single' => 'off',
|
1651 |
+
'footer_exclude_archive' => 'off',
|
1652 |
+
'footer_exclude_search' => 'off',
|
1653 |
+
'footer_exclude_404' => 'off',
|
1654 |
+
'widget_exclude_front' => 'off',
|
1655 |
+
'widget_exclude_home' => 'off',
|
1656 |
+
'widget_exclude_page' => 'off',
|
1657 |
+
'widget_exclude_single' => 'off',
|
1658 |
+
'widget_exclude_archive' => 'off',
|
1659 |
+
'widget_exclude_search' => 'off',
|
1660 |
+
'widget_exclude_404' => 'off',
|
1661 |
+
'template_exclude_front' => 'off',
|
1662 |
+
'template_exclude_home' => 'off',
|
1663 |
+
'template_exclude_page' => 'off',
|
1664 |
+
'template_exclude_single' => 'off',
|
1665 |
+
'template_exclude_archive' => 'off',
|
1666 |
+
'template_exclude_search' => 'off',
|
1667 |
+
'template_exclude_404' => 'off',
|
1668 |
// advanced settings
|
1669 |
'the_content_filter_priority' => '10', // 10 is the default for add_filter
|
1670 |
// ui main tab
|
1692 |
// ui debug tab
|
1693 |
'ui_debugging_hide' => 'false',
|
1694 |
// debug
|
1695 |
+
'debug_mode' => 'off',
|
1696 |
// version
|
1697 |
'db_version' => ADINJ_DB_VERSION
|
1698 |
);
|
ad-injection.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ad Injection
|
4 |
Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
|
5 |
Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
|
6 |
-
Version: 1.2.0.
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
@@ -39,7 +39,8 @@ define('ADINJ_DB_VERSION', 20);
|
|
39 |
|
40 |
// Files
|
41 |
// TODO will these paths work on windows?
|
42 |
-
define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
|
|
|
43 |
define('ADINJ_CONFIG_FILE', WP_CONTENT_DIR . '/ad-injection-config.php');
|
44 |
define('ADINJ_AD_PATH', WP_PLUGIN_DIR.'/ad-injection-data');
|
45 |
|
@@ -623,8 +624,7 @@ function adinj_footer_hook(){
|
|
623 |
}
|
624 |
|
625 |
function adinj_debug_on(){
|
626 |
-
|
627 |
-
return $ops['debug_mode'];
|
628 |
}
|
629 |
|
630 |
function adinj_content_hook($content){
|
@@ -635,7 +635,7 @@ function adinj_content_hook($content){
|
|
635 |
return $content;
|
636 |
}
|
637 |
|
638 |
-
$debug_on =
|
639 |
$debug = "";
|
640 |
if ($debug_on) echo "<!--adinj Ad Injection debug mode on-->";
|
641 |
|
@@ -662,6 +662,17 @@ function adinj_content_hook($content){
|
|
662 |
}
|
663 |
}
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
$ad_include = "";
|
666 |
if (adinj_mfunc_mode()){
|
667 |
$ad_include = adinj_ad_code_include();
|
@@ -669,8 +680,8 @@ function adinj_content_hook($content){
|
|
669 |
|
670 |
# Ad sandwich mode
|
671 |
if(is_page() || is_single()){
|
672 |
-
if(stripos($content, "<!--adsandwich-->") !== false) return adinj($ad_include
|
673 |
-
if(stripos($content, "<!--adfooter-->") !== false) return adinj($content.$ad_include
|
674 |
}
|
675 |
|
676 |
# Get content length for ad placement settings
|
@@ -701,13 +712,6 @@ function adinj_content_hook($content){
|
|
701 |
Try 100, or if that fails 200!";
|
702 |
}
|
703 |
|
704 |
-
$topad = adinj_ad_code_top();
|
705 |
-
if (empty($topad)) { if ($debug_on) $debug .= "\nNo top ad defined in any of the ad code boxes"; }
|
706 |
-
$randomad = adinj_ad_code_random();
|
707 |
-
if (empty($randomad)) { if ($debug_on) $debug .= "\nNo random ad defined in any of the ad code boxes"; }
|
708 |
-
$bottomad = adinj_ad_code_bottom();
|
709 |
-
if (empty($bottomad)) { if ($debug_on) $debug .= "\nNo bottom ad defined in any of the ad code boxes"; }
|
710 |
-
|
711 |
# Positions to insert ads
|
712 |
$top_ad_paragraph = -1;
|
713 |
$random_ad_paragraphs = array();
|
3 |
Plugin Name: Ad Injection
|
4 |
Plugin URI: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
|
5 |
Description: Injects any advert (e.g. AdSense) into your WordPress posts or widget area. Restrict who sees the ads by post length, age, referrer or IP. Cache compatible.
|
6 |
+
Version: 1.2.0.6
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
39 |
|
40 |
// Files
|
41 |
// TODO will these paths work on windows?
|
42 |
+
//define('ADINJ_PATH', WP_PLUGIN_DIR.'/ad-injection');
|
43 |
+
define('ADINJ_PATH', dirname(__FILE__));
|
44 |
define('ADINJ_CONFIG_FILE', WP_CONTENT_DIR . '/ad-injection-config.php');
|
45 |
define('ADINJ_AD_PATH', WP_PLUGIN_DIR.'/ad-injection-data');
|
46 |
|
624 |
}
|
625 |
|
626 |
function adinj_debug_on(){
|
627 |
+
return adinj_ticked('debug_mode');
|
|
|
628 |
}
|
629 |
|
630 |
function adinj_content_hook($content){
|
635 |
return $content;
|
636 |
}
|
637 |
|
638 |
+
$debug_on = adinj_debug_on();
|
639 |
$debug = "";
|
640 |
if ($debug_on) echo "<!--adinj Ad Injection debug mode on-->";
|
641 |
|
662 |
}
|
663 |
}
|
664 |
|
665 |
+
$topad = adinj_ad_code_top();
|
666 |
+
if (empty($topad)) { if ($debug_on) $debug .= "\nNo top ad defined in any of the ad code boxes"; }
|
667 |
+
$randomad = adinj_ad_code_random();
|
668 |
+
if (empty($randomad)) { if ($debug_on) $debug .= "\nNo random ad defined in any of the ad code boxes"; }
|
669 |
+
$bottomad = adinj_ad_code_bottom();
|
670 |
+
if (empty($bottomad)) { if ($debug_on) $debug .= "\nNo bottom ad defined in any of the ad code boxes"; }
|
671 |
+
|
672 |
+
if (empty($topad) && empty($randomad) && empty($bottomad)){
|
673 |
+
return adinj($content, "None of top, random or bottom ads are defined.");
|
674 |
+
}
|
675 |
+
|
676 |
$ad_include = "";
|
677 |
if (adinj_mfunc_mode()){
|
678 |
$ad_include = adinj_ad_code_include();
|
680 |
|
681 |
# Ad sandwich mode
|
682 |
if(is_page() || is_single()){
|
683 |
+
if(stripos($content, "<!--adsandwich-->") !== false) return adinj($ad_include.$topad.$content.$bottomad, "Ads=sandwich" . $debug);
|
684 |
+
if(stripos($content, "<!--adfooter-->") !== false) return adinj($content.$ad_include.$bottomad, "Ads=footer" . $debug);
|
685 |
}
|
686 |
|
687 |
# Get content length for ad placement settings
|
712 |
Try 100, or if that fails 200!";
|
713 |
}
|
714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
# Positions to insert ads
|
716 |
$top_ad_paragraph = -1;
|
717 |
$random_ad_paragraphs = array();
|
adshow.php
CHANGED
@@ -351,7 +351,10 @@ function adshow_clicked_ad(){
|
|
351 |
if (!function_exists('adshow_eval_php')){
|
352 |
function adshow_eval_php($code) {
|
353 |
ob_start();
|
354 |
-
eval("?>$code<?php ");
|
|
|
|
|
|
|
355 |
$output = ob_get_contents();
|
356 |
ob_end_clean();
|
357 |
return $output;
|
351 |
if (!function_exists('adshow_eval_php')){
|
352 |
function adshow_eval_php($code) {
|
353 |
ob_start();
|
354 |
+
$return = eval("?>$code<?php ");
|
355 |
+
if ($return === false && function_exists('error_get_last') && ($error = error_get_last())){
|
356 |
+
echo "<!--\nADINJ: Parse error in code\nType: " . $error['type'] . "\nMsg: " . $error['message'] . "\nFile: " . $error['file'] . "\nLine: " . $error['line'] . "\n-->";
|
357 |
+
}
|
358 |
$output = ob_get_contents();
|
359 |
ob_end_clean();
|
360 |
return $output;
|
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.2.1
|
7 |
-
Stable tag: 1.2.0.
|
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 |
|
@@ -305,6 +305,16 @@ Google's AdSense TOS only allow allow three ad units, and three link units per p
|
|
305 |
|
306 |
You may find that your right sidebar ad doesn't show if you have too many ads. Google renders the ads in the order that they are in the HTML, and your right sidebar will be at the bottom of HTML. If you need your right sidebar AdSense ad you will have to limit the number of ads on the rest of the page from the 'Ad placement settings'.
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
= How can I show different ads for different categories? =
|
309 |
|
310 |
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).
|
@@ -374,7 +384,7 @@ Some extra information:
|
|
374 |
|
375 |
Expansion ideas:
|
376 |
* Show a default advert if no text file exists.
|
377 |
-
* Create multiple text files for each category and then randomly select one.
|
378 |
* Use different code for top, random or bottom ads. e.g. you could have liverpool_top.txt and liverpool_random.txt
|
379 |
|
380 |
= How can I show different ads for different post authors? =
|
@@ -485,7 +495,7 @@ Solution: Follow the below advice for the 'theme conflicts'.
|
|
485 |
|
486 |
= Are there any known theme conflicts? =
|
487 |
|
488 |
-
Ad Injection (when
|
489 |
|
490 |
Themes which I know have this issue include 'Avenue', 'TheTravelTheme' and 'Vectors'.
|
491 |
|
@@ -493,6 +503,16 @@ Themes which I know have this issue include 'Avenue', 'TheTravelTheme' and 'Vect
|
|
493 |
|
494 |
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.
|
495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
= Some technical details =
|
497 |
|
498 |
* Plugin stores all its settings in a single option (adinj_options).
|
@@ -587,6 +607,12 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
|
|
587 |
|
588 |
== Changelog ==
|
589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
= 1.2.0.5 =
|
591 |
* Fix: Problem with adinjblocked cookie reading.
|
592 |
|
@@ -808,6 +834,12 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
|
|
808 |
|
809 |
== Upgrade Notice ==
|
810 |
|
|
|
|
|
|
|
|
|
|
|
|
|
811 |
= 1.2.0.5 =
|
812 |
* Fix: Problem with adinjblocked cookie reading.
|
813 |
|
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.1
|
7 |
+
Stable tag: 1.2.0.6
|
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 |
|
305 |
|
306 |
You may find that your right sidebar ad doesn't show if you have too many ads. Google renders the ads in the order that they are in the HTML, and your right sidebar will be at the bottom of HTML. If you need your right sidebar AdSense ad you will have to limit the number of ads on the rest of the page from the 'Ad placement settings'.
|
307 |
|
308 |
+
= How can I rotate more than 10 adverts? =
|
309 |
+
|
310 |
+
I am planning on making a change to allow an arbitrary number of adverts - this will probably be in 2012. Until then you have these 3 options:
|
311 |
+
|
312 |
+
1. Use PHP / JavaScript in the ad boxes to handle the rotation of the extra ads.
|
313 |
+
2. Use an ad service such as OpenX or Google Ad Manager in conjunction with Ad Injection. Ad Injection can handle the ad placement, and the ad service can manage your ad pool.
|
314 |
+
3. Hack Ad Injection to increase the limit (but be aware that if you upgrade your changes will be overwritten).
|
315 |
+
|
316 |
+
I'd recommend 1 or 2.
|
317 |
+
|
318 |
= How can I show different ads for different categories? =
|
319 |
|
320 |
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).
|
384 |
|
385 |
Expansion ideas:
|
386 |
* Show a default advert if no text file exists.
|
387 |
+
* Create multiple text files for each category and then randomly select one - an implementation of this is shown on [advancedhtml](http://www.advancedhtml.co.uk/advert-by-wordpress-post-category/ "advancedhtml")
|
388 |
* Use different code for top, random or bottom ads. e.g. you could have liverpool_top.txt and liverpool_random.txt
|
389 |
|
390 |
= How can I show different ads for different post authors? =
|
495 |
|
496 |
= Are there any known theme conflicts? =
|
497 |
|
498 |
+
Ad Injection (when injecting random ads) works by looking for the end paragraph tags (<p></p>). Some themes override the wpautop filter and set it to run after the plugins. This means that Ad Injection can't find the end paragraph tags, and so can't inject any random ads. If this happens try changing the the_content filter priority from the Advanced tab in the Ad Injection UI. Try values of 100, and if that doesn't work 200.
|
499 |
|
500 |
Themes which I know have this issue include 'Avenue', 'TheTravelTheme' and 'Vectors'.
|
501 |
|
503 |
|
504 |
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.
|
505 |
|
506 |
+
= Is there an easy way to copy my ad settings to a new blog? =
|
507 |
+
|
508 |
+
1. Go to phpMyAdmin, either from your web hosts control panel, or by using the very convenient 'Portable phpMyAdmin' plugin for WordPress on the blog that has your Ad Injection settings configured.
|
509 |
+
2. Open up the [yourdb]_options table.
|
510 |
+
3. Either find the adinj_options and widget_adinj rows or use this query to help you:
|
511 |
+
|
512 |
+
`SELECT * FROM [yourdb]_options WHERE option_name LIKE '%adinj%'`
|
513 |
+
|
514 |
+
4. Then copy these two options to your new blogs by using phpMyAdmin on the new blogs. If you aren't using widgets then you can ignore the widget_adinj option, you need only the adinj_options value. You can use the 'Insert' tab on the new blog to do this.
|
515 |
+
|
516 |
= Some technical details =
|
517 |
|
518 |
* Plugin stores all its settings in a single option (adinj_options).
|
607 |
|
608 |
== Changelog ==
|
609 |
|
610 |
+
= 1.2.0.6 =
|
611 |
+
* Fix problem with debug output.
|
612 |
+
* Reduce memory on admin side for blogs with large numbers of tags.
|
613 |
+
* More detailed debug for PHP exec errors.
|
614 |
+
* Colour debug table changes.
|
615 |
+
|
616 |
= 1.2.0.5 =
|
617 |
* Fix: Problem with adinjblocked cookie reading.
|
618 |
|
834 |
|
835 |
== Upgrade Notice ==
|
836 |
|
837 |
+
= 1.2.0.6 =
|
838 |
+
* Fix problem with debug output.
|
839 |
+
* Reduce memory on admin side for blogs with large numbers of tags.
|
840 |
+
* More detailed debug for PHP exec errors.
|
841 |
+
* Colour debug table changes.
|
842 |
+
|
843 |
= 1.2.0.5 =
|
844 |
* Fix: Problem with adinjblocked cookie reading.
|
845 |
|
ui-tab-debug.php
CHANGED
@@ -61,12 +61,15 @@ function adinj_debug_information(){
|
|
61 |
}
|
62 |
echo "$key";
|
63 |
$main_length += sizeof($key);
|
64 |
-
echo "</td><td>";
|
65 |
$value = htmlspecialchars($value);
|
66 |
$main_length += sizeof($value);
|
67 |
-
|
|
|
|
|
|
|
|
|
68 |
echo "</td><td>";
|
69 |
-
echo $
|
70 |
echo "</td></tr>";
|
71 |
$count++;
|
72 |
}
|
61 |
}
|
62 |
echo "$key";
|
63 |
$main_length += sizeof($key);
|
|
|
64 |
$value = htmlspecialchars($value);
|
65 |
$main_length += sizeof($value);
|
66 |
+
$default = $default_options[$key];
|
67 |
+
echo "</td><td>";
|
68 |
+
if ($value != $default) echo '<font color="blue">';
|
69 |
+
echo $value;
|
70 |
+
if ($value != $default) echo '</font>';
|
71 |
echo "</td><td>";
|
72 |
+
echo $default;
|
73 |
echo "</td></tr>";
|
74 |
$count++;
|
75 |
}
|