AdRotate Banner Manager - Version 3.18

Version Description

  • [new] Maintenance function to clean up AdRotate transients
  • [fix] Stats link not always showing for expired adverts

All recent changes are available on the AdRotate website.

=

Download this release

Release Info

Developer adegans
Plugin Icon 128x128 AdRotate Banner Manager
Version 3.18
Comparing to
See all releases

Code changes from version 3.17 to 3.18

adrotate-manage-publisher.php CHANGED
@@ -604,6 +604,15 @@ function adrotate_options_submit() {
604
  $config['stats'] = (is_numeric($stats) AND $stats >= 0 AND $stats <= 3) ? $stats : 1;
605
  $config['enable_loggedin_impressions'] = 'Y';
606
  $config['enable_loggedin_clicks'] = 'Y';
 
 
 
 
 
 
 
 
 
607
  $impression_timer = trim($_POST['adrotate_impression_timer']);
608
  $config['impression_timer'] = (is_numeric($impression_timer) AND $impression_timer >= 10 AND $impression_timer <= 3600) ? $impression_timer : 60;
609
  $click_timer = trim($_POST['adrotate_click_timer']);
604
  $config['stats'] = (is_numeric($stats) AND $stats >= 0 AND $stats <= 3) ? $stats : 1;
605
  $config['enable_loggedin_impressions'] = 'Y';
606
  $config['enable_loggedin_clicks'] = 'Y';
607
+ $config['enable_clean_trackerdata'] = (isset($_POST['adrotate_enable_clean_trackerdata'])) ? 'Y' : 'N';
608
+
609
+ if($config['enable_clean_trackerdata'] == "Y" AND !wp_next_scheduled('adrotate_delete_transients')) {
610
+ wp_schedule_event(adrotate_now(), 'twicedaily', 'adrotate_delete_transients');
611
+ }
612
+ if($config['enable_clean_trackerdata'] == "N" AND wp_next_scheduled('adrotate_delete_transients')) {
613
+ wp_clear_scheduled_hook('adrotate_delete_transients');
614
+ }
615
+
616
  $impression_timer = trim($_POST['adrotate_impression_timer']);
617
  $config['impression_timer'] = (is_numeric($impression_timer) AND $impression_timer >= 10 AND $impression_timer <= 3600) ? $impression_timer : 60;
618
  $click_timer = trim($_POST['adrotate_click_timer']);
adrotate-setup.php CHANGED
@@ -72,6 +72,7 @@ function adrotate_activate_setup() {
72
  adrotate_database_install();
73
  adrotate_dummy_data();
74
  adrotate_check_config();
 
75
 
76
  // Set the capabilities for the administrator
77
  $role = get_role('administrator');
@@ -84,11 +85,7 @@ function adrotate_activate_setup() {
84
  if(is_object(get_role('adrotate_advertiser'))) {
85
  adrotate_prepare_roles('remove');
86
  }
87
-
88
- if(!wp_next_scheduled('adrotate_evaluate_ads')) {// Periodically check ads
89
- wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
90
- }
91
-
92
  // Attempt to make the some folders
93
  if(!is_dir(ABSPATH.'wp-content/banners')) mkdir(ABSPATH.'/wp-content/banners', 0755);
94
  if(!is_dir(ABSPATH.'wp-content/reports')) mkdir(ABSPATH.'/wp-content/reports', 0755);
@@ -128,6 +125,7 @@ function adrotate_deactivate_setup() {
128
  // Clear out wp_cron
129
  wp_clear_scheduled_hook('adrotate_notification');
130
  wp_clear_scheduled_hook('adrotate_evaluate_ads');
 
131
  }
132
 
133
  /*-------------------------------------------------------------
@@ -213,6 +211,10 @@ function adrotate_check_schedules() {
213
  if(!wp_next_scheduled('adrotate_evaluate_ads')) { // Periodically check ads
214
  wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
215
  }
 
 
 
 
216
  }
217
 
218
  /*-------------------------------------------------------------
@@ -247,6 +249,8 @@ function adrotate_check_config() {
247
  if(!isset($config['stats']) OR ($config['stats'] < 0 AND $config['stats'] > 2)) $config['stats'] = 1;
248
  if(!isset($config['enable_loggedin_impressions']) OR ($config['enable_loggedin_impressions'] != 'Y' AND $config['enable_loggedin_impressions'] != 'N')) $config['enable_loggedin_impressions'] = 'Y';
249
  if(!isset($config['enable_loggedin_clicks']) OR ($config['enable_loggedin_clicks'] != 'Y' AND $config['enable_loggedin_clicks'] != 'N')) $config['enable_loggedin_clicks'] = 'Y';
 
 
250
  if(!isset($config['enable_geo'])) $config['enable_geo'] = 0;
251
  if(!isset($config['geo_email'])) $config['geo_email'] = '';
252
  if(!isset($config['geo_pass'])) $config['geo_pass'] = '';
@@ -1089,6 +1093,11 @@ function adrotate_core_upgrade() {
1089
  wp_clear_scheduled_hook('adrotate_clean_trackerdata');
1090
  }
1091
 
 
 
 
 
 
1092
  update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
1093
  }
1094
 
@@ -1136,6 +1145,11 @@ function adrotate_cleanup_database() {
1136
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` < $lastyear;");
1137
  }
1138
 
 
 
 
 
 
1139
  // Delete empty ads, groups and schedules
1140
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
1141
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '';");
@@ -1167,6 +1181,20 @@ function adrotate_cleanup_database() {
1167
  adrotate_return('adrotate-settings', 406, array('tab' => 'maintenance'));
1168
  }
1169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1170
  /*-------------------------------------------------------------
1171
  Name: adrotate_add_column
1172
  Purpose: Check if the column exists in the table
72
  adrotate_database_install();
73
  adrotate_dummy_data();
74
  adrotate_check_config();
75
+ adrotate_check_schedules();
76
 
77
  // Set the capabilities for the administrator
78
  $role = get_role('administrator');
85
  if(is_object(get_role('adrotate_advertiser'))) {
86
  adrotate_prepare_roles('remove');
87
  }
88
+
 
 
 
 
89
  // Attempt to make the some folders
90
  if(!is_dir(ABSPATH.'wp-content/banners')) mkdir(ABSPATH.'/wp-content/banners', 0755);
91
  if(!is_dir(ABSPATH.'wp-content/reports')) mkdir(ABSPATH.'/wp-content/reports', 0755);
125
  // Clear out wp_cron
126
  wp_clear_scheduled_hook('adrotate_notification');
127
  wp_clear_scheduled_hook('adrotate_evaluate_ads');
128
+ wp_clear_scheduled_hook('adrotate_delete_transients');
129
  }
130
 
131
  /*-------------------------------------------------------------
211
  if(!wp_next_scheduled('adrotate_evaluate_ads')) { // Periodically check ads
212
  wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
213
  }
214
+
215
+ if(!wp_next_scheduled('adrotate_delete_transients')) { // Clear Tracker Data
216
+ wp_schedule_event($firstrun + 1800, 'hourly', 'adrotate_delete_transients');
217
+ }
218
  }
219
 
220
  /*-------------------------------------------------------------
249
  if(!isset($config['stats']) OR ($config['stats'] < 0 AND $config['stats'] > 2)) $config['stats'] = 1;
250
  if(!isset($config['enable_loggedin_impressions']) OR ($config['enable_loggedin_impressions'] != 'Y' AND $config['enable_loggedin_impressions'] != 'N')) $config['enable_loggedin_impressions'] = 'Y';
251
  if(!isset($config['enable_loggedin_clicks']) OR ($config['enable_loggedin_clicks'] != 'Y' AND $config['enable_loggedin_clicks'] != 'N')) $config['enable_loggedin_clicks'] = 'Y';
252
+ if(!isset($config['enable_clean_trackerdata']) OR ($config['enable_clean_trackerdata'] != 'Y' AND $config['enable_clean_trackerdata'] != 'N')) $config['enable_clean_trackerdata'] = 'Y';
253
+ if(!wp_next_scheduled('adrotate_delete_transients')) wp_schedule_event(adrotate_now(), 'hourly', 'adrotate_delete_transients'); // Goes together with 'enable_clean_trackerdata' option if Y
254
  if(!isset($config['enable_geo'])) $config['enable_geo'] = 0;
255
  if(!isset($config['geo_email'])) $config['geo_email'] = '';
256
  if(!isset($config['geo_pass'])) $config['geo_pass'] = '';
1093
  wp_clear_scheduled_hook('adrotate_clean_trackerdata');
1094
  }
1095
 
1096
+ // 3.18
1097
+ if($adrotate_version['current'] < 386) {
1098
+ if(!wp_next_scheduled('adrotate_delete_transients')) wp_schedule_event($firstrun, 'hourly', 'adrotate_delete_transients');
1099
+ }
1100
+
1101
  update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
1102
  }
1103
 
1145
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` < $lastyear;");
1146
  }
1147
 
1148
+ // Delete old tracker data
1149
+ if(isset($_POST['adrotate_db_cleanup_trackerdata'])) {
1150
+ adrotate_delete_transients();
1151
+ }
1152
+
1153
  // Delete empty ads, groups and schedules
1154
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
1155
  $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '';");
1181
  adrotate_return('adrotate-settings', 406, array('tab' => 'maintenance'));
1182
  }
1183
 
1184
+ /*-------------------------------------------------------------
1185
+ Name: adrotate_delete_transients
1186
+ Purpose: Delete expired transients periodically
1187
+ Since: 3.18
1188
+ -------------------------------------------------------------*/
1189
+ function adrotate_delete_transients() {
1190
+ global $wpdb;
1191
+
1192
+ $onedayonehour = adrotate_now() - 90000;
1193
+
1194
+ $wpdb->query("DELETE FROM wp_options WHERE (`option_name` LIKE '\_transient\_timeout\_adrotate\_%' OR `option_name` LIKE '\_transient\_adrotate\_%') AND `option_value` < '$onedayonehour'");
1195
+
1196
+ }
1197
+
1198
  /*-------------------------------------------------------------
1199
  Name: adrotate_add_column
1200
  Purpose: Check if the column exists in the table
adrotate-statistics.php CHANGED
@@ -185,12 +185,33 @@ function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
185
  }
186
 
187
  if($stats) {
188
- $dates = $clicks = $impressions = '';
 
 
189
 
 
190
  foreach($stats as $result) {
191
  if(empty($result['clicks'])) $result['clicks'] = '0';
192
  if(empty($result['impressions'])) $result['impressions'] = '0';
193
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  $dates .= ',"'.date_i18n("d M", $result['thetime']).'"';
195
  $clicks .= ','.$result['clicks'];
196
  $impressions .= ','.$result['impressions'];
185
  }
186
 
187
  if($stats) {
188
+ $dates = $clicks = $impressions = ''; // To store the final graph data
189
+ $day_start = $start; // Midnight of the day (start)
190
+ $day_end = $day_start + 86399; // 1 second before midnight of the next day
191
 
192
+ $i = 0;
193
  foreach($stats as $result) {
194
  if(empty($result['clicks'])) $result['clicks'] = '0';
195
  if(empty($result['impressions'])) $result['impressions'] = '0';
196
+
197
+ if($result['thetime'] >= $day_start AND $result['thetime'] <= $day_end) {
198
+ if(empty($graph[$i]['clicks'])) $graph[$i]['clicks'] = '0';
199
+ if(empty($graph[$i]['impressions'])) $graph[$i]['impressions'] = '0';
200
+
201
+ $count_clicks = $graph[$i]['clicks'] + $result['clicks'];
202
+ $count_impressions = $graph[$i]['impressions'] + $result['impressions'];
203
+ } else {
204
+ $day_start += 86400;
205
+ $day_end += 86400;
206
+ $count_clicks = $result['clicks'];
207
+ $count_impressions = $result['impressions'];
208
+ $i++;
209
+ }
210
+ $graph[$i] = array('thetime' => $day_start, 'clicks' => $count_clicks, 'impressions' => $count_impressions);
211
+ unset($count_clicks, $count_impressions);
212
+ }
213
+
214
+ foreach($graph as $result) {
215
  $dates .= ',"'.date_i18n("d M", $result['thetime']).'"';
216
  $clicks .= ','.$result['clicks'];
217
  $impressions .= ','.$result['impressions'];
adrotate.php CHANGED
@@ -7,7 +7,7 @@ Author URI: http://ajdg.solutions/?utm_campaign=homepage&utm_medium=plugin-info&
7
  Description: The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
  Domain Path: /languages/
10
- Version: 3.17
11
  License: GPLv3
12
  */
13
 
@@ -22,8 +22,8 @@ License: GPLv3
22
  ------------------------------------------------------------------------------------ */
23
 
24
  /*--- AdRotate values ---------------------------------------*/
25
- define("ADROTATE_DISPLAY", '3.17');
26
- define("ADROTATE_VERSION", 385);
27
  define("ADROTATE_DB_VERSION", 60);
28
  /*-----------------------------------------------------------*/
29
 
@@ -185,7 +185,7 @@ function adrotate_manage() {
185
 
186
  $allbanners = $wpdb->get_results("SELECT `id`, `title`, `type`, `tracker`, `weight` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' OR `type` != 'a_empty' OR `type` != 'queue') ORDER BY `id` ASC;");
187
 
188
- $activebanners = $errorbanners = $disabledbanners = false;
189
  foreach($allbanners as $singlebanner) {
190
  $starttime = $stoptime = 0;
191
  $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '".$singlebanner->id."' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
@@ -197,7 +197,7 @@ function adrotate_manage() {
197
  if($type == 'active' AND $stoptime <= $now) $type = 'expired';
198
 
199
  if($type == 'active' OR $type == '7days') {
200
- $activebanners[$singlebanner->id] = array(
201
  'id' => $singlebanner->id,
202
  'title' => $singlebanner->title,
203
  'type' => $type,
@@ -209,7 +209,7 @@ function adrotate_manage() {
209
  }
210
 
211
  if($type == 'error' OR $type == 'expired' OR $type == '2days') {
212
- $errorbanners[$singlebanner->id] = array(
213
  'id' => $singlebanner->id,
214
  'title' => $singlebanner->title,
215
  'type' => $type,
@@ -221,7 +221,7 @@ function adrotate_manage() {
221
  }
222
 
223
  if($type == 'disabled') {
224
- $disabledbanners[$singlebanner->id] = array(
225
  'id' => $singlebanner->id,
226
  'title' => $singlebanner->title,
227
  'type' => $type,
@@ -244,14 +244,14 @@ function adrotate_manage() {
244
  <?php
245
  if ($view == "" OR $view == "manage") {
246
  // Show list of errorous ads if any
247
- if ($errorbanners) {
248
  include("dashboard/publisher/adverts-error.php");
249
  }
250
 
251
  include("dashboard/publisher/adverts-main.php");
252
 
253
  // Show disabled ads, if any
254
- if ($disabledbanners) {
255
  include("dashboard/publisher/adverts-disabled.php");
256
  }
257
  } else if($view == "addnew" OR $view == "edit") {
@@ -399,6 +399,7 @@ function adrotate_options() {
399
 
400
  $adevaluate = wp_next_scheduled('adrotate_evaluate_ads');
401
  $adschedule = wp_next_scheduled('adrotate_notification');
 
402
 
403
  include("dashboard/settings/maintenance.php");
404
  } elseif($active_tab == 'license') {
7
  Description: The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
  Domain Path: /languages/
10
+ Version: 3.18
11
  License: GPLv3
12
  */
13
 
22
  ------------------------------------------------------------------------------------ */
23
 
24
  /*--- AdRotate values ---------------------------------------*/
25
+ define("ADROTATE_DISPLAY", '3.18');
26
+ define("ADROTATE_VERSION", 386);
27
  define("ADROTATE_DB_VERSION", 60);
28
  /*-----------------------------------------------------------*/
29
 
185
 
186
  $allbanners = $wpdb->get_results("SELECT `id`, `title`, `type`, `tracker`, `weight` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' OR `type` != 'a_empty' OR `type` != 'queue') ORDER BY `id` ASC;");
187
 
188
+ $active = $disabled = $error = false;
189
  foreach($allbanners as $singlebanner) {
190
  $starttime = $stoptime = 0;
191
  $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '".$singlebanner->id."' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
197
  if($type == 'active' AND $stoptime <= $now) $type = 'expired';
198
 
199
  if($type == 'active' OR $type == '7days') {
200
+ $active[$singlebanner->id] = array(
201
  'id' => $singlebanner->id,
202
  'title' => $singlebanner->title,
203
  'type' => $type,
209
  }
210
 
211
  if($type == 'error' OR $type == 'expired' OR $type == '2days') {
212
+ $error[$singlebanner->id] = array(
213
  'id' => $singlebanner->id,
214
  'title' => $singlebanner->title,
215
  'type' => $type,
221
  }
222
 
223
  if($type == 'disabled') {
224
+ $disabled[$singlebanner->id] = array(
225
  'id' => $singlebanner->id,
226
  'title' => $singlebanner->title,
227
  'type' => $type,
244
  <?php
245
  if ($view == "" OR $view == "manage") {
246
  // Show list of errorous ads if any
247
+ if ($error) {
248
  include("dashboard/publisher/adverts-error.php");
249
  }
250
 
251
  include("dashboard/publisher/adverts-main.php");
252
 
253
  // Show disabled ads, if any
254
+ if ($disabled) {
255
  include("dashboard/publisher/adverts-disabled.php");
256
  }
257
  } else if($view == "addnew" OR $view == "edit") {
399
 
400
  $adevaluate = wp_next_scheduled('adrotate_evaluate_ads');
401
  $adschedule = wp_next_scheduled('adrotate_notification');
402
+ $transients = wp_next_scheduled('adrotate_delete_transients');
403
 
404
  include("dashboard/settings/maintenance.php");
405
  } elseif($active_tab == 'license') {
dashboard/publisher/adverts-disabled.php CHANGED
@@ -42,9 +42,9 @@
42
  </thead>
43
  <tbody>
44
  <?php
45
- foreach($disabledbanners as $disbanner) {
46
- $stats = adrotate_stats($disbanner['id']);
47
- $grouplist = adrotate_ad_is_in_groups($disbanner['id']);
48
 
49
  // Prevent gaps in display
50
  $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
@@ -52,28 +52,25 @@
52
  if($adrotate_debug['publisher'] == true) {
53
  echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='9'><pre>";
54
  echo "Ad Specs: <pre>";
55
- print_r($disbanner);
56
  echo "</pre>";
57
  echo "Stats: <pre>";
58
  print_r($stats);
59
  echo "</pre></td></tr>";
60
  }
61
 
62
- $grouplist = adrotate_ad_is_in_groups($disbanner['id']);
63
 
64
- if($disbanner['type'] == 'disabled') {
65
- $errorclass = ' row_inactive';
66
- } else {
67
- $errorclass = '';
68
- }
69
  ?>
70
  <tr id='adrotateindex' class='<?php echo $errorclass; ?>'>
71
- <th class="check-column"><input type="checkbox" name="disabledbannercheck[]" value="<?php echo $disbanner['id']; ?>" /></th>
72
- <td><center><?php echo $disbanner['id'];?></center></td>
73
- <td><?php echo date_i18n("F d, Y", $disbanner['firstactive']);?><br /><span style="color: <?php echo adrotate_prepare_color($disbanner['lastactive']);?>;"><?php echo date_i18n("F d, Y", $disbanner['lastactive']);?></span></td>
74
- <td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=edit&ad='.$disbanner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($disbanner['title']));?></a></strong> - <a href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=report&ad='.$disbanner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></td>
75
  <td><center><?php echo $stats['impressions']; ?></center></td>
76
- <?php if($disbanner['tracker'] == "Y") { ?>
77
  <td><center><?php echo $stats['clicks']; ?></center></td>
78
  <td><center><?php echo $ctr; ?> %</center></td>
79
  <?php } else { ?>
42
  </thead>
43
  <tbody>
44
  <?php
45
+ foreach($disabled as $banner) {
46
+ $stats = adrotate_stats($banner['id']);
47
+ $grouplist = adrotate_ad_is_in_groups($banner['id']);
48
 
49
  // Prevent gaps in display
50
  $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
52
  if($adrotate_debug['publisher'] == true) {
53
  echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='9'><pre>";
54
  echo "Ad Specs: <pre>";
55
+ print_r($banner);
56
  echo "</pre>";
57
  echo "Stats: <pre>";
58
  print_r($stats);
59
  echo "</pre></td></tr>";
60
  }
61
 
62
+ $grouplist = adrotate_ad_is_in_groups($banner['id']);
63
 
64
+ $errorclass = '';
65
+ if($banner['type'] == 'disabled') $errorclass = ' row_blue';
 
 
 
66
  ?>
67
  <tr id='adrotateindex' class='<?php echo $errorclass; ?>'>
68
+ <th class="check-column"><input type="checkbox" name="disabledbannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
69
+ <td><center><?php echo $banner['id'];?></center></td>
70
+ <td><?php echo date_i18n("F d, Y", $banner['firstactive']);?><br /><span style="color: <?php echo adrotate_prepare_color($banner['lastactive']);?>;"><?php echo date_i18n("F d, Y", $banner['lastactive']);?></span></td>
71
+ <td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=edit&ad='.$banner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($banner['title']));?></a></strong> - <a href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=report&ad='.$disbanner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></td>
72
  <td><center><?php echo $stats['impressions']; ?></center></td>
73
+ <?php if($banner['tracker'] == "Y") { ?>
74
  <td><center><?php echo $stats['clicks']; ?></center></td>
75
  <td><center><?php echo $ctr; ?> %</center></td>
76
  <?php } else { ?>
dashboard/publisher/adverts-error.php CHANGED
@@ -42,26 +42,26 @@
42
  </tr>
43
  </thead>
44
  <tbody>
45
- <?php foreach($errorbanners as $errbanner) {
46
  $grouplist = adrotate_ad_is_in_groups($errbanner['id']);
47
 
48
  if($adrotate_debug['publisher'] == true) {
49
  echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='9'>";
50
  echo "Ad Specs: <pre>";
51
- print_r($errbanner);
52
  echo "</pre></td></tr>";
53
  }
54
 
55
  $errorclass = '';
56
- if($errbanner['type'] == 'error') $errorclass = ' row_error';
57
- if($errbanner['type'] == 'expired') $errorclass = ' row_inactive';
58
- if($errbanner['type'] == '2days') $errorclass = ' row_urgent';
59
  ?>
60
  <tr id='adrotateindex' class='<?php echo $errorclass; ?>'>
61
- <th class="check-column"><input type="checkbox" name="errorbannercheck[]" value="<?php echo $errbanner['id']; ?>" /></th>
62
- <td><center><?php echo $errbanner['id'];?></center></td>
63
- <td><?php echo date_i18n("F d, Y", $errbanner['firstactive']);?><br /><span style="color: <?php echo adrotate_prepare_color($errbanner['lastactive']);?>;"><?php echo date_i18n("F d, Y", $errbanner['lastactive']);?></span></td>
64
- <td><strong><a class="row-title" href="<?php echo admin_url("/admin.php?page=adrotate-ads&view=edit&ad=".$errbanner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($errbanner['title']));?></a></strong> - <a href="<?php echo admin_url("/admin.php?page=adrotate-ads&view=report&ad=".$errbanner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></span></td>
65
  </tr>
66
  <?php } ?>
67
  </tbody>
42
  </tr>
43
  </thead>
44
  <tbody>
45
+ <?php foreach($error as $banner) {
46
  $grouplist = adrotate_ad_is_in_groups($errbanner['id']);
47
 
48
  if($adrotate_debug['publisher'] == true) {
49
  echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='9'>";
50
  echo "Ad Specs: <pre>";
51
+ print_r($banner);
52
  echo "</pre></td></tr>";
53
  }
54
 
55
  $errorclass = '';
56
+ if($banner['type'] == 'error') $errorclass = ' row_yellow';
57
+ if($banner['type'] == 'expired') $errorclass = ' row_blue';
58
+ if($banner['type'] == '2days') $errorclass = ' row_red';
59
  ?>
60
  <tr id='adrotateindex' class='<?php echo $errorclass; ?>'>
61
+ <th class="check-column"><input type="checkbox" name="errorbannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
62
+ <td><center><?php echo $banner['id'];?></center></td>
63
+ <td><?php echo date_i18n("F d, Y", $banner['firstactive']);?><br /><span style="color: <?php echo adrotate_prepare_color($banner['lastactive']);?>;"><?php echo date_i18n("F d, Y", $banner['lastactive']);?></span></td>
64
+ <td><strong><a class="row-title" href="<?php echo admin_url("/admin.php?page=adrotate-ads&view=edit&ad=".$banner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($banner['title']));?></a></strong> <?php if($adrotate_config['stats'] == 1 AND $banner['type'] != 'error') { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=report&ad='.$banner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><?php } ?><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></span></td>
65
  </tr>
66
  <?php } ?>
67
  </tbody>
dashboard/publisher/adverts-main.php CHANGED
@@ -51,9 +51,9 @@
51
  </thead>
52
  <tbody>
53
  <?php
54
- if ($activebanners) {
55
  $class = '';
56
- foreach($activebanners as $banner) {
57
  $stats = adrotate_stats($banner['id']);
58
  $stats_today = adrotate_stats($banner['id'], adrotate_date_start('day'));
59
  $grouplist = adrotate_ad_is_in_groups($banner['id']);
@@ -73,12 +73,7 @@
73
  echo "</pre></td></tr>";
74
  }
75
 
76
- if($class != 'alternate') {
77
- $class = 'alternate';
78
- } else {
79
- $class = '';
80
- }
81
-
82
  ?>
83
  <tr id='adrotateindex' class='<?php echo $class; ?>'>
84
  <th class="check-column"><input type="checkbox" name="bannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
51
  </thead>
52
  <tbody>
53
  <?php
54
+ if ($active) {
55
  $class = '';
56
+ foreach($active as $banner) {
57
  $stats = adrotate_stats($banner['id']);
58
  $stats_today = adrotate_stats($banner['id'], adrotate_date_start('day'));
59
  $grouplist = adrotate_ad_is_in_groups($banner['id']);
73
  echo "</pre></td></tr>";
74
  }
75
 
76
+ $class = ($class != 'alternate') ? 'alternate' : '';
 
 
 
 
 
77
  ?>
78
  <tr id='adrotateindex' class='<?php echo $class; ?>'>
79
  <th class="check-column"><input type="checkbox" name="bannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
dashboard/publisher/groups-edit.php CHANGED
@@ -340,9 +340,9 @@ if(!is_array($meta_array)) $meta_array = array();
340
  }
341
 
342
  $errorclass = '';
343
- if($ad->type == 'error') $errorclass = ' row_error';
344
- if($stoptime <= $in2days OR $stoptime <= $in7days) $errorclass = ' row_urgent';
345
- if($stoptime <= $now) $errorclass = ' row_inactive';
346
 
347
  $class = ('alternate' != $class) ? 'alternate' : '';
348
  $class = ($errorclass != '') ? $errorclass : $class;
340
  }
341
 
342
  $errorclass = '';
343
+ if($ad->type == 'error') $errorclass = ' row_yellow';
344
+ if($stoptime <= $in2days OR $stoptime <= $in7days) $errorclass = ' row_red';
345
+ if($stoptime <= $now) $errorclass = ' row_blue';
346
 
347
  $class = ('alternate' != $class) ? 'alternate' : '';
348
  $class = ($errorclass != '') ? $errorclass : $class;
dashboard/settings/maintenance.php CHANGED
@@ -29,7 +29,8 @@
29
  <td>
30
  <input type="submit" id="post-role-submit" name="adrotate_db_cleanup_submit" value="<?php _e('Clean-up Database', 'adrotate'); ?>" class="button-secondary" onclick="return confirm('<?php _e('You are about to clean up your database. This may delete expired schedules and older statistics.', 'adrotate'); ?>\n\n<?php _e('Are you sure you want to continue?', 'adrotate'); ?>\n\n<?php _e('This might take a while and may slow down your site during this action!', 'adrotate'); ?>\n\n<?php _e('OK to continue, CANCEL to stop.', 'adrotate'); ?>')" /><br />
31
  <label for="adrotate_db_cleanup_statistics"><input type="checkbox" name="adrotate_db_cleanup_statistics" value="1" /> <?php _e('Delete stats older than 356 days (Optional).', 'adrotate'); ?></label><br />
32
- <span class="description"><?php _e('AdRotate creates empty records when you start making ads, groups or schedules. In rare occasions these records are faulty.', 'adrotate'); ?><br /><?php _e('If you made an ad, group or schedule that does not save when you make it use this button to delete those empty records.', 'adrotate'); ?><br /><?php _e('Additionally you can clean up old schedules and/or statistics. This will improve the speed of your site.', 'adrotate'); ?></span>
 
33
  </td>
34
  </tr>
35
  <tr>
@@ -75,8 +76,8 @@
75
  <tr>
76
  <th width="15%"><?php _e('Advert evaluation', 'adrotate'); ?></th>
77
  <td><?php if(!$adevaluate) '<span style="color:#CC2900;">'._e('Not scheduled! Re-activate the plugin from the plugins page.', 'adrotate-pro').'</span>'; else echo '<span style="color:#009900;">'.date_i18n(get_option('date_format')." H:i", $adevaluate).'</span>'; ?></td>
78
- <th width="15%">&nbsp;</th>
79
- <td>&nbsp;</td>
80
  </tr>
81
  </table>
82
 
29
  <td>
30
  <input type="submit" id="post-role-submit" name="adrotate_db_cleanup_submit" value="<?php _e('Clean-up Database', 'adrotate'); ?>" class="button-secondary" onclick="return confirm('<?php _e('You are about to clean up your database. This may delete expired schedules and older statistics.', 'adrotate'); ?>\n\n<?php _e('Are you sure you want to continue?', 'adrotate'); ?>\n\n<?php _e('This might take a while and may slow down your site during this action!', 'adrotate'); ?>\n\n<?php _e('OK to continue, CANCEL to stop.', 'adrotate'); ?>')" /><br />
31
  <label for="adrotate_db_cleanup_statistics"><input type="checkbox" name="adrotate_db_cleanup_statistics" value="1" /> <?php _e('Delete stats older than 356 days (Optional).', 'adrotate'); ?></label><br />
32
+ <label for="adrotate_db_cleanup_trackerdata"><input type="checkbox" name="adrotate_db_cleanup_trackerdata" value="1" /> <?php _e('Delete old tracker data. (Does nothing if you use a memcached plugin)', 'adrotate-pro'); ?></label><br />
33
+ <span class="description"><?php _e('For when you create an advert, group or schedule and it does not save or keep changes you make.', 'adrotate-pro'); ?><br /><?php _e('Additionally you can clean up old schedules, tracker data and/or statistics. This will improve the speed of your site.', 'adrotate-pro'); ?></span>
34
  </td>
35
  </tr>
36
  <tr>
76
  <tr>
77
  <th width="15%"><?php _e('Advert evaluation', 'adrotate'); ?></th>
78
  <td><?php if(!$adevaluate) '<span style="color:#CC2900;">'._e('Not scheduled! Re-activate the plugin from the plugins page.', 'adrotate-pro').'</span>'; else echo '<span style="color:#009900;">'.date_i18n(get_option('date_format')." H:i", $adevaluate).'</span>'; ?></td>
79
+ <th width="15%"><?php _e('Clean Transients', 'adrotate'); ?></th>
80
+ <td><?php if(!$transients) '<span style="color:#CC2900;">'._e('Not scheduled! Re-activate the plugin from the plugins page.', 'adrotate').'</span>'; else echo '<span style="color:#009900;">'.date_i18n(get_option('date_format')." H:i", $transients).'</span>'; ?></td>
81
  </tr>
82
  </table>
83
 
dashboard/settings/statistics.php CHANGED
@@ -67,6 +67,12 @@
67
  <span class="description"><?php _e('Default: 86400.', 'adrotate'); ?> <?php _e('This number may not be empty, be lower than 60 or exceed 86400 (24 hours).', 'adrotate'); ?></span>
68
  </td>
69
  </tr>
 
 
 
 
 
 
70
  </table>
71
 
72
  <p class="submit">
67
  <span class="description"><?php _e('Default: 86400.', 'adrotate'); ?> <?php _e('This number may not be empty, be lower than 60 or exceed 86400 (24 hours).', 'adrotate'); ?></span>
68
  </td>
69
  </tr>
70
+ <tr>
71
+ <th valign="top"><?php _e('Clean up temporary data', 'adrotate'); ?></th>
72
+ <td>
73
+ <input type="checkbox" name="adrotate_enable_clean_trackerdata" <?php if($adrotate_config['enable_clean_trackerdata'] == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Periodically delete old tracker data. If you are using a memcached plugin you should disable this option!', 'adrotate'); ?>
74
+ </td>
75
+ </tr>
76
  </table>
77
 
78
  <p class="submit">
library/dashboard.css CHANGED
@@ -4,11 +4,11 @@
4
  .adrotate_impressions { color: #F80; font-weight: normal }
5
 
6
  /* styles for advert statuses and stats */
7
- .row_urgent, .row_red { background-color:#ffebe8; border-color:#c00; }
8
  .row_orange { background-color: #fdefc3; border-color: #c80; }
9
- .row_error, .row_yellow { background-color:#ffffe0; border-color:#e6db55; }
10
- .row_inactive, .row_blue { background-color:#ebf3fa; border-color:#466f82; }
11
- .row_active, .row_green { background-color: #e5faee; border-color: #518257; }
12
  .stats_large { display: block; margin-bottom: 10px; margin-top: 10px; text-align: center; font-weight: bold; }
13
  .number_large { margin: 20px; font-size: 28px; }
14
 
4
  .adrotate_impressions { color: #F80; font-weight: normal }
5
 
6
  /* styles for advert statuses and stats */
7
+ .row_red { background-color:#ffebe8; border-color:#c00; }
8
  .row_orange { background-color: #fdefc3; border-color: #c80; }
9
+ .row_yellow { background-color:#ffffe0; border-color:#e6db55; }
10
+ .row_blue { background-color:#ebf3fa; border-color:#466f82; }
11
+ .row_green { background-color: #e5faee; border-color: #518257; }
12
  .stats_large { display: block; margin-bottom: 10px; margin-top: 10px; text-align: center; font-weight: bold; }
13
  .number_large { margin: 20px; font-size: 28px; }
14
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === AdRotate ===
2
  Contributors: adegans
3
  Donate link: http://www.arnan.me/donate/?utm_campaign=donations&utm_medium=readme&utm_source=adrotate-free
4
- Tags: ads, advert, adverts, banner, monetize, admin, advertise, adrotator, rotator, ad, advertising, advertisement, advertiser, publisher, adsense, chitika, clickbank, broadstreet, geo, geolocation, geotarget, banner manager, advert manager, campaign manager, export, import, maxmind, statistics, stats, report, geoselect, geolite, schedules, schedule, monetize, header, widget, html5 advert, javascript advert, tracking, clicks, impressions, rotate, zone, zones, sidebar, footer, content, posts, pages
5
  Requires at least: 3.8
6
  Tested up to: 4.7
7
- Stable tag: 3.17
8
  License: GPLv3
9
 
10
  The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
@@ -97,31 +97,19 @@ You can also post your questions on the [forum](https://ajdg.solutions/forums/?u
97
 
98
  Be a Pro and go Pro. With [AdRotate Pro](https://ajdg.solutions/products/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
99
 
100
- = 3.17 FREE =
101
- * [new] Usage of WP Object Cache for stats
102
- * [new] Moved tracker data to WP Transient API
103
- * [change] Stats now counted per hour instead of per day
104
- * [change] Updated Elycharts to v2.1.6
105
- * [fix] Post Injection not always in the right location for categories
106
- * [fix] Tracking hash split in the right values
107
- * [fix] Graph date labels showing through each other
108
-
109
- = 4.2 PRO =
110
- * [new] Usage of WP Object Cache for stats
111
- * [new] Moved tracker data to WP Transient API
112
- * [change] Stats now counted per hour instead of per day
113
- * [change] Updated Elycharts to v2.1.6
114
- * [fix] Impressions now always show on adverts dashboard
115
- * [fix] Post Injection not always in the right location for categories
116
- * [fix] Undefined notice on Main AdRotate dashboard
117
- * [fix] Undefined notice on Transactions dashboard
118
- * [fix] Hide relevant dashboard links if advertisers are disabled
119
- * [fix] Count correct number of hourly impressions
120
- * [fix] Tracking hash split in the right values
121
- * [fix] 'best' and 'least' advert counts showing wrong numbers
122
- * [fix] Graph date labels showing through each other
123
- * [fix] Not all Geo Targeting strings translated
124
- * [i18n] Polish translation via Michal
125
 
126
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
127
 
@@ -129,14 +117,9 @@ NOTE: Unsolicited offers, parnterships, job offers, promotional emails or produc
129
 
130
  == Upgrade Notice ==
131
 
132
- = 3.16.3 =
133
- * [new] Usage of WP Object Cache for stats
134
- * [new] Moved tracker data to WP Transient API
135
- * [change] Stats now counted per hour instead of per day
136
- * [change] Updated Elycharts to v2.1.6
137
- * [fix] Post Injection not always in the right location for categories
138
- * [fix] Tracking hash split in the right values
139
- * [fix] Graph date labels showing through each other
140
 
141
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
142
 
1
  === AdRotate ===
2
  Contributors: adegans
3
  Donate link: http://www.arnan.me/donate/?utm_campaign=donations&utm_medium=readme&utm_source=adrotate-free
4
+ Tags: ads, advert, adverts, banner, monetize, admin, advertise, adrotator, rotator, ad, advertising, advertisement, advertiser, publisher, adsense, chitika, clickbank, geo, geolocation, geotarget, banner manager, advert manager, campaign manager, maxmind, statistics, stats, report, geoselect, geolite, schedules, schedule, monetize, header, widget, html5 advert, javascript advert, tracking, clicks, impressions
5
  Requires at least: 3.8
6
  Tested up to: 4.7
7
+ Stable tag: 3.18
8
  License: GPLv3
9
 
10
  The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
97
 
98
  Be a Pro and go Pro. With [AdRotate Pro](https://ajdg.solutions/products/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
99
 
100
+ = 3.18 FREE =
101
+ * [new] Maintenance function to clean up AdRotate transients
102
+ * [fix] Stats link not always showing for expired adverts
103
+
104
+ = 4.2.1 PRO =
105
+ * [new] Maintenance function to clean up AdRotate transients
106
+ * [change] Clearer color-scheme for schedules that are expiring
107
+ * [fix] Advertiser dropdown no longer shows non-advertiser
108
+ * [fix] Stats link not showing for expired adverts
109
+ * [fix] Graphs showing hourly stats instead of days
110
+ * [fix] Unexpected output when activating the plugin
111
+ * [fix] Periodic stats table misaligned for advert stats
112
+ * [i18n] Added missing translation strings for settings tabs
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
115
 
117
 
118
  == Upgrade Notice ==
119
 
120
+ = 3.18 =
121
+ * [new] Maintenance function to clean up AdRotate transients
122
+ * [fix] Stats link not always showing for expired adverts
 
 
 
 
 
123
 
124
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
125