Download Monitor - Version 4.7.70

Version Description

  • 12.12.2022 = Fixed: Aditional CSS classes for gutenberg blocks ( #1146 ) Changed: Removed test paymant gateway as PayPal gateway already has a test solution ( #666 ) Changed: De-prioritize the "DLM Protect file" buttin in Media Library single view ( #1132 ) Added: Quick copy download link in admin Downloads table ( #1148 ) Fixed: Reports download date not being displayed correctly based on time zone ( #1149 ) Fixed: Dashboard widget bugged if manual downloads are removed with filter ( #1151 )
Download this release

Release Info

Developer raldea89
Plugin Icon 128x128 Download Monitor
Version 4.7.70
Comparing to
See all releases

Code changes from version 4.7.60 to 4.7.70

assets/js/overview-download.js CHANGED
@@ -45,6 +45,7 @@
45
  dlm_shortcode.trigger("focus");
46
  dlm_shortcode.trigger("select");
47
  document.execCommand('copy');
 
48
  $(this).next('span').text($(this).data('item') + ' copied');
49
  $('.copy-dlm-button').not($(this)).parent().find('span').text('');
50
  dlm_shortcode.trigger("blur");
45
  dlm_shortcode.trigger("focus");
46
  dlm_shortcode.trigger("select");
47
  document.execCommand('copy');
48
+ navigator.clipboard.writeText(dlm_shortcode.val());
49
  $(this).next('span').text($(this).data('item') + ' copied');
50
  $('.copy-dlm-button').not($(this)).parent().find('span').text('');
51
  dlm_shortcode.trigger("blur");
assets/js/overview-download.min.js CHANGED
@@ -1 +1 @@
1
- !function(c){var d=inlineEditPost.edit;inlineEditPost.edit=function(e){d.apply(this,arguments);var t,o,n,i=0;0<(i="object"==typeof e?parseInt(this.getId(e)):i)&&(t=c("#edit-"+i),i=c("#post-"+i),o="Yes"==c(".column-featured",i).text(),n="Yes"==c(".column-members_only",i).text(),i="Yes"==c(".column-redirect_only",i).text(),c(':input[name="_featured"]',t).prop("checked",o),c(':input[name="_members_only"]',t).prop("checked",n),c(':input[name="_redirect_only"]',t).prop("checked",i))},c(".copy-dlm-shortcode").click(e=>{e.preventDefault();const t=c(e.currentTarget),o=t.find("input");o.trigger("focus"),o.trigger("select"),document.execCommand("copy"),c(this).next("span").text(c(this).data("item")+" copied"),c(".copy-dlm-button").not(c(this)).parent().find("span").text(""),o.trigger("blur"),t.find(".wpchill-tooltip-content span").text(dlm_download_overview.shortcode_copied),setTimeout(()=>{t.find(".wpchill-tooltip-content span").text(dlm_download_overview.copy_shortcode)},1e3)})}(jQuery);
1
+ !function(c){var r=inlineEditPost.edit;inlineEditPost.edit=function(t){r.apply(this,arguments);var e,o,n,i=0;0<(i="object"==typeof t?parseInt(this.getId(t)):i)&&(e=c("#edit-"+i),i=c("#post-"+i),o="Yes"==c(".column-featured",i).text(),n="Yes"==c(".column-members_only",i).text(),i="Yes"==c(".column-redirect_only",i).text(),c(':input[name="_featured"]',e).prop("checked",o),c(':input[name="_members_only"]',e).prop("checked",n),c(':input[name="_redirect_only"]',e).prop("checked",i))},c(".copy-dlm-shortcode").click(t=>{t.preventDefault();const e=c(t.currentTarget),o=e.find("input");o.trigger("focus"),o.trigger("select"),document.execCommand("copy"),navigator.clipboard.writeText(o.val()),c(this).next("span").text(c(this).data("item")+" copied"),c(".copy-dlm-button").not(c(this)).parent().find("span").text(""),o.trigger("blur"),e.find(".wpchill-tooltip-content span").text(dlm_download_overview.shortcode_copied),setTimeout(()=>{e.find(".wpchill-tooltip-content span").text(dlm_download_overview.copy_shortcode)},1e3)})}(jQuery);
changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 4.7.60 - 05.12.2022 =
2
  Fix: No access logs as redirect ( [#1143](https://github.com/WPChill/download-monitor/issues/1143) )
3
  Added: Action hook for extensions to hook on Reports page ( [#1140](https://github.com/WPChill/download-monitor/issues/1140) )
@@ -19,7 +27,7 @@ Fix: Bug on reports when Download deleted ( [#1136](https://github.com/WPChill/d
19
  = 4.7.5 - 22.11.2022 =
20
  Fix: Installed extensions error - missing class
21
 
22
- = 4.7.4 - 21.12.2022 =
23
  Fix: Sorting by download count did not take into consideration the post meta ( [#1126](https://github.com/WPChill/download-monitor/issues/1126) )
24
  Fix: Reports Downloads CPT retrieval ( [#1128](https://github.com/WPChill/download-monitor/issues/1128) )
25
  Fix: Storing IP setting not working ( [#1124](https://github.com/WPChill/download-monitor/issues/1124) )
1
+ = 4.7.70 - 12.12.2022 =
2
+ Fixed: Aditional CSS classes for gutenberg blocks ( [#1146](https://github.com/WPChill/download-monitor/issues/1146) )
3
+ Changed: Removed test paymant gateway as PayPal gateway already has a test solution ( [#666](https://github.com/WPChill/download-monitor/issues/666) )
4
+ Changed: De-prioritize the "DLM Protect file" buttin in Media Library single view ( [#1132](https://github.com/WPChill/download-monitor/issues/1132) )
5
+ Added: Quick copy download link in admin Downloads table ( [#1148](https://github.com/WPChill/download-monitor/issues/1148) )
6
+ Fixed: Reports download date not being displayed correctly based on time zone ( [#1149](https://github.com/WPChill/download-monitor/issues/1149) )
7
+ Fixed: Dashboard widget bugged if manual downloads are removed with filter ( [#1151](https://github.com/WPChill/download-monitor/issues/1151) )
8
+
9
  = 4.7.60 - 05.12.2022 =
10
  Fix: No access logs as redirect ( [#1143](https://github.com/WPChill/download-monitor/issues/1143) )
11
  Added: Action hook for extensions to hook on Reports page ( [#1140](https://github.com/WPChill/download-monitor/issues/1140) )
27
  = 4.7.5 - 22.11.2022 =
28
  Fix: Installed extensions error - missing class
29
 
30
+ = 4.7.4 - 21.11.2022 =
31
  Fix: Sorting by download count did not take into consideration the post meta ( [#1126](https://github.com/WPChill/download-monitor/issues/1126) )
32
  Fix: Reports Downloads CPT retrieval ( [#1128](https://github.com/WPChill/download-monitor/issues/1128) )
33
  Fix: Storing IP setting not working ( [#1124](https://github.com/WPChill/download-monitor/issues/1124) )
download-monitor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing and selling downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
- Version: 4.7.60
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
@@ -34,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) {
34
 
35
  // Define DLM Version
36
 
37
- define( 'DLM_VERSION', '4.7.60' );
38
  define( 'DLM_UPGRADER_VERSION', '4.6.0' );
39
 
40
  // Define DLM FILE
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing and selling downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
+ Version: 4.7.70
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
34
 
35
  // Define DLM Version
36
 
37
+ define( 'DLM_VERSION', '4.7.70' );
38
  define( 'DLM_UPGRADER_VERSION', '4.6.0' );
39
 
40
  // Define DLM FILE
includes/backwards-compatibility/class-dlm-backwards-compatibility.php CHANGED
@@ -211,8 +211,11 @@ class DLM_Backwards_Compatibility {
211
  public function select_download_count_compatibility( $fields ) {
212
 
213
  global $wpdb;
214
-
215
- $fields .= ", {$wpdb->dlm_downloads}.download_count, ( IFNULL( {$wpdb->dlm_downloads}.download_count, 0 ) + IFNULL( meta_downloads.meta_value, 0 ) ) total_downloads";
 
 
 
216
 
217
  return $fields;
218
  }
211
  public function select_download_count_compatibility( $fields ) {
212
 
213
  global $wpdb;
214
+ if ( apply_filters( 'dlm_count_meta_downloads', true ) ) {
215
+ $fields .= ", {$wpdb->dlm_downloads}.download_count, ( IFNULL( {$wpdb->dlm_downloads}.download_count, 0 ) + IFNULL( meta_downloads.meta_value, 0 ) ) total_downloads";
216
+ } else {
217
+ $fields .= ", {$wpdb->dlm_downloads}.download_count, ( IFNULL( {$wpdb->dlm_downloads}.download_count, 0 ) ) total_downloads";
218
+ }
219
 
220
  return $fields;
221
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpchill, silkalns, barrykooij, mikejolley
3
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection, password, protect downloads, tracker, sell, shop, ecommerce, paypal
4
  Requires at least: 5.4
5
  Tested up to: 6.1
6
- Stable tag: 4.7.60
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
@@ -120,6 +120,13 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
120
  4. The quick add panel can be opened via a link about the post editor. This lets you quickly add a file and insert it into a post.
121
 
122
  == Changelog ==
 
 
 
 
 
 
 
123
 
124
  = 4.7.60 - 05.12.2022 =
125
  Fix: No access logs as redirect ( [#1143](https://github.com/WPChill/download-monitor/issues/1143) )
3
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection, password, protect downloads, tracker, sell, shop, ecommerce, paypal
4
  Requires at least: 5.4
5
  Tested up to: 6.1
6
+ Stable tag: 4.7.70
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
120
  4. The quick add panel can be opened via a link about the post editor. This lets you quickly add a file and insert it into a post.
121
 
122
  == Changelog ==
123
+ = 4.7.70 - 12.12.2022 =
124
+ Fixed: Aditional CSS classes for gutenberg blocks ( [#1146](https://github.com/WPChill/download-monitor/issues/1146) )
125
+ Changed: Removed test paymant gateway as PayPal gateway already has a test solution ( [#666](https://github.com/WPChill/download-monitor/issues/666) )
126
+ Changed: De-prioritize the "DLM Protect file" buttin in Media Library single view ( [#1132](https://github.com/WPChill/download-monitor/issues/1132) )
127
+ Added: Quick copy download link in admin Downloads table ( [#1148](https://github.com/WPChill/download-monitor/issues/1148) )
128
+ Fixed: Reports download date not being displayed correctly based on time zone ( [#1149](https://github.com/WPChill/download-monitor/issues/1149) )
129
+ Fixed: Dashboard widget bugged if manual downloads are removed with filter ( [#1151](https://github.com/WPChill/download-monitor/issues/1151) )
130
 
131
  = 4.7.60 - 05.12.2022 =
132
  Fix: No access logs as redirect ( [#1143](https://github.com/WPChill/download-monitor/issues/1143) )
src/Admin/AdminScripts.php CHANGED
@@ -144,7 +144,7 @@ class DLM_Admin_Scripts {
144
  'dlm_download_overview',
145
  array(
146
  'copy_shortcode' => esc_html__( 'Copy shortcode', 'download-monitor' ),
147
- 'shortcode_copied' => esc_html__( 'Shortcode copied', 'download-monitor' ),
148
  )
149
  );
150
 
144
  'dlm_download_overview',
145
  array(
146
  'copy_shortcode' => esc_html__( 'Copy shortcode', 'download-monitor' ),
147
+ 'shortcode_copied' => esc_html__( 'Copied', 'download-monitor' ),
148
  )
149
  );
150
 
src/Admin/CustomColumns.php CHANGED
@@ -54,6 +54,7 @@ class DLM_Custom_Columns {
54
  $columns["download_cat"] = __( "Categories", 'download-monitor' );
55
  $columns["version"] = __( "Version", 'download-monitor' );
56
  $columns["shortcode"] = __( "Shortcode", 'download-monitor' );
 
57
  $columns["download_tag"] = __( "Tags", 'download-monitor' );
58
  $columns["download_count"] = __( "Download count", 'download-monitor' );
59
  $columns["featured"] = __( "Featured", 'download-monitor' );
@@ -161,6 +162,9 @@ class DLM_Custom_Columns {
161
  case "shortcode" :
162
  echo '<button class="wpchill-tooltip-button copy-dlm-shortcode button button-primary dashicons dashicons-shortcode" style="width:40px;"><div class="wpchill-tooltip-content"><span class="dlm-copy-text">' . esc_html__( 'Copy shortcode', 'download-monitor' ) . '</span><div class="dl-shortcode-copy"><code>[download id="' . absint( $post->ID ) . '"]</code><input type="text" readonly value="[download id=\'' . absint( $post->ID ) . '\']" class="dlm-copy-shortcode-input"></div></div></button>';
163
  break;
 
 
 
164
  case "download_count" :
165
  echo number_format( $this->column_download->get_download_count(), 0, '.', ',' );
166
  break;
54
  $columns["download_cat"] = __( "Categories", 'download-monitor' );
55
  $columns["version"] = __( "Version", 'download-monitor' );
56
  $columns["shortcode"] = __( "Shortcode", 'download-monitor' );
57
+ $columns["download_link"] = __( "Download link", 'download-monitor' );
58
  $columns["download_tag"] = __( "Tags", 'download-monitor' );
59
  $columns["download_count"] = __( "Download count", 'download-monitor' );
60
  $columns["featured"] = __( "Featured", 'download-monitor' );
162
  case "shortcode" :
163
  echo '<button class="wpchill-tooltip-button copy-dlm-shortcode button button-primary dashicons dashicons-shortcode" style="width:40px;"><div class="wpchill-tooltip-content"><span class="dlm-copy-text">' . esc_html__( 'Copy shortcode', 'download-monitor' ) . '</span><div class="dl-shortcode-copy"><code>[download id="' . absint( $post->ID ) . '"]</code><input type="text" readonly value="[download id=\'' . absint( $post->ID ) . '\']" class="dlm-copy-shortcode-input"></div></div></button>';
164
  break;
165
+ case "download_link" :
166
+ echo '<button class="wpchill-tooltip-button copy-dlm-shortcode button button-primary dashicons dashicons-admin-links" style="width:40px;"><div class="wpchill-tooltip-content"><span class="dlm-copy-text">' . esc_html__( 'Copy download link', 'download-monitor' ) . '</span><div class="dl-shortcode-copy">' . esc_url( $this->column_download->get_the_download_link() ) . '<input type="text" readonly value="' . esc_url( $this->column_download->get_the_download_link() ) . '" class="dlm-copy-shortcode-input"></div></div></button>';
167
+ break;
168
  case "download_count" :
169
  echo number_format( $this->column_download->get_download_count(), 0, '.', ',' );
170
  break;
src/Admin/Reports/class-dlm-reports.php CHANGED
@@ -174,7 +174,7 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
174
  * @since 4.6.0
175
  */
176
  public function create_global_variable() {
177
- $current_user_can = '&user_can_view_reports=' . apply_filters( 'dlm_user_can_view_reports', current_user_can( 'manage_options' ) );
178
 
179
  $rest_route_download_reports = rest_url() . 'download-monitor/v1/download_reports?_wpnonce=' . wp_create_nonce( 'wp_rest' ) . $current_user_can;
180
  $rest_route_user_reports = rest_url() . 'download-monitor/v1/user_reports?_wpnonce=' . wp_create_nonce( 'wp_rest' ) . $current_user_can;
@@ -206,7 +206,7 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
206
  array(
207
  'methods' => 'GET',
208
  'callback' => array( $this, 'rest_stats' ),
209
- 'permission_callback' => '__return_true',
210
  )
211
  );
212
 
@@ -217,7 +217,7 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
217
  array(
218
  'methods' => 'GET',
219
  'callback' => array( $this, 'user_reports_stats' ),
220
- 'permission_callback' => '__return_true',
221
  )
222
  );
223
 
@@ -228,7 +228,7 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
228
  array(
229
  'methods' => 'GET',
230
  'callback' => array( $this, 'user_data_stats' ),
231
- 'permission_callback' => '__return_true',
232
  )
233
  );
234
  }
@@ -302,14 +302,6 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
302
 
303
  check_ajax_referer( 'wp_rest' );
304
 
305
- if ( ! isset( $_REQUEST['user_can_view_reports'] ) || ! (bool) $_REQUEST['user_can_view_reports'] || ! is_user_logged_in() ) {
306
- return array(
307
- 'stats' => array(),
308
- 'offset' => 0,
309
- 'done' => true,
310
- );
311
- }
312
-
313
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
314
  return array(
315
  'stats' => array(),
@@ -342,14 +334,6 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
342
 
343
  check_ajax_referer( 'wp_rest' );
344
 
345
- if ( ! isset( $_REQUEST['user_can_view_reports'] ) || ! (bool) $_REQUEST['user_can_view_reports'] || ! is_user_logged_in() ) {
346
- return array(
347
- 'logs' => array(),
348
- 'offset' => 1,
349
- 'done' => true,
350
- );
351
- }
352
-
353
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
354
  return array(
355
  'logs' => array(),
@@ -373,7 +357,7 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
373
  )
374
  );
375
  $table_columns = sanitize_text_field( implode( ',', wp_unslash( $table_columns ) ) );
376
- $downloads = $wpdb->get_results( $wpdb->prepare( 'SELECT ' . $table_columns . ', UNIX_TIMESTAMP( download_date ) as display_date FROM ' . $wpdb->download_log . " ORDER BY ID desc LIMIT {$offset_limit}, {$count};" ), ARRAY_A );
377
 
378
  $downloads = array_map( array( $this, 'date_creator' ), $downloads );
379
 
@@ -394,8 +378,8 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
394
  * @since 4.7.4
395
  */
396
  public function date_creator( $element ) {
397
-
398
- $element['display_date'] = wp_date( $this->date_format, $element['display_date'] );
399
 
400
  return $element;
401
  }
@@ -412,10 +396,6 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
412
 
413
  check_ajax_referer( 'wp_rest' );
414
 
415
- if ( ! isset( $_REQUEST['user_can_view_reports'] ) || ! (bool) $_REQUEST['user_can_view_reports'] || ! is_user_logged_in() ) {
416
- return array();
417
- }
418
-
419
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
420
  return array();
421
  }
@@ -539,5 +519,27 @@ if ( ! class_exists( 'DLM_Reports' ) ) {
539
  include __DIR__ . '/components/php-components/user-logs-footer.php';
540
  return ob_get_clean();
541
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  }
543
  }
174
  * @since 4.6.0
175
  */
176
  public function create_global_variable() {
177
+ $current_user_can = '&user_can_view_reports=' . apply_filters( 'dlm_user_can_view_reports', current_user_can( 'dlm_view_reports' ) );
178
 
179
  $rest_route_download_reports = rest_url() . 'download-monitor/v1/download_reports?_wpnonce=' . wp_create_nonce( 'wp_rest' ) . $current_user_can;
180
  $rest_route_user_reports = rest_url() . 'download-monitor/v1/user_reports?_wpnonce=' . wp_create_nonce( 'wp_rest' ) . $current_user_can;
206
  array(
207
  'methods' => 'GET',
208
  'callback' => array( $this, 'rest_stats' ),
209
+ 'permission_callback' => array( $this, 'check_api_rights' ),
210
  )
211
  );
212
 
217
  array(
218
  'methods' => 'GET',
219
  'callback' => array( $this, 'user_reports_stats' ),
220
+ 'permission_callback' => array( $this, 'check_api_rights' ),
221
  )
222
  );
223
 
228
  array(
229
  'methods' => 'GET',
230
  'callback' => array( $this, 'user_data_stats' ),
231
+ 'permission_callback' => array( $this, 'check_api_rights' ),
232
  )
233
  );
234
  }
302
 
303
  check_ajax_referer( 'wp_rest' );
304
 
 
 
 
 
 
 
 
 
305
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
306
  return array(
307
  'stats' => array(),
334
 
335
  check_ajax_referer( 'wp_rest' );
336
 
 
 
 
 
 
 
 
 
337
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
338
  return array(
339
  'logs' => array(),
357
  )
358
  );
359
  $table_columns = sanitize_text_field( implode( ',', wp_unslash( $table_columns ) ) );
360
+ $downloads = $wpdb->get_results( $wpdb->prepare( 'SELECT ' . $table_columns . ' FROM ' . $wpdb->download_log . " ORDER BY ID desc LIMIT {$offset_limit}, {$count};" ), ARRAY_A );
361
 
362
  $downloads = array_map( array( $this, 'date_creator' ), $downloads );
363
 
378
  * @since 4.7.4
379
  */
380
  public function date_creator( $element ) {
381
+ // Set UTC timezone bacause in the DB it is stored based on the timezone in the settings.
382
+ $element['display_date'] = wp_date( $this->date_format, strtotime( $element['download_date'] ), new DateTimeZone('UTC') );
383
 
384
  return $element;
385
  }
396
 
397
  check_ajax_referer( 'wp_rest' );
398
 
 
 
 
 
399
  if ( ! DLM_Logging::is_logging_enabled() || ! DLM_Utils::table_checker( $wpdb->dlm_reports ) ) {
400
  return array();
401
  }
519
  include __DIR__ . '/components/php-components/user-logs-footer.php';
520
  return ob_get_clean();
521
  }
522
+
523
+ /**
524
+ * Check permissions to display data
525
+ *
526
+ * @param array $request The request.
527
+ *
528
+ * @return bool|WP_Error
529
+ * @since 4.7.70
530
+ */
531
+ public function check_api_rights( $request ) {
532
+
533
+ if ( ! isset( $request['user_can_view_reports'] ) || ! (bool) $request['user_can_view_reports'] ||
534
+ ! is_user_logged_in() || ! current_user_can( 'dlm_view_reports' ) ) {
535
+ return new WP_Error(
536
+ 'rest_forbidden_context',
537
+ esc_html__( 'Sorry, you are not allowed to see data from this endpoint.', 'download-monitor' ),
538
+ array( 'status' => rest_authorization_required_code() )
539
+ );
540
+ }
541
+
542
+ return true;
543
+ }
544
  }
545
  }
src/Admin/Settings/Settings.php CHANGED
@@ -768,7 +768,7 @@ class DLM_Admin_Settings {
768
  $fields = array(
769
  array(
770
  'name' => 'dlm_gateway_' . esc_attr( $gateway->get_id() ) . '_enabled',
771
- 'std' => '0',
772
  'label' => __( 'Enabled', 'download-monitor' ),
773
  'cb_label' => __( 'Enable Gateway', 'download-monitor' ),
774
  'desc' => __( 'Check this to allow your customers to use this payment method to pay at your checkout page.', 'download-monitor' ),
768
  $fields = array(
769
  array(
770
  'name' => 'dlm_gateway_' . esc_attr( $gateway->get_id() ) . '_enabled',
771
+ 'std' => ( $gateway->is_enabled() ) ? '1' : '0',
772
  'label' => __( 'Enabled', 'download-monitor' ),
773
  'cb_label' => __( 'Enable Gateway', 'download-monitor' ),
774
  'desc' => __( 'Check this to allow your customers to use this payment method to pay at your checkout page.', 'download-monitor' ),
src/Admin/class-dlm-media-library.php CHANGED
@@ -51,7 +51,7 @@ class DLM_Media_Library {
51
  // Add DLM Uploads file as a mime type
52
  add_filter( 'post_mime_types', array( $this, 'add_mime_types' ), 15, 1 );
53
  // Actions done to Media Library files in order to create Downloads and protect files
54
- add_filter( 'attachment_fields_to_edit', array( $this, 'add_protect_button' ), 15, 2 );
55
  add_action( 'wp_ajax_dlm_protect_file', array( $this, 'protect_file' ), 15 );
56
  add_action( 'wp_ajax_dlm_unprotect_file', array( $this, 'unprotect_file' ), 15 );
57
  add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_visual_indicator' ), 10, 2 );
51
  // Add DLM Uploads file as a mime type
52
  add_filter( 'post_mime_types', array( $this, 'add_mime_types' ), 15, 1 );
53
  // Actions done to Media Library files in order to create Downloads and protect files
54
+ add_filter( 'attachment_fields_to_edit', array( $this, 'add_protect_button' ), 999, 2 );
55
  add_action( 'wp_ajax_dlm_protect_file', array( $this, 'protect_file' ), 15 );
56
  add_action( 'wp_ajax_dlm_unprotect_file', array( $this, 'unprotect_file' ), 15 );
57
  add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_visual_indicator' ), 10, 2 );
src/Gutenberg.php CHANGED
@@ -124,7 +124,7 @@ class DLM_Gutenberg {
124
  ob_start();
125
  if($download)
126
  {
127
- $template_handler->get_template_part( 'content-download', $template, '', array( 'dlm_download' => $download ) );
128
  }
129
  $output = ob_get_clean();
130
 
124
  ob_start();
125
  if($download)
126
  {
127
+ $template_handler->get_template_part( 'content-download', $template, '', array( 'dlm_download' => $download, 'dlm_attributes' => $attributes ) );
128
  }
129
  $output = ob_get_clean();
130
 
src/Shop/Checkout/PaymentGateway/Manager.php CHANGED
@@ -15,7 +15,6 @@ class Manager {
15
  // add gateways
16
  $this->gateways = apply_filters( 'dlm_shop_payment_gateways', array(
17
  new PayPal\PayPalGateway(),
18
- new Test\TestGateway()
19
  ) );
20
 
21
  }
15
  // add gateways
16
  $this->gateways = apply_filters( 'dlm_shop_payment_gateways', array(
17
  new PayPal\PayPalGateway(),
 
18
  ) );
19
 
20
  }
src/Shop/Checkout/PaymentGateway/PayPal/PayPalGateway.php CHANGED
@@ -22,7 +22,7 @@ class PayPalGateway extends PaymentGateway\PaymentGateway {
22
  $this->set_id( 'paypal' );
23
  $this->set_title( 'PayPal' );
24
  $this->set_description( __( 'Pay with PayPal', 'download-monitor' ) );
25
-
26
  parent::__construct();
27
 
28
  $this->set_sandbox( '1' == $this->get_option( 'sandbox_enabled' ) );
22
  $this->set_id( 'paypal' );
23
  $this->set_title( 'PayPal' );
24
  $this->set_description( __( 'Pay with PayPal', 'download-monitor' ) );
25
+ $this->set_enabled( true );
26
  parent::__construct();
27
 
28
  $this->set_sandbox( '1' == $this->get_option( 'sandbox_enabled' ) );
templates/content-download-box.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
9
 
10
  ?>
11
 
12
- <aside class="download-box">
13
 
14
  <?php $dlm_download->the_image(); ?>
15
 
9
 
10
  ?>
11
 
12
+ <aside class="download-box<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>">
13
 
14
  <?php $dlm_download->the_image(); ?>
15
 
templates/content-download-button.php CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
8
  } // Exit if accessed directly
9
  ?>
10
 
11
- <a class="aligncenter download-button" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
12
  <p>
13
  <?php printf( esc_html__( 'Download &ldquo;%s&rdquo;', 'download-monitor' ), wp_kses_post( $dlm_download->get_title() ) ); ?>
14
  </p>
8
  } // Exit if accessed directly
9
  ?>
10
 
11
+ <a class="aligncenter download-button<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
12
  <p>
13
  <?php printf( esc_html__( 'Download &ldquo;%s&rdquo;', 'download-monitor' ), wp_kses_post( $dlm_download->get_title() ) ); ?>
14
  </p>
templates/content-download-filename.php CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
8
  } // Exit if accessed directly
9
 
10
  ?>
11
- <a class="download-link filetype-icon <?php echo 'filetype-' . esc_html( $dlm_download->get_version()->get_filetype() ); ?>"
12
  title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
13
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
14
  } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
8
  } // Exit if accessed directly
9
 
10
  ?>
11
+ <a class="download-link<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?> filetype-icon <?php echo 'filetype-' . esc_html( $dlm_download->get_version()->get_filetype() ); ?>"
12
  title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
13
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
14
  } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
templates/content-download-no-version.php CHANGED
@@ -8,6 +8,6 @@ if ( ! defined( 'ABSPATH' ) ) {
8
  } // Exit if accessed directly
9
 
10
  ?>
11
- <a class="download-link" title="<?php echo esc_attr__( 'Please set a version in your WordPress admin', 'download-monitor' ); ?>" href="#" rel="nofollow">
12
  "<?php $dlm_download->the_title(); ?>" <strong><?php echo esc_html__( 'has no version set!', 'download-monitor' ); ?></strong>
13
  </a>
8
  } // Exit if accessed directly
9
 
10
  ?>
11
+ <a class="download-link<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>" title="<?php echo esc_attr__( 'Please set a version in your WordPress admin', 'download-monitor' ); ?>" href="#" rel="nofollow">
12
  "<?php $dlm_download->the_title(); ?>" <strong><?php echo esc_html__( 'has no version set!', 'download-monitor' ); ?></strong>
13
  </a>
templates/content-download-title.php CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
8
  } // Exit if accessed directly
9
 
10
  ?>
11
- <a class="download-link" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
12
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
13
  } ?>" href="<?php esc_url( $dlm_download->the_download_link() ); ?>" rel="nofollow">
14
  <?php $dlm_download->the_title(); ?>
8
  } // Exit if accessed directly
9
 
10
  ?>
11
+ <a class="download-link<?php echo ( !empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
12
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
13
  } ?>" href="<?php esc_url( $dlm_download->the_download_link() ); ?>" rel="nofollow">
14
  <?php $dlm_download->the_title(); ?>
templates/content-download-version-list.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  $versions = $dlm_download->get_versions();
11
 
12
  if ( $versions ) : ?>
13
- <ul class="download-versions">
14
  <?php
15
  /** @var DLM_Download_Version $version */
16
  foreach ( $versions as $version ) {
10
  $versions = $dlm_download->get_versions();
11
 
12
  if ( $versions ) : ?>
13
+ <ul class="download-versions<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : ''; ?>">
14
  <?php
15
  /** @var DLM_Download_Version $version */
16
  foreach ( $versions as $version ) {
templates/content-download.php CHANGED
@@ -12,8 +12,9 @@ if ( ! isset( $dlm_download ) || ! $dlm_download ) {
12
  }
13
 
14
  /** @var DLM_Download $dlm_download */
 
15
  ?>
16
- <a class="download-link" title="
17
  <?php
18
  if ( $dlm_download->get_version()->has_version_number() ) {
19
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
12
  }
13
 
14
  /** @var DLM_Download $dlm_download */
15
+ /** @var Attributes $dlm_attributes */
16
  ?>
17
+ <a class="download-link<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>" title="
18
  <?php
19
  if ( $dlm_download->get_version()->has_version_number() ) {
20
  printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
vendor/autoload.php CHANGED
@@ -2,11 +2,6 @@
2
 
3
  // autoload.php @generated by Composer
4
 
5
- if (PHP_VERSION_ID < 50600) {
6
- echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
- exit(1);
8
- }
9
-
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
  return ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a::getLoader();
2
 
3
  // autoload.php @generated by Composer
4
 
 
 
 
 
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
  return ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -149,7 +149,7 @@ class ClassLoader
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
- * @psalm-return array<string, string>
153
  */
154
  public function getClassMap()
155
  {
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
+ * @psalm-var array<string, string>
153
  */
154
  public function getClassMap()
155
  {
vendor/composer/autoload_classmap.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_classmap.php @generated by Composer
4
 
5
- $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
@@ -212,7 +212,6 @@ return array(
212
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PayPal\\Payments\\RefundsGetRequest' => $baseDir . '/src/Shop/Checkout/PaymentGateway/PayPal/Payments/RefundsGetRequest.php',
213
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PaymentGateway' => $baseDir . '/src/Shop/Checkout/PaymentGateway/PaymentGateway.php',
214
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Result' => $baseDir . '/src/Shop/Checkout/PaymentGateway/Result.php',
215
- 'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Test\\TestGateway' => $baseDir . '/src/Shop/Checkout/PaymentGateway/Test/TestGateway.php',
216
  'WPChill\\DownloadMonitor\\Shop\\Email\\Handler' => $baseDir . '/src/Shop/Email/Handler.php',
217
  'WPChill\\DownloadMonitor\\Shop\\Email\\Message' => $baseDir . '/src/Shop/Email/Message.php',
218
  'WPChill\\DownloadMonitor\\Shop\\Email\\VarParser' => $baseDir . '/src/Shop/Email/VarParser.php',
2
 
3
  // autoload_classmap.php @generated by Composer
4
 
5
+ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
212
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PayPal\\Payments\\RefundsGetRequest' => $baseDir . '/src/Shop/Checkout/PaymentGateway/PayPal/Payments/RefundsGetRequest.php',
213
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PaymentGateway' => $baseDir . '/src/Shop/Checkout/PaymentGateway/PaymentGateway.php',
214
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Result' => $baseDir . '/src/Shop/Checkout/PaymentGateway/Result.php',
 
215
  'WPChill\\DownloadMonitor\\Shop\\Email\\Handler' => $baseDir . '/src/Shop/Email/Handler.php',
216
  'WPChill\\DownloadMonitor\\Shop\\Email\\Message' => $baseDir . '/src/Shop/Email/Message.php',
217
  'WPChill\\DownloadMonitor\\Shop\\Email\\VarParser' => $baseDir . '/src/Shop/Email/VarParser.php',
vendor/composer/autoload_namespaces.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_namespaces.php @generated by Composer
4
 
5
- $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
2
 
3
  // autoload_namespaces.php @generated by Composer
4
 
5
+ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
vendor/composer/autoload_psr4.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_psr4.php @generated by Composer
4
 
5
- $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
2
 
3
  // autoload_psr4.php @generated by Composer
4
 
5
+ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
vendor/composer/autoload_real.php CHANGED
@@ -23,11 +23,30 @@ class ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a
23
  }
24
 
25
  spl_autoload_register(array('ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a', 'loadClassLoader'), true, true);
26
- self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
  spl_autoload_unregister(array('ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a', 'loadClassLoader'));
28
 
29
- require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit80ce4473100edd20fd6c17775a76ce9a::getInitializer($loader));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  $loader->register(true);
33
 
23
  }
24
 
25
  spl_autoload_register(array('ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a', 'loadClassLoader'), true, true);
26
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
  spl_autoload_unregister(array('ComposerAutoloaderInit80ce4473100edd20fd6c17775a76ce9a', 'loadClassLoader'));
28
 
29
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
+ if ($useStaticLoader) {
31
+ require __DIR__ . '/autoload_static.php';
32
+
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit80ce4473100edd20fd6c17775a76ce9a::getInitializer($loader));
34
+ } else {
35
+ $map = require __DIR__ . '/autoload_namespaces.php';
36
+ foreach ($map as $namespace => $path) {
37
+ $loader->set($namespace, $path);
38
+ }
39
+
40
+ $map = require __DIR__ . '/autoload_psr4.php';
41
+ foreach ($map as $namespace => $path) {
42
+ $loader->setPsr4($namespace, $path);
43
+ }
44
+
45
+ $classMap = require __DIR__ . '/autoload_classmap.php';
46
+ if ($classMap) {
47
+ $loader->addClassMap($classMap);
48
+ }
49
+ }
50
 
51
  $loader->register(true);
52
 
vendor/composer/autoload_static.php CHANGED
@@ -227,7 +227,6 @@ class ComposerStaticInit80ce4473100edd20fd6c17775a76ce9a
227
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PayPal\\Payments\\RefundsGetRequest' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/PayPal/Payments/RefundsGetRequest.php',
228
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PaymentGateway' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/PaymentGateway.php',
229
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Result' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/Result.php',
230
- 'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Test\\TestGateway' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/Test/TestGateway.php',
231
  'WPChill\\DownloadMonitor\\Shop\\Email\\Handler' => __DIR__ . '/../..' . '/src/Shop/Email/Handler.php',
232
  'WPChill\\DownloadMonitor\\Shop\\Email\\Message' => __DIR__ . '/../..' . '/src/Shop/Email/Message.php',
233
  'WPChill\\DownloadMonitor\\Shop\\Email\\VarParser' => __DIR__ . '/../..' . '/src/Shop/Email/VarParser.php',
227
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PayPal\\Payments\\RefundsGetRequest' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/PayPal/Payments/RefundsGetRequest.php',
228
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\PaymentGateway' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/PaymentGateway.php',
229
  'WPChill\\DownloadMonitor\\Shop\\Checkout\\PaymentGateway\\Result' => __DIR__ . '/../..' . '/src/Shop/Checkout/PaymentGateway/Result.php',
 
230
  'WPChill\\DownloadMonitor\\Shop\\Email\\Handler' => __DIR__ . '/../..' . '/src/Shop/Email/Handler.php',
231
  'WPChill\\DownloadMonitor\\Shop\\Email\\Message' => __DIR__ . '/../..' . '/src/Shop/Email/Message.php',
232
  'WPChill\\DownloadMonitor\\Shop\\Email\\VarParser' => __DIR__ . '/../..' . '/src/Shop/Email/VarParser.php',