Download Monitor - Version 4.4.10

Version Description

  • 02.11.2021 = Fixed: Escaping in admin "All Downloads" page. ( https://github.com/WPChill/download-monitor/issues/753 ) Added: Review request in dashboard.
Download this release

Release Info

Developer giucu91
Plugin Icon 128x128 Download Monitor
Version 4.4.10
Comparing to
See all releases

Code changes from version 4.4.9 to 4.4.10

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.4.9
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
- define( 'DLM_VERSION', '4.4.9' );
37
 
38
  // Define DLM FILE
39
  define( 'DLM_PLUGIN_FILE', __FILE__ );
@@ -52,6 +52,11 @@ if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) {
52
  if( ! class_exists( 'Download_Monitor_Usage_Tracker') ) {
53
  require_once dirname( __FILE__ ) . '/includes/tracking/class-download-monitor-usage-tracker.php';
54
  }
 
 
 
 
 
55
  if( ! function_exists( 'download_monitor_start_plugin_tracking' ) ) {
56
  function download_monitor_start_plugin_tracking() {
57
  $wisdom = new Download_Monitor_Usage_Tracker(
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.4.10
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
+ define( 'DLM_VERSION', '4.4.10' );
37
 
38
  // Define DLM FILE
39
  define( 'DLM_PLUGIN_FILE', __FILE__ );
52
  if( ! class_exists( 'Download_Monitor_Usage_Tracker') ) {
53
  require_once dirname( __FILE__ ) . '/includes/tracking/class-download-monitor-usage-tracker.php';
54
  }
55
+
56
+ if( ! class_exists( 'DLM_Review') && is_admin() ) {
57
+ require_once dirname( __FILE__ ) . '/includes/admin/class-dlm-review.php';
58
+ }
59
+
60
  if( ! function_exists( 'download_monitor_start_plugin_tracking' ) ) {
61
  function download_monitor_start_plugin_tracking() {
62
  $wisdom = new Download_Monitor_Usage_Tracker(
includes/admin/class-dlm-review.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DLM_Review {
4
+
5
+ private $value;
6
+ private $messages;
7
+ private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
8
+ private $slug = 'download-monitor';
9
+
10
+ function __construct() {
11
+
12
+ $this->messages = array(
13
+ 'notice' => esc_html__( "Hi there! Stoked to see you're using Download Monitor for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'download-monitor' ),
14
+ 'rate' => esc_html__( 'Rate the plugin', 'download-monitor' ),
15
+ 'rated' => esc_html__( 'Remind me later', 'download-monitor' ),
16
+ 'no_rate' => __( 'Don\'t show again', 'download-monitor' ),
17
+ );
18
+
19
+ if ( isset( $args['messages'] ) ) {
20
+ $this->messages = wp_parse_args( $args['messages'], $this->messages );
21
+ }
22
+
23
+ add_action( 'init', array( $this, 'init' ) );
24
+
25
+ }
26
+
27
+ public function init() {
28
+ if ( ! is_admin() ) {
29
+ return;
30
+ }
31
+
32
+ $this->value = $this->value();
33
+
34
+ if ( $this->check() ) {
35
+ add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) );
36
+ add_action( 'wp_ajax_download-monitor_review', array( $this, 'ajax' ) );
37
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
38
+ add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) );
39
+ }
40
+
41
+ add_filter('st_uninstall_db_options',array($this,'uninstall_options'));
42
+
43
+ }
44
+
45
+ private function check() {
46
+
47
+ if ( ! current_user_can('manage_options') ) {
48
+ return false;
49
+ }
50
+
51
+ return( time() > $this->value );
52
+
53
+ }
54
+
55
+ private function value() {
56
+
57
+ $value = get_option( 'download-monitor-rate-time', false );
58
+ if ( $value ) {
59
+ return $value;
60
+ }
61
+
62
+ $value = time() + DAY_IN_SECONDS;
63
+ update_option( 'download-monitor-rate-time', $value );
64
+
65
+ return $value;
66
+
67
+ }
68
+
69
+ public function five_star_wp_rate_notice() {
70
+
71
+ $url = sprintf( $this->link, $this->slug );
72
+
73
+ ?>
74
+ <div id="<?php echo esc_attr( $this->slug ) ?>-download-monitor-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
75
+ <p><?php echo sprintf( esc_html( $this->messages['notice'] ), esc_attr( $this->value ) ) ; ?></p>
76
+ <p class="actions">
77
+ <a id="download-monitor-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary download-monitor-review-button">
78
+ <?php echo esc_html( $this->messages['rate'] ); ?>
79
+ </a>
80
+ <a id="download-monitor-later" href="#" style="margin-left:10px" class="download-monitor-review-button"><?php echo esc_html( $this->messages['rated'] ); ?></a>
81
+ <a id="download-monitor-no-rate" href="#" style="margin-left:10px" class="download-monitor-review-button"><?php echo esc_html( $this->messages['no_rate'] ); ?></a>
82
+ </p>
83
+ </div>
84
+ <?php
85
+ }
86
+
87
+ public function ajax() {
88
+
89
+ check_ajax_referer( 'download-monitor-review', 'security' );
90
+
91
+ if ( ! isset( $_POST['check'] ) ) {
92
+ wp_die( 'ok' );
93
+ }
94
+
95
+ $time = get_option( 'download-monitor-rate-time' );
96
+
97
+ if ( 'download-monitor-rate' == $_POST['check'] ) {
98
+ $time = time() + YEAR_IN_SECONDS * 1;
99
+ }elseif ( 'download-monitor-later' == ['check'] ) {
100
+ $time = time() + WEEK_IN_SECONDS;
101
+ }elseif ( 'download-monitor-no-rate' == $_POST['check'] ) {
102
+ $time = time() + YEAR_IN_SECONDS * 1;
103
+ }
104
+
105
+ update_option( 'download-monitor-rate-time', $time );
106
+ wp_die( 'ok' );
107
+
108
+ }
109
+
110
+ public function enqueue() {
111
+ wp_enqueue_script( 'jquery' );
112
+ }
113
+
114
+ public function ajax_script() {
115
+
116
+ $ajax_nonce = wp_create_nonce( "download-monitor-review" );
117
+
118
+ ?>
119
+
120
+ <script type="text/javascript">
121
+ jQuery( document ).ready( function( $ ){
122
+
123
+ $( '.download-monitor-review-button' ).on('click', function( evt ){
124
+ var href = $(this).attr('href'),
125
+ id = $(this).attr('id');
126
+
127
+ if ( 'download-monitor-rate' != id ) {
128
+ evt.preventDefault();
129
+ }
130
+
131
+ var data = {
132
+ action: 'download-monitor_review',
133
+ security: '<?php echo $ajax_nonce; ?>',
134
+ check: id
135
+ };
136
+
137
+ if ( 'download-monitor-rated' === id ) {
138
+ data['download-monitor-review'] = 1;
139
+ }
140
+
141
+ $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
142
+ $( '#<?php echo $this->slug ?>-download-monitor-review-notice' ).slideUp( 'fast', function() {
143
+ $( this ).remove();
144
+ } );
145
+ });
146
+
147
+ } );
148
+
149
+ });
150
+ </script>
151
+
152
+ <?php
153
+ }
154
+
155
+ /**
156
+ * @param $options
157
+ *
158
+ * @return mixed
159
+ *
160
+ * @since 2.51.6
161
+ */
162
+ public function uninstall_options( $options ) {
163
+
164
+ $options[] = 'download-monitor-rate-time';
165
+
166
+ return $options;
167
+ }
168
+ }
169
+
170
+ new DLM_Review();
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: 5.8
6
- Stable tag: 4.4.9
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
@@ -122,6 +122,10 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 4.4.9 - 01.11.2021 =
126
  Fixed: Escaping in admin column, displaying HTLM instead of correct form
127
  Added: Clear transients button.
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: 5.8
6
+ Stable tag: 4.4.10
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
122
 
123
  == Changelog ==
124
 
125
+ = 4.4.10 - 02.11.2021 =
126
+ Fixed: Escaping in admin "All Downloads" page. ( https://github.com/WPChill/download-monitor/issues/753 )
127
+ Added: Review request in dashboard.
128
+
129
  = 4.4.9 - 01.11.2021 =
130
  Fixed: Escaping in admin column, displaying HTLM instead of correct form
131
  Added: Clear transients button.
src/Admin/CustomActions.php CHANGED
@@ -58,12 +58,11 @@ class DLM_Custom_Actions {
58
  }
59
 
60
  $dlm_download_category = isset( $_GET['dlm_download_category'] ) ? sanitize_text_field( wp_unslash( $_GET['dlm_download_category'] ) ) : '';
61
- $output = "<select name='dlm_download_category' id='dropdown_dlm_download_category'>";
62
- $output .= '<option value="" ' . selected( $dlm_download_category, '', false ) . '>' . __( 'Select a category', 'download-monitor' ) . '</option>';
63
- $output .= $this->walk_category_dropdown_tree( $terms, 0, $r );
64
- $output .= "</select>";
65
 
66
- echo wp_kses_post( $output );
67
  }
68
 
69
  /**
58
  }
59
 
60
  $dlm_download_category = isset( $_GET['dlm_download_category'] ) ? sanitize_text_field( wp_unslash( $_GET['dlm_download_category'] ) ) : '';
61
+ echo "<select name='dlm_download_category' id='dropdown_dlm_download_category'>";
62
+ echo '<option value="" ' . selected( $dlm_download_category, '', false ) . '>' . esc_html__( 'Select a category', 'download-monitor' ) . '</option>';
63
+ echo $this->walk_category_dropdown_tree( $terms, 0, $r ); //phpcs:ignore
64
+ echo '</select>';
65
 
 
66
  }
67
 
68
  /**