Download Monitor - Version 4.7.54

Version Description

  • 30.11.2022 = Fix: Incompatibility with WPML for translated downloads ( #1144 )
Download this release

Release Info

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

Code changes from version 4.7.53 to 4.7.54

changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 4.7.53 - 25.11.2022 =
2
  Fix: Readlink error ( [#1142](https://github.com/WPChill/download-monitor/issues/1142) )
3
 
1
+ = 4.7.54 - 30.11.2022 =
2
+ Fix: Incompatibility with WPML for translated downloads ( [#1144](https://github.com/WPChill/download-monitor/issues/1144) )
3
+
4
  = 4.7.53 - 25.11.2022 =
5
  Fix: Readlink error ( [#1142](https://github.com/WPChill/download-monitor/issues/1142) )
6
 
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.53
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.53' );
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.54
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.54' );
38
  define( 'DLM_UPGRADER_VERSION', '4.6.0' );
39
 
40
  // Define DLM FILE
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.53
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
@@ -121,6 +121,9 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
121
 
122
  == Changelog ==
123
 
 
 
 
124
  = 4.7.53 - 25.11.2022 =
125
  Fix: Readlink error ( [#1142](https://github.com/WPChill/download-monitor/issues/1142) )
126
 
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.54
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
121
 
122
  == Changelog ==
123
 
124
+ = 4.7.54 - 30.11.2022 =
125
+ Fix: Incompatibility with WPML for translated downloads ( [#1144](https://github.com/WPChill/download-monitor/issues/1144) )
126
+
127
  = 4.7.53 - 25.11.2022 =
128
  Fix: Readlink error ( [#1142](https://github.com/WPChill/download-monitor/issues/1142) )
129
 
src/Download/Download.php CHANGED
@@ -417,7 +417,16 @@ class DLM_Download {
417
  }
418
  // If WPML is active we should return the original home_url to avoid 404 pages.
419
  //@todo: If Downloads will be made translatable in the future then this should be removed.
420
- add_filter( 'wpml_get_home_url', array( $this, 'wpml_download_link' ), 15, 2 );
 
 
 
 
 
 
 
 
 
421
 
422
  if ( get_option( 'permalink_structure' ) ) {
423
  // Fix for translation plugins that modify the home_url
@@ -429,7 +438,9 @@ class DLM_Download {
429
 
430
  // Now we can remove the filter as the link is generated.
431
  //@todo: If Downloads will be made translatable in the future then this should be removed.
432
- remove_filter( 'wpml_get_home_url', array( $this, 'wpml_download_link' ), 15, 2 );
 
 
433
 
434
  // Add the timestamp to the Download's link to prevent unwanted behaviour with caching plugins/hosts
435
  $timestamp = time();
417
  }
418
  // If WPML is active we should return the original home_url to avoid 404 pages.
419
  //@todo: If Downloads will be made translatable in the future then this should be removed.
420
+ // First we need to make sure they are not translated.
421
+ $wpml_options = get_option( 'icl_sitepress_settings', false );
422
+ $is_dlm_translated = false;
423
+ if ( $wpml_options && isset( $wpml_options['custom_posts_sync_option'] ) && in_array( 'dlm_download', $wpml_options['custom_posts_sync_option'] ) ) {
424
+ $is_dlm_translated = true;
425
+ }
426
+
427
+ if ( $is_dlm_translated ) {
428
+ add_filter( 'wpml_get_home_url', array( $this, 'wpml_download_link' ), 15, 2 );
429
+ }
430
 
431
  if ( get_option( 'permalink_structure' ) ) {
432
  // Fix for translation plugins that modify the home_url
438
 
439
  // Now we can remove the filter as the link is generated.
440
  //@todo: If Downloads will be made translatable in the future then this should be removed.
441
+ if ( $is_dlm_translated ) {
442
+ remove_filter( 'wpml_get_home_url', array( $this, 'wpml_download_link' ), 15, 2 );
443
+ }
444
 
445
  // Add the timestamp to the Download's link to prevent unwanted behaviour with caching plugins/hosts
446
  $timestamp = time();