AdSense Manager - Version 1.3

Version Description

Download this release

Release Info

Developer mutube
Plugin Icon wp plugin AdSense Manager
Version 1.3
Comparing to
See all releases

Code changes from version 1.1 to 1.3

Files changed (2) hide show
  1. adsense-manager.php +199 -70
  2. readme.txt +3 -3
adsense-manager.php CHANGED
@@ -1,22 +1,35 @@
1
<?php
2
/*
3
Plugin Name: AdSense Manager
4
- PLugin URI: http://www.mutube.com/projects/wordpress/adsense-manager/?utm_source=plugin&utm_medium=admin
5
Description: Control and arrange your AdSense & Referral blocks on your Wordpress blog. With Widget and inline post support, configurable colours.
6
Author: Martin Fitzpatrick
7
- Version: 1.2
8
- Author URI: http://www.mutube.com?utm_source=plugin&utm_medium=admin
9
*/
10
11
- @define("ADSENSEM_VERSION", "1.2");
12
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
13
14
/*
15
CONSTANTS FOR CONFIGURATION
16
*/
17
18
- @define("ADSENSEM_MAX_BLOCKS", 20); //Has to be some max for looping through on submit
19
-
20
@define("ADSENSEM_MAX_ADS", 7); //Max Google Ad units
21
@define("ADSENSEM_MAX_REFERRALS", 7); //Max Google Referral units
22
@@ -108,15 +121,12 @@ class adsensem {
108
$code='';
109
/* This test block determines whether to display the Ad in the current location.
110
The home,single,archive,search tests only apply to Ads displayed inline,
111
- so we test for that first */
112
- /* If we're displaying the sidebar / template, we always show */
113
- if( !$_is_inline ||
114
- ( ($ad['show-home'] && is_home()) ||
115
($ad['show-post'] && (is_single() || is_page())) ||
116
($ad['show-archive'] && is_archive()) ||
117
- ($ad['show-search'] && is_search()) ) )
118
{ /* We passed the test, display the Ad */
119
-
120
$code.=$this->get_ad($ad);
121
}
122
return $code;
@@ -134,8 +144,17 @@ class adsensem {
134
/* Valid entry */
135
if(is_array($ad)){
136
137
- list($width,$height,$null)=split('[x]',$ad['adformat']);
138
139
$code .= $ad['html-before'];
140
141
@@ -153,18 +172,23 @@ class adsensem {
153
$ad['channel']=ADSENSEM_CHANNEL;
154
}
155
156
$code.= 'google_ad_client = "pub-' . $options['adsense-account'] . '";' . "\n";
157
if($ad['channel']!=''){ $code.= 'google_ad_channel = "' . $ad['channel'] . '";' . "\n";}
158
- $code.= 'google_ad_width = ' . $width . "\n";
159
- $code.= 'google_ad_height = ' . $height . "\n";
160
- $code.= 'google_ad_format = "' . $ad['adformat'] . '_as"' . "\n";
161
- $code.= 'google_ad_type = "' . $ad['adtype'] . '"' . "\n";
162
-
163
- $code.= 'google_color_border = "' . $ad['colors']['border'] . '"' . "\n";
164
- $code.= 'google_color_bg = "' . $ad['colors']['bg'] . '"' . "\n";
165
- $code.= 'google_color_link = "' . $ad['colors']['link'] . '"' . "\n";
166
- $code.= 'google_color_text = "' . $ad['colors']['text'] . '"' . "\n";
167
- $code.= 'google_color_url = "' . $ad['colors']['url'] . '"' . "\n";
168
$code.= '
169
//--></script>' . "\n";
170
@@ -194,8 +218,13 @@ class adsensem {
194
'url' => '008000'
195
),
196
'channel' => '',
197
'adformat' => '250x250',
198
'adtype' => 'text_image',
199
'show-home' => true,
200
'show-post' => true,
201
'show-archive' => true,
@@ -227,11 +256,25 @@ class adsensem {
227
228
}
229
230
/* ADMIN Settings - Editing form for each Ad and defaults, reusable */
231
function admin_settingsform($settings=array('colors'=>array()),$name=false)
232
{
233
$colors = $settings['colors'];
234
235
?>
236
237
<script type="text/javascript">
@@ -245,33 +288,52 @@ class adsensem {
245
}
246
}
247
248
</script>
249
- <table>
250
- <tr valign="top"><td>
251
252
- <?php
253
254
- function output_select($list,$selected)
255
- {
256
- foreach($list as $key=>$value)
257
- {
258
- ?><option <?php if($key==$selected){ echo "selected"; }?> value="<?php echo $key; ?>"> <?php echo $value; ?> </option><?php
259
- }
260
- }
261
262
263
- $formats['ads']['default']=array('' => 'Use Default');
264
$formats['ads']['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
265
$formats['ads']['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
266
$formats['ads']['square']=array('336x280' => '336 x 280 Large Rectangle', '300x250' => '300 x 250 Medium Rectangle', '250x250' => '250 x 250 Square', '200x200' => '200 x 200 Small Square', '180x150' => '180 x 150 Small Rectangle', '125x125' => '125 x 125 Button');
267
268
- $type['default']=array('' => 'Use Default');
269
- $type['all']=array('text_image' => 'Text &amp; Image', 'image' => 'Image Only', 'text' => 'Text Only');
270
271
?>
272
273
274
- <h4>Ad Settings</h4>
275
<table cellspacing="5">
276
<?php if($name!==false){ ?>
277
<tr><td><label for="adsensem-name">Name:</label></td>
@@ -281,27 +343,69 @@ class adsensem {
281
<?php } ?>
282
<tr><td><label for="adsensem-channel">Channel:</label></td>
283
<td><input name="adsensem-channel" size="15" title="Enter multiple Channels seperated by + signs" value="<?php echo htmlspecialchars($settings['channel'], ENT_QUOTES); ?>" /></td></tr>
284
- <tr id="row-adformat"><td><label for="adsensem-adformat"><a href="https://www.google.com/adsense/adformats" target="_new">Ad Format:</a></label></td>
285
<td>
286
<select name="adsensem-adformat">
287
<!-- Options taken from Google AdSense setup pages -->
288
- <?php if($name!==false){ ?><optgroup label="Default"><?php output_select($formats['ads']['default'],$settings['adformat']);?></optgroup><?php } ?>
289
- <optgroup label="Horizontal"><?php output_select($formats['ads']['horizontal'],$settings['adformat']);?></optgroup>
290
- <optgroup label="Vertical"><?php output_select($formats['ads']['vertical'],$settings['adformat']);?></optgroup>
291
- <optgroup label="Square"><?php output_select($formats['ads']['square'],$settings['adformat']);?></optgroup>
292
</select>
293
</td></tr>
294
<tr id="row-adtype"><td><label for="adsensem-adtype">Ad Type:</label></td>
295
<td>
296
<select name="adsensem-adtype">
297
<!-- Options taken from Google AdSense setup pages -->
298
- <?php if($name!==false){ ?><optgroup label="Default"><?php output_select($type['default'],$settings['adtype']);?></optgroup><?php } ?>
299
- <optgroup label="Options"><?php output_select($type['all'],$settings['adtype']);?></optgroup>
300
</select>
301
</td></tr>
302
</table>
303
304
- </td><td>
305
<h4>Ad Colours</h4>
306
<table cellspacing="5">
307
<tr><td><label for="adsensem-colors-border">Border:</label></td>
@@ -327,7 +431,7 @@ class adsensem {
327
}
328
329
?>
330
- <div id="ad-color-bg" style="width:160px;background: #<?php echo htmlspecialchars($colors['bg'], ENT_QUOTES); ?>;">
331
<div id="ad-color-border" style="font: 10px arial, sans-serif; border: 1px solid #<?php echo htmlspecialchars($colors['border'], ENT_QUOTES); ?>" class="linkunit-wrapper">
332
<div id="ad-color-link" style="color: #<?php echo htmlspecialchars($colors['link'], ENT_QUOTES); ?>; font: 11px verdana, arial, sans-serif; padding: 2px;">
333
<b><u>Linked Title</u></b><br /></div>
@@ -342,29 +446,43 @@ class adsensem {
342
</td></tr>
343
</table>
344
345
- </td><td>
346
347
<h4>Inline Ads</h4>
348
<table cellspacing="5">
349
<tr><td><label for="adsensem-show-home">Show on Homepage</label></td>
350
- <td><input name="adsensem-show-home" type="checkbox" value="true" <?php if($settings['show-home']=='true'){ echo "checked"; }?> /></td></tr>
351
<tr><td><label for="adsensem-show-post">Show on Posts/Pages</label></td>
352
- <td><input name="adsensem-show-post" type="checkbox" value="true" <?php if($settings['show-post']=='true'){ echo "checked"; }?> /></td></tr>
353
<tr><td><label for="adsensem-show-archive">Show on Archives</label></td>
354
- <td><input name="adsensem-show-archive" type="checkbox" value="true" <?php if($settings['show-archive']=='true'){ echo "checked"; }?> /></td></tr>
355
<tr><td><label for="adsensem-show-search">Show on Search</label></td>
356
- <td><input name="adsensem-show-search" type="checkbox" value="true" <?php if($settings['show-search']=='true'){ echo "checked"; }?> /></td></tr>
357
</table>
358
359
- <h4>HTML Markup</h4>
360
<table cellspacing="5">
361
<tr><td><label for="adsensem-html-before">Before:</label></td>
362
- <td><input name="adsensem-html-before" size="15" title="Enter HTML to be included before Ad block" value="<?php echo htmlspecialchars($settings['html-before'], ENT_QUOTES); ?>" /></td></tr>
363
<tr><td><label for="adsensem-html-after">After:</label></td>
364
- <td><input name="adsensem-html-after" size="15" title="Enter HTML to be included after Ad block" value="<?php echo htmlspecialchars($settings['html-after'], ENT_QUOTES); ?>" /></td></tr>
365
</table>
366
367
368
</td></tr>
369
</table>
370
<?
@@ -384,18 +502,19 @@ class adsensem {
384
385
if ( $_POST['adsensem-submit'] ) {
386
387
-
388
- $options['adsense-account']=strip_tags(stripslashes($_POST['adsensem-adsense-account']));
389
- if(strrpos($options['adsense-account'],'-')!==false){
390
- $options['adsense-account']=substr(strrchr($options['adsense-account'],'-'),1);
391
- }
392
393
$options['be-nice']=max(min($_POST['adsensem-be-nice'],100),0);
394
if(!is_numeric($options['be-nice'])){$options['be-nice']=ADSENSEM_BE_NICE;}
395
396
$options['defaults']['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
397
$options['defaults']['adformat']=strip_tags(stripslashes($_POST['adsensem-adformat']));
398
$options['defaults']['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
399
400
$options['defaults']['html-before']=$_POST['adsensem-html-before'];
401
$options['defaults']['html-after']=$_POST['adsensem-html-after'];
@@ -410,11 +529,10 @@ class adsensem {
410
$options['defaults']['colors'] = $colors;
411
412
413
- $options['defaults']['show-home']=($_POST['adsensem-show-home'] === 'true');
414
- $options['defaults']['show-post']=($_POST['adsensem-show-post'] === 'true');
415
- $options['defaults']['show-archive']=($_POST['adsensem-show-archive'] === 'true');
416
- $options['defaults']['show-search']=($_POST['adsensem-show-search'] === 'true');
417
-
418
419
update_option('plugin_adsensem', $options);
420
@@ -486,12 +604,21 @@ class adsensem {
486
}
487
488
$options['ads'][$name]['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
489
$options['ads'][$name]['adformat']=strip_tags(stripslashes($_POST['adsensem-adformat']));
490
$options['ads'][$name]['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
491
492
$options['ads'][$name]['html-before']=$_POST['adsensem-html-before'];
493
$options['ads'][$name]['html-after']=$_POST['adsensem-html-after'];
494
-
495
496
$colors['border']=strip_tags(stripslashes($_POST['adsensem-colors-border']));
497
$colors['link']=strip_tags(stripslashes($_POST['adsensem-colors-link']));
@@ -501,10 +628,10 @@ class adsensem {
501
502
$options['ads'][$name]['colors'] = $colors;
503
504
- $options['ads'][$name]['show-home']=($_POST['adsensem-show-home'] === 'true');
505
- $options['ads'][$name]['show-post']=($_POST['adsensem-show-post'] === 'true');
506
- $options['ads'][$name]['show-archive']=($_POST['adsensem-show-archive'] === 'true');
507
- $options['ads'][$name]['show-search']=($_POST['adsensem-show-search'] === 'true');
508
509
update_option('plugin_adsensem', $options);
510
@@ -544,11 +671,12 @@ class adsensem {
544
</style>
545
546
<table style="width:100%;" cellspacing="0">
547
- <tr style="height:2em;"><th>Name</th><th>Channel</th><th colspan="5" style="width:80px;">Colours</th><th>Format</th><th colspan="3">Admin</th></tr>
548
549
<tr style="background-color:#ddd;" id="default-options">
550
<td></td>
551
<td><?php echo htmlspecialchars($options['defaults']['channel'], ENT_QUOTES); ?></td>
552
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['border'], ENT_QUOTES); ?>">&nbsp;</td>
553
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['link'], ENT_QUOTES); ?>">&nbsp;</td>
554
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['bg'], ENT_QUOTES); ?>">&nbsp;</td>
@@ -566,6 +694,7 @@ class adsensem {
566
?><tr <?php if($name==$options['defaults']['ad']){?>style="background-color:#eee;"<?php } ?>>
567
<td><?php echo htmlspecialchars($name, ENT_QUOTES); ?></td>
568
<td><?php echo htmlspecialchars($ad['channel'], ENT_QUOTES); ?></td>
569
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['border'], ENT_QUOTES); ?>">&nbsp;</td>
570
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['link'], ENT_QUOTES); ?>">&nbsp;</td>
571
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['bg'], ENT_QUOTES); ?>">&nbsp;</td>
1
<?php
2
/*
3
Plugin Name: AdSense Manager
4
+ PLugin URI: http://www.mutube.com/projects/wordpress/adsense-manager/
5
Description: Control and arrange your AdSense & Referral blocks on your Wordpress blog. With Widget and inline post support, configurable colours.
6
Author: Martin Fitzpatrick
7
+ Version: 1.3
8
+ Author URI: http://www.mutube.com/
9
*/
10
11
+ /*
12
+ TODO:
13
+
14
+ Multiple Ad types
15
+ * on Options dialog show all possible options available for all ads for setting defaults.
16
+ * on Manage dialog show only the options available for the specific type of ad
17
+ * needs new "New Ad" method for creating (or clever Javascripty)
18
+
19
+ Defaults
20
+ * highlight the fields for which there are default settings
21
+ * is this making code overcomplicated? rearrange into functions/etc.
22
+
23
+ */
24
+
25
+ @define("ADSENSEM_VERSION", "1.3");
26
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
27
28
/*
29
CONSTANTS FOR CONFIGURATION
30
*/
31
32
+ //Currently not used
33
@define("ADSENSEM_MAX_ADS", 7); //Max Google Ad units
34
@define("ADSENSEM_MAX_REFERRALS", 7); //Max Google Referral units
35
121
$code='';
122
/* This test block determines whether to display the Ad in the current location.
123
The home,single,archive,search tests only apply to Ads displayed inline,
124
+ so we test for that here */
125
+ if( ($ad['show-home'] && is_home()) ||
126
($ad['show-post'] && (is_single() || is_page())) ||
127
($ad['show-archive'] && is_archive()) ||
128
+ ($ad['show-search'] && is_search()) )
129
{ /* We passed the test, display the Ad */
130
$code.=$this->get_ad($ad);
131
}
132
return $code;
144
/* Valid entry */
145
if(is_array($ad)){
146
147
+ //Default to Ad
148
+ if($ad['product']=='link'){
149
+ $format = $ad['linkformat'] . $ad['linktype'];
150
+ list($width,$height,$null)=split('[x]',$ad['linkformat']);
151
+ } else {
152
+ $format = $ad['adformat'] . '_as';
153
+ list($width,$height,$null)=split('[x]',$ad['adformat']);
154
+ }
155
156
+
157
+
158
$code .= $ad['html-before'];
159
160
172
$ad['channel']=ADSENSEM_CHANNEL;
173
}
174
175
+
176
$code.= 'google_ad_client = "pub-' . $options['adsense-account'] . '";' . "\n";
177
+
178
if($ad['channel']!=''){ $code.= 'google_ad_channel = "' . $ad['channel'] . '";' . "\n";}
179
+
180
+ $code.= 'google_ad_width = ' . $width . ";\n";
181
+ $code.= 'google_ad_height = ' . $height . ";\n";
182
+ $code.= 'google_ad_format = "' . $format . '"' . ";\n";
183
+
184
+ //Default to Ads
185
+ if($ad['product']!=='link'){ $code.= 'google_ad_type = "' . $ad['adtype'] . '"' . ";\n"; }
186
+
187
+ $code.= 'google_color_border = "' . $ad['colors']['border'] . '"' . ";\n";
188
+ $code.= 'google_color_bg = "' . $ad['colors']['bg'] . '"' . ";\n";
189
+ $code.= 'google_color_link = "' . $ad['colors']['link'] . '"' . ";\n";
190
+ $code.= 'google_color_text = "' . $ad['colors']['text'] . '"' . ";\n";
191
+ $code.= 'google_color_url = "' . $ad['colors']['url'] . '"' . ";\n";
192
$code.= '
193
//--></script>' . "\n";
194
218
'url' => '008000'
219
),
220
'channel' => '',
221
+
222
'adformat' => '250x250',
223
'adtype' => 'text_image',
224
+
225
+ 'linkformat' => '120x90',
226
+ 'linktype' => '_0ads_al_s',
227
+
228
'show-home' => true,
229
'show-post' => true,
230
'show-archive' => true,
256
257
}
258
259
+ function output_select($list,$selected)
260
+ {
261
+ foreach($list as $key=>$value)
262
+ {
263
+ ?><option <?php if($key==$selected){ echo "selected"; }?> value="<?php echo $key; ?>"> <?php echo $value; ?> </option><?php
264
+ }
265
+ }
266
+
267
/* ADMIN Settings - Editing form for each Ad and defaults, reusable */
268
function admin_settingsform($settings=array('colors'=>array()),$name=false)
269
{
270
+
271
$colors = $settings['colors'];
272
273
+ // $options = get_option('plugin_adsensem');
274
+ // $defaults = $options['defaults'];
275
+
276
+ if($settings['product']==''){$settings['product']='ad';}
277
+
278
?>
279
280
<script type="text/javascript">
288
}
289
}
290
291
+ function adsensem_product_options(value){
292
+
293
+ switch (value){
294
+ case 'link': show = 'link';
295
+ hide = 'ad';
296
+ break;
297
+ case 'ad': show = 'ad';
298
+ hide = 'link';
299
+ break;
300
+ }
301
+
302
+ document.getElementById('table-' + hide + 'settings').style.display='none';
303
+
304
+ document.getElementById('table-' + show + 'settings').style.display='';
305
+
306
+
307
+ }
308
+
309
</script>
310
311
+ <table style="width:100%;">
312
+ <tr valign="top"><td class="wrap">
313
314
+ <?php
315
316
+ $formats['default']=array('' => 'Use Default');
317
318
$formats['ads']['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
319
$formats['ads']['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
320
$formats['ads']['square']=array('336x280' => '336 x 280 Large Rectangle', '300x250' => '300 x 250 Medium Rectangle', '250x250' => '250 x 250 Square', '200x200' => '200 x 200 Small Square', '180x150' => '180 x 150 Small Rectangle', '125x125' => '125 x 125 Button');
321
322
+ $formats['links']['horizontal']=array('728x15' => '728 x 15', '468x15' => '468 x 15');
323
+ $formats['links']['square']=array('200x90' => '200 x 90', '180x90' => '180 x 90', '160x90' => '160 x 90', '120x90' => '120 x 90');
324
+
325
+ $adtypes=array('text_image' => 'Text &amp; Image', 'image' => 'Image Only', 'text' => 'Text Only');
326
+
327
+ $linktypes=array('_0ads_al' => '4 Ads Per Unit', '_0ads_al_s' => '5 Ads Per Unit');
328
329
+ $yesno=array(true => 'Yes', false => 'No');
330
+ $default=array('' => 'Use Default');
331
+
332
+ $products=array('ad' => 'Ad Unit','link' => 'Link Unit');
333
?>
334
335
336
+ <h4>Basic</h4>
337
<table cellspacing="5">
338
<?php if($name!==false){ ?>
339
<tr><td><label for="adsensem-name">Name:</label></td>
343
<?php } ?>
344
<tr><td><label for="adsensem-channel">Channel:</label></td>
345
<td><input name="adsensem-channel" size="15" title="Enter multiple Channels seperated by + signs" value="<?php echo htmlspecialchars($settings['channel'], ENT_QUOTES); ?>" /></td></tr>
346
+
347
+ <?php if($name!==false){ ?>
348
+ <tr><td><label for="adsensem-product">Product:</label></td>
349
+ <td><select name="adsensem-product" onchange="adsensem_product_options(this.value);">
350
+ <?php $this->output_select($products,$settings['product']);?>
351
+ </select></tr>
352
+ <?php } ?>
353
+ </table>
354
+
355
+ <h4>Layout</h4>
356
+ <table cellspacing="5" id="table-adsettings">
357
+ <tr id="row-adformat"><td style="width:7em;"><label for="adsensem-adformat"><a href="https://www.google.com/adsense/adformats" target="_new">Ad Format:</a></label></td>
358
<td>
359
<select name="adsensem-adformat">
360
<!-- Options taken from Google AdSense setup pages -->
361
+ <?php if($name!==false){ ?><optgroup label="Default"><?php $this->output_select($formats['default'],$settings['adformat']);?></optgroup><?php } ?>
362
+ <optgroup label="Horizontal"><?php $this->output_select($formats['ads']['horizontal'],$settings['adformat']);?></optgroup>
363
+ <optgroup label="Vertical"><?php $this->output_select($formats['ads']['vertical'],$settings['adformat']);?></optgroup>
364
+ <optgroup label="Square"><?php $this->output_select($formats['ads']['square'],$settings['adformat']);?></optgroup>
365
</select>
366
</td></tr>
367
+
368
<tr id="row-adtype"><td><label for="adsensem-adtype">Ad Type:</label></td>
369
<td>
370
<select name="adsensem-adtype">
371
<!-- Options taken from Google AdSense setup pages -->
372
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['adtype']);?><?php } ?>
373
+ <?php $this->output_select($adtypes,$settings['adtype']);?>
374
</select>
375
</td></tr>
376
</table>
377
378
+ <table cellspacing="5" id="table-linksettings">
379
+
380
+ <tr id="row-linkformat"><td style="width:7em;"><label for="adsensem-linkformat"><a href="https://www.google.com/adsense/adformats" target="_new">Link Format:</a></label></td>
381
+ <td>
382
+ <select name="adsensem-linkformat">
383
+ <!-- Options taken from Google AdSense setup pages -->
384
+ <?php if($name!==false){ ?><optgroup label="Default"><?php $this->output_select($formats['default'],$settings['adformat']);?></optgroup><?php } ?>
385
+ <optgroup label="Horizontal"><?php $this->output_select($formats['links']['horizontal'],$settings['adformat']);?></optgroup>
386
+ <optgroup label="Square"><?php $this->output_select($formats['links']['square'],$settings['adformat']);?></optgroup>
387
+ </select>
388
+ </td></tr>
389
+
390
+ <tr id="row-linktype"><td><label for="adsensem-linktype">Link Type:</label></td>
391
+ <td>
392
+ <select name="adsensem-linktype">
393
+ <!-- Options taken from Google AdSense setup pages -->
394
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['linktype']);?><?php } ?>
395
+ <?php $this->output_select($linktypes,$settings['linktype']);?>
396
+ </select>
397
+ </td></tr>
398
+
399
+
400
+ </table>
401
+
402
+
403
+ <?php if($name!==false){ ?>
404
+ <script>adsensem_product_options('<?php echo $settings['product']; ?>');</script>
405
+ <? } ?>
406
+
407
+
408
+ </td><td class="wrap">
409
<h4>Ad Colours</h4>
410
<table cellspacing="5">
411
<tr><td><label for="adsensem-colors-border">Border:</label></td>
431
}
432
433
?>
434
+ <div id="ad-color-bg" style="margin-top:1em;width:160px;background: #<?php echo htmlspecialchars($colors['bg'], ENT_QUOTES); ?>;">
435
<div id="ad-color-border" style="font: 10px arial, sans-serif; border: 1px solid #<?php echo htmlspecialchars($colors['border'], ENT_QUOTES); ?>" class="linkunit-wrapper">
436
<div id="ad-color-link" style="color: #<?php echo htmlspecialchars($colors['link'], ENT_QUOTES); ?>; font: 11px verdana, arial, sans-serif; padding: 2px;">
437
<b><u>Linked Title</u></b><br /></div>
446
</td></tr>
447
</table>
448
449
+ </td><td class="adsensemcol wrap">
450
451
<h4>Inline Ads</h4>
452
<table cellspacing="5">
453
<tr><td><label for="adsensem-show-home">Show on Homepage</label></td>
454
+ <td><select name="adsensem-show-home">
455
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-home']);?><?php } ?>
456
+ <?php $this->output_select($yesno,$settings['show-home']);?>
457
+ </select></td></tr>
458
<tr><td><label for="adsensem-show-post">Show on Posts/Pages</label></td>
459
+ <td><select name="adsensem-show-post">
460
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-post']);?><?php } ?>
461
+ <?php $this->output_select($yesno,$settings['show-post']);?>
462
+ </select></td></tr>
463
<tr><td><label for="adsensem-show-archive">Show on Archives</label></td>
464
+ <td><select name="adsensem-show-archive">
465
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-archive']);?><?php } ?>
466
+ <?php $this->output_select($yesno,$settings['show-archive']);?>
467
+ </select></td></tr>
468
<tr><td><label for="adsensem-show-search">Show on Search</label></td>
469
+ <td><select name="adsensem-show-search">
470
+ <?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-search']);?><?php } ?>
471
+ <?php $this->output_select($yesno,$settings['show-search']);?>
472
+ </select></td></tr>
473
</table>
474
475
+
476
+ <h4>HTML Markup (Optional)</h4>
477
<table cellspacing="5">
478
<tr><td><label for="adsensem-html-before">Before:</label></td>
479
+ <td><input name="adsensem-html-before" size="15" title="Enter HTML to be included before Ad unit" value="<?php echo htmlspecialchars($settings['html-before'], ENT_QUOTES); ?>" /></td></tr>
480
<tr><td><label for="adsensem-html-after">After:</label></td>
481
+ <td><input name="adsensem-html-after" size="15" title="Enter HTML to be included after Ad unit" value="<?php echo htmlspecialchars($settings['html-after'], ENT_QUOTES); ?>" /></td></tr>
482
</table>
483
484
485
+
486
</td></tr>
487
</table>
488
<?
502
503
if ( $_POST['adsensem-submit'] ) {
504
505
+ $options['adsense-account']=preg_replace('/\D/','',$_POST['adsensem-adsense-account']);
506
507
$options['be-nice']=max(min($_POST['adsensem-be-nice'],100),0);
508
if(!is_numeric($options['be-nice'])){$options['be-nice']=ADSENSEM_BE_NICE;}
509
510
$options['defaults']['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
511
+
512
$options['defaults']['adformat']=strip_tags(stripslashes($_POST['adsensem-adformat']));
513
$options['defaults']['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
514
+
515
+ $options['defaults']['linkformat']=strip_tags(stripslashes($_POST['adsensem-linkformat']));
516
+ $options['defaults']['linktype']=strip_tags(stripslashes($_POST['adsensem-linktype']));
517
+
518
519
$options['defaults']['html-before']=$_POST['adsensem-html-before'];
520
$options['defaults']['html-after']=$_POST['adsensem-html-after'];
529
$options['defaults']['colors'] = $colors;
530
531
532
+ $options['defaults']['show-home']=$_POST['adsensem-show-home'];
533
+ $options['defaults']['show-post']=$_POST['adsensem-show-post'];
534
+ $options['defaults']['show-archive']=$_POST['adsensem-show-archive'];
535
+ $options['defaults']['show-search']=$_POST['adsensem-show-search'];
536
537
update_option('plugin_adsensem', $options);
538
604
}
605
606
$options['ads'][$name]['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
607
+
608
+
609
+ $options['ads'][$name]['product']=$_POST['adsensem-product'];
610
+
611
+
612
$options['ads'][$name]['adformat']=strip_tags(stripslashes($_POST['adsensem-adformat']));
613
$options['ads'][$name]['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
614
615
+ $options['ads'][$name]['linkformat']=strip_tags(stripslashes($_POST['adsensem-linkformat']));
616
+ $options['ads'][$name]['linktype']=strip_tags(stripslashes($_POST['adsensem-linktype']));
617
+
618
$options['ads'][$name]['html-before']=$_POST['adsensem-html-before'];
619
$options['ads'][$name]['html-after']=$_POST['adsensem-html-after'];
620
+
621
+
622
623
$colors['border']=strip_tags(stripslashes($_POST['adsensem-colors-border']));
624
$colors['link']=strip_tags(stripslashes($_POST['adsensem-colors-link']));
628
629
$options['ads'][$name]['colors'] = $colors;
630
631
+ $options['ads'][$name]['show-home']=$_POST['adsensem-show-home'];
632
+ $options['ads'][$name]['show-post']=$_POST['adsensem-show-post'];
633
+ $options['ads'][$name]['show-archive']=$_POST['adsensem-show-archive'];
634
+ $options['ads'][$name]['show-search']=$_POST['adsensem-show-search'];
635
636
update_option('plugin_adsensem', $options);
637
671
</style>
672
673
<table style="width:100%;" cellspacing="0">
674
+ <tr style="height:2em;"><th>Name</th><th>Channel</th><th>Product</th><th colspan="5" style="width:80px;">Colours</th><th>Format</th><th colspan="3">Admin</th></tr>
675
676
<tr style="background-color:#ddd;" id="default-options">
677
<td></td>
678
<td><?php echo htmlspecialchars($options['defaults']['channel'], ENT_QUOTES); ?></td>
679
+ <td><?php echo htmlspecialchars($options['defaults']['product'], ENT_QUOTES); ?></td>
680
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['border'], ENT_QUOTES); ?>">&nbsp;</td>
681
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['link'], ENT_QUOTES); ?>">&nbsp;</td>
682
<td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['bg'], ENT_QUOTES); ?>">&nbsp;</td>
694
?><tr <?php if($name==$options['defaults']['ad']){?>style="background-color:#eee;"<?php } ?>>
695
<td><?php echo htmlspecialchars($name, ENT_QUOTES); ?></td>
696
<td><?php echo htmlspecialchars($ad['channel'], ENT_QUOTES); ?></td>
697
+ <td style="text-align:center;"><?php echo htmlspecialchars(ucfirst($ad['product']), ENT_QUOTES); ?></td>
698
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['border'], ENT_QUOTES); ?>">&nbsp;</td>
699
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['link'], ENT_QUOTES); ?>">&nbsp;</td>
700
<td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['bg'], ENT_QUOTES); ?>">&nbsp;</td>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Plugin Name ===
2
Contributors: mutube
3
Donate link: http://www.mutube.com/about/be-nice/
4
- Tags: adsense, ads, manage, widget
5
Requires at least: 2.0.2
6
Tested up to: 2.1
7
- Stable tag: 1.2
8
9
AdSense Manager is a new Wordpress plugin for managing AdSense ads on your blog. Generates code automatically and allows positioning with Widgets.
10
1
+ === AdSense Manager ===
2
Contributors: mutube
3
Donate link: http://www.mutube.com/about/be-nice/
4
+ Tags: adsense, ads, manage, widget, google
5
Requires at least: 2.0.2
6
Tested up to: 2.1
7
+ Stable tag: 1.3
8
9
AdSense Manager is a new Wordpress plugin for managing AdSense ads on your blog. Generates code automatically and allows positioning with Widgets.
10