AdRotate Banner Manager - Version 4.6

Version Description

FREE = * [new] Better stats display * [fix] Improved PHP7 compatibility * [fix] Schedule properly removed when removing advert * [change] Dashboard tweaks and improvements

Download this release

Release Info

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

Code changes from version 4.5 to 4.6

adrotate-functions.php CHANGED
@@ -673,7 +673,7 @@ function adrotate_dashboard_styles() {
673
674
/*-------------------------------------------------------------
675
Name: adrotate_folder_contents
676
- Purpose: List folder contents of /wp-content/banners
677
Since: 0.4
678
-------------------------------------------------------------*/
679
function adrotate_folder_contents($current, $kind = 'all') {
@@ -722,6 +722,49 @@ function adrotate_folder_contents($current, $kind = 'all') {
722
return $output;
723
}
724
725
/*-------------------------------------------------------------
726
Name: adrotate_return
727
Purpose: Internal redirects
673
674
/*-------------------------------------------------------------
675
Name: adrotate_folder_contents
676
+ Purpose: Populate dropdown menu for creating adverts with relevant assets
677
Since: 0.4
678
-------------------------------------------------------------*/
679
function adrotate_folder_contents($current, $kind = 'all') {
722
return $output;
723
}
724
725
+ /*-------------------------------------------------------------
726
+ Name: adrotate_subfolder_contents
727
+ Purpose: List sub-folder contents for media manager
728
+ Since: 4.9
729
+ -------------------------------------------------------------*/
730
+ function adrotate_subfolder_contents($asset_folder, $level = 1) {
731
+ $index = $assets = array();
732
+
733
+ // Read Banner folder
734
+ if($handle = opendir($asset_folder)) {
735
+ while(false !== ($file = readdir($handle))) {
736
+ if($file != "." AND $file != ".." AND $file != "index.php" AND $file != ".DS_Store") {
737
+ $assets[] = $file;
738
+ }
739
+ }
740
+ closedir($handle);
741
+
742
+ if(count($assets) > 0) {
743
+ $new_level = $level + 1;
744
+ $extensions = array('jpg', 'jpeg', 'gif', 'png', 'swf', 'flv', 'html', 'htm', 'js');
745
+
746
+ foreach($assets as $key => $asset) {
747
+ $fileinfo = pathinfo($asset);
748
+ unset($fileinfo['dirname']);
749
+ if(is_dir($asset_folder.'/'.$asset)) { // Read subfolder
750
+ if($level <= 2) { // Not to deep
751
+ $fileinfo['contents'] = adrotate_subfolder_contents($asset_folder.'/'.$asset, $new_level);
752
+ $index[] = $fileinfo;
753
+ }
754
+ } else { // It's a file
755
+ if(in_array($fileinfo['extension'], $extensions)) {
756
+ $index[] = $fileinfo;
757
+ }
758
+ }
759
+ unset($fileinfo);
760
+ }
761
+ unset($level, $new_level);
762
+ }
763
+ }
764
+
765
+ return $index;
766
+ }
767
+
768
/*-------------------------------------------------------------
769
Name: adrotate_return
770
Purpose: Internal redirects
adrotate-manage-publisher.php CHANGED
@@ -561,6 +561,8 @@ function adrotate_delete($id, $what) {
561
562
if($id > 0) {
563
if($what == 'banner') {
564
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `id` = %d;", $id));
565
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = %d;", $id));
566
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d;", $id));
561
562
if($id > 0) {
563
if($what == 'banner') {
564
+ $schedule_id = $wpdb->get_row($wpdb->prepare("SELECT `schedule` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = %d AND `group` = '0' AND `user` = '0' AND `schedule` != '0';", $id));
565
+ $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_schedules` WHERE `id` = %d;", $schedule_id));
566
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `id` = %d;", $id));
567
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = %d;", $id));
568
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d;", $id));
adrotate-output.php CHANGED
@@ -676,29 +676,24 @@ function adrotate_notifications_dashboard() {
676
677
if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = ''; }
678
if(strpos($page, 'adrotate') !== false) {
679
-
680
- if(isset($_GET['hide']) AND $_GET['hide'] == 1) update_option('adrotate_hide_banner', 1);
681
if(isset($_GET['hide']) AND $_GET['hide'] == 2) update_option('adrotate_hide_review', 1);
682
if(isset($_GET['hide']) AND $_GET['hide'] == 3) update_option('adrotate_hide_competition', 1);
683
684
$pro_banner = get_option('adrotate_hide_banner');
685
- if($pro_banner != 1 AND $pro_banner < (adrotate_now() - 604800)) {
686
- echo '<div class="updated" style="padding: 0; margin: 0;">';
687
- echo ' <div class="ajdg_notification">';
688
- echo ' <div class="button_div"><a class="button" target="_blank" href="https://ajdg.solutions/products/adrotate-for-wordpress/?add-to-cart=1126&utm_campaign=adrotate-page&utm_medium=upgrade-banner-button&utm_source=adrotate-free">'.__('Buy now', 'adrotate').'</a></div>';
689
- echo ' <div class="text">'.__("You've been using <strong>AdRotate</strong> for a while now. Why not upgrade to the <strong>PRO</strong> version", 'adrotate').'?<br /><span>'.__('Use discount code <b>getadrotatepro</b> for 10% off on any AdRotate license!', 'adrotate' ).' '.__('Thank you for your purchase!', 'adrotate' ).'</span></div>';
690
- echo ' <a class="close_notification" href="admin.php?page=adrotate&hide=1"><img title="Close" src="'.plugins_url('/images/icon-close.png', __FILE__).'" alt=""/></a>';
691
- echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
692
- echo ' </div>';
693
- echo '</div>';
694
- }
695
696
$review_banner = get_option('adrotate_hide_review');
697
- if($review_banner != 1 AND $review_banner < (adrotate_now() - 2419200)) {
698
echo '<div class="updated" style="padding: 0; margin: 0;">';
699
echo ' <div class="ajdg_notification">';
700
echo ' <div class="button_div"><a class="button" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Rate AdRotate</a></div>';
701
- echo ' <div class="text">If you like <strong>AdRotate</strong> please let the world know that you do. Thanks for your support!<br /><span>If you have questions, suggestions or something else that doesn\'t belong in a review, please <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/?utm_campaign=adrotate-forum&utm_medium=review-banner&utm_source=adrotate-free" target="_blank">get in touch</a>!</span></div>';
702
echo ' <a class="close_notification" href="admin.php?page=adrotate&hide=2"><img title="Close" src="'.plugins_url('/images/icon-close.png', __FILE__).'" alt=""/></a>';
703
echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
704
echo ' </div>';
676
677
if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = ''; }
678
if(strpos($page, 'adrotate') !== false) {
679
if(isset($_GET['hide']) AND $_GET['hide'] == 2) update_option('adrotate_hide_review', 1);
680
if(isset($_GET['hide']) AND $_GET['hide'] == 3) update_option('adrotate_hide_competition', 1);
681
682
$pro_banner = get_option('adrotate_hide_banner');
683
+ echo '<div class="updated" style="padding: 0; margin: 0;">';
684
+ echo ' <div class="ajdg_notification">';
685
+ echo ' <div class="button_div"><a class="button" target="_blank" href="https://ajdg.solutions/products/adrotate-for-wordpress/?add-to-cart=1126&utm_campaign=adrotate-page&utm_medium=upgrade-banner-button&utm_source=adrotate-free">'.__('Buy now', 'adrotate').'</a></div>';
686
+ echo ' <div class="text">'.__("If you like <strong>AdRotate</strong>, please consider upgrading to the <strong>PRO</strong> version and get more features.", 'adrotate').'<br /><span>'.__('Use discount code <b>getadrotatepro</b> for 10% off on any AdRotate license!', 'adrotate' ).' '.__('Thank you for your support!', 'adrotate' ).'</span></div>';
687
+ echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
688
+ echo ' </div>';
689
+ echo '</div>';
690
691
$review_banner = get_option('adrotate_hide_review');
692
+ if($review_banner != 1 AND $review_banner < (adrotate_now() - 1209600)) {
693
echo '<div class="updated" style="padding: 0; margin: 0;">';
694
echo ' <div class="ajdg_notification">';
695
echo ' <div class="button_div"><a class="button" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Rate AdRotate</a></div>';
696
+ echo ' <div class="text">You have been using <strong>AdRotate</strong> for a few days. Rate <strong>AdRotate</strong> with a 5 star review!<br /><span>If you have questions, suggestions or something else that doesn\'t belong in a review, please <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/?utm_campaign=adrotate-forum&utm_medium=review-banner&utm_source=adrotate-free" target="_blank">get in touch</a>!</span></div>';
697
echo ' <a class="close_notification" href="admin.php?page=adrotate&hide=2"><img title="Close" src="'.plugins_url('/images/icon-close.png', __FILE__).'" alt=""/></a>';
698
echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
699
echo ' </div>';
adrotate-setup.php CHANGED
@@ -1200,11 +1200,6 @@ function adrotate_cleanup_database() {
1200
1201
$now = adrotate_now();
1202
1203
- // Delete expired schedules
1204
- if(isset($_POST['adrotate_db_cleanup_schedules'])) {
1205
- $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_schedule` WHERE `stoptime` < $now;");
1206
- }
1207
-
1208
// Delete old stats
1209
if(isset($_POST['adrotate_db_cleanup_statistics'])) {
1210
$lastyear = $now - 30758400;
1200
1201
$now = adrotate_now();
1202
1203
// Delete old stats
1204
if(isset($_POST['adrotate_db_cleanup_statistics'])) {
1205
$lastyear = $now - 30758400;
adrotate-statistics.php CHANGED
@@ -2,7 +2,7 @@
2
/* ------------------------------------------------------------------------------------
3
* COPYRIGHT AND TRADEMARK NOTICE
4
* Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
- * ADROTATE is a trademark of Arnan de Gans.
6
7
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
* By using this code you agree to indemnify Arnan de Gans from any
@@ -11,13 +11,20 @@
11
12
/*-------------------------------------------------------------
13
Name: adrotate_draw_graph
14
Purpose: Draw graph using ElyCharts
15
Since: 3.8
16
-------------------------------------------------------------*/
17
function adrotate_draw_graph($id = 0, $labels = 0, $clicks = 0, $impressions = 0) {
18
19
if($id == 0 OR !is_numeric($id) OR strlen($labels) < 1 OR strlen($clicks) < 1 OR strlen($impressions) < 1) {
20
echo 'Syntax error, graph can not de drawn!';
21
} else {
22
echo '
23
<script type="text/javascript">
@@ -42,16 +49,17 @@ function adrotate_draw_graph($id = 0, $labels = 0, $clicks = 0, $impressions = 0
42
serie2: {
43
axis: "r", color: "#F80", plotProps: { "stroke-width": 2 }, dotProps: { stroke: "white", size: 3, "stroke-width": 1 }
44
}
45
},
46
defaultAxis: {
47
labels: true, labelsProps: { fill: "#777", "font-size": "10px", }, labelsAnchor: "start", labelsMargin: 5, labelsDistance: 8, labelsRotate: 65
48
},
49
axis: {
50
l: { // left axis
51
- labels: true, labelsDistance: 0, labelsSkip: 1, labelsAnchor: "end", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#26B", "font-size": "11px", "font-weight": "bold" }
52
},
53
r: { // right axis
54
- labels: true, labelsDistance: 0, labelsSkip: 1, labelsAnchor: "start", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#F80", "font-size": "11px", "font-weight": "bold" }
55
}
56
},
57
features: {
@@ -84,18 +92,23 @@ function adrotate_draw_graph($id = 0, $labels = 0, $clicks = 0, $impressions = 0
84
Purpose: Generate latest number of clicks and impressions
85
Since: 3.8
86
-------------------------------------------------------------*/
87
- function adrotate_stats($ad, $when = 0, $until = 0) {
88
global $wpdb;
89
-
90
- if($when > 0 AND is_numeric($when) AND $until > 0 AND is_numeric($until)) {
91
- $whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until' GROUP BY `ad` ASC";
92
- } else if($when > 0 AND is_numeric($when) AND $until == 0) {
93
$until = $when + 86400;
94
$whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until'";
95
- } else {
96
$whenquery = "";
97
}
98
99
$ad_query = '';
100
if(is_array($ad)) {
101
$ad_query .= '(';
@@ -107,18 +120,27 @@ function adrotate_stats($ad, $when = 0, $until = 0) {
107
} else {
108
$ad_query = '`ad` = '.$ad;
109
}
110
- $stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE {$ad_query}{$whenquery};", ARRAY_A);
111
112
if(empty($stats['clicks'])) $stats['clicks'] = '0';
113
if(empty($stats['impressions'])) $stats['impressions'] = '0';
114
115
return $stats;
116
-
117
}
118
119
/*-------------------------------------------------------------
120
Name: adrotate_stats_nav
121
Purpose: Create browsable links for graph
122
Since: 3.8
123
-------------------------------------------------------------*/
124
function adrotate_stats_nav($type, $id, $month, $year) {
@@ -135,41 +157,53 @@ function adrotate_stats_nav($type, $id, $month, $year) {
135
$nextmonth = 1;
136
$nextyear = $year + 1;
137
}
138
- $months = array(__('January', 'adrotate'), __('February', 'adrotate'), __('March', 'adrotate'), __('April', 'adrotate'), __('May', 'adrotate'), __('June', 'adrotate'), __('July', 'adrotate'), __('August', 'adrotate'), __('September', 'adrotate'), __('October', 'adrotate'), __('November', 'adrotate'), __('December', 'adrotate'));
139
140
- if($type == 'ads') $page = 'adrotate-ads&view=report&ad='.$id;
141
- if($type == 'groups') $page = 'adrotate-groups&view=report&group='.$id;
142
143
- $nav = '<a href="admin.php?page='.$page.'&month='.$lastmonth.'&year='.$lastyear.'">&lt;&lt; '.__('Previous', 'adrotate').'</a> - ';
144
$nav .= '<strong>'.$months[$month-1].' '.$year.'</strong> - ';
145
- $nav .= '(<a href="admin.php?page='.$page.'">'.__('This month', 'adrotate').'</a>) - ';
146
- $nav .= '<a href="admin.php?page='.$page.'&month='.$nextmonth.'&year='.$nextyear.'">'. __('Next', 'adrotate').' &gt;&gt;</a>';
147
-
148
return $nav;
149
}
150
151
/*-------------------------------------------------------------
152
Name: adrotate_stats_graph
153
Purpose: Generate graph
154
Since: 3.8
155
-------------------------------------------------------------*/
156
- function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
157
global $wpdb;
158
159
if($type == 'ads' OR $type == 'advertiser') {
160
- $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
161
}
162
163
if($type == 'groups') {
164
- $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
165
}
166
167
- if($type == 'global-report') {
168
- $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $start, $end), ARRAY_A);
169
}
170
171
- if($type == 'advertiser-global') {
172
- $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `{$wpdb->prefix}adrotate_stats`.`ad` = `{$wpdb->prefix}adrotate_linkmeta`.`ad` AND `{$wpdb->prefix}adrotate_linkmeta`.`user` = %d AND (`{$wpdb->prefix}adrotate_stats`.`thetime` >= %d AND `{$wpdb->prefix}adrotate_stats`.`thetime` <= %d) GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
173
}
174
175
if($stats) {
@@ -196,6 +230,7 @@ function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
196
if(empty($result['clicks'])) $result['clicks'] = '0';
197
if(empty($result['impressions'])) $result['impressions'] = '0';
198
199
if($result['thetime'] >= $day_start AND $result['thetime'] <= $day_end) {
200
if(empty($graph[$i]['clicks'])) $graph[$i]['clicks'] = '0';
201
if(empty($graph[$i]['impressions'])) $graph[$i]['impressions'] = '0';
@@ -225,11 +260,11 @@ function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
225
$impressions = trim($impressions, ",");
226
227
$output = '';
228
- $output .= '<div id="chart-1" style="height:300px; width:100%;"></div>';
229
$output .= adrotate_draw_graph($chartid, $dates, $clicks, $impressions);
230
unset($stats, $graph, $dates, $clicks, $impressions);
231
} else {
232
- $output = __('No data to show!', 'adrotate');
233
}
234
235
return $output;
@@ -237,7 +272,10 @@ function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
237
238
/*-------------------------------------------------------------
239
Name: adrotate_ctr
240
Purpose: Calculate Click-Through-Rate
241
Since: 3.7
242
-------------------------------------------------------------*/
243
function adrotate_ctr($clicks = 0, $impressions = 0, $round = 2) {
@@ -251,10 +289,103 @@ function adrotate_ctr($clicks = 0, $impressions = 0, $round = 2) {
251
return $ctr;
252
}
253
254
/*-------------------------------------------------------------
255
Name: adrotate_date_start
256
Purpose: Get and return the localized UNIX time for the current hour, day and start of the week
257
- Since: 3.8.5.1
258
-------------------------------------------------------------*/
259
function adrotate_date_start($what) {
260
$now = adrotate_now();
@@ -264,14 +395,14 @@ function adrotate_date_start($what) {
264
switch($what) {
265
case 'hour' :
266
$string_time = gmmktime($matches[4], 0, 0, $matches[2], $matches[3], $matches[1]);
267
- $result = gmdate('U', $string_time + (get_option('gmt_offset') * HOUR_IN_SECONDS));
268
break;
269
case 'day' :
270
$timezone = get_option('timezone_string');
271
if($timezone) {
272
$server_timezone = date('e');
273
date_default_timezone_set($timezone);
274
- $result = strtotime('00:00:00') + (get_option('gmt_offset') * HOUR_IN_SECONDS);
275
date_default_timezone_set($server_timezone);
276
} else {
277
$result = gmdate('U', gmmktime(0, 0, 0, gmdate('n'), gmdate('j')));
@@ -282,39 +413,84 @@ function adrotate_date_start($what) {
282
if($timezone) {
283
$server_timezone = date('e');
284
date_default_timezone_set($timezone);
285
- $result = strtotime('Last Monday', $now) + (get_option('gmt_offset') * HOUR_IN_SECONDS);
286
date_default_timezone_set($server_timezone);
287
} else {
288
$result = gmdate('U', gmmktime(0, 0, 0));
289
}
290
break;
291
}
292
-
293
return $result;
294
}
295
296
/*-------------------------------------------------------------
297
Name: adrotate_now
298
Purpose: Get and return the localized UNIX time for "now"
299
Since: 3.8.6.2
300
-------------------------------------------------------------*/
301
function adrotate_now() {
302
return time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
303
}
304
305
/*-------------------------------------------------------------
306
Name: adrotate_count_impression
307
Purpose: Count Impressions where needed
308
- Since: 3.10.12
309
-------------------------------------------------------------*/
310
function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
311
global $wpdb, $adrotate_config, $adrotate_debug;
312
313
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
314
$now = adrotate_now();
315
- $hour = adrotate_date_start('hour');
316
$remote_ip = adrotate_get_remote_ip();
317
318
if($adrotate_debug['timers'] == true) {
319
$impression_timer = $now;
320
} else {
@@ -322,25 +498,29 @@ function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
322
}
323
324
if($remote_ip != "unknown" AND !empty($remote_ip)) {
325
- $saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `".$wpdb->prefix."adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'i' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
326
if($saved_timer < $impression_timer AND adrotate_is_human()) {
327
- $stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$hour};", $ad, $group));
328
if($stats > 0) {
329
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `impressions` = `impressions` + 1 WHERE `id` = {$stats};");
330
} else {
331
- $wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $hour, 'clicks' => 0, 'impressions' => 1));
332
}
333
334
$wpdb->insert($wpdb->prefix."adrotate_tracker", array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'i'));
335
}
336
}
337
}
338
}
339
340
/*-------------------------------------------------------------
341
Name: adrotate_impression_callback
342
Purpose: Register a impression for dynamic groups
343
- Since: 3.10.14
344
-------------------------------------------------------------*/
345
function adrotate_impression_callback() {
346
define('DONOTCACHEPAGE', true);
@@ -353,7 +533,7 @@ function adrotate_impression_callback() {
353
if($adrotate_debug['track'] != true) {
354
$meta = base64_decode($meta);
355
}
356
-
357
$meta = esc_attr($meta);
358
// Don't use $impression_timer - It's for impressions used in javascript
359
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
@@ -362,11 +542,10 @@ function adrotate_impression_callback() {
362
wp_die();
363
}
364
365
-
366
/*-------------------------------------------------------------
367
Name: adrotate_click_callback
368
Purpose: Register clicks for clicktracking
369
- Since: 3.10.14
370
-------------------------------------------------------------*/
371
function adrotate_click_callback() {
372
define('DONOTCACHEPAGE', true);
@@ -386,12 +565,18 @@ function adrotate_click_callback() {
386
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
387
388
if(is_numeric($ad) AND is_numeric($group) AND is_numeric($blog_id)) {
389
- if(($adrotate_config['enable_loggedin_clicks'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
390
- $remote_ip = adrotate_get_remote_ip();
391
392
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
393
$now = adrotate_now();
394
- $hour = adrotate_date_start('hour');
395
396
if($adrotate_debug['timers'] == true) {
397
$click_timer = $now;
@@ -399,20 +584,27 @@ function adrotate_click_callback() {
399
$click_timer = $now - $adrotate_config['click_timer'];
400
}
401
402
- $saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `".$wpdb->prefix."adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'c' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
403
if($saved_timer < $click_timer) {
404
- $stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$hour};", $ad, $group));
405
if($stats > 0) {
406
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `clicks` = `clicks` + 1 WHERE `id` = {$stats};");
407
} else {
408
- $wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $hour, 'clicks' => 1, 'impressions' => 1));
409
}
410
411
$wpdb->insert($wpdb->prefix.'adrotate_tracker', array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'c'));
412
}
413
}
414
}
415
416
unset($remote_ip, $track, $meta, $ad, $group, $remote, $banner);
417
}
418
2
/* ------------------------------------------------------------------------------------
3
* COPYRIGHT AND TRADEMARK NOTICE
4
* Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
7
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
* By using this code you agree to indemnify Arnan de Gans from any
11
12
/*-------------------------------------------------------------
13
Name: adrotate_draw_graph
14
+
15
Purpose: Draw graph using ElyCharts
16
+ Receive: $id, $labels, $clicks, $impressions
17
+ Return: -None-
18
Since: 3.8
19
-------------------------------------------------------------*/
20
function adrotate_draw_graph($id = 0, $labels = 0, $clicks = 0, $impressions = 0) {
21
22
if($id == 0 OR !is_numeric($id) OR strlen($labels) < 1 OR strlen($clicks) < 1 OR strlen($impressions) < 1) {
23
echo 'Syntax error, graph can not de drawn!';
24
+ echo 'id '.$id;
25
+ echo ' labels '.$labels;
26
+ echo ' clicks '.$clicks;
27
+ echo ' impressions '.$impressions;
28
} else {
29
echo '
30
<script type="text/javascript">
49
serie2: {
50
axis: "r", color: "#F80", plotProps: { "stroke-width": 2 }, dotProps: { stroke: "white", size: 3, "stroke-width": 1 }
51
}
52
+
53
},
54
defaultAxis: {
55
labels: true, labelsProps: { fill: "#777", "font-size": "10px", }, labelsAnchor: "start", labelsMargin: 5, labelsDistance: 8, labelsRotate: 65
56
},
57
axis: {
58
l: { // left axis
59
+ labels: true, labelsSkip: 1, labelsAnchor: "end", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#26B", "font-size": "11px", "font-weight": "bold" }
60
},
61
r: { // right axis
62
+ labels: true, labelsSkip: 1, labelsAnchor: "start", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#F80", "font-size": "11px", "font-weight": "bold" }
63
}
64
},
65
features: {
92
Purpose: Generate latest number of clicks and impressions
93
Since: 3.8
94
-------------------------------------------------------------*/
95
+ function adrotate_stats($ad, $archive = false, $when = 0, $until = 0) {
96
global $wpdb;
97
+
98
+ if($when > 0 AND is_numeric($when) AND $until > 0 AND is_numeric($until)) { // date range
99
+ $whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until' GROUP BY `ad` ASC";
100
+ } else if($when > 0 AND is_numeric($when) AND $until == 0) { // one day
101
$until = $when + 86400;
102
$whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until'";
103
+ } else { // everything
104
$whenquery = "";
105
}
106
107
+ $table = 'adrotate_stats';
108
+ if($archive) {
109
+ $table = 'adrotate_stats_archive';
110
+ }
111
+
112
$ad_query = '';
113
if(is_array($ad)) {
114
$ad_query .= '(';
120
} else {
121
$ad_query = '`ad` = '.$ad;
122
}
123
+
124
+ $cachekey = "adrotate_stats_".md5($ad_query.$whenquery);
125
+ $stats = wp_cache_get($cachekey);
126
+ if(false === $stats) {
127
+ $stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}{$table}` WHERE {$ad_query}{$whenquery};", ARRAY_A);
128
+ wp_cache_set($cachekey, $stats, '', 300);
129
+ }
130
+ unset($cachekey);
131
132
if(empty($stats['clicks'])) $stats['clicks'] = '0';
133
if(empty($stats['impressions'])) $stats['impressions'] = '0';
134
135
return $stats;
136
}
137
138
/*-------------------------------------------------------------
139
Name: adrotate_stats_nav
140
+
141
Purpose: Create browsable links for graph
142
+ Receive: $type, $id, $month, $year
143
+ Return: $nav
144
Since: 3.8
145
-------------------------------------------------------------*/
146
function adrotate_stats_nav($type, $id, $month, $year) {
157
$nextmonth = 1;
158
$nextyear = $year + 1;
159
}
160
+ $months = array(__('January', 'adrotate-pro'), __('February', 'adrotate-pro'), __('March', 'adrotate-pro'), __('April', 'adrotate-pro'), __('May', 'adrotate-pro'), __('June', 'adrotate-pro'), __('July', 'adrotate-pro'), __('August', 'adrotate-pro'), __('September', 'adrotate-pro'), __('October', 'adrotate-pro'), __('November', 'adrotate-pro'), __('December', 'adrotate-pro'));
161
162
+ $page = '';
163
+ if($type == 'ads') $page = 'adrotate-statistics&view=advert&id='.$id;
164
+ if($type == 'groups') $page = 'adrotate-statistics&view=group&id='.$id;
165
+ if($type == 'fullreport') $page = 'adrotate-statistics';
166
+ if($type == 'advertiser') $page = 'adrotate-advertiser&view=report&ad='.$id;
167
+ if($type == 'advertiserfull') $page = 'adrotate-advertiser';
168
169
+ $nav = '<a href="admin.php?page='.$page.'&month='.$lastmonth.'&year='.$lastyear.'">&lt;&lt; '.__('Previous', 'adrotate-pro').'</a> - ';
170
$nav .= '<strong>'.$months[$month-1].' '.$year.'</strong> - ';
171
+ $nav .= '(<a href="admin.php?page='.$page.'">'.__('This month', 'adrotate-pro').'</a>) - ';
172
+ $nav .= '<a href="admin.php?page='.$page.'&month='.$nextmonth.'&year='.$nextyear.'">'. __('Next', 'adrotate-pro').' &gt;&gt;</a>';
173
+
174
return $nav;
175
}
176
177
/*-------------------------------------------------------------
178
Name: adrotate_stats_graph
179
+
180
Purpose: Generate graph
181
+ Receive: $type, $id, $chartid, $start, $end
182
+ Return: $output
183
Since: 3.8
184
-------------------------------------------------------------*/
185
+ function adrotate_stats_graph($type, $archive = false, $id, $chartid, $start, $end, $height = 300) {
186
global $wpdb;
187
188
+ $table = 'adrotate_stats';
189
+ if($archive) {
190
+ $table = 'adrotate_stats_archive';
191
+ }
192
+
193
if($type == 'ads' OR $type == 'advertiser') {
194
+ $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}{$table}` WHERE `ad` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
195
}
196
197
if($type == 'groups') {
198
+ $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}{$table}` WHERE `group` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
199
}
200
201
+ if($type == 'fullreport') {
202
+ $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}{$table}` WHERE `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $start, $end), ARRAY_A);
203
}
204
205
+ if($type == 'advertiserfull') {
206
+ $stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}{$table}`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `{$wpdb->prefix}adrotate_stats`.`ad` = `{$wpdb->prefix}adrotate_linkmeta`.`ad` AND `{$wpdb->prefix}adrotate_linkmeta`.`user` = %d AND `{$wpdb->prefix}adrotate_stats`.`thetime` >= %d AND `{$wpdb->prefix}adrotate_stats`.`thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
207
}
208
209
if($stats) {
230
if(empty($result['clicks'])) $result['clicks'] = '0';
231
if(empty($result['impressions'])) $result['impressions'] = '0';
232
233
+ // Convert hourly stats into daily stats
234
if($result['thetime'] >= $day_start AND $result['thetime'] <= $day_end) {
235
if(empty($graph[$i]['clicks'])) $graph[$i]['clicks'] = '0';
236
if(empty($graph[$i]['impressions'])) $graph[$i]['impressions'] = '0';
260
$impressions = trim($impressions, ",");
261
262
$output = '';
263
+ $output .= '<div id="chart-'.$chartid.'" style="height:'.$height.'px; width:100%;"></div>';
264
$output .= adrotate_draw_graph($chartid, $dates, $clicks, $impressions);
265
unset($stats, $graph, $dates, $clicks, $impressions);
266
} else {
267
+ $output = __('No data to show!', 'adrotate-pro');
268
}
269
270
return $output;
272
273
/*-------------------------------------------------------------
274
Name: adrotate_ctr
275
+
276
Purpose: Calculate Click-Through-Rate
277
+ Receive: $clicks, $impressions, $round
278
+ Return: $ctr
279
Since: 3.7
280
-------------------------------------------------------------*/
281
function adrotate_ctr($clicks = 0, $impressions = 0, $round = 2) {
289
return $ctr;
290
}
291
292
+ /*-------------------------------------------------------------
293
+ Name: adrotate_prepare_fullreport
294
+ Purpose: Generate live stats for admins
295
+ Since: 3.5
296
+ -------------------------------------------------------------*/
297
+ function adrotate_prepare_fullreport() {
298
+ global $wpdb;
299
+
300
+ $today = adrotate_date_start('day');
301
+
302
+ $stats['banners'] = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'active';");
303
+ $stats['tracker'] = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}adrotate` WHERE `tracker` = 'Y' AND `type` = 'active';");
304
+ $stats['overall_clicks'] = $wpdb->get_var("SELECT SUM(`clicks`) as `clicks` FROM `{$wpdb->prefix}adrotate_stats`;");
305
+ $stats['overall_impressions'] = $wpdb->get_var("SELECT SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats`;");
306
+
307
+ $this_month_start = mktime(0, 0, 0, date("m"), 1, date("Y"));
308
+ $this_month_end = mktime(0, 0, 0, date("m"), date("t"), date("Y"));
309
+ $stats['this_month_clicks'] = $wpdb->get_var("SELECT SUM(`clicks`) as `clicks` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$this_month_start} AND `thetime` <= {$this_month_end};");
310
+ $stats['this_month_impressions'] = $wpdb->get_var("SELECT SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$this_month_start} AND `thetime` <= {$this_month_end};");
311
+
312
+ $last_month_start = mktime(0, 0, 0, date("m")-1, 1, date("Y"));
313
+ $last_month_end = mktime(0, 0, 0, date("m"), 0, date("Y"));
314
+ $stats['last_month_clicks'] = $wpdb->get_var("SELECT SUM(`clicks`) as `clicks` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$last_month_start} AND `thetime` <= {$last_month_end};");
315
+ $stats['last_month_impressions'] = $wpdb->get_var("SELECT SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$last_month_start} AND `thetime` <= {$last_month_end};");
316
+
317
+ if(!$stats['banners']) $stats['banners'] = 0;
318
+ if(!$stats['tracker']) $stats['tracker'] = 0;
319
+ if(!$stats['overall_clicks']) $stats['overall_clicks'] = 0;
320
+ if(!$stats['overall_impressions']) $stats['overall_impressions'] = 0;
321
+ if(!$stats['last_month_clicks']) $stats['last_month_clicks'] = 0;
322
+ if(!$stats['last_month_impressions']) $stats['last_month_impressions'] = 0;
323
+ if(!$stats['this_month_clicks']) $stats['this_month_clicks'] = 0;
324
+ if(!$stats['this_month_impressions']) $stats['this_month_impressions'] = 0;
325
+
326
+ return $stats;
327
+ }
328
+
329
+ /*-------------------------------------------------------------
330
+ Name: adrotate_prepare_advertiser_report
331
+
332
+ Purpose: Generate live stats for advertisers
333
+ Receive: $user
334
+ Return: -None-
335
+ Since: 3.5
336
+ -------------------------------------------------------------*/
337
+ function adrotate_prepare_advertiser_report($user, $ads) {
338
+ global $wpdb;
339
+
340
+ if($ads) {
341
+ $stats['ad_amount'] = count($ads);
342
+ if(empty($stats['total_impressions'])) $stats['total_impressions'] = 0;
343
+ if(empty($stats['total_clicks'])) $stats['total_clicks'] = 0;
344
+ if(empty($stats['thebest'])) $stats['thebest'] = array('id' => 0, 'title' => __('Not found', 'adrotate-pro'), 'clicks' => 0);
345
+ if(empty($stats['theworst'])) $stats['theworst'] = array('id' => 0, 'title' => __('Not found', 'adrotate-pro'), 'clicks' => 0);
346
+
347
+ foreach($ads as $ad) {
348
+ $result = adrotate_stats($ad['id']);
349
+ $stats['total_impressions'] = $stats['total_impressions'] + $result['impressions'];
350
+ $stats['total_clicks'] = $stats['total_clicks'] + $result['clicks'];
351
+ unset($result);
352
+ }
353
+
354
+ $stats['thebest'] = $wpdb->get_row($wpdb->prepare("
355
+ SELECT `{$wpdb->prefix}adrotate`.`id`, `{$wpdb->prefix}adrotate`.`title`, SUM(`{$wpdb->prefix}adrotate_stats`.`clicks`) as `clicks`
356
+ FROM `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`
357
+ WHERE `{$wpdb->prefix}adrotate`.`id` = `{$wpdb->prefix}adrotate_linkmeta`.`ad`
358
+ AND `{$wpdb->prefix}adrotate_linkmeta`.`ad` = `{$wpdb->prefix}adrotate_stats`.`ad`
359
+ AND `{$wpdb->prefix}adrotate`.`tracker` = 'Y'
360
+ AND `{$wpdb->prefix}adrotate`.`type` = 'active'
361
+ AND `{$wpdb->prefix}adrotate_linkmeta`.`user` = %d
362
+ GROUP BY `{$wpdb->prefix}adrotate`.`id`
363
+ ORDER BY `{$wpdb->prefix}adrotate_stats`.`clicks` DESC LIMIT 1;
364
+ ", $user), ARRAY_A);
365
+
366
+ $stats['theworst'] = $wpdb->get_row($wpdb->prepare("
367
+ SELECT `{$wpdb->prefix}adrotate`.`id`, `{$wpdb->prefix}adrotate`.`title`, SUM(`{$wpdb->prefix}adrotate_stats`.`clicks`) as `clicks`
368
+ FROM `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`
369
+ WHERE `{$wpdb->prefix}adrotate`.`id` = `{$wpdb->prefix}adrotate_linkmeta`.`ad`
370
+ AND `{$wpdb->prefix}adrotate_linkmeta`.`ad` = `{$wpdb->prefix}adrotate_stats`.`ad`
371
+ AND `{$wpdb->prefix}adrotate`.`tracker` = 'Y'
372
+ AND `{$wpdb->prefix}adrotate`.`type` = 'active'
373
+ AND `{$wpdb->prefix}adrotate_linkmeta`.`user` = %d
374
+ GROUP BY `{$wpdb->prefix}adrotate`.`id`
375
+ ORDER BY `{$wpdb->prefix}adrotate_stats`.`clicks` ASC LIMIT 1;
376
+ ", $user), ARRAY_A);
377
+
378
+ return $stats;
379
+ }
380
+ }
381
+
382
/*-------------------------------------------------------------
383
Name: adrotate_date_start
384
+
385
Purpose: Get and return the localized UNIX time for the current hour, day and start of the week
386
+ Receive: $what
387
+ Return: int
388
+ Since: 3.8.7.1
389
-------------------------------------------------------------*/
390
function adrotate_date_start($what) {
391
$now = adrotate_now();
395
switch($what) {
396
case 'hour' :
397
$string_time = gmmktime($matches[4], 0, 0, $matches[2], $matches[3], $matches[1]);
398
+ $result = gmdate('U', $string_time + (get_option('gmt_offset') * 3600));
399
break;
400
case 'day' :
401
$timezone = get_option('timezone_string');
402
if($timezone) {
403
$server_timezone = date('e');
404
date_default_timezone_set($timezone);
405
+ $result = strtotime('00:00:00') + (get_option('gmt_offset') * 3600);
406
date_default_timezone_set($server_timezone);
407
} else {
408
$result = gmdate('U', gmmktime(0, 0, 0, gmdate('n'), gmdate('j')));
413
if($timezone) {
414
$server_timezone = date('e');
415
date_default_timezone_set($timezone);
416
+ $result = strtotime('Last Monday', $now) + (get_option('gmt_offset') * 3600);
417
date_default_timezone_set($server_timezone);
418
} else {
419
$result = gmdate('U', gmmktime(0, 0, 0));
420
}
421
break;
422
}
423
+
424
return $result;
425
}
426
427
/*-------------------------------------------------------------
428
Name: adrotate_now
429
+
430
Purpose: Get and return the localized UNIX time for "now"
431
+ Receive: -None-
432
+ Return: int
433
Since: 3.8.6.2
434
-------------------------------------------------------------*/
435
function adrotate_now() {
436
return time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
437
}
438
439
+ /*-------------------------------------------------------------
440
+ Name: adrotate_archive_stats
441
+
442
+ Purpose: Move stats into a secondary table when adverst are archived
443
+ Since: 4.0
444
+ -------------------------------------------------------------*/
445
+ function adrotate_archive_stats($id) {
446
+ global $wpdb;
447
+
448
+ $insert = $delete = false;
449
+ $stats = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = {$id} ORDER BY `id` ASC;");
450
+
451
+ foreach($stats as $stat) {
452
+ if($stat->id > 0) {
453
+ $insert[] = "(".$stat->ad.", ".$stat->group.", ".$stat->thetime.", ".$stat->clicks.", ".$stat->impressions.")";
454
+ $delete[] = $stat->id;
455
+ }
456
+ }
457
+
458
+ // Split the data into chunks
459
+ $insert = array_chunk($insert, 30);
460
+
461
+ // Insert each chunk to the archive table
462
+ if(is_array($insert)) {
463
+ foreach($insert as $chunk) {
464
+ $wpdb->query("INSERT INTO `{$wpdb->prefix}adrotate_stats_archive` (`ad`, `group`, `thetime`, `clicks`, `impressions`)
465
+ VALUES ".implode(",", $chunk).";");
466
+ unset($chunk);
467
+ }
468
+
469
+ // Delete old stats
470
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `id` IN (".implode(",", $delete).");");
471
+ }
472
+
473
+ unset($stats, $insert, $delete);
474
+ }
475
+
476
/*-------------------------------------------------------------
477
Name: adrotate_count_impression
478
Purpose: Count Impressions where needed
479
+ Since: 3.11.3
480
-------------------------------------------------------------*/
481
function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
482
global $wpdb, $adrotate_config, $adrotate_debug;
483
484
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
485
$now = adrotate_now();
486
+ $today = adrotate_date_start('day');
487
$remote_ip = adrotate_get_remote_ip();
488
489
+ if($blog_id > 0 AND adrotate_is_networked()) {
490
+ $current_blog = $wpdb->blogid;
491
+ switch_to_blog($blog_id);
492
+ }
493
+
494
if($adrotate_debug['timers'] == true) {
495
$impression_timer = $now;
496
} else {
498
}
499
500
if($remote_ip != "unknown" AND !empty($remote_ip)) {
501
+ $saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `{$wpdb->prefix}adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'i' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
502
if($saved_timer < $impression_timer AND adrotate_is_human()) {
503
+ $stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$today};", $ad, $group));
504
if($stats > 0) {
505
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `impressions` = `impressions` + 1 WHERE `id` = {$stats};");
506
} else {
507
+ $wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $today, 'clicks' => 0, 'impressions' => 1));
508
}
509
510
$wpdb->insert($wpdb->prefix."adrotate_tracker", array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'i'));
511
}
512
}
513
+
514
+ if($blog_id > 0 AND adrotate_is_networked()) {
515
+ switch_to_blog($current_blog);
516
+ }
517
}
518
}
519
520
/*-------------------------------------------------------------
521
Name: adrotate_impression_callback
522
Purpose: Register a impression for dynamic groups
523
+ Since: 3.11.4
524
-------------------------------------------------------------*/
525
function adrotate_impression_callback() {
526
define('DONOTCACHEPAGE', true);
533
if($adrotate_debug['track'] != true) {
534
$meta = base64_decode($meta);
535
}
536
+
537
$meta = esc_attr($meta);
538
// Don't use $impression_timer - It's for impressions used in javascript
539
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
542
wp_die();
543
}
544
545
/*-------------------------------------------------------------
546
Name: adrotate_click_callback
547
Purpose: Register clicks for clicktracking
548
+ Since: 3.11.4
549
-------------------------------------------------------------*/
550
function adrotate_click_callback() {
551
define('DONOTCACHEPAGE', true);
565
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
566
567
if(is_numeric($ad) AND is_numeric($group) AND is_numeric($blog_id)) {
568
569
+ if($blog_id > 0 AND adrotate_is_networked()) {
570
+ $current_blog = $wpdb->blogid;
571
+ switch_to_blog($blog_id);
572
+ }
573
+
574
+ if(($adrotate_config['enable_loggedin_clicks'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
575
+ $remote_ip = adrotate_get_remote_ip();
576
+
577
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
578
$now = adrotate_now();
579
+ $today = adrotate_date_start('day');
580
581
if($adrotate_debug['timers'] == true) {
582
$click_timer = $now;
584
$click_timer = $now - $adrotate_config['click_timer'];
585
}
586
587
+ $saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `{$wpdb->prefix}adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'c' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
588
if($saved_timer < $click_timer) {
589
+ $stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$today};", $ad, $group));
590
if($stats > 0) {
591
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `clicks` = `clicks` + 1 WHERE `id` = {$stats};");
592
} else {
593
+ $wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $today, 'clicks' => 1, 'impressions' => 1));
594
}
595
596
$wpdb->insert($wpdb->prefix.'adrotate_tracker', array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'c'));
597
}
598
+
599
+ // Advertising budget
600
+ $wpdb->query("UPDATE `{$wpdb->prefix}adrotate` SET `budget` = `budget` - `crate` WHERE `id` = {$ad} AND `crate` > 0;");
601
}
602
}
603
604
+ if($blog_id > 0 AND adrotate_is_networked()) {
605
+ switch_to_blog($current_blog);
606
+ }
607
+
608
unset($remote_ip, $track, $meta, $ad, $group, $remote, $banner);
609
}
610
adrotate.php CHANGED
@@ -7,7 +7,7 @@ Author URI: http://ajdg.solutions/?utm_campaign=homepage&utm_medium=plugin-info&
7
Description: Monetise your website with adverts while keeping things simple. Start making money today!
8
Text Domain: adrotate
9
Domain Path: /languages/
10
- Version: 4.5
11
License: GPLv3
12
*/
13
@@ -22,7 +22,7 @@ License: GPLv3
22
------------------------------------------------------------------------------------ */
23
24
/*--- AdRotate values ---------------------------------------*/
25
- define("ADROTATE_DISPLAY", '4.5');
26
define("ADROTATE_VERSION", 391);
27
define("ADROTATE_DB_VERSION", 64);
28
$plugin_folder = plugin_dir_path(__FILE__);
@@ -104,6 +104,9 @@ function adrotate_dashboard() {
104
$adrotate_pro = add_submenu_page('adrotate', 'AdRotate · '.__('AdRotate Pro', 'adrotate'), __('AdRotate Pro', 'adrotate'), 'adrotate_ad_manage', 'adrotate-pro', 'adrotate_pro');
105
$adrotate_adverts = add_submenu_page('adrotate', 'AdRotate · '.__('Adverts', 'adrotate'), __('Adverts', 'adrotate'), 'adrotate_ad_manage', 'adrotate-ads', 'adrotate_manage');
106
$adrotate_groups = add_submenu_page('adrotate', 'AdRotate · '.__('Groups', 'adrotate'), __('Groups', 'adrotate'), 'adrotate_group_manage', 'adrotate-groups', 'adrotate_manage_group');
107
$adrotate_settings = add_submenu_page('adrotate', 'AdRotate · '.__('Settings', 'adrotate'), __('Settings', 'adrotate'), 'manage_options', 'adrotate-settings', 'adrotate_options');
108
109
// Add help tabs
@@ -111,6 +114,9 @@ function adrotate_dashboard() {
111
add_action('load-'.$adrotate_pro, 'adrotate_help_info');
112
add_action('load-'.$adrotate_adverts, 'adrotate_help_info');
113
add_action('load-'.$adrotate_groups, 'adrotate_help_info');
114
add_action('load-'.$adrotate_settings, 'adrotate_help_info');
115
}
116
@@ -241,7 +247,7 @@ function adrotate_manage() {
241
<div class="tablenav">
242
<div class="alignleft actions">
243
<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads');?>"><?php _e('Manage', 'adrotate'); ?></a>
244
- &nbsp;|&nbsp;<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=generator');?>"><?php _e('Generator', 'adrotate-pro'); ?></a>
245
&nbsp;|&nbsp;<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=addnew');?>"><?php _e('Add New', 'adrotate'); ?></a>
246
</div>
247
</div>
@@ -345,6 +351,130 @@ function adrotate_manage_group() {
345
<?php
346
}
347
348
/*-------------------------------------------------------------
349
Name: adrotate_options
350
Purpose: Admin options page
7
Description: Monetise your website with adverts while keeping things simple. Start making money today!
8
Text Domain: adrotate
9
Domain Path: /languages/
10
+ Version: 4.6
11
License: GPLv3
12
*/
13
22
------------------------------------------------------------------------------------ */
23
24
/*--- AdRotate values ---------------------------------------*/
25
+ define("ADROTATE_DISPLAY", '4.6');
26
define("ADROTATE_VERSION", 391);
27
define("ADROTATE_DB_VERSION", 64);
28
$plugin_folder = plugin_dir_path(__FILE__);
104
$adrotate_pro = add_submenu_page('adrotate', 'AdRotate · '.__('AdRotate Pro', 'adrotate'), __('AdRotate Pro', 'adrotate'), 'adrotate_ad_manage', 'adrotate-pro', 'adrotate_pro');
105
$adrotate_adverts = add_submenu_page('adrotate', 'AdRotate · '.__('Adverts', 'adrotate'), __('Adverts', 'adrotate'), 'adrotate_ad_manage', 'adrotate-ads', 'adrotate_manage');
106
$adrotate_groups = add_submenu_page('adrotate', 'AdRotate · '.__('Groups', 'adrotate'), __('Groups', 'adrotate'), 'adrotate_group_manage', 'adrotate-groups', 'adrotate_manage_group');
107
+ $adrotate_schedules = add_submenu_page('adrotate', 'AdRotate · '.__('Schedules', 'adrotate'), __('Schedules', 'adrotate'), 'adrotate_ad_manage', 'adrotate-schedules', 'adrotate_manage_schedules');
108
+ $adrotate_statistics = add_submenu_page('adrotate', 'AdRotate · '.__('Statistics', 'adrotate'), __('Statistics', 'adrotate'), 'adrotate_ad_manage', 'adrotate-statistics', 'adrotate_statistics');
109
+ $adrotate_media = add_submenu_page('adrotate', 'AdRotate · '.__('Media', 'adrotate'), __('Media', 'adrotate'), 'adrotate_ad_manage', 'adrotate-media', 'adrotate_manage_media');
110
$adrotate_settings = add_submenu_page('adrotate', 'AdRotate · '.__('Settings', 'adrotate'), __('Settings', 'adrotate'), 'manage_options', 'adrotate-settings', 'adrotate_options');
111
112
// Add help tabs
114
add_action('load-'.$adrotate_pro, 'adrotate_help_info');
115
add_action('load-'.$adrotate_adverts, 'adrotate_help_info');
116
add_action('load-'.$adrotate_groups, 'adrotate_help_info');
117
+ add_action('load-'.$adrotate_schedules, 'adrotate_help_info');
118
+ add_action('load-'.$adrotate_statistics, 'adrotate_help_info');
119
+ add_action('load-'.$adrotate_media, 'adrotate_help_info');
120
add_action('load-'.$adrotate_settings, 'adrotate_help_info');
121
}
122
247
<div class="tablenav">
248
<div class="alignleft actions">
249
<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads');?>"><?php _e('Manage', 'adrotate'); ?></a>
250
+ &nbsp;|&nbsp;<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=generator');?>"><?php _e('Generator', 'adrotate'); ?></a>
251
&nbsp;|&nbsp;<a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=addnew');?>"><?php _e('Add New', 'adrotate'); ?></a>
252
</div>
253
</div>
351
<?php
352
}
353
354
+ /*-------------------------------------------------------------
355
+ Name: adrotate_manage_schedules
356
+ Purpose: Manage schedules for ads
357
+ -------------------------------------------------------------*/
358
+ function adrotate_manage_schedules() {
359
+ global $wpdb, $adrotate_config;
360
+
361
+ $now = adrotate_now();
362
+ $in2days = $now + 172800;
363
+ ?>
364
+ <div class="wrap">
365
+ <h1><?php _e('Schedules', 'adrotate'); ?></h1>
366
+
367
+ <?php
368
+ include("dashboard/publisher/schedules-main.php");
369
+ ?>
370
+
371
+ <br class="clear" />
372
+
373
+ <?php adrotate_credits(); ?>
374
+
375
+ <br class="clear" />
376
+ </div>
377
+ <?php
378
+ }
379
+
380
+ /*-------------------------------------------------------------
381
+ Name: adrotate_statistics
382
+ Purpose: Advert and Group stats
383
+ -------------------------------------------------------------*/
384
+ function adrotate_statistics() {
385
+ global $wpdb, $adrotate_config;
386
+
387
+ $status = $view = $id = $file = '';
388
+ if(isset($_GET['status'])) $status = esc_attr($_GET['status']);
389
+ if(isset($_GET['view'])) $view = esc_attr($_GET['view']);
390
+ if(isset($_GET['id'])) $id = esc_attr($_GET['id']);
391
+ if(isset($_GET['file'])) $file = esc_attr($_GET['file']);
392
+
393
+ if(isset($_GET['month']) AND isset($_GET['year'])) {
394
+ $month = esc_attr($_GET['month']);
395
+ $year = esc_attr($_GET['year']);
396
+ } else {
397
+ $month = date("m");
398
+ $year = date("Y");
399
+ }
400
+ $monthstart = mktime(0, 0, 0, $month, 1, $year);
401
+ $monthend = mktime(0, 0, 0, $month+1, 0, $year);
402
+ $today = adrotate_date_start('day');
403
+ ?>
404
+ <div class="wrap">
405
+ <h2><?php _e('Statistics', 'adrotate'); ?></h2>
406
+
407
+ <?php if($status > 0) adrotate_status($status, array('file' => $file)); ?>
408
+
409
+ <?php
410
+ if ($view == "") {
411
+ $stats = adrotate_prepare_fullreport();
412
+ $stats_graph_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$monthstart} AND `thetime` <= {$monthend};", ARRAY_A);
413
+ if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
414
+ if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
415
+
416
+ // Get Click Through Rate
417
+ $ctr_alltime = adrotate_ctr($stats['overall_clicks'], $stats['overall_impressions']);
418
+ $ctr_last_month = adrotate_ctr($stats['last_month_clicks'], $stats['last_month_impressions']);
419
+ $ctr_this_month = adrotate_ctr($stats['this_month_clicks'], $stats['this_month_impressions']);
420
+ $ctr_graph_month = adrotate_ctr($stats_graph_month['clicks'], $stats_graph_month['impressions']);
421
+
422
+ include("dashboard/publisher/statistics-main.php");
423
+ } else if($view == "advert") {
424
+ include("dashboard/publisher/statistics-advert.php");
425
+ } else if($view == "group") {
426
+ include("dashboard/publisher/statistics-group.php");
427
+ }
428
+ ?>
429
+ <br class="clear" />
430
+
431
+ <?php adrotate_credits(); ?>
432
+
433
+ <br class="clear" />
434
+ </div>
435
+ <?php
436
+ }
437
+
438
+ /*-------------------------------------------------------------
439
+ Name: adrotate_manage_media
440
+ Purpose: Manage banner images for ads
441
+ -------------------------------------------------------------*/
442
+ function adrotate_manage_media() {
443
+ global $wpdb, $adrotate_config;
444
+
445
+ $status = $file = '';
446
+ if(isset($_GET['status'])) $status = esc_attr($_GET['status']);
447
+ if(isset($_GET['file'])) $file = esc_attr($_GET['file']);
448
+
449
+ if(strlen($file) > 0 AND wp_verify_nonce($_REQUEST['_wpnonce'], 'adrotate_delete_media_'.$file)) {
450
+ if(adrotate_unlink($file)) {
451
+ $status = 206;
452
+ } else {
453
+ $status = 207;
454
+ }
455
+ }
456
+ ?>
457
+
458
+ <div class="wrap">
459
+ <h1><?php _e('Media and Assets', 'adrotate'); ?></h1>
460
+
461
+ <?php if($status > 0) adrotate_status($status); ?>
462
+
463
+ <p><?php _e('Upload images to the AdRotate Pro banners folder from here. This is useful if you have HTML5 adverts containing multiple files.', 'adrotate'); ?><br /><?php _e('Get more features', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Get AdRotate Pro', 'adrotate'); ?></a>!</p>
464
+
465
+ <?php
466
+ include("dashboard/publisher/media.php");
467
+ ?>
468
+
469
+ <br class="clear" />
470
+
471
+ <?php adrotate_credits(); ?>
472
+
473
+ <br class="clear" />
474
+ </div>
475
+ <?php
476
+ }
477
+
478
/*-------------------------------------------------------------
479
Name: adrotate_options
480
Purpose: Admin options page
dashboard/publisher/adverts-edit.php CHANGED
@@ -126,7 +126,7 @@ if($edit_banner->imagetype == "field") {
126
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
127
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;');return false;">&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;</a></em></p>
128
129
- <p><strong><?php _e('Get better adverts from Media.net', 'adrotate'); ?></strong></p>
130
<p><a href="http://ajdg.link/medianet" target="_blank"><img src="<?php echo plugins_url("../images/medianet-small-$partner.jpg", dirname(__FILE__)); ?>" width="250" /></a></p>
131
</td>
132
</tr>
@@ -185,7 +185,7 @@ if($edit_banner->imagetype == "field") {
185
</tr>
186
</tbody>
187
</table>
188
- <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
189
190
<p class="submit">
191
<input tabindex="8" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
@@ -285,7 +285,7 @@ if($edit_banner->imagetype == "field") {
285
</tr>
286
</tbody>
287
</table>
288
- <center><?php _e('Create multiple and more advanced schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
289
290
<p class="submit">
291
<input tabindex="21" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
@@ -354,7 +354,7 @@ if($edit_banner->imagetype == "field") {
354
</tr>
355
</tbody>
356
</table>
357
- <center><?php _e('With AdRotate Pro you can easily select which devices and mobile operating systems the advert should show on!', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>!</center>
358
359
<h2><?php _e('Geo Targeting', 'adrotate-pro'); ?></h2>
360
<p><em><?php _e('Assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate-pro'); ?> <?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
@@ -425,7 +425,7 @@ if($edit_banner->imagetype == "field") {
425
</div>
426
</div>
427
<div class="clear"></div>
428
- <center><?php _e('Target your audience with Geo Targeting in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
429
430
<h3><?php _e('Usage', 'adrotate'); ?></h3>
431
<table class="widefat" style="margin-top: .5em">
126
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
127
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;');return false;">&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;</a></em></p>
128
129
+ <p><strong><?php _e('Get adverts from Media.net', 'adrotate'); ?></strong></p>
130
<p><a href="http://ajdg.link/medianet" target="_blank"><img src="<?php echo plugins_url("../images/medianet-small-$partner.jpg", dirname(__FILE__)); ?>" width="250" /></a></p>
131
</td>
132
</tr>
185
</tr>
186
</tbody>
187
</table>
188
+ <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
189
190
<p class="submit">
191
<input tabindex="8" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
285
</tr>
286
</tbody>
287
</table>
288
+ <center><?php _e('Create multiple and more advanced schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
289
290
<p class="submit">
291
<input tabindex="21" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
354
</tr>
355
</tbody>
356
</table>
357
+ <center><?php _e('With AdRotate Pro you can easily select which devices and mobile operating systems the advert should show on!', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
358
359
<h2><?php _e('Geo Targeting', 'adrotate-pro'); ?></h2>
360
<p><em><?php _e('Assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate-pro'); ?> <?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
425
</div>
426
</div>
427
<div class="clear"></div>
428
+ <center><?php _e('Target your audience with Geo Targeting in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
429
430
<h3><?php _e('Usage', 'adrotate'); ?></h3>
431
<table class="widefat" style="margin-top: .5em">
dashboard/publisher/adverts-main.php CHANGED
@@ -78,7 +78,7 @@
78
<th class="check-column"><input type="checkbox" name="bannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
79
<td><center><?php echo $banner['id'];?></center></td>
80
<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>
81
- <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) { ?>- <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>
82
<?php if($adrotate_config['stats'] == 1) { ?>
83
<td><center><?php echo $stats['impressions']; ?></center></td>
84
<td><center><?php echo $stats_today['impressions']; ?></center></td>
@@ -102,6 +102,6 @@
102
<?php } ?>
103
</tbody>
104
</table>
105
- <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
106
107
</form>
78
<th class="check-column"><input type="checkbox" name="bannercheck[]" value="<?php echo $banner['id']; ?>" /></th>
79
<td><center><?php echo $banner['id'];?></center></td>
80
<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>
81
+ <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) { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-statistics&view=advert&id='.$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>
82
<?php if($adrotate_config['stats'] == 1) { ?>
83
<td><center><?php echo $stats['impressions']; ?></center></td>
84
<td><center><?php echo $stats_today['impressions']; ?></center></td>
102
<?php } ?>
103
</tbody>
104
</table>
105
+ <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
106
107
</form>
dashboard/publisher/adverts-report.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /* ------------------------------------------------------------------------------------
3
- * COPYRIGHT AND TRADEMARK NOTICE
4
- * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
- * ADROTATE is a trademark of Arnan de Gans.
6
-
7
- * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
- * By using this code you agree to indemnify Arnan de Gans from any
9
- * liability that might arise from it's use.
10
- ------------------------------------------------------------------------------------ */
11
-
12
- $banner = $wpdb->get_row("SELECT `title`, `tracker` FROM `".$wpdb->prefix."adrotate` WHERE `id` = '$ad_edit_id';");
13
- $stats = adrotate_stats($ad_edit_id);
14
- $stats_today = adrotate_stats($ad_edit_id, $today);
15
- $stats_graph_month = adrotate_stats($ad_edit_id, $monthstart, $monthend);
16
-
17
- // Get Click Through Rate
18
- $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
19
- $ctr_graph_month = adrotate_ctr($stats_graph_month['clicks'], $stats_graph_month['impressions']);
20
-
21
- // Prevent gaps in display
22
- if(empty($stats['impressions'])) $stats['impressions'] = 0;
23
- if(empty($stats['clicks'])) $stats['clicks'] = 0;
24
- if(empty($stats_today['impressions'])) $stats_today['impressions'] = 0;
25
- if(empty($stats_today['clicks'])) $stats_today['clicks'] = 0;
26
- if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
27
- if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
28
- ?>
29
-
30
- <h3><?php _e('Statistics for advert', 'adrotate'); ?> '<?php echo $banner->title; ?>'</h3>
31
- <table class="widefat" style="margin-top: .5em">
32
-
33
- <tbody>
34
- <tr>
35
- <td width="20%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['impressions']; ?></div></div></td>
36
- <td width="20%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $stats['clicks']; } else { echo '--'; } ?></div></div></td>
37
- <td width="20%"><div class="stats_large"><?php _e('Impressions today', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['impressions']; ?></div></div></td>
38
- <td width="20%"><div class="stats_large"><?php _e('Clicks today', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $stats_today['clicks']; } else { echo '--'; } ?></div></div></td>
39
- <td width="20%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $ctr.' %'; } else { echo '--'; } ?></div></div></td>
40
- </tr>
41
- <tbody>
42
-
43
- </table>
44
-
45
- <h3><?php _e('Monthly overview of clicks and impressions', 'adrotate'); ?></h3>
46
- <table class="widefat" style="margin-top: .5em">
47
-
48
- <tbody>
49
- <tr>
50
- <th colspan="3">
51
- <div style="text-align:center;"><?php echo adrotate_stats_nav('ads', $ad_edit_id, $month, $year); ?></div>
52
- <?php echo adrotate_stats_graph('ads', $ad_edit_id, 1, $monthstart, $monthend); ?>
53
- </th>
54
- </tr>
55
- <tr>
56
- <td width="33%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['impressions']; ?></div></div></td>
57
- <td width="33%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $stats_graph_month['clicks']; } else { echo '--'; } ?></div></div></td>
58
- <td width="34%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $ctr_graph_month.' %'; } else { echo '--'; } ?></div></div></td>
59
- </tr>
60
- </tbody>
61
-
62
- </table>
63
-
64
- <p><em><strong><?php _e('Note:', 'adrotate'); ?></strong> <?php _e('All statistics are indicative. They do not nessesarily reflect results counted by other parties.', 'adrotate'); ?></em></p>
dashboard/publisher/groups-edit.php CHANGED
@@ -27,7 +27,7 @@ $groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHE
27
$ads = $wpdb->get_results("SELECT `id`, `title`, `tracker`, `weight`, `type` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' AND `type` != 'a_empty') ORDER BY `id` ASC;");
28
$linkmeta = $wpdb->get_results("SELECT `ad` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = '$group_edit_id' AND `user` = 0;");
29
30
- $meta_array = '';
31
foreach($linkmeta as $meta) {
32
$meta_array[] = $meta->ad;
33
}
@@ -68,7 +68,7 @@ if(!is_array($meta_array)) $meta_array = array();
68
</tr>
69
</tbody>
70
</table>
71
- <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
72
73
<h3><?php _e('Dynamic and Block Mode', 'adrotate'); ?></h3>
74
<p><em><?php _e('Only required if your group is in Dynamic or Block mode.', 'adrotate'); ?></em></p>
@@ -188,7 +188,7 @@ if(!is_array($meta_array)) $meta_array = array();
188
</tr>
189
</tbody>
190
</table>
191
- <center><?php _e('Set up mobile support and use Geo Targeting in AdRotate Pro', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
192
193
<div id="dashboard-widgets-wrap">
194
<div id="dashboard-widgets" class="metabox-holder">
27
$ads = $wpdb->get_results("SELECT `id`, `title`, `tracker`, `weight`, `type` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' AND `type` != 'a_empty') ORDER BY `id` ASC;");
28
$linkmeta = $wpdb->get_results("SELECT `ad` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = '$group_edit_id' AND `user` = 0;");
29
30
+ $meta_array = array();
31
foreach($linkmeta as $meta) {
32
$meta_array[] = $meta->ad;
33
}
68
</tr>
69
</tbody>
70
</table>
71
+ <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
72
73
<h3><?php _e('Dynamic and Block Mode', 'adrotate'); ?></h3>
74
<p><em><?php _e('Only required if your group is in Dynamic or Block mode.', 'adrotate'); ?></em></p>
188
</tr>
189
</tbody>
190
</table>
191
+ <center><?php _e('Set up mobile support and use Geo Targeting in AdRotate Pro', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
192
193
<div id="dashboard-widgets-wrap">
194
<div id="dashboard-widgets" class="metabox-holder">
dashboard/publisher/groups-main.php CHANGED
@@ -67,7 +67,7 @@
67
<tr class='<?php echo $class; ?>'>
68
<th class="check-column"><input type="checkbox" name="groupcheck[]" value="<?php echo $group->id; ?>" /></th>
69
<td><center><?php echo $group->id;?></center></td>
70
- <td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-groups&view=edit&group='.$group->id);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo $group->name;?></a></strong> <?php if($adrotate_config['stats'] == 1) { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-groups&view=report&group='.$group->id);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><?php } ?><span style="color:#999;"><?php echo '<br /><span style="font-weight:bold;">'.__('Mode', 'adrotate').':</span> '.implode(', ', $modus); ?></span></td>
71
<td><center><?php echo $ads_in_group; ?></center></td>
72
<?php if($adrotate_config['stats'] == 1) { ?>
73
<td><center><?php echo $stats['impressions']; ?></center></td>
@@ -86,5 +86,5 @@
86
<?php } ?>
87
</tbody>
88
</table>
89
- <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
90
</form>
67
<tr class='<?php echo $class; ?>'>
68
<th class="check-column"><input type="checkbox" name="groupcheck[]" value="<?php echo $group->id; ?>" /></th>
69
<td><center><?php echo $group->id;?></center></td>
70
+ <td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-groups&view=edit&group='.$group->id);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo $group->name;?></a></strong> <?php if($adrotate_config['stats'] == 1) { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-statistics&view=group&id='.$group->id);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><?php } ?><span style="color:#999;"><?php echo '<br /><span style="font-weight:bold;">'.__('Mode', 'adrotate').':</span> '.implode(', ', $modus); ?></span></td>
71
<td><center><?php echo $ads_in_group; ?></center></td>
72
<?php if($adrotate_config['stats'] == 1) { ?>
73
<td><center><?php echo $stats['impressions']; ?></center></td>
86
<?php } ?>
87
</tbody>
88
</table>
89
+ <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
90
</form>
dashboard/publisher/groups-report.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- /* ------------------------------------------------------------------------------------
3
- * COPYRIGHT AND TRADEMARK NOTICE
4
- * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
- * ADROTATE is a trademark of Arnan de Gans.
6
-
7
- * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
- * By using this code you agree to indemnify Arnan de Gans from any
9
- * liability that might arise from it's use.
10
- ------------------------------------------------------------------------------------ */
11
-
12
- $title = $wpdb->get_var("SELECT `name` FROM `".$wpdb->prefix."adrotate_groups` WHERE `id` = '$group_edit_id';");
13
- $stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `".$wpdb->prefix."adrotate_stats` WHERE `group` = '$group_edit_id';", ARRAY_A);
14
- $stats_today = $wpdb->get_row("SELECT `clicks`, `impressions` FROM `".$wpdb->prefix."adrotate_stats` WHERE `group` = '$group_edit_id' AND `thetime` = '$today';", ARRAY_A);
15
-
16
- $stats_graph_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$group_edit_id} AND `thetime` >= {$monthstart} AND `thetime` <= {$monthend};", ARRAY_A);
17
-
18
- // Get Click Through Rate
19
- $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
20
- $ctr_graph_month = adrotate_ctr($stats_graph_month['clicks'], $stats_graph_month['impressions']);
21
-
22
- // Prevent gaps in display
23
- if(empty($stats['impressions'])) $stats['impressions'] = 0;
24
- if(empty($stats['clicks'])) $stats['clicks'] = 0;
25
- if(empty($stats_today['impressions'])) $stats_today['impressions'] = 0;
26
- if(empty($stats_today['clicks'])) $stats_today['clicks'] = 0;
27
- if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
28
- if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
29
- ?>
30
-
31
- <h3><?php _e('Statistics for group', 'adrotate'); ?> '<?php echo $title; ?>'</h3>
32
- <table class="widefat" style="margin-top: .5em">
33
-
34
- <tbody>
35
- <tr>
36
- <td width="20%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['impressions']; ?></div></div></td>
37
- <td width="20%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['clicks']; ?></div></div></td>
38
- <td width="20%"><div class="stats_large"><?php _e('Impressions today', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['impressions']; ?></div></div></td>
39
- <td width="20%"><div class="stats_large"><?php _e('Clicks today', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['clicks']; ?></div></div></td>
40
- <td width="20%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr.' %'; ?></div></div></td>
41
- </tr>
42
- </tbody>
43
-
44
- </table>
45
-
46
- <h3><?php _e('Monthly overview of clicks and impressions', 'adrotate'); ?></h3>
47
- <table class="widefat" style="margin-top: .5em">
48
-
49
- <tbody>
50
- <tr>
51
- <th colspan="5">
52
- <div style="text-align:center;"><?php echo adrotate_stats_nav('groups', $group_edit_id, $month, $year); ?></div>
53
- <?php echo adrotate_stats_graph('groups', $group_edit_id, 1, $monthstart, $monthend); ?>
54
- </th>
55
- </tr>
56
- <tr>
57
- <td width="33%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['impressions']; ?></div></div></td>
58
- <td width="33%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['clicks']; ?></div></div></td>
59
- <td width="34%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_graph_month; ?> %</div></div></td>
60
- </tr>
61
- </tbody>
62
-
63
- </table>
64
-
65
- <p><em><strong><?php _e('Note:', 'adrotate'); ?></strong> <?php _e('All statistics are indicative. They do not nessesarily reflect results counted by other parties.', 'adrotate'); ?></em></p>
dashboard/publisher/media.php ADDED
@@ -0,0 +1,74 @@
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from it's use.
10
+ ------------------------------------------------------------------------------------ */
11
+ ?>
12
+
13
+ <form method="post" action="admin.php?page=adrotate-media" enctype="multipart/form-data">
14
+ <?php wp_nonce_field('adrotate_save_media','adrotate_nonce'); ?>
15
+ <input type="hidden" name="MAX_FILE_SIZE" value="512000" />
16
+
17
+ <h2><?php _e('Upload new file', 'adrotate'); ?></h2>
18
+ <label for="adrotate_image"><input tabindex="1" type="file" name="adrotate_image" disabled="1" /><br /><em><strong><?php _e('Accepted files:', 'adrotate'); ?></strong> jpg, jpeg, gif, png, html, js, swf and flv. <?php _e('Maximum size is 512Kb per file.', 'adrotate'); ?></em><br /><em><strong><?php _e('Important:', 'adrotate'); ?></strong> <?php _e('Make sure your file has no spaces or special characters in the name. Replace spaces with a - or _.', 'adrotate'); ?><br /><?php _e('If you remove spaces from filenames for HTML5 adverts also edit the html file so it knows about the changed name. For example for the javascript file.', 'adrotate'); ?></em></label>
19
+
20
+ <p class="submit">
21
+ <input tabindex="2" type="submit" name="adrotate_media_submit" class="button-primary" value="<?php _e('Upload file', 'adrotate'); ?>" disabled="1" /> <em><?php _e('Click only once per file!', 'adrotate'); ?></em>
22
+ </p>
23
+ </form>
24
+
25
+ <h2><?php _e('Available files in', 'adrotate'); ?> '<?php echo '/'.$adrotate_config['banner_folder']; ?>'</h2>
26
+ <table class="widefat" style="margin-top: .5em">
27
+
28
+ <thead>
29
+ <tr>
30
+ <th><?php _e('Name', 'adrotate'); ?></th>
31
+ <th width="12%"><center><?php _e('Actions', 'adrotate'); ?></center></th>
32
+ </tr>
33
+ </thead>
34
+
35
+ <tbody>
36
+ <?php
37
+ $assets = adrotate_subfolder_contents(WP_CONTENT_DIR."/".$adrotate_config['banner_folder']);
38
+
39
+ if(count($assets) > 0) {
40
+ $class = '';
41
+ foreach($assets as $asset) {
42
+ $class = ($class != 'alternate') ? 'alternate' : '';
43
+
44
+ echo "<tr class=\"$class\">";
45
+ echo "<td>";
46
+ echo $asset['basename'];
47
+ if(array_key_exists("contents", $asset) AND !array_key_exists("no_files", $asset['contents']) AND !array_key_exists("no_access", $asset['contents'])) {
48
+ echo "<small>";
49
+ foreach($asset['contents'] as $level_one) {
50
+ echo "<br />&mdash; ".$level_one['basename'];
51
+ if(array_key_exists("contents", $level_one)) {
52
+ foreach($level_one['contents'] as $level_two) {
53
+ echo "<br />&mdash;&mdash; ".$level_two['basename'];
54
+ }
55
+ }
56
+ }
57
+ echo "</small>";
58
+ }
59
+ echo "</td>";
60
+ echo "<td><center><strong>".__('Delete', 'adrotate')."</strong></center></td>";
61
+ echo "</tr>";
62
+ }
63
+ } else {
64
+ echo "<tr class=\"alternate\">";
65
+ echo "<td colspan=\"2\"><em>".__('No files found!', 'adrotate')."</em></td>";
66
+ echo "</tr>";
67
+ }
68
+ ?>
69
+ </tbody>
70
+ </table>
71
+ <p><center>
72
+ <?php _e("Make sure the banner images are not in use by adverts when you delete them!", "adrotate"); ?><br />
73
+ <?php _e('Get more features with AdRotate Pro', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!
74
+ </center></p>
dashboard/publisher/schedules-main.php ADDED
@@ -0,0 +1,92 @@
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from it's use.
10
+ ------------------------------------------------------------------------------------ */
11
+ ?>
12
+ <h2><?php _e('Manage Schedules', 'adrotate'); ?></h2>
13
+ <p><?php _e('In AdRotate Pro you can schedule adverts for multiple periods of time. One schedule can be assigned to many adverts allowing you to manage multi advert campaigns easily. Schedules can be active on certain days of the week or on certain hours of the day.', 'adrotate'); ?> <?php _e('Get more features', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Get AdRotate Pro', 'adrotate'); ?></a>!</p>
14
+
15
+ <form name="banners" id="post" method="post" action="admin.php?page=adrotate-schedules">
16
+ <?php wp_nonce_field('adrotate_bulk_schedules','adrotate_nonce'); ?>
17
+
18
+ <div class="tablenav top">
19
+ <div class="alignleft actions">
20
+ <select name="adrotate_action" id="cat" class="postform" disabled="1">
21
+ <option value=""><?php _e('Bulk Actions', 'adrotate'); ?></option>
22
+ </select> <input type="submit" id="post-action-submit" name="adrotate_action_submit" value="<?php _e('Go', 'adrotate'); ?>" class="button-secondary" disabled="1" />
23
+ </div>
24
+ <br class="clear" />
25
+ </div>
26
+
27
+ <table class="widefat tablesorter manage-schedules-main" style="margin-top: .5em">
28
+ <thead>
29
+ <tr>
30
+ <td scope="col" class="manage-column column-cb check-column"><input type="checkbox" disabled="1" /></td>
31
+ <th width="4%"><center><?php _e('ID', 'adrotate'); ?></center></th>
32
+ <th width="20%"><?php _e('Start / End', 'adrotate'); ?></th>
33
+ <th><?php _e('Name', 'adrotate'); ?></th>
34
+ <th width="4%"><center><?php _e('Adverts', 'adrotate'); ?></center></th>
35
+ <?php if($adrotate_config['stats'] == 1) { ?>
36
+ <th width="10%"><center><?php _e('Max Shown', 'adrotate'); ?></center></th>
37
+ <th width="10%"><center><?php _e('Max Clicks', 'adrotate'); ?></center></th>
38
+ <?php } ?>
39
+ </tr>
40
+ </thead>
41
+ <tbody>
42
+ <?php
43
+ $schedules = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_schedule` WHERE `name` != '' ORDER BY `id` ASC;");
44
+ if($schedules) {
45
+ $tick = '<img src="'.plugins_url('../../images/tick.png', __FILE__).'" width="10" height"10" />';
46
+ $cross = '<img src="'.plugins_url('../../images/cross.png', __FILE__).'" width="10" height"10" />';
47
+
48
+ $class = '';
49
+ foreach($schedules as $schedule) {
50
+ $ads_use_schedule = $wpdb->get_results("SELECT `ad` FROM `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate` WHERE `group` = 0 AND `user` = 0 AND `schedule` = ".$schedule->id." AND `ad` = `{$wpdb->prefix}adrotate`.`id`;");
51
+
52
+ if($adrotate_config['stats'] == 1) {
53
+ if($schedule->maxclicks == 0) $schedule->maxclicks = '&infin;';
54
+ if($schedule->maximpressions == 0) $schedule->maximpressions = '&infin;';
55
+ }
56
+
57
+ ($class != 'alternate') ? $class = 'alternate' : $class = '';
58
+ if($schedule->stoptime < $in2days) $class = 'row_orange';
59
+ if($schedule->stoptime < $now) $class = 'row_red';
60
+
61
+ $sdayhour = substr($schedule->daystarttime, 0, 2);
62
+ $sdayminute = substr($schedule->daystarttime, 2, 2);
63
+ $edayhour = substr($schedule->daystoptime, 0, 2);
64
+ $edayminute = substr($schedule->daystoptime, 2, 2);
65
+ ?>
66
+ <tr id='adrotateindex' class='<?php echo $class; ?>'>
67
+ <th class="check-column"><input type="checkbox" name="schedulecheck[]" value="<?php echo $schedule->id; ?>" disabled="1" /></th>
68
+ <td><center><?php echo $schedule->id;?></center></td>
69
+ <td><?php echo date_i18n("F d, Y H:i", $schedule->starttime);?><br /><span style="color: <?php echo adrotate_prepare_color($schedule->stoptime);?>;"><?php echo date_i18n("F d, Y H:i", $schedule->stoptime);?></span></td>
70
+ <td><?php echo stripslashes(html_entity_decode($schedule->name)); ?><span style="color:#999;"><br /><?php _e('Mon:', 'adrotate'); ?> <?php echo ($schedule->day_mon == 'Y') ? $tick : $cross; ?> <?php _e('Tue:', 'adrotate'); ?> <?php echo ($schedule->day_tue == 'Y') ? $tick : $cross; ?> <?php _e('Wed:', 'adrotate'); ?> <?php echo ($schedule->day_wed == 'Y') ? $tick : $cross; ?> <?php _e('Thu:', 'adrotate'); ?> <?php echo ($schedule->day_thu == 'Y') ? $tick : $cross; ?> <?php _e('Fri:', 'adrotate'); ?> <?php echo ($schedule->day_fri == 'Y') ? $tick : $cross; ?> <?php _e('Sat:', 'adrotate'); ?> <?php echo ($schedule->day_sat == 'Y') ? $tick : $cross; ?> <?php _e('Sun:', 'adrotate'); ?> <?php echo ($schedule->day_sun == 'Y') ? $tick : $cross; ?> <?php if($schedule->daystarttime > 0) { ?><?php _e('Between:', 'adrotate'); ?> <?php echo $sdayhour; ?>:<?php echo $sdayminute; ?> - <?php echo $edayhour; ?>:<?php echo $edayminute; ?> <?php } ?><br /><?php _e('Impression spread:', 'adrotate'); ?> <?php echo ($schedule->spread == 'Y') ? $tick : $cross; ?>, <?php _e('Auto Delete:', 'adrotate'); ?> <?php echo ($schedule->autodelete == 'Y') ? $tick : $cross; ?></span></td>
71
+ <td><center><?php echo count($ads_use_schedule); ?></center></td>
72
+ <?php if($adrotate_config['stats'] == 1) { ?>
73
+ <td><center><?php echo $schedule->maximpressions; ?></center></td>
74
+ <td><center><?php echo $schedule->maxclicks; ?></center></td>
75
+ <?php } ?>
76
+ </tr>
77
+ <?php } ?>
78
+ <?php } else { ?>
79
+ <tr id='no-schedules'>
80
+ <th class="check-column">&nbsp;</th>
81
+ <td colspan="<?php echo ($adrotate_config['stats'] == 1) ? '7' : '5'; ?>"><em><?php _e('Nothing here!', 'adrotate'); ?></em></td>
82
+ </tr>
83
+ <?php } ?>
84
+ </tbody>
85
+ </table>
86
+ <p><center>
87
+ <span style="border: 1px solid #c80; height: 12px; width: 12px; background-color: #fdefc3">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Expires soon.", "adrotate"); ?>
88
+ &nbsp;&nbsp;&nbsp;&nbsp;<span style="border: 1px solid #c00; height: 12px; width: 12px; background-color: #ffebe8">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Has expired.", "adrotate"); ?><br />
89
+ <?php _e('Get more features with AdRotate Pro', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!
90
+
91
+ </center></p>
92
+ </form>
dashboard/publisher/statistics-advert.php ADDED
@@ -0,0 +1,142 @@
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from it's use.
10
+ ------------------------------------------------------------------------------------ */
11
+
12
+ $banner = $wpdb->get_row("SELECT `title`, `tracker`, `type` FROM `{$wpdb->prefix}adrotate` WHERE `id` = '{$id}';");
13
+ $schedules = $wpdb->get_results("SELECT `{$wpdb->prefix}adrotate_schedule`.`id`, `starttime`, `stoptime`, `maxclicks`, `maximpressions`, COUNT(`clicks`) as `clicks`, COUNT(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats` WHERE `{$wpdb->prefix}adrotate_linkmeta`.`ad` = '{$id}' AND `{$wpdb->prefix}adrotate_linkmeta`.`ad` = `{$wpdb->prefix}adrotate_stats`.`ad` AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` AND `thetime` > `starttime` AND `thetime` < `stoptime` ORDER BY `{$wpdb->prefix}adrotate_schedule`.`id` ASC;");
14
+
15
+ $stats = adrotate_stats($id, false);
16
+ $stats_today = adrotate_stats($id, false, adrotate_date_start('day'), null, 1);
17
+ $stats_last_month = adrotate_stats($id, false, mktime(0, 0, 0, date("m")-1, 1, date("Y")), mktime(0, 0, 0, date("m"), 0, date("Y")));
18
+ $stats_this_month = adrotate_stats($id, false, mktime(0, 0, 0, date("m"), 1, date("Y")), mktime(0, 0, 0, date("m"), date("t"), date("Y")));
19
+ $stats_graph_month = adrotate_stats($id, false, $monthstart, $monthend);
20
+
21
+ // Prevent gaps in display
22
+ if(empty($stats['impressions'])) $stats['impressions'] = 0;
23
+ if(empty($stats['clicks'])) $stats['clicks'] = 0;
24
+ if(empty($stats_today['impressions'])) $stats_today['impressions'] = 0;
25
+ if(empty($stats_today['clicks'])) $stats_today['clicks'] = 0;
26
+ if(empty($stats_last_month['impressions'])) $stats_last_month['impressions'] = 0;
27
+ if(empty($stats_last_month['clicks'])) $stats_last_month['clicks'] = 0;
28
+ if(empty($stats_this_month['impressions'])) $stats_this_month['impressions'] = 0;
29
+ if(empty($stats_this_month['clicks'])) $stats_this_month['clicks'] = 0;
30
+ if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
31
+ if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
32
+
33
+ // Get Click Through Rate
34
+ $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
35
+ $ctr_today = adrotate_ctr($stats_today['clicks'], $stats_today['impressions']);
36
+ $ctr_last_month = adrotate_ctr($stats_last_month['clicks'], $stats_last_month['impressions']);
37
+ $ctr_this_month = adrotate_ctr($stats_this_month['clicks'], $stats_this_month['impressions']);
38
+ $ctr_graph_month = adrotate_ctr($stats_graph_month['clicks'], $stats_graph_month['impressions']);
39
+ ?>
40
+ <h2><?php _e('Statistics for advert', 'adrotate'); ?> '<?php echo stripslashes($banner->title); ?>'</h2>
41
+ <table class="widefat" style="margin-top: .5em">
42
+
43
+ <thead>
44
+ <tr>
45
+ <th colspan="3"><center><strong><?php _e('Today', 'adrotate'); ?></strong></center></th>
46
+ <th>&nbsp;</th>
47
+ <th colspan="3"><center><strong><?php _e('All time', 'adrotate'); ?></strong></center></th>
48
+ </tr>
49
+ </thead>
50
+ <tbody>
51
+ <tr>
52
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['impressions']; ?></div></div></td>
53
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['clicks']; ?></div></div></td>
54
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_today.' %'; ?></div></div></td>
55
+
56
+ <td>&nbsp;</td>
57
+
58
+ <td><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['impressions']; ?></div></div></td>
59
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['clicks']; ?></div></div></td>
60
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr.' %'; ?></div></div></td>
61
+ </tr>
62
+ </tbody>
63
+ <thead>
64
+ <tr>
65
+ <th colspan="3"><center><strong><?php _e('Last month', 'adrotate'); ?></strong></center></th>
66
+ <th>&nbsp;</th>
67
+ <th colspan="3"><center><strong><?php _e('This month', 'adrotate'); ?></strong></center></th>
68
+ </tr>
69
+ </thead>
70
+ <tbody>
71
+ <tr>
72
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_last_month['impressions']; ?></div></div></td>
73
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_last_month['clicks']; ?></div></div></td>
74
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_last_month.' %'; ?></div></div></td>
75
+
76
+ <td>&nbsp;</td>
77
+
78
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_this_month['impressions']; ?></div></div></td>
79
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_this_month['clicks']; ?></div></div></td>
80
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_this_month.' %'; ?></div></div></td>
81
+ </tr>
82
+ <tbody>
83
+
84
+ </table>
85
+
86
+ <h2><?php _e('Monthly overview of clicks and impressions', 'adrotate'); ?></h2>
87
+ <form method="post" action="admin.php?page=adrotate-statistics&view=advert&id=<?php echo $id; ?>">
88
+ <table class="widefat" style="margin-top: .5em">
89
+ <tbody>
90
+ <tr>
91
+ <th colspan="3">
92
+ <div style="text-align:center;"><?php echo adrotate_stats_nav('ads', $id, $month, $year); ?></div>
93
+ <?php
94
+ echo adrotate_stats_graph('ads', false, $id, 1, $monthstart, $monthend);
95
+ ?>
96
+ </th>
97
+ </tr>
98
+ <tr>
99
+ <td width="33%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['impressions']; ?></div></div></td>
100
+ <td width="33%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $stats_graph_month['clicks']; } else { echo '--'; } ?></div></div></td>
101
+ <td width="34%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php if($banner->tracker == "Y") { echo $ctr_graph_month.' %'; } else { echo '--'; } ?></div></div></td>
102
+ </tr>
103
+ </tbody>
104
+
105
+ </table>
106
+ </form>
107
+
108
+ <h2><?php _e('Periodic overview of clicks and impressions', 'adrotate'); ?></h2>
109
+ <table class="widefat" style="margin-top: .5em">
110
+ <thead>
111
+ <tr>
112
+ <th><?php _e('Shown from', 'adrotate'); ?></th>
113
+ <th><?php _e('Shown until', 'adrotate'); ?></th>
114
+ <th><center><?php _e('Max Clicks', 'adrotate'); ?> / <?php _e('Used', 'adrotate'); ?></center></th>
115
+ <th><center><?php _e('Max Impressions', 'adrotate'); ?> / <?php _e('Used', 'adrotate'); ?></center></th>
116
+ </tr>
117
+ </thead>
118
+
119
+ <tbody>
120
+ <?php
121
+ foreach($schedules as $schedule) {
122
+ $stats_schedule = adrotate_stats($id, false, $schedule->starttime, $schedule->stoptime);
123
+ if($schedule->maxclicks == 0) $schedule->maxclicks = '&infin;';
124
+ if($schedule->maximpressions == 0) $schedule->maximpressions = '&infin;';
125
+ ?>
126
+ <tr id='schedule-<?php echo $schedule->id; ?>'>
127
+ <td><?php echo date_i18n("F d, Y - H:i", $schedule->starttime);?></td>
128
+ <td><?php echo date_i18n("F d, Y - H:i", $schedule->stoptime);?></td>
129
+ <td><center><?php echo $schedule->maxclicks; ?> / <?php echo $stats_schedule['clicks']; ?></center></td>
130
+ <td><center><?php echo $schedule->maximpressions; ?> / <?php echo $stats_schedule['impressions']; ?></center></td>
131
+ </tr>
132
+ <?php
133
+ unset($stats_schedule);
134
+ }
135
+ ?>
136
+ </tbody>
137
+ </table>
138
+
139
+ <p><center>
140
+ <?php _e('Get more features with AdRotate Pro', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!<br />
141
+ <em><small><strong><?php _e('Note:', 'adrotate'); ?></strong> <?php _e('All statistics are indicative. They do not nessesarily reflect results counted by other parties.', 'adrotate'); ?></small></em>
142
+ </center></p>
dashboard/publisher/statistics-group.php ADDED
@@ -0,0 +1,114 @@
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from it's use.
10
+ ------------------------------------------------------------------------------------ */
11
+
12
+ $title = $wpdb->get_var("SELECT `name` FROM `{$wpdb->prefix}adrotate_groups` WHERE `id` = {$id};");
13
+ $stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$id};", ARRAY_A);
14
+ $stats_today = $wpdb->get_row("SELECT `clicks`, `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$id} AND `thetime` = {$today};", ARRAY_A);
15
+
16
+ $start_last_month = mktime(0, 0, 0, date("m")-1, 1, date("Y"));
17
+ $end_last_month = mktime(0, 0, 0, date("m")-1, date("t"), date("Y"));
18
+ $stats_last_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$id} AND `thetime` >= {$start_last_month} AND `thetime` <= {$end_last_month};", ARRAY_A);
19
+
20
+ $start_this_month = mktime(0, 0, 0, date("m"), 1, date("Y"));
21
+ $end_this_month = mktime(0, 0, 0, date("m"), date("t"), date("Y"));
22
+ $stats_this_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$id} AND `thetime` >= {$start_this_month} AND `thetime` <= {$end_this_month};", ARRAY_A);
23
+
24
+ $stats_graph_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = {$id} AND `thetime` >= {$monthstart} AND `thetime` <= {$monthend};", ARRAY_A);
25
+
26
+ // Prevent gaps in display
27
+ if(empty($stats['impressions'])) $stats['impressions'] = 0;
28
+ if(empty($stats['clicks'])) $stats['clicks'] = 0;
29
+ if(empty($stats_today['impressions'])) $stats_today['impressions'] = 0;
30
+ if(empty($stats_today['clicks'])) $stats_today['clicks'] = 0;
31
+ if(empty($stats_last_month['impressions'])) $stats_last_month['impressions'] = 0;
32
+ if(empty($stats_last_month['clicks'])) $stats_last_month['clicks'] = 0;
33
+ if(empty($stats_this_month['impressions'])) $stats_this_month['impressions'] = 0;
34
+ if(empty($stats_this_month['clicks'])) $stats_this_month['clicks'] = 0;
35
+ if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
36
+ if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
37
+
38
+ // Get Click Through Rate
39
+ $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
40
+ $ctr_today = adrotate_ctr($stats_today['clicks'], $stats_today['impressions']);
41
+ $ctr_last_month = adrotate_ctr($stats_last_month['clicks'], $stats_last_month['impressions']);
42
+ $ctr_this_month = adrotate_ctr($stats_this_month['clicks'], $stats_this_month['impressions']);
43
+ $ctr_graph_month = adrotate_ctr($stats_graph_month['clicks'], $stats_graph_month['impressions']);
44
+ ?>
45
+
46
+ <h2><?php _e('Statistics for group', 'adrotate'); ?> '<?php echo stripslashes($title); ?>'</h2>
47
+ <table class="widefat" style="margin-top: .5em">
48
+
49
+ <thead>
50
+ <tr>
51
+ <th colspan="3"><center><strong><?php _e('Today', 'adrotate'); ?></strong></center></th>
52
+ <th>&nbsp;</th>
53
+ <th colspan="3"><center><strong><?php _e('All time', 'adrotate'); ?></strong></center></th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr>
58
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['impressions']; ?></div></div></td>
59
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_today['clicks']; ?></div></div></td>
60
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_today.' %'; ?></div></div></td>
61
+
62
+ <td>&nbsp;</td>
63
+
64
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['impressions']; ?></div></div></td>
65
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['clicks']; ?></div></div></td>
66
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr.' %'; ?></div></div></td>
67
+ </tr>
68
+ </tbody>
69
+ <thead>
70
+ <tr>
71
+ <th colspan="3"><center><strong><?php _e('Last month', 'adrotate'); ?></strong></center></th>
72
+ <th>&nbsp;</th>
73
+ <th colspan="3"><center><strong><?php _e('This month', 'adrotate'); ?></strong></center></th>
74
+ </tr>
75
+ </thead>
76
+ <tbody>
77
+ <tr>
78
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_last_month['impressions']; ?></div></div></td>
79
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_last_month['clicks']; ?></div></div></td>
80
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_last_month.' %'; ?></div></div></td>
81
+
82
+ <td>&nbsp;</td>
83
+
84
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_this_month['impressions']; ?></div></div></td>
85
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_this_month['clicks']; ?></div></div></td>
86
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_this_month.' %'; ?></div></div></td>
87
+ </tr>
88
+ <tbody>
89
+
90
+ </table>
91
+
92
+ <h2><?php _e('Monthly overview of clicks and impressions', 'adrotate'); ?></h2>
93
+ <table class="widefat" style="margin-top: .5em">
94
+
95
+ <tbody>
96
+ <tr>
97
+ <th colspan="3">
98
+ <div style="text-align:center;"><?php echo adrotate_stats_nav('groups', $id, $month, $year); ?></div>
99
+ <?php echo adrotate_stats_graph('groups', false, $id, 1, $monthstart, $monthend); ?>
100
+ </th>
101
+ </tr>
102
+ <tr>
103
+ <td width="33%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['impressions']; ?></div></div></td>
104
+ <td width="33%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats_graph_month['clicks']; ?></div></div></td>
105
+ <td width="34%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_graph_month; ?> %</div></div></td>
106
+ </tr>
107
+ </tbody>
108
+
109
+ </table>
110
+
111
+ <p><center>
112
+ <?php _e('Get more features with AdRotate Pro', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!<br />
113
+ <em><small><strong><?php _e('Note:', 'adrotate'); ?></strong> <?php _e('All statistics are indicative. They do not nessesarily reflect results counted by other parties.', 'adrotate'); ?></small></em>
114
+ </center></p>
dashboard/publisher/statistics-main.php ADDED
@@ -0,0 +1,75 @@
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2017 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from it's use.
10
+ ------------------------------------------------------------------------------------ */
11
+ ?>
12
+ <h2><?php _e('Statistics', 'adrotate'); ?></h2>
13
+
14
+ <table class="widefat" style="margin-top: .5em">
15
+ <thead>
16
+ <tr>
17
+ <th colspan="3"><center><strong><?php _e('General', 'adrotate'); ?></strong></center></th>
18
+ <th>&nbsp;</th>
19
+ <th colspan="3"><center><strong><?php _e('All time', 'adrotate'); ?></strong></center></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <tr>
24
+ <td width="16%"><div class="stats_large"><?php _e('Adverts', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['banners']; ?></div></div></td>
25
+ <td width="16%">&nbsp;</td>
26
+ <td width="16%"><div class="stats_large"><?php _e('Adverts counting stats', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['tracker']; ?></div></div></td>
27
+ <td>&nbsp;</td>
28
+ <td width="16%"><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['overall_impressions']; ?></div></div></td>
29
+ <td width="16%"><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['overall_clicks']; ?></div></div></td>
30
+ <td width="16%"><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_alltime; ?> %</div></div></td>
31
+ </tr>
32
+ </tbody>
33
+ <thead>
34
+ <tr>
35
+ <th colspan="3"><center><strong><?php _e('Last month', 'adrotate'); ?></strong></center></th>
36
+ <th>&nbsp;</th>
37
+ <th colspan="3"><center><strong><?php _e('This month', 'adrotate'); ?></strong></center></th>
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ <tr>
42
+ <td><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['last_month_impressions']; ?></div></div></td>
43
+ <td><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['last_month_clicks']; ?></div></div></td>
44
+ <td><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_last_month.' %'; ?></div></div></td>
45
+ <td>&nbsp;</td>
46
+ <td><div class="stats_large"><?php _e('Impressions', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['this_month_impressions']; ?></div></div></td>
47
+ <td><div class="stats_large"><?php _e('Clicks', 'adrotate'); ?><br /><div class="number_large"><?php echo $stats['this_month_clicks']; ?></div></div></td>
48
+ <td><div class="stats_large"><?php _e('CTR', 'adrotate'); ?><br /><div class="number_large"><?php echo $ctr_this_month.' %'; ?></div></div></td>
49
+ </tr>
50
+ </tbody>
51
+ </table>
52
+
53
+ <h2><?php _e('Monthly overview of clicks and impressions', 'adrotate'); ?></h2>
54
+ <table class="widefat" style="margin-top: .5em">
55
+
56
+ <tbody>
57
+ <tr>
58
+ <th colspan="3">
59
+ <div style="text-align:center;"><?php echo adrotate_stats_nav('fullreport', 0, $month, $year); ?></div>
60
+ <?php echo adrotate_stats_graph('fullreport', false, 0, 1, $monthstart, $monthend); ?>
61
+ </th>
62
+ </tr>
63
+ <tr>
64
+ <td width="33%"><div class="stats_large"><?php _e('Impressions', 'adrotate-pro'); ?><br /><div class="number_large"><?php echo $stats_graph_month['impressions']; ?></div></div></td>
65
+ <td width="33%"><div class="stats_large"><?php _e('Clicks', 'adrotate-pro'); ?><br /><div class="number_large"><?php echo $stats_graph_month['clicks']; ?></div></div></td>
66
+ <td width="34%"><div class="stats_large"><?php _e('CTR', 'adrotate-pro'); ?><br /><div class="number_large"><?php echo $ctr_graph_month; ?> %</div></div></td>
67
+ </tr>
68
+ </tbody>
69
+
70
+ </table>
71
+
72
+ <p><center>
73
+ <?php _e('Get more features with AdRotate Pro', 'adrotate'); ?> - <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!<br />
74
+ <em><small><strong><?php _e('Note:', 'adrotate'); ?></strong> <?php _e('All statistics are indicative. They do not nessesarily reflect results counted by other parties.', 'adrotate'); ?></small></em>
75
+ </center></p>
images/cross.png ADDED
Binary file
images/tick.png ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.arnan.me/donate/?utm_campaign=donations&utm_medium=readm
4
Tags: ad, advert, adsense, advertising, doubleclick, responsive, ad rotator, ad manager, banner manager, advert manager, analytics, advertisement,
5
Requires at least: 3.8
6
Tested up to: 4.8
7
- Stable tag: 4.5
8
License: GPLv3
9
10
Monetise your website with adverts while keeping things simple. Start making money today!
@@ -98,9 +98,11 @@ You can also post your questions on the [forum](https://ajdg.solutions/forums/?u
98
99
Be a Professional and go Pro. With [AdRotate Professional](https://ajdg.solutions/plugins/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
100
101
- = 4.5 FREE =
102
- * [new] Basic advert code generator
103
- * [fix] Unable to edit adverts with empty titles
104
105
= 4.8 PRO =
106
* [new] Advert code generator
@@ -112,8 +114,10 @@ All recent changes are available on the [AdRotate website](https://ajdg.solution
112
113
== Upgrade Notice ==
114
115
- * [new] Basic advert code generator
116
- * [fix] Unable to edit adverts with empty titles
117
118
== Screenshots ==
119
4
Tags: ad, advert, adsense, advertising, doubleclick, responsive, ad rotator, ad manager, banner manager, advert manager, analytics, advertisement,
5
Requires at least: 3.8
6
Tested up to: 4.8
7
+ Stable tag: 4.6
8
License: GPLv3
9
10
Monetise your website with adverts while keeping things simple. Start making money today!
98
99
Be a Professional and go Pro. With [AdRotate Professional](https://ajdg.solutions/plugins/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
100
101
+ = 4.6 FREE =
102
+ * [new] Better stats display
103
+ * [fix] Improved PHP7 compatibility
104
+ * [fix] Schedule properly removed when removing advert
105
+ * [change] Dashboard tweaks and improvements
106
107
= 4.8 PRO =
108
* [new] Advert code generator
114
115
== Upgrade Notice ==
116
117
+ * [new] Better stats display
118
+ * [fix] Improved PHP7 compatibility
119
+ * [fix] Schedule properly removed when removing advert
120
+ * [change] Dashboard tweaks and improvements
121
122
== Screenshots ==
123