Quick Adsense - Version 1.8.1

Version Description

  • Add a new functionality for default Ads positioning: Assign Ads to Middle of post.
  • Date: 22-Nov-2010
Download this release

Release Info

Developer philipze
Plugin Icon 128x128 Quick Adsense
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8 to 1.8.1

Files changed (3) hide show
  1. quick-adsense-admin.php +13 -3
  2. quick-adsense.php +27 -5
  3. readme.txt +6 -2
quick-adsense-admin.php CHANGED
@@ -24,6 +24,8 @@
24
  $dis = get_option('AdsDisp');if(!$dis&&is_bool($dis)){$dis=$QData['Default']['AdsDisp'];};
25
  $ra1 = get_option('BegnAds');
26
  $ra2 = get_option('BegnRnd');
 
 
27
  $rb1 = get_option('EndiAds');
28
  $rb2 = get_option('EndiRnd');
29
  $rc = 3;
@@ -65,6 +67,8 @@
65
  document.getElementById("DisTot<?php echo($QData['Default']['AdsDisp']) ?>").selected = true;
66
  document.getElementById("BegnAds").checked = <?php echo(truefalse($QData['Default']['BegnAds'])) ?>;
67
  document.getElementById("BegnRnd").selectedIndex = <?php echo($QData['Default']['BegnRnd']) ?>;
 
 
68
  document.getElementById("EndiAds").checked = <?php echo(truefalse($QData['Default']['EndiAds'])) ?>;
69
  document.getElementById("EndiRnd").selectedIndex = <?php echo($QData['Default']['EndiRnd']) ?>;
70
  <?php for ($j=1;$j<=$rc;$j++) { ?>
@@ -100,6 +104,7 @@
100
  if (ts.selectedIndex == 0) { return; }
101
  cek = new Array(
102
  document.getElementById('BegnRnd'),
 
103
  document.getElementById('EndiRnd'),
104
  document.getElementById('Par1Rnd'),
105
  document.getElementById('Par2Rnd'),
@@ -121,6 +126,7 @@
121
  }
122
  function deftcheckinfo() {
123
  checkinfo1('BegnRnd',document.getElementById('BegnAds'));
 
124
  checkinfo1('EndiRnd',document.getElementById('EndiAds'));
125
  for (i=1;i<=3;i++) {
126
  checkinfo2(document.getElementById('Par'+i+'Ads'),'Par'+i+'Rnd','Par'+i+'Nup','Par'+i+'Con');
@@ -155,6 +161,10 @@
155
  <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
156
  <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>
157
  <?php } ?></select> <?php _e('to <b>Beginning of Post') ?></b><br/>
 
 
 
 
158
  <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)">
159
  <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
160
  <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>
@@ -220,11 +230,11 @@
220
  </td>
221
  </tr>
222
  <tr valign="top">
223
- <td style="width:110px">
224
- <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8609041" target="_blank" rel="nofollow"><img alt="PayPal" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" /></a>
 
225
  <br/>
226
  </td>
227
- <td></td>
228
  </tr>
229
 
230
  </table>
24
  $dis = get_option('AdsDisp');if(!$dis&&is_bool($dis)){$dis=$QData['Default']['AdsDisp'];};
25
  $ra1 = get_option('BegnAds');
26
  $ra2 = get_option('BegnRnd');
27
+ $rm1 = get_option('MiddAds');
28
+ $rm2 = get_option('MiddRnd');
29
  $rb1 = get_option('EndiAds');
30
  $rb2 = get_option('EndiRnd');
31
  $rc = 3;
67
  document.getElementById("DisTot<?php echo($QData['Default']['AdsDisp']) ?>").selected = true;
68
  document.getElementById("BegnAds").checked = <?php echo(truefalse($QData['Default']['BegnAds'])) ?>;
69
  document.getElementById("BegnRnd").selectedIndex = <?php echo($QData['Default']['BegnRnd']) ?>;
70
+ document.getElementById("MiddAds").checked = <?php echo(truefalse($QData['Default']['MiddAds'])) ?>;
71
+ document.getElementById("MiddRnd").selectedIndex = <?php echo($QData['Default']['MiddRnd']) ?>;
72
  document.getElementById("EndiAds").checked = <?php echo(truefalse($QData['Default']['EndiAds'])) ?>;
73
  document.getElementById("EndiRnd").selectedIndex = <?php echo($QData['Default']['EndiRnd']) ?>;
74
  <?php for ($j=1;$j<=$rc;$j++) { ?>
104
  if (ts.selectedIndex == 0) { return; }
105
  cek = new Array(
106
  document.getElementById('BegnRnd'),
107
+ document.getElementById('MiddRnd'),
108
  document.getElementById('EndiRnd'),
109
  document.getElementById('Par1Rnd'),
110
  document.getElementById('Par2Rnd'),
126
  }
127
  function deftcheckinfo() {
128
  checkinfo1('BegnRnd',document.getElementById('BegnAds'));
129
+ checkinfo1('MiddRnd',document.getElementById('MiddAds'));
130
  checkinfo1('EndiRnd',document.getElementById('EndiAds'));
131
  for (i=1;i<=3;i++) {
132
  checkinfo2(document.getElementById('Par'+i+'Ads'),'Par'+i+'Rnd','Par'+i+'Nup','Par'+i+'Con');
161
  <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
162
  <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>
163
  <?php } ?></select> <?php _e('to <b>Beginning of Post') ?></b><br/>
164
+ <input type="checkbox" id="MiddAds" name="MiddAds" value="false" <?php if($rm1){echo('checked');} ?> onchange="checkinfo1('MiddRnd',this)" /> <?php _e('Assign') ; ?> <select id="MiddRnd" name="MiddRnd" onchange="selectinfo(this)">
165
+ <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
166
+ <option id="OptMidd<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if($rm2==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
167
+ <?php } ?></select> <?php _e('to <b>Middle of Post') ?></b><span style="color:#a00;font-size:75%"> <b>(New!)</b></span><br/>
168
  <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)">
169
  <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
170
  <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>
230
  </td>
231
  </tr>
232
  <tr valign="top">
233
+ <td style="width:110px"></td>
234
+ <td style="padding-top:8px">
235
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8609041" target="_blank" rel="nofollow"><img alt="PayPal" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" /></a>
236
  <br/>
237
  </td>
 
238
  </tr>
239
 
240
  </table>
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.8
9
  Author URI: http://techmilieu.com/
10
  */
11
 
@@ -34,12 +34,12 @@ global $QData;
34
  $QData['AdsWid'] = 10; /* Ads on Widget */
35
  $QData['Ads'] = 10; /* Ads on Post body */
36
  $QData['Name'] = 'Quick Adsense';
37
- $QData['Version'] = '1.8';
38
  $QData['URI'] = 'http://techmilieu.com/quick-adsense';
39
  $QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)';
40
  $QData['Default'] = array(
41
  'AdsDisp'=>'3',
42
- 'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0',
43
  'Par1Ads'=>false,'Par1Rnd'=>'0','Par1Nup'=>'0','Par1Con'=>false,
44
  'Par2Ads'=>false,'Par2Rnd'=>'0','Par2Nup'=>'0','Par2Con'=>false,
45
  'Par3Ads'=>false,'Par3Rnd'=>'0','Par3Nup'=>'0','Par3Con'=>false,
@@ -179,6 +179,7 @@ function process_content($content)
179
  $AdsIdCus = array();
180
  $cusads = 'CusAds'; $cusrnd = 'CusRnd';
181
  $begn1 = get_option('BegnAds'); $begn2 = get_option('BegnRnd');
 
182
  $endi1 = get_option('EndiAds'); $endi2 = get_option('EndiRnd');
183
  $rc=3;
184
  for($i=1;$i<=$rc;$i++) {
@@ -186,11 +187,32 @@ function process_content($content)
186
  }
187
  $imge1 = get_option('Img1Ads'); $imge2 = get_option('Img1Rnd'); $imge3 = get_option('Img1Nup');
188
  if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
 
189
  if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
190
  for($i=1;$i<=$rc;$i++) {
191
  if ( $para2[$i] == 0 ) { $b3[$i] = $cusrnd; } else { $b3[$i] = $cusads.$para2[$i]; array_push($AdsIdCus, $para2[$i]); };
192
  }
193
  if ( $imge2 == 0 ) { $b4 = $cusrnd; } else { $b4 = $cusads.$imge2; array_push($AdsIdCus, $imge2); };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  if( $begn1 ) {
195
  $content = '<!--'.$b1.'-->'.$content;
196
  }
@@ -230,7 +252,7 @@ function process_content($content)
230
  $ismany = (!is_single() && !is_page());
231
  $showall = get_option('AppMaxA');
232
 
233
- /* ... Replace Beginning/End Ads1-10 ... */
234
  if( !$offdef ) {
235
  for( $i=1; $i<=count($AdsIdCus); $i++ ) {
236
  if( $showall || !$ismany || $beginend != $i ) {
@@ -255,7 +277,7 @@ function process_content($content)
255
  }
256
  }
257
  }
258
- /* ... Replace Beginning/End random Ads ... */
259
  if( strpos($content, '<!--'.$cusrnd.'-->') && ($showall || !$ismany) ) {
260
  $tcx = count($AdsId);
261
  $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
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.8.1
9
  Author URI: http://techmilieu.com/
10
  */
11
 
34
  $QData['AdsWid'] = 10; /* Ads on Widget */
35
  $QData['Ads'] = 10; /* Ads on Post body */
36
  $QData['Name'] = 'Quick Adsense';
37
+ $QData['Version'] = '1.8.1';
38
  $QData['URI'] = 'http://techmilieu.com/quick-adsense';
39
  $QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)';
40
  $QData['Default'] = array(
41
  'AdsDisp'=>'3',
42
+ 'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0','MiddAds'=>false,'MiddRnd'=>'0',
43
  'Par1Ads'=>false,'Par1Rnd'=>'0','Par1Nup'=>'0','Par1Con'=>false,
44
  'Par2Ads'=>false,'Par2Rnd'=>'0','Par2Nup'=>'0','Par2Con'=>false,
45
  'Par3Ads'=>false,'Par3Rnd'=>'0','Par3Nup'=>'0','Par3Con'=>false,
179
  $AdsIdCus = array();
180
  $cusads = 'CusAds'; $cusrnd = 'CusRnd';
181
  $begn1 = get_option('BegnAds'); $begn2 = get_option('BegnRnd');
182
+ $midd1 = get_option('MiddAds'); $midd2 = get_option('MiddRnd');
183
  $endi1 = get_option('EndiAds'); $endi2 = get_option('EndiRnd');
184
  $rc=3;
185
  for($i=1;$i<=$rc;$i++) {
187
  }
188
  $imge1 = get_option('Img1Ads'); $imge2 = get_option('Img1Rnd'); $imge3 = get_option('Img1Nup');
189
  if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
190
+ if ( $midd2 == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$midd2; array_push($AdsIdCus, $midd2); };
191
  if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
192
  for($i=1;$i<=$rc;$i++) {
193
  if ( $para2[$i] == 0 ) { $b3[$i] = $cusrnd; } else { $b3[$i] = $cusads.$para2[$i]; array_push($AdsIdCus, $para2[$i]); };
194
  }
195
  if ( $imge2 == 0 ) { $b4 = $cusrnd; } else { $b4 = $cusads.$imge2; array_push($AdsIdCus, $imge2); };
196
+ if( $midd1 ) {
197
+ if( substr_count(strtolower($content), '</p>')>=2 ) {
198
+ $sch = "</p>";
199
+ $content = str_replace("</P>", $sch, $content);
200
+ $arr = explode($sch, $content);
201
+ $nn = 0; $mm = strlen($content)/2;
202
+ for($i=0;$i<count($arr);$i++) {
203
+ $nn += strlen($arr[$i]) + 4;
204
+ if($nn>$mm) {
205
+ if( ($mm - ($nn - strlen($arr[$i]))) > ($nn - $mm) && $i+1<count($arr) ) {
206
+ $arr[$i+1] = '<!--'.$m1.'-->'.$arr[$i+1];
207
+ } else {
208
+ $arr[$i] = '<!--'.$m1.'-->'.$arr[$i];
209
+ }
210
+ break;
211
+ }
212
+ }
213
+ $content = implode($sch, $arr);
214
+ }
215
+ }
216
  if( $begn1 ) {
217
  $content = '<!--'.$b1.'-->'.$content;
218
  }
252
  $ismany = (!is_single() && !is_page());
253
  $showall = get_option('AppMaxA');
254
 
255
+ /* ... Replace Beginning/Middle/End Ads1-10 ... */
256
  if( !$offdef ) {
257
  for( $i=1; $i<=count($AdsIdCus); $i++ ) {
258
  if( $showall || !$ismany || $beginend != $i ) {
277
  }
278
  }
279
  }
280
+ /* ... Replace Beginning/Middle/End random Ads ... */
281
  if( strpos($content, '<!--'.$cusrnd.'-->') && ($showall || !$ismany) ) {
282
  $tcx = count($AdsId);
283
  $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
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: 3.0.1
7
- Stable tag: 1.8
8
 
9
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
10
 
@@ -17,7 +17,7 @@ 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. Default Ads positioning: Assign Ads at the beginning of post, assign Ads at the end of post, assign Ads after certain paragraphs (3 options available) & 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.
@@ -49,6 +49,10 @@ Please feedback to [http://techmilieu.com/quick-adsense](http://techmilieu.com/q
49
 
50
  == Change Log ==
51
 
 
 
 
 
52
  = 1.8 =
53
  * Text correction: Change the words "must be identical" to "must not be identical".
54
  * Add two more functionality for default Ads positioning after certain paragraphs, make it up to the total of three.
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: 3.0.1
7
+ Stable tag: 1.8.1
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 to the beginning of post, assign Ads to the middle of post, assign Ads to the end of post, assign Ads after certain paragraphs (3 options available) & 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.
49
 
50
  == Change Log ==
51
 
52
+ = 1.8.1 =
53
+ * Add a new functionality for default Ads positioning: Assign Ads to Middle of post.
54
+ * Date: 22-Nov-2010
55
+
56
  = 1.8 =
57
  * Text correction: Change the words "must be identical" to "must not be identical".
58
  * Add two more functionality for default Ads positioning after certain paragraphs, make it up to the total of three.