Version Description
- Add two new functionality for default Ads positioning: Assign Ads after certain paragraphs & assign Ads after certain images.
- You can now disable AdsWidget (Sidebar Ads) on Homepage.
- Insert a <!--OffDef--> to temporary disable the default positioned Ads, so that you can insert the specific Ads or Random ad tags in the post.
- Google allows publishers to place up to 3 Adsense for Content on a page. If you are using other Ads, you may now display up to 10 Ads.
- Minor bug fixed & code modifications.
Download this release
Release Info
Developer | philipze |
Plugin | Quick Adsense |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- quick-adsense-admin.php +66 -33
- quick-adsense.php +69 -35
- readme.txt +12 -4
quick-adsense-admin.php
CHANGED
@@ -26,6 +26,12 @@
|
|
26 |
$ra2 = get_option('BegnRnd');
|
27 |
$rb1 = get_option('EndiAds');
|
28 |
$rb2 = get_option('EndiRnd');
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
$aps = get_option('AppPost');
|
30 |
$apg = get_option('AppPage');
|
31 |
$ahm = get_option('AppHome');
|
@@ -33,6 +39,7 @@
|
|
33 |
$aar = get_option('AppArch');
|
34 |
$atg = get_option('AppTags');
|
35 |
$amx = get_option('AppMaxA');
|
|
|
36 |
$aqt = get_option('QckTags');
|
37 |
$aqr = get_option('QckRnds');
|
38 |
$aqf = get_option('QckOffs');
|
@@ -56,6 +63,12 @@
|
|
56 |
document.getElementById("BegnRnd").selectedIndex = <?php echo($QData['Default']['BegnRnd']) ?>;
|
57 |
document.getElementById("EndiAds").checked = <?php echo(truefalse($QData['Default']['EndiAds'])) ?>;
|
58 |
document.getElementById("EndiRnd").selectedIndex = <?php echo($QData['Default']['EndiRnd']) ?>;
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
document.getElementById("AppHome").checked = <?php echo(truefalse($QData['Default']['AppHome'])) ?>;
|
60 |
document.getElementById("AppPost").checked = <?php echo(truefalse($QData['Default']['AppPost'])) ?>;
|
61 |
document.getElementById("AppPage").checked = <?php echo(truefalse($QData['Default']['AppPage'])) ?>;
|
@@ -63,6 +76,7 @@
|
|
63 |
document.getElementById("AppArch").checked = <?php echo(truefalse($QData['Default']['AppArch'])) ?>;
|
64 |
document.getElementById("AppTags").checked = <?php echo(truefalse($QData['Default']['AppTags'])) ?>;
|
65 |
document.getElementById("AppMaxA").checked = <?php echo(truefalse($QData['Default']['AppMaxA'])) ?>;
|
|
|
66 |
document.getElementById("QckTags").checked = <?php echo(truefalse($QData['Default']['QckTags'])) ?>;
|
67 |
document.getElementById("QckRnds").checked = <?php echo(truefalse($QData['Default']['QckRnds'])) ?>;
|
68 |
document.getElementById("QckOffs").checked = <?php echo(truefalse($QData['Default']['QckOffs'])) ?>;
|
@@ -77,25 +91,29 @@
|
|
77 |
}
|
78 |
function selectinfo(ts) {
|
79 |
if (ts.selectedIndex == 0) { return; }
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
begnrnd.selectedIndex += (begnrnd.selectedIndex == 0)?1:-1 ;
|
90 |
-
}
|
91 |
}
|
92 |
}
|
93 |
-
function
|
94 |
document.getElementById(selnme).disabled=!ts.checked;
|
95 |
}
|
|
|
|
|
|
|
|
|
96 |
function deftcheckinfo() {
|
97 |
-
|
98 |
-
|
|
|
|
|
99 |
}
|
100 |
</script>
|
101 |
|
@@ -111,25 +129,38 @@
|
|
111 |
<tr valign="top">
|
112 |
<td style="width:110px"><?php _e('Adsense :'); ?></td>
|
113 |
<td><?php _e('Place up to '); ?><select name="AdsDisp" style="width:50px;font-weight:bold">
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
<
|
118 |
-
<span class="description" style="font-style:italic"><?php _e('(Google allows publishers to place up to <b>three</b> AdSense for Content Units on a page. If you have placed these ads somewhere in the page, you will need to take those into account.)'); ?></span><br/>
|
119 |
<br/>
|
120 |
</td>
|
121 |
</tr>
|
122 |
<tr valign="top">
|
123 |
-
<td style="width:110px"><?php _e('Position
|
124 |
<td>
|
125 |
-
<input type="checkbox" id="BegnAds" name="BegnAds" value="true" <?php if($ra1){echo('checked');} ?> onchange="
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
<input type="checkbox" id="EndiAds" name="EndiAds" value="false" <?php if($rb1){echo('checked');} ?> onchange="
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
<br/>
|
134 |
<script type="text/javascript">deftcheckinfo();</script>
|
135 |
</td>
|
@@ -144,7 +175,8 @@
|
|
144 |
<input type="checkbox" id="AppCate" name="AppCate" value="true" <?php if($act){echo('checked');} ?> /> <?php _e('Categories'); ?>
|
145 |
<input type="checkbox" id="AppArch" name="AppArch" value="true" <?php if($aar){echo('checked');} ?> /> <?php _e('Archives'); ?>
|
146 |
<input type="checkbox" id="AppTags" name="AppTags" value="true" <?php if($atg){echo('checked');} ?> /> <?php _e('Tags'); ?><span> ] → </span>
|
147 |
-
<input type="checkbox" id="AppMaxA" name="AppMaxA" value="true" <?php if($amx){echo('checked');} ?> /> <?php _e('Place all possible Ads on these pages.'); ?><br
|
|
|
148 |
<br/>
|
149 |
</td>
|
150 |
</tr>
|
@@ -154,11 +186,12 @@
|
|
154 |
<ol style="margin-top:5px;">
|
155 |
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--Ads1--></span>, <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--Ads2--></span>, etc. into a post to show the <b>Particular Ads</b> at specific location.'); ?></li>
|
156 |
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--RndAds--></span> (or more) into a post to show the <b>Random Ads</b> at specific location.'); ?></li>
|
157 |
-
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--NoAds--></span> to <b>Disable Ads</b> in a post.'); ?></li>
|
158 |
-
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffAds--></span> to <b>Disable All Ads</b> including AdsWidget.'); ?></li>
|
|
|
159 |
</ol>
|
160 |
-
[ <input type="checkbox" id="QckRnds" name="QckRnds" value="true" <?php if($aqr){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--RndAds--></span> Quicktag Buttons
|
161 |
-
[ <input type="checkbox" id="QckOffs" name="QckOffs" value="true" <?php if($aqf){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--NoAds--></span>, <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffAds--></span
|
162 |
<span class="description" style="font-style:italic"><?php _e('(Tags above tags can be inserted into a post via the additional Quicktag Buttons added to the HTML Edit Post SubPanel.)'); ?></span><br/>
|
163 |
<br/>
|
164 |
</td>
|
26 |
$ra2 = get_option('BegnRnd');
|
27 |
$rb1 = get_option('EndiAds');
|
28 |
$rb2 = get_option('EndiRnd');
|
29 |
+
$rc1 = get_option('Par1Ads');
|
30 |
+
$rc2 = get_option('Par1Rnd');
|
31 |
+
$rc3 = get_option('Par1Nup');
|
32 |
+
$rd1 = get_option('Img1Ads');
|
33 |
+
$rd2 = get_option('Img1Rnd');
|
34 |
+
$rd3 = get_option('Img1Nup');
|
35 |
$aps = get_option('AppPost');
|
36 |
$apg = get_option('AppPage');
|
37 |
$ahm = get_option('AppHome');
|
39 |
$aar = get_option('AppArch');
|
40 |
$atg = get_option('AppTags');
|
41 |
$amx = get_option('AppMaxA');
|
42 |
+
$asd = get_option('AppSide');
|
43 |
$aqt = get_option('QckTags');
|
44 |
$aqr = get_option('QckRnds');
|
45 |
$aqf = get_option('QckOffs');
|
63 |
document.getElementById("BegnRnd").selectedIndex = <?php echo($QData['Default']['BegnRnd']) ?>;
|
64 |
document.getElementById("EndiAds").checked = <?php echo(truefalse($QData['Default']['EndiAds'])) ?>;
|
65 |
document.getElementById("EndiRnd").selectedIndex = <?php echo($QData['Default']['EndiRnd']) ?>;
|
66 |
+
document.getElementById("Par1Ads").checked = <?php echo(truefalse($QData['Default']['Par1Ads'])) ?>;
|
67 |
+
document.getElementById("Par1Rnd").selectedIndex = <?php echo($QData['Default']['Par1Rnd']) ?>;
|
68 |
+
document.getElementById("Par1Nup").selectedIndex = <?php echo($QData['Default']['Par1Nup']) ?>;
|
69 |
+
document.getElementById("Img1Ads").checked = <?php echo(truefalse($QData['Default']['Img1Ads'])) ?>;
|
70 |
+
document.getElementById("Img1Rnd").selectedIndex = <?php echo($QData['Default']['Img1Rnd']) ?>;
|
71 |
+
document.getElementById("Img1Nup").selectedIndex = <?php echo($QData['Default']['Img1Nup']) ?>;
|
72 |
document.getElementById("AppHome").checked = <?php echo(truefalse($QData['Default']['AppHome'])) ?>;
|
73 |
document.getElementById("AppPost").checked = <?php echo(truefalse($QData['Default']['AppPost'])) ?>;
|
74 |
document.getElementById("AppPage").checked = <?php echo(truefalse($QData['Default']['AppPage'])) ?>;
|
76 |
document.getElementById("AppArch").checked = <?php echo(truefalse($QData['Default']['AppArch'])) ?>;
|
77 |
document.getElementById("AppTags").checked = <?php echo(truefalse($QData['Default']['AppTags'])) ?>;
|
78 |
document.getElementById("AppMaxA").checked = <?php echo(truefalse($QData['Default']['AppMaxA'])) ?>;
|
79 |
+
document.getElementById("AppSide").checked = <?php echo(truefalse($QData['Default']['AppSide'])) ?>;
|
80 |
document.getElementById("QckTags").checked = <?php echo(truefalse($QData['Default']['QckTags'])) ?>;
|
81 |
document.getElementById("QckRnds").checked = <?php echo(truefalse($QData['Default']['QckRnds'])) ?>;
|
82 |
document.getElementById("QckOffs").checked = <?php echo(truefalse($QData['Default']['QckOffs'])) ?>;
|
91 |
}
|
92 |
function selectinfo(ts) {
|
93 |
if (ts.selectedIndex == 0) { return; }
|
94 |
+
cek = new Array(
|
95 |
+
document.getElementById('BegnRnd'),
|
96 |
+
document.getElementById('EndiRnd'),
|
97 |
+
document.getElementById('Par1Rnd'),
|
98 |
+
document.getElementById('Img1Rnd') );
|
99 |
+
for (i=0;i<cek.length;i++) {
|
100 |
+
if (ts != cek[i] && ts.selectedIndex == cek[i].selectedIndex) {
|
101 |
+
cek[i].selectedIndex = 0;
|
102 |
+
}
|
|
|
|
|
103 |
}
|
104 |
}
|
105 |
+
function checkinfo1(selnme,ts) {
|
106 |
document.getElementById(selnme).disabled=!ts.checked;
|
107 |
}
|
108 |
+
function checkinfo2(selnm1,selnm2,ts) {
|
109 |
+
document.getElementById(selnm1).disabled=!ts.checked;
|
110 |
+
document.getElementById(selnm2).disabled=!ts.checked;
|
111 |
+
}
|
112 |
function deftcheckinfo() {
|
113 |
+
checkinfo1('BegnRnd',document.getElementById('BegnAds'));
|
114 |
+
checkinfo1('EndiRnd',document.getElementById('EndiAds'));
|
115 |
+
checkinfo2('Par1Rnd','Par1Nup',document.getElementById('Par1Ads'));
|
116 |
+
checkinfo2('Img1Rnd','Img1Nup',document.getElementById('Img1Ads'));
|
117 |
}
|
118 |
</script>
|
119 |
|
129 |
<tr valign="top">
|
130 |
<td style="width:110px"><?php _e('Adsense :'); ?></td>
|
131 |
<td><?php _e('Place up to '); ?><select name="AdsDisp" style="width:50px;font-weight:bold">
|
132 |
+
<?php for ($i=0;$i<=(int)$QData['Default']['AdsDisp'];$i++) { ?>
|
133 |
+
<option id="DisTot<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($dis==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
|
134 |
+
<?php } ?></select><?php _e(' Ads on a page. Select up to <b>3 Ads</b> only if you are solely using Google Ads.'); ?><br/>
|
135 |
+
<span class="description" style="font-style:italic"><?php _e('(Google allows publishers to place up to <b>3 Adsense</b> for Content on a page. If you have placed these ads somewhere in the page, you will need to take those into account. If you are using other Ads, you may select up to <b>10 Ads</b>.)<span style="color:#a00;font-size:75%;font-style:normal"> (New!)</span>'); ?></span><br/>
|
|
|
136 |
<br/>
|
137 |
</td>
|
138 |
</tr>
|
139 |
<tr valign="top">
|
140 |
+
<td style="width:110px"><?php _e('Position :<br/>(Default)'); ?></td>
|
141 |
<td>
|
142 |
+
<input type="checkbox" id="BegnAds" name="BegnAds" value="true" <?php if($ra1){echo('checked');} ?> onchange="checkinfo1('BegnRnd',this)" /> <?php _e('Assign') ; ?> <select id="BegnRnd" name="BegnRnd" onchange="selectinfo(this)">
|
143 |
+
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
144 |
+
<option id="OptBegn<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($ra2==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
|
145 |
+
<?php } ?></select> <?php _e('to <b>Beginning of Post') ?></b><br/>
|
146 |
+
<input type="checkbox" id="EndiAds" name="EndiAds" value="false" <?php if($rb1){echo('checked');} ?> onchange="checkinfo1('EndiRnd',this)" /> <?php _e('Assign') ; ?> <select id="EndiRnd" name="EndiRnd" onchange="selectinfo(this)">
|
147 |
+
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
148 |
+
<option id="OptEndi<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rb2==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
|
149 |
+
<?php } ?></select> <?php _e('to <b>End of Post') ?></b><br/>
|
150 |
+
<input type="checkbox" id="Par1Ads" name="Par1Ads" value="false" <?php if($rc1){echo('checked');} ?> onchange="checkinfo2('Par1Rnd','Par1Nup',this)" /> <?php _e('Assign') ; ?> <select id="Par1Rnd" name="Par1Rnd" onchange="selectinfo(this)">
|
151 |
+
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
152 |
+
<option id="OptPar1<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rc2==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
|
153 |
+
<?php } ?></select> <?php _e('<b>After Paragraph</b> ') ?> <select id="Par1Nup" name="Par1Nup">
|
154 |
+
<?php for ($i=1;$i<=50;$i++) { ?>
|
155 |
+
<option id="Opt1Nu<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rc3==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
|
156 |
+
<?php } ?></select><span style="color:#a00;font-size:75%"> (New!)</span><br/>
|
157 |
+
<input type="checkbox" id="Img1Ads" name="Img1Ads" value="false" <?php if($rd1){echo('checked');} ?> onchange="checkinfo2('Img1Rnd','Img1Nup',this)" /> <?php _e('Assign') ; ?> <select id="Img1Rnd" name="Img1Rnd" onchange="selectinfo(this)">
|
158 |
+
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
159 |
+
<option id="OptImg1<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rd2==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
|
160 |
+
<?php } ?></select> <?php _e('<b>After Image</b> ') ?> <select id="Img1Nup" name="Img1Nup">
|
161 |
+
<?php for ($i=1;$i<=50;$i++) { ?>
|
162 |
+
<option id="Opt1Im<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rd3==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
|
163 |
+
<?php } ?></select><span style="color:#a00;font-size:75%"> (New!)</span><br/>
|
164 |
<br/>
|
165 |
<script type="text/javascript">deftcheckinfo();</script>
|
166 |
</td>
|
175 |
<input type="checkbox" id="AppCate" name="AppCate" value="true" <?php if($act){echo('checked');} ?> /> <?php _e('Categories'); ?>
|
176 |
<input type="checkbox" id="AppArch" name="AppArch" value="true" <?php if($aar){echo('checked');} ?> /> <?php _e('Archives'); ?>
|
177 |
<input type="checkbox" id="AppTags" name="AppTags" value="true" <?php if($atg){echo('checked');} ?> /> <?php _e('Tags'); ?><span> ] → </span>
|
178 |
+
<input type="checkbox" id="AppMaxA" name="AppMaxA" value="true" <?php if($amx){echo('checked');} ?> /> <?php _e('Place all possible Ads on these pages.'); ?><br/><span>[ </span>
|
179 |
+
<input type="checkbox" id="AppSide" name="AppSide" value="true" <?php if($asd){echo('checked');} ?> /> <?php _e('Disable AdsWidget on Homepage'); ?><span> ]</span> <span style="color:#a00;font-size:75%"> (New!)</span><br/>
|
180 |
<br/>
|
181 |
</td>
|
182 |
</tr>
|
186 |
<ol style="margin-top:5px;">
|
187 |
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--Ads1--></span>, <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--Ads2--></span>, etc. into a post to show the <b>Particular Ads</b> at specific location.'); ?></li>
|
188 |
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--RndAds--></span> (or more) into a post to show the <b>Random Ads</b> at specific location.'); ?></li>
|
189 |
+
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--NoAds--></span> to temporary <b>Disable Ads</b> in a post.'); ?></li>
|
190 |
+
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffAds--></span> to temporary <b>Disable All Ads</b> including AdsWidget.'); ?></li>
|
191 |
+
<li><?php _e('Insert a <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffDef--></span> to temporary <b>Disable The Default Positioned Ads</b>. You can then insert specific Ads as per item 1 above to the page.'); ?> <span style="color:#a00;font-size:75%"> (New!)</span></li>
|
192 |
</ol>
|
193 |
+
[ <input type="checkbox" id="QckRnds" name="QckRnds" value="true" <?php if($aqr){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--RndAds--></span> Quicktag Buttons'); ?> ]<br/>
|
194 |
+
[ <input type="checkbox" id="QckOffs" name="QckOffs" value="true" <?php if($aqf){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--NoAds--></span>, <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffAds--></span>, <span style="font-family:Courier New,Courier,Fixed;color:#050"><!--OffDef--></span> Quicktag Buttons'); ?> ]<br/>
|
195 |
<span class="description" style="font-style:italic"><?php _e('(Tags above tags can be inserted into a post via the additional Quicktag Buttons added to the HTML Edit Post SubPanel.)'); ?></span><br/>
|
196 |
<br/>
|
197 |
</td>
|
quick-adsense.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Plugin URI: http://techmilieu.com/quick-adsense
|
6 |
Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
7 |
Author: Philip Ze
|
8 |
-
Version: 1.
|
9 |
Author URI: http://techmilieu.com/
|
10 |
*/
|
11 |
|
@@ -34,13 +34,14 @@ global $QData;
|
|
34 |
$QData['AdsWid'] = 3; /* Ads on Widget */
|
35 |
$QData['Ads'] = 10; /* Ads on Post body */
|
36 |
$QData['Name'] = 'Quick Adsense';
|
37 |
-
$QData['Version'] = '1.
|
38 |
$QData['URI'] = 'http://techmilieu.com/quick-adsense';
|
39 |
$QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)';
|
40 |
$QData['Default'] = array(
|
41 |
-
'AdsDisp'=>'
|
42 |
'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0',
|
43 |
-
'
|
|
|
44 |
'QckTags'=>true,'QckRnds'=>false,'QckOffs'=>false
|
45 |
);
|
46 |
$QData['DefaultAdsOpt'] = array(
|
@@ -121,6 +122,7 @@ function ads_head_java() {
|
|
121 |
<?php if(!get_option('QckOffs')){ ?>
|
122 |
edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
|
123 |
edButtons[edButtons.length]=new edButton("off_ads","OffAds","\n<!--OffAds-->\n","","",-1);
|
|
|
124 |
<?php } ?>
|
125 |
};
|
126 |
</script>
|
@@ -170,34 +172,66 @@ function process_content($content)
|
|
170 |
if( !count($AdsId) ) { $content = clean_tags($content); return $content; };
|
171 |
|
172 |
/* ... Tidy up content ... */
|
173 |
-
$
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
$
|
181 |
-
|
182 |
-
$
|
183 |
-
|
184 |
-
$
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$content = clean_tags($content, true);
|
188 |
$ismany = (!is_single() && !is_page());
|
189 |
$showall = get_option('AppMaxA');
|
190 |
|
191 |
/* ... Replace Beginning/End Ads1-10 ... */
|
192 |
-
|
193 |
-
|
194 |
-
if(
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
199 |
}
|
200 |
-
}
|
|
|
201 |
/* ... Replace Ads1 to Ads10 ... */
|
202 |
if( $showall || !$ismany ) {
|
203 |
$tcn = count($AdsId); $tt = 0;
|
@@ -277,10 +311,10 @@ function replace_ads($content, $nme, $adn) {
|
|
277 |
$style = sprintf($arr[(int)$adsalign], $adsmargin);
|
278 |
$adscode = get_option('AdsCode'.$adn);
|
279 |
$adscode =
|
280 |
-
|
281 |
-
'<div style="'.$style.'">'.
|
282 |
-
$adscode.
|
283 |
-
'</div>'.
|
284 |
} else {
|
285 |
$adscode ='';
|
286 |
}
|
@@ -305,17 +339,17 @@ function ads_widget_register() {
|
|
305 |
for($i=1;$i<=$QData['AdsWid'];$i++) {
|
306 |
$displaystr =
|
307 |
'$cont = get_the_content("",0,"");'.
|
308 |
-
'if(!strpos($cont,"<!--OffAds-->")) {'.
|
309 |
'extract($args);'.
|
310 |
'$title = get_option("WidCode-title-'.$i.'");'.
|
311 |
'$codetxt = get_option("WidCode'.$i.'");'.
|
312 |
-
'echo
|
313 |
-
'echo $before_widget.
|
314 |
'if (!empty($title)) { '.
|
315 |
-
'echo $before_title.$title.$after_title.
|
316 |
'};'.
|
317 |
'echo $codetxt;'.
|
318 |
-
'echo
|
319 |
'}';
|
320 |
$controlstr =
|
321 |
'if ($_POST["WidCodeSubmit'.$i.'"]) {'.
|
5 |
Plugin URI: http://techmilieu.com/quick-adsense
|
6 |
Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
7 |
Author: Philip Ze
|
8 |
+
Version: 1.5
|
9 |
Author URI: http://techmilieu.com/
|
10 |
*/
|
11 |
|
34 |
$QData['AdsWid'] = 3; /* Ads on Widget */
|
35 |
$QData['Ads'] = 10; /* Ads on Post body */
|
36 |
$QData['Name'] = 'Quick Adsense';
|
37 |
+
$QData['Version'] = '1.5';
|
38 |
$QData['URI'] = 'http://techmilieu.com/quick-adsense';
|
39 |
$QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)';
|
40 |
$QData['Default'] = array(
|
41 |
+
'AdsDisp'=>'10',
|
42 |
'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0',
|
43 |
+
'Par1Ads'=>false,'Par1Rnd'=>'0','Par1Nup'=>'0','Img1Ads'=>false,'Img1Rnd'=>'0','Img1Nup'=>'0',
|
44 |
+
'AppPost'=>true,'AppPage'=>true,'AppHome'=>false,'AppCate'=>false,'AppArch'=>false,'AppTags'=>false,'AppMaxA'=>false,'AppSide'=>false,
|
45 |
'QckTags'=>true,'QckRnds'=>false,'QckOffs'=>false
|
46 |
);
|
47 |
$QData['DefaultAdsOpt'] = array(
|
122 |
<?php if(!get_option('QckOffs')){ ?>
|
123 |
edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
|
124 |
edButtons[edButtons.length]=new edButton("off_ads","OffAds","\n<!--OffAds-->\n","","",-1);
|
125 |
+
edButtons[edButtons.length]=new edButton("off_def","OffDef","\n<!--OffDef-->\n","","",-1);
|
126 |
<?php } ?>
|
127 |
};
|
128 |
</script>
|
172 |
if( !count($AdsId) ) { $content = clean_tags($content); return $content; };
|
173 |
|
174 |
/* ... Tidy up content ... */
|
175 |
+
$offdef = strpos($content,'<!--OffDef-->');
|
176 |
+
if( !$offdef ) {
|
177 |
+
$AdsIdCus = array();
|
178 |
+
$cusads = 'CusAds'; $cusrnd = 'CusRnd';
|
179 |
+
$begn1 = get_option('BegnAds'); $begn2 = get_option('BegnRnd');
|
180 |
+
$endi1 = get_option('EndiAds'); $endi2 = get_option('EndiRnd');
|
181 |
+
$para1 = get_option('Par1Ads'); $para2 = get_option('Par1Rnd'); $para3 = get_option('Par1Nup');
|
182 |
+
$imge1 = get_option('Img1Ads'); $imge2 = get_option('Img1Rnd'); $imge3 = get_option('Img1Nup');
|
183 |
+
if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
|
184 |
+
if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
|
185 |
+
if ( $para2 == 0 ) { $b3 = $cusrnd; } else { $b3 = $cusads.$para2; array_push($AdsIdCus, $para2); };
|
186 |
+
if ( $imge2 == 0 ) { $b4 = $cusrnd; } else { $b4 = $cusads.$imge2; array_push($AdsIdCus, $imge2); };
|
187 |
+
if( $begn1 ) {
|
188 |
+
$content = '<!--'.$b1.'-->'.$content;
|
189 |
+
}
|
190 |
+
if( $endi1 ) {
|
191 |
+
$content = $content.'<!--'.$b2.'-->';
|
192 |
+
}
|
193 |
+
if ( $para1 ){
|
194 |
+
$sch = "</p>";
|
195 |
+
$content = str_replace("</P>", $sch, $content);
|
196 |
+
$arr = explode($sch, $content);
|
197 |
+
if ( (int)$para3 < count($arr) ) {
|
198 |
+
$content = implode($sch, array_slice($arr, 0, $para3)).$sch .'<!--'.$b3.'-->'. implode($sch, array_slice($arr, $para3));
|
199 |
+
}
|
200 |
+
}
|
201 |
+
if ( $imge1 ){
|
202 |
+
$sch = "<img";
|
203 |
+
$bch = ">";
|
204 |
+
$content = str_replace("<IMG", $sch, $content);
|
205 |
+
$arr = explode($sch, $content);
|
206 |
+
if ( (int)$imge3 < count($arr) ) {
|
207 |
+
$trr = explode($bch, $arr[$imge3]);
|
208 |
+
if ( count($trr) ) {
|
209 |
+
$arr[$imge3] = implode($bch, array_slice($trr, 0, 1)).$bch. "\n".'<!--'.$b4.'-->'."\n". implode($bch, array_slice($trr, 1));
|
210 |
+
}
|
211 |
+
$content = implode($sch, $arr);
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/* ... Tidy up content ... */
|
217 |
+
$content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
|
218 |
$content = clean_tags($content, true);
|
219 |
$ismany = (!is_single() && !is_page());
|
220 |
$showall = get_option('AppMaxA');
|
221 |
|
222 |
/* ... Replace Beginning/End Ads1-10 ... */
|
223 |
+
if( !$offdef ) {
|
224 |
+
for( $i=1; $i<=count($AdsIdCus); $i++ ) {
|
225 |
+
if( $showall || !$ismany || $beginend != $i ) {
|
226 |
+
if( strpos($content, '<!--'.$cusads.$AdsIdCus[$i-1].'-->') && in_array($AdsIdCus[$i-1], $AdsId)) {
|
227 |
+
$content = replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] ); $AdsId = del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
|
228 |
+
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; };
|
229 |
+
$beginend = $i; if(!$showall && $ismany){break;}
|
230 |
+
}
|
231 |
+
}
|
232 |
}
|
233 |
+
}
|
234 |
+
|
235 |
/* ... Replace Ads1 to Ads10 ... */
|
236 |
if( $showall || !$ismany ) {
|
237 |
$tcn = count($AdsId); $tt = 0;
|
311 |
$style = sprintf($arr[(int)$adsalign], $adsmargin);
|
312 |
$adscode = get_option('AdsCode'.$adn);
|
313 |
$adscode =
|
314 |
+
"\n".'<!-- '.$QData['Name'].' Wordpress Plugin: '.$QData['URI'].' -->'."\n".
|
315 |
+
'<div style="'.$style.'">'."\n".
|
316 |
+
$adscode."\n".
|
317 |
+
'</div>'."\n";
|
318 |
} else {
|
319 |
$adscode ='';
|
320 |
}
|
339 |
for($i=1;$i<=$QData['AdsWid'];$i++) {
|
340 |
$displaystr =
|
341 |
'$cont = get_the_content("",0,"");'.
|
342 |
+
'if( !strpos($cont,"<!--OffAds-->") && !(is_home()&&get_option("AppSide")) ) {'.
|
343 |
'extract($args);'.
|
344 |
'$title = get_option("WidCode-title-'.$i.'");'.
|
345 |
'$codetxt = get_option("WidCode'.$i.'");'.
|
346 |
+
'echo "\n"."<!-- Quick Adsense Wordpress Plugin: http://techmilieu.com/quick-adsense -->"."\n";'.
|
347 |
+
'echo $before_widget."\n";'.
|
348 |
'if (!empty($title)) { '.
|
349 |
+
'echo $before_title.$title.$after_title."\n"; '.
|
350 |
'};'.
|
351 |
'echo $codetxt;'.
|
352 |
+
'echo "\n".$after_widget;'.
|
353 |
'}';
|
354 |
$controlstr =
|
355 |
'if ($_POST["WidCodeSubmit'.$i.'"]) {'.
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Philip Ze
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8609041
|
4 |
Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 2.8.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
10 |
|
@@ -17,10 +17,11 @@ In general, placing Adsense randomly within a post is a good way to experiment a
|
|
17 |
Here are some **features** that come with this plugin:
|
18 |
|
19 |
1. Absolutely NO author revenue reward or revenue sharing from your Adsense or that kind of features.
|
20 |
-
1.
|
|
|
21 |
1. Simple configuration interface, requires no coding knowledge: Just copy and paste AdSense code, tick & select options, the plugin will then do the rest for you.
|
22 |
1. Support any Ads code, not limited to Adsense code only.
|
23 |
-
1. Display up to a maximum of
|
24 |
1. Support up to a maximum of 3 Ads codes on Sidebar Widgets.
|
25 |
1. Support up to a maximum of 10 Ads codes for specific placement & randomization within a post.
|
26 |
1. Ads placement on the fly, simply insert <!--Ads1-->, <!--Ads2--> ... , <!--RndAds-->, <!--NoAds-->, <!--OffAds--> to a post to accomplish this.
|
@@ -48,6 +49,13 @@ Please feedback to [http://techmilieu.com/quick-adsense](http://techmilieu.com/q
|
|
48 |
|
49 |
== Change Log ==
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
= 1.4 =
|
52 |
* Fix for plugin user Roles. Now, only Administrator is allowed to read & modified the plugin.
|
53 |
* Quicktag Buttons for Ads1-Ads10 are now automatically shown only when the Ads codes are available. You will have the option to hide the RndAds, NoAds & OffAds Quicktag Buttons.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8609041
|
4 |
Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 2.8.6
|
7 |
+
Stable tag: 1.5
|
8 |
|
9 |
Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
10 |
|
17 |
Here are some **features** that come with this plugin:
|
18 |
|
19 |
1. Absolutely NO author revenue reward or revenue sharing from your Adsense or that kind of features.
|
20 |
+
1. Default Ads positioning: Assign Ads at the beginning of post, assign Ads at the end of post, assign Ads after certain paragraphs & assign Ads after certain images.
|
21 |
+
1. Flexible Ads placement, insert Ads specifically or randomly anywhere within a post.
|
22 |
1. Simple configuration interface, requires no coding knowledge: Just copy and paste AdSense code, tick & select options, the plugin will then do the rest for you.
|
23 |
1. Support any Ads code, not limited to Adsense code only.
|
24 |
+
1. Display up to a maximum of 10 Ads on a page. Google allows publishers to place up to 3 Adsense for Content on a page. If you are using other Ads, you may display up to 10 Ads.
|
25 |
1. Support up to a maximum of 3 Ads codes on Sidebar Widgets.
|
26 |
1. Support up to a maximum of 10 Ads codes for specific placement & randomization within a post.
|
27 |
1. Ads placement on the fly, simply insert <!--Ads1-->, <!--Ads2--> ... , <!--RndAds-->, <!--NoAds-->, <!--OffAds--> to a post to accomplish this.
|
49 |
|
50 |
== Change Log ==
|
51 |
|
52 |
+
= 1.5 =
|
53 |
+
* Add two new functionality for default Ads positioning: Assign Ads after certain paragraphs & assign Ads after certain images.
|
54 |
+
* You can now disable AdsWidget (Sidebar Ads) on Homepage.
|
55 |
+
* Insert a <!--OffDef--> to temporary disable the default positioned Ads, so that you can insert the specific Ads or Random ad tags in the post.
|
56 |
+
* Google allows publishers to place up to 3 Adsense for Content on a page. If you are using other Ads, you may now display up to 10 Ads.
|
57 |
+
* Minor bug fixed & code modifications.
|
58 |
+
|
59 |
= 1.4 =
|
60 |
* Fix for plugin user Roles. Now, only Administrator is allowed to read & modified the plugin.
|
61 |
* Quicktag Buttons for Ads1-Ads10 are now automatically shown only when the Ads codes are available. You will have the option to hide the RndAds, NoAds & OffAds Quicktag Buttons.
|