AdSense Manager - Version 1.7

Version Description

Download this release

Release Info

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

Code changes from version 1.6 to 1.7

Files changed (2) hide show
  1. adsense-manager.php +40 -20
  2. readme.txt +4 -2
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.6
8
Author URI: http://www.mutube.com/
9
*/
10
@@ -17,7 +17,7 @@ Defaults
17
18
*/
19
20
- @define("ADSENSEM_VERSION", "1.6");
21
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
22
23
/*
@@ -204,12 +204,6 @@ class adsensem {
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',
@@ -239,6 +233,15 @@ class adsensem {
239
240
);
241
242
return $options;
243
}
244
@@ -658,7 +661,7 @@ class adsensem {
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
}
@@ -989,7 +992,7 @@ else { $EDIT_DEFAULT = false; }
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
@@ -1000,9 +1003,16 @@ else { $EDIT_DEFAULT = false; }
1000
1001
add_action('admin_footer', array(&$this,'admin_callback_editor'));
1002
1003
-
1004
/* Add the blocks to the Widget panel for positioning */
1005
- if (function_exists('register_sidebar_widget') )
1006
{
1007
1008
/* Loop through available ads and generate widget one at a time */
@@ -1031,22 +1041,32 @@ $adsensem = new adsensem();
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
/*
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.7
8
Author URI: http://www.mutube.com/
9
*/
10
17
18
*/
19
20
+ @define("ADSENSEM_VERSION", "1.7");
21
@define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
22
23
/*
204
205
function set_defaults($options,$wipebasic=false) {
206
207
$options['defaults'] = array (
208
'colors' => array(
209
'border'=> 'FFFFFF',
233
234
);
235
236
+ if($wipebasic===true){
237
+ $options['ads'] = array(
238
+ 'demo-advert' => array()
239
+ );
240
+ $options['adsense-account']="";
241
+ $options['be-nice']=ADSENSEM_BE_NICE;
242
+ $options['defaults']['ad'] = 'demo-advert';
243
+ }
244
+
245
return $options;
246
}
247
661
update_option('plugin_adsensem', $options);
662
}
663
664
+ if( ( $options['defaults']['ad']=='' ) && ( count($options['ads']>0) ) ){
665
$options['defaults']['ad']=key($options['ads']);
666
update_option('plugin_adsensem', $options);
667
}
992
$options = get_option('plugin_adsensem');
993
if ( !is_array($options) )
994
{
995
+ $options = $this->set_defaults($options,true);
996
update_option('plugin_adsensem', $options);
997
}
998
1003
1004
add_action('admin_footer', array(&$this,'admin_callback_editor'));
1005
1006
+ /* If SBM installed output the Kludge functions for compatibility */
1007
+ /* These use the #id pased via the module name because of inability to pass
1008
+ references to functions using class definitions under SBM */
1009
+ if (function_exists('sbm_get_option') )
1010
+ {
1011
+ register_sidebar_widget('AdSense Ad', 'adsensem_sbm_widget');
1012
+ register_widget_control('AdSense Ad', 'adsensem_sbm_widget_control', 300, 80);
1013
+ }
1014
/* Add the blocks to the Widget panel for positioning */
1015
+ else if (function_exists('register_sidebar_widget') )
1016
{
1017
1018
/* Loop through available ads and generate widget one at a time */
1041
which does not allow calls to be passed to a class member.
1042
These functions are dummy passthru's for the real functions above
1043
1044
SBM also does not pass any details about the module (e.g. module name, id, etc.) to
1045
the callback function and it is impossible to determine anything about itself.
1046
1047
+ For this reason the name is extracted out of the title given to the SBM and
1048
+ it is not possible to modify individual modules from within the module panel.
1049
+ On the upside, it does work.
1050
+
1051
*/
1052
1053
+ function adsensem_sbm_widget($args){
1054
global $adsensem;
1055
+ extract($args);
1056
+ /* The module's title is in 'title'
1057
+ we can extract the "name" from this
1058
+ and use it to display the correct Ad.
1059
+
1060
+ If no matchable title is found, use
1061
+ the default Ad */
1062
+
1063
+ if( preg_match ("/#(.+)(\W+|$)/", $title, $matches) > 0 )
1064
+ { $adsensem->widget($args,$matches[1]); }
1065
+ else { $adsensem->widget($args); }
1066
}
1067
1068
+ function adsensem_sbm_widget_control(){
1069
+ /*Null function, unable to edit options for multiple Widgets under SBM*/
1070
}
1071
1072
/*
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.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
@@ -12,7 +12,9 @@ AdSense Manager is a new Wordpress plugin for managing AdSense ads on your blog.
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
4
Tags: adsense, ads, manage, widget, google
5
Requires at least: 2.0.2
6
Tested up to: 2.1
7
+ Stable tag: 1.7
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
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
+ Sidebar Modules (as used in the popular K2 theme) are now also supported.
18
19
== Installation ==
20