Download Monitor - Version 4.7.1

Version Description

  • 18.10.2022 = Fixed: Top Downloads widget wrong URL ( #1087 ) Fixed: Error when getting version download ( #1090 ) Fixed: Unicode file names downloaded with wrong name ( #1069 ) Added: Timestamp to download link ( #1092 )
Download this release

Release Info

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

Code changes from version 4.7.0 to 4.7.1

assets/js/dlm-xhr.js CHANGED
@@ -174,7 +174,8 @@ class DLM_XHR_Download {
174
  let blob = request.response;
175
  let file_name = responseHeaders['content-disposition'].split('filename=')[1];
176
  file_name = file_name.replace(/\"/g, '').replace(';', '');
177
-
 
178
  _OBJECT_URL = URL.createObjectURL(blob);
179
  // Remove event listener
180
  button.removeEventListener('click', dlmXHRinstance.handleDownloadClick);
174
  let blob = request.response;
175
  let file_name = responseHeaders['content-disposition'].split('filename=')[1];
176
  file_name = file_name.replace(/\"/g, '').replace(';', '');
177
+ // We use this method because we urlencoded it on the server so that characters like chinese or persian are not broken
178
+ file_name = decodeURI( file_name );
179
  _OBJECT_URL = URL.createObjectURL(blob);
180
  // Remove event listener
181
  button.removeEventListener('click', dlmXHRinstance.handleDownloadClick);
assets/js/dlm-xhr.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){new DLM_XHR_Download});class DLM_XHR_Download{constructor(){(dlmXHRinstance=this).init()}init(){dlmXHRinstance.attachButtonEvent()}attachButtonEvent(){let d="",r="";jQuery.each(dlmXHR.xhr_links.class,function(e,t){-1<t.indexOf("[class")||-1<t.indexOf("[id")?d+=r+" "+t:d+=r+" ."+t,r=","}),jQuery("html, body").on("click",d,function(e){return!!jQuery(this).hasClass("dlm-no-xhr-download")||(0<=jQuery(this).attr("href").indexOf("?add-to-cart")||void dlmXHRinstance.handleDownloadClick(this,e))})}handleDownloadClick(e,t){t.stopPropagation();var d=e.getAttribute("href");let r={button:e,href:d,buttonObj:jQuery(e)};-1===r.href.indexOf("blob:http")&&"#"!==r.href&&(t.preventDefault(),dlmXHRinstance.retrieveBlob(r))}retrieveBlob(e){let{button:n,href:l,buttonObj:a}=e,s;const i=new XMLHttpRequest,m=dlmXHR.prevent_duplicates,c=a.attr("target");let u=a.attr("class");u=void 0!==u&&""!==u?u.replace("dlm-download-started","").replace("dlm-download-completed",""):"",a.addClass("dlm-download-started"),n.setAttribute("href","#"),n.removeAttribute("download"),n.setAttribute("disabled","disabled");e=0<l.indexOf("?")?l+"&nonce="+dlmXHR.nonce:l+"?nonce="+dlmXHR.nonce;jQuery(document).trigger("dlm_download_triggered",[this,n,a,s]),i.responseType="blob",i.onreadystatechange=function(){var{status:e,readyState:t,statusText:d}=i;let r=i.getAllResponseHeaders().split("\r\n").reduce((e,t)=>{var[t,d]=t.split(": ");return e[t]=d,e},{});if(void 0!==r["dlm-no-waypoints"]&&(i.abort(),window.location.href=l),void 0!==r["dlm-external-download"])return i.abort(),o=r["dlm-file-name"].replace(/\"/g,"").replace(";",""),void dlmXHRinstance.dlmExternalDownload(r,n,a,o,l);if(2==i.readyState&&void 0!==r["dlm-error"]&&""!==r["dlm-error"]&&null!==r["dlm-error"])return dlmXHRinstance.dlmLogDownload(r,"failed",!1),n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove(),i.abort(),void a.append('<span class="dlm-xhr-error">'+r["dlm-error"]+"</span>");if(2==i.readyState&&void 0!==r["dlm-redirect"]&&""!==r["dlm-redirect"]&&null!==r["dlm-redirect"])return dlmXHRinstance.dlmLogDownload(r,"redirected",!1,r["dlm-redirect"],r["dlm-no-access"],c),n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove(),void i.abort();if(2==i.readyState&&i.status,404==e&&2==t){let e=document.createElement("p");e.innerHTML=d,n.parentNode.appendChild(e)}if(401==e&&2==t&&(window.location.href=d),403==e&&2==t){let e=document.createElement("p");e.innerHTML=d,n.parentNode.appendChild(e)}if(200==e&&4==t){var o=i.response;let e=r["content-disposition"].split("filename=")[1];e=e.replace(/\"/g,"").replace(";",""),s=URL.createObjectURL(o),n.removeEventListener("click",dlmXHRinstance.handleDownloadClick),n.setAttribute("download",""+e),n.setAttribute("href",s),n.click(),a.removeClass().addClass(u+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,n,a,s]),dlmXHRinstance.dlmLogDownload(r,"completed",m),window.URL.revokeObjectURL(s),n.removeAttribute("download"),n.setAttribute("href",l),setTimeout(function(){a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove()},4e3)}},i.addEventListener("progress",function(e){let t=e.loaded/e.total*100;t=t.toFixed(2);var d;a.find("span.dlm-xhr-progress").remove(),d="dlm-download-started download-"+10*Math.ceil(t/10),1/0!=t&&a.append('<span class="dlm-xhr-progress">&nbsp;'+t+"%</span>"),a.removeClass().addClass(u+" "+d),jQuery(document).trigger("dlm_download_progress",[this,n,a,s,e,t])}),i.onerror=function(){n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u+" dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),a.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},i.open("GET",e,!0),i.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),i.send()}dlmLogDownload(e,t,d,r=null,o=null,n="_self"){null!==o?window.location.href=r:(o=window.location.href,t={download_id:e["dlm-download-id"],version_id:e["dlm-version-id"],status:t,cookie:d,currentURL:o,action:"log_dlm_xhr_download",responseHeaders:e,nonce:dlmXHR.nonce},jQuery.post(dlmXHR.ajaxUrl,t,function(e){null!==r&&(null==n&&(n="_self"),window.open(r,n))}))}dlmExternalDownload(e,r,o,n,l){const a=new XMLHttpRequest,t=e["dlm-external-download"];o.attr("target");let s=o.attr("class"),i;s=void 0!==s&&""!==s?s.replace("dlm-download-started","").replace("dlm-download-completed",""):"",o.addClass("dlm-download-started"),r.setAttribute("href","#"),r.removeAttribute("download"),r.setAttribute("disabled","disabled"),jQuery(document).trigger("dlm_download_triggered",[this,r,o,i]),a.responseType="blob",a.onreadystatechange=function(){var{status:e,readyState:t}=a,d=a.getAllResponseHeaders().split("\r\n").reduce((e,t)=>{var[t,d]=t.split(": ");return e[t]=d,e},{});if(403===e)return dlmXHRinstance.dlmLogDownload(d,"failed",!1),a.abort(),void o.append('<span class="dlm-xhr-error">Acces Denied to file.</span>');200==e&&4==t&&(e=a.response,i=URL.createObjectURL(e),r.removeEventListener("click",dlmXHRinstance.handleDownloadClick),r.setAttribute("download",""+n),r.setAttribute("href",i),r.click(),o.removeClass().addClass(s+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,r,o,i]),dlmXHRinstance.dlmLogDownload(d,"completed",!1),window.URL.revokeObjectURL(i),r.removeAttribute("download"),r.setAttribute("href",l),setTimeout(function(){o.removeClass().addClass(s).find("span.dlm-xhr-progress").remove()},1e3))},a.addEventListener("progress",function(e){let t=e.loaded/e.total*100;t=t.toFixed(2);var d;o.find("span.dlm-xhr-progress").remove(),d="dlm-download-started download-"+10*Math.ceil(t/10),1/0!=t&&o.append('<span class="dlm-xhr-progress">&nbsp;'+t+"%</span>"),o.removeClass().addClass(s+" "+d),jQuery(document).trigger("dlm_download_progress",[this,r,o,i,e,t])}),a.onerror=function(){r.removeAttribute("download"),r.setAttribute("href",l),o.removeClass().addClass(s+" .dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),o.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},a.open("GET",t,!0),a.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),a.send()}}
1
+ jQuery(function(e){new DLM_XHR_Download});class DLM_XHR_Download{constructor(){(dlmXHRinstance=this).init()}init(){dlmXHRinstance.attachButtonEvent()}attachButtonEvent(){let d="",r="";jQuery.each(dlmXHR.xhr_links.class,function(e,t){-1<t.indexOf("[class")||-1<t.indexOf("[id")?d+=r+" "+t:d+=r+" ."+t,r=","}),jQuery("html, body").on("click",d,function(e){return!!jQuery(this).hasClass("dlm-no-xhr-download")||(0<=jQuery(this).attr("href").indexOf("?add-to-cart")||void dlmXHRinstance.handleDownloadClick(this,e))})}handleDownloadClick(e,t){t.stopPropagation();var d=e.getAttribute("href");let r={button:e,href:d,buttonObj:jQuery(e)};-1===r.href.indexOf("blob:http")&&"#"!==r.href&&(t.preventDefault(),dlmXHRinstance.retrieveBlob(r))}retrieveBlob(e){let{button:n,href:l,buttonObj:a}=e,s;const i=new XMLHttpRequest,m=dlmXHR.prevent_duplicates,c=a.attr("target");let u=a.attr("class");u=void 0!==u&&""!==u?u.replace("dlm-download-started","").replace("dlm-download-completed",""):"",a.addClass("dlm-download-started"),n.setAttribute("href","#"),n.removeAttribute("download"),n.setAttribute("disabled","disabled");e=0<l.indexOf("?")?l+"&nonce="+dlmXHR.nonce:l+"?nonce="+dlmXHR.nonce;jQuery(document).trigger("dlm_download_triggered",[this,n,a,s]),i.responseType="blob",i.onreadystatechange=function(){var{status:e,readyState:t,statusText:d}=i;let r=i.getAllResponseHeaders().split("\r\n").reduce((e,t)=>{var[t,d]=t.split(": ");return e[t]=d,e},{});if(void 0!==r["dlm-no-waypoints"]&&(i.abort(),window.location.href=l),void 0!==r["dlm-external-download"])return i.abort(),o=r["dlm-file-name"].replace(/\"/g,"").replace(";",""),void dlmXHRinstance.dlmExternalDownload(r,n,a,o,l);if(2==i.readyState&&void 0!==r["dlm-error"]&&""!==r["dlm-error"]&&null!==r["dlm-error"])return dlmXHRinstance.dlmLogDownload(r,"failed",!1),n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove(),i.abort(),void a.append('<span class="dlm-xhr-error">'+r["dlm-error"]+"</span>");if(2==i.readyState&&void 0!==r["dlm-redirect"]&&""!==r["dlm-redirect"]&&null!==r["dlm-redirect"])return dlmXHRinstance.dlmLogDownload(r,"redirected",!1,r["dlm-redirect"],r["dlm-no-access"],c),n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove(),void i.abort();if(2==i.readyState&&i.status,404==e&&2==t){let e=document.createElement("p");e.innerHTML=d,n.parentNode.appendChild(e)}if(401==e&&2==t&&(window.location.href=d),403==e&&2==t){let e=document.createElement("p");e.innerHTML=d,n.parentNode.appendChild(e)}if(200==e&&4==t){var o=i.response;let e=r["content-disposition"].split("filename=")[1];e=e.replace(/\"/g,"").replace(";",""),e=decodeURI(e),s=URL.createObjectURL(o),n.removeEventListener("click",dlmXHRinstance.handleDownloadClick),n.setAttribute("download",""+e),n.setAttribute("href",s),n.click(),a.removeClass().addClass(u+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,n,a,s]),dlmXHRinstance.dlmLogDownload(r,"completed",m),window.URL.revokeObjectURL(s),n.removeAttribute("download"),n.setAttribute("href",l),setTimeout(function(){a.removeClass().addClass(u).find("span.dlm-xhr-progress").remove()},4e3)}},i.addEventListener("progress",function(e){let t=e.loaded/e.total*100;t=t.toFixed(2);var d;a.find("span.dlm-xhr-progress").remove(),d="dlm-download-started download-"+10*Math.ceil(t/10),1/0!=t&&a.append('<span class="dlm-xhr-progress">&nbsp;'+t+"%</span>"),a.removeClass().addClass(u+" "+d),jQuery(document).trigger("dlm_download_progress",[this,n,a,s,e,t])}),i.onerror=function(){n.removeAttribute("download"),n.setAttribute("href",l),a.removeClass().addClass(u+" dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),a.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},i.open("GET",e,!0),i.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),i.send()}dlmLogDownload(e,t,d,r=null,o=null,n="_self"){null!==o?window.location.href=r:(o=window.location.href,t={download_id:e["dlm-download-id"],version_id:e["dlm-version-id"],status:t,cookie:d,currentURL:o,action:"log_dlm_xhr_download",responseHeaders:e,nonce:dlmXHR.nonce},jQuery.post(dlmXHR.ajaxUrl,t,function(e){null!==r&&(null==n&&(n="_self"),window.open(r,n))}))}dlmExternalDownload(e,r,o,n,l){const a=new XMLHttpRequest,t=e["dlm-external-download"];o.attr("target");let s=o.attr("class"),i;s=void 0!==s&&""!==s?s.replace("dlm-download-started","").replace("dlm-download-completed",""):"",o.addClass("dlm-download-started"),r.setAttribute("href","#"),r.removeAttribute("download"),r.setAttribute("disabled","disabled"),jQuery(document).trigger("dlm_download_triggered",[this,r,o,i]),a.responseType="blob",a.onreadystatechange=function(){var{status:e,readyState:t}=a,d=a.getAllResponseHeaders().split("\r\n").reduce((e,t)=>{var[t,d]=t.split(": ");return e[t]=d,e},{});if(403===e)return dlmXHRinstance.dlmLogDownload(d,"failed",!1),a.abort(),void o.append('<span class="dlm-xhr-error">Acces Denied to file.</span>');200==e&&4==t&&(e=a.response,i=URL.createObjectURL(e),r.removeEventListener("click",dlmXHRinstance.handleDownloadClick),r.setAttribute("download",""+n),r.setAttribute("href",i),r.click(),o.removeClass().addClass(s+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,r,o,i]),dlmXHRinstance.dlmLogDownload(d,"completed",!1),window.URL.revokeObjectURL(i),r.removeAttribute("download"),r.setAttribute("href",l),setTimeout(function(){o.removeClass().addClass(s).find("span.dlm-xhr-progress").remove()},1e3))},a.addEventListener("progress",function(e){let t=e.loaded/e.total*100;t=t.toFixed(2);var d;o.find("span.dlm-xhr-progress").remove(),d="dlm-download-started download-"+10*Math.ceil(t/10),1/0!=t&&o.append('<span class="dlm-xhr-progress">&nbsp;'+t+"%</span>"),o.removeClass().addClass(s+" "+d),jQuery(document).trigger("dlm_download_progress",[this,r,o,i,e,t])}),a.onerror=function(){r.removeAttribute("download"),r.setAttribute("href",l),o.removeClass().addClass(s+" .dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),o.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},a.open("GET",t,!0),a.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),a.send()}}
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 4.7.0 - 14.10.2022 =
2
  Fixed: Quick add - recreate Uploader if file upload ended in error ( [#1079](https://github.com/WPChill/download-monitor/issues/1079) )
3
  Changed: Show grouped dates as period instead of a single day on repoprt chart tooltip ( [#1082](https://github.com/WPChill/download-monitor/issues/1082) )
1
+ = 4.7.1 - 18.10.2022 =
2
+ Fixed: Top Downloads widget wrong URL ( [#1087](https://github.com/WPChill/download-monitor/issues/1087) )
3
+ Fixed: Error when getting version download ( [#1090](https://github.com/WPChill/download-monitor/issues/1090) )
4
+ Fixed: Unicode file names downloaded with wrong name ( [#1069](https://github.com/WPChill/download-monitor/issues/1069) )
5
+ Added: Timestamp to download link ( [#1092](https://github.com/WPChill/download-monitor/issues/1092) )
6
+
7
  = 4.7.0 - 14.10.2022 =
8
  Fixed: Quick add - recreate Uploader if file upload ended in error ( [#1079](https://github.com/WPChill/download-monitor/issues/1079) )
9
  Changed: Show grouped dates as period instead of a single day on repoprt chart tooltip ( [#1082](https://github.com/WPChill/download-monitor/issues/1082) )
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.0
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.0' );
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.1
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.1' );
38
  define( 'DLM_UPGRADER_VERSION', '4.6.0' );
39
 
40
  // Define DLM FILE
includes/backwards-compatibility/class-dlm-backwards-compatibility.php CHANGED
@@ -287,7 +287,7 @@ class DLM_Backwards_Compatibility {
287
  if ( ( isset( $this->upgrade_option['using_logs'] ) && '0' === $this->upgrade_option['using_logs'] ) || $count_meta ) {
288
 
289
  if ( 'dlm_download_version' === get_post_type( $id ) ) {
290
- $meta_counts = get_post_meta( get_post_parent( $id )->ID, '_download_count', true );
291
  } else {
292
  $meta_counts = get_post_meta( $id, '_download_count', true );
293
  }
287
  if ( ( isset( $this->upgrade_option['using_logs'] ) && '0' === $this->upgrade_option['using_logs'] ) || $count_meta ) {
288
 
289
  if ( 'dlm_download_version' === get_post_type( $id ) ) {
290
+ $meta_counts = get_post_meta( get_post( $id )->post_parent, '_download_count', true );
291
  } else {
292
  $meta_counts = get_post_meta( $id, '_download_count', true );
293
  }
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.0
6
- Stable tag: 4.7.0
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
@@ -121,6 +121,12 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
121
 
122
  == Changelog ==
123
 
 
 
 
 
 
 
124
  = 4.7.0 - 14.10.2022 =
125
  Fixed: Quick add - recreate Uploader if file upload ended in error ( [#1079](https://github.com/WPChill/download-monitor/issues/1079) )
126
  Changed: Show grouped dates as period instead of a single day on repoprt chart tooltip ( [#1082](https://github.com/WPChill/download-monitor/issues/1082) )
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.0
6
+ Stable tag: 4.7.1
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
121
 
122
  == Changelog ==
123
 
124
+ = 4.7.1 - 18.10.2022 =
125
+ Fixed: Top Downloads widget wrong URL ( [#1087](https://github.com/WPChill/download-monitor/issues/1087) )
126
+ Fixed: Error when getting version download ( [#1090](https://github.com/WPChill/download-monitor/issues/1090) )
127
+ Fixed: Unicode file names downloaded with wrong name ( [#1069](https://github.com/WPChill/download-monitor/issues/1069) )
128
+ Added: Timestamp to download link ( [#1092](https://github.com/WPChill/download-monitor/issues/1092) )
129
+
130
  = 4.7.0 - 14.10.2022 =
131
  Fixed: Quick add - recreate Uploader if file upload ended in error ( [#1079](https://github.com/WPChill/download-monitor/issues/1079) )
132
  Changed: Show grouped dates as period instead of a single day on repoprt chart tooltip ( [#1082](https://github.com/WPChill/download-monitor/issues/1082) )
src/Admin/Dashboard.php CHANGED
@@ -93,7 +93,9 @@ class DLM_Admin_Dashboard {
93
  </div>
94
  <div>
95
  <span class="dlm-reports-top-downloads__overflower" style="width: <?php echo absint( $width ); ?>%;"></span>
96
- <a href="http://localhost/dev/wp-admin/post.php?post=<?php echo absint( $download->get_id() ); ?>&amp;action=edit" title="<?php echo sprintf( esc_html__('Click to edit download: %s', 'download-monitor' ), $download->get_title() ); ?>" target="_blank"><?php echo esc_html( $download->get_title() ); ?></a>
 
 
97
  </div>
98
  <div>
99
  <?php echo esc_html( $download->get_download_count() ); ?>
93
  </div>
94
  <div>
95
  <span class="dlm-reports-top-downloads__overflower" style="width: <?php echo absint( $width ); ?>%;"></span>
96
+ <a href="<?php echo esc_url( admin_url( 'post.php?post=' . absint( $download->get_id() ) . '&amp;action=edit' ) ); ?>"
97
+ title="<?php echo sprintf( esc_html__( 'Click to edit download: %s', 'download-monitor' ), $download->get_title() ); ?>"
98
+ target="_blank"><?php echo esc_html( $download->get_title() ); ?></a>
99
  </div>
100
  <div>
101
  <?php echo esc_html( $download->get_download_count() ); ?>
src/Download/Download.php CHANGED
@@ -398,6 +398,10 @@ class DLM_Download {
398
  $link = add_query_arg( $endpoint, $value, home_url( '', $scheme ) );
399
  }
400
 
 
 
 
 
401
  // only add version argument when current version isn't latest version
402
  if ( null !== $this->get_version() && false === $this->get_version()->is_latest() ) {
403
 
398
  $link = add_query_arg( $endpoint, $value, home_url( '', $scheme ) );
399
  }
400
 
401
+ // Add the timestamp to the Download's link to prevent unwanted behaviour with caching plugins/hosts
402
+ $timestamp = time();
403
+ $link = add_query_arg( 'tmstv', $timestamp, $link );
404
+
405
  // only add version argument when current version isn't latest version
406
  if ( null !== $this->get_version() && false === $this->get_version()->is_latest() ) {
407
 
src/DownloadHandler.php CHANGED
@@ -701,6 +701,12 @@ class DLM_Download_Handler {
701
 
702
  $headers = array();
703
 
 
 
 
 
 
 
704
  $headers['X-Robots-Tag'] = 'noindex, nofollow';
705
  $headers['Content-Type'] = $mime_type;
706
  $headers['Content-Description'] = 'File Transfer';
701
 
702
  $headers = array();
703
 
704
+ if ( $this->check_for_xhr() ) {
705
+ // We use this method to encode the filename for XHR requests so that file names with characters like
706
+ // chinese or persian can be named correctly after the download.
707
+ $file_name = urlencode( $file_name );
708
+ }
709
+
710
  $headers['X-Robots-Tag'] = 'noindex, nofollow';
711
  $headers['Content-Type'] = $mime_type;
712
  $headers['Content-Description'] = 'File Transfer';
src/Version/WordPressVersionRepository.php CHANGED
@@ -85,7 +85,7 @@ class DLM_WordPress_Version_Repository implements DLM_Version_Repository {
85
  public function retrieve_version_download_count( $version_id ) {
86
  global $wpdb;
87
  $version_count = 0;
88
- $download_id = get_post_parent( $version_id )->ID;
89
  // Check to see if the table exists first.
90
  if ( DLM_Utils::table_checker( $wpdb->dlm_downloads ) ) {
91
  // Data in the table are based on Download and it's meta, so we need to get the Download to find the version count.
85
  public function retrieve_version_download_count( $version_id ) {
86
  global $wpdb;
87
  $version_count = 0;
88
+ $download_id = get_post( $version_id )->post_parent;
89
  // Check to see if the table exists first.
90
  if ( DLM_Utils::table_checker( $wpdb->dlm_downloads ) ) {
91
  // Data in the table are based on Download and it's meta, so we need to get the Download to find the version count.