Version Description
Download this release
Release Info
Developer | mutube |
Plugin | AdSense Manager |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.6
- adsense-manager.php +138 -41
- readme.txt +1 -1
adsense-manager.php
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
Author URI: http://www.mutube.com/
|
9 |
*/
|
10 |
|
@@ -17,7 +17,7 @@ Defaults
|
|
17 |
|
18 |
*/
|
19 |
|
20 |
-
@define("ADSENSEM_VERSION", "1.
|
21 |
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
|
22 |
|
23 |
/*
|
@@ -117,10 +117,10 @@ class adsensem {
|
|
117 |
/* This test block determines whether to display the Ad in the current location.
|
118 |
The home,single,archive,search tests only apply to Ads displayed inline,
|
119 |
so we test for that here */
|
120 |
-
if( ($ad['show-home'] && is_home()) ||
|
121 |
-
($ad['show-post'] && (is_single() || is_page())) ||
|
122 |
-
($ad['show-archive'] && is_archive()) ||
|
123 |
-
($ad['show-search'] && is_search()) )
|
124 |
{ /* We passed the test, display the Ad */
|
125 |
$code.=$this->get_ad($ad);
|
126 |
}
|
@@ -176,6 +176,9 @@ class adsensem {
|
|
176 |
$code.= 'google_ad_height = ' . $height . ";\n";
|
177 |
$code.= 'google_ad_format = "' . $format . '"' . ";\n";
|
178 |
|
|
|
|
|
|
|
179 |
//Default to Ads
|
180 |
if($ad['product']!=='link'){ $code.= 'google_ad_type = "' . $ad['adtype'] . '"' . ";\n"; }
|
181 |
|
@@ -199,11 +202,14 @@ class adsensem {
|
|
199 |
|
200 |
/* ADMIN ELEMENTS - REUSABLE PAGE ELEMENTS FOR CONFIGURATION */
|
201 |
|
202 |
-
function set_defaults() {
|
203 |
|
204 |
-
$
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
207 |
$options['defaults'] = array (
|
208 |
'colors' => array(
|
209 |
'border'=> 'FFFFFF',
|
@@ -220,13 +226,20 @@ class adsensem {
|
|
220 |
'linkformat' => '120x90',
|
221 |
'linktype' => '_0ads_al_s',
|
222 |
|
223 |
-
'show-home' =>
|
224 |
-
'show-post' =>
|
225 |
-
'show-archive' =>
|
226 |
-
'show-search' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
);
|
228 |
|
229 |
-
|
230 |
}
|
231 |
|
232 |
|
@@ -255,7 +268,7 @@ class adsensem {
|
|
255 |
{
|
256 |
foreach($list as $key=>$value)
|
257 |
{
|
258 |
-
?><option <?php if($key==$selected){ echo "selected"; }?> value="<?php echo $key; ?>"> <?php echo $value;
|
259 |
}
|
260 |
}
|
261 |
|
@@ -321,7 +334,7 @@ class adsensem {
|
|
321 |
|
322 |
$linktypes=array('_0ads_al' => '4 Ads Per Unit', '_0ads_al_s' => '5 Ads Per Unit');
|
323 |
|
324 |
-
$yesno=array(
|
325 |
$default=array('' => 'Use Default');
|
326 |
|
327 |
$products=array('ad' => 'Ad Unit','link' => 'Link Unit');
|
@@ -332,7 +345,7 @@ class adsensem {
|
|
332 |
<table cellspacing="5">
|
333 |
<?php if($name!==false){ ?>
|
334 |
<tr><td><label for="adsensem-name">Name:</label></td>
|
335 |
-
<td><input name="adsensem-name" size="15" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
|
336 |
<input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
|
337 |
</td></tr>
|
338 |
<?php } ?>
|
@@ -443,24 +456,26 @@ class adsensem {
|
|
443 |
|
444 |
</td><td class="adsensemcol wrap">
|
445 |
|
446 |
-
<h4>Inline Ads</h4>
|
|
|
447 |
<table cellspacing="5">
|
448 |
-
<tr><td><label for="adsensem-show-home">
|
449 |
<td><select name="adsensem-show-home">
|
|
|
450 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-home']);?><?php } ?>
|
451 |
<?php $this->output_select($yesno,$settings['show-home']);?>
|
452 |
</select></td></tr>
|
453 |
-
<tr><td><label for="adsensem-show-post">
|
454 |
<td><select name="adsensem-show-post">
|
455 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-post']);?><?php } ?>
|
456 |
<?php $this->output_select($yesno,$settings['show-post']);?>
|
457 |
</select></td></tr>
|
458 |
-
<tr><td><label for="adsensem-show-archive">
|
459 |
<td><select name="adsensem-show-archive">
|
460 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-archive']);?><?php } ?>
|
461 |
<?php $this->output_select($yesno,$settings['show-archive']);?>
|
462 |
</select></td></tr>
|
463 |
-
<tr><td><label for="adsensem-show-search">
|
464 |
<td><select name="adsensem-show-search">
|
465 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-search']);?><?php } ?>
|
466 |
<?php $this->output_select($yesno,$settings['show-search']);?>
|
@@ -476,6 +491,14 @@ class adsensem {
|
|
476 |
<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>
|
477 |
</table>
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
|
480 |
|
481 |
</td></tr>
|
@@ -520,7 +543,7 @@ class adsensem {
|
|
520 |
|
521 |
<h3>Basic Setup</h3>
|
522 |
<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'])); ?>"
|
523 |
-
style="<?php if($options['adsense-account']!=''){echo "font-weight:bold;
|
524 |
|
525 |
<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>
|
526 |
</p>
|
@@ -555,10 +578,11 @@ class adsensem {
|
|
555 |
$ad['linkformat']=strip_tags(stripslashes($_POST['adsensem-linkformat']));
|
556 |
$ad['linktype']=strip_tags(stripslashes($_POST['adsensem-linktype']));
|
557 |
|
558 |
-
$ad['html-before']
|
559 |
-
$ad['html-after']
|
560 |
-
|
561 |
|
|
|
|
|
562 |
|
563 |
$colors['border']=strip_tags(stripslashes($_POST['adsensem-colors-border']));
|
564 |
$colors['link']=strip_tags(stripslashes($_POST['adsensem-colors-link']));
|
@@ -586,12 +610,21 @@ class adsensem {
|
|
586 |
|
587 |
if ( $_POST['adsensem-submit'] ) {
|
588 |
|
589 |
-
if($_POST['adsensem-
|
590 |
-
|
591 |
-
|
|
|
|
|
|
|
|
|
592 |
|
593 |
} else {
|
594 |
|
|
|
|
|
|
|
|
|
|
|
595 |
$name=sanitize_title($_POST['adsensem-name']);
|
596 |
|
597 |
/* Changing the name of an Ad, copy and delete old */
|
@@ -625,7 +658,10 @@ class adsensem {
|
|
625 |
update_option('plugin_adsensem', $options);
|
626 |
}
|
627 |
|
628 |
-
if($options['defaults']['ad']==''){
|
|
|
|
|
|
|
629 |
|
630 |
?>
|
631 |
<div class="wrap">
|
@@ -692,6 +728,11 @@ class adsensem {
|
|
692 |
|
693 |
<p>By changing the <strong>Default settings</strong> (shown on the top line) you can update all Ads at once.
|
694 |
<br /><strong>Default Ad</strong> indicates which Ad will be displayed when no specific ID is used. </p>
|
|
|
|
|
|
|
|
|
|
|
695 |
</form>
|
696 |
|
697 |
<br /><br />
|
@@ -700,23 +741,27 @@ class adsensem {
|
|
700 |
|
701 |
<?php
|
702 |
|
|
|
|
|
|
|
|
|
703 |
if($_POST['adsensem-edit']){ ?>
|
704 |
|
705 |
-
<h2>Edit '<?php echo ($
|
706 |
<p>Edit the settings for your Ad below. If you want to use the default settings for any element,
|
707 |
simply leave that section unchanged.</p>
|
708 |
<?php
|
709 |
-
if($
|
710 |
-
$this->admin_settingsform($options['ads'][$_POST['adsensem-edit-name']],$_POST['adsensem-edit-name']);
|
711 |
-
} else {
|
712 |
$this->admin_settingsform($options['defaults'],false);
|
|
|
|
|
713 |
}
|
714 |
|
715 |
?>
|
716 |
|
717 |
<?php } else { ?>
|
718 |
<h2>Create New</h2>
|
719 |
-
<p>Enter the settings for your new Ad below. If you want to use the default settings for any element,
|
720 |
simply leave that section unchanged.</p>
|
721 |
<?php $this->admin_settingsform(null,''); ?>
|
722 |
|
@@ -724,7 +769,15 @@ class adsensem {
|
|
724 |
<?php } ?>
|
725 |
|
726 |
<input type="hidden" id="adsensem-submit" name="adsensem-submit" value="1" />
|
727 |
-
<p class="submit"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
|
729 |
</form>
|
730 |
|
@@ -842,14 +895,22 @@ class adsensem {
|
|
842 |
$options = get_option('plugin_adsensem');
|
843 |
|
844 |
//Editor page, so we need to output this editor button code
|
845 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
846 |
{
|
847 |
?>
|
848 |
<script language="JavaScript" type="text/javascript">
|
849 |
<!--
|
850 |
var ed_adsensem = document.createElement("select");
|
851 |
-
|
852 |
-
|
|
|
|
|
|
|
853 |
ed_adsensem.setAttribute("class", "ed_button");
|
854 |
ed_adsensem.setAttribute("title", "Select AdSense to Add to Content");
|
855 |
ed_adsensem.setAttribute("id", "ed_adsensem");
|
@@ -881,6 +942,11 @@ class adsensem {
|
|
881 |
?>
|
882 |
document.getElementById("ed_toolbar").insertBefore(ed_adsensem, document.getElementById("ed_spell"));
|
883 |
|
|
|
|
|
|
|
|
|
|
|
884 |
function add_adsensem(element)
|
885 |
{
|
886 |
if(element.selectedIndex!=0){
|
@@ -922,7 +988,10 @@ class adsensem {
|
|
922 |
{
|
923 |
$options = get_option('plugin_adsensem');
|
924 |
if ( !is_array($options) )
|
925 |
-
{
|
|
|
|
|
|
|
926 |
|
927 |
$this->benice = (rand(1,100)<=$options['be-nice']);
|
928 |
|
@@ -956,6 +1025,34 @@ class adsensem {
|
|
956 |
|
957 |
$adsensem = new adsensem();
|
958 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
959 |
// Run our code later in case this loads prior to any required plugins.
|
960 |
add_action('plugins_loaded', array(&$adsensem,'init'));
|
961 |
?>
|
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.6
|
8 |
Author URI: http://www.mutube.com/
|
9 |
*/
|
10 |
|
17 |
|
18 |
*/
|
19 |
|
20 |
+
@define("ADSENSEM_VERSION", "1.6");
|
21 |
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
|
22 |
|
23 |
/*
|
117 |
/* This test block determines whether to display the Ad in the current location.
|
118 |
The home,single,archive,search tests only apply to Ads displayed inline,
|
119 |
so we test for that here */
|
120 |
+
if( (($ad['show-home']=='yes') && is_home()) ||
|
121 |
+
(($ad['show-post']=='yes') && (is_single() || is_page())) ||
|
122 |
+
(($ad['show-archive']=='yes') && is_archive()) ||
|
123 |
+
(($ad['show-search']=='yes') && is_search()) )
|
124 |
{ /* We passed the test, display the Ad */
|
125 |
$code.=$this->get_ad($ad);
|
126 |
}
|
176 |
$code.= 'google_ad_height = ' . $height . ";\n";
|
177 |
$code.= 'google_ad_format = "' . $format . '"' . ";\n";
|
178 |
|
179 |
+
if($ad['alternate-url']!=''){ $code.= 'google_alternate_ad_url = "' . $ad['alternate-url'] . '";' . "\n";}
|
180 |
+
else if($ad['alternate-color']!=''){ $code.= 'google_alternate_color = "' . $ad['alternate-color'] . '";' . "\n";}
|
181 |
+
|
182 |
//Default to Ads
|
183 |
if($ad['product']!=='link'){ $code.= 'google_ad_type = "' . $ad['adtype'] . '"' . ";\n"; }
|
184 |
|
202 |
|
203 |
/* ADMIN ELEMENTS - REUSABLE PAGE ELEMENTS FOR CONFIGURATION */
|
204 |
|
205 |
+
function set_defaults($options,$wipebasic=false) {
|
206 |
|
207 |
+
if($wipebasic===true){
|
208 |
+
$options['ads'] = array();
|
209 |
+
$options['google-account']="";
|
210 |
+
$options['be-nice']=ADSENSEM_BE_NICE;
|
211 |
+
}
|
212 |
+
|
213 |
$options['defaults'] = array (
|
214 |
'colors' => array(
|
215 |
'border'=> 'FFFFFF',
|
226 |
'linkformat' => '120x90',
|
227 |
'linktype' => '_0ads_al_s',
|
228 |
|
229 |
+
'show-home' => "yes",
|
230 |
+
'show-post' => "yes",
|
231 |
+
'show-archive' => "yes",
|
232 |
+
'show-search' => "yes",
|
233 |
+
|
234 |
+
'html-before' => '',
|
235 |
+
'html-after' => '',
|
236 |
+
|
237 |
+
'alternate-url' => '',
|
238 |
+
'alternate-color' => ''
|
239 |
+
|
240 |
);
|
241 |
|
242 |
+
return $options;
|
243 |
}
|
244 |
|
245 |
|
268 |
{
|
269 |
foreach($list as $key=>$value)
|
270 |
{
|
271 |
+
?><option <?php if($key==$selected){ echo "selected"; }?> value="<?php echo $key; ?>"> <?php echo $value; ?></option><?php
|
272 |
}
|
273 |
}
|
274 |
|
334 |
|
335 |
$linktypes=array('_0ads_al' => '4 Ads Per Unit', '_0ads_al_s' => '5 Ads Per Unit');
|
336 |
|
337 |
+
$yesno=array("yes" => 'Yes', "no" => 'No');
|
338 |
$default=array('' => 'Use Default');
|
339 |
|
340 |
$products=array('ad' => 'Ad Unit','link' => 'Link Unit');
|
345 |
<table cellspacing="5">
|
346 |
<?php if($name!==false){ ?>
|
347 |
<tr><td><label for="adsensem-name">Name:</label></td>
|
348 |
+
<td><input style="border:2px solid #000" name="adsensem-name" size="15" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
|
349 |
<input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($name, ENT_QUOTES); ?>" />
|
350 |
</td></tr>
|
351 |
<?php } ?>
|
456 |
|
457 |
</td><td class="adsensemcol wrap">
|
458 |
|
459 |
+
<h4>Show Inline Ads</h4>
|
460 |
+
|
461 |
<table cellspacing="5">
|
462 |
+
<tr><td><label for="adsensem-show-home">On Homepage</label></td>
|
463 |
<td><select name="adsensem-show-home">
|
464 |
+
|
465 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-home']);?><?php } ?>
|
466 |
<?php $this->output_select($yesno,$settings['show-home']);?>
|
467 |
</select></td></tr>
|
468 |
+
<tr><td><label for="adsensem-show-post">On Posts/Pages</label></td>
|
469 |
<td><select name="adsensem-show-post">
|
470 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-post']);?><?php } ?>
|
471 |
<?php $this->output_select($yesno,$settings['show-post']);?>
|
472 |
</select></td></tr>
|
473 |
+
<tr><td><label for="adsensem-show-archive">On Archives</label></td>
|
474 |
<td><select name="adsensem-show-archive">
|
475 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-archive']);?><?php } ?>
|
476 |
<?php $this->output_select($yesno,$settings['show-archive']);?>
|
477 |
</select></td></tr>
|
478 |
+
<tr><td><label for="adsensem-show-search">On Search</label></td>
|
479 |
<td><select name="adsensem-show-search">
|
480 |
<?php if($name!==false){ ?><?php $this->output_select($default,$settings['show-search']);?><?php } ?>
|
481 |
<?php $this->output_select($yesno,$settings['show-search']);?>
|
491 |
<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>
|
492 |
</table>
|
493 |
|
494 |
+
<h4>Alternate Ads (Optional)</h4>
|
495 |
+
<table cellspacing="5">
|
496 |
+
<tr><td><label for="adsensem-alternate-url">URL:</label></td>
|
497 |
+
<td><input name="adsensem-alternate-url" size="20" title="Enter URL to alternate Ad for display when Google Ad unavailable" value="<?php echo htmlspecialchars($settings['alternate-url'], ENT_QUOTES); ?>" /></td></tr>
|
498 |
+
<tr><td><label for="adsensem-alternate-color">Color:</label></td>
|
499 |
+
<td>#<input name="adsensem-alternate-color" size="6" title="Enter #COLOUR to display when Google Ad unavailable" value="<?php echo htmlspecialchars($settings['alternate-color'], ENT_QUOTES); ?>" /></td></tr>
|
500 |
+
</table>
|
501 |
+
|
502 |
|
503 |
|
504 |
</td></tr>
|
543 |
|
544 |
<h3>Basic Setup</h3>
|
545 |
<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'])); ?>"
|
546 |
+
style="<?php if($options['adsense-account']!=''){echo "font-weight:bold; color:green; ";} else { echo "border:1px solid red;"; }?>">
|
547 |
|
548 |
<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>
|
549 |
</p>
|
578 |
$ad['linkformat']=strip_tags(stripslashes($_POST['adsensem-linkformat']));
|
579 |
$ad['linktype']=strip_tags(stripslashes($_POST['adsensem-linktype']));
|
580 |
|
581 |
+
$ad['html-before']=stripslashes($_POST['adsensem-html-before']);
|
582 |
+
$ad['html-after']=stripslashes($_POST['adsensem-html-after']);
|
|
|
583 |
|
584 |
+
$ad['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
|
585 |
+
$ad['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
|
586 |
|
587 |
$colors['border']=strip_tags(stripslashes($_POST['adsensem-colors-border']));
|
588 |
$colors['link']=strip_tags(stripslashes($_POST['adsensem-colors-link']));
|
610 |
|
611 |
if ( $_POST['adsensem-submit'] ) {
|
612 |
|
613 |
+
if($_POST['adsensem-edit-default']) {
|
614 |
+
|
615 |
+
if($_POST['adsensem-restore-defaults']){
|
616 |
+
$options = $this->set_defaults($options);
|
617 |
+
} else {
|
618 |
+
$options['defaults']=$this->admin_save_settings($options['defaults']);
|
619 |
+
}
|
620 |
|
621 |
} else {
|
622 |
|
623 |
+
if($_POST['adsensem-name']==''){
|
624 |
+
$a=0;
|
625 |
+
do { $a++; $_POST['adsensem-name']='Ad-' . $a; } while (isset($options['ads'][$_POST['adsensem-name']]));
|
626 |
+
}
|
627 |
+
|
628 |
$name=sanitize_title($_POST['adsensem-name']);
|
629 |
|
630 |
/* Changing the name of an Ad, copy and delete old */
|
658 |
update_option('plugin_adsensem', $options);
|
659 |
}
|
660 |
|
661 |
+
if($options['defaults']['ad']==''){
|
662 |
+
$options['defaults']['ad']=key($options['ads']);
|
663 |
+
update_option('plugin_adsensem', $options);
|
664 |
+
}
|
665 |
|
666 |
?>
|
667 |
<div class="wrap">
|
728 |
|
729 |
<p>By changing the <strong>Default settings</strong> (shown on the top line) you can update all Ads at once.
|
730 |
<br /><strong>Default Ad</strong> indicates which Ad will be displayed when no specific ID is used. </p>
|
731 |
+
<p>Ads can be included in <strong>templates</strong> using <code><?php adsensem_ad('name'); ?></code> or <code><?php adsensem_ad(); ?></code> for the default Ad.<br />
|
732 |
+
Ads can be inserted into <strong>posts / pages</strong> using <code><!--adsense#name--></code> or <code><!--adsense--></code> for the default Ad.</p>
|
733 |
+
|
734 |
+
<!--adsense-->
|
735 |
+
|
736 |
</form>
|
737 |
|
738 |
<br /><br />
|
741 |
|
742 |
<?php
|
743 |
|
744 |
+
if( ($_POST['adsensem-edit']) && ($_POST['adsensem-edit-name'])=="")
|
745 |
+
{ $EDIT_DEFAULT = true; }
|
746 |
+
else { $EDIT_DEFAULT = false; }
|
747 |
+
|
748 |
if($_POST['adsensem-edit']){ ?>
|
749 |
|
750 |
+
<h2>Edit '<?php echo ( $EDIT_DEFAULT )?'Default Settings':$_POST['adsensem-edit-name']; ?>'</h2>
|
751 |
<p>Edit the settings for your Ad below. If you want to use the default settings for any element,
|
752 |
simply leave that section unchanged.</p>
|
753 |
<?php
|
754 |
+
if( $EDIT_DEFAULT ) {
|
|
|
|
|
755 |
$this->admin_settingsform($options['defaults'],false);
|
756 |
+
} else {
|
757 |
+
$this->admin_settingsform($options['ads'][$_POST['adsensem-edit-name']],$_POST['adsensem-edit-name']);
|
758 |
}
|
759 |
|
760 |
?>
|
761 |
|
762 |
<?php } else { ?>
|
763 |
<h2>Create New</h2>
|
764 |
+
<p>Enter the settings for your new Ad below. <br />If you want to use the default settings for any element,
|
765 |
simply leave that section unchanged.</p>
|
766 |
<?php $this->admin_settingsform(null,''); ?>
|
767 |
|
769 |
<?php } ?>
|
770 |
|
771 |
<input type="hidden" id="adsensem-submit" name="adsensem-submit" value="1" />
|
772 |
+
<p class="submit">
|
773 |
+
|
774 |
+
<?php if( $EDIT_DEFAULT ) { ?>
|
775 |
+
<input name="adsensem-restore-defaults" type="submit" value="Restore Defaults »">
|
776 |
+
<input type="hidden" id="adsensem-edit-default" name="adsensem-edit-default" value="1" />
|
777 |
+
<?php } ?>
|
778 |
+
<input type="submit" value="Save changes »">
|
779 |
+
|
780 |
+
</p>
|
781 |
|
782 |
</form>
|
783 |
|
895 |
$options = get_option('plugin_adsensem');
|
896 |
|
897 |
//Editor page, so we need to output this editor button code
|
898 |
+
if(
|
899 |
+
strpos($_SERVER['REQUEST_URI'], 'post.php')
|
900 |
+
|| strpos($_SERVER['REQUEST_URI'], 'post-new.php')
|
901 |
+
|| strpos($_SERVER['REQUEST_URI'], 'page.php')
|
902 |
+
|| strpos($_SERVER['REQUEST_URI'], 'page-new.php')
|
903 |
+
|| strpos($_SERVER['REQUEST_URI'], 'bookmarklet.php'))
|
904 |
{
|
905 |
?>
|
906 |
<script language="JavaScript" type="text/javascript">
|
907 |
<!--
|
908 |
var ed_adsensem = document.createElement("select");
|
909 |
+
|
910 |
+
ed_adsensem.setAttribute("onchange", "add_adsensem(this)");
|
911 |
+
|
912 |
+
|
913 |
+
|
914 |
ed_adsensem.setAttribute("class", "ed_button");
|
915 |
ed_adsensem.setAttribute("title", "Select AdSense to Add to Content");
|
916 |
ed_adsensem.setAttribute("id", "ed_adsensem");
|
942 |
?>
|
943 |
document.getElementById("ed_toolbar").insertBefore(ed_adsensem, document.getElementById("ed_spell"));
|
944 |
|
945 |
+
/* Below is a Kludge for IE, which causes it to re-read the state of onChange etc. set above. Tut tut tut */
|
946 |
+
if (navigator.appName == 'Microsoft Internet Explorer') {
|
947 |
+
document.getElementById("ed_toolbar").innerHTML=document.getElementById("ed_toolbar").innerHTML;
|
948 |
+
}
|
949 |
+
|
950 |
function add_adsensem(element)
|
951 |
{
|
952 |
if(element.selectedIndex!=0){
|
988 |
{
|
989 |
$options = get_option('plugin_adsensem');
|
990 |
if ( !is_array($options) )
|
991 |
+
{
|
992 |
+
$options = $this->set_defaults($options);
|
993 |
+
update_option('plugin_adsensem', $options);
|
994 |
+
}
|
995 |
|
996 |
$this->benice = (rand(1,100)<=$options['be-nice']);
|
997 |
|
1025 |
|
1026 |
$adsensem = new adsensem();
|
1027 |
|
1028 |
+
/*
|
1029 |
+
SIDEBAR MODULES COMPATIBILITY KLUDGE
|
1030 |
+
These functions are external to the class above to allow compatibility with SBM
|
1031 |
+
which does not allow calls to be passed to a class member.
|
1032 |
+
These functions are dummy passthru's for the real functions above
|
1033 |
+
|
1034 |
+
NOT (CURRENTLY?) WORKING - it is not possible to do this, because we need the $name to
|
1035 |
+
be passed through which is not supported by SBM.
|
1036 |
+
|
1037 |
+
SBM also does not pass any details about the module (e.g. module name, id, etc.) to
|
1038 |
+
the callback function and it is impossible to determine anything about itself.
|
1039 |
+
|
1040 |
+
*/
|
1041 |
+
|
1042 |
+
function adsensem_widget($args){
|
1043 |
+
global $adsensem;
|
1044 |
+
$adsensem->widget($args);
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
function adsensem_widget_control(){
|
1048 |
+
global $adsensem;
|
1049 |
+
$adsensem->widget_control();
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
/*
|
1053 |
+
END DUMMY KLUDGE
|
1054 |
+
*/
|
1055 |
+
|
1056 |
// Run our code later in case this loads prior to any required plugins.
|
1057 |
add_action('plugins_loaded', array(&$adsensem,'init'));
|
1058 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.
|
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 |
|
4 |
Tags: adsense, ads, manage, widget, google
|
5 |
Requires at least: 2.0.2
|
6 |
Tested up to: 2.1
|
7 |
+
Stable tag: 1.6
|
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 |
|