Version Description
- Updated the read permission of the download post type to fix the permalink of the item (shown below the title of the post when editing).
- Changed the downloads menu permission from 'update_core' to 'manage_options' for better compatibility with WP Multi-Site install.
Download this release
Release Info
Developer | mra13 |
Plugin | Simple Download Monitor |
Version | 3.9.5.1 |
Comparing to | |
See all releases |
Code changes from version 3.9.2 to 3.9.5.1
- includes/admin-side/sdm-admin-export-logs.php +122 -0
- includes/sdm-admin-menu-handler.php +104 -36
- includes/sdm-utility-functions-admin-side.php +185 -2
- includes/sdm-utility-functions.php +8 -0
- includes/templates/fancy1/sdm-fancy-1.php +1 -1
- includes/templates/fancy2/sdm-fancy-2.php +5 -5
- includes/templates/fancy3/sdm-fancy-3.php +2 -2
- main.php +3 -3
- readme.txt +21 -1
- sdm-post-type-and-taxonomy.php +13 -1
- sdm-post-type-content-handler.php +2 -1
- sdm-shortcodes.php +4 -0
includes/admin-side/sdm-admin-export-logs.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function sdm_logs_export_tab_page() {
|
4 |
+
// jQuery functions
|
5 |
+
wp_enqueue_script('jquery-ui-datepicker');
|
6 |
+
wp_enqueue_style('sdm_jquery_ui_style');
|
7 |
+
|
8 |
+
// tab heading
|
9 |
+
echo '<h2>';
|
10 |
+
_e('Export Download Log Entries', 'simple-download-monitor');
|
11 |
+
echo '</h2>';
|
12 |
+
|
13 |
+
// datetime fileds
|
14 |
+
if (isset($_POST['sdm_stats_start_date'])) {
|
15 |
+
$start_date = sanitize_text_field($_POST['sdm_stats_start_date']);
|
16 |
+
} else {
|
17 |
+
// default start date is 30 days back
|
18 |
+
$start_date = date('Y-m-d', time() - 60 * 60 * 24 * 30);
|
19 |
+
}
|
20 |
+
|
21 |
+
if (isset($_POST['sdm_stats_end_date'])) {
|
22 |
+
$end_date = sanitize_text_field($_POST['sdm_stats_end_date']);
|
23 |
+
} else {
|
24 |
+
$end_date = date('Y-m-d', time());
|
25 |
+
}
|
26 |
+
|
27 |
+
// csv export message box
|
28 |
+
if (isset($_POST['sdm_export_log_entries'])) {
|
29 |
+
//validate date fields
|
30 |
+
if (sdm_validate_date_field([$start_date, $end_date])) {
|
31 |
+
//Export log entries
|
32 |
+
$log_file_url = sdm_export_download_logs_to_csv($start_date, $end_date);
|
33 |
+
echo '<div id="message" class="updated"><p>';
|
34 |
+
_e('Log entries exported! Click on the following link to download the file.', 'simple-download-monitor');
|
35 |
+
echo '<br /><br /><a href="' . $log_file_url . '">' . __('Download Logs CSV File', 'simple-download-monitor') . '</a>';
|
36 |
+
echo '</p></div>';
|
37 |
+
}else{
|
38 |
+
echo '<div id="message" class="error"><p>';
|
39 |
+
_e('Please select a valid date range.', 'simple-download-monitor');
|
40 |
+
echo '</p></div>';
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
?>
|
45 |
+
|
46 |
+
<div style="background:#ECECEC;border:1px solid #CCC;padding:0 10px;margin-top:5px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;">
|
47 |
+
<p><?php _e('This menu allows you to export all the log entries to a CSV file that you can download. The download link will be shown at the top of this page.', 'simple-download-monitor'); ?></p>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<div id="poststuff">
|
51 |
+
<div id="post-body">
|
52 |
+
<div class="postbox">
|
53 |
+
<h3 class="hndle"><label
|
54 |
+
for="title"><?php _e('Choose Date Range (yyyy-mm-dd)', 'simple-download-monitor'); ?></label>
|
55 |
+
</h3>
|
56 |
+
<div class="inside">
|
57 |
+
<form id="sdm_choose_logs_date" method="post"
|
58 |
+
onSubmit="return confirm('Are you sure you want to export all the log entries?');">
|
59 |
+
<div>
|
60 |
+
<label for="sdm_stats_start_date_input"><?php _e('Start Date: ', 'simple-download-monitor'); ?></label>
|
61 |
+
<input type="text"
|
62 |
+
id="sdm_stats_start_date_input"
|
63 |
+
class="datepicker d-block w-100"
|
64 |
+
name="sdm_stats_start_date"
|
65 |
+
value="<?php echo $start_date; ?>">
|
66 |
+
<label for="sdm_stats_end_date_input"><?php _e('End Date: ', 'simple-download-monitor'); ?></label>
|
67 |
+
<input type="text"
|
68 |
+
id="sdm_stats_end_date_input"
|
69 |
+
class="datepicker d-block w-100"
|
70 |
+
name="sdm_stats_end_date"
|
71 |
+
value="<?php echo $end_date; ?>">
|
72 |
+
</div>
|
73 |
+
<br>
|
74 |
+
<div id="sdm_logs_date_buttons">
|
75 |
+
<button class="button" type="button"
|
76 |
+
data-start-date="<?php echo date('Y-m-d'); ?>"
|
77 |
+
data-end-date="<?php echo date('Y-m-d'); ?>"><?php _e('Today', 'simple-download-monitor'); ?></button>
|
78 |
+
<button class="button" type="button"
|
79 |
+
data-start-date="<?php echo date('Y-m-01'); ?>"
|
80 |
+
data-end-date="<?php echo date('Y-m-d'); ?>"><?php _e('This Month', 'simple-download-monitor'); ?></button>
|
81 |
+
<button class="button" type="button"
|
82 |
+
data-start-date="<?php echo date('Y-m-d', strtotime('first day of last month')); ?>"
|
83 |
+
data-end-date="<?php echo date('Y-m-d', strtotime('last day of last month')); ?>"><?php _e('Last Month', 'simple-download-monitor'); ?></button>
|
84 |
+
<button class="button" type="button"
|
85 |
+
data-start-date="<?php echo date('Y-01-01'); ?>"
|
86 |
+
data-end-date="<?php echo date('Y-m-d'); ?>"><?php _e('This Year', 'simple-download-monitor'); ?></button>
|
87 |
+
<button class="button" type="button"
|
88 |
+
data-start-date="<?php echo date("Y-01-01", strtotime("-1 year")); ?>"
|
89 |
+
data-end-date="<?php echo date("Y-12-31", strtotime('last year')); ?>"><?php _e('Last Year', 'simple-download-monitor'); ?></button>
|
90 |
+
<button class="button" type="button"
|
91 |
+
data-start-date="<?php echo "1970-01-01"; ?>"
|
92 |
+
data-end-date="<?php echo date('Y-m-d'); ?>"><?php _e('All Time', 'simple-download-monitor'); ?></button>
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<div class="submit">
|
96 |
+
<input type="submit" class="button-primary" name="sdm_export_log_entries"
|
97 |
+
value="<?php _e('Export Log Entries to CSV File', 'simple-download-monitor'); ?>"/>
|
98 |
+
</div>
|
99 |
+
</form>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<?php
|
107 |
+
}
|
108 |
+
|
109 |
+
?>
|
110 |
+
|
111 |
+
<script>
|
112 |
+
jQuery(document).ready(function () {
|
113 |
+
jQuery('#sdm_logs_date_buttons button').click(function (e) {
|
114 |
+
jQuery('#sdm_choose_logs_date').find('input[name="sdm_stats_start_date"]').val(jQuery(this).attr('data-start-date'));
|
115 |
+
jQuery('#sdm_choose_logs_date').find('input[name="sdm_stats_end_date"]').val(jQuery(this).attr('data-end-date'));
|
116 |
+
});
|
117 |
+
|
118 |
+
jQuery('.datepicker').datepicker({
|
119 |
+
dateFormat: 'yy-mm-dd'
|
120 |
+
});
|
121 |
+
});
|
122 |
+
</script>
|
includes/sdm-admin-menu-handler.php
CHANGED
@@ -302,8 +302,9 @@ function sdm_create_logs_page() {
|
|
302 |
echo '<div class="wrap">';
|
303 |
|
304 |
$sdm_logs_menu_tabs = array(
|
305 |
-
|
306 |
-
|
|
|
307 |
);
|
308 |
|
309 |
$current = "";
|
@@ -327,15 +328,19 @@ function sdm_create_logs_page() {
|
|
327 |
echo $content;
|
328 |
|
329 |
if ( isset( $_GET[ 'action' ] ) ) {
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
339 |
} else {
|
340 |
sdm_handle_logs_main_tab_page();
|
341 |
}
|
@@ -347,14 +352,6 @@ function sdm_handle_logs_main_tab_page() {
|
|
347 |
global $wpdb;
|
348 |
$advanced_options = get_option( 'sdm_advanced_options' );
|
349 |
|
350 |
-
if ( isset( $_POST[ 'sdm_export_log_entries' ] ) ) {
|
351 |
-
//Export log entries
|
352 |
-
$log_file_url = sdm_export_download_logs_to_csv();
|
353 |
-
echo '<div id="message" class="updated"><p>';
|
354 |
-
_e( 'Log entries exported! Click on the following link to download the file.', 'simple-download-monitor' );
|
355 |
-
echo '<br /><br /><a href="' . $log_file_url . '">' . __( 'Download Logs CSV File', 'simple-download-monitor' ) . '</a>';
|
356 |
-
echo '</p></div>';
|
357 |
-
}
|
358 |
|
359 |
if ( isset( $_POST[ 'sdm_reset_log_entries' ] ) ) {
|
360 |
//Reset log entries
|
@@ -404,19 +401,6 @@ function sdm_handle_logs_main_tab_page() {
|
|
404 |
|
405 |
<div id="poststuff"><div id="post-body">
|
406 |
|
407 |
-
<!-- Log export button -->
|
408 |
-
<div class="postbox">
|
409 |
-
<h3 class="hndle"><label for="title"><?php _e( 'Export Download Log Entries', 'simple-download-monitor' ); ?></label></h3>
|
410 |
-
<div class="inside">
|
411 |
-
<form method="post" action="" onSubmit="return confirm('Are you sure you want to export all the log entries?');" >
|
412 |
-
<div class="submit">
|
413 |
-
<input type="submit" class="button" name="sdm_export_log_entries" value="<?php _e( 'Export Log Entries to CSV File', 'simple-download-monitor' ); ?>" />
|
414 |
-
<p class="description"><?php _e( 'This button will export all the log entries to a CSV file that you can download. The download link will be shown at the top of this page.', 'simple-download-monitor' ); ?></p>
|
415 |
-
</div>
|
416 |
-
</form>
|
417 |
-
</div>
|
418 |
-
</div>
|
419 |
-
|
420 |
<!-- Log reset button -->
|
421 |
<div class="postbox">
|
422 |
<h3 class="hndle"><label for="title"><?php _e( 'Reset Download Log Entries', 'simple-download-monitor' ); ?></label></h3>
|
@@ -514,9 +498,9 @@ function sdm_create_stats_page() {
|
|
514 |
<h3 class="hndle"><label for="title"><?php _e( 'Choose Date Range (yyyy-mm-dd)', 'simple-download-monitor' ); ?></label></h3>
|
515 |
<div class="inside">
|
516 |
<form id="sdm_choose_date" method="post">
|
517 |
-
<input type="hidden" name="sdm_active_tab" value="<?php echo $active_tab; ?>">
|
518 |
-
<?php _e( 'Start Date: ', 'simple-download-monitor' ); ?><input type="text" class="datepicker" name="sdm_stats_start_date" value="<?php echo $start_date; ?>">
|
519 |
-
<?php _e( 'End Date: ', 'simple-download-monitor' ); ?><input type="text" class="datepicker" name="sdm_stats_end_date" value="<?php echo $
|
520 |
<p id="sdm_date_buttons">
|
521 |
<button type="button" data-start-date="<?php echo date( 'Y-m-01' ); ?>" data-end-date="<?php echo date( 'Y-m-d' ); ?>"><?php _e( 'This Month', 'simple-download-monitor' ); ?></button>
|
522 |
<button type="button" data-start-date="<?php echo date( 'Y-m-d', strtotime( 'first day of last month' ) ); ?>" data-end-date="<?php echo date( 'Y-m-d', strtotime( 'last day of last month' ) ); ?>"><?php _e( 'Last Month', 'simple-download-monitor' ); ?></button>
|
@@ -534,6 +518,9 @@ function sdm_create_stats_page() {
|
|
534 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=datechart" class="nav-tab<?php echo ($active_tab == 'datechart' ? ' nav-tab-active' : ''); ?>" data-tab-name="datechart"><?php _e( 'Downloads by date', 'simple-download-monitor' ); ?></a>
|
535 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=geochart" href="" class="nav-tab<?php echo ($active_tab == 'geochart' ? ' nav-tab-active' : ''); ?>" data-tab-name="geochart"><?php _e( 'Downloads by country', 'simple-download-monitor' ); ?></a>
|
536 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=countrylistchart" href="" class="nav-tab<?php echo ($active_tab == 'countrylistchart' ? ' nav-tab-active' : ''); ?>" data-tab-name="countrylistchart"><?php _e('Downloads by country list', 'simple-download-monitor'); ?></a>
|
|
|
|
|
|
|
537 |
</div>
|
538 |
<div class="sdm-tabs-content-wrapper" style="height: 500px;margin-top: 10px;">
|
539 |
<div data-tab-name="datechart" class="sdm-tab"<?php echo ($active_tab == 'datechart' ? '' : ' style="display:none;"'); ?>>
|
@@ -581,6 +568,87 @@ function sdm_create_stats_page() {
|
|
581 |
</div>
|
582 |
</div><!-- end of countrylistchart -->
|
583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
</div>
|
585 |
</div></div>
|
586 |
</div>
|
@@ -588,7 +656,7 @@ function sdm_create_stats_page() {
|
|
588 |
var sdm = [];
|
589 |
sdm.datechart = false;
|
590 |
sdm.geochart = false;
|
591 |
-
sdm.activeTab = '<?php echo $active_tab; ?>';
|
592 |
sdm.apiKey = '<?php echo esc_js( $api_key ); ?>';
|
593 |
jQuery('#sdm_date_buttons button').click(function (e) {
|
594 |
jQuery('#sdm_choose_date').find('input[name="sdm_stats_start_date"]').val(jQuery(this).attr('data-start-date'));
|
302 |
echo '<div class="wrap">';
|
303 |
|
304 |
$sdm_logs_menu_tabs = array(
|
305 |
+
'sdm-logs' => __('Main Logs', 'simple-download-monitor'),
|
306 |
+
'sdm-logs&action=sdm-logs-by-download' => __('Specific Item Logs', 'simple-download-monitor'),
|
307 |
+
'sdm-logs&action=sdm-logs-export' => __('Export', 'simple-download-monitor'),
|
308 |
);
|
309 |
|
310 |
$current = "";
|
328 |
echo $content;
|
329 |
|
330 |
if ( isset( $_GET[ 'action' ] ) ) {
|
331 |
+
switch ($_GET['action']) {
|
332 |
+
case 'sdm-logs-by-download':
|
333 |
+
include_once(WP_SIMPLE_DL_MONITOR_PATH . 'includes/admin-side/sdm-admin-individual-item-logs-page.php');
|
334 |
+
sdm_handle_individual_logs_tab_page();
|
335 |
+
break;
|
336 |
+
case 'sdm-logs-export':
|
337 |
+
include_once(WP_SIMPLE_DL_MONITOR_PATH . 'includes/admin-side/sdm-admin-export-logs.php');
|
338 |
+
sdm_logs_export_tab_page();
|
339 |
+
break;
|
340 |
+
default:
|
341 |
+
sdm_handle_logs_main_tab_page();
|
342 |
+
break;
|
343 |
+
}
|
344 |
} else {
|
345 |
sdm_handle_logs_main_tab_page();
|
346 |
}
|
352 |
global $wpdb;
|
353 |
$advanced_options = get_option( 'sdm_advanced_options' );
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
if ( isset( $_POST[ 'sdm_reset_log_entries' ] ) ) {
|
357 |
//Reset log entries
|
401 |
|
402 |
<div id="poststuff"><div id="post-body">
|
403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
<!-- Log reset button -->
|
405 |
<div class="postbox">
|
406 |
<h3 class="hndle"><label for="title"><?php _e( 'Reset Download Log Entries', 'simple-download-monitor' ); ?></label></h3>
|
498 |
<h3 class="hndle"><label for="title"><?php _e( 'Choose Date Range (yyyy-mm-dd)', 'simple-download-monitor' ); ?></label></h3>
|
499 |
<div class="inside">
|
500 |
<form id="sdm_choose_date" method="post">
|
501 |
+
<input type="hidden" name="sdm_active_tab" value="<?php echo sdm_sanitize_text($active_tab); ?>">
|
502 |
+
<?php _e( 'Start Date: ', 'simple-download-monitor' ); ?><input type="text" class="datepicker" name="sdm_stats_start_date" value="<?php echo sdm_sanitize_text($start_date); ?>">
|
503 |
+
<?php _e( 'End Date: ', 'simple-download-monitor' ); ?><input type="text" class="datepicker" name="sdm_stats_end_date" value="<?php echo sdm_sanitize_text($start_date); ?>">
|
504 |
<p id="sdm_date_buttons">
|
505 |
<button type="button" data-start-date="<?php echo date( 'Y-m-01' ); ?>" data-end-date="<?php echo date( 'Y-m-d' ); ?>"><?php _e( 'This Month', 'simple-download-monitor' ); ?></button>
|
506 |
<button type="button" data-start-date="<?php echo date( 'Y-m-d', strtotime( 'first day of last month' ) ); ?>" data-end-date="<?php echo date( 'Y-m-d', strtotime( 'last day of last month' ) ); ?>"><?php _e( 'Last Month', 'simple-download-monitor' ); ?></button>
|
518 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=datechart" class="nav-tab<?php echo ($active_tab == 'datechart' ? ' nav-tab-active' : ''); ?>" data-tab-name="datechart"><?php _e( 'Downloads by date', 'simple-download-monitor' ); ?></a>
|
519 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=geochart" href="" class="nav-tab<?php echo ($active_tab == 'geochart' ? ' nav-tab-active' : ''); ?>" data-tab-name="geochart"><?php _e( 'Downloads by country', 'simple-download-monitor' ); ?></a>
|
520 |
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=countrylistchart" href="" class="nav-tab<?php echo ($active_tab == 'countrylistchart' ? ' nav-tab-active' : ''); ?>" data-tab-name="countrylistchart"><?php _e('Downloads by country list', 'simple-download-monitor'); ?></a>
|
521 |
+
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=browserList" href="" class="nav-tab<?php echo ($active_tab == 'browserList' ? ' nav-tab-active' : ''); ?>" data-tab-name="browserList"><?php _e('Downloads by browser', 'simple-download-monitor'); ?></a>
|
522 |
+
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=osList" href="" class="nav-tab<?php echo ($active_tab == 'osList' ? ' nav-tab-active' : ''); ?>" data-tab-name="osList"><?php _e('Downloads by OS', 'simple-download-monitor'); ?></a>
|
523 |
+
<a href="edit.php?post_type=sdm_downloads&page=stats&sdm_active_tab=topDownloads" href="" class="nav-tab<?php echo ($active_tab == 'topDownloads' ? ' nav-tab-active' : ''); ?>" data-tab-name="topDownloads"><?php _e('Top Downloads', 'simple-download-monitor'); ?></a>
|
524 |
</div>
|
525 |
<div class="sdm-tabs-content-wrapper" style="height: 500px;margin-top: 10px;">
|
526 |
<div data-tab-name="datechart" class="sdm-tab"<?php echo ($active_tab == 'datechart' ? '' : ' style="display:none;"'); ?>>
|
568 |
</div>
|
569 |
</div><!-- end of countrylistchart -->
|
570 |
|
571 |
+
<div data-tab-name="browserList"
|
572 |
+
class="sdm-tab"<?php echo($active_tab == 'browserList' ? '' : ' style="display:none;"'); ?>>
|
573 |
+
<div class="wrap">
|
574 |
+
<table class="widefat">
|
575 |
+
<thead>
|
576 |
+
<th><strong><?php _e('Browser', 'simple-download-monitor'); ?></strong></th>
|
577 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
578 |
+
</thead>
|
579 |
+
<tbody>
|
580 |
+
<?php
|
581 |
+
$downloads_by_browser_array = sdm_get_all_downloads_by_browser($start_date, $end_date);
|
582 |
+
foreach ($downloads_by_browser_array as $name => $count){
|
583 |
+
?>
|
584 |
+
<tr>
|
585 |
+
<td><?php echo $name ?></td>
|
586 |
+
<td><?php echo $count ?></td>
|
587 |
+
</tr>
|
588 |
+
<?php } ?>
|
589 |
+
</tbody>
|
590 |
+
<tfoot>
|
591 |
+
<th><strong><?php _e('Browser', 'simple-download-monitor'); ?></strong></th>
|
592 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
593 |
+
</tfoot>
|
594 |
+
</table>
|
595 |
+
</div>
|
596 |
+
</div><!-- end of browserList tab-->
|
597 |
+
|
598 |
+
<div data-tab-name="osList"
|
599 |
+
class="sdm-tab"<?php echo($active_tab == 'osList' ? '' : ' style="display:none;"'); ?>>
|
600 |
+
<div class="wrap">
|
601 |
+
<table class="widefat">
|
602 |
+
<thead>
|
603 |
+
<th><strong><?php _e('Operating System', 'simple-download-monitor'); ?></strong></th>
|
604 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
605 |
+
</thead>
|
606 |
+
<tbody>
|
607 |
+
<?php
|
608 |
+
$downloads_by_os_array = sdm_get_all_downloads_by_os($start_date, $end_date);
|
609 |
+
foreach ($downloads_by_os_array as $name => $count){
|
610 |
+
?>
|
611 |
+
<tr>
|
612 |
+
<td><?php echo $name ?></td>
|
613 |
+
<td><?php echo $count ?></td>
|
614 |
+
</tr>
|
615 |
+
<?php } ?>
|
616 |
+
</tbody>
|
617 |
+
<tfoot>
|
618 |
+
<th><strong><?php _e('Operating System', 'simple-download-monitor'); ?></strong></th>
|
619 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
620 |
+
</tfoot>
|
621 |
+
</table>
|
622 |
+
</div>
|
623 |
+
</div><!-- end of osList tab-->
|
624 |
+
|
625 |
+
<div data-tab-name="topDownloads"
|
626 |
+
class="sdm-tab"<?php echo($active_tab == 'topDownloads' ? '' : ' style="display:none;"'); ?>>
|
627 |
+
<div class="wrap">
|
628 |
+
<table class="widefat">
|
629 |
+
<thead>
|
630 |
+
<th><strong><?php _e('Download Item', 'simple-download-monitor'); ?></strong></th>
|
631 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
632 |
+
</thead>
|
633 |
+
<tbody>
|
634 |
+
<?php
|
635 |
+
$downloads_by_count = sdm_get_top_downloads_by_count($start_date, $end_date, 15);
|
636 |
+
foreach ($downloads_by_count as $item){
|
637 |
+
?>
|
638 |
+
<tr>
|
639 |
+
<td><?php echo $item['post_title'] ?></td>
|
640 |
+
<td><?php echo $item['cnt'] ?></td>
|
641 |
+
</tr>
|
642 |
+
<?php } ?>
|
643 |
+
</tbody>
|
644 |
+
<tfoot>
|
645 |
+
<th><strong><?php _e('Download Item', 'simple-download-monitor'); ?></strong></th>
|
646 |
+
<th><strong><?php _e('Total Downloads', 'simple-download-monitor'); ?></strong></th>
|
647 |
+
</tfoot>
|
648 |
+
</table>
|
649 |
+
</div>
|
650 |
+
</div><!-- end of top downloads tab-->
|
651 |
+
|
652 |
</div>
|
653 |
</div></div>
|
654 |
</div>
|
656 |
var sdm = [];
|
657 |
sdm.datechart = false;
|
658 |
sdm.geochart = false;
|
659 |
+
sdm.activeTab = '<?php echo sdm_sanitize_text($active_tab); ?>';
|
660 |
sdm.apiKey = '<?php echo esc_js( $api_key ); ?>';
|
661 |
jQuery('#sdm_date_buttons button').click(function (e) {
|
662 |
jQuery('#sdm_choose_date').find('input[name="sdm_stats_start_date"]').val(jQuery(this).attr('data-start-date'));
|
includes/sdm-utility-functions-admin-side.php
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function sdm_export_download_logs_to_csv() {
|
|
|
|
|
|
|
4 |
|
5 |
global $wpdb;
|
6 |
$table_name = $wpdb->prefix . 'sdm_downloads';
|
7 |
-
$
|
|
|
8 |
|
9 |
$csv_file_path = WP_SIMPLE_DL_MONITOR_PATH . "sdm-download-logs.csv";
|
10 |
$fp = fopen($csv_file_path, 'w');
|
@@ -68,3 +72,182 @@ function sdm_get_downloads_by_country($start_date = '', $end_date = '', $returnS
|
|
68 |
return $res;
|
69 |
}
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
+
function sdm_export_download_logs_to_csv($start_date, $end_date) {
|
4 |
+
//appending time to start and end date
|
5 |
+
$start_date .= ' 00:00:00';
|
6 |
+
$end_date .= ' 23:59:59';
|
7 |
|
8 |
global $wpdb;
|
9 |
$table_name = $wpdb->prefix . 'sdm_downloads';
|
10 |
+
$resultset_query = $wpdb->prepare("SELECT * FROM $table_name WHERE date_time BETWEEN %s AND %s ORDER BY id DESC", $start_date, $end_date);
|
11 |
+
$resultset = $wpdb->get_results($resultset_query, OBJECT);
|
12 |
|
13 |
$csv_file_path = WP_SIMPLE_DL_MONITOR_PATH . "sdm-download-logs.csv";
|
14 |
$fp = fopen($csv_file_path, 'w');
|
72 |
return $res;
|
73 |
}
|
74 |
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Retrieves all user agent fields form downloads
|
78 |
+
*
|
79 |
+
* @param string $start_date
|
80 |
+
* @param string $end_date
|
81 |
+
*
|
82 |
+
* @return array
|
83 |
+
*/
|
84 |
+
function sdm_get_all_download_user_agent($start_date = '', $end_date = '') {
|
85 |
+
global $wpdb;
|
86 |
+
|
87 |
+
$q = $wpdb->prepare("SELECT user_agent
|
88 |
+
FROM " . $wpdb->prefix . "sdm_downloads
|
89 |
+
WHERE DATE_FORMAT(`date_time`,'%%Y-%%m-%%d')>=%s
|
90 |
+
AND DATE_FORMAT(`date_time`,'%%Y-%%m-%%d')<=%s", $start_date, $end_date);
|
91 |
+
|
92 |
+
return $wpdb->get_results($q, ARRAY_A);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Processes all user agent to browser
|
97 |
+
*
|
98 |
+
* @param string $start_date
|
99 |
+
* @param string $end_date
|
100 |
+
*
|
101 |
+
* @return array
|
102 |
+
*/
|
103 |
+
|
104 |
+
function sdm_get_all_downloads_by_browser($start_date = '', $end_date = '') {
|
105 |
+
$user_agents = sdm_get_all_download_user_agent($start_date, $end_date);
|
106 |
+
|
107 |
+
$browsers = array();
|
108 |
+
foreach ($user_agents as $agent) {
|
109 |
+
$browserArray = array(
|
110 |
+
'Microsoft Edge' => 'Edg',
|
111 |
+
'Opera' => '(OPR)|(OPX)',
|
112 |
+
'Vivaldi' => 'Vivaldi',
|
113 |
+
'Firefox' => 'Firefox',
|
114 |
+
"Samsung Browser" => 'SamsungBrowser',
|
115 |
+
'Chrome' => 'Chrome',
|
116 |
+
'Internet Explorer' => 'MSIE',
|
117 |
+
'Safari' => 'Safari'
|
118 |
+
);
|
119 |
+
$browser = "Other";
|
120 |
+
foreach ($browserArray as $k => $v) {
|
121 |
+
if (preg_match("/$v/", $agent['user_agent'])) {
|
122 |
+
$browser = $k;
|
123 |
+
break;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
if (isset($browsers[$browser])) {
|
127 |
+
$browsers[$browser] += 1;
|
128 |
+
} else {
|
129 |
+
$browsers[$browser] = 1;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
return moveArrayElementToEnd($browsers, 'Other');
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Processes all user agent to operating system
|
137 |
+
*
|
138 |
+
* @param string $start_date
|
139 |
+
* @param string $end_date
|
140 |
+
*
|
141 |
+
* @return array
|
142 |
+
*/
|
143 |
+
|
144 |
+
function sdm_get_all_downloads_by_os($start_date = '', $end_date = '') {
|
145 |
+
$user_agents = sdm_get_all_download_user_agent($start_date, $end_date);
|
146 |
+
|
147 |
+
$operating_systems = array();
|
148 |
+
foreach ($user_agents as $agent) {
|
149 |
+
$osArray = array(
|
150 |
+
"Windows 10 Phone" => "(Windows Phone)|(Microsoft; Lumia)",
|
151 |
+
"Android" => "(Linux; Android)|Android",
|
152 |
+
"ChromeOS" => "(X11; CrOS)",
|
153 |
+
"SymbianOS" => "SymbianOS",
|
154 |
+
'Windows 98' => '(Win98)|(Windows 98)',
|
155 |
+
'Windows 2000' => '(Windows 2000)|(Windows NT 5.0)',
|
156 |
+
'Windows ME' => 'Windows ME',
|
157 |
+
'Windows XP' => '(Windows XP)|(Windows NT 5.1)',
|
158 |
+
'Windows Vista' => 'Windows NT 6.0',
|
159 |
+
'Windows 8' => 'Windows NT 6.2',
|
160 |
+
'Windows 8.1' => 'Windows NT 6.3',
|
161 |
+
'Windows 7' => '(Windows NT 6.1)|(Windows NT 7.0)',
|
162 |
+
'Windows 10' => 'Windows NT 10.0',
|
163 |
+
'Linux' => '(X11)|(Linux)',
|
164 |
+
'iOS' => '(Apple-iPhone)|(iPhone)|(iPhone OS)',
|
165 |
+
'macOS' => '(Mac_PowerPC)|(Macintosh)|(Mac OS)'
|
166 |
+
);
|
167 |
+
$os = "Other";
|
168 |
+
foreach ($osArray as $k => $v) {
|
169 |
+
if (preg_match("/$v/", $agent['user_agent'])) {
|
170 |
+
$os = $k;
|
171 |
+
break;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
if (isset($operating_systems[$os])) {
|
175 |
+
$operating_systems[$os] += 1;
|
176 |
+
} else {
|
177 |
+
$operating_systems[$os] = 1;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
return moveArrayElementToEnd($operating_systems, "Other");
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Retrieves top downloads by download count
|
185 |
+
*
|
186 |
+
* @param string $start_date
|
187 |
+
* @param string $end_date
|
188 |
+
* @param int $limit Total number of records to retrieve
|
189 |
+
*
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
function sdm_get_top_downloads_by_count($start_date = '', $end_date = '', $limit = 25) {
|
193 |
+
global $wpdb;
|
194 |
+
|
195 |
+
$q = $wpdb->prepare("SELECT COUNT(id) as cnt, post_title
|
196 |
+
FROM " . $wpdb->prefix . "sdm_downloads
|
197 |
+
WHERE DATE_FORMAT(`date_time`,'%%Y-%%m-%%d')>=%s
|
198 |
+
AND DATE_FORMAT(`date_time`,'%%Y-%%m-%%d')<=%s
|
199 |
+
GROUP BY post_title
|
200 |
+
ORDER BY cnt DESC LIMIT $limit", $start_date, $end_date);
|
201 |
+
$res = $wpdb->get_results($q, ARRAY_A);
|
202 |
+
|
203 |
+
return $res;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Checks if valid date or not
|
208 |
+
*
|
209 |
+
* @param mixed $data
|
210 |
+
*
|
211 |
+
* @return boolean
|
212 |
+
*/
|
213 |
+
function sdm_validate_date_field($data) {
|
214 |
+
if (is_array($data)) {
|
215 |
+
foreach ($data as $date) {
|
216 |
+
$date_elements = explode('-', $date);
|
217 |
+
|
218 |
+
$year = isset($date_elements[0]) ? $date_elements[0] : null;
|
219 |
+
$month = isset($date_elements[1]) ? $date_elements[1] : null;
|
220 |
+
$day = isset($date_elements[2]) ? $date_elements[2] : null;
|
221 |
+
|
222 |
+
return checkdate((int)$month, (int)$day, (int)$year);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
$date_elements = explode('-', $data);
|
226 |
+
|
227 |
+
$year = isset($date_elements[0]) ? $date_elements[0] : null;
|
228 |
+
$month = isset($date_elements[1]) ? $date_elements[1] : null;
|
229 |
+
$day = isset($date_elements[2]) ? $date_elements[2] : null;
|
230 |
+
|
231 |
+
return checkdate((int)$month, (int)$day, (int)$year);
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* move an array element by its key to the end.
|
236 |
+
*
|
237 |
+
* @param array $array The array being reordered.
|
238 |
+
* @param string|int $key They key of the element you want to move.
|
239 |
+
*
|
240 |
+
* @return array
|
241 |
+
*/
|
242 |
+
function moveArrayElementToEnd(array &$array, $key)
|
243 |
+
{
|
244 |
+
if(($k = array_search($key, array_keys($array))) === false){
|
245 |
+
return $array;
|
246 |
+
}
|
247 |
+
|
248 |
+
$p1 = array_splice($array, $k, 1);
|
249 |
+
$p2 = array_splice($array, 0, count($array));
|
250 |
+
$array = array_merge($p2, $p1, $array);
|
251 |
+
|
252 |
+
return $array;
|
253 |
+
}
|
includes/sdm-utility-functions.php
CHANGED
@@ -459,4 +459,12 @@ function sdm_insert_download_to_logs_table( $download_id ){
|
|
459 |
SDM_Debug::log('Error! Failed to log the download request in the database table.', false);
|
460 |
}
|
461 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
}
|
459 |
SDM_Debug::log('Error! Failed to log the download request in the database table.', false);
|
460 |
}
|
461 |
}
|
462 |
+
}
|
463 |
+
|
464 |
+
function sdm_sanitize_text( $text ){
|
465 |
+
$text = htmlspecialchars($text);
|
466 |
+
$text = strip_tags($text);
|
467 |
+
$text = sanitize_text_field($text);
|
468 |
+
$text = esc_attr($text);
|
469 |
+
return $text;
|
470 |
}
|
includes/templates/fancy1/sdm-fancy-1.php
CHANGED
@@ -142,7 +142,7 @@ function sdm_generate_fancy1_display_output( $args ) {
|
|
142 |
|
143 |
$output = '';
|
144 |
|
145 |
-
$output .= '<div class="sdm_download_item ' . $css_class . '">';
|
146 |
$output .= '<div class="sdm_download_item_top">';
|
147 |
$output .= '<div class="sdm_download_thumbnail">' . $isset_download_thumbnail . '</div>';
|
148 |
$output .= '<div class="sdm_download_title">' . $item_title . '</div>';
|
142 |
|
143 |
$output = '';
|
144 |
|
145 |
+
$output .= '<div class="sdm_download_item ' . sdm_sanitize_text($css_class) . '">';
|
146 |
$output .= '<div class="sdm_download_item_top">';
|
147 |
$output .= '<div class="sdm_download_thumbnail">' . $isset_download_thumbnail . '</div>';
|
148 |
$output .= '<div class="sdm_download_title">' . $item_title . '</div>';
|
includes/templates/fancy2/sdm-fancy-2.php
CHANGED
@@ -69,7 +69,7 @@ function sdm_generate_fancy2_category_display_output( $get_posts, $args ) {
|
|
69 |
}
|
70 |
|
71 |
/*
|
72 |
-
* Generates the output of a single item using fancy2 sytle
|
73 |
* $args array can have the following parameters
|
74 |
* id, fancy, button_text, new_window
|
75 |
*/
|
@@ -108,7 +108,7 @@ function sdm_generate_fancy2_display_output( $args ) {
|
|
108 |
|
109 |
// Check to see if the download link cpt is password protected
|
110 |
$get_cpt_object = get_post( $id );
|
111 |
-
$cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
|
112 |
// Read plugin settings
|
113 |
$main_opts = get_option( 'sdm_downloads_options' );
|
114 |
|
@@ -156,13 +156,13 @@ function sdm_generate_fancy2_display_output( $args ) {
|
|
156 |
$show_version = get_post_meta( $id, 'sdm_item_show_item_version_fd', true );
|
157 |
}
|
158 |
$isset_item_version = ($show_version && isset( $item_version )) ? $item_version : ''; //check if show_version is enabled and if there is a version value
|
159 |
-
// check show date in fancy display
|
160 |
$show_date_fd = get_post_meta( $id, 'sdm_item_show_date_fd', true );
|
161 |
-
// Get item date
|
162 |
$download_date = get_the_date( get_option( 'date_format' ), $id );
|
163 |
|
164 |
$output = '';
|
165 |
-
$output .= '<div class="sdm_fancy2_item ' . $css_class . '">';
|
166 |
$output .= '<div class="sdm_fancy2_wrapper">';
|
167 |
|
168 |
$output .= '<div class="sdm_fancy2_download_item_top">';
|
69 |
}
|
70 |
|
71 |
/*
|
72 |
+
* Generates the output of a single item using fancy2 sytle
|
73 |
* $args array can have the following parameters
|
74 |
* id, fancy, button_text, new_window
|
75 |
*/
|
108 |
|
109 |
// Check to see if the download link cpt is password protected
|
110 |
$get_cpt_object = get_post( $id );
|
111 |
+
$cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
|
112 |
// Read plugin settings
|
113 |
$main_opts = get_option( 'sdm_downloads_options' );
|
114 |
|
156 |
$show_version = get_post_meta( $id, 'sdm_item_show_item_version_fd', true );
|
157 |
}
|
158 |
$isset_item_version = ($show_version && isset( $item_version )) ? $item_version : ''; //check if show_version is enabled and if there is a version value
|
159 |
+
// check show date in fancy display
|
160 |
$show_date_fd = get_post_meta( $id, 'sdm_item_show_date_fd', true );
|
161 |
+
// Get item date
|
162 |
$download_date = get_the_date( get_option( 'date_format' ), $id );
|
163 |
|
164 |
$output = '';
|
165 |
+
$output .= '<div class="sdm_fancy2_item ' . sdm_sanitize_text($css_class) . '">';
|
166 |
$output .= '<div class="sdm_fancy2_wrapper">';
|
167 |
|
168 |
$output .= '<div class="sdm_fancy2_download_item_top">';
|
includes/templates/fancy3/sdm-fancy-3.php
CHANGED
@@ -42,7 +42,7 @@ function sdm_generate_fancy3_category_display_output( $get_posts, $args ) {
|
|
42 |
}
|
43 |
|
44 |
/*
|
45 |
-
* Generates the output of a single item using fancy2 sytle
|
46 |
* $args array can have the following parameters
|
47 |
* id, fancy, button_text, new_window
|
48 |
*/
|
@@ -88,7 +88,7 @@ function sdm_generate_fancy3_display_output( $args ) {
|
|
88 |
|
89 |
$output = '';
|
90 |
|
91 |
-
$output .= '<div class="sdm_fancy3_download_item ' . $css_class . '">';
|
92 |
$output .= '<div class="sdm_fancy3_download_item_left">';
|
93 |
$output .= '<span class="sdm_fancy3_download_title">' . $item_title . '</span>';
|
94 |
$output .= '</div>'; //End of .sdm_fancy3_download_title
|
42 |
}
|
43 |
|
44 |
/*
|
45 |
+
* Generates the output of a single item using fancy2 sytle
|
46 |
* $args array can have the following parameters
|
47 |
* id, fancy, button_text, new_window
|
48 |
*/
|
88 |
|
89 |
$output = '';
|
90 |
|
91 |
+
$output .= '<div class="sdm_fancy3_download_item ' . sdm_sanitize_text($css_class) . '">';
|
92 |
$output .= '<div class="sdm_fancy3_download_item_left">';
|
93 |
$output .= '<span class="sdm_fancy3_download_title">' . $item_title . '</span>';
|
94 |
$output .= '</div>'; //End of .sdm_fancy3_download_title
|
main.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Simple Download Monitor
|
4 |
* Plugin URI: https://simple-download-monitor.com/
|
5 |
* Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
6 |
-
* Version: 3.9.
|
7 |
* Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
|
8 |
* Author URI: https://www.tipsandtricks-hq.com/development-center
|
9 |
* License: GPL2
|
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
-
define( 'WP_SIMPLE_DL_MONITOR_VERSION', '3.9.
|
18 |
define( 'WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname( plugin_basename( __FILE__ ) ) );
|
19 |
define( 'WP_SIMPLE_DL_MONITOR_URL', plugins_url( '', __FILE__ ) );
|
20 |
define( 'WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path( __FILE__ ) );
|
@@ -433,7 +433,7 @@ class simpleDownloadManager {
|
|
433 |
<?php
|
434 |
if ( ! empty( $old_value ) ) {
|
435 |
?>
|
436 |
-
<img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" style="max-width:200px;" />
|
437 |
<?php
|
438 |
}
|
439 |
?>
|
3 |
* Plugin Name: Simple Download Monitor
|
4 |
* Plugin URI: https://simple-download-monitor.com/
|
5 |
* Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
6 |
+
* Version: 3.9.5.1
|
7 |
* Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
|
8 |
* Author URI: https://www.tipsandtricks-hq.com/development-center
|
9 |
* License: GPL2
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
define( 'WP_SIMPLE_DL_MONITOR_VERSION', '3.9.5.1' );
|
18 |
define( 'WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname( plugin_basename( __FILE__ ) ) );
|
19 |
define( 'WP_SIMPLE_DL_MONITOR_URL', plugins_url( '', __FILE__ ) );
|
20 |
define( 'WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path( __FILE__ ) );
|
433 |
<?php
|
434 |
if ( ! empty( $old_value ) ) {
|
435 |
?>
|
436 |
+
<img id="sdm_thumbnail_image" src="<?php echo esc_url( $old_value ); ?>" style="max-width:200px;" />
|
437 |
<?php
|
438 |
}
|
439 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.tipsandtricks-hq.com
|
|
4 |
Tags: download, downloads, count, counter, tracker, tracking, hits, logging, monitor, manager, files, media, digital, download monitor, download manager, downloadmanager, file manager, protect downloads, password, download category, file tree, ajax, download template, grid, documents, ip address
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 3.9.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
@@ -78,6 +78,7 @@ https://www.youtube.com/watch?v=SjVaanbulRU
|
|
78 |
* Ability to easily clone/copy your existing download items.
|
79 |
* Ability to insert Adsense or other Ad code inside the download item display.
|
80 |
* Gutenberg block to insert download now buttons on a post or page.
|
|
|
81 |
|
82 |
View more details on the [download monitor plugin](https://simple-download-monitor.com/) page.
|
83 |
|
@@ -189,6 +190,25 @@ For screenshots please visit the [download monitor plugin page](https://www.tips
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
= 3.9.2 =
|
193 |
- The sorting option on the "Downloads" column has been removed.
|
194 |
- Added a new filter that can be used to override the "slug" of the download single post. The name of the filter hook is "sdm_downloads_post_type_before_register".
|
4 |
Tags: download, downloads, count, counter, tracker, tracking, hits, logging, monitor, manager, files, media, digital, download monitor, download manager, downloadmanager, file manager, protect downloads, password, download category, file tree, ajax, download template, grid, documents, ip address
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 3.9.5.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
78 |
* Ability to easily clone/copy your existing download items.
|
79 |
* Ability to insert Adsense or other Ad code inside the download item display.
|
80 |
* Gutenberg block to insert download now buttons on a post or page.
|
81 |
+
* The stats menu can show you the top downloads, downloads by date, country, browser etc.
|
82 |
|
83 |
View more details on the [download monitor plugin](https://simple-download-monitor.com/) page.
|
84 |
|
190 |
|
191 |
== Changelog ==
|
192 |
|
193 |
+
= 3.9.5.1 =
|
194 |
+
- Updated the read permission of the download post type to fix the permalink of the item (shown below the title of the post when editing).
|
195 |
+
- Changed the downloads menu permission from 'update_core' to 'manage_options' for better compatibility with WP Multi-Site install.
|
196 |
+
|
197 |
+
= 3.9.5 =
|
198 |
+
- The "Downloads" menu in the admin dashboard is now only available to site administrator roles.
|
199 |
+
- Sanitization of variables.
|
200 |
+
|
201 |
+
= 3.9.4 =
|
202 |
+
- Added new tabs to show downloads by browser and downloads by OS in the stats menu.
|
203 |
+
- Added a new tab showing top downloads (top 25 downloads).
|
204 |
+
- Placed the "Other" type field at the end of the stats table.
|
205 |
+
- New filter hook 'sdm_single_page_dl_link' added across the download button in single download page.
|
206 |
+
|
207 |
+
= 3.9.3 =
|
208 |
+
- The logs data exporting function has been moved to a new menu tab within the "Logs" menu.
|
209 |
+
- The Export sub-menu now allows exporting of logs data between selected date range.
|
210 |
+
- Date validation function added.
|
211 |
+
|
212 |
= 3.9.2 =
|
213 |
- The sorting option on the "Downloads" column has been removed.
|
214 |
- Added a new filter that can be used to override the "slug" of the download single post. The name of the filter hook is "sdm_downloads_post_type_before_register".
|
sdm-post-type-and-taxonomy.php
CHANGED
@@ -19,8 +19,19 @@ function sdm_register_post_type() {
|
|
19 |
'menu_name' => __( 'Downloads', 'simple-download-monitor' )
|
20 |
);
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
$sdm_permalink_base = 'sdm_downloads'; //TODO - add an option to configure in the settings maybe?
|
23 |
-
$sdm_slug
|
24 |
$args = array(
|
25 |
'labels' => $labels,
|
26 |
'public' => true,
|
@@ -30,6 +41,7 @@ function sdm_register_post_type() {
|
|
30 |
'query_var' => true,
|
31 |
'rewrite' => array( 'slug' => $sdm_slug ),
|
32 |
'capability_type' => 'post',
|
|
|
33 |
'has_archive' => true,
|
34 |
'hierarchical' => false,
|
35 |
'menu_position' => null,
|
19 |
'menu_name' => __( 'Downloads', 'simple-download-monitor' )
|
20 |
);
|
21 |
|
22 |
+
$capabilities = array(
|
23 |
+
'edit_post' => 'manage_options',
|
24 |
+
'delete_post' => 'manage_options',
|
25 |
+
'read_post' => 'manage_options',
|
26 |
+
'edit_posts' => 'manage_options',
|
27 |
+
'edit_others_posts' => 'manage_options',
|
28 |
+
'delete_posts' => 'manage_options',
|
29 |
+
'publish_posts' => 'manage_options',
|
30 |
+
'read_private_posts' => 'manage_options',
|
31 |
+
);
|
32 |
+
|
33 |
$sdm_permalink_base = 'sdm_downloads'; //TODO - add an option to configure in the settings maybe?
|
34 |
+
$sdm_slug = untrailingslashit( $sdm_permalink_base );
|
35 |
$args = array(
|
36 |
'labels' => $labels,
|
37 |
'public' => true,
|
41 |
'query_var' => true,
|
42 |
'rewrite' => array( 'slug' => $sdm_slug ),
|
43 |
'capability_type' => 'post',
|
44 |
+
'capabilities' => $capabilities,
|
45 |
'has_archive' => true,
|
46 |
'hierarchical' => false,
|
47 |
'menu_position' => null,
|
sdm-post-type-content-handler.php
CHANGED
@@ -128,7 +128,8 @@ function filter_sdm_post_type_content( $content ) {
|
|
128 |
$content .= apply_filters('sdm_post_single_download_page_disabled_dl_button_msg', $msg);
|
129 |
$content .= '</div>';
|
130 |
} else {
|
131 |
-
$
|
|
|
132 |
}
|
133 |
|
134 |
if ( ! empty( $isset_item_file_size ) ) {//Show file size info
|
128 |
$content .= apply_filters('sdm_post_single_download_page_disabled_dl_button_msg', $msg);
|
129 |
$content .= '</div>';
|
130 |
} else {
|
131 |
+
$download_link = '<div class="sdm_download_link">'. $download_button_code . '</div>';
|
132 |
+
$content .= '<div class="sdm_post_download_section">' . apply_filters('sdm_single_page_dl_link', $download_link, array('id'=> $id, 'button_text'=> $button_text_string)) . '</div>';
|
133 |
}
|
134 |
|
135 |
if ( ! empty( $isset_item_file_size ) ) {//Show file size info
|
sdm-shortcodes.php
CHANGED
@@ -84,6 +84,10 @@ function sdm_create_download_shortcode( $atts ) {
|
|
84 |
return '<p style="color: red;">' . __( 'Error! Please enter an ID value with this shortcode.', 'simple-download-monitor' ) . '</p>';
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
87 |
// Check to see if the download link cpt is password protected
|
88 |
$get_cpt_object = get_post( $id );
|
89 |
$cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
|
84 |
return '<p style="color: red;">' . __( 'Error! Please enter an ID value with this shortcode.', 'simple-download-monitor' ) . '</p>';
|
85 |
}
|
86 |
|
87 |
+
$id = intval($id);
|
88 |
+
$color = sdm_sanitize_text( $color );
|
89 |
+
$css_class = sdm_sanitize_text( $css_class );
|
90 |
+
|
91 |
// Check to see if the download link cpt is password protected
|
92 |
$get_cpt_object = get_post( $id );
|
93 |
$cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
|