Version Description
- Code modification: Option to place all possible Ads on Homepage, Categories, Archives and Tags page. Previously, only one Ads (the one assigned to the Beginning of Post) is displayed.
- Code update to take advantage of some WP functions for options page, also for forward compatibility in future version.
- Code update to make it compatible with WordpressMU, tested on WordpressMU 2.7.1
- Some minor page & wording modification.
- Date: 13-Oct-2009
Download this release
Release Info
Developer | philipze |
Plugin | Quick Adsense |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- quick-adsense-admin.php +25 -17
- quick-adsense.php +41 -20
- readme.txt +8 -1
quick-adsense-admin.php
CHANGED
@@ -32,13 +32,16 @@
|
|
32 |
$act = get_option('AppCate');
|
33 |
$aar = get_option('AppArch');
|
34 |
$atg = get_option('AppTags');
|
|
|
35 |
$aqt = get_option('QckTags');
|
36 |
-
$optionsupdate =
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
function truefalse($arg) {
|
43 |
if($arg){ return 'true';}else{ return 'false';}
|
44 |
}
|
@@ -57,12 +60,13 @@
|
|
57 |
document.getElementById("AppCate").checked = <?php echo(truefalse($QData['Default']['AppCate'])) ?>;
|
58 |
document.getElementById("AppArch").checked = <?php echo(truefalse($QData['Default']['AppArch'])) ?>;
|
59 |
document.getElementById("AppTags").checked = <?php echo(truefalse($QData['Default']['AppTags'])) ?>;
|
|
|
60 |
document.getElementById("QckTags").checked = <?php echo(truefalse($QData['Default']['QckTags'])) ?>;
|
61 |
for(i=1;i<=<?php echo($QData['Ads']) ?>;i++){
|
62 |
tp=document.getElementById("AdsCode"+i.toString()).innerHTML;
|
63 |
if(tp==''){
|
64 |
-
document.getElementById("AdsMargin"+i.toString()).value = "<?php echo($QData['
|
65 |
-
document.getElementById("OptAgn"+i.toString()+"<?php echo($QData['
|
66 |
}
|
67 |
}
|
68 |
deftcheckinfo();
|
@@ -95,7 +99,7 @@
|
|
95 |
<h2>Quick Adsense <?php _e('Setting'); ?> <span style="font-size:9pt;font-style:italic">( Version <?php echo($QData['Version']) ?> )</span></h2>
|
96 |
|
97 |
<form method="post" action="options.php">
|
98 |
-
<?php wp_nonce_field('update-options');
|
99 |
|
100 |
<h3 style="font-size:120%"><?php _e('Options'); ?></h3>
|
101 |
|
@@ -107,7 +111,7 @@
|
|
107 |
<option id="DisTot1" value="1" <?php if($dis=="1"){echo('selected');} ?>>1</option>
|
108 |
<option id="DisTot2" value="2" <?php if($dis=="2"){echo('selected');} ?>>2</option>
|
109 |
<option id="DisTot3" value="3" <?php if($dis=="3"){echo('selected');} ?>>3</option></select><?php _e(' Ads on a page.'); ?><br/>
|
110 |
-
<span class="description"><?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/>
|
111 |
<br/>
|
112 |
</td>
|
113 |
</tr>
|
@@ -117,7 +121,7 @@
|
|
117 |
<input type="checkbox" id="BegnAds" name="BegnAds" value="true" <?php if($ra1){echo('checked');} ?> onchange="checkinfo('BegnRnd',this)" /> <?php _e('Assign') ; ?> <select id="BegnRnd" name="BegnRnd" onchange="selectinfo(this)">
|
118 |
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
119 |
<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>
|
120 |
-
<?php } ?></select> <?php _e('to the <b>
|
121 |
<input type="checkbox" id="EndiAds" name="EndiAds" value="false" <?php if($rb1){echo('checked');} ?> onchange="checkinfo('EndiRnd',this)" /> <?php _e('Assign') ; ?> <select id="EndiRnd" name="EndiRnd" onchange="selectinfo(this)">
|
122 |
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
123 |
<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>
|
@@ -129,12 +133,14 @@
|
|
129 |
<tr valign="top">
|
130 |
<td style="width:110px"><?php _e('Appearance :'); ?></td>
|
131 |
<td>
|
|
|
132 |
<input type="checkbox" id="AppPost" name="AppPost" value="true" <?php if($aps){echo('checked');} ?> /> <?php _e('Posts'); ?>
|
133 |
-
<input type="checkbox" id="AppPage" name="AppPage" value="true" <?php if($apg){echo('checked');} ?> /> <?php _e('Pages'); ?><span>
|
134 |
<input type="checkbox" id="AppHome" name="AppHome" value="true" <?php if($ahm){echo('checked');} ?> /> <?php _e('Homepage'); ?>
|
135 |
<input type="checkbox" id="AppCate" name="AppCate" value="true" <?php if($act){echo('checked');} ?> /> <?php _e('Categories'); ?>
|
136 |
<input type="checkbox" id="AppArch" name="AppArch" value="true" <?php if($aar){echo('checked');} ?> /> <?php _e('Archives'); ?>
|
137 |
-
<input type="checkbox" id="AppTags" name="AppTags" value="true" <?php if($atg){echo('checked');} ?> /> <?php _e('Tags'); ?><
|
|
|
138 |
<br/>
|
139 |
</td>
|
140 |
</tr>
|
@@ -147,7 +153,7 @@
|
|
147 |
<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>
|
148 |
<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>
|
149 |
</ol>
|
150 |
-
<span class="description"><?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/>
|
151 |
<br/>
|
152 |
</td>
|
153 |
</tr>
|
@@ -155,8 +161,9 @@
|
|
155 |
<td style="width:110px"><?php _e('Infomation :'); ?></td>
|
156 |
<td>
|
157 |
<?php echo(__(
|
158 |
-
'
|
159 |
-
'
|
|
|
160 |
</tr>
|
161 |
</table>
|
162 |
|
@@ -201,7 +208,8 @@
|
|
201 |
</table>
|
202 |
|
203 |
<input type="hidden" name="action" value="update" />
|
204 |
-
<input type="hidden" name="page_options" value="<?php echo $optionsupdate; ?>" />
|
|
|
205 |
<div style="width:580px">
|
206 |
<span style="float:right;padding-top:18px">[ <a href="javascript:defaultoptions()"><?php _e('Load Default Setting') ?></a> ]</span>
|
207 |
<p class="submit">
|
32 |
$act = get_option('AppCate');
|
33 |
$aar = get_option('AppArch');
|
34 |
$atg = get_option('AppTags');
|
35 |
+
$amx = get_option('AppMaxA');
|
36 |
$aqt = get_option('QckTags');
|
37 |
+
$optionsupdate = '';
|
38 |
+
foreach ($QData['Default'] as $key => $value) {
|
39 |
+
$optionsupdate .= $key.',' ;
|
40 |
+
}
|
41 |
+
foreach ($QData['DefaultAdsName'] as $key => $value) {
|
42 |
+
$optionsupdate .= $value.',' ;
|
43 |
+
}
|
44 |
+
$optionsupdate = substr($optionsupdate, 0, -1);
|
45 |
function truefalse($arg) {
|
46 |
if($arg){ return 'true';}else{ return 'false';}
|
47 |
}
|
60 |
document.getElementById("AppCate").checked = <?php echo(truefalse($QData['Default']['AppCate'])) ?>;
|
61 |
document.getElementById("AppArch").checked = <?php echo(truefalse($QData['Default']['AppArch'])) ?>;
|
62 |
document.getElementById("AppTags").checked = <?php echo(truefalse($QData['Default']['AppTags'])) ?>;
|
63 |
+
document.getElementById("AppMaxA").checked = <?php echo(truefalse($QData['Default']['AppMaxA'])) ?>;
|
64 |
document.getElementById("QckTags").checked = <?php echo(truefalse($QData['Default']['QckTags'])) ?>;
|
65 |
for(i=1;i<=<?php echo($QData['Ads']) ?>;i++){
|
66 |
tp=document.getElementById("AdsCode"+i.toString()).innerHTML;
|
67 |
if(tp==''){
|
68 |
+
document.getElementById("AdsMargin"+i.toString()).value = "<?php echo($QData['DefaultAdsOpt']['AdsMargin']) ?>";
|
69 |
+
document.getElementById("OptAgn"+i.toString()+"<?php echo($QData['DefaultAdsOpt']['AdsAlign']) ?>").selected = true;
|
70 |
}
|
71 |
}
|
72 |
deftcheckinfo();
|
99 |
<h2>Quick Adsense <?php _e('Setting'); ?> <span style="font-size:9pt;font-style:italic">( Version <?php echo($QData['Version']) ?> )</span></h2>
|
100 |
|
101 |
<form method="post" action="options.php">
|
102 |
+
<?php /* wp_nonce_field('update-options'); */?>
|
103 |
|
104 |
<h3 style="font-size:120%"><?php _e('Options'); ?></h3>
|
105 |
|
111 |
<option id="DisTot1" value="1" <?php if($dis=="1"){echo('selected');} ?>>1</option>
|
112 |
<option id="DisTot2" value="2" <?php if($dis=="2"){echo('selected');} ?>>2</option>
|
113 |
<option id="DisTot3" value="3" <?php if($dis=="3"){echo('selected');} ?>>3</option></select><?php _e(' Ads on a page.'); ?><br/>
|
114 |
+
<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/>
|
115 |
<br/>
|
116 |
</td>
|
117 |
</tr>
|
121 |
<input type="checkbox" id="BegnAds" name="BegnAds" value="true" <?php if($ra1){echo('checked');} ?> onchange="checkinfo('BegnRnd',this)" /> <?php _e('Assign') ; ?> <select id="BegnRnd" name="BegnRnd" onchange="selectinfo(this)">
|
122 |
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
123 |
<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>
|
124 |
+
<?php } ?></select> <?php _e('to the <b>Beginning of Post') ?></b><br/>
|
125 |
<input type="checkbox" id="EndiAds" name="EndiAds" value="false" <?php if($rb1){echo('checked');} ?> onchange="checkinfo('EndiRnd',this)" /> <?php _e('Assign') ; ?> <select id="EndiRnd" name="EndiRnd" onchange="selectinfo(this)">
|
126 |
<?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
|
127 |
<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>
|
133 |
<tr valign="top">
|
134 |
<td style="width:110px"><?php _e('Appearance :'); ?></td>
|
135 |
<td>
|
136 |
+
<span>[ </span>
|
137 |
<input type="checkbox" id="AppPost" name="AppPost" value="true" <?php if($aps){echo('checked');} ?> /> <?php _e('Posts'); ?>
|
138 |
+
<input type="checkbox" id="AppPage" name="AppPage" value="true" <?php if($apg){echo('checked');} ?> /> <?php _e('Pages'); ?><span> ]</span><br/><span>[ </span>
|
139 |
<input type="checkbox" id="AppHome" name="AppHome" value="true" <?php if($ahm){echo('checked');} ?> /> <?php _e('Homepage'); ?>
|
140 |
<input type="checkbox" id="AppCate" name="AppCate" value="true" <?php if($act){echo('checked');} ?> /> <?php _e('Categories'); ?>
|
141 |
<input type="checkbox" id="AppArch" name="AppArch" value="true" <?php if($aar){echo('checked');} ?> /> <?php _e('Archives'); ?>
|
142 |
+
<input type="checkbox" id="AppTags" name="AppTags" value="true" <?php if($atg){echo('checked');} ?> /> <?php _e('Tags'); ?><span> ] → </span>
|
143 |
+
<input type="checkbox" id="AppMaxA" name="AppMaxA" value="true" <?php if($amx){echo('checked');} ?> /> <?php _e('Place all possible Ads on these pages <span style="color:#f00">(New!)</span>.'); ?><br/>
|
144 |
<br/>
|
145 |
</td>
|
146 |
</tr>
|
153 |
<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>
|
154 |
<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>
|
155 |
</ol>
|
156 |
+
<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/>
|
157 |
<br/>
|
158 |
</td>
|
159 |
</tr>
|
161 |
<td style="width:110px"><?php _e('Infomation :'); ?></td>
|
162 |
<td>
|
163 |
<?php echo(__(
|
164 |
+
'A link from your blog to <b>TechMilieu</b> (http://techmilieu.com/) would be highly appreciated. A tiny button is also available for the link (http://techmilieu.com/images/link-20x20.png). '.
|
165 |
+
'Visit <a href="http://techmilieu.com/quick-adsense" target="_blank">http://techmilieu.com/quick-adsense</a> for more information & updates about this plugin.'
|
166 |
+
)); ?>
|
167 |
</tr>
|
168 |
</table>
|
169 |
|
208 |
</table>
|
209 |
|
210 |
<input type="hidden" name="action" value="update" />
|
211 |
+
<?php /* <input type="hidden" name="page_options" value="<?php echo $optionsupdate; ?>" /> */ ?>
|
212 |
+
<?php settings_fields('qa-options'); ?>
|
213 |
<div style="width:580px">
|
214 |
<span style="float:right;padding-top:18px">[ <a href="javascript:defaultoptions()"><?php _e('Load Default Setting') ?></a> ]</span>
|
215 |
<p class="submit">
|
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,16 +34,27 @@ 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'=>'3',
|
42 |
'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0',
|
43 |
-
'AppPost'=>true,'AppPage'=>true,'AppHome'=>false,'AppCate'=>false,'AppArch'=>false,'AppTags'=>false,
|
44 |
-
'QckTags'=>true
|
45 |
-
'AdsMargin'=>'10','AdsAlign'=>'2'
|
46 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
function ads_admin_page_inc() {
|
49 |
include('quick-adsense-admin.php');
|
@@ -51,8 +62,18 @@ function ads_admin_page_inc() {
|
|
51 |
function ads_admin_page() {
|
52 |
add_options_page("Quick Adsense Options", "Quick Adsense", 1, basename(__FILE__), "ads_admin_page_inc");
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if(is_admin()) {
|
55 |
add_action('admin_menu', 'ads_admin_page');
|
|
|
56 |
}
|
57 |
|
58 |
|
@@ -69,13 +90,12 @@ function plugin_activated() {
|
|
69 |
global $QData;
|
70 |
$isold = get_option('AdsDisp');
|
71 |
if ( !$isold && is_bool($isold) ) {
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
for ($i=1;$i<=$QData['Ads'];$i++) {
|
77 |
-
update_option('AdsMargin'.$i, $QData['
|
78 |
-
update_option('AdsAlign'.$i, $QData['
|
79 |
}
|
80 |
}
|
81 |
}
|
@@ -95,8 +115,8 @@ function ads_head_java() {
|
|
95 |
edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
|
96 |
edButtons[edButtons.length]=new edButton("off_ads","OffAds","\n<!--OffAds-->\n","","",-1);
|
97 |
};
|
98 |
-
</script>
|
99 |
-
}
|
100 |
}
|
101 |
add_action('admin_head', 'ads_head_java');
|
102 |
|
@@ -158,19 +178,20 @@ function process_content($content)
|
|
158 |
$content = '<!--EmptyClear-->'.$content.PHP_EOL.'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
|
159 |
$content = clean_tags($content, true);
|
160 |
$ismany = (!is_single() && !is_page());
|
|
|
161 |
|
162 |
-
/* ... Replace
|
163 |
for( $i=1; $i<=count($AdsIdCus); $i++ ) {
|
164 |
-
if( !$ismany || $beginend != $i ) {
|
165 |
if( strpos($content, '<!--'.$cusads.$AdsIdCus[$i-1].'-->') && in_array($AdsIdCus[$i-1], $AdsId)) {
|
166 |
$content = replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] ); $AdsId = del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
|
167 |
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; };
|
168 |
-
$beginend = $i; if($ismany){break;}
|
169 |
}
|
170 |
}
|
171 |
}
|
172 |
/* ... Replace Ads1 to Ads10 ... */
|
173 |
-
if( !$ismany ) {
|
174 |
$tcn = count($AdsId); $tt = 0;
|
175 |
for( $i=1; $i<=$tcn; $i++ ) {
|
176 |
if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->') ) {
|
@@ -181,8 +202,8 @@ function process_content($content)
|
|
181 |
}
|
182 |
}
|
183 |
}
|
184 |
-
/* ... Replace
|
185 |
-
if( strpos($content, '<!--'.$cusrnd.'-->') && !$ismany ) {
|
186 |
$tcx = count($AdsId);
|
187 |
$tcy = substr_count($content, '<!--'.$cusrnd.'-->');
|
188 |
for( $i=$tcx; $i<=$tcy-1; $i++ ) {
|
@@ -195,7 +216,7 @@ function process_content($content)
|
|
195 |
}
|
196 |
}
|
197 |
/* ... Replace RndAds ... */
|
198 |
-
if( strpos($content, '<!--RndAds-->') && !$ismany ) {
|
199 |
$AdsIdTmp = array();
|
200 |
shuffle($AdsId);
|
201 |
for( $i=1; $i<=$AdsToShow-$ShownAds; $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.3
|
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.3';
|
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 |
+
'AppPost'=>true,'AppPage'=>true,'AppHome'=>false,'AppCate'=>false,'AppArch'=>false,'AppTags'=>false,'AppMaxA'=>false,
|
44 |
+
'QckTags'=>true
|
|
|
45 |
);
|
46 |
+
$QData['DefaultAdsOpt'] = array(
|
47 |
+
'AdsMargin'=>'10','AdsAlign'=>'2'
|
48 |
+
);
|
49 |
+
$QData['DefaultAdsName'] = array();
|
50 |
+
for ($i=1;$i<=$QData['Ads'];$i++) {
|
51 |
+
array_push($QData['DefaultAdsName'], 'AdsCode'.$i );
|
52 |
+
array_push($QData['DefaultAdsName'], 'AdsAlign'.$i );
|
53 |
+
array_push($QData['DefaultAdsName'], 'AdsMargin'.$i );
|
54 |
+
};
|
55 |
+
for ($i=1;$i<=$QData['AdsWid'];$i++) {
|
56 |
+
array_push($QData['DefaultAdsName'], 'WidCode'.$i );
|
57 |
+
};
|
58 |
|
59 |
function ads_admin_page_inc() {
|
60 |
include('quick-adsense-admin.php');
|
62 |
function ads_admin_page() {
|
63 |
add_options_page("Quick Adsense Options", "Quick Adsense", 1, basename(__FILE__), "ads_admin_page_inc");
|
64 |
}
|
65 |
+
function register_ads_settings() {
|
66 |
+
global $QData;
|
67 |
+
foreach ($QData['Default'] as $key => $value) {
|
68 |
+
register_setting( 'qa-options', $key);
|
69 |
+
}
|
70 |
+
foreach ($QData['DefaultAdsName'] as $key => $value) {
|
71 |
+
register_setting( 'qa-options', $value);
|
72 |
+
}
|
73 |
+
}
|
74 |
if(is_admin()) {
|
75 |
add_action('admin_menu', 'ads_admin_page');
|
76 |
+
add_action('admin_init', 'register_ads_settings');
|
77 |
}
|
78 |
|
79 |
|
90 |
global $QData;
|
91 |
$isold = get_option('AdsDisp');
|
92 |
if ( !$isold && is_bool($isold) ) {
|
93 |
+
foreach ($QData['Default'] as $key => $value) {
|
94 |
+
update_option($key , $value);
|
95 |
+
}
|
|
|
96 |
for ($i=1;$i<=$QData['Ads'];$i++) {
|
97 |
+
update_option('AdsMargin'.$i, $QData['DefaultAdsOpt']['AdsMargin']);
|
98 |
+
update_option('AdsAlign'.$i, $QData['DefaultAdsOpt']['AdsAlign']);
|
99 |
}
|
100 |
}
|
101 |
}
|
115 |
edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
|
116 |
edButtons[edButtons.length]=new edButton("off_ads","OffAds","\n<!--OffAds-->\n","","",-1);
|
117 |
};
|
118 |
+
</script>
|
119 |
+
<?php }
|
120 |
}
|
121 |
add_action('admin_head', 'ads_head_java');
|
122 |
|
178 |
$content = '<!--EmptyClear-->'.$content.PHP_EOL.'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
|
179 |
$content = clean_tags($content, true);
|
180 |
$ismany = (!is_single() && !is_page());
|
181 |
+
$showall = get_option('AppMaxA');
|
182 |
|
183 |
+
/* ... Replace Beginning/End Ads1-10 ... */
|
184 |
for( $i=1; $i<=count($AdsIdCus); $i++ ) {
|
185 |
+
if( $showall || !$ismany || $beginend != $i ) {
|
186 |
if( strpos($content, '<!--'.$cusads.$AdsIdCus[$i-1].'-->') && in_array($AdsIdCus[$i-1], $AdsId)) {
|
187 |
$content = replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] ); $AdsId = del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
|
188 |
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; };
|
189 |
+
$beginend = $i; if(!$showall && $ismany){break;}
|
190 |
}
|
191 |
}
|
192 |
}
|
193 |
/* ... Replace Ads1 to Ads10 ... */
|
194 |
+
if( $showall || !$ismany ) {
|
195 |
$tcn = count($AdsId); $tt = 0;
|
196 |
for( $i=1; $i<=$tcn; $i++ ) {
|
197 |
if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->') ) {
|
202 |
}
|
203 |
}
|
204 |
}
|
205 |
+
/* ... Replace Beginning/End random Ads ... */
|
206 |
+
if( strpos($content, '<!--'.$cusrnd.'-->') && ($showall || !$ismany) ) {
|
207 |
$tcx = count($AdsId);
|
208 |
$tcy = substr_count($content, '<!--'.$cusrnd.'-->');
|
209 |
for( $i=$tcx; $i<=$tcy-1; $i++ ) {
|
216 |
}
|
217 |
}
|
218 |
/* ... Replace RndAds ... */
|
219 |
+
if( strpos($content, '<!--RndAds-->') && ($showall || !$ismany) ) {
|
220 |
$AdsIdTmp = array();
|
221 |
shuffle($AdsId);
|
222 |
for( $i=1; $i<=$AdsToShow-$ShownAds; $i++ ) {
|
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: 2.8.4
|
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 |
|
@@ -48,6 +48,13 @@ Please feedback to [http://techmilieu.com/quick-adsense](http://techmilieu.com/q
|
|
48 |
|
49 |
== Change Log ==
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
= 1.2 =
|
52 |
* Re-fix the frist time default options loading value.
|
53 |
* Date: 03-Oct-2009
|
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.4
|
7 |
+
Stable tag: 1.3
|
8 |
|
9 |
Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
10 |
|
48 |
|
49 |
== Change Log ==
|
50 |
|
51 |
+
= 1.3 =
|
52 |
+
* Code modification: Option to place all possible Ads on Homepage, Categories, Archives and Tags page. Previously, only one Ads (the one assigned to the Beginning of Post) is displayed.
|
53 |
+
* Code update to take advantage of some WP functions for options page, also for forward compatibility in future version.
|
54 |
+
* Code update to make it compatible with WordpressMU, tested on WordpressMU 2.7.1
|
55 |
+
* Some minor page & wording modification.
|
56 |
+
* Date: 13-Oct-2009
|
57 |
+
|
58 |
= 1.2 =
|
59 |
* Re-fix the frist time default options loading value.
|
60 |
* Date: 03-Oct-2009
|