Version Description
- UI fix for WordPress 3.2
- fix for users who are running PHP with no UTF8 support
- file error code message fix
Download this release
Release Info
Developer | reviewmylife |
Plugin | Ad Injection |
Version | 0.9.7.10 |
Comparing to | |
See all releases |
Code changes from version 0.9.7.9 to 0.9.7.10
- ad-injection-admin.php +4 -3
- ad-injection.php +6 -2
- readme.txt +42 -2
- ui-tab-main.php +70 -67
ad-injection-admin.php
CHANGED
@@ -199,7 +199,7 @@ function adinj_chmod($path, $permission){
|
|
199 |
$oldperm = substr(decoct(@fileperms($path)), -3);
|
200 |
$newperm = decoct($permission);
|
201 |
if ($newperm == $oldperm) return;
|
202 |
-
@chmod($path, $permission) or $adinj_warning_msg_chmod .= "<br />Warning: chmod $
|
203 |
"on $path failed. Current permissions: $oldperm<br /> Try manually updating the permission if problems occur.";
|
204 |
}
|
205 |
|
@@ -324,6 +324,7 @@ function adinj_top_message_box(){
|
|
324 |
}
|
325 |
global $adinj_warning_msg_chmod;
|
326 |
if (!empty($adinj_warning_msg_chmod)){
|
|
|
327 |
echo '<br />Info: Some warnings were generated by chmod. See the <a href="?page=ad-injection&tab=debug#debugging">debugging</a> section for more info.';
|
328 |
}
|
329 |
if ($ops['ads_enabled'] != 'on'){
|
@@ -333,7 +334,7 @@ function adinj_top_message_box(){
|
|
333 |
|
334 |
} else if (!isset($_GET['tab'])){
|
335 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
336 |
-
echo "
|
337 |
echo '</strong></p></div>';
|
338 |
}
|
339 |
}
|
@@ -357,7 +358,7 @@ function adinj_side_info_box(){
|
|
357 |
<p>You are responsible for making sure the ad settings and positioning you define are in compliance with your ad provider's terms of service! Failure to do so could get you banned by them!</p>
|
358 |
|
359 |
<h4><font color="red">In developement</font></h4>
|
360 |
-
<p>
|
361 |
|
362 |
<h4>More by this author</h4>
|
363 |
<ul>
|
199 |
$oldperm = substr(decoct(@fileperms($path)), -3);
|
200 |
$newperm = decoct($permission);
|
201 |
if ($newperm == $oldperm) return;
|
202 |
+
@chmod($path, $permission) or $adinj_warning_msg_chmod .= "<br />Warning: chmod $newperm " .
|
203 |
"on $path failed. Current permissions: $oldperm<br /> Try manually updating the permission if problems occur.";
|
204 |
}
|
205 |
|
324 |
}
|
325 |
global $adinj_warning_msg_chmod;
|
326 |
if (!empty($adinj_warning_msg_chmod)){
|
327 |
+
// TODO this adinj_warning_msg_chmod msg is no longer being shown
|
328 |
echo '<br />Info: Some warnings were generated by chmod. See the <a href="?page=ad-injection&tab=debug#debugging">debugging</a> section for more info.';
|
329 |
}
|
330 |
if ($ops['ads_enabled'] != 'on'){
|
334 |
|
335 |
} else if (!isset($_GET['tab'])){
|
336 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
337 |
+
echo "17th June 2011: UI fixes for WordPress 3.2 and other minor updates. 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>.';
|
338 |
echo '</strong></p></div>';
|
339 |
}
|
340 |
}
|
358 |
<p>You are responsible for making sure the ad settings and positioning you define are in compliance with your ad provider's terms of service! Failure to do so could get you banned by them!</p>
|
359 |
|
360 |
<h4><font color="red">In developement</font></h4>
|
361 |
+
<p>I'm actively listening to your feedback and fixing any problems, and will hopefully be adding new features later in 2011. Please let me know if you like the plugin too!</p>
|
362 |
|
363 |
<h4>More by this author</h4>
|
364 |
<ul>
|
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
|
@@ -806,7 +806,11 @@ function adinj_content_hook($content){
|
|
806 |
//http://php.net/manual/en/function.str-word-count.php
|
807 |
define("WORD_COUNT_MASK", "/\p{L}[\p{L}\p{Mn}\p{Pd}'\x{2019}]*/u");
|
808 |
function str_word_count_utf8($str){
|
809 |
-
|
|
|
|
|
|
|
|
|
810 |
}
|
811 |
|
812 |
function adinj_paragraph_to_start_ads(){
|
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.10
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
806 |
//http://php.net/manual/en/function.str-word-count.php
|
807 |
define("WORD_COUNT_MASK", "/\p{L}[\p{L}\p{Mn}\p{Pd}'\x{2019}]*/u");
|
808 |
function str_word_count_utf8($str){
|
809 |
+
if (@preg_match('/\pL/u', 'a') == 1) { // check if utf8 support is compile in
|
810 |
+
return preg_match_all(WORD_COUNT_MASK, $str, $matches);
|
811 |
+
} else {
|
812 |
+
return str_word_count($str);
|
813 |
+
}
|
814 |
}
|
815 |
|
816 |
function adinj_paragraph_to_start_ads(){
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: reviewmylife
|
|
3 |
Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-wordpress/
|
4 |
Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
|
5 |
Requires at least: 2.8.6
|
6 |
-
Tested up to: 3.
|
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 |
|
@@ -205,6 +205,12 @@ Yes you can do this, there are two ways.
|
|
205 |
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.
|
206 |
2. Alternatively use the global exclude options at the top to exclude ads from all page types except the home page.
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
= How do I stop adverts from appearing on my contacts form page? =
|
209 |
|
210 |
To stop ads appearing on the contact page (or any other post/page) you have many of options. Here are three to choose from:
|
@@ -268,6 +274,8 @@ See http://codex.wordpress.org/Function_Reference/in_category for more informati
|
|
268 |
|
269 |
You can do the same for tags using has_tag. See http://codex.wordpress.org/Function_Reference/has_tag for info.
|
270 |
|
|
|
|
|
271 |
= How can I show different ads for different post authors? =
|
272 |
|
273 |
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.
|
@@ -299,6 +307,22 @@ Global advert
|
|
299 |
|
300 |
You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
= How can I sell my ads / track my ad clicks? =
|
303 |
|
304 |
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.
|
@@ -346,6 +370,12 @@ Here are some things to check if the ads are not appearing, or are appearing whe
|
|
346 |
5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
|
347 |
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.
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
= If you are using a caching plugin =
|
350 |
|
351 |
1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
|
@@ -393,6 +423,12 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
|
|
393 |
|
394 |
== Changelog ==
|
395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
= 0.9.7.9 =
|
397 |
* Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
|
398 |
* New option to randomly pick again from pool for each random ad position.
|
@@ -557,6 +593,10 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
|
|
557 |
|
558 |
== Upgrade Notice ==
|
559 |
|
|
|
|
|
|
|
|
|
560 |
= 0.9.7.9 =
|
561 |
* New options to disable last paragraph random ad, re-pick random ad for each position, and other minor fixes.
|
562 |
|
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.10
|
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 |
|
205 |
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.
|
206 |
2. Alternatively use the global exclude options at the top to exclude ads from all page types except the home page.
|
207 |
|
208 |
+
= Why aren't adverts appearing on my front / home / archives page? =
|
209 |
+
|
210 |
+
Ads will only appear if your front, home or archives page if you show the full post - not if you show excerpts*.
|
211 |
+
|
212 |
+
* 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.
|
213 |
+
|
214 |
= How do I stop adverts from appearing on my contacts form page? =
|
215 |
|
216 |
To stop ads appearing on the contact page (or any other post/page) you have many of options. Here are three to choose from:
|
274 |
|
275 |
You can do the same for tags using has_tag. See http://codex.wordpress.org/Function_Reference/has_tag for info.
|
276 |
|
277 |
+
Note - this will only work in direct insertion mode.
|
278 |
+
|
279 |
= How can I show different ads for different post authors? =
|
280 |
|
281 |
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.
|
307 |
|
308 |
You can download the Country Filter plugin from http://wordpress.org/extend/plugins/country-filter/
|
309 |
|
310 |
+
= If I restrict a widget to both a category and a tag it doesn't appear in the relevant category/tag archives. Why? =
|
311 |
+
|
312 |
+
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.
|
313 |
+
|
314 |
+
A post in this category with that tag will work as you spotted.
|
315 |
+
|
316 |
+
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.
|
317 |
+
|
318 |
+
This means that if you add both a tag and a category restriction the ad won't appear in the tag or category archives.
|
319 |
+
|
320 |
+
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.
|
321 |
+
|
322 |
+
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.
|
323 |
+
|
324 |
+
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.
|
325 |
+
|
326 |
= How can I sell my ads / track my ad clicks? =
|
327 |
|
328 |
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.
|
370 |
5. Have you selected the correct insertion mode in the 'Ad insertion mode' section?
|
371 |
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.
|
372 |
|
373 |
+
= If ads aren't appearing on your archive (category, tag, author) pages =
|
374 |
+
|
375 |
+
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.
|
376 |
+
|
377 |
+
I hope to add proper support for ads in excerpts in a later release.
|
378 |
+
|
379 |
= If you are using a caching plugin =
|
380 |
|
381 |
1. Have you enabled Ad Injection's 'mfunc' mode? (in the Ad insertion mode and dynamic ad display restrictions pane)
|
423 |
|
424 |
== Changelog ==
|
425 |
|
426 |
+
= 0.9.7.10 =
|
427 |
+
|
428 |
+
* UI fix for WordPress 3.2
|
429 |
+
* fix for users who are running PHP with no UTF8 support
|
430 |
+
* file error code message fix
|
431 |
+
|
432 |
= 0.9.7.9 =
|
433 |
* Add option to prevent random ad from appearing on last paragraph (to prevent it overlapping bottom ad).
|
434 |
* New option to randomly pick again from pool for each random ad position.
|
593 |
|
594 |
== Upgrade Notice ==
|
595 |
|
596 |
+
= 0.9.7.10 =
|
597 |
+
|
598 |
+
* UI fix for WordPress 3.2 and fix for users who are running PHP with no UTF8 support.
|
599 |
+
|
600 |
= 0.9.7.9 =
|
601 |
* New options to disable last paragraph random ad, re-pick random ad for each position, and other minor fixes.
|
602 |
|
ui-tab-main.php
CHANGED
@@ -12,58 +12,8 @@ function adinj_tab_main(){
|
|
12 |
|
13 |
<p><a href="#adsettings">Ad Placement settings</a> | <a href="#adverts">Adverts</a> | <a href="#restrictions">Ad insert mode/dynamic restrictions</a> | <a href="#docsquickstart">Quick Start</a> | <a href="#testads">Test ads</a></p>
|
14 |
|
15 |
-
<?php
|
16 |
|
17 |
-
<p>These settings apply to all ads (random, top, bottom, and widget). They will override all other settings.</p>
|
18 |
-
|
19 |
-
<input type="radio" name="ads_enabled" value="on" <?php if ($ops['ads_enabled']=='on') echo 'checked="checked"'; ?> /> <b>On: <?php _e('Ads enabled', 'adinj') ?></b><br />
|
20 |
-
<input type="radio" name="ads_enabled" value="off" <?php if ($ops['ads_enabled']=='off' || $ops['ads_enabled']=='') echo 'checked="checked"'; ?> /> <b>Off</b><br />
|
21 |
-
<input type="radio" name="ads_enabled" value="test" <?php if ($ops['ads_enabled']=='test') echo 'checked="checked"'; ?> /> <b>Test mode</b> - Only show ads to admin.<br />
|
22 |
-
|
23 |
-
<script type="text/javascript">
|
24 |
-
jQuery(document).ready(function(){
|
25 |
-
jQuery('input[name=ads_enabled]:radio').change(function() {
|
26 |
-
if (jQuery('input[name=ads_enabled]:checked').val() == "test"){
|
27 |
-
jQuery('#test_mode_warning').slideDown(500);
|
28 |
-
} else {
|
29 |
-
jQuery('#test_mode_warning').slideUp(500);
|
30 |
-
}
|
31 |
-
return true;
|
32 |
-
});
|
33 |
-
});
|
34 |
-
if ('<?php echo $ops['ads_enabled'] ?>' != 'test') {
|
35 |
-
document.write('<style type="text/css">#test_mode_warning { display: none; }</style>');
|
36 |
-
}
|
37 |
-
</script>
|
38 |
-
<div id="test_mode_warning"><span style="font-size:10px;color:red;">Warning: Turn any caching plugin *off* before using test mode. If you leave the caching plugin on, the test adverts will be cached and shown to your real visitors.</span><br /></div>
|
39 |
-
|
40 |
-
<style type="text/css">
|
41 |
-
.adinjtable td { vertical-align: top; }
|
42 |
-
</style>
|
43 |
-
|
44 |
-
<table border="0" class="adinjtable">
|
45 |
-
<tr>
|
46 |
-
<td><p><?php _e("Only show ads on pages older than ", 'adinj') ?></p></td>
|
47 |
-
<td>
|
48 |
-
<p>
|
49 |
-
<select name='ads_on_page_older_than'>
|
50 |
-
<?php
|
51 |
-
$older_than_days = array(0, 1, 2, 3, 5, 7, 10, 14, 21, 28, 40, 50);
|
52 |
-
for ($value=0; $value<sizeof($older_than_days); ++$value){
|
53 |
-
echo "<option value=\"$older_than_days[$value]\" ";
|
54 |
-
if($ops['ads_on_page_older_than'] == $older_than_days[$value]) echo 'selected="selected"';
|
55 |
-
echo ">$older_than_days[$value]</option>";
|
56 |
-
}
|
57 |
-
?>
|
58 |
-
</select><?php _e(" (days)", 'adinj') ?> - only for single posts and pages</p>
|
59 |
-
</td></tr>
|
60 |
-
</table>
|
61 |
-
<?php
|
62 |
-
adinj_condition_tables('global_', 'ui_conditions_show');
|
63 |
-
adinj_postbox_end();
|
64 |
-
?>
|
65 |
-
|
66 |
-
|
67 |
|
68 |
<?php adinj_postbox_start(__("Ad placement settings", 'adinj'), 'adsettings'); ?>
|
69 |
<p><b>Exclude ads from page types</b></p>
|
@@ -112,7 +62,7 @@ function adinj_tab_main(){
|
|
112 |
<tr><td>Only show top ad on posts longer than:</td><td>
|
113 |
<?php
|
114 |
$unit = adinj_counting_unit_description();
|
115 |
-
$ad_if_longer_settings = array('d','a',100,200,300,500,1000,1500,2000,2500,3000,5000,10000,20000);
|
116 |
adinj_selection_box("top_ad_if_longer_than", $ad_if_longer_settings, $unit);
|
117 |
echo '</td><td>';
|
118 |
adinj_selection_box("home_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
|
@@ -165,7 +115,7 @@ function adinj_tab_main(){
|
|
165 |
_e("Always put the first ad immediately after paragraph: ", 'adinj');
|
166 |
echo '</td><td>';
|
167 |
adinj_selection_box("start_from_paragraph", array(ADINJ_RULE_DISABLED,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
|
168 |
-
echo '</tr
|
169 |
?>
|
170 |
</table>
|
171 |
</td></tr>
|
@@ -284,10 +234,72 @@ function adinj_tab_main(){
|
|
284 |
|
285 |
<?php adinj_postbox_end(); ?>
|
286 |
|
|
|
|
|
|
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
|
|
|
|
|
|
|
|
289 |
|
290 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
<h4>Ad insertion mode</h4>
|
292 |
<blockquote>
|
293 |
<input type="radio" name="ad_insertion_mode" value="mfunc" <?php if (adinj_mfunc_mode()) echo 'checked="checked"'; ?> /> <b>mfunc: Insert ads using cache compatible mfunc tags</b> - Dynamic features will work with WP Super Cache, W3 Total Cache and WP Cache. Only select this mode if you are using one of those caching plugins and want to use dynamic features (IP / referrer restriction, alt content and ad roatation). If you aren't using dynamic features select direct mode.
|
@@ -319,7 +331,7 @@ function adinj_tab_main(){
|
|
319 |
|
320 |
<input type="radio" name="ad_insertion_mode" value="direct" <?php if (adinj_direct_mode()) echo 'checked="checked"'; ?> /> <b>direct: Direct ad code insertion</b> - Select this if you are not using an mfunc compatible caching plugin OR if you are not using the dynamic features.<br />
|
321 |
</blockquote>
|
322 |
-
|
323 |
<p></p>
|
324 |
|
325 |
<script type="text/javascript">
|
@@ -358,16 +370,7 @@ function adinj_tab_main(){
|
|
358 |
</blockquote>
|
359 |
</div>
|
360 |
|
361 |
-
|
362 |
-
<?php adinj_postbox_end(); ?>
|
363 |
-
|
364 |
-
<br clear="all" />
|
365 |
-
|
366 |
-
<?php
|
367 |
-
|
368 |
-
adinj_docs();
|
369 |
-
|
370 |
-
adinj_testads();
|
371 |
}
|
372 |
|
373 |
function adinj_add_exclude_row($name, $prefix=''){
|
@@ -391,7 +394,7 @@ function adinj_random_ad_limit_table(){
|
|
391 |
<?php
|
392 |
$prefixes = array("", "home_", "archive_");
|
393 |
$unit = adinj_counting_unit_description();
|
394 |
-
$ad_limit_settings = array(ADINJ_RULE_DISABLED,100,200,300,500,1000,1500,2000,2500,3000);
|
395 |
|
396 |
foreach ($prefixes as $prefix){
|
397 |
echo '<td>';
|
@@ -525,7 +528,7 @@ function adinj_side_status_box(){
|
|
525 |
|
526 |
<tr><td colspan="2">
|
527 |
<p></p>
|
528 |
-
<b>Ad summary</
|
529 |
<table class="adinjstatustable">
|
530 |
<tr>
|
531 |
<td></td>
|
12 |
|
13 |
<p><a href="#adsettings">Ad Placement settings</a> | <a href="#adverts">Adverts</a> | <a href="#restrictions">Ad insert mode/dynamic restrictions</a> | <a href="#docsquickstart">Quick Start</a> | <a href="#testads">Test ads</a></p>
|
14 |
|
15 |
+
<?php adinj_global_settings_box($ops); ?>
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
<?php adinj_postbox_start(__("Ad placement settings", 'adinj'), 'adsettings'); ?>
|
19 |
<p><b>Exclude ads from page types</b></p>
|
62 |
<tr><td>Only show top ad 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);
|
66 |
adinj_selection_box("top_ad_if_longer_than", $ad_if_longer_settings, $unit);
|
67 |
echo '</td><td>';
|
68 |
adinj_selection_box("home_top_ad_if_longer_than", $ad_if_longer_settings, $unit);
|
115 |
_e("Always put the first ad immediately after paragraph: ", 'adinj');
|
116 |
echo '</td><td>';
|
117 |
adinj_selection_box("start_from_paragraph", array(ADINJ_RULE_DISABLED,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), " ");
|
118 |
+
echo '</td></tr>';
|
119 |
?>
|
120 |
</table>
|
121 |
</td></tr>
|
234 |
|
235 |
<?php adinj_postbox_end(); ?>
|
236 |
|
237 |
+
<?php adinj_insertion_mode_box($ops); ?>
|
238 |
+
|
239 |
+
<br clear="all" />
|
240 |
|
241 |
+
<?php
|
242 |
+
|
243 |
+
adinj_docs();
|
244 |
+
|
245 |
+
adinj_testads();
|
246 |
+
}
|
247 |
|
248 |
+
function adinj_global_settings_box($ops){
|
249 |
+
adinj_postbox_start(__("Global settings", 'adinj'), 'global'); ?>
|
250 |
+
|
251 |
+
<p>These settings apply to all ads (random, top, bottom, and widget). They will override all other settings.</p>
|
252 |
|
253 |
+
<input type="radio" name="ads_enabled" value="on" <?php if ($ops['ads_enabled']=='on') echo 'checked="checked"'; ?> /> <b>On: <?php _e('Ads enabled', 'adinj') ?></b><br />
|
254 |
+
<input type="radio" name="ads_enabled" value="off" <?php if ($ops['ads_enabled']=='off' || $ops['ads_enabled']=='') echo 'checked="checked"'; ?> /> <b>Off</b><br />
|
255 |
+
<input type="radio" name="ads_enabled" value="test" <?php if ($ops['ads_enabled']=='test') echo 'checked="checked"'; ?> /> <b>Test mode</b> - Only show ads to admin.<br />
|
256 |
+
|
257 |
+
<script type="text/javascript">
|
258 |
+
jQuery(document).ready(function(){
|
259 |
+
jQuery('input[name=ads_enabled]:radio').change(function() {
|
260 |
+
if (jQuery('input[name=ads_enabled]:checked').val() == "test"){
|
261 |
+
jQuery('#test_mode_warning').slideDown(500);
|
262 |
+
} else {
|
263 |
+
jQuery('#test_mode_warning').slideUp(500);
|
264 |
+
}
|
265 |
+
return true;
|
266 |
+
});
|
267 |
+
});
|
268 |
+
if ('<?php echo $ops['ads_enabled'] ?>' != 'test') {
|
269 |
+
document.write('<style type="text/css">#test_mode_warning { display: none; }</style>');
|
270 |
+
}
|
271 |
+
</script>
|
272 |
+
<div id="test_mode_warning"><span style="font-size:10px;color:red;">Warning: Turn any caching plugin *off* before using test mode. If you leave the caching plugin on, the test adverts will be cached and shown to your real visitors.</span><br /></div>
|
273 |
+
|
274 |
+
<style type="text/css">
|
275 |
+
.adinjtable td { vertical-align: top; }
|
276 |
+
</style>
|
277 |
+
|
278 |
+
<table border="0" class="adinjtable">
|
279 |
+
<tr>
|
280 |
+
<td><p><?php _e("Only show ads on pages older than ", 'adinj') ?></p></td>
|
281 |
+
<td>
|
282 |
+
<p>
|
283 |
+
<select name='ads_on_page_older_than'>
|
284 |
+
<?php
|
285 |
+
$older_than_days = array(0, 1, 2, 3, 5, 7, 10, 14, 21, 28, 40, 50);
|
286 |
+
for ($value=0; $value<sizeof($older_than_days); ++$value){
|
287 |
+
echo "<option value=\"$older_than_days[$value]\" ";
|
288 |
+
if($ops['ads_on_page_older_than'] == $older_than_days[$value]) echo 'selected="selected"';
|
289 |
+
echo ">$older_than_days[$value]</option>";
|
290 |
+
}
|
291 |
+
?>
|
292 |
+
</select><?php _e(" (days)", 'adinj') ?> - only for single posts and pages</p>
|
293 |
+
</td></tr>
|
294 |
+
</table>
|
295 |
+
<?php
|
296 |
+
adinj_condition_tables('global_', 'ui_conditions_show');
|
297 |
+
//TODO sometimes OOM here - just before drop down list is loaded
|
298 |
+
adinj_postbox_end();
|
299 |
+
}
|
300 |
+
|
301 |
+
function adinj_insertion_mode_box($ops){
|
302 |
+
adinj_postbox_start(__("Ad insertion mode and dynamic ad display restrictions", 'adinj'), 'restrictions'); ?>
|
303 |
<h4>Ad insertion mode</h4>
|
304 |
<blockquote>
|
305 |
<input type="radio" name="ad_insertion_mode" value="mfunc" <?php if (adinj_mfunc_mode()) echo 'checked="checked"'; ?> /> <b>mfunc: Insert ads using cache compatible mfunc tags</b> - Dynamic features will work with WP Super Cache, W3 Total Cache and WP Cache. Only select this mode if you are using one of those caching plugins and want to use dynamic features (IP / referrer restriction, alt content and ad roatation). If you aren't using dynamic features select direct mode.
|
331 |
|
332 |
<input type="radio" name="ad_insertion_mode" value="direct" <?php if (adinj_direct_mode()) echo 'checked="checked"'; ?> /> <b>direct: Direct ad code insertion</b> - Select this if you are not using an mfunc compatible caching plugin OR if you are not using the dynamic features.<br />
|
333 |
</blockquote>
|
334 |
+
|
335 |
<p></p>
|
336 |
|
337 |
<script type="text/javascript">
|
370 |
</blockquote>
|
371 |
</div>
|
372 |
|
373 |
+
<?php adinj_postbox_end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
|
376 |
function adinj_add_exclude_row($name, $prefix=''){
|
394 |
<?php
|
395 |
$prefixes = array("", "home_", "archive_");
|
396 |
$unit = adinj_counting_unit_description();
|
397 |
+
$ad_limit_settings = array(ADINJ_RULE_DISABLED,100,200,300,500,1000,1500,2000,2500,3000,5000,10000,15000,20000);
|
398 |
|
399 |
foreach ($prefixes as $prefix){
|
400 |
echo '<td>';
|
528 |
|
529 |
<tr><td colspan="2">
|
530 |
<p></p>
|
531 |
+
<b>Ad summary</b><br />
|
532 |
<table class="adinjstatustable">
|
533 |
<tr>
|
534 |
<td></td>
|