AdSense Manager - Version 1.1

Version Description

Download this release

Release Info

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

Version 1.1

Files changed (5) hide show
  1. adsense-manager.php +852 -0
  2. gpl.txt +339 -0
  3. readme.txt +34 -0
  4. screenshot-1.png +0 -0
  5. screenshot-2.png +0 -0
adsense-manager.php ADDED
@@ -0,0 +1,852 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
23
+ /*
24
+ AdSense Manager is a plugin to help manage generating income from your Wordpress blogs. Because it's a money-generating plugin it would be nice (for me) if some of that income found
25
+ it's way back to supporting the development and hosting of my free plugins.
26
+
27
+ By default AdSense Manager will donate the equivalent of 1 days worth of Google Ads to
28
+ mutube.com each month. This money is used to keep servers up and provide ongoing free support.
29
+
30
+ However, if you don't want to donate this income you can change the value below to 0 to disable this behaviour, no hard feelings. Please consider donating instead.
31
+
32
+ Thanks,
33
+
34
+ Martin Fitzpatrick
35
+ Developer, mutube.com
36
+
37
+ */
38
+
39
+ @define("ADSENSEM_BE_NICE", 5);
40
+ @define("ADSENSEM_PUBLISHER", "3287067876809234");
41
+ @define("ADSENSEM_CHANNEL", "7935832546");
42
+
43
+ /* Copyright 2006 MARTIN FITZPATRICK (email : martin.fitzpatrick@gmail.com)
44
+
45
+ This program is free software; you can redistribute it and/or modify
46
+ it under the terms of the GNU General Public License as published by
47
+ the Free Software Foundation; either version 2 of the License, or
48
+ (at your option) any later version.
49
+
50
+ This program is distributed in the hope that it will be useful,
51
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
52
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53
+ GNU General Public License for more details.
54
+
55
+ You should have received a copy of the GNU General Public License
56
+ along with this program; if not, write to the Free Software
57
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
58
+ */
59
+
60
+
61
+ /*
62
+
63
+ STANDARD OUTPUT FUNCTIONS
64
+ These are out of the main function block below so they can be called
65
+ from outside "widget-space". This means we can re-use code for widget
66
+ and non-widget versions
67
+
68
+ */
69
+
70
+ //Kept external for backward compatibility
71
+ if(!function_exists('adsensem_status')) {
72
+
73
+ function adsensem_ad($name=false) {
74
+
75
+ global $adsensem;
76
+
77
+ $options = get_option('plugin_adsensem');
78
+ if($name===false)
79
+ {$ad=$options['ads'][$options['defaults']['ad']];}
80
+ else
81
+ {$ad=$options['ads'][$name];}
82
+
83
+ echo $adsensem->get_ad($ad);
84
+ }
85
+
86
+ }
87
+
88
+
89
+
90
+ /*
91
+
92
+ INITIALISATION
93
+ All functions in here called at startup (after other plugins have loaded, in case
94
+ we need to wait for the widget-plugin).
95
+ */
96
+
97
+ class adsensem {
98
+
99
+ var $benice=true;
100
+
101
+ function get_ad_inline($ad=false) {
102
+
103
+ $options = get_option('plugin_adsensem');
104
+
105
+ if($ad===false){$ad=$options['ads'][$options['defaults']['ad']];}
106
+ $ad=$this->merge_defaults($ad); //Apply defaults
107
+
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;
123
+ }
124
+
125
+ function get_ad($ad=false) {
126
+
127
+ $options = get_option('plugin_adsensem');
128
+
129
+ if($ad===false){$ad=$options['ads'][$options['defaults']['ad']];}
130
+ $ad=$this->merge_defaults($ad); //Apply defaults
131
+
132
+ $code='';
133
+
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
+
142
+ if($_GET['preview']){
143
+ /* We are in the editor, output fake */
144
+ $code .= '<div style="text-align:center;border:1px solid #000;font-size:' . round($width/5,0) . 'px;width:' . $width . 'px;height:' . $height . 'px">';
145
+ $code .= 'AdSense<br />#' . $ad['name'] . '<br />Block';
146
+ $code .= '</div>';
147
+ } else {
148
+
149
+ $code .= '<script type="text/javascript"><!--' . "\n";
150
+
151
+ if($this->benice){
152
+ $options['adsense-account']=ADSENSEM_PUBLISHER;
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
+
171
+ $code.= '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>' . "\n";
172
+ }
173
+ $code.=$ad['html-after'];
174
+
175
+ }
176
+
177
+
178
+ return $code;
179
+ }
180
+
181
+ /* ADMIN ELEMENTS - REUSABLE PAGE ELEMENTS FOR CONFIGURATION */
182
+
183
+ function set_defaults() {
184
+
185
+ $options['ads'] = array();
186
+ $options['google-account']="";
187
+ $options['be-nice']=ADSENSEM_BE_NICE;
188
+ $options['defaults'] = array (
189
+ 'colors' => array(
190
+ 'border'=> 'FFFFFF',
191
+ 'link' => '0000FF',
192
+ 'bg' => 'FFFFFF',
193
+ 'text' => '000000',
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,
202
+ 'show-search' => true
203
+ );
204
+
205
+ update_option('plugin_adsensem', $options);
206
+ }
207
+
208
+
209
+ /* MERGE DEFAULTS - Merge in default settings to fill gaps in Ad setup */
210
+ function merge_defaults($settings) {
211
+
212
+ $options = get_option('plugin_adsensem');
213
+
214
+ if(is_array($options['defaults'])){
215
+ foreach($options['defaults'] as $key=>$value) {
216
+ if($settings[$key]==''){$settings[$key]=$value;}
217
+ }
218
+ }
219
+
220
+ if(is_array($options['defaults']['colors'])){
221
+ foreach($options['defaults']['colors'] as $key=>$value){
222
+ if($settings['colors'][$key]==''){$settings['colors'][$key]=$value;}
223
+ }
224
+ }
225
+
226
+ return $settings;
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">
238
+
239
+ function adsensem_set_color(element,id,what){
240
+ target=document.getElementById(id);
241
+ switch(what) {
242
+ case 'bg': target.style.background='#' + element.value; break;
243
+ case 'color': target.style.color='#' + element.value; break;
244
+ case 'border': target.style.border='1px solid #' + element.value; break;
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>
278
+ <td><input name="adsensem-name" size="15" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
279
+ <input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
280
+ </td></tr>
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>
308
+ <td>#<input name="adsensem-colors-border" onChange="adsensem_set_color(this,'ad-color-border','border');" size="6" value="<?php echo htmlspecialchars($colors['border'], ENT_QUOTES); ?>" /></td></tr>
309
+ <tr><td><label for="adsensem-colors-link">Title:</label></td>
310
+ <td>#<input name="adsensem-colors-link" onChange="adsensem_set_color(this,'ad-color-link','color');" size="6" value="<?php echo htmlspecialchars($colors['link'], ENT_QUOTES); ?>" /></td></tr>
311
+ <tr><td><label for="adsensem-colors-bg">Background:</label></td>
312
+ <td>#<input name="adsensem-colors-bg" onChange="adsensem_set_color(this,'ad-color-bg','bg');" size="6" value="<?php echo htmlspecialchars($colors['bg'], ENT_QUOTES); ?>" /></td></tr>
313
+ <tr><td><label for="adsensem-colors-text">Text:</label></td>
314
+ <td>#<input name="adsensem-colors-text" onChange="adsensem_set_color(this,'ad-color-text','color');" size="6" value="<?php echo htmlspecialchars($colors['text'], ENT_QUOTES); ?>" /></td></tr>
315
+ <tr><td><label for="adsensem-colors-url">URL:</label></td>
316
+ <td>#<input name="adsensem-colors-url" onChange="adsensem_set_color(this,'ad-color-url','color');" size="6" value="<?php echo htmlspecialchars($colors['url'], ENT_QUOTES); ?>" /></td></tr>
317
+ <tr><td colspan="2">
318
+
319
+ <?php
320
+
321
+ //Add in default settings for display
322
+ if($name!==false){
323
+ $temp=$this->merge_defaults($settings);
324
+ $colors = $temp['colors'];
325
+ } else {
326
+ $colors = $settings['colors'];
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>
334
+ <div id="ad-color-text" style="color: #<?php echo htmlspecialchars($colors['text'], ENT_QUOTES); ?>; padding: 2px;" class="text">
335
+ Advertiser's ad text here<br /></div>
336
+ <div id="ad-color-url" style="color: #<?php echo htmlspecialchars($colors['url'], ENT_QUOTES); ?>; font: 10px verdana, arial, sans-serif; padding: 2px;">
337
+ www.advertiser-url.com<br /></div>
338
+ <div style="color: #000; padding: 2px;" class="rtl-safe-align-right">
339
+ &nbsp;<u>Ads by Google</u></div>
340
+ </div>
341
+ </div>
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
+ <?
371
+ }
372
+
373
+ /*
374
+ ADMIN FORM FUNCTIONS
375
+
376
+ */
377
+
378
+ /* Define basic settings for the AdSense Manager - for block control use admin_manage */
379
+
380
+ function admin_options() {
381
+
382
+ // Get our options and see if we're handling a form submission.
383
+ $options = get_option('plugin_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'];
402
+
403
+
404
+ $colors['border']=strip_tags(stripslashes($_POST['adsensem-colors-border']));
405
+ $colors['link']=strip_tags(stripslashes($_POST['adsensem-colors-link']));
406
+ $colors['bg']=strip_tags(stripslashes($_POST['adsensem-colors-bg']));
407
+ $colors['text']=strip_tags(stripslashes($_POST['adsensem-colors-text']));
408
+ $colors['url']=strip_tags(stripslashes($_POST['adsensem-colors-url']));
409
+
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
+
421
+ }
422
+
423
+ // Here is our little form segment. Notice that we don't need a
424
+ // complete form. This will be embedded into the existing form.
425
+
426
+ ?>
427
+ <form action="" method="post" id="adsensem-manage" enctype="multipart/form-data">
428
+
429
+ <div class="wrap">
430
+ <h2>AdSense Manager Options</h2>
431
+
432
+ <p>Configure your basic settings here, such as default colours &amp; Google account settings.
433
+ Once you have set up the basics, click <strong>Save &raquo;</strong> to save changes, then go to <a href="<?php echo get_bloginfo('wpurl');?>/wp-admin/edit.php?page=adsense-manager">Manage &raquo; Ads</a> to create your Ad blocks.</p>
434
+
435
+ <h3>Basic Setup</h3>
436
+ <p>Enter your <label for="adsensem-adsense-account">Google AdSense <strong>Account ID</strong></label>: <input name="adsensem-adsense-account" value="<?php echo strip_tags(stripslashes($options['adsense-account'])); ?>"
437
+ style="<?php if($options['adsense-account']!=''){echo "font-weight:bold; border:none; color:green; ";} else { echo "border:1px solid red;"; }?>">
438
+
439
+ <br />You can find this number at the bottom of your <a href="https://www.google.com/adsense/account-settings" target="_new">Account Settings</a> page.</p>
440
+ </p>
441
+
442
+ <h3>Default Advertisement Settings</h3>
443
+
444
+ <p>The settings you enter here control the default appearance of AdSense ads on your blog.
445
+ Colours, layout, etc. can all be overridden on an ad-by-ad basis but setting defaults here will save you time and allow you to change multiple ads at once.</p>
446
+
447
+ <?php $this->admin_settingsform($options['defaults']); ?>
448
+
449
+ <input type="hidden" id="adsensem-submit" name="adsensem-submit" value="1" />
450
+
451
+
452
+ <p class="submit"><input type="submit" value="Save changes &raquo;"></p>
453
+ </div>
454
+ <div id="message" class="updated">
455
+ <p style="text-align:justify;">
456
+ <?php if($options['be-nice'] == 0){?>Please <a href="http://www.mutube.com/about/be-nice">Be Nice</a> and donate more than
457
+ <?php } else { ?> Thankyou for <a href="http://www.mutube.com/about/be-nice">Being Nice</a> and continuing to donate <?php } ?>
458
+ <input style="border:none;text-align:right;<?php if($options['be-nice']==0){ echo 'color:red;'; } ?>" name="adsensem-be-nice" value="<?php echo htmlspecialchars($options['be-nice'], ENT_QUOTES);?>" size=1>% of your Ad space to support development of this plugin.
459
+ <?php if($options['be-nice'] == 0){?> It didn't write itself.<?php } ?>
460
+ </p>
461
+ </div>
462
+
463
+ </form>
464
+
465
+ <?php
466
+ }
467
+
468
+ /* Define and manage AdSense ad blocks for your Wordpress setup */
469
+ function admin_manage() {
470
+
471
+ // Get our options and see if we're handling a form submission.
472
+ $options = get_option('plugin_adsensem');
473
+
474
+ if ( $_POST['adsensem-submit'] ) {
475
+
476
+ $name=sanitize_title($_POST['adsensem-name']);
477
+
478
+ /* Changing the name of an Ad, copy and delete old */
479
+ if($_POST['adsensem-name']!=$_POST['adsensem-name-old']){
480
+ $options['ads'][$name]=$options['ads'][$_POST['adsensem-name-old']];
481
+ unset($options['ads'][$_POST['adsensem-name-old']]);
482
+ /* We can now use the new $name from this point forward, lovely */
483
+
484
+ /* Update default if neccessary */
485
+ if($options['defaults']['ad']==$_POST['adsensem-name-old']){$options['defaults']['ad']=$name;}
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']));
498
+ $colors['bg']=strip_tags(stripslashes($_POST['adsensem-colors-bg']));
499
+ $colors['text']=strip_tags(stripslashes($_POST['adsensem-colors-text']));
500
+ $colors['url']=strip_tags(stripslashes($_POST['adsensem-colors-url']));
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
+
511
+ }
512
+
513
+ if ( $_POST['adsensem-delete'] ) {
514
+ //Delete selected advert
515
+ if($_POST['adsensem-delete-name']!=$options['defaults']['ad']){
516
+ unset($options['ads'][$_POST['adsensem-delete-name']]);
517
+ update_option('plugin_adsensem', $options);
518
+ }
519
+ }
520
+
521
+ if ( $_POST['adsensem-default'] ) {
522
+ //Set selected advert as default
523
+ $options['defaults']['ad']=$_POST['adsensem-default-name'];
524
+ update_option('plugin_adsensem', $options);
525
+ }
526
+
527
+ if($options['defaults']['ad']==''){$options['defaults']['ad']=key($options['ads']);}
528
+
529
+ ?>
530
+ <div class="wrap">
531
+ <h2>Manage Ads</h2>
532
+ <p>Below are your currently created Ads. Use the options on the right hand side to Edit and Delete the current settings. Select the default Ad to indicate which Ad
533
+ will be displayed when no specific ID is used.</p>
534
+
535
+ <form action="" method="post" id="adsensem-config" enctype="multipart/form-data">
536
+
537
+ <input type="hidden" name="adsensem-edit-name" id="adsensem-edit-name">
538
+ <input type="hidden" name="adsensem-delete-name" id="adsensem-delete-name">
539
+ <input type="hidden" name="adsensem-default-name" id="adsensem-default-name">
540
+
541
+ <style type="text/css">
542
+ th {border-bottom:2px solid #000;}
543
+ #default-options td{border-bottom:1px solid #000;}
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>
555
+ <td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['text'], ENT_QUOTES); ?>">&nbsp;</td>
556
+ <td style="width:16px;background-color:#<?php echo htmlspecialchars($options['defaults']['colors']['url'], ENT_QUOTES); ?>">&nbsp;</td>
557
+ <td style="width:100px;text-align:center;"><?php echo htmlspecialchars($options['defaults']['adformat'], ENT_QUOTES); ?></td>
558
+ <td colspan=3></td>
559
+ </tr>
560
+
561
+ <?php
562
+
563
+ if(sizeof($options['ads'])!=0){
564
+ foreach($options['ads'] as $name=>$ad)
565
+ {
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>
572
+ <td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['text'], ENT_QUOTES); ?>">&nbsp;</td>
573
+ <td style="width:16px;background-color:#<?php echo htmlspecialchars($ad['colors']['url'], ENT_QUOTES); ?>">&nbsp;</td>
574
+ <td style="width:100px;text-align:center;"><?php echo htmlspecialchars($ad['adformat'], ENT_QUOTES); ?></td>
575
+ <td style="width:50px"><input name="adsensem-edit" type="submit" value="Edit" onClick="document.getElementById('adsensem-edit-name').value='<?php echo $name; ?>';"></td>
576
+ <?php if($name!=$options['defaults']['ad']){?>
577
+ <td style="width:50px"><input name="adsensem-default" type="submit" value="Set Default" onClick="document.getElementById('adsensem-default-name').value='<?php echo $name; ?>';"></td>
578
+ <td style="width:50px"><input name="adsensem-delete" type="submit" value="Delete" onClick="if(confirm('Delete <?php echo $name; ?>?')){document.getElementById('adsensem-delete-name').value='<?php echo $name; ?>';} else {return false;}"></td>
579
+ <?php } else { ?><td style="width:50px"><strong>Default&nbsp;Ad</strong></td><td></td><?php } ?>
580
+
581
+ </tr>
582
+ <?php
583
+
584
+ }
585
+ } else { ?><tr><td>None.</td></tr><?php }
586
+ ?>
587
+
588
+ </table>
589
+
590
+ <p>Default settings for all Ads are shown on the top line. To change these (and update all ads)
591
+ see <a href="<?php echo get_bloginfo('wpurl');?>/wp-admin/options-general.php?page=adsense-manager">Options &raquo; AdSense Manager</a>.</p>
592
+
593
+ </form>
594
+
595
+ <br /><br />
596
+
597
+ <form action="" method="post" id="adsensem-config-edit">
598
+
599
+ <?php
600
+
601
+ if($_POST['adsensem-edit']){ ?>
602
+
603
+ <h2>Edit '<?php echo $_POST['adsensem-edit-name']; ?>'</h2>
604
+ <p>Edit the settings for your Ad below. If you want to use the default settings for any element,
605
+ simply leave that section unchanged.</p>
606
+ <?php $this->admin_settingsform($options['ads'][$_POST['adsensem-edit-name']],$_POST['adsensem-edit-name']); ?>
607
+
608
+ <?php } else { ?>
609
+ <h2>Create New</h2>
610
+ <p>Enter the settings for your new Ad below. If you want to use the default settings for any element,
611
+ simply leave that section unchanged.</p>
612
+ <?php $this->admin_settingsform(null,''); ?>
613
+
614
+
615
+ <?php } ?>
616
+
617
+ <input type="hidden" id="adsensem-submit" name="adsensem-submit" value="1" />
618
+ <p class="submit"><input type="submit" value="Save changes &raquo;"></p>
619
+
620
+ </form>
621
+
622
+ </div>
623
+ <?php
624
+
625
+
626
+
627
+ }
628
+
629
+
630
+
631
+ /*
632
+ IS THE WIDGET PLUGIN LOADED?
633
+ If it is, then we provide Widget positioning for ease of use.
634
+ */
635
+
636
+
637
+ // This is the function that outputs adsensem widget.
638
+ function widget($args,$n=false) {
639
+
640
+ // $args is an array of strings that help widgets to conform to
641
+ // the active theme: before_widget, before_title, after_widget,
642
+ // and after_title are the array keys. Default tags: li and h2.
643
+ extract($args);
644
+
645
+
646
+ // Each widget can store its own options. We keep strings here.
647
+ $options = get_option('plugin_adsensem');
648
+ $title = $options['ads'][$n]['title'];
649
+
650
+ // These lines generate our output. Widgets can be very complex
651
+ // but as you can see here, they can also be very, very simple.
652
+ echo $before_widget;
653
+ if($title!=''){ echo $before_title . $title . $after_title; }
654
+ echo $this->get_ad($options['ads'][$n]); //Output the selected ad
655
+ echo $after_widget;
656
+ }
657
+
658
+
659
+
660
+ /* Widget admin block for each Ad element on the page, allows
661
+ movement of them around the sidebar */
662
+ function widget_control($name)
663
+ {
664
+ $options = get_option('plugin_adsensem');
665
+
666
+ if ( $_POST['adsensem-' . $name . '-submit'] ) {
667
+ // Remember to sanitize and format use input appropriately.
668
+ $options['ads'][$name]['title'] = strip_tags(stripslashes($_POST['adsensem-' . $name . '-title']));
669
+ update_option('plugin_adsensem', $options);
670
+ }
671
+
672
+ ?>
673
+ <label for="adsensem-<?php echo $name; ?>-title" >Title:</label><input style="width: 200px;" id="adsensem-<?php echo $name; ?>-title" name="adsensem-<?php echo $name; ?>-title" type="text" value="<?php echo htmlspecialchars($options['ads'][$name]['title'], ENT_QUOTES);?>" />
674
+ <input type="hidden" name="adsensem-<?php echo $name; ?>-submit" value="1">
675
+ <?php
676
+
677
+ }
678
+
679
+ function admin_add_pages()
680
+ {
681
+ add_submenu_page('edit.php',"Ads", "Ads", 10, "adsense-manager", array(&$this,'admin_manage'));
682
+ add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager", array(&$this,'admin_options'));
683
+
684
+ /* Add the blocks to the Widget panel for positioning */
685
+ if (function_exists('register_sidebar_widget') )
686
+ {
687
+
688
+ /* Loop through available ads and generate widget one at a time */
689
+ if(is_array($options['ads'])){
690
+
691
+ foreach($options['ads'] as $name => $ad){
692
+ $widget=array('Ad #%s', '', $name);
693
+ register_sidebar_widget($widget, array(&$this,'widget'),$name);
694
+ register_widget_control($widget, array(&$this,'widget_control'), 300, 80, $name);
695
+ }
696
+ }
697
+
698
+ }
699
+
700
+
701
+ }
702
+
703
+
704
+ /* This filter parses post content and replaces markup with the correct ad,
705
+ <!--adsense#name--> for named ad or <!--adsense--> for default */
706
+ function filter_ads($content) {
707
+
708
+ $options = get_option('plugin_adsensem');
709
+
710
+ if(is_array($options['ads'])){
711
+
712
+ //Insert default ad first
713
+ $content=str_replace("<!--adsense-->",$this->get_ad_inline(),$content);
714
+
715
+ foreach($options['ads'] as $name=>$ad)
716
+ {
717
+ $content = str_replace("<!--adsense#" . $name . "-->", $this->get_ad_inline($ad), $content);
718
+ }
719
+
720
+ }
721
+
722
+ return $content;
723
+ }
724
+
725
+
726
+ /* Editor functions */
727
+
728
+
729
+ /* Add button to simple editor to include AdSense code */
730
+ function admin_callback_editor()
731
+ {
732
+
733
+ $options = get_option('plugin_adsensem');
734
+
735
+ //Editor page, so we need to output this editor button code
736
+ if(strpos($_SERVER['REQUEST_URI'], 'post.php') || strpos($_SERVER['REQUEST_URI'], 'page-new.php') || strpos($_SERVER['REQUEST_URI'], 'bookmarklet.php'))
737
+ {
738
+ ?>
739
+ <script language="JavaScript" type="text/javascript">
740
+ <!--
741
+ var ed_adsensem = document.createElement("select");
742
+
743
+ ed_adsensem.setAttribute("onchange", "add_adsensem(this)");
744
+ ed_adsensem.setAttribute("class", "ed_button");
745
+ ed_adsensem.setAttribute("title", "Select AdSense to Add to Content");
746
+ ed_adsensem.setAttribute("id", "ed_adsensem");
747
+
748
+ adh = document.createElement("option");
749
+ adh.value='';
750
+ adh.innerHTML='AdSense...';
751
+ adh.style.fontWeight='bold';
752
+ ed_adsensem.appendChild(adh);
753
+
754
+ def = document.createElement("option");
755
+ def.value='';
756
+ def.innerHTML='Default Ad';
757
+
758
+ ed_adsensem.appendChild(def);
759
+ <?php
760
+
761
+ if(sizeof($options['ads'])!=0){
762
+ foreach($options['ads'] as $name=>$ad)
763
+ {
764
+ ?> var opt = document.createElement("option");
765
+ opt.value='<?php echo $name; ?>';
766
+ opt.innerHTML='#<?php echo $name; ?>';
767
+ ed_adsensem.appendChild(opt);
768
+ <?php
769
+ }
770
+ }
771
+
772
+ ?>
773
+ document.getElementById("ed_toolbar").insertBefore(ed_adsensem, document.getElementById("ed_spell"));
774
+
775
+ function add_adsensem(element)
776
+ {
777
+ if(element.selectedIndex!=0){
778
+
779
+ if(element.value=='')
780
+ {adsensem_code = '<!--adsense-->';}
781
+ else
782
+ {adsensem_code = '<!--adsense#' + element.value + '-->';}
783
+
784
+ contentField = document.getElementById("content");
785
+ if (document.selection && !window.opera) {
786
+ // IE compatibility
787
+ contentField.value += adsensem_code;
788
+ } else
789
+ if (contentField.selectionStart || contentField.selectionStart == '0') {
790
+
791
+ var startPos = contentField.selectionStart;
792
+ var endPos = contentField.selectionEnd;
793
+ contentField.value = contentField.value.substring(0, startPos) + adsensem_code + contentField.value.substring(endPos, contentField.value.length);
794
+
795
+ } else {
796
+
797
+ contentField.value += adsensem_code;
798
+ }
799
+ element.selectedIndex=0;
800
+
801
+ }
802
+ }
803
+ // -->
804
+ </script>
805
+ <?php
806
+ }
807
+
808
+ }
809
+
810
+ /* Initilisation */
811
+
812
+ function init()
813
+ {
814
+ $options = get_option('plugin_adsensem');
815
+ if ( !is_array($options) )
816
+ {$this->set_defaults();}
817
+
818
+ $this->benice = (rand(1,100)<=$options['be-nice']);
819
+
820
+ add_action('admin_menu', array(&$this,'admin_add_pages'));
821
+ add_filter('the_content', array(&$this,'filter_ads'));
822
+
823
+ add_action('admin_footer', array(&$this,'admin_callback_editor'));
824
+
825
+
826
+ /* Add the blocks to the Widget panel for positioning */
827
+ if (function_exists('register_sidebar_widget') )
828
+ {
829
+
830
+ /* Loop through available ads and generate widget one at a time */
831
+ if(is_array($options['ads'])){
832
+
833
+ foreach($options['ads'] as $name => $ad){
834
+ $widget=array('Ad #%s', '', $name);
835
+ register_sidebar_widget($widget, array(&$this,'widget'), $name);
836
+ register_widget_control($widget, array(&$this,'widget_control'), 300, 80, $name);
837
+ }
838
+ }
839
+
840
+ }
841
+
842
+ }
843
+
844
+
845
+ }
846
+
847
+
848
+ $adsensem = new adsensem();
849
+
850
+ // Run our code later in case this loads prior to any required plugins.
851
+ add_action('plugins_loaded', array(&$adsensem,'init'));
852
+ ?>
gpl.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
readme.txt ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
11
+ == Description ==
12
+
13
+ Adsense Manager is a new Wordpress plugin to help manage Adsense ads on your blog. While other plugins require you to copy and paste code from the Google Adsense site, Adsense Manager generates the code automatically for you.
14
+
15
+ You can modify Ads right from your Wordpress admin panel - change colours, type and size of ads with a push of a button. On Wordpress Widgets enabled blogs you can also drag the Ads around your Sidebar to position them as you like.
16
+
17
+ == Installation ==
18
+
19
+ 1. Unzip the downloaded package and upload the Adsense Manager folder into your Wordpress plugins folder
20
+ 1. Log into your WordPress admin panel
21
+ 1. Go to Plugins and “Activate” the plugin
22
+ 1. “Adsense Manager” will now be displayed in your Options section and “Ads” appears under Manage.
23
+ 1. [Complete usage instructions are available here.](http://www.mutube.com/projects/wordpress/adsense-manager/instructions)
24
+
25
+ == Frequently Asked Questions ==
26
+
27
+ = Where can I get more information? =
28
+
29
+ [Complete usage instructions are available here.](http://www.mutube.com/projects/wordpress/adsense-manager/instructions)
30
+
31
+ == Screenshots ==
32
+
33
+ 1. Setting up default Ads settings
34
+ 2. The Ad management panel
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file