AdSense Manager - Version 4.0

Version Description

Download this release

Release Info

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

Code changes from version 3.1.0 to 4.0

adsense-manager.css CHANGED
@@ -83,10 +83,10 @@
83
  th {border-bottom:2px solid #000;font-size:smaller;}
84
  #default-options td{border-bottom:1px solid #000;}
85
  #manage-ads {}
86
- #manage-ads td, #manage-ads th {padding: 1px 5px;}
87
 
88
  .network_blanking {height:20px;}
89
- .network_header td {border-top:1px solid #000;font-weight:bold;background-color:#ddd;}
90
  .network_admin * {font-weight:normal; text-align:center;}
91
  .adrow td { border-bottom:1px dotted #888 }
92
  .adrow_name { padding-left:25px;}
@@ -108,8 +108,10 @@ th {border-bottom:2px solid #000;font-size:smaller;}
108
  .ad_adsense {padding-left:25px;background:url(http://www.google.com/favicon.ico) left no-repeat;}
109
  .ad_adsense_classic {padding-left:25px;background:url(http://www.google.com/favicon.ico) left no-repeat;}
110
  .ad_cj {padding-left:25px;background:url(http://www.cj.com/favicon.ico) left no-repeat;}
111
- .ad_code {padding-left:25px;background:url(./code.png) left no-repeat;}
112
  .ad_crispads {padding-left:25px;background:url(http://www.crispads.com/favicon.ico) left no-repeat;}
113
  .ad_widgetbucks {padding-left:25px;background:url(http://www.widgetbucks.com/favicon.ico) left no-repeat;}
114
- .ad_shoppingads {padding-left:25px;background:url(./shoppingads.png) left no-repeat;}
115
  .ad_ypn {padding-left:25px;background:url(http://www.yahoo.com/favicon.ico) left no-repeat;}
 
 
83
  th {border-bottom:2px solid #000;font-size:smaller;}
84
  #default-options td{border-bottom:1px solid #000;}
85
  #manage-ads {}
86
+ #manage-ads td {padding: 2px 5px; vertical-align:middle;}
87
 
88
  .network_blanking {height:20px;}
89
+ .network_header td {border-top:1px solid #000;font-weight:bold;}
90
  .network_admin * {font-weight:normal; text-align:center;}
91
  .adrow td { border-bottom:1px dotted #888 }
92
  .adrow_name { padding-left:25px;}
108
  .ad_adsense {padding-left:25px;background:url(http://www.google.com/favicon.ico) left no-repeat;}
109
  .ad_adsense_classic {padding-left:25px;background:url(http://www.google.com/favicon.ico) left no-repeat;}
110
  .ad_cj {padding-left:25px;background:url(http://www.cj.com/favicon.ico) left no-repeat;}
111
+ .ad_code {padding-left:25px;background:url(./images/code.png) left no-repeat;}
112
  .ad_crispads {padding-left:25px;background:url(http://www.crispads.com/favicon.ico) left no-repeat;}
113
  .ad_widgetbucks {padding-left:25px;background:url(http://www.widgetbucks.com/favicon.ico) left no-repeat;}
114
+ .ad_shoppingads {padding-left:25px;background:url(./images/shoppingads.png) left no-repeat;}
115
  .ad_ypn {padding-left:25px;background:url(http://www.yahoo.com/favicon.ico) left no-repeat;}
116
+
117
+ .default_note {padding-left:20px;background:url(./images/default.png) left no-repeat;width:16px;height:16px;}
adsense-manager.js CHANGED
@@ -60,66 +60,7 @@
60
  addLoadEvent(function(){ adsensem_update_custom()});
61
  addLoadEvent(function(){ adsensem_update_formats()});
62
 
 
 
63
 
64
  //End Initialise
65
-
66
-
67
-
68
-
69
- addLoadEvent( function() {var manager = new dbxManager( 'adsensem_dbx' );} );
70
- addLoadEvent( function()
71
- {
72
- var adsensem_dbx1 = new dbxGroup(
73
- 'adsensem_dbx1', // container ID [/-_a-zA-Z0-9/]
74
- 'vertical', // orientation ['vertical'|'horizontal']
75
- '7', // drag threshold ['n' pixels]
76
- 'no', // restrict drag movement to container axis ['yes'|'no']
77
- '10', // animate re-ordering ['n' frames per transition]
78
- 'yes', // include open/close toggle buttons ['yes'|'no']
79
- 'open', // default state ['open'|'closed']
80
-
81
- 'open', // word for "open", as in "open this box"
82
- 'close', // word for "close", as in "close this box"
83
- 'click-down and drag to move this box', // sentence for "move this box" by mouse
84
- 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
85
- 'use the arrow keys to move this box', // sentence for "move this box" by keyboard
86
- ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
87
- '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
88
- );
89
- var adsensem_dbx2 = new dbxGroup(
90
- 'adsensem_dbx2', // container ID [/-_a-zA-Z0-9/]
91
- 'vertical', // orientation ['vertical'|'horizontal']
92
- '7', // drag threshold ['n' pixels]
93
- 'no', // restrict drag movement to container axis ['yes'|'no']
94
- '10', // animate re-ordering ['n' frames per transition]
95
- 'yes', // include open/close toggle buttons ['yes'|'no']
96
- 'open', // default state ['open'|'closed']
97
-
98
- 'open', // word for "open", as in "open this box"
99
- 'close', // word for "close", as in "close this box"
100
- 'click-down and drag to move this box', // sentence for "move this box" by mouse
101
- 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
102
- 'use the arrow keys to move this box', // sentence for "move this box" by keyboard
103
- ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
104
- '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
105
- );
106
- var adsensem_dbx3 = new dbxGroup(
107
- 'adsensem_dbx3', // container ID [/-_a-zA-Z0-9/]
108
- 'vertical', // orientation ['vertical'|'horizontal']
109
- '7', // drag threshold ['n' pixels]
110
- 'no', // restrict drag movement to container axis ['yes'|'no']
111
- '10', // animate re-ordering ['n' frames per transition]
112
- 'yes', // include open/close toggle buttons ['yes'|'no']
113
- 'open', // default state ['open'|'closed']
114
-
115
- 'open', // word for "open", as in "open this box"
116
- 'close', // word for "close", as in "close this box"
117
- 'click-down and drag to move this box', // sentence for "move this box" by mouse
118
- 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
119
- 'use the arrow keys to move this box', // sentence for "move this box" by keyboard
120
- ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
121
- '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
122
- );
123
-
124
- }
125
- );
60
  addLoadEvent(function(){ adsensem_update_custom()});
61
  addLoadEvent(function(){ adsensem_update_formats()});
62
 
63
+ addLoadEvent(function(){ add_postbox_toggles('adsensem')});
64
+
65
 
66
  //End Initialise
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adsense-manager.php CHANGED
@@ -2,12 +2,15 @@
2
  /*
3
  Plugin Name: AdSense Manager
4
  PLugin URI: http://wordpress.org/extend/plugins/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: 3.1.0
8
  Author URI: http://www.mutube.com/
9
  */
10
- @define("ADSENSEM_VERSION", "3.1.0");
 
 
 
11
 
12
  /*
13
  TODO:
@@ -19,16 +22,6 @@ Defaults
19
 
20
  @define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
21
 
22
- /*
23
- CONSTANTS FOR CONFIGURATION
24
- */
25
-
26
- //Currently not used
27
- //@define("ADSENSEM_MAX_ADS", 7); //Max Google Ad units
28
- //@define("ADSENSEM_MAX_REFERRALS", 7); //Max Google Referral units
29
-
30
- @define("ADSENSEM_BE_NICE", 3); //Default level only, can be changed in Options/AdSense Manager
31
-
32
 
33
  /* Copyright 2006 MARTIN FITZPATRICK (email : martin.fitzpatrick@gmail.com)
34
 
@@ -47,7 +40,9 @@ Defaults
47
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
48
  */
49
 
 
50
  //Now ad networks are managed by dedicated classes. How modern.
 
51
  require_once('class-generic.php');
52
 
53
  require_once('class-adsense.php'); //Adsense (using Slots, etc.)
@@ -64,12 +59,11 @@ require_once('class-shoppingads.php'); //ShoppingAds
64
  require_once('class-ypn.php'); //Yahoo! Publisher Network - not yet supported
65
  require_once('class-widgetbucks.php'); //Widgetbucks
66
 
67
- if(is_admin()){ require_once('class-admin.php'); } //Admin interface functions (keep out while browsing main site
68
-
69
  $_adsensem = get_option('plugin_adsensem');
70
  $_adsensem_notices = array();
71
  $_adsensem_counters = array();
72
 
 
73
 
74
  /*
75
 
@@ -88,11 +82,12 @@ if(!function_exists('adsensem_ad')) {
88
  {$ad=$_adsensem['ads'][$_adsensem['default-ad']];}
89
  else
90
  {$ad=$_adsensem['ads'][$name];}
91
-
92
- if($ad->show_ad_here()){
93
- echo $ad->get_ad();
94
- $ad->counter_click();
95
- }
 
96
  }
97
  }
98
 
@@ -105,7 +100,7 @@ if(!function_exists('adsensem_ad')) {
105
  */
106
 
107
  class adsensem {
108
-
109
  //STARTUP INITIALISATION
110
  function init(){
111
 
@@ -116,23 +111,25 @@ class adsensem {
116
  add_filter('the_content', array('adsensem','filter_ads'));
117
  add_action('wp_footer', array('adsensem','footer'));
118
  }
119
-
120
- add_action('admin_menu', array('adsensem_admin','init_admin'));
121
- add_action('admin_head', array('adsensem_admin','add_header_script'));
122
- add_action('admin_footer', array('adsensem_admin','admin_callback_editor'));
123
-
 
124
  }
125
 
126
- function setup_is_valid(){
127
- global $_adsensem;
128
- if(is_array($_adsensem)){
129
- if(is_array($_adsensem['ads'])){
130
- if(is_object($_adsensem['ads'][$_adsensem['default-ad']])){
131
- return true;
132
- }
133
- }
134
- }
135
- return false;
 
136
  }
137
 
138
  function init_widgets()
@@ -144,16 +141,14 @@ class adsensem {
144
  if (function_exists('wp_register_sidebar_widget') || function_exists('register_sidebar_module') )
145
  {
146
 
147
- /* Create Ad Unit for the 'Default Ad' */
148
- //$args = array('name' => 'default-ad', 'height' => 80, 'width' => 300);
149
- //adsensem::register_widget('default-ad',$args);
150
 
151
  /* Loop through available ads and generate widget one at a time */
152
  if(is_array($_adsensem['ads'])){
153
  foreach($_adsensem['ads'] as $name => $ad){
154
- $args = array('name' => $name, 'height' => 80, 'width' => 300);
155
- //$id, $name, $output_callback, $_adsensem = array()
156
- adsensem::register_widget($name,$args);
157
  }
158
  }
159
  }
@@ -163,8 +158,9 @@ class adsensem {
163
  function register_widget($name,$args){
164
 
165
  if(function_exists('wp_register_sidebar_widget')){
166
- wp_register_sidebar_widget('adsensem-' . $name,'Ad #' . $name, array('adsensem','widget'), $args, $name);
167
- wp_register_widget_control('adsensem-' . $name,'Ad #' . $name, array('adsensem','widget_control'), $args, $name);
 
168
  } else if (function_exists('register_sidebar_module') ){
169
  register_sidebar_module('Ad #' . $name, 'adsensem_sbm_widget', 'adsensem-' . $name, $args );
170
  register_sidebar_module_control('Ad #' . $name, array('adsensem','widget_control'), 'adsensem-' . $name);
@@ -172,27 +168,28 @@ class adsensem {
172
  }
173
 
174
 
175
- // This is the function that outputs adsensem widget.
176
- function widget($args,$n) {
177
- // $args is an array of strings that help widgets to conform to
178
- // the active theme: before_widget, before_title, after_widget,
179
- // and after_title are the array keys. Default tags: li and h2.
180
- extract($args); //nb. $name comes out of this, hence the use of $n
181
- global $_adsensem;
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- // Each widget can store its own options. We keep strings here.
184
- if($n){$ad = $_adsensem['ads'][$n];} else {$ad = $_adsensem['ads'][$_adsensem['default-ad']];}
185
-
186
- if($ad->show_ad_here()){
187
- $ad->counter_click();
188
-
189
- echo $before_widget;
190
- if($ad->title!=''){ echo $before_title . $ad->title . $after_title; }
191
- echo $ad->get_ad(); //Output the selected ad
192
-
193
- echo $after_widget;
194
- }
195
- }
196
  /* Widget admin block for each Ad element on the page, allows
197
  movement of them around the sidebar */
198
  function widget_control($name)
@@ -213,26 +210,19 @@ class adsensem {
213
 
214
  }
215
 
216
-
217
-
218
-
219
-
220
-
221
-
222
- function footer(){
223
- ?><!-- AdSense Manager v<?php echo ADSENSEM_VERSION;?> (<?php timer_stop(1); ?> seconds.) --><?php
224
- }
225
 
226
 
227
- function filter_ad_callback($matches){
228
- global $_adsensem;
229
 
230
  if($matches[1]==''){ /* default ad */ $matches[1]=$_adsensem['default-ad']; }
231
 
232
  if(isset($_adsensem['ads'][$matches[1]])){
233
  $ad=$_adsensem['ads'][$matches[1]];
234
  if($ad->show_ad_here()){
235
- $ad->counter_click();
236
  return $ad->get_ad();
237
  }
238
  }
@@ -244,11 +234,11 @@ class adsensem {
244
  <!--adsense#name--> for named ad or <!--adsense--> for default */
245
  function filter_ads($content) {
246
  global $_adsensem;
247
-
248
  if(is_object($_adsensem['ads'][$_adsensem['default-ad']])){
249
- $content=preg_replace_callback(array("/<!--adsense-->/","/<!--am-->/"),array('adsensem','filter_ad_callback'),$content);
250
- $content=preg_replace_callback(array("/<!--adsense#(.*)-->/","/<!--am#(.*)-->/"),array('adsensem','filter_ad_callback'),$content);
251
  }
 
 
252
 
253
  return $content;
254
  }
@@ -278,15 +268,9 @@ if ($_REQUEST['adsensem-show-ad']){
278
  }
279
  /* END SHOW ALTERNATE AD UNITS */
280
 
281
- /* SHOW BENICE UNITS */
282
- if ($_REQUEST['adsensem-benice']){
283
- ?><html><body><?php
284
- echo adsensem_benice::benice_code($_REQUEST['adsensem-benice']); //contains format
285
- ?></body></html><?php
286
- die(0);
287
- }
288
- /* END BENICE UNITS */
289
 
 
290
 
291
  /* REVERT TO PREVIOUS BACKUP OF AD DATABASE */
292
  if ($_REQUEST['adsensem-revert-db']){
@@ -302,7 +286,7 @@ if ($_REQUEST['adsensem-revert-db']){
302
  switch ($_POST['adsensem-mode'].':'.$_POST['adsensem-action']){
303
  case 'notice:upgrade adsense-deluxe':
304
  if($_POST['adsensem-notice-confirm-yes']){
305
- require('class-upgrade.php');
306
  adsensem_upgrade::adsense_deluxe_to_3_0();
307
  adsensem_admin::remove_notice('upgrade adsense-deluxe');
308
  } else {
@@ -312,9 +296,16 @@ switch ($_POST['adsensem-mode'].':'.$_POST['adsensem-action']){
312
  case 'notice:upgrade adsense-manager':
313
  adsensem_admin::remove_notice('upgrade adsense-manager');
314
  break;
 
 
 
 
 
 
 
315
  }
316
  /* END PRE-OUTPUT PROCESSING */
317
-
318
 
319
 
320
 
@@ -326,8 +317,9 @@ switch ($_POST['adsensem-mode'].':'.$_POST['adsensem-action']){
326
  /* SIDEBAR MODULES COMPATIBILITY FUNCTION */
327
 
328
 
329
-
330
  add_action('plugins_loaded', array('adsensem','init'), 1);
 
 
331
  add_action('widgets_init', array('adsensem','init_widgets'), 1);
332
 
333
  function kda_mce_callback(){
2
  /*
3
  Plugin Name: AdSense Manager
4
  PLugin URI: http://wordpress.org/extend/plugins/adsense-manager/
5
+ Description: AdSense Manager lets you manage your ads from within WordPress. With support for AdSense, AdBrite and many more.
6
  Author: Martin Fitzpatrick
7
+ Version: 4.0
8
  Author URI: http://www.mutube.com/
9
  */
10
+ @define("ADSENSEM_VERSION", "4.0");
11
+
12
+ @define("AM_BRAND_NAME", "AdSense Manager");
13
+ @define("AM_BRAND_DEFAULT_NETWORK", "AdSense");
14
 
15
  /*
16
  TODO:
22
 
23
  @define('ADSENSEM_DIRPATH','/wp-content/plugins' . strrchr(dirname(__FILE__),'/') . "/");
24
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  /* Copyright 2006 MARTIN FITZPATRICK (email : martin.fitzpatrick@gmail.com)
27
 
40
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41
  */
42
 
43
+
44
  //Now ad networks are managed by dedicated classes. How modern.
45
+
46
  require_once('class-generic.php');
47
 
48
  require_once('class-adsense.php'); //Adsense (using Slots, etc.)
59
  require_once('class-ypn.php'); //Yahoo! Publisher Network - not yet supported
60
  require_once('class-widgetbucks.php'); //Widgetbucks
61
 
 
 
62
  $_adsensem = get_option('plugin_adsensem');
63
  $_adsensem_notices = array();
64
  $_adsensem_counters = array();
65
 
66
+ //Array ( [ads] => Array ( [ad-1] => Ad_AdSense Object ( [title] => [p] => Array ( [html-before] => [html-after] => [show-home] => [show-post] => [show-page] => [show-archive] => [show-search] => [adformat] => [code] => [notes] => 160x90, created 4/16/08 5 Link for side bar [height] => [width] => [slot] => 6983861882 [adtype] => link ) [name] => ad-1 ) [ad-2] => Ad_AdSense Object ( [title] => [p] => Array ( [html-before] => [html-after] => [show-home] => [show-post] => [show-page] => [show-archive] => [show-search] => [adformat] => [code] => [notes] => 160x90, created 4/16/08 5 Link for side bar [height] => [width] => [slot] => 6983861882 [adtype] => link ) [name] => ad-2 ) [co-1] => Ad_Code Object ( [title] => [p] => Array ( [html-before] => [html-after] => [show-home] => [show-post] => [show-page] => [show-archive] => [show-search] => [adformat] => [code] => [notes] => [height] => [width] => ) [name] => co-1 ) ) [defaults] => Array ( [ad_adsense] => Array ( [html-before] => [html-after] => [show-home] => yes [show-post] => yes [show-page] => yes [show-archive] => yes [show-search] => yes [adformat] => 120x240 [code] => [notes] => 120x240, created 4/15/08 [height] => 240 [width] => 120 [slot] => [adtype] => ad ) [ad_adsense_classic] => Array ( [show-home] => yes [show-post] => yes [show-page] => yes [show-archive] => yes [show-search] => yes [html-before] => [html-after] => [color-border] => FFFFFF [color-title] => 0000FF [color-bg] => FFFFFF [color-text] => 000000 [color-link] => 008000 [channel] => [uistyle] => [slot] => [adformat] => 250x250 [adtype] => text_image [linkformat] => 120x90 [linktype] => _0ads_al_s ) [ad_code] => Array ( [show-home] => yes [show-post] => yes [show-page] => yes [show-archive] => yes [show-search] => yes [html-before] => [html-after] => ) ) [account-ids] => Array ( [ad_adsense] => 3904618150325763 ) [be-nice] => 3 [version] => 3.2.11 [default-ad] => ad-1 )
67
 
68
  /*
69
 
82
  {$ad=$_adsensem['ads'][$_adsensem['default-ad']];}
83
  else
84
  {$ad=$_adsensem['ads'][$name];}
85
+ if(is_object($ad)){
86
+ if($ad->show_ad_here()){
87
+ echo $ad->get_ad();
88
+ $ad->counter_click();
89
+ }
90
+ }
91
  }
92
  }
93
 
100
  */
101
 
102
  class adsensem {
103
+
104
  //STARTUP INITIALISATION
105
  function init(){
106
 
111
  add_filter('the_content', array('adsensem','filter_ads'));
112
  add_action('wp_footer', array('adsensem','footer'));
113
  }
114
+ }
115
+
116
+ function init_admin(){
117
+ //Pull in the admin functions before triggering
118
+ require_once('class-admin.php');
119
+ adsensem_admin::init_admin();
120
  }
121
 
122
+
123
+
124
+
125
+ function setup_is_valid(){ //Check we have ads, (removed default-ad checks as causes problems where is not set, not essential.
126
+ global $_adsensem;
127
+ if(is_array($_adsensem)){
128
+ if(is_array($_adsensem['ads'])){
129
+ return true;
130
+ }
131
+ }
132
+ return false;
133
  }
134
 
135
  function init_widgets()
141
  if (function_exists('wp_register_sidebar_widget') || function_exists('register_sidebar_module') )
142
  {
143
 
144
+ /* Default Ad widget */
145
+ if(is_object($_adsensem['ads'][$_adsensem['default-ad']])){ adsensem::register_widget('default-ad',$args); }
 
146
 
147
  /* Loop through available ads and generate widget one at a time */
148
  if(is_array($_adsensem['ads'])){
149
  foreach($_adsensem['ads'] as $name => $ad){
150
+ $args = array('name' => $name, 'height' => 80, 'width' => 300);
151
+ adsensem::register_widget($name,$args);
 
152
  }
153
  }
154
  }
158
  function register_widget($name,$args){
159
 
160
  if(function_exists('wp_register_sidebar_widget')){
161
+ //$id, $name, $output_callback, $options = array()
162
+ wp_register_sidebar_widget('adsensem-' . $name,"Ad#$name", array('adsensem','widget'),$args,$name);
163
+ wp_register_widget_control('adsensem-' . $name,"Ad#$name", array('adsensem','widget_control'), $args,$name);
164
  } else if (function_exists('register_sidebar_module') ){
165
  register_sidebar_module('Ad #' . $name, 'adsensem_sbm_widget', 'adsensem-' . $name, $args );
166
  register_sidebar_module_control('Ad #' . $name, array('adsensem','widget_control'), 'adsensem-' . $name);
168
  }
169
 
170
 
171
+ // This is the function that outputs adsensem widget.
172
+ function widget($args,$n='') {
173
+ // $args is an array of strings that help widgets to conform to
174
+ // the active theme: before_widget, before_title, after_widget,
175
+ // and after_title are the array keys. Default tags: li and h2.
176
+ extract($args); //nb. $name comes out of this, hence the use of $n
177
+ global $_adsensem;
178
+
179
+ //If name not passed in (Sidebar Modules), extract from the widget-id (WordPress Widgets)
180
+ if($n==''){ $n=substr($args['widget_id'],9); } //Chop off beginning adsensem- bit
181
+ if($n!=='default-ad'){$ad = $_adsensem['ads'][$n];} else {$ad = $_adsensem['ads'][$_adsensem['default-ad']];}
182
+
183
+ if($ad->show_ad_here()){
184
+ echo $before_widget;
185
+ if($ad->title!=''){ echo $before_title . $ad->title . $after_title; }
186
+ echo $ad->get_ad(); //Output the selected ad
187
+ echo $after_widget;
188
+ $ad->counter_click();
189
+ }
190
 
191
+ }
192
+
 
 
 
 
 
 
 
 
 
 
 
193
  /* Widget admin block for each Ad element on the page, allows
194
  movement of them around the sidebar */
195
  function widget_control($name)
210
 
211
  }
212
 
213
+ function footer(){
214
+ ?><!-- AdSense Manager v<?php echo ADSENSEM_VERSION;?> (<?php timer_stop(1); ?> seconds.) --><?php
215
+ }
 
 
 
 
 
 
216
 
217
 
218
+ function filter_ad_callback($matches){
219
+ global $_adsensem;
220
 
221
  if($matches[1]==''){ /* default ad */ $matches[1]=$_adsensem['default-ad']; }
222
 
223
  if(isset($_adsensem['ads'][$matches[1]])){
224
  $ad=$_adsensem['ads'][$matches[1]];
225
  if($ad->show_ad_here()){
 
226
  return $ad->get_ad();
227
  }
228
  }
234
  <!--adsense#name--> for named ad or <!--adsense--> for default */
235
  function filter_ads($content) {
236
  global $_adsensem;
 
237
  if(is_object($_adsensem['ads'][$_adsensem['default-ad']])){
238
+ $content=preg_replace_callback(array("/<!--adsense-->/","/<!--am-->/","/\[ad\]/"),array('adsensem','filter_ad_callback'),$content);
 
239
  }
240
+
241
+ $content=preg_replace_callback(array("/<!--adsense#(.*)-->/","/<!--am#(.*)-->/","/\[ad#(.*)\]/"),array('adsensem','filter_ad_callback'),$content);
242
 
243
  return $content;
244
  }
268
  }
269
  /* END SHOW ALTERNATE AD UNITS */
270
 
271
+ if(is_admin()){
 
 
 
 
 
 
 
272
 
273
+ require_once('class-admin.php');
274
 
275
  /* REVERT TO PREVIOUS BACKUP OF AD DATABASE */
276
  if ($_REQUEST['adsensem-revert-db']){
286
  switch ($_POST['adsensem-mode'].':'.$_POST['adsensem-action']){
287
  case 'notice:upgrade adsense-deluxe':
288
  if($_POST['adsensem-notice-confirm-yes']){
289
+ require_once('class-upgrade.php');
290
  adsensem_upgrade::adsense_deluxe_to_3_0();
291
  adsensem_admin::remove_notice('upgrade adsense-deluxe');
292
  } else {
296
  case 'notice:upgrade adsense-manager':
297
  adsensem_admin::remove_notice('upgrade adsense-manager');
298
  break;
299
+ case 'notice:activate adsense-manager':
300
+ adsensem_admin::remove_notice('activate adsense-manager');
301
+ break;
302
+ case 'notice:notice adsense-manager':
303
+ adsensem_admin::remove_notice('notice adsense-manager');
304
+ break;
305
+
306
  }
307
  /* END PRE-OUTPUT PROCESSING */
308
+ }
309
 
310
 
311
 
317
  /* SIDEBAR MODULES COMPATIBILITY FUNCTION */
318
 
319
 
 
320
  add_action('plugins_loaded', array('adsensem','init'), 1);
321
+ add_action('admin_menu', array('adsensem','init_admin'));
322
+
323
  add_action('widgets_init', array('adsensem','init_widgets'), 1);
324
 
325
  function kda_mce_callback(){
class-adbrite.php CHANGED
@@ -6,8 +6,8 @@ $_adsensem_networks['ad_adbrite'] = array(
6
  'name' => 'AdBrite',
7
  'shortname' => 'adbrite',
8
  'www' => 'http://www.adbrite.com/',
9
- 'www-create' => 'http://www.adbrite.com/zones/commerce/purchase.php?product_id_array=22',
10
- 'www-signup' => 'http://www.adbrite.com/mb/landing_both.php?spid=51549&afb=120x60-1-blue',
11
  );
12
 
13
  /*
@@ -82,9 +82,9 @@ class Ad_AdBrite extends Ad_Generic {
82
 
83
  function import_detect_network($code){
84
 
85
- return ( (strpos($code,'<!-- Begin: AdBrite -->')!==false) ||
86
- (strpos($code,'src="http://ads.adbrite.com')!==false) ||
87
- (strpos($code,'<!-- End: AdBrite -->')!==false)
88
  );
89
 
90
  }
@@ -119,27 +119,6 @@ class Ad_AdBrite extends Ad_Generic {
119
  }
120
 
121
 
122
- function _form_settings_colors(){
123
- $this->_form_settings_colors_generate(array('Border'=>'border','Title'=>'title','Background'=>'bg','Text'=>'text'));
124
- }
125
-
126
-
127
- function _form_settings_colors_demo(){
128
- ?>
129
- <div id="ad-color-bg" style="margin-top:1em;width:120px;background: #<?php echo htmlspecialchars($this->pd('color-bg'), ENT_QUOTES); ?>;">
130
- <div id="ad-color-border" style="font: 10px arial, sans-serif; border: 1px solid #<?php echo htmlspecialchars($this->pd('color-border'), ENT_QUOTES); ?>" class="linkunit-wrapper">
131
- <div id="ad-color-title" style="color: #<?php echo htmlspecialchars($this->pd('color-title'), ENT_QUOTES); ?>; font: 11px verdana, arial, sans-serif; padding: 2px;">
132
- <b><u>Linked Title</u></b><br /></div>
133
- <div id="ad-color-text" style="color: #<?php echo htmlspecialchars($this->pd('color-text'), ENT_QUOTES); ?>; padding: 2px;" class="text">
134
- Advertiser's ad text here<br /></div>
135
- <div id="ad-color-link" style="color: #<?php echo htmlspecialchars($this->pd('color-title'), ENT_QUOTES); ?>; font: 10px verdana, arial, sans-serif; padding: 2px;">
136
- www.advertiser-url.com<br /></div>
137
- <div style="color: #000; padding: 2px;" class="rtl-safe-align-right">
138
- &nbsp;<u>Ads by AdBrite</u></div>
139
- </div>
140
- <?php
141
- }
142
-
143
  function _var_ad_formats_available(){
144
  $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner');
145
  $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper');
6
  'name' => 'AdBrite',
7
  'shortname' => 'adbrite',
8
  'www' => 'http://www.adbrite.com/',
9
+ 'www-create' => 'http://www.adbrite.com/zones/zone_add.php',
10
+ 'www-signup' => 'http://www.adbrite.com/?spid=51549',
11
  );
12
 
13
  /*
82
 
83
  function import_detect_network($code){
84
 
85
+ return ( (strpos($code,'<!-- Begin: adBrite')!==false) ||
86
+ (strpos($code,'ads.adbrite.com')!==false) ||
87
+ (strpos($code,'End: adBrite -->')!==false)
88
  );
89
 
90
  }
119
  }
120
 
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  function _var_ad_formats_available(){
123
  $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner');
124
  $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper');
class-adgridwork.php CHANGED
@@ -6,7 +6,7 @@ $_adsensem_networks['ad_adgridwork'] = array(
6
  'name' => 'AdGridWork',
7
  'shortname' => 'adgrid',
8
  'www' => 'http://www.adgridwork.com/',
9
- //'www-create' => 'http://www.adbrite.com/zones/commerce/purchase.php?product_id_array=22',
10
  'www-signup' => 'http://www.adgridwork.com/?r=18501',
11
  );
12
 
@@ -27,7 +27,7 @@ class Ad_AdGridWork extends Ad_Generic {
27
 
28
  $code ='<a href="http://www.adgridwork.com/?r=' . $this->account_id() . '" style="color: #' . $this->pd('color-link') . '; font-size: 14px" target="_blank">Free Advertising</a>';
29
  $code.='<script type="text/javascript">' . "\n";
30
- $code.="var sid = '" . $this->account_id() . "';\n";
31
  $code.="var title_color = '" . $this->pd('color-title') . "';\n";
32
  $code.="var description_color = '" . $this->pd('color-text') . "';\n";
33
  $code.="var link_color = '" . $this->pd('color-url') . "';\n";
@@ -38,14 +38,14 @@ class Ad_AdGridWork extends Ad_Generic {
38
  return $code;
39
  }
40
 
41
-
42
  function render_benice(){
43
- $this->set_account_id('18501'); //TEMPORARILY override the account id
44
  return $this->render_ad();
45
  }
46
 
47
  function can_benice(){return true;}
48
-
49
 
50
  function save_settings_network() {
51
 
@@ -82,7 +82,7 @@ class Ad_AdGridWork extends Ad_Generic {
82
 
83
  function import_settings($code){
84
 
85
- if(preg_match('/var sid = \'(\w*)\'/', $code, $matches)!=0){ $_POST['adsensem-account-id'] = $matches[1]; }
86
 
87
  if(preg_match("/var title_color = '(\w*)'/", $code, $matches)!=0){ $_POST['adsensem-color-title'] = $matches[1]; }
88
  if(preg_match("/var description_color = '(\w*)'/", $code, $matches)!=0){ $_POST['adsensem-color-text'] = $matches[1]; }
@@ -93,19 +93,24 @@ class Ad_AdGridWork extends Ad_Generic {
93
  $this->save_settings();
94
  }
95
 
96
-
97
- function _form_settings_ad_unit(){
98
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
99
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
100
- }
101
-
102
-
103
- //Middle
104
- function admin_manage_column2(){
105
- adsensem_admin::manage_dbxoutput(array('colors'));
106
- }
107
 
108
 
 
 
 
 
 
109
  }
110
 
111
  ?>
6
  'name' => 'AdGridWork',
7
  'shortname' => 'adgrid',
8
  'www' => 'http://www.adgridwork.com/',
9
+ 'www-create' => 'http://www.adgridwork.com/u.php?page=submitsite',
10
  'www-signup' => 'http://www.adgridwork.com/?r=18501',
11
  );
12
 
27
 
28
  $code ='<a href="http://www.adgridwork.com/?r=' . $this->account_id() . '" style="color: #' . $this->pd('color-link') . '; font-size: 14px" target="_blank">Free Advertising</a>';
29
  $code.='<script type="text/javascript">' . "\n";
30
+ $code.="var sid = '" . $this->pd('slot') . "';\n";
31
  $code.="var title_color = '" . $this->pd('color-title') . "';\n";
32
  $code.="var description_color = '" . $this->pd('color-text') . "';\n";
33
  $code.="var link_color = '" . $this->pd('color-url') . "';\n";
38
  return $code;
39
  }
40
 
41
+ /* BENICE WILL REQUIRED MULTIPLE ALTERNATIVES AND OUTPUT DIFFERENT SID DEPENDING ON DIMENSIONS
42
  function render_benice(){
43
+ $this->p['slot']==''; //TEMPORARILY override the slot id
44
  return $this->render_ad();
45
  }
46
 
47
  function can_benice(){return true;}
48
+ */
49
 
50
  function save_settings_network() {
51
 
82
 
83
  function import_settings($code){
84
 
85
+ if(preg_match('/var sid = \'(\w*)\'/', $code, $matches)!=0){ $_POST['adsensem-slot'] = $matches[1]; }
86
 
87
  if(preg_match("/var title_color = '(\w*)'/", $code, $matches)!=0){ $_POST['adsensem-color-title'] = $matches[1]; }
88
  if(preg_match("/var description_color = '(\w*)'/", $code, $matches)!=0){ $_POST['adsensem-color-text'] = $matches[1]; }
93
  $this->save_settings();
94
  }
95
 
96
+
97
+ function _form_settings_help(){
98
+ ?><tr><td><p>Further configuration and control over channel and slot setup can be achieved through <a href="http://www.adgridwork.com/u.php" target="_blank">AdGridWorks's online system</a>:</p>
99
+ <ul>
100
+ <li><a href="http://www.adgridwork.com/u.php?page=metrics&sid=<?php echo $this->p['slot']; ?>" target="_blank">Campaign Metrics</a><br />
101
+ View hits, clicks, and other stats information.</li>
102
+ <li><a href="http://www.adgridwork.com/u.php?page=submitsite&sid=<?php echo $this->p['slot']; ?>" target="_blank">Edit Campaign</a><br />
103
+ Change keywords, ad format and layout.</li>
104
+ </ul></td></tr>
105
+ <?php
106
+ }
107
 
108
 
109
+ function _form_settings_network(){
110
+ ?><td><td><p>No network settings.</p></td></tr>
111
+ <?php
112
+ }
113
+
114
  }
115
 
116
  ?>
class-admin.php CHANGED
@@ -18,25 +18,27 @@ class adsensem_admin {
18
 
19
  function init_admin()
20
  {
21
- global $_adsensem;
 
 
 
22
 
23
  wp_enqueue_script('prototype');
24
- wp_enqueue_script('dbx');
25
- wp_enqueue_script('dbx-admin-key');
26
 
27
  add_submenu_page('edit.php',"Ad Units", "Ad Units", 10, "adsense-manager-manage-ads", array('adsensem_admin','admin_manage'));
28
- // add_submenu_page('edit.php',"Ad Zones", "Ad Zones", 10, "adsense-manager-manage-ad-zones", 'adsensem_admin::admin_manage');
29
  add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager-options", array('adsensem_admin','admin_options'));
30
  add_action( 'admin_notices', array('adsensem_admin','admin_notices'), 1 );
31
-
32
- if (!is_array($_adsensem)){ //No startup data found, fill it out now.
33
 
 
34
  /* Wipe basic data */
35
  $_adsensem['ads'] = array();//'demo-adroll' => new Ad_ShoppingAds,
36
  $_adsensem['defaults'] = array();
37
  $_adsensem['account-ids'] = array();
 
38
 
39
- $_adsensem['be-nice'] = ADSENSEM_BE_NICE;
40
  $_adsensem['version'] = ADSENSEM_VERSION;
41
 
42
  $deluxe=get_option('acmetech_adsensedeluxe');
@@ -45,12 +47,13 @@ class adsensem_admin {
45
  $update_adsensem = true;
46
 
47
  } else if(adsensem_admin::version_upgrade($_adsensem['version'],ADSENSEM_VERSION)){
 
48
  require('class-upgrade.php');
49
 
50
  //Backup cycle
51
  $backup=get_option('plugin_adsensem_backup');
52
  $backup[adsensem_admin::major_version($_adsensem['version'])]=$_adsensem;
53
- update_option('plugin_adsensem_backup',$backup);
54
 
55
  adsensem_upgrade::go();
56
  $update_adsensem=true;
@@ -68,7 +71,6 @@ class adsensem_admin {
68
  function version_upgrade($old,$new){
69
  $ov=explode('.', $old);
70
  $nv=explode('.', $new);
71
-
72
  if($nv[0]>$ov[0]){
73
  return true;
74
  } else if($nv[0]==$ov[0]){
@@ -80,7 +82,7 @@ class adsensem_admin {
80
  }
81
  }
82
  }
83
- //else
84
  return false;
85
  }
86
 
@@ -94,6 +96,7 @@ class adsensem_admin {
94
  global $_adsensem;
95
  ?>
96
  <?php
 
97
  if(is_array($_adsensem['notices'])){
98
  foreach($_adsensem['notices'] as $action=>$notice){
99
  ?>
@@ -107,7 +110,9 @@ class adsensem_admin {
107
  <input name="adsensem-notice-confirm-no" type="submit" value="No">
108
  <?php } else if($notice['confirm']=='ok'){ ?>
109
  <input name="adsensem-notice-confirm-ok" type="submit" value="OK">
110
- <?php } ?>
 
 
111
  </form>
112
  </div><?php
113
  }
@@ -117,10 +122,8 @@ class adsensem_admin {
117
 
118
  function add_notice($action,$text,$confirm=false){
119
  global $_adsensem;
120
- //if($_adsensem['notices'][$action]!==false){ //Has not previously been disabled
121
- $_adsensem['notices'][$action]['text']=$text;
122
- $_adsensem['notices'][$action]['confirm']=$confirm;
123
- //}
124
  update_option('plugin_adsensem', $_adsensem);
125
  }
126
 
@@ -129,10 +132,6 @@ class adsensem_admin {
129
  unset($_adsensem['notices'][$action]); //=false;
130
  update_option('plugin_adsensem', $_adsensem);
131
  }
132
-
133
-
134
-
135
-
136
 
137
  /*
138
  FORM ELEMENT GENERATION FUNCTIONS
@@ -151,7 +150,7 @@ class adsensem_admin {
151
  }
152
  }
153
 
154
- function _field_select($title,$id,$list,$selected)
155
  {
156
  $default=array('' => 'Use Default');
157
  if(is_array(current($list))){$default=array('Default'=>$default);} //If optgroups in use, move the default into one. Smart.
@@ -159,46 +158,45 @@ class adsensem_admin {
159
  <tr id="adsensem-form-<?php echo $id;?>"><td class="adsensem_label"><label for="adsensem-<?php echo $id?>"><?php echo $title?>:</label></td><td>
160
  <select name="adsensem-<?php echo $id; ?>" id="adsensem-<?php echo $id; ?>" onchange="adsensem_form_update(this);">
161
  <?php if($_POST['adsensem-action']!=='edit defaults'){ ?><?php adsensem_admin::_field_select_options($default,$selected);?><?php }
162
- adsensem_admin::_field_select_options($list,$selected);
163
  ?></select>
164
- </td></tr>
 
 
165
  <?php
166
  }
167
 
168
- function _field_input($title,$id,$value,$size,$info='')
169
  {
170
  ?>
171
  <tr id="adsensem-form-<?php echo $id;?>"><td class="adsensem_label"><label for="adsensem-<?php echo $id;?>"><?php echo $title;?>:</label></td><td>
172
- <input name="adsensem-<?php echo $id;?>" size="<?php echo $size;?>" title="<?php echo $info;?>" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
173
- </td></tr>
 
 
 
 
 
 
174
  <?php
175
  }
176
 
177
  //Reads an array and outputs the form elements specified within, wrapped in the dbx wrapper code.
178
- function manage_dbxoutput($forms){
179
- ?>
180
-
181
- <?php
182
- foreach($forms as $formelement){
183
- ?><div class="dbx-box-wrapper">
184
- <fieldset id="<?php $formelement; ?>" class="dbx-box">
185
- <div class="dbx-handle-wrapper"><h3 class="dbx-handle"><?php echo ucwords(strtr($formelement,'_',' ')); ?></h3></div>
186
- <div class="dbx-content-wrapper">
187
- <div class="dbx-content">
188
- <div><table id="adsensem-settings-<?php echo $formelement; ?>"><?php $this->{_form_settings_.$formelement}(); ?></table></div>
189
- </div>
190
- </div>
191
- </fieldset></div><?php
192
- }
193
 
194
-
195
  }
196
-
197
-
198
-
199
-
200
-
201
-
202
 
203
  /*
204
  NETWORK LISTING / AD SORTING FUNCTIONS
@@ -256,17 +254,20 @@ class adsensem_admin {
256
 
257
  //We're attempting to import code
258
  $code=stripslashes($code);
259
- foreach ($_adsensem_networks as $network => $n){
260
- if(call_user_func(array($network,'import_detect_network'),$code))
261
- {
262
- $ad=new $network;
263
- $ad->import_settings($code);
 
 
264
 
265
- $imported=true;
266
- break; //leave the foreach loop
267
- }
 
268
  }
269
-
270
  if(!$imported){$ad=new Ad_Code(); $ad->import_settings($code);}
271
  return $ad;
272
  }
@@ -362,51 +363,20 @@ class adsensem_admin {
362
 
363
  } else {$name=stripslashes($_POST['adsensem-name']);}
364
 
 
365
  $_adsensem['ads'][$name]->save_settings();
366
 
367
  if($_POST['adsensem-mode']!=='apply'){//Only for Save (Apply leave as is, return to edit page)
368
  $_POST['adsensem-mode']='manage';
369
  $_POST['adsensem-action']='';}
370
-
371
- $update_adsensem=true;
372
- break;
373
-
374
- case 'save:restore defaults':
375
- $temp = new $_POST['adsensem-action-target']; //temporary to access network-specific functions
376
- $temp->reset_defaults();
377
 
378
- $_POST['adsensem-mode']='edit';
379
- $_POST['adsensem-action']='edit defaults';
380
- $update_adsensem=true;
381
- break;
382
 
383
- case 'save:edit defaults':
384
- $temp = new $_POST['adsensem-action-target']; //temporary to access network-specific functions
385
- $temp->save_settings();
386
-
387
- $_adsensem['defaults'][$_POST['adsensem-action-target']]=$temp->p;
388
-
389
- $_POST['adsensem-mode']='manage';
390
- $_POST['adsensem-action']='';
391
  $update_adsensem=true;
392
- break;
393
-
394
- case 'import:edit code':
395
- $ad=new Ad_Code;
396
- $ad->save_settings(); //adsensem_admin::import_ad($_POST['adsensem-code']);
397
- $name=adsensem_admin::validate_name($_POST['adsensem-name'],$ad->network());
398
- $_adsensem['ads'][$name]=$ad;
399
- $_adsensem['ads'][$name]->name=$name;
400
-
401
- //Forces imported unit into the edit mode for changes
402
- $_POST['adsensem-action']='edit unit';
403
- $_POST['adsensem-action-target']=$name;
404
-
405
- $update_adsensem=true; $sort_adsensem=true;
406
  break;
407
-
408
  case 'import:edit unit':
409
- $ad=adsensem_admin::import_ad($_POST['adsensem-code']);
410
  $name=adsensem_admin::validate_name($_POST['adsensem-name'],$ad->network());
411
  $_adsensem['ads'][$name]=$ad;
412
  $_adsensem['ads'][$name]->name=$name;
@@ -421,21 +391,7 @@ class adsensem_admin {
421
  $update_adsensem=true;
422
  break;
423
 
424
- case 'import:edit defaults':
425
- $ad=adsensem_admin::import_ad($_POST['adsensem-code']);
426
- if($ad->network=='Ad_Code'){$_POST['adsensem-action']=''; break;}
427
-
428
- $_adsensem['defaults'][$ad->network()]=$ad->p;
429
-
430
- //Forces imported unit into the edit mode for changes, to skip change mode to 'manage';
431
- $_POST['adsensem-action']='edit defaults';
432
- $_POST['adsensem-action-target']=$ad->network();
433
-
434
- $update_adsensem=true;
435
- break;
436
-
437
  case 'manage:edit unit': //Pass through stuff to switch modes between pages.
438
- case 'manage:edit defaults':
439
  case 'import:edit new':
440
  $_POST['adsensem-mode']='edit';
441
  break;
@@ -445,24 +401,32 @@ class adsensem_admin {
445
  $_POST['adsensem-action']='';
446
 
447
  } //End switch cases
448
-
449
- //Set default ad if it is currently incorrect and there is a valid ad object available
450
- if( (!is_object($_adsensem['ads'][$_adsensem['default-ad']]) ) && ( count($_adsensem['ads']>0) ) ){
451
- $_adsensem['default-ad']=key($_adsensem['ads']);
452
- $update_adsensem==true;
453
- }
 
 
 
 
 
454
 
455
  if($update_adsensem){
456
  $_adsensem['ads']=adsensem_admin::sort_ads_by_network($_adsensem['ads']);
457
  update_option('plugin_adsensem', $_adsensem);
 
458
  }
459
 
460
  if($_POST['adsensem-mode']=='manage'){ //Managing (i.e. not Importing, or editing)
461
- //If not in edit mode, output the ad listing/tables
462
- ////if((sizeof($_adsensem['ads'])==false) || (sizeof($_adsensem['ads'])==0) ){
463
- adsensem_admin::admin_manage_table(); //Only if ads available to list
464
- // }
465
- adsensem_admin::admin_manage_create();
 
 
466
  } else {
467
  //If in edit mode, output the editing form (create, edit, defaults, etc.)
468
  adsensem_admin::admin_manage_edit();
@@ -482,27 +446,8 @@ class adsensem_admin {
482
  MAIN INTERFACE FUNCTIONS
483
  Output the HTML for the main user interface in admin mode - including managing ads and initiating edit forms
484
  */
485
-
486
-
487
- function admin_manage_table(){
488
- // Get our options and see if we're handling a form submission.
489
- global $_adsensem, $_adsensem_networks;
490
-
491
- ?>
492
- <div class="wrap">
493
- <h2>Manage Ads</h2>
494
- <!--<p>Below are your currently created Ads. Remember to set your <strong>Google Adsense ID</strong> at <a href="<?php echo get_bloginfo('wpurl');?>/wp-admin/options-general.php?page=adsense-manager-options">Options &raquo; AdSense Manager</a></p>-->
495
-
496
- <form action="" method="post" id="adsensem-config-manage" enctype="multipart/form-data">
497
- <input type="hidden" name="adsensem-mode" id="adsensem-submit" value="manage">
498
- <input type="hidden" name="adsensem-action" id="adsensem-action">
499
- <input type="hidden" name="adsensem-action-target" id="adsensem-action-target">
500
-
501
- <table id="manage-ads" style="width:100%;" cellspacing="0" border="0">
502
- <tr style="height:2em;"><th style="text-align:left;">Name</th><th style="text-aling:center">Slot</th><th colspan="5" style="width:50px;">Colours</th><th>Format</th><th>Alternate</th><th>Notes</th><th style="width:100px;">Modify</th><th style="width:110px;"></th><th style="width:2px;">DA</th></tr>
503
 
504
- <?php
505
- function network_header($network){
506
  global $_adsensem, $_adsensem_networks;
507
 
508
  $defaults = $_adsensem['defaults'][$network];
@@ -516,34 +461,55 @@ class adsensem_admin {
516
  <span class="<?php echo $network; ?>"><?php } ?>
517
  <?php echo $_adsensem_networks[$network]['name']; ?>
518
  <?php if ($_adsensem_networks[$network]['www']!=''){ ?></a><?php } else { ?></span><?php } ?></td>
 
 
 
519
 
520
- <?php if(($defaults['slot'])||($defaults['channel'])){?><td style="text-align:center"><?php echo htmlspecialchars($defaults['slot'], ENT_QUOTES); ?><?php echo htmlspecialchars($defaults['channel'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php } ?>
521
 
522
- <td class="colcol" title="Border" style="width:10px;background-color:#<?php echo htmlspecialchars($defaults['color-border'], ENT_QUOTES); ?>">&nbsp;</td>
523
- <td class="colcol" title="Link" style="width:10px;background-color:#<?php echo htmlspecialchars($defaults['color-title'], ENT_QUOTES); ?>">&nbsp;</td>
524
- <td class="colcol" title="Background" style="width:10px;background-color:#<?php echo htmlspecialchars($defaults['color-bg'], ENT_QUOTES); ?>">&nbsp;</td>
525
- <td class="colcol" title="Text" style="width:10px;background-color:#<?php echo htmlspecialchars($defaults['color-text'], ENT_QUOTES); ?>">&nbsp;</td>
526
- <td class="colcol colcor" title="URL" style="width:10px;background-color:#<?php echo htmlspecialchars($defaults['color-link'], ENT_QUOTES); ?>">&nbsp;</td>
527
  <?php
528
 
529
- if($defaults['adformat']){?><td style="width:100px;text-align:center;"><?php echo htmlspecialchars($defaults['adformat'], ENT_QUOTES); ?><br /><?php echo htmlspecialchars($defaults['linkformat'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php }
530
  if($defaults['alternate-ad']){?><td style="text-align:center"><?php echo htmlspecialchars($defaults['alternate-ad'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php } ?>
531
  <td></td>
532
- <td class="network_admin" style="width:10px;">
533
- <input class="button" name="adsensem-edit" type="submit" value="Edit Network" onClick="document.getElementById('adsensem-action').value='edit defaults'; document.getElementById('adsensem-action-target').value='<?php echo $network?>';" title="Edit Defaults for the <?php echo $_adsensem_networks[$network]['name']; ?> network"></td>
534
- <td><?php if($_adsensem_networks[$network]['www-create']){?><a href="<?php echo $_adsensem_networks[$network]['www-create']; ?>" target="_blank" style="font-weight:normal;">Create Ads...</a><?php } ?></td><td></td>
535
  </tr>
536
  <?php
537
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
 
539
  $previous_network='';
540
 
541
- if(sizeof($_adsensem['ads'])!=0){
542
- foreach($_adsensem['ads'] as $name=>$ad)
543
- {
544
  if($ad->network()!==$previous_network){
545
- if($previous_network!==''){ ?><tr class="network_blanking"><td></td></tr><?php }
546
- network_header($ad->network());
547
  $previous_network=$ad->network();
548
  $shade=0;
549
  }
@@ -552,8 +518,9 @@ class adsensem_admin {
552
  //if(($_POST['adsensem-edit-network']!='') && ($ad['network']!=$_POST['adsensem-edit-network'])){continue;}
553
  ?><tr class="adrow shade_<?php echo $shade; $shade=($shade==1)?0:1; ?>">
554
  <td><span class="adrow_name"><?php echo htmlspecialchars($name, ENT_QUOTES); ?></span></td>
 
555
  <td <?php if((!array_key_exists('slot',$ad->p))&&(!array_key_exists('channel',$ad->p))){ echo 'class="disabled"'; } ?> style="text-align:center"><?php echo htmlspecialchars($ad->p['slot'], ENT_QUOTES); ?><?php if($ad->p['channel']!=''){echo htmlspecialchars('/'.$ad->p['channel'], ENT_QUOTES) ;} ?></td>
556
-
557
  <?php if(array_key_exists('color-border',$ad->p)){ ?>
558
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-border'], ENT_QUOTES); ?>">&nbsp;</td>
559
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-title'], ENT_QUOTES); ?>">&nbsp;</td>
@@ -561,33 +528,34 @@ class adsensem_admin {
561
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-text'], ENT_QUOTES); ?>">&nbsp;</td>
562
  <td class="colcor" style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-link'], ENT_QUOTES); ?>">&nbsp;</td>
563
  <?php } else { ?><td colspan="5" class="disabled"></td><?php } ?>
564
-
565
- <td style="text-align:center;"><?php echo htmlspecialchars($ad->p['adformat'], ENT_QUOTES); ?></td>
566
  <td style="text-align:center"><?php echo htmlspecialchars($ad->p['alternate-ad'], ENT_QUOTES); ?></td>
567
- <td style="text-align:center"><?php echo htmlspecialchars($ad->p['notes'], ENT_QUOTES); ?></td>
568
  <td class="network_admin">
569
- <input name="adsensem-edit" type="submit" value="Edit Settings" onClick="document.getElementById('adsensem-action').value='edit unit'; document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';">
570
  </td>
571
 
572
- <td class="network_admin"><input name="adsensem-copy" type="submit" value="Copy" onClick="document.getElementById('adsensem-action').value='copy unit';document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';" title="Copy to new Ad unit"><?php
573
- if($name!=$_adsensem['default-ad']){?><input name="adsensem-delete" type="submit" value="Delete" onClick="if(confirm('Delete <?php echo $name; ?>?')){document.getElementById('adsensem-action').value='delete unit'; document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';} else {return false;}"></td><?php }
574
  ?></td>
575
 
576
- <td><input onClick="document.getElementById('adsensem-action').value='set default'; this.form.submit();" name="adsensem-default-name" type="radio" value="<?php echo $name; ?>"<?php
577
  if($name==$_adsensem['default-ad']){?> checked <?php }
578
  ?>></td>
579
 
580
  </tr>
581
  <?php
582
 
583
- }
584
  } ?>
585
 
586
  </table>
 
587
  <p>By changing the <strong>Network</strong> settings you can update all Ads on a network at once.
588
  <br /><strong>Default Ad</strong> indicates which Ad will be displayed in any space on your site where no specific ID is used. </p>
589
  <p>Ads can be included in <strong>templates</strong> using <code>&lt;?php adsensem_ad('name'); ?&gt;</code> or <code>&lt;?php adsensem_ad(); ?&gt;</code> for the default Ad.<br />
590
- Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#name--&gt;</code> or <code>&lt;!--am--&gt;</code> for the default Ad. Note that the old <code>&lt;--adsense#name--&gt;</code> style works too!</p>
 
591
  </form>
592
  </div>
593
  <?php
@@ -599,40 +567,30 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#na
599
  global $_adsensem, $_adsensem_networks;
600
 
601
  ?>
 
602
  <div class="wrap">
603
  <form action="" method="post" id="adsensem-config-import" enctype="multipart/form-data">
604
  <input type="hidden" name="adsensem-mode" id="adsensem-mode-import" value="import">
605
  <input type="hidden" name="adsensem-action" id="adsensem-action-import">
606
  <input type="hidden" name="adsensem-action-target" id="adsensem-action-import-target">
607
  <h2>Create Ads</h2>
608
-
609
- <p>AdSense Manager supports most Ad networks including <?php adsensem_admin::network_list(); ?>.</p>
 
 
610
 
611
  <table>
612
  <tr><td style="width:50%;vertical-align:top;">
613
- <h3>AdSense Slots &amp; Other Networks</h3>
614
- <p>Simply <strong>paste your Ad Code below</strong> and Import!</p>
615
 
616
- <div><textarea rows="5" cols="80" name="adsensem-code" id="adsensem-code"></textarea>
617
  <p class="submit" style="text-align:left;vertical-align:bottom;">
618
  <input name="adsensem-clear" type="button" value="Clear" onclick="document.getElementById('adsensem-code').value='';">
619
- <input name="adsensem-save" type="submit" value="Save as Code" onclick="document.getElementById('adsensem-action-import').value='edit code'; document.getElementById('adsensem-action-import-target').value='Ad_Code';">
620
- <input name="adsensem-import-defualts" type="submit" value="Import to Defaults&raquo;" onclick="document.getElementById('adsensem-action-import').value='edit defaults'; document.getElementById('adsensem-action-import-target').value='Ad_Code';">
621
- <input style="font-weight:bold;" name="adsensem-import" type="submit" value="Import to New Ad Unit&raquo;" onclick="document.getElementById('adsensem-action-import').value='edit unit';">
622
  </p>
623
  </div>
624
 
625
- </td><td style="width:50%;vertical-align:bottom;">
626
- <h3>AdSense Classic</h3>
627
- <p>If you prefer <em>not</em> to manage your AdSense ads through Google's online Slot system, you can use AdSense Manager to change colours, size and layout as in previous versions.</p>
628
- <p>Simply <strong>choose the type of Ad</strong> to create below!</p>
629
- <p class="submit" style="text-align:left;">
630
- <input name="adsensem-import" type="submit" value="AdSense Ad Unit&raquo;" onclick="document.getElementById('adsensem-action-import').value='edit new'; document.getElementById('adsensem-action-import-target').value='Ad_AdSense_Ad';">
631
- &nbsp;
632
- <input name="adsensem-import" type="submit" value="AdSense Link Unit&raquo;" onclick="document.getElementById('adsensem-action-import').value='edit new'; document.getElementById('adsensem-action-import-target').value='Ad_AdSense_Link';">
633
- &nbsp;
634
- <input name="adsensem-import" type="submit" value="AdSense Referral&raquo;" onclick="document.getElementById('adsensem-action-import').value='edit new'; document.getElementById('adsensem-action-import-target').value='Ad_AdSense_Referral';">
635
- </p>
636
  </td></table>
637
 
638
  </form>
@@ -654,16 +612,7 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#na
654
  <form action="#adsensem-config" method="post" id="adsensem-config" enctype="multipart/form-data">
655
 
656
  <?php //Default options for all situations
657
- if($_POST['adsensem-action']=='edit defaults'){
658
-
659
- $ad=new $_POST['adsensem-action-target']; //Create temporary ad unit to access functions
660
- $ad->p=$_adsensem['defaults'][$_POST['adsensem-action-target']]; //Load defaults into temporary ad
661
-
662
- ?><h2>Edit Default Settings for '<span class="<?php echo $ad->network();?>"><?php echo $_adsensem_networks[$_POST['adsensem-action-target']]['name']; ?></span>'</h2>
663
- <p>Edit the settings for your Ad below. To use the network defaults for any element,
664
- simply leave that section blank or select "Use Default" from the drop down menus.</p><?php
665
-
666
- } else if ($_POST['adsensem-action']=='edit unit'){
667
 
668
  $ad=$_adsensem['ads'][$_POST['adsensem-action-target']];
669
  $ad->name=$_POST['adsensem-action-target'];
@@ -672,15 +621,7 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#na
672
  <p>Edit the settings for your Ad below. To use the network defaults for any element,
673
  simply leave that section blank or select "Use Default" from the drop down menus.</p><?php
674
 
675
- } else if ($_POST['adsensem-action']=='edit new'){
676
-
677
- $ad=new $_POST['adsensem-action-target'];
678
-
679
- ?><h2>Create New '<span class="<?php echo $ad->network();?>"><?php echo $_adsensem_networks[$_POST['adsensem-action-target']]['name']; ?></span>' </h2>
680
- <p>Enter the settings for your new Ad below. To use the network defaults for any element,
681
- simply leave that section blank or select "Use Default" from the drop down menus.</p><?php
682
-
683
- }
684
 
685
  /* ADMIN Settings - Editing form for each Ad and defaults, reusable */
686
  ?>
@@ -692,7 +633,7 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#na
692
  <?php $ad->admin_manage_column1(); ?>
693
  </div></td>
694
  <td class="formlayoutsection">
695
- <h2>Appearance</h2>
696
  <div id="adsensem_dbx2" class="dbx-group" >
697
  <?php $ad->admin_manage_column2(); ?>
698
  </div></td>
@@ -726,6 +667,8 @@ Ads can be inserted into <strong>posts / pages</strong> using <code>&lt;!--am#na
726
 
727
  }
728
 
 
 
729
  /* Define basic settings for the AdSense Manager - for block control use admin_manage */
730
 
731
  function admin_options() {
@@ -781,13 +724,11 @@ or <a href="http://wordpress.org/tags/adsense-manager" target="_blank">check the
781
 
782
  <h3>Be Nice!</h3>
783
  <p style="text-align:justify;">
784
- Please support the developers of this plugin by either donating a small amount of your ad space to show our ads, or by making a donation through
785
- PayPal:</p>
786
 
787
  <ol>
788
- <li>I'm Being Nice and donating
789
- <input style="text-align:right;" name="adsensem-be-nice" value="<?php echo htmlspecialchars($_adsensem['be-nice'], ENT_QUOTES);?>" size="1">% of my Ad space to support development of this plugin [<a href="http://wordpress.org/extend/plugins/adsense-manager/faq/">Eh?</a>]</li>
790
  <li>I've given a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">a very generous donation through Paypal</a> and got a warm fuzzy feeling.</li>
 
791
  </ol>
792
 
793
  <p>Thanks to all those that have shown their support, it really does make a difference!</p>
@@ -816,8 +757,8 @@ or <a href="http://wordpress.org/tags/adsense-manager" target="_blank">check the
816
  function add_header_script(){
817
  if($_GET['page']=='adsense-manager-manage-ads'){
818
  ?>
819
- <link type="text/css" rel="stylesheet" href="<?php get_bloginfo('wpurl') ?>/wp-content/plugins/adsense-manager/adsense-manager.css" />
820
- <script src="<?php get_bloginfo('wpurl') ?>/wp-content/plugins/adsense-manager/adsense-manager.js" /></script>
821
  <?php
822
  }
823
  }
@@ -845,7 +786,7 @@ or <a href="http://wordpress.org/tags/adsense-manager" target="_blank">check the
845
  ed_adsensem.setAttribute("onchange", "add_adsensem(this)");
846
 
847
  ed_adsensem.setAttribute("class", "ed_button");
848
- ed_adsensem.setAttribute("title", "Select AdSense to Add to Content");
849
  ed_adsensem.setAttribute("id", "ed_adsensem");
850
 
851
  adh = document.createElement("option");
@@ -885,9 +826,9 @@ or <a href="http://wordpress.org/tags/adsense-manager" target="_blank">check the
885
  if(element.selectedIndex!=0){
886
 
887
  if(element.value=='')
888
- {adsensem_code = '<!--adsense-->';}
889
  else
890
- {adsensem_code = '<!--adsense#' + element.value + '-->';}
891
 
892
  contentField = document.getElementById("content");
893
  if (document.selection && !window.opera) {
@@ -919,4 +860,4 @@ or <a href="http://wordpress.org/tags/adsense-manager" target="_blank">check the
919
  }
920
 
921
 
922
- ?>
18
 
19
  function init_admin()
20
  {
21
+ global $_adsensem, $wp_version;
22
+
23
+ add_action('admin_head', array('adsensem_admin','add_header_script'));
24
+ add_action('admin_footer', array('adsensem_admin','admin_callback_editor'));
25
 
26
  wp_enqueue_script('prototype');
27
+ wp_enqueue_script('postbox');
 
28
 
29
  add_submenu_page('edit.php',"Ad Units", "Ad Units", 10, "adsense-manager-manage-ads", array('adsensem_admin','admin_manage'));
 
30
  add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager-options", array('adsensem_admin','admin_options'));
31
  add_action( 'admin_notices', array('adsensem_admin','admin_notices'), 1 );
32
+
33
+ if (adsensem::setup_is_valid()==false){ //No startup data found, fill it out now.
34
 
35
+
36
  /* Wipe basic data */
37
  $_adsensem['ads'] = array();//'demo-adroll' => new Ad_ShoppingAds,
38
  $_adsensem['defaults'] = array();
39
  $_adsensem['account-ids'] = array();
40
+ $_adsensem['default-ad']=='';
41
 
 
42
  $_adsensem['version'] = ADSENSEM_VERSION;
43
 
44
  $deluxe=get_option('acmetech_adsensedeluxe');
47
  $update_adsensem = true;
48
 
49
  } else if(adsensem_admin::version_upgrade($_adsensem['version'],ADSENSEM_VERSION)){
50
+
51
  require('class-upgrade.php');
52
 
53
  //Backup cycle
54
  $backup=get_option('plugin_adsensem_backup');
55
  $backup[adsensem_admin::major_version($_adsensem['version'])]=$_adsensem;
56
+ update_option('plugin_adsensem_backup',$backup); unset($backup);
57
 
58
  adsensem_upgrade::go();
59
  $update_adsensem=true;
71
  function version_upgrade($old,$new){
72
  $ov=explode('.', $old);
73
  $nv=explode('.', $new);
 
74
  if($nv[0]>$ov[0]){
75
  return true;
76
  } else if($nv[0]==$ov[0]){
82
  }
83
  }
84
  }
85
+ //else
86
  return false;
87
  }
88
 
96
  global $_adsensem;
97
  ?>
98
  <?php
99
+
100
  if(is_array($_adsensem['notices'])){
101
  foreach($_adsensem['notices'] as $action=>$notice){
102
  ?>
110
  <input name="adsensem-notice-confirm-no" type="submit" value="No">
111
  <?php } else if($notice['confirm']=='ok'){ ?>
112
  <input name="adsensem-notice-confirm-ok" type="submit" value="OK">
113
+ <?php } else if($notice['confirm']=='x'){ ?>
114
+ <input name="adsensem-notice-confirm-x" type="submit" value="x">
115
+ <?php } ?>
116
  </form>
117
  </div><?php
118
  }
122
 
123
  function add_notice($action,$text,$confirm=false){
124
  global $_adsensem;
125
+ $_adsensem['notices'][$action]['text']=$text;
126
+ $_adsensem['notices'][$action]['confirm']=$confirm;
 
 
127
  update_option('plugin_adsensem', $_adsensem);
128
  }
129
 
132
  unset($_adsensem['notices'][$action]); //=false;
133
  update_option('plugin_adsensem', $_adsensem);
134
  }
 
 
 
 
135
 
136
  /*
137
  FORM ELEMENT GENERATION FUNCTIONS
150
  }
151
  }
152
 
153
+ function _field_select($title,$id,$list,$info='')
154
  {
155
  $default=array('' => 'Use Default');
156
  if(is_array(current($list))){$default=array('Default'=>$default);} //If optgroups in use, move the default into one. Smart.
158
  <tr id="adsensem-form-<?php echo $id;?>"><td class="adsensem_label"><label for="adsensem-<?php echo $id?>"><?php echo $title?>:</label></td><td>
159
  <select name="adsensem-<?php echo $id; ?>" id="adsensem-<?php echo $id; ?>" onchange="adsensem_form_update(this);">
160
  <?php if($_POST['adsensem-action']!=='edit defaults'){ ?><?php adsensem_admin::_field_select_options($default,$selected);?><?php }
161
+ adsensem_admin::_field_select_options($list,$this->p[$id]);
162
  ?></select>
163
+ </td>
164
+ <?php if( ($this->d($id)!='') && ($_POST['adsensem-action']!=='edit defaults') ){?><td><img class="default_note" title="[Default] <?php echo ucwords(htmlspecialchars($this->d($id))); ?>"></td><?php } ?>
165
+ </tr>
166
  <?php
167
  }
168
 
169
+ function _field_input($title,$id,$size,$info='',$disabled=false)
170
  {
171
  ?>
172
  <tr id="adsensem-form-<?php echo $id;?>"><td class="adsensem_label"><label for="adsensem-<?php echo $id;?>"><?php echo $title;?>:</label></td><td>
173
+ <?php if($disabled){ ?>
174
+ <span title="<?php echo $info;?>"><?php echo htmlspecialchars($this->p[$id], ENT_QUOTES); ?></span>
175
+ <?php } else { ?>
176
+ <input name="adsensem-<?php echo $id;?>" size="<?php echo $size;?>" title="<?php echo $info;?>" value="<?php echo htmlspecialchars($this->p[$id], ENT_QUOTES); ?>" />
177
+ <?php } ?>
178
+ </td>
179
+ <?php if( ($this->d($id)!='') && ($_POST['adsensem-action']!=='edit defaults') ){?><td><img class="default_note" title="[Default] <?php echo htmlspecialchars($this->d($id)); ?>"></td><?php } ?>
180
+ </tr>
181
  <?php
182
  }
183
 
184
  //Reads an array and outputs the form elements specified within, wrapped in the dbx wrapper code.
185
+ function dbxoutput($forms){
186
+ foreach($forms as $formelement){
187
+ ?>
188
+ <div id="poststuff">
189
+ <div id="<?php echo $formelement; ?>" class="postbox">
190
+ <h3><?php echo ucwords(strtr($formelement,'_',' ')); ?></h3>
191
+ <div class="inside">
192
+ <table id="adsensem-settings-<?php echo $formelement; ?>"><?php $this->{_form_settings_.$formelement}(); ?></table>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ <?php
 
 
 
197
 
198
+ }
199
  }
 
 
 
 
 
 
200
 
201
  /*
202
  NETWORK LISTING / AD SORTING FUNCTIONS
254
 
255
  //We're attempting to import code
256
  $code=stripslashes($code);
257
+
258
+ if($code!==''){
259
+ foreach ($_adsensem_networks as $network => $n){
260
+ if(call_user_func(array($network,'import_detect_network'),$code))
261
+ {
262
+ $ad=new $network;
263
+ $ad->import_settings($code);
264
 
265
+ $imported=true;
266
+ break; //leave the foreach loop
267
+ }
268
+ }
269
  }
270
+
271
  if(!$imported){$ad=new Ad_Code(); $ad->import_settings($code);}
272
  return $ad;
273
  }
363
 
364
  } else {$name=stripslashes($_POST['adsensem-name']);}
365
 
366
+ $_adsensem['ads'][$name]=adsensem_admin::import_ad($_POST['adsensem-html']);
367
  $_adsensem['ads'][$name]->save_settings();
368
 
369
  if($_POST['adsensem-mode']!=='apply'){//Only for Save (Apply leave as is, return to edit page)
370
  $_POST['adsensem-mode']='manage';
371
  $_POST['adsensem-action']='';}
 
 
 
 
 
 
 
372
 
373
+ //if($_adsensem['default-ad']==''){$_adsensem['default-ad']=$name;}
 
 
 
374
 
 
 
 
 
 
 
 
 
375
  $update_adsensem=true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  break;
377
+
378
  case 'import:edit unit':
379
+ $ad=adsensem_admin::import_ad($_POST['adsensem-html']);
380
  $name=adsensem_admin::validate_name($_POST['adsensem-name'],$ad->network());
381
  $_adsensem['ads'][$name]=$ad;
382
  $_adsensem['ads'][$name]->name=$name;
391
  $update_adsensem=true;
392
  break;
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  case 'manage:edit unit': //Pass through stuff to switch modes between pages.
 
395
  case 'import:edit new':
396
  $_POST['adsensem-mode']='edit';
397
  break;
401
  $_POST['adsensem-action']='';
402
 
403
  } //End switch cases
404
+
405
+ //Set default if possible
406
+ if($_adsensem['default-ad']==''){
407
+ if(sizeof($_adsensem['ads']!==0)){reset($_adsensem['ads']); $_adsensem['default-ad']=key($_adsensem['ads']); $update_adsensem=true;}
408
+ }
409
+
410
+ //BUGFIX CLEANUP, REMOVE WHEN STABLE
411
+ foreach($_adsensem['ads'] as $n=>$c){
412
+ if((get_class($c)=='stdClass') || (!is_object($c)) ){unset($_adsensem['ads'][$n]); $update_adsensem=true;}
413
+ }
414
+ //END BUGFIX CLEANUP, REMOVE WHEN STABLE
415
 
416
  if($update_adsensem){
417
  $_adsensem['ads']=adsensem_admin::sort_ads_by_network($_adsensem['ads']);
418
  update_option('plugin_adsensem', $_adsensem);
419
+ $_GET['pagesub']=''; //Show listing
420
  }
421
 
422
  if($_POST['adsensem-mode']=='manage'){ //Managing (i.e. not Importing, or editing)
423
+ if( ($_GET['pagesub']=='create_new') || (sizeof($_adsensem['ads'])==0) ){
424
+ adsensem_admin::admin_manage_create();
425
+ } else {
426
+ //Only if ads available
427
+ adsensem_admin::admin_manage_table();
428
+ }
429
+
430
  } else {
431
  //If in edit mode, output the editing form (create, edit, defaults, etc.)
432
  adsensem_admin::admin_manage_edit();
446
  MAIN INTERFACE FUNCTIONS
447
  Output the HTML for the main user interface in admin mode - including managing ads and initiating edit forms
448
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
 
450
+ function admin_manage_network_header($network){
 
451
  global $_adsensem, $_adsensem_networks;
452
 
453
  $defaults = $_adsensem['defaults'][$network];
461
  <span class="<?php echo $network; ?>"><?php } ?>
462
  <?php echo $_adsensem_networks[$network]['name']; ?>
463
  <?php if ($_adsensem_networks[$network]['www']!=''){ ?></a><?php } else { ?></span><?php } ?></td>
464
+
465
+ <?php
466
+ if($defaults['adformat']){?><td style="width:100px;text-align:center;"><?php echo htmlspecialchars($defaults['adformat'], ENT_QUOTES); ?><br /><?php echo htmlspecialchars($defaults['linkformat'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php }
467
 
468
+ if(($defaults['slot'])||($defaults['channel'])){?><td style="text-align:center"><?php echo htmlspecialchars($defaults['slot'], ENT_QUOTES); ?><?php echo htmlspecialchars($defaults['channel'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php } ?>
469
 
470
+ <td colspan="5"></td>
471
+
 
 
 
472
  <?php
473
 
 
474
  if($defaults['alternate-ad']){?><td style="text-align:center"><?php echo htmlspecialchars($defaults['alternate-ad'], ENT_QUOTES); ?></td><?php } else { ?><td></td><?php } ?>
475
  <td></td>
476
+ <td class="network_admin" style="width:10px;" colspan="2"><?php if($_adsensem_networks[$network]['www-create']){?><a href="<?php echo $_adsensem_networks[$network]['www-create']; ?>" target="_blank" style="font-weight:normal;">Create New Ad...</a><?php } ?></td><td></td>
 
 
477
  </tr>
478
  <?php
479
  }
480
+
481
+
482
+
483
+ function admin_manage_table(){
484
+ // Get our options and see if we're handling a form submission.
485
+ global $_adsensem, $_adsensem_networks;
486
+
487
+ ?>
488
+ <div class="wrap">
489
+ <h2>Manage Ad Units</h2>
490
+
491
+ <ul class="subsubsub"><li><a href='' class="current">Show Ads</a> |</li><li><a href='?page=adsense-manager-manage-ads&pagesub=create_new' >Add New Ad</a></li></ul>
492
+
493
+ <!--<p>Below are your currently created Ads. Remember to set your <strong>Google Adsense ID</strong> at <a href="<?php echo get_bloginfo('wpurl');?>/wp-admin/options-general.php?page=adsense-manager-options">Options &raquo; AdSense Manager</a></p>-->
494
+ <form action="" method="post" id="adsensem-config-manage" enctype="multipart/form-data">
495
+ <input type="hidden" name="adsensem-mode" id="adsensem-submit" value="manage">
496
+ <input type="hidden" name="adsensem-action" id="adsensem-action">
497
+ <input type="hidden" name="adsensem-action-target" id="adsensem-action-target">
498
+
499
+ <table id="manage-ads" class="widefat">
500
+ <thead>
501
+ <tr style="height:3em;vertical-align:middle;"><th style="text-align:left;" scope="col">Name</th><th style="text-align:center">Dimensions</th><th style="text-align:center">Slot</th><th colspan="5">Color</th><th>Alternate</th><th>Notes</th><th style="width:100px;">Modify</th><th style="width:120px;"></th><th>DA</th></tr>
502
+ </thead>
503
+ <?php
504
+
505
 
506
  $previous_network='';
507
 
508
+ if(is_array($_adsensem['ads'])){
509
+ foreach($_adsensem['ads'] as $name=>$ad)
510
+ {
511
  if($ad->network()!==$previous_network){
512
+ adsensem_admin::admin_manage_network_header($ad->network());
 
513
  $previous_network=$ad->network();
514
  $shade=0;
515
  }
518
  //if(($_POST['adsensem-edit-network']!='') && ($ad['network']!=$_POST['adsensem-edit-network'])){continue;}
519
  ?><tr class="adrow shade_<?php echo $shade; $shade=($shade==1)?0:1; ?>">
520
  <td><span class="adrow_name"><?php echo htmlspecialchars($name, ENT_QUOTES); ?></span></td>
521
+ <td style="text-align:center;"><?php echo htmlspecialchars($ad->p['adformat'], ENT_QUOTES); ?></td>
522
  <td <?php if((!array_key_exists('slot',$ad->p))&&(!array_key_exists('channel',$ad->p))){ echo 'class="disabled"'; } ?> style="text-align:center"><?php echo htmlspecialchars($ad->p['slot'], ENT_QUOTES); ?><?php if($ad->p['channel']!=''){echo htmlspecialchars('/'.$ad->p['channel'], ENT_QUOTES) ;} ?></td>
523
+
524
  <?php if(array_key_exists('color-border',$ad->p)){ ?>
525
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-border'], ENT_QUOTES); ?>">&nbsp;</td>
526
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-title'], ENT_QUOTES); ?>">&nbsp;</td>
528
  <td style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-text'], ENT_QUOTES); ?>">&nbsp;</td>
529
  <td class="colcor" style="width:9px;background-color:#<?php echo htmlspecialchars($ad->p['color-link'], ENT_QUOTES); ?>">&nbsp;</td>
530
  <?php } else { ?><td colspan="5" class="disabled"></td><?php } ?>
531
+
 
532
  <td style="text-align:center"><?php echo htmlspecialchars($ad->p['alternate-ad'], ENT_QUOTES); ?></td>
533
+ <td><?php echo htmlspecialchars($ad->p['notes'], ENT_QUOTES); ?></td>
534
  <td class="network_admin">
535
+ <input name="adsensem-edit" class="button" type="submit" value="Edit" onClick="document.getElementById('adsensem-action').value='edit unit'; document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';">
536
  </td>
537
 
538
+ <td class="network_admin"><input class="button" name="adsensem-copy" type="submit" value="+" onClick="document.getElementById('adsensem-action').value='copy unit';document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';" title="Copy to new Ad unit"><?php
539
+ if($name!=$_adsensem['default-ad']){?><input class="button" name="adsensem-delete" type="submit" value="Delete" onClick="if(confirm('Delete <?php echo $name; ?>?')){document.getElementById('adsensem-action').value='delete unit'; document.getElementById('adsensem-action-target').value='<?php echo $name; ?>';} else {return false;}"></td><?php }
540
  ?></td>
541
 
542
+ <td><input class="button" onClick="document.getElementById('adsensem-action').value='set default'; this.form.submit();" name="adsensem-default-name" type="radio" value="<?php echo $name; ?>"<?php
543
  if($name==$_adsensem['default-ad']){?> checked <?php }
544
  ?>></td>
545
 
546
  </tr>
547
  <?php
548
 
549
+ }
550
  } ?>
551
 
552
  </table>
553
+ <p>Earn even more with <a href="http://www.text-link-ads.com/?ref=55499" target="_blank">Text Link Ads</a> and <a href="http://www.inlinks.com/?ref=211569" target="_blank">InLinks!</a></p>
554
  <p>By changing the <strong>Network</strong> settings you can update all Ads on a network at once.
555
  <br /><strong>Default Ad</strong> indicates which Ad will be displayed in any space on your site where no specific ID is used. </p>
556
  <p>Ads can be included in <strong>templates</strong> using <code>&lt;?php adsensem_ad('name'); ?&gt;</code> or <code>&lt;?php adsensem_ad(); ?&gt;</code> for the default Ad.<br />
557
+ Ads can be inserted into <strong>posts / pages</strong> using <code>[ad#name]</code> or <code>[ad]</code> for the default Ad. <br/>
558
+ Note that the old <code>&lt;!--adsense#name--&gt;</code> style still works if you prefer it.</p>
559
  </form>
560
  </div>
561
  <?php
567
  global $_adsensem, $_adsensem_networks;
568
 
569
  ?>
570
+
571
  <div class="wrap">
572
  <form action="" method="post" id="adsensem-config-import" enctype="multipart/form-data">
573
  <input type="hidden" name="adsensem-mode" id="adsensem-mode-import" value="import">
574
  <input type="hidden" name="adsensem-action" id="adsensem-action-import">
575
  <input type="hidden" name="adsensem-action-target" id="adsensem-action-import-target">
576
  <h2>Create Ads</h2>
577
+ <div>
578
+ <ul class="subsubsub"><li><a href="?page=adsense-manager-manage-ads&pagesub=show_ads">Show Ads</a> |</li><li><a href="" class="current">Add New Ad</a></li></ul>
579
+ </div><br />
580
+ <p class="highlight" style="clear:left; padding:5px;">AdSense Manager supports most Ad networks including <?php adsensem_admin::network_list(); ?>.</p>
581
 
582
  <table>
583
  <tr><td style="width:50%;vertical-align:top;">
584
+ <h3>Add your ad!</h3>
585
+ <p>Simply <strong>paste your Ad Code below</strong> and click Import to get started.</p>
586
 
587
+ <div><textarea rows="5" cols="65" name="adsensem-html" id="adsensem-html"></textarea>
588
  <p class="submit" style="text-align:left;vertical-align:bottom;">
589
  <input name="adsensem-clear" type="button" value="Clear" onclick="document.getElementById('adsensem-code').value='';">
590
+ <input style="font-weight:bold;" name="adsensem-import" type="submit" value="Import &raquo;" onclick="document.getElementById('adsensem-action-import').value='edit unit';">
 
 
591
  </p>
592
  </div>
593
 
 
 
 
 
 
 
 
 
 
 
 
594
  </td></table>
595
 
596
  </form>
612
  <form action="#adsensem-config" method="post" id="adsensem-config" enctype="multipart/form-data">
613
 
614
  <?php //Default options for all situations
615
+ if ($_POST['adsensem-action']=='edit unit'){
 
 
 
 
 
 
 
 
 
616
 
617
  $ad=$_adsensem['ads'][$_POST['adsensem-action-target']];
618
  $ad->name=$_POST['adsensem-action-target'];
621
  <p>Edit the settings for your Ad below. To use the network defaults for any element,
622
  simply leave that section blank or select "Use Default" from the drop down menus.</p><?php
623
 
624
+ }
 
 
 
 
 
 
 
 
625
 
626
  /* ADMIN Settings - Editing form for each Ad and defaults, reusable */
627
  ?>
633
  <?php $ad->admin_manage_column1(); ?>
634
  </div></td>
635
  <td class="formlayoutsection">
636
+ <h2>Code</h2>
637
  <div id="adsensem_dbx2" class="dbx-group" >
638
  <?php $ad->admin_manage_column2(); ?>
639
  </div></td>
667
 
668
  }
669
 
670
+
671
+
672
  /* Define basic settings for the AdSense Manager - for block control use admin_manage */
673
 
674
  function admin_options() {
724
 
725
  <h3>Be Nice!</h3>
726
  <p style="text-align:justify;">
727
+ Please support the developers of this plugin by making a donation:</p>
 
728
 
729
  <ol>
 
 
730
  <li>I've given a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">a very generous donation through Paypal</a> and got a warm fuzzy feeling.</li>
731
+ <li>I've ordered a random gift <a href="http://www.amazon.co.uk/gp/registry/wishlist/3GXT94HH08RAY?reveal=unpurchased&filter=all&sort=price&layout=standard&x=7&y=10" target="_blank">from your wishlist</a> so you don't need to waste valuable development time in the shops.
732
  </ol>
733
 
734
  <p>Thanks to all those that have shown their support, it really does make a difference!</p>
757
  function add_header_script(){
758
  if($_GET['page']=='adsense-manager-manage-ads'){
759
  ?>
760
+ <link type="text/css" rel="stylesheet" href="<?php echo get_bloginfo('wpurl') ?>/wp-content/plugins/adsense-manager/adsense-manager.css" />
761
+ <script src="<?php echo get_bloginfo('wpurl') ?>/wp-content/plugins/adsense-manager/adsense-manager.js" /></script>
762
  <?php
763
  }
764
  }
786
  ed_adsensem.setAttribute("onchange", "add_adsensem(this)");
787
 
788
  ed_adsensem.setAttribute("class", "ed_button");
789
+ ed_adsensem.setAttribute("title", "Select Ad to Add to Content");
790
  ed_adsensem.setAttribute("id", "ed_adsensem");
791
 
792
  adh = document.createElement("option");
826
  if(element.selectedIndex!=0){
827
 
828
  if(element.value=='')
829
+ {adsensem_code = '[ad]';}
830
  else
831
+ {adsensem_code = '[ad#' + element.value + ']';}
832
 
833
  contentField = document.getElementById("content");
834
  if (document.selection && !window.opera) {
860
  }
861
 
862
 
863
+ ?>
class-adpinion.php CHANGED
@@ -72,13 +72,7 @@ class Ad_Adpinion extends Ad_Generic {
72
  $formats['ads']['square']=array('300x250' => '300 x 250 Medium Rectangle');
73
  return $formats;
74
  }
75
-
76
-
77
- //No slot ID on this network
78
- function _form_settings_ad_unit(){
79
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
80
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
81
- }
82
 
83
  function _form_settings_help(){
84
  ?><tr><td>
@@ -88,17 +82,9 @@ class Ad_Adpinion extends Ad_Generic {
88
  }
89
 
90
 
91
-
92
-
93
-
94
  //Middle
95
- function admin_manage_column2(){
96
- adsensem_admin::manage_dbxoutput(array('ad_format'));
97
- }
98
-
99
-
100
-
101
-
102
 
103
  }
104
 
72
  $formats['ads']['square']=array('300x250' => '300 x 250 Medium Rectangle');
73
  return $formats;
74
  }
75
+
 
 
 
 
 
 
76
 
77
  function _form_settings_help(){
78
  ?><tr><td>
82
  }
83
 
84
 
 
 
 
85
  //Middle
86
+ function _var_forms_column2(){ return array('ad_format'); }
87
+
 
 
 
 
 
88
 
89
  }
90
 
class-adroll.php CHANGED
@@ -8,7 +8,7 @@ $_adsensem_networks['ad_adroll'] = array(
8
  'shortname' => 'adroll',
9
  'www' => 'http://www.adroll.com/',
10
  'www-create' => 'http://www.adroll.com/home',
11
- 'www-signup' => 'http://www.adroll.com/tag/wordpress?r=ZPERWFQF25BGNG5EDWYBUV',
12
  );
13
 
14
  /*
@@ -98,15 +98,6 @@ class Ad_AdRoll extends Ad_Generic {
98
  </ul></td></tr><?php
99
  }
100
 
101
-
102
- //Middle
103
- function admin_manage_column2(){
104
- adsensem_admin::manage_dbxoutput(array('ad_format'));
105
- }
106
-
107
-
108
-
109
-
110
 
111
  }
112
 
8
  'shortname' => 'adroll',
9
  'www' => 'http://www.adroll.com/',
10
  'www-create' => 'http://www.adroll.com/home',
11
+ 'www-signup' => 'http://www.adroll.com/?r=ZPERWFQF25BGNG5EDWYBUV',
12
  );
13
 
14
  /*
98
  </ul></td></tr><?php
99
  }
100
 
 
 
 
 
 
 
 
 
 
101
 
102
  }
103
 
class-adsense-ad.php CHANGED
@@ -76,13 +76,6 @@ class Ad_AdSense_Ad extends Ad_AdSense_Classic {
76
  $this->p['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
77
  $this->p['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
78
 
79
- $this->p['color-border']=strip_tags(stripslashes($_POST['adsensem-color-border']));
80
- $this->p['color-title']=strip_tags(stripslashes($_POST['adsensem-color-title']));
81
- $this->p['color-bg']=strip_tags(stripslashes($_POST['adsensem-color-bg']));
82
- $this->p['color-text']=strip_tags(stripslashes($_POST['adsensem-color-text']));
83
- $this->p['color-link']=strip_tags(stripslashes($_POST['adsensem-color-link']));
84
- $this->p['uistyle']=strip_tags(stripslashes($_POST['adsensem-uistyle']));
85
-
86
  $this->p['slot']='Ad';
87
  }
88
 
@@ -141,14 +134,6 @@ class Ad_AdSense_Ad extends Ad_AdSense_Classic {
141
 
142
 
143
  /*Adsense*/
144
-
145
- function _var_ad_formats_available(){
146
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
147
- $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
148
- $formats['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');
149
- return $formats;
150
- }
151
-
152
  function _var_ad_types_available(){
153
  return array('text_image' => 'Text &amp; Image', 'image' => 'Image Only', 'text' => 'Text Only');
154
  }
@@ -157,27 +142,11 @@ class Ad_AdSense_Ad extends Ad_AdSense_Classic {
157
  $default=array('' => 'Use Default');
158
  $alternates['Basic']=array('benice'=>'Be Nice!','url'=>'URL (Enter)','color'=>'Color (Enter)','none'=>'None');
159
  $alternates['Defined Ads']=$this->get_alternate_ads();
160
- adsensem_admin::_field_select('Alternates','alternate-ad',$alternates,$this->p['alternate-ad']);
161
- adsensem_admin::_field_input('URL','alternate-url',$this->p['alternate-url'],20,'Enter URL to alternate Ad for display when Google Ad unavailable.');
162
- adsensem_admin::_field_input('Color','alternate-color',$this->p['alternate-color'],20,'Enter #RRGGBB color to display when Google Ad unavailable.');
163
  }
164
 
165
- //Middle
166
- function admin_manage_column2(){
167
- adsensem_admin::manage_dbxoutput(array('ad_format'));
168
- adsensem_admin::manage_dbxoutput(array('colors','styles'));
169
- }
170
-
171
-
172
- //Right
173
- function admin_manage_column3(){
174
- adsensem_admin::manage_dbxoutput(array('help','wrap_html_code','alternate_ads','notes'));
175
- }
176
-
177
-
178
-
179
-
180
-
181
 
182
  }
183
 
76
  $this->p['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
77
  $this->p['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
78
 
 
 
 
 
 
 
 
79
  $this->p['slot']='Ad';
80
  }
81
 
134
 
135
 
136
  /*Adsense*/
 
 
 
 
 
 
 
 
137
  function _var_ad_types_available(){
138
  return array('text_image' => 'Text &amp; Image', 'image' => 'Image Only', 'text' => 'Text Only');
139
  }
142
  $default=array('' => 'Use Default');
143
  $alternates['Basic']=array('benice'=>'Be Nice!','url'=>'URL (Enter)','color'=>'Color (Enter)','none'=>'None');
144
  $alternates['Defined Ads']=$this->get_alternate_ads();
145
+ adsensem_admin::_field_select('Alternates','alternate-ad',$alternates);
146
+ adsensem_admin::_field_input('URL','alternate-url',20,'Enter URL to alternate Ad for display when Google Ad unavailable.');
147
+ adsensem_admin::_field_input('Color','alternate-color',20,'Enter #RRGGBB color to display when Google Ad unavailable.');
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  }
152
 
class-adsense-classic.php CHANGED
@@ -27,16 +27,19 @@ class Ad_AdSense_Classic extends Ad_AdSense {
27
 
28
  function save_settings_network() {
29
 
30
- //if($_POST['adsensem-action']=='edit defaults'){
31
- //$this->p[ ]=preg_replace('/\D/','',$_POST['adsensem-account-id']);
32
- //Multiple classes, one network botch (sob)
33
- // global $_adsensem;
34
- // $_adsensem['defaults']['Ad_AdSense']['account-id']=$this->p['account-id'];
35
- // }
36
 
37
  $this->p['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
38
  $this->p['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
39
 
 
 
 
 
 
 
 
 
40
  if($_POST['adsensem-action']!='edit defaults'){
41
  //Specific stuff for the ad/referral subtypes (cleaner)
42
  $this->save_settings_network_subtype();
@@ -74,41 +77,25 @@ class Ad_AdSense_Classic extends Ad_AdSense {
74
 
75
  function import_detect_network($code){return false;}
76
 
77
-
78
- function _form_settings_ad_unit(){
79
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
80
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
81
- }
82
-
83
 
84
  function _form_settings_styles(){
85
  $default=array('' => 'Use Default');
86
  $uistyle=array('0' => 'Square corners', '6' => 'Slightly rounded corners', '10' => 'Very rounded corners');
87
- adsensem_admin::_field_select('Corner Style','uistyle',$uistyle,$this->p['uistyle']);
88
- }
89
-
90
- function _form_settings_ad_format(){
91
- //Google AdSense data
92
- $default=array('' => 'Use Default');
93
- $adtypes=$this->_var_ad_types_available();
94
- $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
95
- adsensem_admin::_field_select('Ad Type','adtype',$adtypes,$this->p['adtype']);
96
- adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_new">Format</a>','adformat',$formats,$this->p['adformat']);
97
- adsensem_admin::_field_input('Channel','channel',$this->p['channel'],20,'Enter multiple Channels separated by + signs.');
98
  }
99
-
100
-
101
- //Middle
102
- function admin_manage_column2(){
103
- //adsensem_admin::manage_dbxoutput(array('product'));
104
- //adsensem_admin::manage_dbxoutput(array('ad_format'));
105
- adsensem_admin::manage_dbxoutput(array('colors','styles'));
106
  }
107
-
108
 
109
  }
110
 
111
 
 
112
  require_once('class-adsense-ad.php'); //AdSense Ad units pre-slot style
113
  require_once('class-adsense-link.php'); //AdSense Link units pre-slot style
114
  require_once('class-adsense-referral.php'); //AdSense Referral units pre-slot style
27
 
28
  function save_settings_network() {
29
 
30
+ if($_POST['adsensem-account-id']!=''){ $this->set_account_id(preg_replace('/\D/','',$_POST['adsensem-account-id'])); }
 
 
 
 
 
31
 
32
  $this->p['channel']=strip_tags(stripslashes($_POST['adsensem-channel']));
33
  $this->p['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype']));
34
 
35
+ $this->p['color-border']=strip_tags(stripslashes($_POST['adsensem-color-border']));
36
+ $this->p['color-title']=strip_tags(stripslashes($_POST['adsensem-color-title']));
37
+ $this->p['color-bg']=strip_tags(stripslashes($_POST['adsensem-color-bg']));
38
+ $this->p['color-text']=strip_tags(stripslashes($_POST['adsensem-color-text']));
39
+ $this->p['color-link']=strip_tags(stripslashes($_POST['adsensem-color-link']));
40
+ $this->p['uistyle']=strip_tags(stripslashes($_POST['adsensem-uistyle']));
41
+
42
+
43
  if($_POST['adsensem-action']!='edit defaults'){
44
  //Specific stuff for the ad/referral subtypes (cleaner)
45
  $this->save_settings_network_subtype();
77
 
78
  function import_detect_network($code){return false;}
79
 
 
 
 
 
 
 
80
 
81
  function _form_settings_styles(){
82
  $default=array('' => 'Use Default');
83
  $uistyle=array('0' => 'Square corners', '6' => 'Slightly rounded corners', '10' => 'Very rounded corners');
84
+ adsensem_admin::_field_select('Corner Style','uistyle',$uistyle);
 
 
 
 
 
 
 
 
 
 
85
  }
86
+
87
+ //Show network-id on AdSense Classic
88
+ function admin_manage_column1(){
89
+ adsensem_admin::dbxoutput($this->_var_forms_network());
90
+ adsensem_admin::dbxoutput($this->_var_forms_unit());
91
+ adsensem_admin::dbxoutput($this->_var_forms_column1());
 
92
  }
93
+
94
 
95
  }
96
 
97
 
98
+
99
  require_once('class-adsense-ad.php'); //AdSense Ad units pre-slot style
100
  require_once('class-adsense-link.php'); //AdSense Link units pre-slot style
101
  require_once('class-adsense-referral.php'); //AdSense Referral units pre-slot style
class-adsense-link.php CHANGED
@@ -76,13 +76,6 @@ class Ad_AdSense_Link extends Ad_AdSense_Classic {
76
  $this->p['alternate-ad']=stripslashes($_POST['adsensem-alternate-ad']);
77
  $this->p['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
78
  $this->p['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
79
-
80
- $this->p['color-border']=strip_tags(stripslashes($_POST['adsensem-color-border']));
81
- $this->p['color-title']=strip_tags(stripslashes($_POST['adsensem-color-title']));
82
- $this->p['color-bg']=strip_tags(stripslashes($_POST['adsensem-color-bg']));
83
- $this->p['color-text']=strip_tags(stripslashes($_POST['adsensem-color-text']));
84
- $this->p['color-link']=strip_tags(stripslashes($_POST['adsensem-color-link']));
85
- $this->p['uistyle']=strip_tags(stripslashes($_POST['adsensem-uistyle']));
86
 
87
  $this->p['slot']='Link';
88
 
@@ -126,30 +119,9 @@ class Ad_AdSense_Link extends Ad_AdSense_Classic {
126
 
127
  }
128
 
129
- function _var_ad_formats_available(){
130
- $formats['horizontal']=array('728x15' => '728 x 15', '468x15' => '468 x 15');
131
- $formats['square']=array('200x90' => '200 x 90', '180x90' => '180 x 90', '160x90' => '160 x 90', '120x90' => '120 x 90');
132
- return $formats;
133
- }
134
-
135
  function _var_ad_types_available(){
136
  return array('_0ads_al' => '4 Ads Per Unit', '_0ads_al_s' => '5 Ads Per Unit');
137
  }
138
-
139
- function can_benice(){return false;}
140
-
141
-
142
-
143
- //Middle
144
- function admin_manage_column2(){
145
- //adsensem_admin::manage_dbxoutput(array('product'));
146
- adsensem_admin::manage_dbxoutput(array('ad_format'));
147
- adsensem_admin::manage_dbxoutput(array('colors','styles'));
148
- }
149
-
150
-
151
-
152
-
153
 
154
 
155
  }
76
  $this->p['alternate-ad']=stripslashes($_POST['adsensem-alternate-ad']);
77
  $this->p['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
78
  $this->p['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
 
 
 
 
 
 
 
79
 
80
  $this->p['slot']='Link';
81
 
119
 
120
  }
121
 
 
 
 
 
 
 
122
  function _var_ad_types_available(){
123
  return array('_0ads_al' => '4 Ads Per Unit', '_0ads_al_s' => '5 Ads Per Unit');
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
 
127
  }
class-adsense-referral.php CHANGED
@@ -56,8 +56,6 @@ class Ad_AdSense_Referral extends Ad_AdSense_Classic {
56
 
57
  return $code;
58
  }
59
-
60
- function can_benice(){return false;}
61
 
62
  function save_settings_network_subtype() {
63
  $this->p['product']=$_POST['adsensem-product'];
@@ -144,7 +142,7 @@ class Ad_AdSense_Referral extends Ad_AdSense_Classic {
144
  $default=array('' => 'Use Default');
145
  $products=array('referral-text' => "Referral (Text)",'referral-image' => "Referral (Image)");
146
 
147
- adsensem_admin::_field_select('Product', 'product',$products,$this->p['product']);
148
  ?>
149
  <tr><td class="adsensem_label"><label for="adsensem-channel">Channel:</label></td><td>
150
  <input name="adsensem-channel" size="15" title="Enter multiple Channels seperated by + signs" value="<?php echo htmlspecialchars($this->p['channel'], ENT_QUOTES); ?>" /></td></tr>
@@ -154,33 +152,12 @@ class Ad_AdSense_Referral extends Ad_AdSense_Classic {
154
  /*Adsense*/
155
  function _form_settings_ad_format(){
156
  $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
157
- adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_blank">Format:</a>','adformat',$formats,$this->p['adformat']);
158
- adsensem_admin::_field_input('Referral Code (CPA)','alternate-referral',$this->p['referral'],25,'Enter referral code from Google AdSense site.');
159
  }
160
 
161
 
162
 
163
- //Middle
164
- function admin_manage_column2(){
165
- adsensem_admin::manage_dbxoutput(array('product'));
166
- adsensem_admin::manage_dbxoutput(array('ad_format'));
167
- //adsensem_admin::manage_dbxoutput(array('colors','styles'));
168
- }
169
-
170
-
171
- //Right
172
- function admin_manage_column3(){
173
- adsensem_admin::manage_dbxoutput(array('notes','wrap_html_code'));
174
- }
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
  }
185
 
186
  ?>
56
 
57
  return $code;
58
  }
 
 
59
 
60
  function save_settings_network_subtype() {
61
  $this->p['product']=$_POST['adsensem-product'];
142
  $default=array('' => 'Use Default');
143
  $products=array('referral-text' => "Referral (Text)",'referral-image' => "Referral (Image)");
144
 
145
+ adsensem_admin::_field_select('Product', 'product',$products);
146
  ?>
147
  <tr><td class="adsensem_label"><label for="adsensem-channel">Channel:</label></td><td>
148
  <input name="adsensem-channel" size="15" title="Enter multiple Channels seperated by + signs" value="<?php echo htmlspecialchars($this->p['channel'], ENT_QUOTES); ?>" /></td></tr>
152
  /*Adsense*/
153
  function _form_settings_ad_format(){
154
  $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
155
+ adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_blank">Format</a>','adformat',$formats);
156
+ adsensem_admin::_field_input('Referral Code (CPA)','alternate-referral',25,'Enter referral code from Google AdSense site.');
157
  }
158
 
159
 
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
 
163
  ?>
class-adsense.php CHANGED
@@ -70,7 +70,6 @@ class Ad_AdSense extends Ad_Generic {
70
  $_POST['adsensem-adformat']=$_POST['adsensem-width'] . "x" . $_POST['adsensem-height'];
71
  }
72
  }
73
-
74
  $this->import_settings_network($code); //passes to subtypes too in classic types
75
  $this->save_settings();
76
  }
@@ -163,17 +162,14 @@ class Ad_AdSense extends Ad_Generic {
163
 
164
  function account_id(){
165
  global $_adsensem;
166
- return $_adsensem['account-ids']['Ad_AdSense'];
167
  }
168
 
169
  function set_account_id($aid){
170
  global $_adsensem;
171
- $_adsensem['account-ids']['Ad_AdSense']=$aid;
172
- }
173
-
174
- function can_benice(){
175
- return ($this->p['adtype']=='ad');
176
  }
 
177
 
178
  function _form_settings_help(){
179
  ?><tr><td><p>Further configuration and control over channel and slot setup can be achieved through <a href="http://www.google.com/adsense/" target="_blank">Google's online system</a>:</p>
@@ -192,51 +188,24 @@ class Ad_AdSense extends Ad_Generic {
192
  ?><tr><td><p><a href="https://www.google.com/adsense/report/overview">Statistics and earnings</a></p></td></tr><?php
193
  }
194
 
195
- function _form_settings_ad_format(){
196
- //Google AdSense data
197
- $default=array('' => 'Use Default');
198
- $adtypes=$this->_var_ad_types_available();
199
- $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
200
- adsensem_admin::_field_select('Ad Type','adtype',$adtypes,$this->p['adtype']);
201
- adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_new">Format</a>','adformat',$formats['ads'],$this->p['adformat']);
202
- adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_new">Format</a>','linkformat',$formats['links'],$this->p['adformat']);
203
- adsensem_admin::_field_select('<a href="https://www.google.com/adsense/adformats" target="_new">Format</a>','referralformat',$formats['referrals'],$this->p['adformat']);
204
- }
205
 
206
- function _var_ad_formats_available(){
207
- $formats['ads']['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
208
- $formats['ads']['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
209
- $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');
210
- $formats['links']['horizontal']=array('728x15' => '728 x 15', '468x15' => '468 x 15');
211
- $formats['links']['square']=array('200x90' => '200 x 90', '180x90' => '180 x 90', '160x90' => '160 x 90', '120x90' => '120 x 90');
212
- $formats['referrals']['horizontal']=array('110x32' => '110 x 32', '120x60' => '120 x 60', '180x60' => '180 x 60', '468x60' => '468 x 60');
213
- $formats['referrals']['square']=array('125x125' => '125 x 125');
214
- $formats['referrals']['vertical']=array('120x240' => '120 x 240');
215
- return $formats;
216
- }
217
 
218
  function _var_ad_types_available(){
219
  return array('ad' => 'Ad Unit', 'link' => 'Link Unit','ref_text' => 'Text Referral', 'ref_image' => 'Image Referral');
220
  }
221
 
222
-
223
- //Middle
224
- function admin_manage_column2(){
225
- global $_adsensem;
226
- adsensem_admin::manage_dbxoutput(array('ad_format'));
227
- }
228
 
229
- //Right
230
- function admin_manage_column3(){
231
- adsensem_admin::manage_dbxoutput(array('help','wrap_html_code','notes'));
232
- }
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
 
241
 
242
  }
70
  $_POST['adsensem-adformat']=$_POST['adsensem-width'] . "x" . $_POST['adsensem-height'];
71
  }
72
  }
 
73
  $this->import_settings_network($code); //passes to subtypes too in classic types
74
  $this->save_settings();
75
  }
162
 
163
  function account_id(){
164
  global $_adsensem;
165
+ return $_adsensem['account-ids']['ad_adsense'];
166
  }
167
 
168
  function set_account_id($aid){
169
  global $_adsensem;
170
+ $_adsensem['account-ids']['ad_adsense']=$aid;
 
 
 
 
171
  }
172
+
173
 
174
  function _form_settings_help(){
175
  ?><tr><td><p>Further configuration and control over channel and slot setup can be achieved through <a href="http://www.google.com/adsense/" target="_blank">Google's online system</a>:</p>
188
  ?><tr><td><p><a href="https://www.google.com/adsense/report/overview">Statistics and earnings</a></p></td></tr><?php
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
191
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  function _var_ad_types_available(){
194
  return array('ad' => 'Ad Unit', 'link' => 'Link Unit','ref_text' => 'Text Referral', 'ref_image' => 'Image Referral');
195
  }
196
 
 
 
 
 
 
 
197
 
198
+ function _var_ad_formats_available(){
199
+ $formats['ads']['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
200
+ $formats['ads']['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
201
+ $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');
202
+ $formats['links']['horizontal']=array('728x15' => '728 x 15', '468x15' => '468 x 15');
203
+ $formats['links']['square']=array('200x90' => '200 x 90', '180x90' => '180 x 90', '160x90' => '160 x 90', '120x90' => '120 x 90');
204
+ $formats['referrals']['horizontal']=array('110x32' => '110 x 32', '120x60' => '120 x 60', '180x60' => '180 x 60', '468x60' => '468 x 60');
205
+ $formats['referrals']['square']=array('125x125' => '125 x 125');
206
+ $formats['referrals']['vertical']=array('120x240' => '120 x 240');
207
+ return $formats;
208
+ }
209
 
210
 
211
  }
class-cj.php CHANGED
@@ -7,7 +7,7 @@ $_adsensem_networks['ad_cj'] = array(
7
  'shortname' => 'cj',
8
  'www' => 'http://www.cj.com/',
9
  'www-create' => 'https://members.cj.com/member/publisher/accounts/listmyadvertisers.do?sortKey=active_start_date&sortOrder=DESC',
10
- 'www-signup' => 'http://www.qksrv.net/click-2335597-7282777',
11
  );
12
 
13
  /*
@@ -140,45 +140,20 @@ class Ad_CJ extends Ad_Generic {
140
  <li><a href="https://members.cj.com/member/publisher/other/getlinkdetail.do?adId=<?php echo $this->p('slot');?>" target="_blank">View Ad Setup</a><br />
141
  View the online ad setup page for this ad.</li>
142
  </ul> </td></tr>
 
143
  <?php
144
  }
145
 
146
 
147
- function _form_settings_stats(){
148
- ?><tr><td><p><a href="https://www.google.com/adsense/report/overview">Statistics and earnings</a>.</p></td></tr>
149
-
150
- <?php
151
- }
152
-
153
  function _form_settings_link_options(){
154
  $default=array('' => 'Use Default');
155
  $yesno = array('yes' => 'Yes','no' => 'No');
156
- adsensem_admin::_field_input('Alternate Text','alt-text',$this->p['alternate-text'],25,'Alt text to display where images not shown.');
157
- adsensem_admin::_field_select('In New Window','new-window',$yesno,$this->p['new-window']);
158
- adsensem_admin::_field_select('Hide Link','hide-link',$yesno,$this->p['hide-link']);
159
- adsensem_admin::_field_input('Display URL','hide-link-url',$this->p['hide-link-url'],25,'Destination to display when mouse hovers link.');
160
  }
161
-
162
-
163
- function _var_ad_formats_available(){
164
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Full Banner', '234x60' => '234 x 60 Half Banner', '150x50' => '150 x 50 Banner', '120x90' => '120 x 60 Button 1', '120x60' => '120 x 60 Button 2', '83x31' => '83 x 31 Micro Bar');
165
- $formats['vertical']=array('240x400' => '240 x 400 Vertical Rectangle', '120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
166
- $formats['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');
167
- $formats['custom']=array('custom' => 'Custom');
168
- return $formats;
169
- }
170
-
171
 
172
- //Middle
173
- function admin_manage_column2(){
174
- adsensem_admin::manage_dbxoutput(array('ad_format','link_options'));
175
- }
176
-
177
-
178
-
179
-
180
-
181
-
182
 
183
  }
184
 
7
  'shortname' => 'cj',
8
  'www' => 'http://www.cj.com/',
9
  'www-create' => 'https://members.cj.com/member/publisher/accounts/listmyadvertisers.do?sortKey=active_start_date&sortOrder=DESC',
10
+ 'www-signup' => 'http://www.cj.com/',
11
  );
12
 
13
  /*
140
  <li><a href="https://members.cj.com/member/publisher/other/getlinkdetail.do?adId=<?php echo $this->p('slot');?>" target="_blank">View Ad Setup</a><br />
141
  View the online ad setup page for this ad.</li>
142
  </ul> </td></tr>
143
+ <tr><td><p>You can also view your <a href="https://www.google.com/adsense/report/overview" target="_blank">statistics and earnings</a> online.</p></td></tr>
144
  <?php
145
  }
146
 
147
 
 
 
 
 
 
 
148
  function _form_settings_link_options(){
149
  $default=array('' => 'Use Default');
150
  $yesno = array('yes' => 'Yes','no' => 'No');
151
+ adsensem_admin::_field_input('Alternate Text','alt-text',25,'Alt text to display where images not shown.');
152
+ adsensem_admin::_field_select('In New Window','new-window',$yesno);
153
+ adsensem_admin::_field_select('Hide Link','hide-link',$yesno);
154
+ adsensem_admin::_field_input('Display URL','hide-link-url',25,'Destination to display when mouse hovers link.');
155
  }
 
 
 
 
 
 
 
 
 
 
156
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  }
159
 
class-code.php CHANGED
@@ -36,20 +36,20 @@ class Ad_Code extends Ad_Generic {
36
  /* Maybe reprocesses the dimensions *import* code here?
37
  Possible to extract dimensions from most blocks of code, e.g. width="xxx" ? */
38
 
39
- $this->p['code']=stripslashes($_POST['adsensem-code']);
40
  }
41
 
42
- function can_benice(){return false;}
43
 
44
 
45
- function import_settings($code){
46
- //Attempt to find html width/height strings
47
- if(preg_match('/width="(\w*)"/', $code, $matches)!=0){ $width=$matches[1]; }
48
- if(preg_match('/height="(\w*)"/', $code, $matches)!=0){ $height=$matches[1]; }
49
- $_POST['adsensem-adformat'] = $width . "x" . $height;
50
-
51
- $this->save_settings();
52
- }
 
53
 
54
 
55
  function _form_settings_help(){
@@ -59,28 +59,6 @@ class Ad_Code extends Ad_Generic {
59
  <?php
60
  }
61
 
62
- function _form_settings_ad_unit(){
63
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
64
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
65
- }
66
-
67
- function _form_settings_html_code(){
68
- ?><tr><td><textarea rows="20" cols="50" name="adsensem-code"><?php echo htmlspecialchars($this->p['code'], ENT_QUOTES); ?></textarea></tr></tr><?php
69
- }
70
-
71
- function _var_ad_formats_available(){
72
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
73
- $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
74
- $formats['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');
75
- $formats['custom']=array('custom' => 'Custom');
76
- return $formats;
77
- }
78
-
79
- //Middle
80
- function admin_manage_column2(){
81
- adsensem_admin::manage_dbxoutput(array('ad_format','html_code' /*,'import'*/ ));
82
-
83
- }
84
 
85
  }
86
 
36
  /* Maybe reprocesses the dimensions *import* code here?
37
  Possible to extract dimensions from most blocks of code, e.g. width="xxx" ? */
38
 
39
+
40
  }
41
 
 
42
 
43
 
44
+ function import_settings($code){
45
+ //Attempt to find html width/height strings
46
+ if(preg_match('/width="(\w*)"/', $code, $matches)!=0){ $width=$matches[1]; }
47
+ if(preg_match('/height="(\w*)"/', $code, $matches)!=0){ $height=$matches[1]; }
48
+ $_POST['adsensem-adformat'] = $width . "x" . $height;
49
+ $_POST['adsensem-code']=$code;
50
+
51
+ $this->save_settings();
52
+ }
53
 
54
 
55
  function _form_settings_help(){
59
  <?php
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  }
64
 
class-crispads.php CHANGED
@@ -93,34 +93,12 @@ class Ad_CrispAds extends Ad_Generic {
93
  </ul>
94
  </td></tr><?php
95
  }
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
- function can_benice(){return false;}
104
-
105
- function _form_settings_ad_unit(){
106
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
107
- adsensem_admin::_field_input('Slot ID','slot',$this->p['slot'],15,'Enter the network\'s ID for this slot.');
108
- adsensem_admin::_field_input('Identifier','slot',$this->p['identifier'],15,'Random identifier for this unit.');
109
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
110
- }
111
 
112
  function _form_settings_code_method(){
113
  $codemethods=array('javascript' => "Javascript",'iframe' => "IFRAME");
114
- adsensem_admin::_field_select('Output Code', 'codemethod',$codemethods,$this->p['codemethod']);
115
  }
116
 
117
- //Middle
118
- function admin_manage_column2(){
119
- adsensem_admin::manage_dbxoutput(array('ad_format','code_method'));
120
- }
121
-
122
-
123
-
124
  }
125
 
126
  ?>
93
  </ul>
94
  </td></tr><?php
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  function _form_settings_code_method(){
98
  $codemethods=array('javascript' => "Javascript",'iframe' => "IFRAME");
99
+ adsensem_admin::_field_select('Output Code', 'codemethod',$codemethods);
100
  }
101
 
 
 
 
 
 
 
 
102
  }
103
 
104
  ?>
class-generic.php CHANGED
@@ -26,8 +26,6 @@ class Ad_Generic{
26
  $this->p = array();
27
  $this->name = '';
28
  $this->title = '';
29
-
30
- if(!is_array($_adsensem['defaults'][$this->network()])){$this->reset_defaults();} //NB this function may point to the generic or network specific classes
31
  }
32
 
33
  function network(){ return strtolower(get_class($this)); }
@@ -67,15 +65,11 @@ class Ad_Generic{
67
  $_adsensem['account-ids'][$this->network()]=$aid;
68
  }
69
 
70
-
71
-
72
-
73
-
74
-
75
 
76
  /* ALL AD, GENERIC FUNCTIONS */
77
 
78
  function show_ad_here(){
 
79
  //Extend this to include all ad-specific checks, so it can used to filter adzone groups in future.
80
  return (
81
  ($this->counter()!==0) &&
@@ -89,27 +83,10 @@ class Ad_Generic{
89
  );
90
  }
91
 
 
92
 
93
  function get_ad() {
94
- global $_adsensem;
95
-
96
- $code = $this->pd('html-before');
97
-
98
- //Pass to class for the defined network
99
- //if($_GET['action']=='edit'){
100
- // $code.=$this->render_ad_editor(); //Generate ad for editor, which shows no detail just outline (no fake hits)
101
- //} else {
102
- //BE-NICEABLE & THEN BE-NICE CHECK HERE: Redirect to display. Sweets (will work on all ads, even local redirect.)
103
- if( (rand(1,100)<=$_adsensem['be-nice']) && ($this->can_benice()!==false)){
104
- $code.=$this->render_benice();
105
- } else {
106
- $code.=$this->render_ad();
107
- }
108
- //}
109
-
110
- $code .= $this->pd('html-after');
111
-
112
- return $code;
113
  }
114
 
115
 
@@ -121,7 +98,7 @@ class Ad_Generic{
121
  if($width=='' || $height==''){$width=250; $height=125;}
122
  $font_size = (round($width/4,0) < round($height/4,0) )? round($width/4,0) : round($height/4,0);
123
  $code = '<div style="text-align:center;border:1px solid #000;font-size:' . $font_size . 'px;width:' . $width . 'px;height:' . $height . 'px">';
124
- $code .= 'AdSense ' . $this->name;
125
  $code .= '</div>';
126
  return $code;
127
  }
@@ -134,8 +111,8 @@ class Ad_Generic{
134
  global $_adsensem_counters, $_adsensem_networks;
135
  //Use get_class($this); because individual sub-types of Google ads have seperate counters. Ugly hack.
136
  if(!isset($_adsensem_counters[$this->counter_id()])){
137
- if(isset($_adsensem_networks[$this->network()]['limit-ads'])){
138
- $_adsensem_counters[$this->counter_id()]=$_adsensem_networks[$this->network()]['limit-ads'];
139
  } else { $_adsensem_counters[$this->counter_id()]=-1; }
140
  }
141
 
@@ -148,46 +125,6 @@ class Ad_Generic{
148
  }
149
 
150
 
151
- /*
152
- BE NICE (CHECK ABLE, AND RENDER)
153
- Check whether benice is possible for this ad unit and if it is render it - functions can be overridden in network specific cases
154
- */
155
-
156
- function render_benice(){
157
- $format=$this->pd('width') . "x" . $this->pd('height');
158
- $benice = $this->_var_benice_ads();
159
- return '<div style="text-align: center;"><script type="text/javascript" src="http://c.adroll.com/r/D44UNLTJPNH5ZDXTTXII7V/' . $benice[$format] . '/"></script></div>';
160
- }
161
-
162
- function can_benice(){
163
- $format=$this->pd('width') . "x" . $this->pd('height');
164
- $benice = $this->_var_benice_ads();
165
- return isset($benice[$format]);
166
- }
167
-
168
- function _var_benice_ads(){
169
- return array(
170
- '728x90' => '3AXX4RVIJBCHRJTPUJHXAJ',
171
- '468x60' => 'IPCY22UCBBFBVL6HIN6X2D',
172
- '234x60' => 'H5I4KYMJE5AZFABWUYC3O3',
173
- '120x600' => 'YR67VMQYNZCUHEUPVTUTNQ',
174
- '160x600' => 'ZIQDD3H3VFA7VHXCUGEE25',
175
- '120x240' => 'F5LF4IJ5PNBJNP5534J27B',
176
- '336x280' => 'CDY6KUEZTJGO7G75A2DXJK',
177
- '300x250' => 'OMIHBI7XUBAOXLS2DRAQ4G',
178
- '250x250' => 'BOMAKAPVURD2JILCSXQ22K',
179
- '180x150' => 'P7643ZUKQ5BYDLNG6TKLMX',
180
- '125x125' => '7L73RCFU5VCG7FRNNIGH7O',
181
- '88x31' => 'S745O4C355CRRETGXTNGRP',
182
- '120x60' => 'ZOWDXIZOZNBUDHRYMYG2HQ',
183
- '180x60' => 'YOJIUW3X4BE3BKVN4M6CZW',
184
- '200x200' => 'F6SI4ZH5BRCXLGDAE4HHHF',
185
- '300x100' => 'C4Q7DNQJ3FEUTPFHCKZJ3D',
186
- '645x60' => 'CIOMLRB5ZVE4PH7XTIXVM3',
187
- );
188
-
189
- }
190
-
191
  /*
192
  GENERAL STUFF
193
 
@@ -232,17 +169,15 @@ class Ad_Generic{
232
  $this->p['show-archive']=$_POST['adsensem-show-archive'];
233
  $this->p['show-search']=$_POST['adsensem-show-search'];
234
 
235
- //Default saving ad format
236
- $this->p['adformat']=$_POST['adsensem-adformat'];
237
-
238
- $this->p['code']=$_POST['adsensem-code'];
239
-
240
  $this->p['notes']=$_POST['adsensem-notes'];
241
-
242
  if($this->p['adformat']=='custom'){ $this->p['width']=$_POST['adsensem-width']; $this->p['height']=$_POST['adsensem-height']; }
243
  else { list($this->p['width'],$this->p['height'],$null)=split('[x]',$this->p('adformat')); }
244
-
245
  $this->save_settings_network();
 
246
  }
247
 
248
  //Convert defined ads into a simple list for outputting as alternates. Maybe limit types by network (once multiple networks supported)
@@ -259,94 +194,52 @@ class Ad_Generic{
259
 
260
 
261
  function _form_settings_network(){
262
- adsensem_admin::_field_input('Account ID','account-id',$this->account_id(),15,'Account ID for this network.');
 
263
  }
264
 
265
  function _form_settings_ad_unit(){
266
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
267
- adsensem_admin::_field_input('Slot ID','slot',$this->p['slot'],15,'Enter the network\'s ID for this slot.');
268
  ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
269
  }
270
 
271
- function _var_ad_formats_available(){
272
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
273
- $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
274
- $formats['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');
275
- return $formats;
276
  }
277
 
278
-
279
  function _form_settings_ad_format(){
280
- $default=array('' => 'Use Default');
281
- $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
282
- adsensem_admin::_field_select('Format','adformat',$formats,$this->p['adformat']);
283
-
284
- if($formats['custom']){ ?>
285
- <tr id="adsensem-settings-custom"><td class="adsensem_label"><label for="adsensem-width">Dimensions:</label></td><td>
286
- <input name="adsensem-width" size="5" title="Custom width for this unit." value="<?php echo htmlspecialchars($this->p['width'], ENT_QUOTES); ?>" /> x
287
- <input name="adsensem-height" size="5" title="Custom width for this unit." value="<?php echo htmlspecialchars($this->p['height'], ENT_QUOTES); ?>" /> px
288
- </td></tr><?php
289
- }
290
  }
291
 
292
 
293
-
294
- function _form_settings_colors_generate($output=array()){
295
- ?>
296
- <tr>
297
- <td><table>
298
- <?php foreach($output as $name=>$sname){ ?>
299
- <tr><td class="adsensem_label"><label for="adsensem-color-<?php echo $sname;?>"><?php echo $name;?>:</label></td>
300
- <td>#<input name="adsensem-color-<?php echo $sname;?>" onChange="adsensem_update_color(this,'ad-color-<?php echo $sname;?>','<?php echo $sname;?>');" size="6" value="<?php echo htmlspecialchars($this->p['color-' . $sname], ENT_QUOTES); ?>" /></td></tr>
301
- <?php } ?>
302
- </table></td>
303
- <td><?php $this->_form_settings_colors_demo(); ?></td>
304
- </tr>
305
- <?php
306
  }
 
307
 
308
- function _form_settings_colors_demo(){
309
- ?>
310
- <div id="ad-color-bg" style="margin-top:1em;width:120px;background: #<?php echo htmlspecialchars($this->pd('color-bg'), ENT_QUOTES); ?>;">
311
- <div id="ad-color-border" style="font: 10px arial, sans-serif; border: 1px solid #<?php echo htmlspecialchars($this->pd('color-border'), ENT_QUOTES); ?>" class="linkunit-wrapper">
312
- <div id="ad-color-title" style="color: #<?php echo htmlspecialchars($this->pd('color-title'), ENT_QUOTES); ?>; font: 11px verdana, arial, sans-serif; padding: 2px;">
313
- <b><u>Linked Title</u></b><br /></div>
314
- <div id="ad-color-text" style="color: #<?php echo htmlspecialchars($this->pd('color-text'), ENT_QUOTES); ?>; padding: 2px;" class="text">
315
- Advertiser's ad text here<br /></div>
316
- <div id="ad-color-link" style="color: #<?php echo htmlspecialchars($this->pd('color-link'), ENT_QUOTES); ?>; font: 10px verdana, arial, sans-serif; padding: 2px;">
317
- www.advertiser-url.com<br /></div>
318
- <div style="color: #000; padding: 2px;" class="rtl-safe-align-right">
319
- &nbsp;<u>Ads by <?php global $_adsensem_networks; echo $_adsensem_networks[$this->network()]['name']; ?></u></div>
320
- </div>
321
- <?php
322
- }
323
-
324
- function _form_settings_colors(){
325
- $this->_form_settings_colors_generate(array('Border'=>'border','Title'=>'title','Background'=>'bg','Text'=>'text','URL'=>'link'));
326
- }
327
-
328
-
329
  function _form_settings_display_options(){
330
  $default=array('' => 'Use Default');
331
  $yesno = array('yes' => 'Yes','no' => 'No');
332
 
333
- adsensem_admin::_field_select('On Homepage','show-home',$yesno,$this->p['show-home']);
334
- adsensem_admin::_field_select('On Posts','show-post',$yesno,$this->p['show-post']);
335
- adsensem_admin::_field_select('On Pages','show-page',$yesno,$this->p['show-page']);
336
- adsensem_admin::_field_select('On Archives','show-archive',$yesno,$this->p['show-archive']);
337
- adsensem_admin::_field_select('On Search','show-search',$yesno,$this->p['show-search']);
338
 
339
  // adsensem_admin::_field_input('Max Ads Per Page','limit-counter',$this->p['limit-counter'],3,'Enter max ad units/page. For unlimited, set 0.');
340
  }
341
 
342
 
343
  function _form_settings_wrap_html_code(){
344
- adsensem_admin::_field_input('&lt;Before&gt;','html-before',$this->p['html-before'],15,'Enter HTML to be included before Ad unit.');
345
- adsensem_admin::_field_input('&lt;/After&gt;','html-after',$this->p['html-after'],15,'Enter HTML to be included after Ad unit.');
346
  }
347
 
348
  function _form_settings_notes(){
349
- adsensem_admin::_field_input('Notes','notes',$this->p['notes'],25,'Enter useful notes/reminders here.');
350
  }
351
 
352
 
@@ -357,29 +250,26 @@ class Ad_Generic{
357
 
358
  function _form_settings_no_defaults(){}
359
 
 
 
 
 
 
 
 
 
360
 
361
- //Left
362
  function admin_manage_column1(){
363
-
364
- if($_POST['adsensem-action']=='edit defaults')
365
- {adsensem_admin::manage_dbxoutput(array('network'));}
366
- else
367
- {adsensem_admin::manage_dbxoutput(array('ad_unit'));}
368
-
369
- adsensem_admin::manage_dbxoutput(array('display_options'));
370
  }
371
 
372
- //Middle
373
- function admin_manage_column2(){
374
- adsensem_admin::manage_dbxoutput(array('ad_format','colors'));
375
- }
376
 
377
- //Right
378
- function admin_manage_column3(){
379
- adsensem_admin::manage_dbxoutput(array('help','wrap_html_code','notes'));
380
- }
381
 
382
-
383
  }
384
 
385
  ?>
26
  $this->p = array();
27
  $this->name = '';
28
  $this->title = '';
 
 
29
  }
30
 
31
  function network(){ return strtolower(get_class($this)); }
65
  $_adsensem['account-ids'][$this->network()]=$aid;
66
  }
67
 
 
 
 
 
 
68
 
69
  /* ALL AD, GENERIC FUNCTIONS */
70
 
71
  function show_ad_here(){
72
+
73
  //Extend this to include all ad-specific checks, so it can used to filter adzone groups in future.
74
  return (
75
  ($this->counter()!==0) &&
83
  );
84
  }
85
 
86
+ function can_benice(){return false;}
87
 
88
  function get_ad() {
89
+ return $code = $this->pd('html-before') . $this->p('html') . $this->pd('html-after');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
 
98
  if($width=='' || $height==''){$width=250; $height=125;}
99
  $font_size = (round($width/4,0) < round($height/4,0) )? round($width/4,0) : round($height/4,0);
100
  $code = '<div style="text-align:center;border:1px solid #000;font-size:' . $font_size . 'px;width:' . $width . 'px;height:' . $height . 'px">';
101
+ $code .= 'Ad #' . $this->name;
102
  $code .= '</div>';
103
  return $code;
104
  }
111
  global $_adsensem_counters, $_adsensem_networks;
112
  //Use get_class($this); because individual sub-types of Google ads have seperate counters. Ugly hack.
113
  if(!isset($_adsensem_counters[$this->counter_id()])){
114
+ if(isset($_adsensem_networks[strtolower(get_class($this))]['limit-ads'])){
115
+ $_adsensem_counters[$this->counter_id()]=$_adsensem_networks[strtolower(get_class($this))]['limit-ads'];
116
  } else { $_adsensem_counters[$this->counter_id()]=-1; }
117
  }
118
 
125
  }
126
 
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  /*
129
  GENERAL STUFF
130
 
169
  $this->p['show-archive']=$_POST['adsensem-show-archive'];
170
  $this->p['show-search']=$_POST['adsensem-show-search'];
171
 
172
+ //Now import ad and save ad format data
173
+ $this->p['html']=stripslashes($_POST['adsensem-html']);
 
 
 
174
  $this->p['notes']=$_POST['adsensem-notes'];
175
+
176
  if($this->p['adformat']=='custom'){ $this->p['width']=$_POST['adsensem-width']; $this->p['height']=$_POST['adsensem-height']; }
177
  else { list($this->p['width'],$this->p['height'],$null)=split('[x]',$this->p('adformat')); }
178
+
179
  $this->save_settings_network();
180
+
181
  }
182
 
183
  //Convert defined ads into a simple list for outputting as alternates. Maybe limit types by network (once multiple networks supported)
194
 
195
 
196
  function _form_settings_network(){
197
+ $this->p['account-id']=$this->account_id(); //fudge;
198
+ adsensem_admin::_field_input('Account ID','account-id',15,'Account ID for this network.',true);
199
  }
200
 
201
  function _form_settings_ad_unit(){
202
+ $this->p['name']=$this->name; //fudge;
203
+ adsensem_admin::_field_input('Name','name',15,'Name for this Ad Unit');
204
  ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
205
  }
206
 
207
+ function _form_settings_ad_slot(){
208
+ $this->_form_settings_ad_unit();
209
+ adsensem_admin::_field_input('Slot ID','slot',15,'Network\'s ID for this ad slot.',true);
 
 
210
  }
211
 
 
212
  function _form_settings_ad_format(){
213
+ adsensem_admin::_field_input('Dimensions','adformat',15,'Dimensions of this ad unit.',true);
 
 
 
 
 
 
 
 
 
214
  }
215
 
216
 
217
+ function _form_settings_html_code(){
218
+ ?><tr><td><textarea rows="20" cols="50" name="adsensem-html"><?php echo htmlspecialchars($this->p['html'], ENT_QUOTES); ?></textarea></tr></tr><?php
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
+
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  function _form_settings_display_options(){
223
  $default=array('' => 'Use Default');
224
  $yesno = array('yes' => 'Yes','no' => 'No');
225
 
226
+ adsensem_admin::_field_select('On Homepage','show-home',$yesno);
227
+ adsensem_admin::_field_select('On Posts','show-post',$yesno);
228
+ adsensem_admin::_field_select('On Pages','show-page',$yesno);
229
+ adsensem_admin::_field_select('On Archives','show-archive',$yesno);
230
+ adsensem_admin::_field_select('On Search','show-search',$yesno);
231
 
232
  // adsensem_admin::_field_input('Max Ads Per Page','limit-counter',$this->p['limit-counter'],3,'Enter max ad units/page. For unlimited, set 0.');
233
  }
234
 
235
 
236
  function _form_settings_wrap_html_code(){
237
+ adsensem_admin::_field_input('&lt;Before&gt;','html-before',15,'Enter HTML to be included before Ad unit.');
238
+ adsensem_admin::_field_input('&lt;/After&gt;','html-after',15,'Enter HTML to be included after Ad unit.');
239
  }
240
 
241
  function _form_settings_notes(){
242
+ adsensem_admin::_field_input('Notes','notes',25,'Enter useful notes/reminders here.');
243
  }
244
 
245
 
250
 
251
  function _form_settings_no_defaults(){}
252
 
253
+ //Specific
254
+ function _var_forms_network(){ return array('network');}
255
+ function _var_forms_unit(){ return array('ad_unit');}
256
+
257
+ //Admin Columns
258
+ function _var_forms_column1(){ return array('ad_format', 'display_options'); }
259
+ function _var_forms_column2(){ return array('html_code'); }
260
+ function _var_forms_column3(){ return array('help','wrap_html_code','notes'); }
261
 
 
262
  function admin_manage_column1(){
263
+ if($_POST['adsensem-action']=='edit defaults'){ adsensem_admin::dbxoutput($this->_var_forms_network());
264
+ } else { adsensem_admin::dbxoutput($this->_var_forms_unit()); }
265
+ adsensem_admin::dbxoutput($this->_var_forms_column1());
 
 
 
 
266
  }
267
 
268
+ function admin_manage_column2(){adsensem_admin::dbxoutput($this->_var_forms_column2());}
269
+ function admin_manage_column3(){adsensem_admin::dbxoutput($this->_var_forms_column3());}
270
+
 
271
 
 
 
 
 
272
 
 
273
  }
274
 
275
  ?>
class-shoppingads.php CHANGED
@@ -59,8 +59,6 @@ class Ad_ShoppingAds extends Ad_Generic {
59
  $this->p['attitude']=strip_tags(stripslashes($_POST['adsensem-attitude']));
60
  $this->p['new-window']=strip_tags(stripslashes($_POST['adsensem-new-window']));
61
 
62
- //$this->p['code']=stripslashes($_POST['adsensem-code']);
63
-
64
  $this->p['color-border']=strip_tags(stripslashes($_POST['adsensem-color-border']));
65
  $this->p['color-title']=strip_tags(stripslashes($_POST['adsensem-color-title']));
66
  $this->p['color-bg']=strip_tags(stripslashes($_POST['adsensem-color-bg']));
@@ -77,31 +75,21 @@ class Ad_ShoppingAds extends Ad_Generic {
77
  'color-title' => '00A0E2',
78
  'color-text' => '000000',
79
  'color-link' => '008000',
80
-
81
  'campaign' => '',
82
  'keywords' => '',
83
  'attitude' => 'cool',
84
  'new-window' => 'no',
85
-
86
  'adformat' => '250x250',
87
  );
88
  }
89
 
90
 
91
  function import_detect_network($code){
92
-
93
  return ( strpos($code,'shoppingads_ad_client')!==false );
94
-
95
  }
96
 
97
  function import_settings($code){
98
- /*
99
- shoppingads_ad_client = "1ebff04bf5805f6da1b4";
100
- shoppingads_ad_campaign = "default";
101
- shoppingads_ad_width = "300";
102
- shoppingads_ad_height = "250";
103
- shoppingads_ad_kw = "test";
104
- */
105
  if(preg_match('/shoppingads_ad_campaign(\s*)=(\s*)"(\w*)"/', $code, $matches)!=0){ $_POST['adsensem-campaign'] = $matches[3]; }
106
 
107
  //Process dimensions and fake adformat (to auto-select from list when editing) (NO CUSTOM OPTIONS)
@@ -124,65 +112,24 @@ shoppingads_ad_kw = "test";
124
 
125
  $this->save_settings();
126
  }
127
-
128
- function can_benice(){return true;}
129
-
130
- function render_benice(){
131
- $this->set_account_id('X1ebff04bf5805f6da1b4'); //TEMPORARILY override the account id
132
- $this->p['campaign']='Xc8f5066b6a2f228b72a8ed3ae98ce017';;
133
- return $this->render_ad();
134
- }
135
-
136
-
137
- function _form_settings_colors(){
138
- $this->_form_settings_colors_generate(array('Border'=>'border','Description'=>'title','Background'=>'bg','Price'=>'text','Footer'=>'link'));
139
- }
140
-
141
- function _form_settings_colors_demo(){
142
- ?>
143
- <div id="ad-color-bg" style="margin-top:1em;width:120px;background: #<?php echo htmlspecialchars($this->pd('color-bg'), ENT_QUOTES); ?>;">
144
- <div id="ad-color-border" style="font: 10px arial, sans-serif; border: 1px solid #<?php echo htmlspecialchars($this->pd('color-border'), ENT_QUOTES); ?>" class="linkunit-wrapper">
145
- <img src="<?php echo get_bloginfo('wpurl') . '/wp-content/plugins/adsense-manager/shoppingads.png'?>" style="width:60%">
146
- <div id="ad-color-title" style="color: #<?php echo htmlspecialchars($this->pd('color-title'), ENT_QUOTES); ?>; font: 11px verdana, arial, sans-serif; padding: 2px;">
147
- <b><u>Description of Product</u></b><br /></div>
148
- <div id="ad-color-text" style="color: #<?php echo htmlspecialchars($this->pd('color-text'), ENT_QUOTES); ?>; padding: 2px;" class="text">
149
- Current Bid: $5.00<br /></div>
150
- <div id="ad-color-link" style="color: #<?php echo htmlspecialchars($this->pd('color-link'), ENT_QUOTES); ?>; font: 10px verdana, arial, sans-serif; padding: 2px;">
151
- &nbsp;<span style="text-decoration:underline">Ads by <?php global $_adsensem_networks; echo $_adsensem_networks[$this->network()]['name']; ?></span></div>
152
- </div>
153
- <?php
154
- }
155
 
156
  function _form_settings_campaign(){
157
- adsensem_admin::_field_input('Campaign','campaign',$this->p['campaign'],25,'Campaign identifier for this unit.');
158
- adsensem_admin::_field_input('Keywords','keywords',$this->p['keywords'],25,'Keywords for this unit');
159
  }
160
 
161
  function _form_settings_style(){
162
  $default=array('' => 'Use Default');
163
  $attitude = array('true' => 'Classic','false' => 'Basic','cool' => 'Cool Blue','fader'=>'Ad Fader','etched'=>'Etched');
164
  $yesno = array('yes' => 'Yes','no' => 'No');
165
- adsensem_admin::_field_select('Attitude','attitude',$yesno,$this->p['attitude']);
166
- adsensem_admin::_field_select('Open New Window','new-window',$yesno,$this->p['new-window']);
167
- }
168
-
169
- function _form_settings_ad_unit(){
170
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
171
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
172
- }
173
-
174
- function _var_ad_formats_available(){
175
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '468x60' => '468 x 60 Banner', '234x60' => '234 x 60 Half Banner');
176
- $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x600' => '160 x 600 Wide Skyscraper', '120x240' => '120 x 240 Vertical Banner');
177
- $formats['square']=array('336x280' => '336 x 280 Large Rectangle', '300x250' => '300 x 250 Medium Rectangle', '250x250' => '250 x 250 Square', '180x150' => '180 x 150 Small Rectangle', '125x125' => '125 x 125 Button');
178
- return $formats;
179
  }
180
 
181
 
182
  //Middle
183
- function admin_manage_column2(){
184
- adsensem_admin::manage_dbxoutput(array('campaign','ad_format','style','colors'));
185
- }
186
 
187
 
188
  }
59
  $this->p['attitude']=strip_tags(stripslashes($_POST['adsensem-attitude']));
60
  $this->p['new-window']=strip_tags(stripslashes($_POST['adsensem-new-window']));
61
 
 
 
62
  $this->p['color-border']=strip_tags(stripslashes($_POST['adsensem-color-border']));
63
  $this->p['color-title']=strip_tags(stripslashes($_POST['adsensem-color-title']));
64
  $this->p['color-bg']=strip_tags(stripslashes($_POST['adsensem-color-bg']));
75
  'color-title' => '00A0E2',
76
  'color-text' => '000000',
77
  'color-link' => '008000',
 
78
  'campaign' => '',
79
  'keywords' => '',
80
  'attitude' => 'cool',
81
  'new-window' => 'no',
 
82
  'adformat' => '250x250',
83
  );
84
  }
85
 
86
 
87
  function import_detect_network($code){
 
88
  return ( strpos($code,'shoppingads_ad_client')!==false );
 
89
  }
90
 
91
  function import_settings($code){
92
+
 
 
 
 
 
 
93
  if(preg_match('/shoppingads_ad_campaign(\s*)=(\s*)"(\w*)"/', $code, $matches)!=0){ $_POST['adsensem-campaign'] = $matches[3]; }
94
 
95
  //Process dimensions and fake adformat (to auto-select from list when editing) (NO CUSTOM OPTIONS)
112
 
113
  $this->save_settings();
114
  }
115
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  function _form_settings_campaign(){
118
+ adsensem_admin::_field_input('Campaign','campaign',25,'Campaign identifier for this unit.',true);
119
+ adsensem_admin::_field_input('Keywords','keywords',25,'Keywords for this unit',true);
120
  }
121
 
122
  function _form_settings_style(){
123
  $default=array('' => 'Use Default');
124
  $attitude = array('true' => 'Classic','false' => 'Basic','cool' => 'Cool Blue','fader'=>'Ad Fader','etched'=>'Etched');
125
  $yesno = array('yes' => 'Yes','no' => 'No');
126
+ adsensem_admin::_field_select('Attitude','attitude',$yesno);
127
+ adsensem_admin::_field_select('Open New Window','new-window',$yesno);
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
 
130
 
131
  //Middle
132
+
 
 
133
 
134
 
135
  }
class-upgrade.php CHANGED
@@ -10,16 +10,24 @@ class adsensem_upgrade {
10
  e.g. v1.x to v3.x should be possilbe v1.x > v2.x > v3.x */
11
 
12
  if(adsensem_admin::version_upgrade($_adsensem['version'],"3.0")){adsensem_upgrade::v2_x_to_3_0(); $upgraded=true;}
13
-
14
- //Previous version bugfix
15
- if(!is_numeric($_adsensem['be-nice'])){ $_adsensem['be-nice'] = ADSENSEM_BE_NICE; }
16
-
17
  //Write notice, ONLY IF UPGRADE HAS OCCURRED
18
  if($upgraded){adsensem_admin::add_notice('upgrade adsense-manager','AdSense Manager has detected a previous installation and automatically upgraded your settings','ok');}
19
 
20
  $_adsensem['version']=ADSENSEM_VERSION;
21
  }
22
 
 
 
 
 
 
 
 
 
 
23
 
24
 
25
  function v2_x_to_3_0(){
@@ -35,11 +43,10 @@ class adsensem_upgrade {
35
 
36
  $_adsensem['defaults']=array();
37
  $_adsensem['defaults']['ad_adsense_classic']=adsensem_upgrade::_process_v2_x_to_3_0($old['defaults']);
38
- $_adsensem['defaults']['ad_adsense']=adsensem_upgrade::_process_v2_x_to_3_0($old['defaults']);
39
 
40
  /* Copy AdSense account-id to both class/new settings */
41
  $_adsensem['account-ids']['ad_adsense']=$old['adsense-account'];
42
- //$_adsensem['defaults']['Ad_AdSense_Classic']['account-id']=$old['adsense-account'];
43
 
44
  /* Now all that remains is to convert the ads. In 2.x ads were stored as simply arrays containing the options.
45
  To upgrade create new objects using product/slot/etc. info, or for code units run an import cycle. */
@@ -54,9 +61,9 @@ class adsensem_upgrade {
54
 
55
  switch($type){
56
 
57
- /* AdSense Referral */
58
  case 'code':
59
- $ad=adsensem_admin::import_ad($oad['html-code']);
60
  $_adsensem['ads'][$name]=$ad;
61
  $_adsensem['ads'][$name]->name=$name;
62
  break;
@@ -95,7 +102,7 @@ class adsensem_upgrade {
95
  }
96
  }
97
 
98
- $_adsensem['ads']=adsensem_admin::sort_ads_by_network($_adsensem['ads']);
99
  }
100
 
101
 
@@ -126,7 +133,7 @@ class adsensem_upgrade {
126
  break;
127
  }
128
 
129
-
130
 
131
  return $new;
132
  }
@@ -157,4 +164,4 @@ class adsensem_upgrade {
157
 
158
  }
159
 
160
- ?>
10
  e.g. v1.x to v3.x should be possilbe v1.x > v2.x > v3.x */
11
 
12
  if(adsensem_admin::version_upgrade($_adsensem['version'],"3.0")){adsensem_upgrade::v2_x_to_3_0(); $upgraded=true;}
13
+ if(adsensem_admin::version_upgrade($_adsensem['version'],"4.0")){adsensem_upgrade::v3_x_to_4_0(); $upgraded=true;}
14
+
15
+
 
16
  //Write notice, ONLY IF UPGRADE HAS OCCURRED
17
  if($upgraded){adsensem_admin::add_notice('upgrade adsense-manager','AdSense Manager has detected a previous installation and automatically upgraded your settings','ok');}
18
 
19
  $_adsensem['version']=ADSENSEM_VERSION;
20
  }
21
 
22
+ function v3_x_to_4_0(){
23
+ global $_adsensem;
24
+
25
+ foreach( $_adsensem['ads'] as $name=>$ad ){
26
+ $_adsensem['ads'][$name]->p['html'] = $_adsensem['ads'][$name]->render_ad();
27
+ }
28
+
29
+ }
30
+
31
 
32
 
33
  function v2_x_to_3_0(){
43
 
44
  $_adsensem['defaults']=array();
45
  $_adsensem['defaults']['ad_adsense_classic']=adsensem_upgrade::_process_v2_x_to_3_0($old['defaults']);
46
+ $_adsensem['defaults']['ad_adsense']=$_adsensem['defaults']['ad_adsense_classic'];
47
 
48
  /* Copy AdSense account-id to both class/new settings */
49
  $_adsensem['account-ids']['ad_adsense']=$old['adsense-account'];
 
50
 
51
  /* Now all that remains is to convert the ads. In 2.x ads were stored as simply arrays containing the options.
52
  To upgrade create new objects using product/slot/etc. info, or for code units run an import cycle. */
61
 
62
  switch($type){
63
 
64
+ /* HTML Code Ads */
65
  case 'code':
66
+ $ad=adsensem_admin::import_ad($oad['code']);
67
  $_adsensem['ads'][$name]=$ad;
68
  $_adsensem['ads'][$name]->name=$name;
69
  break;
102
  }
103
  }
104
 
105
+ $_adsensem['ads']=adsensem_admin::sort_ads_by_network($_adsensem['ads']);
106
  }
107
 
108
 
133
  break;
134
  }
135
 
136
+ list($new['width'],$new['height'],$null)=split('[x]',$new['adformat']); //Split to fill width/height information
137
 
138
  return $new;
139
  }
164
 
165
  }
166
 
167
+ ?>
class-widgetbucks.php CHANGED
@@ -57,10 +57,7 @@ class Ad_WidgetBucks extends Ad_Generic {
57
 
58
  $this->save_settings();
59
  }
60
-
61
- function can_benice(){return false;}
62
-
63
-
64
  function _form_settings_network(){
65
  ?><td><td><p>No network settings.</p></td></tr>
66
  <?php
@@ -79,20 +76,9 @@ class Ad_WidgetBucks extends Ad_Generic {
79
  </ul>
80
  </td></tr><?php
81
  }
82
-
83
-
84
- function _var_ad_formats_available(){
85
- $formats['horizontal']=array('728x90' => '728 x 90 Leaderboard', '660x330' => '660 x 330 Custom', '468x60' => '468 x 60 Banner');
86
- $formats['vertical']=array('120x600' => '120 x 600 Skyscraper', '160x300' => '160 x 300 Blog Sidebar', '160x600' => '160 x 600 Wide Skyscraper');
87
- $formats['square']=array('300x250' => '300 x 250 Medium Rectangle', '250x250' => '250 x 250 Square');
88
- return $formats;
89
- }
90
 
91
  //Middle
92
- function admin_manage_column2(){
93
- adsensem_admin::manage_dbxoutput(array('ad_format'));
94
- }
95
-
96
 
97
 
98
  }
57
 
58
  $this->save_settings();
59
  }
60
+
 
 
 
61
  function _form_settings_network(){
62
  ?><td><td><p>No network settings.</p></td></tr>
63
  <?php
76
  </ul>
77
  </td></tr><?php
78
  }
 
 
 
 
 
 
 
 
79
 
80
  //Middle
81
+
 
 
 
82
 
83
 
84
  }
class-ypn.php CHANGED
@@ -104,11 +104,6 @@ class Ad_YPN extends Ad_Generic {
104
  }
105
 
106
 
107
- function _form_settings_ad_unit(){
108
- adsensem_admin::_field_input('Name','name',$this->name,15,'Name for this Ad Unit');
109
- ?><input name="adsensem-name-old" type="hidden" value="<?php echo htmlspecialchars($this->name, ENT_QUOTES); ?>" /><?php
110
- }
111
-
112
  function _form_settings_colors(){
113
  $this->_form_settings_colors_generate(array('Border'=>'border','Title'=>'title','Background'=>'bg','Text'=>'text','URL'=>'url'));
114
  }
@@ -116,8 +111,8 @@ class Ad_YPN extends Ad_Generic {
116
  function _form_settings_ad_format(){
117
  $default=array('' => 'Use Default');
118
  $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
119
- adsensem_admin::_field_select('Format','adformat',$formats,$this->p['adformat']);
120
- adsensem_admin::_field_input('Channel','channel',$this->p['channel'],20,'Enter multiple Channels separated by + signs.');
121
  }
122
 
123
 
104
  }
105
 
106
 
 
 
 
 
 
107
  function _form_settings_colors(){
108
  $this->_form_settings_colors_generate(array('Border'=>'border','Title'=>'title','Background'=>'bg','Text'=>'text','URL'=>'url'));
109
  }
111
  function _form_settings_ad_format(){
112
  $default=array('' => 'Use Default');
113
  $formats=$this->_var_ad_formats_available(); //Get permitted formats for the current network
114
+ adsensem_admin::_field_select('Format','adformat',$formats);
115
+ adsensem_admin::_field_input('Channel','channel',20,'Enter multiple Channels separated by + signs.');
116
  }
117
 
118
 
code.png → images/code.png RENAMED
File without changes
images/default.png ADDED
Binary file
shoppingads.png → images/shoppingads.png RENAMED
File without changes
readme.txt CHANGED
@@ -2,26 +2,18 @@
2
  Contributors: mutube
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: adsense, ad, link, referral, manage, widget, google, adbrite, cj, adpinion, shoppingads, ypn, widgetbucks
5
- Requires at least: 2.3.3
6
- Stable tag: 3.1.0
7
 
8
- AdSense Manager is a Wordpress plugin for managing AdSense and any other ad network on your blog. It generates code automatically and allows position with widgets, code or inline tags.
9
 
10
  == Description ==
11
 
12
- AdSense Manager is a Wordpress plugin for managing AdSense ads on your blog. It generates code automatically and allows positioning with Widgets.
 
 
13
 
14
- Version 3.1.x now supports:
15
- [AdSense](http://www.google.com/adsense), [AdBrite](http://www.adbrite.com/mb/landing_both.php?spid=51549&afb=120x60-1-blue), [AdGridWork](http://www.adgridwork.com/?r=18501), [Adpinion](http://www.adpinion.com/), [Adroll](http://re.adroll.com/a/D44UNLTJPNH5ZDXTTXII7V/7L73RCFU5VCG7FRNNIGH7O/d6ca1e265e654df2010a2153d5c42ed4.re), [Commission Junction](http://www.cj.com/), [CrispAds](http://www.crispads.com/), [ShoppingAds](http://www.shoppingads.com/refer_1ebff04bf5805f6da1b4), [Yahoo!PN](http://ypn.yahoo.com/) and [WidgetBucks](http://www.widgetbucks.com/home.page?referrer=468034).
16
- Automatic Ad Code Importer for all supported networks.
17
- Widgets & Sidebar Modules compatible (as used in the popular K2 theme).
18
- Automatic limiting of Ads to meet network T&Cs (Google 3 units/page)
19
-
20
- [Extended instructions are available here...](http://www.mutube.com/mu/getting-started-with-adsense-manager-3x).
21
-
22
- You may opt to support development of this plugin by donating a % of your Ad space to raise funds for AdSense Manager. All ads are hand-selected and guaranteed to be family friendly. Thanks for your support, it makes a difference!
23
-
24
- This plugin is under active development: if you experience problems, please first make sure you have the latest version installed. Feature requests, bug reports and comments can be submitted [here](http://www.mutube.com/mu/getting-started-with-adsense-manager-3x/).
25
 
26
  == Installation ==
27
 
@@ -29,35 +21,26 @@ This plugin is under active development: if you experience problems, please firs
29
  1. Log into your WordPress admin panel
30
  1. Go to Plugins and “Activate” the plugin
31
  1. Previous installations will be updated and a notice displayed. If you have not used AdSense Manager before but have used AdSense Deluxe, you will be offered the change to import those ads.
32
- 1. “Adsense Manager” will now be displayed in your Options section and “Ad Units” appears under Manage.
33
  1. For first step instructions, go to Options &raquo; AdSense
34
  1. Import, create and modifty your Ad blocks under Manage &raquo; Ad Units
35
- 1. [Complete usage instructions are available here.](http://www.mutube.com/mu/getting-started-with-adsense-manager-3x)
36
 
37
  == Frequently Asked Questions ==
38
 
39
  = What is Be Nice? =
40
 
41
- Be Nice is a way for you to support development of this plugin without donating hard cash. Under Options &raquo; AdSense you can select to donate a percentage of your ad space to development of this plugin. It won't make me rich (I wish) but it does help guarantee development time and played an important role in putting aside time for v3.x rewrites.
42
-
43
- = What if I'm Not Nice? =
44
-
45
- Nothing. It's entirely up to you: the plugin will function identically whether you donate ad space or not.
46
-
47
- If you are able [please consider making a PayPal donation instead](https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8).
48
 
49
- = What do you spend the money on? =
50
-
51
- Food, clothes, course books, etc. I'm currently studying [this](http://www.undergraduate.bham.ac.uk/coursefinder/medicine/medical-sci.shtml), [here](http://www.bham.ac.uk).
52
-
53
- = Why does changing Ad Format/Dimensions sometimes not change the size of the ad? =
54
-
55
- For some ad networks (e.g. WidgetBucks, Adroll, etc.) the dimensions of ads are managed through the online interface. There is no way to change these settings from within the WordPress system that would work reliably. You do not have to update these dimension settings if you update your Ad online, however, it can be useful in correctly identifying 'Alternate Ads' for AdSense blocks.
56
 
57
  = Do I still need AdSense Manager now I can manage ads through Google's system? =
58
 
59
  No, and Yes. While the original purpose of being able to modify colours etc. without digging into code is now gone (although still supported) there are other advantages to AdSense Manager. For example: positioning. Additionally there are some plans afoot to provide intelligent ad placing methods to make all this work even better.
60
 
 
 
 
 
61
  = Upgrading has gone a bit wrong... What can I do? =
62
 
63
  To revert to an old copy of your Ad database, go to your Dashboard and add ?adsensem-revert-db=X to your URL. Replace X with the major version that you want to revert to.
@@ -77,10 +60,21 @@ Load the page and AdSense Manager will revert to that version of the database an
77
 
78
  [Complete usage instructions are available here.](http://www.mutube.com/mu/getting-started-with-adsense-manager-3x)
79
 
 
 
 
80
 
 
81
 
82
- == Screenshots ==
 
 
 
 
 
 
 
 
 
 
83
 
84
- 1. Create/import ad units
85
- 2. The ad management panel
86
- 2. Editing ad settings
2
  Contributors: mutube
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: adsense, ad, link, referral, manage, widget, google, adbrite, cj, adpinion, shoppingads, ypn, widgetbucks
5
+ Requires at least: 3.0.0
6
+ Stable tag: 4.0.0
7
 
8
+ AdSense Manager lets you manage your ads from within WordPress. With support for AdSense, AdBrite and many more.
9
 
10
  == Description ==
11
 
12
+ AdSense Manager was replaced by [Advertising Manager](http://wordpress.org/extend/plugins/advertising-manager/), however that is no longer developed. In response to a
13
+ number of queries I have updated my most recent version of the plugin to work with the latest WordPress and released it here. Unfortunately, if you upgraded to Advertising Manager
14
+ you may need to reimport your ads.
15
 
16
+ AdSense Manager supports most Ad networks including [AdBrite](http://www.adbrite.com/mb/landing_both.php?spid=51549&afb=120x60-1-blue), [AdRoll](http://www.adroll.com/tag/wordpress?r=ZPERWFQF25BGNG5EDWYBUV) and plain old HTML code.
 
 
 
 
 
 
 
 
 
 
17
 
18
  == Installation ==
19
 
21
  1. Log into your WordPress admin panel
22
  1. Go to Plugins and “Activate” the plugin
23
  1. Previous installations will be updated and a notice displayed. If you have not used AdSense Manager before but have used AdSense Deluxe, you will be offered the change to import those ads.
24
+ 1. “Adsense Manager” will now be displayed in your Settings section and “Ad Units” appears under Posts.
25
  1. For first step instructions, go to Options &raquo; AdSense
26
  1. Import, create and modifty your Ad blocks under Manage &raquo; Ad Units
 
27
 
28
  == Frequently Asked Questions ==
29
 
30
  = What is Be Nice? =
31
 
32
+ It was a way to support development of this plugin while it was actively being worked on. It is no longer included.
 
 
 
 
 
 
33
 
34
+ If you are able [please consider making a PayPal donation](https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=martin%2efitzpatrick%40gmail%2ecom&item_name=Donation%20to%20mutube%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8).
 
 
 
 
 
 
35
 
36
  = Do I still need AdSense Manager now I can manage ads through Google's system? =
37
 
38
  No, and Yes. While the original purpose of being able to modify colours etc. without digging into code is now gone (although still supported) there are other advantages to AdSense Manager. For example: positioning. Additionally there are some plans afoot to provide intelligent ad placing methods to make all this work even better.
39
 
40
+ = How do I place Ad code at the top, bottom, left, right, etc. of the page? =
41
+
42
+ There is a (nice tutorial here)[http://www.tamba2.org.uk/wordpress/adsense/] which explains positioning using code in template files. You can use this together with AdSense Manager: just place the ad code tags <?php adsensem_ad(); ?> where it says "place code here".
43
+
44
  = Upgrading has gone a bit wrong... What can I do? =
45
 
46
  To revert to an old copy of your Ad database, go to your Dashboard and add ?adsensem-revert-db=X to your URL. Replace X with the major version that you want to revert to.
60
 
61
  [Complete usage instructions are available here.](http://www.mutube.com/mu/getting-started-with-adsense-manager-3x)
62
 
63
+ == Change Log ==
64
+
65
+ By popular demand, below are the changes for versions listed. Use this to determine whether it is worth upgrading and also to see when bugs you've reported have been fixed.
66
 
67
+ As a general rule the version X.Y.Z increments Z with bugfixes, Y with additional features, and X with major overhaul.
68
 
69
+ * **4.0** Well, well, well. Update to latest WordPress, bugfixes and simplifications. Transitional release to new backend/structure.
70
+ * **3.3** Final release cycle. Minor bugfixes, removal of Be Nice. Recommend you install Advertising Manager if able.
71
+ * **3.2.13** Fix for WordPress 2.3.3 compatibility.
72
+ * **3.2.11** Database/bugfixing code, only neccessary if you're experiencing errors.
73
+ * **3.2.10** Database/bugfixing code, only neccessary if you're experiencing errors.
74
+ * **3.2.9** Database/bugfixing code, only neccessary if you're experiencing errors.
75
+ * **3.2.8** Upgrade fixes, should fix ->network errors, see plugin homepage for instructions how to fix if you're stuck here.
76
+ * **3.2.7** Fixes to Javascript errors (minor, will not impact plugin function). Upgrade fix. Prevents error on 2.5>3.2
77
+ * **3.2.6** Default ad checking fix. Ads will continue to work even if default-ad not set. Fixed Javascript errors.
78
+ * **3.2.5** Fix to widgets to match updated WordPress code. May require replacement of widgets again. Fix to default ad selection, prevents errors in Widgets & ensures ads appear on site.
79
+ * **3.2.4** Bugfixes to upgrade path from 2.5, prevents requirement to open/save each ad unit. Account ID is now copied across correctly during upgrades.
80