Simple Download Monitor - Version 3.9.9

Version Description

  • Nonce verification added to "Delete/Reset log entries" form.
  • Sanitization added to 'sdm_search_form' shortcode parameters.
  • Nonce verification added to remove thumbnail button.
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 Simple Download Monitor
Version 3.9.9
Comparing to
See all releases

Code changes from version 3.9.7 to 3.9.9

includes/admin-side/sdm-admin-edit-download.php CHANGED
@@ -24,13 +24,17 @@ class SDM_Admin_Edit_Download {
24
  }
25
 
26
  public function remove_thumbnail_image_ajax_handler() {
 
 
 
 
27
  if ( ! current_user_can( 'manage_options' ) ) {
28
- //Permission denied
29
  wp_die( esc_html( __( 'Permission denied!', 'simple-download-monitor' ) ) );
30
  exit;
31
  }
32
 
33
- //Go ahead with the thumbnail removal
34
  $post_id = filter_input( INPUT_POST, 'post_id_del', FILTER_SANITIZE_NUMBER_INT );
35
  $post_id = empty( $post_id ) ? 0 : intval( $post_id );
36
  $key_exists = metadata_exists( 'post', $post_id, 'sdm_upload_thumbnail' );
@@ -64,12 +68,12 @@ class SDM_Admin_Edit_Download {
64
  $old_upload = get_post_meta( $post->ID, 'sdm_upload', true );
65
  $old_value = isset( $old_upload ) ? $old_upload : '';
66
 
67
- //Trigger filter to allow "sdm_upload" field validation override.
68
  $url_validation_override = apply_filters( 'sdm_file_download_url_validation_override', '' );
69
  if ( ! empty( $url_validation_override ) ) { //phpcs:ignore
70
- //This site has customized the behavior and overriden the "sdm_upload" field validation. It can be useful if you are offering app download URLs (that has unconventional URL patterns).
71
  } else {
72
- //Do the normal URL validation.
73
  $old_value = esc_url( $old_value );
74
  }
75
 
@@ -77,7 +81,7 @@ class SDM_Admin_Edit_Download {
77
  echo '<br /><br />';
78
 
79
  echo '<div class="sdm-download-edit-file-url-section">';
80
- echo '<input id="sdm_upload" type="text" size="100" name="sdm_upload" value="' . esc_attr( $old_value ) . '" placeholder="http://..." />';
81
  echo '</div>';
82
 
83
  echo '<br />';
@@ -113,25 +117,25 @@ class SDM_Admin_Edit_Download {
113
  // Open Download in new window
114
  public function display_sdm_misc_properties_meta_box( $post ) {
115
 
116
- //Check the open in new window value
117
  $new_window = get_post_meta( $post->ID, 'sdm_item_new_window', true );
118
  if ( $new_window === '' ) {
119
  // No value yet (either new item or saved with older version of plugin)
120
  $screen = get_current_screen();
121
  if ( $screen->action === 'add' ) { //phpcs:ignore
122
- //New item: we can set a default value as per plugin settings. If a general settings is introduced at a later stage.
123
- //Does nothing at the moment.
124
  }
125
  }
126
 
127
- //Check the sdm_item_disable_single_download_page value
128
  $sdm_item_disable_single_download_page = get_post_meta( $post->ID, 'sdm_item_disable_single_download_page', true );
129
  $sdm_item_hide_dl_button_single_download_page = get_post_meta( $post->ID, 'sdm_item_hide_dl_button_single_download_page', true );
130
 
131
  echo '<p> <input id="sdm_item_new_window" type="checkbox" name="sdm_item_new_window" value="yes"' . checked( true, $new_window, false ) . ' />';
132
  echo '<label for="sdm_item_new_window">' . esc_html__( 'Open download in a new window.', 'simple-download-monitor' ) . '</label> </p>';
133
 
134
- //the new window will have no download button
135
  echo '<p> <input id="sdm_item_hide_dl_button_single_download_page" type="checkbox" name="sdm_item_hide_dl_button_single_download_page" value="yes"' . checked( true, $sdm_item_hide_dl_button_single_download_page, false ) . ' />';
136
  echo '<label for="sdm_item_hide_dl_button_single_download_page">';
137
 
@@ -160,10 +164,12 @@ class SDM_Admin_Edit_Download {
160
  esc_html_e( 'Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor' );
161
  ?>
162
  <br /><br />
163
- <input id="sdm_upload_thumbnail" type="text" size="100" name="sdm_upload_thumbnail" value="<?php echo esc_attr( $old_value ); ?>" placeholder="http://..." />
164
  <br /><br />
165
  <input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php esc_attr_e( 'Select Image', 'simple-download-monitor' ); ?>" />
166
- <input id="remove_thumbnail_button" type="button" class="button" value="<?php esc_attr_e( 'Remove Image', 'simple-download-monitor' ); ?>" />
 
 
167
  <br /><br />
168
 
169
  <span id="sdm_admin_thumb_preview">
@@ -183,7 +189,7 @@ class SDM_Admin_Edit_Download {
183
  }
184
 
185
  public function display_sdm_stats_meta_box( $post ) {
186
- //Stats metabox
187
  $old_count = get_post_meta( $post->ID, 'sdm_count_offset', true );
188
  $value = isset( $old_count ) && ! empty( $old_count ) ? $old_count : '0';
189
 
@@ -218,7 +224,7 @@ class SDM_Admin_Edit_Download {
218
  }
219
 
220
  public function display_sdm_other_details_meta_box( $post ) {
221
- //Other details metabox
222
  $show_date_fd = get_post_meta( $post->ID, 'sdm_item_show_date_fd', true );
223
  $sdm_item_show_file_size_fd = get_post_meta( $post->ID, 'sdm_item_show_file_size_fd', true );
224
  $sdm_item_show_item_version_fd = get_post_meta( $post->ID, 'sdm_item_show_item_version_fd', true );
@@ -268,7 +274,7 @@ class SDM_Admin_Edit_Download {
268
  }
269
 
270
  public function display_sdm_shortcode_meta_box( $post ) {
271
- //Shortcode metabox
272
  esc_html_e( 'The following shortcode can be used on posts or pages to embed a download now button for this file. You can also use the shortcode inserter (in the post editor) to add this shortcode to a post or page.', 'simple-download-monitor' );
273
  echo '<br />';
274
  $shortcode_text = '[sdm_download id="' . $post->ID . '" fancy="0"]';
@@ -312,7 +318,7 @@ class SDM_Admin_Edit_Download {
312
 
313
  // *** File Upload ***
314
  if ( isset( $_POST['sdm_upload'] ) ) {
315
- update_post_meta( $post_id, 'sdm_upload', esc_url( $_POST['sdm_upload'], array( 'http', 'https', 'dropbox' ) ) );
316
  }
317
 
318
  // *** PHP Dispatch or Redirect ***
@@ -326,7 +332,7 @@ class SDM_Admin_Edit_Download {
326
  $sdm_item_disable_single_download_page = filter_input( INPUT_POST, 'sdm_item_disable_single_download_page', FILTER_VALIDATE_BOOLEAN );
327
  $sdm_item_anonymous_can_download = filter_input( INPUT_POST, 'sdm_item_anonymous_can_download', FILTER_VALIDATE_BOOLEAN );
328
 
329
- //Save the data
330
  update_post_meta( $post_id, 'sdm_item_new_window', $new_window_open );
331
  update_post_meta( $post_id, 'sdm_item_hide_dl_button_single_download_page', $sdm_item_hide_dl_button_single_download_page );
332
  update_post_meta( $post_id, 'sdm_item_disable_single_download_page', $sdm_item_disable_single_download_page );
24
  }
25
 
26
  public function remove_thumbnail_image_ajax_handler() {
27
+
28
+ // terminates the script if the nonce verification fails.
29
+ check_ajax_referer( 'sdm_remove_thumbnail_nonce_action', 'sdm_remove_thumbnail_nonce' );
30
+
31
  if ( ! current_user_can( 'manage_options' ) ) {
32
+ // Permission denied
33
  wp_die( esc_html( __( 'Permission denied!', 'simple-download-monitor' ) ) );
34
  exit;
35
  }
36
 
37
+ // Go ahead with the thumbnail removal
38
  $post_id = filter_input( INPUT_POST, 'post_id_del', FILTER_SANITIZE_NUMBER_INT );
39
  $post_id = empty( $post_id ) ? 0 : intval( $post_id );
40
  $key_exists = metadata_exists( 'post', $post_id, 'sdm_upload_thumbnail' );
68
  $old_upload = get_post_meta( $post->ID, 'sdm_upload', true );
69
  $old_value = isset( $old_upload ) ? $old_upload : '';
70
 
71
+ // Trigger filter to allow "sdm_upload" field validation override.
72
  $url_validation_override = apply_filters( 'sdm_file_download_url_validation_override', '' );
73
  if ( ! empty( $url_validation_override ) ) { //phpcs:ignore
74
+ // This site has customized the behavior and overriden the "sdm_upload" field validation. It can be useful if you are offering app download URLs (that has unconventional URL patterns).
75
  } else {
76
+ // Do the normal URL validation.
77
  $old_value = esc_url( $old_value );
78
  }
79
 
81
  echo '<br /><br />';
82
 
83
  echo '<div class="sdm-download-edit-file-url-section">';
84
+ echo '<input id="sdm_upload" type="text" style="width: 95%" name="sdm_upload" value="' . esc_attr( $old_value ) . '" placeholder="http://..." />';
85
  echo '</div>';
86
 
87
  echo '<br />';
117
  // Open Download in new window
118
  public function display_sdm_misc_properties_meta_box( $post ) {
119
 
120
+ // Check the open in new window value
121
  $new_window = get_post_meta( $post->ID, 'sdm_item_new_window', true );
122
  if ( $new_window === '' ) {
123
  // No value yet (either new item or saved with older version of plugin)
124
  $screen = get_current_screen();
125
  if ( $screen->action === 'add' ) { //phpcs:ignore
126
+ // New item: we can set a default value as per plugin settings. If a general settings is introduced at a later stage.
127
+ // Does nothing at the moment.
128
  }
129
  }
130
 
131
+ // Check the sdm_item_disable_single_download_page value
132
  $sdm_item_disable_single_download_page = get_post_meta( $post->ID, 'sdm_item_disable_single_download_page', true );
133
  $sdm_item_hide_dl_button_single_download_page = get_post_meta( $post->ID, 'sdm_item_hide_dl_button_single_download_page', true );
134
 
135
  echo '<p> <input id="sdm_item_new_window" type="checkbox" name="sdm_item_new_window" value="yes"' . checked( true, $new_window, false ) . ' />';
136
  echo '<label for="sdm_item_new_window">' . esc_html__( 'Open download in a new window.', 'simple-download-monitor' ) . '</label> </p>';
137
 
138
+ // the new window will have no download button
139
  echo '<p> <input id="sdm_item_hide_dl_button_single_download_page" type="checkbox" name="sdm_item_hide_dl_button_single_download_page" value="yes"' . checked( true, $sdm_item_hide_dl_button_single_download_page, false ) . ' />';
140
  echo '<label for="sdm_item_hide_dl_button_single_download_page">';
141
 
164
  esc_html_e( 'Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor' );
165
  ?>
166
  <br /><br />
167
+ <input id="sdm_upload_thumbnail" type="text" style="width: 95%" name="sdm_upload_thumbnail" value="<?php echo esc_attr( $old_value ); ?>" placeholder="http://..." />
168
  <br /><br />
169
  <input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php esc_attr_e( 'Select Image', 'simple-download-monitor' ); ?>" />
170
+ <!-- Creating the nonce field for csrf protection-->
171
+ <input id="sdm_remove_thumbnail_nonce" type="hidden" value="<?php echo wp_create_nonce( 'sdm_remove_thumbnail_nonce_action' ); ?>"/>
172
+ <input id="remove_thumbnail_button" type="button" class="button" value="<?php esc_attr_e( 'Remove Image', 'simple-download-monitor' ); ?>"/>
173
  <br /><br />
174
 
175
  <span id="sdm_admin_thumb_preview">
189
  }
190
 
191
  public function display_sdm_stats_meta_box( $post ) {
192
+ // Stats metabox
193
  $old_count = get_post_meta( $post->ID, 'sdm_count_offset', true );
194
  $value = isset( $old_count ) && ! empty( $old_count ) ? $old_count : '0';
195
 
224
  }
225
 
226
  public function display_sdm_other_details_meta_box( $post ) {
227
+ // Other details metabox
228
  $show_date_fd = get_post_meta( $post->ID, 'sdm_item_show_date_fd', true );
229
  $sdm_item_show_file_size_fd = get_post_meta( $post->ID, 'sdm_item_show_file_size_fd', true );
230
  $sdm_item_show_item_version_fd = get_post_meta( $post->ID, 'sdm_item_show_item_version_fd', true );
274
  }
275
 
276
  public function display_sdm_shortcode_meta_box( $post ) {
277
+ // Shortcode metabox
278
  esc_html_e( 'The following shortcode can be used on posts or pages to embed a download now button for this file. You can also use the shortcode inserter (in the post editor) to add this shortcode to a post or page.', 'simple-download-monitor' );
279
  echo '<br />';
280
  $shortcode_text = '[sdm_download id="' . $post->ID . '" fancy="0"]';
318
 
319
  // *** File Upload ***
320
  if ( isset( $_POST['sdm_upload'] ) ) {
321
+ update_post_meta( $post_id, 'sdm_upload', esc_url_raw( $_POST['sdm_upload'], array( 'http', 'https', 'dropbox' ) ) );
322
  }
323
 
324
  // *** PHP Dispatch or Redirect ***
332
  $sdm_item_disable_single_download_page = filter_input( INPUT_POST, 'sdm_item_disable_single_download_page', FILTER_VALIDATE_BOOLEAN );
333
  $sdm_item_anonymous_can_download = filter_input( INPUT_POST, 'sdm_item_anonymous_can_download', FILTER_VALIDATE_BOOLEAN );
334
 
335
+ // Save the data
336
  update_post_meta( $post_id, 'sdm_item_new_window', $new_window_open );
337
  update_post_meta( $post_id, 'sdm_item_hide_dl_button_single_download_page', $sdm_item_hide_dl_button_single_download_page );
338
  update_post_meta( $post_id, 'sdm_item_disable_single_download_page', $sdm_item_disable_single_download_page );
includes/sdm-admin-menu-handler.php CHANGED
@@ -442,7 +442,7 @@ function sdm_handle_logs_main_tab_page() {
442
  global $wpdb;
443
  $advanced_options = get_option( 'sdm_advanced_options' );
444
 
445
- if ( isset( $_POST['sdm_reset_log_entries'] ) ) {
446
  //Reset log entries
447
  $table_name = $wpdb->prefix . 'sdm_downloads';
448
  $query = "TRUNCATE $table_name";
@@ -452,7 +452,7 @@ function sdm_handle_logs_main_tab_page() {
452
  echo '</p></div>';
453
  }
454
 
455
- if ( isset( $_POST['sdm_trim_log_entries'] ) ) {
456
  //Trim log entries
457
  $interval_val = intval( $_POST['sdm_trim_log_entries_days'] );
458
  $interval_unit = 'DAY';
@@ -499,6 +499,7 @@ function sdm_handle_logs_main_tab_page() {
499
  <input type="submit" class="button" name="sdm_reset_log_entries" value="<?php esc_html_e( 'Reset Log Entries', 'simple-download-monitor' ); ?>" />
500
  <p class="description"><?php esc_html_e( 'This button will reset all log entries. It can useful if you want to export all your log entries then reset them.', 'simple-download-monitor' ); ?></p>
501
  </div>
 
502
  </form>
503
 
504
  <form method="post" action="" onSubmit="return confirm('Are you sure you want to trim log entries?');" >
@@ -507,6 +508,7 @@ function sdm_handle_logs_main_tab_page() {
507
  <input type="submit" class="button" name="sdm_trim_log_entries" value="<?php esc_html_e( 'Trim Log Entries', 'simple-download-monitor' ); ?>" />
508
  <p class="description"><?php esc_html_e( 'This option can be useful if you want to delete older log entries. Enter a number of days value then click the Trim Log Entries button.', 'simple-download-monitor' ); ?></p>
509
  </div>
 
510
  </form>
511
  </div>
512
  </div>
442
  global $wpdb;
443
  $advanced_options = get_option( 'sdm_advanced_options' );
444
 
445
+ if ( isset( $_POST['sdm_reset_log_entries'] ) && check_admin_referer( null,'sdm_delete_all_logs_nonce' ) ) {
446
  //Reset log entries
447
  $table_name = $wpdb->prefix . 'sdm_downloads';
448
  $query = "TRUNCATE $table_name";
452
  echo '</p></div>';
453
  }
454
 
455
+ if ( isset( $_POST['sdm_trim_log_entries'] ) && check_admin_referer( null, 'sdm_delete_logs_nonce' ) ) {
456
  //Trim log entries
457
  $interval_val = intval( $_POST['sdm_trim_log_entries_days'] );
458
  $interval_unit = 'DAY';
499
  <input type="submit" class="button" name="sdm_reset_log_entries" value="<?php esc_html_e( 'Reset Log Entries', 'simple-download-monitor' ); ?>" />
500
  <p class="description"><?php esc_html_e( 'This button will reset all log entries. It can useful if you want to export all your log entries then reset them.', 'simple-download-monitor' ); ?></p>
501
  </div>
502
+ <?php wp_nonce_field( null, 'sdm_delete_all_logs_nonce' ); ?>
503
  </form>
504
 
505
  <form method="post" action="" onSubmit="return confirm('Are you sure you want to trim log entries?');" >
508
  <input type="submit" class="button" name="sdm_trim_log_entries" value="<?php esc_html_e( 'Trim Log Entries', 'simple-download-monitor' ); ?>" />
509
  <p class="description"><?php esc_html_e( 'This option can be useful if you want to delete older log entries. Enter a number of days value then click the Trim Log Entries button.', 'simple-download-monitor' ); ?></p>
510
  </div>
511
+ <?php wp_nonce_field( null, 'sdm_delete_logs_nonce' ); ?>
512
  </form>
513
  </div>
514
  </div>
includes/sdm-search-shortcode-handler.php CHANGED
@@ -71,10 +71,9 @@ function sdm_search_form_shortcode( $args ) {
71
  $result_output = '<h2 class="sdm_search_result_heading">' . __( 'Nothing found for ', 'simple-download-monitor' ) . '"' . $s_term . '".</h2>';
72
  }
73
  }
74
-
75
  $out = '';
76
- $out .= '<form id="sdm_search_form" class="' . ( empty( $atts['class'] ) ? '' : ' ' . $atts['class'] ) . '" method="POST">';
77
- $out .= '<input type="search" class="search-field" name="sdm_search_term" value="' . $s_term . '" placeholder="' . $atts['placeholder'] . '">';
78
  $out .= '<input type="submit" class="sdm_search_submit" name="sdm_search_submit" value="Search">';
79
  $out .= '</form>';
80
  $out .= isset( $result_output ) ? $result_output : '';
71
  $result_output = '<h2 class="sdm_search_result_heading">' . __( 'Nothing found for ', 'simple-download-monitor' ) . '"' . $s_term . '".</h2>';
72
  }
73
  }
 
74
  $out = '';
75
+ $out .= '<form id="sdm_search_form" class="' . sanitize_html_class( $atts['class'], '' ) . '" method="POST">';
76
+ $out .= '<input type="search" class="search-field" name="sdm_search_term" value="' . $s_term . '" placeholder="' . sanitize_text_field( $atts['placeholder'] ) . '">';
77
  $out .= '<input type="submit" class="sdm_search_submit" name="sdm_search_submit" value="Search">';
78
  $out .= '</form>';
79
  $out .= isset( $result_output ) ? $result_output : '';
includes/sdm-utility-functions.php CHANGED
@@ -38,10 +38,34 @@ function sdm_get_download_count_for_post( $id ) {
38
 
39
  $db_count = $db_count + $get_offset;
40
  }
41
-
42
  return $db_count;
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  function sdm_get_password_entry_form( $id, $args = array(), $class = '' ) {
46
  $action_url = WP_SIMPLE_DL_MONITOR_SITE_HOME_URL . '/?smd_process_download=1&download_id=' . $id;
47
 
38
 
39
  $db_count = $db_count + $get_offset;
40
  }
 
41
  return $db_count;
42
  }
43
 
44
+ /**
45
+ * Counts all total downloads including offset count.
46
+ *
47
+ * @return number
48
+ */
49
+ function sdm_get_download_count_for_all_posts() {
50
+ global $wpdb;
51
+
52
+ $table = $wpdb->prefix . 'sdm_downloads';
53
+ $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $table));
54
+ $db_count = $wpdb->num_rows;
55
+
56
+ $table2 = $wpdb->prefix . 'posts';
57
+ $result = $wpdb->get_results($wpdb->prepare(' SELECT * FROM ' . $table2 . ' WHERE post_type="sdm_downloads"'));
58
+
59
+ // Check post meta for offset count.
60
+ for ($i = 0; $i < $wpdb->num_rows; $i++) {
61
+ $get_offset = get_post_meta($result[$i]->ID, 'sdm_count_offset', true);
62
+ if ($get_offset && $get_offset != '') {
63
+ $db_count = $db_count + $get_offset;
64
+ }
65
+ }
66
+ return $db_count;
67
+ }
68
+
69
  function sdm_get_password_entry_form( $id, $args = array(), $class = '' ) {
70
  $action_url = WP_SIMPLE_DL_MONITOR_SITE_HOME_URL . '/?smd_process_download=1&download_id=' . $id;
71
 
js/sdm_admin_scripts.js CHANGED
@@ -44,26 +44,26 @@ jQuery(document).ready(function ($) {
44
  });
45
 
46
  // Remove thumbnail image from CPT
47
- $('#remove_thumbnail_button').click(function () {
48
  if ($('#sdm_thumbnail_image').length === 0) {
49
  return;
50
  }
51
  $.post(
52
- sdm_admin.ajax_url,
53
- {
54
- action: 'sdm_remove_thumbnail_image',
55
- post_id_del: sdm_admin.post_id
56
- },
57
- function (response) {
58
- if (response) { // ** If response was successful
59
- $('#sdm_thumbnail_image').remove();
60
- $('#sdm_upload_thumbnail').val('');
61
- alert(sdm_translations.image_removed);
62
- } else { // ** Else response was unsuccessful
63
- alert(sdm_translations.ajax_error);
64
- }
65
  }
 
66
  );
67
  });
68
-
69
  });
44
  });
45
 
46
  // Remove thumbnail image from CPT
47
+ $('#remove_thumbnail_button').click( function () {
48
  if ($('#sdm_thumbnail_image').length === 0) {
49
  return;
50
  }
51
  $.post(
52
+ sdm_admin.ajax_url,
53
+ {
54
+ action: 'sdm_remove_thumbnail_image',
55
+ post_id_del: sdm_admin.post_id,
56
+ _ajax_nonce: $('#sdm_remove_thumbnail_nonce').val()
57
+ },
58
+ function (response) {
59
+ if (response) { // ** If response was successful
60
+ $('#sdm_thumbnail_image').remove();
61
+ $('#sdm_upload_thumbnail').val('');
62
+ alert(sdm_translations.image_removed);
63
+ } else { // ** Else response was unsuccessful
64
+ alert(sdm_translations.ajax_error);
65
  }
66
+ }
67
  );
68
  });
 
69
  });
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
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.7' );
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__ ) );
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.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
  exit;
15
  }
16
 
17
+ define( 'WP_SIMPLE_DL_MONITOR_VERSION', '3.9.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__ ) );
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.7
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
@@ -190,6 +190,15 @@ For screenshots please visit the [download monitor plugin page](https://www.tips
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
193
  = 3.9.7 =
194
  - Added a new filter hook 'sdm_post_type_capability'. This hook can be used to apply a customization and override the default capability from 'administrator' to other roles.
195
  - The '%' symbol is now allowed in the download URL field.
@@ -237,7 +246,7 @@ For screenshots please visit the [download monitor plugin page](https://www.tips
237
  - WordPress 5.7 compatibility.
238
 
239
  = 3.8.9 =
240
- - WordPress 5.5 compatiblity.
241
  - Added sanitization to the "User Agent" field.
242
  - Removed the "TinyMCE" button option. It is no longer needed in current WordPress version.
243
 
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.9
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
190
 
191
  == Changelog ==
192
 
193
+ = 3.9.9 =
194
+ - Nonce verification added to "Delete/Reset log entries" form.
195
+ - Sanitization added to 'sdm_search_form' shortcode parameters.
196
+ - Nonce verification added to remove thumbnail button.
197
+
198
+ = 3.9.8 =
199
+ - New shortcode to show combined total download count. [sdm_download_counter id="ALL"]
200
+ - Ampersands (&) encoding to #038 issue fixed for download URLs.
201
+
202
  = 3.9.7 =
203
  - Added a new filter hook 'sdm_post_type_capability'. This hook can be used to apply a customization and override the default capability from 'administrator' to other roles.
204
  - The '%' symbol is now allowed in the download URL field.
246
  - WordPress 5.7 compatibility.
247
 
248
  = 3.8.9 =
249
+ - WordPress 5.5 compatibility.
250
  - Added sanitization to the "User Agent" field.
251
  - Removed the "TinyMCE" button option. It is no longer needed in current WordPress version.
252
 
sdm-shortcodes.php CHANGED
@@ -183,7 +183,12 @@ function sdm_create_counter_shortcode( $atts ) {
183
  return '<p style="color: red;">' . __( 'Error! Please enter an ID value with this shortcode.', 'simple-download-monitor' ) . '</p>';
184
  }
185
 
186
- $db_count = sdm_get_download_count_for_post( $id );
 
 
 
 
 
187
 
188
  // Set string for singular/plural results
189
  $string = ( $db_count == '1' ) ? __( 'Download', 'simple-download-monitor' ) : __( 'Downloads', 'simple-download-monitor' );
183
  return '<p style="color: red;">' . __( 'Error! Please enter an ID value with this shortcode.', 'simple-download-monitor' ) . '</p>';
184
  }
185
 
186
+ // Checks if to show count for all total download or any specific download.
187
+ if ( preg_match( '/^all$/i', $id ) ) {
188
+ $db_count = sdm_get_download_count_for_all_posts();
189
+ } else {
190
+ $db_count = sdm_get_download_count_for_post( $id );
191
+ }
192
 
193
  // Set string for singular/plural results
194
  $string = ( $db_count == '1' ) ? __( 'Download', 'simple-download-monitor' ) : __( 'Downloads', 'simple-download-monitor' );