Simple Download Monitor - Version 3.7.0

Version Description

Download this release

Release Info

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

Code changes from version 3.6.5 to 3.7.0

css/sdm_wp_styles.css CHANGED
@@ -101,6 +101,9 @@
101
  .sdm_post_download_version{
102
  font-weight: bold;
103
  }
 
 
 
104
  .sdm_post_download_section{
105
  margin: 15px 0;
106
  }
101
  .sdm_post_download_version{
102
  font-weight: bold;
103
  }
104
+ .sdm_post_download_published_date{
105
+ font-weight: bold;
106
+ }
107
  .sdm_post_download_section{
108
  margin: 15px 0;
109
  }
images/addons/sdm-dropbox-integration-addon.png ADDED
Binary file
includes/admin-side/sdm-admin-add-ons-page.php CHANGED
@@ -49,7 +49,15 @@ echo '<link type="text/css" rel="stylesheet" href="' . WP_SIMPLE_DL_MONITOR_URL
49
  "description" => "WordPress by default doesn't allow you to upload all file types. This addon will remove the limitation and allow you to upload all file types.",
50
  "page_url" => "https://simple-download-monitor.com/allow-more-file-types-to-be-uploaded-via-wordpress/",
51
  );
52
- array_push($addons_data, $addon_5);
 
 
 
 
 
 
 
 
53
 
54
  /*** Show the addons list ***/
55
  foreach ($addons_data as $addon) {
49
  "description" => "WordPress by default doesn't allow you to upload all file types. This addon will remove the limitation and allow you to upload all file types.",
50
  "page_url" => "https://simple-download-monitor.com/allow-more-file-types-to-be-uploaded-via-wordpress/",
51
  );
52
+ array_push($addons_data, $addon_5);
53
+
54
+ $addon_6 = array(
55
+ "name" => "Dropbox Integration",
56
+ "thumbnail" => WP_SIMPLE_DL_MONITOR_URL . "/images/addons/sdm-dropbox-integration-addon.png",
57
+ "description" => "Allows you to configure downloads from your Dropbox account so the visitors can download it from your site.",
58
+ "page_url" => "https://simple-download-monitor.com/dropbox-addon-for-the-simple-download-monitor/",
59
+ );
60
+ array_push($addons_data, $addon_6);
61
 
62
  /*** Show the addons list ***/
63
  foreach ($addons_data as $addon) {
includes/sdm-admin-menu-handler.php CHANGED
@@ -6,7 +6,7 @@
6
  function sdm_handle_admin_menu() {
7
 
8
  //***** Create the 'logs' and 'settings' submenu pages
9
- $sdm_logs_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Logs', 'simple-download-monitor' ), __( 'Logs', 'simple-download-monitor' ), 'manage_options', 'logs', 'sdm_create_logs_page' );
10
  $sdm_logs_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Stats', 'simple-download-monitor' ), __( 'Stats', 'simple-download-monitor' ), 'manage_options', 'sdm-stats', 'sdm_create_stats_page' );
11
  $sdm_settings_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Settings', 'simple-download-monitor' ), __( 'Settings', 'simple-download-monitor' ), 'manage_options', 'sdm-settings', 'sdm_create_settings_page' );
12
  $sdm_addons_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Add-ons', 'simple-download-monitor' ), __( 'Add-ons', 'simple-download-monitor' ), 'manage_options', 'sdm-addons', 'sdm_create_addons_page' );
@@ -21,8 +21,10 @@ add_filter( 'whitelist_options', 'sdm_admin_menu_function_hook' );
21
  * @return string
22
  */
23
  function sdm_admin_menu_function_hook( $whitelist_options = array() ) {
24
- $whitelist_options[ 'recaptcha_options_section' ] = array( 'sdm_advanced_options' );
25
- $whitelist_options[ 'termscond_options_section' ] = array( 'sdm_advanced_options' );
 
 
26
  return $whitelist_options;
27
  }
28
 
@@ -256,23 +258,21 @@ function sdm_admin_menu_general_settings() {
256
  }
257
 
258
  function sdm_admin_menu_advanced_settings() {
259
- //At the moment we only have the captcha options in the advanced settings. More options will be added here in the future.
260
- ?>
261
- <!-- BEGIN RECAPTCHA OPTIONS DIV -->
262
- <?php
263
  // This prints out all hidden setting fields
264
  do_settings_sections( 'recaptcha_options_section' );
265
  settings_fields( 'recaptcha_options_section' );
266
-
267
  submit_button();
268
 
269
  do_settings_sections( 'termscond_options_section' );
270
  settings_fields( 'termscond_options_section' );
 
271
 
 
 
272
  submit_button();
273
- ?>
274
- <!-- END RECAPTCHA OPTIONS DIV -->
275
- <?php
276
  }
277
 
278
  /*
6
  function sdm_handle_admin_menu() {
7
 
8
  //***** Create the 'logs' and 'settings' submenu pages
9
+ $sdm_logs_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Logs', 'simple-download-monitor' ), __( 'Logs', 'simple-download-monitor' ), 'manage_options', 'sdm-logs', 'sdm_create_logs_page' );
10
  $sdm_logs_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Stats', 'simple-download-monitor' ), __( 'Stats', 'simple-download-monitor' ), 'manage_options', 'sdm-stats', 'sdm_create_stats_page' );
11
  $sdm_settings_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Settings', 'simple-download-monitor' ), __( 'Settings', 'simple-download-monitor' ), 'manage_options', 'sdm-settings', 'sdm_create_settings_page' );
12
  $sdm_addons_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __( 'Add-ons', 'simple-download-monitor' ), __( 'Add-ons', 'simple-download-monitor' ), 'manage_options', 'sdm-addons', 'sdm_create_addons_page' );
21
  * @return string
22
  */
23
  function sdm_admin_menu_function_hook( $whitelist_options = array() ) {
24
+ $whitelist_options[ 'recaptcha_options_section' ] = array( 'sdm_advanced_options' );
25
+ $whitelist_options[ 'termscond_options_section' ] = array( 'sdm_advanced_options' );
26
+ $whitelist_options[ 'adsense_options_section' ] = array( 'sdm_advanced_options' );
27
+
28
  return $whitelist_options;
29
  }
30
 
258
  }
259
 
260
  function sdm_admin_menu_advanced_settings() {
261
+ //More advanced options will be added here in the future.
262
+
 
 
263
  // This prints out all hidden setting fields
264
  do_settings_sections( 'recaptcha_options_section' );
265
  settings_fields( 'recaptcha_options_section' );
 
266
  submit_button();
267
 
268
  do_settings_sections( 'termscond_options_section' );
269
  settings_fields( 'termscond_options_section' );
270
+ submit_button();
271
 
272
+ do_settings_sections( 'adsense_options_section' );
273
+ settings_fields( 'adsense_options_section' );
274
  submit_button();
275
+
 
 
276
  }
277
 
278
  /*
includes/sdm-logs-list-table.php CHANGED
@@ -43,7 +43,7 @@ class sdm_List_Table extends WP_List_Table {
43
  //Build row actions
44
  $actions = array(
45
  'edit' => sprintf('<a href="' . admin_url('post.php?post=' . $item['ID'] . '&action=edit') . '">' . __('Edit', 'simple-download-monitor') . '</a>'),
46
- 'delete' => sprintf('<a href="?post_type=sdm_downloads&page=logs&action=%s&download=%s&row_id=%s&_wpnonce=%s" onclick="return confirm(\'Are you sure you want to delete this entry?\')">' . __('Delete', 'simple-download-monitor') . '</a>', 'delete', $item['ID'], $item['row_id'], $delete_log_nonce),
47
  );
48
 
49
  //Return the title contents
43
  //Build row actions
44
  $actions = array(
45
  'edit' => sprintf('<a href="' . admin_url('post.php?post=' . $item['ID'] . '&action=edit') . '">' . __('Edit', 'simple-download-monitor') . '</a>'),
46
+ 'delete' => sprintf('<a href="?post_type=sdm_downloads&page=sdm-logs&action=%s&download=%s&row_id=%s&_wpnonce=%s" onclick="return confirm(\'Are you sure you want to delete this entry?\')">' . __('Delete', 'simple-download-monitor') . '</a>', 'delete', $item['ID'], $item['row_id'], $delete_log_nonce),
47
  );
48
 
49
  //Return the title contents
includes/sdm-utility-functions.php CHANGED
@@ -38,21 +38,6 @@ function sdm_get_download_count_for_post($id) {
38
  return $db_count;
39
  }
40
 
41
- function sdm_get_item_description_output($id) {
42
- $item_description = get_post_meta($id, 'sdm_description', true);
43
- $isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
44
- //$isset_item_description = apply_filters('the_content', $isset_item_description);
45
-
46
- $isset_item_description = do_shortcode($isset_item_description);
47
- $isset_item_description = wptexturize($isset_item_description);
48
- $isset_item_description = convert_smilies($isset_item_description);
49
- $isset_item_description = convert_chars($isset_item_description);
50
- $isset_item_description = wpautop($isset_item_description);
51
- $isset_item_description = shortcode_unautop($isset_item_description);
52
- $isset_item_description = prepend_attachment($isset_item_description);
53
- return $isset_item_description;
54
- }
55
-
56
  function sdm_get_password_entry_form($id, $args = array(), $class = '') {
57
  $action_url = WP_SIMPLE_DL_MONITOR_SITE_HOME_URL . '/?smd_process_download=1&download_id=' . $id;
58
 
@@ -67,7 +52,11 @@ function sdm_get_password_entry_form($id, $args = array(), $class = '') {
67
  $uuid = uniqid('sdm-pass-');
68
 
69
  $data = __('Enter Password to Download:', 'simple-download-monitor');
70
- $data .= '<form action="' . $action_url . '" method="post" id="' . $uuid . '" class="sdm-download-form">';
 
 
 
 
71
  $data .= '<input type="password" name="pass_text" class="sdm_pass_text" value="" /> ';
72
 
73
  $data .= sdm_get_download_with_recaptcha();
@@ -232,7 +221,10 @@ function sdm_get_download_form_with_recaptcha($id, $args = array(), $class = '')
232
 
233
  $main_advanced_opts = get_option('sdm_advanced_options');
234
 
235
- $data = '<form action="' . $action_url . '" method="post" class="sdm-g-recaptcha-form sdm-download-form">';
 
 
 
236
 
237
  $data .= '<div class="sdm-recaptcha-button">';
238
  $data .= '<div class="g-recaptcha sdm-g-recaptcha"></div>';
@@ -283,7 +275,10 @@ function sdm_get_download_form_with_termsncond($id, $args = array(), $class = ''
283
  $main_advanced_opts = get_option('sdm_advanced_options');
284
  $termscond_enable = isset($main_advanced_opts['termscond_enable']) ? true : false;
285
 
286
- $data = '<form action="' . $action_url . '" method="post" class="sdm-download-form">';
 
 
 
287
  $data .= sdm_get_checkbox_for_termsncond();
288
  $data .= '<div class="sdm-termscond-button">';
289
  $data .= '<a href="#" class="sdm_download_with_condition ' . $class . '">' . $button_text_string . '</a>';
38
  return $db_count;
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  function sdm_get_password_entry_form($id, $args = array(), $class = '') {
42
  $action_url = WP_SIMPLE_DL_MONITOR_SITE_HOME_URL . '/?smd_process_download=1&download_id=' . $id;
43
 
52
  $uuid = uniqid('sdm-pass-');
53
 
54
  $data = __('Enter Password to Download:', 'simple-download-monitor');
55
+
56
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
57
+ $window_target=empty($new_window) ? '' : ' target="_blank"';
58
+
59
+ $data .= '<form action="' . $action_url . '" method="post" id="' . $uuid . '" class="sdm-download-form"'.$window_target.'>';
60
  $data .= '<input type="password" name="pass_text" class="sdm_pass_text" value="" /> ';
61
 
62
  $data .= sdm_get_download_with_recaptcha();
221
 
222
  $main_advanced_opts = get_option('sdm_advanced_options');
223
 
224
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
225
+ $window_target=empty($new_window) ? '' : ' target="_blank"';
226
+
227
+ $data = '<form action="' . $action_url . '" method="post" class="sdm-g-recaptcha-form sdm-download-form"'.$window_target.'>';
228
 
229
  $data .= '<div class="sdm-recaptcha-button">';
230
  $data .= '<div class="g-recaptcha sdm-g-recaptcha"></div>';
275
  $main_advanced_opts = get_option('sdm_advanced_options');
276
  $termscond_enable = isset($main_advanced_opts['termscond_enable']) ? true : false;
277
 
278
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
279
+ $window_target=empty($new_window) ? '' : ' target="_blank"';
280
+
281
+ $data = '<form action="' . $action_url . '" method="post" class="sdm-download-form"'.$window_target.'>';
282
  $data .= sdm_get_checkbox_for_termsncond();
283
  $data .= '<div class="sdm-termscond-button">';
284
  $data .= '<a href="#" class="sdm_download_with_condition ' . $class . '">' . $button_text_string . '</a>';
includes/templates/fancy0/sdm-fancy-0.php CHANGED
@@ -108,8 +108,12 @@ function sdm_generate_fancy0_display_output($args) {
108
  if ($cpt_is_password !== 'no') {//This is a password protected download so replace the download now button with password requirement
109
  $download_button_code = sdm_get_password_entry_form($id, $args, 'sdm_download ' . $def_color);
110
  }
111
-
112
  $output = "";
 
 
 
 
113
  $output .= '<div class="sdm_download_button_box_default"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
114
 
115
  return $output;
108
  if ($cpt_is_password !== 'no') {//This is a password protected download so replace the download now button with password requirement
109
  $download_button_code = sdm_get_password_entry_form($id, $args, 'sdm_download ' . $def_color);
110
  }
111
+
112
  $output = "";
113
+
114
+ //apply filter on button HTML code
115
+ $download_button_code=apply_filters('sdm_download_button_code_html', $download_button_code );
116
+
117
  $output .= '<div class="sdm_download_button_box_default"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
118
 
119
  return $output;
includes/templates/fancy1/sdm-fancy-1.php CHANGED
@@ -61,12 +61,16 @@ function sdm_generate_fancy1_display_output($args) {
61
  $main_opts = get_option('sdm_downloads_options');
62
 
63
  // See if new window parameter is set
 
 
 
64
  $window_target = empty($new_window) ? '_self' : '_blank';
65
 
66
  // Get CPT thumbnail
67
  $item_download_thumbnail = get_post_meta($id, 'sdm_upload_thumbnail', true);
68
  $isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_download_thumbnail_image" src="' . $item_download_thumbnail . '" />' : '';
69
-
 
70
  // Get CPT title
71
  $item_title = get_the_title($id);
72
 
@@ -80,14 +84,30 @@ function sdm_generate_fancy1_display_output($args) {
80
 
81
  //Get item file size
82
  $item_file_size = get_post_meta($id, 'sdm_item_file_size', true);
 
 
 
 
 
83
  $isset_item_file_size = ($show_size && isset($item_file_size)) ? $item_file_size : ''; //check if show_size is enabled and if there is a size value
 
84
  //Get item version
85
  $item_version = get_post_meta($id, 'sdm_item_version', true);
 
 
 
 
 
86
  $isset_item_version = ($show_version && isset($item_version)) ? $item_version : ''; //check if show_version is enabled and if there is a version value
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;
90
 
 
 
 
 
91
 
92
  $main_advanced_opts = get_option('sdm_advanced_options');
93
 
@@ -122,6 +142,9 @@ function sdm_generate_fancy1_display_output($args) {
122
 
123
  $output .= '<div class="sdm_download_description">' . $isset_item_description . '</div>';
124
 
 
 
 
125
  if (!empty($isset_item_file_size)) {//Show file size info
126
  $output .= '<div class="sdm_download_size">';
127
  $output .= '<span class="sdm_download_size_label">' . __('Size: ', 'simple-download-monitor') . '</span>';
@@ -135,8 +158,20 @@ function sdm_generate_fancy1_display_output($args) {
135
  $output .= '<span class="sdm_download_version_value">' . $isset_item_version . '</span>';
136
  $output .= '</div>';
137
  }
 
 
 
 
 
 
 
 
138
 
139
  $output .= '<div class="sdm_download_link">';
 
 
 
 
140
  $output .= '<span class="sdm_download_button">' . $download_button_code . '</span>';
141
  if (!isset($main_opts['general_hide_donwload_count'])) {//The hide download count is enabled.
142
  $output .= '<span class="sdm_download_item_count">' . $download_count_string . '</span>';
61
  $main_opts = get_option('sdm_downloads_options');
62
 
63
  // See if new window parameter is set
64
+ if(empty($new_window)){
65
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
66
+ }
67
  $window_target = empty($new_window) ? '_self' : '_blank';
68
 
69
  // Get CPT thumbnail
70
  $item_download_thumbnail = get_post_meta($id, 'sdm_upload_thumbnail', true);
71
  $isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_download_thumbnail_image" src="' . $item_download_thumbnail . '" />' : '';
72
+ $isset_download_thumbnail = apply_filters('sdm_download_fancy_1_thumbnail', $isset_download_thumbnail, $args);//Apply filter so it can be customized.
73
+
74
  // Get CPT title
75
  $item_title = get_the_title($id);
76
 
84
 
85
  //Get item file size
86
  $item_file_size = get_post_meta($id, 'sdm_item_file_size', true);
87
+ //Check if show file size is enabled
88
+ if(empty($show_size)){
89
+ //Disabled in shortcode. Lets check if it is enabled in the download meta.
90
+ $show_size = get_post_meta($id, 'sdm_item_show_file_size_fd', true);
91
+ }
92
  $isset_item_file_size = ($show_size && isset($item_file_size)) ? $item_file_size : ''; //check if show_size is enabled and if there is a size value
93
+
94
  //Get item version
95
  $item_version = get_post_meta($id, 'sdm_item_version', true);
96
+ //Check if show version is enabled
97
+ if(empty($show_version)){
98
+ //Disabled in shortcode. Lets check if it is enabled in the download meta.
99
+ $show_version = get_post_meta($id, 'sdm_item_show_item_version_fd', true);
100
+ }
101
  $isset_item_version = ($show_version && isset($item_version)) ? $item_version : ''; //check if show_version is enabled and if there is a version value
102
+
103
+ //Check to see if the download link cpt is password protected
104
  $get_cpt_object = get_post($id);
105
  $cpt_is_password = !empty($get_cpt_object->post_password) ? 'yes' : 'no'; // yes = download is password protected;
106
 
107
+ //Check if show date is enabled
108
+ $show_date_fd = get_post_meta($id, 'sdm_item_show_date_fd', true);
109
+ //Get item date
110
+ $download_date = get_the_date(get_option('date_format'), $id) ;
111
 
112
  $main_advanced_opts = get_option('sdm_advanced_options');
113
 
142
 
143
  $output .= '<div class="sdm_download_description">' . $isset_item_description . '</div>';
144
 
145
+ //This hook can be used to add content below the description in fancy1 template
146
+ $output .= apply_filters('sdm_fancy1_below_download_description','');
147
+
148
  if (!empty($isset_item_file_size)) {//Show file size info
149
  $output .= '<div class="sdm_download_size">';
150
  $output .= '<span class="sdm_download_size_label">' . __('Size: ', 'simple-download-monitor') . '</span>';
158
  $output .= '<span class="sdm_download_version_value">' . $isset_item_version . '</span>';
159
  $output .= '</div>';
160
  }
161
+
162
+ if ($show_date_fd) {//Show date
163
+ $output .= '<div class="sdm_download_date">';
164
+ $output .= '<span class="sdm_download_date_label">' . __('Published: ', 'simple-download-monitor') . '</span>';
165
+ $output .= '<span class="sdm_download_date_value">' . $download_date . '</span>';
166
+ $output .= '</div>';
167
+ }
168
+
169
 
170
  $output .= '<div class="sdm_download_link">';
171
+
172
+ //apply filter on button HTML code
173
+ $download_button_code=apply_filters('sdm_download_button_code_html', $download_button_code );
174
+
175
  $output .= '<span class="sdm_download_button">' . $download_button_code . '</span>';
176
  if (!isset($main_opts['general_hide_donwload_count'])) {//The hide download count is enabled.
177
  $output .= '<span class="sdm_download_item_count">' . $download_count_string . '</span>';
includes/templates/fancy2/sdm-fancy-2.php CHANGED
@@ -75,6 +75,9 @@ function sdm_generate_fancy2_display_output($args) {
75
  }
76
 
77
  // See if new window parameter is set
 
 
 
78
  $window_target = empty($new_window) ? '_self' : '_blank';
79
 
80
  $homepage = get_bloginfo('url');
@@ -109,6 +112,7 @@ function sdm_generate_fancy2_display_output($args) {
109
  // Get item thumbnail
110
  $item_download_thumbnail = get_post_meta($id, 'sdm_upload_thumbnail', true);
111
  $isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_fancy2_thumb_image" src="' . $item_download_thumbnail . '" />' : '';
 
112
 
113
  // Get item title
114
  $item_title = get_the_title($id);
@@ -118,11 +122,25 @@ function sdm_generate_fancy2_display_output($args) {
118
 
119
  //Get item file size
120
  $item_file_size = get_post_meta($id, 'sdm_item_file_size', true);
 
 
 
 
 
121
  $isset_item_file_size = ($show_size && isset($item_file_size)) ? $item_file_size : ''; //check if show_size is enabled and if there is a size value
122
  //Get item version
123
  $item_version = get_post_meta($id, 'sdm_item_version', true);
 
 
 
 
 
124
  $isset_item_version = ($show_version && isset($item_version)) ? $item_version : ''; //check if show_version is enabled and if there is a version value
125
-
 
 
 
 
126
 
127
  $output = '';
128
  $output .= '<div class="sdm_fancy2_item ' . $css_class . '">';
@@ -147,6 +165,16 @@ function sdm_generate_fancy2_display_output($args) {
147
  $output .= '<span class="sdm_fancy2_download_version_value">' . $isset_item_version . '</span>';
148
  $output .= '</div>';
149
  }
 
 
 
 
 
 
 
 
 
 
150
 
151
  $output .= '<div class="sdm_fancy2_download_link">' . $download_button_code . '</div>';
152
 
75
  }
76
 
77
  // See if new window parameter is set
78
+ if(empty($new_window)){
79
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
80
+ }
81
  $window_target = empty($new_window) ? '_self' : '_blank';
82
 
83
  $homepage = get_bloginfo('url');
112
  // Get item thumbnail
113
  $item_download_thumbnail = get_post_meta($id, 'sdm_upload_thumbnail', true);
114
  $isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_fancy2_thumb_image" src="' . $item_download_thumbnail . '" />' : '';
115
+ $isset_download_thumbnail = apply_filters('sdm_download_fancy_2_thumbnail', $isset_download_thumbnail, $args);//Apply filter so it can be customized.
116
 
117
  // Get item title
118
  $item_title = get_the_title($id);
122
 
123
  //Get item file size
124
  $item_file_size = get_post_meta($id, 'sdm_item_file_size', true);
125
+ //Check if show file size is enabled
126
+ if(empty($show_size)){
127
+ //Disabled in shortcode. Lets check if it is enabled in the download meta.
128
+ $show_size = get_post_meta($id, 'sdm_item_show_file_size_fd', true);
129
+ }
130
  $isset_item_file_size = ($show_size && isset($item_file_size)) ? $item_file_size : ''; //check if show_size is enabled and if there is a size value
131
  //Get item version
132
  $item_version = get_post_meta($id, 'sdm_item_version', true);
133
+ //Check if show version is enabled
134
+ if(empty($show_version)){
135
+ //Disabled in shortcode. Lets check if it is enabled in the download meta.
136
+ $show_version = get_post_meta($id, 'sdm_item_show_item_version_fd', true);
137
+ }
138
  $isset_item_version = ($show_version && isset($item_version)) ? $item_version : ''; //check if show_version is enabled and if there is a version value
139
+
140
+ // check show date in fancy display
141
+ $show_date_fd = get_post_meta($id, 'sdm_item_show_date_fd', true);
142
+ // Get item date
143
+ $download_date = get_the_date(get_option('date_format'), $id) ;
144
 
145
  $output = '';
146
  $output .= '<div class="sdm_fancy2_item ' . $css_class . '">';
165
  $output .= '<span class="sdm_fancy2_download_version_value">' . $isset_item_version . '</span>';
166
  $output .= '</div>';
167
  }
168
+
169
+ if ($show_date_fd) {//Show version info if specified in the shortcode
170
+ $output .= '<div class="sdm_fancy2_download_date">';
171
+ $output .= '<span class="sdm_fancy2_download_date_label">' . __('Published: ', 'simple-download-monitor') . '</span>';
172
+ $output .= '<span class="sdm_fancy2_download_date_value">' . $download_date . '</span>';
173
+ $output .= '</div>';
174
+ }
175
+
176
+ //apply filter on button HTML code
177
+ $download_button_code=apply_filters('sdm_download_button_code_html', $download_button_code );
178
 
179
  $output .= '<div class="sdm_fancy2_download_link">' . $download_button_code . '</div>';
180
 
languages/simple-download-monitor.pot CHANGED
@@ -985,3 +985,16 @@ msgstr ""
985
  #: includes/sdm-utility-functions.php:264
986
  msgid "terms and conditions"
987
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
985
  #: includes/sdm-utility-functions.php:264
986
  msgid "terms and conditions"
987
  msgstr ""
988
+
989
+
990
+ ### Translation strings for the addons
991
+ # Squeeze form addon
992
+
993
+ msgid "The download has been sent to your email. Please check your inbox."
994
+ msgstr ""
995
+
996
+ msgid "Name"
997
+ msgstr ""
998
+
999
+ msgid "Email"
1000
+ msgstr ""
main.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  * Plugin Name: Simple Download Monitor
4
- * Plugin URI: https://www.tipsandtricks-hq.com/simple-wordpress-download-monitor-plugin
5
  * Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
6
- * Version: 3.6.5
7
  * Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
8
  * Author URI: https://www.tipsandtricks-hq.com/development-center
9
  * License: GPL2
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) {
15
  exit;
16
  }
17
 
18
- define('WP_SIMPLE_DL_MONITOR_VERSION', '3.6.5');
19
  define('WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname(plugin_basename(__FILE__)));
20
  define('WP_SIMPLE_DL_MONITOR_URL', plugins_url('', __FILE__));
21
  define('WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path(__FILE__));
@@ -202,6 +202,7 @@ class simpleDownloadManager {
202
  add_action('save_post', array($this, 'sdm_save_description_meta_data')); // Save 'description' metabox
203
  add_action('save_post', array($this, 'sdm_save_upload_meta_data')); // Save 'upload file' metabox
204
  add_action('save_post', array($this, 'sdm_save_dispatch_meta_data')); // Save 'dispatch' metabox
 
205
  add_action('save_post', array($this, 'sdm_save_thumbnail_meta_data')); // Save 'thumbnail' metabox
206
  add_action('save_post', array($this, 'sdm_save_statistics_meta_data')); // Save 'statistics' metabox
207
  add_action('save_post', array($this, 'sdm_save_other_details_meta_data')); // Save 'other details' metabox
@@ -305,6 +306,7 @@ class simpleDownloadManager {
305
  add_meta_box('sdm_description_meta_box', __('Description', 'simple-download-monitor'), array($this, 'display_sdm_description_meta_box'), 'sdm_downloads', 'normal', 'default');
306
  add_meta_box('sdm_upload_meta_box', __('Downloadable File (Visitors will download this item)', 'simple-download-monitor'), array($this, 'display_sdm_upload_meta_box'), 'sdm_downloads', 'normal', 'default');
307
  add_meta_box('sdm_dispatch_meta_box', __('PHP Dispatch or Redirect', 'simple-download-monitor'), array($this, 'display_sdm_dispatch_meta_box'), 'sdm_downloads', 'normal', 'default');
 
308
  add_meta_box('sdm_thumbnail_meta_box', __('File Thumbnail (Optional)', 'simple-download-monitor'), array($this, 'display_sdm_thumbnail_meta_box'), 'sdm_downloads', 'normal', 'default');
309
  add_meta_box('sdm_stats_meta_box', __('Statistics', 'simple-download-monitor'), array($this, 'display_sdm_stats_meta_box'), 'sdm_downloads', 'normal', 'default');
310
  add_meta_box('sdm_other_details_meta_box', __('Other Details (Optional)', 'simple-download-monitor'), array($this, 'display_sdm_other_details_meta_box'), 'sdm_downloads', 'normal', 'default');
@@ -366,6 +368,25 @@ class simpleDownloadManager {
366
 
367
  wp_nonce_field('sdm_dispatch_box_nonce', 'sdm_dispatch_box_nonce_check');
368
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
 
370
  public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox
371
  $old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true);
@@ -433,26 +454,43 @@ class simpleDownloadManager {
433
  }
434
 
435
  public function display_sdm_other_details_meta_box($post) { //Other details metabox
 
 
 
 
 
436
  $file_size = get_post_meta($post->ID, 'sdm_item_file_size', true);
437
  $file_size = isset($file_size) ? $file_size : '';
438
 
439
  $version = get_post_meta($post->ID, 'sdm_item_version', true);
440
  $version = isset($version) ? $version : '';
441
-
442
  echo '<div class="sdm-download-edit-filesize">';
443
- _e('File Size: ', 'simple-download-monitor');
444
  echo '<br />';
445
  echo ' <input type="text" name="sdm_item_file_size" value="' . esc_attr($file_size) . '" size="20" />';
446
- echo '<p class="description">' . __('Enter the size of this file (example value: 2.15 MB). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
447
- echo '</div>';
 
 
 
448
 
449
  echo '<div class="sdm-download-edit-version">';
450
- _e('Version: ', 'simple-download-monitor');
451
  echo '<br />';
452
  echo ' <input type="text" name="sdm_item_version" value="' . esc_attr($version) . '" size="20" />';
453
- echo '<p class="description">' . __('Enter the version number for this item if any (example value: v2.5.10). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
 
 
454
  echo '</div>';
455
-
 
 
 
 
 
 
 
456
  wp_nonce_field('sdm_other_details_nonce', 'sdm_other_details_nonce_check');
457
  }
458
 
@@ -506,6 +544,19 @@ class simpleDownloadManager {
506
  $value = filter_input(INPUT_POST, 'sdm_item_dispatch', FILTER_VALIDATE_BOOLEAN);
507
  update_post_meta($post_id, 'sdm_item_dispatch', $value);
508
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
510
  public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox
511
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){
@@ -546,6 +597,15 @@ class simpleDownloadManager {
546
  return;
547
  }
548
 
 
 
 
 
 
 
 
 
 
549
  if (isset($_POST['sdm_item_file_size'])) {
550
  update_post_meta($post_id, 'sdm_item_file_size', sanitize_text_field($_POST['sdm_item_file_size']));
551
  }
@@ -570,14 +630,14 @@ class simpleDownloadManager {
570
  //Register the main setting
571
  register_setting('sdm_downloads_options', 'sdm_downloads_options');
572
 
 
 
 
 
573
  //Add all the settings section that will go under the main settings
574
  add_settings_section('general_options', __('General Options', 'simple-download-monitor'), array($this, 'general_options_cb'), 'general_options_section');
575
  add_settings_section('admin_options', __('Admin Options', 'simple-download-monitor'), array($this, 'admin_options_cb'), 'admin_options_section');
576
-
577
- //add reCAPTCHA section
578
- add_settings_section('recaptcha_options', __('Google Captcha (reCAPTCHA)', 'simple-download-monitor'), array($this, 'recaptcha_options_cb'), 'recaptcha_options_section');
579
- add_settings_section('termscond_options', __('Terms and Conditions', 'simple-download-monitor'), array($this, 'termscond_options_cb'), 'termscond_options_section');
580
-
581
  add_settings_section('sdm_colors', __('Colors', 'simple-download-monitor'), array($this, 'sdm_colors_cb'), 'sdm_colors_section');
582
  add_settings_section('sdm_debug', __('Debug', 'simple-download-monitor'), array($this, 'sdm_debug_cb'), 'sdm_debug_section');
583
  add_settings_section('sdm_deldata', __('Delete Plugin Data', 'simple-download-monitor'), array($this, 'sdm_deldata_cb'), 'sdm_deldata_section');
@@ -598,14 +658,26 @@ class simpleDownloadManager {
598
 
599
  add_settings_field('enable_debug', __('Enable Debug', 'simple-download-monitor'), array($this, 'enable_debug_cb'), 'sdm_debug_section', 'sdm_debug');
600
 
601
- //add reCAPTCHA section fields
 
 
 
 
 
 
 
 
602
  add_settings_field('recaptcha_enable', __('Enable reCAPTCHA', 'simple-download-monitor'), array($this, 'recaptcha_enable_cb'), 'recaptcha_options_section', 'recaptcha_options');
603
  add_settings_field('recaptcha_site_key', __('Site Key', 'simple-download-monitor'), array($this, 'recaptcha_site_key_cb'), 'recaptcha_options_section', 'recaptcha_options');
604
  add_settings_field('recaptcha_secret_key', __('Secret Key', 'simple-download-monitor'), array($this, 'recaptcha_secret_key_cb'), 'recaptcha_options_section', 'recaptcha_options');
605
 
606
- //add Terms & Condition section fields
607
  add_settings_field('termscond_enable', __('Enable Terms and Conditions', 'simple-download-monitor'), array($this, 'termscond_enable_cb'), 'termscond_options_section', 'termscond_options');
608
  add_settings_field('termscond_url', __('Terms Page URL', 'simple-download-monitor'), array($this, 'termscond_url_cb'), 'termscond_options_section', 'termscond_options');
 
 
 
 
609
  }
610
 
611
  public function general_options_cb() {
@@ -637,7 +709,7 @@ class simpleDownloadManager {
637
  }
638
 
639
  public function recaptcha_options_cb() {
640
- //Set the message that will be shown below the debug options settings heading
641
  _e('Google Captcha (reCAPTCHA) options', 'simple-download-monitor');
642
  }
643
 
@@ -645,6 +717,11 @@ class simpleDownloadManager {
645
 
646
  }
647
 
 
 
 
 
 
648
  public function recaptcha_enable_cb() {
649
  $main_opts = get_option('sdm_advanced_options');
650
  echo '<input name="sdm_advanced_options[recaptcha_enable]" id="recaptcha_enable" type="checkbox" ' . checked(1, isset($main_opts['recaptcha_enable']), false) . ' /> ';
@@ -761,6 +838,14 @@ class simpleDownloadManager {
761
  echo '<p class="description">' . __('Enter the URL of your terms and conditions page.', 'simple-download-monitor') . '</p>';
762
  }
763
 
 
 
 
 
 
 
 
 
764
  public function sdm_add_clone_record_btn($action, $post) {
765
  // Only execute on SDM CPT posts page
766
  if ($post->post_type == 'sdm_downloads') {
1
  <?php
2
  /**
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.7.0
7
  * Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
8
  * Author URI: https://www.tipsandtricks-hq.com/development-center
9
  * License: GPL2
15
  exit;
16
  }
17
 
18
+ define('WP_SIMPLE_DL_MONITOR_VERSION', '3.7.0');
19
  define('WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname(plugin_basename(__FILE__)));
20
  define('WP_SIMPLE_DL_MONITOR_URL', plugins_url('', __FILE__));
21
  define('WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path(__FILE__));
202
  add_action('save_post', array($this, 'sdm_save_description_meta_data')); // Save 'description' metabox
203
  add_action('save_post', array($this, 'sdm_save_upload_meta_data')); // Save 'upload file' metabox
204
  add_action('save_post', array($this, 'sdm_save_dispatch_meta_data')); // Save 'dispatch' metabox
205
+ add_action('save_post', array($this, 'sdm_save_misc_properties_meta_data')); // Save 'misc properties/settings' metabox
206
  add_action('save_post', array($this, 'sdm_save_thumbnail_meta_data')); // Save 'thumbnail' metabox
207
  add_action('save_post', array($this, 'sdm_save_statistics_meta_data')); // Save 'statistics' metabox
208
  add_action('save_post', array($this, 'sdm_save_other_details_meta_data')); // Save 'other details' metabox
306
  add_meta_box('sdm_description_meta_box', __('Description', 'simple-download-monitor'), array($this, 'display_sdm_description_meta_box'), 'sdm_downloads', 'normal', 'default');
307
  add_meta_box('sdm_upload_meta_box', __('Downloadable File (Visitors will download this item)', 'simple-download-monitor'), array($this, 'display_sdm_upload_meta_box'), 'sdm_downloads', 'normal', 'default');
308
  add_meta_box('sdm_dispatch_meta_box', __('PHP Dispatch or Redirect', 'simple-download-monitor'), array($this, 'display_sdm_dispatch_meta_box'), 'sdm_downloads', 'normal', 'default');
309
+ add_meta_box('sdm_misc_properties_meta_box', __('Miscellaneous Download Properties', 'simple-download-monitor'), array($this, 'display_sdm_misc_properties_meta_box'), 'sdm_downloads', 'normal', 'default');// Meta box for misc properies/settings
310
  add_meta_box('sdm_thumbnail_meta_box', __('File Thumbnail (Optional)', 'simple-download-monitor'), array($this, 'display_sdm_thumbnail_meta_box'), 'sdm_downloads', 'normal', 'default');
311
  add_meta_box('sdm_stats_meta_box', __('Statistics', 'simple-download-monitor'), array($this, 'display_sdm_stats_meta_box'), 'sdm_downloads', 'normal', 'default');
312
  add_meta_box('sdm_other_details_meta_box', __('Other Details (Optional)', 'simple-download-monitor'), array($this, 'display_sdm_other_details_meta_box'), 'sdm_downloads', 'normal', 'default');
368
 
369
  wp_nonce_field('sdm_dispatch_box_nonce', 'sdm_dispatch_box_nonce_check');
370
  }
371
+ // Open Download in new window
372
+ public function display_sdm_misc_properties_meta_box($post) {
373
+
374
+ //Check the open in new window value
375
+ $new_window = get_post_meta($post->ID, 'sdm_item_new_window', true);
376
+ if ($new_window === '') {
377
+ // No value yet (either new item or saved with older version of plugin)
378
+ $screen = get_current_screen();
379
+ if ($screen->action === 'add') {
380
+ //New item: we can set a default value as per plugin settings. If a general settings is introduced at a later stage.
381
+ //Does nothing at the moment.
382
+ }
383
+ }
384
+
385
+ echo '<p> <input id="sdm_item_new_window" type="checkbox" name="sdm_item_new_window" value="yes"' . checked(true, $new_window, false) . ' />';
386
+ echo '<label for="sdm_item_new_window">' . __('Open download in a new window.', 'simple-download-monitor') . '</label> </p>';
387
+
388
+ wp_nonce_field('sdm_misc_properties_box_nonce', 'sdm_misc_properties_box_nonce_check');
389
+ }
390
 
391
  public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox
392
  $old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true);
454
  }
455
 
456
  public function display_sdm_other_details_meta_box($post) { //Other details metabox
457
+
458
+ $show_date_fd = get_post_meta($post->ID, 'sdm_item_show_date_fd', true);
459
+ $sdm_item_show_file_size_fd = get_post_meta($post->ID, 'sdm_item_show_file_size_fd', true);
460
+ $sdm_item_show_item_version_fd = get_post_meta($post->ID, 'sdm_item_show_item_version_fd', true);
461
+
462
  $file_size = get_post_meta($post->ID, 'sdm_item_file_size', true);
463
  $file_size = isset($file_size) ? $file_size : '';
464
 
465
  $version = get_post_meta($post->ID, 'sdm_item_version', true);
466
  $version = isset($version) ? $version : '';
467
+
468
  echo '<div class="sdm-download-edit-filesize">';
469
+ echo '<strong>'.__('File Size: ', 'simple-download-monitor').'</strong>';
470
  echo '<br />';
471
  echo ' <input type="text" name="sdm_item_file_size" value="' . esc_attr($file_size) . '" size="20" />';
472
+ echo '<p class="description">' . __('Enter the size of this file (example value: 2.15 MB).', 'simple-download-monitor') . '</p>';
473
+ echo '<div class="sdm-download-edit-show-file-size"> <input id="sdm_item_show_file_size_fd" type="checkbox" name="sdm_item_show_file_size_fd" value="yes"' . checked(true, $sdm_item_show_file_size_fd, false) . ' />';
474
+ echo '<label for="sdm_item_show_file_size_fd">' . __('Show file size in fancy display.', 'simple-download-monitor') . '</label> </div>';
475
+ echo '</div>';
476
+ echo '<hr />';
477
 
478
  echo '<div class="sdm-download-edit-version">';
479
+ echo '<strong>'.__('Version: ', 'simple-download-monitor').'</strong>';
480
  echo '<br />';
481
  echo ' <input type="text" name="sdm_item_version" value="' . esc_attr($version) . '" size="20" />';
482
+ echo '<p class="description">' . __('Enter the version number for this item if any (example value: v2.5.10).', 'simple-download-monitor') . '</p>';
483
+ echo '<div class="sdm-download-edit-show-item-version"> <input id="sdm_item_show_item_version_fd" type="checkbox" name="sdm_item_show_item_version_fd" value="yes"' . checked(true, $sdm_item_show_item_version_fd, false) . ' />';
484
+ echo '<label for="sdm_item_show_item_version_fd">' . __('Show version number in fancy display.', 'simple-download-monitor') . '</label> </div>';
485
  echo '</div>';
486
+ echo '<hr />';
487
+
488
+ echo '<div class="sdm-download-edit-show-publish-date">';
489
+ echo '<strong>'.__('Publish Date: ', 'simple-download-monitor').'</strong>';
490
+ echo '<br /> <input id="sdm_item_show_date_fd" type="checkbox" name="sdm_item_show_date_fd" value="yes"' . checked(true, $show_date_fd, false) . ' />';
491
+ echo '<label for="sdm_item_show_date_fd">' . __('Show download published date in fancy display.', 'simple-download-monitor') . '</label>';
492
+ echo '</div>';
493
+
494
  wp_nonce_field('sdm_other_details_nonce', 'sdm_other_details_nonce_check');
495
  }
496
 
544
  $value = filter_input(INPUT_POST, 'sdm_item_dispatch', FILTER_VALIDATE_BOOLEAN);
545
  update_post_meta($post_id, 'sdm_item_dispatch', $value);
546
  }
547
+
548
+ public function sdm_save_misc_properties_meta_data($post_id) {
549
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
550
+ return;
551
+ }
552
+ if (!isset($_POST['sdm_misc_properties_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_misc_properties_box_nonce_check'], 'sdm_misc_properties_box_nonce')) {
553
+ return;
554
+ }
555
+ // Get POST-ed data as boolean value
556
+ $new_window_open = filter_input(INPUT_POST, 'sdm_item_new_window', FILTER_VALIDATE_BOOLEAN);
557
+
558
+ update_post_meta($post_id, 'sdm_item_new_window', $new_window_open);
559
+ }
560
 
561
  public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox
562
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){
597
  return;
598
  }
599
 
600
+ $show_date_fd = filter_input(INPUT_POST, 'sdm_item_show_date_fd', FILTER_VALIDATE_BOOLEAN);
601
+ update_post_meta($post_id, 'sdm_item_show_date_fd', $show_date_fd);
602
+
603
+ $sdm_item_show_file_size_fd = filter_input(INPUT_POST, 'sdm_item_show_file_size_fd', FILTER_VALIDATE_BOOLEAN);
604
+ update_post_meta($post_id, 'sdm_item_show_file_size_fd', $sdm_item_show_file_size_fd);
605
+
606
+ $sdm_item_show_item_version_fd = filter_input(INPUT_POST, 'sdm_item_show_item_version_fd', FILTER_VALIDATE_BOOLEAN);
607
+ update_post_meta($post_id, 'sdm_item_show_item_version_fd', $sdm_item_show_item_version_fd);
608
+
609
  if (isset($_POST['sdm_item_file_size'])) {
610
  update_post_meta($post_id, 'sdm_item_file_size', sanitize_text_field($_POST['sdm_item_file_size']));
611
  }
630
  //Register the main setting
631
  register_setting('sdm_downloads_options', 'sdm_downloads_options');
632
 
633
+ /*****************************/
634
+ /* General Settings Section */
635
+ /*****************************/
636
+
637
  //Add all the settings section that will go under the main settings
638
  add_settings_section('general_options', __('General Options', 'simple-download-monitor'), array($this, 'general_options_cb'), 'general_options_section');
639
  add_settings_section('admin_options', __('Admin Options', 'simple-download-monitor'), array($this, 'admin_options_cb'), 'admin_options_section');
640
+
 
 
 
 
641
  add_settings_section('sdm_colors', __('Colors', 'simple-download-monitor'), array($this, 'sdm_colors_cb'), 'sdm_colors_section');
642
  add_settings_section('sdm_debug', __('Debug', 'simple-download-monitor'), array($this, 'sdm_debug_cb'), 'sdm_debug_section');
643
  add_settings_section('sdm_deldata', __('Delete Plugin Data', 'simple-download-monitor'), array($this, 'sdm_deldata_cb'), 'sdm_deldata_section');
658
 
659
  add_settings_field('enable_debug', __('Enable Debug', 'simple-download-monitor'), array($this, 'enable_debug_cb'), 'sdm_debug_section', 'sdm_debug');
660
 
661
+ /*****************************/
662
+ /* Advanced Settings Section */
663
+ /*****************************/
664
+ //Add the advanced settings section
665
+ add_settings_section('recaptcha_options', __('Google Captcha (reCAPTCHA)', 'simple-download-monitor'), array($this, 'recaptcha_options_cb'), 'recaptcha_options_section');
666
+ add_settings_section('termscond_options', __('Terms and Conditions', 'simple-download-monitor'), array($this, 'termscond_options_cb'), 'termscond_options_section');
667
+ add_settings_section('adsense_options', __('Adsense/Ad Insertion', 'simple-download-monitor'), array($this, 'adsense_options_cb'), 'adsense_options_section');
668
+
669
+ //Add reCAPTCHA section fields
670
  add_settings_field('recaptcha_enable', __('Enable reCAPTCHA', 'simple-download-monitor'), array($this, 'recaptcha_enable_cb'), 'recaptcha_options_section', 'recaptcha_options');
671
  add_settings_field('recaptcha_site_key', __('Site Key', 'simple-download-monitor'), array($this, 'recaptcha_site_key_cb'), 'recaptcha_options_section', 'recaptcha_options');
672
  add_settings_field('recaptcha_secret_key', __('Secret Key', 'simple-download-monitor'), array($this, 'recaptcha_secret_key_cb'), 'recaptcha_options_section', 'recaptcha_options');
673
 
674
+ //Add Terms & Condition section fields
675
  add_settings_field('termscond_enable', __('Enable Terms and Conditions', 'simple-download-monitor'), array($this, 'termscond_enable_cb'), 'termscond_options_section', 'termscond_options');
676
  add_settings_field('termscond_url', __('Terms Page URL', 'simple-download-monitor'), array($this, 'termscond_url_cb'), 'termscond_options_section', 'termscond_options');
677
+
678
+ //Add Adsense section fields
679
+ add_settings_field('adsense_below_description', __('Below Download Description', 'simple-download-monitor'), array($this, 'adsense_below_description_cb'), 'adsense_options_section', 'adsense_options');
680
+
681
  }
682
 
683
  public function general_options_cb() {
709
  }
710
 
711
  public function recaptcha_options_cb() {
712
+ //Set the message that will be shown below the recaptcha options settings heading
713
  _e('Google Captcha (reCAPTCHA) options', 'simple-download-monitor');
714
  }
715
 
717
 
718
  }
719
 
720
+ public function adsense_options_cb() {
721
+ //Set the message that will be shown below the adsense/ad code settings heading
722
+ _e('You can use this section to insert adsense or other ad code inside the download item output', 'simple-download-monitor');
723
+ }
724
+
725
  public function recaptcha_enable_cb() {
726
  $main_opts = get_option('sdm_advanced_options');
727
  echo '<input name="sdm_advanced_options[recaptcha_enable]" id="recaptcha_enable" type="checkbox" ' . checked(1, isset($main_opts['recaptcha_enable']), false) . ' /> ';
838
  echo '<p class="description">' . __('Enter the URL of your terms and conditions page.', 'simple-download-monitor') . '</p>';
839
  }
840
 
841
+ public function adsense_below_description_cb() {
842
+ $main_opts = get_option('sdm_advanced_options');
843
+ $value = isset($main_opts['adsense_below_description']) ? $main_opts['adsense_below_description'] : '';
844
+ //echo '<input size="100" name="sdm_advanced_options[adsense_below_description]" id="adsense_below_description" type="text" value="'.$value.'" /> ';
845
+ echo '<textarea name="sdm_advanced_options[adsense_below_description]" id="adsense_below_description" rows="6" cols="60">'.$value.'</textarea>';
846
+ echo '<p class="description">' . __('Enter the Adsense or Ad code that you want to show below the download item description.', 'simple-download-monitor') . '</p>';
847
+ }
848
+
849
  public function sdm_add_clone_record_btn($action, $post) {
850
  // Only execute on SDM CPT posts page
851
  if ($post->post_type == 'sdm_downloads') {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Tips and Tricks HQ, Ruhul Amin, josh401, mbrsolution, alexanderfox
3
  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: 4.1.0
6
- Tested up to: 4.9
7
- Stable tag: 3.6.5
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
@@ -66,11 +66,13 @@ https://www.youtube.com/watch?v=utYIH0fILuQ
66
  * You can also choose to only monitor downloads from unique IP address only.
67
  * Option to specify file size info so it can be shown to your visitors. [View the tutorial](https://simple-download-monitor.com/how-to-show-file-size-info-of-your-downloads/)
68
  * Option to specify version number info for the download item so it can be shown to your visitors.
 
69
  * Option to restrict downloads to logged-in users only.
70
  * Option to ignore download count from bots.
71
  * Option to add Google reCAPTCHA to your download buttons.
72
  * Option to add Terms and Condtions to your download buttons.
73
  * Ability to easily clone/copy your existing download items.
 
74
 
75
  View more details on the [download monitor plugin](https://simple-download-monitor.com/) page.
76
 
@@ -182,6 +184,27 @@ For screenshots please visit the [download monitor plugin page](https://www.tips
182
 
183
  == Changelog ==
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  = 3.6.5 =
186
  - Added a new feature to allow easy copying/cloning of your existing download item. Useful if you are trying to create a lot of similar downloads.
187
  - The list downloads from category can now accept multiple category slugs (or IDs).
3
  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: 4.1.0
6
+ Tested up to: 5.0
7
+ Stable tag: 3.7.0
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
66
  * You can also choose to only monitor downloads from unique IP address only.
67
  * Option to specify file size info so it can be shown to your visitors. [View the tutorial](https://simple-download-monitor.com/how-to-show-file-size-info-of-your-downloads/)
68
  * Option to specify version number info for the download item so it can be shown to your visitors.
69
+ * Option to show the download published date.
70
  * Option to restrict downloads to logged-in users only.
71
  * Option to ignore download count from bots.
72
  * Option to add Google reCAPTCHA to your download buttons.
73
  * Option to add Terms and Condtions to your download buttons.
74
  * Ability to easily clone/copy your existing download items.
75
+ * Ability to insert Adsense or other Ad code inside the download item display.
76
 
77
  View more details on the [download monitor plugin](https://simple-download-monitor.com/) page.
78
 
184
 
185
  == Changelog ==
186
 
187
+ = 3.7.0.=
188
+ - Fixed "Open in new window" option was ignored when for downloads with reCaptcha, password and/or Terms and Conditions.
189
+
190
+ = 3.6.9 =
191
+ - Added two filter hooks for template 1 and template 2 to allow customization of the thumbnail output.
192
+ - Changed the "logs" admin menu slug to "sdm-logs" to make it unique.
193
+ - WordPress 5 compatibility.
194
+
195
+ = 3.6.8 =
196
+ - Fixed Terms and Conditions box conflict with Hidden Downloads addon (requires addon version 1.3+).
197
+
198
+ = 3.6.7 =
199
+ - You can configure the "new_window" property by editing the download item from the admin dashboard.
200
+ - Added a new feature to show the download published date in the fancy display. You can edit a download and check the "Publish Date" option to show this info.
201
+ - There are also checkboxes to show the file size and version number.
202
+
203
+ = 3.6.6 =
204
+ - Added a new feature to show adsense or other ad code below the download description.
205
+ - Added the sdm_downloads_description filter to the description output. Other plugins can apply customization to the description output using this hook.
206
+ - Added a new filter sdm_cpt_below_download_description
207
+
208
  = 3.6.5 =
209
  - Added a new feature to allow easy copying/cloning of your existing download item. Useful if you are trying to create a lot of similar downloads.
210
  - The list downloads from category can now accept multiple category slugs (or IDs).
sdm-post-type-content-handler.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  add_filter('the_content', 'filter_sdm_post_type_content');
4
 
5
  function filter_sdm_post_type_content($content) {
@@ -33,6 +34,11 @@ function filter_sdm_post_type_content($content) {
33
  $item_version = get_post_meta($id, 'sdm_item_version', true);
34
  $isset_item_version = isset($item_version) ? $item_version : '';
35
 
 
 
 
 
 
36
  // See if user color option is selected
37
  $main_opts = get_option('sdm_downloads_options');
38
  $color_opt = $main_opts['download_button_color'];
@@ -43,9 +49,13 @@ function filter_sdm_post_type_content($content) {
43
  //*** Generate the download now button code ***
44
  $button_text_string = __('Download Now!', 'simple-download-monitor');
45
 
 
 
 
 
46
  $homepage = get_bloginfo('url');
47
  $download_url = $homepage . '/?smd_process_download=1&download_id=' . $id;
48
- $download_button_code = '<a href="' . $download_url . '" class="sdm_download ' . $def_color . '" title="' . $isset_item_title . '">' . $button_text_string . '</a>';
49
 
50
  $main_advanced_opts = get_option('sdm_advanced_options');
51
 
@@ -94,6 +104,9 @@ function filter_sdm_post_type_content($content) {
94
 
95
  $content .= '<div class="sdm_post_description">' . $isset_item_description . '</div>';
96
 
 
 
 
97
  $content .= '<div class="sdm_post_download_section"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
98
 
99
  if (!empty($isset_item_file_size)) {//Show file size info
@@ -110,6 +123,13 @@ function filter_sdm_post_type_content($content) {
110
  $content .= '</div>';
111
  }
112
 
 
 
 
 
 
 
 
113
  //$content .= '<div class="sdm_post_meta_section"></div>';//TODO - Show post meta (category and tags)
114
  $content .= '</div>'; //end .sdm_post_item_top_right
115
 
@@ -124,3 +144,37 @@ function filter_sdm_post_type_content($content) {
124
 
125
  return $content;
126
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ //Handles the output on the SDM individual download page (Custom Post Type)
4
  add_filter('the_content', 'filter_sdm_post_type_content');
5
 
6
  function filter_sdm_post_type_content($content) {
34
  $item_version = get_post_meta($id, 'sdm_item_version', true);
35
  $isset_item_version = isset($item_version) ? $item_version : '';
36
 
37
+ //Check if show published date is enabled
38
+ $show_date_fd = get_post_meta($id, 'sdm_item_show_date_fd', true);
39
+ //Get published date
40
+ $published_date = get_the_date(get_option('date_format'), $id);
41
+
42
  // See if user color option is selected
43
  $main_opts = get_option('sdm_downloads_options');
44
  $color_opt = $main_opts['download_button_color'];
49
  //*** Generate the download now button code ***
50
  $button_text_string = __('Download Now!', 'simple-download-monitor');
51
 
52
+ // See if new window parameter is set
53
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
54
+ $window_target = empty($new_window) ? '_self' : '_blank';
55
+
56
  $homepage = get_bloginfo('url');
57
  $download_url = $homepage . '/?smd_process_download=1&download_id=' . $id;
58
+ $download_button_code = '<a href="' . $download_url . '" class="sdm_download ' . $def_color . '" title="' . $isset_item_title . '" target="' . $window_target . '">' . $button_text_string . '</a>';
59
 
60
  $main_advanced_opts = get_option('sdm_advanced_options');
61
 
104
 
105
  $content .= '<div class="sdm_post_description">' . $isset_item_description . '</div>';
106
 
107
+ //This hook can be used to add content below the description
108
+ $content .= apply_filters('sdm_cpt_below_download_description','');
109
+
110
  $content .= '<div class="sdm_post_download_section"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
111
 
112
  if (!empty($isset_item_file_size)) {//Show file size info
123
  $content .= '</div>';
124
  }
125
 
126
+ if ($show_date_fd) {//Show Published date
127
+ $content .= '<div class="sdm_post_download_published_date">';
128
+ $content .= '<span class="sdm_post_download_published_date_label">' . __('Published: ', 'simple-download-monitor') . '</span>';
129
+ $content .= '<span class="sdm_post_download_published_date_value">' . $published_date . '</span>';
130
+ $content .= '</div>';
131
+ }
132
+
133
  //$content .= '<div class="sdm_post_meta_section"></div>';//TODO - Show post meta (category and tags)
134
  $content .= '</div>'; //end .sdm_post_item_top_right
135
 
144
 
145
  return $content;
146
  }
147
+
148
+ //The following filters are applied to the output of the SDM description field.
149
+ add_filter('sdm_downloads_description', 'do_shortcode' );
150
+ add_filter('sdm_downloads_description', 'wptexturize' );
151
+ add_filter('sdm_downloads_description', 'convert_smilies' );
152
+ add_filter('sdm_downloads_description', 'convert_chars' );
153
+ add_filter('sdm_downloads_description', 'wpautop' );
154
+ add_filter('sdm_downloads_description', 'shortcode_unautop' );
155
+ add_filter('sdm_downloads_description', 'prepend_attachment' );
156
+
157
+ function sdm_get_item_description_output($id) {
158
+ $item_description = get_post_meta($id, 'sdm_description', true);
159
+ $isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
160
+ //$isset_item_description = apply_filters('the_content', $isset_item_description);
161
+
162
+ //Lets apply all the filters like do_shortcode, wptexturize, convert_smilies, wpautop etc.
163
+ $filtered_item_description = apply_filters('sdm_downloads_description', $isset_item_description);
164
+
165
+ return $filtered_item_description;
166
+ }
167
+
168
+ //Add adsense or ad code below the description (if applicable)
169
+ add_filter('sdm_cpt_below_download_description', 'sdm_add_ad_code_below_description');
170
+ add_filter('sdm_fancy1_below_download_description', 'sdm_add_ad_code_below_description');
171
+
172
+ function sdm_add_ad_code_below_description($output){
173
+ $main_advanced_opts = get_option('sdm_advanced_options');
174
+ $adsense_below_desc = isset($main_advanced_opts['adsense_below_description']) ? $main_advanced_opts['adsense_below_description'] : '';
175
+ if(!empty($adsense_below_desc)){
176
+ //Ad code is configured in settings. Lets add it to the output.
177
+ $output .= '<div class="sdm_below_description_ad_code">' . $adsense_below_desc . '</div>';
178
+ }
179
+ return $output;
180
+ }
sdm-shortcodes.php CHANGED
@@ -88,6 +88,9 @@ function sdm_create_download_shortcode( $atts ) {
88
  $item_title = get_the_title( $id );
89
 
90
  //*** Generate the download now button code ***
 
 
 
91
  $window_target = empty( $new_window ) ? '_self' : '_blank';
92
 
93
  $homepage = get_bloginfo( 'url' );
@@ -268,7 +271,10 @@ function sdm_handle_category_shortcode( $args ) {
268
 
269
  // Setup download location
270
  $homepage = get_bloginfo( 'url' );
271
-
 
 
 
272
  $window_target = empty( $new_window ) ? '_self' : '_blank';
273
 
274
  // Iterate cpt's
88
  $item_title = get_the_title( $id );
89
 
90
  //*** Generate the download now button code ***
91
+ if(empty($new_window)){
92
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
93
+ }
94
  $window_target = empty( $new_window ) ? '_self' : '_blank';
95
 
96
  $homepage = get_bloginfo( 'url' );
271
 
272
  // Setup download location
273
  $homepage = get_bloginfo( 'url' );
274
+ if(empty($new_window)){
275
+ $new_window = get_post_meta( $id, 'sdm_item_new_window', true );
276
+ }
277
+
278
  $window_target = empty( $new_window ) ? '_self' : '_blank';
279
 
280
  // Iterate cpt's