Version Description
- Add 'words' to content length counting options.
- Fixes for categories/tags and ads with UTF-8 characters.
- Search/404 exclusion options for global and widget settngs.
- Ad pool size for top/random/bottom ads increased to 10.
Download this release
Release Info
Developer | reviewmylife |
Plugin | Ad Injection |
Version | 0.9.6.5 |
Comparing to | |
See all releases |
Code changes from version 0.9.6.4 to 0.9.6.5
- ad-injection-admin.php +66 -36
- ad-injection-widget.php +20 -3
- ad-injection.php +42 -29
- readme.txt +9 -3
- ui-tab-adrotation.php +3 -3
- ui-tab-main.php +46 -22
ad-injection-admin.php
CHANGED
@@ -56,9 +56,9 @@ function adinj_save_options(){
|
|
56 |
}
|
57 |
}
|
58 |
|
59 |
-
extract_text_args('ad_code_random_', $ops, 1,
|
60 |
-
extract_text_args('ad_code_top_', $ops, 1,
|
61 |
-
extract_text_args('ad_code_bottom_', $ops, 1,
|
62 |
|
63 |
extract_text_args('ad_code_random_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_random_alt_');
|
64 |
extract_text_args('ad_code_top_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_top_alt_');
|
@@ -83,6 +83,9 @@ function adinj_save_options(){
|
|
83 |
case 'Delete settings from DB':
|
84 |
adinj_checkNonce();
|
85 |
delete_option('adinj_options');
|
|
|
|
|
|
|
86 |
|
87 |
case 'Delete widget settings from DB':
|
88 |
adinj_checkNonce();
|
@@ -289,7 +292,7 @@ function adinj_top_message_box(){
|
|
289 |
|
290 |
} else {
|
291 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
292 |
-
echo "
|
293 |
echo '</strong></p></div>';
|
294 |
}
|
295 |
}
|
@@ -435,7 +438,9 @@ function adinj_get_status($name){
|
|
435 |
$ops['exclude_home'] == 'on' &&
|
436 |
$ops['exclude_page'] == 'on' &&
|
437 |
$ops['exclude_single'] == 'on' &&
|
438 |
-
$ops['exclude_archive'] == 'on'
|
|
|
|
|
439 |
$status[0] = 'red';
|
440 |
$status[1] = 'excluded from all';
|
441 |
return $status;
|
@@ -529,7 +534,9 @@ function adinj_get_status($name){
|
|
529 |
$ops['widget_exclude_home'] == 'on' &&
|
530 |
$ops['widget_exclude_page'] == 'on' &&
|
531 |
$ops['widget_exclude_single'] == 'on' &&
|
532 |
-
$ops['widget_exclude_archive'] == 'on'
|
|
|
|
|
533 |
$status[0] = 'red';
|
534 |
$status[1] = 'exclude from all';
|
535 |
} else {
|
@@ -576,7 +583,7 @@ function adinj_dot($colour){
|
|
576 |
return '<span style="color:'.$colour.'">●</span>';
|
577 |
}
|
578 |
|
579 |
-
function adinj_selection_box($name, $values, $type=
|
580 |
$associative = false;
|
581 |
if (!array_key_exists(0, $values)){
|
582 |
// Very naive test but works for me.
|
@@ -595,13 +602,9 @@ function adinj_selection_box($name, $values, $type=NULL, $selected_value=NULL){
|
|
595 |
$option_value = $key;
|
596 |
}
|
597 |
echo "<option value=\"$option_value\" ";
|
598 |
-
if($selected_value ==
|
599 |
-
|
600 |
-
|
601 |
-
} else {
|
602 |
-
$typetxt = $type;
|
603 |
-
}
|
604 |
-
if (adinj_disabled($option_value)) $typetxt = "";
|
605 |
echo ">$value $typetxt</option>";
|
606 |
}
|
607 |
echo "</select>";
|
@@ -630,8 +633,9 @@ function adinj_condition_table($name, $description, $type){
|
|
630 |
<?php
|
631 |
$categories = get_categories();
|
632 |
foreach ($categories as $category) {
|
633 |
-
$
|
634 |
-
$option
|
|
|
635 |
$option .= ' ('.$category->category_count.')';
|
636 |
$option .= '</option>';
|
637 |
echo $option;
|
@@ -648,8 +652,9 @@ function adinj_condition_table($name, $description, $type){
|
|
648 |
<?php
|
649 |
$tags = get_tags();
|
650 |
foreach ($tags as $tag) {
|
651 |
-
$
|
652 |
-
$option
|
|
|
653 |
$option .= ' ('.$tag->count.')';
|
654 |
$option .= '</option>';
|
655 |
echo $option;
|
@@ -905,6 +910,14 @@ function adinj_upgrade_db(){
|
|
905 |
$new_options['content_length_unit'] = 'all';
|
906 |
}
|
907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
// 3. Bump up db version number.
|
909 |
$new_options['db_version'] = $new_dbversion;
|
910 |
|
@@ -918,23 +931,6 @@ function adinj_upgrade_db(){
|
|
918 |
}
|
919 |
}
|
920 |
|
921 |
-
// If the options in the database are out of sync with our default options
|
922 |
-
// then the database options will need upgrading
|
923 |
-
function adinj_options_need_upgrading($stored_options){
|
924 |
-
$default_options = adinj_default_options();
|
925 |
-
foreach ($default_options as $key => $value){
|
926 |
-
if (!array_key_exists($key, $stored_options)){
|
927 |
-
return true;
|
928 |
-
}
|
929 |
-
}
|
930 |
-
foreach ($stored_options as $key => $value){
|
931 |
-
if (!array_key_exists($key, $default_options)){
|
932 |
-
return true;
|
933 |
-
}
|
934 |
-
}
|
935 |
-
return false;
|
936 |
-
}
|
937 |
-
|
938 |
// All these stored in a single DB option row
|
939 |
function adinj_default_options(){
|
940 |
return array(
|
@@ -946,22 +942,34 @@ function adinj_default_options(){
|
|
946 |
'exclude_page' => '',
|
947 |
'exclude_single' => '',
|
948 |
'exclude_archive' => '',
|
|
|
|
|
949 |
'global_category_condition_mode' => ADINJ_ONLY_SHOW_IN,
|
950 |
'global_category_condition_entries' => '',
|
951 |
'global_tag_condition_mode' => ADINJ_ONLY_SHOW_IN,
|
952 |
'global_tag_condition_entries' => '',
|
953 |
-
'content_length_unit' => '
|
954 |
// Random ads
|
955 |
'ad_code_random_1' => '',
|
956 |
'ad_code_random_2' => '',
|
957 |
'ad_code_random_3' => '',
|
958 |
'ad_code_random_4' => '',
|
959 |
'ad_code_random_5' => '',
|
|
|
|
|
|
|
|
|
|
|
960 |
'ad_code_random_1_split' => '100',
|
961 |
'ad_code_random_2_split' => '100',
|
962 |
'ad_code_random_3_split' => '100',
|
963 |
'ad_code_random_4_split' => '100',
|
964 |
'ad_code_random_5_split' => '100',
|
|
|
|
|
|
|
|
|
|
|
965 |
'ad_code_random_alt_1' => '',
|
966 |
'ad_code_random_alt_2' => '',
|
967 |
'ad_code_random_alt_1_split' => '100',
|
@@ -994,11 +1002,21 @@ function adinj_default_options(){
|
|
994 |
'ad_code_top_3' => '',
|
995 |
'ad_code_top_4' => '',
|
996 |
'ad_code_top_5' => '',
|
|
|
|
|
|
|
|
|
|
|
997 |
'ad_code_top_1_split' => '100',
|
998 |
'ad_code_top_2_split' => '100',
|
999 |
'ad_code_top_3_split' => '100',
|
1000 |
'ad_code_top_4_split' => '100',
|
1001 |
'ad_code_top_5_split' => '100',
|
|
|
|
|
|
|
|
|
|
|
1002 |
'ad_code_top_alt_1' => '',
|
1003 |
'ad_code_top_alt_2' => '',
|
1004 |
'ad_code_top_alt_1_split' => '100',
|
@@ -1019,11 +1037,21 @@ function adinj_default_options(){
|
|
1019 |
'ad_code_bottom_3' => '',
|
1020 |
'ad_code_bottom_4' => '',
|
1021 |
'ad_code_bottom_5' => '',
|
|
|
|
|
|
|
|
|
|
|
1022 |
'ad_code_bottom_1_split' => '100',
|
1023 |
'ad_code_bottom_2_split' => '100',
|
1024 |
'ad_code_bottom_3_split' => '100',
|
1025 |
'ad_code_bottom_4_split' => '100',
|
1026 |
'ad_code_bottom_5_split' => '100',
|
|
|
|
|
|
|
|
|
|
|
1027 |
'ad_code_bottom_alt_1' => '',
|
1028 |
'ad_code_bottom_alt_2' => '',
|
1029 |
'ad_code_bottom_alt_1_split' => '100',
|
@@ -1044,6 +1072,8 @@ function adinj_default_options(){
|
|
1044 |
'widget_exclude_page' => '',
|
1045 |
'widget_exclude_single' => '',
|
1046 |
'widget_exclude_archive' => '',
|
|
|
|
|
1047 |
// dynamic features
|
1048 |
'ad_insertion_mode' => 'mfunc',
|
1049 |
'sevisitors_only' => 'off',
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
extract_text_args('ad_code_random_', $ops, 1, 10, ADINJ_AD_PATH.'/ad_random_');
|
60 |
+
extract_text_args('ad_code_top_', $ops, 1, 10, ADINJ_AD_PATH.'/ad_top_');
|
61 |
+
extract_text_args('ad_code_bottom_', $ops, 1, 10, ADINJ_AD_PATH.'/ad_bottom_');
|
62 |
|
63 |
extract_text_args('ad_code_random_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_random_alt_');
|
64 |
extract_text_args('ad_code_top_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_top_alt_');
|
83 |
case 'Delete settings from DB':
|
84 |
adinj_checkNonce();
|
85 |
delete_option('adinj_options');
|
86 |
+
adinj_install_db();
|
87 |
+
adinj_options(1);
|
88 |
+
break;
|
89 |
|
90 |
case 'Delete widget settings from DB':
|
91 |
adinj_checkNonce();
|
292 |
|
293 |
} else {
|
294 |
echo '<div id="message" class="updated below-h2"><p style="line-height:140%"><strong>';
|
295 |
+
echo "4th February 2011: There is a new content length counting method - you can now restrict ads by number of 'words'. The option is in the global settings. Also fixes for UTF-8 characters and search/404 restriction options. Plus ad pool size for top/random/bottom increased to 10. 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>.';
|
296 |
echo '</strong></p></div>';
|
297 |
}
|
298 |
}
|
438 |
$ops['exclude_home'] == 'on' &&
|
439 |
$ops['exclude_page'] == 'on' &&
|
440 |
$ops['exclude_single'] == 'on' &&
|
441 |
+
$ops['exclude_archive'] == 'on' &&
|
442 |
+
$ops['exclude_search'] == 'on' &&
|
443 |
+
$ops['exclude_404'] == 'on'){
|
444 |
$status[0] = 'red';
|
445 |
$status[1] = 'excluded from all';
|
446 |
return $status;
|
534 |
$ops['widget_exclude_home'] == 'on' &&
|
535 |
$ops['widget_exclude_page'] == 'on' &&
|
536 |
$ops['widget_exclude_single'] == 'on' &&
|
537 |
+
$ops['widget_exclude_archive'] == 'on' &&
|
538 |
+
$ops['widget_exclude_search'] == 'on' &&
|
539 |
+
$ops['widget_exclude_404'] == 'on'){
|
540 |
$status[0] = 'red';
|
541 |
$status[1] = 'exclude from all';
|
542 |
} else {
|
583 |
return '<span style="color:'.$colour.'">●</span>';
|
584 |
}
|
585 |
|
586 |
+
function adinj_selection_box($name, $values, $type="", $selected_value=NULL){
|
587 |
$associative = false;
|
588 |
if (!array_key_exists(0, $values)){
|
589 |
// Very naive test but works for me.
|
602 |
$option_value = $key;
|
603 |
}
|
604 |
echo "<option value=\"$option_value\" ";
|
605 |
+
if($selected_value == $option_value) echo 'selected="selected"';
|
606 |
+
$typetxt = $type;
|
607 |
+
if (adinj_disabled($option_value) || $option_value == ADINJ_ALWAYS_SHOW) $typetxt = "";
|
|
|
|
|
|
|
|
|
608 |
echo ">$value $typetxt</option>";
|
609 |
}
|
610 |
echo "</select>";
|
633 |
<?php
|
634 |
$categories = get_categories();
|
635 |
foreach ($categories as $category) {
|
636 |
+
$cat = rawurldecode($category->category_nicename);
|
637 |
+
$option = '<option value="'.$cat.'">';
|
638 |
+
$option .= $cat;
|
639 |
$option .= ' ('.$category->category_count.')';
|
640 |
$option .= '</option>';
|
641 |
echo $option;
|
652 |
<?php
|
653 |
$tags = get_tags();
|
654 |
foreach ($tags as $tag) {
|
655 |
+
$tagname = rawurldecode($tag->slug);
|
656 |
+
$option = '<option value="'.$tagname.'">';
|
657 |
+
$option .= $tagname;
|
658 |
$option .= ' ('.$tag->count.')';
|
659 |
$option .= '</option>';
|
660 |
echo $option;
|
910 |
$new_options['content_length_unit'] = 'all';
|
911 |
}
|
912 |
|
913 |
+
if ($stored_dbversion < 5){
|
914 |
+
// Maintain previous behaviour for users who upgrade
|
915 |
+
$new_options['exclude_search'] = 'on';
|
916 |
+
$new_options['exclude_404'] = 'on';
|
917 |
+
$new_options['widget_exclude_search'] = 'on';
|
918 |
+
$new_options['widget_exclude_404'] = 'on';
|
919 |
+
}
|
920 |
+
|
921 |
// 3. Bump up db version number.
|
922 |
$new_options['db_version'] = $new_dbversion;
|
923 |
|
931 |
}
|
932 |
}
|
933 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
// All these stored in a single DB option row
|
935 |
function adinj_default_options(){
|
936 |
return array(
|
942 |
'exclude_page' => '',
|
943 |
'exclude_single' => '',
|
944 |
'exclude_archive' => '',
|
945 |
+
'exclude_search' => 'on',
|
946 |
+
'exclude_404' => 'on',
|
947 |
'global_category_condition_mode' => ADINJ_ONLY_SHOW_IN,
|
948 |
'global_category_condition_entries' => '',
|
949 |
'global_tag_condition_mode' => ADINJ_ONLY_SHOW_IN,
|
950 |
'global_tag_condition_entries' => '',
|
951 |
+
'content_length_unit' => 'words',
|
952 |
// Random ads
|
953 |
'ad_code_random_1' => '',
|
954 |
'ad_code_random_2' => '',
|
955 |
'ad_code_random_3' => '',
|
956 |
'ad_code_random_4' => '',
|
957 |
'ad_code_random_5' => '',
|
958 |
+
'ad_code_random_6' => '',
|
959 |
+
'ad_code_random_7' => '',
|
960 |
+
'ad_code_random_8' => '',
|
961 |
+
'ad_code_random_9' => '',
|
962 |
+
'ad_code_random_10' => '',
|
963 |
'ad_code_random_1_split' => '100',
|
964 |
'ad_code_random_2_split' => '100',
|
965 |
'ad_code_random_3_split' => '100',
|
966 |
'ad_code_random_4_split' => '100',
|
967 |
'ad_code_random_5_split' => '100',
|
968 |
+
'ad_code_random_6_split' => '100',
|
969 |
+
'ad_code_random_7_split' => '100',
|
970 |
+
'ad_code_random_8_split' => '100',
|
971 |
+
'ad_code_random_9_split' => '100',
|
972 |
+
'ad_code_random_10_split' => '100',
|
973 |
'ad_code_random_alt_1' => '',
|
974 |
'ad_code_random_alt_2' => '',
|
975 |
'ad_code_random_alt_1_split' => '100',
|
1002 |
'ad_code_top_3' => '',
|
1003 |
'ad_code_top_4' => '',
|
1004 |
'ad_code_top_5' => '',
|
1005 |
+
'ad_code_top_6' => '',
|
1006 |
+
'ad_code_top_7' => '',
|
1007 |
+
'ad_code_top_8' => '',
|
1008 |
+
'ad_code_top_9' => '',
|
1009 |
+
'ad_code_top_10' => '',
|
1010 |
'ad_code_top_1_split' => '100',
|
1011 |
'ad_code_top_2_split' => '100',
|
1012 |
'ad_code_top_3_split' => '100',
|
1013 |
'ad_code_top_4_split' => '100',
|
1014 |
'ad_code_top_5_split' => '100',
|
1015 |
+
'ad_code_top_6_split' => '100',
|
1016 |
+
'ad_code_top_7_split' => '100',
|
1017 |
+
'ad_code_top_8_split' => '100',
|
1018 |
+
'ad_code_top_9_split' => '100',
|
1019 |
+
'ad_code_top_10_split' => '100',
|
1020 |
'ad_code_top_alt_1' => '',
|
1021 |
'ad_code_top_alt_2' => '',
|
1022 |
'ad_code_top_alt_1_split' => '100',
|
1037 |
'ad_code_bottom_3' => '',
|
1038 |
'ad_code_bottom_4' => '',
|
1039 |
'ad_code_bottom_5' => '',
|
1040 |
+
'ad_code_bottom_6' => '',
|
1041 |
+
'ad_code_bottom_7' => '',
|
1042 |
+
'ad_code_bottom_8' => '',
|
1043 |
+
'ad_code_bottom_9' => '',
|
1044 |
+
'ad_code_bottom_10' => '',
|
1045 |
'ad_code_bottom_1_split' => '100',
|
1046 |
'ad_code_bottom_2_split' => '100',
|
1047 |
'ad_code_bottom_3_split' => '100',
|
1048 |
'ad_code_bottom_4_split' => '100',
|
1049 |
'ad_code_bottom_5_split' => '100',
|
1050 |
+
'ad_code_bottom_6_split' => '100',
|
1051 |
+
'ad_code_bottom_7_split' => '100',
|
1052 |
+
'ad_code_bottom_8_split' => '100',
|
1053 |
+
'ad_code_bottom_9_split' => '100',
|
1054 |
+
'ad_code_bottom_10_split' => '100',
|
1055 |
'ad_code_bottom_alt_1' => '',
|
1056 |
'ad_code_bottom_alt_2' => '',
|
1057 |
'ad_code_bottom_alt_1_split' => '100',
|
1072 |
'widget_exclude_page' => '',
|
1073 |
'widget_exclude_single' => '',
|
1074 |
'widget_exclude_archive' => '',
|
1075 |
+
'widget_exclude_search' => '',
|
1076 |
+
'widget_exclude_404' => '',
|
1077 |
// dynamic features
|
1078 |
'ad_insertion_mode' => 'mfunc',
|
1079 |
'sevisitors_only' => 'off',
|
ad-injection-widget.php
CHANGED
@@ -6,7 +6,8 @@ http://www.reviewmylife.co.uk/
|
|
6 |
|
7 |
// 1 = original
|
8 |
// 2 = split testing / alt content
|
9 |
-
|
|
|
10 |
|
11 |
class Ad_Injection_Widget extends WP_Widget {
|
12 |
function Ad_Injection_Widget() {
|
@@ -22,7 +23,9 @@ class Ad_Injection_Widget extends WP_Widget {
|
|
22 |
(is_home() && adinj_ticked('widget_exclude_home')) ||
|
23 |
(is_page() && adinj_ticked('widget_exclude_page')) ||
|
24 |
(is_single() && adinj_ticked('widget_exclude_single')) ||
|
25 |
-
(is_archive() && adinj_ticked('widget_exclude_archive'))
|
|
|
|
|
26 |
return;
|
27 |
}
|
28 |
|
@@ -82,6 +85,20 @@ class Ad_Injection_Widget extends WP_Widget {
|
|
82 |
'advert_2_split' => '100',
|
83 |
'advert_3' => '',
|
84 |
'advert_3_split' => '100',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
'advert_alt_1' => '',
|
86 |
'advert_alt_1_split' => '100',
|
87 |
'advert_alt_2' => '',
|
@@ -98,7 +115,7 @@ class Ad_Injection_Widget extends WP_Widget {
|
|
98 |
'ui_alt_1_show' => 'false',
|
99 |
'ui_alt_2_show' => 'false',
|
100 |
//
|
101 |
-
'db_version' =>
|
102 |
);
|
103 |
}
|
104 |
|
6 |
|
7 |
// 1 = original
|
8 |
// 2 = split testing / alt content
|
9 |
+
// 3 = increase db rotation slots to 10 - no UI support yet
|
10 |
+
define('ADINJ_WIDGET_DB_VERSION', 3);
|
11 |
|
12 |
class Ad_Injection_Widget extends WP_Widget {
|
13 |
function Ad_Injection_Widget() {
|
23 |
(is_home() && adinj_ticked('widget_exclude_home')) ||
|
24 |
(is_page() && adinj_ticked('widget_exclude_page')) ||
|
25 |
(is_single() && adinj_ticked('widget_exclude_single')) ||
|
26 |
+
(is_archive() && adinj_ticked('widget_exclude_archive')) ||
|
27 |
+
(is_search() && adinj_ticked('widget_exclude_search')) ||
|
28 |
+
(is_404() && adinj_ticked('widget_exclude_404'))){
|
29 |
return;
|
30 |
}
|
31 |
|
85 |
'advert_2_split' => '100',
|
86 |
'advert_3' => '',
|
87 |
'advert_3_split' => '100',
|
88 |
+
'advert_4' => '',
|
89 |
+
'advert_4_split' => '100',
|
90 |
+
'advert_5' => '',
|
91 |
+
'advert_5_split' => '100',
|
92 |
+
'advert_6' => '',
|
93 |
+
'advert_6_split' => '100',
|
94 |
+
'advert_7' => '',
|
95 |
+
'advert_7_split' => '100',
|
96 |
+
'advert_8' => '',
|
97 |
+
'advert_8_split' => '100',
|
98 |
+
'advert_9' => '',
|
99 |
+
'advert_9_split' => '100',
|
100 |
+
'advert_10' => '',
|
101 |
+
'advert_10_split' => '100',
|
102 |
'advert_alt_1' => '',
|
103 |
'advert_alt_1_split' => '100',
|
104 |
'advert_alt_2' => '',
|
115 |
'ui_alt_1_show' => 'false',
|
116 |
'ui_alt_2_show' => 'false',
|
117 |
//
|
118 |
+
'db_version' => ADINJ_WIDGET_DB_VERSION
|
119 |
);
|
120 |
}
|
121 |
|
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.6.
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
@@ -21,7 +21,8 @@ define('ADINJ_NO_CONFIG_FILE', 1);
|
|
21 |
// 2 = split testing support
|
22 |
// 3 = added front options
|
23 |
// 4 = new character counting option
|
24 |
-
|
|
|
25 |
|
26 |
// Files
|
27 |
// TODO will these paths work on windows?
|
@@ -384,10 +385,16 @@ function adinj_adverts_disabled_flag(){
|
|
384 |
function adinj($content, $message){
|
385 |
if (!adinj_ticked('debug_mode')) return $content;
|
386 |
global $adinj_total_rand_ads_used, $adinj_total_all_ads_used;
|
387 |
-
$path = ADINJ_AD_PATH;
|
388 |
$ops = adinj_options();
|
389 |
$para = adinj_paragraph_to_start_ads();
|
390 |
$mode = $ops['ad_insertion_mode'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
return $content."
|
392 |
<!--
|
393 |
[ADINJ DEBUG]
|
@@ -395,8 +402,10 @@ $message
|
|
395 |
\$adinj_total_rand_ads_used=$adinj_total_rand_ads_used
|
396 |
\$adinj_total_all_ads_used=$adinj_total_all_ads_used
|
397 |
paragraphtostartads=$para (fyi: -1 is disabled)
|
|
|
|
|
|
|
398 |
injection mode=$mode
|
399 |
-
ADINJ_AD_PATH=$path
|
400 |
//-->\n";
|
401 |
}
|
402 |
|
@@ -413,10 +422,11 @@ function adinj_ads_completely_disabled_from_page($content=NULL){
|
|
413 |
// check for ads on certain page types being disabled
|
414 |
if (is_front_page() && adinj_ticked('exclude_front')){ return "NOADS: excluded from front page"; }
|
415 |
if (is_home() && adinj_ticked('exclude_home')){ return "NOADS: excluded from home page"; }
|
|
|
|
|
416 |
if ((is_page() && adinj_ticked('exclude_page')) ||
|
417 |
(is_single() && adinj_ticked('exclude_single')) ||
|
418 |
-
(is_archive() && adinj_ticked('exclude_archive'))
|
419 |
-
is_search() || is_404()){
|
420 |
return "NOADS: excluded from this page type: ".get_post_type();
|
421 |
}
|
422 |
|
@@ -426,10 +436,10 @@ function adinj_ads_completely_disabled_from_page($content=NULL){
|
|
426 |
// no ads on old posts/pages if rule is enabled
|
427 |
if((is_page() || is_single()) && !adinj_is_old_post()) return "NOADS: !is_old_post";
|
428 |
|
429 |
-
$category_ok = adinj_allowed_in_category('global');
|
430 |
if (!$category_ok) return "NOADS: blocked from category";
|
431 |
|
432 |
-
$tag_ok = adinj_allowed_in_tag('global');
|
433 |
if (!$tag_ok) return "NOADS: blocked from tag";
|
434 |
|
435 |
// manual ad disabling tags
|
@@ -442,8 +452,7 @@ function adinj_ads_completely_disabled_from_page($content=NULL){
|
|
442 |
return false;
|
443 |
}
|
444 |
|
445 |
-
function adinj_allowed_in_category($scope){
|
446 |
-
$ops = adinj_options();
|
447 |
$cat_list = $ops[$scope.'_category_condition_entries'];
|
448 |
$cat_array = preg_split("/[\s,]+/", $cat_list, -1, PREG_SPLIT_NO_EMPTY);
|
449 |
if (empty($cat_array)) return true;
|
@@ -453,8 +462,9 @@ function adinj_allowed_in_category($scope){
|
|
453 |
$postcategories = get_the_category($post->ID);
|
454 |
if (is_array($postcategories)){
|
455 |
foreach($postcategories as $cat) {
|
456 |
-
$
|
457 |
-
|
|
|
458 |
if ($cat_mode == ADINJ_ONLY_SHOW_IN){
|
459 |
return true;
|
460 |
} else if ($cat_mode == ADINJ_NEVER_SHOW_IN){
|
@@ -472,8 +482,7 @@ function adinj_allowed_in_category($scope){
|
|
472 |
return true;
|
473 |
}
|
474 |
|
475 |
-
function adinj_allowed_in_tag($scope){
|
476 |
-
$ops = adinj_options();
|
477 |
$tag_list = $ops[$scope.'_tag_condition_entries'];
|
478 |
$tag_array = preg_split("/[\s,]+/", $tag_list, -1, PREG_SPLIT_NO_EMPTY);
|
479 |
if (empty($tag_array)) return true;
|
@@ -483,8 +492,9 @@ function adinj_allowed_in_tag($scope){
|
|
483 |
$posttags = get_the_tags($post->ID);
|
484 |
if (is_array($posttags)){
|
485 |
foreach($posttags as $tag) {
|
486 |
-
$
|
487 |
-
|
|
|
488 |
if ($tag_mode == ADINJ_ONLY_SHOW_IN){
|
489 |
return true;
|
490 |
} else if ($tag_mode == ADINJ_NEVER_SHOW_IN){
|
@@ -508,7 +518,7 @@ function adinj_inject_hook($content){
|
|
508 |
|
509 |
adinj_upgrade_db_if_necessary();
|
510 |
|
511 |
-
if(is_page() || is_single()){
|
512 |
// TODO hack for no random ads bug
|
513 |
$adinj_total_rand_ads_used = 0;
|
514 |
}
|
@@ -521,6 +531,7 @@ function adinj_inject_hook($content){
|
|
521 |
$ops = adinj_options();
|
522 |
|
523 |
$debug_on = $ops['debug_mode'];
|
|
|
524 |
|
525 |
if ($debug_on && $ops['ad_insertion_mode'] == 'direct_dynamic'){
|
526 |
$showads = adshow_show_adverts();
|
@@ -537,15 +548,16 @@ function adinj_inject_hook($content){
|
|
537 |
if(stripos($content, "<!--adfooter-->") !== false) return adinj($content.$ad_include.adinj_ad_code_bottom(), "Ads=adfooter");
|
538 |
}
|
539 |
|
540 |
-
|
541 |
-
|
542 |
$length = 0;
|
543 |
if ($ops['content_length_unit'] == 'all'){
|
544 |
$length = strlen($content);
|
545 |
if ($debug_on) $debug .= "\nlength = $length (including HTML chars)";
|
546 |
-
} else {
|
547 |
$length = strlen(strip_tags($content));
|
548 |
if ($debug_on) $debug .= "\nlength = $length (viewable chars only)";
|
|
|
|
|
|
|
549 |
}
|
550 |
# Insert top and bottom ads if necesary
|
551 |
if(is_page() || is_single()){
|
@@ -612,8 +624,9 @@ function adinj_inject_hook($content){
|
|
612 |
$potential_inj_positions = array();
|
613 |
$prevpos = -1;
|
614 |
while(($prevpos = stripos($content, $paragraphmarker, $prevpos+1)) !== false){
|
615 |
-
$
|
616 |
-
|
|
|
617 |
}
|
618 |
|
619 |
if ($debug_on) $debug .= "\npotential_inj_positions:".sizeof($potential_inj_positions);
|
@@ -652,9 +665,6 @@ function adinj_inject_hook($content){
|
|
652 |
} else {
|
653 |
$inj_positions = array_merge($inj_positions, $rand_positions);
|
654 |
}
|
655 |
-
foreach($inj_positions as $pos){
|
656 |
-
if ($debug_on) $debug = $pos . ", " . $debug;
|
657 |
-
}
|
658 |
} else {
|
659 |
// Multiple ads may be inserted at the same position
|
660 |
$injections = 0;
|
@@ -669,6 +679,9 @@ function adinj_inject_hook($content){
|
|
669 |
if (sizeof($inj_positions) == 0){
|
670 |
return adinj($content_adfree_header.$content.$content_adfree_footer, "Error: No ad injection positions: " . $debug);
|
671 |
}
|
|
|
|
|
|
|
672 |
|
673 |
// Sort positions
|
674 |
sort($inj_positions);
|
@@ -768,16 +781,16 @@ function adinj_ticked($option){
|
|
768 |
}
|
769 |
|
770 |
function adinj_upgrade_db_if_necessary(){
|
771 |
-
$
|
772 |
-
if(empty($
|
773 |
// 1st Install.
|
774 |
adinj_install_db();
|
775 |
return;
|
776 |
}
|
777 |
|
778 |
-
$
|
779 |
|
780 |
-
if (ADINJ_DB_VERSION != $
|
781 |
require_once(ADINJ_PATH . '/ad-injection-admin.php');
|
782 |
adinj_upgrade_db();
|
783 |
}
|
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.6.5
|
7 |
Author: reviewmylife
|
8 |
Author URI: http://www.reviewmylife.co.uk/
|
9 |
License: GPLv2
|
21 |
// 2 = split testing support
|
22 |
// 3 = added front options
|
23 |
// 4 = new character counting option
|
24 |
+
// 5 = search/404 exclusion, increase db ad rotations to 10
|
25 |
+
define('ADINJ_DB_VERSION', 5);
|
26 |
|
27 |
// Files
|
28 |
// TODO will these paths work on windows?
|
385 |
function adinj($content, $message){
|
386 |
if (!adinj_ticked('debug_mode')) return $content;
|
387 |
global $adinj_total_rand_ads_used, $adinj_total_all_ads_used;
|
|
|
388 |
$ops = adinj_options();
|
389 |
$para = adinj_paragraph_to_start_ads();
|
390 |
$mode = $ops['ad_insertion_mode'];
|
391 |
+
$posttype = get_post_type();
|
392 |
+
if(is_single() || is_page()) {
|
393 |
+
$currentdate = time();
|
394 |
+
$postdate = get_the_time('U');
|
395 |
+
$currentday = $currentdate / 24 / 60 / 60;
|
396 |
+
$postday = $postdate / 24 / 60 / 60;
|
397 |
+
}
|
398 |
return $content."
|
399 |
<!--
|
400 |
[ADINJ DEBUG]
|
402 |
\$adinj_total_rand_ads_used=$adinj_total_rand_ads_used
|
403 |
\$adinj_total_all_ads_used=$adinj_total_all_ads_used
|
404 |
paragraphtostartads=$para (fyi: -1 is disabled)
|
405 |
+
posttype=$posttype
|
406 |
+
currentdate=$currentdate ($currentday)
|
407 |
+
postdate=$postdate ($postday)
|
408 |
injection mode=$mode
|
|
|
409 |
//-->\n";
|
410 |
}
|
411 |
|
422 |
// check for ads on certain page types being disabled
|
423 |
if (is_front_page() && adinj_ticked('exclude_front')){ return "NOADS: excluded from front page"; }
|
424 |
if (is_home() && adinj_ticked('exclude_home')){ return "NOADS: excluded from home page"; }
|
425 |
+
if (is_search() && adinj_ticked('exclude_search')){ return "NOADS: excluded from search pages"; }
|
426 |
+
if (is_404() && adinj_ticked('exclude_404')){ return "NOADS: excluded from 404 pages"; }
|
427 |
if ((is_page() && adinj_ticked('exclude_page')) ||
|
428 |
(is_single() && adinj_ticked('exclude_single')) ||
|
429 |
+
(is_archive() && adinj_ticked('exclude_archive'))){
|
|
|
430 |
return "NOADS: excluded from this page type: ".get_post_type();
|
431 |
}
|
432 |
|
436 |
// no ads on old posts/pages if rule is enabled
|
437 |
if((is_page() || is_single()) && !adinj_is_old_post()) return "NOADS: !is_old_post";
|
438 |
|
439 |
+
$category_ok = adinj_allowed_in_category('global', $ops);
|
440 |
if (!$category_ok) return "NOADS: blocked from category";
|
441 |
|
442 |
+
$tag_ok = adinj_allowed_in_tag('global', $ops);
|
443 |
if (!$tag_ok) return "NOADS: blocked from tag";
|
444 |
|
445 |
// manual ad disabling tags
|
452 |
return false;
|
453 |
}
|
454 |
|
455 |
+
function adinj_allowed_in_category($scope, $ops){
|
|
|
456 |
$cat_list = $ops[$scope.'_category_condition_entries'];
|
457 |
$cat_array = preg_split("/[\s,]+/", $cat_list, -1, PREG_SPLIT_NO_EMPTY);
|
458 |
if (empty($cat_array)) return true;
|
462 |
$postcategories = get_the_category($post->ID);
|
463 |
if (is_array($postcategories)){
|
464 |
foreach($postcategories as $cat) {
|
465 |
+
$slug = $cat->category_nicename;
|
466 |
+
$decodedslug = rawurldecode($slug); //allow UTF-8 encoded cats
|
467 |
+
if (in_array($slug, $cat_array) || in_array($decodedslug, $cat_array)){
|
468 |
if ($cat_mode == ADINJ_ONLY_SHOW_IN){
|
469 |
return true;
|
470 |
} else if ($cat_mode == ADINJ_NEVER_SHOW_IN){
|
482 |
return true;
|
483 |
}
|
484 |
|
485 |
+
function adinj_allowed_in_tag($scope, $ops){
|
|
|
486 |
$tag_list = $ops[$scope.'_tag_condition_entries'];
|
487 |
$tag_array = preg_split("/[\s,]+/", $tag_list, -1, PREG_SPLIT_NO_EMPTY);
|
488 |
if (empty($tag_array)) return true;
|
492 |
$posttags = get_the_tags($post->ID);
|
493 |
if (is_array($posttags)){
|
494 |
foreach($posttags as $tag) {
|
495 |
+
$slug = $tag->slug;
|
496 |
+
$decodedslug = rawurldecode($slug); //allow UTF-8 encoded tags
|
497 |
+
if (in_array($slug, $tag_array) || in_array($decodedslug, $tag_array)){
|
498 |
if ($tag_mode == ADINJ_ONLY_SHOW_IN){
|
499 |
return true;
|
500 |
} else if ($tag_mode == ADINJ_NEVER_SHOW_IN){
|
518 |
|
519 |
adinj_upgrade_db_if_necessary();
|
520 |
|
521 |
+
if(!is_archive && (is_page() || is_single())){
|
522 |
// TODO hack for no random ads bug
|
523 |
$adinj_total_rand_ads_used = 0;
|
524 |
}
|
531 |
$ops = adinj_options();
|
532 |
|
533 |
$debug_on = $ops['debug_mode'];
|
534 |
+
$debug = "";
|
535 |
|
536 |
if ($debug_on && $ops['ad_insertion_mode'] == 'direct_dynamic'){
|
537 |
$showads = adshow_show_adverts();
|
548 |
if(stripos($content, "<!--adfooter-->") !== false) return adinj($content.$ad_include.adinj_ad_code_bottom(), "Ads=adfooter");
|
549 |
}
|
550 |
|
|
|
|
|
551 |
$length = 0;
|
552 |
if ($ops['content_length_unit'] == 'all'){
|
553 |
$length = strlen($content);
|
554 |
if ($debug_on) $debug .= "\nlength = $length (including HTML chars)";
|
555 |
+
} else if ($ops['content_length_unit'] == 'viewable'){
|
556 |
$length = strlen(strip_tags($content));
|
557 |
if ($debug_on) $debug .= "\nlength = $length (viewable chars only)";
|
558 |
+
} else {
|
559 |
+
$length = str_word_count(strip_tags($content));
|
560 |
+
if ($debug_on) $debug .= "\nlength = $length (number of words)";
|
561 |
}
|
562 |
# Insert top and bottom ads if necesary
|
563 |
if(is_page() || is_single()){
|
624 |
$potential_inj_positions = array();
|
625 |
$prevpos = -1;
|
626 |
while(($prevpos = stripos($content, $paragraphmarker, $prevpos+1)) !== false){
|
627 |
+
$potentialposition = $prevpos + strlen($paragraphmarker);
|
628 |
+
$potential_inj_positions[] = $potentialposition;
|
629 |
+
if ($debug_on) $debug .= "$potentialposition, ";
|
630 |
}
|
631 |
|
632 |
if ($debug_on) $debug .= "\npotential_inj_positions:".sizeof($potential_inj_positions);
|
665 |
} else {
|
666 |
$inj_positions = array_merge($inj_positions, $rand_positions);
|
667 |
}
|
|
|
|
|
|
|
668 |
} else {
|
669 |
// Multiple ads may be inserted at the same position
|
670 |
$injections = 0;
|
679 |
if (sizeof($inj_positions) == 0){
|
680 |
return adinj($content_adfree_header.$content.$content_adfree_footer, "Error: No ad injection positions: " . $debug);
|
681 |
}
|
682 |
+
foreach($inj_positions as $pos){
|
683 |
+
if ($debug_on) $debug = "$pos, $debug";
|
684 |
+
}
|
685 |
|
686 |
// Sort positions
|
687 |
sort($inj_positions);
|
781 |
}
|
782 |
|
783 |
function adinj_upgrade_db_if_necessary(){
|
784 |
+
$cached_options = adinj_options();
|
785 |
+
if(empty($cached_options)){
|
786 |
// 1st Install.
|
787 |
adinj_install_db();
|
788 |
return;
|
789 |
}
|
790 |
|
791 |
+
$cached_dbversion = adinj_db_version($cached_options);
|
792 |
|
793 |
+
if (ADINJ_DB_VERSION != $cached_dbversion){
|
794 |
require_once(ADINJ_PATH . '/ad-injection-admin.php');
|
795 |
adinj_upgrade_db();
|
796 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.reviewmylife.co.uk/blog/2010/12/06/ad-injection-plugin-w
|
|
4 |
Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
|
5 |
Requires at least: 2.8.6
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 0.9.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,6 +305,12 @@ If you do get any errors please use the 'Report a bug or give feedback' link on
|
|
305 |
|
306 |
== Changelog ==
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
= 0.9.6.4 =
|
309 |
* Can choose between page lengths based on viewable characters or all characters (includes HTML markup).
|
310 |
* Fixes for widget padding options.
|
@@ -417,8 +423,8 @@ Fix 'Something badly wrong in num_rand_ads_to_insert' message that occurs on pag
|
|
417 |
|
418 |
== Upgrade Notice ==
|
419 |
|
420 |
-
= 0.9.6.
|
421 |
-
|
422 |
|
423 |
= 0.8.3 =
|
424 |
First public release.
|
4 |
Tags: ad injection, adsense, advert injection, advert, ad, injection, advertising, affiliate, inject, injection, insert, widget, widgets, sidebar, monetize, monetise, banner, Amazon, ClickBank, TradeDoubler, Google, adBrite, post, WordPress, automatically, plugin, Adsense Injection, free, blog, ad rotation, A:B testing, split testing, WP Super Cache, W3 Total Cache, WP Cache
|
5 |
Requires at least: 2.8.6
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 0.9.6.5
|
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 |
== Changelog ==
|
307 |
|
308 |
+
= 0.9.6.5 =
|
309 |
+
* Add 'words' to content length counting options.
|
310 |
+
* Fixes for categories/tags and ads with UTF-8 characters.
|
311 |
+
* Search/404 exclusion options for global and widget settngs.
|
312 |
+
* Ad pool size for top/random/bottom ads increased to 10.
|
313 |
+
|
314 |
= 0.9.6.4 =
|
315 |
* Can choose between page lengths based on viewable characters or all characters (includes HTML markup).
|
316 |
* Fixes for widget padding options.
|
423 |
|
424 |
== Upgrade Notice ==
|
425 |
|
426 |
+
= 0.9.6.5 =
|
427 |
+
'word' length restrictions, UTF-8 fixes, search/404 restriction options, and top/random/bottom ad pool size increased to 10.
|
428 |
|
429 |
= 0.8.3 =
|
430 |
First public release.
|
ui-tab-adrotation.php
CHANGED
@@ -38,7 +38,7 @@ DOCS;
|
|
38 |
<?php
|
39 |
adinj_postbox_start(__("Random adverts", 'adinj'), 'multiple_random');
|
40 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
41 |
-
for ($i=1; $i<=
|
42 |
adinj_add_row_with_text_box('ad_code_random_', $i, 'Ad code', $total_rand_split);
|
43 |
}
|
44 |
adinj_add_row_with_text_box('ad_code_random_alt_', 1, 'Alt content', $total_rand_alt_split);
|
@@ -49,7 +49,7 @@ DOCS;
|
|
49 |
|
50 |
adinj_postbox_start(__("Top adverts", 'adinj'), 'multiple_top');
|
51 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
52 |
-
for ($i=1; $i<=
|
53 |
adinj_add_row_with_text_box('ad_code_top_', $i, 'Ad code', $total_top_split);
|
54 |
}
|
55 |
adinj_add_row_with_text_box('ad_code_top_alt_', 1, 'Alt content', $total_top_alt_split);
|
@@ -60,7 +60,7 @@ DOCS;
|
|
60 |
|
61 |
adinj_postbox_start(__("Bottom adverts", 'adinj'), 'multiple_bottom');
|
62 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
63 |
-
for ($i=1; $i<=
|
64 |
adinj_add_row_with_text_box('ad_code_bottom_', $i, 'Ad code', $total_bottom_split);
|
65 |
}
|
66 |
adinj_add_row_with_text_box('ad_code_bottom_alt_', 1, 'Alt content', $total_bottom_alt_split);
|
38 |
<?php
|
39 |
adinj_postbox_start(__("Random adverts", 'adinj'), 'multiple_random');
|
40 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
41 |
+
for ($i=1; $i<=10; ++$i){
|
42 |
adinj_add_row_with_text_box('ad_code_random_', $i, 'Ad code', $total_rand_split);
|
43 |
}
|
44 |
adinj_add_row_with_text_box('ad_code_random_alt_', 1, 'Alt content', $total_rand_alt_split);
|
49 |
|
50 |
adinj_postbox_start(__("Top adverts", 'adinj'), 'multiple_top');
|
51 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
52 |
+
for ($i=1; $i<=10; ++$i){
|
53 |
adinj_add_row_with_text_box('ad_code_top_', $i, 'Ad code', $total_top_split);
|
54 |
}
|
55 |
adinj_add_row_with_text_box('ad_code_top_alt_', 1, 'Alt content', $total_top_alt_split);
|
60 |
|
61 |
adinj_postbox_start(__("Bottom adverts", 'adinj'), 'multiple_bottom');
|
62 |
echo '<table border="0" cellspacing="5" class="adinjtable">';
|
63 |
+
for ($i=1; $i<=10; ++$i){
|
64 |
adinj_add_row_with_text_box('ad_code_bottom_', $i, 'Ad code', $total_bottom_split);
|
65 |
}
|
66 |
adinj_add_row_with_text_box('ad_code_bottom_alt_', 1, 'Alt content', $total_bottom_alt_split);
|
ui-tab-main.php
CHANGED
@@ -88,17 +88,19 @@ function adinj_tab_main(){
|
|
88 |
<?php adinj_add_checkbox('exclude_page') ?>page - <?php echo $count_pages->publish; ?> page(s)<br />
|
89 |
<?php adinj_add_checkbox('exclude_single') ?>single -<?php echo $count_posts->publish; ?> single blog post(s)<br />
|
90 |
<?php adinj_add_checkbox('exclude_archive') ?>archive - only <a href="#widgets">widgets</a> currently appear on archives<br />
|
|
|
|
|
91 |
</td></tr>
|
92 |
<tr><td colspan="2"><p><span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p></td></tr>
|
93 |
<tr>
|
94 |
-
<td>
|
95 |
<td>
|
96 |
<?php
|
97 |
adinj_selection_box("content_length_unit",
|
98 |
-
array('viewable' => 'viewable
|
99 |
?>
|
100 |
</td></tr>
|
101 |
-
<tr><td colspan="2"><p><span style="font-size:10px;">When defining conditions that refer to the length of the content; do you
|
102 |
</table>
|
103 |
|
104 |
<p><b>Category and tag conditions</b></p>
|
@@ -179,26 +181,27 @@ function adinj_tab_main(){
|
|
179 |
<td>If page shorter than:</td>
|
180 |
<td>
|
181 |
<?php
|
182 |
-
|
183 |
-
|
|
|
184 |
?>
|
185 |
</td>
|
186 |
<td>
|
187 |
<?php
|
188 |
-
|
189 |
-
|
190 |
?>
|
191 |
</td>
|
192 |
<td>
|
193 |
<?php
|
194 |
-
|
195 |
-
|
196 |
?>
|
197 |
</td>
|
198 |
<td>
|
199 |
<?php
|
200 |
-
|
201 |
-
|
202 |
?>
|
203 |
</td>
|
204 |
</tr>
|
@@ -241,12 +244,13 @@ function adinj_tab_main(){
|
|
241 |
|
242 |
|
243 |
<?php adinj_postbox_start(__("Optional top advert (single posts and pages only)", 'adinj'), 'topad'); ?>
|
|
|
|
|
244 |
|
245 |
<?php
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
?>
|
251 |
|
252 |
<br clear="all" />
|
@@ -270,10 +274,12 @@ function adinj_tab_main(){
|
|
270 |
|
271 |
<?php adinj_postbox_start(__("Optional bottom advert (single posts and pages only)", 'adinj'), 'bottomad'); ?>
|
272 |
|
|
|
|
|
273 |
<?php
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
?>
|
278 |
|
279 |
<br clear="all"/>
|
@@ -309,7 +315,9 @@ function adinj_tab_main(){
|
|
309 |
<?php adinj_add_checkbox('widget_exclude_home') ?>home - latest posts page (may be same as front)<br />
|
310 |
<?php adinj_add_checkbox('widget_exclude_page') ?>page - <?php echo $count_pages->publish; ?> page(s)<br />
|
311 |
<?php adinj_add_checkbox('widget_exclude_single') ?>single - <?php echo $count_posts->publish; ?> single blog post(s)<br />
|
312 |
-
<?php adinj_add_checkbox('widget_exclude_archive') ?>archive -
|
|
|
|
|
313 |
</td></tr>
|
314 |
<tr><td colspan="2"><p><span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p></td></tr>
|
315 |
|
@@ -462,6 +470,18 @@ function adinj_tab_main(){
|
|
462 |
adinj_docs();
|
463 |
}
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
function adinj_wp_super_cache_msg(){
|
466 |
?>
|
467 |
<p>With WP Super Cache version 0.9.9.8+ you can use the fastest 'mod rewrite rules' caching mode. With older versions of WP Super Cache you'll have to use the slower 'legacy mode'.</p>
|
@@ -528,6 +548,8 @@ function adinj_side_status_box(){
|
|
528 |
<br /> <?php echo adinj_green_or_red_dot('exclude_page'); ?> page
|
529 |
<br /> <?php echo adinj_green_or_red_dot('exclude_single'); ?> single
|
530 |
<br /> <?php echo adinj_green_or_red_dot('exclude_archive'); ?> archive
|
|
|
|
|
531 |
</td></tr>
|
532 |
|
533 |
<tr><td style="text-align:right">
|
@@ -571,6 +593,8 @@ function adinj_side_status_box(){
|
|
571 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_page'); ?> page
|
572 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_single'); ?> single
|
573 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_archive'); ?> archive
|
|
|
|
|
574 |
<?php } ?>
|
575 |
</td></tr>
|
576 |
|
@@ -627,7 +651,7 @@ function adinj_debug_information(){
|
|
627 |
}
|
628 |
echo "$key";
|
629 |
echo "</td><td>";
|
630 |
-
$value =
|
631 |
echo "$value";
|
632 |
echo "</td><td>";
|
633 |
echo $default_options[$key];
|
@@ -657,10 +681,10 @@ function adinj_debug_information(){
|
|
657 |
echo '<td style="vertical-align:top">';
|
658 |
if (is_array($val)){
|
659 |
foreach($val as $subkey=>$subval){
|
660 |
-
echo $subkey.':'.
|
661 |
}
|
662 |
} else {
|
663 |
-
echo
|
664 |
}
|
665 |
echo '</td></tr>';
|
666 |
++$count;
|
88 |
<?php adinj_add_checkbox('exclude_page') ?>page - <?php echo $count_pages->publish; ?> page(s)<br />
|
89 |
<?php adinj_add_checkbox('exclude_single') ?>single -<?php echo $count_posts->publish; ?> single blog post(s)<br />
|
90 |
<?php adinj_add_checkbox('exclude_archive') ?>archive - only <a href="#widgets">widgets</a> currently appear on archives<br />
|
91 |
+
<?php adinj_add_checkbox('exclude_search') ?>search pages - widgets only for now<br />
|
92 |
+
<?php adinj_add_checkbox('exclude_404') ?>404 error pages - widgets only for now<br />
|
93 |
</td></tr>
|
94 |
<tr><td colspan="2"><p><span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p></td></tr>
|
95 |
<tr>
|
96 |
+
<td>Content length counting method:</td>
|
97 |
<td>
|
98 |
<?php
|
99 |
adinj_selection_box("content_length_unit",
|
100 |
+
array('viewable' => 'viewable chars', 'all' => 'all chars', 'words' => 'words'));
|
101 |
?>
|
102 |
</td></tr>
|
103 |
+
<tr><td colspan="2"><p><span style="font-size:10px;">When defining conditions that refer to the length of the content; do you want to count viewable characters, all characters (which includes HTML tags), or number of words?</span></p></td></tr>
|
104 |
</table>
|
105 |
|
106 |
<p><b>Category and tag conditions</b></p>
|
181 |
<td>If page shorter than:</td>
|
182 |
<td>
|
183 |
<?php
|
184 |
+
$unit = adinj_counting_unit_description();
|
185 |
+
adinj_selection_box("no_random_ads_if_shorter_than",
|
186 |
+
array(ADINJ_RULE_DISABLED, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000), $unit);
|
187 |
?>
|
188 |
</td>
|
189 |
<td>
|
190 |
<?php
|
191 |
+
adinj_selection_box("one_ad_if_shorter_than",
|
192 |
+
array(ADINJ_RULE_DISABLED, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000), $unit);
|
193 |
?>
|
194 |
</td>
|
195 |
<td>
|
196 |
<?php
|
197 |
+
adinj_selection_box("two_ads_if_shorter_than",
|
198 |
+
array(ADINJ_RULE_DISABLED, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000), $unit);
|
199 |
?>
|
200 |
</td>
|
201 |
<td>
|
202 |
<?php
|
203 |
+
adinj_selection_box("three_ads_if_shorter_than",
|
204 |
+
array(ADINJ_RULE_DISABLED, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000, 20000), $unit);
|
205 |
?>
|
206 |
</td>
|
207 |
</tr>
|
244 |
|
245 |
|
246 |
<?php adinj_postbox_start(__("Optional top advert (single posts and pages only)", 'adinj'), 'topad'); ?>
|
247 |
+
|
248 |
+
<p><span style="font-size:10px;"><b>Purpose:</b> This ad is placed above your main post/page content (this is not a 'header' ad).</span></p>
|
249 |
|
250 |
<?php
|
251 |
+
_e("Only show top ad on pages longer than: ", 'adinj');
|
252 |
+
adinj_selection_box("top_ad_if_longer_than",
|
253 |
+
array(ADINJ_DISABLED, ADINJ_ALWAYS_SHOW, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000, 20000), $unit);
|
|
|
254 |
?>
|
255 |
|
256 |
<br clear="all" />
|
274 |
|
275 |
<?php adinj_postbox_start(__("Optional bottom advert (single posts and pages only)", 'adinj'), 'bottomad'); ?>
|
276 |
|
277 |
+
<p><span style="font-size:10px;"><b>Purpose:</b> This ad is placed below your main post/page content (this is not a 'footer' ad).</span></p>
|
278 |
+
|
279 |
<?php
|
280 |
+
_e("Only show bottom ad on pages longer than: ", 'adinj');
|
281 |
+
adinj_selection_box("bottom_ad_if_longer_than",
|
282 |
+
array(ADINJ_DISABLED, ADINJ_ALWAYS_SHOW, 100, 200, 300, 500, 1000, 1500, 2000, 2500, 3000, 5000, 10000, 20000), $unit);
|
283 |
?>
|
284 |
|
285 |
<br clear="all"/>
|
315 |
<?php adinj_add_checkbox('widget_exclude_home') ?>home - latest posts page (may be same as front)<br />
|
316 |
<?php adinj_add_checkbox('widget_exclude_page') ?>page - <?php echo $count_pages->publish; ?> page(s)<br />
|
317 |
<?php adinj_add_checkbox('widget_exclude_single') ?>single - <?php echo $count_posts->publish; ?> single blog post(s)<br />
|
318 |
+
<?php adinj_add_checkbox('widget_exclude_archive') ?>archive - category, tag, author, and date pages types<br />
|
319 |
+
<?php adinj_add_checkbox('widget_exclude_search') ?>search pages<br />
|
320 |
+
<?php adinj_add_checkbox('widget_exclude_404') ?>404 error pages<br />
|
321 |
</td></tr>
|
322 |
<tr><td colspan="2"><p><span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span></p></td></tr>
|
323 |
|
470 |
adinj_docs();
|
471 |
}
|
472 |
|
473 |
+
function adinj_counting_unit_description(){
|
474 |
+
$ops = adinj_options();
|
475 |
+
$unit = $ops['content_length_unit'];
|
476 |
+
if ($unit == 'all'){
|
477 |
+
return '(all chars)';
|
478 |
+
} else if ($unit == 'viewable'){
|
479 |
+
return '(chars)';
|
480 |
+
} else {
|
481 |
+
return '(words)';
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
function adinj_wp_super_cache_msg(){
|
486 |
?>
|
487 |
<p>With WP Super Cache version 0.9.9.8+ you can use the fastest 'mod rewrite rules' caching mode. With older versions of WP Super Cache you'll have to use the slower 'legacy mode'.</p>
|
548 |
<br /> <?php echo adinj_green_or_red_dot('exclude_page'); ?> page
|
549 |
<br /> <?php echo adinj_green_or_red_dot('exclude_single'); ?> single
|
550 |
<br /> <?php echo adinj_green_or_red_dot('exclude_archive'); ?> archive
|
551 |
+
<br /> <?php echo adinj_green_or_red_dot('exclude_search'); ?> search
|
552 |
+
<br /> <?php echo adinj_green_or_red_dot('exclude_404'); ?> 404
|
553 |
</td></tr>
|
554 |
|
555 |
<tr><td style="text-align:right">
|
593 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_page'); ?> page
|
594 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_single'); ?> single
|
595 |
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_archive'); ?> archive
|
596 |
+
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_search'); ?> search
|
597 |
+
<br /> <?php echo adinj_green_or_red_dot('widget_exclude_404'); ?> 404
|
598 |
<?php } ?>
|
599 |
</td></tr>
|
600 |
|
651 |
}
|
652 |
echo "$key";
|
653 |
echo "</td><td>";
|
654 |
+
$value = htmlspecialchars($value);
|
655 |
echo "$value";
|
656 |
echo "</td><td>";
|
657 |
echo $default_options[$key];
|
681 |
echo '<td style="vertical-align:top">';
|
682 |
if (is_array($val)){
|
683 |
foreach($val as $subkey=>$subval){
|
684 |
+
echo $subkey.':'.htmlspecialchars($subval).'<br />';
|
685 |
}
|
686 |
} else {
|
687 |
+
echo htmlspecialchars($val);
|
688 |
}
|
689 |
echo '</td></tr>';
|
690 |
++$count;
|