Version Description
- Fix php warning in WCML custom prices module.
- Fixed unable to add variation to cart for products with more than 30 variations.
- Remove legacy code for downloading the language pack.
- Fixed string translation while adding "sold individual" product more than ones from second language.
- Fixed notices thrown with php 7.4 with multi-currency.
- Fixed notices thrown with php 7.4 when using multi-currency.
- Fixed notices thrown with php 7.4 when using WCML with WC Variation Swatches and Photos.
- Fixed deprecation notices (
Function get_magic_quotes_gpc() is deprecated
) when running PHP 7.4. - Fixed a few fatal errors thrown when running PHP 7.4 (e.g.
Fatal error: Uncaught Error: Call to a member function get_setting() on null
) and caused by legacy code passing objects by reference. - Fixed language for "Low Stock" and "No Stock" admin emails.
- Fixed not converted pre-selected price widget prices when switching currency.
Download this release
Release Info
Developer | sergey.r |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 4.7.6 |
Comparing to | |
See all releases |
Code changes from version 4.7.5 to 4.7.6
- changelog/4.7.5.md +0 -34
- changelog/4.7.6.md +16 -0
- compatibility/class-wcml-accommodation-bookings.php +16 -10
- compatibility/class-wcml-product-bundles.php +1 -1
- compatibility/class-wcml-the-events-calendar.php +11 -4
- inc/class-wcml-attributes.php +6 -1
- inc/class-wcml-cart.php +11 -26
- inc/class-wcml-dependencies.php +2 -1
- inc/class-wcml-emails.php +56 -8
- inc/class-wcml-install.php +10 -2
- inc/class-wcml-languages-upgrader.php +0 -40
- inc/class-wcml-locale.php +16 -11
- inc/class-wcml-resources.php +7 -3
- inc/class-wcml-troubleshooting.php +15 -9
- inc/class-wcml-wc-shipping.php +12 -9
- inc/class-wcml-wc-strings.php +1 -1
- inc/class-wcml-widgets.php +11 -5
- inc/currencies/class-wcml-custom-prices.php +28 -16
- inc/currencies/class-wcml-multi-currency-configuration.php +3 -3
- inc/currencies/class-wcml-multi-currency-prices.php +22 -0
- inc/currencies/class-wcml-multi-currency.php +7 -19
- inc/currencies/class-wcml-price-filter.php +6 -1
- inc/currencies/currency-switcher/class-wcml-currency-switcher-ajax.php +11 -8
- inc/currencies/currency-switcher/class-wcml-currency-switcher.php +3 -3
- inc/missing-php-functions.php +0 -35
- inc/template-classes/class-wcml-attribute-translation-ui.php +10 -2
- inc/template-classes/class-wcml-custom-files-ui.php +8 -7
- inc/template-classes/class-wcml-custom-taxonomy-translation-ui.php +9 -1
- inc/template-classes/class-wcml-menus-wrap.php +10 -3
- inc/template-classes/class-wcml-not-translatable-attributes.php +10 -2
- inc/template-classes/class-wcml-products-ui.php +8 -2
- inc/template-classes/class-wcml-removed-cart-items-ui.php +12 -3
- inc/template-classes/class-wcml-sync-taxonomy.php +15 -6
- inc/template-classes/class-wcml-troubleshooting-ui.php +8 -1
- inc/template-classes/currency-switcher/class-wcml-currency-switcher-options-dialog.php +15 -7
- inc/template-classes/currency-switcher/class-wcml-currency-switcher-template.php +21 -18
- inc/template-classes/multi-currency/class-wcml-custom-currency-options.php +21 -14
- inc/template-classes/multi-currency/class-wcml-custom-prices-ui.php +9 -1
- inc/template-classes/multi-currency/class-wcml-exchange-rates-ui.php +26 -19
- inc/template-classes/multi-currency/class-wcml-multi-currency-ui.php +20 -6
- inc/template-classes/setup/class-wcml-setup-attributes-ui.php +14 -7
- inc/template-classes/setup/class-wcml-setup-multi-currency-ui.php +14 -7
- inc/template-classes/setup/class-wcml-setup-ready-ui.php +12 -6
- inc/template-classes/setup/class-wcml-setup-store-pages-ui.php +16 -8
- inc/template-classes/setup/class-wcml-setup-translation-options-ui.php +3 -1
- inc/template-classes/status/class-wcml-status-config-warnings-ui.php +16 -8
- inc/template-classes/status/class-wcml-status-multi-currencies-ui.php +12 -5
- inc/template-classes/status/class-wcml-status-products-ui.php +12 -6
- inc/template-classes/status/class-wcml-status-status-ui.php +12 -5
- inc/template-classes/status/class-wcml-status-store-pages-ui.php +12 -5
- inc/template-classes/status/class-wcml-status-ui.php +10 -4
- inc/template-classes/store-urls/class-wcml-store-urls-edit-base-ui.php +14 -5
- inc/template-classes/store-urls/class-wcml-store-urls-translation-statuses-ui.php +15 -5
- inc/template-classes/store-urls/class-wcml-store-urls-ui.php +8 -2
- inc/translation-editor/class-wcml-editor-ui-product-job.php +26 -14
- inc/translation-editor/class-wcml-page-builders.php +6 -2
- inc/translation-editor/class-wcml-wc-admin-duplicate-product.php +14 -8
- readme.txt +13 -25
- res/js/wcml-multi-currency.js +19 -3
- res/js/wcml-multi-currency.min.js +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
- vendor/otgs/installer/includes/class-otgs-installer-plugin-finder.php +1 -0
- vendor/otgs/installer/includes/class-otgs-installer-plugin.php +8 -0
- vendor/otgs/installer/includes/upgrade/class-otgs-installer-upgrade-response.php +1 -11
- vendor/otgs/installer/loader.php +1 -1
- wpml-woocommerce.php +2 -2
changelog/4.7.5.md
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
# Features
|
2 |
-
* [wcml-2988] Skip Currency Switcher caching for NginxCache.
|
3 |
-
* [wcml-2985] Improve performance on plugin page.
|
4 |
-
|
5 |
-
# Fixes
|
6 |
-
* [wcml-3020] Fixed missing products on shop page in second language for some themes when slug is identical to default language.
|
7 |
-
* [wcml-3013] Fixed wrong strings localization on some WooCommerce ajax actions.
|
8 |
-
* [wcml-3005] Fixed Cash on delivery "Payment method instructions" not translated in the customer order emails.
|
9 |
-
* [wcml-2939] Fixed RTL styling on WCML Status Tab.
|
10 |
-
|
11 |
-
# Compatibility
|
12 |
-
* [wcml-3027] Fixed notice for Product-Addon and specific field settings.
|
13 |
-
* [wcml-2990] Composite products fixed a wrong displayed discounted price.
|
14 |
-
* [wcml-2913] Fixed not pre-selected custom attributes for variable Bundle product.
|
15 |
-
* [wcml-2888] Fixed missed images for product translation created via REST API.
|
16 |
-
* [wcml-2873] Added new setting option for synchronizing not translated media on translated product front page.
|
17 |
-
* [wcml-2857] Fixed not duplicated variation description while duplicating variable product to another language.
|
18 |
-
* [wcml-2850] Fixed not matched variation on translated variable product page when "Translatable - use translation if available or fallback to default language" mode enabled for products and global attribute terms are translated.
|
19 |
-
* [wcml-2824] Fixed overlapping columns on WooCommerce Order Statuses table.
|
20 |
-
* [wcml-2799] WooCommerce Bookings compatibility - fixed availability count duplication while updating original product and bookings were made in the second language.
|
21 |
-
* [wcml-2691] wcml_client_currency hook not applied in some cases
|
22 |
-
* [wcml-2645] Fixed variation product title modifying after switching language on cart page in specific situations.
|
23 |
-
* [wcml-2553] Fixed mixed strings language on variable product admin edit page in not admin language.
|
24 |
-
|
25 |
-
# Performances
|
26 |
-
* [wcml-2992] Fixed performance when a large number of shipping methods are defined.
|
27 |
-
* [wcml-2957] Long query to get currencies removed from WCML to optimise performance.
|
28 |
-
|
29 |
-
# Usability
|
30 |
-
* [wcml-2984] Fixed cart total shipping converted twice when enabled custom settings for gateways and use not default currency as a currency for gateway.
|
31 |
-
* [wcml-2983] Fixed converted product price when using custom gateway settings for second currency.
|
32 |
-
|
33 |
-
# API
|
34 |
-
* [wcml-3003] Fixed notice while importing xliff translations with custom attributes in some specific cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changelog/4.7.6.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Fixes
|
2 |
+
* [wcml-3060] Fix php warning in WCML custom prices module.
|
3 |
+
* [wcml-3057] Fixed unable to add variation to cart for products with more than 30 variations.
|
4 |
+
* [wcml-3040] Remove legacy code for downloading the language pack.
|
5 |
+
* [wcml-3023] Fixed string translation while adding "sold individual" product more than ones from second language.
|
6 |
+
|
7 |
+
# Compatibility
|
8 |
+
* [wcml-3055] Fixed notices thrown with php 7.4 with multi-currency.
|
9 |
+
* [wcml-3054] Fixed notices thrown with php 7.4 when using multi-currency.
|
10 |
+
* [wcml-3053] Fixed notices thrown with php 7.4 when using WCML with WC Variation Swatches and Photos.
|
11 |
+
* [wcml-3039] Fixed deprecation notices (`Function get_magic_quotes_gpc() is deprecated`) when running PHP 7.4.
|
12 |
+
* [wcml-3037] Fixed a few fatal errors thrown when running PHP 7.4 (e.g. `Fatal error: Uncaught Error: Call to a member function get_setting() on null`) and caused by legacy code passing objects by reference.
|
13 |
+
* [wcml-2544] Fixed language for "Low Stock" and "No Stock" admin emails.
|
14 |
+
|
15 |
+
# Usability
|
16 |
+
* [wcml-3017] Fixed not converted pre-selected price widget prices when switching currency.
|
compatibility/class-wcml-accommodation-bookings.php
CHANGED
@@ -7,21 +7,27 @@ class WCML_Accommodation_Bookings{
|
|
7 |
*/
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
|
26 |
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
27 |
|
7 |
*/
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
+
/**
|
11 |
+
* WCML_Accommodation_Bookings constructor.
|
12 |
+
*
|
13 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
14 |
+
*/
|
15 |
+
public function __construct( $woocommerce_wpml ) {
|
16 |
+
// @todo Cover by tests, required for wcml-3037.
|
17 |
|
18 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
19 |
|
20 |
+
add_action( 'woocommerce_accommodation_bookings_after_booking_base_cost', [ $this, 'wcml_price_field_after_booking_base_cost', ] );
|
21 |
+
add_action( 'woocommerce_accommodation_bookings_after_booking_pricing_override_block_cost', [ $this, 'wcml_price_field_after_booking_pricing_override_block_cost', ], 10, 2 );
|
22 |
+
add_action( 'woocommerce_accommodation_bookings_after_bookings_pricing', [ $this, 'after_bookings_pricing' ] );
|
23 |
|
24 |
+
add_action( 'save_post', [ $this, 'save_custom_costs' ], 110, 2 );
|
25 |
+
add_filter( 'get_post_metadata', [ $this, 'product_price_filter' ], 9, 4 );
|
26 |
|
27 |
+
add_action( 'init', [ $this, 'load_assets' ], 100 );
|
28 |
+
}
|
29 |
|
30 |
+
function wcml_price_field_after_booking_base_cost( $post_id ){
|
31 |
|
32 |
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
33 |
|
compatibility/class-wcml-product-bundles.php
CHANGED
@@ -665,7 +665,7 @@ class WCML_Product_Bundles {
|
|
665 |
|
666 |
$translated_bundle_data = $this->get_product_bundle_data( $translated_bundle_id );
|
667 |
|
668 |
-
$bundle_id
|
669 |
|
670 |
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
671 |
|
665 |
|
666 |
$translated_bundle_data = $this->get_product_bundle_data( $translated_bundle_id );
|
667 |
|
668 |
+
$bundle_id = $job->original_doc_id;
|
669 |
|
670 |
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
671 |
|
compatibility/class-wcml-the-events-calendar.php
CHANGED
@@ -10,10 +10,17 @@ class WCML_The_Events_Calendar{
|
|
10 |
/** @var WPML_Element_Translation_Package */
|
11 |
private $tp;
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
if( isset( $_POST['action'] ) && strpos( $_POST['action'], 'tribe-ticket-add-') === 0 ){
|
19 |
add_action( 'tribe_tickets_ticket_add', array( $this, 'unset_post_post_id' ) );
|
10 |
/** @var WPML_Element_Translation_Package */
|
11 |
private $tp;
|
12 |
|
13 |
+
/**
|
14 |
+
* WCML_The_Events_Calendar constructor.
|
15 |
+
*
|
16 |
+
* @param SitePress $sitepress
|
17 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
18 |
+
*/
|
19 |
+
public function __construct( $sitepress, $woocommerce_wpml ) {
|
20 |
+
// @todo Cover by tests, required for wcml-3037.
|
21 |
+
|
22 |
+
$this->sitepress = $sitepress;
|
23 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
|
25 |
if( isset( $_POST['action'] ) && strpos( $_POST['action'], 'tribe-ticket-add-') === 0 ){
|
26 |
add_action( 'tribe_tickets_ticket_add', array( $this, 'unset_post_post_id' ) );
|
inc/class-wcml-attributes.php
CHANGED
@@ -764,7 +764,12 @@ class WCML_Attributes{
|
|
764 |
}
|
765 |
|
766 |
public function maybe_filter_get_variation() {
|
767 |
-
|
|
|
|
|
|
|
|
|
|
|
768 |
foreach ( wp_unslash( $_POST ) as $key => $value ) {
|
769 |
if ( substr( $key, 0, 13 ) == 'attribute_pa_' ) {
|
770 |
$taxonomy = substr( $key, 10 );
|
764 |
}
|
765 |
|
766 |
public function maybe_filter_get_variation() {
|
767 |
+
|
768 |
+
if (
|
769 |
+
isset( $_POST['product_id'] ) &&
|
770 |
+
$this->woocommerce_wpml->products->is_product_display_as_translated_post_type() &&
|
771 |
+
is_null( $this->post_translations->element_id_in( $_POST['product_id'], $this->sitepress->get_current_language() ) )
|
772 |
+
) {
|
773 |
foreach ( wp_unslash( $_POST ) as $key => $value ) {
|
774 |
if ( substr( $key, 0, 13 ) == 'attribute_pa_' ) {
|
775 |
$taxonomy = substr( $key, 10 );
|
inc/class-wcml-cart.php
CHANGED
@@ -60,10 +60,10 @@ class WCML_Cart {
|
|
60 |
|
61 |
add_filter( 'woocommerce_cart_item_permalink', array( $this, 'cart_item_permalink' ), 10, 2 );
|
62 |
add_filter( 'woocommerce_paypal_args', array( $this, 'filter_paypal_args' ) );
|
63 |
-
add_filter( '
|
64 |
$this,
|
65 |
'add_to_cart_sold_individually_exception'
|
66 |
-
), 10,
|
67 |
|
68 |
$this->localize_flat_rates_shipping_classes();
|
69 |
}
|
@@ -184,7 +184,7 @@ class WCML_Cart {
|
|
184 |
if ( $return ) {
|
185 |
return array( 'prevent_switching' => $html );
|
186 |
} else {
|
187 |
-
|
188 |
}
|
189 |
|
190 |
return true;
|
@@ -585,37 +585,34 @@ class WCML_Cart {
|
|
585 |
return $args;
|
586 |
}
|
587 |
|
588 |
-
public function add_to_cart_sold_individually_exception( $
|
589 |
|
590 |
$post_id = $product_id;
|
591 |
if ( $variation_id ) {
|
592 |
$post_id = $variation_id;
|
593 |
}
|
594 |
|
595 |
-
//check if product already added to cart in another language
|
596 |
foreach ( WC()->cart->cart_contents as $cart_item ) {
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
$this->sold_individually_exception( $post_id );
|
601 |
-
|
602 |
}
|
603 |
}
|
604 |
|
605 |
-
return $
|
606 |
}
|
607 |
|
608 |
-
public function sold_individually_product( $cart_item, $cart_item_data, $post_id
|
609 |
|
610 |
$current_product_trid = $this->sitepress->get_element_trid( $post_id, 'post_' . get_post_type( $post_id ) );
|
611 |
|
612 |
-
if ( $cart_item['variation_id'] ) {
|
613 |
$cart_element_trid = $this->sitepress->get_element_trid( $cart_item['variation_id'], 'post_product_variation' );
|
614 |
} else {
|
615 |
$cart_element_trid = $this->sitepress->get_element_trid( $cart_item['product_id'], 'post_product' );
|
616 |
}
|
617 |
|
618 |
-
if ( apply_filters( 'wcml_add_to_cart_sold_individually', true, $cart_item_data, $post_id, $quantity ) &&
|
619 |
$current_product_trid == $cart_element_trid &&
|
620 |
$cart_item['quantity'] > 0
|
621 |
) {
|
@@ -625,18 +622,6 @@ class WCML_Cart {
|
|
625 |
}
|
626 |
}
|
627 |
|
628 |
-
public function sold_individually_exception( $post_id ) {
|
629 |
-
|
630 |
-
$wc_cart_url = esc_url( wc_get_cart_url() );
|
631 |
-
$message_title = sprintf( esc_html__( 'You cannot add another "%s" to your cart.', 'woocommerce' ), get_the_title( $post_id ) );
|
632 |
-
|
633 |
-
$message = '<a href="' . $wc_cart_url . '" class="button wc-forward">' . esc_html__( 'View Cart', 'woocommerce' ) . '</a>';
|
634 |
-
$message .= ' ' . $message_title;
|
635 |
-
|
636 |
-
throw new Exception( $message );
|
637 |
-
|
638 |
-
}
|
639 |
-
|
640 |
/**
|
641 |
* @param string $permalink
|
642 |
* @param array $cart_item
|
60 |
|
61 |
add_filter( 'woocommerce_cart_item_permalink', array( $this, 'cart_item_permalink' ), 10, 2 );
|
62 |
add_filter( 'woocommerce_paypal_args', array( $this, 'filter_paypal_args' ) );
|
63 |
+
add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', array(
|
64 |
$this,
|
65 |
'add_to_cart_sold_individually_exception'
|
66 |
+
), 10, 4 );
|
67 |
|
68 |
$this->localize_flat_rates_shipping_classes();
|
69 |
}
|
184 |
if ( $return ) {
|
185 |
return array( 'prevent_switching' => $html );
|
186 |
} else {
|
187 |
+
wp_send_json_success( [ 'prevent_switching' => $html ] );
|
188 |
}
|
189 |
|
190 |
return true;
|
585 |
return $args;
|
586 |
}
|
587 |
|
588 |
+
public function add_to_cart_sold_individually_exception( $found_in_cart, $product_id, $variation_id, $cart_item_data ) {
|
589 |
|
590 |
$post_id = $product_id;
|
591 |
if ( $variation_id ) {
|
592 |
$post_id = $variation_id;
|
593 |
}
|
594 |
|
|
|
595 |
foreach ( WC()->cart->cart_contents as $cart_item ) {
|
596 |
+
if ( $this->sold_individually_product( $cart_item, $cart_item_data, $post_id ) ) {
|
597 |
+
$found_in_cart = true;
|
598 |
+
break;
|
|
|
|
|
599 |
}
|
600 |
}
|
601 |
|
602 |
+
return $found_in_cart;
|
603 |
}
|
604 |
|
605 |
+
public function sold_individually_product( $cart_item, $cart_item_data, $post_id ) {
|
606 |
|
607 |
$current_product_trid = $this->sitepress->get_element_trid( $post_id, 'post_' . get_post_type( $post_id ) );
|
608 |
|
609 |
+
if ( !empty( $cart_item['variation_id'] ) ) {
|
610 |
$cart_element_trid = $this->sitepress->get_element_trid( $cart_item['variation_id'], 'post_product_variation' );
|
611 |
} else {
|
612 |
$cart_element_trid = $this->sitepress->get_element_trid( $cart_item['product_id'], 'post_product' );
|
613 |
}
|
614 |
|
615 |
+
if ( apply_filters( 'wcml_add_to_cart_sold_individually', true, $cart_item_data, $post_id, $cart_item['quantity'] ) &&
|
616 |
$current_product_trid == $cart_element_trid &&
|
617 |
$cart_item['quantity'] > 0
|
618 |
) {
|
622 |
}
|
623 |
}
|
624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
/**
|
626 |
* @param string $permalink
|
627 |
* @param array $cart_item
|
inc/class-wcml-dependencies.php
CHANGED
@@ -78,7 +78,8 @@ class WCML_Dependencies {
|
|
78 |
}
|
79 |
|
80 |
if ( isset( $sitepress ) ) {
|
81 |
-
|
|
|
82 |
}
|
83 |
|
84 |
return $this->allok;
|
78 |
}
|
79 |
|
80 |
if ( isset( $sitepress ) ) {
|
81 |
+
// @todo Cover by tests, required for wcml-3037.
|
82 |
+
$this->allok = $this->allok && $sitepress->setup();
|
83 |
}
|
84 |
|
85 |
return $this->allok;
|
inc/class-wcml-emails.php
CHANGED
@@ -119,6 +119,9 @@ class WCML_Emails {
|
|
119 |
$this,
|
120 |
'customer_processing_order_subject'
|
121 |
) );
|
|
|
|
|
|
|
122 |
}
|
123 |
|
124 |
function email_refresh_in_ajax() {
|
@@ -306,13 +309,6 @@ class WCML_Emails {
|
|
306 |
if ( $email ) {
|
307 |
$recipients = explode( ',', $email->get_recipient() );
|
308 |
foreach ( $recipients as $recipient ) {
|
309 |
-
$user = get_user_by( 'email', $recipient );
|
310 |
-
if ( $user ) {
|
311 |
-
$admin_language = $this->sitepress->get_user_admin_language( $user->ID, true );
|
312 |
-
} else {
|
313 |
-
$admin_language = $this->sitepress->get_default_language();
|
314 |
-
}
|
315 |
-
|
316 |
/**
|
317 |
* Filter new order admin email language for recipient
|
318 |
*
|
@@ -322,7 +318,7 @@ class WCML_Emails {
|
|
322 |
* @param string $recipient Admin email
|
323 |
* @param int $order_id Order ID
|
324 |
*/
|
325 |
-
$admin_language = apply_filters( 'wcml_new_order_admin_email_language', $
|
326 |
|
327 |
$this->change_email_language( $admin_language );
|
328 |
|
@@ -344,6 +340,20 @@ class WCML_Emails {
|
|
344 |
}
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
public function new_order_email_heading( $heading ) {
|
348 |
return $this->get_translated_order_strings( 'heading', $heading, 'WC_Email_New_Order' );
|
349 |
}
|
@@ -508,4 +518,42 @@ class WCML_Emails {
|
|
508 |
return $this->wcml_get_translated_email_string( $domain, $namePrefix . $field, $orderId, $languageCode );
|
509 |
};
|
510 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
}
|
119 |
$this,
|
120 |
'customer_processing_order_subject'
|
121 |
) );
|
122 |
+
|
123 |
+
add_action( 'woocommerce_low_stock_notification', array( $this, 'low_stock_admin_notification' ), 9 );
|
124 |
+
add_action( 'woocommerce_no_stock_notification', array( $this, 'no_stock_admin_notification' ), 9 );
|
125 |
}
|
126 |
|
127 |
function email_refresh_in_ajax() {
|
309 |
if ( $email ) {
|
310 |
$recipients = explode( ',', $email->get_recipient() );
|
311 |
foreach ( $recipients as $recipient ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
/**
|
313 |
* Filter new order admin email language for recipient
|
314 |
*
|
318 |
* @param string $recipient Admin email
|
319 |
* @param int $order_id Order ID
|
320 |
*/
|
321 |
+
$admin_language = apply_filters( 'wcml_new_order_admin_email_language', $this->get_admin_language_by_email( $recipient ), $recipient, $order_id );
|
322 |
|
323 |
$this->change_email_language( $admin_language );
|
324 |
|
340 |
}
|
341 |
}
|
342 |
|
343 |
+
/**
|
344 |
+
* @param string $recipient
|
345 |
+
*
|
346 |
+
* @return string
|
347 |
+
*/
|
348 |
+
private function get_admin_language_by_email( $recipient ){
|
349 |
+
$user = get_user_by( 'email', $recipient );
|
350 |
+
if ( $user ) {
|
351 |
+
return $this->sitepress->get_user_admin_language( $user->ID, true );
|
352 |
+
} else {
|
353 |
+
return $this->sitepress->get_default_language();
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
public function new_order_email_heading( $heading ) {
|
358 |
return $this->get_translated_order_strings( 'heading', $heading, 'WC_Email_New_Order' );
|
359 |
}
|
518 |
return $this->wcml_get_translated_email_string( $domain, $namePrefix . $field, $orderId, $languageCode );
|
519 |
};
|
520 |
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* @param WC_Product $product
|
524 |
+
*/
|
525 |
+
public function low_stock_admin_notification( $product ) {
|
526 |
+
$this->admin_notification( $product, 'woocommerce_low_stock_notification', 'low_stock' );
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* @param WC_Product $product
|
531 |
+
*/
|
532 |
+
public function no_stock_admin_notification( $product ) {
|
533 |
+
$this->admin_notification( $product, 'woocommerce_no_stock_notification', 'no_stock' );
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* @param WC_Product $product
|
538 |
+
* @param string $action
|
539 |
+
* @param string $method
|
540 |
+
*/
|
541 |
+
private function admin_notification( $product, $action, $method ) {
|
542 |
+
|
543 |
+
$is_action_removed = remove_action( $action, [ $this->wcEmails, $method ] );
|
544 |
+
|
545 |
+
if ( $is_action_removed ) {
|
546 |
+
$admin_language = $this->get_admin_language_by_email( get_option( 'woocommerce_stock_email_recipient' ) );
|
547 |
+
$product_id_in_admin_language = wpml_object_id_filter(
|
548 |
+
$product->get_id(),
|
549 |
+
'product',
|
550 |
+
true,
|
551 |
+
$admin_language
|
552 |
+
);
|
553 |
+
|
554 |
+
$this->sitepress->switch_lang( $admin_language );
|
555 |
+
$this->wcEmails->$method( wc_get_product( $product_id_in_admin_language ) );
|
556 |
+
$this->sitepress->switch_lang();
|
557 |
+
}
|
558 |
+
}
|
559 |
}
|
inc/class-wcml-install.php
CHANGED
@@ -2,7 +2,12 @@
|
|
2 |
|
3 |
class WCML_Install{
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
if( is_admin() ) {
|
8 |
|
@@ -100,7 +105,10 @@ class WCML_Install{
|
|
100 |
|
101 |
}
|
102 |
|
103 |
-
|
|
|
|
|
|
|
104 |
global $wpdb;
|
105 |
|
106 |
$def_lang = $sitepress->get_default_language();
|
2 |
|
3 |
class WCML_Install{
|
4 |
|
5 |
+
/**
|
6 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
7 |
+
* @param SitePress $sitepress
|
8 |
+
*/
|
9 |
+
public static function initialize( $woocommerce_wpml, $sitepress ) {
|
10 |
+
// @todo Cover by tests, required for wcml-3037.
|
11 |
|
12 |
if( is_admin() ) {
|
13 |
|
105 |
|
106 |
}
|
107 |
|
108 |
+
/**
|
109 |
+
* @param SitePress $sitepress
|
110 |
+
*/
|
111 |
+
private static function set_language_information( $sitepress ) {
|
112 |
global $wpdb;
|
113 |
|
114 |
$def_lang = $sitepress->get_default_language();
|
inc/class-wcml-languages-upgrader.php
CHANGED
@@ -7,7 +7,6 @@ class WCML_Languages_Upgrader{
|
|
7 |
function __construct(){
|
8 |
|
9 |
add_action( 'icl_update_active_languages', array( $this, 'download_woocommerce_translations_for_active_languages' ) );
|
10 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_for_update' ), 11 );
|
11 |
add_filter( 'upgrader_pre_download', array( $this, 'version_update' ), 10, 2 );
|
12 |
add_action( 'admin_notices', array( $this, 'translation_upgrade_notice' ) );
|
13 |
add_action( 'wp_ajax_hide_wcml_translations_message', array($this, 'hide_wcml_translations_message') );
|
@@ -94,45 +93,6 @@ class WCML_Languages_Upgrader{
|
|
94 |
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
/*
|
99 |
-
* Check for WC language updates
|
100 |
-
*
|
101 |
-
* @param object $data Transient update data
|
102 |
-
*
|
103 |
-
* @return object
|
104 |
-
*/
|
105 |
-
function check_for_update( $data ){
|
106 |
-
global $sitepress;
|
107 |
-
|
108 |
-
$active_languages = $sitepress->get_active_languages();
|
109 |
-
|
110 |
-
foreach( $active_languages as $language ){
|
111 |
-
if( $language['code'] == 'en' )
|
112 |
-
continue;
|
113 |
-
|
114 |
-
$locale = $sitepress->get_locale( $language['code'] );
|
115 |
-
|
116 |
-
if ( isset( $data->translations ) ) {
|
117 |
-
|
118 |
-
$data->translations[] = array(
|
119 |
-
'type' => 'plugin',
|
120 |
-
'slug' => 'woocommerce',
|
121 |
-
'language' => $locale,
|
122 |
-
'version' => WC_VERSION,
|
123 |
-
'updated' => date( 'Y-m-d H:i:s' ),
|
124 |
-
'package' => $this->get_language_pack_uri( $locale ),
|
125 |
-
'autoupdate' => 1
|
126 |
-
);
|
127 |
-
|
128 |
-
}
|
129 |
-
|
130 |
-
}
|
131 |
-
|
132 |
-
return $data;
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
function get_language_pack_uri( $locale, $version = false ){
|
137 |
|
138 |
if( !$version ){
|
7 |
function __construct(){
|
8 |
|
9 |
add_action( 'icl_update_active_languages', array( $this, 'download_woocommerce_translations_for_active_languages' ) );
|
|
|
10 |
add_filter( 'upgrader_pre_download', array( $this, 'version_update' ), 10, 2 );
|
11 |
add_action( 'admin_notices', array( $this, 'translation_upgrade_notice' ) );
|
12 |
add_action( 'wp_ajax_hide_wcml_translations_message', array($this, 'hide_wcml_translations_message') );
|
93 |
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
function get_language_pack_uri( $locale, $version = false ){
|
97 |
|
98 |
if( !$version ){
|
inc/class-wcml-locale.php
CHANGED
@@ -5,17 +5,22 @@ class WCML_Locale{
|
|
5 |
private $woocommerce_wpml;
|
6 |
private $sitepress;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
$
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
return load_plugin_textdomain( 'woocommerce-multilingual', false, WCML_PLUGIN_FOLDER.'/locale' );
|
20 |
}
|
21 |
|
5 |
private $woocommerce_wpml;
|
6 |
private $sitepress;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_Locale constructor.
|
10 |
+
*
|
11 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
12 |
+
* @param SitePress $sitepress
|
13 |
+
*/
|
14 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
15 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
16 |
+
$this->sitepress = $sitepress;
|
17 |
+
|
18 |
+
$this->load_locale();
|
19 |
+
|
20 |
+
add_filter( 'locale', [ $this, 'update_product_action_locale_check' ] );
|
21 |
+
}
|
22 |
+
|
23 |
+
function load_locale() {
|
24 |
return load_plugin_textdomain( 'woocommerce-multilingual', false, WCML_PLUGIN_FOLDER.'/locale' );
|
25 |
}
|
26 |
|
inc/class-wcml-resources.php
CHANGED
@@ -15,11 +15,15 @@ class WCML_Resources {
|
|
15 |
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'front_scripts' ) );
|
16 |
}
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
global $pagenow;
|
20 |
|
21 |
-
self::$woocommerce_wpml
|
22 |
-
self::$sitepress
|
23 |
|
24 |
self::$page = isset($_GET['page']) ? $_GET['page'] : null;
|
25 |
self::$tab = isset($_GET['tab']) ? $_GET['tab'] : null;
|
15 |
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'front_scripts' ) );
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
20 |
+
* @param SitePress $sitepress
|
21 |
+
*/
|
22 |
+
public static function set_up_resources( $woocommerce_wpml, $sitepress ) {
|
23 |
global $pagenow;
|
24 |
|
25 |
+
self::$woocommerce_wpml = $woocommerce_wpml;
|
26 |
+
self::$sitepress = $sitepress;
|
27 |
|
28 |
self::$page = isset($_GET['page']) ? $_GET['page'] : null;
|
29 |
self::$tab = isset($_GET['tab']) ? $_GET['tab'] : null;
|
inc/class-wcml-troubleshooting.php
CHANGED
@@ -8,17 +8,23 @@ class WCML_Troubleshooting{
|
|
8 |
private $sitepress;
|
9 |
private $wpdb;
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
|
23 |
add_action('wp_ajax_trbl_gallery_images', array($this,'trbl_gallery_images'));
|
24 |
add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
|
8 |
private $sitepress;
|
9 |
private $wpdb;
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Troubleshooting constructor.
|
13 |
+
*
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
* @param SitePress $sitepress
|
16 |
+
* @param wpdb $wpdb
|
17 |
+
*/
|
18 |
+
public function __construct( $woocommerce_wpml, $sitepress, $wpdb ) {
|
19 |
|
20 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
21 |
+
$this->sitepress = $sitepress;
|
22 |
+
$this->wpdb = $wpdb;
|
23 |
+
|
24 |
+
add_action( 'init', [ $this, 'init' ] );
|
25 |
+
}
|
|
|
26 |
|
27 |
+
function init() {
|
28 |
add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
|
29 |
add_action('wp_ajax_trbl_gallery_images', array($this,'trbl_gallery_images'));
|
30 |
add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
|
inc/class-wcml-wc-shipping.php
CHANGED
@@ -5,16 +5,19 @@ class WCML_WC_Shipping{
|
|
5 |
private $current_language;
|
6 |
private $sitepress;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
}
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
function add_hooks(){
|
20 |
|
5 |
private $current_language;
|
6 |
private $sitepress;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_WC_Shipping constructor.
|
10 |
+
*
|
11 |
+
* @param SitePress $sitepress
|
12 |
+
*/
|
13 |
+
public function __construct( $sitepress ) {
|
14 |
+
$this->sitepress = $sitepress;
|
|
|
15 |
|
16 |
+
$this->current_language = $this->sitepress->get_current_language();
|
17 |
+
if ( 'all' === $this->current_language ) {
|
18 |
+
$this->current_language = $this->sitepress->get_default_language();
|
19 |
+
}
|
20 |
+
}
|
21 |
|
22 |
function add_hooks(){
|
23 |
|
inc/class-wcml-wc-strings.php
CHANGED
@@ -480,7 +480,7 @@ class WCML_WC_Strings {
|
|
480 |
}
|
481 |
|
482 |
$mo->import_from_file( $mo_file );
|
483 |
-
$this->mo_files[ $language ] =
|
484 |
}
|
485 |
|
486 |
if ( in_array( $string, array( 'product', 'product-category', 'product-tag' ) ) ) {
|
480 |
}
|
481 |
|
482 |
$mo->import_from_file( $mo_file );
|
483 |
+
$this->mo_files[ $language ] = $mo->entries;
|
484 |
}
|
485 |
|
486 |
if ( in_array( $string, array( 'product', 'product-category', 'product-tag' ) ) ) {
|
inc/class-wcml-widgets.php
CHANGED
@@ -4,14 +4,20 @@ class WCML_Widgets{
|
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
|
|
13 |
|
14 |
-
|
15 |
|
16 |
if( $this->woocommerce_wpml->settings[ 'enable_multi_currency' ] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
17 |
register_widget( 'WCML_Currency_Switcher_Widget' );
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
+
/**
|
8 |
+
* WCML_Widgets constructor.
|
9 |
+
*
|
10 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
11 |
+
*/
|
12 |
+
public function __construct( $woocommerce_wpml ) {
|
13 |
+
// @todo Cover by tests, required for wcml-3037.
|
14 |
|
15 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
16 |
|
17 |
+
add_action( 'widgets_init', [ $this, 'register_widgets' ] );
|
18 |
+
}
|
19 |
|
20 |
+
public function register_widgets() {
|
21 |
|
22 |
if( $this->woocommerce_wpml->settings[ 'enable_multi_currency' ] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
23 |
register_widget( 'WCML_Currency_Switcher_Widget' );
|
inc/currencies/class-wcml-custom-prices.php
CHANGED
@@ -41,8 +41,13 @@ class WCML_Custom_Prices{
|
|
41 |
|
42 |
}
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
46 |
if( empty( $currency ) ){
|
47 |
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
48 |
}
|
@@ -507,28 +512,35 @@ class WCML_Custom_Prices{
|
|
507 |
}
|
508 |
|
509 |
/**
|
510 |
-
* @param bool $on_sale
|
511 |
* @param WC_Product $product_object
|
512 |
*
|
513 |
* @return bool
|
514 |
*/
|
515 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
get_post_meta( $product_object->get_id(), '_wcml_custom_prices_status', true )
|
521 |
-
){
|
522 |
-
|
523 |
-
$custom_prices = $this->get_product_custom_prices( $product_object->get_id() );
|
524 |
-
|
525 |
-
if( $custom_prices[ '_sale_price' ] !== '' && $custom_prices[ '_sale_price' ] != $custom_prices[ '_regular_price' ] ){
|
526 |
-
$on_sale = true;
|
527 |
-
}
|
528 |
-
|
529 |
}
|
530 |
|
531 |
return $on_sale;
|
532 |
}
|
533 |
-
|
534 |
}
|
41 |
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* @param int $product_id
|
46 |
+
* @param bool $currency
|
47 |
+
*
|
48 |
+
* @return array|false
|
49 |
+
*/
|
50 |
+
public function get_product_custom_prices( $product_id, $currency = false ) {
|
51 |
if( empty( $currency ) ){
|
52 |
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
53 |
}
|
512 |
}
|
513 |
|
514 |
/**
|
|
|
515 |
* @param WC_Product $product_object
|
516 |
*
|
517 |
* @return bool
|
518 |
*/
|
519 |
+
private function is_on_sale( $product_object ) {
|
520 |
+
$custom_prices = $this->get_product_custom_prices( $product_object->get_id() );
|
521 |
+
|
522 |
+
return $custom_prices
|
523 |
+
&& array_key_exists( '_sale_price', $custom_prices )
|
524 |
+
&& array_key_exists( '_regular_price', $custom_prices )
|
525 |
+
&& '' !== $custom_prices['_sale_price']
|
526 |
+
&& $custom_prices['_sale_price'] !== $custom_prices['_regular_price'];
|
527 |
+
}
|
528 |
|
529 |
+
/**
|
530 |
+
* @param bool $on_sale
|
531 |
+
* @param WC_Product $product_object
|
532 |
+
*
|
533 |
+
* @return bool
|
534 |
+
*/
|
535 |
+
public function filter_product_is_on_sale( $on_sale, $product_object ) {
|
536 |
+
if (
|
537 |
+
! $on_sale &&
|
538 |
+
WCML_MULTI_CURRENCIES_INDEPENDENT === $this->woocommerce_wpml->settings['enable_multi_currency'] &&
|
539 |
get_post_meta( $product_object->get_id(), '_wcml_custom_prices_status', true )
|
540 |
+
) {
|
541 |
+
$on_sale = $this->is_on_sale( $product_object );
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
}
|
543 |
|
544 |
return $on_sale;
|
545 |
}
|
|
|
546 |
}
|
inc/currencies/class-wcml-multi-currency-configuration.php
CHANGED
@@ -40,12 +40,12 @@ class WCML_Multi_Currency_Configuration
|
|
40 |
|
41 |
}
|
42 |
|
43 |
-
public static function save_configuration()
|
44 |
-
|
45 |
|
46 |
if (check_admin_referer('wcml_mc_options', 'wcml_nonce')) {
|
47 |
|
48 |
-
$wcml_settings
|
49 |
|
50 |
$wcml_settings['enable_multi_currency'] = isset($_POST['multi_currency']) ? intval($_POST['multi_currency']) : 0;
|
51 |
$wcml_settings['display_custom_prices'] = isset($_POST['display_custom_prices']) ? intval($_POST['display_custom_prices']) : 0;
|
40 |
|
41 |
}
|
42 |
|
43 |
+
public static function save_configuration() {
|
44 |
+
// @todo Cover by tests, required for wcml-3037.
|
45 |
|
46 |
if (check_admin_referer('wcml_mc_options', 'wcml_nonce')) {
|
47 |
|
48 |
+
$wcml_settings = self::$woocommerce_wpml->settings;
|
49 |
|
50 |
$wcml_settings['enable_multi_currency'] = isset($_POST['multi_currency']) ? intval($_POST['multi_currency']) : 0;
|
51 |
$wcml_settings['display_custom_prices'] = isset($_POST['display_custom_prices']) ? intval($_POST['display_custom_prices']) : 0;
|
inc/currencies/class-wcml-multi-currency-prices.php
CHANGED
@@ -593,6 +593,28 @@ class WCML_Multi_Currency_Prices {
|
|
593 |
return $args;
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
private function check_admin_order_currency_code() {
|
597 |
global $pagenow;
|
598 |
|
593 |
return $args;
|
594 |
}
|
595 |
|
596 |
+
/**
|
597 |
+
* @param array $response
|
598 |
+
* @param string $to_currency
|
599 |
+
* @param string $from_currency
|
600 |
+
* @param array $params
|
601 |
+
*
|
602 |
+
* @return array
|
603 |
+
*/
|
604 |
+
public function filter_pre_selected_widget_prices_in_new_currency( $response, $to_currency, $from_currency, $params ) {
|
605 |
+
|
606 |
+
wpml_collect( $params )->each(
|
607 |
+
function ( $value, $key ) use ( &$response, $from_currency, $to_currency ) {
|
608 |
+
if ( wpml_collect( [ 'min_price', 'max_price' ] )->contains( $key ) ) {
|
609 |
+
$response[ $key ] = $this->convert_price_amount( $this->unconvert_price_amount( $value, $from_currency ), $to_currency );
|
610 |
+
}
|
611 |
+
}
|
612 |
+
);
|
613 |
+
|
614 |
+
return $response;
|
615 |
+
}
|
616 |
+
|
617 |
+
|
618 |
private function check_admin_order_currency_code() {
|
619 |
global $pagenow;
|
620 |
|
inc/currencies/class-wcml-multi-currency.php
CHANGED
@@ -99,7 +99,7 @@ class WCML_Multi_Currency {
|
|
99 |
public function __construct() {
|
100 |
global $woocommerce_wpml, $sitepress, $wpdb, $wp_locale, $wp;
|
101 |
|
102 |
-
$this->woocommerce_wpml
|
103 |
|
104 |
$this->install = new WCML_Multi_Currency_Install( $this, $woocommerce_wpml );
|
105 |
|
@@ -220,7 +220,7 @@ class WCML_Multi_Currency {
|
|
220 |
global $sitepress;
|
221 |
|
222 |
$this->default_currency = wcml_get_woocommerce_currency_option();
|
223 |
-
$this->currencies
|
224 |
|
225 |
// Add default currency if missing (set when MC is off)
|
226 |
if ( ! empty( $this->default_currency ) && ! isset( $this->currencies[ $this->default_currency ] ) ) {
|
@@ -439,20 +439,6 @@ class WCML_Multi_Currency {
|
|
439 |
}
|
440 |
}
|
441 |
|
442 |
-
if (
|
443 |
-
isset( $_POST['action'] ) &&
|
444 |
-
$_POST['action'] == 'wcml_switch_currency' &&
|
445 |
-
! empty( $_POST['currency'] ) &&
|
446 |
-
isset( $_POST['force_switch'] ) &&
|
447 |
-
! $_POST['force_switch'] &&
|
448 |
-
(
|
449 |
-
$this->woocommerce_wpml->settings['cart_sync']['currency_switch'] == WCML_CART_SYNC ||
|
450 |
-
$this->woocommerce_wpml->settings['cart_sync']['currency_switch'] == WCML_CART_SYNC
|
451 |
-
)
|
452 |
-
) {
|
453 |
-
$this->client_currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
454 |
-
}
|
455 |
-
|
456 |
if ( isset( $_GET['action'] ) &&
|
457 |
$_GET['action'] === 'woocommerce_json_search_products_and_variations' &&
|
458 |
! empty( $_COOKIE['_wcml_order_currency'] ) ) {
|
@@ -560,10 +546,12 @@ class WCML_Multi_Currency {
|
|
560 |
|
561 |
$currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
562 |
$force_switch = filter_input( INPUT_POST, 'force_switch', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
|
|
|
|
563 |
|
564 |
do_action( 'wcml_before_switch_currency', $currency, $force_switch );
|
565 |
|
566 |
-
if ( ! $force_switch && apply_filters( 'wcml_switch_currency_exception', false, $
|
567 |
die();
|
568 |
}
|
569 |
|
@@ -579,9 +567,9 @@ class WCML_Multi_Currency {
|
|
579 |
|
580 |
do_action( 'wcml_switch_currency', $currency );
|
581 |
|
582 |
-
|
583 |
-
die();
|
584 |
|
|
|
585 |
}
|
586 |
|
587 |
public function get_currencies_without_cents() {
|
99 |
public function __construct() {
|
100 |
global $woocommerce_wpml, $sitepress, $wpdb, $wp_locale, $wp;
|
101 |
|
102 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
103 |
|
104 |
$this->install = new WCML_Multi_Currency_Install( $this, $woocommerce_wpml );
|
105 |
|
220 |
global $sitepress;
|
221 |
|
222 |
$this->default_currency = wcml_get_woocommerce_currency_option();
|
223 |
+
$this->currencies = $this->woocommerce_wpml->settings['currency_options'];
|
224 |
|
225 |
// Add default currency if missing (set when MC is off)
|
226 |
if ( ! empty( $this->default_currency ) && ! isset( $this->currencies[ $this->default_currency ] ) ) {
|
439 |
}
|
440 |
}
|
441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
if ( isset( $_GET['action'] ) &&
|
443 |
$_GET['action'] === 'woocommerce_json_search_products_and_variations' &&
|
444 |
! empty( $_COOKIE['_wcml_order_currency'] ) ) {
|
546 |
|
547 |
$currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
548 |
$force_switch = filter_input( INPUT_POST, 'force_switch', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
549 |
+
parse_str( filter_input( INPUT_POST, 'params', FILTER_SANITIZE_STRING ), $params );
|
550 |
+
$from_currency = $this->client_currency;
|
551 |
|
552 |
do_action( 'wcml_before_switch_currency', $currency, $force_switch );
|
553 |
|
554 |
+
if ( ! $force_switch && apply_filters( 'wcml_switch_currency_exception', false, $from_currency, $currency ) ) {
|
555 |
die();
|
556 |
}
|
557 |
|
567 |
|
568 |
do_action( 'wcml_switch_currency', $currency );
|
569 |
|
570 |
+
$response = $this->prices->filter_pre_selected_widget_prices_in_new_currency( [], $currency, $from_currency, $params );
|
|
|
571 |
|
572 |
+
wp_send_json_success( $response );
|
573 |
}
|
574 |
|
575 |
public function get_currencies_without_cents() {
|
inc/currencies/class-wcml-price-filter.php
CHANGED
@@ -7,7 +7,12 @@ class WCML_Price_Filter {
|
|
7 |
*/
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
12 |
}
|
13 |
|
7 |
*/
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
+
/**
|
11 |
+
* WCML_Price_Filter constructor.
|
12 |
+
*
|
13 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
14 |
+
*/
|
15 |
+
public function __construct( woocommerce_wpml $woocommerce_wpml ) {
|
16 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
17 |
}
|
18 |
|
inc/currencies/currency-switcher/class-wcml-currency-switcher-ajax.php
CHANGED
@@ -8,15 +8,18 @@ class WCML_Currency_Switcher_Ajax{
|
|
8 |
|
9 |
private $woocommerce_wpml;
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
14 |
|
15 |
-
add_action( 'wp_ajax_wcml_currencies_order',
|
16 |
-
add_action( 'wp_ajax_wcml_currencies_switcher_preview',
|
17 |
-
add_action( 'wp_ajax_wcml_currencies_switcher_save_settings',
|
18 |
-
add_action( 'wp_ajax_wcml_delete_currency_switcher',
|
19 |
-
|
20 |
}
|
21 |
|
22 |
public function wcml_currencies_order() {
|
@@ -35,7 +38,7 @@ class WCML_Currency_Switcher_Ajax{
|
|
35 |
if ( !$nonce || !wp_verify_nonce( $nonce, 'wcml_currencies_switcher_save_settings' ) ) {
|
36 |
wp_send_json_error('Invalid nonce');
|
37 |
}
|
38 |
-
$wcml_settings
|
39 |
$switcher_settings = array();
|
40 |
|
41 |
// Allow some HTML in the currency switcher
|
8 |
|
9 |
private $woocommerce_wpml;
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Currency_Switcher_Ajax constructor.
|
13 |
+
*
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
*/
|
16 |
+
public function __construct( $woocommerce_wpml ) {
|
17 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
18 |
|
19 |
+
add_action( 'wp_ajax_wcml_currencies_order', [ $this, 'wcml_currencies_order' ] );
|
20 |
+
add_action( 'wp_ajax_wcml_currencies_switcher_preview', [ $this, 'wcml_currencies_switcher_preview' ] );
|
21 |
+
add_action( 'wp_ajax_wcml_currencies_switcher_save_settings', [ $this, 'wcml_currencies_switcher_save_settings' ] );
|
22 |
+
add_action( 'wp_ajax_wcml_delete_currency_switcher', [ $this, 'wcml_delete_currency_switcher' ] );
|
|
|
23 |
}
|
24 |
|
25 |
public function wcml_currencies_order() {
|
38 |
if ( !$nonce || !wp_verify_nonce( $nonce, 'wcml_currencies_switcher_save_settings' ) ) {
|
39 |
wp_send_json_error('Invalid nonce');
|
40 |
}
|
41 |
+
$wcml_settings = $this->woocommerce_wpml->settings;
|
42 |
$switcher_settings = array();
|
43 |
|
44 |
// Allow some HTML in the currency switcher
|
inc/currencies/currency-switcher/class-wcml-currency-switcher.php
CHANGED
@@ -69,9 +69,9 @@ class WCML_Currency_Switcher{
|
|
69 |
$args[ 'switcher_id' ] = 'product';
|
70 |
}
|
71 |
|
72 |
-
$wcml_settings
|
73 |
-
$multi_currency_object
|
74 |
-
$currency_switcher_settings =
|
75 |
|
76 |
if( isset( $wcml_settings[ 'currency_switchers' ][ $args[ 'switcher_id' ] ] ) ){
|
77 |
$currency_switcher_settings = $wcml_settings[ 'currency_switchers' ][ $args[ 'switcher_id' ] ];
|
69 |
$args[ 'switcher_id' ] = 'product';
|
70 |
}
|
71 |
|
72 |
+
$wcml_settings = $this->woocommerce_wpml->get_settings();
|
73 |
+
$multi_currency_object = $this->woocommerce_wpml->multi_currency;
|
74 |
+
$currency_switcher_settings = [];
|
75 |
|
76 |
if( isset( $wcml_settings[ 'currency_switchers' ][ $args[ 'switcher_id' ] ] ) ){
|
77 |
$currency_switcher_settings = $wcml_settings[ 'currency_switchers' ][ $args[ 'switcher_id' ] ];
|
inc/missing-php-functions.php
CHANGED
@@ -1,39 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/* PHP 5.3 - start */
|
4 |
-
|
5 |
-
if ( false === function_exists( 'lcfirst' ) ) {
|
6 |
-
/**
|
7 |
-
* Make a string's first character lowercase
|
8 |
-
*
|
9 |
-
* @param string $str
|
10 |
-
*
|
11 |
-
* @return string the resulting string.
|
12 |
-
*/
|
13 |
-
function lcfirst( $str ) {
|
14 |
-
$str[0] = strtolower( $str[0] );
|
15 |
-
|
16 |
-
return (string) $str;
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
if ( get_magic_quotes_gpc() ) {
|
21 |
-
if ( ! function_exists( 'stripslashes_deep' ) ) {
|
22 |
-
function stripslashes_deep( $value ) {
|
23 |
-
$value = is_array( $value ) ?
|
24 |
-
array_map( 'stripslashes_deep', $value ) :
|
25 |
-
stripslashes( $value );
|
26 |
-
|
27 |
-
return $value;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
$_POST = array_map( 'stripslashes_deep', $_POST );
|
32 |
-
$_GET = array_map( 'stripslashes_deep', $_GET );
|
33 |
-
$_COOKIE = array_map( 'stripslashes_deep', $_COOKIE );
|
34 |
-
}
|
35 |
-
/* PHP 5.3 - end */
|
36 |
-
|
37 |
add_action( 'plugins_loaded', 'wcml_check_wpml_functions' );
|
38 |
|
39 |
function wcml_check_wpml_functions() {
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
add_action( 'plugins_loaded', 'wcml_check_wpml_functions' );
|
3 |
|
4 |
function wcml_check_wpml_functions() {
|
inc/template-classes/class-wcml-attribute-translation-ui.php
CHANGED
@@ -6,11 +6,19 @@ class WCML_Attribute_Translation_UI extends WCML_Templates_Factory {
|
|
6 |
private $woocommerce_wpml;
|
7 |
private $sitepress;
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
parent::__construct();
|
11 |
|
12 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
13 |
-
$this->sitepress
|
14 |
}
|
15 |
|
16 |
public function get_model() {
|
6 |
private $woocommerce_wpml;
|
7 |
private $sitepress;
|
8 |
|
9 |
+
/**
|
10 |
+
* WCML_Attribute_Translation_UI constructor.
|
11 |
+
*
|
12 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
13 |
+
* @param SitePress $sitepress
|
14 |
+
*/
|
15 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
16 |
+
// @todo Cover by tests, required for wcml-3037.
|
17 |
+
|
18 |
parent::__construct();
|
19 |
|
20 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
21 |
+
$this->sitepress = $sitepress;
|
22 |
}
|
23 |
|
24 |
public function get_model() {
|
inc/template-classes/class-wcml-custom-files-ui.php
CHANGED
@@ -13,16 +13,17 @@ class WCML_Custom_Files_UI extends WCML_Templates_Factory {
|
|
13 |
* WCML_Custom_Files_UI constructor.
|
14 |
*
|
15 |
* @param woocommerce_wpml $woocommerce_wpml
|
16 |
-
* @param int
|
17 |
-
* @param bool
|
18 |
*/
|
19 |
-
function __construct(
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
$this->product_id = $product_id;
|
24 |
-
$this->is_variation = $is_variation;
|
25 |
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function get_model() {
|
13 |
* WCML_Custom_Files_UI constructor.
|
14 |
*
|
15 |
* @param woocommerce_wpml $woocommerce_wpml
|
16 |
+
* @param int $product_id
|
17 |
+
* @param bool $is_variation
|
18 |
*/
|
19 |
+
public function __construct( $woocommerce_wpml, $product_id, $is_variation = false ) {
|
20 |
+
// @todo Cover by tests, required for wcml-3037.
|
21 |
|
22 |
+
parent::__construct();
|
|
|
|
|
23 |
|
24 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
25 |
+
$this->product_id = $product_id;
|
26 |
+
$this->is_variation = $is_variation;
|
27 |
}
|
28 |
|
29 |
public function get_model() {
|
inc/template-classes/class-wcml-custom-taxonomy-translation-ui.php
CHANGED
@@ -10,7 +10,15 @@ class WCML_Custom_Taxonomy_Translation_UI extends WCML_Templates_Factory {
|
|
10 |
private $product_builtin_taxonomy_names = array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type', 'translation_priority' ); //'product_type' is used for tags (?)
|
11 |
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
parent::__construct();
|
15 |
|
16 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
10 |
private $product_builtin_taxonomy_names = array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type', 'translation_priority' ); //'product_type' is used for tags (?)
|
11 |
|
12 |
|
13 |
+
/**
|
14 |
+
* WCML_Custom_Taxonomy_Translation_UI constructor.
|
15 |
+
*
|
16 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
17 |
+
* @param SitePress $sitepress
|
18 |
+
*/
|
19 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
20 |
+
// @todo Cover by tests, required for wcml-3037.
|
21 |
+
|
22 |
parent::__construct();
|
23 |
|
24 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
inc/template-classes/class-wcml-menus-wrap.php
CHANGED
@@ -14,10 +14,17 @@ class WCML_Menus_Wrap extends WCML_Templates_Factory {
|
|
14 |
private $selected_attribute;
|
15 |
private $selected_taxonomy;
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
|
|
|
|
21 |
|
22 |
$this->product_attributes = $this->woocommerce_wpml->attributes->get_translatable_attributes();
|
23 |
if( $this->product_attributes ){
|
14 |
private $selected_attribute;
|
15 |
private $selected_taxonomy;
|
16 |
|
17 |
+
/**
|
18 |
+
* WCML_Menus_Wrap constructor.
|
19 |
+
*
|
20 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
21 |
+
*/
|
22 |
+
public function __construct( $woocommerce_wpml ) {
|
23 |
+
// @todo Cover by tests, required for wcml-3037.
|
24 |
|
25 |
+
parent::__construct();
|
26 |
+
|
27 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
28 |
|
29 |
$this->product_attributes = $this->woocommerce_wpml->attributes->get_translatable_attributes();
|
30 |
if( $this->product_attributes ){
|
inc/template-classes/class-wcml-not-translatable-attributes.php
CHANGED
@@ -8,10 +8,18 @@ class WCML_Not_Translatable_Attributes extends WCML_Templates_Factory {
|
|
8 |
private $attr_id;
|
9 |
private $woocommerce_wpml;
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
parent::__construct();
|
13 |
|
14 |
-
$this->attr_id
|
15 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
16 |
}
|
17 |
|
8 |
private $attr_id;
|
9 |
private $woocommerce_wpml;
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Not_Translatable_Attributes constructor.
|
13 |
+
*
|
14 |
+
* @param int $attr_id
|
15 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
16 |
+
*/
|
17 |
+
public function __construct( $attr_id, $woocommerce_wpml ) {
|
18 |
+
// @todo Cover by tests, required for wcml-3037.
|
19 |
+
|
20 |
parent::__construct();
|
21 |
|
22 |
+
$this->attr_id = $attr_id;
|
23 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
}
|
25 |
|
inc/template-classes/class-wcml-products-ui.php
CHANGED
@@ -8,11 +8,17 @@ class WCML_Products_UI extends WCML_Templates_Factory {
|
|
8 |
private $woocommerce_wpml;
|
9 |
private $sitepress;
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
parent::__construct();
|
13 |
|
14 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
15 |
-
$this->sitepress
|
16 |
}
|
17 |
|
18 |
public function get_model() {
|
8 |
private $woocommerce_wpml;
|
9 |
private $sitepress;
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Products_UI constructor.
|
13 |
+
*
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
* @param SitePress $sitepress
|
16 |
+
*/
|
17 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
18 |
parent::__construct();
|
19 |
|
20 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
21 |
+
$this->sitepress = $sitepress;
|
22 |
}
|
23 |
|
24 |
public function get_model() {
|
inc/template-classes/class-wcml-removed-cart-items-ui.php
CHANGED
@@ -19,9 +19,18 @@ class WCML_Removed_Cart_Items_UI extends WCML_Templates_Factory {
|
|
19 |
*/
|
20 |
private $woocommerce;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
$this->args = $args;
|
26 |
$this->sitepress = $sitepress;
|
27 |
$this->woocommerce = $woocommerce;
|
19 |
*/
|
20 |
private $woocommerce;
|
21 |
|
22 |
+
/**
|
23 |
+
* WCML_Removed_Cart_Items_UI constructor.
|
24 |
+
*
|
25 |
+
* @param array $args
|
26 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
27 |
+
* @param SitePress $sitepress
|
28 |
+
* @param WooCommerce $woocommerce
|
29 |
+
*/
|
30 |
+
public function __construct( $args, $woocommerce_wpml, $sitepress, $woocommerce ) {
|
31 |
+
// @todo Cover by tests, required for wcml-3037.
|
32 |
+
|
33 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
34 |
$this->args = $args;
|
35 |
$this->sitepress = $sitepress;
|
36 |
$this->woocommerce = $woocommerce;
|
inc/template-classes/class-wcml-sync-taxonomy.php
CHANGED
@@ -6,13 +6,22 @@ class WCML_Sync_Taxonomy extends WCML_Templates_Factory {
|
|
6 |
private $taxonomy;
|
7 |
private $taxonomy_obj;
|
8 |
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
public function get_model(){
|
18 |
|
6 |
private $taxonomy;
|
7 |
private $taxonomy_obj;
|
8 |
|
9 |
+
/**
|
10 |
+
* WCML_Sync_Taxonomy constructor.
|
11 |
+
*
|
12 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
13 |
+
* @param string $taxonomy
|
14 |
+
* @param WP_Taxonomy $taxonomy_obj
|
15 |
+
*/
|
16 |
+
function __construct( $woocommerce_wpml, $taxonomy, $taxonomy_obj ) {
|
17 |
+
// @todo Cover by tests, required for wcml-3037.
|
18 |
|
19 |
+
parent::__construct();
|
20 |
+
|
21 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
+
$this->taxonomy = $taxonomy;
|
23 |
+
$this->taxonomy_obj = $taxonomy_obj;
|
24 |
+
}
|
25 |
|
26 |
public function get_model(){
|
27 |
|
inc/template-classes/class-wcml-troubleshooting-ui.php
CHANGED
@@ -8,7 +8,14 @@ class WCML_Troubleshooting_UI extends WCML_Templates_Factory {
|
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
parent::__construct();
|
13 |
|
14 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
8 |
private $woocommerce_wpml;
|
9 |
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Troubleshooting_UI constructor.
|
13 |
+
*
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
*/
|
16 |
+
public function __construct( $woocommerce_wpml ) {
|
17 |
+
// @todo Cover by tests, required for wcml-3037.
|
18 |
+
|
19 |
parent::__construct();
|
20 |
|
21 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
inc/template-classes/currency-switcher/class-wcml-currency-switcher-options-dialog.php
CHANGED
@@ -5,16 +5,24 @@ class WCML_Currency_Switcher_Options_Dialog extends WCML_Templates_Factory {
|
|
5 |
private $woocommerce_wpml;
|
6 |
private $args;
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
$this->args = $args;
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
|
19 |
$model = array(
|
20 |
|
5 |
private $woocommerce_wpml;
|
6 |
private $args;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_Currency_Switcher_Options_Dialog constructor.
|
10 |
+
*
|
11 |
+
* @param array $args
|
12 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
13 |
+
*/
|
14 |
+
public function __construct( $args, $woocommerce_wpml ) {
|
15 |
+
// @todo Cover by tests, required for wcml-3037.
|
16 |
|
17 |
+
parent::__construct();
|
|
|
18 |
|
19 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
+
$this->args = $args;
|
21 |
+
|
22 |
+
add_action( 'wcml_before_currency_switcher_options', [ $this, 'render' ] );
|
23 |
+
}
|
24 |
|
25 |
+
public function get_model() {
|
26 |
|
27 |
$model = array(
|
28 |
|
inc/template-classes/currency-switcher/class-wcml-currency-switcher-template.php
CHANGED
@@ -17,27 +17,30 @@ class WCML_Currency_Switcher_Template extends WCML_Templates_Factory {
|
|
17 |
*/
|
18 |
private $woocommerce_wpml;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
$this->template = $this->format_data( $template_data );
|
26 |
-
|
27 |
-
if ( array_key_exists( 'template_string', $this->template ) ) {
|
28 |
-
$this->template_string = $this->template['template_string'];
|
29 |
-
}
|
30 |
-
|
31 |
-
$functions = array(
|
32 |
-
new Twig_SimpleFunction( 'get_formatted_price', array( $this, 'get_formatted_price' ) )
|
33 |
-
);
|
34 |
-
|
35 |
-
parent::__construct( $functions );
|
36 |
|
37 |
-
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
*/
|
42 |
public function set_model( $model ) {
|
43 |
$this->model = is_array( $model ) ? $model : array( $model );
|
17 |
*/
|
18 |
private $woocommerce_wpml;
|
19 |
|
20 |
+
/**
|
21 |
+
* WCML_Currency_Switcher_Template constructor.
|
22 |
+
*
|
23 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
24 |
+
* @param array $template_data
|
25 |
+
*/
|
26 |
+
public function __construct( $woocommerce_wpml, $template_data ) {
|
27 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
28 |
+
|
29 |
+
$this->template = $this->format_data( $template_data );
|
30 |
+
|
31 |
+
if ( array_key_exists( 'template_string', $this->template ) ) {
|
32 |
+
$this->template_string = $this->template['template_string'];
|
33 |
+
}
|
34 |
|
35 |
+
$functions = [
|
36 |
+
new Twig_SimpleFunction( 'get_formatted_price', [ $this, 'get_formatted_price' ] ),
|
37 |
+
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
parent::__construct( $functions );
|
40 |
+
}
|
41 |
|
42 |
+
/**
|
43 |
+
* @param array $model
|
44 |
*/
|
45 |
public function set_model( $model ) {
|
46 |
$this->model = is_array( $model ) ? $model : array( $model );
|
inc/template-classes/multi-currency/class-wcml-custom-currency-options.php
CHANGED
@@ -7,18 +7,25 @@ class WCML_Custom_Currency_Options extends WCML_Templates_Factory {
|
|
7 |
private $woocommerce_wpml;
|
8 |
private $args;
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
public function get_model(){
|
24 |
|
@@ -26,7 +33,7 @@ class WCML_Custom_Currency_Options extends WCML_Templates_Factory {
|
|
26 |
array_keys( $this->args['currencies'] ), array( $this->args['default_currency'] ) );
|
27 |
$current_currency = empty($this->args['currency_code']) ? current( $currencies_not_used ) : $this->args['currency_code'];
|
28 |
|
29 |
-
$exchange_rate_services
|
30 |
$exchange_rates_automatic = $exchange_rate_services->get_setting('automatic');
|
31 |
|
32 |
if( $exchange_rates_automatic ){
|
@@ -145,7 +152,7 @@ class WCML_Custom_Currency_Options extends WCML_Templates_Factory {
|
|
145 |
|
146 |
if( isset( $this->args['currencies'][$currency] ) ) {
|
147 |
|
148 |
-
$this->current_currency_for_preview
|
149 |
|
150 |
add_filter( 'option_woocommerce_currency_pos', array($this, 'filter_currency_pos') );
|
151 |
|
7 |
private $woocommerce_wpml;
|
8 |
private $args;
|
9 |
|
10 |
+
/**
|
11 |
+
* WCML_Custom_Currency_Options constructor.
|
12 |
+
*
|
13 |
+
* @param array $args
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
*/
|
16 |
+
public function __construct( $args, $woocommerce_wpml ) {
|
17 |
+
// @todo Cover by tests, required for wcml-3037.
|
18 |
+
|
19 |
+
$functions = [
|
20 |
+
new Twig_SimpleFunction( 'get_currency_symbol', [ $this, 'get_currency_symbol' ] ),
|
21 |
+
];
|
22 |
+
|
23 |
+
parent::__construct( $functions );
|
24 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
25 |
+
$this->args = $args;
|
26 |
+
|
27 |
+
add_action( 'wcml_before_multi_currency_ui', [ $this, 'render' ] );
|
28 |
+
}
|
29 |
|
30 |
public function get_model(){
|
31 |
|
33 |
array_keys( $this->args['currencies'] ), array( $this->args['default_currency'] ) );
|
34 |
$current_currency = empty($this->args['currency_code']) ? current( $currencies_not_used ) : $this->args['currency_code'];
|
35 |
|
36 |
+
$exchange_rate_services = $this->woocommerce_wpml->multi_currency->exchange_rate_services;
|
37 |
$exchange_rates_automatic = $exchange_rate_services->get_setting('automatic');
|
38 |
|
39 |
if( $exchange_rates_automatic ){
|
152 |
|
153 |
if( isset( $this->args['currencies'][$currency] ) ) {
|
154 |
|
155 |
+
$this->current_currency_for_preview = $currency;
|
156 |
|
157 |
add_filter( 'option_woocommerce_currency_pos', array($this, 'filter_currency_pos') );
|
158 |
|
inc/template-classes/multi-currency/class-wcml-custom-prices-ui.php
CHANGED
@@ -11,7 +11,15 @@ class WCML_Custom_Prices_UI extends WCML_Templates_Factory {
|
|
11 |
private $is_variation;
|
12 |
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
parent::__construct();
|
16 |
|
17 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
11 |
private $is_variation;
|
12 |
|
13 |
|
14 |
+
/**
|
15 |
+
* WCML_Custom_Prices_UI constructor.
|
16 |
+
*
|
17 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
18 |
+
* @param int $product_id
|
19 |
+
*/
|
20 |
+
public function __construct( $woocommerce_wpml, $product_id ) {
|
21 |
+
// @todo Cover by tests, required for wcml-3037.
|
22 |
+
|
23 |
parent::__construct();
|
24 |
|
25 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
inc/template-classes/multi-currency/class-wcml-exchange-rates-ui.php
CHANGED
@@ -15,25 +15,32 @@ class WCML_Exchange_Rates_UI extends WCML_Templates_Factory {
|
|
15 |
*/
|
16 |
private $settings;
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
$last_updated = empty( $this->settings['last_updated'] ) ?
|
39 |
'<i>' . __( 'never', 'woocommerce-multilingual' ) . '</i>' :
|
15 |
*/
|
16 |
private $settings;
|
17 |
|
18 |
+
/**
|
19 |
+
* WCML_Exchange_Rates_UI constructor.
|
20 |
+
*
|
21 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
22 |
+
*/
|
23 |
+
public function __construct( $woocommerce_wpml ) {
|
24 |
+
// @todo Cover by tests, required for wcml-3037.
|
25 |
+
|
26 |
+
parent::__construct();
|
27 |
+
|
28 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
29 |
+
$services = $this->woocommerce_wpml->multi_currency->exchange_rate_services->get_services();
|
30 |
+
$this->settings = $this->woocommerce_wpml->multi_currency->exchange_rate_services->get_settings();
|
31 |
+
|
32 |
+
foreach ( $services as $id => $service ) {
|
33 |
+
$this->services[ $id ] = [
|
34 |
+
'name' => $service->get_name(),
|
35 |
+
'url' => $service->get_url(),
|
36 |
+
'requires_key' => $service->is_key_required(),
|
37 |
+
'api_key' => $service->get_setting( 'api-key' ),
|
38 |
+
'last_error' => $service->get_last_error(),
|
39 |
+
];
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
public function get_model(){
|
44 |
|
45 |
$last_updated = empty( $this->settings['last_updated'] ) ?
|
46 |
'<i>' . __( 'never', 'woocommerce-multilingual' ) . '</i>' :
|
inc/template-classes/multi-currency/class-wcml-multi-currency-ui.php
CHANGED
@@ -28,9 +28,16 @@ class WCML_Multi_Currency_UI extends WCML_Templates_Factory {
|
|
28 |
/** @var WCML_Tracking_Link */
|
29 |
private $tracking_link;
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) ),
|
35 |
new Twig_SimpleFunction( 'is_currency_on', array( $this, 'is_currency_on' ) ),
|
36 |
new Twig_SimpleFunction( 'get_language_currency', array( $this, 'get_language_currency' ) ),
|
@@ -220,9 +227,16 @@ class WCML_Multi_Currency_UI extends WCML_Templates_Factory {
|
|
220 |
return $this->sitepress->get_flag_url( $code );
|
221 |
}
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
public function get_language_currency( $language ) {
|
228 |
return $this->woocommerce_wpml->settings['default_currencies'][ $language ];
|
28 |
/** @var WCML_Tracking_Link */
|
29 |
private $tracking_link;
|
30 |
|
31 |
+
/**
|
32 |
+
* WCML_Multi_Currency_UI constructor.
|
33 |
+
*
|
34 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
35 |
+
* @param SitePress $sitepress
|
36 |
+
*/
|
37 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
38 |
+
// @todo Cover by tests, required for wcml-3037.
|
39 |
+
|
40 |
+
$functions = array(
|
41 |
new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) ),
|
42 |
new Twig_SimpleFunction( 'is_currency_on', array( $this, 'is_currency_on' ) ),
|
43 |
new Twig_SimpleFunction( 'get_language_currency', array( $this, 'get_language_currency' ) ),
|
227 |
return $this->sitepress->get_flag_url( $code );
|
228 |
}
|
229 |
|
230 |
+
/**
|
231 |
+
* @param string $currency
|
232 |
+
* @param string $language
|
233 |
+
*
|
234 |
+
* @return bool
|
235 |
+
*/
|
236 |
+
public function is_currency_on( $currency, $language ) {
|
237 |
+
return isset( $this->woocommerce_wpml->settings['currency_options'][ $currency ]['languages'][ $language ] )
|
238 |
+
&& (bool) $this->woocommerce_wpml->settings['currency_options'][ $currency ]['languages'][ $language ];
|
239 |
+
}
|
240 |
|
241 |
public function get_language_currency( $language ) {
|
242 |
return $this->woocommerce_wpml->settings['default_currencies'][ $language ];
|
inc/template-classes/setup/class-wcml-setup-attributes-ui.php
CHANGED
@@ -5,13 +5,20 @@ class WCML_Setup_Attributes_UI extends WCML_Templates_Factory {
|
|
5 |
private $woocommerce_wpml;
|
6 |
private $next_step_url;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
public function get_model(){
|
17 |
|
5 |
private $woocommerce_wpml;
|
6 |
private $next_step_url;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_Setup_Attributes_UI constructor.
|
10 |
+
*
|
11 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
12 |
+
* @param string $next_step_url
|
13 |
+
*/
|
14 |
+
public function __construct( $woocommerce_wpml, $next_step_url ) {
|
15 |
+
// @todo Cover by tests, required for wcml-3037.
|
16 |
+
|
17 |
+
parent::__construct();
|
18 |
+
|
19 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
+
$this->next_step_url = $next_step_url;
|
21 |
+
}
|
22 |
|
23 |
public function get_model(){
|
24 |
|
inc/template-classes/setup/class-wcml-setup-multi-currency-ui.php
CHANGED
@@ -5,13 +5,20 @@ class WCML_Setup_Multi_Currency_UI extends WCML_Templates_Factory {
|
|
5 |
private $woocommerce_wpml;
|
6 |
private $next_step_url;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
public function get_model(){
|
17 |
|
5 |
private $woocommerce_wpml;
|
6 |
private $next_step_url;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_Setup_Multi_Currency_UI constructor.
|
10 |
+
*
|
11 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
12 |
+
* @param string $next_step_url
|
13 |
+
*/
|
14 |
+
function __construct( $woocommerce_wpml, $next_step_url ) {
|
15 |
+
// @todo Cover by tests, required for wcml-3037.
|
16 |
+
|
17 |
+
parent::__construct();
|
18 |
+
|
19 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
+
$this->next_step_url = $next_step_url;
|
21 |
+
}
|
22 |
|
23 |
public function get_model(){
|
24 |
|
inc/template-classes/setup/class-wcml-setup-ready-ui.php
CHANGED
@@ -4,12 +4,18 @@ class WCML_Setup_Ready_UI extends WCML_Templates_Factory {
|
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
public function get_model(){
|
15 |
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
+
/**
|
8 |
+
* WCML_Setup_Ready_UI constructor.
|
9 |
+
*
|
10 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
11 |
+
*/
|
12 |
+
public function __construct( $woocommerce_wpml ) {
|
13 |
+
// @todo Cover by tests, required for wcml-3037.
|
14 |
+
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
18 |
+
}
|
19 |
|
20 |
public function get_model(){
|
21 |
|
inc/template-classes/setup/class-wcml-setup-store-pages-ui.php
CHANGED
@@ -6,14 +6,22 @@ class WCML_Setup_Store_Pages_UI extends WCML_Templates_Factory {
|
|
6 |
private $sitepress;
|
7 |
private $next_step_url;
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
$
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
public function get_model(){
|
19 |
|
6 |
private $sitepress;
|
7 |
private $next_step_url;
|
8 |
|
9 |
+
/**
|
10 |
+
* WCML_Setup_Store_Pages_UI constructor.
|
11 |
+
*
|
12 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
13 |
+
* @param SitePress $sitepress
|
14 |
+
* @param string $next_step_url
|
15 |
+
*/
|
16 |
+
public function __construct( $woocommerce_wpml, $sitepress, $next_step_url ) {
|
17 |
+
// @todo Cover by tests, required for wcml-3037.
|
18 |
+
|
19 |
+
parent::__construct();
|
20 |
+
|
21 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
+
$this->sitepress = $sitepress;
|
23 |
+
$this->next_step_url = $next_step_url;
|
24 |
+
}
|
25 |
|
26 |
public function get_model(){
|
27 |
|
inc/template-classes/setup/class-wcml-setup-translation-options-ui.php
CHANGED
@@ -18,7 +18,9 @@ class WCML_Setup_Translation_Options_UI extends WCML_Templates_Factory {
|
|
18 |
$custom_posts_unlocked = apply_filters( 'wpml_get_setting', false, 'custom_posts_unlocked_option' );
|
19 |
$custom_posts_sync = apply_filters( 'wpml_get_setting', false, 'custom_posts_sync_option' );
|
20 |
|
21 |
-
$is_display_as_translated_checked =
|
|
|
|
|
22 |
|
23 |
$model = array(
|
24 |
'strings' => array(
|
18 |
$custom_posts_unlocked = apply_filters( 'wpml_get_setting', false, 'custom_posts_unlocked_option' );
|
19 |
$custom_posts_sync = apply_filters( 'wpml_get_setting', false, 'custom_posts_sync_option' );
|
20 |
|
21 |
+
$is_display_as_translated_checked = isset( $custom_posts_unlocked['product'], $custom_posts_sync['product'] )
|
22 |
+
&& 1 === $custom_posts_unlocked['product']
|
23 |
+
&& WPML_CONTENT_TYPE_DISPLAY_AS_IF_TRANSLATED === $custom_posts_sync['product'];
|
24 |
|
25 |
$model = array(
|
26 |
'strings' => array(
|
inc/template-classes/status/class-wcml-status-config-warnings-ui.php
CHANGED
@@ -8,14 +8,22 @@ class WCML_Status_Config_Warnings_UI extends WCML_Templates_Factory {
|
|
8 |
private $sitepress;
|
9 |
private $sitepress_settings;
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
public function init_twig_functions() {
|
21 |
$function = new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) );
|
8 |
private $sitepress;
|
9 |
private $sitepress_settings;
|
10 |
|
11 |
+
/**
|
12 |
+
* WCML_Status_Config_Warnings_UI constructor.
|
13 |
+
*
|
14 |
+
* @param SitePress $sitepress
|
15 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
16 |
+
* @param array $sitepress_settings
|
17 |
+
*/
|
18 |
+
public function __construct( $sitepress, $woocommerce_wpml, $sitepress_settings ) {
|
19 |
+
// @todo Cover by tests, required for wcml-3037.
|
20 |
+
|
21 |
+
parent::__construct();
|
22 |
+
|
23 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
+
$this->sitepress = $sitepress;
|
25 |
+
$this->sitepress_settings = $sitepress_settings;
|
26 |
+
}
|
27 |
|
28 |
public function init_twig_functions() {
|
29 |
$function = new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) );
|
inc/template-classes/status/class-wcml-status-multi-currencies-ui.php
CHANGED
@@ -4,11 +4,18 @@ class WCML_Status_Multi_Currencies_UI extends WCML_Templates_Factory {
|
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
public function get_model() {
|
14 |
|
4 |
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
+
/**
|
8 |
+
* WCML_Status_Multi_Currencies_UI constructor.
|
9 |
+
*
|
10 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
11 |
+
*/
|
12 |
+
public function __construct( $woocommerce_wpml ) {
|
13 |
+
// @todo Cover by tests, required for wcml-3037.
|
14 |
+
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
18 |
+
}
|
19 |
|
20 |
public function get_model() {
|
21 |
|
inc/template-classes/status/class-wcml-status-products-ui.php
CHANGED
@@ -5,12 +5,18 @@ class WCML_Status_Products_UI extends WCML_Templates_Factory {
|
|
5 |
private $woocommerce_wpml;
|
6 |
private $sitepress;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
public function get_model() {
|
16 |
|
5 |
private $woocommerce_wpml;
|
6 |
private $sitepress;
|
7 |
|
8 |
+
/**
|
9 |
+
* WCML_Status_Products_UI constructor.
|
10 |
+
*
|
11 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
12 |
+
* @param SitePress $sitepress
|
13 |
+
*/
|
14 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
18 |
+
$this->sitepress = $sitepress;
|
19 |
+
}
|
20 |
|
21 |
public function get_model() {
|
22 |
|
inc/template-classes/status/class-wcml-status-status-ui.php
CHANGED
@@ -4,11 +4,18 @@ class WCML_Status_Status_UI extends WCML_Templates_Factory {
|
|
4 |
|
5 |
private $sitepress;
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
public function get_model() {
|
14 |
|
4 |
|
5 |
private $sitepress;
|
6 |
|
7 |
+
/**
|
8 |
+
* WCML_Status_Status_UI constructor.
|
9 |
+
*
|
10 |
+
* @param SitePress $sitepress
|
11 |
+
*/
|
12 |
+
public function __construct( $sitepress ) {
|
13 |
+
// @todo Cover by tests, required for wcml-3037.
|
14 |
+
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
$this->sitepress = $sitepress;
|
18 |
+
}
|
19 |
|
20 |
public function get_model() {
|
21 |
|
inc/template-classes/status/class-wcml-status-store-pages-ui.php
CHANGED
@@ -7,13 +7,20 @@ class WCML_Status_Store_Pages_UI extends WCML_Templates_Factory {
|
|
7 |
private $woocommerce_wpml;
|
8 |
private $sitepress;
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
$this->sitepress = $sitepress;
|
15 |
|
16 |
-
|
|
|
|
|
17 |
|
18 |
public function init_twig_functions() {
|
19 |
$function = new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) );
|
7 |
private $woocommerce_wpml;
|
8 |
private $sitepress;
|
9 |
|
10 |
+
/**
|
11 |
+
* WCML_Status_Store_Pages_UI constructor.
|
12 |
+
*
|
13 |
+
* @param SitePress $sitepress
|
14 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
15 |
+
*/
|
16 |
+
public function __construct( $sitepress, $woocommerce_wpml ) {
|
17 |
+
// @todo Cover by tests, required for wcml-3037.
|
18 |
|
19 |
+
parent::__construct();
|
|
|
20 |
|
21 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
+
$this->sitepress = $sitepress;
|
23 |
+
}
|
24 |
|
25 |
public function init_twig_functions() {
|
26 |
$function = new Twig_SimpleFunction( 'get_flag_url', array( $this, 'get_flag_url' ) );
|
inc/template-classes/status/class-wcml-status-ui.php
CHANGED
@@ -10,13 +10,19 @@ class WCML_Status_UI extends WCML_Templates_Factory {
|
|
10 |
private $sitepress_settings;
|
11 |
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
parent::__construct();
|
15 |
|
16 |
-
$this->woocommerce_wpml
|
17 |
-
$this->sitepress
|
18 |
$this->sitepress_settings = $sitepress_settings;
|
19 |
-
|
20 |
}
|
21 |
|
22 |
public function get_model() {
|
10 |
private $sitepress_settings;
|
11 |
|
12 |
|
13 |
+
/**
|
14 |
+
* WCML_Status_UI constructor.
|
15 |
+
*
|
16 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
17 |
+
* @param SitePress $sitepress
|
18 |
+
* @param array $sitepress_settings
|
19 |
+
*/
|
20 |
+
public function __construct( $woocommerce_wpml, $sitepress, $sitepress_settings ) {
|
21 |
parent::__construct();
|
22 |
|
23 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
+
$this->sitepress = $sitepress;
|
25 |
$this->sitepress_settings = $sitepress_settings;
|
|
|
26 |
}
|
27 |
|
28 |
public function get_model() {
|
inc/template-classes/store-urls/class-wcml-store-urls-edit-base-ui.php
CHANGED
@@ -11,14 +11,23 @@ class WCML_Store_URLs_Edit_Base_UI extends WCML_Templates_Factory {
|
|
11 |
private $sitepress;
|
12 |
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
parent::__construct();
|
16 |
|
17 |
-
$this->base
|
18 |
-
$this->language
|
19 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
-
$this->sitepress
|
21 |
-
|
22 |
}
|
23 |
|
24 |
public function get_model() {
|
11 |
private $sitepress;
|
12 |
|
13 |
|
14 |
+
/**
|
15 |
+
* WCML_Store_URLs_Edit_Base_UI constructor.
|
16 |
+
*
|
17 |
+
* @param string $base
|
18 |
+
* @param string $language
|
19 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
20 |
+
* @param SitePress $sitepress
|
21 |
+
*/
|
22 |
+
public function __construct( $base, $language, $woocommerce_wpml, $sitepress ) {
|
23 |
+
// @todo Cover by tests, required for wcml-3037.
|
24 |
+
|
25 |
parent::__construct();
|
26 |
|
27 |
+
$this->base = $base;
|
28 |
+
$this->language = $language;
|
29 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
30 |
+
$this->sitepress = $sitepress;
|
|
|
31 |
}
|
32 |
|
33 |
public function get_model() {
|
inc/template-classes/store-urls/class-wcml-store-urls-translation-statuses-ui.php
CHANGED
@@ -14,15 +14,25 @@ class WCML_Store_URLs_Translation_Statuses_UI extends WCML_Templates_Factory {
|
|
14 |
private $sitepress;
|
15 |
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
parent::__construct();
|
19 |
|
20 |
-
$this->base
|
21 |
$this->active_languages = $active_languages;
|
22 |
-
$this->value
|
23 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
-
$this->sitepress
|
25 |
-
|
26 |
}
|
27 |
|
28 |
public function init_twig_functions() {
|
14 |
private $sitepress;
|
15 |
|
16 |
|
17 |
+
/**
|
18 |
+
* WCML_Store_URLs_Translation_Statuses_UI constructor.
|
19 |
+
*
|
20 |
+
* @param string $base
|
21 |
+
* @param array $active_languages
|
22 |
+
* @param bool $value
|
23 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
24 |
+
* @param SitePress $sitepress
|
25 |
+
*/
|
26 |
+
public function __construct( $base, $active_languages, $value, $woocommerce_wpml, $sitepress ) {
|
27 |
+
// @todo Cover by tests, required for wcml-3037.
|
28 |
+
|
29 |
parent::__construct();
|
30 |
|
31 |
+
$this->base = $base;
|
32 |
$this->active_languages = $active_languages;
|
33 |
+
$this->value = $value;
|
34 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
35 |
+
$this->sitepress = $sitepress;
|
|
|
36 |
}
|
37 |
|
38 |
public function init_twig_functions() {
|
inc/template-classes/store-urls/class-wcml-store-urls-ui.php
CHANGED
@@ -9,11 +9,17 @@ class WCML_Store_URLs_UI extends WCML_Templates_Factory {
|
|
9 |
private $sitepress;
|
10 |
private $active_languages;
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
parent::__construct();
|
14 |
|
15 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
16 |
-
$this->sitepress
|
17 |
$this->active_languages = $this->sitepress->get_active_languages();
|
18 |
}
|
19 |
|
9 |
private $sitepress;
|
10 |
private $active_languages;
|
11 |
|
12 |
+
/**
|
13 |
+
* WCML_Store_URLs_UI constructor.
|
14 |
+
*
|
15 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
16 |
+
* @param SitePress $sitepress
|
17 |
+
*/
|
18 |
+
public function __construct( $woocommerce_wpml, $sitepress ) {
|
19 |
parent::__construct();
|
20 |
|
21 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
+
$this->sitepress = $sitepress;
|
23 |
$this->active_languages = $this->sitepress->get_active_languages();
|
24 |
}
|
25 |
|
inc/translation-editor/class-wcml-editor-ui-product-job.php
CHANGED
@@ -23,13 +23,22 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
|
|
23 |
private $not_display_fields_for_variables_product;
|
24 |
private $not_display_custom_fields_for_product;
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
global $iclTranslationManagement;
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
$this->not_display_fields_for_variables_product = array( '_purchase_note', '_regular_price', '_sale_price',
|
34 |
'_price', '_min_variation_price', '_max_variation_price',
|
35 |
'_min_variation_regular_price', '_max_variation_regular_price',
|
@@ -437,8 +446,8 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
|
|
437 |
|
438 |
$trn_attribute = $this->woocommerce_wpml->attributes->get_custom_attribute_translation( $this->product_id, $attr_key, $attribute, $this->get_target_language() );
|
439 |
|
440 |
-
|
441 |
-
|
442 |
}
|
443 |
}
|
444 |
|
@@ -498,6 +507,16 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
|
|
498 |
return $element_data;
|
499 |
}
|
500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
public function add_taxonomies_to_element_data( $element_data ){
|
502 |
|
503 |
$taxonomies = get_object_taxonomies( 'product', 'objects' );
|
@@ -601,13 +620,6 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
|
|
601 |
$tr_product_id = apply_filters( 'translate_object_id', $this->product_id, 'product', false, $this->get_target_language() );
|
602 |
|
603 |
new WCML_Editor_Save_Filters( $product_trid, $this->get_target_language() );
|
604 |
-
if ( get_magic_quotes_gpc() ) {
|
605 |
-
foreach ( $translations as $key => $data_item ) {
|
606 |
-
if ( !is_array( $data_item ) ) {
|
607 |
-
$translations[$key] = stripslashes( $data_item );
|
608 |
-
}
|
609 |
-
}
|
610 |
-
}
|
611 |
|
612 |
if ( null === $tr_product_id ) {
|
613 |
|
23 |
private $not_display_fields_for_variables_product;
|
24 |
private $not_display_custom_fields_for_product;
|
25 |
|
26 |
+
/**
|
27 |
+
* WCML_Editor_UI_Product_Job constructor.
|
28 |
+
*
|
29 |
+
* @param array $job_details
|
30 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
31 |
+
* @param SitePress $sitepress
|
32 |
+
* @param wpdb $wpdb
|
33 |
+
*/
|
34 |
+
public function __construct( $job_details, $woocommerce_wpml, $sitepress, $wpdb ) {
|
35 |
global $iclTranslationManagement;
|
36 |
|
37 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
38 |
+
$this->sitepress = $sitepress;
|
39 |
+
$this->tm_instance = $iclTranslationManagement;
|
40 |
+
$this->wpdb = $wpdb;
|
41 |
+
|
42 |
$this->not_display_fields_for_variables_product = array( '_purchase_note', '_regular_price', '_sale_price',
|
43 |
'_price', '_min_variation_price', '_max_variation_price',
|
44 |
'_min_variation_regular_price', '_max_variation_regular_price',
|
446 |
|
447 |
$trn_attribute = $this->woocommerce_wpml->attributes->get_custom_attribute_translation( $this->product_id, $attr_key, $attribute, $this->get_target_language() );
|
448 |
|
449 |
+
$element_data[ $attr_key . '_name' ]['translation'] = $this->get_array_item( $trn_attribute, 'name' );
|
450 |
+
$element_data[ $attr_key ]['translation'] = $this->get_array_item( $trn_attribute, 'value' );
|
451 |
}
|
452 |
}
|
453 |
|
507 |
return $element_data;
|
508 |
}
|
509 |
|
510 |
+
/**
|
511 |
+
* @param array $array
|
512 |
+
* @param string $key
|
513 |
+
*
|
514 |
+
* @return string
|
515 |
+
*/
|
516 |
+
private function get_array_item( $array, $key ) {
|
517 |
+
return isset( $array[ $key ] ) && $array[ $key ] ? $array[ $key ] : '';
|
518 |
+
}
|
519 |
+
|
520 |
public function add_taxonomies_to_element_data( $element_data ){
|
521 |
|
522 |
$taxonomies = get_object_taxonomies( 'product', 'objects' );
|
620 |
$tr_product_id = apply_filters( 'translate_object_id', $this->product_id, 'product', false, $this->get_target_language() );
|
621 |
|
622 |
new WCML_Editor_Save_Filters( $product_trid, $this->get_target_language() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
|
624 |
if ( null === $tr_product_id ) {
|
625 |
|
inc/translation-editor/class-wcml-page-builders.php
CHANGED
@@ -7,9 +7,13 @@ class WCML_Page_Builders {
|
|
7 |
*/
|
8 |
private $sitepress;
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
$this->sitepress = $sitepress;
|
12 |
-
|
13 |
}
|
14 |
|
15 |
public function get_page_builders_string_packages( $product_id ) {
|
7 |
*/
|
8 |
private $sitepress;
|
9 |
|
10 |
+
/**
|
11 |
+
* WCML_Page_Builders constructor.
|
12 |
+
*
|
13 |
+
* @param SitePress $sitepress
|
14 |
+
*/
|
15 |
+
public function __construct( $sitepress ) {
|
16 |
$this->sitepress = $sitepress;
|
|
|
17 |
}
|
18 |
|
19 |
public function get_page_builders_string_packages( $product_id ) {
|
inc/translation-editor/class-wcml-wc-admin-duplicate-product.php
CHANGED
@@ -11,16 +11,22 @@ class WCML_WC_Admin_Duplicate_Product{
|
|
11 |
*/
|
12 |
private $sitepress;
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
$duplicated_products = array();
|
25 |
|
26 |
$product_id = $post->get_id();
|
11 |
*/
|
12 |
private $sitepress;
|
13 |
|
14 |
+
/**
|
15 |
+
* WCML_WC_Admin_Duplicate_Product constructor.
|
16 |
+
*
|
17 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
18 |
+
* @param SitePress $sitepress
|
19 |
+
* @param wpdb $wpdb
|
20 |
+
*/
|
21 |
+
public function __construct( $woocommerce_wpml, $sitepress, $wpdb ) {
|
22 |
+
$this->woocommerce_wpml = $woocommerce_wpml;
|
23 |
+
$this->sitepress = $sitepress;
|
24 |
+
$this->wpdb = $wpdb;
|
25 |
|
26 |
+
add_action( 'woocommerce_product_duplicate', [ $this, 'woocommerce_duplicate_product' ], 10, 2 );
|
27 |
+
}
|
28 |
|
29 |
+
public function woocommerce_duplicate_product( $new_id, $post ){
|
30 |
$duplicated_products = array();
|
31 |
|
32 |
$product_id = $post->get_id();
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
|
|
5 |
License: GPLv2
|
6 |
Requires at least: 4.7
|
7 |
Tested up to: 5.3
|
8 |
-
Stable tag: 4.7.
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
@@ -137,30 +137,18 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
|
|
137 |
|
138 |
== Changelog ==
|
139 |
|
140 |
-
= 4.7.
|
141 |
-
*
|
142 |
-
*
|
143 |
-
*
|
144 |
-
* Fixed
|
145 |
-
* Fixed
|
146 |
-
* Fixed
|
147 |
-
* Fixed
|
148 |
-
*
|
149 |
-
* Fixed
|
150 |
-
* Fixed
|
151 |
-
*
|
152 |
-
* Fixed not duplicated variation description while duplicating variable product to another language.
|
153 |
-
* Fixed not matched variation on translated variable product page when "Translatable - use translation if available or fallback to default language" mode enabled for products and global attribute terms are translated.
|
154 |
-
* Fixed overlapping columns on WooCommerce Order Statuses table.
|
155 |
-
* WooCommerce Bookings compatibility - fixed availability count duplication while updating original product and bookings were made in the second language.
|
156 |
-
* wcml_client_currency hook not applied in some cases
|
157 |
-
* Fixed variation product title modifying after switching language on cart page in specific situations.
|
158 |
-
* Fixed mixed strings language on variable product admin edit page in not admin language.
|
159 |
-
* Fixed performance when a large number of shipping methods are defined.
|
160 |
-
* Long query to get currencies removed from WCML to optimise performance.
|
161 |
-
* Fixed cart total shipping converted twice when enabled custom settings for gateways and use not default currency as a currency for gateway.
|
162 |
-
* Fixed converted product price when using custom gateway settings for second currency.
|
163 |
-
* Fixed notice while importing xliff translations with custom attributes in some specific cases.
|
164 |
|
165 |
= 4.7.0 =
|
166 |
* Replaced some Twig templates with pure PHP templates as the first step towards the removal of Twig dependencies.
|
5 |
License: GPLv2
|
6 |
Requires at least: 4.7
|
7 |
Tested up to: 5.3
|
8 |
+
Stable tag: 4.7.6
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
137 |
|
138 |
== Changelog ==
|
139 |
|
140 |
+
= 4.7.6 =
|
141 |
+
* Fix php warning in WCML custom prices module.
|
142 |
+
* Fixed unable to add variation to cart for products with more than 30 variations.
|
143 |
+
* Remove legacy code for downloading the language pack.
|
144 |
+
* Fixed string translation while adding "sold individual" product more than ones from second language.
|
145 |
+
* Fixed notices thrown with php 7.4 with multi-currency.
|
146 |
+
* Fixed notices thrown with php 7.4 when using multi-currency.
|
147 |
+
* Fixed notices thrown with php 7.4 when using WCML with WC Variation Swatches and Photos.
|
148 |
+
* Fixed deprecation notices (`Function get_magic_quotes_gpc() is deprecated`) when running PHP 7.4.
|
149 |
+
* Fixed a few fatal errors thrown when running PHP 7.4 (e.g. `Fatal error: Uncaught Error: Call to a member function get_setting() on null`) and caused by legacy code passing objects by reference.
|
150 |
+
* Fixed language for "Low Stock" and "No Stock" admin emails.
|
151 |
+
* Fixed not converted pre-selected price widget prices when switching currency.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
= 4.7.0 =
|
154 |
* Replaced some Twig templates with pure PHP templates as the first step towards the removal of Twig dependencies.
|
res/js/wcml-multi-currency.js
CHANGED
@@ -28,13 +28,14 @@ function wcml_load_currency( currency, force_switch ){
|
|
28 |
data : {
|
29 |
action: 'wcml_switch_currency',
|
30 |
currency : currency,
|
31 |
-
force_switch: force_switch
|
|
|
32 |
},
|
33 |
success: function(response) {
|
34 |
if(typeof response.error !== 'undefined') {
|
35 |
alert(response.error);
|
36 |
-
}else if( typeof response.prevent_switching !== 'undefined' ){
|
37 |
-
jQuery('body').append( response.prevent_switching );
|
38 |
}else{
|
39 |
|
40 |
var target_location = window.location.href;
|
@@ -54,8 +55,23 @@ function wcml_load_currency( currency, force_switch ){
|
|
54 |
|
55 |
wcml_reset_cart_fragments();
|
56 |
|
|
|
|
|
57 |
window.location = target_location;
|
58 |
}
|
59 |
}
|
60 |
});
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
data : {
|
29 |
action: 'wcml_switch_currency',
|
30 |
currency : currency,
|
31 |
+
force_switch: force_switch,
|
32 |
+
params: window.location.search.substr(1)
|
33 |
},
|
34 |
success: function(response) {
|
35 |
if(typeof response.error !== 'undefined') {
|
36 |
alert(response.error);
|
37 |
+
}else if( typeof response.data.prevent_switching !== 'undefined' ){
|
38 |
+
jQuery('body').append( response.data.prevent_switching );
|
39 |
}else{
|
40 |
|
41 |
var target_location = window.location.href;
|
55 |
|
56 |
wcml_reset_cart_fragments();
|
57 |
|
58 |
+
target_location = wcml_maybe_adjust_widget_price( target_location, response.data );
|
59 |
+
|
60 |
window.location = target_location;
|
61 |
}
|
62 |
}
|
63 |
});
|
64 |
}
|
65 |
+
|
66 |
+
function wcml_maybe_adjust_widget_price(target_location, response) {
|
67 |
+
|
68 |
+
if (typeof response.min_price !== 'undefined') {
|
69 |
+
target_location = target_location.replace(/(min_price=)(\d+)/, "$1" + response.min_price);
|
70 |
+
}
|
71 |
+
|
72 |
+
if (typeof response.max_price !== 'undefined') {
|
73 |
+
target_location = target_location.replace(/(max_price=)(\d+)/, "$1" + response.max_price);
|
74 |
+
}
|
75 |
+
|
76 |
+
return target_location;
|
77 |
+
}
|
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("#")||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}}})}
|
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,params:window.location.search.substr(1)},success:function(response){if(typeof response.error!=="undefined"){alert(response.error)}else if(typeof response.data.prevent_switching!=="undefined"){jQuery("body").append(response.data.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();target_location=wcml_maybe_adjust_widget_price(target_location,response.data);window.location=target_location}}})}function wcml_maybe_adjust_widget_price(target_location,response){if(typeof response.min_price!=="undefined"){target_location=target_location.replace(/(min_price=)(\d+)/,"$1"+response.min_price)}if(typeof response.max_price!=="undefined"){target_location=target_location.replace(/(max_price=)(\d+)/,"$1"+response.max_price)}return target_location}
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit1c06ba8112cf30696ed81802be9382a7::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit5ac08f95a41ac99faca9cacc98fc9fc3
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
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\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit5ac08f95a41ac99faca9cacc98fc9fc3
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit1c06ba8112cf30696ed81802be9382a7
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit1c06ba8112cf30696ed81802be9382a7', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit1c06ba8112cf30696ed81802be9382a7', '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\ComposerStaticInit1c06ba8112cf30696ed81802be9382a7::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit1c06ba8112cf30696ed81802be9382a7::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire1c06ba8112cf30696ed81802be9382a7($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire1c06ba8112cf30696ed81802be9382a7($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'b45b351e6b6f7487d819961fef2fda77' => __DIR__ . '/..' . '/jakeasmith/http_build_url/src/http_build_url.php',
|
@@ -238,9 +238,9 @@ class ComposerStaticInit5ac08f95a41ac99faca9cacc98fc9fc3
|
|
238 |
public static function getInitializer(ClassLoader $loader)
|
239 |
{
|
240 |
return \Closure::bind(function () use ($loader) {
|
241 |
-
$loader->prefixLengthsPsr4 =
|
242 |
-
$loader->prefixDirsPsr4 =
|
243 |
-
$loader->classMap =
|
244 |
|
245 |
}, null, ClassLoader::class);
|
246 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit1c06ba8112cf30696ed81802be9382a7
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'b45b351e6b6f7487d819961fef2fda77' => __DIR__ . '/..' . '/jakeasmith/http_build_url/src/http_build_url.php',
|
238 |
public static function getInitializer(ClassLoader $loader)
|
239 |
{
|
240 |
return \Closure::bind(function () use ($loader) {
|
241 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit1c06ba8112cf30696ed81802be9382a7::$prefixLengthsPsr4;
|
242 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit1c06ba8112cf30696ed81802be9382a7::$prefixDirsPsr4;
|
243 |
+
$loader->classMap = ComposerStaticInit1c06ba8112cf30696ed81802be9382a7::$classMap;
|
244 |
|
245 |
}, null, ClassLoader::class);
|
246 |
}
|
vendor/otgs/installer/includes/class-otgs-installer-plugin-finder.php
CHANGED
@@ -47,6 +47,7 @@ class OTGS_Installer_Plugin_Finder {
|
|
47 |
'repo' => $repo_key,
|
48 |
'id' => $plugin_id,
|
49 |
'channel' => $plugin['channel'],
|
|
|
50 |
) );
|
51 |
}
|
52 |
}
|
47 |
'repo' => $repo_key,
|
48 |
'id' => $plugin_id,
|
49 |
'channel' => $plugin['channel'],
|
50 |
+
'tested' => isset( $plugin['tested'] ) ? $plugin['tested'] : null,
|
51 |
) );
|
52 |
}
|
53 |
}
|
vendor/otgs/installer/includes/class-otgs-installer-plugin.php
CHANGED
@@ -18,6 +18,7 @@ class OTGS_Installer_Plugin {
|
|
18 |
private $id;
|
19 |
private $installed_version;
|
20 |
private $channel;
|
|
|
21 |
|
22 |
public function __construct( array $params = array() ) {
|
23 |
foreach ( get_object_vars( $this ) as $property => $value ) {
|
@@ -132,6 +133,13 @@ class OTGS_Installer_Plugin {
|
|
132 |
return $this->channel;
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
/**
|
136 |
* @return string
|
137 |
*/
|
18 |
private $id;
|
19 |
private $installed_version;
|
20 |
private $channel;
|
21 |
+
private $tested;
|
22 |
|
23 |
public function __construct( array $params = array() ) {
|
24 |
foreach ( get_object_vars( $this ) as $property => $value ) {
|
133 |
return $this->channel;
|
134 |
}
|
135 |
|
136 |
+
/**
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function get_tested() {
|
140 |
+
return $this->tested;
|
141 |
+
}
|
142 |
+
|
143 |
/**
|
144 |
* @return string
|
145 |
*/
|
vendor/otgs/installer/includes/upgrade/class-otgs-installer-upgrade-response.php
CHANGED
@@ -54,6 +54,7 @@ class OTGS_Installer_Upgrade_Response {
|
|
54 |
$response->new_version = $plugin->get_version();
|
55 |
$response->upgrade_notice = '';
|
56 |
$response->url = $plugin->get_url();
|
|
|
57 |
|
58 |
if ( $subscription->get_site_key() ) {
|
59 |
$response->package = $this->append_site_key_to_download_url(
|
@@ -125,16 +126,6 @@ class OTGS_Installer_Upgrade_Response {
|
|
125 |
|
126 |
$url_params['site_key'] = $key;
|
127 |
$url_params['site_url'] = $site_url;
|
128 |
-
$package_source = $this->source_factory->create()->get();
|
129 |
-
|
130 |
-
// Add extra parameters for custom Installer packages
|
131 |
-
if ( $package_source ) {
|
132 |
-
$extra = $this->get_extra_url_parameters( $package_source );
|
133 |
-
if ( ! empty( $extra['repository'] ) && $extra['repository'] == $repository_id ) {
|
134 |
-
unset( $extra['repository'] );
|
135 |
-
$url_params = array_merge( $url_params, $extra );
|
136 |
-
}
|
137 |
-
}
|
138 |
|
139 |
$url = add_query_arg( $url_params, $url );
|
140 |
|
@@ -146,7 +137,6 @@ class OTGS_Installer_Upgrade_Response {
|
|
146 |
}
|
147 |
|
148 |
return $url;
|
149 |
-
|
150 |
}
|
151 |
|
152 |
private function get_extra_url_parameters( $source ) {
|
54 |
$response->new_version = $plugin->get_version();
|
55 |
$response->upgrade_notice = '';
|
56 |
$response->url = $plugin->get_url();
|
57 |
+
$response->tested = $plugin->get_tested();
|
58 |
|
59 |
if ( $subscription->get_site_key() ) {
|
60 |
$response->package = $this->append_site_key_to_download_url(
|
126 |
|
127 |
$url_params['site_key'] = $key;
|
128 |
$url_params['site_url'] = $site_url;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
$url = add_query_arg( $url_params, $url );
|
131 |
|
137 |
}
|
138 |
|
139 |
return $url;
|
|
|
140 |
}
|
141 |
|
142 |
private function get_extra_url_parameters( $source ) {
|
vendor/otgs/installer/loader.php
CHANGED
@@ -51,7 +51,7 @@ $wp_installer_instance = dirname( __FILE__ ) . '/installer.php';
|
|
51 |
global $wp_installer_instances;
|
52 |
$wp_installer_instances[ $wp_installer_instance ] = array(
|
53 |
'bootfile' => $wp_installer_instance,
|
54 |
-
'version' => '2.2.
|
55 |
);
|
56 |
|
57 |
|
51 |
global $wp_installer_instances;
|
52 |
$wp_installer_instances[ $wp_installer_instance ] = array(
|
53 |
'bootfile' => $wp_installer_instance,
|
54 |
+
'version' => '2.2.3'
|
55 |
);
|
56 |
|
57 |
|
wpml-woocommerce.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* Text Domain: woocommerce-multilingual
|
9 |
* Requires at least: 4.7
|
10 |
* Tested up to: 5.3
|
11 |
-
* Version: 4.7.
|
12 |
* Plugin Slug: woocommerce-multilingual
|
13 |
* WC requires at least: 3.3.0
|
14 |
* WC tested up to: 3.8.0
|
@@ -33,7 +33,7 @@ if ( ! $wpml_php_version_check->is_ok() ) {
|
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
-
define( 'WCML_VERSION', '4.7.
|
37 |
define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
|
38 |
define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
|
39 |
define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
|
8 |
* Text Domain: woocommerce-multilingual
|
9 |
* Requires at least: 4.7
|
10 |
* Tested up to: 5.3
|
11 |
+
* Version: 4.7.6
|
12 |
* Plugin Slug: woocommerce-multilingual
|
13 |
* WC requires at least: 3.3.0
|
14 |
* WC tested up to: 3.8.0
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
define( 'WCML_VERSION', '4.7.6' );
|
37 |
define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
|
38 |
define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
|
39 |
define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
|