WooCommerce Multilingual – run WooCommerce with WPML - Version 4.3.2.1

Version Description

  • wcmlc argument always being added when switching currency
  • Missing images on the translated product page
Download this release

Release Info

Developer sergey.r
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 4.3.2.1
Comparing to
See all releases

Code changes from version 4.3.2 to 4.3.2.1

changelog/4.3.2.1.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ # Fixes
2
+ * [wcml-2445] wcmlc argument always being added when switching currency
3
+ * [wcml-2441] Missing images on the translated product page
classes/media/class-wcml-product-image-filter-factory.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Product_Image_Filter_Factory implements IWPML_Frontend_Action_Loader, IWPML_Backend_Action_Loader {
4
+
5
+ public function create() {
6
+ global $sitepress;
7
+
8
+ return new WCML_Product_Image_Filter( new WPML_Translation_Element_Factory( $sitepress ) );
9
+ }
10
+
11
+ }
classes/media/class-wcml-product-image-filter.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Product_Image_Filter implements IWPML_Action {
4
+
5
+ /**
6
+ * @var WPML_Translation_Element_Factory
7
+ */
8
+ private $translation_element_factory;
9
+
10
+ public function __construct( WPML_Translation_Element_Factory $translation_element_factory ) {
11
+ $this->translation_element_factory = $translation_element_factory;
12
+ }
13
+
14
+ public function add_hooks() {
15
+ add_filter( 'get_post_metadata', array( $this, 'localize_image_id' ), 11, 3 );
16
+ }
17
+
18
+ public function localize_image_id( $value, $object_id, $meta_key ) {
19
+
20
+ if ( '_thumbnail_id' === $meta_key &&
21
+ in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ) ) &&
22
+ (
23
+ ! defined( 'WPML_Admin_Post_Actions::DISPLAY_FEATURED_IMAGE_AS_TRANSLATED_META_KEY' ) ||
24
+ (
25
+ ! get_post_meta( $object_id, WPML_Admin_Post_Actions::DISPLAY_FEATURED_IMAGE_AS_TRANSLATED_META_KEY, true ) ||
26
+ get_post_meta( $object_id, WPML_Admin_Post_Actions::DISPLAY_FEATURED_IMAGE_AS_TRANSLATED_META_KEY, true ) === '0'
27
+ )
28
+ )
29
+ ) {
30
+
31
+ remove_filter( 'get_post_metadata', array( $this, 'localize_image_id' ), 11, 3 );
32
+
33
+ $meta_value = get_post_meta( $object_id, '_thumbnail_id', true );
34
+ if ( empty( $meta_value ) ) {
35
+ $post_element = $this->translation_element_factory->create( $object_id, 'post' );
36
+ $source_element = $post_element->get_source_element();
37
+ if ( null !== $source_element ) {
38
+ $value = get_post_meta( $source_element->get_id(), '_thumbnail_id', true );
39
+ }
40
+
41
+ }
42
+ add_filter( 'get_post_metadata', array( $this, 'localize_image_id' ), 11, 3 );
43
+
44
+ }
45
+
46
+ return $value;
47
+ }
48
+
49
+ }
inc/currencies/class-wcml-multi-currency-resources.php CHANGED
@@ -44,19 +44,21 @@ class WCML_Multi_Currency_Resources{
44
 
45
  private static function set_cache_compatibility_variables( $script_vars ) {
46
 
 
 
47
  if (
48
  (int) ! empty( self::$multi_currency->W3TC ) ||
49
  ( function_exists( 'wp_cache_is_enabled' ) && wp_cache_is_enabled() )
50
  ) {
51
- $script_vars['w3tc'] = true;
52
- }
53
-
54
- global $sg_cachepress_environment;
55
- if ( $sg_cachepress_environment && $sg_cachepress_environment->cache_is_enabled() ) {
56
- $script_vars['sg_cachepress'] = true;
57
  }
58
 
59
- $script_vars = apply_filters( 'wcml_cache_compatibility_variables', $script_vars );
60
 
61
  return $script_vars;
62
  }
44
 
45
  private static function set_cache_compatibility_variables( $script_vars ) {
46
 
47
+ $script_vars['cache_enabled'] = false;
48
+
49
  if (
50
  (int) ! empty( self::$multi_currency->W3TC ) ||
51
  ( function_exists( 'wp_cache_is_enabled' ) && wp_cache_is_enabled() )
52
  ) {
53
+ $script_vars['cache_enabled'] = true;
54
+ }else{
55
+ global $sg_cachepress_environment;
56
+ if ( $sg_cachepress_environment && $sg_cachepress_environment->cache_is_enabled() ) {
57
+ $script_vars['cache_enabled'] = true;
58
+ }
59
  }
60
 
61
+ $script_vars['cache_enabled'] = apply_filters( 'wcml_is_cache_enabled_for_switching_currency', $script_vars['cache_enabled'] );
62
 
63
  return $script_vars;
64
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.9
7
  Tested up to: 4.9.6
8
- Stable tag: 4.3.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -140,6 +140,10 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
140
 
141
  == Changelog ==
142
 
 
 
 
 
143
  = 4.3.2 =
144
  * Fixed an error when adding a product to cart in specific situations
145
  * Error while adding product to cart wit WC < 3.4.0
5
  License: GPLv2
6
  Requires at least: 3.9
7
  Tested up to: 4.9.6
8
+ Stable tag: 4.3.2.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.3.2.1 =
144
+ * wcmlc argument always being added when switching currency
145
+ * Missing images on the translated product page
146
+
147
  = 4.3.2 =
148
  * Fixed an error when adding a product to cart in specific situations
149
  * Error while adding product to cart wit WC < 3.4.0
res/js/wcml-multi-currency.js CHANGED
@@ -38,7 +38,7 @@ function wcml_load_currency( currency, force_switch ){
38
  }else{
39
 
40
  var target_location = window.location.href;
41
- if( -1 !== target_location.indexOf('#') || !jQuery.isEmptyObject( wcml_mc_settings ) ){
42
 
43
  var url_dehash = target_location.split('#');
44
  var hash = url_dehash.length > 1 ? '#' + url_dehash[1] : '';
38
  }else{
39
 
40
  var target_location = window.location.href;
41
+ if( -1 !== target_location.indexOf('#') || wcml_mc_settings.cache_enabled ){
42
 
43
  var url_dehash = target_location.split('#');
44
  var hash = url_dehash.length > 1 ? '#' + url_dehash[1] : '';
res/js/wcml-multi-currency.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){jQuery(document).on("click",".wcml_currency_switcher a",wcml_switch_currency_handler)});var wcml_switch_currency_handler=function(event){event.preventDefault();if(jQuery(this).is(":disabled")||jQuery(this).parent().hasClass("wcml-cs-active-currency")||jQuery(this).hasClass("wcml-cs-active-currency")){return false}else{jQuery(this).off(event)}wcml_load_currency(jQuery(this).attr("rel"))};function wcml_load_currency(currency,force_switch){var ajax_loader=jQuery('<img class="wcml-spinner" width="16" heigth="16" src="'+wcml_mc_settings.wcml_spinner+'" />');jQuery(".wcml_currency_switcher").append(ajax_loader);if(typeof force_switch==="undefined")force_switch=0;jQuery.ajax({type:"post",url:woocommerce_params.ajax_url,dataType:"json",data:{action:"wcml_switch_currency",currency:currency,force_switch:force_switch},success:function(response){if(typeof response.error!=="undefined"){alert(response.error)}else if(typeof response.prevent_switching!=="undefined"){jQuery("body").append(response.prevent_switching)}else{var target_location=window.location.href;if(-1!==target_location.indexOf("#")||!jQuery.isEmptyObject(wcml_mc_settings)){var url_dehash=target_location.split("#");var hash=url_dehash.length>1?"#"+url_dehash[1]:"";target_location=url_dehash[0].replace(/&wcmlc(\=[^&]*)?(?=&|$)|wcmlc(\=[^&]*)?(&|$)/,"").replace(/\?$/,"");var url_glue=target_location.indexOf("?")!=-1?"&":"?";target_location+=url_glue+"wcmlc="+currency+hash}wcml_reset_cart_fragments();window.location=target_location}}})}
1
+ jQuery(document).ready(function(){jQuery(document).on("click",".wcml_currency_switcher a",wcml_switch_currency_handler)});var wcml_switch_currency_handler=function(event){event.preventDefault();if(jQuery(this).is(":disabled")||jQuery(this).parent().hasClass("wcml-cs-active-currency")||jQuery(this).hasClass("wcml-cs-active-currency")){return false}else{jQuery(this).off(event)}wcml_load_currency(jQuery(this).attr("rel"))};function wcml_load_currency(currency,force_switch){var ajax_loader=jQuery('<img class="wcml-spinner" width="16" heigth="16" src="'+wcml_mc_settings.wcml_spinner+'" />');jQuery(".wcml_currency_switcher").append(ajax_loader);if(typeof force_switch==="undefined")force_switch=0;jQuery.ajax({type:"post",url:woocommerce_params.ajax_url,dataType:"json",data:{action:"wcml_switch_currency",currency:currency,force_switch:force_switch},success:function(response){if(typeof response.error!=="undefined"){alert(response.error)}else if(typeof response.prevent_switching!=="undefined"){jQuery("body").append(response.prevent_switching)}else{var target_location=window.location.href;if(-1!==target_location.indexOf("#")||wcml_mc_settings.cache_enabled){var url_dehash=target_location.split("#");var hash=url_dehash.length>1?"#"+url_dehash[1]:"";target_location=url_dehash[0].replace(/&wcmlc(\=[^&]*)?(?=&|$)|wcmlc(\=[^&]*)?(&|$)/,"").replace(/\?$/,"");var url_glue=target_location.indexOf("?")!=-1?"&":"?";target_location+=url_glue+"wcmlc="+currency+hash}wcml_reset_cart_fragments();window.location=target_location}}})}
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit05f5b43addf06b2d78e3926664637a1a::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8f42e1912b73b45aa1e030d7895bd05b::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit3623574b351c16de2361ae5d445aa7fa::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit1952fc2ab7f7cf82da6f0ced1b320c56::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -388,6 +388,8 @@ return array(
388
  'WCML_Product_Bundles_Legacy' => $baseDir . '/compatibility/class-wcml-product-bundles-legacy.php',
389
  'WCML_Product_Gallery_Filter' => $baseDir . '/classes/media/class-wcml-product-gallery-filter.php',
390
  'WCML_Product_Gallery_Filter_Factory' => $baseDir . '/classes/media/class-wcml-product-gallery-filter-factory.php',
 
 
391
  'WCML_Products' => $baseDir . '/inc/class-wcml-products.php',
392
  'WCML_Products_Screen_Options' => $baseDir . '/inc/class-wcml-products-screen-options.php',
393
  'WCML_Products_UI' => $baseDir . '/inc/template-classes/class-wcml-products-ui.php',
388
  'WCML_Product_Bundles_Legacy' => $baseDir . '/compatibility/class-wcml-product-bundles-legacy.php',
389
  'WCML_Product_Gallery_Filter' => $baseDir . '/classes/media/class-wcml-product-gallery-filter.php',
390
  'WCML_Product_Gallery_Filter_Factory' => $baseDir . '/classes/media/class-wcml-product-gallery-filter-factory.php',
391
+ 'WCML_Product_Image_Filter' => $baseDir . '/classes/media/class-wcml-product-image-filter.php',
392
+ 'WCML_Product_Image_Filter_Factory' => $baseDir . '/classes/media/class-wcml-product-image-filter-factory.php',
393
  'WCML_Products' => $baseDir . '/inc/class-wcml-products.php',
394
  'WCML_Products_Screen_Options' => $baseDir . '/inc/class-wcml-products-screen-options.php',
395
  'WCML_Products_UI' => $baseDir . '/inc/template-classes/class-wcml-products-ui.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit05f5b43addf06b2d78e3926664637a1a
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit05f5b43addf06b2d78e3926664637a1a
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit05f5b43addf06b2d78e3926664637a1a', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit05f5b43addf06b2d78e3926664637a1a', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit05f5b43addf06b2d78e3926664637a1a::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit8f42e1912b73b45aa1e030d7895bd05b
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit8f42e1912b73b45aa1e030d7895bd05b', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit8f42e1912b73b45aa1e030d7895bd05b', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit3623574b351c16de2361ae5d445aa7fa {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit3623574b351c16de2361ae5d445aa7fa {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit3623574b351c16de2361ae5d445aa7fa', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit3623574b351c16de2361ae5d445aa7fa', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit1952fc2ab7f7cf82da6f0ced1b320c56 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit1952fc2ab7f7cf82da6f0ced1b320c56', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit1952fc2ab7f7cf82da6f0ced1b320c56', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit05f5b43addf06b2d78e3926664637a1a
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
@@ -420,6 +420,8 @@ class ComposerStaticInit05f5b43addf06b2d78e3926664637a1a
420
  'WCML_Product_Bundles_Legacy' => __DIR__ . '/../..' . '/compatibility/class-wcml-product-bundles-legacy.php',
421
  'WCML_Product_Gallery_Filter' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-gallery-filter.php',
422
  'WCML_Product_Gallery_Filter_Factory' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-gallery-filter-factory.php',
 
 
423
  'WCML_Products' => __DIR__ . '/../..' . '/inc/class-wcml-products.php',
424
  'WCML_Products_Screen_Options' => __DIR__ . '/../..' . '/inc/class-wcml-products-screen-options.php',
425
  'WCML_Products_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-products-ui.php',
@@ -513,10 +515,10 @@ class ComposerStaticInit05f5b43addf06b2d78e3926664637a1a
513
  public static function getInitializer(ClassLoader $loader)
514
  {
515
  return \Closure::bind(function () use ($loader) {
516
- $loader->prefixLengthsPsr4 = ComposerStaticInit05f5b43addf06b2d78e3926664637a1a::$prefixLengthsPsr4;
517
- $loader->prefixDirsPsr4 = ComposerStaticInit05f5b43addf06b2d78e3926664637a1a::$prefixDirsPsr4;
518
- $loader->prefixesPsr0 = ComposerStaticInit05f5b43addf06b2d78e3926664637a1a::$prefixesPsr0;
519
- $loader->classMap = ComposerStaticInit05f5b43addf06b2d78e3926664637a1a::$classMap;
520
 
521
  }, null, ClassLoader::class);
522
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
420
  'WCML_Product_Bundles_Legacy' => __DIR__ . '/../..' . '/compatibility/class-wcml-product-bundles-legacy.php',
421
  'WCML_Product_Gallery_Filter' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-gallery-filter.php',
422
  'WCML_Product_Gallery_Filter_Factory' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-gallery-filter-factory.php',
423
+ 'WCML_Product_Image_Filter' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-image-filter.php',
424
+ 'WCML_Product_Image_Filter_Factory' => __DIR__ . '/../..' . '/classes/media/class-wcml-product-image-filter-factory.php',
425
  'WCML_Products' => __DIR__ . '/../..' . '/inc/class-wcml-products.php',
426
  'WCML_Products_Screen_Options' => __DIR__ . '/../..' . '/inc/class-wcml-products-screen-options.php',
427
  'WCML_Products_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-products-ui.php',
515
  public static function getInitializer(ClassLoader $loader)
516
  {
517
  return \Closure::bind(function () use ($loader) {
518
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b::$prefixLengthsPsr4;
519
+ $loader->prefixDirsPsr4 = ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b::$prefixDirsPsr4;
520
+ $loader->prefixesPsr0 = ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b::$prefixesPsr0;
521
+ $loader->classMap = ComposerStaticInit8f42e1912b73b45aa1e030d7895bd05b::$classMap;
522
 
523
  }, null, ClassLoader::class);
524
  }
wpml-woocommerce.php CHANGED
@@ -8,7 +8,7 @@
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 3.9
10
  Tested up to: 4.9.6
11
- Version: 4.3.2
12
  WC requires at least: 2.1.0
13
  WC tested up to: 3.4.2
14
  */
@@ -17,7 +17,7 @@ if ( defined( 'WCML_VERSION' ) ) {
17
  return;
18
  }
19
 
20
- define( 'WCML_VERSION', '4.3.2' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
@@ -61,6 +61,7 @@ function wcml_loader(){
61
  $xdomain_data->add_hooks();
62
 
63
  $loaders = array(
 
64
  'WCML_Product_Gallery_Filter_Factory',
65
  'WCML_Update_Product_Gallery_Translation_Factory',
66
  'WCML_Append_Gallery_To_Post_Media_Ids_Factory',
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 3.9
10
  Tested up to: 4.9.6
11
+ Version: 4.3.2.1
12
  WC requires at least: 2.1.0
13
  WC tested up to: 3.4.2
14
  */
17
  return;
18
  }
19
 
20
+ define( 'WCML_VERSION', '4.3.2.1' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
61
  $xdomain_data->add_hooks();
62
 
63
  $loaders = array(
64
+ 'WCML_Product_Image_Filter_Factory',
65
  'WCML_Product_Gallery_Filter_Factory',
66
  'WCML_Update_Product_Gallery_Translation_Factory',
67
  'WCML_Append_Gallery_To_Post_Media_Ids_Factory',