AdSense Manager - Version 2.1

Version Description

Download this release

Release Info

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

Code changes from version 2.0 to 2.1

Files changed (2) hide show
  1. adsense-manager.php +14 -11
  2. readme.txt +3 -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: 2.0
8
  Author URI: http://www.mutube.com/
9
  */
10
 
@@ -17,7 +17,7 @@ Defaults
17
 
18
  */
19
 
20
- @define("ADSENSEM_VERSION", "2.0");
21
  @define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
22
 
23
  /*
@@ -989,14 +989,13 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--adsen
989
 
990
 
991
  // This is the function that outputs adsensem widget.
992
- function widget($args,$n=false) {
993
 
994
  // $args is an array of strings that help widgets to conform to
995
  // the active theme: before_widget, before_title, after_widget,
996
  // and after_title are the array keys. Default tags: li and h2.
997
  extract($args);
998
-
999
-
1000
  // Each widget can store its own options. We keep strings here.
1001
  $options = get_option('plugin_adsensem');
1002
  $title = $options['ads'][$n]['title'];
@@ -1032,6 +1031,8 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--adsen
1032
 
1033
  function admin_add_pages()
1034
  {
 
 
1035
  add_submenu_page('edit.php',"Ads", "Ads", 10, "adsense-manager", array(&$this,'admin_manage'));
1036
  add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager", array(&$this,'admin_options'));
1037
 
@@ -1039,18 +1040,19 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--adsen
1039
  /* If SBM installed output the Kludge functions for compatibility */
1040
  /* These use the #id pased via the module name because of inability to pass
1041
  references to functions using class definitions under SBM */
 
1042
  if (function_exists('sbm_get_option') )
1043
  {register_widget_control('AdSense Ad', 'adsensem_sbm_widget_control', 300, 80);}
1044
  /* Add the blocks to the Widget panel for positioning */
1045
- else if (function_exists('register_sidebar_widget') )
1046
- {
1047
 
1048
  /* Loop through available ads and generate widget one at a time */
1049
  if(is_array($options['ads'])){
1050
 
1051
  foreach($options['ads'] as $name => $ad){
1052
- $widget=array('Ad #%s', '', $name);
1053
- register_widget_control($widget, array(&$this,'widget_control'), 300, 80, $name);
1054
  }
1055
  }
1056
 
@@ -1209,8 +1211,9 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--adsen
1209
  /* Loop through available ads and generate widget one at a time */
1210
  if(is_array($options['ads'])){
1211
  foreach($options['ads'] as $name => $ad){
1212
- $widget=array('Ad #%s', '', $name);
1213
- register_sidebar_widget($widget, array(&$this,'widget'), $name);
 
1214
  }
1215
  }
1216
 
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: 2.1
8
  Author URI: http://www.mutube.com/
9
  */
10
 
17
 
18
  */
19
 
20
+ @define("ADSENSEM_VERSION", "2.1");
21
  @define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
22
 
23
  /*
989
 
990
 
991
  // This is the function that outputs adsensem widget.
992
+ function widget($args, $n=0) {
993
 
994
  // $args is an array of strings that help widgets to conform to
995
  // the active theme: before_widget, before_title, after_widget,
996
  // and after_title are the array keys. Default tags: li and h2.
997
  extract($args);
998
+
 
999
  // Each widget can store its own options. We keep strings here.
1000
  $options = get_option('plugin_adsensem');
1001
  $title = $options['ads'][$n]['title'];
1031
 
1032
  function admin_add_pages()
1033
  {
1034
+ $options = get_option('plugin_adsensem');
1035
+
1036
  add_submenu_page('edit.php',"Ads", "Ads", 10, "adsense-manager", array(&$this,'admin_manage'));
1037
  add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager", array(&$this,'admin_options'));
1038
 
1040
  /* If SBM installed output the Kludge functions for compatibility */
1041
  /* These use the #id pased via the module name because of inability to pass
1042
  references to functions using class definitions under SBM */
1043
+
1044
  if (function_exists('sbm_get_option') )
1045
  {register_widget_control('AdSense Ad', 'adsensem_sbm_widget_control', 300, 80);}
1046
  /* Add the blocks to the Widget panel for positioning */
1047
+ else if (function_exists('wp_register_widget_control') )
1048
+ {
1049
 
1050
  /* Loop through available ads and generate widget one at a time */
1051
  if(is_array($options['ads'])){
1052
 
1053
  foreach($options['ads'] as $name => $ad){
1054
+ $args = array('n' => $name, 'height' => 80, 'width' => 300);
1055
+ wp_register_widget_control('adsensem-' . $name,'Ad #' . $name, array(&$this,'widget_control'), $args, $name);
1056
  }
1057
  }
1058
 
1211
  /* Loop through available ads and generate widget one at a time */
1212
  if(is_array($options['ads'])){
1213
  foreach($options['ads'] as $name => $ad){
1214
+ $args = array('n' => $name);
1215
+ //$id, $name, $output_callback, $options = array()
1216
+ wp_register_sidebar_widget('adsensem-' . $name,'Ad #' . $name, array(&$this,'widget'), $args, $name);
1217
  }
1218
  }
1219
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 2.0
8
 
9
  AdSense Manager is a new Wordpress plugin for managing AdSense ads on your blog. Generates code automatically and allows positioning with Widgets. Now supports Referral ads.
10
 
@@ -21,6 +21,7 @@ Version 2.0 now supports:
21
  * Sidebar Modules (as used in the popular K2 theme)
22
  * [New extended instructions available.](http://www.mutube.com/projects/wordpress/adsense-manager/instructions)
23
 
 
24
 
25
  == Installation ==
26
 
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.2
7
+ Stable tag: 2.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. Now supports Referral ads.
10
 
21
  * Sidebar Modules (as used in the popular K2 theme)
22
  * [New extended instructions available.](http://www.mutube.com/projects/wordpress/adsense-manager/instructions)
23
 
24
+ Updated to work with new Wordpress 2.2 Widgets. This may break Sidebar Module support, let me know how you get on with it. They seem pretty incompatible now Widgets are built in.
25
 
26
  == Installation ==
27