Version Description
- Fix compatibility issues with PHP 7.1
- Fix issue with product slug when using language per domain in WPML
- Removed notice when set domain per language in WPML
- WooCommerce Bookings: Added support to translate booking emails
- Removed warning from translation editor when set display as translated
- Added compatibility for unsupported WooCommerce themes
- Removed some custom WPML taxonomies from plugin's Dashboard
- Fix an error with product variations which you cannot add them in cart if display as translated feature is used
- WooCommerce Composite Products: Fix Default option sync when using component option category
- WooCommerce Subscriptions: Fix Sign-up fee recalculation cost in some situations
- Theme Storefront: Fix Cart widget currency symbol not switched after switching currency
- Siteground Optimizer: Fix an issue with currency switcher
- Wrong price when manually adding product to an order with multicurrency enabled
- WooCommerce Bookings : Fix Block cost recalculation in second currency
- Added filter for oder_item_quantity
- Fix issue in endpoints when set My Account as homepage
- WooCommerce Dynamic Pricing: Fix Order total rules by category
Download this release
Release Info
Developer | sergey.r |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 4.2.10 |
Comparing to | |
See all releases |
Code changes from version 4.2.9 to 4.2.10
- changelog/4.2.10.md +18 -0
- classes/shortcodes/class-wcml-wc-shortcode-product-category.php +1 -1
- compatibility/class-wcml-bookings.php +172 -29
- compatibility/class-wcml-composite-products.php +8 -14
- compatibility/class-wcml-dynamic-pricing.php +1 -1
- compatibility/class-wcml-product-bundles.php +18 -13
- compatibility/class-wcml-relevanssi.php +17 -0
- compatibility/class-wcml-wc-subscriptions.php +5 -2
- inc/class-wcml-ajax-setup.php +2 -1
- inc/class-wcml-attributes.php +3 -1
- inc/class-wcml-cart-sync-warnings.php +2 -1
- inc/class-wcml-compatibility.php +8 -2
- inc/class-wcml-coupons.php +1 -1
- inc/class-wcml-emails.php +80 -57
- inc/class-wcml-endpoints.php +32 -2
- inc/class-wcml-resources.php +1 -3
- inc/class-wcml-store-pages.php +3 -1
- inc/class-wcml-terms.php +1 -1
- inc/class-wcml-upgrade.php +24 -1
- inc/class-wcml-url-translation.php +1 -1
- inc/class-wcml-wc-strings.php +1 -1
- inc/class-woocommerce-wpml.php +1 -1
- inc/currencies/class-wcml-multi-currency-orders.php +50 -25
- inc/currencies/class-wcml-multi-currency-resources.php +14 -2
- inc/template-classes/class-wcml-custom-taxonomy-translation-ui.php +2 -1
- inc/template-classes/class-wcml-menus-wrap.php +1 -1
- inc/translation-editor/class-wcml-synchronize-product-data.php +2 -0
- inc/translation-editor/class-wcml-synchronize-variations-data.php +7 -3
- readme.txt +21 -2
- res/js/cart_widget.js +11 -11
- res/js/cart_widget.min.js +1 -1
- res/js/multi-currency.js +1 -1
- res/js/wcml-multi-currency.js +4 -1
- res/js/wcml-multi-currency.min.js +1 -1
- vendor/autoload.php +1 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/ClassLoader.php +2 -2
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_real_52.php +3 -3
- vendor/composer/autoload_static.php +6 -5
- vendor/otgs/installer/includes/class-installer-theme.php +2 -2
- vendor/otgs/installer/includes/class-otgs-installer-filename-hooks.php +33 -0
- vendor/otgs/installer/includes/class-otgs-installer-php-functions.php +29 -0
- vendor/otgs/installer/includes/class-wp-installer.php +67 -46
- vendor/otgs/installer/installer.php +6 -2
- vendor/otgs/installer/loader.php +1 -1
- wpml-woocommerce.php +4 -4
changelog/4.2.10.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Fixes
|
2 |
+
* [wcml-2348] Fix compatibility issues with PHP 7.1
|
3 |
+
* [wcml-2346] Fix issue with product slug when using language per domain in WPML
|
4 |
+
* [wcml-2344] Removed notice when set domain per language in WPML
|
5 |
+
* [wcml-2341] WooCommerce Bookings: Added support to translate booking emails
|
6 |
+
* [wcml-2331] Removed warning from translation editor when set display as translated
|
7 |
+
* [wcml-2330] Added compatibility for unsupported WooCommerce themes
|
8 |
+
* [wcml-2329] Removed some custom WPML taxonomies from plugin's Dashboard
|
9 |
+
* [wcml-2327] Fix an error with product variations which you cannot add them in cart if display as translated feature is used
|
10 |
+
* [wcml-2318] WooCommerce Composite Products: Fix Default option sync when using component option category
|
11 |
+
* [wcml-2317] WooCommerce Subscriptions: Fix Sign-up fee recalculation cost in some situations
|
12 |
+
* [wcml-2312] Theme Storefront: Fix Cart widget currency symbol not switched after switching currency
|
13 |
+
* [wcml-2309] Siteground Optimizer: Fix an issue with currency switcher
|
14 |
+
* [wcml-2308] Wrong price when manually adding product to an order with multicurrency enabled
|
15 |
+
* [wcml-2307] WooCommerce Bookings : Fix Block cost recalculation in second currency
|
16 |
+
* [wcml-2306] Added filter for oder_item_quantity
|
17 |
+
* [wcml-2305] Fix issue in endpoints when set My Account as homepage
|
18 |
+
* [wcml-2302] WooCommerce Dynamic Pricing: Fix Order total rules by category
|
classes/shortcodes/class-wcml-wc-shortcode-product-category.php
CHANGED
@@ -37,7 +37,7 @@ class WCML_WC_Shortcode_Product_Category {
|
|
37 |
|
38 |
if ( isset( $args['product_cat'] ) ) {
|
39 |
$args = $this->translate_categories_using_simple_tax_query( $args );
|
40 |
-
} elseif ( isset( $atts['category'] ) ) {
|
41 |
|
42 |
// Get translated category slugs, we need to remove WPML filter.
|
43 |
$filter_exists = remove_filter( 'terms_clauses', array( $this->sitepress, 'terms_clauses' ), 10 );
|
37 |
|
38 |
if ( isset( $args['product_cat'] ) ) {
|
39 |
$args = $this->translate_categories_using_simple_tax_query( $args );
|
40 |
+
} elseif ( isset( $atts['category'] ) && isset( $args['tax_query'] ) ) {
|
41 |
|
42 |
// Get translated category slugs, we need to remove WPML filter.
|
43 |
$filter_exists = remove_filter( 'terms_clauses', array( $this->sitepress, 'terms_clauses' ), 10 );
|
compatibility/class-wcml-bookings.php
CHANGED
@@ -20,6 +20,11 @@ class WCML_Bookings {
|
|
20 |
*/
|
21 |
private $woocommerce_wpml;
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* @var wpdb
|
25 |
*/
|
@@ -29,12 +34,14 @@ class WCML_Bookings {
|
|
29 |
* WCML_Bookings constructor.
|
30 |
* @param SitePress $sitepress
|
31 |
* @param woocommerce_wpml $woocommerce_wpml
|
|
|
32 |
* @param wpdb $wpdb
|
33 |
* @param WPML_Element_Translation_Package $tp
|
34 |
*/
|
35 |
-
function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, wpdb $wpdb, WPML_Element_Translation_Package $tp ) {
|
36 |
$this->sitepress = $sitepress;
|
37 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
|
|
38 |
$this->wpdb = $wpdb;
|
39 |
$this->tp = $tp;
|
40 |
}
|
@@ -165,30 +172,53 @@ class WCML_Bookings {
|
|
165 |
//allow filtering resources by language
|
166 |
add_filter( 'get_booking_resources_args', array( $this, 'filter_get_booking_resources_args' ) );
|
167 |
|
168 |
-
|
169 |
-
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
|
181 |
add_filter( 'pre_wpml_is_translated_post_type', array( $this, 'filter_is_translated_post_type' ) );
|
182 |
|
183 |
add_action( 'woocommerce_product_data_panels', array( $this, 'show_pointer_info' ) );
|
184 |
|
185 |
add_action( 'save_post', array( $this, 'sync_booking_status' ), 10, 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
|
188 |
if ( ! is_admin() || isset( $_POST['action'] ) && $_POST['action'] == 'wc_bookings_calculate_costs' ) {
|
189 |
add_filter( 'get_post_metadata', array( $this, 'filter_wc_booking_cost' ), 10, 4 );
|
190 |
}
|
191 |
-
|
192 |
add_filter( 'wpml_language_filter_extra_conditions_snippet', array( $this, 'extra_conditions_to_filter_bookings' ) );
|
193 |
|
194 |
$this->clear_transient_fields();
|
@@ -208,9 +238,11 @@ class WCML_Bookings {
|
|
208 |
}
|
209 |
|
210 |
function wcml_price_field_after_booking_block_cost( $post_id ) {
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
214 |
}
|
215 |
|
216 |
function wcml_price_field_after_display_cost( $post_id ) {
|
@@ -285,14 +317,15 @@ class WCML_Bookings {
|
|
285 |
)
|
286 |
) );
|
287 |
break;
|
|
|
288 |
case 'wcml_wc_booking_base_cost':
|
289 |
woocommerce_wp_text_input( array(
|
290 |
-
'id' =>
|
291 |
'class' => 'wcml_bookings_custom_price',
|
292 |
-
'name' => '
|
293 |
'label' => get_woocommerce_currency_symbol( $currency_code ),
|
294 |
'description' => __( 'This is the cost per block booked. All other costs (for resources and persons) are added to this.', 'woocommerce-bookings' ),
|
295 |
-
'value' => get_post_meta( $post_id, '_wc_booking_base_cost_' . $currency_code, true ),
|
296 |
'type' => 'number',
|
297 |
'desc_tip' => true,
|
298 |
'custom_attributes' => array(
|
@@ -757,6 +790,7 @@ class WCML_Bookings {
|
|
757 |
'_wc_display_cost',
|
758 |
'_wc_booking_pricing',
|
759 |
'cost',
|
|
|
760 |
'block_cost',
|
761 |
'_resource_base_costs',
|
762 |
'_resource_block_costs'
|
@@ -1123,21 +1157,21 @@ class WCML_Bookings {
|
|
1123 |
$wc_currencies = get_woocommerce_currencies();
|
1124 |
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies( $include_default = true );
|
1125 |
?>
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
|
1131 |
<?php foreach ( $currencies as $currency => $count ): ?>
|
1132 |
|
1133 |
-
|
1134 |
-
|
1135 |
|
1136 |
<?php endforeach; ?>
|
1137 |
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
|
1142 |
<?php
|
1143 |
|
@@ -2065,10 +2099,16 @@ class WCML_Bookings {
|
|
2065 |
private function update_booking_costs( $currencies = array(), $post_id = 0 ) {
|
2066 |
$booking_options = array(
|
2067 |
'wcml_wc_booking_cost' => '_wc_booking_cost_',
|
2068 |
-
'
|
2069 |
'wcml_wc_display_cost' => '_wc_display_cost_',
|
2070 |
);
|
2071 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2072 |
foreach ( $currencies as $code => $currency ) {
|
2073 |
foreach ( $booking_options as $booking_options_post_key => $booking_options_meta_key_prefix ) {
|
2074 |
if ( isset( $_POST[ $booking_options_post_key ][ $code ] ) ) {
|
@@ -2383,6 +2423,109 @@ class WCML_Bookings {
|
|
2383 |
return $tables;
|
2384 |
}
|
2385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2386 |
|
|
|
|
|
|
|
2387 |
|
2388 |
}
|
20 |
*/
|
21 |
private $woocommerce_wpml;
|
22 |
|
23 |
+
/**
|
24 |
+
* @var woocommerce
|
25 |
+
*/
|
26 |
+
private $woocommerce;
|
27 |
+
|
28 |
/**
|
29 |
* @var wpdb
|
30 |
*/
|
34 |
* WCML_Bookings constructor.
|
35 |
* @param SitePress $sitepress
|
36 |
* @param woocommerce_wpml $woocommerce_wpml
|
37 |
+
* @param woocommerce $woocommerce
|
38 |
* @param wpdb $wpdb
|
39 |
* @param WPML_Element_Translation_Package $tp
|
40 |
*/
|
41 |
+
function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, woocommerce $woocommerce, wpdb $wpdb, WPML_Element_Translation_Package $tp ) {
|
42 |
$this->sitepress = $sitepress;
|
43 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
44 |
+
$this->woocommerce = $woocommerce;
|
45 |
$this->wpdb = $wpdb;
|
46 |
$this->tp = $tp;
|
47 |
}
|
172 |
//allow filtering resources by language
|
173 |
add_filter( 'get_booking_resources_args', array( $this, 'filter_get_booking_resources_args' ) );
|
174 |
|
175 |
+
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'ICL_SITEPRESS_VERSION' ), '3.8.0', '<' ) ) {
|
176 |
+
add_filter( 'get_translatable_documents', array( $this, 'filter_translatable_documents' ) );
|
177 |
|
178 |
+
//@TODO review after WPML 3.6
|
179 |
+
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'ICL_SITEPRESS_VERSION' ), '3.6', '<' ) ) {
|
180 |
+
add_action( 'added_post_meta', array(
|
181 |
+
$this,
|
182 |
+
'maybe_fix_double_serialized_wc_booking_availability'
|
183 |
+
), 10, 4 );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
add_filter( 'get_translatable_documents_all', array( $this, 'filter_translatable_documents' ) );
|
187 |
|
188 |
add_filter( 'pre_wpml_is_translated_post_type', array( $this, 'filter_is_translated_post_type' ) );
|
189 |
|
190 |
add_action( 'woocommerce_product_data_panels', array( $this, 'show_pointer_info' ) );
|
191 |
|
192 |
add_action( 'save_post', array( $this, 'sync_booking_status' ), 10, 3 );
|
193 |
+
|
194 |
+
add_filter( 'wcml_emails_options_to_translate', array( $this, 'emails_options_to_translate' ) );
|
195 |
+
|
196 |
+
add_filter( 'wcml_emails_text_keys_to_translate', array( $this, 'emails_text_keys_to_translate' ) );
|
197 |
+
|
198 |
+
add_filter( 'woocommerce_email_get_option', array( $this, 'translate_emails_text_strings' ), 10, 4 );
|
199 |
+
|
200 |
+
|
201 |
+
add_action( 'woocommerce_booking_confirmed_notification', array( $this, 'translate_booking_confirmed_email_texts' ), 9 );
|
202 |
+
|
203 |
+
add_action( 'woocommerce_booking_pending-confirmation_to_cancelled_notification', array( $this, 'translate_booking_cancelled_email_texts' ), 9 );
|
204 |
+
add_action( 'woocommerce_booking_confirmed_to_cancelled_notification', array( $this, 'translate_booking_cancelled_email_texts' ), 9 );
|
205 |
+
add_action( 'woocommerce_booking_paid_to_cancelled_notification', array( $this, 'translate_booking_cancelled_email_texts' ), 9 );
|
206 |
+
|
207 |
+
add_action( 'wc-booking-reminder', array( $this, 'translate_booking_confirmed_email_texts' ), 9 );
|
208 |
+
add_action( 'woocommerce_admin_new_booking_notification', array( $this, 'translate_new_booking_email_texts' ), 9 );
|
209 |
+
|
210 |
+
|
211 |
+
add_action( 'woocommerce_booking_pending-confirmation_to_cancelled_notification', array( $this, 'translate_booking_cancelled_admin_email_texts' ), 9 );
|
212 |
+
add_action( 'woocommerce_booking_confirmed_to_cancelled_notification', array( $this, 'translate_booking_cancelled_admin_email_texts' ), 9 );
|
213 |
+
add_action( 'woocommerce_booking_paid_to_cancelled_notification', array( $this, 'translate_booking_cancelled_admin_email_texts' ), 9 );
|
214 |
+
|
215 |
+
add_filter( 'wcml_email_language', array( $this, 'booking_email_language' ) );
|
216 |
}
|
217 |
|
218 |
if ( ! is_admin() || isset( $_POST['action'] ) && $_POST['action'] == 'wc_bookings_calculate_costs' ) {
|
219 |
add_filter( 'get_post_metadata', array( $this, 'filter_wc_booking_cost' ), 10, 4 );
|
220 |
}
|
221 |
+
|
222 |
add_filter( 'wpml_language_filter_extra_conditions_snippet', array( $this, 'extra_conditions_to_filter_bookings' ) );
|
223 |
|
224 |
$this->clear_transient_fields();
|
238 |
}
|
239 |
|
240 |
function wcml_price_field_after_booking_block_cost( $post_id ) {
|
241 |
+
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'WC_BOOKINGS_VERSION' ), '1.10.9', '<' ) ) {
|
242 |
+
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
243 |
+
}else{
|
244 |
+
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_block_cost' );
|
245 |
+
}
|
246 |
}
|
247 |
|
248 |
function wcml_price_field_after_display_cost( $post_id ) {
|
317 |
)
|
318 |
) );
|
319 |
break;
|
320 |
+
case 'wcml_wc_booking_block_cost':
|
321 |
case 'wcml_wc_booking_base_cost':
|
322 |
woocommerce_wp_text_input( array(
|
323 |
+
'id' => $field,
|
324 |
'class' => 'wcml_bookings_custom_price',
|
325 |
+
'name' => $field . '[' . $currency_code . ']',
|
326 |
'label' => get_woocommerce_currency_symbol( $currency_code ),
|
327 |
'description' => __( 'This is the cost per block booked. All other costs (for resources and persons) are added to this.', 'woocommerce-bookings' ),
|
328 |
+
'value' => get_post_meta( $post_id, $field === 'wcml_wc_booking_block_cost' ? '_wc_booking_block_cost_' : '_wc_booking_base_cost_' . $currency_code, true ),
|
329 |
'type' => 'number',
|
330 |
'desc_tip' => true,
|
331 |
'custom_attributes' => array(
|
790 |
'_wc_display_cost',
|
791 |
'_wc_booking_pricing',
|
792 |
'cost',
|
793 |
+
'_wc_booking_block_cost',
|
794 |
'block_cost',
|
795 |
'_resource_base_costs',
|
796 |
'_resource_block_costs'
|
1157 |
$wc_currencies = get_woocommerce_currencies();
|
1158 |
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies( $include_default = true );
|
1159 |
?>
|
1160 |
+
<tr valign="top">
|
1161 |
+
<th scope="row"><?php _e( 'Booking currency', 'woocommerce-multilingual' ); ?></th>
|
1162 |
+
<td>
|
1163 |
+
<select id="dropdown_booking_currency">
|
1164 |
|
1165 |
<?php foreach ( $currencies as $currency => $count ): ?>
|
1166 |
|
1167 |
+
<option
|
1168 |
+
value="<?php echo $currency ?>" <?php echo $current_booking_currency == $currency ? 'selected="selected"' : ''; ?>><?php echo $wc_currencies[ $currency ]; ?></option>
|
1169 |
|
1170 |
<?php endforeach; ?>
|
1171 |
|
1172 |
+
</select>
|
1173 |
+
</td>
|
1174 |
+
</tr>
|
1175 |
|
1176 |
<?php
|
1177 |
|
2099 |
private function update_booking_costs( $currencies = array(), $post_id = 0 ) {
|
2100 |
$booking_options = array(
|
2101 |
'wcml_wc_booking_cost' => '_wc_booking_cost_',
|
2102 |
+
'wcml_wc_booking_block_cost' => '_wc_booking_block_cost_',
|
2103 |
'wcml_wc_display_cost' => '_wc_display_cost_',
|
2104 |
);
|
2105 |
|
2106 |
+
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'WC_BOOKINGS_VERSION' ), '1.10.9', '<' ) ) {
|
2107 |
+
unset( $booking_options['wcml_wc_booking_block_cost']);
|
2108 |
+
$booking_options['wcml_wc_booking_base_cost'] = '_wc_booking_base_cost_';
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
|
2112 |
foreach ( $currencies as $code => $currency ) {
|
2113 |
foreach ( $booking_options as $booking_options_post_key => $booking_options_meta_key_prefix ) {
|
2114 |
if ( isset( $_POST[ $booking_options_post_key ][ $code ] ) ) {
|
2423 |
return $tables;
|
2424 |
}
|
2425 |
|
2426 |
+
public function emails_options_to_translate( $emails_options ){
|
2427 |
+
$emails_options[] = 'woocommerce_new_booking_settings';
|
2428 |
+
$emails_options[] = 'woocommerce_booking_reminder_settings';
|
2429 |
+
$emails_options[] = 'woocommerce_booking_confirmed_settings';
|
2430 |
+
$emails_options[] = 'woocommerce_booking_cancelled_settings';
|
2431 |
+
$emails_options[] = 'woocommerce_admin_booking_cancelled_settings';
|
2432 |
+
|
2433 |
+
return $emails_options;
|
2434 |
+
}
|
2435 |
+
|
2436 |
+
public function emails_text_keys_to_translate( $text_keys ){
|
2437 |
+
$text_keys[] = 'subject_confirmation';
|
2438 |
+
$text_keys[] = 'heading_confirmation';
|
2439 |
+
|
2440 |
+
return $text_keys;
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
public function translate_emails_text_strings( $value, $object , $old_value, $key ){
|
2444 |
+
|
2445 |
+
$emails_ids = array( 'admin_booking_cancelled', 'new_booking', 'booking_cancelled', 'booking_confirmed', 'booking_reminder' );
|
2446 |
+
$keys = array( 'subject', 'subject_confirmation', 'heading', 'heading_confirmation' );
|
2447 |
+
|
2448 |
+
if( in_array( $key, $keys ) && in_array( $object->id, $emails_ids ) ){
|
2449 |
+
$translated_value = $object->$key;
|
2450 |
+
}
|
2451 |
+
|
2452 |
+
return !empty( $translated_value ) ? $translated_value : $value;
|
2453 |
+
}
|
2454 |
+
|
2455 |
+
public function translate_booking_confirmed_email_texts( $booking_id ){
|
2456 |
+
|
2457 |
+
if( class_exists( 'WC_Email_Booking_Confirmed' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Booking_Confirmed' ] ) ){
|
2458 |
+
$booking = get_wc_booking( $booking_id );
|
2459 |
+
$this->translate_email_strings( 'WC_Email_Booking_Confirmed', 'woocommerce_booking_confirmed_settings', $booking->get_order()->get_id() );
|
2460 |
+
}
|
2461 |
+
|
2462 |
+
}
|
2463 |
+
|
2464 |
+
public function translate_booking_cancelled_email_texts( $booking_id ){
|
2465 |
+
|
2466 |
+
if( class_exists( 'WC_Email_Booking_Cancelled' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Booking_Cancelled' ] ) ){
|
2467 |
+
$booking = get_wc_booking( $booking_id );
|
2468 |
+
$this->translate_email_strings( 'WC_Email_Booking_Cancelled', 'woocommerce_booking_cancelled_settings', $booking->get_order()->get_id() );
|
2469 |
+
}
|
2470 |
+
|
2471 |
+
}
|
2472 |
+
|
2473 |
+
public function translate_booking_reminder_email_texts( $booking_id ){
|
2474 |
+
|
2475 |
+
if( class_exists( 'WC_Email_Booking_Reminder' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Booking_Reminder' ] ) ){
|
2476 |
+
$booking = get_wc_booking( $booking_id );
|
2477 |
+
$this->translate_email_strings( 'WC_Email_Booking_Reminder', 'woocommerce_booking_reminder_settings', $booking->get_order()->get_id() );
|
2478 |
+
}
|
2479 |
+
|
2480 |
+
}
|
2481 |
+
|
2482 |
+
public function translate_new_booking_email_texts( $booking_id ){
|
2483 |
+
|
2484 |
+
if( class_exists( 'WC_Email_New_Booking' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_New_Booking' ] ) ){
|
2485 |
+
$user = get_user_by('email', $this->woocommerce->mailer()->emails['WC_Email_New_Booking']->recipient );
|
2486 |
+
if($user){
|
2487 |
+
$user_lang = $this->sitepress->get_user_admin_language($user->ID, true );
|
2488 |
+
}else{
|
2489 |
+
$booking = get_wc_booking( $booking_id );
|
2490 |
+
$user_lang = get_post_meta( $booking->get_order()->get_id(), 'wpml_language', true );
|
2491 |
+
}
|
2492 |
+
$this->translate_email_strings( 'WC_Email_New_Booking', 'woocommerce_new_booking_settings', false, $user_lang );
|
2493 |
+
$this->woocommerce->mailer()->emails['WC_Email_New_Booking']->heading_confirmation = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_woocommerce_new_booking_settings', '[woocommerce_new_booking_settings]heading_confirmation', $user_lang );
|
2494 |
+
$this->woocommerce->mailer()->emails['WC_Email_New_Booking']->subject_confirmation = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_woocommerce_new_booking_settings', '[woocommerce_new_booking_settings]subject_confirmation', $user_lang );
|
2495 |
+
}
|
2496 |
+
}
|
2497 |
+
|
2498 |
+
public function translate_booking_cancelled_admin_email_texts( $booking_id ){
|
2499 |
+
|
2500 |
+
if( class_exists( 'WC_Email_Admin_Booking_Cancelled' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Admin_Booking_Cancelled' ] ) ){
|
2501 |
+
$user = get_user_by('email', $this->woocommerce->mailer()->emails['WC_Email_Admin_Booking_Cancelled']->recipient );
|
2502 |
+
if($user){
|
2503 |
+
$user_lang = $this->sitepress->get_user_admin_language($user->ID, true );
|
2504 |
+
}else{
|
2505 |
+
$booking = get_wc_booking( $booking_id );
|
2506 |
+
$user_lang = get_post_meta( $booking->get_order()->get_id(), 'wpml_language', true );
|
2507 |
+
}
|
2508 |
+
$this->translate_email_strings( 'WC_Email_Admin_Booking_Cancelled', 'woocommerce_admin_booking_cancelled_settings', false, $user_lang );
|
2509 |
+
}
|
2510 |
+
|
2511 |
+
}
|
2512 |
+
|
2513 |
+
public function booking_email_language( $current_language ){
|
2514 |
+
|
2515 |
+
if( isset( $_POST[ 'post_type' ] ) && 'wc_booking' === $_POST[ 'post_type' ] ){
|
2516 |
+
$order_language = get_post_meta( $_POST[ '_booking_order_id' ], 'wpml_language', true );
|
2517 |
+
if( $order_language ){
|
2518 |
+
$current_language = $order_language;
|
2519 |
+
}
|
2520 |
+
}
|
2521 |
+
|
2522 |
+
return $current_language;
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
private function translate_email_strings( $email_class, $setting_slug, $order_id = false, $user_lang = null ){
|
2526 |
|
2527 |
+
$this->woocommerce->mailer()->emails[$email_class]->heading = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_'.$setting_slug, '['.$setting_slug.']heading', $order_id, $user_lang );
|
2528 |
+
$this->woocommerce->mailer()->emails[$email_class]->subject = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_'.$setting_slug, '['.$setting_slug.']subject', $order_id, $user_lang );
|
2529 |
+
}
|
2530 |
|
2531 |
}
|
compatibility/class-wcml-composite-products.php
CHANGED
@@ -281,14 +281,6 @@ class WCML_Composite_Products extends WCML_Compatibility_Helper{
|
|
281 |
$composite_data[ $component_id ][ 'assigned_ids' ][ $key ] = $assigned_id_current_language;
|
282 |
}
|
283 |
}
|
284 |
-
//sync default
|
285 |
-
if( $component[ 'default_id' ] ){
|
286 |
-
$trnsl_default_id = apply_filters( 'translate_object_id', $component[ 'default_id' ], get_post_type( $component[ 'default_id' ] ), false, $language );
|
287 |
-
if( $trnsl_default_id ){
|
288 |
-
$composite_data[ $component_id ][ 'default_id' ] = $trnsl_default_id;
|
289 |
-
}
|
290 |
-
}
|
291 |
-
|
292 |
}elseif( $component[ 'query_type' ] == 'category_ids' ){
|
293 |
foreach( $component[ 'assigned_category_ids' ] as $key => $assigned_id ){
|
294 |
$trsl_term_id = apply_filters( 'translate_object_id', $assigned_id, 'product_cat', false, $language );
|
@@ -296,14 +288,16 @@ class WCML_Composite_Products extends WCML_Compatibility_Helper{
|
|
296 |
$composite_data[ $component_id ][ 'assigned_category_ids' ][ $key ] = $trsl_term_id;
|
297 |
}
|
298 |
}
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
305 |
}
|
306 |
}
|
|
|
307 |
}
|
308 |
|
309 |
update_post_meta( $product_id, '_bto_data', $composite_data );
|
281 |
$composite_data[ $component_id ][ 'assigned_ids' ][ $key ] = $assigned_id_current_language;
|
282 |
}
|
283 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}elseif( $component[ 'query_type' ] == 'category_ids' ){
|
285 |
foreach( $component[ 'assigned_category_ids' ] as $key => $assigned_id ){
|
286 |
$trsl_term_id = apply_filters( 'translate_object_id', $assigned_id, 'product_cat', false, $language );
|
288 |
$composite_data[ $component_id ][ 'assigned_category_ids' ][ $key ] = $trsl_term_id;
|
289 |
}
|
290 |
}
|
291 |
+
}
|
292 |
+
|
293 |
+
//sync default
|
294 |
+
if( $component[ 'default_id' ] ){
|
295 |
+
$trnsl_default_id = apply_filters( 'translate_object_id', $component[ 'default_id' ], get_post_type( $component[ 'default_id' ] ), false, $language );
|
296 |
+
if( $trnsl_default_id ){
|
297 |
+
$composite_data[ $component_id ][ 'default_id' ] = $trnsl_default_id;
|
298 |
}
|
299 |
}
|
300 |
+
|
301 |
}
|
302 |
|
303 |
update_post_meta( $product_id, '_bto_data', $composite_data );
|
compatibility/class-wcml-dynamic-pricing.php
CHANGED
@@ -62,7 +62,7 @@ class WCML_Dynamic_Pricing {
|
|
62 |
* @return bool|WP_Error
|
63 |
*/
|
64 |
function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, $_product, $module_id, $obj, $cat_ids ) {
|
65 |
-
if ( $cat_ids &&
|
66 |
|
67 |
if ( ! is_array( $cat_ids ) ) {
|
68 |
$cat_ids = array( $cat_ids );
|
62 |
* @return bool|WP_Error
|
63 |
*/
|
64 |
function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, $_product, $module_id, $obj, $cat_ids ) {
|
65 |
+
if ( $cat_ids && ( ! empty( $obj->available_rulesets ) || ! empty( $obj->adjustment_sets ) ) ) {
|
66 |
|
67 |
if ( ! is_array( $cat_ids ) ) {
|
68 |
$cat_ids = array( $cat_ids );
|
compatibility/class-wcml-product-bundles.php
CHANGED
@@ -494,7 +494,7 @@ class WCML_Product_Bundles {
|
|
494 |
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
495 |
if ( $bundle_data ) {
|
496 |
$lang = $this->sitepress->get_language_for_element( $translated_bundle_id, 'post_product' );
|
497 |
-
$
|
498 |
|
499 |
foreach ( $bundle_data as $item_id => $product_data ) {
|
500 |
|
@@ -521,32 +521,38 @@ class WCML_Product_Bundles {
|
|
521 |
$this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang );
|
522 |
}
|
523 |
|
524 |
-
$translated_bundle_data[ $translated_item_id ]
|
525 |
$translated_bundle_data[ $translated_item_id ]['product_id'] = $translated_product_id;
|
526 |
|
527 |
-
if ( isset( $
|
528 |
-
if ( $
|
529 |
$translated_bundle_data[ $translated_item_id ]['title'] = get_the_title( $translated_product_id );
|
|
|
|
|
530 |
}
|
531 |
}
|
532 |
|
533 |
-
if ( isset( $
|
534 |
-
if ( $
|
535 |
$translated_bundle_data[ $translated_item_id ]['description'] = get_the_title( $translated_product_id );
|
|
|
|
|
536 |
}
|
537 |
}
|
538 |
|
539 |
-
if ( isset( $
|
540 |
-
$allowed_var = $
|
|
|
541 |
foreach ( $allowed_var as $key => $var_id ) {
|
542 |
$translated_var_id = apply_filters( 'translate_object_id', $var_id, get_post_type( $var_id ), true, $lang );
|
543 |
$translated_bundle_data[ $translated_item_id ]['allowed_variations'][ $key ] = $translated_var_id;
|
544 |
}
|
|
|
545 |
}
|
546 |
|
547 |
-
|
548 |
-
|
549 |
-
foreach ( $
|
550 |
|
551 |
$term_id = $this->woocommerce_wpml->terms->wcml_get_term_id_by_slug( $tax, $term_slug );
|
552 |
if ( $term_id ) {
|
@@ -570,11 +576,10 @@ class WCML_Product_Bundles {
|
|
570 |
endwhile;
|
571 |
}
|
572 |
}
|
|
|
573 |
}
|
574 |
|
575 |
}
|
576 |
-
|
577 |
-
|
578 |
}
|
579 |
|
580 |
$this->save_product_bundle_data( $translated_bundle_id, $translated_bundle_data );
|
494 |
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
495 |
if ( $bundle_data ) {
|
496 |
$lang = $this->sitepress->get_language_for_element( $translated_bundle_id, 'post_product' );
|
497 |
+
$translated_bundle_data_before_update = $this->get_product_bundle_data( $translated_bundle_id );
|
498 |
|
499 |
foreach ( $bundle_data as $item_id => $product_data ) {
|
500 |
|
521 |
$this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang );
|
522 |
}
|
523 |
|
524 |
+
$translated_bundle_data[ $translated_item_id ] = $product_data;
|
525 |
$translated_bundle_data[ $translated_item_id ]['product_id'] = $translated_product_id;
|
526 |
|
527 |
+
if ( isset( $product_data['title'] ) ) {
|
528 |
+
if ( $product_data['override_title'] != 'yes' ) {
|
529 |
$translated_bundle_data[ $translated_item_id ]['title'] = get_the_title( $translated_product_id );
|
530 |
+
}else{
|
531 |
+
$translated_bundle_data[ $translated_item_id ]['title'] = isset( $translated_bundle_data_before_update[ $translated_item_id ] ) ? $translated_bundle_data_before_update[ $translated_item_id ]['title'] : '';
|
532 |
}
|
533 |
}
|
534 |
|
535 |
+
if ( isset( $product_data['title'] ) ) {
|
536 |
+
if ( $product_data['override_description'] != 'yes' ) {
|
537 |
$translated_bundle_data[ $translated_item_id ]['description'] = get_the_title( $translated_product_id );
|
538 |
+
}else{
|
539 |
+
$translated_bundle_data[ $translated_item_id ]['description'] = isset( $translated_bundle_data_before_update[ $translated_item_id ] ) ? $translated_bundle_data_before_update[ $translated_item_id ]['description'] : '';
|
540 |
}
|
541 |
}
|
542 |
|
543 |
+
if ( isset( $product_data['filter_variations'] ) && $product_data['filter_variations'] == 'yes' ) {
|
544 |
+
$allowed_var = maybe_unserialize( $product_data['allowed_variations'] );
|
545 |
+
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] = maybe_unserialize( $translated_bundle_data[ $translated_item_id ]['allowed_variations'] );
|
546 |
foreach ( $allowed_var as $key => $var_id ) {
|
547 |
$translated_var_id = apply_filters( 'translate_object_id', $var_id, get_post_type( $var_id ), true, $lang );
|
548 |
$translated_bundle_data[ $translated_item_id ]['allowed_variations'][ $key ] = $translated_var_id;
|
549 |
}
|
550 |
+
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] = maybe_serialize( $translated_bundle_data[ $translated_item_id ]['allowed_variations'] );
|
551 |
}
|
552 |
|
553 |
+
if ( isset( $product_data['bundle_defaults'] ) && ! empty( $product_data['bundle_defaults'] ) ) {
|
554 |
+
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'] = maybe_unserialize( $translated_bundle_data[ $translated_item_id ]['bundle_defaults'] );
|
555 |
+
foreach ( maybe_unserialize( $product_data['bundle_defaults'] ) as $tax => $term_slug ) {
|
556 |
|
557 |
$term_id = $this->woocommerce_wpml->terms->wcml_get_term_id_by_slug( $tax, $term_slug );
|
558 |
if ( $term_id ) {
|
576 |
endwhile;
|
577 |
}
|
578 |
}
|
579 |
+
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'] = maybe_serialize( $translated_bundle_data[ $translated_item_id ]['bundle_defaults'] );
|
580 |
}
|
581 |
|
582 |
}
|
|
|
|
|
583 |
}
|
584 |
|
585 |
$this->save_product_bundle_data( $translated_bundle_id, $translated_bundle_data );
|
compatibility/class-wcml-relevanssi.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_Relevanssi {
|
4 |
+
|
5 |
+
public function add_hooks() {
|
6 |
+
// Re-index translated product to add missing terms (wcml-2282)
|
7 |
+
add_action( 'wcml_update_extra_fields', array( $this, 'index_product' ), 10, 4 );
|
8 |
+
}
|
9 |
+
|
10 |
+
public function index_product( $product_id, $tr_product_id, $translations, $target_language ) {
|
11 |
+
$current_language = apply_filters( 'wpml_current_language', null );
|
12 |
+
do_action( 'wpml_switch_language', $target_language );
|
13 |
+
relevanssi_insert_edit( $tr_product_id );
|
14 |
+
do_action( 'wpml_switch_language', $current_language );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
compatibility/class-wcml-wc-subscriptions.php
CHANGED
@@ -68,8 +68,11 @@ class WCML_WC_Subscriptions{
|
|
68 |
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
69 |
|
70 |
if ( $currency !== get_option( 'woocommerce_currency' ) ) {
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
} else {
|
74 |
$subscription_sign_up_fee = apply_filters( 'wcml_raw_price_amount', $subscription_sign_up_fee );
|
75 |
}
|
68 |
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
69 |
|
70 |
if ( $currency !== get_option( 'woocommerce_currency' ) ) {
|
71 |
+
|
72 |
+
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $product->get_id() );
|
73 |
+
|
74 |
+
if ( get_post_meta( $original_product_id, '_wcml_custom_prices_status', true ) ) {
|
75 |
+
$subscription_sign_up_fee = get_post_meta( $original_product_id, '_subscription_sign_up_fee_' . $currency, true );
|
76 |
} else {
|
77 |
$subscription_sign_up_fee = apply_filters( 'wcml_raw_price_amount', $subscription_sign_up_fee );
|
78 |
}
|
inc/class-wcml-ajax-setup.php
CHANGED
@@ -123,7 +123,8 @@ class WCML_Ajax_Setup{
|
|
123 |
array(
|
124 |
'wcml_product_data',
|
125 |
'wpml_translation_dialog_save_job',
|
126 |
-
'edit-theme-plugin-file'
|
|
|
127 |
),
|
128 |
true );
|
129 |
if ( $action && ( $is_ajax_action || ! apply_filters( 'wcml_is_localize_woocommerce_on_ajax', true, $action ) ) ) {
|
123 |
array(
|
124 |
'wcml_product_data',
|
125 |
'wpml_translation_dialog_save_job',
|
126 |
+
'edit-theme-plugin-file',
|
127 |
+
'search-install-plugins'
|
128 |
),
|
129 |
true );
|
130 |
if ( $action && ( $is_ajax_action || ! apply_filters( 'wcml_is_localize_woocommerce_on_ajax', true, $action ) ) ) {
|
inc/class-wcml-attributes.php
CHANGED
@@ -659,7 +659,9 @@ class WCML_Attributes{
|
|
659 |
|
660 |
if( taxonomy_exists( $attribute_taxonomy ) ){
|
661 |
$term = get_term_by( 'slug', $attribute_value, $attribute_taxonomy );
|
662 |
-
|
|
|
|
|
663 |
}
|
664 |
|
665 |
return $attribute_value;
|
659 |
|
660 |
if( taxonomy_exists( $attribute_taxonomy ) ){
|
661 |
$term = get_term_by( 'slug', $attribute_value, $attribute_taxonomy );
|
662 |
+
if( $term ){
|
663 |
+
$attribute_value = $term->slug;
|
664 |
+
}
|
665 |
}
|
666 |
|
667 |
return $attribute_value;
|
inc/class-wcml-cart-sync-warnings.php
CHANGED
@@ -19,7 +19,8 @@ class WCML_Cart_Sync_Warnings{
|
|
19 |
'WC_Bookings' => 'Woocommerce Bookings',
|
20 |
'WC_Accommodation_Bookings_Plugin' => 'Woocommerce Accommodation Bookings',
|
21 |
'WC_Product_Bundle' => 'Woocommerce Product Bundles',
|
22 |
-
'WC_Composite_Products' => 'Woocommerce Composite Products'
|
|
|
23 |
);
|
24 |
|
25 |
public function __construct( $woocommerce_wpml, $sitepress ){
|
19 |
'WC_Bookings' => 'Woocommerce Bookings',
|
20 |
'WC_Accommodation_Bookings_Plugin' => 'Woocommerce Accommodation Bookings',
|
21 |
'WC_Product_Bundle' => 'Woocommerce Product Bundles',
|
22 |
+
'WC_Composite_Products' => 'Woocommerce Composite Products',
|
23 |
+
'WC_Dynamic_Pricing' => 'Woocommerce Dynamic Pricing',
|
24 |
);
|
25 |
|
26 |
public function __construct( $woocommerce_wpml, $sitepress ){
|
inc/class-wcml-compatibility.php
CHANGED
@@ -36,10 +36,10 @@ class WCML_Compatibility {
|
|
36 |
|
37 |
function init() {
|
38 |
//hardcoded list of extensions and check which ones the user has and then include the corresponding file from the ‘compatibility’ folder
|
|
|
39 |
|
40 |
//WooCommerce Tab Manager plugin
|
41 |
if ( class_exists( 'WC_Tab_Manager' ) ) {
|
42 |
-
global $woocommerce;
|
43 |
$this->tab_manager = new WCML_Tab_Manager( $this->sitepress, $woocommerce, $this->woocommerce_wpml, $this->wpdb, $this->tp );
|
44 |
$this->tab_manager->add_hooks();
|
45 |
}
|
@@ -121,7 +121,7 @@ class WCML_Compatibility {
|
|
121 |
|
122 |
// WooCommerce Bookings
|
123 |
if ( defined( 'WC_BOOKINGS_VERSION' ) && version_compare( WC_BOOKINGS_VERSION, '1.7.8', '>=' ) ) {
|
124 |
-
$this->bookings = new WCML_Bookings( $this->sitepress, $this->woocommerce_wpml, $this->wpdb, $this->tp );
|
125 |
$this->bookings->add_hooks();
|
126 |
|
127 |
// WooCommerce Accommodation Bookings
|
@@ -241,6 +241,12 @@ class WCML_Compatibility {
|
|
241 |
$this->wpb_vc->add_hooks();
|
242 |
}
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
|
246 |
}
|
36 |
|
37 |
function init() {
|
38 |
//hardcoded list of extensions and check which ones the user has and then include the corresponding file from the ‘compatibility’ folder
|
39 |
+
global $woocommerce;
|
40 |
|
41 |
//WooCommerce Tab Manager plugin
|
42 |
if ( class_exists( 'WC_Tab_Manager' ) ) {
|
|
|
43 |
$this->tab_manager = new WCML_Tab_Manager( $this->sitepress, $woocommerce, $this->woocommerce_wpml, $this->wpdb, $this->tp );
|
44 |
$this->tab_manager->add_hooks();
|
45 |
}
|
121 |
|
122 |
// WooCommerce Bookings
|
123 |
if ( defined( 'WC_BOOKINGS_VERSION' ) && version_compare( WC_BOOKINGS_VERSION, '1.7.8', '>=' ) ) {
|
124 |
+
$this->bookings = new WCML_Bookings( $this->sitepress, $this->woocommerce_wpml, $woocommerce, $this->wpdb, $this->tp );
|
125 |
$this->bookings->add_hooks();
|
126 |
|
127 |
// WooCommerce Accommodation Bookings
|
241 |
$this->wpb_vc->add_hooks();
|
242 |
}
|
243 |
|
244 |
+
// Relevanssi plugin
|
245 |
+
if ( function_exists( 'relevanssi_insert_edit' ) ) {
|
246 |
+
$this->relevanssi = new WCML_Relevanssi();
|
247 |
+
$this->relevanssi->add_hooks();
|
248 |
+
}
|
249 |
+
|
250 |
}
|
251 |
|
252 |
}
|
inc/class-wcml-coupons.php
CHANGED
@@ -110,7 +110,7 @@ class WCML_Coupons {
|
|
110 |
|
111 |
$translated_product_id = apply_filters( 'translate_object_id', $product_id, 'product', false, $this->sitepress->get_current_language() );
|
112 |
|
113 |
-
if ( $product_id !== $translated_product_id ) {
|
114 |
|
115 |
remove_filter( 'woocommerce_coupon_is_valid_for_product', array( $this, 'is_valid_for_product' ), 10, 4 );
|
116 |
|
110 |
|
111 |
$translated_product_id = apply_filters( 'translate_object_id', $product_id, 'product', false, $this->sitepress->get_current_language() );
|
112 |
|
113 |
+
if ( $translated_product_id && $product_id !== $translated_product_id ) {
|
114 |
|
115 |
remove_filter( 'woocommerce_coupon_is_valid_for_product', array( $this, 'is_valid_for_product' ), 10, 4 );
|
116 |
|
inc/class-wcml-emails.php
CHANGED
@@ -9,11 +9,22 @@ class WCML_Emails{
|
|
9 |
private $sitepress;
|
10 |
/** @var WooCommerce */
|
11 |
private $woocommerce;
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
15 |
$this->sitepress = $sitepress;
|
16 |
$this->woocommerce = $woocommerce;
|
|
|
17 |
}
|
18 |
|
19 |
function add_hooks(){
|
@@ -122,6 +133,10 @@ class WCML_Emails{
|
|
122 |
|
123 |
add_filter( 'woocommerce_email_setup_locale', '__return_false' );
|
124 |
add_filter( 'woocommerce_email_restore_locale', '__return_false' );
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
function email_refresh_in_ajax() {
|
@@ -282,6 +297,18 @@ class WCML_Emails{
|
|
282 |
}
|
283 |
}
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
public function backend_new_order_admin_email( $order_id ){
|
286 |
if( isset( $_POST[ 'wc_order_action' ] ) && $_POST[ 'wc_order_action' ] == 'send_email_new_order' ){
|
287 |
$this->new_order_admin_email( $order_id );
|
@@ -356,19 +383,9 @@ class WCML_Emails{
|
|
356 |
$language_code = $order_language;
|
357 |
}
|
358 |
}
|
|
|
359 |
|
360 |
-
|
361 |
-
global $wpdb;
|
362 |
-
|
363 |
-
$result = $wpdb->get_var( $wpdb->prepare( "SELECT value FROM {$wpdb->prefix}icl_strings WHERE context = %s AND name = %s ", $context, $name ) );
|
364 |
-
|
365 |
-
return apply_filters( 'wpml_translate_single_string', $result, $context, $name, $language_code );
|
366 |
-
}else{
|
367 |
-
|
368 |
-
return apply_filters( 'wpml_translate_single_string', false, $context, $name , $language_code);
|
369 |
-
|
370 |
-
}
|
371 |
-
|
372 |
}
|
373 |
|
374 |
function icl_current_string_language( $current_language, $name ){
|
@@ -434,18 +451,22 @@ class WCML_Emails{
|
|
434 |
'woocommerce_customer_new_account_settings'
|
435 |
);
|
436 |
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
|
|
|
|
|
|
|
|
449 |
|
450 |
|
451 |
foreach( $emails_options as $emails_option ) {
|
@@ -455,37 +476,39 @@ class WCML_Emails{
|
|
455 |
if( isset( $_GET['section'] ) && $_GET['section'] == $section_name ){
|
456 |
|
457 |
$option_settings = get_option( $emails_option );
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
input.
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
|
|
|
|
489 |
}
|
490 |
}
|
491 |
}
|
9 |
private $sitepress;
|
10 |
/** @var WooCommerce */
|
11 |
private $woocommerce;
|
12 |
+
/** @var wpdb */
|
13 |
+
private $wpdb;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* WCML_Emails constructor.
|
17 |
+
*
|
18 |
+
* @param woocommerce_wpml $woocommerce_wpml
|
19 |
+
* @param SitePress $sitepress
|
20 |
+
* @param WooCommerce $woocommerce
|
21 |
+
* @param wpdb $wpdb
|
22 |
+
*/
|
23 |
+
function __construct( woocommerce_wpml $woocommerce_wpml, SitePress $sitepress, WooCommerce $woocommerce, wpdb $wpdb ) {
|
24 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
25 |
$this->sitepress = $sitepress;
|
26 |
$this->woocommerce = $woocommerce;
|
27 |
+
$this->wpdb = $wpdb;
|
28 |
}
|
29 |
|
30 |
function add_hooks(){
|
133 |
|
134 |
add_filter( 'woocommerce_email_setup_locale', '__return_false' );
|
135 |
add_filter( 'woocommerce_email_restore_locale', '__return_false' );
|
136 |
+
|
137 |
+
|
138 |
+
add_filter( 'woocommerce_email_heading_new_order', array( $this, 'new_order_email_heading' ) );
|
139 |
+
add_filter( 'woocommerce_email_subject_new_order', array( $this, 'new_order_email_subject' ) );
|
140 |
}
|
141 |
|
142 |
function email_refresh_in_ajax() {
|
297 |
}
|
298 |
}
|
299 |
|
300 |
+
public function new_order_email_heading( $heading ){
|
301 |
+
$heading = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->heading;
|
302 |
+
|
303 |
+
return $heading;
|
304 |
+
}
|
305 |
+
|
306 |
+
public function new_order_email_subject( $subject ){
|
307 |
+
$subject = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->subject;
|
308 |
+
|
309 |
+
return $subject;
|
310 |
+
}
|
311 |
+
|
312 |
public function backend_new_order_admin_email( $order_id ){
|
313 |
if( isset( $_POST[ 'wc_order_action' ] ) && $_POST[ 'wc_order_action' ] == 'send_email_new_order' ){
|
314 |
$this->new_order_admin_email( $order_id );
|
383 |
$language_code = $order_language;
|
384 |
}
|
385 |
}
|
386 |
+
$result = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT value FROM {$this->wpdb->prefix}icl_strings WHERE context = %s AND name = %s ", $context, $name ) );
|
387 |
|
388 |
+
return apply_filters( 'wpml_translate_single_string', $result, $context, $name, $language_code );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
}
|
390 |
|
391 |
function icl_current_string_language( $current_language, $name ){
|
451 |
'woocommerce_customer_new_account_settings'
|
452 |
);
|
453 |
|
454 |
+
$emails_options = apply_filters( 'wcml_emails_options_to_translate', $emails_options );
|
455 |
+
|
456 |
+
$text_keys = array(
|
457 |
+
'subject',
|
458 |
+
'heading',
|
459 |
+
'subject_downloadable',
|
460 |
+
'heading_downloadable',
|
461 |
+
'subject_full',
|
462 |
+
'subject_partial',
|
463 |
+
'heading_full',
|
464 |
+
'heading_partial',
|
465 |
+
'subject_paid',
|
466 |
+
'heading_paid'
|
467 |
+
);
|
468 |
+
|
469 |
+
$text_keys = apply_filters( 'wcml_emails_text_keys_to_translate', $text_keys );
|
470 |
|
471 |
|
472 |
foreach( $emails_options as $emails_option ) {
|
476 |
if( isset( $_GET['section'] ) && $_GET['section'] == $section_name ){
|
477 |
|
478 |
$option_settings = get_option( $emails_option );
|
479 |
+
if( $option_settings ){
|
480 |
+
foreach ($option_settings as $setting_key => $setting_value) {
|
481 |
+
if ( in_array( $setting_key, $text_keys ) ) {
|
482 |
+
$input_name = str_replace( '_settings', '', $emails_option ).'_'.$setting_key;
|
483 |
+
|
484 |
+
$lang_selector = new WPML_Simple_Language_Selector($this->sitepress);
|
485 |
+
$language = $this->woocommerce_wpml->strings->get_string_language( $setting_value, 'admin_texts_'.$emails_option, '['.$emails_option.']'.$setting_key );
|
486 |
+
if( is_null( $language ) ) {
|
487 |
+
$language = $this->sitepress->get_default_language();
|
488 |
+
}
|
489 |
+
|
490 |
+
$lang_selector->render( array(
|
491 |
+
'id' => $emails_option.'_'.$setting_key.'_language_selector',
|
492 |
+
'name' => 'wcml_lang-'.$emails_option.'-'.$setting_key,
|
493 |
+
'selected' => $language,
|
494 |
+
'show_please_select' => false,
|
495 |
+
'echo' => true,
|
496 |
+
'style' => 'width: 18%;float: left'
|
497 |
+
)
|
498 |
+
);
|
499 |
+
|
500 |
+
$st_page = admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=admin_texts_'.$emails_option.'&search='.$setting_value );
|
501 |
+
?>
|
502 |
+
<script>
|
503 |
+
var input = jQuery('input[name="<?php echo $input_name ?>"]');
|
504 |
+
if (input.length) {
|
505 |
+
input.parent().append('<div class="translation_controls"></div>');
|
506 |
+
input.parent().find('.translation_controls').append('<a href="<?php echo $st_page ?>" style="margin-left: 10px"><?php _e('translations', 'woocommerce-multilingual') ?></a>');
|
507 |
+
jQuery('#<?php echo $emails_option.'_'.$setting_key.'_language_selector' ?>').prependTo(input.parent().find('.translation_controls'));
|
508 |
+
}
|
509 |
+
</script>
|
510 |
+
<?php }
|
511 |
+
}
|
512 |
}
|
513 |
}
|
514 |
}
|
inc/class-wcml-endpoints.php
CHANGED
@@ -26,6 +26,8 @@ class WCML_Endpoints{
|
|
26 |
add_filter( 'woocommerce_get_endpoint_url', array( $this, 'filter_get_endpoint_url' ), 10, 4 );
|
27 |
|
28 |
add_filter( 'woocommerce_settings_saved', array( $this, 'update_original_endpoints_strings') );
|
|
|
|
|
29 |
}
|
30 |
|
31 |
public function reserved_requests( $requests, SitePress $sitepress ) {
|
@@ -161,7 +163,9 @@ class WCML_Endpoints{
|
|
161 |
WC()->query->query_vars = apply_filters( 'wcml_flush_rules_query_vars', WC()->query->query_vars, $this );
|
162 |
|
163 |
remove_filter( 'gettext_with_context', array( $this->woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
|
164 |
-
|
|
|
|
|
165 |
add_filter( 'gettext_with_context', array( $this->woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
|
166 |
delete_option( 'flush_rules_for_endpoints_translations' );
|
167 |
}
|
@@ -286,7 +290,11 @@ class WCML_Endpoints{
|
|
286 |
$endpoints['shipping'] = urldecode( $this->get_translated_edit_address_slug( 'shipping' ) );
|
287 |
$endpoints['billing'] = urldecode( $this->get_translated_edit_address_slug( 'billing' ) );
|
288 |
|
289 |
-
|
|
|
|
|
|
|
|
|
290 |
$wp_query->set_404();
|
291 |
status_header(404);
|
292 |
include( get_query_template( '404' ) );
|
@@ -353,5 +361,27 @@ class WCML_Endpoints{
|
|
353 |
|
354 |
}
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
}
|
26 |
add_filter( 'woocommerce_get_endpoint_url', array( $this, 'filter_get_endpoint_url' ), 10, 4 );
|
27 |
|
28 |
add_filter( 'woocommerce_settings_saved', array( $this, 'update_original_endpoints_strings') );
|
29 |
+
|
30 |
+
add_filter( 'option_rewrite_rules', array( $this, 'translate_endpoints_in_rewrite_rules' ), 0, 1 ); // high priority
|
31 |
}
|
32 |
|
33 |
public function reserved_requests( $requests, SitePress $sitepress ) {
|
163 |
WC()->query->query_vars = apply_filters( 'wcml_flush_rules_query_vars', WC()->query->query_vars, $this );
|
164 |
|
165 |
remove_filter( 'gettext_with_context', array( $this->woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
|
166 |
+
if ( (int) get_option( 'page_on_front' ) !== wc_get_page_id( 'myaccount' ) ) {
|
167 |
+
flush_rewrite_rules( false );
|
168 |
+
}
|
169 |
add_filter( 'gettext_with_context', array( $this->woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
|
170 |
delete_option( 'flush_rules_for_endpoints_translations' );
|
171 |
}
|
290 |
$endpoints['shipping'] = urldecode( $this->get_translated_edit_address_slug( 'shipping' ) );
|
291 |
$endpoints['billing'] = urldecode( $this->get_translated_edit_address_slug( 'billing' ) );
|
292 |
|
293 |
+
$endpoint_not_pagename = isset( $q->query['pagename'] ) && urldecode( $q->query['pagename'] ) != $endpoint_in_url;
|
294 |
+
$endpoint_url_not_in_endpoints = !in_array( $endpoint_in_url,$endpoints );
|
295 |
+
$uri_vars_not_in_query_vars = !in_array( urldecode( prev( $uri_vars ) ) ,$q->query_vars );
|
296 |
+
|
297 |
+
if( $endpoint_not_pagename && $endpoint_url_not_in_endpoints && is_numeric( $endpoint_in_url ) && $uri_vars_not_in_query_vars ){
|
298 |
$wp_query->set_404();
|
299 |
status_header(404);
|
300 |
include( get_query_template( '404' ) );
|
361 |
|
362 |
}
|
363 |
|
364 |
+
public function translate_endpoints_in_rewrite_rules( $value ) {
|
365 |
+
|
366 |
+
if ( ! empty( $value ) ) {
|
367 |
+
|
368 |
+
foreach ( WC()->query->query_vars as $endpoint_key => $endpoint_translation ) {
|
369 |
+
if ( $endpoint_key == $endpoint_translation ) {
|
370 |
+
continue;
|
371 |
+
}
|
372 |
+
|
373 |
+
$buff_value = array();
|
374 |
+
|
375 |
+
foreach ( $value as $k => $v ) {
|
376 |
+
$k = preg_replace( '/(\/)?' . $endpoint_key . '(\/)?(\(\/\(\.\*\)\)\?\/\?\$)/', '$1' . $endpoint_translation . '$2$3', $k );
|
377 |
+
$buff_value[ $k ] = $v;
|
378 |
+
}
|
379 |
+
$value = $buff_value;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
return $value;
|
384 |
+
}
|
385 |
+
|
386 |
|
387 |
}
|
inc/class-wcml-resources.php
CHANGED
@@ -149,9 +149,7 @@ class WCML_Resources {
|
|
149 |
wp_enqueue_script( 'cart-widget' );
|
150 |
wp_localize_script( 'cart-widget', 'actions', array(
|
151 |
'is_lang_switched' => self::$sitepress->get_language_from_url( $referer ) != self::$sitepress->get_current_language() ? 1 : 0,
|
152 |
-
'
|
153 |
-
'force_reset' => apply_filters( 'wcml_force_reset_cart_fragments', 0 ),
|
154 |
-
'cart_fragment' => apply_filters( 'woocommerce_cart_fragment_name', 'wc_fragments_' . md5( get_current_blog_id() . '_' . get_site_url( get_current_blog_id(), '/' ) ) ),
|
155 |
) );
|
156 |
} elseif( is_admin() ) {
|
157 |
|
149 |
wp_enqueue_script( 'cart-widget' );
|
150 |
wp_localize_script( 'cart-widget', 'actions', array(
|
151 |
'is_lang_switched' => self::$sitepress->get_language_from_url( $referer ) != self::$sitepress->get_current_language() ? 1 : 0,
|
152 |
+
'force_reset' => apply_filters( 'wcml_force_reset_cart_fragments', 0 )
|
|
|
|
|
153 |
) );
|
154 |
} elseif( is_admin() ) {
|
155 |
|
inc/class-wcml-store-pages.php
CHANGED
@@ -285,7 +285,9 @@ class WCML_Store_Pages{
|
|
285 |
|
286 |
function adjust_shop_page($q) {
|
287 |
|
288 |
-
|
|
|
|
|
289 |
if (!empty($q->query_vars['pagename'])) {
|
290 |
$shop_page = get_post( wc_get_page_id('shop') );
|
291 |
// we should explode by / for children page
|
285 |
|
286 |
function adjust_shop_page($q) {
|
287 |
|
288 |
+
$is_wc_prior_3_3 = $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'WC_VERSION' ), '3.3', '<' );
|
289 |
+
|
290 |
+
if ( $is_wc_prior_3_3 && $this->sitepress->get_default_language() != $this->sitepress->get_current_language() ) {
|
291 |
if (!empty($q->query_vars['pagename'])) {
|
292 |
$shop_page = get_post( wc_get_page_id('shop') );
|
293 |
// we should explode by / for children page
|
inc/class-wcml-terms.php
CHANGED
@@ -437,7 +437,7 @@ class WCML_Terms{
|
|
437 |
$posts_processed = 0;
|
438 |
foreach($post_ids as $post_id){
|
439 |
$terms = wp_get_post_terms($post_id, $taxonomy);
|
440 |
-
$terms_count = count($terms)
|
441 |
|
442 |
$trid = $this->sitepress->get_element_trid($post_id, 'post_product');
|
443 |
$translations = $this->sitepress->get_element_translations($trid, 'post_product');
|
437 |
$posts_processed = 0;
|
438 |
foreach($post_ids as $post_id){
|
439 |
$terms = wp_get_post_terms($post_id, $taxonomy);
|
440 |
+
$terms_count = count($terms);
|
441 |
|
442 |
$trid = $this->sitepress->get_element_trid($post_id, 'post_product');
|
443 |
$translations = $this->sitepress->get_element_translations($trid, 'post_product');
|
inc/class-wcml-upgrade.php
CHANGED
@@ -21,7 +21,8 @@ class WCML_Upgrade{
|
|
21 |
'4.1.0',
|
22 |
'4.2.0',
|
23 |
'4.2.2',
|
24 |
-
'4.2.7'
|
|
|
25 |
);
|
26 |
|
27 |
function __construct(){
|
@@ -629,4 +630,26 @@ class WCML_Upgrade{
|
|
629 |
|
630 |
}
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
}
|
21 |
'4.1.0',
|
22 |
'4.2.0',
|
23 |
'4.2.2',
|
24 |
+
'4.2.7',
|
25 |
+
'4.2.10'
|
26 |
);
|
27 |
|
28 |
function __construct(){
|
630 |
|
631 |
}
|
632 |
|
633 |
+
private function upgrade_4_2_10(){
|
634 |
+
|
635 |
+
// #wcml-2307
|
636 |
+
global $wpdb;
|
637 |
+
|
638 |
+
if ( defined( 'WC_BOOKINGS_VERSION' ) && version_compare(WC_BOOKINGS_VERSION, '1.10.9', '>=' ) ) {
|
639 |
+
|
640 |
+
$results = $wpdb->get_results( "
|
641 |
+
SELECT *
|
642 |
+
FROM {$wpdb->postmeta}
|
643 |
+
WHERE meta_key LIKE '\\_wc_booking_base_cost\\_%' )
|
644 |
+
" );
|
645 |
+
|
646 |
+
foreach ( $results as $price ) {
|
647 |
+
$base_cost_price = $price->meta_value;
|
648 |
+
$block_cost_field_key = str_replace( 'base', 'block', $price->meta_key );
|
649 |
+
update_post_meta( $price->post_id, $block_cost_field_key, $base_cost_price );
|
650 |
+
}
|
651 |
+
}
|
652 |
+
|
653 |
+
}
|
654 |
+
|
655 |
}
|
inc/class-wcml-url-translation.php
CHANGED
@@ -195,7 +195,7 @@ class WCML_Url_Translation {
|
|
195 |
|
196 |
$string = icl_get_string_id( $slug, $this->url_strings_context(), $this->url_string_name( 'product' ) );
|
197 |
if ( ! $string ) {
|
198 |
-
do_action( 'wpml_register_single_string', $this->url_strings_context(), $this->url_string_name( 'product' ), $slug );
|
199 |
}
|
200 |
|
201 |
}
|
195 |
|
196 |
$string = icl_get_string_id( $slug, $this->url_strings_context(), $this->url_string_name( 'product' ) );
|
197 |
if ( ! $string ) {
|
198 |
+
do_action( 'wpml_register_single_string', $this->url_strings_context(), $this->url_string_name( 'product' ), trim( $slug, '/' ) );
|
199 |
}
|
200 |
|
201 |
}
|
inc/class-wcml-wc-strings.php
CHANGED
@@ -366,7 +366,7 @@ class WCML_WC_Strings{
|
|
366 |
$trnsl_base['translated_base'] = $trnsl_base['original_value'];
|
367 |
}
|
368 |
|
369 |
-
if ( $shop_page->ID && strstr( $trnsl_base['translated_base'], urldecode( $shop_page->post_name ) ) && get_option( 'page_on_front' ) != $shop_page->ID ) {
|
370 |
$breadcrumbs_buff = array();
|
371 |
$i = 0;
|
372 |
foreach( $breadcrumbs as $key => $breadcrumb ){
|
366 |
$trnsl_base['translated_base'] = $trnsl_base['original_value'];
|
367 |
}
|
368 |
|
369 |
+
if ( is_woocommerce() && $shop_page->ID && strstr( $trnsl_base['translated_base'], urldecode( $shop_page->post_name ) ) && get_option( 'page_on_front' ) != $shop_page->ID ) {
|
370 |
$breadcrumbs_buff = array();
|
371 |
$i = 0;
|
372 |
foreach( $breadcrumbs as $key => $breadcrumb ){
|
inc/class-woocommerce-wpml.php
CHANGED
@@ -194,7 +194,7 @@ class woocommerce_wpml {
|
|
194 |
$this->store->add_hooks();
|
195 |
$this->strings = new WCML_WC_Strings( $this, $sitepress );
|
196 |
$this->strings->add_hooks();
|
197 |
-
$this->emails = new WCML_Emails( $this, $sitepress, $woocommerce );
|
198 |
$this->emails->add_hooks();
|
199 |
$this->terms = new WCML_Terms( $this, $sitepress, $wpdb );
|
200 |
$this->terms->add_hooks();
|
194 |
$this->store->add_hooks();
|
195 |
$this->strings = new WCML_WC_Strings( $this, $sitepress );
|
196 |
$this->strings->add_hooks();
|
197 |
+
$this->emails = new WCML_Emails( $this, $sitepress, $woocommerce, $wpdb );
|
198 |
$this->emails->add_hooks();
|
199 |
$this->terms = new WCML_Terms( $this, $sitepress, $wpdb );
|
200 |
$this->terms->add_hooks();
|
inc/currencies/class-wcml-multi-currency-orders.php
CHANGED
@@ -34,8 +34,8 @@ class WCML_Multi_Currency_Orders {
|
|
34 |
add_action( 'woocommerce_process_shop_order_meta', array( $this, 'set_order_currency_on_update' ), 10, 2 );
|
35 |
add_action( 'woocommerce_order_actions_start', array( $this, 'show_order_currency_selector' ) );
|
36 |
|
37 |
-
add_filter( 'woocommerce_ajax_order_item', array( $this, 'filter_ajax_order_item' ), 10, 2 );
|
38 |
add_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ) );
|
|
|
39 |
|
40 |
add_action( 'wp_ajax_wcml_order_set_currency', array( $this, 'set_order_currency_on_ajax_update' ) );
|
41 |
|
@@ -254,20 +254,6 @@ class WCML_Multi_Currency_Orders {
|
|
254 |
|
255 |
}
|
256 |
|
257 |
-
public function filter_ajax_order_item( $item, $item_id ) {
|
258 |
-
|
259 |
-
list( $item, $order_currency ) = $this->set_converted_totals_for_item( $item );
|
260 |
-
|
261 |
-
wc_update_order_item_meta( $item_id, '_line_subtotal', $item['line_subtotal'] );
|
262 |
-
$item['line_subtotal_tax'] = $this->multi_currency->prices->convert_price_amount( $item['line_subtotal_tax'], $order_currency );
|
263 |
-
wc_update_order_item_meta( $item_id, '_line_subtotal_tax', $item['line_subtotal_tax'] );
|
264 |
-
wc_update_order_item_meta( $item_id, '_line_total', $item['line_total'] );
|
265 |
-
$item['line_tax'] = $this->multi_currency->prices->convert_price_amount( $item['line_tax'], $order_currency );
|
266 |
-
wc_update_order_item_meta( $item_id, '_line_tax', $item['line_tax'] );
|
267 |
-
|
268 |
-
return $item;
|
269 |
-
}
|
270 |
-
|
271 |
public function set_totals_for_order_items( $items ) {
|
272 |
|
273 |
if ( isset( $_POST['action'] ) && 'woocommerce_add_order_item' === $_POST['action'] ) {
|
@@ -280,6 +266,14 @@ class WCML_Multi_Currency_Orders {
|
|
280 |
return $items;
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
private function set_converted_totals_for_item( $item ) {
|
284 |
|
285 |
$order_currency = get_post_meta( $_POST['order_id'], '_order_currency', true );
|
@@ -289,7 +283,7 @@ class WCML_Multi_Currency_Orders {
|
|
289 |
}
|
290 |
|
291 |
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( sanitize_text_field( $_POST['item_to_add'][0] ) );
|
292 |
-
$converted_price
|
293 |
|
294 |
if ( ! isset( $this->multi_currency->prices ) ) {
|
295 |
$this->multi_currency->prices = new WCML_Multi_Currency_Prices( $this->multi_currency );
|
@@ -297,20 +291,51 @@ class WCML_Multi_Currency_Orders {
|
|
297 |
$this->multi_currency->prices->prices_init();
|
298 |
}
|
299 |
|
300 |
-
if ( ! $converted_price ) {
|
301 |
-
$converted_price = $this->multi_currency->prices->raw_price_filter( $item['line_subtotal'], $order_currency );
|
302 |
-
$converted_price = $this->multi_currency->prices->raw_price_filter( $item['line_total'], $order_currency );
|
303 |
-
}
|
304 |
-
|
305 |
if ( $item instanceof WC_Order_Item_Product ) {
|
|
|
306 |
if ( 'line_item' === $item->get_type() ) {
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
$item->save();
|
310 |
}
|
311 |
} else {
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
315 |
|
316 |
return array( $item, $order_currency );
|
34 |
add_action( 'woocommerce_process_shop_order_meta', array( $this, 'set_order_currency_on_update' ), 10, 2 );
|
35 |
add_action( 'woocommerce_order_actions_start', array( $this, 'show_order_currency_selector' ) );
|
36 |
|
|
|
37 |
add_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ) );
|
38 |
+
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'add_woocommerce_hidden_order_itemmeta' ) );
|
39 |
|
40 |
add_action( 'wp_ajax_wcml_order_set_currency', array( $this, 'set_order_currency_on_ajax_update' ) );
|
41 |
|
254 |
|
255 |
}
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
public function set_totals_for_order_items( $items ) {
|
258 |
|
259 |
if ( isset( $_POST['action'] ) && 'woocommerce_add_order_item' === $_POST['action'] ) {
|
266 |
return $items;
|
267 |
}
|
268 |
|
269 |
+
public function add_woocommerce_hidden_order_itemmeta( $itemmeta ) {
|
270 |
+
|
271 |
+
$itemmeta[] = 'wcml_converted_subtotal';
|
272 |
+
$itemmeta[] = 'wcml_converted_total';
|
273 |
+
|
274 |
+
return $itemmeta;
|
275 |
+
}
|
276 |
+
|
277 |
private function set_converted_totals_for_item( $item ) {
|
278 |
|
279 |
$order_currency = get_post_meta( $_POST['order_id'], '_order_currency', true );
|
283 |
}
|
284 |
|
285 |
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( sanitize_text_field( $_POST['item_to_add'][0] ) );
|
286 |
+
$converted_price = $converted_subtotal_price = $converted_total_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
|
287 |
|
288 |
if ( ! isset( $this->multi_currency->prices ) ) {
|
289 |
$this->multi_currency->prices = new WCML_Multi_Currency_Prices( $this->multi_currency );
|
291 |
$this->multi_currency->prices->prices_init();
|
292 |
}
|
293 |
|
|
|
|
|
|
|
|
|
|
|
294 |
if ( $item instanceof WC_Order_Item_Product ) {
|
295 |
+
|
296 |
if ( 'line_item' === $item->get_type() ) {
|
297 |
+
|
298 |
+
if ( ! $converted_price ) {
|
299 |
+
if( $item->meta_exists( 'wcml_converted_subtotal' ) ){
|
300 |
+
$converted_subtotal_price = $item->get_meta( 'wcml_converted_subtotal' );
|
301 |
+
}else{
|
302 |
+
$converted_subtotal_price = $this->multi_currency->prices->raw_price_filter( $item->get_subtotal(), $order_currency );
|
303 |
+
$item->add_meta_data('wcml_converted_subtotal', $converted_subtotal_price );
|
304 |
+
}
|
305 |
+
|
306 |
+
if( $item->meta_exists( 'wcml_converted_total' ) ){
|
307 |
+
$converted_total_price = $item->get_meta( 'wcml_converted_total' );
|
308 |
+
}else{
|
309 |
+
$converted_total_price = $this->multi_currency->prices->raw_price_filter( $item->get_total(), $order_currency );
|
310 |
+
$item->add_meta_data('wcml_converted_total', $converted_total_price );
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
$item->set_subtotal( $converted_subtotal_price );
|
315 |
+
$item->set_total( $converted_total_price );
|
316 |
$item->save();
|
317 |
}
|
318 |
} else {
|
319 |
+
|
320 |
+
if ( ! $converted_price ) {
|
321 |
+
if( isset( $item[ 'wcml_converted_subtotal' ] ) ){
|
322 |
+
$converted_subtotal_price = $item[ 'wcml_converted_subtotal' ];
|
323 |
+
}else{
|
324 |
+
$converted_subtotal_price = $this->multi_currency->prices->raw_price_filter( $item['line_subtotal'], $order_currency );
|
325 |
+
$item[ 'wcml_converted_subtotal' ] = $converted_subtotal_price;
|
326 |
+
}
|
327 |
+
|
328 |
+
if( isset( $item[ 'wcml_converted_total' ] ) ){
|
329 |
+
$converted_total_price = $item[ 'wcml_converted_total' ];
|
330 |
+
}else{
|
331 |
+
$converted_total_price = $this->multi_currency->prices->raw_price_filter( $item['line_total'] , $order_currency );
|
332 |
+
$item[ 'wcml_converted_total' ] = $converted_total_price;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
$item['line_subtotal'] = $converted_subtotal_price;
|
337 |
+
$item['line_total'] = $converted_total_price;
|
338 |
+
$item['mc_total_converted'] = true;
|
339 |
}
|
340 |
|
341 |
return array( $item, $order_currency );
|
inc/currencies/class-wcml-multi-currency-resources.php
CHANGED
@@ -35,11 +35,23 @@ class WCML_Multi_Currency_Resources{
|
|
35 |
'symbol'=> get_woocommerce_currency_symbol( self::$multi_currency->get_client_currency() )
|
36 |
);
|
37 |
|
38 |
-
$script_vars
|
39 |
-
|| ( function_exists( 'wp_cache_is_enabled' ) && wp_cache_is_enabled() );
|
40 |
|
41 |
wp_localize_script('wcml-mc-scripts', 'wcml_mc_settings', $script_vars );
|
42 |
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
35 |
'symbol'=> get_woocommerce_currency_symbol( self::$multi_currency->get_client_currency() )
|
36 |
);
|
37 |
|
38 |
+
$script_vars = self::set_cache_compatibility_variables( $script_vars );
|
|
|
39 |
|
40 |
wp_localize_script('wcml-mc-scripts', 'wcml_mc_settings', $script_vars );
|
41 |
|
42 |
}
|
43 |
|
44 |
+
private static function set_cache_compatibility_variables( $script_vars ){
|
45 |
+
|
46 |
+
$script_vars['w3tc'] = (int) ! empty( self::$multi_currency->W3TC )
|
47 |
+
|| ( function_exists( 'wp_cache_is_enabled' ) && wp_cache_is_enabled() );
|
48 |
+
|
49 |
+
global $sg_cachepress_environment;
|
50 |
+
if( $sg_cachepress_environment ){
|
51 |
+
$script_vars['sg_cachepress'] = $sg_cachepress_environment->cache_is_enabled();
|
52 |
+
}
|
53 |
+
|
54 |
+
return $script_vars;
|
55 |
+
}
|
56 |
+
|
57 |
}
|
inc/template-classes/class-wcml-custom-taxonomy-translation-ui.php
CHANGED
@@ -7,7 +7,7 @@ class WCML_Custom_Taxonomy_Translation_UI extends WPML_Templates_Factory {
|
|
7 |
private $sitepress;
|
8 |
|
9 |
private $custom_taxonomies = array();
|
10 |
-
private $product_builtin_taxonomy_names = array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type' ); //'product_type' is used for tags (?)
|
11 |
|
12 |
|
13 |
public function __construct( &$woocommerce_wpml, &$sitepress ){
|
@@ -23,6 +23,7 @@ class WCML_Custom_Taxonomy_Translation_UI extends WPML_Templates_Factory {
|
|
23 |
}
|
24 |
|
25 |
$product_taxonomies = get_object_taxonomies( 'product', 'objects' );
|
|
|
26 |
foreach( $product_taxonomies as $product_taxonomy_name => $product_taxonomy_object ){
|
27 |
if(
|
28 |
!isset( $product_attributes[$product_taxonomy_name] ) &&
|
7 |
private $sitepress;
|
8 |
|
9 |
private $custom_taxonomies = array();
|
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 |
public function __construct( &$woocommerce_wpml, &$sitepress ){
|
23 |
}
|
24 |
|
25 |
$product_taxonomies = get_object_taxonomies( 'product', 'objects' );
|
26 |
+
|
27 |
foreach( $product_taxonomies as $product_taxonomy_name => $product_taxonomy_object ){
|
28 |
if(
|
29 |
!isset( $product_attributes[$product_taxonomy_name] ) &&
|
inc/template-classes/class-wcml-menus-wrap.php
CHANGED
@@ -5,7 +5,7 @@ class WCML_Menus_Wrap extends WPML_Templates_Factory {
|
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
private $product_attribute_names = array();
|
8 |
-
private $product_builtin_taxonomy_names = array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type' ); //'product_type' is used for tags (?)
|
9 |
private $product_extra_taxonomy_names = array();
|
10 |
|
11 |
private $product_attributes = array();
|
5 |
private $woocommerce_wpml;
|
6 |
|
7 |
private $product_attribute_names = array();
|
8 |
+
private $product_builtin_taxonomy_names = array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type', 'translation_priority' ); //'product_type' is used for tags (?)
|
9 |
private $product_extra_taxonomy_names = array();
|
10 |
|
11 |
private $product_attributes = array();
|
inc/translation-editor/class-wcml-synchronize-product-data.php
CHANGED
@@ -324,6 +324,8 @@ class WCML_Synchronize_Product_Data{
|
|
324 |
$qty = $item[ 'qty' ];
|
325 |
}
|
326 |
|
|
|
|
|
327 |
if( $variation_id > 0 ){
|
328 |
$trid = $this->sitepress->get_element_trid( $variation_id, 'post_product_variation' );
|
329 |
$translations = $this->sitepress->get_element_translations( $trid, 'post_product_variation' );
|
324 |
$qty = $item[ 'qty' ];
|
325 |
}
|
326 |
|
327 |
+
$qty = apply_filters( 'wcml_order_item_quantity', $qty, $order, $item );
|
328 |
+
|
329 |
if( $variation_id > 0 ){
|
330 |
$trid = $this->sitepress->get_element_trid( $variation_id, 'post_product_variation' );
|
331 |
$translations = $this->sitepress->get_element_translations( $trid, 'post_product_variation' );
|
inc/translation-editor/class-wcml-synchronize-variations-data.php
CHANGED
@@ -260,9 +260,13 @@ class WCML_Synchronize_Variations_Data{
|
|
260 |
// adjust the global attribute slug in the custom field
|
261 |
$attid = null;
|
262 |
if( substr( $meta_key, 0, 10 ) == 'attribute_' ) {
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
if( $meta_key == '_stock'){
|
260 |
// adjust the global attribute slug in the custom field
|
261 |
$attid = null;
|
262 |
if( substr( $meta_key, 0, 10 ) == 'attribute_' ) {
|
263 |
+
if( $meta_value ){
|
264 |
+
$trn_post_meta = $this->woocommerce_wpml->attributes->get_translated_variation_attribute_post_meta( $meta_value, $meta_key, $original_variation_id, $variation_id, $lang );
|
265 |
+
$meta_value = $trn_post_meta['meta_value'];
|
266 |
+
$meta_key = $trn_post_meta['meta_key'];
|
267 |
+
}else{
|
268 |
+
$meta_value = '';
|
269 |
+
}
|
270 |
}
|
271 |
|
272 |
if( $meta_key == '_stock'){
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilin
|
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.9
|
7 |
-
Tested up to: 4.9.
|
8 |
-
Stable tag: 4.2.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -142,6 +142,25 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
= 4.2.9 =
|
146 |
* Fix wrong qty in cart page for same product and different language
|
147 |
* Fix changes for WC 3.3 in order page for second language
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.9
|
7 |
+
Tested up to: 4.9.5
|
8 |
+
Stable tag: 4.2.10
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 4.2.10 =
|
146 |
+
* Fix compatibility issues with PHP 7.1
|
147 |
+
* Fix issue with product slug when using language per domain in WPML
|
148 |
+
* Removed notice when set domain per language in WPML
|
149 |
+
* WooCommerce Bookings: Added support to translate booking emails
|
150 |
+
* Removed warning from translation editor when set display as translated
|
151 |
+
* Added compatibility for unsupported WooCommerce themes
|
152 |
+
* Removed some custom WPML taxonomies from plugin's Dashboard
|
153 |
+
* Fix an error with product variations which you cannot add them in cart if display as translated feature is used
|
154 |
+
* WooCommerce Composite Products: Fix Default option sync when using component option category
|
155 |
+
* WooCommerce Subscriptions: Fix Sign-up fee recalculation cost in some situations
|
156 |
+
* Theme Storefront: Fix Cart widget currency symbol not switched after switching currency
|
157 |
+
* Siteground Optimizer: Fix an issue with currency switcher
|
158 |
+
* Wrong price when manually adding product to an order with multicurrency enabled
|
159 |
+
* WooCommerce Bookings : Fix Block cost recalculation in second currency
|
160 |
+
* Added filter for oder_item_quantity
|
161 |
+
* Fix issue in endpoints when set My Account as homepage
|
162 |
+
* WooCommerce Dynamic Pricing: Fix Order total rules by category
|
163 |
+
|
164 |
= 4.2.9 =
|
165 |
* Fix wrong qty in cart page for same product and different language
|
166 |
* Fix changes for WC 3.3 in order page for second language
|
res/js/cart_widget.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
try {
|
3 |
-
var cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash';
|
4 |
-
|
5 |
-
if (sessionStorage.getItem( 'woocommerce_cart_hash' ) == '' || actions.is_lang_switched == 1 || actions.is_currency_switched == 1 || actions.force_reset == 1 ) {
|
6 |
-
sessionStorage.removeItem( actions.cart_fragment );
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
} catch(err){
|
12 |
-
//console.log(err.message);
|
13 |
}
|
14 |
});
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
var empty_cart_hash = sessionStorage.getItem('woocommerce_cart_hash') == '';
|
4 |
+
if ( empty_cart_hash || actions.is_lang_switched == 1 || actions.force_reset == 1 ) {
|
5 |
+
wcml_reset_cart_fragments();
|
|
|
|
|
6 |
}
|
7 |
});
|
8 |
|
9 |
+
function wcml_reset_cart_fragments(){
|
10 |
+
try {
|
11 |
+
jQuery( document.body ).trigger( 'wc_fragment_refresh' );
|
12 |
+
//backward compatibility for WC < 3.0
|
13 |
+
sessionStorage.removeItem( 'wc_fragments' );
|
14 |
+
} catch(err){}
|
15 |
+
}
|
res/js/cart_widget.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
1 |
+
jQuery(document).ready(function($){var empty_cart_hash=sessionStorage.getItem("woocommerce_cart_hash")=="";if(empty_cart_hash||actions.is_lang_switched==1||actions.force_reset==1){wcml_reset_cart_fragments()}});function wcml_reset_cart_fragments(){try{jQuery(document.body).trigger("wc_fragment_refresh");sessionStorage.removeItem("wc_fragments")}catch(err){}}
|
res/js/multi-currency.js
CHANGED
@@ -323,7 +323,7 @@ jQuery( function($){
|
|
323 |
var elem = $( '#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]' );
|
324 |
|
325 |
if( currency ){
|
326 |
-
elem = $( '#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]:not([data-currency="'+currency+'"]' );
|
327 |
}
|
328 |
|
329 |
if( elem.length == 0 ){
|
323 |
var elem = $( '#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]' );
|
324 |
|
325 |
if( currency ){
|
326 |
+
elem = $( '#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]:not([data-currency="'+currency+'"])' );
|
327 |
}
|
328 |
|
329 |
if( elem.length == 0 ){
|
res/js/wcml-multi-currency.js
CHANGED
@@ -40,7 +40,7 @@ function wcml_load_currency( currency, force_switch ){
|
|
40 |
}else{
|
41 |
|
42 |
var target_location = window.location.href;
|
43 |
-
if(-1 !== target_location.indexOf('#') || wcml_mc_settings.w3tc ){
|
44 |
|
45 |
var url_dehash = target_location.split('#');
|
46 |
var hash = url_dehash.length > 1 ? '#' + url_dehash[1] : '';
|
@@ -53,6 +53,9 @@ function wcml_load_currency( currency, force_switch ){
|
|
53 |
target_location += url_glue + 'wcmlc=' + currency + hash;
|
54 |
|
55 |
}
|
|
|
|
|
|
|
56 |
window.location = target_location;
|
57 |
|
58 |
}
|
40 |
}else{
|
41 |
|
42 |
var target_location = window.location.href;
|
43 |
+
if(-1 !== target_location.indexOf('#') || wcml_mc_settings.w3tc || wcml_mc_settings.sg_cachepress ){
|
44 |
|
45 |
var url_dehash = target_location.split('#');
|
46 |
var hash = url_dehash.length > 1 ? '#' + url_dehash[1] : '';
|
53 |
target_location += url_glue + 'wcmlc=' + currency + hash;
|
54 |
|
55 |
}
|
56 |
+
|
57 |
+
wcml_reset_cart_fragments();
|
58 |
+
|
59 |
window.location = target_location;
|
60 |
|
61 |
}
|
res/js/wcml-multi-currency.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery(document).on("click",".wcml_currency_switcher a",function(
|
1 |
+
jQuery(document).ready(function(){jQuery(document).on("click",".wcml_currency_switcher a",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"))});if(typeof woocommerce_price_slider_params!=="undefined"){woocommerce_price_slider_params.currency_symbol=wcml_mc_settings.current_currency.symbol}});function wcml_load_currency(currency,force_switch){var ajax_loader=jQuery('<img style="margin-left:10px;" width="16" heigth="16" src="'+wcml_mc_settings.wcml_spinner+'" />');jQuery(".wcml_currency_switcher").after();ajax_loader.insertAfter(jQuery(".wcml_currency_switcher"));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.w3tc||wcml_mc_settings.sg_cachepress){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}window.location=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 ComposerAutoloaderInit9222072d16310fd8875b75abebc0359a::getLoader();
|
vendor/autoload_52.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit1ec5c1cf744145194d089d1c0c1b0f4b::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
|
|
379 |
$subPath = substr($subPath, 0, $lastPos);
|
380 |
$search = $subPath.'\\';
|
381 |
if (isset($this->prefixDirsPsr4[$search])) {
|
|
|
382 |
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
383 |
-
$
|
384 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
385 |
return $file;
|
386 |
}
|
387 |
}
|
379 |
$subPath = substr($subPath, 0, $lastPos);
|
380 |
$search = $subPath.'\\';
|
381 |
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
|
|
385 |
return $file;
|
386 |
}
|
387 |
}
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -382,6 +382,7 @@ return array(
|
|
382 |
'WCML_Products_UI' => $baseDir . '/inc/template-classes/class-wcml-products-ui.php',
|
383 |
'WCML_REST_API_Support' => $baseDir . '/inc/rest-api-support/class-wcml-rest-api-support.php',
|
384 |
'WCML_REST_API_Support_V1' => $baseDir . '/inc/rest-api-support/class-wcml-rest-api-support-v1.php',
|
|
|
385 |
'WCML_Removed_Cart_Items_UI' => $baseDir . '/inc/template-classes/class-wcml-removed-cart-items-ui.php',
|
386 |
'WCML_Reports' => $baseDir . '/inc/class-wcml-reports.php',
|
387 |
'WCML_Requests' => $baseDir . '/inc/class-wcml-requests.php',
|
382 |
'WCML_Products_UI' => $baseDir . '/inc/template-classes/class-wcml-products-ui.php',
|
383 |
'WCML_REST_API_Support' => $baseDir . '/inc/rest-api-support/class-wcml-rest-api-support.php',
|
384 |
'WCML_REST_API_Support_V1' => $baseDir . '/inc/rest-api-support/class-wcml-rest-api-support-v1.php',
|
385 |
+
'WCML_Relevanssi' => $baseDir . '/compatibility/class-wcml-relevanssi.php',
|
386 |
'WCML_Removed_Cart_Items_UI' => $baseDir . '/inc/template-classes/class-wcml-removed-cart-items-ui.php',
|
387 |
'WCML_Reports' => $baseDir . '/inc/class-wcml-reports.php',
|
388 |
'WCML_Requests' => $baseDir . '/inc/class-wcml-requests.php',
|
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 ComposerAutoloaderInit04e97305d0c987e2e8eafee869450c7e
|
|
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) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit9222072d16310fd8875b75abebc0359a
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit9222072d16310fd8875b75abebc0359a', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit9222072d16310fd8875b75abebc0359a', '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\ComposerStaticInit9222072d16310fd8875b75abebc0359a::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_real_52.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
-
class
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitb88a9af106aecc7c862145d37cadd07b {
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
+
class ComposerAutoloaderInit1ec5c1cf744145194d089d1c0c1b0f4b {
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit1ec5c1cf744145194d089d1c0c1b0f4b', 'loadClassLoader'), true /*, true */);
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit1ec5c1cf744145194d089d1c0c1b0f4b', 'loadClassLoader'));
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
@@ -414,6 +414,7 @@ class ComposerStaticInit04e97305d0c987e2e8eafee869450c7e
|
|
414 |
'WCML_Products_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-products-ui.php',
|
415 |
'WCML_REST_API_Support' => __DIR__ . '/../..' . '/inc/rest-api-support/class-wcml-rest-api-support.php',
|
416 |
'WCML_REST_API_Support_V1' => __DIR__ . '/../..' . '/inc/rest-api-support/class-wcml-rest-api-support-v1.php',
|
|
|
417 |
'WCML_Removed_Cart_Items_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-removed-cart-items-ui.php',
|
418 |
'WCML_Reports' => __DIR__ . '/../..' . '/inc/class-wcml-reports.php',
|
419 |
'WCML_Requests' => __DIR__ . '/../..' . '/inc/class-wcml-requests.php',
|
@@ -483,10 +484,10 @@ class ComposerStaticInit04e97305d0c987e2e8eafee869450c7e
|
|
483 |
public static function getInitializer(ClassLoader $loader)
|
484 |
{
|
485 |
return \Closure::bind(function () use ($loader) {
|
486 |
-
$loader->prefixLengthsPsr4 =
|
487 |
-
$loader->prefixDirsPsr4 =
|
488 |
-
$loader->prefixesPsr0 =
|
489 |
-
$loader->classMap =
|
490 |
|
491 |
}, null, ClassLoader::class);
|
492 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit9222072d16310fd8875b75abebc0359a
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
414 |
'WCML_Products_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-products-ui.php',
|
415 |
'WCML_REST_API_Support' => __DIR__ . '/../..' . '/inc/rest-api-support/class-wcml-rest-api-support.php',
|
416 |
'WCML_REST_API_Support_V1' => __DIR__ . '/../..' . '/inc/rest-api-support/class-wcml-rest-api-support-v1.php',
|
417 |
+
'WCML_Relevanssi' => __DIR__ . '/../..' . '/compatibility/class-wcml-relevanssi.php',
|
418 |
'WCML_Removed_Cart_Items_UI' => __DIR__ . '/../..' . '/inc/template-classes/class-wcml-removed-cart-items-ui.php',
|
419 |
'WCML_Reports' => __DIR__ . '/../..' . '/inc/class-wcml-reports.php',
|
420 |
'WCML_Requests' => __DIR__ . '/../..' . '/inc/class-wcml-requests.php',
|
484 |
public static function getInitializer(ClassLoader $loader)
|
485 |
{
|
486 |
return \Closure::bind(function () use ($loader) {
|
487 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit9222072d16310fd8875b75abebc0359a::$prefixLengthsPsr4;
|
488 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit9222072d16310fd8875b75abebc0359a::$prefixDirsPsr4;
|
489 |
+
$loader->prefixesPsr0 = ComposerStaticInit9222072d16310fd8875b75abebc0359a::$prefixesPsr0;
|
490 |
+
$loader->classMap = ComposerStaticInit9222072d16310fd8875b75abebc0359a::$classMap;
|
491 |
|
492 |
}, null, ClassLoader::class);
|
493 |
}
|
vendor/otgs/installer/includes/class-installer-theme.php
CHANGED
@@ -936,7 +936,7 @@ class Installer_Theme_Class {
|
|
936 |
public function installer_theme_filter_themes_by_subscription( $themes, $active_tab ) {
|
937 |
|
938 |
//Step1, we only filter OTGS themes
|
939 |
-
$orig = count( $themes );
|
940 |
if ( in_array( $active_tab, $this->theme_repo ) ) {
|
941 |
//OTGS Theme
|
942 |
//Step2, we retrieved the available themes based on client subscription
|
@@ -959,7 +959,7 @@ class Installer_Theme_Class {
|
|
959 |
}
|
960 |
}
|
961 |
}
|
962 |
-
$new = count( $themes );
|
963 |
if ( $orig != $new ) {
|
964 |
//It is filtered
|
965 |
$themes = array_values( $themes );
|
936 |
public function installer_theme_filter_themes_by_subscription( $themes, $active_tab ) {
|
937 |
|
938 |
//Step1, we only filter OTGS themes
|
939 |
+
$orig = is_array( $themes ) ? count( $themes ) : 0;
|
940 |
if ( in_array( $active_tab, $this->theme_repo ) ) {
|
941 |
//OTGS Theme
|
942 |
//Step2, we retrieved the available themes based on client subscription
|
959 |
}
|
960 |
}
|
961 |
}
|
962 |
+
$new = is_array( $themes ) ? count( $themes ) : 0;
|
963 |
if ( $orig != $new ) {
|
964 |
//It is filtered
|
965 |
$themes = array_values( $themes );
|
vendor/otgs/installer/includes/class-otgs-installer-filename-hooks.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class OTGS_Installer_Filename_Hooks {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @var OTGS_Installer_PHP_Functions
|
7 |
+
*/
|
8 |
+
private $built_in_functions;
|
9 |
+
|
10 |
+
public function __construct( OTGS_Installer_PHP_Functions $built_in_functions ) {
|
11 |
+
$this->built_in_functions = $built_in_functions;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function add_hooks() {
|
15 |
+
if ( in_array( $this->built_in_functions->constant( 'PHP_OS' ), array( 'WIN32', 'WINNT', 'Windows' ), true ) ) {
|
16 |
+
add_filter( 'wp_unique_filename', array( $this, 'fix_filename_for_win' ), 10, 3 );
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @param string $filename
|
22 |
+
* @param string $ext
|
23 |
+
* @param string $dir
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function fix_filename_for_win( $filename, $ext, $dir ) {
|
28 |
+
if ( $dir === get_temp_dir() ) {
|
29 |
+
return md5( $filename . $this->built_in_functions->time() ) . 'tmp';
|
30 |
+
}
|
31 |
+
return $filename;
|
32 |
+
}
|
33 |
+
}
|
vendor/otgs/installer/includes/class-otgs-installer-php-functions.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class OTGS_Installer_PHP_Functions {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @param string $constant_name
|
7 |
+
*
|
8 |
+
* @return bool
|
9 |
+
*/
|
10 |
+
public function defined( $constant_name ) {
|
11 |
+
return defined( $constant_name );
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @param string $constant_name
|
16 |
+
*
|
17 |
+
* @return string|int|null
|
18 |
+
*/
|
19 |
+
public function constant( $constant_name ) {
|
20 |
+
return $this->defined( $constant_name ) ? constant( $constant_name ) : null;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return int
|
25 |
+
*/
|
26 |
+
public function time() {
|
27 |
+
return time();
|
28 |
+
}
|
29 |
+
}
|
vendor/otgs/installer/includes/class-wp-installer.php
CHANGED
@@ -302,24 +302,19 @@ final class WP_Installer {
|
|
302 |
foreach ( $this->settings['repositories'] as $repository_id => $repository ) {
|
303 |
|
304 |
foreach ( $repository['data']['packages'] as $package ) {
|
305 |
-
|
306 |
foreach ( $package['products'] as $product ) {
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
);
|
317 |
}
|
318 |
-
|
319 |
}
|
320 |
-
|
321 |
}
|
322 |
-
|
323 |
}
|
324 |
|
325 |
foreach ( $plugins as $plugin_id => $plugin ) {
|
@@ -547,7 +542,7 @@ final class WP_Installer {
|
|
547 |
);
|
548 |
|
549 |
if ( ! empty( $response['error'] ) ) {
|
550 |
-
$this->remove_site_key( $repository_id );
|
551 |
|
552 |
$this->admin_messages[] = array(
|
553 |
'type' => 'error',
|
@@ -652,6 +647,19 @@ final class WP_Installer {
|
|
652 |
return $site_url;
|
653 |
}
|
654 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
public function show_site_key_nags() {
|
656 |
$screen = get_current_screen();
|
657 |
|
@@ -1016,8 +1024,10 @@ final class WP_Installer {
|
|
1016 |
// downloads
|
1017 |
if ( isset( $subscription_type ) && ! $expired && ( $product['subscription_type'] == $subscription_type || $product['subscription_type_equivalent'] == $subscription_type ) ) {
|
1018 |
|
1019 |
-
|
1020 |
-
|
|
|
|
|
1021 |
}
|
1022 |
|
1023 |
}
|
@@ -1162,7 +1172,8 @@ final class WP_Installer {
|
|
1162 |
$this->settings['repositories'][ $repository_id ]['subscription'] = array(
|
1163 |
'key' => $site_key,
|
1164 |
'data' => $subscription_data,
|
1165 |
-
'registered_by' => get_current_user_id()
|
|
|
1166 |
);
|
1167 |
$this->save_settings();
|
1168 |
} else {
|
@@ -1209,11 +1220,13 @@ final class WP_Installer {
|
|
1209 |
return WP_Installer::get_repository_site_key( $repository_id );
|
1210 |
}
|
1211 |
|
1212 |
-
public function remove_site_key( $repository_id ) {
|
1213 |
if ( isset( $this->settings['repositories'][ $repository_id ] ) ) {
|
1214 |
unset( $this->settings['repositories'][ $repository_id ]['subscription'] );
|
1215 |
$this->save_settings();
|
1216 |
-
$
|
|
|
|
|
1217 |
}
|
1218 |
}
|
1219 |
|
@@ -1565,20 +1578,22 @@ final class WP_Installer {
|
|
1565 |
|
1566 |
foreach ( $package['products'] as $product ) {
|
1567 |
|
1568 |
-
|
|
|
1569 |
|
1570 |
-
|
1571 |
|
1572 |
-
|
1573 |
|
1574 |
-
|
1575 |
|
1576 |
-
|
|
|
|
|
1577 |
|
1578 |
}
|
1579 |
|
1580 |
}
|
1581 |
-
|
1582 |
}
|
1583 |
|
1584 |
}
|
@@ -2249,33 +2264,30 @@ final class WP_Installer {
|
|
2249 |
}
|
2250 |
|
2251 |
foreach ( $repository['data']['packages'] as $package ) {
|
2252 |
-
|
2253 |
foreach ( $package['products'] as $product ) {
|
|
|
|
|
2254 |
|
2255 |
-
|
|
|
|
|
|
|
2256 |
|
2257 |
-
|
2258 |
-
if ( ! empty( $download['free-on-wporg'] ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION ) {
|
2259 |
-
continue;
|
2260 |
-
}
|
2261 |
|
2262 |
-
|
|
|
|
|
|
|
|
|
|
|
2263 |
|
2264 |
-
if ( ! $site_key || ! $this->plugin_is_registered( $repository_id, $download['slug'] ) ) {
|
2265 |
-
add_action( "after_plugin_row_" . $plugin_id, array(
|
2266 |
-
$this,
|
2267 |
-
'show_purchase_notice_under_plugin'
|
2268 |
-
), 10, 3 );
|
2269 |
}
|
2270 |
|
2271 |
}
|
2272 |
-
|
2273 |
}
|
2274 |
-
|
2275 |
}
|
2276 |
-
|
2277 |
}
|
2278 |
-
|
2279 |
}
|
2280 |
|
2281 |
}
|
@@ -2554,11 +2566,11 @@ final class WP_Installer {
|
|
2554 |
}
|
2555 |
|
2556 |
// order parents
|
2557 |
-
usort( $ordered_packages, array( $this, '
|
2558 |
//order sub-packages
|
2559 |
foreach ( $ordered_packages as $package_id => $package ) {
|
2560 |
if ( ! empty( $package['sub-packages'] ) ) {
|
2561 |
-
|
2562 |
}
|
2563 |
}
|
2564 |
|
@@ -2571,8 +2583,8 @@ final class WP_Installer {
|
|
2571 |
|
2572 |
}
|
2573 |
|
2574 |
-
public function
|
2575 |
-
|
2576 |
}
|
2577 |
|
2578 |
public function get_support_tag_by_name( $name, $repository ) {
|
@@ -2765,4 +2777,13 @@ final class WP_Installer {
|
|
2765 |
|
2766 |
}
|
2767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2768 |
}
|
302 |
foreach ( $this->settings['repositories'] as $repository_id => $repository ) {
|
303 |
|
304 |
foreach ( $repository['data']['packages'] as $package ) {
|
|
|
305 |
foreach ( $package['products'] as $product ) {
|
306 |
+
if ( $this->has_plugins( $product ) ) {
|
307 |
+
foreach ( $product['plugins'] as $plugin_slug ) {
|
308 |
+
$download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
|
309 |
+
if ( ! isset( $repositories_plugins[ $repository_id ][ $download['slug'] ] ) ) {
|
310 |
+
$repositories_plugins[ $repository_id ][ $download['slug'] ] = array(
|
311 |
+
'name' => $download['name'],
|
312 |
+
'registered' => $this->plugin_is_registered( $repository_id, $download['slug'] ) ? 1 : 0
|
313 |
+
);
|
314 |
+
}
|
|
|
315 |
}
|
|
|
316 |
}
|
|
|
317 |
}
|
|
|
318 |
}
|
319 |
|
320 |
foreach ( $plugins as $plugin_id => $plugin ) {
|
542 |
);
|
543 |
|
544 |
if ( ! empty( $response['error'] ) ) {
|
545 |
+
$this->remove_site_key( $repository_id, false );
|
546 |
|
547 |
$this->admin_messages[] = array(
|
548 |
'type' => 'error',
|
647 |
return $site_url;
|
648 |
}
|
649 |
|
650 |
+
/**
|
651 |
+
* @param string $repository_id
|
652 |
+
*
|
653 |
+
* @return string|null
|
654 |
+
*/
|
655 |
+
public function get_registered_site_url( $repository_id ) {
|
656 |
+
if ( isset( $this->settings['repositories'][ $repository_id ]['subscription']['site_url'] ) ) {
|
657 |
+
return $this->settings['repositories'][ $repository_id ]['subscription']['site_url'];
|
658 |
+
}
|
659 |
+
|
660 |
+
return null;
|
661 |
+
}
|
662 |
+
|
663 |
public function show_site_key_nags() {
|
664 |
$screen = get_current_screen();
|
665 |
|
1024 |
// downloads
|
1025 |
if ( isset( $subscription_type ) && ! $expired && ( $product['subscription_type'] == $subscription_type || $product['subscription_type_equivalent'] == $subscription_type ) ) {
|
1026 |
|
1027 |
+
if ( $this->has_plugins( $product ) ) {
|
1028 |
+
foreach ( $product['plugins'] as $plugin_slug ) {
|
1029 |
+
$row['downloads'][ $plugin_slug ] = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
|
1030 |
+
}
|
1031 |
}
|
1032 |
|
1033 |
}
|
1172 |
$this->settings['repositories'][ $repository_id ]['subscription'] = array(
|
1173 |
'key' => $site_key,
|
1174 |
'data' => $subscription_data,
|
1175 |
+
'registered_by' => get_current_user_id(),
|
1176 |
+
'site_url' => get_site_url(),
|
1177 |
);
|
1178 |
$this->save_settings();
|
1179 |
} else {
|
1220 |
return WP_Installer::get_repository_site_key( $repository_id );
|
1221 |
}
|
1222 |
|
1223 |
+
public function remove_site_key( $repository_id, $refresh_repositories_data = true ) {
|
1224 |
if ( isset( $this->settings['repositories'][ $repository_id ] ) ) {
|
1225 |
unset( $this->settings['repositories'][ $repository_id ]['subscription'] );
|
1226 |
$this->save_settings();
|
1227 |
+
if( $refresh_repositories_data ){
|
1228 |
+
$this->refresh_repositories_data();
|
1229 |
+
}
|
1230 |
}
|
1231 |
}
|
1232 |
|
1578 |
|
1579 |
foreach ( $package['products'] as $product ) {
|
1580 |
|
1581 |
+
if ( $this->has_plugins( $product ) ) {
|
1582 |
+
foreach ( $product['plugins'] as $plugin_slug ) {
|
1583 |
|
1584 |
+
$download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
|
1585 |
|
1586 |
+
if ( $download['slug'] == $slug || $download['name'] == $plugin['Name'] || $download['name'] == $plugin['Title'] ) { //match order: slug, name, title
|
1587 |
|
1588 |
+
if ( isset( $subscriptions_with_warnings[ $product['subscription_type'] ] ) ) {
|
1589 |
|
1590 |
+
$this->_plugins_renew_warnings[ $plugin_id ] = $subscriptions_with_warnings[ $product['subscription_type'] ];
|
1591 |
+
|
1592 |
+
}
|
1593 |
|
1594 |
}
|
1595 |
|
1596 |
}
|
|
|
1597 |
}
|
1598 |
|
1599 |
}
|
2264 |
}
|
2265 |
|
2266 |
foreach ( $repository['data']['packages'] as $package ) {
|
|
|
2267 |
foreach ( $package['products'] as $product ) {
|
2268 |
+
if ( $this->has_plugins( $product ) ) {
|
2269 |
+
foreach ( $product['plugins'] as $plugin_slug ) {
|
2270 |
|
2271 |
+
$download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
|
2272 |
+
if ( ! empty( $download['free-on-wporg'] ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION ) {
|
2273 |
+
continue;
|
2274 |
+
}
|
2275 |
|
2276 |
+
if ( $download['slug'] == $slug || $download['name'] == $name ) {
|
|
|
|
|
|
|
2277 |
|
2278 |
+
if ( ! $site_key || ! $this->plugin_is_registered( $repository_id, $download['slug'] ) ) {
|
2279 |
+
add_action( "after_plugin_row_" . $plugin_id, array(
|
2280 |
+
$this,
|
2281 |
+
'show_purchase_notice_under_plugin'
|
2282 |
+
), 10, 3 );
|
2283 |
+
}
|
2284 |
|
|
|
|
|
|
|
|
|
|
|
2285 |
}
|
2286 |
|
2287 |
}
|
|
|
2288 |
}
|
|
|
2289 |
}
|
|
|
2290 |
}
|
|
|
2291 |
}
|
2292 |
|
2293 |
}
|
2566 |
}
|
2567 |
|
2568 |
// order parents
|
2569 |
+
usort( $ordered_packages, array( $this, 'compare_package_order' ) );
|
2570 |
//order sub-packages
|
2571 |
foreach ( $ordered_packages as $package_id => $package ) {
|
2572 |
if ( ! empty( $package['sub-packages'] ) ) {
|
2573 |
+
usort( $ordered_packages[ $package_id ]['sub-packages'], array( $this, 'compare_package_order' ) );
|
2574 |
}
|
2575 |
}
|
2576 |
|
2583 |
|
2584 |
}
|
2585 |
|
2586 |
+
public function compare_package_order($a, $b) {
|
2587 |
+
return $a['order'] > $b['order'];
|
2588 |
}
|
2589 |
|
2590 |
public function get_support_tag_by_name( $name, $repository ) {
|
2777 |
|
2778 |
}
|
2779 |
|
2780 |
+
/**
|
2781 |
+
* @param array $product
|
2782 |
+
*
|
2783 |
+
* @return bool
|
2784 |
+
*/
|
2785 |
+
private function has_plugins( $product ) {
|
2786 |
+
return isset( $product['plugins'] ) && is_array( $product['plugins'] );
|
2787 |
+
}
|
2788 |
+
|
2789 |
}
|
vendor/otgs/installer/installer.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
define( 'WP_INSTALLER_VERSION', '1.8.
|
3 |
|
4 |
include_once dirname( __FILE__ ) . '/includes/functions-core.php';
|
5 |
include_once dirname( __FILE__ ) . '/includes/class-wp-installer.php';
|
@@ -9,10 +9,14 @@ include_once WP_Installer()->plugin_path() . '/includes/class-translation-servic
|
|
9 |
include_once WP_Installer()->plugin_path() . '/includes/class-installer-dependencies.php';
|
10 |
include_once WP_Installer()->plugin_path() . '/includes/class-wp-installer-channels.php';
|
11 |
|
|
|
|
|
|
|
12 |
include_once WP_Installer()->plugin_path() . '/includes/functions-templates.php';
|
13 |
|
14 |
// Initialization
|
15 |
WP_Installer();
|
16 |
WP_Installer_Channels();
|
17 |
|
18 |
-
|
|
1 |
<?php
|
2 |
+
define( 'WP_INSTALLER_VERSION', '1.8.8' );
|
3 |
|
4 |
include_once dirname( __FILE__ ) . '/includes/functions-core.php';
|
5 |
include_once dirname( __FILE__ ) . '/includes/class-wp-installer.php';
|
9 |
include_once WP_Installer()->plugin_path() . '/includes/class-installer-dependencies.php';
|
10 |
include_once WP_Installer()->plugin_path() . '/includes/class-wp-installer-channels.php';
|
11 |
|
12 |
+
include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-filename-hooks.php';
|
13 |
+
include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-php-functions.php';
|
14 |
+
|
15 |
include_once WP_Installer()->plugin_path() . '/includes/functions-templates.php';
|
16 |
|
17 |
// Initialization
|
18 |
WP_Installer();
|
19 |
WP_Installer_Channels();
|
20 |
|
21 |
+
$filename_hooks = new OTGS_Installer_Filename_Hooks( new OTGS_Installer_PHP_Functions() );
|
22 |
+
$filename_hooks->add_hooks();
|
vendor/otgs/installer/loader.php
CHANGED
@@ -19,7 +19,7 @@ $wp_installer_instance = dirname(__FILE__) . '/installer.php';
|
|
19 |
global $wp_installer_instances;
|
20 |
$wp_installer_instances[$wp_installer_instance] = array(
|
21 |
'bootfile' => $wp_installer_instance,
|
22 |
-
'version' => '1.8.
|
23 |
);
|
24 |
|
25 |
|
19 |
global $wp_installer_instances;
|
20 |
$wp_installer_instances[$wp_installer_instance] = array(
|
21 |
'bootfile' => $wp_installer_instance,
|
22 |
+
'version' => '1.8.8'
|
23 |
);
|
24 |
|
25 |
|
wpml-woocommerce.php
CHANGED
@@ -7,17 +7,17 @@
|
|
7 |
Author URI: http://www.onthegosystems.com/
|
8 |
Text Domain: woocommerce-multilingual
|
9 |
Requires at least: 3.9
|
10 |
-
Tested up to: 4.9
|
11 |
-
Version: 4.2.
|
12 |
WC requires at least: 2.1.0
|
13 |
-
WC tested up to: 3.3.
|
14 |
*/
|
15 |
|
16 |
if ( defined( 'WCML_VERSION' ) ) {
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
-
define( 'WCML_VERSION', '4.2.
|
21 |
define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
|
22 |
define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
|
23 |
define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
|
7 |
Author URI: http://www.onthegosystems.com/
|
8 |
Text Domain: woocommerce-multilingual
|
9 |
Requires at least: 3.9
|
10 |
+
Tested up to: 4.9.5
|
11 |
+
Version: 4.2.10
|
12 |
WC requires at least: 2.1.0
|
13 |
+
WC tested up to: 3.3.5
|
14 |
*/
|
15 |
|
16 |
if ( defined( 'WCML_VERSION' ) ) {
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
+
define( 'WCML_VERSION', '4.2.10' );
|
21 |
define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
|
22 |
define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
|
23 |
define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
|