Version Description
- Replace is_ajax (deprecated) with wp_doing_ajax.
Download this release
Release Info
Developer | strategio |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 4.12.4 |
Comparing to | |
See all releases |
Code changes from version 4.12.1 to 4.12.4
- classes/Multicurrency/Analytics/Export.php +1 -1
- classes/Multicurrency/Analytics/Hooks.php +1 -1
- classes/Multicurrency/Shipping/ShippingHooksFactory.php +1 -1
- classes/Reports/Orders/Hooks.php +1 -1
- classes/Rest/Functions.php +3 -1
- dist/css/multicurrencyOptions/styles.css +1 -1
- inc/admin-menus/class-wcml-admin-menus.php +1 -1
- inc/class-wcml-cart.php +1 -1
- inc/class-wcml-endpoints.php +7 -3
- inc/class-wcml-terms.php +2 -2
- inc/currencies/class-wcml-multi-currency-configuration.php +1 -1
- inc/currencies/class-wcml-multi-currency-orders.php +2 -4
- inc/currencies/class-wcml-multi-currency-prices.php +1 -1
- inc/currencies/class-wcml-multi-currency.php +3 -3
- inc/template-classes/store-urls/class-wcml-store-urls-ui.php +6 -1
- locale/woocommerce-multilingual-it_IT.mo +0 -0
- readme.txt +20 -5
- trunk/classes/API/VendorAddon/Hooks.php +0 -127
- trunk/classes/AdminDashboard/Hooks.php +0 -55
- trunk/classes/AdminNotices/CachePlugins.php +0 -69
- trunk/classes/AdminNotices/MultiCurrencyMissing.php +0 -71
- trunk/classes/AdminNotices/RestrictedScreens.php +0 -26
- trunk/classes/AdminNotices/Review.php +0 -132
- trunk/classes/Block/Convert/Converter/ProductsByAttributes.php +0 -22
- trunk/classes/Block/Convert/ConverterProvider.php +0 -141
- trunk/classes/Block/Convert/Hooks.php +0 -97
- trunk/classes/CLI/Hooks.php +0 -14
- trunk/classes/Container/Config.php +0 -21
- trunk/classes/Email/Settings/Hooks.php +0 -204
- trunk/classes/MO/Hooks.php +0 -16
- trunk/classes/Multicurrency/Analytics/Export.php +0 -66
- trunk/classes/Multicurrency/Analytics/Factory.php +0 -35
- trunk/classes/Multicurrency/Analytics/Hooks.php +0 -191
- trunk/classes/Multicurrency/Shipping/AdminHooks.php +0 -155
- trunk/classes/Multicurrency/Shipping/DefaultConversion.php +0 -25
- trunk/classes/Multicurrency/Shipping/FlatRateShipping.php +0 -12
- trunk/classes/Multicurrency/Shipping/FreeShipping.php +0 -76
- trunk/classes/Multicurrency/Shipping/FrontEndHooks.php +0 -90
- trunk/classes/Multicurrency/Shipping/LocalPickup.php +0 -12
- trunk/classes/Multicurrency/Shipping/ShippingClasses.php +0 -90
- trunk/classes/Multicurrency/Shipping/ShippingClassesMode.php +0 -22
- trunk/classes/Multicurrency/Shipping/ShippingHooksFactory.php +0 -54
- trunk/classes/Multicurrency/Shipping/ShippingMode.php +0 -75
- trunk/classes/Multicurrency/Shipping/ShippingModeBase.php +0 -14
- trunk/classes/Multicurrency/Shipping/ShippingModeProvider.php +0 -39
- trunk/classes/Multicurrency/Shipping/UnsupportedShipping.php +0 -41
- trunk/classes/Multicurrency/Shipping/VariableCost.php +0 -206
- trunk/classes/Multicurrency/UI/Factory.php +0 -40
- trunk/classes/Multicurrency/UI/Hooks.php +0 -290
- trunk/classes/Options/WPML.php +0 -25
- trunk/classes/PaymentGateways/Hooks.php +0 -199
- trunk/classes/Reports/Categories/Query.php +0 -60
- trunk/classes/Reports/Hooks.php +0 -29
- trunk/classes/Reports/Orders/Factory.php +0 -29
- trunk/classes/Reports/Orders/Hooks.php +0 -83
- trunk/classes/Reports/Products/Query.php +0 -191
- trunk/classes/Rest/Exceptions/Generic.php +0 -16
- trunk/classes/Rest/Exceptions/InvalidCurrency.php +0 -20
- trunk/classes/Rest/Exceptions/InvalidLanguage.php +0 -21
- trunk/classes/Rest/Exceptions/InvalidProduct.php +0 -21
- trunk/classes/Rest/Exceptions/InvalidTerm.php +0 -21
- trunk/classes/Rest/Exceptions/MissingLanguage.php +0 -17
- trunk/classes/Rest/Frontend/Language.php +0 -35
- trunk/classes/Rest/Functions.php +0 -81
- trunk/classes/Rest/Generic.php +0 -36
- trunk/classes/Rest/Hooks.php +0 -57
- trunk/classes/Rest/Language/Set.php +0 -75
- trunk/classes/Rest/ProductSaveActions.php +0 -66
- trunk/classes/Rest/Wrapper/Composite.php +0 -58
- trunk/classes/Rest/Wrapper/Factory.php +0 -63
- trunk/classes/Rest/Wrapper/Handler.php +0 -38
- trunk/classes/Rest/Wrapper/Orders/Languages.php +0 -99
- trunk/classes/Rest/Wrapper/Orders/Prices.php +0 -46
- trunk/classes/Rest/Wrapper/ProductTerms.php +0 -145
- trunk/classes/Rest/Wrapper/Products/Products.php +0 -119
- trunk/classes/Rest/Wrapper/Reports/ProductsCount.php +0 -66
- trunk/classes/Rest/Wrapper/Reports/ProductsSales.php +0 -34
- trunk/classes/Rest/Wrapper/Reports/TopSeller.php +0 -53
- trunk/classes/Reviews/Translations/Factory.php +0 -26
- trunk/classes/Reviews/Translations/FrontEndHooks.php +0 -86
- trunk/classes/Reviews/Translations/Mapper.php +0 -46
- trunk/classes/RewriteRules/Hooks.php +0 -33
- trunk/classes/Tax/Strings/Hooks.php +0 -87
- trunk/classes/User/Store/Cookie.php +0 -54
- trunk/classes/User/Store/Noop.php +0 -19
- trunk/classes/User/Store/Store.php +0 -72
- trunk/classes/User/Store/Strategy.php +0 -20
- trunk/classes/User/Store/WcSession.php +0 -41
- trunk/classes/Utilities/Post.php +0 -39
- trunk/classes/Utilities/Resources.php +0 -14
- trunk/classes/ate/class-wcml-ate-activate-synchronization.php +0 -16
- trunk/classes/class-wcml-admin-cookie.php +0 -44
- trunk/classes/class-wcml-tracking-link.php +0 -149
- trunk/classes/class-woocommerce-wpml.php +0 -489
- trunk/classes/currencies/class-wcml-admin-currency-selector.php +0 -163
- trunk/classes/currencies/class-wcml-currencies.php +0 -62
- trunk/classes/media/Wrapper/Factory.php +0 -29
- trunk/classes/media/Wrapper/IMedia.php +0 -51
- trunk/classes/media/Wrapper/NonTranslatable.php +0 -53
- trunk/classes/media/Wrapper/Translatable.php +0 -220
- trunk/classes/media/class-wcml-product-gallery-filter-factory.php +0 -13
- trunk/classes/media/class-wcml-product-gallery-filter.php +0 -75
- trunk/classes/media/class-wcml-product-image-filter-factory.php +0 -13
- trunk/classes/media/class-wcml-product-image-filter.php +0 -57
- trunk/classes/media/class-wcml-update-product-gallery-translation-factory.php +0 -18
- trunk/classes/media/class-wcml-update-product-gallery-translation.php +0 -93
- trunk/classes/media/class-wml-append-gallery-to-post-media-ids-factory.php +0 -8
- trunk/classes/media/class-wml-append-gallery-to-post-media-ids.php +0 -30
- trunk/classes/multi-currency/class-wcml-exchange-rates.php +0 -375
- trunk/classes/multi-currency/exchange-rate-services/CurrencyLayer.php +0 -97
- trunk/classes/multi-currency/exchange-rate-services/ExchangeRatesApi.php +0 -45
- trunk/classes/multi-currency/exchange-rate-services/Fixerio.php +0 -45
- trunk/classes/multi-currency/exchange-rate-services/OpenExchangeRates.php +0 -45
- trunk/classes/multi-currency/exchange-rate-services/Service.php +0 -145
- trunk/classes/multi-currency/geolocation/Geolocation.php +0 -214
- trunk/classes/multi-currency/geolocation/GeolocationBackendHooks.php +0 -10
- trunk/classes/multi-currency/geolocation/GeolocationFrontendHooks.php +0 -18
- trunk/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php +0 -212
- trunk/classes/multi-currency/payment-gateways/class-wcml-not-supported-payment-gateway.php +0 -20
- trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-bacs.php +0 -52
- trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-paypal.php +0 -174
- trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-stripe.php +0 -104
- trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway.php +0 -127
- trunk/classes/order-property-filter/class-wcml-payment-method-filter.php +0 -66
- trunk/classes/pointers/class-wcml-pointers.php +0 -127
- trunk/classes/privacy/class-wcml-privacy-content-factory.php +0 -18
- trunk/classes/privacy/class-wcml-privacy-content.php +0 -25
- trunk/classes/product/Hooks.php +0 -28
- trunk/classes/product/class-wcml-product-data-store-cpt.php +0 -16
- trunk/classes/shortcodes/class-wcml-wc-shortcode-product-category.php +0 -121
- trunk/classes/taxonomy-translation/class-wcml-taxonomy-translation-link-filters.php +0 -113
- trunk/classes/templates/php/model.php +0 -114
- trunk/classes/url-filters/class-wcml-url-filters-redirect-location.php +0 -30
- trunk/classes/urls/class-wcml-xdomain-data.php +0 -98
- trunk/classes/wcml-setup/BeforeHooks.php +0 -33
- trunk/classes/wcml-setup/class-wcml-setup-handlers.php +0 -83
- trunk/classes/wcml-setup/class-wcml-setup-ui.php +0 -129
- trunk/classes/wcml-setup/class-wcml-setup.php +0 -279
- trunk/compatibility/class-wcml-accommodation-bookings.php +0 -199
- trunk/compatibility/class-wcml-adventure-tours.php +0 -384
- trunk/compatibility/class-wcml-ajax-layered-nav-widget.php +0 -38
- trunk/compatibility/class-wcml-aurum.php +0 -17
- trunk/compatibility/class-wcml-bookings.php +0 -2797
- trunk/compatibility/class-wcml-bulk-stock-management.php +0 -45
- trunk/compatibility/class-wcml-checkout-addons.php +0 -61
- trunk/compatibility/class-wcml-checkout-field-editor.php +0 -161
- trunk/compatibility/class-wcml-compatibility-helper.php +0 -19
- trunk/compatibility/class-wcml-composite-products.php +0 -586
- trunk/compatibility/class-wcml-dynamic-pricing.php +0 -280
- trunk/compatibility/class-wcml-extra-product-options.php +0 -29
- trunk/compatibility/class-wcml-flatsome.php +0 -17
- trunk/compatibility/class-wcml-gravityforms.php +0 -79
- trunk/compatibility/class-wcml-jck-wssv.php +0 -24
- trunk/compatibility/class-wcml-klarna-gateway.php +0 -27
- trunk/compatibility/class-wcml-litespeed-cache.php +0 -26
- trunk/compatibility/class-wcml-maxstore.php +0 -17
- trunk/compatibility/class-wcml-mix-and-match-products.php +0 -53
- trunk/compatibility/class-wcml-order-status-manager.php +0 -88
- trunk/compatibility/class-wcml-per-product-shipping.php +0 -29
- trunk/compatibility/class-wcml-pip.php +0 -104
- trunk/compatibility/class-wcml-product-addons.php +0 -664
- trunk/compatibility/class-wcml-product-bundles.php +0 -907
- trunk/compatibility/class-wcml-relevanssi.php +0 -17
- trunk/compatibility/class-wcml-sensei.php +0 -249
- trunk/compatibility/class-wcml-tab-manager.php +0 -760
- trunk/compatibility/class-wcml-table-rate-shipping.php +0 -357
- trunk/compatibility/class-wcml-the-events-calendar.php +0 -490
- trunk/compatibility/class-wcml-variation-swatches-and-photos.php +0 -109
- trunk/compatibility/class-wcml-wc-memberships.php +0 -96
- trunk/compatibility/class-wcml-wc-name-your-price.php +0 -29
- trunk/compatibility/class-wcml-wc-product-type-column.php +0 -18
- trunk/compatibility/class-wcml-wc-subscriptions.php +0 -460
- trunk/compatibility/class-wcml-wcexporter.php +0 -88
- trunk/compatibility/class-wcml-woo-var-table.php +0 -32
- trunk/compatibility/class-wcml-woobe.php +0 -74
- trunk/compatibility/class-wcml-woof-woocommerce-product-filter.php +0 -110
- trunk/compatibility/class-wcml-wpb-vc.php +0 -22
- trunk/compatibility/class-wcml-wpfastest-cache.php +0 -32
- trunk/compatibility/class-wcml-wpseo.php +0 -69
- trunk/compatibility/class-wcml-yikes-custom-product-tabs.php +0 -262
- trunk/compatibility/class-wcml-yith-wcqv.php +0 -18
- trunk/compatibility/includes/class-wcml-wc-product-bundles-items.php +0 -77
- trunk/compatibility/res/css/wcml-bookings.css +0 -65
- trunk/compatibility/res/css/wcml-product-addons.css +0 -34
- trunk/compatibility/res/js/wcml-adventure-tours.js +0 -31
- trunk/compatibility/res/js/wcml-adventure-tours.min.js +0 -1
- trunk/compatibility/res/js/wcml-bookings.js +0 -91
- trunk/compatibility/res/js/wcml-bookings.min.js +0 -1
- trunk/compatibility/res/js/wcml-composite.js +0 -28
- trunk/compatibility/res/js/wcml-composite.min.js +0 -1
- trunk/compatibility/res/js/wcml-members.js +0 -18
- trunk/compatibility/res/js/wcml-members.min.js +0 -1
- trunk/compatibility/res/js/wcml-product-addons.js +0 -93
- trunk/compatibility/res/js/wcml-product-addons.min.js +0 -1
- trunk/dist/css/multicurrencyAnalytics/styles.css +0 -1
- trunk/dist/css/multicurrencyOptions/styles.css +0 -4
- trunk/dist/css/multicurrencyShippingAdmin/styles.css +0 -1
- trunk/dist/css/paymentGatewaysAdmin/styles.css +0 -3
- trunk/dist/css/reportsOrders/styles.css +0 -1
- trunk/dist/js/multicurrencyAnalytics/app.js +0 -1
- trunk/dist/js/multicurrencyOptions/app.js +0 -17
classes/Multicurrency/Analytics/Export.php
CHANGED
@@ -40,7 +40,7 @@ class Export implements \IWPML_Backend_Action, \IWPML_Frontend_Action, \IWPML_DI
|
|
40 |
return Obj::assoc(
|
41 |
$columnName,
|
42 |
$this->wpdb->prepare(
|
43 |
-
"(SELECT meta_value FROM {$this->wpdb->postmeta} WHERE post_id = order_id AND meta_key = %s) AS %s",
|
44 |
$metaKey,
|
45 |
$columnName
|
46 |
),
|
40 |
return Obj::assoc(
|
41 |
$columnName,
|
42 |
$this->wpdb->prepare(
|
43 |
+
"(SELECT meta_value FROM {$this->wpdb->postmeta} WHERE post_id = {$this->wpdb->prefix}wc_order_stats.order_id AND meta_key = %s) AS %s",
|
44 |
$metaKey,
|
45 |
$columnName
|
46 |
),
|
classes/Multicurrency/Analytics/Hooks.php
CHANGED
@@ -184,7 +184,7 @@ class Hooks implements \IWPML_Action {
|
|
184 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
185 |
return isset( $_GET['currency'] )
|
186 |
? sanitize_text_field( wp_unslash( $_GET['currency'] ) )
|
187 |
-
:
|
188 |
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
189 |
}
|
190 |
|
184 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
185 |
return isset( $_GET['currency'] )
|
186 |
? sanitize_text_field( wp_unslash( $_GET['currency'] ) )
|
187 |
+
: wcml_get_woocommerce_currency_option();
|
188 |
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
189 |
}
|
190 |
|
classes/Multicurrency/Shipping/ShippingHooksFactory.php
CHANGED
@@ -49,6 +49,6 @@ class ShippingHooksFactory implements \IWPML_Deferred_Action_Loader, \IWPML_Back
|
|
49 |
$getData = wpml_collect( $_GET );
|
50 |
$shippingActions = [ 'woocommerce_shipping_zone_add_method', 'woocommerce_shipping_zone_methods_save_changes' ];
|
51 |
|
52 |
-
return
|
53 |
}
|
54 |
}
|
49 |
$getData = wpml_collect( $_GET );
|
50 |
$shippingActions = [ 'woocommerce_shipping_zone_add_method', 'woocommerce_shipping_zone_methods_save_changes' ];
|
51 |
|
52 |
+
return wp_doing_ajax() && wpml_collect( $shippingActions )->containsStrict( $getData->get( 'action' ) );
|
53 |
}
|
54 |
}
|
classes/Reports/Orders/Hooks.php
CHANGED
@@ -53,7 +53,7 @@ class Hooks implements \IWPML_Action {
|
|
53 |
* @return array
|
54 |
*/
|
55 |
public function addJoin( $clauses ) {
|
56 |
-
$clauses[] = "LEFT JOIN {$this->wpdb->postmeta} wcml_language_postmeta ON {$this->wpdb->prefix}wc_order_stats.
|
57 |
|
58 |
return $clauses;
|
59 |
}
|
53 |
* @return array
|
54 |
*/
|
55 |
public function addJoin( $clauses ) {
|
56 |
+
$clauses[] = "LEFT JOIN {$this->wpdb->postmeta} wcml_language_postmeta ON wcml_language_postmeta.post_id = IF( {$this->wpdb->prefix}wc_order_stats.parent_id = 0, {$this->wpdb->prefix}wc_order_stats.order_id, {$this->wpdb->prefix}wc_order_stats.parent_id )";
|
57 |
|
58 |
return $clauses;
|
59 |
}
|
classes/Rest/Functions.php
CHANGED
@@ -12,9 +12,11 @@ class Functions {
|
|
12 |
* @return bool
|
13 |
*/
|
14 |
public static function isAnalyticsPage() {
|
|
|
15 |
return is_admin()
|
16 |
&& 'wc-admin' === Obj::prop( 'page', $_GET )
|
17 |
&& 0 === strpos( sanitize_text_field( wp_unslash( Obj::prop( 'path', $_GET ) ) ), '/analytics/' );
|
|
|
18 |
}
|
19 |
|
20 |
/**
|
@@ -48,7 +50,7 @@ class Functions {
|
|
48 |
}
|
49 |
|
50 |
$restPrefix = trailingslashit( rest_get_url_prefix() );
|
51 |
-
if ( preg_match(
|
52 |
$version = intval( $matches[1] );
|
53 |
}
|
54 |
|
12 |
* @return bool
|
13 |
*/
|
14 |
public static function isAnalyticsPage() {
|
15 |
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
16 |
return is_admin()
|
17 |
&& 'wc-admin' === Obj::prop( 'page', $_GET )
|
18 |
&& 0 === strpos( sanitize_text_field( wp_unslash( Obj::prop( 'path', $_GET ) ) ), '/analytics/' );
|
19 |
+
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
20 |
}
|
21 |
|
22 |
/**
|
50 |
}
|
51 |
|
52 |
$restPrefix = trailingslashit( rest_get_url_prefix() );
|
53 |
+
if ( preg_match( '@' . $restPrefix . 'wc/v([0-9]+)/@i', $_SERVER['REQUEST_URI'], $matches ) ) {
|
54 |
$version = intval( $matches[1] );
|
55 |
}
|
56 |
|
dist/css/multicurrencyOptions/styles.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
2 |
-
.ant-select-single .ant-select-selector{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-single .ant-select-selector .ant-select-selection-search{position:absolute;top:0;right:11px;bottom:0;left:11px}.ant-select-single .ant-select-selector .ant-select-selection-search-input{width:100%}.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{padding:0;line-height:30px;-webkit-transition:all 0.3s;transition:all 0.3s}@supports (-moz-appearance: meterbar){.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{line-height:30px}}.ant-select-single .ant-select-selector .ant-select-selection-item{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-single .ant-select-selector .ant-select-selection-placeholder{pointer-events:none}.ant-select-single .ant-select-selector::after,.ant-select-single .ant-select-selector .ant-select-selection-item::after,.ant-select-single .ant-select-selector .ant-select-selection-placeholder::after{display:inline-block;width:0;visibility:hidden;content:'\a0'}.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:25px}.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:18px}.ant-select-single.ant-select-open .ant-select-selection-item{opacity:0.4}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);width:100%;height:32px;padding:0 11px}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:not-allowed}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{height:30px}.ant-select-single.ant-select-customize-input .ant-select-selector::after{display:none}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-search{position:static;width:100%}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder{position:absolute;right:0;left:0;padding:0 11px}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder::after{display:none}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{height:40px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:38px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:38px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{height:24px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selection-search{right:7px;left:7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{padding:0 7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:28px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:21px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-multiple .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1px 4px}.ant-select-multiple .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-multiple .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-multiple .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-multiple .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-multiple .ant-select-selector input{cursor:not-allowed}.ant-select-multiple .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-multiple .ant-select-selector::after{display:inline-block;width:0;margin:2px 0;line-height:24px;content:'\a0'}.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:24px}.ant-select-multiple .ant-select-selection-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:24px;margin-top:2px;margin-right:4px;margin-bottom:2px;padding:0 4px 0 8px;line-height:22px;background:#f5f5f5;border:1px solid #f0f0f0;border-radius:2px;cursor:default;-webkit-transition:font-size 0.3s, line-height 0.3s, height 0.3s;transition:font-size 0.3s, line-height 0.3s, height 0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-multiple .ant-select-selection-item-content{display:inline-block;margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-multiple .ant-select-selection-item-remove{color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:rgba(0,0,0,0.45);font-weight:bold;font-size:12px;line-height:inherit;cursor:pointer;display:inline-block;font-size:10px}.ant-select-multiple .ant-select-selection-item-remove>*{line-height:1}.ant-select-multiple .ant-select-selection-item-remove svg{display:inline-block}.ant-select-multiple .ant-select-selection-item-remove::before{display:none}.ant-select-multiple .ant-select-selection-item-remove .ant-select-multiple .ant-select-selection-item-remove-icon{display:block}.ant-select-multiple .ant-select-selection-item-remove>.anticon{vertical-align:-0.2em}.ant-select-multiple .ant-select-selection-item-remove:hover{color:rgba(0,0,0,0.75)}.ant-select-multiple .ant-select-selection-search{position:relative;margin-left:0.5px}.ant-select-multiple .ant-select-selection-search-input,.ant-select-multiple .ant-select-selection-search-mirror{font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';line-height:1.5715;-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple .ant-select-selection-search-input{width:100%;min-width:3px}.ant-select-multiple .ant-select-selection-search-mirror{position:absolute;top:0;left:0;z-index:999;white-space:nowrap;visibility:hidden}.ant-select-multiple .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:6.5px}.ant-select-multiple .ant-select-selection-placeholder{position:absolute;top:50%;right:11px;left:11px;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple.ant-select-lg .ant-select-selector::after{line-height:32px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:30px}.ant-select-multiple.ant-select-lg .ant-select-selection-search{height:33px;line-height:33px}.ant-select-multiple.ant-select-lg .ant-select-selection-search-input,.ant-select-multiple.ant-select-lg .ant-select-selection-search-mirror{height:32px;line-height:30px}.ant-select-multiple.ant-select-sm .ant-select-selector::after{line-height:16px}.ant-select-multiple.ant-select-sm .ant-select-selection-item{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-search{height:17px;line-height:17px}.ant-select-multiple.ant-select-sm .ant-select-selection-search-input,.ant-select-multiple.ant-select-sm .ant-select-selection-search-mirror{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{left:7px}.ant-select-multiple.ant-select-sm .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:3px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:32px}.ant-select-disabled .ant-select-selection-item-remove{display:none}.ant-select{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;display:inline-block;cursor:pointer}.ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important}.ant-select-selection-item{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media all and (-ms-high-contrast: none){.ant-select-selection-item *::-ms-backdrop,.ant-select-selection-item{-ms-flex:auto;flex:auto}}.ant-select-selection-placeholder{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0.4}@media all and (-ms-high-contrast: none){.ant-select-selection-placeholder *::-ms-backdrop,.ant-select-selection-placeholder{-ms-flex:auto;flex:auto}}.ant-select-arrow{display:inline-block;color:inherit;font-style:normal;line-height:0;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:53%;right:11px;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;line-height:1;text-align:center;pointer-events:none}.ant-select-arrow>*{line-height:1}.ant-select-arrow svg{display:inline-block}.ant-select-arrow::before{display:none}.ant-select-arrow .ant-select-arrow-icon{display:block}.ant-select-arrow .anticon{vertical-align:top;-webkit-transition:-webkit-transform 0.3s;transition:-webkit-transform 0.3s;transition:transform 0.3s;transition:transform 0.3s, -webkit-transform 0.3s}.ant-select-arrow .anticon>svg{vertical-align:top}.ant-select-arrow .anticon:not(.anticon-down){pointer-events:auto}.ant-select-clear{position:absolute;top:50%;right:11px;z-index:1;display:inline-block;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;font-style:normal;line-height:1;text-align:center;text-transform:none;background:#fff;cursor:pointer;opacity:0;-webkit-transition:color 0.3s ease, opacity 0.15s ease;transition:color 0.3s ease, opacity 0.15s ease;text-rendering:auto}.ant-select-clear::before{display:block}.ant-select-clear:hover{color:rgba(0,0,0,0.45)}.ant-select:hover .ant-select-clear{opacity:1}.ant-select-dropdown{margin:0;padding:0;color:rgba(0,0,0,0.65);font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;top:-9999px;left:-9999px;z-index:1050;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 0;overflow:hidden;font-size:14px;font-variant:initial;background-color:#fff;border-radius:2px;outline:none;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-bottomLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-topLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut}.ant-select-dropdown-hidden{display:none}.ant-select-item-empty{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px}.ant-select-item{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px;cursor:pointer;-webkit-transition:background 0.3s ease;transition:background 0.3s ease}.ant-select-item-group{color:rgba(0,0,0,0.45);font-size:12px;cursor:default}.ant-select-item-option{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-item-option-content{-webkit-box-flex:1;-ms-flex:auto;flex:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-item-option-state{-webkit-box-flex:0;-ms-flex:none;flex:none}.ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:#f5f5f5}.ant-select-item-option-selected:not(.ant-select-item-option-disabled){color:rgba(0,0,0,0.65);font-weight:600;background-color:#e6f7ff}.ant-select-item-option-selected:not(.ant-select-item-option-disabled) .ant-select-item-option-state{color:#1890ff}.ant-select-item-option-disabled{color:rgba(0,0,0,0.25);cursor:not-allowed}.ant-select-item-option-grouped{padding-left:24px}.ant-select-lg{font-size:16px}.ant-select-borderless .ant-select-selector{background-color:transparent !important;border-color:transparent !important;-webkit-box-shadow:none !important;box-shadow:none !important}.ant-select-rtl{direction:rtl}.ant-select-rtl .ant-select-arrow{right:initial;left:11px}.ant-select-rtl .ant-select-clear{right:initial;left:11px}.ant-select-dropdown-rtl{direction:rtl}.ant-select-dropdown-rtl .ant-select-item-option-grouped{padding-right:24px;padding-left:12px}.ant-select-rtl.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:4px;padding-left:24px}.ant-select-rtl.ant-select-multiple .ant-select-selection-item{margin-right:0;margin-left:4px;padding:0 8px 0 4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-item-content{margin-right:0;margin-left:4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-search{margin-right:0.5px;margin-left:4px}.ant-select-rtl.ant-select-multiple .ant-select-selection-search-mirror{right:0;left:auto}.ant-select-rtl.ant-select-multiple .ant-select-selection-placeholder{right:11px;left:auto}.ant-select-rtl.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{right:7px}.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-placeholder{right:0;left:9px;text-align:right}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:11px;left:25px}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:18px}.ant-select-rtl.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:0}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:21px}
|
3 |
.ant-modal{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;top:100px;width:auto;margin:0 auto;padding-bottom:24px;pointer-events:none}.ant-modal-wrap{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;overflow:auto;outline:0;-webkit-overflow-scrolling:touch}.ant-modal-title{margin:0;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:22px;word-wrap:break-word}.ant-modal-content{position:relative;background-color:#fff;background-clip:padding-box;border:0;border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);pointer-events:auto}.ant-modal-close{position:absolute;top:0;right:0;z-index:10;padding:0;color:rgba(0,0,0,0.45);font-weight:700;line-height:1;text-decoration:none;background:transparent;border:0;outline:0;cursor:pointer;-webkit-transition:color 0.3s;transition:color 0.3s}.ant-modal-close-x{display:block;width:56px;height:56px;font-size:16px;font-style:normal;line-height:56px;text-align:center;text-transform:none;text-rendering:auto}.ant-modal-close:focus,.ant-modal-close:hover{color:rgba(0,0,0,0.75);text-decoration:none}.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,0.65);background:#fff;border-bottom:1px solid #f0f0f0;border-radius:2px 2px 0 0}.ant-modal-body{padding:24px;font-size:14px;line-height:1.5715;word-wrap:break-word}.ant-modal-footer{padding:10px 16px;text-align:right;background:transparent;border-top:1px solid #f0f0f0;border-radius:0 0 2px 2px}.ant-modal-footer button+button{margin-bottom:0;margin-left:8px}.ant-modal.zoom-enter,.ant-modal.zoom-appear{-webkit-transform:none;transform:none;opacity:0;-webkit-animation-duration:0.3s;animation-duration:0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;height:100%;background-color:rgba(0,0,0,0.45);filter:alpha(opacity=50)}.ant-modal-mask-hidden{display:none}.ant-modal-open{overflow:hidden}.ant-modal-centered{text-align:center}.ant-modal-centered::before{display:inline-block;width:0;height:100%;vertical-align:middle;content:''}.ant-modal-centered .ant-modal{top:0;display:inline-block;text-align:left;vertical-align:middle}@media (max-width: 767px){.ant-modal{max-width:calc(100vw - 16px);margin:8px auto}.ant-modal-centered .ant-modal{-webkit-box-flex:1;-ms-flex:1;flex:1}}.ant-modal-confirm .ant-modal-header{display:none}.ant-modal-confirm .ant-modal-close{display:none}.ant-modal-confirm .ant-modal-body{padding:32px 32px 24px}.ant-modal-confirm-body-wrapper::before{display:table;content:''}.ant-modal-confirm-body-wrapper::after{display:table;clear:both;content:''}.ant-modal-confirm-body .ant-modal-confirm-title{display:block;overflow:hidden;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:1.4}.ant-modal-confirm-body .ant-modal-confirm-content{margin-top:8px;color:rgba(0,0,0,0.65);font-size:14px}.ant-modal-confirm-body>.anticon{float:left;margin-right:16px;font-size:22px}.ant-modal-confirm-body>.anticon+.ant-modal-confirm-title+.ant-modal-confirm-content{margin-left:38px}.ant-modal-confirm .ant-modal-confirm-btns{float:right;margin-top:24px}.ant-modal-confirm .ant-modal-confirm-btns button+button{margin-bottom:0;margin-left:8px}.ant-modal-confirm-error .ant-modal-confirm-body>.anticon{color:#ff4d4f}.ant-modal-confirm-warning .ant-modal-confirm-body>.anticon,.ant-modal-confirm-confirm .ant-modal-confirm-body>.anticon{color:#faad14}.ant-modal-confirm-info .ant-modal-confirm-body>.anticon{color:#1890ff}.ant-modal-confirm-success .ant-modal-confirm-body>.anticon{color:#52c41a}.ant-modal-wrap-rtl{direction:rtl}.ant-modal-wrap-rtl .ant-modal-close{right:initial;left:0}.ant-modal-wrap-rtl .ant-modal-footer{text-align:left}.ant-modal-wrap-rtl .ant-modal-footer button+button{margin-right:8px;margin-left:0}.ant-modal-wrap-rtl.ant-modal-centered .ant-modal{text-align:right}
|
4 |
.ant-tooltip{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;z-index:1060;display:block;max-width:250px;visibility:visible}.ant-tooltip-hidden{display:none}.ant-tooltip-placement-top,.ant-tooltip-placement-topLeft,.ant-tooltip-placement-topRight{padding-bottom:8px}.ant-tooltip-placement-right,.ant-tooltip-placement-rightTop,.ant-tooltip-placement-rightBottom{padding-left:8px}.ant-tooltip-placement-bottom,.ant-tooltip-placement-bottomLeft,.ant-tooltip-placement-bottomRight{padding-top:8px}.ant-tooltip-placement-left,.ant-tooltip-placement-leftTop,.ant-tooltip-placement-leftBottom{padding-right:8px}.ant-tooltip-inner{min-width:30px;min-height:32px;padding:6px 8px;color:#fff;text-align:left;text-decoration:none;word-wrap:break-word;background-color:rgba(0,0,0,0.75);border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-tooltip-arrow{position:absolute;display:block;width:13.07106781px;height:13.07106781px;overflow:hidden;background:transparent;pointer-events:none}.ant-tooltip-arrow::before{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:5px;height:5px;margin:auto;background-color:rgba(0,0,0,0.75);content:'';pointer-events:auto}.ant-tooltip-placement-top .ant-tooltip-arrow,.ant-tooltip-placement-topLeft .ant-tooltip-arrow,.ant-tooltip-placement-topRight .ant-tooltip-arrow{bottom:-5.07106781px}.ant-tooltip-placement-top .ant-tooltip-arrow::before,.ant-tooltip-placement-topLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-topRight .ant-tooltip-arrow::before{-webkit-box-shadow:3px 3px 7px rgba(0,0,0,0.07);box-shadow:3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(-6.53553px) rotate(45deg);transform:translateY(-6.53553px) rotate(45deg)}.ant-tooltip-placement-top .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-topLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-topRight .ant-tooltip-arrow{right:13px}.ant-tooltip-placement-right .ant-tooltip-arrow,.ant-tooltip-placement-rightTop .ant-tooltip-arrow,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{left:-5.07106781px}.ant-tooltip-placement-right .ant-tooltip-arrow::before,.ant-tooltip-placement-rightTop .ant-tooltip-arrow::before,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow::before{-webkit-box-shadow:-3px 3px 7px rgba(0,0,0,0.07);box-shadow:-3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(6.53553px) rotate(45deg);transform:translateX(6.53553px) rotate(45deg)}.ant-tooltip-placement-right .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-rightTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-left .ant-tooltip-arrow,.ant-tooltip-placement-leftTop .ant-tooltip-arrow,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{right:-5.07106781px}.ant-tooltip-placement-left .ant-tooltip-arrow::before,.ant-tooltip-placement-leftTop .ant-tooltip-arrow::before,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow::before{-webkit-box-shadow:3px -3px 7px rgba(0,0,0,0.07);box-shadow:3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(-6.53553px) rotate(45deg);transform:translateX(-6.53553px) rotate(45deg)}.ant-tooltip-placement-left .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-leftTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-bottom .ant-tooltip-arrow,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{top:-5.07106781px}.ant-tooltip-placement-bottom .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow::before{-webkit-box-shadow:-3px -3px 7px rgba(0,0,0,0.07);box-shadow:-3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(6.53553px) rotate(45deg);transform:translateY(6.53553px) rotate(45deg)}.ant-tooltip-placement-bottom .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{right:13px}.ant-tooltip-rtl{direction:rtl}.ant-tooltip-rtl .ant-tooltip-inner{text-align:right}
|
|
1 |
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
|
|
2 |
.ant-modal{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;top:100px;width:auto;margin:0 auto;padding-bottom:24px;pointer-events:none}.ant-modal-wrap{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;overflow:auto;outline:0;-webkit-overflow-scrolling:touch}.ant-modal-title{margin:0;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:22px;word-wrap:break-word}.ant-modal-content{position:relative;background-color:#fff;background-clip:padding-box;border:0;border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);pointer-events:auto}.ant-modal-close{position:absolute;top:0;right:0;z-index:10;padding:0;color:rgba(0,0,0,0.45);font-weight:700;line-height:1;text-decoration:none;background:transparent;border:0;outline:0;cursor:pointer;-webkit-transition:color 0.3s;transition:color 0.3s}.ant-modal-close-x{display:block;width:56px;height:56px;font-size:16px;font-style:normal;line-height:56px;text-align:center;text-transform:none;text-rendering:auto}.ant-modal-close:focus,.ant-modal-close:hover{color:rgba(0,0,0,0.75);text-decoration:none}.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,0.65);background:#fff;border-bottom:1px solid #f0f0f0;border-radius:2px 2px 0 0}.ant-modal-body{padding:24px;font-size:14px;line-height:1.5715;word-wrap:break-word}.ant-modal-footer{padding:10px 16px;text-align:right;background:transparent;border-top:1px solid #f0f0f0;border-radius:0 0 2px 2px}.ant-modal-footer button+button{margin-bottom:0;margin-left:8px}.ant-modal.zoom-enter,.ant-modal.zoom-appear{-webkit-transform:none;transform:none;opacity:0;-webkit-animation-duration:0.3s;animation-duration:0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;height:100%;background-color:rgba(0,0,0,0.45);filter:alpha(opacity=50)}.ant-modal-mask-hidden{display:none}.ant-modal-open{overflow:hidden}.ant-modal-centered{text-align:center}.ant-modal-centered::before{display:inline-block;width:0;height:100%;vertical-align:middle;content:''}.ant-modal-centered .ant-modal{top:0;display:inline-block;text-align:left;vertical-align:middle}@media (max-width: 767px){.ant-modal{max-width:calc(100vw - 16px);margin:8px auto}.ant-modal-centered .ant-modal{-webkit-box-flex:1;-ms-flex:1;flex:1}}.ant-modal-confirm .ant-modal-header{display:none}.ant-modal-confirm .ant-modal-close{display:none}.ant-modal-confirm .ant-modal-body{padding:32px 32px 24px}.ant-modal-confirm-body-wrapper::before{display:table;content:''}.ant-modal-confirm-body-wrapper::after{display:table;clear:both;content:''}.ant-modal-confirm-body .ant-modal-confirm-title{display:block;overflow:hidden;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:1.4}.ant-modal-confirm-body .ant-modal-confirm-content{margin-top:8px;color:rgba(0,0,0,0.65);font-size:14px}.ant-modal-confirm-body>.anticon{float:left;margin-right:16px;font-size:22px}.ant-modal-confirm-body>.anticon+.ant-modal-confirm-title+.ant-modal-confirm-content{margin-left:38px}.ant-modal-confirm .ant-modal-confirm-btns{float:right;margin-top:24px}.ant-modal-confirm .ant-modal-confirm-btns button+button{margin-bottom:0;margin-left:8px}.ant-modal-confirm-error .ant-modal-confirm-body>.anticon{color:#ff4d4f}.ant-modal-confirm-warning .ant-modal-confirm-body>.anticon,.ant-modal-confirm-confirm .ant-modal-confirm-body>.anticon{color:#faad14}.ant-modal-confirm-info .ant-modal-confirm-body>.anticon{color:#1890ff}.ant-modal-confirm-success .ant-modal-confirm-body>.anticon{color:#52c41a}.ant-modal-wrap-rtl{direction:rtl}.ant-modal-wrap-rtl .ant-modal-close{right:initial;left:0}.ant-modal-wrap-rtl .ant-modal-footer{text-align:left}.ant-modal-wrap-rtl .ant-modal-footer button+button{margin-right:8px;margin-left:0}.ant-modal-wrap-rtl.ant-modal-centered .ant-modal{text-align:right}
|
3 |
.ant-tooltip{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;z-index:1060;display:block;max-width:250px;visibility:visible}.ant-tooltip-hidden{display:none}.ant-tooltip-placement-top,.ant-tooltip-placement-topLeft,.ant-tooltip-placement-topRight{padding-bottom:8px}.ant-tooltip-placement-right,.ant-tooltip-placement-rightTop,.ant-tooltip-placement-rightBottom{padding-left:8px}.ant-tooltip-placement-bottom,.ant-tooltip-placement-bottomLeft,.ant-tooltip-placement-bottomRight{padding-top:8px}.ant-tooltip-placement-left,.ant-tooltip-placement-leftTop,.ant-tooltip-placement-leftBottom{padding-right:8px}.ant-tooltip-inner{min-width:30px;min-height:32px;padding:6px 8px;color:#fff;text-align:left;text-decoration:none;word-wrap:break-word;background-color:rgba(0,0,0,0.75);border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-tooltip-arrow{position:absolute;display:block;width:13.07106781px;height:13.07106781px;overflow:hidden;background:transparent;pointer-events:none}.ant-tooltip-arrow::before{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:5px;height:5px;margin:auto;background-color:rgba(0,0,0,0.75);content:'';pointer-events:auto}.ant-tooltip-placement-top .ant-tooltip-arrow,.ant-tooltip-placement-topLeft .ant-tooltip-arrow,.ant-tooltip-placement-topRight .ant-tooltip-arrow{bottom:-5.07106781px}.ant-tooltip-placement-top .ant-tooltip-arrow::before,.ant-tooltip-placement-topLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-topRight .ant-tooltip-arrow::before{-webkit-box-shadow:3px 3px 7px rgba(0,0,0,0.07);box-shadow:3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(-6.53553px) rotate(45deg);transform:translateY(-6.53553px) rotate(45deg)}.ant-tooltip-placement-top .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-topLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-topRight .ant-tooltip-arrow{right:13px}.ant-tooltip-placement-right .ant-tooltip-arrow,.ant-tooltip-placement-rightTop .ant-tooltip-arrow,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{left:-5.07106781px}.ant-tooltip-placement-right .ant-tooltip-arrow::before,.ant-tooltip-placement-rightTop .ant-tooltip-arrow::before,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow::before{-webkit-box-shadow:-3px 3px 7px rgba(0,0,0,0.07);box-shadow:-3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(6.53553px) rotate(45deg);transform:translateX(6.53553px) rotate(45deg)}.ant-tooltip-placement-right .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-rightTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-left .ant-tooltip-arrow,.ant-tooltip-placement-leftTop .ant-tooltip-arrow,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{right:-5.07106781px}.ant-tooltip-placement-left .ant-tooltip-arrow::before,.ant-tooltip-placement-leftTop .ant-tooltip-arrow::before,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow::before{-webkit-box-shadow:3px -3px 7px rgba(0,0,0,0.07);box-shadow:3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(-6.53553px) rotate(45deg);transform:translateX(-6.53553px) rotate(45deg)}.ant-tooltip-placement-left .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-leftTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-bottom .ant-tooltip-arrow,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{top:-5.07106781px}.ant-tooltip-placement-bottom .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow::before{-webkit-box-shadow:-3px -3px 7px rgba(0,0,0,0.07);box-shadow:-3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(6.53553px) rotate(45deg);transform:translateY(6.53553px) rotate(45deg)}.ant-tooltip-placement-bottom .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{right:13px}.ant-tooltip-rtl{direction:rtl}.ant-tooltip-rtl .ant-tooltip-inner{text-align:right}
|
4 |
+
.ant-select-single .ant-select-selector{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-single .ant-select-selector .ant-select-selection-search{position:absolute;top:0;right:11px;bottom:0;left:11px}.ant-select-single .ant-select-selector .ant-select-selection-search-input{width:100%}.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{padding:0;line-height:30px;-webkit-transition:all 0.3s;transition:all 0.3s}@supports (-moz-appearance: meterbar){.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{line-height:30px}}.ant-select-single .ant-select-selector .ant-select-selection-item{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-single .ant-select-selector .ant-select-selection-placeholder{pointer-events:none}.ant-select-single .ant-select-selector::after,.ant-select-single .ant-select-selector .ant-select-selection-item::after,.ant-select-single .ant-select-selector .ant-select-selection-placeholder::after{display:inline-block;width:0;visibility:hidden;content:'\a0'}.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:25px}.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:18px}.ant-select-single.ant-select-open .ant-select-selection-item{opacity:0.4}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);width:100%;height:32px;padding:0 11px}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:not-allowed}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{height:30px}.ant-select-single.ant-select-customize-input .ant-select-selector::after{display:none}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-search{position:static;width:100%}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder{position:absolute;right:0;left:0;padding:0 11px}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder::after{display:none}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{height:40px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:38px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:38px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{height:24px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selection-search{right:7px;left:7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{padding:0 7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:28px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:21px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-multiple .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1px 4px}.ant-select-multiple .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-multiple .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-multiple .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-multiple .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-multiple .ant-select-selector input{cursor:not-allowed}.ant-select-multiple .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-multiple .ant-select-selector::after{display:inline-block;width:0;margin:2px 0;line-height:24px;content:'\a0'}.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:24px}.ant-select-multiple .ant-select-selection-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:24px;margin-top:2px;margin-right:4px;margin-bottom:2px;padding:0 4px 0 8px;line-height:22px;background:#f5f5f5;border:1px solid #f0f0f0;border-radius:2px;cursor:default;-webkit-transition:font-size 0.3s, line-height 0.3s, height 0.3s;transition:font-size 0.3s, line-height 0.3s, height 0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-multiple .ant-select-selection-item-content{display:inline-block;margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-multiple .ant-select-selection-item-remove{color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:rgba(0,0,0,0.45);font-weight:bold;font-size:12px;line-height:inherit;cursor:pointer;display:inline-block;font-size:10px}.ant-select-multiple .ant-select-selection-item-remove>*{line-height:1}.ant-select-multiple .ant-select-selection-item-remove svg{display:inline-block}.ant-select-multiple .ant-select-selection-item-remove::before{display:none}.ant-select-multiple .ant-select-selection-item-remove .ant-select-multiple .ant-select-selection-item-remove-icon{display:block}.ant-select-multiple .ant-select-selection-item-remove>.anticon{vertical-align:-0.2em}.ant-select-multiple .ant-select-selection-item-remove:hover{color:rgba(0,0,0,0.75)}.ant-select-multiple .ant-select-selection-search{position:relative;margin-left:0.5px}.ant-select-multiple .ant-select-selection-search-input,.ant-select-multiple .ant-select-selection-search-mirror{font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';line-height:1.5715;-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple .ant-select-selection-search-input{width:100%;min-width:3px}.ant-select-multiple .ant-select-selection-search-mirror{position:absolute;top:0;left:0;z-index:999;white-space:nowrap;visibility:hidden}.ant-select-multiple .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:6.5px}.ant-select-multiple .ant-select-selection-placeholder{position:absolute;top:50%;right:11px;left:11px;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple.ant-select-lg .ant-select-selector::after{line-height:32px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:30px}.ant-select-multiple.ant-select-lg .ant-select-selection-search{height:33px;line-height:33px}.ant-select-multiple.ant-select-lg .ant-select-selection-search-input,.ant-select-multiple.ant-select-lg .ant-select-selection-search-mirror{height:32px;line-height:30px}.ant-select-multiple.ant-select-sm .ant-select-selector::after{line-height:16px}.ant-select-multiple.ant-select-sm .ant-select-selection-item{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-search{height:17px;line-height:17px}.ant-select-multiple.ant-select-sm .ant-select-selection-search-input,.ant-select-multiple.ant-select-sm .ant-select-selection-search-mirror{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{left:7px}.ant-select-multiple.ant-select-sm .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:3px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:32px}.ant-select-disabled .ant-select-selection-item-remove{display:none}.ant-select{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;display:inline-block;cursor:pointer}.ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important}.ant-select-selection-item{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media all and (-ms-high-contrast: none){.ant-select-selection-item *::-ms-backdrop,.ant-select-selection-item{-ms-flex:auto;flex:auto}}.ant-select-selection-placeholder{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0.4}@media all and (-ms-high-contrast: none){.ant-select-selection-placeholder *::-ms-backdrop,.ant-select-selection-placeholder{-ms-flex:auto;flex:auto}}.ant-select-arrow{display:inline-block;color:inherit;font-style:normal;line-height:0;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:53%;right:11px;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;line-height:1;text-align:center;pointer-events:none}.ant-select-arrow>*{line-height:1}.ant-select-arrow svg{display:inline-block}.ant-select-arrow::before{display:none}.ant-select-arrow .ant-select-arrow-icon{display:block}.ant-select-arrow .anticon{vertical-align:top;-webkit-transition:-webkit-transform 0.3s;transition:-webkit-transform 0.3s;transition:transform 0.3s;transition:transform 0.3s, -webkit-transform 0.3s}.ant-select-arrow .anticon>svg{vertical-align:top}.ant-select-arrow .anticon:not(.anticon-down){pointer-events:auto}.ant-select-clear{position:absolute;top:50%;right:11px;z-index:1;display:inline-block;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;font-style:normal;line-height:1;text-align:center;text-transform:none;background:#fff;cursor:pointer;opacity:0;-webkit-transition:color 0.3s ease, opacity 0.15s ease;transition:color 0.3s ease, opacity 0.15s ease;text-rendering:auto}.ant-select-clear::before{display:block}.ant-select-clear:hover{color:rgba(0,0,0,0.45)}.ant-select:hover .ant-select-clear{opacity:1}.ant-select-dropdown{margin:0;padding:0;color:rgba(0,0,0,0.65);font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;top:-9999px;left:-9999px;z-index:1050;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 0;overflow:hidden;font-size:14px;font-variant:initial;background-color:#fff;border-radius:2px;outline:none;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-bottomLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-topLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut}.ant-select-dropdown-hidden{display:none}.ant-select-item-empty{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px}.ant-select-item{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px;cursor:pointer;-webkit-transition:background 0.3s ease;transition:background 0.3s ease}.ant-select-item-group{color:rgba(0,0,0,0.45);font-size:12px;cursor:default}.ant-select-item-option{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-item-option-content{-webkit-box-flex:1;-ms-flex:auto;flex:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-item-option-state{-webkit-box-flex:0;-ms-flex:none;flex:none}.ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:#f5f5f5}.ant-select-item-option-selected:not(.ant-select-item-option-disabled){color:rgba(0,0,0,0.65);font-weight:600;background-color:#e6f7ff}.ant-select-item-option-selected:not(.ant-select-item-option-disabled) .ant-select-item-option-state{color:#1890ff}.ant-select-item-option-disabled{color:rgba(0,0,0,0.25);cursor:not-allowed}.ant-select-item-option-grouped{padding-left:24px}.ant-select-lg{font-size:16px}.ant-select-borderless .ant-select-selector{background-color:transparent !important;border-color:transparent !important;-webkit-box-shadow:none !important;box-shadow:none !important}.ant-select-rtl{direction:rtl}.ant-select-rtl .ant-select-arrow{right:initial;left:11px}.ant-select-rtl .ant-select-clear{right:initial;left:11px}.ant-select-dropdown-rtl{direction:rtl}.ant-select-dropdown-rtl .ant-select-item-option-grouped{padding-right:24px;padding-left:12px}.ant-select-rtl.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:4px;padding-left:24px}.ant-select-rtl.ant-select-multiple .ant-select-selection-item{margin-right:0;margin-left:4px;padding:0 8px 0 4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-item-content{margin-right:0;margin-left:4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-search{margin-right:0.5px;margin-left:4px}.ant-select-rtl.ant-select-multiple .ant-select-selection-search-mirror{right:0;left:auto}.ant-select-rtl.ant-select-multiple .ant-select-selection-placeholder{right:11px;left:auto}.ant-select-rtl.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{right:7px}.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-placeholder{right:0;left:9px;text-align:right}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:11px;left:25px}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:18px}.ant-select-rtl.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:0}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:21px}
|
inc/admin-menus/class-wcml-admin-menus.php
CHANGED
@@ -225,7 +225,7 @@ class WCML_Admin_Menus {
|
|
225 |
|
226 |
if (
|
227 |
'post.php' === $pagenow &&
|
228 |
-
!
|
229 |
self::is_post_product_translation_screen() &&
|
230 |
self::is_post_action_needs_redirect()
|
231 |
) {
|
225 |
|
226 |
if (
|
227 |
'post.php' === $pagenow &&
|
228 |
+
! wp_doing_ajax() &&
|
229 |
self::is_post_product_translation_screen() &&
|
230 |
self::is_post_action_needs_redirect()
|
231 |
) {
|
inc/class-wcml-cart.php
CHANGED
@@ -515,7 +515,7 @@ class WCML_Cart {
|
|
515 |
|
516 |
public function localize_flat_rates_shipping_classes() {
|
517 |
|
518 |
-
if (
|
519 |
$this->woocommerce->shipping->load_shipping_methods();
|
520 |
$shipping_methods = $this->woocommerce->shipping->get_shipping_methods();
|
521 |
foreach ( $shipping_methods as $method ) {
|
515 |
|
516 |
public function localize_flat_rates_shipping_classes() {
|
517 |
|
518 |
+
if ( wp_doing_ajax() && isset( $_POST['action'] ) && $_POST['action'] == 'woocommerce_update_order_review' ) {
|
519 |
$this->woocommerce->shipping->load_shipping_methods();
|
520 |
$shipping_methods = $this->woocommerce->shipping->get_shipping_methods();
|
521 |
foreach ( $shipping_methods as $method ) {
|
inc/class-wcml-endpoints.php
CHANGED
@@ -15,6 +15,12 @@ class WCML_Endpoints {
|
|
15 |
|
16 |
var $endpoints_strings = array();
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function __construct( woocommerce_wpml $woocommerce_wpml, SitePress $sitepress, wpdb $wpdb ) {
|
19 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
$this->sitepress = $sitepress;
|
@@ -24,9 +30,7 @@ class WCML_Endpoints {
|
|
24 |
public function add_hooks() {
|
25 |
add_action( 'init', array( $this, 'migrate_ones_string_translations' ), 9 );
|
26 |
|
27 |
-
|
28 |
-
add_action( 'wpml_after_add_endpoints_translations', array( $this, 'add_wc_endpoints_translations' ) );
|
29 |
-
}
|
30 |
|
31 |
add_filter( 'wpml_endpoint_permalink_filter', array( $this, 'endpoint_permalink_filter' ), 10, 2 );
|
32 |
add_filter( 'wpml_endpoint_url_value', array( $this, 'filter_endpoint_url_value' ), 10, 2 );
|
15 |
|
16 |
var $endpoints_strings = array();
|
17 |
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
* @see WPML_Endpoints_Support::STRING_CONTEXT
|
21 |
+
*/
|
22 |
+
const STRING_CONTEXT = 'WP Endpoints';
|
23 |
+
|
24 |
public function __construct( woocommerce_wpml $woocommerce_wpml, SitePress $sitepress, wpdb $wpdb ) {
|
25 |
$this->woocommerce_wpml = $woocommerce_wpml;
|
26 |
$this->sitepress = $sitepress;
|
30 |
public function add_hooks() {
|
31 |
add_action( 'init', array( $this, 'migrate_ones_string_translations' ), 9 );
|
32 |
|
33 |
+
add_action( 'wpml_after_add_endpoints_translations', array( $this, 'add_wc_endpoints_translations' ) );
|
|
|
|
|
34 |
|
35 |
add_filter( 'wpml_endpoint_permalink_filter', array( $this, 'endpoint_permalink_filter' ), 10, 2 );
|
36 |
add_filter( 'wpml_endpoint_url_value', array( $this, 'filter_endpoint_url_value' ), 10, 2 );
|
inc/class-wcml-terms.php
CHANGED
@@ -405,7 +405,7 @@ class WCML_Terms {
|
|
405 |
public function sync_taxonomy_translations( $html, $taxonomy, $taxonomy_obj ) {
|
406 |
|
407 |
$is_wcml = is_admin() && $taxonomy && isset( $_GET['page'] ) && $_GET['page'] == 'wpml-wcml' && isset( $_GET['tab'] );
|
408 |
-
$is_ajax =
|
409 |
|
410 |
if ( $is_wcml || $is_ajax ) {
|
411 |
|
@@ -832,7 +832,7 @@ class WCML_Terms {
|
|
832 |
if ( isset( $is_slug ) ) {
|
833 |
$filtered_terms[] = get_term( $trnsl_term_id, $taxonomy )->slug;
|
834 |
} else {
|
835 |
-
$filtered_terms[] = (
|
836 |
$_POST['action'],
|
837 |
[
|
838 |
'woocommerce_add_variation',
|
405 |
public function sync_taxonomy_translations( $html, $taxonomy, $taxonomy_obj ) {
|
406 |
|
407 |
$is_wcml = is_admin() && $taxonomy && isset( $_GET['page'] ) && $_GET['page'] == 'wpml-wcml' && isset( $_GET['tab'] );
|
408 |
+
$is_ajax = wp_doing_ajax() && $taxonomy && isset( $_POST['action'] ) && $_POST['action'] === 'wpml_get_terms_and_labels_for_taxonomy_table';
|
409 |
|
410 |
if ( $is_wcml || $is_ajax ) {
|
411 |
|
832 |
if ( isset( $is_slug ) ) {
|
833 |
$filtered_terms[] = get_term( $trnsl_term_id, $taxonomy )->slug;
|
834 |
} else {
|
835 |
+
$filtered_terms[] = ( wp_doing_ajax() && isset( $_POST['action'] ) && in_array(
|
836 |
$_POST['action'],
|
837 |
[
|
838 |
'woocommerce_add_variation',
|
inc/currencies/class-wcml-multi-currency-configuration.php
CHANGED
@@ -31,7 +31,7 @@ class WCML_Multi_Currency_Configuration {
|
|
31 |
}
|
32 |
|
33 |
public static function add_hooks(){
|
34 |
-
if (
|
35 |
|
36 |
add_action( 'wp_ajax_legacy_update_custom_rates', [ __CLASS__, 'legacy_update_custom_rates' ] );
|
37 |
add_action( 'wp_ajax_legacy_remove_custom_rates', [ __CLASS__, 'legacy_remove_custom_rates' ] );
|
31 |
}
|
32 |
|
33 |
public static function add_hooks(){
|
34 |
+
if ( wp_doing_ajax() ) {
|
35 |
|
36 |
add_action( 'wp_ajax_legacy_update_custom_rates', [ __CLASS__, 'legacy_update_custom_rates' ] );
|
37 |
add_action( 'wp_ajax_legacy_remove_custom_rates', [ __CLASS__, 'legacy_remove_custom_rates' ] );
|
inc/currencies/class-wcml-multi-currency-orders.php
CHANGED
@@ -340,10 +340,8 @@ class WCML_Multi_Currency_Orders {
|
|
340 |
continue;
|
341 |
}
|
342 |
|
343 |
-
if (
|
344 |
-
|
345 |
-
)
|
346 |
-
|| $this->total_is_changed( $item )
|
347 |
) {
|
348 |
|
349 |
$converted_totals[ $key ] = $item->get_total();
|
340 |
continue;
|
341 |
}
|
342 |
|
343 |
+
if ( 'total' === $key
|
344 |
+
&& ( $item->get_total() !== $item->get_subtotal() || $this->total_is_changed( $item ) )
|
|
|
|
|
345 |
) {
|
346 |
|
347 |
$converted_totals[ $key ] = $item->get_total();
|
inc/currencies/class-wcml-multi-currency-prices.php
CHANGED
@@ -673,7 +673,7 @@ class WCML_Multi_Currency_Prices {
|
|
673 |
'woocommerce_calc_line_taxes',
|
674 |
];
|
675 |
$is_ajax_order_action =
|
676 |
-
|
677 |
(
|
678 |
(
|
679 |
isset( $_POST['action'] ) &&
|
673 |
'woocommerce_calc_line_taxes',
|
674 |
];
|
675 |
$is_ajax_order_action =
|
676 |
+
wp_doing_ajax() &&
|
677 |
(
|
678 |
(
|
679 |
isset( $_POST['action'] ) &&
|
inc/currencies/class-wcml-multi-currency.php
CHANGED
@@ -181,7 +181,7 @@ class WCML_Multi_Currency {
|
|
181 |
|
182 |
add_filter( 'init', [ $this, 'init' ], 5 );
|
183 |
|
184 |
-
if (
|
185 |
add_action( 'wp_ajax_nopriv_wcml_switch_currency', [ $this, 'switch_currency' ] );
|
186 |
add_action( 'wp_ajax_wcml_switch_currency', [ $this, 'switch_currency' ] );
|
187 |
}
|
@@ -194,7 +194,7 @@ class WCML_Multi_Currency {
|
|
194 |
if ( ! is_admin() && $this->get_client_currency() !== wcml_get_woocommerce_currency_option() ) {
|
195 |
$load = true;
|
196 |
} else {
|
197 |
-
if (
|
198 |
|
199 |
$ajax_actions = apply_filters(
|
200 |
'wcml_multi_currency_ajax_actions',
|
@@ -579,7 +579,7 @@ class WCML_Multi_Currency {
|
|
579 |
}
|
580 |
|
581 |
$currency_not_in_storage = is_null( $client_currency ) && ! wcml_user_store_get( self::CURRENCY_STORAGE_KEY );
|
582 |
-
$is_checkout_ajax =
|
583 |
|
584 |
if ( $currency_not_in_storage || $is_checkout_ajax ) {
|
585 |
$location_currency = $this->get_currency_by_geolocation();
|
181 |
|
182 |
add_filter( 'init', [ $this, 'init' ], 5 );
|
183 |
|
184 |
+
if ( wp_doing_ajax() ) {
|
185 |
add_action( 'wp_ajax_nopriv_wcml_switch_currency', [ $this, 'switch_currency' ] );
|
186 |
add_action( 'wp_ajax_wcml_switch_currency', [ $this, 'switch_currency' ] );
|
187 |
}
|
194 |
if ( ! is_admin() && $this->get_client_currency() !== wcml_get_woocommerce_currency_option() ) {
|
195 |
$load = true;
|
196 |
} else {
|
197 |
+
if ( wp_doing_ajax() && $this->get_client_currency() !== wcml_get_woocommerce_currency_option() ) {
|
198 |
|
199 |
$ajax_actions = apply_filters(
|
200 |
'wcml_multi_currency_ajax_actions',
|
579 |
}
|
580 |
|
581 |
$currency_not_in_storage = is_null( $client_currency ) && ! wcml_user_store_get( self::CURRENCY_STORAGE_KEY );
|
582 |
+
$is_checkout_ajax = wp_doing_ajax() && isset( $_GET['wc-ajax'] ) && 'update_order_review' === $_GET['wc-ajax'];
|
583 |
|
584 |
if ( $currency_not_in_storage || $is_checkout_ajax ) {
|
585 |
$location_currency = $this->get_currency_by_geolocation();
|
inc/template-classes/store-urls/class-wcml-store-urls-ui.php
CHANGED
@@ -91,8 +91,13 @@ class WCML_Store_URLs_UI extends WCML_Templates_Factory {
|
|
91 |
|
92 |
public function get_endpoint_info() {
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
$endpoints_info = [];
|
95 |
-
foreach (
|
96 |
if ( class_exists( 'WPML_Endpoints_Support' ) ) {
|
97 |
$key = $endpoint;
|
98 |
}
|
91 |
|
92 |
public function get_endpoint_info() {
|
93 |
|
94 |
+
$is_original_slug = function( $endpoint ) {
|
95 |
+
return (bool) apply_filters( 'wpml_get_string_language', '', WCML_Endpoints::STRING_CONTEXT, $endpoint );
|
96 |
+
};
|
97 |
+
$filtered_query_vars = wpml_collect( WC()->query->query_vars )->filter( $is_original_slug )->toArray();
|
98 |
+
|
99 |
$endpoints_info = [];
|
100 |
+
foreach ( $filtered_query_vars as $key => $endpoint ) {
|
101 |
if ( class_exists( 'WPML_Endpoints_Support' ) ) {
|
102 |
$key = $endpoint;
|
103 |
}
|
locale/woocommerce-multilingual-it_IT.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
|
|
5 |
License: GPLv2
|
6 |
Requires at least: 4.7
|
7 |
Tested up to: 5.8
|
8 |
-
Stable tag: 4.12.
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
@@ -67,9 +67,9 @@ If the checks fail, WooCommerce Multilingual will not be able to run.
|
|
67 |
* MySQL version 5.6 or later
|
68 |
|
69 |
* WooCommerce 3.9.0 or later
|
70 |
-
* WPML Multilingual CMS 4.
|
71 |
-
* WPML String Translation 3.
|
72 |
-
* WPML Translation Management 2.
|
73 |
|
74 |
= WordPress automatic installation =
|
75 |
In your WordPress dashboard, go to the Plugins section and click 'Add new'.
|
@@ -138,6 +138,21 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
|
|
138 |
|
139 |
== Changelog ==
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
= 4.12.1 =
|
142 |
|
143 |
* Removed translation files for some locales that we cannot maintain anymore and updated the remaining locale translations.
|
@@ -311,4 +326,4 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
|
|
311 |
* Fixed an issue with the price filter widget not showing results in a secondary language.
|
312 |
* Fixed an issue where the shipping classes in secondary languages were not calculated during checkout.
|
313 |
* Display larger images when hovering thumbnails in the WooCommerce Multilingual Products admin page.
|
314 |
-
* Added the "wcml_new_order_admin_email_language" filter to allow setting the language of emails sent to admins for new or updated orders.
|
5 |
License: GPLv2
|
6 |
Requires at least: 4.7
|
7 |
Tested up to: 5.8
|
8 |
+
Stable tag: 4.12.4
|
9 |
Requires PHP: 5.6
|
10 |
|
11 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
67 |
* MySQL version 5.6 or later
|
68 |
|
69 |
* WooCommerce 3.9.0 or later
|
70 |
+
* WPML Multilingual CMS 4.4.11 or later
|
71 |
+
* WPML String Translation 3.1.9 or later
|
72 |
+
* WPML Translation Management 2.10.7 or later
|
73 |
|
74 |
= WordPress automatic installation =
|
75 |
In your WordPress dashboard, go to the Plugins section and click 'Add new'.
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 4.12.4 =
|
142 |
+
|
143 |
+
* Replace is_ajax (deprecated) with wp_doing_ajax.
|
144 |
+
|
145 |
+
= 4.12.3 =
|
146 |
+
|
147 |
+
* Fixed analytics in secondary languages.
|
148 |
+
|
149 |
+
= 4.12.2 =
|
150 |
+
|
151 |
+
* Fixed an issue with overwriting order subtotal with total value.
|
152 |
+
* Fixed a regression affecting correct translation of emails.
|
153 |
+
* Fixed several glitches in WooCommerce Analytics reports.
|
154 |
+
* Updated the Italian translations.
|
155 |
+
|
156 |
= 4.12.1 =
|
157 |
|
158 |
* Removed translation files for some locales that we cannot maintain anymore and updated the remaining locale translations.
|
326 |
* Fixed an issue with the price filter widget not showing results in a secondary language.
|
327 |
* Fixed an issue where the shipping classes in secondary languages were not calculated during checkout.
|
328 |
* Display larger images when hovering thumbnails in the WooCommerce Multilingual Products admin page.
|
329 |
+
* Added the "wcml_new_order_admin_email_language" filter to allow setting the language of emails sent to admins for new or updated orders.
|
trunk/classes/API/VendorAddon/Hooks.php
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\API\VendorAddon;
|
4 |
-
|
5 |
-
use WPML\Element\API\Languages;
|
6 |
-
use WPML\FP\Cast;
|
7 |
-
use WPML\FP\Fns;
|
8 |
-
use WPML\FP\Obj;
|
9 |
-
use WPML\FP\Relation;
|
10 |
-
use WPML\LIB\WP\Hooks as WpHooks;
|
11 |
-
use function WPML\Container\make;
|
12 |
-
use function WPML\FP\invoke;
|
13 |
-
use function WPML\FP\pipe;
|
14 |
-
use function WPML\FP\spreadArgs;
|
15 |
-
|
16 |
-
class Hooks implements \IWPML_Backend_Action {
|
17 |
-
|
18 |
-
const TRANSLATE_CAPABILITY = 'translate';
|
19 |
-
|
20 |
-
const COLUMN_USER_OPTION = 'manageedit-productcolumnshidden';
|
21 |
-
|
22 |
-
public function add_hooks() {
|
23 |
-
/**
|
24 |
-
* This filter allows to enable this module
|
25 |
-
* by passing an array of configuration.
|
26 |
-
*
|
27 |
-
* @since 4.12.0
|
28 |
-
*
|
29 |
-
* @return null|array
|
30 |
-
*/
|
31 |
-
$config = apply_filters( 'wcml_vendor_addon_configuration', null );
|
32 |
-
|
33 |
-
if ( $config ) {
|
34 |
-
// $getConfig - Curried :: string -> mixed
|
35 |
-
$getConfig = Obj::prop( Fns::__, $config );
|
36 |
-
|
37 |
-
// $isVendor - Curried :: \WP_User -> bool
|
38 |
-
$isVendor = invoke( 'has_cap' )->with( $getConfig( 'vendor_capability' ) );
|
39 |
-
|
40 |
-
WpHooks::onFilter( 'wpml_override_is_translator', 10, 3 )
|
41 |
-
->then( spreadArgs( self::allowVendorToTranslateHisProduct( $isVendor ) ) );
|
42 |
-
|
43 |
-
WpHooks::onFilter( 'get_user_metadata', 10, 3 )
|
44 |
-
->then( spreadArgs( self::forceLanguagesColumnInProductsList( $isVendor ) ) );
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @param callable $isVendor
|
50 |
-
*
|
51 |
-
* @return \Closure :: (bool, int, array) -> bool
|
52 |
-
*/
|
53 |
-
private static function allowVendorToTranslateHisProduct( callable $isVendor ) {
|
54 |
-
return function( $isTranslator, $userId, $args ) use ( $isVendor ) {
|
55 |
-
$user = self::getUser( $userId );
|
56 |
-
|
57 |
-
if ( $isVendor( $user ) ) {
|
58 |
-
self::maybeSetTranslatorRequirements( $user );
|
59 |
-
|
60 |
-
// $isProductOfVendor :: array -> bool
|
61 |
-
$isProductOfVendor = pipe(
|
62 |
-
Obj::prop( 'post_id' ),
|
63 |
-
'get_post',
|
64 |
-
Obj::prop( 'post_author' ),
|
65 |
-
Cast::toInt(),
|
66 |
-
Relation::equals( $userId )
|
67 |
-
);
|
68 |
-
|
69 |
-
return $isProductOfVendor( $args );
|
70 |
-
}
|
71 |
-
|
72 |
-
return $isTranslator;
|
73 |
-
};
|
74 |
-
}
|
75 |
-
|
76 |
-
private static function maybeSetTranslatorRequirements( \WPML_User $user ) {
|
77 |
-
/** @var \wpdb $wpdb */
|
78 |
-
global $wpdb;
|
79 |
-
|
80 |
-
$languagePairsKey = $wpdb->prefix . 'language_pairs';
|
81 |
-
|
82 |
-
if (
|
83 |
-
! $user->has_cap( self::TRANSLATE_CAPABILITY )
|
84 |
-
|| $user->get( $languagePairsKey ) !== self::getAllLanguagePairsInDefault()
|
85 |
-
) {
|
86 |
-
$user->add_cap( self::TRANSLATE_CAPABILITY );
|
87 |
-
$user->update_meta( $languagePairsKey, self::getAllLanguagePairsInDefault() );
|
88 |
-
|
89 |
-
do_action( 'wpml_tm_ate_synchronize_translators' );
|
90 |
-
do_action( 'wpml_tm_add_translation_role', $user, self::TRANSLATE_CAPABILITY );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* @return array
|
96 |
-
*/
|
97 |
-
private static function getAllLanguagePairsInDefault() {
|
98 |
-
return [ Languages::getDefaultCode() => array_fill_keys( Languages::getSecondaryCodes(), 1 ) ];
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* @param callable $isVendor
|
103 |
-
*
|
104 |
-
* @return \Closure :: (mixed, int, string) -> mixed
|
105 |
-
*/
|
106 |
-
public static function forceLanguagesColumnInProductsList( callable $isVendor ) {
|
107 |
-
return function ( $value, $userId, $metaKey ) use ( $isVendor ) {
|
108 |
-
if (
|
109 |
-
self::COLUMN_USER_OPTION === $metaKey
|
110 |
-
&& $isVendor( self::getUser( $userId ) )
|
111 |
-
) {
|
112 |
-
return [ [] ];
|
113 |
-
}
|
114 |
-
|
115 |
-
return $value;
|
116 |
-
};
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* @param int $id
|
121 |
-
*
|
122 |
-
* @return \WPML_User
|
123 |
-
*/
|
124 |
-
private static function getUser( $id ) {
|
125 |
-
return make( \WPML_WP_User_Factory::class )->create( $id );
|
126 |
-
}
|
127 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/AdminDashboard/Hooks.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\AdminDashboard;
|
4 |
-
|
5 |
-
use SitePress;
|
6 |
-
use wpdb;
|
7 |
-
use IWPML_DIC_Action;
|
8 |
-
use IWPML_Backend_Action;
|
9 |
-
|
10 |
-
class Hooks implements IWPML_Backend_Action, IWPML_DIC_Action {
|
11 |
-
|
12 |
-
/** @var SitePress $sitepress */
|
13 |
-
private $sitepress;
|
14 |
-
|
15 |
-
/** @var wpdb $wpdb */
|
16 |
-
private $wpdb;
|
17 |
-
|
18 |
-
public function __construct( SitePress $sitepress, wpdb $wpdb ) {
|
19 |
-
$this->sitepress = $sitepress;
|
20 |
-
$this->wpdb = $wpdb;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function add_hooks() {
|
24 |
-
add_action( 'wp_dashboard_setup', [ $this, 'clearStockTransients' ] );
|
25 |
-
add_filter( 'woocommerce_status_widget_low_in_stock_count_query', [ $this, 'addLanguageQuery' ] );
|
26 |
-
add_filter( 'woocommerce_status_widget_out_of_stock_count_query', [ $this, 'addLanguageQuery' ] );
|
27 |
-
}
|
28 |
-
|
29 |
-
public function clearStockTransients() {
|
30 |
-
delete_transient( 'wc_outofstock_count' );
|
31 |
-
delete_transient( 'wc_low_stock_count' );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param string $query
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public function addLanguageQuery( $query ) {
|
40 |
-
|
41 |
-
$currentLanguage = $this->sitepress->get_current_language();
|
42 |
-
|
43 |
-
if ( $currentLanguage !== 'all' ) {
|
44 |
-
$languageQuery = $this->wpdb->prepare(
|
45 |
-
" INNER JOIN {$this->wpdb->prefix}icl_translations AS t
|
46 |
-
ON posts.ID = t.element_id AND t.element_type IN ( 'post_product', 'post_product_variation' )
|
47 |
-
WHERE t.language_code = %s AND ",
|
48 |
-
$currentLanguage );
|
49 |
-
|
50 |
-
return str_replace( 'WHERE', $languageQuery, $query );
|
51 |
-
}
|
52 |
-
|
53 |
-
return $query;
|
54 |
-
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/AdminNotices/CachePlugins.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\AdminNotices;
|
4 |
-
|
5 |
-
use WPML\FP\Fns;
|
6 |
-
use WPML\FP\Logic;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
use WPML\FP\Str;
|
9 |
-
use function WPML\FP\pipe;
|
10 |
-
|
11 |
-
class CachePlugins implements \IWPML_Backend_Action, \IWPML_DIC_Action {
|
12 |
-
|
13 |
-
const NOTICE_ID = 'wcml-cache-plugins';
|
14 |
-
|
15 |
-
/** @var \WPML_Notices $notices */
|
16 |
-
private $notices;
|
17 |
-
|
18 |
-
public function __construct( \WPML_Notices $notices ) {
|
19 |
-
$this->notices = $notices;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function add_hooks() {
|
23 |
-
if (
|
24 |
-
wcml_is_multi_currency_on()
|
25 |
-
&& ! $this->notices->get_notice( self::NOTICE_ID )
|
26 |
-
&& self::hasActiveCachePlugin()
|
27 |
-
) {
|
28 |
-
add_action( 'admin_init', [ $this, 'addNotice' ] );
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function addNotice() {
|
33 |
-
$text = '<h2>' . __( 'WooCommerce Multilingual detected an active cache plugin on your site.', 'woocommerce-multilingual' ) . '</h2>';
|
34 |
-
$text .= '<p>' . __( 'Caching may cause currency display issues for your customers if you are using the multi-currency feature.', 'woocommerce-multilingual' ) . '</p>';
|
35 |
-
$text .= '<p>' . __( 'To avoid this, set your cache plugin to not cache pages for visitors that have a cookie set in their browser.', 'woocommerce-multilingual' ) . '</p>';
|
36 |
-
|
37 |
-
$notice = $this->notices->create_notice( self::NOTICE_ID, $text );
|
38 |
-
$notice->set_css_class_types( 'notice-warning' );
|
39 |
-
$notice->set_restrict_to_screen_ids( RestrictedScreens::get() );
|
40 |
-
$notice->set_dismissible( true );
|
41 |
-
|
42 |
-
$this->notices->add_notice( $notice );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @return bool
|
47 |
-
*/
|
48 |
-
private static function hasActiveCachePlugin() {
|
49 |
-
// $isActive :: ( array, string ) -> bool
|
50 |
-
$isActive = pipe(
|
51 |
-
Fns::nthArg( 1 ), // array index
|
52 |
-
'is_plugin_active'
|
53 |
-
);
|
54 |
-
|
55 |
-
// $isAboutCaching :: array -> bool
|
56 |
-
$isAboutCaching = pipe(
|
57 |
-
Obj::prop( 'Description' ),
|
58 |
-
Logic::anyPass( [
|
59 |
-
Str::includes( 'cache' ),
|
60 |
-
Str::includes( 'caching' )
|
61 |
-
] )
|
62 |
-
);
|
63 |
-
|
64 |
-
return (bool) wpml_collect( get_plugins() )
|
65 |
-
->filter( $isActive )
|
66 |
-
->filter( $isAboutCaching )
|
67 |
-
->first();
|
68 |
-
}
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/AdminNotices/MultiCurrencyMissing.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\AdminNotices;
|
4 |
-
|
5 |
-
use woocommerce_wpml;
|
6 |
-
use WPML\FP\Obj;
|
7 |
-
use WPML_Notices;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Manage showing a reminder notice when multi-currency mode is not configured completely.
|
11 |
-
*/
|
12 |
-
class MultiCurrencyMissing implements \IWPML_Backend_Action, \IWPML_DIC_Action {
|
13 |
-
|
14 |
-
const NOTICE_ID = 'wcml-multi-currency-missing';
|
15 |
-
|
16 |
-
/** @var woocommerce_wpml */
|
17 |
-
private $wcml;
|
18 |
-
|
19 |
-
/** @var WPML_Notices */
|
20 |
-
private $notices;
|
21 |
-
|
22 |
-
public function __construct( woocommerce_wpml $wcml, WPML_Notices $notices ) {
|
23 |
-
$this->wcml = $wcml;
|
24 |
-
$this->notices = $notices;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Add hooks to manage visibility of notice.
|
29 |
-
*/
|
30 |
-
public function add_hooks() {
|
31 |
-
$notice = $this->notices->get_notice( self::NOTICE_ID );
|
32 |
-
$needsNotice = wcml_is_multi_currency_on() && $this->hasOneUniqueCurrency();
|
33 |
-
|
34 |
-
if ( $needsNotice && ! $notice ) {
|
35 |
-
add_action( 'admin_init', [ $this, 'addNotice' ] );
|
36 |
-
} elseif ( ! $needsNotice && $notice ) {
|
37 |
-
add_action( 'admin_init', [ $this, 'removeNotice' ] );
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Add a notice reminding admin about missing secondary currency.
|
43 |
-
*/
|
44 |
-
public function addNotice() {
|
45 |
-
$text = '<h2>' . __( "You haven't added any secondary currencies", 'woocommerce-multilingual' ) . '</h2>';
|
46 |
-
$text .= '<p>' . __( "Please add another currency to fully utilize multi-currency mode. If you do not need multiple currencies, you can disable this setting to improve your site's performance.", 'woocommerce-multilingual' ) . '</p>';
|
47 |
-
$text .= '<a href="' . admin_url( 'admin.php?page=wpml-wcml&tab=multi-currency' ) . '">' . __( 'Configure multi-currency mode', 'woocommerce-multilingual' ) . '</a>';
|
48 |
-
|
49 |
-
$notice = $this->notices->create_notice( self::NOTICE_ID, $text );
|
50 |
-
$notice->set_css_class_types( 'notice-warning' );
|
51 |
-
$notice->set_restrict_to_screen_ids( RestrictedScreens::get() );
|
52 |
-
$notice->set_dismissible( true );
|
53 |
-
|
54 |
-
$this->notices->add_notice( $notice );
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Remove the notice if the problem has been fixed
|
59 |
-
*/
|
60 |
-
public function removeNotice() {
|
61 |
-
$notice = $this->notices->get_notice( self::NOTICE_ID );
|
62 |
-
$this->notices->remove_notice( $notice->get_group(), $notice->get_id() );
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* @return bool
|
67 |
-
*/
|
68 |
-
private function hasOneUniqueCurrency() {
|
69 |
-
return count( (array) Obj::path( [ 'settings', 'currency_options' ], $this->wcml ) ) <= 1;
|
70 |
-
}
|
71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/AdminNotices/RestrictedScreens.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\AdminNotices;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
|
7 |
-
class RestrictedScreens {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @return string[]
|
11 |
-
*/
|
12 |
-
public static function get() {
|
13 |
-
return [
|
14 |
-
'dashboard',
|
15 |
-
'woocommerce_page_wpml-wcml',
|
16 |
-
'woocommerce_page_wc-admin',
|
17 |
-
'woocommerce_page_wc-reports',
|
18 |
-
'woocommerce_page_wc-settings',
|
19 |
-
'woocommerce_page_wc-status',
|
20 |
-
'woocommerce_page_wc-addons',
|
21 |
-
'edit-shop_order',
|
22 |
-
'edit-shop_coupon',
|
23 |
-
'edit-product',
|
24 |
-
];
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/AdminNotices/Review.php
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\AdminNotices;
|
4 |
-
|
5 |
-
use WPML_Notices;
|
6 |
-
use IWPML_Backend_Action;
|
7 |
-
use IWPML_Frontend_Action;
|
8 |
-
use IWPML_DIC_Action;
|
9 |
-
use wpdb;
|
10 |
-
use SitePress;
|
11 |
-
|
12 |
-
class Review implements IWPML_Backend_Action, IWPML_Frontend_Action, IWPML_DIC_Action {
|
13 |
-
|
14 |
-
const OPTION_NAME = 'wcml-rate-notice';
|
15 |
-
|
16 |
-
/** @var WPML_Notices $wpmlNotices */
|
17 |
-
private $wpmlNotices;
|
18 |
-
|
19 |
-
/** @var wpdb $wpdb */
|
20 |
-
private $wpdb;
|
21 |
-
|
22 |
-
/** @var SitePress $sitepress */
|
23 |
-
private $sitepress;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Review constructor.
|
27 |
-
*
|
28 |
-
* @param WPML_Notices $wpmlNotices
|
29 |
-
* @param wpdb $wpdb
|
30 |
-
* @param SitePress $sitepress
|
31 |
-
*/
|
32 |
-
public function __construct( WPML_Notices $wpmlNotices, wpdb $wpdb, SitePress $sitepress ) {
|
33 |
-
$this->wpmlNotices = $wpmlNotices;
|
34 |
-
$this->wpdb = $wpdb;
|
35 |
-
$this->sitepress = $sitepress;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* add hooks
|
40 |
-
*/
|
41 |
-
public function add_hooks() {
|
42 |
-
add_action( 'admin_notices', [ $this, 'addNotice' ] );
|
43 |
-
add_action( 'woocommerce_after_order_object_save', [ $this, 'onNewOrder' ] );
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* add notice message
|
48 |
-
*/
|
49 |
-
public function addNotice() {
|
50 |
-
|
51 |
-
if ( $this->shouldDisplayNotice() ) {
|
52 |
-
$notice = $this->wpmlNotices->get_new_notice( 'wcml-rate', $this->getNoticeText(), 'wcml-admin-notices' );
|
53 |
-
|
54 |
-
if ( $this->wpmlNotices->is_notice_dismissed( $notice ) ) {
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
|
58 |
-
$notice->set_css_class_types( 'info' );
|
59 |
-
$notice->set_css_classes( [ 'otgs-notice-wcml-rating' ] );
|
60 |
-
$notice->set_dismissible( true );
|
61 |
-
|
62 |
-
$reviewLink = 'https://wordpress.org/support/plugin/woocommerce-multilingual/reviews/?filter=5#new-post';
|
63 |
-
$reviewButton = $this->wpmlNotices->get_new_notice_action( __( 'Review WooCommerce Multilingual', 'woocommerce-multilingual' ), $reviewLink, false, false, true );
|
64 |
-
$notice->add_action( $reviewButton );
|
65 |
-
|
66 |
-
$notice->set_restrict_to_screen_ids( RestrictedScreens::get() );
|
67 |
-
$notice->add_capability_check( [ 'manage_options', 'wpml_manage_woocommerce_multilingual' ] );
|
68 |
-
$this->wpmlNotices->add_notice( $notice );
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* get notice text
|
74 |
-
*
|
75 |
-
* @return string
|
76 |
-
*/
|
77 |
-
private function getNoticeText() {
|
78 |
-
$text = '<h2>';
|
79 |
-
$text .= __( 'Congrats! You\'ve just earned some money using WooCommerce Multilingual.', 'woocommerce-multilingual' );
|
80 |
-
$text .= '</h2>';
|
81 |
-
|
82 |
-
$text .= '<p>';
|
83 |
-
$text .= __( 'How do you feel getting your very first order in foreign language or currency?', 'woocommerce-multilingual' );
|
84 |
-
$text .= '<br />';
|
85 |
-
$text .= __( 'We for sure are super thrilled about your success! Will you help WCML improve and grow?', 'woocommerce-multilingual' );
|
86 |
-
$text .= '</p>';
|
87 |
-
|
88 |
-
$text .= '<p><strong>';
|
89 |
-
$text .= __( 'Give us <span class="rating">5.0 <i class="otgs-ico-star"></i></span> review now.', 'woocommerce-multilingual' );
|
90 |
-
$text .= '</strong></p>';
|
91 |
-
|
92 |
-
return $text;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* check if we should display notice
|
97 |
-
*
|
98 |
-
* @return bool
|
99 |
-
*/
|
100 |
-
private function shouldDisplayNotice() {
|
101 |
-
return get_option( self::OPTION_NAME, false );
|
102 |
-
}
|
103 |
-
|
104 |
-
public function onNewOrder(){
|
105 |
-
if ( !$this->shouldDisplayNotice() ) {
|
106 |
-
$this->maybeAddOptionToShowNotice();
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* maybe add option to show notice
|
112 |
-
*/
|
113 |
-
private function maybeAddOptionToShowNotice() {
|
114 |
-
|
115 |
-
$ordersCountInSecondLanguageOrCurrency = $this->wpdb->get_var(
|
116 |
-
$this->wpdb->prepare(
|
117 |
-
"SELECT COUNT(p.ID) FROM {$this->wpdb->postmeta} as pm
|
118 |
-
INNER JOIN {$this->wpdb->posts} as p ON pm.post_id = p.ID
|
119 |
-
WHERE p.post_type = 'shop_order' AND (
|
120 |
-
( pm.meta_key = '_order_currency' AND pm.meta_value != %s )
|
121 |
-
OR
|
122 |
-
( pm.meta_key = 'wpml_language' AND pm.meta_value != %s ) )",
|
123 |
-
wcml_get_woocommerce_currency_option(),
|
124 |
-
$this->sitepress->get_default_language() )
|
125 |
-
);
|
126 |
-
|
127 |
-
if ( $ordersCountInSecondLanguageOrCurrency ) {
|
128 |
-
add_option( self::OPTION_NAME, true );
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Block/Convert/Converter/ProductsByAttributes.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Block\Convert\Converter;
|
4 |
-
|
5 |
-
class ProductsByAttributes extends \WPML\PB\Gutenberg\ConvertIdsInBlock\Base {
|
6 |
-
|
7 |
-
public function convert( array $block ) {
|
8 |
-
if ( ! isset( $block['attrs']['attributes'] ) ) {
|
9 |
-
return $block;
|
10 |
-
}
|
11 |
-
|
12 |
-
foreach ( $block['attrs']['attributes'] as $key => $attribute ) {
|
13 |
-
if ( ! isset( $attribute['id'], $attribute['attr_slug'] ) ) {
|
14 |
-
continue;
|
15 |
-
}
|
16 |
-
|
17 |
-
$block['attrs']['attributes'][ $key ]['id'] = self::convertIds( $attribute['id'], $attribute['attr_slug'], 'taxonomy' );
|
18 |
-
}
|
19 |
-
|
20 |
-
return $block;
|
21 |
-
}
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Block/Convert/ConverterProvider.php
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Block\Convert;
|
4 |
-
|
5 |
-
use WCML\Block\Convert\Converter\ProductsByAttributes;
|
6 |
-
use WPML\PB\Gutenberg\ConvertIdsInBlock\Base;
|
7 |
-
use WPML\PB\Gutenberg\ConvertIdsInBlock\Composite;
|
8 |
-
use WPML\PB\Gutenberg\ConvertIdsInBlock\NullConvert;
|
9 |
-
use WPML\PB\Gutenberg\ConvertIdsInBlock\BlockAttributes;
|
10 |
-
use WPML\PB\Gutenberg\ConvertIdsInBlock\TagAttributes;
|
11 |
-
|
12 |
-
class ConverterProvider {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @param string $blockName
|
16 |
-
*
|
17 |
-
* @return \WPML\PB\Gutenberg\ConvertIdsInBlock\Base
|
18 |
-
*/
|
19 |
-
public static function get( $blockName ) {
|
20 |
-
switch ( $blockName ) {
|
21 |
-
case 'woocommerce/product-category':
|
22 |
-
$converter = new BlockAttributes(
|
23 |
-
[
|
24 |
-
[
|
25 |
-
'name' => 'categories',
|
26 |
-
'slug' => 'product_cat',
|
27 |
-
'type' => 'taxonomy',
|
28 |
-
],
|
29 |
-
]
|
30 |
-
);
|
31 |
-
break;
|
32 |
-
|
33 |
-
case 'woocommerce/featured-category':
|
34 |
-
$converter = new BlockAttributes(
|
35 |
-
[
|
36 |
-
[
|
37 |
-
'name' => 'categoryId',
|
38 |
-
'slug' => 'product_cat',
|
39 |
-
'type' => 'taxonomy',
|
40 |
-
],
|
41 |
-
]
|
42 |
-
);
|
43 |
-
break;
|
44 |
-
|
45 |
-
case 'woocommerce/featured-product':
|
46 |
-
$converter = new BlockAttributes(
|
47 |
-
[
|
48 |
-
[
|
49 |
-
'name' => 'productId',
|
50 |
-
'slug' => 'product',
|
51 |
-
'type' => 'post'
|
52 |
-
],
|
53 |
-
]
|
54 |
-
);
|
55 |
-
break;
|
56 |
-
|
57 |
-
case 'woocommerce/handpicked-products':
|
58 |
-
$converter = new BlockAttributes(
|
59 |
-
[
|
60 |
-
[
|
61 |
-
'name' => 'products',
|
62 |
-
'slug' => 'product',
|
63 |
-
'type' => 'post',
|
64 |
-
],
|
65 |
-
]
|
66 |
-
);
|
67 |
-
break;
|
68 |
-
|
69 |
-
case 'woocommerce/product-tag':
|
70 |
-
$converter = new BlockAttributes(
|
71 |
-
[
|
72 |
-
[
|
73 |
-
'name' => 'tags',
|
74 |
-
'slug' => 'product_tag',
|
75 |
-
'type' => 'taxonomy',
|
76 |
-
],
|
77 |
-
]
|
78 |
-
);
|
79 |
-
break;
|
80 |
-
|
81 |
-
case 'woocommerce/reviews-by-product':
|
82 |
-
$converter = new Composite(
|
83 |
-
[
|
84 |
-
new BlockAttributes(
|
85 |
-
[
|
86 |
-
[
|
87 |
-
'name' => 'productId',
|
88 |
-
'slug' => 'product',
|
89 |
-
'type' => 'post',
|
90 |
-
],
|
91 |
-
]
|
92 |
-
),
|
93 |
-
new TagAttributes(
|
94 |
-
[
|
95 |
-
[
|
96 |
-
'xpath' => '//*[contains(@class, "wp-block-woocommerce-reviews-by-product")]/@data-product-id',
|
97 |
-
'slug' => 'product',
|
98 |
-
'type' => 'post',
|
99 |
-
],
|
100 |
-
]
|
101 |
-
),
|
102 |
-
]
|
103 |
-
);
|
104 |
-
break;
|
105 |
-
|
106 |
-
case 'woocommerce/reviews-by-category':
|
107 |
-
$converter = new Composite(
|
108 |
-
[
|
109 |
-
new BlockAttributes(
|
110 |
-
[
|
111 |
-
[
|
112 |
-
'name' => 'categoryIds',
|
113 |
-
'slug' => 'product_cat',
|
114 |
-
'type' => 'taxonomy',
|
115 |
-
],
|
116 |
-
]
|
117 |
-
),
|
118 |
-
new TagAttributes(
|
119 |
-
[
|
120 |
-
[
|
121 |
-
'xpath' => '//*[contains(@class, "wp-block-woocommerce-reviews-by-category")]/@data-category-ids',
|
122 |
-
'slug' => 'product_cat',
|
123 |
-
'type' => 'taxonomy',
|
124 |
-
],
|
125 |
-
]
|
126 |
-
),
|
127 |
-
]
|
128 |
-
);
|
129 |
-
break;
|
130 |
-
|
131 |
-
case 'woocommerce/products-by-attribute':
|
132 |
-
$converter = new ProductsByAttributes();
|
133 |
-
break;
|
134 |
-
|
135 |
-
default:
|
136 |
-
$converter = new Base();
|
137 |
-
}
|
138 |
-
|
139 |
-
return $converter;
|
140 |
-
}
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Block/Convert/Hooks.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Block\Convert;
|
4 |
-
|
5 |
-
use IWPML_DIC_Action;
|
6 |
-
use IWPML_Frontend_Action;
|
7 |
-
use SitePress;
|
8 |
-
use WCML\Rest\Frontend\Language;
|
9 |
-
use WPML\FP\Just;
|
10 |
-
use WPML\FP\Str;
|
11 |
-
|
12 |
-
class Hooks implements IWPML_Frontend_Action, IWPML_DIC_Action {
|
13 |
-
|
14 |
-
/** @var SitePress $sitepress */
|
15 |
-
private $sitepress;
|
16 |
-
|
17 |
-
/** @var Language $frontendRestLang */
|
18 |
-
private $frontendRestLang;
|
19 |
-
|
20 |
-
public function __construct( SitePress $sitepress, Language $frontendRestLang ) {
|
21 |
-
$this->sitepress = $sitepress;
|
22 |
-
$this->frontendRestLang = $frontendRestLang;
|
23 |
-
}
|
24 |
-
|
25 |
-
public function add_hooks() {
|
26 |
-
add_filter( 'render_block_data', [ $this, 'filterIdsInBlock' ] );
|
27 |
-
add_filter( 'render_block_woocommerce/product-search', [ $this, 'filterProductSearchForm' ] );
|
28 |
-
add_action( 'parse_query', [ $this, 'addCurrentLangToQueryVars' ] );
|
29 |
-
|
30 |
-
if ( ! ( is_admin() || \WPML_URL_HTTP_Referer::is_post_edit_page() ) ) {
|
31 |
-
add_filter( 'rest_request_before_callbacks', [ $this, 'useLanguageFrontendRestLang' ], 10, 3 );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
public function filterIdsInBlock( array $block ) {
|
36 |
-
return ConverterProvider::get( $block['blockName'] )->convert( $block );
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* WC is caching query results in transients which name
|
41 |
-
* is based on the query vars hash.
|
42 |
-
*
|
43 |
-
* @param \WP_Query $query
|
44 |
-
*/
|
45 |
-
public function addCurrentLangToQueryVars( $query ) {
|
46 |
-
if ( $query instanceof \Automattic\WooCommerce\Blocks\Utils\BlocksWpQuery ) {
|
47 |
-
$query->query_vars['wpml_language'] = $this->sitepress->get_current_language();
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @param \WP_HTTP_Response|\WP_Error $response
|
53 |
-
* @param array $handler
|
54 |
-
* @param \WP_REST_Request $request
|
55 |
-
*
|
56 |
-
* @return \WP_HTTP_Response|\WP_Error
|
57 |
-
*/
|
58 |
-
public function useLanguageFrontendRestLang( $response, $handler, $request ) {
|
59 |
-
if ( $this->isWcRestRequest( $request ) ) {
|
60 |
-
$lang = $this->frontendRestLang->get();
|
61 |
-
|
62 |
-
if ( $lang ) {
|
63 |
-
$this->sitepress->switch_lang( $lang );
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
return $response;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* @param \WP_REST_Request $request
|
72 |
-
*
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
private function isWcRestRequest( \WP_REST_Request $request ) {
|
76 |
-
return strpos( $request->get_route(), '/wc/blocks/' ) === 0
|
77 |
-
|| strpos( $request->get_route(), '/wc/store/' ) === 0;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @param string $blockContent
|
82 |
-
*
|
83 |
-
* @return string
|
84 |
-
*/
|
85 |
-
public function filterProductSearchForm( $blockContent ) {
|
86 |
-
// $replaceActionUrl :: string -> string
|
87 |
-
$replaceActionUrl = Str::pregReplace( '/(<form[^>]*action=")([^"]*)"/', "$1" . home_url( '/' ) . '"' );
|
88 |
-
|
89 |
-
// $addLanguageHiddenField :: string -> string
|
90 |
-
$addLanguageHiddenField = [ $this->sitepress, 'get_search_form_filter' ];
|
91 |
-
|
92 |
-
return Just::of( $blockContent )
|
93 |
-
->map( $replaceActionUrl )
|
94 |
-
->map( $addLanguageHiddenField )
|
95 |
-
->get();
|
96 |
-
}
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/CLI/Hooks.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\CLI;
|
4 |
-
|
5 |
-
class Hooks implements \IWPML_CLI_Action {
|
6 |
-
|
7 |
-
public function add_hooks() {
|
8 |
-
add_action( 'shutdown', [ $this, 'preventWcWizardRedirection' ] );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function preventWcWizardRedirection() {
|
12 |
-
delete_transient( '_wc_activation_redirect' );
|
13 |
-
}
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Container/Config.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Container;
|
4 |
-
|
5 |
-
class Config {
|
6 |
-
|
7 |
-
public static function getSharedInstances() {
|
8 |
-
global $woocommerce_wpml;
|
9 |
-
|
10 |
-
return [
|
11 |
-
$woocommerce_wpml,
|
12 |
-
];
|
13 |
-
}
|
14 |
-
|
15 |
-
public static function getSharedClasses() {
|
16 |
-
return [
|
17 |
-
\WCML_Multi_Currency::class,
|
18 |
-
\WCML_Currencies_Payment_Gateways::class,
|
19 |
-
];
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Email/Settings/Hooks.php
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Email\Settings;
|
4 |
-
|
5 |
-
use IWPML_Backend_Action;
|
6 |
-
use IWPML_DIC_Action;
|
7 |
-
use SitePress;
|
8 |
-
use WCML_WC_Strings;
|
9 |
-
use WPML_Simple_Language_Selector;
|
10 |
-
|
11 |
-
class Hooks implements IWPML_Backend_Action, IWPML_DIC_Action {
|
12 |
-
|
13 |
-
const KEY_PREFIX = 'wcml_lang';
|
14 |
-
|
15 |
-
/** @var SitePress */
|
16 |
-
private $sitepress;
|
17 |
-
|
18 |
-
/** @var WCML_WC_Strings */
|
19 |
-
private $wcmlStrings;
|
20 |
-
|
21 |
-
public function __construct( SitePress $sitepress, WCML_WC_Strings $wcmlStrings ) {
|
22 |
-
$this->sitepress = $sitepress;
|
23 |
-
$this->wcmlStrings = $wcmlStrings;
|
24 |
-
}
|
25 |
-
|
26 |
-
public function add_hooks() {
|
27 |
-
if ( $this->isEmailSettingsPage() ) {
|
28 |
-
add_action( 'admin_footer', [ $this, 'showLanguageLinksForWcEmails' ] );
|
29 |
-
$this->setEmailsStringLanguage();
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @return bool
|
35 |
-
*/
|
36 |
-
private function isEmailSettingsPage() {
|
37 |
-
global $pagenow;
|
38 |
-
|
39 |
-
return is_admin()
|
40 |
-
&& $pagenow === 'admin.php'
|
41 |
-
&& isset( $_GET['page'], $_GET['tab'] )
|
42 |
-
&& $_GET['page'] === 'wc-settings'
|
43 |
-
&& $_GET['tab'] === 'email';
|
44 |
-
}
|
45 |
-
|
46 |
-
public function showLanguageLinksForWcEmails() {
|
47 |
-
$emailOptions = [
|
48 |
-
'woocommerce_new_order_settings',
|
49 |
-
'woocommerce_cancelled_order_settings',
|
50 |
-
'woocommerce_failed_order_settings',
|
51 |
-
'woocommerce_customer_on_hold_order_settings',
|
52 |
-
'woocommerce_customer_processing_order_settings',
|
53 |
-
'woocommerce_customer_completed_order_settings',
|
54 |
-
'woocommerce_customer_refunded_order_settings',
|
55 |
-
'woocommerce_customer_invoice_settings',
|
56 |
-
'woocommerce_customer_note_settings',
|
57 |
-
'woocommerce_customer_reset_password_settings',
|
58 |
-
'woocommerce_customer_new_account_settings',
|
59 |
-
];
|
60 |
-
|
61 |
-
$emailOptions = apply_filters( 'wcml_emails_options_to_translate', $emailOptions );
|
62 |
-
|
63 |
-
$textKeys = [
|
64 |
-
'subject',
|
65 |
-
'heading',
|
66 |
-
'subject_downloadable',
|
67 |
-
'heading_downloadable',
|
68 |
-
'subject_full',
|
69 |
-
'subject_partial',
|
70 |
-
'heading_full',
|
71 |
-
'heading_partial',
|
72 |
-
'subject_paid',
|
73 |
-
'heading_paid',
|
74 |
-
'additional_content',
|
75 |
-
];
|
76 |
-
|
77 |
-
$textKeys = apply_filters( 'wcml_emails_text_keys_to_translate', $textKeys );
|
78 |
-
|
79 |
-
foreach ( $emailOptions as $emailOption ) {
|
80 |
-
$sectionPrefix = apply_filters( 'wcml_emails_section_name_prefix', 'wc_email_', $emailOption );
|
81 |
-
$sectionName = str_replace( 'woocommerce_', $sectionPrefix, $emailOption );
|
82 |
-
$sectionName = apply_filters( 'wcml_emails_section_name_to_translate', str_replace( '_settings', '', $sectionName ) );
|
83 |
-
|
84 |
-
if ( isset( $_GET['section'] ) && $_GET['section'] === $sectionName ) {
|
85 |
-
|
86 |
-
$emailSettings = $this->get_email_option( $emailOption );
|
87 |
-
|
88 |
-
if ( $emailSettings ) {
|
89 |
-
|
90 |
-
foreach ( $emailSettings as $settingsKey => $settingsValue ) {
|
91 |
-
|
92 |
-
if ( in_array( $settingsKey, $textKeys ) ) {
|
93 |
-
|
94 |
-
$emailInputKey = self::getEmailInputKey( $emailOption, $settingsKey );
|
95 |
-
$langSelector = new WPML_Simple_Language_Selector( $this->sitepress );
|
96 |
-
$language = $this->wcmlStrings->get_string_language(
|
97 |
-
$settingsValue,
|
98 |
-
self::getStringDomain( $emailOption ),
|
99 |
-
self::getStringName( $emailOption, $settingsKey )
|
100 |
-
);
|
101 |
-
|
102 |
-
if ( is_null( $language ) ) {
|
103 |
-
$language = $this->sitepress->get_default_language();
|
104 |
-
}
|
105 |
-
|
106 |
-
$langSelector->render(
|
107 |
-
[
|
108 |
-
'id' => $emailOption . '_' . $settingsKey . '_language_selector',
|
109 |
-
'name' => self::KEY_PREFIX . '-' . $emailOption . '-' . $settingsKey,
|
110 |
-
'selected' => $language,
|
111 |
-
'show_please_select' => false,
|
112 |
-
'echo' => true,
|
113 |
-
'style' => 'width: 18%;float: left',
|
114 |
-
]
|
115 |
-
);
|
116 |
-
|
117 |
-
$stPage = admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=admin_texts_' . $emailOption );
|
118 |
-
|
119 |
-
?>
|
120 |
-
<script>
|
121 |
-
var input = jQuery('#<?php echo $emailInputKey; ?>');
|
122 |
-
if (input.length) {
|
123 |
-
input.parent().append('<div class="translation_controls"></div>');
|
124 |
-
input.parent().find('.translation_controls').append('<a href="<?php echo esc_url( $stPage ); ?>" style="margin-left: 10px"><?php esc_html_e( 'translations', 'woocommerce-multilingual' ); ?></a>');
|
125 |
-
jQuery('#<?php echo esc_html( $emailOption . '_' . $settingsKey . '_language_selector' ); ?>').prependTo(input.parent().find('.translation_controls'));
|
126 |
-
}
|
127 |
-
</script>
|
128 |
-
<?php
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
public function setEmailsStringLanguage() {
|
137 |
-
foreach ( $_POST as $key => $language ) {
|
138 |
-
if ( substr( $key, 0, 9 ) === self::KEY_PREFIX ) {
|
139 |
-
|
140 |
-
$keyParts = explode( '-', $key );
|
141 |
-
|
142 |
-
if ( isset( $keyParts[2] ) ) {
|
143 |
-
list( , $emailType, $emailElement ) = $keyParts;
|
144 |
-
|
145 |
-
$emailInputKey = self::getEmailInputKey( $emailType, $emailElement );
|
146 |
-
$emailSettings = $this->get_email_option( $emailType, true );
|
147 |
-
$optionStringValue = $emailSettings[ $emailElement ];
|
148 |
-
|
149 |
-
$stringValue = isset( $_POST[ $emailInputKey ] ) ? $_POST[ $emailInputKey ] : $optionStringValue;
|
150 |
-
$domain = self::getStringDomain( $emailType );
|
151 |
-
$name = self::getStringName( $emailType, $emailElement );
|
152 |
-
|
153 |
-
do_action( 'wpml_register_single_string', $domain, $name, $stringValue, false, $this->wcmlStrings->get_string_language( $optionStringValue, $domain ) );
|
154 |
-
|
155 |
-
$this->wcmlStrings->set_string_language( $stringValue, $domain, $name, $language );
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* @param string $option
|
163 |
-
* @param bool $default
|
164 |
-
*
|
165 |
-
* @return mixed
|
166 |
-
*/
|
167 |
-
private function get_email_option( $option, $default = false ) {
|
168 |
-
$emailSettings = get_option( $option, $default );
|
169 |
-
if ( $emailSettings && is_array( $emailSettings ) && ! isset( $emailSettings['additional_content'] ) ) {
|
170 |
-
$emailSettings['additional_content'] = '';
|
171 |
-
}
|
172 |
-
|
173 |
-
return $emailSettings;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* @param string $emailType
|
178 |
-
* @param string $emailElement
|
179 |
-
*
|
180 |
-
* @return string
|
181 |
-
*/
|
182 |
-
private static function getEmailInputKey( $emailType, $emailElement ) {
|
183 |
-
return str_replace( '_settings', '', $emailType ) . '_' . $emailElement;
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* @param string $emailType
|
188 |
-
*
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
private static function getStringDomain( $emailType ) {
|
192 |
-
return 'admin_texts_' . $emailType;
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* @param string $emailType
|
197 |
-
* @param string $emailElement
|
198 |
-
*
|
199 |
-
* @return string
|
200 |
-
*/
|
201 |
-
private static function getStringName( $emailType, $emailElement ) {
|
202 |
-
return '[' . $emailType . ']' . $emailElement;
|
203 |
-
}
|
204 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/MO/Hooks.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MO;
|
4 |
-
|
5 |
-
class Hooks implements \IWPML_Backend_Action, \IWPML_Frontend_Action {
|
6 |
-
|
7 |
-
public function add_hooks() {
|
8 |
-
add_action( 'wpml_language_has_switched', [ $this, 'forceRemoveUnloadedDomain' ], 0 );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function forceRemoveUnloadedDomain() {
|
12 |
-
if ( isset( $GLOBALS['l10n_unloaded']['woocommerce'] ) ) {
|
13 |
-
unset( $GLOBALS['l10n_unloaded']['woocommerce'] );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Analytics/Export.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Analytics;
|
4 |
-
|
5 |
-
use Closure;
|
6 |
-
use WPML\FP\Obj;
|
7 |
-
|
8 |
-
class Export implements \IWPML_Backend_Action, \IWPML_Frontend_Action, \IWPML_DIC_Action {
|
9 |
-
|
10 |
-
/** @var \wpdb $wpdb */
|
11 |
-
private $wpdb;
|
12 |
-
|
13 |
-
public function __construct( \wpdb $wpdb ) {
|
14 |
-
$this->wpdb = $wpdb;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function add_hooks() {
|
18 |
-
add_filter( 'woocommerce_admin_report_columns', $this->addSelect( 'language', 'wpml_language' ), 10, 2 );
|
19 |
-
add_filter( 'woocommerce_report_orders_export_columns', Obj::assoc( 'language', __( 'Language', 'woocommerce-multilingual' ) ) );
|
20 |
-
add_filter( 'woocommerce_report_orders_prepare_export_item', $this->copyProp( 'language' ), 10, 2 );
|
21 |
-
|
22 |
-
if ( wcml_is_multi_currency_on() ) {
|
23 |
-
add_filter( 'woocommerce_admin_report_columns', $this->addSelect( 'currency', '_order_currency' ), 10, 2 );
|
24 |
-
add_filter( 'woocommerce_report_orders_export_columns', Obj::assoc( 'currency', __( 'Currency', 'woocommerce-multilingual' ) ) );
|
25 |
-
add_filter( 'woocommerce_report_orders_prepare_export_item', $this->copyProp( 'currency' ), 10, 2 );
|
26 |
-
add_filter( 'woocommerce_report_products_export_columns', Obj::assoc( 'currency', __( 'Currency', 'woocommerce-multilingual' ) ) );
|
27 |
-
add_filter( 'woocommerce_report_products_prepare_export_item', $this->copyProp( 'currency' ), 10, 2 );
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @param string $columnName
|
33 |
-
* @param string $metaKey
|
34 |
-
*
|
35 |
-
* @return callable ( array, string ) → array
|
36 |
-
*/
|
37 |
-
public function addSelect( $columnName, $metaKey ) {
|
38 |
-
return function( $columns, $context ) use ( $columnName, $metaKey ) {
|
39 |
-
if ( 'orders' === $context ) {
|
40 |
-
return Obj::assoc(
|
41 |
-
$columnName,
|
42 |
-
$this->wpdb->prepare(
|
43 |
-
"(SELECT meta_value FROM {$this->wpdb->postmeta} WHERE post_id = {$this->wpdb->prefix}wc_order_stats.order_id AND meta_key = %s) AS %s",
|
44 |
-
$metaKey,
|
45 |
-
$columnName
|
46 |
-
),
|
47 |
-
$columns
|
48 |
-
);
|
49 |
-
}
|
50 |
-
|
51 |
-
return $columns;
|
52 |
-
};
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @param string $column
|
57 |
-
*
|
58 |
-
* @return callable ( array, array ) → array
|
59 |
-
*/
|
60 |
-
public function copyProp( $column ) {
|
61 |
-
return function ( $export_item, $item ) use ( $column ) {
|
62 |
-
return Obj::assoc( $column, Obj::prop( $column, $item ), $export_item );
|
63 |
-
};
|
64 |
-
}
|
65 |
-
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Analytics/Factory.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Analytics;
|
4 |
-
|
5 |
-
class Factory implements \IWPML_Backend_Action_Loader, \IWPML_REST_Action_Loader, \IWPML_Deferred_Action_Loader {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @return string
|
9 |
-
*/
|
10 |
-
public function get_load_action() {
|
11 |
-
return 'init';
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @return \IWPML_Action|null
|
16 |
-
*/
|
17 |
-
public function create() {
|
18 |
-
/**
|
19 |
-
* @global \woocommerce_wpml $GLOBALS['woocommerce_wpml']
|
20 |
-
* @name $woocommerce_wpml
|
21 |
-
*/
|
22 |
-
global $woocommerce_wpml;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @global \wpdb $GLOBALS['wpdb']
|
26 |
-
* @name $wpdb
|
27 |
-
*/
|
28 |
-
global $wpdb;
|
29 |
-
|
30 |
-
if ( wcml_is_multi_currency_on() ) {
|
31 |
-
return new Hooks( $woocommerce_wpml, $wpdb );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Analytics/Hooks.php
DELETED
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Analytics;
|
4 |
-
|
5 |
-
use WCML\Utilities\Resources;
|
6 |
-
use WCML\Rest\Functions;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
use WPML\FP\Fns;
|
9 |
-
|
10 |
-
class Hooks implements \IWPML_Action {
|
11 |
-
|
12 |
-
/** @var \woocommerce_wpml $woocommerce_wpml */
|
13 |
-
private $woocommerce_wpml;
|
14 |
-
|
15 |
-
/** @var \wpdb $wpdb */
|
16 |
-
private $wpdb;
|
17 |
-
|
18 |
-
public function __construct( \woocommerce_wpml $woocommerce_wpml, \wpdb $wpdb ) {
|
19 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
20 |
-
$this->wpdb = $wpdb;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function add_hooks() {
|
24 |
-
if ( Functions::isAnalyticsPage() ) {
|
25 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] );
|
26 |
-
}
|
27 |
-
|
28 |
-
wpml_collect(
|
29 |
-
[
|
30 |
-
'revenue',
|
31 |
-
'orders',
|
32 |
-
'orders_stats',
|
33 |
-
'products',
|
34 |
-
'products_stats',
|
35 |
-
'categories',
|
36 |
-
'coupons',
|
37 |
-
'coupons_stats',
|
38 |
-
'taxes',
|
39 |
-
'taxes_stats',
|
40 |
-
'variations',
|
41 |
-
'variations_stats',
|
42 |
-
]
|
43 |
-
)->each(
|
44 |
-
function( $item ) {
|
45 |
-
add_filter( "woocommerce_analytics_{$item}_query_args", [ $this, 'addCurrencyArg' ] );
|
46 |
-
}
|
47 |
-
);
|
48 |
-
|
49 |
-
wpml_collect(
|
50 |
-
[
|
51 |
-
'products',
|
52 |
-
'orders',
|
53 |
-
'variations',
|
54 |
-
'categories',
|
55 |
-
'coupons',
|
56 |
-
'taxes',
|
57 |
-
]
|
58 |
-
)->each(
|
59 |
-
function( $item ) {
|
60 |
-
add_filter( "woocommerce_analytics_clauses_join_{$item}_subquery", [ $this, 'addJoin' ] );
|
61 |
-
add_filter( "woocommerce_analytics_clauses_join_{$item}_stats_total", [ $this, 'addJoin' ] );
|
62 |
-
add_filter( "woocommerce_analytics_clauses_join_{$item}_stats_interval", [ $this, 'addJoin' ] );
|
63 |
-
add_filter( "woocommerce_analytics_clauses_where_{$item}_subquery", [ $this, 'addWhere' ] );
|
64 |
-
add_filter( "woocommerce_analytics_clauses_where_{$item}_stats_total", [ $this, 'addWhere' ] );
|
65 |
-
add_filter( "woocommerce_analytics_clauses_where_{$item}_stats_interval", [ $this, 'addWhere' ] );
|
66 |
-
add_filter( "woocommerce_analytics_clauses_select_{$item}_subquery", [ $this, 'addSelect' ] );
|
67 |
-
add_filter( "woocommerce_analytics_clauses_select_{$item}_stats_total", [ $this, 'addSelect' ] );
|
68 |
-
add_filter( "woocommerce_analytics_clauses_select_{$item}_stats_interval", [ $this, 'addSelect' ] );
|
69 |
-
}
|
70 |
-
);
|
71 |
-
}
|
72 |
-
|
73 |
-
public function enqueueAssets() {
|
74 |
-
$multiCurrency = $this->woocommerce_wpml->get_multi_currency();
|
75 |
-
$currencies = $multiCurrency->get_currency_codes();
|
76 |
-
$enqueue = Resources::enqueueApp( 'multicurrencyAnalytics' );
|
77 |
-
|
78 |
-
$enqueue(
|
79 |
-
[
|
80 |
-
'name' => 'wcmlAnalytics',
|
81 |
-
'data' => [
|
82 |
-
'strings' => [
|
83 |
-
'currencyLabel' => __( 'Currency', 'woocommerce-multilingual' ),
|
84 |
-
],
|
85 |
-
'filterItems' => $this->getCurrencyFilterItems( $currencies ),
|
86 |
-
'currencyConfigs' => $this->getCurrencyConfigs( $currencies, $multiCurrency ),
|
87 |
-
],
|
88 |
-
]
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Labels for the currency dropdown (filter).
|
94 |
-
*
|
95 |
-
* @param array $currencies
|
96 |
-
*
|
97 |
-
* @return array
|
98 |
-
*/
|
99 |
-
private function getCurrencyFilterItems( $currencies ) {
|
100 |
-
$currencyLabels = get_woocommerce_currencies();
|
101 |
-
|
102 |
-
return wpml_collect( $currencies )
|
103 |
-
->map(
|
104 |
-
function( $currency ) use ( $currencyLabels ) {
|
105 |
-
return [
|
106 |
-
'value' => $currency,
|
107 |
-
'label' => $currencyLabels[ $currency ],
|
108 |
-
];
|
109 |
-
}
|
110 |
-
)->toArray();
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Currency settings for displaying prices.
|
115 |
-
*
|
116 |
-
* @param array $currencies
|
117 |
-
* @param \WCML_Multi_Currency $multiCurrency
|
118 |
-
*
|
119 |
-
* @return array
|
120 |
-
*/
|
121 |
-
private function getCurrencyConfigs( $currencies, $multiCurrency ) {
|
122 |
-
return wpml_collect( $currencies )
|
123 |
-
->mapWithKeys(
|
124 |
-
function( $currency ) use ( $multiCurrency ) {
|
125 |
-
$get = Obj::prop( Fns::__, $multiCurrency->get_currency_details_by_code( $currency ) );
|
126 |
-
|
127 |
-
return [
|
128 |
-
$currency => [
|
129 |
-
'code' => $currency,
|
130 |
-
'symbol' => html_entity_decode( get_woocommerce_currency_symbol( $currency ) ),
|
131 |
-
'symbolPosition' => $get( 'position' ),
|
132 |
-
'thousandSeparator' => $get( 'thousand_sep' ),
|
133 |
-
'decimalSeparator' => $get( 'decimal_sep' ),
|
134 |
-
'precision' => $get( 'num_decimals' ),
|
135 |
-
],
|
136 |
-
];
|
137 |
-
}
|
138 |
-
)->toArray();
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* @param array $args
|
143 |
-
*
|
144 |
-
* @return array
|
145 |
-
*/
|
146 |
-
public function addCurrencyArg( $args ) {
|
147 |
-
return Obj::assoc( 'currency', $this->getCurrency(), $args );
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* @param array $clauses
|
152 |
-
*
|
153 |
-
* @return array
|
154 |
-
*/
|
155 |
-
public function addJoin( $clauses ) {
|
156 |
-
$clauses[] = "JOIN {$this->wpdb->postmeta} wcml_currency_postmeta ON {$this->wpdb->prefix}wc_order_stats.order_id = wcml_currency_postmeta.post_id";
|
157 |
-
|
158 |
-
return $clauses;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* @param array $clauses
|
163 |
-
*
|
164 |
-
* @return array
|
165 |
-
*/
|
166 |
-
public function addWhere( $clauses ) {
|
167 |
-
$clauses[] = $this->wpdb->prepare( "AND wcml_currency_postmeta.meta_key = '_order_currency' AND wcml_currency_postmeta.meta_value = %s", $this->getCurrency() );
|
168 |
-
|
169 |
-
return $clauses;
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* @param array $clauses
|
174 |
-
*
|
175 |
-
* @return array
|
176 |
-
*/
|
177 |
-
public function addSelect( $clauses ) {
|
178 |
-
$clauses[] = ', wcml_currency_postmeta.meta_value AS currency';
|
179 |
-
|
180 |
-
return $clauses;
|
181 |
-
}
|
182 |
-
|
183 |
-
private function getCurrency() {
|
184 |
-
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
185 |
-
return isset( $_GET['currency'] )
|
186 |
-
? sanitize_text_field( wp_unslash( $_GET['currency'] ) )
|
187 |
-
: wcml_get_woocommerce_currency_option();
|
188 |
-
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
189 |
-
}
|
190 |
-
|
191 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/AdminHooks.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
use IWPML_Action;
|
6 |
-
use WCML_Multi_Currency;
|
7 |
-
|
8 |
-
class AdminHooks implements IWPML_Action {
|
9 |
-
const WCML_SHIPPING_COSTS = 'wcml_shipping_costs';
|
10 |
-
|
11 |
-
/** @var WCML_Multi_Currency */
|
12 |
-
private $wcmlMultiCurrency;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* AdminHooks constructor.
|
16 |
-
*
|
17 |
-
* @param \WCML_Multi_Currency $wcmlMultiCurrency
|
18 |
-
*/
|
19 |
-
public function __construct( \WCML_Multi_Currency $wcmlMultiCurrency ) {
|
20 |
-
$this->wcmlMultiCurrency = $wcmlMultiCurrency;
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Registers hooks.
|
25 |
-
*/
|
26 |
-
public function add_hooks() {
|
27 |
-
ShippingModeProvider::getAll()->each( function( ShippingMode $shippingMode ) {
|
28 |
-
add_filter(
|
29 |
-
'woocommerce_shipping_instance_form_fields_' . $shippingMode->getMethodId(),
|
30 |
-
$this->addCurrencyShippingFields( $shippingMode ),
|
31 |
-
10,
|
32 |
-
1
|
33 |
-
);
|
34 |
-
}
|
35 |
-
);
|
36 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'loadJs' ] );
|
37 |
-
}
|
38 |
-
|
39 |
-
public function addCurrencyShippingFields( ShippingMode $shippingMode ) {
|
40 |
-
return function( array $field ) use ( $shippingMode ) {
|
41 |
-
return $this->addCurrencyShippingFieldsToShippingMethodForm( $field, $shippingMode );
|
42 |
-
};
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Adds fields to display screen for shipping method.
|
47 |
-
*
|
48 |
-
* Adds two kind of fields:
|
49 |
-
* - The select field to enable/disable shipping costs in other currencies.
|
50 |
-
* @see \AdminHooks::add_enable_field
|
51 |
-
* - The input field for each registered currency to provide shipping costs.
|
52 |
-
* @see \AdminHooks::add_currencies_fields
|
53 |
-
*
|
54 |
-
* @param array $field
|
55 |
-
*
|
56 |
-
* @return array
|
57 |
-
*/
|
58 |
-
private function addCurrencyShippingFieldsToShippingMethodForm( array $field, ShippingMode $shippingMode ) {
|
59 |
-
$field = $this->addTitleField( $field );
|
60 |
-
$field = $this->addEnableField( $field );
|
61 |
-
$field = $this->addCurrenciesFields( $field, $shippingMode );
|
62 |
-
if ( $shippingMode instanceof ShippingClassesMode ) {
|
63 |
-
$field = ShippingClasses::addFields( $field, $this->wcmlMultiCurrency );
|
64 |
-
}
|
65 |
-
return $field;
|
66 |
-
}
|
67 |
-
|
68 |
-
private function addTitleField( $field ) {
|
69 |
-
$field[ 'wcml_shipping_costs_title' ] = [
|
70 |
-
'title' => __( 'Costs and values in custom currencies', 'woocommerce-multilingual' ),
|
71 |
-
'type' => 'title',
|
72 |
-
'default' => '',
|
73 |
-
'description' => __( 'Woocommerce Multilingual by default will multiply all your costs and values defined above by currency exchange rates. If you don\'t want this and you prefer static values instead, you can define them here.', 'woocommerce-multilingual' ),
|
74 |
-
];
|
75 |
-
return $field;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Adds select field to enable/disable shipping costs in other currencies.
|
80 |
-
*
|
81 |
-
* @param array $field
|
82 |
-
*
|
83 |
-
* @return array
|
84 |
-
*/
|
85 |
-
private function addEnableField( array $field ) {
|
86 |
-
$enable_field = [
|
87 |
-
'title' => esc_html__( 'Enable costs in custom currencies', 'woocommerce-multilingual' ),
|
88 |
-
'type' => 'select',
|
89 |
-
'class' => 'wcml-enable-shipping-custom-currency',
|
90 |
-
'default' => 'auto',
|
91 |
-
'options' => [
|
92 |
-
'auto' => esc_html__( 'Calculate shipping costs in other currencies automatically', 'woocommerce-multilingual' ),
|
93 |
-
'manual' => esc_html__( 'Set shipping costs in other currencies manually', 'woocommerce-multilingual' )
|
94 |
-
]
|
95 |
-
];
|
96 |
-
$field[ self::WCML_SHIPPING_COSTS ] = $enable_field;
|
97 |
-
|
98 |
-
return $field;
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Adds input field for each registered currency to provide shipping costs.
|
103 |
-
*
|
104 |
-
* @param array $field
|
105 |
-
*
|
106 |
-
* @return array
|
107 |
-
*/
|
108 |
-
public function addCurrenciesFields( array $field, ShippingMode $shippingMode ) {
|
109 |
-
foreach ( $this->wcmlMultiCurrency->get_currency_codes() as $currencyCode ) {
|
110 |
-
if ( $this->wcmlMultiCurrency->get_default_currency() === $currencyCode ) {
|
111 |
-
continue;
|
112 |
-
}
|
113 |
-
$field = $this->getCurrencyField( $field, $currencyCode, $shippingMode );
|
114 |
-
}
|
115 |
-
return $field;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Adds one field for given currency.
|
120 |
-
*
|
121 |
-
* @param array $field
|
122 |
-
* @param string $currencyCode
|
123 |
-
*
|
124 |
-
* @return mixed
|
125 |
-
*/
|
126 |
-
protected function getCurrencyField( $field, $currencyCode, ShippingMode $shippingMode ) {
|
127 |
-
$fieldKey = $shippingMode->getSettingsFormKey( $currencyCode );
|
128 |
-
if ( $fieldKey ) {
|
129 |
-
$fieldValue = [
|
130 |
-
'title' => $shippingMode->getFieldTitle( $currencyCode ),
|
131 |
-
'type' => 'text',
|
132 |
-
'description' => $shippingMode->getFieldDescription( $currencyCode ),
|
133 |
-
'default' => '0',
|
134 |
-
'desc_tip' => true,
|
135 |
-
'class' => 'wcml-shipping-cost-currency'
|
136 |
-
];
|
137 |
-
|
138 |
-
$field[ $fieldKey] = $fieldValue;
|
139 |
-
}
|
140 |
-
return $field;
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Enqueues script responsible for JS actions on shipping fields.
|
145 |
-
*/
|
146 |
-
public function loadJs() {
|
147 |
-
wp_enqueue_script(
|
148 |
-
'wcml-admin-shipping-currency-selector',
|
149 |
-
constant( 'WCML_PLUGIN_URL' ) . '/dist/js/multicurrencyShippingAdmin/app.js',
|
150 |
-
[],
|
151 |
-
constant( 'WCML_VERSION' ),
|
152 |
-
true
|
153 |
-
);
|
154 |
-
}
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/DefaultConversion.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
trait DefaultConversion {
|
6 |
-
/**
|
7 |
-
* Try to get cost/amount from options array for default currency.
|
8 |
-
*
|
9 |
-
* @param float|int $cost Cost to filter.
|
10 |
-
* @param array $rateSettings Options array.
|
11 |
-
* @param string $costName Cost key with currency code appended.
|
12 |
-
* @param string $currencyCode Currency code.
|
13 |
-
*
|
14 |
-
* @return float|int
|
15 |
-
*/
|
16 |
-
public function getValueFromDefaultCurrency( $cost, $rateSettings, $costName, $currencyCode ) {
|
17 |
-
if ( preg_match( '/(.*)_' . $currencyCode . '$/', $costName, $matches ) ) {
|
18 |
-
$defaultCostName = $matches[1];
|
19 |
-
if ( ! empty( $rateSettings[ $defaultCostName ] ) ) {
|
20 |
-
$cost = wcml_convert_price( $rateSettings[ $defaultCostName ], $currencyCode );
|
21 |
-
}
|
22 |
-
}
|
23 |
-
return $cost;
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/FlatRateShipping.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class FlatRateShipping implements ShippingClassesMode {
|
6 |
-
use ShippingModeBase;
|
7 |
-
use VariableCost;
|
8 |
-
|
9 |
-
public function getMethodId() {
|
10 |
-
return 'flat_rate';
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/FreeShipping.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class FreeShipping implements ShippingMode {
|
6 |
-
use ShippingModeBase;
|
7 |
-
use DefaultConversion;
|
8 |
-
|
9 |
-
public function getFieldTitle( $currencyCode ) {
|
10 |
-
if ( ! is_string( $currencyCode ) ) {
|
11 |
-
$currencyCode = '';
|
12 |
-
}
|
13 |
-
return sprintf( esc_html_x( 'Minimal order amount in %s',
|
14 |
-
'The label for the field with minimal order amount in additional currency. The currency symbol will be added in place of %s specifier.',
|
15 |
-
'woocommerce-multilingual' ), $currencyCode );
|
16 |
-
}
|
17 |
-
|
18 |
-
public function getFieldDescription( $currencyCode ) {
|
19 |
-
if ( ! is_string( $currencyCode ) ) {
|
20 |
-
$currencyCode = '';
|
21 |
-
}
|
22 |
-
return sprintf( esc_html_x( 'The minimal order amount if customer choose %s as a purchase currency.',
|
23 |
-
'The description for the field with minimal order amount in additional currency. The currency symbol will be added in place of %s specifier.',
|
24 |
-
'woocommerce-multilingual' ), $currencyCode );
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getMethodId() {
|
28 |
-
return 'free_shipping';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Returns minimal amount key for given currency.
|
33 |
-
*
|
34 |
-
* @param string $currencyCode Currency code.
|
35 |
-
*
|
36 |
-
* @return string
|
37 |
-
*/
|
38 |
-
private function getMinimalOrderAmountKey( $currencyCode ) {
|
39 |
-
return sprintf( 'min_amount_%s', $currencyCode );
|
40 |
-
}
|
41 |
-
|
42 |
-
public function getSettingsFormKey( $currencyCode ) {
|
43 |
-
return $this->getMinimalOrderAmountKey( $currencyCode );
|
44 |
-
}
|
45 |
-
|
46 |
-
public function getMinimalOrderAmountValue( $amount, $shipping, $currency ) {
|
47 |
-
if ( $this->isManualPricingEnabled( $shipping ) ) {
|
48 |
-
$key = $this->getMinimalOrderAmountKey( $currency );
|
49 |
-
if ( ! empty( $shipping[ $key ] ) ) {
|
50 |
-
$amount = $shipping[ $key ];
|
51 |
-
} else {
|
52 |
-
$amount = $this->getValueFromDefaultCurrency( $amount, $shipping, $key, $currency );
|
53 |
-
}
|
54 |
-
}
|
55 |
-
return $amount;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getShippingCostValue
|
60 |
-
*
|
61 |
-
* @param array|object $rate
|
62 |
-
* @param string $currency
|
63 |
-
*
|
64 |
-
* @return int|mixed|string
|
65 |
-
*/
|
66 |
-
public function getShippingCostValue( $rate, $currency ) {
|
67 |
-
if ( ! isset( $rate->cost ) ) {
|
68 |
-
$rate->cost = 0;
|
69 |
-
}
|
70 |
-
return $rate->cost;
|
71 |
-
}
|
72 |
-
|
73 |
-
public function isManualPricingEnabled( $instance ) {
|
74 |
-
return is_array( $instance ) && isset( $instance['wcml_shipping_costs'] ) && 'manual' === $instance['wcml_shipping_costs'];
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/FrontEndHooks.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
use IWPML_Action;
|
6 |
-
|
7 |
-
class FrontEndHooks implements IWPML_Action {
|
8 |
-
|
9 |
-
private $multiCurrency;
|
10 |
-
|
11 |
-
public function __construct( $multiCurrency ) {
|
12 |
-
$this->multiCurrency = $multiCurrency;
|
13 |
-
}
|
14 |
-
|
15 |
-
public function add_hooks() {
|
16 |
-
ShippingModeProvider::getAll()->each( function( ShippingMode $shippingMode ) {
|
17 |
-
add_filter(
|
18 |
-
'woocommerce_shipping_' . $shippingMode->getMethodId() . '_instance_option',
|
19 |
-
$this->getShippingCost( $shippingMode ),
|
20 |
-
10,
|
21 |
-
3
|
22 |
-
);
|
23 |
-
}
|
24 |
-
);
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getShippingCost( ShippingMode $shippingMode ) {
|
28 |
-
return function( $rate, $key, $wcShippingMethod ) use ( $shippingMode ) {
|
29 |
-
if ( $shippingMode->isManualPricingEnabled( $wcShippingMethod ) ) {
|
30 |
-
if ( 'cost' === $key ) {
|
31 |
-
$rate = $shippingMode->getShippingCostValue( $wcShippingMethod, $this->getClientCurrency() );
|
32 |
-
} elseif ( $shippingMode instanceof ShippingClassesMode ) {
|
33 |
-
if ( $this->isShippingClass( $key ) ) {
|
34 |
-
$rate = $shippingMode->getShippingClassCostValue( $wcShippingMethod, $this->getClientCurrency(), $key );
|
35 |
-
} elseif ( $this->isNoShippingClass( $key ) ) {
|
36 |
-
$rate = $shippingMode->getNoShippingClassCostValue( $wcShippingMethod, $this->getClientCurrency() );
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
return $rate;
|
41 |
-
};
|
42 |
-
}
|
43 |
-
|
44 |
-
private function isShippingClass( $key ) {
|
45 |
-
return 'class_cost_' === substr( $key, 0, 11 );
|
46 |
-
}
|
47 |
-
|
48 |
-
private function isNoShippingClass( $key ) {
|
49 |
-
return 'no_class_cost' === substr( $key, 0, 13 );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns current client currency, respecting result of currency switcher widget actions.
|
54 |
-
*
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
private function getClientCurrency() {
|
58 |
-
return $this->adjustCurrencyOnWidgetChange( $this->multiCurrency->get_client_currency() );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Checks if this is currency change triggered from WCML currency widget and updates currency code.
|
63 |
-
*
|
64 |
-
* @param string $currencyCode
|
65 |
-
*
|
66 |
-
* @return string Currency code.
|
67 |
-
*/
|
68 |
-
private function adjustCurrencyOnWidgetChange( $currencyCode ) {
|
69 |
-
$postData = wpml_collect( $_POST );
|
70 |
-
$currencyCodeInRequest = $postData->get( 'currency' );
|
71 |
-
if ( 'wcml_switch_currency' === $postData->get( 'action' )
|
72 |
-
&& $currencyCodeInRequest
|
73 |
-
&& $this->validateCurrencyCode( $currencyCodeInRequest ) ) {
|
74 |
-
return $currencyCodeInRequest;
|
75 |
-
}
|
76 |
-
return $currencyCode;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Checks if given currency code is one of currencies set in WCML.
|
81 |
-
*
|
82 |
-
* @param mixed $currencyCode
|
83 |
-
*
|
84 |
-
* @return bool
|
85 |
-
*/
|
86 |
-
private function validateCurrencyCode( $currencyCode ) {
|
87 |
-
return in_array( $currencyCode, $this->multiCurrency->get_currency_codes() );
|
88 |
-
}
|
89 |
-
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/LocalPickup.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class LocalPickup implements ShippingMode {
|
6 |
-
use ShippingModeBase;
|
7 |
-
use VariableCost;
|
8 |
-
|
9 |
-
public function getMethodId() {
|
10 |
-
return 'local_pickup';
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingClasses.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class ShippingClasses {
|
6 |
-
/**
|
7 |
-
* Adds shipping classes for currencies fields to shipping method wp-admin GUI.
|
8 |
-
*
|
9 |
-
* @param array $field
|
10 |
-
* @param \WCML_Multi_Currency $wcmlMultiCurrency
|
11 |
-
*
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
public static function addFields( array $field, \WCML_Multi_Currency $wcmlMultiCurrency ) {
|
15 |
-
$shippingClasses = WC()->shipping()->get_shipping_classes();
|
16 |
-
if ( ! empty( $shippingClasses ) ) {
|
17 |
-
foreach ( $wcmlMultiCurrency->get_currency_codes() as $currencyCode ) {
|
18 |
-
if ( $wcmlMultiCurrency->get_default_currency() === $currencyCode ) {
|
19 |
-
continue;
|
20 |
-
}
|
21 |
-
foreach ( $shippingClasses as $shippingClass ) {
|
22 |
-
$classSourceLanguageCode = self::getSourceLanguageCode( $shippingClass );
|
23 |
-
if ( $classSourceLanguageCode === null ) {
|
24 |
-
$field = self::addShippingClassField( $field, $shippingClass, $currencyCode );
|
25 |
-
} else {
|
26 |
-
$field = self::askToSwitchLanguage( $field, $shippingClass, $classSourceLanguageCode );
|
27 |
-
}
|
28 |
-
}
|
29 |
-
$field = self::addNoShippingClassField( $field, $currencyCode );
|
30 |
-
}
|
31 |
-
}
|
32 |
-
return $field;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Returns source language of the shipping class which was created originally.
|
37 |
-
*
|
38 |
-
* @param WP_Term $shippingClass
|
39 |
-
*
|
40 |
-
* @return string|null
|
41 |
-
*/
|
42 |
-
protected static function getSourceLanguageCode( $shippingClass ) {
|
43 |
-
$classLanguageDetails = apply_filters( 'wpml_element_language_details', false, [
|
44 |
-
'element_id' => $shippingClass->term_id,
|
45 |
-
'element_type' => $shippingClass->taxonomy,
|
46 |
-
] );
|
47 |
-
return isset( $classLanguageDetails->source_language_code ) ? $classLanguageDetails->source_language_code : null;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Adds field to the GUI which explains user should switch to the other language to provide the data.
|
52 |
-
*
|
53 |
-
* @param array $field
|
54 |
-
* @param WP_Tern $shippingClass
|
55 |
-
* @param string $classSourceLanguageCode
|
56 |
-
*
|
57 |
-
* @return array
|
58 |
-
*/
|
59 |
-
protected static function askToSwitchLanguage( $field, $shippingClass, $classSourceLanguageCode ) {
|
60 |
-
$field[ 'wcml_ask_to_switch_language_' . $shippingClass->term_id ] = [
|
61 |
-
'title' => '',
|
62 |
-
'description' => sprintf( __( 'Your shipping class %s has been created in %s language. Please switch your language if you want to provide shipping costs in different currencies for this class.', 'woocommerce-multilingual' ),
|
63 |
-
$shippingClass->name,
|
64 |
-
$classSourceLanguageCode),
|
65 |
-
'type' => 'title'
|
66 |
-
];
|
67 |
-
return $field;
|
68 |
-
}
|
69 |
-
|
70 |
-
protected static function addShippingClassField( $field, $shippingClass, $currencyCode ) {
|
71 |
-
$field[ 'class_cost_' . $shippingClass->term_id . '_' . $currencyCode ] = [
|
72 |
-
'title' => sprintf( __( '"%s" shipping class cost in %s', 'woocommerce-multilingual' ), esc_html( $shippingClass->name ), esc_html( $currencyCode ) ),
|
73 |
-
'type' => 'text',
|
74 |
-
'placeholder' => __( 'N/A', 'woocommerce-multilingual' ),
|
75 |
-
'class' => 'wcml-shipping-cost-currency'
|
76 |
-
];
|
77 |
-
return $field;
|
78 |
-
}
|
79 |
-
|
80 |
-
protected static function addNoShippingClassField( $field, $currencyCode ) {
|
81 |
-
$field[ 'no_class_cost_' . $currencyCode ] = [
|
82 |
-
'title' => sprintf( __( 'No shipping class cost in %s', 'woocommerce-multilingual' ), esc_html( $currencyCode ) ),
|
83 |
-
'type' => 'text',
|
84 |
-
'placeholder' => __( 'N/A', 'woocommerce-multilingual' ),
|
85 |
-
'default' => '',
|
86 |
-
'class' => 'wcml-shipping-cost-currency'
|
87 |
-
];
|
88 |
-
return $field;
|
89 |
-
}
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingClassesMode.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
interface ShippingClassesMode extends ShippingMode {
|
6 |
-
/**
|
7 |
-
* @param array|object $rate
|
8 |
-
* @param string $currency
|
9 |
-
* @param string $shippingClassKey
|
10 |
-
*
|
11 |
-
* @return int|mixed|string Shipping class cost for given currency.
|
12 |
-
*/
|
13 |
-
public function getShippingClassCostValue( $rate, $currency, $shippingClassKey );
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param array|object $rate
|
17 |
-
* @param string $currency
|
18 |
-
*
|
19 |
-
* @return int|mixed|string "No shipping class" cost for given currency.
|
20 |
-
*/
|
21 |
-
public function getNoShippingClassCostValue( $rate, $currency );
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingHooksFactory.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class ShippingHooksFactory implements \IWPML_Deferred_Action_Loader, \IWPML_Backend_Action_Loader, \IWPML_Frontend_Action_Loader {
|
6 |
-
|
7 |
-
public function get_load_action() {
|
8 |
-
return 'init';
|
9 |
-
}
|
10 |
-
|
11 |
-
public function create() {
|
12 |
-
/** @var \woocommerce_wpml $woocommerce_wpml */
|
13 |
-
global $woocommerce_wpml;
|
14 |
-
$hooks = [];
|
15 |
-
|
16 |
-
if ( wcml_is_multi_currency_on()
|
17 |
-
&& $this->hasAdditionalCurrencyDefined()
|
18 |
-
) {
|
19 |
-
if ( $this->isShippingPageRequest() || $this->isAjaxOnShippingPageRequest() ) {
|
20 |
-
$hooks[] = new AdminHooks( $woocommerce_wpml->get_multi_currency() );
|
21 |
-
} else {
|
22 |
-
$hooks[] = new FrontEndHooks( $woocommerce_wpml->get_multi_currency() );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
return $hooks;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Does user defined at least one additional currency in WCML.
|
31 |
-
*
|
32 |
-
* @return bool
|
33 |
-
*/
|
34 |
-
private function hasAdditionalCurrencyDefined() {
|
35 |
-
/** @var \woocommerce_wpml $woocommerce_wpml */
|
36 |
-
global $woocommerce_wpml;
|
37 |
-
|
38 |
-
$available_currencies = $woocommerce_wpml->get_multi_currency()->get_currency_codes();
|
39 |
-
|
40 |
-
return is_array( $available_currencies ) && count( $available_currencies ) > 1;
|
41 |
-
}
|
42 |
-
|
43 |
-
private function isShippingPageRequest() {
|
44 |
-
return isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && 'shipping' === $_GET['tab']
|
45 |
-
|| isset( $_GET['action'] ) && 'woocommerce_shipping_zone_methods_save_settings' === $_GET['action'];
|
46 |
-
}
|
47 |
-
|
48 |
-
private function isAjaxOnShippingPageRequest() {
|
49 |
-
$getData = wpml_collect( $_GET );
|
50 |
-
$shippingActions = [ 'woocommerce_shipping_zone_add_method', 'woocommerce_shipping_zone_methods_save_changes' ];
|
51 |
-
|
52 |
-
return wp_doing_ajax() && wpml_collect( $shippingActions )->containsStrict( $getData->get( 'action' ) );
|
53 |
-
}
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingMode.php
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
interface ShippingMode {
|
6 |
-
/**
|
7 |
-
* Returns shipping method id (shipping option key).
|
8 |
-
*
|
9 |
-
* @return string
|
10 |
-
*/
|
11 |
-
public function getMethodId();
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Returns field title.
|
15 |
-
*
|
16 |
-
* This value is visible on shipping method configuration screen, on the left.
|
17 |
-
*
|
18 |
-
* @param string $currencyCode
|
19 |
-
*
|
20 |
-
* @return string
|
21 |
-
*/
|
22 |
-
public function getFieldTitle( $currencyCode );
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Returns field description.
|
26 |
-
*
|
27 |
-
* This value is visible on shipping method configuration screen, when mouse over
|
28 |
-
* the question mark icon, next to field title.
|
29 |
-
*
|
30 |
-
* @param string $currencyCode
|
31 |
-
*
|
32 |
-
* @return string
|
33 |
-
*/
|
34 |
-
public function getFieldDescription( $currencyCode );
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Return the key which will be used in shipping method configuration form.
|
38 |
-
*
|
39 |
-
* @param string $currencyCode
|
40 |
-
*
|
41 |
-
* @return string|null
|
42 |
-
*/
|
43 |
-
public function getSettingsFormKey( $currencyCode );
|
44 |
-
|
45 |
-
/**
|
46 |
-
* If shipping mode has minimal order amount, recalculate and return its value.
|
47 |
-
*
|
48 |
-
* @param integer|float|string $amount The value as saved for original language.
|
49 |
-
* @param array $shipping The shipping metadata.
|
50 |
-
* @param string $currency Currency code.
|
51 |
-
*
|
52 |
-
* @return integer|float|string
|
53 |
-
*/
|
54 |
-
public function getMinimalOrderAmountValue( $amount, $shipping, $currency );
|
55 |
-
|
56 |
-
/**
|
57 |
-
* If shipping mode has custom cost, recalculate and return its value.
|
58 |
-
*
|
59 |
-
* @param array|object $rate Shipping rate metadata.
|
60 |
-
* @param string $currency Currency code.
|
61 |
-
*
|
62 |
-
* @return integer|float|string
|
63 |
-
*/
|
64 |
-
public function getShippingCostValue( $rate, $currency );
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Checks if the instance of the shipping method has enabled manual pricing.
|
68 |
-
*
|
69 |
-
* @param array|object $instance Currently processed instance of the shipping method.
|
70 |
-
*
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function isManualPricingEnabled( $instance );
|
74 |
-
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingModeBase.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
trait ShippingModeBase {
|
6 |
-
/**
|
7 |
-
* @param array|object
|
8 |
-
*
|
9 |
-
* @return bool
|
10 |
-
*/
|
11 |
-
public static function isEnabled( $rate_settings ) {
|
12 |
-
return isset( $rate_settings[ AdminHooks::WCML_SHIPPING_COSTS ] ) && 'manual' === $rate_settings[ AdminHooks::WCML_SHIPPING_COSTS ];
|
13 |
-
}
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/ShippingModeProvider.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class ShippingModeProvider {
|
6 |
-
|
7 |
-
private static function getClasses() {
|
8 |
-
$collection = wpml_collect( [
|
9 |
-
'flat_rate' => 'WCML\Multicurrency\Shipping\FlatRateShipping',
|
10 |
-
'free_shipping' => 'WCML\Multicurrency\Shipping\FreeShipping',
|
11 |
-
'local_pickup' => 'WCML\Multicurrency\Shipping\LocalPickup',
|
12 |
-
] );
|
13 |
-
return $collection;
|
14 |
-
}
|
15 |
-
|
16 |
-
public static function getAll() {
|
17 |
-
return self::getClasses()->map( function( $className ) {
|
18 |
-
return self::make( $className );
|
19 |
-
} );
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @param string $shippingMode
|
24 |
-
* @return ShippingMode
|
25 |
-
*/
|
26 |
-
public static function get( $shippingMode ) {
|
27 |
-
return self::make(
|
28 |
-
self::getClasses()->get( $shippingMode, 'WCML\Multicurrency\Shipping\UnsupportedShipping' )
|
29 |
-
);
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @param $className
|
34 |
-
* @return ShippingMode
|
35 |
-
*/
|
36 |
-
private static function make( $className ) {
|
37 |
-
return \WPML\Container\make( $className );
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/UnsupportedShipping.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
class UnsupportedShipping implements ShippingMode {
|
6 |
-
|
7 |
-
public function getMethodId() {
|
8 |
-
return null;
|
9 |
-
}
|
10 |
-
|
11 |
-
public function getFieldTitle( $currencyCode ) {
|
12 |
-
return null;
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getFieldDescription( $currencyCode ) {
|
16 |
-
return null;
|
17 |
-
}
|
18 |
-
|
19 |
-
public function getSettingsFormKey( $currencyCode ) {
|
20 |
-
return null;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function getMinimalOrderAmountValue( $amount, $shipping, $currency ) {
|
24 |
-
return $amount;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function isManualPricingEnabled( $instance = false ) {
|
28 |
-
return false;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function getMinimalOrderAmountKey( $currencyCode ) {
|
32 |
-
// TODO: Implement getMinAmountKey() method.
|
33 |
-
}
|
34 |
-
|
35 |
-
public function getShippingCostValue( $rate, $currency ) {
|
36 |
-
if ( ! isset( $rate->cost ) ) {
|
37 |
-
$rate->cost = 0;
|
38 |
-
}
|
39 |
-
return $rate->cost;
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/Shipping/VariableCost.php
DELETED
@@ -1,206 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\Shipping;
|
4 |
-
|
5 |
-
trait VariableCost {
|
6 |
-
use DefaultConversion;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getFieldTitle
|
10 |
-
*
|
11 |
-
* @param string $currencyCode
|
12 |
-
*
|
13 |
-
* return string
|
14 |
-
*/
|
15 |
-
public function getFieldTitle( $currencyCode ) {
|
16 |
-
return sprintf( esc_html_x( 'Cost in %s',
|
17 |
-
'The label for the field with shipping cost in additional currency. The currency symbol will be added in place of %s specifier.',
|
18 |
-
'woocommerce-multilingual' ), $currencyCode );
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getFieldDescription
|
23 |
-
*
|
24 |
-
* @param string $currencyCode
|
25 |
-
*
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
-
public function getFieldDescription( $currencyCode ) {
|
29 |
-
return sprintf( esc_html_x( 'The shipping cost if customer choose %s as a purchase currency.',
|
30 |
-
'The description for the field with shipping cost in additional currency. The currency symbol will be added in place of %s specifier.',
|
31 |
-
'woocommerce-multilingual' ), $currencyCode );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Returns cost key for given currency.
|
36 |
-
*
|
37 |
-
* @param string $currencyCode Currency code.
|
38 |
-
*
|
39 |
-
* @return string
|
40 |
-
*/
|
41 |
-
private function getCostKey( $currencyCode ) {
|
42 |
-
return sprintf( 'cost_%s', $currencyCode );
|
43 |
-
}
|
44 |
-
|
45 |
-
private function getShippingClassCostKey( $shippingClassKey, $currency ) {
|
46 |
-
return $this->replaceShippingClassId( $shippingClassKey ) . '_' . $currency;
|
47 |
-
}
|
48 |
-
|
49 |
-
private function getNoShippingClassCostKey( $currency ) {
|
50 |
-
return 'no_class_cost_' . $currency;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getSettingsFormKey
|
55 |
-
*
|
56 |
-
* @param string $currencyCode
|
57 |
-
*
|
58 |
-
* @return string
|
59 |
-
*/
|
60 |
-
public function getSettingsFormKey( $currencyCode ) {
|
61 |
-
return $this->getCostKey( $currencyCode );
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getMinimalOrderAmountValue
|
66 |
-
*
|
67 |
-
* @param integer|float|string $amount The value as saved for original language.
|
68 |
-
* @param array $shipping The shipping metadata.
|
69 |
-
* @param string $currency Currency code.
|
70 |
-
*
|
71 |
-
* @return mixed
|
72 |
-
*/
|
73 |
-
public function getMinimalOrderAmountValue( $amount, $shipping, $currency ) {
|
74 |
-
return $amount;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @param array|object $rate
|
79 |
-
* @param string $currency
|
80 |
-
*
|
81 |
-
* @return int|mixed|string
|
82 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::getShippingCostValue
|
83 |
-
*
|
84 |
-
*/
|
85 |
-
public function getShippingCostValue( $rate, $currency ) {
|
86 |
-
$costName = $this->getCostKey( $currency );
|
87 |
-
return $this->getCostValueForName( $rate, $currency, $costName, 'cost' );
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* @see \WCML\Multicurrency\Shipping\ShippingClassesMode::getShippingClassCostValue
|
92 |
-
*
|
93 |
-
* @param array|object $rate
|
94 |
-
* @param string $currency
|
95 |
-
* @param string $shippingClassKey
|
96 |
-
*
|
97 |
-
* @return int Shipping class cost for given currency.
|
98 |
-
*/
|
99 |
-
public function getShippingClassCostValue( $rate, $currency, $shippingClassKey ) {
|
100 |
-
$costName = $this->getShippingClassCostKey( $shippingClassKey, $currency );
|
101 |
-
return $this->getCostValueForName( $rate, $currency, $costName, $shippingClassKey );
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* @see \WCML\Multicurrency\Shipping\ShippingClassesMode::getNoShippingClassCostValue
|
106 |
-
*
|
107 |
-
* @param array|object $rate
|
108 |
-
* @param string $currency
|
109 |
-
*
|
110 |
-
* @return int "No shipping class" cost for given currency.
|
111 |
-
*/
|
112 |
-
public function getNoShippingClassCostValue( $rate, $currency ) {
|
113 |
-
$costName = $this->getNoShippingClassCostKey( $currency );
|
114 |
-
return $this->getCostValueForName( $rate, $currency, $costName, 'no_class_cost' );
|
115 |
-
}
|
116 |
-
|
117 |
-
private function getCostValueForName( $rate, $currency, $costName, $rateField ) {
|
118 |
-
if ( ! isset( $rate->$rateField ) ) {
|
119 |
-
$rate->$rateField = 0;
|
120 |
-
}
|
121 |
-
if ( isset( $rate->instance_id ) ) {
|
122 |
-
if ( $this->isManualPricingEnabled( $rate ) ) {
|
123 |
-
$rateSettings = $this->getWpOption( $this->getMethodId(), $rate->instance_id );
|
124 |
-
if ( ! empty( $rateSettings[ $costName ] ) ) {
|
125 |
-
$rate->$rateField = $rateSettings[ $costName ];
|
126 |
-
} else {
|
127 |
-
$rate->$rateField = $this->getValueFromDefaultCurrency( $rate->$rateField, $rateSettings, $costName, $currency );
|
128 |
-
}
|
129 |
-
}
|
130 |
-
}
|
131 |
-
return $rate->$rateField;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* @see \WCML\Multicurrency\Shipping\ShippingMode::isManualPricingEnabled
|
136 |
-
*
|
137 |
-
* @param \WC_Shipping_Rate $instance
|
138 |
-
*
|
139 |
-
* @return mixed
|
140 |
-
*/
|
141 |
-
public function isManualPricingEnabled( $instance ) {
|
142 |
-
return self::isEnabled( $this->getWpOption( $this->getMethodId(), $instance->instance_id ) );
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Returns shipping data from wp_options table.
|
147 |
-
*
|
148 |
-
* @param string $methodId
|
149 |
-
* @param int $instanceId
|
150 |
-
*
|
151 |
-
* @return bool|mixed|void|null
|
152 |
-
*/
|
153 |
-
private function getWpOption( $methodId, $instanceId ) {
|
154 |
-
return get_option( \WCML_Multi_Currency_Shipping::getShippingOptionName( $methodId, $instanceId ) );
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Extracts numeric shipping class ID from shipping class key.
|
159 |
-
*
|
160 |
-
* @param string $key
|
161 |
-
*
|
162 |
-
* @return false|string Class ID or false if not found.
|
163 |
-
*/
|
164 |
-
private function getShippingClassTermId( $key ) {
|
165 |
-
if ( preg_match( '/^class_cost_(\d*)(_[A-Z]*)*$/', $key, $matches ) && isset( $matches[1] ) ) {
|
166 |
-
return $matches[1];
|
167 |
-
}
|
168 |
-
return false;
|
169 |
-
}
|
170 |
-
/**
|
171 |
-
* @param string $shippingClassKey
|
172 |
-
*
|
173 |
-
* @return string
|
174 |
-
*/
|
175 |
-
private function replaceShippingClassId( $shippingClassKey ) {
|
176 |
-
$termId = $this->getShippingClassTermId( $shippingClassKey );
|
177 |
-
if ( $termId ) {
|
178 |
-
$termTrid = apply_filters( 'wpml_element_trid', null, $termId, 'tax_product_shipping_class' );
|
179 |
-
$termTranslations = apply_filters( 'wpml_get_element_translations', null, $termTrid, 'tax_product_shipping_class' );
|
180 |
-
if ( is_array( $termTranslations ) ) {
|
181 |
-
foreach ( $termTranslations as $languageCode => $translation ) {
|
182 |
-
if ( $translation->source_language_code === null ) {
|
183 |
-
$shippingClassKey = str_replace( $termId, $translation->element_id, $shippingClassKey );
|
184 |
-
break;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
}
|
189 |
-
return $shippingClassKey;
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* wrapper for getShippingClassTermId to avail testing private method.
|
195 |
-
*
|
196 |
-
* @param $key
|
197 |
-
*
|
198 |
-
* @return bool|false|string
|
199 |
-
*/
|
200 |
-
public function _testGetShippingClassTermId( $key ) {
|
201 |
-
if ( ! isset( $_SERVER['SCRIPT_NAME'] ) || stristr( $_SERVER['SCRIPT_NAME'], 'phpunit' ) === false ) {
|
202 |
-
die( "don't run this method directly outside phpunit env" );
|
203 |
-
}
|
204 |
-
return $this->getShippingClassTermId( $key );
|
205 |
-
}
|
206 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/UI/Factory.php
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\UI;
|
4 |
-
|
5 |
-
use function WPML\Container\make;
|
6 |
-
|
7 |
-
class Factory implements \IWPML_Backend_Action_Loader, \IWPML_Deferred_Action_Loader {
|
8 |
-
|
9 |
-
public function get_load_action() {
|
10 |
-
return 'init';
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @return \IWPML_Action|null
|
15 |
-
*/
|
16 |
-
public function create() {
|
17 |
-
/** @var \woocommerce_wpml $woocommerce_wpml */
|
18 |
-
global $woocommerce_wpml;
|
19 |
-
|
20 |
-
if ( self::isMultiCurrencySettings() ) {
|
21 |
-
return make(
|
22 |
-
Hooks::class,
|
23 |
-
[
|
24 |
-
':wcmlSettings' => $woocommerce_wpml->settings,
|
25 |
-
]
|
26 |
-
);
|
27 |
-
}
|
28 |
-
|
29 |
-
return null;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @return bool
|
34 |
-
*/
|
35 |
-
public static function isMultiCurrencySettings() {
|
36 |
-
return isset( $_GET['page'], $_GET['tab'] )
|
37 |
-
&& 'wpml-wcml' === $_GET['page']
|
38 |
-
&& 'multi-currency' === $_GET['tab'];
|
39 |
-
}
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Multicurrency/UI/Hooks.php
DELETED
@@ -1,290 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Multicurrency\UI;
|
4 |
-
|
5 |
-
use WCML\MultiCurrency\Geolocation;
|
6 |
-
use WCML\Utilities\Resources;
|
7 |
-
use WPML\Collect\Support\Collection;
|
8 |
-
use WPML\FP\Fns;
|
9 |
-
use WPML\FP\Obj;
|
10 |
-
use function WPML\FP\curryN;
|
11 |
-
|
12 |
-
class Hooks implements \IWPML_Action {
|
13 |
-
|
14 |
-
const HANDLE = 'wcml-multicurrency-options';
|
15 |
-
|
16 |
-
/** @var \WCML_Multi_Currency $multiCurrency */
|
17 |
-
private $multiCurrency;
|
18 |
-
|
19 |
-
/** @var \WCML_Currencies_Payment_Gateways $currenciesPaymentGateways */
|
20 |
-
private $currenciesPaymentGateways;
|
21 |
-
|
22 |
-
/** @var \SitePress $sitepress */
|
23 |
-
private $sitepress;
|
24 |
-
|
25 |
-
/** @var array $wcmlSettings */
|
26 |
-
private $wcmlSettings;
|
27 |
-
|
28 |
-
public function __construct(
|
29 |
-
\WCML_Multi_Currency $multiCurrency,
|
30 |
-
\WCML_Currencies_Payment_Gateways $currenciesPaymentGateways,
|
31 |
-
\SitePress $sitepress,
|
32 |
-
array $wcmlSettings
|
33 |
-
) {
|
34 |
-
$this->multiCurrency = $multiCurrency;
|
35 |
-
$this->currenciesPaymentGateways = $currenciesPaymentGateways;
|
36 |
-
$this->sitepress = $sitepress;
|
37 |
-
$this->wcmlSettings = $wcmlSettings;
|
38 |
-
}
|
39 |
-
|
40 |
-
public function add_hooks() {
|
41 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'loadAssets' ] );
|
42 |
-
}
|
43 |
-
|
44 |
-
public function loadAssets() {
|
45 |
-
$gateways = $this->getGateways();
|
46 |
-
$enqueue = Resources::enqueueApp( 'multicurrencyOptions' );
|
47 |
-
|
48 |
-
$enqueue( [
|
49 |
-
'name' => 'wcmlMultiCurrency',
|
50 |
-
'data' => [
|
51 |
-
'endpoint' => self::HANDLE,
|
52 |
-
'activeCurrencies' => $this->getActiveCurrencies( $gateways ),
|
53 |
-
'allCurrencies' => $this->getAllCurrencies(),
|
54 |
-
'allCountries' => $this->getAllCountries(),
|
55 |
-
'languages' => $this->getLanguages(),
|
56 |
-
'gateways' => $gateways->toArray(),
|
57 |
-
'strings' => $this->getStrings(),
|
58 |
-
'mode' => $this->getMode(),
|
59 |
-
'maxMindKeyExist' => $this->checkMaxMindKeyExist(),
|
60 |
-
],
|
61 |
-
] );
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @param Collection $gateways
|
66 |
-
*
|
67 |
-
* @return array
|
68 |
-
*/
|
69 |
-
private function getActiveCurrencies( Collection $gateways ) {
|
70 |
-
$defaultCurrency = wcml_get_woocommerce_currency_option();
|
71 |
-
|
72 |
-
$addCode = function( $currency, $code ) {
|
73 |
-
return array_merge( $currency, [ 'code' => $code ] );
|
74 |
-
};
|
75 |
-
|
76 |
-
$buildActiveCurrency = function( $currency ) use ( $defaultCurrency ) {
|
77 |
-
return [
|
78 |
-
'isDefault' => $currency['code'] === $defaultCurrency,
|
79 |
-
'languages' => array_map( 'intval', $currency['languages'] ),
|
80 |
-
'gatewaysEnabled' => $this->currenciesPaymentGateways->is_enabled( $currency['code'] ),
|
81 |
-
];
|
82 |
-
};
|
83 |
-
|
84 |
-
$addGatewaysSettings = function( $currency ) use ( $gateways ) {
|
85 |
-
$addSettingsForGateway = curryN( 2, function( $code, array $gateway ) {
|
86 |
-
return [ $gateway['id'] => Obj::pathOr( [], [ 'settings', $code ], $gateway ) ];
|
87 |
-
} );
|
88 |
-
|
89 |
-
return [ 'gatewaysSettings' => $gateways->mapWithKeys( $addSettingsForGateway( $currency['code'] ) )->toArray() ];
|
90 |
-
};
|
91 |
-
|
92 |
-
|
93 |
-
$addFormattedLastRateUpdate = function( $currency ) {
|
94 |
-
return [
|
95 |
-
'formattedLastRateUpdate' => isset( $currency['updated'] )
|
96 |
-
? self::formatLastRateUpdate( $currency['updated'] )
|
97 |
-
: null
|
98 |
-
];
|
99 |
-
};
|
100 |
-
|
101 |
-
$merge = function( $fn ) { return Fns::converge( 'array_merge', [ $fn, Fns::identity() ] ); };
|
102 |
-
|
103 |
-
return wpml_collect( $this->multiCurrency->get_currencies( true ) )
|
104 |
-
->map( $addCode )
|
105 |
-
->map( $merge( $buildActiveCurrency ) )
|
106 |
-
->map( $merge( $addFormattedLastRateUpdate ) )
|
107 |
-
->map( $merge( $addGatewaysSettings ) )
|
108 |
-
->values()
|
109 |
-
->toArray();
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* @return array
|
114 |
-
*/
|
115 |
-
private function getAllCurrencies() {
|
116 |
-
$buildCurrency = function( $label, $code ) {
|
117 |
-
return (object) [
|
118 |
-
'code' => $code,
|
119 |
-
'label' => html_entity_decode( $label ),
|
120 |
-
'symbol' => html_entity_decode( get_woocommerce_currency_symbol( $code ) ),
|
121 |
-
];
|
122 |
-
};
|
123 |
-
|
124 |
-
return wpml_collect( get_woocommerce_currencies() )->map( $buildCurrency )->values()->toArray();
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* @return array
|
129 |
-
*/
|
130 |
-
private function getLanguages() {
|
131 |
-
$buildLanguage = function( $data ) {
|
132 |
-
return (object) [
|
133 |
-
'code' => $data['code'],
|
134 |
-
'displayName' => $data['display_name'],
|
135 |
-
'flagUrl' => $this->sitepress->get_flag_url( $data['code'] ),
|
136 |
-
'defaultCurrency' => isset( $this->wcmlSettings['default_currencies'][ $data['code'] ] )
|
137 |
-
? $this->wcmlSettings['default_currencies'][ $data['code'] ]
|
138 |
-
: false,
|
139 |
-
];
|
140 |
-
};
|
141 |
-
|
142 |
-
return wpml_collect( $this->sitepress->get_active_languages() )
|
143 |
-
->map( $buildLanguage )
|
144 |
-
->values()
|
145 |
-
->toArray();
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* @return Collection
|
150 |
-
*/
|
151 |
-
private function getGateways() {
|
152 |
-
$isSupported = function( \WCML_Payment_Gateway $gateway ) {
|
153 |
-
return ! $gateway instanceof \WCML_Not_Supported_Payment_Gateway;
|
154 |
-
};
|
155 |
-
|
156 |
-
$buildGateway = function( \WCML_Payment_Gateway $gateway ) {
|
157 |
-
return $gateway->get_output_model();
|
158 |
-
};
|
159 |
-
|
160 |
-
return wpml_collect( $this->currenciesPaymentGateways->get_gateways() )
|
161 |
-
->prioritize( $isSupported )
|
162 |
-
->map( $buildGateway )
|
163 |
-
->values();
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* @return array
|
168 |
-
*/
|
169 |
-
private function getStrings() {
|
170 |
-
$trackingLink = new \WCML_Tracking_Link();
|
171 |
-
|
172 |
-
return [
|
173 |
-
'labelCurrencies' => __( 'Currencies', 'woocommerce-multilingual' ),
|
174 |
-
'labelCurrency' => __( 'Currency', 'woocommerce-multilingual' ),
|
175 |
-
'labelAddCurrency' => __( 'Add currency', 'woocommerce-multilingual' ),
|
176 |
-
'labelRate' => __( 'Rate', 'woocommerce-multilingual' ),
|
177 |
-
'labelDefault' => __( 'default', 'woocommerce-multilingual' ),
|
178 |
-
'labelEdit' => __( 'Edit', 'woocommerce-multilingual' ),
|
179 |
-
'labelDefaultCurrency' => __( 'Default currency', 'woocommerce-multilingual' ),
|
180 |
-
'tooltipDefaultCurrency' => __( 'Switch to this currency when switching language in the front-end', 'woocommerce-multilingual' ),
|
181 |
-
'labelKeep' => __( 'Keep', 'woocommerce-multilingual' ),
|
182 |
-
'labelDelete' => __( 'Delete', 'woocommerce-multilingual' ),
|
183 |
-
'labelCurrenciesToDisplay' => __( 'Currencies to display for each language', 'woocommerce-multilingual' ),
|
184 |
-
'placeholderEnableFor' => __( 'Enable %1$s for %2$s', 'woocommerce-multilingual' ),
|
185 |
-
'placeholderDisableFor' => __( 'Disable %1$s for %2$s', 'woocommerce-multilingual' ),
|
186 |
-
'labelSettings' => __( 'Settings', 'woocommerce-multilingual' ),
|
187 |
-
'labelAddNewCurrency' => __( 'Add new currency', 'woocommerce-multilingual' ),
|
188 |
-
'placeholderCurrencySettingsFor' => __( 'Currency settings for %s', 'woocommerce-multilingual' ),
|
189 |
-
'labelSelectCurrency' => __( 'Select currency', 'woocommerce-multilingual' ),
|
190 |
-
'labelExchangeRate' => __( 'Exchange Rate', 'woocommerce-multilingual' ),
|
191 |
-
'labelOnlyNumeric' => __( 'Only numeric', 'woocommerce-multilingual' ),
|
192 |
-
'placeholderPreviousRate' => __( '(previous value: %s)', 'woocommerce-multilingual' ),
|
193 |
-
'labelCurrencyPreview' => __( 'Currency Preview', 'woocommerce-multilingual' ),
|
194 |
-
'labelPosition' => __( 'Currency Position', 'woocommerce-multilingual' ),
|
195 |
-
'optionLeft' => __( 'Left', 'woocommerce-multilingual' ),
|
196 |
-
'optionRight' => __( 'Right', 'woocommerce-multilingual' ),
|
197 |
-
'optionLeftSpace' => __( 'Left with space', 'woocommerce-multilingual' ),
|
198 |
-
'optionRightSpace' => __( 'Right with space', 'woocommerce-multilingual' ),
|
199 |
-
'labelThousandSep' => __( 'Thousand Separator', 'woocommerce-multilingual' ),
|
200 |
-
'labelSpaceSep' => __( '(Space)', 'woocommerce-multilingual' ),
|
201 |
-
'labelDecimalSep' => __( 'Decimal Separator', 'woocommerce-multilingual' ),
|
202 |
-
'labelNumDecimals' => __( 'Number of Decimals', 'woocommerce-multilingual' ),
|
203 |
-
'labelRounding' => __( 'Rounding to the nearest integer', 'woocommerce-multilingual' ),
|
204 |
-
'optionDisabled' => __( 'Disabled', 'woocommerce-multilingual' ),
|
205 |
-
'optionUp' => __( 'Up', 'woocommerce-multilingual' ),
|
206 |
-
'optionDown' => __( 'Down', 'woocommerce-multilingual' ),
|
207 |
-
'optionNearest' => __( 'Nearest', 'woocommerce-multilingual' ),
|
208 |
-
'labelIncrement' => __( 'Increment for nearest integer', 'woocommerce-multilingual' ),
|
209 |
-
'tooltipIncrement' => sprintf( __( 'The resulting price will be an increment of this value after initial rounding.%se.g.:', 'woocommerce-multilingual' ), '<br>' ) . '<br />' .
|
210 |
-
__( '1454.07 » 1454 when set to 1', 'woocommerce-multilingual' ) . '<br />' .
|
211 |
-
__( '1454.07 » 1450 when set to 10', 'woocommerce-multilingual' ) . '<br />' .
|
212 |
-
__( '1454.07 » 1500 when set to 100', 'woocommerce-multilingual' ) . '<br />',
|
213 |
-
'tooltipRounding' => sprintf( __( 'Round the converted price to the closest integer. %se.g. 15.78 becomes 16.00', 'woocommerce-multilingual' ), '<br />' ),
|
214 |
-
'tooltipAutosubtract' => __( 'The value to be subtracted from the amount obtained previously.', 'woocommerce-multilingual' ) . '<br /><br />' .
|
215 |
-
__( 'For 1454.07, when the increment for the nearest integer is 100 and the auto-subtract amount is 1, the resulting amount is 1499.', 'woocommerce-multilingual' ),
|
216 |
-
'labelAutosubtract' => __( 'Autosubtract amount', 'woocommerce-multilingual' ),
|
217 |
-
'labelPaymentGateways' => __( 'Payment Gateways', 'woocommerce-multilingual' ),
|
218 |
-
'placeholderCustomSettings' => __( 'Custom settings for %s', 'woocommerce-multilingual' ),
|
219 |
-
'linkUrlLearn' => $trackingLink->getWcmlMultiCurrencyDoc( '#payment-gateways-settings' ),
|
220 |
-
'linkLabelLearn' => __( 'Learn more', 'woocommerce-multilingual' ),
|
221 |
-
'errorInvalidNumber' => __( 'Please enter a valid number', 'woocommerce-multilingual' ),
|
222 |
-
'labelCancel' => __( 'Cancel', 'woocommerce-multilingual' ),
|
223 |
-
'labelSave' => __( 'Save', 'woocommerce-multilingual' ),
|
224 |
-
'labelAvailability' => __( 'Currency available in', 'woocommerce-multilingual' ),
|
225 |
-
'labelAllCountries' => __( 'All countries', 'woocommerce-multilingual' ),
|
226 |
-
'labelAllCountriesExcept' => __( 'All countries except: ', 'woocommerce-multilingual' ),
|
227 |
-
'labelAllCountriesExceptDots' => __( 'All countries except...', 'woocommerce-multilingual' ),
|
228 |
-
'labelSpecificCountries' => __( 'Specific countries', 'woocommerce-multilingual' ),
|
229 |
-
'labelModeSelect' => __( 'Show currencies based on', 'woocommerce-multilingual' ),
|
230 |
-
'labelChooseOption' => __( 'Choose Option', 'woocommerce-multilingual' ),
|
231 |
-
'labelSiteLanguage' => __( 'Site Language', 'woocommerce-multilingual' ),
|
232 |
-
'labelClientLocation' => __( 'Client Location', 'woocommerce-multilingual' ),
|
233 |
-
'labelLocationBased' => __( 'Location based', 'woocommerce-multilingual' ),
|
234 |
-
'maxMindDescription' => __( 'WooCommerce uses integration with MaxMind Geolocation in order to determine the correct location for the customer. You need to generate a free MaxMind Geolocation licence key.', 'woocommerce-multilingual' ),
|
235 |
-
'maxMindSuccess' => __( 'Great! Now you can use Geolocation to determine default currency for chosen languages. You can edit that key in ', 'woocommerce-multilingual' ),
|
236 |
-
'maxMindSettingLink' => admin_url( 'admin.php?page=wc-settings&tab=integration' ),
|
237 |
-
'maxMindSettingLinkText' => __( 'WooCommerce settings page.', 'woocommerce-multilingual' ),
|
238 |
-
'maxMindLabel' => __( 'MaxMind Licence Key', 'woocommerce-multilingual' ),
|
239 |
-
'apply' => __( 'Apply', 'woocommerce-multilingual' ),
|
240 |
-
'maxMindDoc' => __( 'You can read how to generate one in ', 'woocommerce-multilingual' ),
|
241 |
-
'maxMindDocLink' => 'https://docs.woocommerce.com/document/maxmind-geolocation-integration/',
|
242 |
-
'maxMindDocLinkText' => __( 'MaxMind Geolocation Integration documentation.', 'woocommerce-multilingual' ),
|
243 |
-
];
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* @return array
|
248 |
-
*/
|
249 |
-
private function getAllCountries() {
|
250 |
-
|
251 |
-
$buildCountry = function( $label, $code ) {
|
252 |
-
return (object) [
|
253 |
-
'code' => $code,
|
254 |
-
'label' => html_entity_decode( $label ),
|
255 |
-
];
|
256 |
-
};
|
257 |
-
|
258 |
-
return wpml_collect( WC()->countries->get_countries() )->map( $buildCountry )->values()->toArray();
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* @return string
|
263 |
-
*/
|
264 |
-
private function getMode(){
|
265 |
-
return isset( $this->wcmlSettings['currency_mode'] ) ? $this->wcmlSettings['currency_mode'] : '';
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* @return bool
|
270 |
-
*/
|
271 |
-
private function checkMaxMindKeyExist(){
|
272 |
-
$integrations = WC()->integrations->get_integrations();
|
273 |
-
|
274 |
-
return isset( $integrations['maxmind_geolocation'] ) ? (bool)$integrations['maxmind_geolocation']->get_option( 'license_key' ) : false ;
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* @param string $lastRateUpdate
|
279 |
-
*
|
280 |
-
* @return string|null
|
281 |
-
*/
|
282 |
-
public static function formatLastRateUpdate( $lastRateUpdate ) {
|
283 |
-
return $lastRateUpdate
|
284 |
-
? sprintf(
|
285 |
-
__( 'Set on %s', 'woocommerce-multilingual' ),
|
286 |
-
date( 'F j, Y g:i a', strtotime( $lastRateUpdate ) )
|
287 |
-
)
|
288 |
-
: null;
|
289 |
-
}
|
290 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Options/WPML.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Options;
|
4 |
-
|
5 |
-
use WPML\Settings\PostType\Automatic;
|
6 |
-
use WPML\Setup\Option;
|
7 |
-
|
8 |
-
class WPML {
|
9 |
-
|
10 |
-
/** @return bool */
|
11 |
-
public static function shouldTranslateEverything() {
|
12 |
-
return method_exists( Option::class, 'shouldTranslateEverything' )
|
13 |
-
&& Option::shouldTranslateEverything();
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @param string $postType
|
18 |
-
* @param bool $state
|
19 |
-
*/
|
20 |
-
public static function setAutomatic( $postType, $state ) {
|
21 |
-
if ( method_exists( Automatic::class, 'set' ) ) {
|
22 |
-
Automatic::set( $postType, $state );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/PaymentGateways/Hooks.php
DELETED
@@ -1,199 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\PaymentGateways;
|
4 |
-
|
5 |
-
use IWPML_Backend_Action;
|
6 |
-
use IWPML_Frontend_Action;
|
7 |
-
use IWPML_DIC_Action;
|
8 |
-
use WCML\MultiCurrency\Geolocation;
|
9 |
-
use WCML\Utilities\Resources;
|
10 |
-
use WPML\FP\Maybe;
|
11 |
-
use WPML\FP\Obj;
|
12 |
-
use WPML\FP\Relation;
|
13 |
-
|
14 |
-
|
15 |
-
class Hooks implements IWPML_Backend_Action, IWPML_Frontend_Action, IWPML_DIC_Action {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'wcml_payment_gateways';
|
18 |
-
/* took this priority from wcgcl but we could not recall the reason of this number.*/
|
19 |
-
const PRIORITY = 1000;
|
20 |
-
|
21 |
-
public function add_hooks() {
|
22 |
-
|
23 |
-
if ( is_admin() ) {
|
24 |
-
if ( $this->isWCGatewaysSettingsScreen() ) {
|
25 |
-
add_action( 'woocommerce_update_options_checkout', [ $this, 'updateSettingsOnSave' ], self::PRIORITY );
|
26 |
-
add_action( 'woocommerce_settings_checkout', [ $this, 'output' ], self::PRIORITY );
|
27 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'loadAssets' ] );
|
28 |
-
}
|
29 |
-
add_action( 'admin_notices', [ $this, 'maybeAddNotice'] );
|
30 |
-
} else {
|
31 |
-
add_filter( 'woocommerce_available_payment_gateways', [ $this, 'filterByCountry' ], self::PRIORITY );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
public function updateSettingsOnSave() {
|
36 |
-
|
37 |
-
if ( isset( $_POST[ self::OPTION_KEY ] ) ) {
|
38 |
-
|
39 |
-
$gatewaySettings = $_POST[ self::OPTION_KEY ];
|
40 |
-
|
41 |
-
$settings = $this->getSettings();
|
42 |
-
|
43 |
-
$gatewayId = filter_var( $gatewaySettings['ID'], FILTER_SANITIZE_STRING );
|
44 |
-
|
45 |
-
$settings[ $gatewayId ]['mode'] = in_array( $gatewaySettings['mode'], [
|
46 |
-
'all',
|
47 |
-
'exclude',
|
48 |
-
'include'
|
49 |
-
], true ) ? $gatewaySettings['mode'] : 'all';
|
50 |
-
|
51 |
-
$settings[ $gatewayId ]['countries'] = isset( $gatewaySettings['countries'] ) ? array_map( 'esc_attr', array_filter( explode( ',', filter_var( $gatewaySettings['countries'], FILTER_SANITIZE_STRING ) ) ) ) : [];
|
52 |
-
|
53 |
-
$this->updateSettings( $settings );
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
public function loadAssets() {
|
58 |
-
$enqueue = Resources::enqueueApp( 'paymentGatewaysAdmin' );
|
59 |
-
|
60 |
-
$gatewayId = sanitize_title( $_GET['section'] );
|
61 |
-
|
62 |
-
$enqueue( [
|
63 |
-
'name' => 'wcmlPaymentGateways',
|
64 |
-
'data' => [
|
65 |
-
'endpoint' => self::OPTION_KEY,
|
66 |
-
'gatewayId' => $gatewayId,
|
67 |
-
'allCountries' => $this->getAllCountries(),
|
68 |
-
'strings' => $this->getStrings(),
|
69 |
-
'settings' => $this->getGatewaySettings( $gatewayId ),
|
70 |
-
],
|
71 |
-
] );
|
72 |
-
|
73 |
-
wp_register_style( 'wcml-payment-gateways', WCML_PLUGIN_URL . '/res/css/wcml-payment-gateways.css', [], WCML_VERSION );
|
74 |
-
wp_enqueue_style( 'wcml-payment-gateways' );
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @return array
|
79 |
-
*/
|
80 |
-
private function getStrings() {
|
81 |
-
|
82 |
-
return [
|
83 |
-
'labelAvailability' => __( 'Country availability', 'woocommerce-multilingual' ),
|
84 |
-
'labelAllCountries' => __( 'All countries', 'woocommerce-multilingual' ),
|
85 |
-
'labelAllCountriesExcept' => __( 'All countries except', 'woocommerce-multilingual' ),
|
86 |
-
'labelAllCountriesExceptDots' => __( 'All countries except...', 'woocommerce-multilingual' ),
|
87 |
-
'labelSpecificCountries' => __( 'Specific countries', 'woocommerce-multilingual' ),
|
88 |
-
'tooltip' => __( 'Configure per country availability for this payment gateway', 'woocommerce-multilingual' ),
|
89 |
-
];
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* @return array
|
94 |
-
*/
|
95 |
-
private function getAllCountries() {
|
96 |
-
|
97 |
-
$buildCountry = function ( $label, $code ) {
|
98 |
-
return (object) [
|
99 |
-
'code' => $code,
|
100 |
-
'label' => html_entity_decode( $label ),
|
101 |
-
];
|
102 |
-
};
|
103 |
-
|
104 |
-
return wpml_collect( WC()->countries->get_countries() )->map( $buildCountry )->values()->toArray();
|
105 |
-
}
|
106 |
-
|
107 |
-
public function output() {
|
108 |
-
?><div id="wcml-payment-gateways"></div><?php
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* @param array $payment_gateways
|
113 |
-
*
|
114 |
-
* @return array
|
115 |
-
*/
|
116 |
-
public function filterByCountry( $payment_gateways ) {
|
117 |
-
|
118 |
-
$customer_country = Geolocation::getUserCountry();
|
119 |
-
|
120 |
-
if ( $customer_country ) {
|
121 |
-
|
122 |
-
$ifExceptCountries = function ( $gateway ) use ( $customer_country ) {
|
123 |
-
$gatewaySettings = $this->getGatewaySettings( $gateway->id );
|
124 |
-
|
125 |
-
return $gatewaySettings['mode'] == 'exclude' && in_array( $customer_country, $gatewaySettings['countries'] );
|
126 |
-
};
|
127 |
-
|
128 |
-
$ifNotIncluded = function ( $gateway ) use ( $customer_country ) {
|
129 |
-
$gatewaySettings = $this->getGatewaySettings( $gateway->id );
|
130 |
-
|
131 |
-
return $gatewaySettings['mode'] == 'include' && ! in_array( $customer_country, $gatewaySettings['countries'] );
|
132 |
-
};
|
133 |
-
|
134 |
-
return wpml_collect( $payment_gateways )
|
135 |
-
->reject( $ifExceptCountries )
|
136 |
-
->reject( $ifNotIncluded )
|
137 |
-
->toArray();
|
138 |
-
}
|
139 |
-
|
140 |
-
return $payment_gateways;
|
141 |
-
}
|
142 |
-
|
143 |
-
public function maybeAddNotice(){
|
144 |
-
if( class_exists( 'WooCommerce_Gateways_Country_Limiter' ) ) {
|
145 |
-
echo $this->getNoticeText();
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* @return string
|
151 |
-
*/
|
152 |
-
private function getNoticeText(){
|
153 |
-
|
154 |
-
$text = '<div id="message" class="updated error">';
|
155 |
-
$text .= '<p>';
|
156 |
-
$text .= __( 'We noticed that you\'re using WooCommerce Gateways Country Limiter plugin which is now integrated into WooCommerce Multilingual. Please remove it!', 'woocommerce-multilingual' );
|
157 |
-
$text .= '</p>';
|
158 |
-
$text .= '</div>';
|
159 |
-
|
160 |
-
return $text;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* @param string $gatewayId
|
165 |
-
*
|
166 |
-
* @return array
|
167 |
-
*/
|
168 |
-
private function getGatewaySettings( $gatewayId ) {
|
169 |
-
return Maybe::fromNullable( get_option( self::OPTION_KEY, false ) )
|
170 |
-
->map( Obj::prop( $gatewayId ) )
|
171 |
-
->getOrElse( [ 'mode' => 'all', 'countries' => [] ] );
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* @param string $gatewayId
|
176 |
-
*
|
177 |
-
* @return array
|
178 |
-
*/
|
179 |
-
private function getSettings() {
|
180 |
-
return get_option( self::OPTION_KEY, [] );
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* @param array $settings
|
185 |
-
*
|
186 |
-
* @return bool
|
187 |
-
*/
|
188 |
-
private function updateSettings( $settings ) {
|
189 |
-
return update_option( self::OPTION_KEY, $settings );
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* @return bool
|
194 |
-
*/
|
195 |
-
private function isWCGatewaysSettingsScreen() {
|
196 |
-
return Obj::prop( 'section', $_GET ) && Relation::equals( 'wc-settings', Obj::prop( 'page', $_GET ) ) && Relation::equals( 'checkout', Obj::prop( 'tab', $_GET ) );
|
197 |
-
}
|
198 |
-
|
199 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reports/Categories/Query.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reports\Categories;
|
4 |
-
|
5 |
-
use WCML\Rest\Functions;
|
6 |
-
|
7 |
-
class Query implements \IWPML_REST_Action, \IWPML_Backend_Action {
|
8 |
-
|
9 |
-
var $actionWasRemoved = false;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Registers hooks.
|
13 |
-
*/
|
14 |
-
public function add_hooks() {
|
15 |
-
if ( Functions::isAnalyticsRestRequest() ) {
|
16 |
-
add_filter( 'woocommerce_analytics_categories_select_query', [ $this, 'translateCategoryTitles' ] );
|
17 |
-
}
|
18 |
-
|
19 |
-
// Remove before priority 10, so that WC Analytics gets all the terms.
|
20 |
-
add_action( 'generate_category_lookup_table', [ $this, 'removeWpmlTermClausesFilter' ], 0 );
|
21 |
-
add_action( 'generate_category_lookup_table', [ $this, 'addWpmlTermClausesFilter' ], 20 );
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @param object $results Categories query (note: in March 2021, WC Admin code is showing a PHPDoc returning an array which is not what we get)
|
26 |
-
*
|
27 |
-
* @return object
|
28 |
-
*/
|
29 |
-
public function translateCategoryTitles( $results ) {
|
30 |
-
$results->data = wpml_collect( $results->data )
|
31 |
-
->map( function( $row ) {
|
32 |
-
if ( $row['extended_info']['name'] ) {
|
33 |
-
$row['category_id'] = apply_filters( 'wpml_object_id', $row['category_id'], 'product_cat', true );
|
34 |
-
$term = get_term( $row['category_id'] );
|
35 |
-
if ( $term ) {
|
36 |
-
$row['extended_info']['name'] = $term->name;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
return $row;
|
40 |
-
} )->toArray();
|
41 |
-
|
42 |
-
return $results;
|
43 |
-
}
|
44 |
-
|
45 |
-
public function removeWpmlTermClausesFilter() {
|
46 |
-
global $sitepress;
|
47 |
-
|
48 |
-
$this->actionWasRemoved = remove_filter( 'terms_clauses', [ $sitepress, 'terms_clauses' ] );
|
49 |
-
}
|
50 |
-
|
51 |
-
public function addWpmlTermClausesFilter() {
|
52 |
-
global $sitepress;
|
53 |
-
|
54 |
-
if ( $this->actionWasRemoved ) {
|
55 |
-
$this->actionWasRemoved = false;
|
56 |
-
add_filter( 'terms_clauses', [ $sitepress, 'terms_clauses' ], 10, 3 );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reports/Hooks.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reports;
|
4 |
-
|
5 |
-
use WCML\Rest\Functions;
|
6 |
-
|
7 |
-
class Hooks implements \IWPML_Backend_Action {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Registers hooks.
|
11 |
-
*/
|
12 |
-
public function add_hooks() {
|
13 |
-
if ( Functions::isAnalyticsPage() ) {
|
14 |
-
add_filter( 'wpml_admin_language_switcher_items', [ $this, 'removeAllFromAnalytics' ] );
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Remove the 'all' language from the admin language switcher.
|
20 |
-
* @param mixed $items
|
21 |
-
* @return mixed
|
22 |
-
*/
|
23 |
-
function removeAllFromAnalytics( $items ) {
|
24 |
-
unset( $items['all'] );
|
25 |
-
|
26 |
-
return $items;
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reports/Orders/Factory.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reports\Orders;
|
4 |
-
|
5 |
-
class Factory implements \IWPML_Backend_Action_Loader, \IWPML_REST_Action_Loader, \IWPML_Deferred_Action_Loader {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @return string
|
9 |
-
*/
|
10 |
-
public function get_load_action() {
|
11 |
-
return 'init';
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @return \IWPML_Action|null
|
16 |
-
*/
|
17 |
-
public function create() {
|
18 |
-
/**
|
19 |
-
* @global \wpdb $GLOBALS['wpdb']
|
20 |
-
* @name $wpdb
|
21 |
-
*/
|
22 |
-
global $wpdb;
|
23 |
-
|
24 |
-
if ( wcml_is_multi_currency_on() ) {
|
25 |
-
return new Hooks( $wpdb );
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reports/Orders/Hooks.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reports\Orders;
|
4 |
-
|
5 |
-
use WCML\Utilities\Resources;
|
6 |
-
use WCML\Rest\Functions;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
use WPML\FP\Fns;
|
9 |
-
|
10 |
-
class Hooks implements \IWPML_Action {
|
11 |
-
|
12 |
-
/** @var \wpdb $wpdb */
|
13 |
-
private $wpdb;
|
14 |
-
|
15 |
-
public function __construct( \wpdb $wpdb ) {
|
16 |
-
$this->wpdb = $wpdb;
|
17 |
-
}
|
18 |
-
|
19 |
-
public function add_hooks() {
|
20 |
-
if ( Functions::isAnalyticsPage() ) {
|
21 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] );
|
22 |
-
}
|
23 |
-
|
24 |
-
add_filter( "woocommerce_analytics_clauses_join_orders_subquery", [ $this, 'addJoin' ] );
|
25 |
-
add_filter( "woocommerce_analytics_clauses_join_orders_stats_total", [ $this, 'addJoin' ] );
|
26 |
-
add_filter( "woocommerce_analytics_clauses_join_orders_stats_interval", [ $this, 'addJoin' ] );
|
27 |
-
add_filter( "woocommerce_analytics_clauses_where_orders_subquery", [ $this, 'addWhere' ] );
|
28 |
-
add_filter( "woocommerce_analytics_clauses_where_orders_stats_total", [ $this, 'addWhere' ] );
|
29 |
-
add_filter( "woocommerce_analytics_clauses_where_orders_stats_interval", [ $this, 'addWhere' ] );
|
30 |
-
add_filter( "woocommerce_analytics_clauses_select_orders_subquery", [ $this, 'addSelect' ] );
|
31 |
-
add_filter( "woocommerce_analytics_clauses_select_orders_stats_total", [ $this, 'addSelect' ] );
|
32 |
-
add_filter( "woocommerce_analytics_clauses_select_orders_stats_interval", [ $this, 'addSelect' ] );
|
33 |
-
}
|
34 |
-
|
35 |
-
public function enqueueAssets() {
|
36 |
-
$enqueue = Resources::enqueueApp( 'reportsOrders' );
|
37 |
-
|
38 |
-
$enqueue(
|
39 |
-
[
|
40 |
-
'name' => 'wcmlReports',
|
41 |
-
'data' => [
|
42 |
-
'strings' => [
|
43 |
-
'languageLabel' => __( 'Language', 'woocommerce-multilingual' ),
|
44 |
-
],
|
45 |
-
],
|
46 |
-
]
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @param array $clauses
|
52 |
-
*
|
53 |
-
* @return array
|
54 |
-
*/
|
55 |
-
public function addJoin( $clauses ) {
|
56 |
-
$clauses[] = "LEFT JOIN {$this->wpdb->postmeta} wcml_language_postmeta ON wcml_language_postmeta.post_id = IF( {$this->wpdb->prefix}wc_order_stats.parent_id = 0, {$this->wpdb->prefix}wc_order_stats.order_id, {$this->wpdb->prefix}wc_order_stats.parent_id )";
|
57 |
-
|
58 |
-
return $clauses;
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @param array $clauses
|
63 |
-
*
|
64 |
-
* @return array
|
65 |
-
*/
|
66 |
-
public function addWhere( $clauses ) {
|
67 |
-
$clauses[] = "AND wcml_language_postmeta.meta_key = 'wpml_language'";
|
68 |
-
|
69 |
-
return $clauses;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @param array $clauses
|
74 |
-
*
|
75 |
-
* @return array
|
76 |
-
*/
|
77 |
-
public function addSelect( $clauses ) {
|
78 |
-
$clauses[] = ', wcml_language_postmeta.meta_value AS language';
|
79 |
-
|
80 |
-
return $clauses;
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reports/Products/Query.php
DELETED
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
namespace WCML\Reports\Products;
|
5 |
-
|
6 |
-
|
7 |
-
use WCML\Rest\Functions;
|
8 |
-
|
9 |
-
class Query implements \IWPML_REST_Action {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Registers hooks.
|
13 |
-
*/
|
14 |
-
public function add_hooks() {
|
15 |
-
if ( Functions::isAnalyticsRestRequest() ) {
|
16 |
-
add_filter( 'woocommerce_analytics_products_select_query', [ $this, 'joinProductTranslations' ] );
|
17 |
-
add_filter( 'woocommerce_analytics_products_select_query', [ $this, 'translateProductTitles' ] );
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param object $results Products query.
|
23 |
-
*
|
24 |
-
* @return object
|
25 |
-
*/
|
26 |
-
public function joinProductTranslations( $results ) {
|
27 |
-
if ( $this->isValidResultsObject( $results ) ) {
|
28 |
-
$previousCount = count( $results->data );
|
29 |
-
$results->data = $this->merge( $results->data );
|
30 |
-
if ( isset( $results->total ) ) {
|
31 |
-
$results->total -= $previousCount - count( $results->data );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
return $results;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Validates if products query is valid.
|
40 |
-
*
|
41 |
-
* @param $results
|
42 |
-
*
|
43 |
-
* @return bool
|
44 |
-
*/
|
45 |
-
private function isValidResultsObject( $results ) {
|
46 |
-
if( empty( $results->data ) || ! is_array( $results->data ) ) {
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
foreach ( $results->data as $key => $val ) {
|
50 |
-
if ( ! isset( $val['product_id'] ) ) {
|
51 |
-
return false;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
return true;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Removes translated products from results and updates numeric values in original product.
|
59 |
-
*
|
60 |
-
* @param array $products
|
61 |
-
*
|
62 |
-
* @return mixed
|
63 |
-
*/
|
64 |
-
private function merge( $products ) {
|
65 |
-
$currentLanguage = apply_filters( 'wpml_current_language', null );
|
66 |
-
foreach( $products as $index => $product ) {
|
67 |
-
$productsDetails = $this->getProductLanguageDetails( $product );
|
68 |
-
if ( $this->isProductTranslated( $productsDetails, $currentLanguage ) ) {
|
69 |
-
$products = $this->mergeTranslationIntoDefault( $products, $index, $product, $productsDetails );
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
return $products;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Checks if product is not in currently displayed language.
|
78 |
-
*
|
79 |
-
* @param object $productDetails
|
80 |
-
* @param string $currentLanguage
|
81 |
-
*
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
private function isProductTranslated( $productDetails, $currentLanguage ) {
|
85 |
-
return isset( $productDetails->language_code )
|
86 |
-
&& $productDetails->language_code !== $currentLanguage;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @param array $products
|
91 |
-
* @param int $translatedProductIndex
|
92 |
-
* @param array $translatedProduct
|
93 |
-
* @param object $productsDetails
|
94 |
-
*
|
95 |
-
* @return mixed
|
96 |
-
*/
|
97 |
-
private function mergeTranslationIntoDefault( $products, $translatedProductIndex, $translatedProduct, $productsDetails ) {
|
98 |
-
$originalProductId = apply_filters( 'wpml_object_id', $productsDetails->element_id, 'product' );
|
99 |
-
if ( $originalProductId ) {
|
100 |
-
foreach ( $products as $index => $product ) {
|
101 |
-
if ( $product['product_id'] === $originalProductId ) {
|
102 |
-
$products = $this->removeTranslatedProduct( $products, $translatedProductIndex );
|
103 |
-
$products = $this->updateOriginalProductFields( $products, $index, $translatedProduct );
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
-
return $products;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Remove translated product from product lists.
|
112 |
-
*
|
113 |
-
* @param array $products Filtered products list.
|
114 |
-
* @param int $key Index of translated product in array.
|
115 |
-
*
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
private function removeTranslatedProduct( $products, $key ) {
|
119 |
-
return array_diff_key( $products, [ $key => '' ] );
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Update numeric values in original product by adding values from translated.
|
124 |
-
*
|
125 |
-
* @param array $products
|
126 |
-
* @param int $index
|
127 |
-
* @param array $translatedProduct
|
128 |
-
*
|
129 |
-
* @return array|mixed
|
130 |
-
*/
|
131 |
-
private function updateOriginalProductFields( $products, $index, $translatedProduct ) {
|
132 |
-
$products = $this->sumValues( 'items_sold', $products, $index, $translatedProduct );
|
133 |
-
$products = $this->sumValues( 'net_revenue', $products, $index, $translatedProduct );
|
134 |
-
$products = $this->sumValues( 'orders_count', $products, $index, $translatedProduct );
|
135 |
-
return $products;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* @param string $field
|
140 |
-
* @param array $products
|
141 |
-
* @param int $index
|
142 |
-
* @param array $translatedProduct
|
143 |
-
*
|
144 |
-
* @return mixed
|
145 |
-
*/
|
146 |
-
private function sumValues( $field, $products, $index, $translatedProduct ) {
|
147 |
-
if ( isset( $translatedProduct[ $field ], $products[ $index ][ $field ] ) ) {
|
148 |
-
$products[ $index ][ $field ] += $translatedProduct[ $field ];
|
149 |
-
}
|
150 |
-
return $products;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* @param array $product
|
155 |
-
*
|
156 |
-
* @return mixed|void
|
157 |
-
*/
|
158 |
-
private function getProductLanguageDetails( $product ) {
|
159 |
-
$args = [
|
160 |
-
'element_id' => $product['product_id'],
|
161 |
-
'element_type' => 'product'
|
162 |
-
];
|
163 |
-
return apply_filters( 'wpml_element_language_details', null, $args );
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* @param object $results Categories query (note: in March 2021, WC Admin code is showing a PHPDoc returning an array which is not what we get)
|
168 |
-
*
|
169 |
-
* @return object
|
170 |
-
*/
|
171 |
-
public function translateProductTitles( $results ) {
|
172 |
-
$results->data = wpml_collect( $results->data )
|
173 |
-
->map( function( $row ) {
|
174 |
-
if ( $row['extended_info']['name'] ) {
|
175 |
-
$row['product_id'] = apply_filters( 'wpml_object_id', $row['product_id'], get_post_type( $row['product_id'] ), true );
|
176 |
-
$product = wc_get_product( $row['product_id'] );
|
177 |
-
if ( $product ) {
|
178 |
-
$row['extended_info']['name'] = $product->get_title();
|
179 |
-
}
|
180 |
-
$row['extended_info']['category_ids'] = wpml_collect( $row['extended_info']['category_ids'] )
|
181 |
-
->map( function( $id ) {
|
182 |
-
return apply_filters( 'wpml_object_id', $id, 'product_cat', true );
|
183 |
-
} )->toArray();
|
184 |
-
}
|
185 |
-
return $row;
|
186 |
-
} )->toArray();
|
187 |
-
|
188 |
-
return $results;
|
189 |
-
}
|
190 |
-
|
191 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/Generic.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class Generic extends WC_REST_Exception {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param string $text
|
11 |
-
*/
|
12 |
-
public function __construct( $text ) {
|
13 |
-
parent::__construct( 422, $text, 422 );
|
14 |
-
}
|
15 |
-
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/InvalidCurrency.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class InvalidCurrency extends WC_REST_Exception {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param string $currency_code
|
11 |
-
*/
|
12 |
-
public function __construct( $currency_code ) {
|
13 |
-
parent::__construct(
|
14 |
-
422,
|
15 |
-
sprintf( __( 'Invalid currency parameter: "%s"', 'woocommerce-multilingual' ),
|
16 |
-
$currency_code ),
|
17 |
-
422
|
18 |
-
);
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/InvalidLanguage.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class InvalidLanguage extends WC_REST_Exception {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param string $language_code
|
11 |
-
*/
|
12 |
-
public function __construct( $language_code ) {
|
13 |
-
parent::__construct(
|
14 |
-
422,
|
15 |
-
sprintf( __( 'Invalid language parameter: "%s"', 'woocommerce-multilingual' ),
|
16 |
-
$language_code ),
|
17 |
-
422
|
18 |
-
);
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/InvalidProduct.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class InvalidProduct extends WC_REST_Exception {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param int $product_id
|
11 |
-
*/
|
12 |
-
public function __construct( $product_id ) {
|
13 |
-
parent::__construct(
|
14 |
-
422,
|
15 |
-
sprintf( __( 'Product not found: %d', 'woocommerce-multilingual' ),
|
16 |
-
$product_id ),
|
17 |
-
422
|
18 |
-
);
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/InvalidTerm.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class InvalidTerm extends WC_REST_Exception {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param int $term_id
|
11 |
-
*/
|
12 |
-
public function __construct( $term_id ) {
|
13 |
-
parent::__construct(
|
14 |
-
422,
|
15 |
-
sprintf( __( 'Term not found: %d', 'woocommerce-multilingual' ),
|
16 |
-
$term_id ),
|
17 |
-
422
|
18 |
-
);
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Exceptions/MissingLanguage.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Exceptions;
|
4 |
-
|
5 |
-
use WC_REST_Exception;
|
6 |
-
|
7 |
-
class MissingLanguage extends WC_REST_Exception {
|
8 |
-
|
9 |
-
public function __construct() {
|
10 |
-
parent::__construct(
|
11 |
-
422,
|
12 |
-
__( 'Using "translation_of" requires providing a "lang" parameter too', 'woocommerce-multilingual' ),
|
13 |
-
422
|
14 |
-
);
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Frontend/Language.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Frontend;
|
4 |
-
|
5 |
-
use WCML_Switch_Lang_Request;
|
6 |
-
use WPML_Cookie;
|
7 |
-
use WPML_URL_Converter;
|
8 |
-
|
9 |
-
class Language {
|
10 |
-
|
11 |
-
/** @var WPML_Cookie $cookie */
|
12 |
-
private $cookie;
|
13 |
-
|
14 |
-
/** @var WPML_URL_Converter $urlConverter */
|
15 |
-
private $urlConverter;
|
16 |
-
|
17 |
-
public function __construct(
|
18 |
-
WPML_Cookie $cookie,
|
19 |
-
WPML_URL_Converter $urlConverter
|
20 |
-
) {
|
21 |
-
$this->cookie = $cookie;
|
22 |
-
$this->urlConverter = $urlConverter;
|
23 |
-
}
|
24 |
-
|
25 |
-
/** @return string */
|
26 |
-
public function get() {
|
27 |
-
$lang = $this->cookie->get_cookie( WCML_Switch_Lang_Request::COOKIE_NAME );
|
28 |
-
|
29 |
-
if ( ! $lang && isset( $_SERVER['HTTP_REFERER'] ) ) {
|
30 |
-
$lang = $this->urlConverter->get_language_from_url( $_SERVER['HTTP_REFERER'] );
|
31 |
-
}
|
32 |
-
|
33 |
-
return $lang;
|
34 |
-
}
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Functions.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
|
7 |
-
class Functions {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Check if we are requesting a WooCommerce Analytics page.
|
11 |
-
*
|
12 |
-
* @return bool
|
13 |
-
*/
|
14 |
-
public static function isAnalyticsPage() {
|
15 |
-
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
16 |
-
return is_admin()
|
17 |
-
&& 'wc-admin' === Obj::prop( 'page', $_GET )
|
18 |
-
&& 0 === strpos( sanitize_text_field( wp_unslash( Obj::prop( 'path', $_GET ) ) ), '/analytics/' );
|
19 |
-
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Check if is request to the WooCommerce REST API.
|
24 |
-
*
|
25 |
-
* @return bool
|
26 |
-
*/
|
27 |
-
public static function isRestApiRequest() {
|
28 |
-
return apply_filters( 'woocommerce_rest_is_request_to_rest_api', self::checkEndpoint( 'wc/v' . self::getApiRequestVersion() . '/' ) );
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Check if is request to the WooCommerce Analytics REST API.
|
33 |
-
*
|
34 |
-
* @return bool
|
35 |
-
*/
|
36 |
-
public static function isAnalyticsRestRequest() {
|
37 |
-
return self::checkEndpoint( 'wc-analytics/' );
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @return int
|
42 |
-
* Returns the version number of the API used for the current request
|
43 |
-
*/
|
44 |
-
public static function getApiRequestVersion() {
|
45 |
-
|
46 |
-
$version = 0;
|
47 |
-
|
48 |
-
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
|
49 |
-
return $version;
|
50 |
-
}
|
51 |
-
|
52 |
-
$restPrefix = trailingslashit( rest_get_url_prefix() );
|
53 |
-
if ( preg_match( '@' . $restPrefix . 'wc/v([0-9]+)/@i', $_SERVER['REQUEST_URI'], $matches ) ) {
|
54 |
-
$version = intval( $matches[1] );
|
55 |
-
}
|
56 |
-
|
57 |
-
return $version;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @param string $endpoint
|
62 |
-
*
|
63 |
-
* @return bool
|
64 |
-
*/
|
65 |
-
private static function checkEndpoint( $endpoint = 'wc/' ) {
|
66 |
-
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
$rest_prefix = trailingslashit( rest_get_url_prefix() );
|
71 |
-
return ( false !== stripos( $_SERVER['REQUEST_URI'], $rest_prefix . $endpoint ) );
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Use url without the language parameter. Needed for the signature match.
|
76 |
-
*/
|
77 |
-
public static function removeWpmlGlobalUrlFilters() {
|
78 |
-
global $wpml_url_filters;
|
79 |
-
remove_filter( 'home_url', [ $wpml_url_filters, 'home_url_filter' ], - 10 );
|
80 |
-
}
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Generic.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest;
|
4 |
-
|
5 |
-
class Generic {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Prevent WPML redirection when using the default language as a parameter in the url
|
9 |
-
*/
|
10 |
-
public static function preventDefaultLangUrlRedirect() {
|
11 |
-
$exp = explode( '?', $_SERVER['REQUEST_URI'] );
|
12 |
-
if ( ! empty( $exp[1] ) ) {
|
13 |
-
parse_str( $exp[1], $vars );
|
14 |
-
if ( isset( $vars['lang'] ) && $vars['lang'] === wpml_get_default_language() ) {
|
15 |
-
unset( $vars['lang'] );
|
16 |
-
$_SERVER['REQUEST_URI'] = $exp[0] . '?' . http_build_query( $vars );
|
17 |
-
}
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param WP_Query $wp_query
|
23 |
-
*/
|
24 |
-
public static function autoAdjustIncludedIds( \WP_Query $wp_query ) {
|
25 |
-
$lang = $wp_query->get( 'lang' );
|
26 |
-
$include = $wp_query->get( 'post__in' );
|
27 |
-
if ( empty( $lang ) && ! empty( $include ) ) {
|
28 |
-
$filtered_include = array();
|
29 |
-
foreach ( $include as $id ) {
|
30 |
-
$filtered_include[] = wpml_object_id_filter( $id, get_post_type( $id ), true );
|
31 |
-
}
|
32 |
-
$wp_query->set( 'post__in', $filtered_include );
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Hooks.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest;
|
4 |
-
|
5 |
-
use WCML\Rest\Wrapper\Factory;
|
6 |
-
|
7 |
-
class Hooks {
|
8 |
-
|
9 |
-
public static function addHooks() {
|
10 |
-
|
11 |
-
Generic::preventDefaultLangUrlRedirect();
|
12 |
-
|
13 |
-
add_action( 'rest_api_init', [ Language\Set::class, 'fromUrlQueryVar' ] );
|
14 |
-
add_filter( 'rest_request_before_callbacks', [ Language\Set::class, 'beforeCallbacks' ], 10, 3 );
|
15 |
-
add_action( 'parse_query', [ Generic::class, 'autoAdjustIncludedIds' ] );
|
16 |
-
|
17 |
-
foreach ( [ 'product', 'shop_order', 'product_variation' ] as $type ) {
|
18 |
-
|
19 |
-
$restObject = Factory::create( $type );
|
20 |
-
|
21 |
-
add_filter( "woocommerce_rest_{$type}_query", [ $restObject, 'query' ], 10, 2 );
|
22 |
-
add_filter( "woocommerce_rest_{$type}_object_query", [ $restObject, 'query' ], 10, 2 );
|
23 |
-
add_action( "woocommerce_rest_prepare_{$type}_object", [ $restObject, 'prepare' ], 10, 3 );
|
24 |
-
add_action( "woocommerce_rest_insert_{$type}_object", [ $restObject, 'insert' ], 10, 3 );
|
25 |
-
}
|
26 |
-
|
27 |
-
$attributeTaxonomies = wc_get_attribute_taxonomy_names();
|
28 |
-
|
29 |
-
foreach ( array_merge( [ 'product_cat', 'product_tag', 'product_shipping_class' ], $attributeTaxonomies ) as $type ) {
|
30 |
-
|
31 |
-
$restObject = Factory::create( 'term' );
|
32 |
-
|
33 |
-
add_filter( "woocommerce_rest_{$type}_query", [ $restObject, 'query' ], 10, 2 );
|
34 |
-
add_action( "woocommerce_rest_prepare_{$type}", [ $restObject, 'prepare' ], 10, 3 );
|
35 |
-
add_action( "woocommerce_rest_insert_{$type}", [ $restObject, 'insert' ], 10, 3 );
|
36 |
-
}
|
37 |
-
|
38 |
-
add_filter( "woocommerce_rest_prepare_report_top_sellers", [ Factory::create( 'reports_top_seller' ), 'prepare' ], 10, 3 );
|
39 |
-
add_filter( "woocommerce_rest_prepare_report_products_count", [ Factory::create( 'reports_products_count' ), 'prepare' ], 10, 3 );
|
40 |
-
add_filter( "woocommerce_rest_prepare_report_sales", [ Factory::create( 'reports_products_sales' ), 'prepare' ], 10, 3 );
|
41 |
-
|
42 |
-
self::addHooksSpecificForV1();
|
43 |
-
}
|
44 |
-
|
45 |
-
private static function addHooksSpecificForV1() {
|
46 |
-
|
47 |
-
if ( 1 === Functions::getApiRequestVersion() ) {
|
48 |
-
add_action( 'woocommerce_rest_prepare_product', [ Factory::create( 'product' ), 'prepare' ], 10, 3 );
|
49 |
-
add_action( 'woocommerce_rest_insert_product', [ Factory::create( 'product' ), 'insert' ], 10, 3 );
|
50 |
-
add_action( 'woocommerce_rest_update_product', [ Factory::create( 'product' ), 'insert' ], 10, 3 );
|
51 |
-
|
52 |
-
add_action( 'woocommerce_rest_insert_shop_order', [ Factory::create( 'shop_order' ), 'insert' ], 10, 3 );
|
53 |
-
add_action( 'woocommerce_rest_prepare_shop_order', [ Factory::create( 'shop_order' ), 'prepare' ], 10, 3 );
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Language/Set.php
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Language;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
|
7 |
-
class Set {
|
8 |
-
|
9 |
-
public static function fromUrlQueryVar() {
|
10 |
-
$lang = self::sanitize( Obj::prop( 'lang', $_GET ) );
|
11 |
-
|
12 |
-
if ( $lang ) {
|
13 |
-
wpml_switch_language_action( $lang );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @param \WP_REST_Response|\WP_HTTP_Response|\WP_Error|mixed $response
|
19 |
-
* @param array $handler
|
20 |
-
* @param \WP_REST_Request $request
|
21 |
-
*
|
22 |
-
* @return \WP_REST_Response|\WP_HTTP_Response|\WP_Error|mixed
|
23 |
-
*/
|
24 |
-
public static function beforeCallbacks( $response, $handler, \WP_REST_Request $request ) {
|
25 |
-
$lang = self::getFromRequestParams( $request )
|
26 |
-
?: self::getFromProduct( $handler, $request );
|
27 |
-
|
28 |
-
if ( $lang ) {
|
29 |
-
wpml_switch_language_action( $lang );
|
30 |
-
}
|
31 |
-
|
32 |
-
return $response;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @param \WP_REST_Request $request
|
37 |
-
*
|
38 |
-
* @return string
|
39 |
-
*/
|
40 |
-
private static function getFromRequestParams( \WP_REST_Request $request ) {
|
41 |
-
return self::sanitize( $request->get_param( 'lang' ) );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param array $handler
|
46 |
-
* @param \WP_REST_Request $request
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
private static function getFromProduct( $handler, \WP_REST_Request $request ) {
|
51 |
-
$callback = Obj::prop( 'callback', $handler );
|
52 |
-
|
53 |
-
if (
|
54 |
-
is_array( $callback )
|
55 |
-
&& Obj::prop( 0, $callback ) instanceof \WC_REST_Products_Controller
|
56 |
-
&& $request->get_param( 'id' )
|
57 |
-
) {
|
58 |
-
return (string) Obj::prop(
|
59 |
-
'language_code',
|
60 |
-
apply_filters( 'wpml_post_language_details', [], $request->get_param( 'id' ) )
|
61 |
-
);
|
62 |
-
}
|
63 |
-
|
64 |
-
return '';
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @param string $lang
|
69 |
-
*
|
70 |
-
* @return string
|
71 |
-
*/
|
72 |
-
private static function sanitize( $lang ) {
|
73 |
-
return filter_var( $lang, FILTER_SANITIZE_STRING );
|
74 |
-
}
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/ProductSaveActions.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest;
|
4 |
-
|
5 |
-
use function WCML\functions\getId;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* We need to reuse the `after_save_post` protected method
|
9 |
-
* of the \WPML_Post_Translation and the only way is by inheritance.
|
10 |
-
* The abstract methods are not used in the parent, but
|
11 |
-
* we need implement it to respect the contract.
|
12 |
-
* We are also including the WCML logic to `synchronize_products`.
|
13 |
-
*/
|
14 |
-
class ProductSaveActions extends \WPML_Post_Translation {
|
15 |
-
|
16 |
-
/** @var \SitePress $sitepress */
|
17 |
-
private $sitepress;
|
18 |
-
|
19 |
-
/** @var \WCML_Synchronize_Product_Data $productDataSync */
|
20 |
-
private $productDataSync;
|
21 |
-
|
22 |
-
public function __construct(
|
23 |
-
array $settings,
|
24 |
-
\wpdb $wpdb,
|
25 |
-
\SitePress $sitepress,
|
26 |
-
\WCML_Synchronize_Product_Data $productDataSync
|
27 |
-
) {
|
28 |
-
parent::__construct( $settings, $wpdb );
|
29 |
-
$this->sitepress = $sitepress;
|
30 |
-
$this->productDataSync = $productDataSync;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @param object|\WC_Abstract_Legacy_Product $product
|
35 |
-
* @param int|null $trid
|
36 |
-
* @param string $langCode
|
37 |
-
* @param int|null $translationOf
|
38 |
-
*/
|
39 |
-
public function run( $product, $trid, $langCode, $translationOf ) {
|
40 |
-
$productId = getId( $product );
|
41 |
-
$trid = $trid ? $trid : $this->get_save_post_trid( $productId, null );
|
42 |
-
$langCode = $langCode ? $langCode : parent::get_save_post_lang( $productId, $this->sitepress );
|
43 |
-
$sourceLangCode = $this->get_element_lang_code( $translationOf );
|
44 |
-
|
45 |
-
$this->after_save_post( $trid, get_post( $productId, ARRAY_A ), $langCode, $sourceLangCode );
|
46 |
-
$this->productDataSync->synchronize_products( $productId, get_post( $productId ), true );
|
47 |
-
}
|
48 |
-
|
49 |
-
public function save_post_actions( $postId, $post ) {
|
50 |
-
throw new \Exception( 'This method should not be called, use `run` instead.' );
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @inheritDoc
|
55 |
-
*/
|
56 |
-
function get_save_post_trid( $postId, $post_status ) {
|
57 |
-
return $this->get_element_trid( $postId );
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @inheritDoc
|
62 |
-
*/
|
63 |
-
protected function get_save_post_source_lang( $trid, $language_code, $default_language ) {
|
64 |
-
return $this->get_source_lang_code( $this->get_element_id( $language_code, $trid ) );
|
65 |
-
}
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Composite.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper;
|
4 |
-
|
5 |
-
class Composite extends Handler {
|
6 |
-
|
7 |
-
/** @var $restHandlers [] */
|
8 |
-
private $restHandlers;
|
9 |
-
|
10 |
-
public function __construct( array $restHandlers ) {
|
11 |
-
$this->restHandlers = $restHandlers;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @param array $args
|
16 |
-
* @param WP_REST_Request $request Request object.
|
17 |
-
*
|
18 |
-
* @return array
|
19 |
-
*/
|
20 |
-
public function query( $args, $request ) {
|
21 |
-
foreach ( $this->restHandlers as $restHandler ) {
|
22 |
-
$args = $restHandler->query( $args, $request );
|
23 |
-
}
|
24 |
-
|
25 |
-
return $args;
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Appends the language and translation information to the get_product response
|
30 |
-
*
|
31 |
-
* @param WP_REST_Response $response
|
32 |
-
* @param object $object
|
33 |
-
* @param WP_REST_Request $request
|
34 |
-
*
|
35 |
-
* @return WP_REST_Response
|
36 |
-
*/
|
37 |
-
public function prepare( $response, $object, $request ) {
|
38 |
-
foreach ( $this->restHandlers as $restHandler ) {
|
39 |
-
$response = $restHandler->prepare( $response, $object, $request );
|
40 |
-
}
|
41 |
-
|
42 |
-
return $response;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Sets the product information according to the provided language
|
47 |
-
*
|
48 |
-
* @param object $object
|
49 |
-
* @param WP_REST_Request $request
|
50 |
-
* @param bool $creating
|
51 |
-
*/
|
52 |
-
public function insert( $object, $request, $creating ) {
|
53 |
-
foreach ( $this->restHandlers as $restHandler ) {
|
54 |
-
$restHandler->insert( $object, $request, $creating );
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Factory.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper;
|
4 |
-
|
5 |
-
use WCML\Rest\ProductSaveActions;
|
6 |
-
|
7 |
-
use WCML\Rest\Wrapper\Orders\Languages as OrdersLanguages;
|
8 |
-
use WCML\Rest\Wrapper\Orders\Prices as OrdersPrices;
|
9 |
-
use WCML\Rest\Wrapper\Products\Products;
|
10 |
-
use WCML\Rest\Wrapper\Reports\ProductsCount;
|
11 |
-
use WCML\Rest\Wrapper\Reports\ProductsSales;
|
12 |
-
use WCML\Rest\Wrapper\Reports\TopSeller;
|
13 |
-
|
14 |
-
class Factory {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @param string $objectType
|
18 |
-
*
|
19 |
-
* @return Handler
|
20 |
-
*/
|
21 |
-
public static function create( $objectType ) {
|
22 |
-
/**
|
23 |
-
* @var \woocommerce_wpml $woocommerce_wpml
|
24 |
-
* @var \WPML_Post_Translation $wpml_post_translations
|
25 |
-
* @var \WPML_Term_Translation $wpml_term_translations
|
26 |
-
* @var \SitePress $sitepress
|
27 |
-
* @var \WPML_Query_Filter $wpml_query_filter
|
28 |
-
* @var \wpdb $wpdb
|
29 |
-
*/
|
30 |
-
global $woocommerce_wpml, $wpml_post_translations, $wpml_term_translations, $sitepress, $wpml_query_filter, $wpdb;
|
31 |
-
|
32 |
-
$isMultiCurrencyOn = wcml_is_multi_currency_on();
|
33 |
-
|
34 |
-
switch ( $objectType ) {
|
35 |
-
case 'shop_order':
|
36 |
-
$objects[] = new OrdersLanguages();
|
37 |
-
if ( $isMultiCurrencyOn ) {
|
38 |
-
$objects[] = new OrdersPrices( $woocommerce_wpml->multi_currency->orders );
|
39 |
-
}
|
40 |
-
|
41 |
-
return new Composite( $objects );
|
42 |
-
case 'product_variation':
|
43 |
-
case 'product':
|
44 |
-
return new Products(
|
45 |
-
$sitepress,
|
46 |
-
$wpml_post_translations,
|
47 |
-
$wpml_query_filter,
|
48 |
-
new ProductSaveActions( $sitepress->get_settings(), $wpdb, $sitepress, $woocommerce_wpml->sync_product_data )
|
49 |
-
);
|
50 |
-
case 'term':
|
51 |
-
return new ProductTerms( $sitepress, $wpml_term_translations, $woocommerce_wpml->terms );
|
52 |
-
case 'reports_top_seller':
|
53 |
-
return new TopSeller( $sitepress );
|
54 |
-
case 'reports_products_count':
|
55 |
-
return new ProductsCount( $sitepress, $wpdb );
|
56 |
-
case 'reports_products_sales':
|
57 |
-
return new ProductsSales();
|
58 |
-
}
|
59 |
-
|
60 |
-
return new Handler();
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Handler.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper;
|
4 |
-
|
5 |
-
|
6 |
-
class Handler {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @param array $args
|
10 |
-
* @param WP_REST_Request $request Request object.
|
11 |
-
*
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
public function query( $args, $request ) {
|
15 |
-
return $args;
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @param WP_REST_Response $response The response object.
|
20 |
-
* @param object $object Object data.
|
21 |
-
* @param WP_REST_Request $request Request object.
|
22 |
-
*
|
23 |
-
* @return WP_REST_Response
|
24 |
-
*/
|
25 |
-
public function prepare( $response, $object, $request ) {
|
26 |
-
return $response;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @param object $object Inserted object.
|
31 |
-
* @param WP_REST_Request $request Request object.
|
32 |
-
* @param boolean $creating True when creating object, false when updating.
|
33 |
-
*/
|
34 |
-
public function insert( $object, $request, $creating ) {
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Orders/Languages.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Orders;
|
4 |
-
|
5 |
-
use WCML\Rest\Wrapper\Handler;
|
6 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
7 |
-
|
8 |
-
use function WCML\functions\getId;
|
9 |
-
|
10 |
-
class Languages extends Handler {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* @param array $args
|
14 |
-
* @param WP_REST_Request $request Request object.
|
15 |
-
*
|
16 |
-
* @return array
|
17 |
-
*/
|
18 |
-
public function query( $args, $request ) {
|
19 |
-
$lang = $request->get_param( 'lang' );
|
20 |
-
|
21 |
-
if ( ! is_null( $lang ) && $lang !== 'all' ) {
|
22 |
-
$args['meta_query'][] = array(
|
23 |
-
'key' => 'wpml_language',
|
24 |
-
'value' => strval( $lang )
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
return $args;
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Appends the language and translation information to the get_product response
|
34 |
-
*
|
35 |
-
* @param WP_REST_Response $response
|
36 |
-
* @param \WP_Post|\WC_Order|mixed $object
|
37 |
-
* @param WP_REST_Request $request
|
38 |
-
*
|
39 |
-
* @return WP_REST_Response
|
40 |
-
*/
|
41 |
-
public function prepare( $response, $object, $request ) {
|
42 |
-
$language = get_query_var( 'lang' );
|
43 |
-
$orderLanguage = get_post_meta( $this->get_id( $object ), 'wpml_language', true );
|
44 |
-
|
45 |
-
if ( $orderLanguage !== $language ) {
|
46 |
-
foreach ( $response->data['line_items'] as $k => $item ) {
|
47 |
-
$translatedProductId = wpml_object_id_filter( $item['product_id'], 'product', false, $language );
|
48 |
-
if ( $translatedProductId ) {
|
49 |
-
$translatedProduct = get_post( $translatedProductId );
|
50 |
-
$response->data['line_items'][ $k ]['product_id'] = $translatedProductId;
|
51 |
-
if ( $translatedProduct->post_type === 'product_variation' ) {
|
52 |
-
$postParent = get_post( $translatedProduct->post_parent );
|
53 |
-
$postName = $postParent->post_title;
|
54 |
-
} else {
|
55 |
-
$postName = $translatedProduct->post_title;
|
56 |
-
}
|
57 |
-
$response->data['line_items'][ $k ]['name'] = $postName;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
return $response;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* @param \WP_Post|\WC_Order|mixed $object
|
67 |
-
* @return int
|
68 |
-
* @throws \Exception If order has no id.
|
69 |
-
*/
|
70 |
-
private function get_id( $object ) {
|
71 |
-
try {
|
72 |
-
return getId( $object );
|
73 |
-
} catch ( \Exception $err ) {
|
74 |
-
throw new \Exception( 'Order has no ID set.' );
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Sets the product information according to the provided language
|
81 |
-
*
|
82 |
-
* @param object $object
|
83 |
-
* @param WP_REST_Request $request
|
84 |
-
* @param bool $creating
|
85 |
-
*
|
86 |
-
* @throws InvalidLanguage
|
87 |
-
*/
|
88 |
-
public function insert( $object, $request, $creating ) {
|
89 |
-
$data = $request->get_params();
|
90 |
-
if ( isset( $data['lang'] ) ) {
|
91 |
-
|
92 |
-
if ( ! apply_filters( 'wpml_language_is_active', false, $data['lang'] ) ) {
|
93 |
-
throw new InvalidLanguage( $data['lang'] );
|
94 |
-
}
|
95 |
-
|
96 |
-
update_post_meta( $object->get_id(), 'wpml_language', $data['lang'] );
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Orders/Prices.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Orders;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
use WCML\Rest\Wrapper\Handler;
|
7 |
-
use WCML\Rest\Exceptions\InvalidCurrency;
|
8 |
-
|
9 |
-
class Prices extends Handler {
|
10 |
-
|
11 |
-
/** @var WCML_Multi_Currency_Orders */
|
12 |
-
private $wcmlMultiCurrencyOrders;
|
13 |
-
|
14 |
-
public function __construct(
|
15 |
-
\WCML_Multi_Currency_Orders $wcmlMultiCurrencyOrders
|
16 |
-
) {
|
17 |
-
$this->wcmlMultiCurrencyOrders = $wcmlMultiCurrencyOrders;
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Sets the product information according to the provided language
|
22 |
-
*
|
23 |
-
* @param object $object
|
24 |
-
* @param WP_REST_Request $request
|
25 |
-
* @param bool $creating
|
26 |
-
*
|
27 |
-
* @throws InvalidCurrency
|
28 |
-
*
|
29 |
-
*/
|
30 |
-
public function insert( $object, $request, $creating ) {
|
31 |
-
|
32 |
-
$currency = Obj::prop( 'currency', $request->get_params() );
|
33 |
-
|
34 |
-
if ( $currency ) {
|
35 |
-
|
36 |
-
$orderId = $object->get_id();
|
37 |
-
$currencies = get_woocommerce_currencies();
|
38 |
-
|
39 |
-
if ( ! isset( $currencies[ $currency ] ) ) {
|
40 |
-
throw new InvalidCurrency( $currency );
|
41 |
-
}
|
42 |
-
|
43 |
-
update_post_meta( $orderId, '_order_currency', $currency );
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/ProductTerms.php
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper;
|
4 |
-
|
5 |
-
use WPML\FP\Fns;
|
6 |
-
use WPML\FP\Obj;
|
7 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
8 |
-
use WCML\Rest\Exceptions\InvalidTerm;
|
9 |
-
use WCML\Rest\Exceptions\MissingLanguage;
|
10 |
-
|
11 |
-
class ProductTerms extends Handler {
|
12 |
-
|
13 |
-
/** @var \Sitepress */
|
14 |
-
private $sitepress;
|
15 |
-
/** @var \WPML_Term_Translation */
|
16 |
-
private $wpmlTermTranslations;
|
17 |
-
/** @var \WCML_Terms */
|
18 |
-
private $wcmlTerms;
|
19 |
-
|
20 |
-
public function __construct(
|
21 |
-
\SitePress $sitepress,
|
22 |
-
\WPML_Term_Translation $wpmlTermTranslations,
|
23 |
-
\WCML_Terms $wcmlTerms
|
24 |
-
) {
|
25 |
-
$this->sitepress = $sitepress;
|
26 |
-
$this->wpmlTermTranslations = $wpmlTermTranslations;
|
27 |
-
$this->wcmlTerms = $wcmlTerms;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @param array $args
|
32 |
-
* @param \WP_REST_Request $request Request object.
|
33 |
-
*
|
34 |
-
* @return array
|
35 |
-
*
|
36 |
-
* @throws InvalidLanguage
|
37 |
-
*/
|
38 |
-
public function query( $args, $request ) {
|
39 |
-
$language = Obj::prop( 'lang', $request->get_params() );
|
40 |
-
|
41 |
-
if ( $language ) {
|
42 |
-
if ( 'all' === $language ) {
|
43 |
-
remove_filter( 'terms_clauses', [ $this->sitepress, 'terms_clauses' ], 10 );
|
44 |
-
remove_filter( 'get_term', [ $this->sitepress, 'get_term_adjust_id' ], 1 );
|
45 |
-
} else {
|
46 |
-
$this->checkLanguage( $language );
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
return $args;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Appends the language and translation information to the get_product response
|
55 |
-
*
|
56 |
-
* @param \WP_REST_Response $response
|
57 |
-
* @param object|\WP_Term $object
|
58 |
-
* @param \WP_REST_Request $request
|
59 |
-
*
|
60 |
-
* @return \WP_REST_Response
|
61 |
-
*/
|
62 |
-
public function prepare( $response, $object, $request ) {
|
63 |
-
|
64 |
-
$response->data['translations'] = [];
|
65 |
-
|
66 |
-
$termTaxonomyId = (int) Obj::prop( 'term_taxonomy_id', $object );
|
67 |
-
$trid = $this->wpmlTermTranslations->get_element_trid( $termTaxonomyId );
|
68 |
-
|
69 |
-
if ( $trid ) {
|
70 |
-
$getTermId = function( $termTaxonomyId ) {
|
71 |
-
$term = get_term_by( 'term_taxonomy_id', $termTaxonomyId );
|
72 |
-
return isset( $term->term_id ) ? $term->term_id : null;
|
73 |
-
};
|
74 |
-
|
75 |
-
$hasFilter = remove_filter( 'get_term', [ $this->sitepress, 'get_term_adjust_id' ], 1 );
|
76 |
-
|
77 |
-
$response->data['translations'] = Fns::map(
|
78 |
-
$getTermId,
|
79 |
-
$this->wpmlTermTranslations->get_element_translations( $termTaxonomyId, $trid )
|
80 |
-
);
|
81 |
-
|
82 |
-
if ( $hasFilter ) {
|
83 |
-
add_filter( 'get_term', [ $this->sitepress, 'get_term_adjust_id' ], 1 );
|
84 |
-
}
|
85 |
-
|
86 |
-
$response->data['lang'] = $this->wpmlTermTranslations->get_element_lang_code( $termTaxonomyId );
|
87 |
-
}
|
88 |
-
|
89 |
-
return $response;
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Sets the product information according to the provided language
|
94 |
-
*
|
95 |
-
* @param \WP_Term $term
|
96 |
-
* @param \WP_REST_Request $request
|
97 |
-
* @param bool $creating
|
98 |
-
*
|
99 |
-
* @throws InvalidLanguage
|
100 |
-
* @throws InvalidTerm
|
101 |
-
*
|
102 |
-
*/
|
103 |
-
public function insert( $term, $request, $creating ) {
|
104 |
-
$getParam = Obj::prop( Fns::__, $request->get_params() );
|
105 |
-
|
106 |
-
$language = $getParam( 'lang' );
|
107 |
-
$translationOf = $getParam( 'translation_of' );
|
108 |
-
|
109 |
-
if ( $language ) {
|
110 |
-
|
111 |
-
$this->checkLanguage( $language );
|
112 |
-
|
113 |
-
if ( $translationOf ) {
|
114 |
-
$translationOfTerm = get_term( $translationOf, $term->taxonomy );
|
115 |
-
|
116 |
-
$trid = isset( $translationOfTerm->term_taxonomy_id )
|
117 |
-
? $this->wpmlTermTranslations->get_element_trid( $translationOfTerm->term_taxonomy_id )
|
118 |
-
: null;
|
119 |
-
|
120 |
-
if ( ! $trid ) {
|
121 |
-
throw new InvalidTerm( $translationOf );
|
122 |
-
}
|
123 |
-
} else {
|
124 |
-
$trid = null;
|
125 |
-
}
|
126 |
-
|
127 |
-
$this->sitepress->set_element_language_details( $term->term_taxonomy_id, 'tax_' . $term->taxonomy, $trid, $language );
|
128 |
-
|
129 |
-
$this->wcmlTerms->update_terms_translated_status( $term->taxonomy );
|
130 |
-
} elseif ( $translationOf ) {
|
131 |
-
throw new MissingLanguage();
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* @param string $language
|
137 |
-
*
|
138 |
-
* @throws InvalidLanguage
|
139 |
-
*/
|
140 |
-
private function checkLanguage( $language ) {
|
141 |
-
if ( ! $this->sitepress->is_active_language( $language ) ) {
|
142 |
-
throw new InvalidLanguage( $language );
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Products/Products.php
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Products;
|
4 |
-
|
5 |
-
use WCML\Rest\Exceptions\Generic;
|
6 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
7 |
-
use WCML\Rest\Exceptions\InvalidProduct;
|
8 |
-
use WCML\Rest\ProductSaveActions;
|
9 |
-
use WCML\Rest\Wrapper\Handler;
|
10 |
-
use WPML\FP\Fns;
|
11 |
-
use WPML\FP\Obj;
|
12 |
-
|
13 |
-
class Products extends Handler {
|
14 |
-
|
15 |
-
/** @var \Sitepress */
|
16 |
-
private $sitepress;
|
17 |
-
/** @var \WPML_Post_Translation */
|
18 |
-
private $wpmlPostTranslations;
|
19 |
-
/** @var \WPML_Query_Filter */
|
20 |
-
private $wpmlQueryFilter;
|
21 |
-
/** @var ProductSaveActions $productSaveActions */
|
22 |
-
private $productSaveActions;
|
23 |
-
|
24 |
-
public function __construct(
|
25 |
-
\Sitepress $sitepress,
|
26 |
-
\WPML_Post_Translation $wpmlPostTranslations,
|
27 |
-
\WPML_Query_Filter $wpmlQueryFilter,
|
28 |
-
ProductSaveActions $productSaveActions
|
29 |
-
) {
|
30 |
-
$this->sitepress = $sitepress;
|
31 |
-
$this->wpmlPostTranslations = $wpmlPostTranslations;
|
32 |
-
$this->wpmlQueryFilter = $wpmlQueryFilter;
|
33 |
-
$this->productSaveActions = $productSaveActions;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @param array $args
|
38 |
-
* @param \WP_REST_Request $request Request object.
|
39 |
-
*
|
40 |
-
* @return array
|
41 |
-
*/
|
42 |
-
public function query( $args, $request ) {
|
43 |
-
$data = $request->get_params();
|
44 |
-
if ( isset( $data['lang'] ) && $data['lang'] === 'all' ) {
|
45 |
-
remove_filter( 'posts_join', [ $this->wpmlQueryFilter, 'posts_join_filter' ] );
|
46 |
-
remove_filter( 'posts_where', [ $this->wpmlQueryFilter, 'posts_where_filter' ] );
|
47 |
-
}
|
48 |
-
|
49 |
-
return $args;
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Appends the language and translation information to the get_product response
|
55 |
-
*
|
56 |
-
* @param \WP_REST_Response $response
|
57 |
-
* @param object $object
|
58 |
-
* @param \WP_REST_Request $request
|
59 |
-
*
|
60 |
-
* @return \WP_REST_Response
|
61 |
-
*/
|
62 |
-
public function prepare( $response, $object, $request ) {
|
63 |
-
$response->data['translations'] = array();
|
64 |
-
|
65 |
-
$trid = $this->wpmlPostTranslations->get_element_trid( $response->data['id'] );
|
66 |
-
|
67 |
-
if ( $trid ) {
|
68 |
-
$translations = $this->wpmlPostTranslations->get_element_translations( $response->data['id'], $trid );
|
69 |
-
foreach ( $translations as $translation ) {
|
70 |
-
$response->data['translations'][ $this->wpmlPostTranslations->get_element_lang_code( $translation ) ] = $translation;
|
71 |
-
}
|
72 |
-
$response->data['lang'] = $this->wpmlPostTranslations->get_element_lang_code( $response->data['id'] );
|
73 |
-
}
|
74 |
-
|
75 |
-
return $response;
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Sets the product information according to the provided language
|
81 |
-
*
|
82 |
-
* @param object|\WC_Abstract_Legacy_Product $object
|
83 |
-
* @param \WP_REST_Request $request
|
84 |
-
* @param bool $creating
|
85 |
-
*
|
86 |
-
* @throws InvalidLanguage
|
87 |
-
* @throws InvalidProduct
|
88 |
-
* @throws Generic
|
89 |
-
*
|
90 |
-
*/
|
91 |
-
public function insert( $object, $request, $creating ) {
|
92 |
-
$getParam = Obj::prop( Fns::__, $request->get_params() );
|
93 |
-
|
94 |
-
$langCode = $getParam( 'lang' );
|
95 |
-
$translationOf = $getParam( 'translation_of' );
|
96 |
-
$trid = null;
|
97 |
-
$sourceLangCode = null;
|
98 |
-
|
99 |
-
if ( $langCode ) {
|
100 |
-
|
101 |
-
if ( ! $this->sitepress->is_active_language( $langCode ) ) {
|
102 |
-
throw new InvalidLanguage( $langCode );
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( $translationOf ) {
|
106 |
-
$trid = $this->wpmlPostTranslations->get_element_trid( $translationOf );
|
107 |
-
|
108 |
-
if ( ! $trid ) {
|
109 |
-
throw new InvalidProduct( $translationOf );
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
} elseif ( $translationOf ) {
|
114 |
-
throw new Generic( __( 'Using "translation_of" requires providing a "lang" parameter too', 'woocommerce-multilingual' ) );
|
115 |
-
}
|
116 |
-
|
117 |
-
$this->productSaveActions->run( $object, $trid, $langCode, $translationOf );
|
118 |
-
}
|
119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Reports/ProductsCount.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Reports;
|
4 |
-
|
5 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
6 |
-
use WCML\Rest\Wrapper\Handler;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
|
9 |
-
class ProductsCount extends Handler {
|
10 |
-
|
11 |
-
/** @var Sitepress */
|
12 |
-
private $sitepress;
|
13 |
-
/** @var wpdb */
|
14 |
-
private $wpdb;
|
15 |
-
|
16 |
-
public function __construct(
|
17 |
-
\SitePress $sitepress,
|
18 |
-
\wpdb $wpdb
|
19 |
-
) {
|
20 |
-
$this->sitepress = $sitepress;
|
21 |
-
$this->wpdb = $wpdb;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Check the language information for top sellers response.
|
26 |
-
*
|
27 |
-
* @param WP_REST_Response $response
|
28 |
-
* @param object $object
|
29 |
-
* @param WP_REST_Request $request
|
30 |
-
*
|
31 |
-
* @throws InvalidLanguage
|
32 |
-
*
|
33 |
-
* @return WP_REST_Response
|
34 |
-
*/
|
35 |
-
public function prepare( $response, $object, $request ) {
|
36 |
-
|
37 |
-
$language = Obj::prop( 'lang', $request->get_params() );
|
38 |
-
|
39 |
-
if ( $language ) {
|
40 |
-
|
41 |
-
if ( ! $this->sitepress->is_active_language( $language ) ) {
|
42 |
-
throw new InvalidLanguage( $language );
|
43 |
-
}
|
44 |
-
|
45 |
-
$term = get_term_by( 'slug', $object->slug, 'product_type' );
|
46 |
-
|
47 |
-
$count = $this->wpdb->get_var(
|
48 |
-
$this->wpdb->prepare(
|
49 |
-
"SELECT count( p.ID ) FROM {$this->wpdb->posts} as p
|
50 |
-
LEFT JOIN {$this->wpdb->term_relationships} as tr ON p.ID = tr.object_id
|
51 |
-
LEFT JOIN {$this->wpdb->prefix}icl_translations as icl ON p.ID = icl.element_id
|
52 |
-
WHERE tr.term_taxonomy_id = %d AND icl.language_code = %s AND icl.element_type = 'post_product'",
|
53 |
-
$term->term_taxonomy_id, $language
|
54 |
-
)
|
55 |
-
);
|
56 |
-
|
57 |
-
$data = \WPML\FP\Obj::assoc( 'total', $count, $response->get_data() );
|
58 |
-
$data = \WPML\FP\Obj::assoc( 'lang', $language, $data );
|
59 |
-
|
60 |
-
$response->set_data( $data );
|
61 |
-
}
|
62 |
-
|
63 |
-
return $response;
|
64 |
-
}
|
65 |
-
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Reports/ProductsSales.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Reports;
|
4 |
-
|
5 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
6 |
-
use WCML\Rest\Wrapper\Handler;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
|
9 |
-
class ProductsSales extends Handler {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Return currency information for products selles response.
|
13 |
-
*
|
14 |
-
* @param WP_REST_Response $response
|
15 |
-
* @param object $object
|
16 |
-
* @param WP_REST_Request $request
|
17 |
-
*
|
18 |
-
* @throws InvalidLanguage
|
19 |
-
*
|
20 |
-
* @return WP_REST_Response
|
21 |
-
*/
|
22 |
-
public function prepare( $response, $object, $request ) {
|
23 |
-
|
24 |
-
$currency = Obj::prop( 'currency', $request->get_params() );
|
25 |
-
|
26 |
-
if ( $currency ) {
|
27 |
-
|
28 |
-
$response->data['currency'] = $currency;
|
29 |
-
}
|
30 |
-
|
31 |
-
return $response;
|
32 |
-
}
|
33 |
-
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Rest/Wrapper/Reports/TopSeller.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Rest\Wrapper\Reports;
|
4 |
-
|
5 |
-
use WCML\Rest\Exceptions\InvalidLanguage;
|
6 |
-
use WCML\Rest\Wrapper\Handler;
|
7 |
-
use WPML\FP\Obj;
|
8 |
-
|
9 |
-
class TopSeller extends Handler {
|
10 |
-
|
11 |
-
/** @var Sitepress */
|
12 |
-
private $sitepress;
|
13 |
-
|
14 |
-
public function __construct(
|
15 |
-
\SitePress $sitepress
|
16 |
-
) {
|
17 |
-
$this->sitepress = $sitepress;
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Check the language information for top sellers response.
|
22 |
-
*
|
23 |
-
* @param WP_REST_Response $response
|
24 |
-
* @param object $object
|
25 |
-
* @param WP_REST_Request $request
|
26 |
-
*
|
27 |
-
* @throws InvalidLanguage
|
28 |
-
*
|
29 |
-
* @return WP_REST_Response|false
|
30 |
-
*/
|
31 |
-
public function prepare( $response, $object, $request ) {
|
32 |
-
|
33 |
-
$language = Obj::prop( 'lang', $request->get_params() );
|
34 |
-
|
35 |
-
if ( $language ) {
|
36 |
-
|
37 |
-
if ( ! $this->sitepress->is_active_language( $language ) ) {
|
38 |
-
throw new InvalidLanguage( $language );
|
39 |
-
}
|
40 |
-
|
41 |
-
$response->data['lang'] = $language;
|
42 |
-
|
43 |
-
$product_lang = $this->sitepress->get_language_for_element( $object->product_id, 'post_' . get_post_type( $object->product_id ) );
|
44 |
-
|
45 |
-
if( $product_lang !== $language ){
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
return $response;
|
51 |
-
}
|
52 |
-
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reviews/Translations/Factory.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reviews\Translations;
|
4 |
-
|
5 |
-
use function WPML\Container\make;
|
6 |
-
|
7 |
-
class Factory implements \IWPML_Deferred_Action_Loader, \IWPML_Frontend_Action_Loader {
|
8 |
-
|
9 |
-
|
10 |
-
public function create() {
|
11 |
-
return [
|
12 |
-
make( FrontEndHooks::class ),
|
13 |
-
];
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* These hooks are deferred to allow 3rd party
|
18 |
-
* themes/plugins to disable the feature
|
19 |
-
* with 'wcml_enable_product_review_translation'.
|
20 |
-
*
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
public function get_load_action() {
|
24 |
-
return 'init';
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reviews/Translations/FrontEndHooks.php
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reviews\Translations;
|
4 |
-
|
5 |
-
use IWPML_Action;
|
6 |
-
use WPML\FP\Obj;
|
7 |
-
use WPML\FP\Relation;
|
8 |
-
|
9 |
-
class FrontEndHooks implements IWPML_Action {
|
10 |
-
|
11 |
-
const CONTEXT = 'wcml-reviews';
|
12 |
-
const COMMENT_TYPE = 'review';
|
13 |
-
|
14 |
-
public function add_hooks() {
|
15 |
-
/**
|
16 |
-
* Allows disabling product reviews translation.
|
17 |
-
*
|
18 |
-
* @param bool Whether translation of product reviews should be enabled
|
19 |
-
*/
|
20 |
-
if ( apply_filters( 'wcml_enable_product_review_translation', true ) ) {
|
21 |
-
add_action( 'wp_insert_comment', [ $this, 'insertCommentAction' ], 10, 2 );
|
22 |
-
add_action( 'woocommerce_review_before', [ $this, 'translateReview' ] );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param int $commentId
|
28 |
-
* @param \WP_Comment $comment
|
29 |
-
*/
|
30 |
-
public function insertCommentAction( $commentId, $comment ) {
|
31 |
-
self::registerReviewString( $comment );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param \WP_Comment $comment
|
36 |
-
*/
|
37 |
-
public function translateReview( $comment ) {
|
38 |
-
if ( self::isNonEmptyReview( $comment ) ) {
|
39 |
-
$reviewTranslation = apply_filters(
|
40 |
-
'wpml_translate_single_string',
|
41 |
-
$comment->comment_content,
|
42 |
-
self::CONTEXT,
|
43 |
-
self::getReviewStringName( $comment )
|
44 |
-
);
|
45 |
-
|
46 |
-
if ( $reviewTranslation !== $comment->comment_content ) {
|
47 |
-
$comment->is_translated = true;
|
48 |
-
$comment->comment_content = $reviewTranslation;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @param \WP_Comment|\stdClass $review
|
55 |
-
*/
|
56 |
-
public static function registerReviewString( $review ) {
|
57 |
-
if ( self::isNonEmptyReview( $review ) ) {
|
58 |
-
do_action(
|
59 |
-
'wpml_register_single_string',
|
60 |
-
self::CONTEXT,
|
61 |
-
self::getReviewStringName( $review ),
|
62 |
-
$review->comment_content,
|
63 |
-
false,
|
64 |
-
Obj::prop( 'language_code', $review ) ?: apply_filters( 'wpml_current_language', null )
|
65 |
-
);
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param \WP_Comment|\stdClass $comment
|
71 |
-
*
|
72 |
-
* @return bool
|
73 |
-
*/
|
74 |
-
private static function isNonEmptyReview( $comment ) {
|
75 |
-
return Obj::prop( 'comment_content', $comment )
|
76 |
-
&& Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment );
|
77 |
-
}
|
78 |
-
/**
|
79 |
-
* @param \WP_Comment|\stdClass $review
|
80 |
-
*
|
81 |
-
* @return string (e.g. "product/123/review/456")
|
82 |
-
*/
|
83 |
-
private static function getReviewStringName( $review ) {
|
84 |
-
return 'product-' . Obj::prop( 'comment_post_ID', $review ) . '-review-' . Obj::prop( 'comment_ID', $review );
|
85 |
-
}
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Reviews/Translations/Mapper.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Reviews\Translations;
|
4 |
-
|
5 |
-
class Mapper {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @var \wpdb
|
9 |
-
*/
|
10 |
-
private $wpdb;
|
11 |
-
|
12 |
-
public function __construct( \wpdb $wpdb ) {
|
13 |
-
$this->wpdb = $wpdb;
|
14 |
-
}
|
15 |
-
|
16 |
-
public function registerMissingReviewStrings() {
|
17 |
-
foreach ( $this->getUnregisteredReviews() as $review ) {
|
18 |
-
FrontEndHooks::registerReviewString( $review );
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @return int
|
24 |
-
*/
|
25 |
-
public function countMissingReviewStrings() {
|
26 |
-
return count( $this->getUnregisteredReviews() );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @return array
|
31 |
-
*/
|
32 |
-
private function getUnregisteredReviews() {
|
33 |
-
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
34 |
-
$q = "SELECT c.comment_ID, c.comment_post_ID, c.comment_content, c.comment_type, tr.language_code, st.name, st.value
|
35 |
-
FROM {$this->wpdb->comments} AS c
|
36 |
-
LEFT JOIN {$this->wpdb->prefix}icl_translations AS tr
|
37 |
-
ON tr.element_id = c.comment_post_ID AND tr.element_type = 'post_product'
|
38 |
-
LEFT JOIN {$this->wpdb->prefix}icl_strings AS st
|
39 |
-
ON c.comment_content = st.value
|
40 |
-
AND st.context = '" . FrontEndHooks::CONTEXT . "'
|
41 |
-
WHERE c.comment_type = '" . FrontEndHooks::COMMENT_TYPE . "'
|
42 |
-
AND st.name IS null";
|
43 |
-
|
44 |
-
return (array) $this->wpdb->get_results( $q );
|
45 |
-
}
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/RewriteRules/Hooks.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\RewriteRules;
|
4 |
-
|
5 |
-
class Hooks implements \IWPML_Backend_Action, \IWPML_Frontend_Action, \IWPML_DIC_Action {
|
6 |
-
|
7 |
-
/** @var \SitePress $sitepress */
|
8 |
-
private $sitepress;
|
9 |
-
|
10 |
-
public function __construct( \SitePress $sitepress ) {
|
11 |
-
$this->sitepress = $sitepress;
|
12 |
-
}
|
13 |
-
|
14 |
-
public function add_hooks() {
|
15 |
-
add_filter( 'option_woocommerce_queue_flush_rewrite_rules', [ $this, 'preventFlushInNonDefaultLang' ] );
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @param string $value
|
20 |
-
*
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
public function preventFlushInNonDefaultLang( $value ) {
|
24 |
-
if (
|
25 |
-
'yes' === $value
|
26 |
-
&& $this->sitepress->get_current_language() !== $this->sitepress->get_default_language()
|
27 |
-
) {
|
28 |
-
return 'no';
|
29 |
-
}
|
30 |
-
|
31 |
-
return $value;
|
32 |
-
}
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Tax/Strings/Hooks.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Tax\Strings;
|
4 |
-
|
5 |
-
use IWPML_Backend_Action;
|
6 |
-
use IWPML_Frontend_Action;
|
7 |
-
|
8 |
-
class Hooks implements IWPML_Backend_Action, IWPML_Frontend_Action {
|
9 |
-
|
10 |
-
const STRINGS_CONTEXT = 'admin_texts_woocommerce_tax';
|
11 |
-
|
12 |
-
public function add_hooks() {
|
13 |
-
add_action( 'woocommerce_tax_rate_added', [ $this, 'registerLabelString' ], 10, 2 );
|
14 |
-
add_action( 'woocommerce_tax_rate_updated', [ $this, 'registerLabelString' ], 10, 2 );
|
15 |
-
add_filter( 'woocommerce_rate_label', [ $this, 'translateLabelString' ], 10, 2 );
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @param string $label
|
20 |
-
* @param int $taxId
|
21 |
-
*
|
22 |
-
* @return string
|
23 |
-
*/
|
24 |
-
public function translateLabelString( $label, $taxId ) {
|
25 |
-
|
26 |
-
$stringId = icl_get_string_id( $label, self::STRINGS_CONTEXT, $this->getStringName( $taxId ) );
|
27 |
-
|
28 |
-
if ( ! $stringId ) {
|
29 |
-
$this->migrateStringToTaxIdName( $taxId, $label );
|
30 |
-
}
|
31 |
-
|
32 |
-
return icl_translate( self::STRINGS_CONTEXT, $this->getStringName( $taxId ), $label );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @param int $taxId
|
37 |
-
* @param array $taxRate
|
38 |
-
*/
|
39 |
-
public function registerLabelString( $taxId, $taxRate ) {
|
40 |
-
if ( ! empty( $taxRate['tax_rate_name'] ) ) {
|
41 |
-
$this->registerString( $taxId, $taxRate['tax_rate_name'] );
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @param int $taxId
|
47 |
-
* @param string $label
|
48 |
-
*
|
49 |
-
* @return int
|
50 |
-
*/
|
51 |
-
private function registerString( $taxId, $label ) {
|
52 |
-
return icl_register_string( self::STRINGS_CONTEXT, $this->getStringName( $taxId ), $label );
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* migration from WCML < 4.9.0
|
57 |
-
*
|
58 |
-
* @param int $taxId
|
59 |
-
* @param string $label
|
60 |
-
*/
|
61 |
-
private function migrateStringToTaxIdName( $taxId, $label ) {
|
62 |
-
$newStringId = $this->registerString( $taxId, $label );
|
63 |
-
|
64 |
-
$oldStringId = icl_get_string_id( $label, 'woocommerce taxes', $label );
|
65 |
-
|
66 |
-
$oldStringTranslations = icl_get_string_translations_by_id( $oldStringId );
|
67 |
-
|
68 |
-
foreach ( $oldStringTranslations as $languageCode => $translation ) {
|
69 |
-
icl_add_string_translation(
|
70 |
-
$newStringId,
|
71 |
-
$languageCode,
|
72 |
-
$translation['value'],
|
73 |
-
ICL_STRING_TRANSLATION_COMPLETE
|
74 |
-
);
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @param int $taxId
|
80 |
-
*
|
81 |
-
* @return string
|
82 |
-
*/
|
83 |
-
private function getStringName( $taxId ) {
|
84 |
-
return 'tax_label_' . $taxId;
|
85 |
-
}
|
86 |
-
|
87 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/User/Store/Cookie.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\User\Store;
|
4 |
-
|
5 |
-
|
6 |
-
class Cookie implements Strategy {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @var WPML_Cookie
|
10 |
-
*/
|
11 |
-
public $cookieHandler;
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Cookie constructor.
|
16 |
-
*
|
17 |
-
* @param \WPML_Cookie $cookieHandler
|
18 |
-
*/
|
19 |
-
public function __construct( \WPML_Cookie $cookieHandler ) {
|
20 |
-
$this->cookieHandler = $cookieHandler;
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param string $key
|
25 |
-
*
|
26 |
-
* @return mixed
|
27 |
-
*/
|
28 |
-
public function get( $key ) {
|
29 |
-
|
30 |
-
return $this->cookieHandler->get_cookie( $key );
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @param string $key
|
35 |
-
* @param mixed $value
|
36 |
-
*/
|
37 |
-
public function set( $key, $value ) {
|
38 |
-
|
39 |
-
if ( ! $this->cookieHandler->headers_sent() ) {
|
40 |
-
|
41 |
-
/**
|
42 |
-
* This filter hook allows to override the expiration cookie time.
|
43 |
-
*
|
44 |
-
* @since 4.11.0
|
45 |
-
*
|
46 |
-
* @param int 'expiration' Expiration cookie time.
|
47 |
-
* @param string $key The key operating the storage.
|
48 |
-
*/
|
49 |
-
$expiration = time() + (int) apply_filters( 'wcml_cookie_expiration', 48 * HOUR_IN_SECONDS, $key );
|
50 |
-
|
51 |
-
$this->cookieHandler->set_cookie( $key, $value, $expiration, COOKIEPATH, COOKIE_DOMAIN );
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/User/Store/Noop.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\User\Store;
|
4 |
-
|
5 |
-
|
6 |
-
class Noop {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @param string $key
|
10 |
-
*
|
11 |
-
* @return null
|
12 |
-
*/
|
13 |
-
public function get( $key ) {
|
14 |
-
return null;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function set( $key, $value ) {
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/User/Store/Store.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\User\Store;
|
4 |
-
|
5 |
-
|
6 |
-
class Store implements Strategy {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @param string $key
|
10 |
-
*
|
11 |
-
* @return mixed
|
12 |
-
*/
|
13 |
-
public function get( $key ) {
|
14 |
-
|
15 |
-
$key = $this->adjustKey( $key );
|
16 |
-
|
17 |
-
return $this->getStrategy( $key )->get( $key );
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @param string $key
|
22 |
-
* @param mixed $value
|
23 |
-
*/
|
24 |
-
public function set( $key, $value ) {
|
25 |
-
|
26 |
-
$key = $this->adjustKey( $key );
|
27 |
-
|
28 |
-
$this->getStrategy( $key )->set( $key, $value );
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @param string $key
|
33 |
-
*
|
34 |
-
* @return Strategy
|
35 |
-
*/
|
36 |
-
private function getStrategy( $key ) {
|
37 |
-
global $woocommerce;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* This filter hook allows to override the storage strategy.
|
41 |
-
*
|
42 |
-
* @since 4.11.0
|
43 |
-
*
|
44 |
-
* @param string 'wc-session' Storage strategy
|
45 |
-
* @param string $key The key operating the storage
|
46 |
-
*/
|
47 |
-
switch ( apply_filters( 'wcml_user_store_strategy', 'wc-session', $key ) ) {
|
48 |
-
case 'cookie':
|
49 |
-
$store = \WPML\Container\make( Cookie::class );
|
50 |
-
break;
|
51 |
-
|
52 |
-
case 'wc-session':
|
53 |
-
default:
|
54 |
-
$store = isset( $woocommerce->session ) ? new WcSession( $woocommerce->session ) : new Noop();
|
55 |
-
}
|
56 |
-
|
57 |
-
return $store;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @param string $key
|
62 |
-
*
|
63 |
-
* @return string $key
|
64 |
-
*/
|
65 |
-
private function adjustKey( $key ) {
|
66 |
-
|
67 |
-
$prefix = 'wcml_';
|
68 |
-
|
69 |
-
return strpos( $key, $prefix ) === 0 ? $key : $prefix . $key;
|
70 |
-
}
|
71 |
-
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/User/Store/Strategy.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\User\Store;
|
4 |
-
|
5 |
-
|
6 |
-
interface Strategy {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @param string $key
|
10 |
-
*
|
11 |
-
* @return mixed
|
12 |
-
*/
|
13 |
-
public function get( $key );
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param string $key
|
17 |
-
* @param mixed $value
|
18 |
-
*/
|
19 |
-
public function set( $key, $value );
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/User/Store/WcSession.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\User\Store;
|
4 |
-
|
5 |
-
|
6 |
-
class WcSession implements Strategy {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @var \WC_Session
|
10 |
-
*/
|
11 |
-
private $session;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* WcSession constructor.
|
15 |
-
*
|
16 |
-
* @param \WC_Session $session
|
17 |
-
*/
|
18 |
-
public function __construct( \WC_Session $session ) {
|
19 |
-
|
20 |
-
$this->session = $session;
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param string $key
|
25 |
-
*
|
26 |
-
* @return mixed
|
27 |
-
*/
|
28 |
-
public function get( $key ) {
|
29 |
-
|
30 |
-
return $this->session->get( $key );
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @param string $key
|
35 |
-
* @param mixed $value
|
36 |
-
*/
|
37 |
-
public function set( $key, $value ) {
|
38 |
-
|
39 |
-
$this->session->set( $key, $value );
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Utilities/Post.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Utilities;
|
4 |
-
|
5 |
-
use WPML\FP\Fns;
|
6 |
-
|
7 |
-
class Post {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* This allows to create new posts immediately in the
|
11 |
-
* correct language and the correct translation group (if any).
|
12 |
-
*
|
13 |
-
* @param array $args
|
14 |
-
* @param string|null $lang
|
15 |
-
* @param int|null $trid
|
16 |
-
*
|
17 |
-
* @return int|\WP_Error
|
18 |
-
*/
|
19 |
-
public static function insert( array $args, $lang = null, $trid = null ) {
|
20 |
-
$saveInLang = $saveWithTrid = null;
|
21 |
-
|
22 |
-
if ( $lang ) {
|
23 |
-
$saveInLang = Fns::always( $lang );
|
24 |
-
add_filter( 'wpml_save_post_lang', $saveInLang );
|
25 |
-
}
|
26 |
-
|
27 |
-
if ( $trid ) {
|
28 |
-
$saveWithTrid = Fns::always( $trid );
|
29 |
-
add_filter( 'wpml_save_post_trid_value', $saveWithTrid );
|
30 |
-
}
|
31 |
-
|
32 |
-
$newPostId = wp_insert_post( $args );
|
33 |
-
|
34 |
-
remove_filter( 'wpml_save_post_lang', $saveInLang );
|
35 |
-
remove_filter( 'wpml_save_post_trid_value', $saveWithTrid );
|
36 |
-
|
37 |
-
return $newPostId;
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/Utilities/Resources.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Utilities;
|
4 |
-
|
5 |
-
use function WPML\FP\partial;
|
6 |
-
|
7 |
-
class Resources {
|
8 |
-
// enqueueApp :: string $app -> ( string $localizeData )
|
9 |
-
public static function enqueueApp( $app ) {
|
10 |
-
return partial( [ '\WPML\LIB\WP\App\Resources', 'enqueue' ],
|
11 |
-
$app, WCML_PLUGIN_URL, WCML_PLUGIN_PATH, WCML_VERSION, 'woocommerce-multilingual'
|
12 |
-
);
|
13 |
-
}
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/ate/class-wcml-ate-activate-synchronization.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_ATE_Activate_Synchronization implements IWPML_Action, IWPML_Backend_Action_Loader {
|
4 |
-
public function add_hooks() {
|
5 |
-
if ( isset( $_GET['page'] ) && 'wpml-wcml' === $_GET['page'] ) {
|
6 |
-
add_filter( 'wpml_tm_load_ate_jobs_synchronization', '__return_true' );
|
7 |
-
}
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @return WCML_ATE_Activate_Synchronization
|
12 |
-
*/
|
13 |
-
public function create() {
|
14 |
-
return $this;
|
15 |
-
}
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/class-wcml-admin-cookie.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Admin_Cookie {
|
4 |
-
|
5 |
-
/** @var string */
|
6 |
-
private $name;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* WCML_Admin_Cookie constructor.
|
10 |
-
*
|
11 |
-
* @param $name
|
12 |
-
*/
|
13 |
-
public function __construct( $name ) {
|
14 |
-
$this->name = $name;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @param mixed $value
|
19 |
-
* @param int $expiration
|
20 |
-
*/
|
21 |
-
public function set_value( $value, $expiration = null ) {
|
22 |
-
if ( null === $expiration ) {
|
23 |
-
$expiration = time() + DAY_IN_SECONDS;
|
24 |
-
}
|
25 |
-
$this->handle_cache_plugins();
|
26 |
-
wc_setcookie( $this->name, $value, $expiration );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @return mixed
|
31 |
-
*/
|
32 |
-
public function get_value() {
|
33 |
-
$value = null;
|
34 |
-
if ( isset( $_COOKIE [ $this->name ] ) ) {
|
35 |
-
$value = $_COOKIE[ $this->name ];
|
36 |
-
}
|
37 |
-
return $value;
|
38 |
-
}
|
39 |
-
|
40 |
-
private function handle_cache_plugins() {
|
41 |
-
// @todo uncomment or delete when #wpmlcore-5796 is resolved
|
42 |
-
// do_action( 'wpsc_add_cookie', $this->name );
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/class-wcml-tracking-link.php
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Tracking_Link {
|
4 |
-
|
5 |
-
// WPML general links
|
6 |
-
const WPML_HOME = 'https://wpml.org/';
|
7 |
-
const WPML_SUPPORT = 'https://wpml.org/forums/forum/english-support/';
|
8 |
-
const WPML_ACCOUNT = 'https://wpml.org/shop/account/';
|
9 |
-
const WPML_AUTO_TRANSLATION_DOC = 'https://wpml.org/documentation/automatic-translation/';
|
10 |
-
|
11 |
-
// WCML general links
|
12 |
-
const WCML_MAIN_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/';
|
13 |
-
const WCML_MULTI_CURRENCY_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/';
|
14 |
-
const WCML_CLEAR_CART_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/clearing-cart-contents-when-language-or-currency-change/';
|
15 |
-
const WCML_DISPLAY_AS_TRANSLATED_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/displaying-untranslated-products-in-secondary-languages/';
|
16 |
-
|
17 |
-
// WCML compatibility links
|
18 |
-
const WCML_BOOKINGS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-bookings-woocommerce-multilingual/';
|
19 |
-
const WCML_PRODUCT_ADDONS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-product-add-ons-woocommerce-multilingual/';
|
20 |
-
const WCML_TAB_MANAGER_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-tab-manager-woocommerce-multilingual/';
|
21 |
-
const WCML_TABLE_RATE_SHIPPING_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-table-rate-shipping-woocommerce-multilingual/';
|
22 |
-
const WCML_SUBSCRIPTIONS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-subscriptions-woocommerce-multilingual/';
|
23 |
-
const WCML_CUSTOM_PRODUCT_TABS = 'https://wpml.org/plugin/custom-product-tabs-for-woocommerce/';
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @param string $link
|
27 |
-
* @param string|false $id e.g. '#some-section'
|
28 |
-
*
|
29 |
-
* @return string
|
30 |
-
*/
|
31 |
-
public static function generate( $link, $id = false ) {
|
32 |
-
$params = [
|
33 |
-
'utm_source' => 'plugin',
|
34 |
-
'utm_medium' => 'gui',
|
35 |
-
'utm_campaign' => 'wcml',
|
36 |
-
];
|
37 |
-
|
38 |
-
$link = add_query_arg( $params, $link );
|
39 |
-
|
40 |
-
if ( $id ) {
|
41 |
-
$link .= $id;
|
42 |
-
}
|
43 |
-
|
44 |
-
return $link;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public static function getWpmlHome() {
|
51 |
-
return self::generate( self::WPML_HOME );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
public static function getWpmlSupport() {
|
58 |
-
return self::generate( self::WPML_SUPPORT );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @return string
|
63 |
-
*/
|
64 |
-
public static function getWpmlAccount() {
|
65 |
-
return self::generate( self::WPML_ACCOUNT );
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @return string
|
70 |
-
*/
|
71 |
-
public static function getWpmlAutoTranslationDoc() {
|
72 |
-
return self::generate( self::WPML_AUTO_TRANSLATION_DOC );
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* @param false|string $id e.g. '#some-section'
|
77 |
-
*
|
78 |
-
* @return string
|
79 |
-
*/
|
80 |
-
public static function getWcmlMainDoc( $id = false ) {
|
81 |
-
return self::generate( self::WCML_MAIN_DOC, $id );
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* @param false|string $id e.g. '#some-section'
|
86 |
-
*
|
87 |
-
* @return string
|
88 |
-
*/
|
89 |
-
public static function getWcmlMultiCurrencyDoc( $id = false ) {
|
90 |
-
return self::generate( self::WCML_MULTI_CURRENCY_DOC, $id );
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* @return string
|
95 |
-
*/
|
96 |
-
public static function getWcmlClearCartDoc() {
|
97 |
-
return self::generate( self::WCML_CLEAR_CART_DOC );
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* @return string
|
102 |
-
*/
|
103 |
-
public static function getWcmlDisplayAsTranslatedDoc() {
|
104 |
-
return self::generate( self::WCML_DISPLAY_AS_TRANSLATED_DOC );
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* @return string
|
109 |
-
*/
|
110 |
-
public static function getWcmlBookingsDoc() {
|
111 |
-
return self::generate( self::WCML_BOOKINGS_DOC );
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* @return string
|
116 |
-
*/
|
117 |
-
public static function getWcmlProductAddonsDoc() {
|
118 |
-
return self::generate( self::WCML_PRODUCT_ADDONS_DOC );
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* @return string
|
123 |
-
*/
|
124 |
-
public static function getWcmlTabManagerDoc() {
|
125 |
-
return self::generate( self::WCML_TAB_MANAGER_DOC );
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* @return string
|
130 |
-
*/
|
131 |
-
public static function getWcmlTableRateShippingDoc() {
|
132 |
-
return self::generate( self::WCML_TABLE_RATE_SHIPPING_DOC );
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* @return string
|
137 |
-
*/
|
138 |
-
public static function getWcmlSubscriptionsDoc() {
|
139 |
-
return self::generate( self::WCML_SUBSCRIPTIONS_DOC );
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* @return string
|
144 |
-
*/
|
145 |
-
public static function getWcmlCustomProductTabs() {
|
146 |
-
return self::generate( self::WCML_CUSTOM_PRODUCT_TABS );
|
147 |
-
}
|
148 |
-
|
149 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/class-woocommerce-wpml.php
DELETED
@@ -1,489 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use function WPML\Container\make;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class woocommerce_wpml
|
7 |
-
*/
|
8 |
-
class woocommerce_wpml {
|
9 |
-
|
10 |
-
/** @var mixed|void Settings */
|
11 |
-
public $settings;
|
12 |
-
/** @var WCML_Troubleshooting */
|
13 |
-
public $troubleshooting;
|
14 |
-
/** @var WCML_Endpoints */
|
15 |
-
public $endpoints;
|
16 |
-
/** @var WCML_Products */
|
17 |
-
public $products;
|
18 |
-
/** @var WCML_Synchronize_Product_Data */
|
19 |
-
public $sync_product_data;
|
20 |
-
/** @var WCML_Synchronize_Variations_Data */
|
21 |
-
public $sync_variations_data;
|
22 |
-
/** @var WCML_Store_Pages */
|
23 |
-
public $store;
|
24 |
-
/** @var WCML_Emails */
|
25 |
-
public $emails;
|
26 |
-
/** @var WCML_Terms */
|
27 |
-
public $terms;
|
28 |
-
/** @var WCML_Attributes */
|
29 |
-
public $attributes;
|
30 |
-
/** @var WCML_Orders */
|
31 |
-
public $orders;
|
32 |
-
/** @var WCML_Currencies */
|
33 |
-
public $currencies;
|
34 |
-
/** @var WCML_Multi_Currency */
|
35 |
-
public $multi_currency;
|
36 |
-
/** @var WCML_Languages_Upgrader */
|
37 |
-
public $languages_upgrader;
|
38 |
-
/** @var WCML_Url_Translation */
|
39 |
-
public $url_translation;
|
40 |
-
/** @var WCML_Coupons */
|
41 |
-
public $coupons;
|
42 |
-
/** @var WCML_Locale */
|
43 |
-
public $locale;
|
44 |
-
/** @var WCML\Media\Wrapper\IMedia */
|
45 |
-
public $media;
|
46 |
-
/** @var WCML_Downloadable_Products */
|
47 |
-
public $downloadable;
|
48 |
-
/** @var WCML_WC_Strings */
|
49 |
-
public $strings;
|
50 |
-
/** @var WCML_WC_Shipping */
|
51 |
-
public $shipping;
|
52 |
-
/** @var WCML_WC_Gateways */
|
53 |
-
public $gateways;
|
54 |
-
/** @var WCML_Currency_Switcher_Templates */
|
55 |
-
public $cs_templates;
|
56 |
-
/** @var WCML_Comments */
|
57 |
-
public $comments;
|
58 |
-
/** @var WCML_Translation_Editor */
|
59 |
-
public $translation_editor;
|
60 |
-
/** @var WCML_Dependencies */
|
61 |
-
public $dependencies;
|
62 |
-
/** @var bool|int */
|
63 |
-
public $dependencies_are_ok;
|
64 |
-
/** @var WCML_Cart */
|
65 |
-
public $cart;
|
66 |
-
/** @var WCML_Cart_Sync_Warnings */
|
67 |
-
public $cart_sync_warnings;
|
68 |
-
|
69 |
-
/** @var WCML_Reports */
|
70 |
-
private $reports;
|
71 |
-
/** @var WCML_Requests */
|
72 |
-
public $requests;
|
73 |
-
// NOTE: reverted back to public after wcml-1218.
|
74 |
-
/** @var WCML_Compatibility */
|
75 |
-
public $compatibility;
|
76 |
-
/** @var WCML_Currency_Switcher_Properties|null $cs_properties */
|
77 |
-
public $cs_properties;
|
78 |
-
/** @var WCML_WC_Admin_Duplicate_Product|null $duplicate_product */
|
79 |
-
public $duplicate_product;
|
80 |
-
/** @var WCML_Page_Builders|null $page_builders */
|
81 |
-
public $page_builders;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @var WCML_Products_Screen_Options
|
85 |
-
*/
|
86 |
-
private $wcml_products_screen;
|
87 |
-
|
88 |
-
public function __construct() {
|
89 |
-
global $sitepress;
|
90 |
-
|
91 |
-
$this->settings = $this->get_settings();
|
92 |
-
$this->currencies = new WCML_Currencies( $this );
|
93 |
-
|
94 |
-
new WCML_Widgets( $this );
|
95 |
-
|
96 |
-
add_action( 'init', [ $this, 'init' ], 2 );
|
97 |
-
|
98 |
-
if ( defined( 'ICL_SITEPRESS_VERSION' ) && ! ICL_PLUGIN_INACTIVE && class_exists( 'SitePress' ) ) {
|
99 |
-
$this->cs_properties = new WCML_Currency_Switcher_Properties();
|
100 |
-
$wpml_wp_api = $sitepress->get_wp_api();
|
101 |
-
$this->cs_templates = new WCML_Currency_Switcher_Templates( $this, $wpml_wp_api, new WPML_File( $wpml_wp_api ) );
|
102 |
-
$this->cs_templates->init_hooks();
|
103 |
-
|
104 |
-
$wc_shortccode_product_category = new WCML_WC_Shortcode_Product_Category( $sitepress );
|
105 |
-
$wc_shortccode_product_category->add_hooks();
|
106 |
-
}
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
private function load_rest_api() {
|
111 |
-
global $sitepress;
|
112 |
-
|
113 |
-
if ( class_exists( 'WooCommerce' ) && defined( 'WC_VERSION' ) && ! is_null( $sitepress ) && WCML\Rest\Functions::isRestApiRequest() ) {
|
114 |
-
WCML\Rest\Hooks::addHooks();
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
public function add_hooks() {
|
119 |
-
add_action( 'wpml_loaded', [ $this, 'load' ] );
|
120 |
-
add_action( 'init', [ $this, 'init' ], 2 );
|
121 |
-
}
|
122 |
-
|
123 |
-
public function load() {
|
124 |
-
do_action( 'wcml_loaded' );
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Init class
|
129 |
-
*
|
130 |
-
* @return bool
|
131 |
-
*/
|
132 |
-
public function init() {
|
133 |
-
global $sitepress, $wpdb, $woocommerce, $wpml_url_converter, $wpml_post_translations, $wpml_term_translations;
|
134 |
-
|
135 |
-
$this->dependencies = new WCML_Dependencies();
|
136 |
-
$this->dependencies_are_ok = $this->dependencies->check();
|
137 |
-
|
138 |
-
WCML_Admin_Menus::set_up_menus( $this, $sitepress, $wpdb );
|
139 |
-
|
140 |
-
if ( ! $this->dependencies_are_ok ) {
|
141 |
-
$is_dashboard_page = isset( $_GET['page'] ) && 'wpml-wcml' === $_GET['page'];
|
142 |
-
if ( is_admin() && $is_dashboard_page ) {
|
143 |
-
WCML_Capabilities::set_up_capabilities();
|
144 |
-
|
145 |
-
wp_register_style( 'otgs-ico', WCML_PLUGIN_URL . '/res/css/otgs-ico.css', null, WCML_VERSION );
|
146 |
-
wp_enqueue_style( 'otgs-ico' );
|
147 |
-
|
148 |
-
WCML_Resources::load_management_css();
|
149 |
-
WCML_Resources::load_tooltip_resources();
|
150 |
-
}
|
151 |
-
return false;
|
152 |
-
}
|
153 |
-
|
154 |
-
new WCML_Upgrade();
|
155 |
-
|
156 |
-
$this->compatibility = new WCML_Compatibility( $sitepress, $this, $wpdb, new WPML_Element_Translation_Package(), $wpml_post_translations );
|
157 |
-
|
158 |
-
$actions_that_need_mc = [
|
159 |
-
'save-mc-options',
|
160 |
-
'wcml_save_currency',
|
161 |
-
'wcml_delete_currency',
|
162 |
-
'wcml_update_currency_lang',
|
163 |
-
'wcml_update_default_currency',
|
164 |
-
'wcml_price_preview',
|
165 |
-
'wcml_currencies_switcher_preview',
|
166 |
-
'wcml_currencies_switcher_save_settings',
|
167 |
-
'wcml_delete_currency_switcher',
|
168 |
-
'wcml_currencies_order',
|
169 |
-
'wcml_set_currency_mode',
|
170 |
-
'wcml_set_max_mind_key',
|
171 |
-
];
|
172 |
-
|
173 |
-
$this->cart = new WCML_Cart( $this, $sitepress, $woocommerce );
|
174 |
-
|
175 |
-
if ( WCML_MULTI_CURRENCIES_INDEPENDENT === (int) $this->settings['enable_multi_currency']
|
176 |
-
|| ( isset( $_GET['page'] ) && 'wpml-wcml' === $_GET['page'] && isset( $_GET['tab'] ) && 'multi-currency' === $_GET['tab'] )
|
177 |
-
|| ( isset( $_POST['action'] ) && in_array( $_POST['action'], $actions_that_need_mc, true ) )
|
178 |
-
) {
|
179 |
-
$this->get_multi_currency();
|
180 |
-
$wcml_price_filters = new WCML_Price_Filter( $this );
|
181 |
-
$wcml_price_filters->add_hooks();
|
182 |
-
} else {
|
183 |
-
add_shortcode( 'currency_switcher', '__return_empty_string' );
|
184 |
-
}
|
185 |
-
|
186 |
-
$this->currencies = new WCML_Currencies( $this );
|
187 |
-
$this->currencies->add_hooks();
|
188 |
-
|
189 |
-
$this->sync_variations_data = new WCML_Synchronize_Variations_Data( $this, $sitepress, $wpdb );
|
190 |
-
|
191 |
-
if ( is_admin() || wpml_is_rest_request() ) {
|
192 |
-
$this->translation_editor = new WCML_Translation_Editor( $this, $sitepress, $wpdb );
|
193 |
-
$this->translation_editor->add_hooks();
|
194 |
-
$tp_support = new WCML_TP_Support( $this, $wpdb, new WPML_Element_Translation_Package(), $sitepress->get_setting( 'translation-management', [] ) );
|
195 |
-
$tp_support->add_hooks();
|
196 |
-
}
|
197 |
-
|
198 |
-
if ( is_admin() ) {
|
199 |
-
$this->sync_variations_data->add_hooks();
|
200 |
-
$this->troubleshooting = new WCML_Troubleshooting( $this, $sitepress, $wpdb );
|
201 |
-
$this->languages_upgrader = new WCML_Languages_Upgrader();
|
202 |
-
$this->wcml_products_screen = new WCML_Products_Screen_Options();
|
203 |
-
$this->wcml_products_screen->init();
|
204 |
-
$wcml_pointers = new WCML_Pointers();
|
205 |
-
$wcml_pointers->add_hooks();
|
206 |
-
}
|
207 |
-
|
208 |
-
$this->sync_product_data = new WCML_Synchronize_Product_Data( $this, $sitepress, $wpml_post_translations, $wpdb );
|
209 |
-
$this->sync_product_data->add_hooks();
|
210 |
-
$this->duplicate_product = new WCML_WC_Admin_Duplicate_Product( $this, $sitepress, $wpdb );
|
211 |
-
$this->products = new WCML_Products( $this, $sitepress, $wpml_post_translations, $wpdb );
|
212 |
-
$this->products->add_hooks();
|
213 |
-
$this->store = new WCML_Store_Pages( $this, $sitepress );
|
214 |
-
$this->store->add_hooks();
|
215 |
-
$this->strings = new WCML_WC_Strings( $this, $sitepress, $wpdb );
|
216 |
-
$this->strings->add_hooks();
|
217 |
-
// do not pass mailer instance instead of $woocommerce
|
218 |
-
$this->emails = new WCML_Emails( $this->strings, $sitepress, $woocommerce, $wpdb );
|
219 |
-
$this->emails->add_hooks();
|
220 |
-
$this->terms = new WCML_Terms( $this, $sitepress, $wpdb );
|
221 |
-
$this->terms->add_hooks();
|
222 |
-
$this->attributes = new WCML_Attributes( $this, $sitepress, $wpml_post_translations, $wpml_term_translations, $wpdb );
|
223 |
-
$this->attributes->add_hooks();
|
224 |
-
$this->orders = new WCML_Orders( $this, $sitepress );
|
225 |
-
$this->shipping = new WCML_WC_Shipping( $sitepress, $this->strings );
|
226 |
-
$this->shipping->add_hooks();
|
227 |
-
$this->gateways = new WCML_WC_Gateways( $this, $sitepress );
|
228 |
-
$this->gateways->add_hooks();
|
229 |
-
$this->url_translation = new WCML_Url_Translation( $this, $sitepress, $wpdb );
|
230 |
-
$this->url_translation->set_up();
|
231 |
-
$this->endpoints = new WCML_Endpoints( $this, $sitepress, $wpdb );
|
232 |
-
$this->endpoints->add_hooks();
|
233 |
-
$this->requests = new WCML_Requests();
|
234 |
-
$this->cart->add_hooks(); // object is instantiated before.
|
235 |
-
$this->coupons = new WCML_Coupons( $this, $sitepress );
|
236 |
-
$this->coupons->add_hooks();
|
237 |
-
$this->locale = new WCML_Locale( $this, $sitepress );
|
238 |
-
$this->media = WCML\Media\Wrapper\Factory::create( $this );
|
239 |
-
$this->media->add_hooks();
|
240 |
-
$this->downloadable = new WCML_Downloadable_Products( $this, $sitepress );
|
241 |
-
$this->downloadable->add_hooks();
|
242 |
-
$this->page_builders = new WCML_Page_Builders( $sitepress );
|
243 |
-
$this->reports = new WCML_Reports();
|
244 |
-
$this->wcml_products_screen = new WCML_Products_Screen_Options();
|
245 |
-
$this->wcml_products_screen->init();
|
246 |
-
$this->cart_sync_warnings = new WCML_Cart_Sync_Warnings( $this, $sitepress );
|
247 |
-
$this->cart_sync_warnings->add_hooks();
|
248 |
-
$this->comments = new WCML_Comments( $this, $sitepress, $wpml_post_translations, $wpdb );
|
249 |
-
$this->comments->add_hooks();
|
250 |
-
|
251 |
-
if ( is_admin() ) {
|
252 |
-
$taxonomy_translation_link_filters = new WCML_Taxonomy_Translation_Link_Filters( $this->attributes );
|
253 |
-
$taxonomy_translation_link_filters->add_filters();
|
254 |
-
}
|
255 |
-
|
256 |
-
$payment_method_filter = new WCML_Payment_Method_Filter();
|
257 |
-
$payment_method_filter->add_hooks();
|
258 |
-
|
259 |
-
$wcml_ajax_setup = new WCML_Ajax_Setup( $sitepress );
|
260 |
-
$wcml_ajax_setup->add_hooks();
|
261 |
-
WCML_Install::initialize( $this, $sitepress );
|
262 |
-
|
263 |
-
WCML_Resources::set_up_resources( $this, $sitepress );
|
264 |
-
WCML_Resources::add_hooks();
|
265 |
-
|
266 |
-
$url_filters_redirect_location = new WCML_Url_Filters_Redirect_Location( $wpml_url_converter );
|
267 |
-
$url_filters_redirect_location->add_hooks();
|
268 |
-
|
269 |
-
add_action( 'wp_ajax_wcml_update_setting_ajx', [ $this, 'update_setting_ajx' ] );
|
270 |
-
|
271 |
-
$this->load_rest_api();
|
272 |
-
|
273 |
-
return true;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Get settings
|
278 |
-
*
|
279 |
-
* @return mixed|void
|
280 |
-
*/
|
281 |
-
public function get_settings() {
|
282 |
-
$defaults = [
|
283 |
-
'file_path_sync' => 1,
|
284 |
-
'is_term_order_synced' => 0,
|
285 |
-
'enable_multi_currency' => WCML_MULTI_CURRENCIES_DISABLED,
|
286 |
-
'dismiss_doc_main' => 0,
|
287 |
-
'trnsl_interface' => 1,
|
288 |
-
'currency_options' => [],
|
289 |
-
'currency_switcher_product_visibility' => 1,
|
290 |
-
'dismiss_tm_warning' => 0,
|
291 |
-
'dismiss_cart_warning' => 0,
|
292 |
-
'cart_sync' => [
|
293 |
-
'lang_switch' => WCML_CART_SYNC,
|
294 |
-
'currency_switch' => WCML_CART_SYNC,
|
295 |
-
],
|
296 |
-
];
|
297 |
-
|
298 |
-
if ( empty( $this->settings ) ) {
|
299 |
-
$this->settings = get_option( '_wcml_settings' );
|
300 |
-
}
|
301 |
-
|
302 |
-
foreach ( $defaults as $key => $value ) {
|
303 |
-
if ( ! isset( $this->settings[ $key ] ) ) {
|
304 |
-
$this->settings[ $key ] = $value;
|
305 |
-
}
|
306 |
-
}
|
307 |
-
|
308 |
-
return $this->settings;
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Get setting
|
313 |
-
*
|
314 |
-
* @param string $key
|
315 |
-
* @param null|string $default
|
316 |
-
*
|
317 |
-
* @return null|string
|
318 |
-
*/
|
319 |
-
public function get_setting( $key, $default = null ) {
|
320 |
-
if ( array_key_exists( $key, $this->settings ) ) {
|
321 |
-
return $this->settings[ $key ];
|
322 |
-
}
|
323 |
-
return get_option( 'wcml_' . $key, $default );
|
324 |
-
}
|
325 |
-
|
326 |
-
/**
|
327 |
-
* Update settings
|
328 |
-
*
|
329 |
-
* @param null|mixed $settings
|
330 |
-
*/
|
331 |
-
public function update_settings( $settings = null ) {
|
332 |
-
if ( ! is_null( $settings ) ) {
|
333 |
-
$this->settings = $settings;
|
334 |
-
}
|
335 |
-
update_option( '_wcml_settings', $this->settings );
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* @param string $key
|
340 |
-
* @param mixed $value
|
341 |
-
* @param bool|false $autoload It only applies to these settings stored as separate options.
|
342 |
-
*/
|
343 |
-
public function update_setting( $key, $value, $autoload = false ) {
|
344 |
-
if ( array_key_exists( $key, $this->settings ) ) {
|
345 |
-
$this->settings [ $key ] = $value;
|
346 |
-
$this->update_settings( $this->settings );
|
347 |
-
} else {
|
348 |
-
update_option( 'wcml_' . $key, $value, $autoload );
|
349 |
-
}
|
350 |
-
}
|
351 |
-
|
352 |
-
|
353 |
-
public function update_setting_ajx() {
|
354 |
-
$nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
355 |
-
if ( ! $nonce || ! wp_verify_nonce( $nonce, 'wcml_settings' ) ) {
|
356 |
-
die( 'Invalid nonce' );
|
357 |
-
}
|
358 |
-
|
359 |
-
$data = $_POST;
|
360 |
-
$error = '';
|
361 |
-
$html = '';
|
362 |
-
|
363 |
-
$this->settings[ $data['setting'] ] = $data['value'];
|
364 |
-
$this->update_settings();
|
365 |
-
|
366 |
-
echo wp_json_encode(
|
367 |
-
[
|
368 |
-
'html' => $html,
|
369 |
-
'error' => $error,
|
370 |
-
]
|
371 |
-
);
|
372 |
-
exit;
|
373 |
-
}
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Get latest stable version from WC readme.txt
|
377 |
-
*
|
378 |
-
* @return string
|
379 |
-
*/
|
380 |
-
public function get_stable_wc_version() {
|
381 |
-
/** @var $woocommerce WooCommerce */
|
382 |
-
global $woocommerce;
|
383 |
-
|
384 |
-
$file = $woocommerce->plugin_path() . '/readme.txt';
|
385 |
-
$values = file( $file );
|
386 |
-
$wc_info = explode( ':', $values[5] );
|
387 |
-
$version = '';
|
388 |
-
|
389 |
-
if ( 'Stable tag' === $wc_info[0] ) {
|
390 |
-
$version = trim( $wc_info[1] );
|
391 |
-
} else {
|
392 |
-
foreach ( $values as $value ) {
|
393 |
-
$wc_info = explode( ':', $value );
|
394 |
-
|
395 |
-
if ( 'Stable tag' === $wc_info[0] ) {
|
396 |
-
$version = trim( $wc_info[1] );
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
|
401 |
-
return $version;
|
402 |
-
}
|
403 |
-
|
404 |
-
/**
|
405 |
-
* Get supported WP version from readme.txt
|
406 |
-
*
|
407 |
-
* @return string
|
408 |
-
*/
|
409 |
-
public function get_supported_wp_version() {
|
410 |
-
$file = WCML_PLUGIN_PATH . '/readme.txt';
|
411 |
-
|
412 |
-
$values = file( $file );
|
413 |
-
|
414 |
-
$version = explode( ':', $values[6] );
|
415 |
-
|
416 |
-
if ( 'Tested up to' === $version[0] ) {
|
417 |
-
return $version[1];
|
418 |
-
}
|
419 |
-
|
420 |
-
foreach ( $values as $value ) {
|
421 |
-
$version = explode( ':', $value );
|
422 |
-
|
423 |
-
if ( 'Tested up to' === $version[0] ) {
|
424 |
-
return $version[1];
|
425 |
-
}
|
426 |
-
}
|
427 |
-
|
428 |
-
return '';
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* @return array
|
433 |
-
*/
|
434 |
-
public function get_wc_query_vars() {
|
435 |
-
return WooCommerce::instance()->query->query_vars;
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* @return WCML_Multi_Currency
|
440 |
-
*/
|
441 |
-
public function get_multi_currency() {
|
442 |
-
if ( ! isset( $this->multi_currency ) ) {
|
443 |
-
$this->multi_currency = make( WCML_Multi_Currency::class );
|
444 |
-
}
|
445 |
-
return $this->multi_currency;
|
446 |
-
}
|
447 |
-
|
448 |
-
/**
|
449 |
-
* @return string
|
450 |
-
*/
|
451 |
-
public function version() {
|
452 |
-
return get_option( '_wcml_version' );
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* @return string
|
457 |
-
*/
|
458 |
-
public function plugin_url() {
|
459 |
-
return WCML_PLUGIN_URL;
|
460 |
-
}
|
461 |
-
|
462 |
-
/**
|
463 |
-
* @return string
|
464 |
-
*/
|
465 |
-
public function js_min_suffix() {
|
466 |
-
return WCML_JS_MIN;
|
467 |
-
}
|
468 |
-
|
469 |
-
/**
|
470 |
-
* @return bool
|
471 |
-
*/
|
472 |
-
public function is_wpml_prior_4_2() {
|
473 |
-
global $sitepress;
|
474 |
-
|
475 |
-
return $sitepress->get_wp_api()->version_compare( $this->get_constant( 'ICL_SITEPRESS_VERSION' ), '4.2.0', '<' ) ||
|
476 |
-
$sitepress->get_wp_api()->version_compare( $this->get_constant( 'WPML_TM_VERSION' ), '2.8.0', '<' );
|
477 |
-
}
|
478 |
-
|
479 |
-
/**
|
480 |
-
* @param string $name
|
481 |
-
*
|
482 |
-
* @return int|string
|
483 |
-
*/
|
484 |
-
private function get_constant( $name ) {
|
485 |
-
global $sitepress;
|
486 |
-
|
487 |
-
return $sitepress->get_wp_api()->constant( $name );
|
488 |
-
}
|
489 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/currencies/class-wcml-admin-currency-selector.php
DELETED
@@ -1,163 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WCML_Admin_Currency_Selector
|
4 |
-
*/
|
5 |
-
class WCML_Admin_Currency_Selector {
|
6 |
-
|
7 |
-
/** @var woocommerce_wpml */
|
8 |
-
private $woocommerce_wpml;
|
9 |
-
/** @var WCML_Admin_Cookie */
|
10 |
-
private $currency_cookie;
|
11 |
-
|
12 |
-
const NONCE_KEY = 'wcml-admin-currency-selector';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* WCML_Admin_Currency_Selector constructor.
|
16 |
-
*
|
17 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
18 |
-
* @param WCML_Admin_Cookie $currency_cookie
|
19 |
-
*/
|
20 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml, WCML_Admin_Cookie $currency_cookie ) {
|
21 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
-
$this->currency_cookie = $currency_cookie;
|
23 |
-
}
|
24 |
-
|
25 |
-
public function add_hooks() {
|
26 |
-
global $pagenow;
|
27 |
-
|
28 |
-
if ( is_admin() ) {
|
29 |
-
|
30 |
-
if ( $this->user_can_manage_woocommerce() ) {
|
31 |
-
add_action( 'init', [ $this, 'set_dashboard_currency' ] );
|
32 |
-
add_action( 'wp_ajax_wcml_dashboard_set_currency', [ $this, 'set_dashboard_currency_ajax' ] );
|
33 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_dashboard_currency_symbol' ] );
|
34 |
-
}
|
35 |
-
|
36 |
-
add_action(
|
37 |
-
'woocommerce_after_dashboard_status_widget',
|
38 |
-
[
|
39 |
-
$this,
|
40 |
-
'show_dashboard_currency_selector',
|
41 |
-
]
|
42 |
-
);
|
43 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'load_js' ] );
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @return bool
|
49 |
-
*/
|
50 |
-
private function user_can_manage_woocommerce() {
|
51 |
-
return current_user_can( 'view_woocommerce_reports' ) ||
|
52 |
-
current_user_can( 'manage_woocommerce' ) ||
|
53 |
-
current_user_can( 'publish_shop_orders' );
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
public function load_js() {
|
58 |
-
wp_enqueue_script(
|
59 |
-
'wcml-admin-currency-selector',
|
60 |
-
$this->woocommerce_wpml->plugin_url() .
|
61 |
-
'/res/js/admin-currency-selector' . $this->woocommerce_wpml->js_min_suffix() . '.js',
|
62 |
-
[ 'jquery' ],
|
63 |
-
$this->woocommerce_wpml->version(),
|
64 |
-
true
|
65 |
-
);
|
66 |
-
wp_localize_script(
|
67 |
-
'wcml-admin-currency-selector',
|
68 |
-
'wcml_admin_currency_selector',
|
69 |
-
[
|
70 |
-
'nonce' => wp_create_nonce( self::NONCE_KEY ),
|
71 |
-
]
|
72 |
-
);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Add currency drop-down on dashboard page ( WooCommerce status block )
|
77 |
-
*/
|
78 |
-
public function show_dashboard_currency_selector() {
|
79 |
-
|
80 |
-
$current_dashboard_currency = $this->get_cookie_dashboard_currency();
|
81 |
-
|
82 |
-
$wc_currencies = get_woocommerce_currencies();
|
83 |
-
$currency_codes = $this->woocommerce_wpml->multi_currency->get_currency_codes();
|
84 |
-
?>
|
85 |
-
<select id="dropdown_dashboard_currency" style="display: none; margin : 10px; ">
|
86 |
-
<?php if ( empty( $currency_codes ) ) : ?>
|
87 |
-
<option value=""><?php _e( 'Currency - no orders found', 'woocommerce-multilingual' ); ?></option>
|
88 |
-
<?php else : ?>
|
89 |
-
<?php foreach ( $currency_codes as $currency ) : ?>
|
90 |
-
|
91 |
-
<option value="<?php echo esc_html( $currency ); ?>" <?php echo esc_html( $current_dashboard_currency === $currency ? 'selected="selected"' : '' ); ?>>
|
92 |
-
<?php echo esc_html( $wc_currencies[ $currency ] ); ?>
|
93 |
-
</option>
|
94 |
-
|
95 |
-
<?php endforeach; ?>
|
96 |
-
<?php endif; ?>
|
97 |
-
</select>
|
98 |
-
<?php
|
99 |
-
}
|
100 |
-
|
101 |
-
public function set_dashboard_currency_ajax() {
|
102 |
-
$nonce = sanitize_text_field( $_POST['wcml_nonce'] );
|
103 |
-
|
104 |
-
if ( ! $nonce || ! wp_verify_nonce( $nonce, self::NONCE_KEY ) ) {
|
105 |
-
wp_send_json_error( __( 'Invalid nonce', 'woocommerce-multilingual' ), 403 );
|
106 |
-
} else {
|
107 |
-
$this->set_dashboard_currency( sanitize_text_field( $_POST['currency'] ) );
|
108 |
-
wp_send_json_success();
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Set dashboard currency cookie
|
114 |
-
*
|
115 |
-
* @param string $currency_code
|
116 |
-
*/
|
117 |
-
public function set_dashboard_currency( $currency_code = '' ) {
|
118 |
-
global $pagenow;
|
119 |
-
|
120 |
-
if ( ! $currency_code && 'index.php' === $pagenow && ! headers_sent() ) {
|
121 |
-
$currency_code = $this->woocommerce_wpml->multi_currency->get_currency_code();
|
122 |
-
}
|
123 |
-
|
124 |
-
if ( $currency_code ) {
|
125 |
-
$this->currency_cookie->set_value( $currency_code, time() + DAY_IN_SECONDS );
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Get dashboard currency cookie
|
131 |
-
*
|
132 |
-
* @return string
|
133 |
-
*/
|
134 |
-
public function get_cookie_dashboard_currency() {
|
135 |
-
|
136 |
-
$currency = $this->currency_cookie->get_value();
|
137 |
-
if ( null === $currency ) {
|
138 |
-
$currency = wcml_get_woocommerce_currency_option();
|
139 |
-
}
|
140 |
-
|
141 |
-
return $currency;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Filter currency symbol on dashboard page
|
146 |
-
*
|
147 |
-
* @param string $currency Currency code
|
148 |
-
*
|
149 |
-
* @return string
|
150 |
-
*/
|
151 |
-
public function filter_dashboard_currency_symbol( $currency ) {
|
152 |
-
global $pagenow;
|
153 |
-
|
154 |
-
remove_filter( 'woocommerce_currency_symbol', [ $this, 'filter_dashboard_currency_symbol' ] );
|
155 |
-
if ( 'index.php' === $pagenow && isset( $_COOKIE ['_wcml_dashboard_currency'] ) ) {
|
156 |
-
$currency = get_woocommerce_currency_symbol( $_COOKIE ['_wcml_dashboard_currency'] );
|
157 |
-
}
|
158 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_dashboard_currency_symbol' ] );
|
159 |
-
|
160 |
-
return $currency;
|
161 |
-
}
|
162 |
-
|
163 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/currencies/class-wcml-currencies.php
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Currencies
|
5 |
-
*/
|
6 |
-
class WCML_Currencies {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* The \woocommerce_wpml instance.
|
10 |
-
*
|
11 |
-
* @var \woocommerce_wpml
|
12 |
-
*/
|
13 |
-
private $woocommerce_wpml;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* WCML_Currencies constructor.
|
17 |
-
*
|
18 |
-
* @param \woocommerce_wpml $woocommerce_wpml And instance of \woocommerce_wpml.
|
19 |
-
*/
|
20 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml ) {
|
21 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* It hooks to `update_option_woocommerce_currency` if the conditions are right.
|
26 |
-
*/
|
27 |
-
public function add_hooks() {
|
28 |
-
if ( is_admin() ) {
|
29 |
-
add_action(
|
30 |
-
'update_option_woocommerce_currency',
|
31 |
-
[
|
32 |
-
$this,
|
33 |
-
'setup_multi_currency_on_currency_update',
|
34 |
-
],
|
35 |
-
10,
|
36 |
-
2
|
37 |
-
);
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* It sets the default currency for each language.
|
43 |
-
*
|
44 |
-
* @param string $old_value The value of the option before the update.
|
45 |
-
* @param string $new_value The new value of the option.
|
46 |
-
*/
|
47 |
-
public function setup_multi_currency_on_currency_update( $old_value, $new_value ) {
|
48 |
-
if ( wcml_is_multi_currency_on() ) {
|
49 |
-
$multi_currency_install = new WCML_Multi_Currency_Install( new WCML_Multi_Currency(), $this->woocommerce_wpml );
|
50 |
-
$multi_currency_install->set_default_currencies_languages( $old_value, $new_value );
|
51 |
-
} else {
|
52 |
-
$currency_options = $this->woocommerce_wpml->get_setting( 'currency_options' );
|
53 |
-
if ( isset( $currency_options[ $old_value ] ) ) {
|
54 |
-
$currency_options[ $new_value ] = $currency_options[ $old_value ];
|
55 |
-
unset( $currency_options[ $old_value ] );
|
56 |
-
$this->woocommerce_wpml->update_setting( 'currency_options', $currency_options );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/Wrapper/Factory.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Media\Wrapper;
|
4 |
-
|
5 |
-
use WCML\Media\Wrapper\Translatable;
|
6 |
-
use woocommerce_wpml;
|
7 |
-
use WPML_Element_Sync_Settings_Factory;
|
8 |
-
|
9 |
-
class Factory {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* @return IMedia
|
13 |
-
*/
|
14 |
-
public static function create( woocommerce_wpml $woocommerce_wpml ) {
|
15 |
-
/**
|
16 |
-
* @var \SitePress $sitepress
|
17 |
-
* @var \wpdb $wpdb
|
18 |
-
*/
|
19 |
-
global $sitepress, $wpdb;
|
20 |
-
|
21 |
-
$settingsFactory = new WPML_Element_Sync_Settings_Factory();
|
22 |
-
|
23 |
-
if ( $settingsFactory->create( 'post' )->is_sync( 'attachment' ) ) {
|
24 |
-
return new Translatable( $woocommerce_wpml, $sitepress, $wpdb );
|
25 |
-
}
|
26 |
-
|
27 |
-
return new NonTranslatable();
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/Wrapper/IMedia.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Media\Wrapper;
|
4 |
-
|
5 |
-
interface IMedia {
|
6 |
-
|
7 |
-
public function add_hooks();
|
8 |
-
|
9 |
-
/**
|
10 |
-
* This method will return only translatable image IDs
|
11 |
-
*
|
12 |
-
* @param int $product_id
|
13 |
-
*
|
14 |
-
* @return array
|
15 |
-
*/
|
16 |
-
public function product_images_ids( $product_id );
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @param int $orig_post_id
|
20 |
-
* @param int $trnsl_post_id
|
21 |
-
* @param string $lang
|
22 |
-
*/
|
23 |
-
public function sync_thumbnail_id( $orig_post_id, $trnsl_post_id, $lang );
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @param int $variation_id
|
27 |
-
* @param int $translated_variation_id
|
28 |
-
* @param string $lang
|
29 |
-
*/
|
30 |
-
public function sync_variation_thumbnail_id( $variation_id, $translated_variation_id, $lang );
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @param int $product_id
|
34 |
-
*/
|
35 |
-
public function sync_product_gallery( $product_id );
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @param int $attachment_id
|
39 |
-
* @param int $parent_id
|
40 |
-
* @param string $target_lang
|
41 |
-
*
|
42 |
-
* @return int
|
43 |
-
*/
|
44 |
-
public function create_base_media_translation( $attachment_id, $parent_id, $target_lang );
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @param int $att_id
|
48 |
-
* @param int $dup_att_id
|
49 |
-
*/
|
50 |
-
public function sync_product_gallery_duplicate_attachment( $att_id, $dup_att_id );
|
51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/Wrapper/NonTranslatable.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Media\Wrapper;
|
4 |
-
|
5 |
-
class NonTranslatable implements IMedia {
|
6 |
-
|
7 |
-
public function add_hooks() {}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param int $product_id
|
11 |
-
*
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
public function product_images_ids( $product_id ) {
|
15 |
-
return [];
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @param int $orig_post_id
|
20 |
-
* @param int $trnsl_post_id
|
21 |
-
* @param string $lang
|
22 |
-
*/
|
23 |
-
public function sync_thumbnail_id( $orig_post_id, $trnsl_post_id, $lang ) {}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @param int $variation_id
|
27 |
-
* @param int $translated_variation_id
|
28 |
-
* @param string $lang
|
29 |
-
*/
|
30 |
-
public function sync_variation_thumbnail_id( $variation_id, $translated_variation_id, $lang ) {}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @param int $product_id
|
34 |
-
*/
|
35 |
-
public function sync_product_gallery( $product_id ) {}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @param int $attachment_id
|
39 |
-
* @param int $parent_id
|
40 |
-
* @param string $target_lang
|
41 |
-
*
|
42 |
-
* @return int
|
43 |
-
*/
|
44 |
-
public function create_base_media_translation( $attachment_id, $parent_id, $target_lang ) {
|
45 |
-
return 0;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @param int $att_id
|
50 |
-
* @param int $dup_att_id
|
51 |
-
*/
|
52 |
-
public function sync_product_gallery_duplicate_attachment( $att_id, $dup_att_id ) {}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/Wrapper/Translatable.php
DELETED
@@ -1,220 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Media\Wrapper;
|
4 |
-
|
5 |
-
use SitePress;
|
6 |
-
use woocommerce_wpml;
|
7 |
-
use wpdb;
|
8 |
-
use WPML_Media_Attachments_Duplication_Factory;
|
9 |
-
|
10 |
-
class Translatable implements IMedia {
|
11 |
-
|
12 |
-
/** @var woocommerce_wpml */
|
13 |
-
private $woocommerce_wpml;
|
14 |
-
/** @var SitePress */
|
15 |
-
private $sitepress;
|
16 |
-
/** @var wpdb */
|
17 |
-
private $wpdb;
|
18 |
-
|
19 |
-
public $settings = [];
|
20 |
-
|
21 |
-
private $products_being_synced = [];
|
22 |
-
|
23 |
-
public function __construct( $woocommerce_wpml, $sitepress, $wpdb ) {
|
24 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
25 |
-
$this->sitepress = $sitepress;
|
26 |
-
$this->wpdb = $wpdb;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function add_hooks() {
|
30 |
-
// when save new attachment duplicate product gallery.
|
31 |
-
add_action( 'wpml_media_create_duplicate_attachment', [ $this, 'sync_product_gallery_duplicate_attachment' ], 11, 2 );
|
32 |
-
}
|
33 |
-
|
34 |
-
public function product_images_ids( $product_id ) {
|
35 |
-
$product_images_ids = [];
|
36 |
-
|
37 |
-
// thumbnail image.
|
38 |
-
$tmb = get_post_meta( $product_id, '_thumbnail_id', true );
|
39 |
-
if ( $tmb ) {
|
40 |
-
$product_images_ids[] = $tmb;
|
41 |
-
}
|
42 |
-
|
43 |
-
// product gallery.
|
44 |
-
$product_gallery = get_post_meta( $product_id, '_product_image_gallery', true );
|
45 |
-
if ( $product_gallery ) {
|
46 |
-
$product_gallery = explode( ',', $product_gallery );
|
47 |
-
foreach ( $product_gallery as $img ) {
|
48 |
-
if ( ! in_array( $img, $product_images_ids ) ) {
|
49 |
-
$product_images_ids[] = $img;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
foreach ( wp_get_post_terms( $product_id, 'product_type', [ 'fields' => 'names' ] ) as $type ) {
|
55 |
-
$product_type = $type;
|
56 |
-
}
|
57 |
-
|
58 |
-
if ( isset( $product_type ) && 'variable' === $product_type ) {
|
59 |
-
$get_post_variations_image = $this->wpdb->get_col(
|
60 |
-
$this->wpdb->prepare(
|
61 |
-
"SELECT pm.meta_value FROM {$this->wpdb->posts} AS p
|
62 |
-
LEFT JOIN {$this->wpdb->postmeta} AS pm ON p.ID = pm.post_id
|
63 |
-
WHERE pm.meta_key='_thumbnail_id'
|
64 |
-
AND p.post_status IN ('publish','private')
|
65 |
-
AND p.post_type = 'product_variation'
|
66 |
-
AND p.post_parent = %d
|
67 |
-
ORDER BY ID",
|
68 |
-
$product_id
|
69 |
-
)
|
70 |
-
);
|
71 |
-
foreach ( $get_post_variations_image as $variation_image ) {
|
72 |
-
if ( $variation_image && ! in_array( $variation_image, $product_images_ids ) ) {
|
73 |
-
$product_images_ids[] = $variation_image;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
foreach ( $product_images_ids as $key => $image ) {
|
79 |
-
if ( ! get_post_status( $image ) ) {
|
80 |
-
unset( $product_images_ids[ $key ] );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
return $product_images_ids;
|
85 |
-
}
|
86 |
-
|
87 |
-
public function sync_thumbnail_id( $original_product_id, $translated_product_id, $language ) {
|
88 |
-
|
89 |
-
if ( $this->is_thumbnail_image_duplication_enabled( $original_product_id ) ) {
|
90 |
-
$translated_thumbnail_id = $this->get_translated_thumbnail_id( $original_product_id, $language );
|
91 |
-
if ( $translated_thumbnail_id ) {
|
92 |
-
update_post_meta( $translated_product_id, '_thumbnail_id', $translated_thumbnail_id );
|
93 |
-
}
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
public function sync_variation_thumbnail_id( $variation_id, $translated_variation_id, $language ) {
|
98 |
-
|
99 |
-
if ( $this->is_thumbnail_image_duplication_enabled( wp_get_post_parent_id( $variation_id ) ) ) {
|
100 |
-
$translated_thumbnail_id = $this->get_translated_thumbnail_id( $variation_id, $language );
|
101 |
-
if ( $translated_thumbnail_id ) {
|
102 |
-
update_post_meta( $translated_variation_id, '_thumbnail_id', $translated_thumbnail_id );
|
103 |
-
update_post_meta( $variation_id, '_wpml_media_duplicate', 1 );
|
104 |
-
update_post_meta( $variation_id, '_wpml_media_featured', 1 );
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* @param int|string $post_id
|
111 |
-
* @param string $language
|
112 |
-
*
|
113 |
-
* @return int|null
|
114 |
-
*/
|
115 |
-
private function get_translated_thumbnail_id( $post_id, $language ) {
|
116 |
-
$thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
|
117 |
-
$translated_thumbnail_id = $this->sitepress->get_object_id( $thumbnail_id, 'attachment', false, $language );
|
118 |
-
|
119 |
-
if ( is_null( $translated_thumbnail_id ) && $thumbnail_id ) {
|
120 |
-
$factory = new WPML_Media_Attachments_Duplication_Factory();
|
121 |
-
$media_duplicate = $factory->create();
|
122 |
-
$translated_thumbnail_id = $media_duplicate->create_duplicate_attachment(
|
123 |
-
$thumbnail_id,
|
124 |
-
wp_get_post_parent_id( $thumbnail_id ),
|
125 |
-
$language
|
126 |
-
);
|
127 |
-
}
|
128 |
-
|
129 |
-
return $translated_thumbnail_id;
|
130 |
-
}
|
131 |
-
|
132 |
-
public function sync_product_gallery( $product_id ) {
|
133 |
-
|
134 |
-
if ( $this->is_media_duplication_enabled( $product_id ) ) {
|
135 |
-
$product_gallery = get_post_meta( $product_id, '_product_image_gallery', true );
|
136 |
-
$gallery_ids = explode( ',', $product_gallery );
|
137 |
-
|
138 |
-
$trid = $this->sitepress->get_element_trid( $product_id, 'post_product' );
|
139 |
-
$translations = $this->sitepress->get_element_translations( $trid, 'post_product', true );
|
140 |
-
foreach ( $translations as $translation ) {
|
141 |
-
$duplicated_ids = '';
|
142 |
-
if ( ! $translation->original ) {
|
143 |
-
foreach ( $gallery_ids as $image_id ) {
|
144 |
-
if ( get_post( $image_id ) ) {
|
145 |
-
$duplicated_id = apply_filters(
|
146 |
-
'translate_object_id',
|
147 |
-
$image_id,
|
148 |
-
'attachment',
|
149 |
-
false,
|
150 |
-
$translation->language_code
|
151 |
-
);
|
152 |
-
if ( is_null( $duplicated_id ) && $image_id ) {
|
153 |
-
$duplicated_id = $this->create_base_media_translation(
|
154 |
-
$image_id,
|
155 |
-
$translation->element_id,
|
156 |
-
$translation->language_code
|
157 |
-
);
|
158 |
-
}
|
159 |
-
$duplicated_ids .= $duplicated_id . ',';
|
160 |
-
}
|
161 |
-
}
|
162 |
-
$duplicated_ids = substr( $duplicated_ids, 0, strlen( $duplicated_ids ) - 1 );
|
163 |
-
update_post_meta( $translation->element_id, '_product_image_gallery', $duplicated_ids );
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
public function create_base_media_translation( $attachment_id, $parent_id, $target_lang ) {
|
170 |
-
|
171 |
-
$factory = new WPML_Media_Attachments_Duplication_Factory();
|
172 |
-
$media_duplicate = $factory->create();
|
173 |
-
$duplicated_id = $media_duplicate->create_duplicate_attachment( $attachment_id, $parent_id, $target_lang );
|
174 |
-
|
175 |
-
return $duplicated_id;
|
176 |
-
}
|
177 |
-
|
178 |
-
public function sync_product_gallery_duplicate_attachment( $att_id, $dup_att_id ) {
|
179 |
-
$product_id = wp_get_post_parent_id( $att_id );
|
180 |
-
$post_type = get_post_type( $product_id );
|
181 |
-
if ( 'product' !== $post_type || array_key_exists( $product_id, $this->products_being_synced ) ) {
|
182 |
-
return;
|
183 |
-
}
|
184 |
-
$this->products_being_synced[ $product_id ] = 1;
|
185 |
-
$this->sync_product_gallery( $product_id );
|
186 |
-
unset( $this->products_being_synced[ $product_id ] );
|
187 |
-
}
|
188 |
-
|
189 |
-
private function is_thumbnail_image_duplication_enabled( $product_id ) {
|
190 |
-
return $this->is_duplication_enabled( $product_id, 'WPML_Admin_Post_Actions::DUPLICATE_FEATURED_META_KEY', 'WPML_Admin_Post_Actions::DUPLICATE_FEATURED_GLOBAL_KEY' );
|
191 |
-
}
|
192 |
-
|
193 |
-
private function is_media_duplication_enabled( $product_id ) {
|
194 |
-
return $this->is_duplication_enabled( $product_id, 'WPML_Admin_Post_Actions::DUPLICATE_MEDIA_META_KEY', 'WPML_Admin_Post_Actions::DUPLICATE_MEDIA_GLOBAL_KEY' );
|
195 |
-
}
|
196 |
-
|
197 |
-
private function is_duplication_enabled( $product_id, $meta_key, $global_key ) {
|
198 |
-
|
199 |
-
$setting_value = get_post_meta(
|
200 |
-
$product_id,
|
201 |
-
$this->sitepress->get_wp_api()
|
202 |
-
->constant( $meta_key ),
|
203 |
-
true
|
204 |
-
);
|
205 |
-
|
206 |
-
if ( '' === $setting_value ) {
|
207 |
-
// fallback to global setting.
|
208 |
-
$media_options = get_option( '_wpml_media', [] );
|
209 |
-
|
210 |
-
$global_setting_key = $this->sitepress->get_wp_api()
|
211 |
-
->constant( $global_key );
|
212 |
-
if ( isset( $media_options['new_content_settings'][ $global_setting_key ] ) ) {
|
213 |
-
$setting_value = $media_options['new_content_settings'][ $global_setting_key ];
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
return (bool) $setting_value;
|
218 |
-
}
|
219 |
-
|
220 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-product-gallery-filter-factory.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Product_Gallery_Filter_Factory implements IWPML_Frontend_Action_Loader {
|
4 |
-
|
5 |
-
public function create() {
|
6 |
-
global $sitepress, $woocommerce_wpml;
|
7 |
-
|
8 |
-
if ( $woocommerce_wpml->get_setting( 'sync_media', true ) ) {
|
9 |
-
return new WCML_Product_Gallery_Filter( new WPML_Translation_Element_Factory( $sitepress ) );
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-product-gallery-filter.php
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Product_Gallery_Filter implements IWPML_Action {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var WPML_Translation_Element_Factory
|
7 |
-
*/
|
8 |
-
private $translation_element_factory;
|
9 |
-
/** @var WPML_WP_Cache */
|
10 |
-
private $wpml_cache;
|
11 |
-
|
12 |
-
public function __construct( WPML_Translation_Element_Factory $translation_element_factory, $wpml_cache = null ) {
|
13 |
-
$this->translation_element_factory = $translation_element_factory;
|
14 |
-
|
15 |
-
$cache_group = 'WCML_Product_Gallery_Filter';
|
16 |
-
$this->wpml_cache = $wpml_cache;
|
17 |
-
if ( null === $wpml_cache ) {
|
18 |
-
$this->wpml_cache = new WPML_WP_Cache( $cache_group );
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
public function add_hooks() {
|
23 |
-
add_filter( 'get_post_metadata', [ $this, 'localize_image_ids' ], 10, 3 );
|
24 |
-
}
|
25 |
-
|
26 |
-
public function localize_image_ids( $value, $object_id, $meta_key ) {
|
27 |
-
|
28 |
-
$image_ids = false;
|
29 |
-
if ( '_product_image_gallery' === $meta_key &&
|
30 |
-
in_array( get_post_type( $object_id ), [ 'product', 'product_variation' ] ) ) {
|
31 |
-
|
32 |
-
$cache_key = $object_id . '_image_gallery';
|
33 |
-
$found = false;
|
34 |
-
$image_ids = $this->wpml_cache->get( $cache_key, $found );
|
35 |
-
|
36 |
-
if ( ! $image_ids ) {
|
37 |
-
|
38 |
-
remove_filter( 'get_post_metadata', [ $this, 'localize_image_ids' ], 10 );
|
39 |
-
|
40 |
-
$meta_value = [];
|
41 |
-
|
42 |
-
$post_element = $this->translation_element_factory->create( $object_id, 'post' );
|
43 |
-
$source_element = $post_element->get_source_element();
|
44 |
-
if ( null !== $source_element ) {
|
45 |
-
$original_gallery_value = get_post_meta( $source_element->get_id(), '_product_image_gallery', true );
|
46 |
-
if ( $original_gallery_value ) {
|
47 |
-
$original_gallery = explode( ',', $original_gallery_value );
|
48 |
-
$original_gallery = array_filter( $original_gallery );
|
49 |
-
|
50 |
-
foreach ( $original_gallery as $attachment_id ) {
|
51 |
-
$attachment_element = $this->translation_element_factory->create( $attachment_id, 'post' );
|
52 |
-
$translated_attachment = $attachment_element->get_translation( $post_element->get_language_code() );
|
53 |
-
if ( null !== $translated_attachment ) {
|
54 |
-
$meta_value[] = $translated_attachment->get_id();
|
55 |
-
} else {
|
56 |
-
$meta_value[] = $attachment_id;
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
if ( ! empty( $meta_value ) ) {
|
63 |
-
$image_ids = implode( ',', $meta_value );
|
64 |
-
}
|
65 |
-
|
66 |
-
add_filter( 'get_post_metadata', [ $this, 'localize_image_ids' ], 10, 3 );
|
67 |
-
|
68 |
-
$this->wpml_cache->set( $cache_key, $image_ids );
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
return $image_ids ? [ $image_ids ] : $value;
|
73 |
-
}
|
74 |
-
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-product-image-filter-factory.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Product_Image_Filter_Factory implements IWPML_Frontend_Action_Loader {
|
4 |
-
|
5 |
-
public function create() {
|
6 |
-
global $sitepress, $woocommerce_wpml;
|
7 |
-
|
8 |
-
if ( $woocommerce_wpml->get_setting( 'sync_media', true ) ) {
|
9 |
-
return new WCML_Product_Image_Filter( new WPML_Translation_Element_Factory( $sitepress ) );
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-product-image-filter.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Product_Image_Filter implements IWPML_Action {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var WPML_Translation_Element_Factory
|
7 |
-
*/
|
8 |
-
private $translation_element_factory;
|
9 |
-
/** @var WPML_WP_Cache */
|
10 |
-
private $wpml_cache;
|
11 |
-
|
12 |
-
public function __construct( WPML_Translation_Element_Factory $translation_element_factory, $wpml_cache = null ) {
|
13 |
-
$this->translation_element_factory = $translation_element_factory;
|
14 |
-
|
15 |
-
$cache_group = 'WCML_Product_Image_Filter';
|
16 |
-
$this->wpml_cache = $wpml_cache;
|
17 |
-
if ( null === $wpml_cache ) {
|
18 |
-
$this->wpml_cache = new WPML_WP_Cache( $cache_group );
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
public function add_hooks() {
|
23 |
-
add_filter( 'get_post_metadata', [ $this, 'localize_image_id' ], 11, 3 );
|
24 |
-
}
|
25 |
-
|
26 |
-
public function localize_image_id( $value, $object_id, $meta_key ) {
|
27 |
-
|
28 |
-
$image_id = false;
|
29 |
-
if ( ! $value && '_thumbnail_id' === $meta_key &&
|
30 |
-
in_array( get_post_type( $object_id ), [ 'product', 'product_variation' ] )
|
31 |
-
) {
|
32 |
-
|
33 |
-
$cache_key = $object_id . '_thumbnail_id';
|
34 |
-
$found = false;
|
35 |
-
$image_id = $this->wpml_cache->get( $cache_key, $found );
|
36 |
-
|
37 |
-
if ( ! $image_id ) {
|
38 |
-
remove_filter( 'get_post_metadata', [ $this, 'localize_image_id' ], 11 );
|
39 |
-
|
40 |
-
$meta_value = get_post_meta( $object_id, '_thumbnail_id', true );
|
41 |
-
if ( empty( $meta_value ) ) {
|
42 |
-
$post_element = $this->translation_element_factory->create( $object_id, 'post' );
|
43 |
-
$source_element = $post_element->get_source_element();
|
44 |
-
if ( null !== $source_element ) {
|
45 |
-
$image_id = get_post_meta( $source_element->get_id(), '_thumbnail_id', true );
|
46 |
-
}
|
47 |
-
}
|
48 |
-
add_filter( 'get_post_metadata', [ $this, 'localize_image_id' ], 11, 3 );
|
49 |
-
|
50 |
-
$this->wpml_cache->set( $cache_key, $image_id );
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
return $image_id ? [ $image_id ] : $value;
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-update-product-gallery-translation-factory.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Update_Product_Gallery_Translation_Factory implements IWPML_Backend_Action_Loader {
|
4 |
-
|
5 |
-
public function create() {
|
6 |
-
global $sitepress;
|
7 |
-
|
8 |
-
if ( class_exists( 'WPML_Media_Usage_Factory' ) ) {
|
9 |
-
return new WCML_Update_Product_Gallery_Translation(
|
10 |
-
new WPML_Translation_Element_Factory( $sitepress ),
|
11 |
-
new WPML_Media_Usage_Factory()
|
12 |
-
);
|
13 |
-
}
|
14 |
-
|
15 |
-
return null;
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wcml-update-product-gallery-translation.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Update_Product_Gallery_Translation implements IWPML_Action {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var WPML_Translation_Element_Factory
|
7 |
-
*/
|
8 |
-
private $translation_element_factory;
|
9 |
-
/**
|
10 |
-
* @var WPML_Media_Usage_Factory
|
11 |
-
*/
|
12 |
-
private $media_usage_factory;
|
13 |
-
|
14 |
-
public function __construct(
|
15 |
-
WPML_Translation_Element_Factory $translation_element_factory,
|
16 |
-
WPML_Media_Usage_Factory $media_usage_factory
|
17 |
-
) {
|
18 |
-
$this->translation_element_factory = $translation_element_factory;
|
19 |
-
$this->media_usage_factory = $media_usage_factory;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function add_hooks() {
|
23 |
-
add_action( 'wpml_added_media_file_translation', [ $this, 'update_meta' ], PHP_INT_MAX, 3 );
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param int $original_attachment_id
|
28 |
-
*/
|
29 |
-
public function update_meta( $original_attachment_id, $file, $language ) {
|
30 |
-
$media_usage = $this->media_usage_factory->create( $original_attachment_id );
|
31 |
-
|
32 |
-
$posts = $media_usage->get_posts();
|
33 |
-
foreach ( $posts as $source_post_id ) {
|
34 |
-
$source_post = $this->translation_element_factory->create( $source_post_id, 'post' );
|
35 |
-
$original_attachment_element = $this->translation_element_factory->create( $original_attachment_id, 'post' );
|
36 |
-
$updated_attachment_element = $original_attachment_element->get_translation( $language );
|
37 |
-
$meta_value = $this->get_translated_gallery( $source_post_id, $updated_attachment_element );
|
38 |
-
$this->update_gallery( $meta_value, $source_post, $updated_attachment_element );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @param int $source_post_id
|
44 |
-
* @param WPML_Post_Element $updated_attachment_element
|
45 |
-
*
|
46 |
-
* @return array
|
47 |
-
* @throws \InvalidArgumentException
|
48 |
-
*/
|
49 |
-
private function get_translated_gallery( $source_post_id, WPML_Post_Element $updated_attachment_element ) {
|
50 |
-
$meta_value = [];
|
51 |
-
|
52 |
-
$original_gallery_meta = get_post_meta( $source_post_id, '_product_image_gallery', true );
|
53 |
-
if ( '' !== $original_gallery_meta ) {
|
54 |
-
$original_gallery = explode( ',', $original_gallery_meta );
|
55 |
-
$original_gallery = array_filter( $original_gallery );
|
56 |
-
|
57 |
-
foreach ( $original_gallery as $original_attachment_id ) {
|
58 |
-
$attachment_element = $this->translation_element_factory->create( $original_attachment_id, 'post' );
|
59 |
-
$translated_attachment = $attachment_element->get_translation( $updated_attachment_element->get_language_code() );
|
60 |
-
if ( null !== $translated_attachment ) {
|
61 |
-
$meta_value[] = $translated_attachment->get_id();
|
62 |
-
} else {
|
63 |
-
$meta_value[] = $original_attachment_id;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
return $meta_value;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param array $meta_value
|
73 |
-
* @param WPML_Post_Element $source_post
|
74 |
-
* @param WPML_Post_Element $updated_attachment_element
|
75 |
-
*
|
76 |
-
* @throws \InvalidArgumentException
|
77 |
-
*/
|
78 |
-
private function update_gallery(
|
79 |
-
array $meta_value,
|
80 |
-
WPML_Post_Element $source_post,
|
81 |
-
WPML_Post_Element $updated_attachment_element
|
82 |
-
) {
|
83 |
-
if ( ! empty( $meta_value ) ) {
|
84 |
-
$translated_post = $source_post->get_translation( $updated_attachment_element->get_language_code() );
|
85 |
-
/** $translated_post could be null */
|
86 |
-
if ( $translated_post ) {
|
87 |
-
$value = implode( ',', $meta_value );
|
88 |
-
update_post_meta( $translated_post->get_id(), '_product_image_gallery', $value );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wml-append-gallery-to-post-media-ids-factory.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Append_Gallery_To_Post_Media_Ids_Factory implements IWPML_Backend_Action_Loader {
|
4 |
-
|
5 |
-
public function create() {
|
6 |
-
return new WCML_Append_Gallery_To_Post_Media_Ids();
|
7 |
-
}
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/media/class-wml-append-gallery-to-post-media-ids.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Append_Gallery_To_Post_Media_Ids implements IWPML_Action {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
add_filter( 'wpml_ids_of_media_used_in_post', array( $this, 'add_product_gallery_images' ), 10, 2 );
|
7 |
-
}
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @param array $media_ids
|
11 |
-
*
|
12 |
-
* @return mixed
|
13 |
-
*/
|
14 |
-
public function add_product_gallery_images( $media_ids, $post_id ) {
|
15 |
-
$product_gallery = get_post_meta( $post_id, '_product_image_gallery', true );
|
16 |
-
if ( $product_gallery ) {
|
17 |
-
$ids = array_map(
|
18 |
-
'intval',
|
19 |
-
array_map(
|
20 |
-
'trim',
|
21 |
-
explode( ',', $product_gallery )
|
22 |
-
)
|
23 |
-
);
|
24 |
-
|
25 |
-
$media_ids = array_values( array_unique( array_merge( $media_ids, $ids ) ) );
|
26 |
-
}
|
27 |
-
|
28 |
-
return array_filter( $media_ids );
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/class-wcml-exchange-rates.php
DELETED
@@ -1,375 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Exchange_Rates
|
5 |
-
*/
|
6 |
-
class WCML_Exchange_Rates {
|
7 |
-
|
8 |
-
/** @var woocommerce_wpml */
|
9 |
-
private $woocommerce_wpml;
|
10 |
-
/** @var array */
|
11 |
-
private $services = [];
|
12 |
-
/** @var array */
|
13 |
-
private $settings;
|
14 |
-
/** @var WP_Locale */
|
15 |
-
private $wp_locale;
|
16 |
-
|
17 |
-
const CRONJOB_EVENT = 'wcml_exchange_rates_update';
|
18 |
-
const DIGITS_AFTER_DECIMAL_POINT = 6;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* WCML_Exchange_Rates constructor.
|
22 |
-
*
|
23 |
-
* @param $woocommerce_wpml
|
24 |
-
* @param WP_Locale
|
25 |
-
*/
|
26 |
-
public function __construct( $woocommerce_wpml, $wp_locale ) {
|
27 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
28 |
-
$this->wp_locale = $wp_locale;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function add_actions() {
|
32 |
-
if ( is_admin() ) {
|
33 |
-
add_action( 'wcml_saved_mc_options', [ $this, 'update_exchange_rate_options' ] ); // before init
|
34 |
-
}
|
35 |
-
add_action( 'init', [ $this, 'init' ] );
|
36 |
-
}
|
37 |
-
|
38 |
-
public function init() {
|
39 |
-
if ( $this->woocommerce_wpml->multi_currency->get_currencies() ) {
|
40 |
-
if ( is_admin() ) {
|
41 |
-
add_action( 'wp_ajax_wcml_update_exchange_rates', [ $this, 'update_exchange_rates_ajax' ] );
|
42 |
-
}
|
43 |
-
add_filter( 'cron_schedules', [ $this, 'cron_schedules' ] );
|
44 |
-
add_action( self::CRONJOB_EVENT, [ $this, 'update_exchange_rates' ] );
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
public function initialize_settings() {
|
49 |
-
if ( ! isset( $this->woocommerce_wpml->settings['multi_currency']['exchange_rates'] ) ) {
|
50 |
-
$this->settings = [
|
51 |
-
'automatic' => 0,
|
52 |
-
'service' => 'fixerio',
|
53 |
-
'lifting_charge' => 0,
|
54 |
-
'schedule' => 'manual',
|
55 |
-
'week_day' => 1,
|
56 |
-
'month_day' => 1,
|
57 |
-
];
|
58 |
-
$this->save_settings();
|
59 |
-
} else {
|
60 |
-
$this->settings =& $this->woocommerce_wpml->settings['multi_currency']['exchange_rates'];
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @return array
|
66 |
-
*/
|
67 |
-
public function get_services() {
|
68 |
-
return $this->services;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param string $service_id
|
73 |
-
* @param \WCML\MultiCurrency\ExchangeRateServices\Service $service
|
74 |
-
*/
|
75 |
-
public function add_service( $service_id, $service ) {
|
76 |
-
$this->services[ $service_id ] = $service;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @return array
|
81 |
-
*/
|
82 |
-
public function get_settings() {
|
83 |
-
return $this->settings;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* @param string $key
|
88 |
-
*
|
89 |
-
* @return mixed|null
|
90 |
-
*/
|
91 |
-
public function get_setting( $key ) {
|
92 |
-
return isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : null;
|
93 |
-
}
|
94 |
-
|
95 |
-
public function save_settings() {
|
96 |
-
$this->woocommerce_wpml->settings['multi_currency']['exchange_rates'] = $this->settings;
|
97 |
-
$this->woocommerce_wpml->update_settings();
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* @param string $key
|
102 |
-
* @param mixed $value
|
103 |
-
*/
|
104 |
-
public function save_setting( $key, $value ) {
|
105 |
-
$this->settings[ $key ] = $value;
|
106 |
-
$this->save_settings();
|
107 |
-
}
|
108 |
-
|
109 |
-
public function update_exchange_rates_ajax() {
|
110 |
-
$response = [];
|
111 |
-
if ( wp_create_nonce( 'update-exchange-rates' ) === $_POST['wcml_nonce'] ) {
|
112 |
-
try {
|
113 |
-
$rates = $this->update_exchange_rates();
|
114 |
-
$response['success'] = 1;
|
115 |
-
$response['last_updated'] = date_i18n( 'F j, Y g:i a', $this->settings['last_updated'] );
|
116 |
-
$response['rates'] = $rates;
|
117 |
-
} catch ( Exception $e ) {
|
118 |
-
$response['success'] = 0;
|
119 |
-
$response['error'] = $e->getMessage();
|
120 |
-
$response['service'] = $this->settings['service'];
|
121 |
-
}
|
122 |
-
} else {
|
123 |
-
$response['success'] = 0;
|
124 |
-
$response['error'] = 'Invalid nonce';
|
125 |
-
}
|
126 |
-
wp_send_json( $response );
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* @return array
|
131 |
-
* @throws Exception
|
132 |
-
*/
|
133 |
-
public function update_exchange_rates() {
|
134 |
-
if ( ! isset( $this->services[ $this->settings['service'] ] ) ) {
|
135 |
-
throw new Exception( 'The exchange rate service "' . $this->settings['service'] . '" is not defined.' );
|
136 |
-
}
|
137 |
-
|
138 |
-
/** @var \WCML\MultiCurrency\ExchangeRateServices\Service $service */
|
139 |
-
$service =& $this->services[ $this->settings['service'] ];
|
140 |
-
|
141 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currency_codes();
|
142 |
-
$default_currency = wcml_get_woocommerce_currency_option();
|
143 |
-
$secondary_currencies = array_diff( $currencies, [ $default_currency ] );
|
144 |
-
|
145 |
-
try {
|
146 |
-
$rates = $service->getRates( $default_currency, $secondary_currencies );
|
147 |
-
} catch ( Exception $e ) {
|
148 |
-
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
|
149 |
-
error_log( 'Exchange rates update error (' . $this->settings['service'] . '): ' . $e->getMessage() );
|
150 |
-
}
|
151 |
-
throw new Exception( $e->getMessage() );
|
152 |
-
}
|
153 |
-
|
154 |
-
$this->apply_lifting_charge( $rates );
|
155 |
-
|
156 |
-
foreach ( $rates as $to => $rate ) {
|
157 |
-
if ( $rate && is_numeric( $rate ) ) {
|
158 |
-
$this->save_exchage_rate( $to, $rate );
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
$this->settings['last_updated'] = current_time( 'timestamp' );
|
163 |
-
$this->save_settings();
|
164 |
-
|
165 |
-
return $rates;
|
166 |
-
}
|
167 |
-
|
168 |
-
public function apply_lifting_charge( &$rates ) {
|
169 |
-
foreach ( $rates as $k => $rate ) {
|
170 |
-
$rates[ $k ] = round( $rate * ( 1 + $this->settings['lifting_charge'] / 100 ), self::DIGITS_AFTER_DECIMAL_POINT );
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* @param string $currency
|
176 |
-
* @param string $rate
|
177 |
-
*/
|
178 |
-
private function save_exchage_rate( $currency, $rate ) {
|
179 |
-
$this->woocommerce_wpml->settings['currency_options'][ $currency ]['previous_rate'] =
|
180 |
-
$this->woocommerce_wpml->settings['currency_options'][ $currency ]['rate'];
|
181 |
-
$this->woocommerce_wpml->settings['currency_options'][ $currency ]['rate'] = $rate;
|
182 |
-
$this->woocommerce_wpml->update_settings();
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* @param $currency
|
187 |
-
*
|
188 |
-
* @return mixed
|
189 |
-
*/
|
190 |
-
public function get_currency_rate( $currency ) {
|
191 |
-
return $this->woocommerce_wpml->settings['currency_options'][ $currency ]['rate'];
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* @param array $post_data
|
196 |
-
*/
|
197 |
-
public function update_exchange_rate_options( $post_data ) {
|
198 |
-
|
199 |
-
if ( isset( $post_data['exchange-rates-automatic'] ) && $post_data['exchange-rates-automatic'] ) {
|
200 |
-
|
201 |
-
$this->settings['automatic'] = (int) $post_data['exchange-rates-automatic'];
|
202 |
-
|
203 |
-
if ( isset( $post_data['exchange-rates-service'] ) ) {
|
204 |
-
|
205 |
-
// clear errors for replaced service
|
206 |
-
if ( isset( $this->services[ $this->settings['service'] ] ) && $post_data['exchange-rates-service'] !== $this->settings['service'] ) {
|
207 |
-
$this->services[ $this->settings['service'] ]->clearLastError();
|
208 |
-
}
|
209 |
-
|
210 |
-
$this->settings['service'] = sanitize_text_field( $post_data['exchange-rates-service'] );
|
211 |
-
|
212 |
-
}
|
213 |
-
|
214 |
-
if ( isset( $post_data['services'] ) ) {
|
215 |
-
|
216 |
-
foreach ( $post_data['services'] as $service_id => $service_data ) {
|
217 |
-
if ( isset( $service_data['api-key'] ) ) {
|
218 |
-
$this->services[ $service_id ]->saveSetting( 'api-key', $service_data['api-key'] );
|
219 |
-
}
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
$this->settings['lifting_charge'] = is_numeric( $post_data['lifting_charge'] ) ? $post_data['lifting_charge'] : 0;
|
224 |
-
|
225 |
-
if ( isset( $post_data['update-schedule'] ) ) {
|
226 |
-
$this->settings['schedule'] = sanitize_text_field( $post_data['update-schedule'] );
|
227 |
-
}
|
228 |
-
|
229 |
-
if ( isset( $post_data['update-time'] ) ) {
|
230 |
-
$this->settings['time'] = sanitize_text_field( $post_data['update-time'] );
|
231 |
-
}
|
232 |
-
|
233 |
-
if ( isset( $post_data['update-weekly-day'] ) ) {
|
234 |
-
$this->settings['week_day'] = sanitize_text_field( $post_data['update-weekly-day'] );
|
235 |
-
}
|
236 |
-
|
237 |
-
if ( isset( $post_data['update-monthly-day'] ) ) {
|
238 |
-
$this->settings['month_day'] = sanitize_text_field( $post_data['update-monthly-day'] );
|
239 |
-
}
|
240 |
-
|
241 |
-
if ( $this->settings['schedule'] === 'manual' ) {
|
242 |
-
$this->delete_update_cronjob();
|
243 |
-
} else {
|
244 |
-
$this->enable_update_cronjob();
|
245 |
-
}
|
246 |
-
} else {
|
247 |
-
$this->settings['automatic'] = 0;
|
248 |
-
$this->delete_update_cronjob();
|
249 |
-
}
|
250 |
-
|
251 |
-
$this->save_settings();
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
public function enable_update_cronjob() {
|
256 |
-
$schedule = wp_get_schedule( self::CRONJOB_EVENT );
|
257 |
-
|
258 |
-
if ( $schedule !== $this->settings['schedule'] ) {
|
259 |
-
$this->delete_update_cronjob();
|
260 |
-
}
|
261 |
-
|
262 |
-
if ( 'monthly' === $this->settings['schedule'] ) {
|
263 |
-
$time_offset = $this->get_monthly_schedule_time_offset();
|
264 |
-
$schedule = 'wcml_' . $this->settings['schedule'] . '_on_' . $this->settings['month_day'];
|
265 |
-
} elseif ( 'weekly' === $this->settings['schedule'] ) {
|
266 |
-
$time_offset = $this->get_weekly_schedule_time_offset();
|
267 |
-
$schedule = 'wcml_' . $this->settings['schedule'] . '_on_' . $this->settings['week_day'];
|
268 |
-
|
269 |
-
} else {
|
270 |
-
$time_offset = time();
|
271 |
-
$schedule = $this->settings['schedule'];
|
272 |
-
}
|
273 |
-
|
274 |
-
if ( ! wp_next_scheduled( self::CRONJOB_EVENT ) ) {
|
275 |
-
wp_schedule_event( $time_offset, $schedule, self::CRONJOB_EVENT );
|
276 |
-
}
|
277 |
-
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* @return int
|
282 |
-
*/
|
283 |
-
private function get_monthly_schedule_time_offset() {
|
284 |
-
$current_day = date( 'j' );
|
285 |
-
$days_in_current_month = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
|
286 |
-
|
287 |
-
if ( $this->settings['month_day'] >= $current_day && $this->settings['month_day'] <= $days_in_current_month ) {
|
288 |
-
$days = $this->settings['month_day'] - $current_day;
|
289 |
-
} else {
|
290 |
-
$days = $days_in_current_month - $current_day + $this->settings['month_day'];
|
291 |
-
}
|
292 |
-
|
293 |
-
$time_offset = time() + $days * DAY_IN_SECONDS;
|
294 |
-
|
295 |
-
return $time_offset;
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* @return int
|
300 |
-
*/
|
301 |
-
private function get_weekly_schedule_time_offset() {
|
302 |
-
$current_day = date( 'w' );
|
303 |
-
if ( $this->settings['week_day'] >= $current_day ) {
|
304 |
-
$days = $this->settings['week_day'] - $current_day;
|
305 |
-
} else {
|
306 |
-
$days = 7 - $current_day + $this->settings['week_day'];
|
307 |
-
}
|
308 |
-
|
309 |
-
$time_offset = time() + $days * DAY_IN_SECONDS;
|
310 |
-
|
311 |
-
return $time_offset;
|
312 |
-
}
|
313 |
-
|
314 |
-
public function delete_update_cronjob() {
|
315 |
-
wp_clear_scheduled_hook( self::CRONJOB_EVENT );
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* @param array $schedules
|
320 |
-
*
|
321 |
-
* @return array
|
322 |
-
*/
|
323 |
-
public function cron_schedules( $schedules ) {
|
324 |
-
|
325 |
-
if ( 'monthly' === $this->settings['schedule'] ) {
|
326 |
-
|
327 |
-
$month_day = $this->get_month_day_formatted();
|
328 |
-
$current_month = date( 'n' );
|
329 |
-
$days_in_current_month = cal_days_in_month( CAL_GREGORIAN, $current_month, date( 'Y' ) );
|
330 |
-
if ( $this->settings['month_day'] <= $days_in_current_month && $this->settings['month_day'] >= date( 'j' ) ) {
|
331 |
-
$interval = DAY_IN_SECONDS * $days_in_current_month;
|
332 |
-
} else {
|
333 |
-
$month_number = 12 === (int) $current_month ? 1 : $current_month + 1;
|
334 |
-
$year_number = 12 === (int) $current_month ? date( 'Y' ) + 1 : date( 'Y' );
|
335 |
-
$interval = DAY_IN_SECONDS * cal_days_in_month( CAL_GREGORIAN, $month_number, $year_number );
|
336 |
-
}
|
337 |
-
|
338 |
-
$schedules[ 'wcml_monthly_on_' . $this->settings['month_day'] ] = [
|
339 |
-
'interval' => $interval,
|
340 |
-
'display' => sprintf( __( 'Monthly on the %s', 'woocommerce-multilingual' ), $month_day ),
|
341 |
-
];
|
342 |
-
|
343 |
-
} elseif ( 'weekly' === $this->settings['schedule'] ) {
|
344 |
-
|
345 |
-
$week_day = $this->wp_locale->get_weekday( $this->settings['week_day'] );
|
346 |
-
$schedules[ 'wcml_weekly_on_' . $this->settings['week_day'] ] = [
|
347 |
-
'interval' => WEEK_IN_SECONDS,
|
348 |
-
'display' => sprintf( __( 'Weekly on %s', 'woocommerce-multilingual' ), $week_day ),
|
349 |
-
];
|
350 |
-
|
351 |
-
}
|
352 |
-
|
353 |
-
return $schedules;
|
354 |
-
}
|
355 |
-
|
356 |
-
private function get_month_day_formatted() {
|
357 |
-
$month_day = $this->settings['month_day'];
|
358 |
-
switch ( $month_day ) {
|
359 |
-
case 1:
|
360 |
-
$month_day .= 'st';
|
361 |
-
break;
|
362 |
-
case 2:
|
363 |
-
$month_day .= 'nd';
|
364 |
-
break;
|
365 |
-
case 3:
|
366 |
-
$month_day .= 'rd';
|
367 |
-
break;
|
368 |
-
default:
|
369 |
-
$month_day .= 'th';
|
370 |
-
break;
|
371 |
-
}
|
372 |
-
return $month_day;
|
373 |
-
}
|
374 |
-
|
375 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/exchange-rate-services/CurrencyLayer.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency\ExchangeRateServices;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class CurrencyLayer
|
7 |
-
*/
|
8 |
-
class CurrencyLayer extends Service {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
public function getId() {
|
14 |
-
return 'currencylayer';
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function getName() {
|
21 |
-
return 'currencylayer';
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function getUrl() {
|
28 |
-
return 'https://currencylayer.com/';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @return string
|
33 |
-
*/
|
34 |
-
public function getApiUrl() {
|
35 |
-
return 'http://apilayer.net/api/live?access_key=%s&source=%s¤cies=%s&amount=1';
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @return bool
|
40 |
-
*/
|
41 |
-
public function isKeyRequired() {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @param string $from Base currency.
|
47 |
-
* @param array $tos Target currencies.
|
48 |
-
*
|
49 |
-
* @return array
|
50 |
-
* @throws \Exception Thrown where there are connection problems.
|
51 |
-
*/
|
52 |
-
public function getRates( $from, $tos ) {
|
53 |
-
$this->clearLastError();
|
54 |
-
|
55 |
-
$rates = [];
|
56 |
-
|
57 |
-
$url = sprintf( $this->getApiUrl(), $this->getSetting( 'api-key' ), $from, implode( ',', $tos ) );
|
58 |
-
|
59 |
-
$data = wp_safe_remote_get( $url );
|
60 |
-
|
61 |
-
if ( is_wp_error( $data ) ) {
|
62 |
-
|
63 |
-
$http_error = implode( "\n", $data->get_error_messages() );
|
64 |
-
$this->saveLastError( $http_error );
|
65 |
-
throw new \Exception( $http_error );
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
$json = json_decode( $data['body'] );
|
70 |
-
|
71 |
-
if ( empty( $json->success ) ) {
|
72 |
-
if ( ! empty( $json->error->info ) ) {
|
73 |
-
if ( strpos( $json->error->info, 'You have not supplied an API Access Key' ) !== false ) {
|
74 |
-
$error = __( 'You have entered an incorrect API Access Key', 'woocommerce-multilingual' );
|
75 |
-
} else {
|
76 |
-
$error = $json->error->info;
|
77 |
-
}
|
78 |
-
} else {
|
79 |
-
$error = __( 'Cannot get exchange rates. Connection failed.', 'woocommerce-multilingual' );
|
80 |
-
}
|
81 |
-
$this->saveLastError( $error );
|
82 |
-
throw new \Exception( $error );
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( isset( $json->quotes ) ) {
|
86 |
-
foreach ( $tos as $to ) {
|
87 |
-
if ( isset( $json->quotes->{$from . $to} ) ) {
|
88 |
-
$rates[ $to ] = round( $json->quotes->{$from . $to}, \WCML_Exchange_Rates::DIGITS_AFTER_DECIMAL_POINT );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
return $rates;
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/exchange-rate-services/ExchangeRatesApi.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency\ExchangeRateServices;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class ExchangeRatesApi
|
7 |
-
*/
|
8 |
-
class ExchangeRatesApi extends Service {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
public function getId() {
|
14 |
-
return 'exchangeratesapi';
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function getName() {
|
21 |
-
return 'Exchange rates API';
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function getUrl() {
|
28 |
-
return 'https://exchangeratesapi.io/';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @return string
|
33 |
-
*/
|
34 |
-
public function getApiUrl() {
|
35 |
-
return 'http://api.exchangeratesapi.io/v1/latest?access_key=%1$s&base=%2$s&symbols=%3$s';
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @return bool
|
40 |
-
*/
|
41 |
-
public function isKeyRequired() {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/exchange-rate-services/Fixerio.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency\ExchangeRateServices;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class Fixerio
|
7 |
-
*/
|
8 |
-
class Fixerio extends Service {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
public function getId() {
|
14 |
-
return 'fixerio';
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function getName() {
|
21 |
-
return 'Fixer.io';
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function getUrl() {
|
28 |
-
return 'http://fixer.io/';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @return string
|
33 |
-
*/
|
34 |
-
public function getApiUrl() {
|
35 |
-
return 'http://data.fixer.io/api/latest?access_key=%1$s&base=%2$s&symbols=%3$s';
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @return bool
|
40 |
-
*/
|
41 |
-
public function isKeyRequired() {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/exchange-rate-services/OpenExchangeRates.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency\ExchangeRateServices;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class OpenExchangeRates
|
7 |
-
*/
|
8 |
-
class OpenExchangeRates extends Service {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
public function getId() {
|
14 |
-
return 'openexchangerates';
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function getName() {
|
21 |
-
return 'Open Exchange Rates';
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function getUrl() {
|
28 |
-
return 'https://openexchangerates.org/';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @return string
|
33 |
-
*/
|
34 |
-
public function getApiUrl() {
|
35 |
-
return 'https://openexchangerates.org/api/latest.json?app_id=%1$s&base=%2$s&symbols=%3$s';
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @return bool
|
40 |
-
*/
|
41 |
-
public function isKeyRequired() {
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/exchange-rate-services/Service.php
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency\ExchangeRateServices;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class Service
|
9 |
-
*/
|
10 |
-
abstract class Service {
|
11 |
-
|
12 |
-
/** @var array */
|
13 |
-
private $settings;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @return string
|
17 |
-
*/
|
18 |
-
abstract public function getId();
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
abstract public function getName();
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
-
abstract public function getUrl();
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @return string
|
32 |
-
*/
|
33 |
-
abstract public function getApiUrl();
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @return bool
|
37 |
-
*/
|
38 |
-
abstract public function isKeyRequired();
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @param string $from Base currency.
|
42 |
-
* @param array $tos Target currencies.
|
43 |
-
*
|
44 |
-
* @return mixed
|
45 |
-
* @throws \Exception Thrown where there are connection problems.
|
46 |
-
*/
|
47 |
-
public function getRates( $from, $tos ) {
|
48 |
-
$this->clearLastError();
|
49 |
-
|
50 |
-
$rates = [];
|
51 |
-
|
52 |
-
if ( $this->isKeyRequired() ) {
|
53 |
-
$url = sprintf( $this->getApiUrl(), $this->getSetting( 'api-key' ), $from, implode( ',', $tos ) );
|
54 |
-
} else {
|
55 |
-
$url = sprintf( $this->getApiUrl(), $from, implode( ',', $tos ) );
|
56 |
-
}
|
57 |
-
|
58 |
-
$data = wp_safe_remote_get( $url );
|
59 |
-
|
60 |
-
if ( is_wp_error( $data ) ) {
|
61 |
-
|
62 |
-
$http_error = implode( "\n", $data->get_error_messages() );
|
63 |
-
$this->saveLastError( $http_error );
|
64 |
-
throw new \Exception( $http_error );
|
65 |
-
|
66 |
-
}
|
67 |
-
|
68 |
-
$json = json_decode( $data['body'] );
|
69 |
-
|
70 |
-
if ( empty( $json->rates ) ) {
|
71 |
-
if ( isset( $json->error->info ) ) {
|
72 |
-
$error = $json->error->info;
|
73 |
-
} else {
|
74 |
-
$error = __( 'Cannot get exchange rates. Connection failed.', 'woocommerce-multilingual' );
|
75 |
-
}
|
76 |
-
$this->saveLastError( $error );
|
77 |
-
throw new \Exception( $error );
|
78 |
-
}
|
79 |
-
|
80 |
-
foreach ( $json->rates as $to => $rate ) {
|
81 |
-
$rates[ $to ] = round( $rate, \WCML_Exchange_Rates::DIGITS_AFTER_DECIMAL_POINT );
|
82 |
-
}
|
83 |
-
|
84 |
-
return $rates;
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @return array
|
89 |
-
*/
|
90 |
-
public function getSettings() {
|
91 |
-
if ( null === $this->settings ) {
|
92 |
-
$this->settings = get_option( 'wcml_exchange_rate_service_' . $this->getId(), [] );
|
93 |
-
}
|
94 |
-
|
95 |
-
return $this->settings;
|
96 |
-
}
|
97 |
-
|
98 |
-
private function saveSettings() {
|
99 |
-
update_option( 'wcml_exchange_rate_service_' . $this->getId(), $this->getSettings() );
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* @param string $key
|
104 |
-
*
|
105 |
-
* @return mixed|null
|
106 |
-
*/
|
107 |
-
public function getSetting( $key ) {
|
108 |
-
return Obj::prop( $key, $this->getSettings() );
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* @param string $key
|
113 |
-
* @param mixed $value
|
114 |
-
*/
|
115 |
-
public function saveSetting( $key, $value ) {
|
116 |
-
$this->getSettings();
|
117 |
-
$this->settings[ $key ] = $value;
|
118 |
-
$this->saveSettings();
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* @param string $error_message
|
123 |
-
*/
|
124 |
-
public function saveLastError( $error_message ) {
|
125 |
-
$this->saveSetting(
|
126 |
-
'last_error',
|
127 |
-
[
|
128 |
-
'text' => $error_message,
|
129 |
-
'time' => date_i18n( 'F j, Y g:i a', false, true ),
|
130 |
-
]
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
-
public function clearLastError() {
|
135 |
-
$this->saveSetting( 'last_error', false );
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* @return mixed
|
140 |
-
*/
|
141 |
-
public function getLastError() {
|
142 |
-
return $this->getSetting( 'last_error' );
|
143 |
-
}
|
144 |
-
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/geolocation/Geolocation.php
DELETED
@@ -1,214 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
use WPML\FP\Relation;
|
7 |
-
|
8 |
-
class Geolocation {
|
9 |
-
|
10 |
-
const DEFAULT_COUNTRY_CURRENCY_CONFIG = 'country-currency.json';
|
11 |
-
const MODE_BY_LANGUAGE = 'by_language';
|
12 |
-
const MODE_BY_LOCATION = 'by_location';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @return bool
|
16 |
-
*/
|
17 |
-
public static function isUsed() {
|
18 |
-
/** @var \woocommerce_wpml $woocommerce_wpml */
|
19 |
-
global $woocommerce_wpml;
|
20 |
-
|
21 |
-
$isByLocationMode = function() use ( $woocommerce_wpml ) {
|
22 |
-
return Geolocation::MODE_BY_LOCATION === $woocommerce_wpml->get_setting( 'currency_mode' );
|
23 |
-
};
|
24 |
-
|
25 |
-
$useDefaultCurrencyByLocation = function() use ( $woocommerce_wpml ) {
|
26 |
-
return (bool) wpml_collect( $woocommerce_wpml->get_setting( 'default_currencies', [] ) )
|
27 |
-
->first( Relation::equals( 'location' ) );
|
28 |
-
};
|
29 |
-
|
30 |
-
return wcml_is_multi_currency_on()
|
31 |
-
&& ( $isByLocationMode() || $useDefaultCurrencyByLocation() );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Get country code by user IP
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
private static function getCountryByUserIp() {
|
40 |
-
wp_cache_add_non_persistent_groups( __CLASS__ );
|
41 |
-
|
42 |
-
$key = 'country';
|
43 |
-
$country = wp_cache_get( $key, __CLASS__ );
|
44 |
-
|
45 |
-
if ( ! is_string( $country ) ) {
|
46 |
-
$geolocationData = \WC_Geolocation::geolocate_ip( \WC_Geolocation::get_ip_address(), true );
|
47 |
-
$country = (string) Obj::propOr( '', 'country', $geolocationData );
|
48 |
-
|
49 |
-
wp_cache_add( $key, $country, __CLASS__ );
|
50 |
-
}
|
51 |
-
|
52 |
-
return $country;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Get country currency config file
|
57 |
-
*
|
58 |
-
* @return array
|
59 |
-
*/
|
60 |
-
private static function parseConfigFile() {
|
61 |
-
$config = [];
|
62 |
-
$configuration_file = WCML_PLUGIN_PATH . '/res/geolocation/' . self::DEFAULT_COUNTRY_CURRENCY_CONFIG;
|
63 |
-
|
64 |
-
if ( file_exists( $configuration_file ) ) {
|
65 |
-
$json_content = file_get_contents( $configuration_file );
|
66 |
-
$config = json_decode( $json_content, true );
|
67 |
-
}
|
68 |
-
|
69 |
-
return $config;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Get currency code by user country
|
74 |
-
*
|
75 |
-
* @return string|bool
|
76 |
-
*/
|
77 |
-
public static function getCurrencyCodeByUserCountry() {
|
78 |
-
|
79 |
-
$country = self::getUserCountry();
|
80 |
-
|
81 |
-
if ( $country ) {
|
82 |
-
$config = self::parseConfigFile();
|
83 |
-
|
84 |
-
return isset( $config[ $country ] ) ? $config[ $country ] : false;
|
85 |
-
}
|
86 |
-
|
87 |
-
return false;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get first available country currency from settings if default country currency not active
|
92 |
-
*
|
93 |
-
* @param array $currenciesSettings
|
94 |
-
*
|
95 |
-
* @return string|bool
|
96 |
-
*/
|
97 |
-
public static function getFirstAvailableCountryCurrencyFromSettings( $currenciesSettings ) {
|
98 |
-
|
99 |
-
$currency = false;
|
100 |
-
|
101 |
-
wpml_collect( $currenciesSettings )->each( function ( $settings, $code ) use ( &$currency ) {
|
102 |
-
if ( self::isCurrencyAvailableForCountry( $settings ) ) {
|
103 |
-
$currency = $code;
|
104 |
-
}
|
105 |
-
} );
|
106 |
-
|
107 |
-
return $currency;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* @return string
|
112 |
-
*/
|
113 |
-
public static function getUserCountry(){
|
114 |
-
|
115 |
-
if ( defined( 'WCML_GEOLOCATED_COUNTRY' ) ) {
|
116 |
-
return WCML_GEOLOCATED_COUNTRY;
|
117 |
-
}
|
118 |
-
|
119 |
-
$allUserCountries = [
|
120 |
-
'billing' => self::getUserCountryByAddress( 'billing' ),
|
121 |
-
'shipping' => self::getUserCountryByAddress( 'shipping' ),
|
122 |
-
'geolocation' => self::getCountryByUserIp()
|
123 |
-
];
|
124 |
-
$userCountry = $allUserCountries['billing'] ?: $allUserCountries['geolocation'];
|
125 |
-
|
126 |
-
/**
|
127 |
-
* This filter allows to override the address country declared by the user.
|
128 |
-
*
|
129 |
-
* @since 4.11.0
|
130 |
-
*
|
131 |
-
* @param string $userCountry Billing address used if set otherwise geolocation country used.
|
132 |
-
* @param array $allUserCountries {
|
133 |
-
* @type string $billing The billing address country
|
134 |
-
* @type string $shipping The shipping address country
|
135 |
-
* @type string $geolocation The geolocation country
|
136 |
-
* }
|
137 |
-
*
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
return apply_filters( 'wcml_geolocation_get_user_country', $userCountry, $allUserCountries );
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Get country code from address if user logged-in.
|
145 |
-
*
|
146 |
-
* @param string $addressType Shipping or Billing address.
|
147 |
-
*
|
148 |
-
* @return string
|
149 |
-
*/
|
150 |
-
private static function getUserCountryByAddress( $addressType ){
|
151 |
-
|
152 |
-
$orderCountry = self::getUserCountryFromOrder( $addressType );
|
153 |
-
if( $orderCountry ){
|
154 |
-
return $orderCountry;
|
155 |
-
}
|
156 |
-
|
157 |
-
$current_user_id = get_current_user_id();
|
158 |
-
|
159 |
-
if ( $current_user_id ) {
|
160 |
-
$customer = new \WC_Customer( $current_user_id, WC()->session ? true : false );
|
161 |
-
|
162 |
-
return 'shipping' === $addressType ? $customer->get_shipping_country() : $customer->get_billing_country();
|
163 |
-
}
|
164 |
-
|
165 |
-
return '';
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Get country code from order based on address.
|
170 |
-
*
|
171 |
-
* @param string $addressType Shipping or Billing address.
|
172 |
-
*
|
173 |
-
* @return string
|
174 |
-
*/
|
175 |
-
private static function getUserCountryFromOrder( $addressType ) {
|
176 |
-
|
177 |
-
$country = '';
|
178 |
-
$wcAjax = Obj::prop( 'wc-ajax', $_GET );
|
179 |
-
|
180 |
-
if ( 'update_order_review' === $wcAjax && isset( $_POST['country'] ) ) {
|
181 |
-
$country = $_POST['country'];
|
182 |
-
} elseif ( 'checkout' === $wcAjax && isset( $_POST[ $addressType . '_country' ] ) ) {
|
183 |
-
$country = $_POST[ $addressType . '_country' ];
|
184 |
-
}
|
185 |
-
|
186 |
-
return wc_clean( wp_unslash( $country ) );
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* @param array $currencySettings
|
191 |
-
*
|
192 |
-
* @return bool
|
193 |
-
*/
|
194 |
-
public static function isCurrencyAvailableForCountry( $currencySettings ) {
|
195 |
-
|
196 |
-
if ( isset( $currencySettings['location_mode'] ) ) {
|
197 |
-
|
198 |
-
if ( 'all' === $currencySettings['location_mode'] ) {
|
199 |
-
return true;
|
200 |
-
}
|
201 |
-
|
202 |
-
if ( 'include' === $currencySettings['location_mode'] && in_array( self::getUserCountry(), $currencySettings['countries'] ) ) {
|
203 |
-
return true;
|
204 |
-
}
|
205 |
-
|
206 |
-
if ( 'exclude' === $currencySettings['location_mode'] && ! in_array( self::getUserCountry(), $currencySettings['countries'] ) ) {
|
207 |
-
return true;
|
208 |
-
}
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
return false;
|
213 |
-
}
|
214 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/geolocation/GeolocationBackendHooks.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency;
|
4 |
-
|
5 |
-
class GeolocationBackendHooks implements \IWPML_Backend_Action {
|
6 |
-
|
7 |
-
public function add_hooks() {
|
8 |
-
add_filter( 'wcml_geolocation_is_used', [ Geolocation::class, 'isUsed' ] );
|
9 |
-
}
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/geolocation/GeolocationFrontendHooks.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\MultiCurrency;
|
4 |
-
|
5 |
-
class GeolocationFrontendHooks implements \IWPML_Frontend_Action {
|
6 |
-
|
7 |
-
const KEY_CLIENT_COUNTRY = 'wcml_client_country';
|
8 |
-
|
9 |
-
public function add_hooks() {
|
10 |
-
if ( Geolocation::isUsed() ) {
|
11 |
-
add_action( 'after_setup_theme', [ self::class, 'storeUserCountry' ] );
|
12 |
-
}
|
13 |
-
}
|
14 |
-
|
15 |
-
public static function storeUserCountry() {
|
16 |
-
wcml_user_store_set( self::KEY_CLIENT_COUNTRY, Geolocation::getUserCountry() );
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php
DELETED
@@ -1,212 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Currencies_Payment_Gateways
|
5 |
-
*/
|
6 |
-
class WCML_Currencies_Payment_Gateways {
|
7 |
-
|
8 |
-
const OPTION_KEY = 'wcml_custom_payment_gateways_for_currencies';
|
9 |
-
|
10 |
-
/** @var array */
|
11 |
-
private $payment_gateways;
|
12 |
-
|
13 |
-
/** @var array */
|
14 |
-
private $available_gateways;
|
15 |
-
|
16 |
-
/** @var array */
|
17 |
-
private $supported_gateways;
|
18 |
-
|
19 |
-
/** @var woocommerce_wpml */
|
20 |
-
private $woocommerce_wpml;
|
21 |
-
|
22 |
-
/** @var WPML_WP_API */
|
23 |
-
private $wp_api;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
27 |
-
* @param WPML_WP_API $wp_api
|
28 |
-
*/
|
29 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml, WPML_WP_API $wp_api ) {
|
30 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
31 |
-
$this->wp_api = $wp_api;
|
32 |
-
}
|
33 |
-
|
34 |
-
public function add_hooks() {
|
35 |
-
add_action( 'wp_loaded', [ $this, 'init_gateways' ] );
|
36 |
-
|
37 |
-
add_filter( 'woocommerce_gateway_description', [ $this, 'filter_gateway_description' ], 10, 2 );
|
38 |
-
add_filter( 'option_woocommerce_stripe_settings', [ 'WCML_Payment_Gateway_Stripe', 'filter_stripe_settings' ] );
|
39 |
-
|
40 |
-
// Temporary until we support "WooCommerce PayPal Payments" addon - wcml-3727
|
41 |
-
add_filter( 'woocommerce_should_load_paypal_standard', '__return_true' );
|
42 |
-
|
43 |
-
if ( ! is_admin() && wcml_is_multi_currency_on() ) {
|
44 |
-
add_filter(
|
45 |
-
'woocommerce_paypal_supported_currencies',
|
46 |
-
[ 'WCML_Payment_Gateway_PayPal', 'filter_supported_currencies' ]
|
47 |
-
);
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @param string $currency
|
53 |
-
*
|
54 |
-
* @return bool
|
55 |
-
*/
|
56 |
-
public function is_enabled( $currency ) {
|
57 |
-
$gateway_enabled_settings = $this->get_settings();
|
58 |
-
|
59 |
-
if ( isset( $gateway_enabled_settings[ $currency ] ) ) {
|
60 |
-
return $gateway_enabled_settings[ $currency ];
|
61 |
-
}
|
62 |
-
|
63 |
-
return false;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* @param string $currency
|
68 |
-
* @param bool $value
|
69 |
-
*/
|
70 |
-
public function set_enabled( $currency, $value ) {
|
71 |
-
$gateway_enabled_settings = $this->get_settings();
|
72 |
-
$gateway_enabled_settings[ $currency ] = $value;
|
73 |
-
|
74 |
-
update_option( self::OPTION_KEY, $gateway_enabled_settings );
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @return array
|
79 |
-
*/
|
80 |
-
private function get_settings() {
|
81 |
-
return get_option( self::OPTION_KEY, [] );
|
82 |
-
}
|
83 |
-
|
84 |
-
public function init_gateways() {
|
85 |
-
if ( null !== $this->payment_gateways ) {
|
86 |
-
return;
|
87 |
-
}
|
88 |
-
|
89 |
-
$this->payment_gateways = [];
|
90 |
-
$this->available_gateways = [];
|
91 |
-
$this->supported_gateways = [];
|
92 |
-
|
93 |
-
do_action( 'wcml_before_init_currency_payment_gateways' );
|
94 |
-
|
95 |
-
$this->available_gateways = $this->get_available_payment_gateways();
|
96 |
-
|
97 |
-
$this->supported_gateways = [
|
98 |
-
'bacs' => 'WCML_Payment_Gateway_Bacs',
|
99 |
-
'paypal' => 'WCML_Payment_Gateway_PayPal',
|
100 |
-
'stripe' => 'WCML_Payment_Gateway_Stripe',
|
101 |
-
];
|
102 |
-
$this->supported_gateways = apply_filters( 'wcml_supported_currency_payment_gateways', $this->supported_gateways );
|
103 |
-
|
104 |
-
$this->store_supported_gateways();
|
105 |
-
$this->store_non_supported_gateways();
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @return array
|
110 |
-
*/
|
111 |
-
public function get_gateways() {
|
112 |
-
$this->init_gateways();
|
113 |
-
|
114 |
-
return $this->payment_gateways;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* @return array
|
119 |
-
*/
|
120 |
-
public function get_supported_gateways() {
|
121 |
-
$this->init_gateways();
|
122 |
-
|
123 |
-
return $this->supported_gateways;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* @param string $description
|
128 |
-
* @param string $id
|
129 |
-
*
|
130 |
-
* @return string
|
131 |
-
*/
|
132 |
-
public function filter_gateway_description( $description, $id ) {
|
133 |
-
$this->init_gateways();
|
134 |
-
|
135 |
-
if ( in_array( $id, array_keys( $this->supported_gateways ), true ) ) {
|
136 |
-
|
137 |
-
$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
138 |
-
$default_currency = wcml_get_woocommerce_currency_option();
|
139 |
-
|
140 |
-
if ( $client_currency === $default_currency ) {
|
141 |
-
return $description;
|
142 |
-
}
|
143 |
-
|
144 |
-
$gateway_setting = $this->payment_gateways[ $id ]->get_setting( $client_currency );
|
145 |
-
$active_currencies = $this->woocommerce_wpml->multi_currency->get_currency_codes();
|
146 |
-
|
147 |
-
if (
|
148 |
-
$this->is_enabled( $client_currency ) &&
|
149 |
-
$gateway_setting &&
|
150 |
-
$client_currency !== $gateway_setting['currency'] &&
|
151 |
-
in_array( $gateway_setting['currency'], $active_currencies, true )
|
152 |
-
) {
|
153 |
-
$cart_total = $this->woocommerce_wpml->cart->get_formatted_cart_total_in_currency( $gateway_setting['currency'] );
|
154 |
-
|
155 |
-
$description .= '<p>';
|
156 |
-
$description .= sprintf(
|
157 |
-
// translators: 1: Currency, 2: Cart total.
|
158 |
-
__( 'Please note that the payment will be made in %1$s. %2$s will be debited from your account.', 'woocommerce-multilingual' ),
|
159 |
-
$gateway_setting['currency'],
|
160 |
-
$cart_total
|
161 |
-
);
|
162 |
-
$description .= '</p>';
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
return $description;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* @param string $id
|
171 |
-
* @param object $supported_gateway
|
172 |
-
*
|
173 |
-
* @return bool
|
174 |
-
*/
|
175 |
-
private function is_a_valid_gateway( $id, $supported_gateway ) {
|
176 |
-
return is_subclass_of( $supported_gateway, 'WCML_Payment_Gateway' ) && array_key_exists( $id, $this->available_gateways );
|
177 |
-
}
|
178 |
-
|
179 |
-
private function store_supported_gateways() {
|
180 |
-
if ( is_array( $this->supported_gateways ) ) {
|
181 |
-
/** @var \WCML_Payment_Gateway $supported_gateway */
|
182 |
-
$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
183 |
-
foreach ( $this->supported_gateways as $id => $supported_gateway ) {
|
184 |
-
if ( $this->is_a_valid_gateway( $id, $supported_gateway ) ) {
|
185 |
-
$this->payment_gateways[ $id ] = new $supported_gateway(
|
186 |
-
$this->available_gateways[ $id ],
|
187 |
-
$this->woocommerce_wpml
|
188 |
-
);
|
189 |
-
if ( $this->is_enabled( $client_currency ) ) {
|
190 |
-
$this->payment_gateways[ $id ]->add_hooks();
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
private function store_non_supported_gateways() {
|
198 |
-
$non_supported_gateways = array_diff( array_keys( $this->available_gateways ), array_keys( $this->payment_gateways ) );
|
199 |
-
|
200 |
-
/** @var int $non_supported_gateway */
|
201 |
-
foreach ( $non_supported_gateways as $non_supported_gateway ) {
|
202 |
-
$this->payment_gateways[ $non_supported_gateway ] = new WCML_Not_Supported_Payment_Gateway( $this->available_gateways[ $non_supported_gateway ], $this->woocommerce_wpml );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* @return array
|
208 |
-
*/
|
209 |
-
private function get_available_payment_gateways() {
|
210 |
-
return WC()->payment_gateways()->get_available_payment_gateways();
|
211 |
-
}
|
212 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-not-supported-payment-gateway.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Not_Supported_Payment_Gateway
|
5 |
-
*/
|
6 |
-
class WCML_Not_Supported_Payment_Gateway extends WCML_Payment_Gateway{
|
7 |
-
|
8 |
-
public function get_output_model() {
|
9 |
-
return [
|
10 |
-
'id' => $this->get_id(),
|
11 |
-
'title' => $this->get_title(),
|
12 |
-
'isSupported' => false,
|
13 |
-
'settings' => [],
|
14 |
-
'tooltip' => '',
|
15 |
-
'strings' => [
|
16 |
-
'labelNotYetSupported' => __( 'Not yet supported', 'woocommerce-multilingual' ),
|
17 |
-
],
|
18 |
-
];
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-bacs.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Payment_Gateway_Bacs
|
5 |
-
*/
|
6 |
-
class WCML_Payment_Gateway_Bacs extends WCML_Payment_Gateway {
|
7 |
-
|
8 |
-
public function get_output_model() {
|
9 |
-
return [
|
10 |
-
'id' => $this->get_id(),
|
11 |
-
'title' => $this->get_title(),
|
12 |
-
'isSupported' => true,
|
13 |
-
'settings' => $this->get_settings(),
|
14 |
-
'tooltip' => __( 'Set the currency in which your customer will see the final price when they checkout. Choose which accounts they will see in their payment message.', 'woocommerce-multilingual' ),
|
15 |
-
'strings' => [
|
16 |
-
'labelCurrency' => __( 'Currency', 'woocommerce-multilingual' ),
|
17 |
-
'labelBankAccount' => __( 'Bank Account', 'woocommerce-multilingual' ),
|
18 |
-
'optionAll' => __( 'All Accounts', 'woocommerce-multilingual' ),
|
19 |
-
'optionAllIn' => __( 'All in selected currency', 'woocommerce-multilingual' ),
|
20 |
-
],
|
21 |
-
];
|
22 |
-
}
|
23 |
-
|
24 |
-
public function add_hooks() {
|
25 |
-
add_filter( 'woocommerce_bacs_accounts', [ $this, 'filter_bacs_accounts' ] );
|
26 |
-
}
|
27 |
-
|
28 |
-
public function filter_bacs_accounts( $accounts ) {
|
29 |
-
|
30 |
-
$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
31 |
-
$gateway_setting = $this->get_setting( $client_currency );
|
32 |
-
|
33 |
-
$allowed_accounts = [];
|
34 |
-
|
35 |
-
if ( $gateway_setting && 'all' !== $gateway_setting['value'] ) {
|
36 |
-
|
37 |
-
if ( 'all_in' === $gateway_setting['value'] ) {
|
38 |
-
$bacs_accounts_currencies = get_option( WCML_WC_Gateways::WCML_BACS_ACCOUNTS_CURRENCIES_OPTION, [] );
|
39 |
-
foreach ( $bacs_accounts_currencies as $account_key => $currency ) {
|
40 |
-
if ( $gateway_setting['currency'] === $currency ) {
|
41 |
-
$allowed_accounts[] = $accounts[ $account_key ];
|
42 |
-
}
|
43 |
-
}
|
44 |
-
} else {
|
45 |
-
$allowed_accounts[] = $accounts[ $gateway_setting['value'] ];
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
return $allowed_accounts ? $allowed_accounts : $accounts;
|
50 |
-
}
|
51 |
-
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-paypal.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Payment_Gateway_PayPal
|
5 |
-
*/
|
6 |
-
class WCML_Payment_Gateway_PayPal extends WCML_Payment_Gateway {
|
7 |
-
|
8 |
-
const ID = 'paypal';
|
9 |
-
const SUPPORTED_CURRENCIES = [
|
10 |
-
'AUD',
|
11 |
-
'BRL',
|
12 |
-
'CAD',
|
13 |
-
'MXN',
|
14 |
-
'NZD',
|
15 |
-
'HKD',
|
16 |
-
'SGD',
|
17 |
-
'USD',
|
18 |
-
'EUR',
|
19 |
-
'JPY',
|
20 |
-
'TRY',
|
21 |
-
'NOK',
|
22 |
-
'CZK',
|
23 |
-
'DKK',
|
24 |
-
'HUF',
|
25 |
-
'ILS',
|
26 |
-
'MYR',
|
27 |
-
'PHP',
|
28 |
-
'PLN',
|
29 |
-
'SEK',
|
30 |
-
'CHF',
|
31 |
-
'TWD',
|
32 |
-
'THB',
|
33 |
-
'GBP',
|
34 |
-
'RMB',
|
35 |
-
'RUB',
|
36 |
-
'INR',
|
37 |
-
];
|
38 |
-
|
39 |
-
public function get_output_model() {
|
40 |
-
return [
|
41 |
-
'id' => $this->get_id(),
|
42 |
-
'title' => $this->get_title(),
|
43 |
-
'isSupported' => true,
|
44 |
-
'settings' => $this->get_currencies_details(),
|
45 |
-
'tooltip' => '',
|
46 |
-
'strings' => [
|
47 |
-
'labelCurrency' => __( 'Currency', 'woocommerce-multilingual' ),
|
48 |
-
'labelPayPalEmail' => __( 'PayPal Email', 'woocommerce-multilingual' ),
|
49 |
-
'tooltipNotSupported' => __( 'This gateway does not support %s. To show this gateway please select another currency.', 'woocommerce-multilingual' ),
|
50 |
-
],
|
51 |
-
];
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @param $currency
|
56 |
-
*
|
57 |
-
* @return bool
|
58 |
-
*/
|
59 |
-
public function is_valid_for_use( $currency ) {
|
60 |
-
|
61 |
-
$filter_removed = remove_filter( 'woocommerce_paypal_supported_currencies', [ 'WCML_Payment_Gateway_PayPal', 'filter_supported_currencies' ] );
|
62 |
-
|
63 |
-
$is_valid = in_array(
|
64 |
-
$currency,
|
65 |
-
apply_filters(
|
66 |
-
'woocommerce_paypal_supported_currencies',
|
67 |
-
self::SUPPORTED_CURRENCIES
|
68 |
-
),
|
69 |
-
true
|
70 |
-
);
|
71 |
-
|
72 |
-
if ( $filter_removed ) {
|
73 |
-
add_filter( 'woocommerce_paypal_supported_currencies', [ 'WCML_Payment_Gateway_PayPal', 'filter_supported_currencies' ] );
|
74 |
-
}
|
75 |
-
|
76 |
-
return $is_valid;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @param array $active_currencies
|
81 |
-
*
|
82 |
-
* @return array
|
83 |
-
*/
|
84 |
-
public function get_currencies_details() {
|
85 |
-
|
86 |
-
$currencies_details = [];
|
87 |
-
$default_currency = wcml_get_woocommerce_currency_option();
|
88 |
-
$woocommerce_currencies = get_woocommerce_currencies();
|
89 |
-
|
90 |
-
foreach ( $woocommerce_currencies as $code => $currency ) {
|
91 |
-
|
92 |
-
if ( $default_currency === $code ) {
|
93 |
-
$currencies_details[ $code ]['value'] = $this->get_gateway()->settings['email'];
|
94 |
-
$currencies_details[ $code ]['currency'] = $code;
|
95 |
-
$currencies_details[ $code ]['isValid'] = $this->is_valid_for_use( $default_currency );
|
96 |
-
} else {
|
97 |
-
$currency_gateway_setting = $this->get_setting( $code );
|
98 |
-
$currencies_details[ $code ]['value'] = $currency_gateway_setting ? $currency_gateway_setting['value'] : '';
|
99 |
-
$currencies_details[ $code ]['currency'] = $currency_gateway_setting ? $currency_gateway_setting['currency'] : $code;
|
100 |
-
$currencies_details[ $code ]['isValid'] = $this->is_valid_for_use( $code );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
return $currencies_details;
|
105 |
-
|
106 |
-
}
|
107 |
-
|
108 |
-
public function add_hooks() {
|
109 |
-
add_filter( 'woocommerce_paypal_args', [ $this, 'filter_paypal_args' ], 10, 2 );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* @param array $args
|
114 |
-
* @param WC_Order $order
|
115 |
-
*
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
public function filter_paypal_args( $args, $order ) {
|
119 |
-
|
120 |
-
$order_data = $order->get_data();
|
121 |
-
$client_currency = $order_data['currency'];
|
122 |
-
$gateway_setting = $this->get_setting( $client_currency );
|
123 |
-
|
124 |
-
if ( $gateway_setting ) {
|
125 |
-
|
126 |
-
if ( $gateway_setting['value'] ) {
|
127 |
-
$args['business'] = $gateway_setting['value'];
|
128 |
-
}
|
129 |
-
|
130 |
-
if ( $client_currency !== $gateway_setting['currency'] ) {
|
131 |
-
$args['currency_code'] = $gateway_setting['currency'];
|
132 |
-
$cart_items = WC()->cart->get_cart_contents();
|
133 |
-
$item_id = 1;
|
134 |
-
|
135 |
-
foreach ( $cart_items as $item ) {
|
136 |
-
$item_product_id = $item['variation_id'] ?: $item['product_id'];
|
137 |
-
$args[ 'amount_' . $item_id ] = $this->woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $item_product_id, $gateway_setting['currency'] );
|
138 |
-
$item_id ++;
|
139 |
-
}
|
140 |
-
|
141 |
-
$args['shipping_1'] = $this->woocommerce_wpml->cart->get_cart_shipping_in_currency( $gateway_setting['currency'] );
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
return $args;
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Filter PayPal supported currencies before WC initialized it
|
150 |
-
*
|
151 |
-
* @param array $supported_currencies
|
152 |
-
*
|
153 |
-
* @return array
|
154 |
-
*/
|
155 |
-
public static function filter_supported_currencies( $supported_currencies ) {
|
156 |
-
global $woocommerce_wpml;
|
157 |
-
|
158 |
-
$client_currency = $woocommerce_wpml->multi_currency->get_client_currency();
|
159 |
-
|
160 |
-
if ( ! in_array( $client_currency, self::SUPPORTED_CURRENCIES, true ) ) {
|
161 |
-
$gateway_settings = get_option( self::OPTION_KEY . self::ID, [] );
|
162 |
-
|
163 |
-
if ( $gateway_settings && isset( $gateway_settings[ $client_currency ] ) ) {
|
164 |
-
|
165 |
-
if ( in_array( $gateway_settings[ $client_currency ]['currency'], self::SUPPORTED_CURRENCIES, true ) ) {
|
166 |
-
$supported_currencies[] = $client_currency;
|
167 |
-
}
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
return $supported_currencies;
|
172 |
-
}
|
173 |
-
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-stripe.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Payment_Gateway_Stripe
|
5 |
-
*/
|
6 |
-
class WCML_Payment_Gateway_Stripe extends WCML_Payment_Gateway {
|
7 |
-
|
8 |
-
const ID = 'stripe';
|
9 |
-
|
10 |
-
public function get_output_model() {
|
11 |
-
return [
|
12 |
-
'id' => $this->get_id(),
|
13 |
-
'title' => $this->get_title(),
|
14 |
-
'isSupported' => true,
|
15 |
-
'settings' => $this->get_currencies_details(),
|
16 |
-
'tooltip' => '',
|
17 |
-
'strings' => [
|
18 |
-
'labelCurrency' => __( 'Currency', 'woocommerce-multilingual' ),
|
19 |
-
'labelLivePublishableKey' => __( 'Live Publishable Key', 'woocommerce-multilingual' ),
|
20 |
-
'labelLiveSecretKey' => __( 'Live Secret Key', 'woocommerce-multilingual' ),
|
21 |
-
],
|
22 |
-
];
|
23 |
-
}
|
24 |
-
|
25 |
-
public function add_hooks() {
|
26 |
-
add_filter( 'woocommerce_stripe_request_body', [ $this, 'filter_request_body' ] );
|
27 |
-
}
|
28 |
-
|
29 |
-
public function filter_request_body( $request ) {
|
30 |
-
|
31 |
-
$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
32 |
-
$gateway_setting = $this->get_setting( strtoupper( $request['currency'] ) );
|
33 |
-
|
34 |
-
if ( $gateway_setting ) {
|
35 |
-
|
36 |
-
if ( $client_currency !== $gateway_setting['currency'] ) {
|
37 |
-
$request['currency'] = strtolower( $gateway_setting['currency'] );
|
38 |
-
$request['amount'] = WC_Stripe_Helper::get_stripe_amount( $this->woocommerce_wpml->cart->get_cart_total_in_currency( $gateway_setting['currency'] ), $gateway_setting['currency'] );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
return $request;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @return array
|
47 |
-
*/
|
48 |
-
public function get_currencies_details() {
|
49 |
-
$currencies_details = [];
|
50 |
-
$default_currency = wcml_get_woocommerce_currency_option();
|
51 |
-
$active_currencies = get_woocommerce_currencies();
|
52 |
-
|
53 |
-
foreach ( $active_currencies as $code => $currency ) {
|
54 |
-
|
55 |
-
if ( $default_currency === $code ) {
|
56 |
-
$currencies_details[ $code ]['currency'] = $code;
|
57 |
-
$currencies_details[ $code ]['publishable_key'] = $this->get_gateway()->settings['publishable_key'];
|
58 |
-
$currencies_details[ $code ]['secret_key'] = $this->get_gateway()->settings['secret_key'];
|
59 |
-
} else {
|
60 |
-
$currency_gateway_setting = $this->get_setting( $code );
|
61 |
-
$currencies_details[ $code ]['currency'] = $currency_gateway_setting ? $currency_gateway_setting['currency'] : '';
|
62 |
-
$currencies_details[ $code ]['publishable_key'] = $currency_gateway_setting ? $currency_gateway_setting['publishable_key'] : '';
|
63 |
-
$currencies_details[ $code ]['secret_key'] = $currency_gateway_setting ? $currency_gateway_setting['secret_key'] : '';
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
return $currencies_details;
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Filter Stripe settings before WC initialized them
|
73 |
-
*
|
74 |
-
* @param array $settings
|
75 |
-
*
|
76 |
-
* @return array
|
77 |
-
*/
|
78 |
-
public static function filter_stripe_settings( $settings ) {
|
79 |
-
if ( is_admin() ) {
|
80 |
-
return $settings;
|
81 |
-
}
|
82 |
-
|
83 |
-
global $woocommerce_wpml;
|
84 |
-
|
85 |
-
$client_currency = $woocommerce_wpml->multi_currency->get_client_currency();
|
86 |
-
$gateway_settings = get_option( self::OPTION_KEY . self::ID, [] );
|
87 |
-
|
88 |
-
if ( $gateway_settings && isset( $gateway_settings[ $client_currency ] ) ) {
|
89 |
-
$gateway_setting = $gateway_settings[ $client_currency ];
|
90 |
-
if ( $gateway_setting['publishable_key'] && $gateway_setting['secret_key'] ) {
|
91 |
-
if ( 'yes' === $settings['testmode'] ) {
|
92 |
-
$settings['test_publishable_key'] = $gateway_setting['publishable_key'];
|
93 |
-
$settings['test_secret_key'] = $gateway_setting['secret_key'];
|
94 |
-
} else {
|
95 |
-
$settings['publishable_key'] = $gateway_setting['publishable_key'];
|
96 |
-
$settings['secret_key'] = $gateway_setting['secret_key'];
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
return $settings;
|
102 |
-
}
|
103 |
-
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/multi-currency/payment-gateways/class-wcml-payment-gateway.php
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Payment_Gateway
|
5 |
-
*/
|
6 |
-
abstract class WCML_Payment_Gateway {
|
7 |
-
|
8 |
-
const OPTION_KEY = 'wcml_payment_gateway_';
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var string
|
12 |
-
*/
|
13 |
-
protected $current_currency;
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
protected $default_currency;
|
18 |
-
/**
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
protected $active_currencies;
|
22 |
-
/**
|
23 |
-
* @var WC_Payment_Gateway
|
24 |
-
*/
|
25 |
-
protected $gateway;
|
26 |
-
|
27 |
-
private $settings = [];
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var woocommerce_wpml
|
31 |
-
*/
|
32 |
-
protected $woocommerce_wpml;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param WC_Payment_Gateway $gateway
|
36 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
37 |
-
*/
|
38 |
-
public function __construct( WC_Payment_Gateway $gateway, woocommerce_wpml $woocommerce_wpml ) {
|
39 |
-
$this->gateway = $gateway;
|
40 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
41 |
-
$this->settings = get_option( self::OPTION_KEY . $this->get_id(), [] );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @deprecated since 4.9.0, use React component instead.
|
46 |
-
*/
|
47 |
-
public function get_settings_output( $current_currency, $active_currencies ) {
|
48 |
-
return '';
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @deprecated since 4.9.0, use React component instead.
|
53 |
-
*/
|
54 |
-
public function show() {
|
55 |
-
return '';
|
56 |
-
}
|
57 |
-
|
58 |
-
abstract public function get_output_model();
|
59 |
-
|
60 |
-
protected function is_current_currency_default() {
|
61 |
-
if ( $this->current_currency === $this->default_currency ) {
|
62 |
-
return true;
|
63 |
-
}
|
64 |
-
return false;
|
65 |
-
}
|
66 |
-
/**
|
67 |
-
* @return WC_Payment_Gateway
|
68 |
-
*/
|
69 |
-
public function get_gateway() {
|
70 |
-
return $this->gateway;
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @return string
|
75 |
-
*/
|
76 |
-
public function get_id() {
|
77 |
-
return $this->gateway->id;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @return string
|
82 |
-
*/
|
83 |
-
public function get_title() {
|
84 |
-
return $this->gateway->title;
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @return array
|
89 |
-
*/
|
90 |
-
public function get_settings() {
|
91 |
-
return $this->settings;
|
92 |
-
}
|
93 |
-
|
94 |
-
private function save_settings() {
|
95 |
-
update_option( self::OPTION_KEY . $this->get_id(), $this->settings );
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* @param string $key
|
100 |
-
*
|
101 |
-
* @return mixed|null
|
102 |
-
*/
|
103 |
-
public function get_setting( $key ) {
|
104 |
-
return isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : null;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* @param string $key
|
109 |
-
* @param mixed $value
|
110 |
-
*/
|
111 |
-
public function save_setting( $key, $value ) {
|
112 |
-
$this->settings[ $key ] = $value;
|
113 |
-
$this->save_settings();
|
114 |
-
}
|
115 |
-
|
116 |
-
public function get_active_currencies() {
|
117 |
-
|
118 |
-
$active_currencies = $this->active_currencies;
|
119 |
-
|
120 |
-
if ( ! in_array( $this->current_currency, array_keys( $active_currencies ) ) ) {
|
121 |
-
$active_currencies[ $this->current_currency ] = [];
|
122 |
-
}
|
123 |
-
|
124 |
-
return $active_currencies;
|
125 |
-
}
|
126 |
-
|
127 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/order-property-filter/class-wcml-payment-method-filter.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Fns;
|
4 |
-
|
5 |
-
class WCML_Payment_Method_Filter {
|
6 |
-
/** @var array */
|
7 |
-
private $payment_gateway_cache = [];
|
8 |
-
|
9 |
-
public function add_hooks() {
|
10 |
-
add_filter(
|
11 |
-
'woocommerce_order_get_payment_method_title',
|
12 |
-
Fns::withoutRecursion( Fns::identity(), [ $this, 'payment_method_string' ] ),
|
13 |
-
10,
|
14 |
-
2
|
15 |
-
);
|
16 |
-
}
|
17 |
-
|
18 |
-
public function payment_method_string( $title, $object ) {
|
19 |
-
|
20 |
-
if ( ! empty( $title ) && $object->get_id() ) {
|
21 |
-
$payment_gateway = $this->get_payment_gateway( $object->get_id() );
|
22 |
-
|
23 |
-
if ( isset( $_POST['payment_method'] ) && $payment_gateway->id !== $_POST['payment_method'] && WC()->payment_gateways() ) {
|
24 |
-
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
25 |
-
if ( isset( $payment_gateways[ $_POST['payment_method'] ] ) ) {
|
26 |
-
$payment_gateway = $payment_gateways[ $_POST['payment_method'] ];
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
if ( $payment_gateway ) {
|
31 |
-
$settings = maybe_unserialize( get_option( 'woocommerce_' . $payment_gateway->id . '_settings' ) );
|
32 |
-
|
33 |
-
$title = apply_filters(
|
34 |
-
'wpml_translate_single_string',
|
35 |
-
! empty( $settings['title'] ) ? $settings['title'] : $payment_gateway->title,
|
36 |
-
'admin_texts_woocommerce_gateways',
|
37 |
-
$payment_gateway->id . '_gateway_title'
|
38 |
-
);
|
39 |
-
|
40 |
-
if ( $title === $payment_gateway->title ) {
|
41 |
-
$title = __( $payment_gateway->title, 'woocommerce' );
|
42 |
-
|
43 |
-
if ( 'cheque' === $payment_gateway->id && $title === $payment_gateway->title ) {
|
44 |
-
$title = _x( $payment_gateway->title, 'Check payment method', 'woocommerce' );
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
return $title;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @param int $object_id
|
55 |
-
*
|
56 |
-
* @return bool|WC_Payment_Gateway
|
57 |
-
*/
|
58 |
-
private function get_payment_gateway( $object_id ) {
|
59 |
-
if ( ! array_key_exists( $object_id, $this->payment_gateway_cache ) ) {
|
60 |
-
$payment_gateway = wc_get_payment_gateway_by_order( $object_id );
|
61 |
-
$this->payment_gateway_cache[ $object_id ] = $payment_gateway;
|
62 |
-
}
|
63 |
-
|
64 |
-
return $this->payment_gateway_cache[ $object_id ];
|
65 |
-
}
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/pointers/class-wcml-pointers.php
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Pointers{
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
add_action( 'admin_head', array( $this, 'setup' ) );
|
7 |
-
}
|
8 |
-
|
9 |
-
public function setup() {
|
10 |
-
$current_screen = get_current_screen();
|
11 |
-
|
12 |
-
if ( empty( $current_screen ) ) {
|
13 |
-
return;
|
14 |
-
}
|
15 |
-
|
16 |
-
$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
|
17 |
-
$section = isset( $_GET['section'] ) ? $_GET['section'] : '';
|
18 |
-
wp_register_style( 'wcml-pointers', WCML_PLUGIN_URL . '/res/css/wcml-pointers.css' );
|
19 |
-
|
20 |
-
if ( 'edit-product' === $current_screen->id ) {
|
21 |
-
add_action( 'admin_footer', array( $this, 'add_products_translation_link' ), 100 );
|
22 |
-
} elseif ( 'woocommerce_page_wc-settings' === $current_screen->id ) {
|
23 |
-
if ( 'shipping' === $tab && 'classes' === $section ) {
|
24 |
-
add_action( 'admin_footer', array( $this, 'add_shipping_classes_translation_link' ) );
|
25 |
-
} elseif ( ! $tab || 'general' === $tab ) {
|
26 |
-
add_filter( 'woocommerce_general_settings', array( $this, 'add_multi_currency_link' ) );
|
27 |
-
} elseif ( 'account' === $tab ) {
|
28 |
-
add_filter( 'woocommerce_account_settings', array( $this, 'add_endpoints_translation_link' ) );
|
29 |
-
}
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
public function add_products_translation_link() {
|
34 |
-
$link = admin_url( 'admin.php?page=wpml-wcml' );
|
35 |
-
$name = __( 'Translate WooCommerce products', 'woocommerce-multilingual' );
|
36 |
-
$anchor = '<a class="button button-small button-wpml wcml-pointer-products_translation" href="{{ url }}">{{ text }}</a>';
|
37 |
-
|
38 |
-
$this->add_link_with_jquery( $link, $name, $anchor, '.subsubsub' );
|
39 |
-
}
|
40 |
-
|
41 |
-
public function add_shipping_classes_translation_link() {
|
42 |
-
$link = admin_url( 'admin.php?page=wpml-wcml&tab=product_shipping_class' );
|
43 |
-
$name = __( 'Translate shipping classes', 'woocommerce-multilingual' );
|
44 |
-
$anchor = '<a class="button button-small button-wpml wcml-pointer-shipping_classes_translation" href="{{ url }}">{{ text }}</a>';
|
45 |
-
|
46 |
-
$this->add_link_with_jquery( $link, $name, $anchor, '.wc-shipping-classes', true );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @param array $settings
|
51 |
-
*
|
52 |
-
* @return array
|
53 |
-
*/
|
54 |
-
public function add_multi_currency_link( array $settings ) {
|
55 |
-
$link = admin_url( 'admin.php?page=wpml-wcml&tab=multi-currency' );
|
56 |
-
$name = __( 'Configure multi-currency for multilingual sites', 'woocommerce-multilingual' );
|
57 |
-
|
58 |
-
$anchor = '<a class="button button-small button-wpml wcml-pointer-multi_currency" href="{{ url }}">{{ text }}</a>';
|
59 |
-
|
60 |
-
return $this->add_link_with_settings( $link, $name, 'pricing_options', $settings, $anchor );
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @param array $settings
|
65 |
-
*
|
66 |
-
* @return array
|
67 |
-
*/
|
68 |
-
public function add_endpoints_translation_link( array $settings ) {
|
69 |
-
$link = admin_url( 'admin.php?page=wpml-wcml&tab=slugs' );
|
70 |
-
$name = __( 'Translate endpoints', 'woocommerce-multilingual' );
|
71 |
-
|
72 |
-
$anchor = '<a class="button button-small button-wpml wcml-pointer-endpoints_translation" href="{{ url }}">{{ text }}</a>';
|
73 |
-
|
74 |
-
return $this->add_link_with_settings( $link, $name, 'account_endpoint_options', $settings, $anchor );
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @param string $link
|
79 |
-
* @param string $name
|
80 |
-
* @param string $anchor_template
|
81 |
-
* @param string $jquery_selector
|
82 |
-
* @param bool $before
|
83 |
-
*/
|
84 |
-
private function add_link_with_jquery( $link, $name, $anchor_template, $jquery_selector, $before = false ) {
|
85 |
-
wp_enqueue_style( 'wcml-pointers' );
|
86 |
-
|
87 |
-
$method = $before ? 'before' : 'append';
|
88 |
-
// @todo move to an enqueued script?.
|
89 |
-
?>
|
90 |
-
<script type="text/javascript">
|
91 |
-
jQuery('<?php echo $jquery_selector; ?>').<?php echo $method; ?>('<?php echo $this->get_anchor( $link, $name, $anchor_template ); ?>');
|
92 |
-
</script>
|
93 |
-
<?php
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* @param string $link
|
98 |
-
* @param string $name
|
99 |
-
* @param string $setting_key
|
100 |
-
* @param array $settings
|
101 |
-
* @param string $anchor_template
|
102 |
-
*
|
103 |
-
* @return array
|
104 |
-
*/
|
105 |
-
private function add_link_with_settings( $link, $name, $setting_key, array $settings, $anchor_template ) {
|
106 |
-
wp_enqueue_style( 'wcml-pointers' );
|
107 |
-
foreach ( $settings as $key => $value ) {
|
108 |
-
if ( $setting_key === $value['id'] && isset( $value['desc'] ) ) {
|
109 |
-
|
110 |
-
$settings[ $key ]['desc'] = $this->get_anchor( $link, $name, $anchor_template ) . '<br />' . $value['desc'];
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
return $settings;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* @param string $link
|
119 |
-
* @param string $name
|
120 |
-
* @param string $anchor_template
|
121 |
-
*
|
122 |
-
* @return string
|
123 |
-
*/
|
124 |
-
private function get_anchor( $link, $name, $anchor_template ) {
|
125 |
-
return str_replace( array( '{{ url }}', '{{ text }}' ), array( $link, $name ), $anchor_template );
|
126 |
-
}
|
127 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/privacy/class-wcml-privacy-content-factory.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @author OnTheGo Systems
|
5 |
-
*/
|
6 |
-
class WCML_Privacy_Content_Factory implements IWPML_Backend_Action_Loader {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @return IWPML_Action
|
10 |
-
*/
|
11 |
-
public function create() {
|
12 |
-
if ( class_exists( 'WPML_Privacy_Content' ) ) {
|
13 |
-
return new WCML_Privacy_Content();
|
14 |
-
}
|
15 |
-
|
16 |
-
return null;
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/privacy/class-wcml-privacy-content.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @author OnTheGo Systems
|
5 |
-
*/
|
6 |
-
class WCML_Privacy_Content extends WPML_Privacy_Content {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @return string
|
10 |
-
*/
|
11 |
-
protected function get_plugin_name() {
|
12 |
-
return 'WooCommerce Multilingual';
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @return string|array
|
17 |
-
*/
|
18 |
-
protected function get_privacy_policy() {
|
19 |
-
return [
|
20 |
-
__( 'WooCommerce Multilingual will use cookies to understand the basket info when using languages in domains and to transfer data between the domains.', 'woocommerce-multilingual' ),
|
21 |
-
__( 'WooCommerce Multilingual will also use cookies to identify the language and currency of each customer’s order as well as the currency of the reports created by WooCommerce. WooCommerce Multilingual extends these reports by adding the currency’s information.', 'woocommerce-multilingual' ),
|
22 |
-
];
|
23 |
-
}
|
24 |
-
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/product/Hooks.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Products;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
use WPML\LIB\WP\Hooks as WpHooks;
|
7 |
-
use function WPML\FP\spreadArgs;
|
8 |
-
|
9 |
-
class Hooks implements \IWPML_Frontend_Action, \IWPML_Backend_Action {
|
10 |
-
|
11 |
-
public function add_hooks() {
|
12 |
-
WpHooks::onFilter( 'woocommerce_variable_children_args' )
|
13 |
-
->then( spreadArgs( self::forceProductLanguageInQuery() ) );
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @return \Closure array -> array
|
18 |
-
*/
|
19 |
-
private static function forceProductLanguageInQuery() {
|
20 |
-
return function( $args ) {
|
21 |
-
return Obj::assoc(
|
22 |
-
'wpml_lang',
|
23 |
-
apply_filters( 'wpml_element_language_code', '', [ 'element_id' => Obj::prop( 'post_parent', $args ), 'element_type' => 'product_variation' ] ),
|
24 |
-
$args
|
25 |
-
);
|
26 |
-
};
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/product/class-wcml-product-data-store-cpt.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WCML_Product_Data_Store_CPT
|
4 |
-
*/
|
5 |
-
class WCML_Product_Data_Store_CPT extends WC_Product_Data_Store_CPT {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @param int $product_id
|
9 |
-
*/
|
10 |
-
public function update_lookup_table_data( $product_id ) {
|
11 |
-
if ( method_exists( $this, 'update_lookup_table' ) ) {
|
12 |
-
$this->update_lookup_table( $product_id, 'wc_product_meta_lookup' );
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/shortcodes/class-wcml-wc-shortcode-product-category.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\Collect\Support\Collection;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class WCML_WC_Shortcode_Product_Category
|
7 |
-
*
|
8 |
-
* @since 4.2.2
|
9 |
-
*/
|
10 |
-
class WCML_WC_Shortcode_Product_Category {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* @var SitePress
|
14 |
-
*/
|
15 |
-
private $sitepress;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* WCML_WC_Shortcode_Product_Category constructor.
|
19 |
-
*
|
20 |
-
* @param SitePress $sitepress
|
21 |
-
*/
|
22 |
-
public function __construct( SitePress $sitepress ) {
|
23 |
-
$this->sitepress = $sitepress;
|
24 |
-
}
|
25 |
-
|
26 |
-
public function add_hooks() {
|
27 |
-
add_filter( 'woocommerce_shortcode_products_query', [ $this, 'translate_category' ], 10, 2 );
|
28 |
-
}
|
29 |
-
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @param array $args
|
33 |
-
* @param array $atts
|
34 |
-
*
|
35 |
-
* @return array
|
36 |
-
*/
|
37 |
-
public function translate_category( $args, $atts = null ) {
|
38 |
-
|
39 |
-
if ( $this->sitepress->get_default_language() !== $this->sitepress->get_current_language() ) {
|
40 |
-
|
41 |
-
if ( isset( $args['product_cat'] ) ) {
|
42 |
-
$args = $this->translate_categories_using_simple_tax_query( $args );
|
43 |
-
} elseif ( ! empty( $atts['category'] ) && isset( $args['tax_query'] ) ) {
|
44 |
-
$getProductCategoryObject = function ( $slugOrId ) {
|
45 |
-
if ( is_numeric( $slugOrId ) ) {
|
46 |
-
return get_term( $slugOrId, 'product_cat' );
|
47 |
-
}
|
48 |
-
|
49 |
-
return get_term_by( 'slug', $slugOrId, 'product_cat' );
|
50 |
-
};
|
51 |
-
|
52 |
-
$categories = wpml_collect( explode( ',', $atts['category'] ) )
|
53 |
-
->map(
|
54 |
-
function( $slugOrId ) {
|
55 |
-
return trim( $slugOrId ); }
|
56 |
-
)
|
57 |
-
->filter()
|
58 |
-
->map( $getProductCategoryObject );
|
59 |
-
|
60 |
-
$args = $this->replace_category_in_query_arguments( $args, $categories );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
return $args;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @param array $args
|
69 |
-
* @param Collection $terms
|
70 |
-
*
|
71 |
-
* @return array
|
72 |
-
*/
|
73 |
-
private function replace_category_in_query_arguments( array $args, Collection $terms ) {
|
74 |
-
|
75 |
-
foreach ( $args['tax_query'] as $i => $tax_query ) {
|
76 |
-
$args['tax_query'][ $i ] = [];
|
77 |
-
if ( ! is_int( key( $tax_query ) ) ) {
|
78 |
-
$tax_query = [ $tax_query ];
|
79 |
-
}
|
80 |
-
foreach ( $tax_query as $j => $condition ) {
|
81 |
-
if ( 'product_cat' === $condition['taxonomy'] ) {
|
82 |
-
$condition['terms'] = $terms->pluck( $condition['field'] )->toArray();
|
83 |
-
}
|
84 |
-
$args['tax_query'][ $i ][] = $condition;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
return $args;
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* @param $args array
|
93 |
-
*
|
94 |
-
* @return array
|
95 |
-
*/
|
96 |
-
public function translate_categories_using_simple_tax_query( $args ) {
|
97 |
-
|
98 |
-
$category_slugs = array_map( 'trim', explode( ',', $args['product_cat'] ) );
|
99 |
-
|
100 |
-
$filter_exists = remove_filter( 'terms_clauses', [ $this->sitepress, 'terms_clauses' ], 10 );
|
101 |
-
$categories_translated = get_terms(
|
102 |
-
[
|
103 |
-
'slug' => $category_slugs,
|
104 |
-
'taxonomy' => 'product_cat',
|
105 |
-
]
|
106 |
-
);
|
107 |
-
if ( $filter_exists ) {
|
108 |
-
add_filter( 'terms_clauses', [ $this->sitepress, 'terms_clauses' ], 10, 3 );
|
109 |
-
}
|
110 |
-
|
111 |
-
$category_slugs_translated = [];
|
112 |
-
foreach ( $categories_translated as $category_translated ) {
|
113 |
-
$category_slugs_translated[] = $category_translated->slug;
|
114 |
-
}
|
115 |
-
$args['product_cat'] = implode( ',', $category_slugs_translated );
|
116 |
-
|
117 |
-
return $args;
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/taxonomy-translation/class-wcml-taxonomy-translation-link-filters.php
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Taxonomy_Translation_Link_Filters {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var WCML_Attributes
|
7 |
-
*/
|
8 |
-
private $wcml_attributes;
|
9 |
-
|
10 |
-
public function __construct( WCML_Attributes $wcml_attributes ) {
|
11 |
-
$this->wcml_attributes = $wcml_attributes;
|
12 |
-
}
|
13 |
-
|
14 |
-
public function add_filters() {
|
15 |
-
add_filter( 'wpml_notice_text', [ $this, 'override_translation_notice_text' ], 10, 2 );
|
16 |
-
add_filter( 'wpml_taxonomy_slug_translation_ui', [ $this, 'slug_translation_ui_class' ], 10, 2 );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @param string text
|
21 |
-
* @param array $notice
|
22 |
-
*
|
23 |
-
* @return string
|
24 |
-
*/
|
25 |
-
public function override_translation_notice_text( $text, $notice ) {
|
26 |
-
if ( 'taxonomy-term-help-notices' === $notice['group'] ) {
|
27 |
-
$taxonomy = get_taxonomy( $notice['id'] );
|
28 |
-
$built_in_taxonomies = [ 'product_cat', 'product_tag', 'product_shipping_class' ];
|
29 |
-
if ( false !== $taxonomy && in_array( $notice['id'], $built_in_taxonomies ) ) {
|
30 |
-
|
31 |
-
$link = sprintf(
|
32 |
-
'<a href="%s">%s</a>',
|
33 |
-
$this->get_screen_url( $taxonomy->name ),
|
34 |
-
sprintf( esc_html__( '%s translation', 'woocommerce-multilingual' ), $taxonomy->labels->singular_name )
|
35 |
-
);
|
36 |
-
|
37 |
-
$text = sprintf(
|
38 |
-
esc_html__( 'Translating %1$s? Use the %2$s table for easier translation.', 'woocommerce-multilingual' ),
|
39 |
-
$taxonomy->labels->name,
|
40 |
-
$link
|
41 |
-
);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
return $text;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @param string $taxonomy
|
50 |
-
*
|
51 |
-
* @return string
|
52 |
-
*/
|
53 |
-
public function get_screen_url( $taxonomy = '' ) {
|
54 |
-
$url = false;
|
55 |
-
|
56 |
-
$base_url = admin_url( 'admin.php' );
|
57 |
-
$args = [ 'page' => 'wpml-wcml' ];
|
58 |
-
|
59 |
-
$built_in_taxonomies = [ 'product_cat', 'product_tag', 'product_shipping_class' ];
|
60 |
-
if ( in_array( $taxonomy, $built_in_taxonomies, true ) ) {
|
61 |
-
$args['tab'] = $taxonomy;
|
62 |
-
} else {
|
63 |
-
|
64 |
-
$translatable_attributes = $this->get_translatable_attributes();
|
65 |
-
|
66 |
-
if ( in_array( $taxonomy, $translatable_attributes, true ) ) {
|
67 |
-
$args['tab'] = 'product-attributes';
|
68 |
-
$args['taxonomy'] = $taxonomy;
|
69 |
-
} else {
|
70 |
-
$custom_taxonomies = get_object_taxonomies( 'product', 'objects' );
|
71 |
-
|
72 |
-
$translatable_taxonomies = [];
|
73 |
-
foreach ( $custom_taxonomies as $product_taxonomy_name => $product_taxonomy_object ) {
|
74 |
-
if ( is_taxonomy_translated( $product_taxonomy_name ) ) {
|
75 |
-
$translatable_taxonomies[] = $product_taxonomy_name;
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
if ( in_array( $taxonomy, $translatable_taxonomies, true ) ) {
|
80 |
-
$args['tab'] = 'custom-taxonomies';
|
81 |
-
$args['taxonomy'] = $taxonomy;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( count( $args ) > 1 ) {
|
87 |
-
$url = add_query_arg( $args, $base_url );
|
88 |
-
}
|
89 |
-
|
90 |
-
return $url;
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
private function get_translatable_attributes() {
|
95 |
-
|
96 |
-
$translatable_attributes = [];
|
97 |
-
foreach ( $this->wcml_attributes->get_translatable_attributes() as $attribute ) {
|
98 |
-
$translatable_attributes[] = 'pa_' . $attribute->attribute_name;
|
99 |
-
}
|
100 |
-
|
101 |
-
return $translatable_attributes;
|
102 |
-
}
|
103 |
-
|
104 |
-
public function slug_translation_ui_class( $ui_class, $taxonomy ) {
|
105 |
-
|
106 |
-
if ( in_array( $taxonomy, $this->get_translatable_attributes() ) ) {
|
107 |
-
|
108 |
-
$ui_class = new WCML_St_Taxonomy_UI( get_taxonomy( $taxonomy ) );
|
109 |
-
}
|
110 |
-
|
111 |
-
return $ui_class;
|
112 |
-
}
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/templates/php/model.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author OnTheGo Systems
|
4 |
-
* @package WPML\Templates
|
5 |
-
*/
|
6 |
-
|
7 |
-
namespace WPML\Templates\PHP;
|
8 |
-
|
9 |
-
class Model {
|
10 |
-
/**
|
11 |
-
* @var \WPML\Templates\PHP\Model[]|mixed[]
|
12 |
-
*/
|
13 |
-
private $attributes = [];
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Model constructor.
|
17 |
-
*
|
18 |
-
* @param array $data
|
19 |
-
*/
|
20 |
-
public function __construct( $data = [] ) {
|
21 |
-
foreach ( $data as $key => $value ) {
|
22 |
-
$this->__set( $key, $value );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* If a property does not exist, the method will create it as an "empty" instance of `Model`
|
28 |
-
* so that children properties can be called without throwing errors.
|
29 |
-
*
|
30 |
-
* @param string $name
|
31 |
-
*
|
32 |
-
* @return mixed|null
|
33 |
-
* @see \WPML\Templates\PHP\Model::__toString
|
34 |
-
*/
|
35 |
-
public function __get( $name ) {
|
36 |
-
if ( ! array_key_exists( $name, $this->attributes ) ) {
|
37 |
-
$this->attributes[ $name ] = new Model();
|
38 |
-
}
|
39 |
-
|
40 |
-
return $this->attributes[ $name ];
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* It ensures that $value is always either an array or a primitive type.
|
45 |
-
*
|
46 |
-
* @param string $name
|
47 |
-
* @param mixed $value
|
48 |
-
*/
|
49 |
-
public function __set( $name, $value ) {
|
50 |
-
if ( is_object( $value ) ) {
|
51 |
-
$value = get_object_vars( $value );
|
52 |
-
}
|
53 |
-
if ( is_array( $value ) ) {
|
54 |
-
$is_assoc = is_array( $value ) && count( array_filter( array_keys( $value ), 'is_string' ) ) > 0;
|
55 |
-
if($is_assoc) {
|
56 |
-
$value = new Model( $value );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
$this->attributes[ $name ] = $value;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @param string $name
|
64 |
-
*
|
65 |
-
* @return bool
|
66 |
-
*/
|
67 |
-
public function hasValue( $name ) {
|
68 |
-
return ! $this->isNull( $name ) && ! $this->isEmpty( $name );
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param string $name
|
73 |
-
*
|
74 |
-
* @return bool
|
75 |
-
*/
|
76 |
-
public function isNull( $name ) {
|
77 |
-
return $this->__get( $name ) === null;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @param string $name
|
82 |
-
*
|
83 |
-
* @return bool
|
84 |
-
*/
|
85 |
-
public function isEmpty( $name ) {
|
86 |
-
return $this->__get( $name ) === '' || ( ( $this->__get( $name ) instanceof Model ) && ! $this->__get( $name )->getAttributes() );
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @return mixed[]|\WPML\Templates\PHP\Model[]
|
91 |
-
*/
|
92 |
-
public function getAttributes() {
|
93 |
-
return $this->attributes;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* This logic allows using the model in a template even when referring to properties which do no exist.
|
98 |
-
*
|
99 |
-
* Example:
|
100 |
-
* `<h1><?php echo esc_html( $model->non_existing_property->title ); ?></h1>` Will output an empty string instead of throwing an error
|
101 |
-
*
|
102 |
-
* @return string
|
103 |
-
*/
|
104 |
-
public function __toString() {
|
105 |
-
if ( count( $this->attributes ) === 0 ) {
|
106 |
-
return '';
|
107 |
-
}
|
108 |
-
if ( count( $this->attributes ) === 1 ) {
|
109 |
-
return array_values( $this->attributes )[0];
|
110 |
-
}
|
111 |
-
|
112 |
-
return wp_json_encode( $this->attributes );
|
113 |
-
}
|
114 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/url-filters/class-wcml-url-filters-redirect-location.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Url_Filters_Redirect_Location {
|
4 |
-
/** @var WPML_URL_Converter */
|
5 |
-
private $wpml_url_converter;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @param WPML_URL_Converter $wpml_url_converter
|
9 |
-
*/
|
10 |
-
public function __construct( WPML_URL_Converter $wpml_url_converter ) {
|
11 |
-
$this->wpml_url_converter = $wpml_url_converter;
|
12 |
-
}
|
13 |
-
|
14 |
-
public function add_hooks() {
|
15 |
-
$hooks = [ 'woocommerce_get_checkout_payment_url', 'woocommerce_get_cancel_order_url', 'woocommerce_get_return_url' ];
|
16 |
-
|
17 |
-
foreach ( $hooks as $hook ) {
|
18 |
-
add_filter( $hook, [ $this, 'filter' ], 10, 1 );
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @param string $link
|
24 |
-
*
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public function filter( $link ) {
|
28 |
-
return html_entity_decode( $this->wpml_url_converter->convert_url( $link ) );
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/urls/class-wcml-xdomain-data.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Handles data being passed between different domains using WPML xDomain logic
|
5 |
-
* https://wpml.org/?page_id=693147
|
6 |
-
*/
|
7 |
-
class WCML_xDomain_Data {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @var WPML_Cookie
|
11 |
-
*/
|
12 |
-
private $cookie_handler;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* WCML_xDomain_Data constructor.
|
16 |
-
*
|
17 |
-
* @param WPML_Cookie $cookie_handler
|
18 |
-
*/
|
19 |
-
public function __construct( WPML_Cookie $cookie_handler ) {
|
20 |
-
$this->cookie_handler = $cookie_handler;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function add_hooks() {
|
24 |
-
add_filter( 'wpml_cross_domain_language_data', [ $this, 'pass_data_to_domain' ] );
|
25 |
-
add_action( 'before_woocommerce_init', [ $this, 'check_request' ] );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @param $data
|
30 |
-
*
|
31 |
-
* @return mixed
|
32 |
-
*/
|
33 |
-
public function pass_data_to_domain( $data ) {
|
34 |
-
|
35 |
-
$wcml_session_id = md5( microtime() . uniqid( mt_rand(), true ) );
|
36 |
-
$data['wcsid'] = $wcml_session_id;
|
37 |
-
$session_data = [];
|
38 |
-
|
39 |
-
if ( isset( $_COOKIE[ 'wp_woocommerce_session_' . COOKIEHASH ] ) ) {
|
40 |
-
$session_data['session'] = $_COOKIE[ 'wp_woocommerce_session_' . COOKIEHASH ];
|
41 |
-
}
|
42 |
-
|
43 |
-
if ( isset( $_COOKIE['woocommerce_cart_hash'] ) ) {
|
44 |
-
$session_data['hash'] = $_COOKIE['woocommerce_cart_hash'];
|
45 |
-
$session_data['items'] = $_COOKIE['woocommerce_items_in_cart'];
|
46 |
-
}
|
47 |
-
|
48 |
-
if ( ! empty( $session_data ) ) {
|
49 |
-
update_option( 'wcml_session_data_' . $wcml_session_id, $session_data );
|
50 |
-
}
|
51 |
-
|
52 |
-
return $data;
|
53 |
-
}
|
54 |
-
|
55 |
-
public function check_request() {
|
56 |
-
|
57 |
-
if ( has_filter( 'wpml_get_cross_domain_language_data' ) ) { // After WPML 3.2.7.
|
58 |
-
$xdomain_data = apply_filters( 'wpml_get_cross_domain_language_data', [] );
|
59 |
-
} elseif ( isset( $_GET['xdomain_data'] ) ) {
|
60 |
-
$xdomain_data = json_decode( base64_decode( $_GET['xdomain_data'] ), true );
|
61 |
-
}
|
62 |
-
|
63 |
-
if ( isset( $xdomain_data['wcsid'] ) ) {
|
64 |
-
$this->set_session_data( $xdomain_data['wcsid'] );
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param string $wcml_session_id
|
71 |
-
*/
|
72 |
-
private function set_session_data( $wcml_session_id ) {
|
73 |
-
|
74 |
-
$data = maybe_unserialize( get_option( 'wcml_session_data_' . $wcml_session_id ) );
|
75 |
-
|
76 |
-
if ( ! empty( $data ) ) {
|
77 |
-
|
78 |
-
$session_expiration = time() + (int) apply_filters( 'wc_session_expiration', 60 * 60 * 48 ); // 48 Hours.
|
79 |
-
$secure = apply_filters( 'wc_session_use_secure_cookie', false );
|
80 |
-
|
81 |
-
if ( isset( $data['session'] ) ) {
|
82 |
-
$this->cookie_handler->set_cookie( 'wp_woocommerce_session_' . COOKIEHASH, $data['session'], $session_expiration, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
83 |
-
$_COOKIE[ 'wp_woocommerce_session_' . COOKIEHASH ] = $data['session'];
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( isset( $data['hash'] ) ) {
|
87 |
-
$this->cookie_handler->set_cookie( 'woocommerce_cart_hash', $data['hash'], $session_expiration, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
88 |
-
$this->cookie_handler->set_cookie( 'woocommerce_items_in_cart', $data['items'], $session_expiration, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
89 |
-
$_COOKIE['woocommerce_cart_hash'] = $data['hash'];
|
90 |
-
$_COOKIE['woocommerce_items_in_cart'] = $data['items'];
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
delete_option( 'wcml_session_data_' . $wcml_session_id );
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/wcml-setup/BeforeHooks.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Setup;
|
4 |
-
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
use WPML\LIB\WP\Hooks;
|
7 |
-
use function WPML\FP\pipe;
|
8 |
-
|
9 |
-
class BeforeHooks implements \IWPML_Backend_Action, \IWPML_Frontend_Action, \IWPML_DIC_Action {
|
10 |
-
|
11 |
-
/** @var \woocommerce_wpml */
|
12 |
-
private $woocommerce_wpml;
|
13 |
-
|
14 |
-
public function __construct( \woocommerce_wpml $woocommerce_wpml ) {
|
15 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
16 |
-
}
|
17 |
-
|
18 |
-
public function add_hooks() {
|
19 |
-
if ( ! $this->woocommerce_wpml->get_setting( 'set_up_wizard_run' ) ) {
|
20 |
-
add_filter( 'get_translatable_documents_all', [ __CLASS__, 'blockProductTranslation' ] );
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @param array $translatablePostTypes
|
26 |
-
*
|
27 |
-
* @return array
|
28 |
-
*/
|
29 |
-
public static function blockProductTranslation( $translatablePostTypes ) {
|
30 |
-
unset( $translatablePostTypes['product'], $translatablePostTypes['product_variation'] );
|
31 |
-
return $translatablePostTypes;
|
32 |
-
}
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/wcml-setup/class-wcml-setup-handlers.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WCML\Options\WPML;
|
4 |
-
use WPML\FP\Fns;
|
5 |
-
use WPML\FP\Relation;
|
6 |
-
|
7 |
-
class WCML_Setup_Handlers {
|
8 |
-
|
9 |
-
/** @var woocommerce_wpml */
|
10 |
-
private $woocommerce_wpml;
|
11 |
-
|
12 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml ) {
|
13 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
14 |
-
}
|
15 |
-
|
16 |
-
public function save_attributes( array $data ) {
|
17 |
-
|
18 |
-
if ( isset( $data['attributes'] ) ) {
|
19 |
-
$this->woocommerce_wpml->attributes->set_translatable_attributes( $data['attributes'] );
|
20 |
-
}
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
public function save_multi_currency( array $data ) {
|
25 |
-
|
26 |
-
$this->woocommerce_wpml->get_multi_currency();
|
27 |
-
|
28 |
-
if ( ! empty( $data['enabled'] ) ) {
|
29 |
-
$this->woocommerce_wpml->multi_currency->enable();
|
30 |
-
} else {
|
31 |
-
$this->woocommerce_wpml->multi_currency->disable();
|
32 |
-
}
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
public function install_store_pages( array $data ) {
|
37 |
-
|
38 |
-
if ( ! empty( $data['install_missing_pages'] ) ) {
|
39 |
-
WC_Install::create_pages();
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( ! empty( $data['install_missing_pages'] ) || ! empty( $data['create_pages'] ) ) {
|
43 |
-
$this->woocommerce_wpml->store->create_missing_store_pages_with_redirect();
|
44 |
-
}
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @param array $data
|
50 |
-
*/
|
51 |
-
public function save_translation_options( $data ) {
|
52 |
-
$is = Relation::propEq( 'translation-option', Fns::__, $data );
|
53 |
-
$settings_helper = wpml_load_settings_helper();
|
54 |
-
|
55 |
-
if ( $is( 'translate_everything' ) ) {
|
56 |
-
$this->set_product_translatable( $settings_helper, true );
|
57 |
-
} elseif ( $is( 'translate_some' ) ) {
|
58 |
-
$this->set_product_translatable( $settings_helper, false );
|
59 |
-
} elseif ( $is( 'display_as_translated' ) ) {
|
60 |
-
$settings_helper->set_post_type_display_as_translated( 'product' );
|
61 |
-
$settings_helper->set_post_type_translation_unlocked_option( 'product' );
|
62 |
-
$settings_helper->set_taxonomy_display_as_translated( 'product_cat' );
|
63 |
-
$settings_helper->set_taxonomy_translation_unlocked_option( 'product_cat' );
|
64 |
-
|
65 |
-
WPML::setAutomatic( 'product', false );
|
66 |
-
} else {
|
67 |
-
$this->set_product_translatable( $settings_helper, false );
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param \WPML_Settings_Helper $settings_helper
|
73 |
-
*/
|
74 |
-
private function set_product_translatable( $settings_helper, $translate_everything ) {
|
75 |
-
$settings_helper->set_post_type_translatable( 'product' );
|
76 |
-
$settings_helper->set_post_type_translation_unlocked_option( 'product', false );
|
77 |
-
$settings_helper->set_taxonomy_translatable( 'product_cat' );
|
78 |
-
$settings_helper->set_taxonomy_translation_unlocked_option( 'product_cat', false );
|
79 |
-
|
80 |
-
WPML::setAutomatic( 'product', $translate_everything );
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/wcml-setup/class-wcml-setup-ui.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Setup_UI {
|
4 |
-
|
5 |
-
/** @var woocommerce_wpml */
|
6 |
-
private $woocommerce_wpml;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* WCML_Setup_UI constructor.
|
10 |
-
*
|
11 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
12 |
-
*/
|
13 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml ) {
|
14 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function add_hooks() {
|
18 |
-
if ( current_user_can( 'manage_options' ) && $this->is_wcml_setup_page() ) {
|
19 |
-
add_action( 'admin_menu', [ $this, 'admin_menus' ] );
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
public function add_wizard_notice_hook() {
|
24 |
-
|
25 |
-
if ( $this->must_display_the_wizard() ) {
|
26 |
-
add_filter( 'admin_notices', [ $this, 'wizard_notice' ] );
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @return bool
|
32 |
-
*/
|
33 |
-
private function must_display_the_wizard() {
|
34 |
-
global $pagenow;
|
35 |
-
|
36 |
-
$allowed_pages = [ 'index.php', 'plugins.php' ];
|
37 |
-
|
38 |
-
return in_array( $pagenow, $allowed_pages, true )
|
39 |
-
|| ( isset( $_GET['page'] ) && 'wpml-wcml' === $_GET['page'] );
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @return bool
|
45 |
-
*/
|
46 |
-
private function is_wcml_setup_page() {
|
47 |
-
return isset( $_GET['page'] ) && $_GET['page'] === 'wcml-setup';
|
48 |
-
}
|
49 |
-
|
50 |
-
public function admin_menus() {
|
51 |
-
add_dashboard_page( '', '', 'manage_options', 'wcml-setup', '' );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @param array $steps
|
56 |
-
* @param string $step
|
57 |
-
*
|
58 |
-
* @throws \WPML\Core\Twig_Error_Loader Exception.
|
59 |
-
* @throws \WPML\Core\Twig_Error_Runtime Exception.
|
60 |
-
* @throws \WPML\Core\Twig_Error_Syntax Exception.
|
61 |
-
*/
|
62 |
-
public function setup_header( $steps, $step ) {
|
63 |
-
set_current_screen( 'wcml-setup' );
|
64 |
-
$header = new WCML_Setup_Header_UI( $steps, $step );
|
65 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
66 |
-
echo $header->get_view();
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param array $steps
|
71 |
-
* @param string $current_step
|
72 |
-
*/
|
73 |
-
public function setup_steps( array $steps, $current_step ) {
|
74 |
-
$step_keys = array_keys( $steps );
|
75 |
-
array_shift( $steps );
|
76 |
-
?>
|
77 |
-
<ol class="wcml-setup-steps">
|
78 |
-
<?php foreach ( $steps as $step_key => $step ) : ?>
|
79 |
-
<li class="
|
80 |
-
<?php
|
81 |
-
if ( $step_key === $current_step ) {
|
82 |
-
echo 'active';
|
83 |
-
} elseif ( array_search( $current_step, $step_keys ) > array_search( $step_key, $step_keys ) ) {
|
84 |
-
echo 'done';
|
85 |
-
}
|
86 |
-
?>
|
87 |
-
"><?php echo esc_html( $step['name'] ); ?></li>
|
88 |
-
<?php endforeach; ?>
|
89 |
-
</ol>
|
90 |
-
<?php
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* @param mixed $view
|
95 |
-
*/
|
96 |
-
public function setup_content( $view ) {
|
97 |
-
|
98 |
-
echo '<div class="wcml-setup-content">';
|
99 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
100 |
-
echo $view->get_view();
|
101 |
-
echo '</div>';
|
102 |
-
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* @param bool $has_handler
|
107 |
-
*
|
108 |
-
* @throws \WPML\Core\Twig_Error_Loader Exception.
|
109 |
-
* @throws \WPML\Core\Twig_Error_Runtime Exception.
|
110 |
-
* @throws \WPML\Core\Twig_Error_Syntax Exception.
|
111 |
-
*/
|
112 |
-
public function setup_footer( $has_handler = false ) {
|
113 |
-
$footer = new WCML_Setup_Footer_UI( $has_handler );
|
114 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
115 |
-
echo $footer->get_view();
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* @throws \WPML\Core\Twig_Error_Loader Exception.
|
120 |
-
* @throws \WPML\Core\Twig_Error_Runtime Exception.
|
121 |
-
* @throws \WPML\Core\Twig_Error_Syntax Exception.
|
122 |
-
*/
|
123 |
-
public function wizard_notice() {
|
124 |
-
wp_enqueue_style( 'wcml-setup-wizard-notice', WCML_PLUGIN_URL . '/res/css/wcml-setup-wizard-notice.css' );
|
125 |
-
$notice = new WCML_Setup_Notice_UI();
|
126 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
127 |
-
echo $notice->get_view();
|
128 |
-
}
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/wcml-setup/class-wcml-setup.php
DELETED
@@ -1,279 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Setup
|
5 |
-
*/
|
6 |
-
class WCML_Setup {
|
7 |
-
|
8 |
-
/** @var WCML_Setup_UI */
|
9 |
-
private $ui;
|
10 |
-
/** @var WCML_Setup_Handlers */
|
11 |
-
private $handlers;
|
12 |
-
/** @var array */
|
13 |
-
private $steps;
|
14 |
-
/** @var string */
|
15 |
-
private $step;
|
16 |
-
/** @var woocommerce_wpml */
|
17 |
-
private $woocommerce_wpml;
|
18 |
-
/** @var SitePress */
|
19 |
-
private $sitepress;
|
20 |
-
/** @var string */
|
21 |
-
private $next_step = false;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* WCML_Setup constructor.
|
25 |
-
*
|
26 |
-
* @param WCML_Setup_UI $ui
|
27 |
-
* @param WCML_Setup_Handlers $handlers
|
28 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
29 |
-
* @param SitePress $sitepress
|
30 |
-
*/
|
31 |
-
public function __construct( WCML_Setup_UI $ui, WCML_Setup_Handlers $handlers, woocommerce_wpml $woocommerce_wpml, SitePress $sitepress ) {
|
32 |
-
|
33 |
-
$this->ui = $ui;
|
34 |
-
$this->handlers = $handlers;
|
35 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
36 |
-
$this->sitepress = $sitepress;
|
37 |
-
|
38 |
-
$this->steps = [
|
39 |
-
'introduction' => [
|
40 |
-
'name' => __( 'Introduction', 'woocommerce-multilingual' ),
|
41 |
-
'view' => new WCML_Setup_Introduction_UI(
|
42 |
-
$this->woocommerce_wpml,
|
43 |
-
$this->step_url( 'store-pages' )
|
44 |
-
),
|
45 |
-
'handler' => '',
|
46 |
-
],
|
47 |
-
'store-pages' => [
|
48 |
-
'name' => __( 'Store Pages', 'woocommerce-multilingual' ),
|
49 |
-
'view' => new WCML_Setup_Store_Pages_UI(
|
50 |
-
$this->woocommerce_wpml,
|
51 |
-
$this->sitepress,
|
52 |
-
$this->step_url( 'attributes' )
|
53 |
-
),
|
54 |
-
'handler' => [ $this->handlers, 'install_store_pages' ],
|
55 |
-
],
|
56 |
-
'attributes' => [
|
57 |
-
'name' => __( 'Global Attributes', 'woocommerce-multilingual' ),
|
58 |
-
'view' => new WCML_Setup_Attributes_UI(
|
59 |
-
$this->woocommerce_wpml,
|
60 |
-
$this->step_url( 'multi-currency' )
|
61 |
-
),
|
62 |
-
'handler' => [ $this->handlers, 'save_attributes' ],
|
63 |
-
],
|
64 |
-
'multi-currency' => [
|
65 |
-
'name' => __( 'Multiple Currencies', 'woocommerce-multilingual' ),
|
66 |
-
'view' => new WCML_Setup_Multi_Currency_UI(
|
67 |
-
$this->woocommerce_wpml,
|
68 |
-
$this->step_url( 'translation-options' )
|
69 |
-
),
|
70 |
-
'handler' => [ $this->handlers, 'save_multi_currency' ],
|
71 |
-
],
|
72 |
-
];
|
73 |
-
|
74 |
-
$this->steps['translation-options'] = [
|
75 |
-
'name' => __( 'Translation Options', 'woocommerce-multilingual' ),
|
76 |
-
'view' => new WCML_Setup_Translation_Options_UI(
|
77 |
-
$this->woocommerce_wpml,
|
78 |
-
$this->step_url( 'ready' )
|
79 |
-
),
|
80 |
-
'handler' => [ $this->handlers, 'save_translation_options' ],
|
81 |
-
];
|
82 |
-
|
83 |
-
$this->steps['ready'] = [
|
84 |
-
'name' => __( 'Ready!', 'woocommerce-multilingual' ),
|
85 |
-
'view' => new WCML_Setup_Ready_UI( $this->woocommerce_wpml ),
|
86 |
-
'handler' => '',
|
87 |
-
];
|
88 |
-
|
89 |
-
}
|
90 |
-
|
91 |
-
public function add_hooks() {
|
92 |
-
if ( current_user_can( 'manage_options' ) ) {
|
93 |
-
add_action( 'admin_init', [ $this, 'wizard' ] );
|
94 |
-
add_action( 'admin_init', [ $this, 'handle_steps' ], 0 );
|
95 |
-
add_filter( 'wp_redirect', [ $this, 'redirect_filters' ] );
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( ! $this->has_completed() ) {
|
99 |
-
$this->ui->add_wizard_notice_hook();
|
100 |
-
add_action( 'admin_init', [ $this, 'skip_setup' ], 1 );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
public function setup_redirect() {
|
105 |
-
if ( get_transient( '_wcml_activation_redirect' ) ) {
|
106 |
-
delete_transient( '_wcml_activation_redirect' );
|
107 |
-
|
108 |
-
if ( ! $this->do_not_redirect_to_setup() && ! $this->has_completed() ) {
|
109 |
-
wcml_safe_redirect( admin_url( 'index.php?page=wcml-setup' ) );
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
private function do_not_redirect_to_setup() {
|
115 |
-
|
116 |
-
// Before WC 4.6
|
117 |
-
$woocommerce_notices = get_option( 'woocommerce_admin_notices', [] );
|
118 |
-
$woocommerce_setup_not_run = in_array( 'install', $woocommerce_notices, true );
|
119 |
-
|
120 |
-
// Since WC 4.6
|
121 |
-
$needsWcWizardFirst = get_transient( '_wc_activation_redirect' );
|
122 |
-
|
123 |
-
return $this->is_wcml_setup_page() ||
|
124 |
-
is_network_admin() ||
|
125 |
-
isset( $_GET['activate-multi'] ) ||
|
126 |
-
! current_user_can( 'manage_options' ) ||
|
127 |
-
$woocommerce_setup_not_run ||
|
128 |
-
$needsWcWizardFirst;
|
129 |
-
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* @return bool
|
134 |
-
*/
|
135 |
-
private function is_wcml_setup_page() {
|
136 |
-
return isset( $_GET['page'] ) && 'wcml-setup' === $_GET['page'];
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* @return bool
|
141 |
-
*/
|
142 |
-
private function is_wcml_admin_page() {
|
143 |
-
return isset( $_GET['page'] ) && 'wcml' === $_GET['page'];
|
144 |
-
}
|
145 |
-
|
146 |
-
public function wizard() {
|
147 |
-
|
148 |
-
$this->splash_wizard_on_wcml_pages();
|
149 |
-
|
150 |
-
if ( ! $this->is_wcml_setup_page() ) {
|
151 |
-
return;
|
152 |
-
}
|
153 |
-
|
154 |
-
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
155 |
-
|
156 |
-
wp_enqueue_style( 'otgs-ico', ICL_PLUGIN_URL . '/res/css/otgs-ico.css', null, ICL_SITEPRESS_VERSION );
|
157 |
-
wp_enqueue_style(
|
158 |
-
'wcml-setup',
|
159 |
-
WCML_PLUGIN_URL . '/res/css/wcml-setup.css',
|
160 |
-
[
|
161 |
-
'dashicons',
|
162 |
-
'install',
|
163 |
-
OTGS_Assets_Handles::POPOVER_TOOLTIP,
|
164 |
-
],
|
165 |
-
WCML_VERSION
|
166 |
-
);
|
167 |
-
|
168 |
-
wp_enqueue_script( 'wcml-setup', WCML_PLUGIN_URL . '/res/js/wcml-setup.js', [ 'jquery', OTGS_Assets_Handles::POPOVER_TOOLTIP ], WCML_VERSION, true );
|
169 |
-
|
170 |
-
$this->ui->setup_header( $this->steps, $this->step );
|
171 |
-
|
172 |
-
$steps_keys = array_keys( $this->steps );
|
173 |
-
$step_index = array_search( $this->step, $steps_keys );
|
174 |
-
$this->next_step = isset( $steps_keys[ $step_index + 1 ] ) ? $steps_keys[ $step_index + 1 ] : '';
|
175 |
-
|
176 |
-
$this->ui->setup_steps( $this->steps, $this->step );
|
177 |
-
$this->ui->setup_content( $this->steps[ $this->step ]['view'] );
|
178 |
-
$this->ui->setup_footer( ! empty( $this->steps[ $this->step ]['handler'] ) );
|
179 |
-
|
180 |
-
if ( 'ready' === $this->step ) {
|
181 |
-
$this->complete_setup();
|
182 |
-
}
|
183 |
-
|
184 |
-
wp_die();
|
185 |
-
}
|
186 |
-
|
187 |
-
private function splash_wizard_on_wcml_pages() {
|
188 |
-
|
189 |
-
if ( isset( $_GET['src'] ) && 'setup_later' === $_GET['src'] ) {
|
190 |
-
$this->woocommerce_wpml->settings['set_up_wizard_splash'] = 1;
|
191 |
-
$this->woocommerce_wpml->update_settings();
|
192 |
-
}
|
193 |
-
|
194 |
-
if ( $this->is_wcml_admin_page() && ! $this->has_completed() && empty( $this->woocommerce_wpml->settings['set_up_wizard_splash'] ) ) {
|
195 |
-
wcml_safe_redirect( 'admin.php?page=wcml-setup' );
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
public function skip_setup() {
|
200 |
-
|
201 |
-
if ( isset( $_GET['wcml-setup-skip'] ) && isset( $_GET['_wcml_setup_nonce'] ) ) {
|
202 |
-
if ( ! wp_verify_nonce( $_GET['_wcml_setup_nonce'], 'wcml_setup_skip_nonce' ) ) {
|
203 |
-
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce-multilingual' ) );
|
204 |
-
}
|
205 |
-
|
206 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
207 |
-
wp_die( esc_html__( "Cheatin' huh?", 'woocommerce' ) );
|
208 |
-
}
|
209 |
-
|
210 |
-
$this->complete_setup();
|
211 |
-
remove_filter( 'admin_notices', [ $this->ui, 'wizard_notice' ] );
|
212 |
-
|
213 |
-
delete_transient( '_wcml_activation_redirect' );
|
214 |
-
}
|
215 |
-
|
216 |
-
}
|
217 |
-
|
218 |
-
public function complete_setup() {
|
219 |
-
$this->woocommerce_wpml->settings['set_up_wizard_run'] = 1;
|
220 |
-
$this->woocommerce_wpml->settings['set_up_wizard_splash'] = 1;
|
221 |
-
$this->woocommerce_wpml->update_settings();
|
222 |
-
}
|
223 |
-
|
224 |
-
private function has_completed() {
|
225 |
-
return ! empty( $this->woocommerce_wpml->settings['set_up_wizard_run'] );
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* @param string $url
|
230 |
-
*
|
231 |
-
* @return string
|
232 |
-
*/
|
233 |
-
public function redirect_filters( $url ) {
|
234 |
-
if ( isset( $_POST['next_step_url'] ) && $_POST['next_step_url'] ) {
|
235 |
-
$url = sanitize_text_field( $_POST['next_step_url'] );
|
236 |
-
}
|
237 |
-
return $url;
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* @param string $step
|
242 |
-
*
|
243 |
-
* @return string
|
244 |
-
*/
|
245 |
-
private function step_url( $step ) {
|
246 |
-
$url = admin_url( 'admin.php?page=wcml-setup&step=' . $step );
|
247 |
-
return $url;
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* @return string|void
|
252 |
-
*/
|
253 |
-
public function next_step_url() {
|
254 |
-
$url = $this->step_url( $this->next_step );
|
255 |
-
return $url;
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* @param string $step
|
260 |
-
*
|
261 |
-
* @return mixed
|
262 |
-
*/
|
263 |
-
private function get_handler( $step ) {
|
264 |
-
$handler = ! empty( $this->steps[ $step ]['handler'] ) ? $this->steps[ $step ]['handler'] : '';
|
265 |
-
return $handler;
|
266 |
-
}
|
267 |
-
|
268 |
-
public function handle_steps() {
|
269 |
-
if ( isset( $_POST['handle_step'] ) && wp_create_nonce( $_POST['handle_step'] ) === $_POST['nonce'] ) {
|
270 |
-
$step_name = sanitize_text_field( $_POST['handle_step'] );
|
271 |
-
if ( $handler = $this->get_handler( $step_name ) ) {
|
272 |
-
if ( is_callable( $handler, true ) ) {
|
273 |
-
call_user_func( $handler, $_POST );
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-accommodation-bookings.php
DELETED
@@ -1,199 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Accommodation_Bookings{
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var woocommerce_wpml
|
7 |
-
*/
|
8 |
-
private $woocommerce_wpml;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var WCML_Bookings
|
12 |
-
*/
|
13 |
-
private $bookings;
|
14 |
-
|
15 |
-
public function __construct(
|
16 |
-
woocommerce_wpml $woocommerce_wpml,
|
17 |
-
WCML_Bookings $bookings
|
18 |
-
) {
|
19 |
-
// @todo Cover by tests, required for wcml-3037.
|
20 |
-
|
21 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
22 |
-
$this->bookings = $bookings;
|
23 |
-
|
24 |
-
add_action( 'woocommerce_accommodation_bookings_after_booking_base_cost', [ $this, 'wcml_price_field_after_booking_base_cost', ] );
|
25 |
-
add_action( 'woocommerce_accommodation_bookings_after_booking_pricing_override_block_cost', [ $this, 'wcml_price_field_after_booking_pricing_override_block_cost', ], 10, 2 );
|
26 |
-
add_action( 'woocommerce_accommodation_bookings_after_bookings_pricing', [ $this, 'after_bookings_pricing' ] );
|
27 |
-
|
28 |
-
add_action( 'save_post', [ $this, 'save_custom_costs' ], 110, 2 );
|
29 |
-
add_filter( 'get_post_metadata', [ $this, 'product_price_filter' ], 9, 4 );
|
30 |
-
|
31 |
-
add_action( 'init', [ $this, 'load_assets' ], 100 );
|
32 |
-
}
|
33 |
-
|
34 |
-
public function wcml_price_field_after_booking_base_cost( $post_id ){
|
35 |
-
|
36 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
function wcml_price_field_after_booking_pricing_override_block_cost( $pricing, $post_id ){
|
41 |
-
|
42 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_pricing_override_block_cost', $pricing );
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
function after_bookings_pricing( $post_id ){
|
47 |
-
|
48 |
-
$product_terms = wp_get_post_terms( $post_id, 'product_type', array( "fields" => "names" ) );
|
49 |
-
|
50 |
-
if(
|
51 |
-
in_array( 'accommodation-booking', $product_terms )&&
|
52 |
-
$this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT &&
|
53 |
-
$this->woocommerce_wpml->products->is_original_product( $post_id )
|
54 |
-
){
|
55 |
-
|
56 |
-
$custom_costs_status = get_post_meta( $post_id, '_wcml_custom_costs_status', true );
|
57 |
-
|
58 |
-
$checked = !$custom_costs_status ? 'checked="checked"' : ' ';
|
59 |
-
|
60 |
-
echo '<div class="wcml_custom_costs">';
|
61 |
-
|
62 |
-
echo '<input type="radio" name="_wcml_custom_costs" id="wcml_custom_costs_auto" value="0" class="wcml_custom_costs_input" '. $checked .' />';
|
63 |
-
echo '<label for="wcml_custom_costs_auto">'. __('Calculate costs in other currencies automatically', 'woocommerce-multilingual') .'</label>';
|
64 |
-
|
65 |
-
$checked = $custom_costs_status == 1 ? 'checked="checked"' : ' ';
|
66 |
-
|
67 |
-
echo '<input type="radio" name="_wcml_custom_costs" value="1" id="wcml_custom_costs_manually" class="wcml_custom_costs_input" '. $checked .' />';
|
68 |
-
echo '<label for="wcml_custom_costs_manually">'. __('Set costs in other currencies manually', 'woocommerce-multilingual') .'</label>';
|
69 |
-
|
70 |
-
wp_nonce_field( 'wcml_save_accommodation_bookings_custom_costs', '_wcml_custom_costs_nonce' );
|
71 |
-
|
72 |
-
echo '</div>';
|
73 |
-
}
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
function echo_wcml_price_field( $post_id, $field, $pricing = false, $check = true, $resource_id = false ){
|
78 |
-
|
79 |
-
if(
|
80 |
-
$this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT &&
|
81 |
-
( !$check || $this->woocommerce_wpml->products->is_original_product( $post_id ) )
|
82 |
-
){
|
83 |
-
|
84 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
85 |
-
|
86 |
-
$wc_currencies = get_woocommerce_currencies();
|
87 |
-
|
88 |
-
echo '<div class="wcml_custom_cost_field" >';
|
89 |
-
|
90 |
-
foreach($currencies as $currency_code => $currency){
|
91 |
-
|
92 |
-
switch( $field ){
|
93 |
-
case 'wcml_wc_booking_base_cost':
|
94 |
-
woocommerce_wp_text_input( array( 'id' => 'wcml_wc_booking_base_cost', 'class'=>'wcml_bookings_custom_price', 'name' => 'wcml_wc_accommodation_booking_base_cost['.$currency_code.']', 'label' => get_woocommerce_currency_symbol($currency_code), 'description' => __( 'This is the cost per block booked. All other costs (for resources and persons) are added to this.', 'woocommerce-bookings' ), 'value' => get_post_meta( $post_id, '_wc_booking_base_cost_'.$currency_code, true ), 'type' => 'number', 'desc_tip' => true, 'custom_attributes' => array(
|
95 |
-
'min' => '',
|
96 |
-
'step' => '0.01'
|
97 |
-
) ) );
|
98 |
-
break;
|
99 |
-
|
100 |
-
|
101 |
-
case 'wcml_wc_booking_pricing_override_block_cost':
|
102 |
-
|
103 |
-
if( isset( $pricing[ 'override_block_'.$currency_code ] ) ){
|
104 |
-
$value = $pricing[ 'override_block_'.$currency_code ];
|
105 |
-
}else{
|
106 |
-
$value = '';
|
107 |
-
}
|
108 |
-
|
109 |
-
echo '<div class="wcml_bookings_range_block" >';
|
110 |
-
echo '<label>'. get_woocommerce_currency_symbol($currency_code) .'</label>';
|
111 |
-
echo '<input type="number" step="0.01" name="wcml_wc_accommodation_booking_pricing_override_block_cost['.$currency_code.']" class="wcml_bookings_custom_price" value="'. $value .'" placeholder="0" />';
|
112 |
-
echo '</div>';
|
113 |
-
break;
|
114 |
-
|
115 |
-
default:
|
116 |
-
break;
|
117 |
-
|
118 |
-
}
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
-
echo '</div>';
|
123 |
-
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
function save_custom_costs( $post_id, $post ){
|
128 |
-
|
129 |
-
$nonce = filter_input( INPUT_POST, '_wcml_custom_costs_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
130 |
-
|
131 |
-
if( isset( $_POST['_wcml_custom_costs'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_accommodation_bookings_custom_costs' ) ){
|
132 |
-
|
133 |
-
update_post_meta( $post_id, '_wcml_custom_costs_status', $_POST['_wcml_custom_costs'] );
|
134 |
-
|
135 |
-
if( $_POST['_wcml_custom_costs'] == 1 ){
|
136 |
-
|
137 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
138 |
-
|
139 |
-
foreach( $currencies as $code => $currency ){
|
140 |
-
|
141 |
-
$wc_booking_base_cost = $_POST[ 'wcml_wc_accommodation_booking_base_cost' ][ $code ];
|
142 |
-
update_post_meta( $post_id, '_wc_booking_base_cost_'.$code, $wc_booking_base_cost );
|
143 |
-
update_post_meta( $post_id, '_price_'.$code, $wc_booking_base_cost );
|
144 |
-
|
145 |
-
}
|
146 |
-
|
147 |
-
$updated_meta = array();
|
148 |
-
$booking_pricing = get_post_meta( $post_id, '_wc_booking_pricing', true );
|
149 |
-
|
150 |
-
foreach ( maybe_unserialize( $booking_pricing ) as $key => $prices ) {
|
151 |
-
|
152 |
-
$updated_meta[ $key ] = $prices;
|
153 |
-
|
154 |
-
foreach ( $currencies as $code => $currency ) {
|
155 |
-
|
156 |
-
$updated_meta[ $key ][ 'override_block_'.$code ] = $_POST[ 'wcml_wc_accommodation_booking_pricing_override_block_cost' ][ $code ];
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
}
|
161 |
-
|
162 |
-
update_post_meta( $post_id, '_wc_booking_pricing', $updated_meta );
|
163 |
-
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
function product_price_filter( $value, $object_id, $meta_key, $single ){
|
170 |
-
|
171 |
-
if(
|
172 |
-
$meta_key == '_price' &&
|
173 |
-
$this->woocommerce_wpml->settings[ 'enable_multi_currency' ] == WCML_MULTI_CURRENCIES_INDEPENDENT &&
|
174 |
-
!is_admin() &&
|
175 |
-
get_post_type( $object_id ) == 'product' &&
|
176 |
-
( $currency = $this->woocommerce_wpml->multi_currency->get_client_currency() ) !== wcml_get_woocommerce_currency_option()
|
177 |
-
) {
|
178 |
-
|
179 |
-
remove_filter( 'get_post_metadata', array( $this, 'product_price_filter' ), 9 );
|
180 |
-
|
181 |
-
$original_product = $this->woocommerce_wpml->products->get_original_product_id( $object_id );
|
182 |
-
|
183 |
-
if ( get_post_meta( $original_product, '_wcml_custom_costs_status' ) ) {
|
184 |
-
|
185 |
-
$price = get_post_meta( $object_id, '_price_' . $currency , true );
|
186 |
-
}
|
187 |
-
|
188 |
-
add_filter( 'get_post_metadata', array( $this, 'product_price_filter' ), 9, 4 );
|
189 |
-
}
|
190 |
-
|
191 |
-
return isset( $price) ? $price : $value;
|
192 |
-
}
|
193 |
-
|
194 |
-
public function load_assets(){
|
195 |
-
|
196 |
-
$this->bookings->load_assets( 'accommodation-booking' );
|
197 |
-
}
|
198 |
-
|
199 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-adventure-tours.php
DELETED
@@ -1,384 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Adventure_tours {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var woocommerce_wpml
|
7 |
-
*/
|
8 |
-
private $woocommerce_wpml;
|
9 |
-
/**
|
10 |
-
* @var SitePress
|
11 |
-
*/
|
12 |
-
private $sitepress;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @var WPML_Element_Translation_Package
|
16 |
-
*/
|
17 |
-
private $tp;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* WCML_Adventure_tours constructor.
|
21 |
-
*
|
22 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
23 |
-
* @param SitePress $sitepress
|
24 |
-
* @param WPML_Element_Translation_Package $tp
|
25 |
-
*/
|
26 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml, SitePress $sitepress, WPML_Element_Translation_Package $tp ) {
|
27 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
28 |
-
$this->sitepress = $sitepress;
|
29 |
-
$this->tp = $tp;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function add_hooks() {
|
33 |
-
add_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10, 4 );
|
34 |
-
add_filter( 'get_post_metadata', [ $this, 'product_price_filter' ], 9, 4 );
|
35 |
-
add_action( 'wpml_translation_job_saved', [ $this, 'save_tour_data_translation' ], 10, 3 );
|
36 |
-
|
37 |
-
if ( is_admin() ) {
|
38 |
-
|
39 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
40 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 4 );
|
41 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'tour_data_update' ], 10, 3 );
|
42 |
-
|
43 |
-
add_filter( 'wpml_tm_translation_job_data', [ $this, 'append_tour_data_translation_package' ], 10, 2 );
|
44 |
-
|
45 |
-
add_action( 'admin_footer', [ $this, 'load_assets' ] );
|
46 |
-
add_action( 'wcml_after_custom_prices_block', [ $this, 'add_custom_prices_block' ] );
|
47 |
-
add_action( 'wcml_after_save_custom_prices', [ $this, 'save_custom_costs' ] );
|
48 |
-
|
49 |
-
add_filter( 'wcml_is_variable_product', [ $this, 'is_variable_tour' ], 10, 2 );
|
50 |
-
add_filter( 'wcml_variation_term_taxonomy_ids', [ $this, 'add_tour_tax_id' ] );
|
51 |
-
add_filter( 'wcml_is_attributes_page', [ $this, 'is_attributes_page' ] );
|
52 |
-
add_filter( 'wcml_is_attributes_page', [ $this, 'is_attributes_page' ] );
|
53 |
-
|
54 |
-
add_filter(
|
55 |
-
'wcml_do_not_display_custom_fields_for_product',
|
56 |
-
[
|
57 |
-
$this,
|
58 |
-
'replace_tm_editor_custom_fields_with_own_sections',
|
59 |
-
]
|
60 |
-
);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
|
65 |
-
public function sync_tour_data_across_translations( $meta_id, $post_id, $meta_key, $tour_tabs_meta ) {
|
66 |
-
if ( 'tour_tabs_meta' !== $meta_key ) {
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
$post = get_post( $post_id );
|
71 |
-
|
72 |
-
// Skip auto-drafts // skip autosave.
|
73 |
-
if ( 'auto-draft' === $post->post_status || isset( $_POST['autosave'] ) ) {
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
if ( 'product' === $post->post_type ) {
|
78 |
-
|
79 |
-
remove_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10 );
|
80 |
-
|
81 |
-
$original_product_id = $post_id;
|
82 |
-
if ( ! $this->woocommerce_wpml->products->is_original_product( $post_id ) ) {
|
83 |
-
$original_product_language = $this->woocommerce_wpml->products->get_original_product_language( $post_id );
|
84 |
-
$original_product_id = apply_filters( 'translate_object_id', $post_id, 'product', true, $original_product_language );
|
85 |
-
}
|
86 |
-
|
87 |
-
$product_trid = $this->sitepress->get_element_trid( $original_product_id, 'post_product' );
|
88 |
-
$product_translations = $this->sitepress->get_element_translations( $product_trid, 'post_product' );
|
89 |
-
|
90 |
-
foreach ( $product_translations as $product_translation ) {
|
91 |
-
|
92 |
-
if ( empty( $product_translation->original ) ) {
|
93 |
-
|
94 |
-
$trnsl_tour_tabs_meta = get_post_meta( $product_translation->element_id, 'tour_tabs_meta', true );
|
95 |
-
|
96 |
-
$trnsl_tour_tabs_meta['tour_badge'] = $tour_tabs_meta['tour_badge'];
|
97 |
-
|
98 |
-
update_post_meta( $product_translation->element_id, 'tour_tabs_meta', $trnsl_tour_tabs_meta );
|
99 |
-
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
add_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10, 4 );
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
public function custom_box_html( $obj, $product_id, $data ) {
|
110 |
-
|
111 |
-
if ( $tour_tabs_meta = get_post_meta( $product_id, 'tour_tabs_meta', true ) ) {
|
112 |
-
|
113 |
-
$tour_section = new WPML_Editor_UI_Field_Section( __( 'Tour Data', 'woocommerce-multilingual' ) );
|
114 |
-
|
115 |
-
$divider = true;
|
116 |
-
|
117 |
-
foreach ( $tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
118 |
-
|
119 |
-
$group = new WPML_Editor_UI_Field_Group( '', $divider );
|
120 |
-
$composite_field = new WPML_Editor_UI_Single_Line_Field( 'adventure_tour_' . $tour_tab_id . '_title', __( 'Title', 'woocommerce-multilingual' ), $data, false );
|
121 |
-
$group->add_field( $composite_field );
|
122 |
-
$composite_field = new WPML_Editor_UI_Single_Line_Field( 'adventure_tour_' . $tour_tab_id . '_content', __( 'Content', 'woocommerce-multilingual' ), $data, false );
|
123 |
-
$group->add_field( $composite_field );
|
124 |
-
$tour_section->add_field( $group );
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
-
if ( ! empty( $tour_tabs_meta['tabs'] ) ) {
|
129 |
-
$obj->add_field( $tour_section );
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
}
|
134 |
-
|
135 |
-
public function custom_box_html_data( $data, $product_id, $translation, $lang ) {
|
136 |
-
|
137 |
-
if ( $tour_tabs_meta = get_post_meta( $product_id, 'tour_tabs_meta', true ) ) {
|
138 |
-
|
139 |
-
foreach ( $tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
140 |
-
$data[ 'adventure_tour_' . $tour_tab_id . '_title' ] = [ 'original' => $tour_tab_meta['title'] ];
|
141 |
-
$data[ 'adventure_tour_' . $tour_tab_id . '_content' ] = [ 'original' => $tour_tab_meta['content'] ];
|
142 |
-
}
|
143 |
-
|
144 |
-
if ( $translation ) {
|
145 |
-
$translated_tour_tabs_meta = get_post_meta( $translation->ID, 'tour_tabs_meta', true );
|
146 |
-
|
147 |
-
if ( $translated_tour_tabs_meta ) {
|
148 |
-
foreach ( $translated_tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
149 |
-
$data[ 'adventure_tour_' . $tour_tab_id . '_title' ]['translation'] = $tour_tab_meta['title'];
|
150 |
-
$data[ 'adventure_tour_' . $tour_tab_id . '_content' ]['translation'] = $tour_tab_meta['content'];
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
return $data;
|
157 |
-
}
|
158 |
-
|
159 |
-
public function tour_data_update( $original_product_id, $product_id, $data ) {
|
160 |
-
|
161 |
-
$tour_tabs_meta = get_post_meta( $original_product_id, 'tour_tabs_meta', true );
|
162 |
-
|
163 |
-
if ( isset( $tour_tabs_meta['tabs'] ) && is_array( $tour_tabs_meta['tabs'] ) ) {
|
164 |
-
foreach ( $tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
165 |
-
|
166 |
-
if ( ! empty( $data[ md5( 'adventure_tour_' . $tour_tab_id . '_title' ) ] ) ) {
|
167 |
-
$tour_tabs_meta['tabs'][ $tour_tab_id ]['title'] = $data[ md5( 'adventure_tour_' . $tour_tab_id . '_title' ) ];
|
168 |
-
}
|
169 |
-
|
170 |
-
if ( ! empty( $data[ md5( 'adventure_tour_' . $tour_tab_id . '_content' ) ] ) ) {
|
171 |
-
$tour_tabs_meta['tabs'][ $tour_tab_id ]['content'] = $data[ md5( 'adventure_tour_' . $tour_tab_id . '_content' ) ];
|
172 |
-
}
|
173 |
-
}
|
174 |
-
remove_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10 );
|
175 |
-
|
176 |
-
update_post_meta( $product_id, 'tour_tabs_meta', $tour_tabs_meta );
|
177 |
-
|
178 |
-
add_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10, 4 );
|
179 |
-
}
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
public function append_tour_data_translation_package( $package, $post ) {
|
184 |
-
|
185 |
-
if ( 'product' === $post->post_type ) {
|
186 |
-
|
187 |
-
$tour_tabs_meta = get_post_meta( $post->ID, 'tour_tabs_meta', true );
|
188 |
-
|
189 |
-
if ( $tour_tabs_meta ) {
|
190 |
-
|
191 |
-
$fields = [ 'title', 'content' ];
|
192 |
-
|
193 |
-
foreach ( $tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
194 |
-
|
195 |
-
foreach ( $fields as $field ) {
|
196 |
-
if ( ! empty( $tour_tab_meta[ $field ] ) ) {
|
197 |
-
|
198 |
-
$package['contents'][ 'wc_adventure_tour:' . $tour_tab_id . ':' . $field ] = [
|
199 |
-
'translate' => 1,
|
200 |
-
'data' => $this->tp->encode_field_data( $tour_tab_meta[ $field ], 'base64' ),
|
201 |
-
'format' => 'base64',
|
202 |
-
];
|
203 |
-
|
204 |
-
}
|
205 |
-
}
|
206 |
-
}
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
return $package;
|
211 |
-
|
212 |
-
}
|
213 |
-
|
214 |
-
public function save_tour_data_translation( $post_id, $data, $job ) {
|
215 |
-
|
216 |
-
$translated_tour_data = [];
|
217 |
-
foreach ( $data as $value ) {
|
218 |
-
|
219 |
-
if ( preg_match( '/wc_adventure_tour:([0-9]+):(.+)/', $value['field_type'], $matches ) ) {
|
220 |
-
|
221 |
-
$tour_tab_id = $matches[1];
|
222 |
-
$field = $matches[2];
|
223 |
-
|
224 |
-
$translated_tour_data[ $tour_tab_id ][ $field ] = $value['data'];
|
225 |
-
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
if ( $translated_tour_data ) {
|
230 |
-
|
231 |
-
$tour_tabs_meta = get_post_meta( $job->original_doc_id, 'tour_tabs_meta', true );
|
232 |
-
|
233 |
-
foreach ( $tour_tabs_meta['tabs'] as $tour_tab_id => $tour_tab_meta ) {
|
234 |
-
|
235 |
-
if ( isset( $translated_tour_data[ $tour_tab_id ]['title'] ) ) {
|
236 |
-
$tour_tabs_meta['tabs'][ $tour_tab_id ]['title'] = $translated_tour_data[ $tour_tab_id ]['title'];
|
237 |
-
}
|
238 |
-
|
239 |
-
if ( isset( $translated_tour_data[ $tour_tab_id ]['content'] ) ) {
|
240 |
-
$tour_tabs_meta['tabs'][ $tour_tab_id ]['content'] = $translated_tour_data[ $tour_tab_id ]['content'];
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
remove_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10 );
|
245 |
-
update_post_meta( $post_id, 'tour_tabs_meta', $tour_tabs_meta );
|
246 |
-
add_action( 'updated_post_meta', [ $this, 'sync_tour_data_across_translations' ], 10, 4 );
|
247 |
-
}
|
248 |
-
|
249 |
-
}
|
250 |
-
|
251 |
-
public function load_assets() {
|
252 |
-
global $pagenow;
|
253 |
-
|
254 |
-
if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
|
255 |
-
wp_register_script( 'wcml-adventure-tours', WCML_PLUGIN_URL . '/compatibility/res/js/wcml-adventure-tours.js', [ 'jquery' ], WCML_VERSION, true );
|
256 |
-
wp_enqueue_script( 'wcml-adventure-tours' );
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
public function add_custom_prices_block( $product_id ) {
|
261 |
-
|
262 |
-
if ( 'new' !== $product_id ) {
|
263 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
264 |
-
$tour_booking_periods = get_post_meta( $product_id, 'tour_booking_periods', true );
|
265 |
-
$custom_periods_prices = get_post_meta( $product_id, 'custom_booking_periods_prices', true );
|
266 |
-
if ( $tour_booking_periods ) {
|
267 |
-
foreach ( $tour_booking_periods as $per_key => $tour_booking_period ) {
|
268 |
-
foreach ( $currencies as $key => $currency ) {
|
269 |
-
|
270 |
-
$value = isset( $custom_periods_prices[ $per_key ][ $key ] ) ? $custom_periods_prices[ $per_key ][ $key ] : '';
|
271 |
-
|
272 |
-
echo '<div class="wcml_custom_cost_field" data-tour="' . esc_html( $per_key ) . '" style="display: none;">';
|
273 |
-
echo '<div>' . wp_kses_post( get_woocommerce_currency_symbol( $key ) ) . '</div>';
|
274 |
-
echo '<input type="text" class="wc_input_price" style="width: 60px;" name="tour_spec_price[' . esc_html( $per_key ) . '][' . esc_html( $key ) . ']" value="' . esc_html( $value ) . '" />';
|
275 |
-
echo '</div>';
|
276 |
-
}
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
echo '<div class="wcml_custom_cost_field_empty" style="display: none;">';
|
281 |
-
echo '<div></div>';
|
282 |
-
echo '<input type="text" class="wc_input_price" style="width: 60px;" name="tour_spec_price" value="" />';
|
283 |
-
echo '</div>';
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
public function save_custom_costs( $post_id ) {
|
288 |
-
|
289 |
-
$tour_spec_price = [];
|
290 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
291 |
-
|
292 |
-
if ( isset( $_POST['tour_spec_price'] ) && is_array( $_POST['tour_spec_price'] ) ) {
|
293 |
-
|
294 |
-
foreach ( $_POST['tour_spec_price'] as $per_key => $costs ) {
|
295 |
-
|
296 |
-
foreach ( $currencies as $code => $currency ) {
|
297 |
-
|
298 |
-
$tour_spec_price[ $per_key ][ $code ] = $costs[ $code ];
|
299 |
-
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
update_post_meta( $post_id, 'custom_booking_periods_prices', $tour_spec_price );
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
public function product_price_filter( $value, $object_id, $meta_key, $single ) {
|
308 |
-
|
309 |
-
if (
|
310 |
-
$meta_key === 'tour_booking_periods' &&
|
311 |
-
$this->woocommerce_wpml->settings['enable_multi_currency'] === WCML_MULTI_CURRENCIES_INDEPENDENT &&
|
312 |
-
! is_admin() &&
|
313 |
-
get_post_type( $object_id ) === 'product' &&
|
314 |
-
( $currency = $this->woocommerce_wpml->multi_currency->get_client_currency() ) !== wcml_get_woocommerce_currency_option()
|
315 |
-
) {
|
316 |
-
|
317 |
-
remove_filter( 'get_post_metadata', [ $this, 'product_price_filter' ], 9 );
|
318 |
-
|
319 |
-
$original_language = $this->woocommerce_wpml->products->get_original_product_language( $object_id );
|
320 |
-
$original_product = apply_filters( 'translate_object_id', $object_id, 'product', true, $original_language );
|
321 |
-
|
322 |
-
if ( get_post_meta( $original_product, '_wcml_custom_prices_status' ) ) {
|
323 |
-
$custom_periods_prices = get_post_meta( $object_id, 'custom_booking_periods_prices', true );
|
324 |
-
$tours_data = get_post_meta( $object_id, 'tour_booking_periods', true );
|
325 |
-
if ( $tours_data ) {
|
326 |
-
foreach ( $tours_data as $key => $periods ) {
|
327 |
-
if ( isset( $custom_periods_prices[ $key ][ $currency ] ) ) {
|
328 |
-
$tours_data[ $key ]['spec_price'] = $custom_periods_prices[ $key ][ $currency ];
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
-
if ( $single ) {
|
333 |
-
$value[0] = $tours_data;
|
334 |
-
} else {
|
335 |
-
$value = $tours_data;
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
add_filter( 'get_post_metadata', [ $this, 'product_price_filter' ], 9, 4 );
|
340 |
-
}
|
341 |
-
|
342 |
-
return $value;
|
343 |
-
}
|
344 |
-
|
345 |
-
public function add_tour_tax_id( $variation_term_taxonomy_ids ) {
|
346 |
-
global $wpdb;
|
347 |
-
$tour_taxonomy_id = $wpdb->get_var( "SELECT tt.term_taxonomy_id FROM {$wpdb->terms} AS t LEFT JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE t.name = 'tour' AND tt.taxonomy = 'product_type'" );
|
348 |
-
|
349 |
-
if ( $tour_taxonomy_id ) {
|
350 |
-
$variation_term_taxonomy_ids[] = $tour_taxonomy_id;
|
351 |
-
}
|
352 |
-
|
353 |
-
return $variation_term_taxonomy_ids;
|
354 |
-
|
355 |
-
}
|
356 |
-
|
357 |
-
public function is_variable_tour( $is_variable, $product_id ) {
|
358 |
-
$var_tour_meta = get_post_meta( $product_id, '_variable_tour', true );
|
359 |
-
|
360 |
-
if ( $is_variable && 'yes' === $var_tour_meta ) {
|
361 |
-
$is_variable = true;
|
362 |
-
} elseif ( 'no' === $var_tour_meta ) {
|
363 |
-
$is_variable = false;
|
364 |
-
}
|
365 |
-
|
366 |
-
return $is_variable;
|
367 |
-
}
|
368 |
-
|
369 |
-
public function is_attributes_page( $is_attributes_page ) {
|
370 |
-
|
371 |
-
if ( isset( $_GET['page'] ) && 'product_attributes_extended' === $_GET['page'] && isset( $_GET['post_type'] ) && 'product' === $_GET['post_type'] ) {
|
372 |
-
$is_attributes_page = true;
|
373 |
-
}
|
374 |
-
|
375 |
-
return $is_attributes_page;
|
376 |
-
}
|
377 |
-
|
378 |
-
public function replace_tm_editor_custom_fields_with_own_sections( $fields ) {
|
379 |
-
$fields[] = 'tour_tabs_meta';
|
380 |
-
|
381 |
-
return $fields;
|
382 |
-
}
|
383 |
-
|
384 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-ajax-layered-nav-widget.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
Class for WooCommerce Advanced Ajax Layered Navigation
|
5 |
-
*/
|
6 |
-
|
7 |
-
class WCML_Ajax_Layered_Nav_Widget {
|
8 |
-
public function __construct() {
|
9 |
-
add_filter( 'wc_ajax_layered_nav_sizeselector_term_id', [ $this, 'wc_ajax_layered_nav_sizeselector_term_id' ] );
|
10 |
-
add_filter( 'wc_ajax_layered_nav_query_editor', [ $this, 'wc_ajax_layered_nav_query_editor' ], 10, 3 );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function wc_ajax_layered_nav_sizeselector_term_id( $term_id ) {
|
14 |
-
$ulanguage_code = apply_filters( 'wpml_default_language', null );
|
15 |
-
$term_id = apply_filters( 'wpml_object_id', $term_id, 'category', true, $ulanguage_code );
|
16 |
-
return $term_id;
|
17 |
-
}
|
18 |
-
|
19 |
-
public function wc_ajax_layered_nav_query_editor( $posts, $attribute, $value ) {
|
20 |
-
$posts = get_posts(
|
21 |
-
[
|
22 |
-
'post_type' => 'product',
|
23 |
-
'numberposts' => -1,
|
24 |
-
'post_status' => 'publish',
|
25 |
-
'fields' => 'ids',
|
26 |
-
'no_found_rows' => true,
|
27 |
-
'tax_query' => [
|
28 |
-
[
|
29 |
-
'taxonomy' => $attribute,
|
30 |
-
'terms' => $value,
|
31 |
-
'field' => 'term_id',
|
32 |
-
],
|
33 |
-
],
|
34 |
-
]
|
35 |
-
);
|
36 |
-
return $posts;
|
37 |
-
}
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-aurum.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Aurum {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'add_ajax_action' ] );
|
8 |
-
}
|
9 |
-
|
10 |
-
public function add_ajax_action( $actions ) {
|
11 |
-
|
12 |
-
$actions[] = 'lab_wc_add_to_cart';
|
13 |
-
|
14 |
-
return $actions;
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-bookings.php
DELETED
@@ -1,2797 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Maybe;
|
4 |
-
use function WPML\FP\invoke;
|
5 |
-
use function WPML\FP\pipe;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class WCML_Bookings.
|
9 |
-
*/
|
10 |
-
class WCML_Bookings {
|
11 |
-
|
12 |
-
const DOMAIN = 'woocommerce-bookings';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @var WPML_Element_Translation_Package
|
16 |
-
*/
|
17 |
-
private $tp;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var SitePress
|
21 |
-
*/
|
22 |
-
private $sitepress;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @var woocommerce_wpml
|
26 |
-
*/
|
27 |
-
private $woocommerce_wpml;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var woocommerce
|
31 |
-
*/
|
32 |
-
private $woocommerce;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var WPML_Post_Translation
|
36 |
-
*/
|
37 |
-
private $wpml_post_translations;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @var wpdb
|
41 |
-
*/
|
42 |
-
private $wpdb;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* WCML_Bookings constructor.
|
46 |
-
*
|
47 |
-
* @param SitePress $sitepress
|
48 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
49 |
-
* @param woocommerce $woocommerce
|
50 |
-
* @param wpdb $wpdb
|
51 |
-
* @param WPML_Element_Translation_Package $tp
|
52 |
-
* @param WPML_Post_Translation $wpml_post_translations
|
53 |
-
*/
|
54 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, woocommerce $woocommerce, wpdb $wpdb, WPML_Element_Translation_Package $tp, WPML_Post_Translation $wpml_post_translations ) {
|
55 |
-
$this->sitepress = $sitepress;
|
56 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
57 |
-
$this->woocommerce = $woocommerce;
|
58 |
-
$this->wpdb = $wpdb;
|
59 |
-
$this->tp = $tp;
|
60 |
-
$this->wpml_post_translations = $wpml_post_translations;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Adds hooks.
|
65 |
-
*/
|
66 |
-
public function add_hooks() {
|
67 |
-
|
68 |
-
// Translate emails.
|
69 |
-
add_filter( 'get_post_metadata', [ $this, 'get_order_language' ], 10, 4 );
|
70 |
-
|
71 |
-
add_filter( 'woocommerce_booking_confirmed_notification', [ $this, 'translate_notification' ], 9 );
|
72 |
-
add_action( 'wc-booking-reminder', [ $this, 'translate_notification' ], 9 );
|
73 |
-
|
74 |
-
// @todo: Verify if 'woocommerce_booking_reminder_notification' and
|
75 |
-
// 'woocommerce_booking_cancelled_notification' are still needed.
|
76 |
-
add_filter( 'woocommerce_booking_reminder_notification', [ $this, 'translate_notification' ], 9 );
|
77 |
-
add_filter( 'woocommerce_booking_cancelled_notification', [ $this, 'translate_notification' ], 9 );
|
78 |
-
|
79 |
-
add_action(
|
80 |
-
'woocommerce_bookings_after_booking_base_cost',
|
81 |
-
[
|
82 |
-
$this,
|
83 |
-
'wcml_price_field_after_booking_base_cost',
|
84 |
-
]
|
85 |
-
);
|
86 |
-
add_action(
|
87 |
-
'woocommerce_bookings_after_booking_block_cost',
|
88 |
-
[
|
89 |
-
$this,
|
90 |
-
'wcml_price_field_after_booking_block_cost',
|
91 |
-
]
|
92 |
-
);
|
93 |
-
add_action( 'woocommerce_bookings_after_display_cost', [ $this, 'wcml_price_field_after_display_cost' ] );
|
94 |
-
add_action(
|
95 |
-
'woocommerce_bookings_after_booking_pricing_base_cost',
|
96 |
-
[
|
97 |
-
$this,
|
98 |
-
'wcml_price_field_after_booking_pricing_base_cost',
|
99 |
-
],
|
100 |
-
10,
|
101 |
-
2
|
102 |
-
);
|
103 |
-
add_action(
|
104 |
-
'woocommerce_bookings_after_booking_pricing_cost',
|
105 |
-
[
|
106 |
-
$this,
|
107 |
-
'wcml_price_field_after_booking_pricing_cost',
|
108 |
-
],
|
109 |
-
10,
|
110 |
-
2
|
111 |
-
);
|
112 |
-
add_action( 'woocommerce_bookings_after_person_cost', [ $this, 'wcml_price_field_after_person_cost' ] );
|
113 |
-
add_action(
|
114 |
-
'woocommerce_bookings_after_person_block_cost',
|
115 |
-
[
|
116 |
-
$this,
|
117 |
-
'wcml_price_field_after_person_block_cost',
|
118 |
-
]
|
119 |
-
);
|
120 |
-
add_action(
|
121 |
-
'woocommerce_bookings_after_resource_cost',
|
122 |
-
[
|
123 |
-
$this,
|
124 |
-
'wcml_price_field_after_resource_cost',
|
125 |
-
],
|
126 |
-
10,
|
127 |
-
2
|
128 |
-
);
|
129 |
-
add_action(
|
130 |
-
'woocommerce_bookings_after_resource_block_cost',
|
131 |
-
[
|
132 |
-
$this,
|
133 |
-
'wcml_price_field_after_resource_block_cost',
|
134 |
-
],
|
135 |
-
10,
|
136 |
-
2
|
137 |
-
);
|
138 |
-
add_action( 'woocommerce_bookings_after_bookings_pricing', [ $this, 'after_bookings_pricing' ] );
|
139 |
-
|
140 |
-
add_action( 'init', [ $this, 'load_assets' ] );
|
141 |
-
|
142 |
-
add_action( 'save_post', [ $this, 'save_booking_action_handler' ], 110 );
|
143 |
-
|
144 |
-
add_action( 'wcml_before_sync_product_data', [ $this, 'sync_bookings' ], 10, 3 );
|
145 |
-
add_action( 'wcml_before_sync_product', [ $this, 'sync_booking_data' ], 10, 2 );
|
146 |
-
|
147 |
-
add_filter(
|
148 |
-
'woocommerce_bookings_process_cost_rules_cost',
|
149 |
-
[
|
150 |
-
$this,
|
151 |
-
'wc_bookings_process_cost_rules_cost',
|
152 |
-
],
|
153 |
-
10,
|
154 |
-
3
|
155 |
-
);
|
156 |
-
add_filter(
|
157 |
-
'woocommerce_bookings_process_cost_rules_base_cost',
|
158 |
-
[
|
159 |
-
$this,
|
160 |
-
'wc_bookings_process_cost_rules_base_cost',
|
161 |
-
],
|
162 |
-
10,
|
163 |
-
3
|
164 |
-
);
|
165 |
-
add_filter(
|
166 |
-
'woocommerce_bookings_process_cost_rules_override_block',
|
167 |
-
[
|
168 |
-
$this,
|
169 |
-
'wc_bookings_process_cost_rules_override_block_cost',
|
170 |
-
],
|
171 |
-
10,
|
172 |
-
3
|
173 |
-
);
|
174 |
-
|
175 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'wcml_multi_currency_is_ajax' ] );
|
176 |
-
|
177 |
-
add_filter(
|
178 |
-
'wcml_cart_contents_not_changed',
|
179 |
-
[
|
180 |
-
$this,
|
181 |
-
'filter_bundled_product_in_cart_contents',
|
182 |
-
],
|
183 |
-
10,
|
184 |
-
3
|
185 |
-
);
|
186 |
-
|
187 |
-
add_action( 'woocommerce_bookings_after_create_booking_page', [ $this, 'booking_currency_dropdown' ] );
|
188 |
-
add_action( 'init', [ $this, 'set_booking_currency' ] );
|
189 |
-
|
190 |
-
add_action( 'wp_ajax_wcml_booking_set_currency', [ $this, 'set_booking_currency_ajax' ] );
|
191 |
-
add_action(
|
192 |
-
'woocommerce_bookings_create_booking_page_add_order_item',
|
193 |
-
[
|
194 |
-
$this,
|
195 |
-
'set_order_currency_on_create_booking_page',
|
196 |
-
]
|
197 |
-
);
|
198 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_booking_currency_symbol' ] );
|
199 |
-
add_filter( 'get_booking_products_args', [ $this, 'filter_get_booking_products_args' ] );
|
200 |
-
add_filter( 'wcml_filter_currency_position', [ $this, 'create_booking_page_client_currency' ] );
|
201 |
-
|
202 |
-
add_filter( 'wcml_client_currency', [ $this, 'create_booking_page_client_currency' ] );
|
203 |
-
|
204 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
205 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 4 );
|
206 |
-
add_filter( 'wcml_check_is_single', [ $this, 'show_custom_blocks_for_resources_and_persons' ], 10, 3 );
|
207 |
-
add_filter( 'wcml_do_not_display_custom_fields_for_product', [ $this, 'replace_tm_editor_custom_fields_with_own_sections' ] );
|
208 |
-
add_filter(
|
209 |
-
'wcml_not_display_single_fields_to_translate',
|
210 |
-
[
|
211 |
-
$this,
|
212 |
-
'remove_single_custom_fields_to_translate',
|
213 |
-
]
|
214 |
-
);
|
215 |
-
add_filter( 'wcml_product_content_label', [ $this, 'product_content_resource_label' ], 10, 2 );
|
216 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'wcml_products_tab_sync_resources_and_persons' ], 10, 4 );
|
217 |
-
|
218 |
-
add_action( 'woocommerce_new_booking', [ $this, 'duplicate_booking_for_translations' ] );
|
219 |
-
|
220 |
-
$bookings_statuses = [
|
221 |
-
'unpaid',
|
222 |
-
'pending-confirmation',
|
223 |
-
'confirmed',
|
224 |
-
'paid',
|
225 |
-
'cancelled',
|
226 |
-
'complete',
|
227 |
-
'in-cart',
|
228 |
-
'was-in-cart',
|
229 |
-
];
|
230 |
-
foreach ( $bookings_statuses as $status ) {
|
231 |
-
add_action( 'woocommerce_booking_' . $status, [ $this, 'update_status_for_translations' ] );
|
232 |
-
}
|
233 |
-
|
234 |
-
add_filter( 'parse_query', [ $this, 'booking_filters_query' ] );
|
235 |
-
add_filter( 'woocommerce_bookings_in_date_range_query', [ $this, 'bookings_in_date_range_query' ] );
|
236 |
-
add_action( 'before_delete_post', [ $this, 'delete_bookings' ] );
|
237 |
-
add_action( 'wp_trash_post', [ $this, 'trash_bookings' ] );
|
238 |
-
add_action( 'wpml_translation_job_saved', [ $this, 'save_booking_data_to_translation' ], 10, 3 );
|
239 |
-
|
240 |
-
if ( is_admin() ) {
|
241 |
-
|
242 |
-
add_filter(
|
243 |
-
'wpml_tm_translation_job_data',
|
244 |
-
[
|
245 |
-
$this,
|
246 |
-
'append_persons_to_translation_package',
|
247 |
-
],
|
248 |
-
10,
|
249 |
-
2
|
250 |
-
);
|
251 |
-
|
252 |
-
add_filter(
|
253 |
-
'wpml_tm_translation_job_data',
|
254 |
-
[
|
255 |
-
$this,
|
256 |
-
'append_resources_to_translation_package',
|
257 |
-
],
|
258 |
-
10,
|
259 |
-
2
|
260 |
-
);
|
261 |
-
|
262 |
-
// lock fields on translations pages.
|
263 |
-
add_filter( 'wcml_js_lock_fields_ids', [ $this, 'wcml_js_lock_fields_ids' ] );
|
264 |
-
add_filter( 'wcml_after_load_lock_fields_js', [ $this, 'localize_lock_fields_js' ] );
|
265 |
-
|
266 |
-
// allow filtering resources by language.
|
267 |
-
add_filter( 'get_booking_resources_args', [ $this, 'filter_get_booking_resources_args' ] );
|
268 |
-
|
269 |
-
add_filter( 'get_translatable_documents_all', [ $this, 'filter_translatable_documents' ] );
|
270 |
-
|
271 |
-
add_filter( 'pre_wpml_is_translated_post_type', [ $this, 'filter_is_translated_post_type' ] );
|
272 |
-
|
273 |
-
add_action( 'woocommerce_product_data_panels', [ $this, 'show_pointer_info' ] );
|
274 |
-
|
275 |
-
add_action( 'save_post', [ $this, 'sync_booking_status' ], 10, 3 );
|
276 |
-
|
277 |
-
add_filter( 'wcml_emails_options_to_translate', [ $this, 'emails_options_to_translate' ] );
|
278 |
-
|
279 |
-
add_filter( 'wcml_emails_text_keys_to_translate', [ $this, 'emails_text_keys_to_translate' ] );
|
280 |
-
|
281 |
-
add_filter( 'woocommerce_email_get_option', [ $this, 'translate_emails_text_strings' ], 10, 4 );
|
282 |
-
|
283 |
-
add_action( 'woocommerce_booking_confirmed_notification', [ $this, 'translate_booking_confirmed_email_texts' ], 9 );
|
284 |
-
add_action( 'woocommerce_booking_pending-confirmation_to_cancelled_notification', [ $this, 'translate_booking_cancelled_email_texts' ], 9 );
|
285 |
-
add_action( 'woocommerce_booking_confirmed_to_cancelled_notification', [ $this, 'translate_booking_cancelled_email_texts' ], 9 );
|
286 |
-
add_action( 'woocommerce_booking_paid_to_cancelled_notification', [ $this, 'translate_booking_cancelled_email_texts' ], 9 );
|
287 |
-
|
288 |
-
// @todo: Verify 'wc-booking-reminder' because it happens in wp cron and we are in admin here.
|
289 |
-
add_action( 'wc-booking-reminder', [ $this, 'translate_booking_reminder_email_texts' ], 9 );
|
290 |
-
add_action( 'woocommerce_admin_new_booking_notification', [ $this, 'translate_new_booking_email_texts' ], 9 );
|
291 |
-
|
292 |
-
add_action( 'woocommerce_booking_pending-confirmation_to_cancelled_notification', [ $this, 'translate_booking_cancelled_admin_email_texts' ], 9 );
|
293 |
-
add_action( 'woocommerce_booking_confirmed_to_cancelled_notification', [ $this, 'translate_booking_cancelled_admin_email_texts' ], 9 );
|
294 |
-
add_action( 'woocommerce_booking_paid_to_cancelled_notification', [ $this, 'translate_booking_cancelled_admin_email_texts' ], 9 );
|
295 |
-
|
296 |
-
add_filter( 'wcml_email_language', [ $this, 'booking_email_language' ] );
|
297 |
-
|
298 |
-
if ( $this->is_bookings_listing_page() ) {
|
299 |
-
$this->remove_language_switcher();
|
300 |
-
add_filter( 'wp_count_posts', [ $this, 'count_bookings_by_current_language' ], 10, 2 );
|
301 |
-
add_filter( 'views_edit-wc_booking', [ $this, 'unset_mine_from_bookings_views' ] );
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
if ( ! is_admin() || isset( $_POST['action'] ) && 'wc_bookings_calculate_costs' === $_POST['action'] ) {
|
306 |
-
add_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10, 4 );
|
307 |
-
}
|
308 |
-
|
309 |
-
add_filter( 'wpml_language_filter_extra_conditions_snippet', [ $this, 'extra_conditions_to_filter_bookings' ] );
|
310 |
-
|
311 |
-
$this->clear_transient_fields();
|
312 |
-
|
313 |
-
add_filter( 'wpml_tm_dashboard_translatable_types', [ $this, 'hide_bookings_type_on_tm_dashboard' ] );
|
314 |
-
|
315 |
-
add_filter( 'wcml_add_to_cart_sold_individually', [ $this, 'add_to_cart_sold_individually' ], 10, 4 );
|
316 |
-
|
317 |
-
add_filter( 'woocommerce_bookings_account_tables', [ $this, 'filter_my_account_bookings_tables_by_current_language' ] );
|
318 |
-
|
319 |
-
add_filter( 'schedule_event', [ $this, 'prevent_events_on_duplicates' ] );
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* When sending a booking notification to the customer get the language from the order.
|
324 |
-
*
|
325 |
-
* @param string $check Dummy argument.
|
326 |
-
* @param integer $object_id The Post ID to query.
|
327 |
-
* @param string $meta_key The meta key to query.
|
328 |
-
* @param bool $single Wether we want a single value or an array.
|
329 |
-
* @return string
|
330 |
-
*/
|
331 |
-
public function get_order_language( $check, $object_id, $meta_key, $single ) {
|
332 |
-
|
333 |
-
if ( 'wpml_language' === $meta_key && 'wc_booking' === get_post_type( $object_id ) ) {
|
334 |
-
// Get the order_item_id which might be in the original booking.
|
335 |
-
$order_item_id = get_post_meta( $object_id, '_booking_order_item_id', true );
|
336 |
-
if ( empty( $order_item_id ) ) {
|
337 |
-
$original_booking_id = get_post_meta( $object_id, '_booking_duplicate_of', true );
|
338 |
-
$order_item_id = get_post_meta( $original_booking_id, '_booking_order_item_id', true );
|
339 |
-
}
|
340 |
-
|
341 |
-
// From here we can grab the order_id and return its language.
|
342 |
-
$order_id = $this->wpdb->get_var(
|
343 |
-
$this->wpdb->prepare(
|
344 |
-
"SELECT order_id FROM {$this->wpdb->prefix}woocommerce_order_items WHERE order_item_id = %d",
|
345 |
-
$order_item_id
|
346 |
-
)
|
347 |
-
); // WPCS: unprepared SQL OK.
|
348 |
-
remove_filter( 'get_post_metadata', [ $this, 'get_order_language' ], 10 );
|
349 |
-
$check = get_post_meta( $order_id, 'wpml_language', $single );
|
350 |
-
add_filter( 'get_post_metadata', [ $this, 'get_order_language' ], 10, 4 );
|
351 |
-
}
|
352 |
-
|
353 |
-
return $check;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Translate strings of notifications.
|
358 |
-
*
|
359 |
-
* If $order_id is a booking ID, the language will be
|
360 |
-
* fetched from the parent order because we have a
|
361 |
-
* filter on the post meta `wpml_language` for bookings.
|
362 |
-
*
|
363 |
-
* @param integer $order_id Order ID.
|
364 |
-
*/
|
365 |
-
public function translate_notification( $order_id ) {
|
366 |
-
$this->woocommerce_wpml->emails->refresh_email_lang( $order_id );
|
367 |
-
}
|
368 |
-
|
369 |
-
public function save_booking_action_handler( $booking_id ) {
|
370 |
-
|
371 |
-
$this->maybe_set_booking_language( $booking_id );
|
372 |
-
|
373 |
-
$this->save_custom_costs( $booking_id );
|
374 |
-
|
375 |
-
$this->maybe_sync_updated_booking_meta( $booking_id );
|
376 |
-
}
|
377 |
-
|
378 |
-
public function wcml_price_field_after_booking_base_cost( $post_id ) {
|
379 |
-
|
380 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_cost' );
|
381 |
-
|
382 |
-
}
|
383 |
-
|
384 |
-
public function wcml_price_field_after_booking_block_cost( $post_id ) {
|
385 |
-
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'WC_BOOKINGS_VERSION' ), '1.10.9', '<' ) ) {
|
386 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
387 |
-
} else {
|
388 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_block_cost' );
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
public function wcml_price_field_after_display_cost( $post_id ) {
|
393 |
-
|
394 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_display_cost' );
|
395 |
-
|
396 |
-
}
|
397 |
-
|
398 |
-
public function wcml_price_field_after_booking_pricing_base_cost( $pricing, $post_id ) {
|
399 |
-
|
400 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_pricing_base_cost', $pricing );
|
401 |
-
|
402 |
-
}
|
403 |
-
|
404 |
-
public function wcml_price_field_after_booking_pricing_cost( $pricing, $post_id ) {
|
405 |
-
|
406 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_pricing_cost', $pricing );
|
407 |
-
|
408 |
-
}
|
409 |
-
|
410 |
-
public function wcml_price_field_after_person_cost( $person_type_id ) {
|
411 |
-
|
412 |
-
$this->echo_wcml_price_field( $person_type_id, 'wcml_wc_booking_person_cost', false, false );
|
413 |
-
|
414 |
-
}
|
415 |
-
|
416 |
-
public function wcml_price_field_after_person_block_cost( $person_type_id ) {
|
417 |
-
|
418 |
-
$this->echo_wcml_price_field( $person_type_id, 'wcml_wc_booking_person_block_cost', false, false );
|
419 |
-
|
420 |
-
}
|
421 |
-
|
422 |
-
public function wcml_price_field_after_resource_cost( $resource_id, $post_id ) {
|
423 |
-
|
424 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_resource_cost', false, true, $resource_id );
|
425 |
-
|
426 |
-
}
|
427 |
-
|
428 |
-
public function wcml_price_field_after_resource_block_cost( $resource_id, $post_id ) {
|
429 |
-
|
430 |
-
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_resource_block_cost', false, true, $resource_id );
|
431 |
-
|
432 |
-
}
|
433 |
-
|
434 |
-
public function echo_wcml_price_field( $post_id, $field, $pricing = false, $check = true, $resource_id = false ) {
|
435 |
-
|
436 |
-
if ( ( ! $check || $this->woocommerce_wpml->products->is_original_product( $post_id ) ) && $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
437 |
-
|
438 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
439 |
-
|
440 |
-
$wc_currencies = get_woocommerce_currencies();
|
441 |
-
|
442 |
-
if ( ! function_exists( 'woocommerce_wp_text_input' ) ) {
|
443 |
-
include_once dirname( WC_PLUGIN_FILE ) . '/includes/admin/wc-meta-box-functions.php';
|
444 |
-
}
|
445 |
-
|
446 |
-
echo '<div class="wcml_custom_cost_field" >';
|
447 |
-
|
448 |
-
foreach ( $currencies as $currency_code => $currency ) {
|
449 |
-
|
450 |
-
switch ( $field ) {
|
451 |
-
case 'wcml_wc_booking_cost':
|
452 |
-
woocommerce_wp_text_input(
|
453 |
-
[
|
454 |
-
'id' => 'wcml_wc_booking_cost',
|
455 |
-
'class' => 'wcml_bookings_custom_price',
|
456 |
-
'name' => 'wcml_wc_booking_cost[' . $currency_code . ']',
|
457 |
-
'label' => get_woocommerce_currency_symbol( $currency_code ),
|
458 |
-
'description' => __( 'One-off cost for the booking as a whole.', 'woocommerce-bookings' ),
|
459 |
-
'value' => get_post_meta( $post_id, '_wc_booking_cost_' . $currency_code, true ),
|
460 |
-
'type' => 'number',
|
461 |
-
'desc_tip' => true,
|
462 |
-
'custom_attributes' => [
|
463 |
-
'min' => '',
|
464 |
-
'step' => '0.01',
|
465 |
-
],
|
466 |
-
]
|
467 |
-
);
|
468 |
-
break;
|
469 |
-
case 'wcml_wc_booking_block_cost':
|
470 |
-
case 'wcml_wc_booking_base_cost':
|
471 |
-
$block_cost_key = '_wc_booking_base_cost_';
|
472 |
-
if ( $field === 'wcml_wc_booking_block_cost' ) {
|
473 |
-
$block_cost_key = '_wc_booking_block_cost_';
|
474 |
-
}
|
475 |
-
$block_cost_key .= $currency_code;
|
476 |
-
woocommerce_wp_text_input(
|
477 |
-
[
|
478 |
-
'id' => $field,
|
479 |
-
'class' => 'wcml_bookings_custom_price',
|
480 |
-
'name' => $field . '[' . $currency_code . ']',
|
481 |
-
'label' => get_woocommerce_currency_symbol( $currency_code ),
|
482 |
-
'description' => __( 'This is the cost per block booked. All other costs (for resources and persons) are added to this.', 'woocommerce-bookings' ),
|
483 |
-
'value' => get_post_meta( $post_id, $block_cost_key, true ),
|
484 |
-
'type' => 'number',
|
485 |
-
'desc_tip' => true,
|
486 |
-
'custom_attributes' => [
|
487 |
-
'min' => '',
|
488 |
-
'step' => '0.01',
|
489 |
-
],
|
490 |
-
]
|
491 |
-
);
|
492 |
-
break;
|
493 |
-
case 'wcml_wc_display_cost':
|
494 |
-
woocommerce_wp_text_input(
|
495 |
-
[
|
496 |
-
'id' => 'wcml_wc_display_cost',
|
497 |
-
'class' => 'wcml_bookings_custom_price',
|
498 |
-
'name' => 'wcml_wc_display_cost[' . $currency_code . ']',
|
499 |
-
'label' => get_woocommerce_currency_symbol( $currency_code ),
|
500 |
-
'description' => __( 'The cost is displayed to the user on the frontend. Leave blank to have it calculated for you. If a booking has varying costs, this will be prefixed with the word "from:".', 'woocommerce-bookings' ),
|
501 |
-
'value' => get_post_meta( $post_id, '_wc_display_cost_' . $currency_code, true ),
|
502 |
-
'type' => 'number',
|
503 |
-
'desc_tip' => true,
|
504 |
-
'custom_attributes' => [
|
505 |
-
'min' => '',
|
506 |
-
'step' => '0.01',
|
507 |
-
],
|
508 |
-
]
|
509 |
-
);
|
510 |
-
break;
|
511 |
-
|
512 |
-
case 'wcml_wc_booking_pricing_base_cost':
|
513 |
-
if ( isset( $pricing[ 'base_cost_' . $currency_code ] ) ) {
|
514 |
-
$value = $pricing[ 'base_cost_' . $currency_code ];
|
515 |
-
} else {
|
516 |
-
$value = '';
|
517 |
-
}
|
518 |
-
|
519 |
-
echo '<div class="wcml_bookings_range_block" >';
|
520 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
521 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_pricing_base_cost[' . esc_html( $currency_code ) . '][]" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
522 |
-
echo '</div>';
|
523 |
-
break;
|
524 |
-
|
525 |
-
case 'wcml_wc_booking_pricing_cost':
|
526 |
-
if ( isset( $pricing[ 'cost_' . $currency_code ] ) ) {
|
527 |
-
$value = $pricing[ 'cost_' . $currency_code ];
|
528 |
-
} else {
|
529 |
-
$value = '';
|
530 |
-
}
|
531 |
-
|
532 |
-
echo '<div class="wcml_bookings_range_block" >';
|
533 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
534 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_pricing_cost[' . esc_html( $currency_code ) . '][]" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
535 |
-
echo '</div>';
|
536 |
-
break;
|
537 |
-
|
538 |
-
case 'wcml_wc_booking_person_cost':
|
539 |
-
$value = get_post_meta( $post_id, 'cost_' . $currency_code, true );
|
540 |
-
|
541 |
-
echo '<div class="wcml_bookings_person_block" >';
|
542 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
543 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_person_cost[' . intval( $post_id ) . '][' . esc_html( $currency_code ) . ']" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
544 |
-
echo '</div>';
|
545 |
-
break;
|
546 |
-
|
547 |
-
case 'wcml_wc_booking_person_block_cost':
|
548 |
-
$value = get_post_meta( $post_id, 'block_cost_' . $currency_code, true );
|
549 |
-
|
550 |
-
echo '<div class="wcml_bookings_person_block" >';
|
551 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
552 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_person_block_cost[' . intval( $post_id ) . '][' . esc_html( $currency_code ) . ']" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
553 |
-
echo '</div>';
|
554 |
-
break;
|
555 |
-
|
556 |
-
case 'wcml_wc_booking_resource_cost':
|
557 |
-
$resource_base_costs = maybe_unserialize( get_post_meta( $post_id, '_resource_base_costs', true ) );
|
558 |
-
|
559 |
-
if ( isset( $resource_base_costs['custom_costs'][ $currency_code ][ $resource_id ] ) ) {
|
560 |
-
$value = $resource_base_costs['custom_costs'][ $currency_code ][ $resource_id ];
|
561 |
-
} else {
|
562 |
-
$value = '';
|
563 |
-
}
|
564 |
-
|
565 |
-
echo '<div class="wcml_bookings_resource_block" >';
|
566 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
567 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_resource_cost[' . esc_html( $resource_id ) . '][' . esc_html( $currency_code ) . ']" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
568 |
-
echo '</div>';
|
569 |
-
break;
|
570 |
-
|
571 |
-
case 'wcml_wc_booking_resource_block_cost':
|
572 |
-
$resource_block_costs = maybe_unserialize( get_post_meta( $post_id, '_resource_block_costs', true ) );
|
573 |
-
|
574 |
-
if ( isset( $resource_block_costs['custom_costs'][ $currency_code ][ $resource_id ] ) ) {
|
575 |
-
$value = $resource_block_costs['custom_costs'][ $currency_code ][ $resource_id ];
|
576 |
-
} else {
|
577 |
-
$value = '';
|
578 |
-
}
|
579 |
-
|
580 |
-
echo '<div class="wcml_bookings_resource_block" >';
|
581 |
-
echo '<label>' . wp_kses_post( get_woocommerce_currency_symbol( $currency_code ) ) . '</label>';
|
582 |
-
echo '<input type="number" step="0.01" name="wcml_wc_booking_resource_block_cost[' . esc_html( $resource_id ) . '][' . esc_html( $currency_code ) . ']" class="wcml_bookings_custom_price" value="' . esc_html( $value ) . '" placeholder="0" />';
|
583 |
-
echo '</div>';
|
584 |
-
break;
|
585 |
-
|
586 |
-
default:
|
587 |
-
break;
|
588 |
-
|
589 |
-
}
|
590 |
-
}
|
591 |
-
|
592 |
-
echo '</div>';
|
593 |
-
|
594 |
-
}
|
595 |
-
}
|
596 |
-
|
597 |
-
public function after_bookings_pricing( $post_id ) {
|
598 |
-
|
599 |
-
if ( in_array( 'booking', wp_get_post_terms( $post_id, 'product_type', [ 'fields' => 'names' ] ) ) && $this->woocommerce_wpml->products->is_original_product( $post_id ) && $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
600 |
-
|
601 |
-
$custom_costs_status = get_post_meta( $post_id, '_wcml_custom_costs_status', true );
|
602 |
-
|
603 |
-
$checked = ! $custom_costs_status ? 'checked="checked"' : ' ';
|
604 |
-
|
605 |
-
echo '<div class="wcml_custom_costs">';
|
606 |
-
|
607 |
-
echo '<input type="radio" name="_wcml_custom_costs" id="wcml_custom_costs_auto" value="0" class="wcml_custom_costs_input" ' . esc_html( $checked ) . ' />';
|
608 |
-
echo '<label for="wcml_custom_costs_auto">' . esc_html__( 'Calculate costs in other currencies automatically', 'woocommerce-multilingual' ) . '</label>';
|
609 |
-
|
610 |
-
$checked = 1 === (int) $custom_costs_status ? 'checked="checked"' : ' ';
|
611 |
-
|
612 |
-
echo '<input type="radio" name="_wcml_custom_costs" value="1" id="wcml_custom_costs_manually" class="wcml_custom_costs_input" ' . esc_html( $checked ) . ' />';
|
613 |
-
echo '<label for="wcml_custom_costs_manually">' . esc_html__( 'Set costs in other currencies manually', 'woocommerce-multilingual' ) . '</label>';
|
614 |
-
|
615 |
-
wp_nonce_field( 'wcml_save_custom_costs', '_wcml_custom_costs_nonce' );
|
616 |
-
|
617 |
-
echo '</div>';
|
618 |
-
}
|
619 |
-
|
620 |
-
}
|
621 |
-
|
622 |
-
public function save_custom_costs( $post_id ) {
|
623 |
-
$nonce = filter_var( isset( $_POST['_wcml_custom_costs_nonce'] ) ? $_POST['_wcml_custom_costs_nonce'] : '', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
624 |
-
|
625 |
-
if ( isset( $_POST['_wcml_custom_costs'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_costs' ) ) {
|
626 |
-
|
627 |
-
update_post_meta( $post_id, '_wcml_custom_costs_status', $_POST['_wcml_custom_costs'] );
|
628 |
-
|
629 |
-
if ( 1 === (int) $_POST['_wcml_custom_costs'] ) {
|
630 |
-
|
631 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
632 |
-
if ( empty( $currencies ) || 0 === $post_id ) {
|
633 |
-
return false;
|
634 |
-
}
|
635 |
-
|
636 |
-
$this->update_booking_costs( $currencies, $post_id );
|
637 |
-
$this->update_booking_pricing( $currencies, $post_id );
|
638 |
-
|
639 |
-
if ( isset( $_POST['wcml_wc_booking_person_cost'] ) && is_array( $_POST['wcml_wc_booking_person_cost'] ) ) {
|
640 |
-
$this->update_booking_person_cost( $currencies, $_POST['wcml_wc_booking_person_cost'] );
|
641 |
-
}
|
642 |
-
|
643 |
-
if ( isset( $_POST['wcml_wc_booking_person_block_cost'] ) && is_array( $_POST['wcml_wc_booking_person_block_cost'] ) ) {
|
644 |
-
$this->update_booking_person_block_cost( $currencies, $_POST['wcml_wc_booking_person_block_cost'] );
|
645 |
-
}
|
646 |
-
|
647 |
-
if ( isset( $_POST['wcml_wc_booking_resource_cost'] ) && is_array( $_POST['wcml_wc_booking_resource_cost'] ) ) {
|
648 |
-
$this->update_booking_resource_cost( $currencies, $post_id, $_POST['wcml_wc_booking_resource_cost'] );
|
649 |
-
}
|
650 |
-
|
651 |
-
if ( isset( $_POST['wcml_wc_booking_resource_block_cost'] ) && is_array( $_POST['wcml_wc_booking_resource_block_cost'] ) ) {
|
652 |
-
$this->update_booking_resource_block_cost( $currencies, $post_id, $_POST['wcml_wc_booking_resource_block_cost'] );
|
653 |
-
}
|
654 |
-
|
655 |
-
update_post_meta( $post_id, '_price', '' );
|
656 |
-
} else {
|
657 |
-
return false;
|
658 |
-
}
|
659 |
-
}
|
660 |
-
|
661 |
-
}
|
662 |
-
|
663 |
-
// sync existing product bookings for translations.
|
664 |
-
public function sync_bookings( $original_product_id, $product_id, $language ) {
|
665 |
-
$all_bookings_for_product = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT post_id as id FROM {$this->wpdb->postmeta} WHERE meta_key = '_booking_product_id' AND meta_value = %d", $original_product_id ) );
|
666 |
-
|
667 |
-
foreach ( $all_bookings_for_product as $booking ) {
|
668 |
-
|
669 |
-
if ( $language === $this->wpml_post_translations->get_source_lang_code( $booking->id ) ) {
|
670 |
-
continue;
|
671 |
-
}
|
672 |
-
|
673 |
-
$booking_translations = $this->get_translated_bookings( $booking->id );
|
674 |
-
|
675 |
-
if ( ! isset( $booking_translations[ $language ] ) ) {
|
676 |
-
$this->duplicate_booking_for_translations( $booking->id, $language );
|
677 |
-
} elseif ( ! get_post_meta( $booking_translations[ $language ], '_booking_product_id', true ) ) {
|
678 |
-
$this->update_translated_booking_meta( $booking_translations[ $language ], $booking->id, $language );
|
679 |
-
}
|
680 |
-
}
|
681 |
-
}
|
682 |
-
|
683 |
-
/**
|
684 |
-
* @param int $translated_booking_id
|
685 |
-
* @param int $original_booking_id
|
686 |
-
* @param string $language
|
687 |
-
*/
|
688 |
-
private function update_translated_booking_meta( $translated_booking_id, $original_booking_id, $language ) {
|
689 |
-
update_post_meta( $translated_booking_id, '_booking_product_id', $this->get_translated_booking_product_id( $original_booking_id, $language ) );
|
690 |
-
update_post_meta( $translated_booking_id, '_booking_resource_id', $this->get_translated_booking_resource_id( $original_booking_id, $language ) );
|
691 |
-
update_post_meta( $translated_booking_id, '_booking_persons', $this->get_translated_booking_persons_ids( $original_booking_id, $language ) );
|
692 |
-
}
|
693 |
-
|
694 |
-
public function sync_booking_data( $original_product_id, $current_product_id ) {
|
695 |
-
|
696 |
-
if ( has_term( 'booking', 'product_type', $original_product_id ) ) {
|
697 |
-
$translations = $this->wpml_post_translations->get_element_translations( $original_product_id, false, true );
|
698 |
-
foreach ( $translations as $translation ) {
|
699 |
-
$language = $this->wpml_post_translations->get_element_lang_code( $translation );
|
700 |
-
|
701 |
-
// sync_resources.
|
702 |
-
$this->sync_resources( $original_product_id, $translation, $language );
|
703 |
-
|
704 |
-
// sync_persons.
|
705 |
-
$this->sync_persons( $original_product_id, $translation, $language );
|
706 |
-
}
|
707 |
-
}
|
708 |
-
}
|
709 |
-
|
710 |
-
public function sync_resources( $original_product_id, $translated_product_id, $lang_code, $duplicate = true ) {
|
711 |
-
|
712 |
-
$original_resources = $this->wpdb->get_results(
|
713 |
-
$this->wpdb->prepare(
|
714 |
-
"SELECT resource_id, sort_order FROM {$this->wpdb->prefix}wc_booking_relationships WHERE product_id = %d",
|
715 |
-
$original_product_id
|
716 |
-
)
|
717 |
-
);
|
718 |
-
|
719 |
-
$translated_resources = $this->wpdb->get_col(
|
720 |
-
$this->wpdb->prepare(
|
721 |
-
"SELECT resource_id FROM {$this->wpdb->prefix}wc_booking_relationships WHERE product_id = %d",
|
722 |
-
$translated_product_id
|
723 |
-
)
|
724 |
-
);
|
725 |
-
|
726 |
-
$used_translated_resources = [];
|
727 |
-
|
728 |
-
foreach ( $original_resources as $resource ) {
|
729 |
-
|
730 |
-
$translated_resource_id = apply_filters( 'translate_object_id', $resource->resource_id, 'bookable_resource', false, $lang_code );
|
731 |
-
if ( ! is_null( $translated_resource_id ) ) {
|
732 |
-
|
733 |
-
if ( in_array( $translated_resource_id, $translated_resources ) ) {
|
734 |
-
$this->update_product_resource( $translated_product_id, $translated_resource_id, $resource );
|
735 |
-
} else {
|
736 |
-
$this->add_product_resource( $translated_product_id, $translated_resource_id, $resource );
|
737 |
-
}
|
738 |
-
$used_translated_resources[] = $translated_resource_id;
|
739 |
-
} else {
|
740 |
-
if ( $duplicate ) {
|
741 |
-
$this->duplicate_resource( $translated_product_id, $resource, $lang_code );
|
742 |
-
}
|
743 |
-
}
|
744 |
-
}
|
745 |
-
|
746 |
-
$removed_translated_resources_id = array_diff( $translated_resources, $used_translated_resources );
|
747 |
-
foreach ( $removed_translated_resources_id as $resource_id ) {
|
748 |
-
$this->remove_resource_from_product( $translated_product_id, $resource_id );
|
749 |
-
}
|
750 |
-
|
751 |
-
$this->sync_resource_costs( $original_product_id, $translated_product_id, '_resource_base_costs', $lang_code );
|
752 |
-
$this->sync_resource_costs( $original_product_id, $translated_product_id, '_resource_block_costs', $lang_code );
|
753 |
-
|
754 |
-
}
|
755 |
-
|
756 |
-
public function duplicate_resource( $tr_product_id, $resource, $lang_code ) {
|
757 |
-
global $iclTranslationManagement;
|
758 |
-
|
759 |
-
if ( method_exists( $this->sitepress, 'make_duplicate' ) ) {
|
760 |
-
|
761 |
-
$trns_resource_id = $this->sitepress->make_duplicate( $resource->resource_id, $lang_code );
|
762 |
-
|
763 |
-
} else {
|
764 |
-
|
765 |
-
if ( ! isset( $iclTranslationManagement ) ) {
|
766 |
-
$iclTranslationManagement = new TranslationManagement();
|
767 |
-
}
|
768 |
-
|
769 |
-
$trns_resource_id = $iclTranslationManagement->make_duplicate( $resource->resource_id, $lang_code );
|
770 |
-
|
771 |
-
}
|
772 |
-
|
773 |
-
$this->wpdb->insert(
|
774 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
775 |
-
[
|
776 |
-
'product_id' => $tr_product_id,
|
777 |
-
'resource_id' => $trns_resource_id,
|
778 |
-
'sort_order' => $resource->sort_order,
|
779 |
-
]
|
780 |
-
);
|
781 |
-
|
782 |
-
delete_post_meta( $trns_resource_id, '_icl_lang_duplicate_of' );
|
783 |
-
|
784 |
-
return $trns_resource_id;
|
785 |
-
}
|
786 |
-
|
787 |
-
public function add_product_resource( $product_id, $resource_id, $resource_data ) {
|
788 |
-
|
789 |
-
$this->wpdb->insert(
|
790 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
791 |
-
[
|
792 |
-
'sort_order' => $resource_data->sort_order,
|
793 |
-
'product_id' => $product_id,
|
794 |
-
'resource_id' => $resource_id,
|
795 |
-
]
|
796 |
-
);
|
797 |
-
|
798 |
-
update_post_meta( $resource_id, 'qty', get_post_meta( $resource_data->resource_id, 'qty', true ) );
|
799 |
-
update_post_meta( $resource_id, '_wc_booking_availability', get_post_meta( $resource_data->resource_id, '_wc_booking_availability', true ) );
|
800 |
-
|
801 |
-
}
|
802 |
-
|
803 |
-
public function remove_resource_from_product( $product_id, $resource_id ) {
|
804 |
-
|
805 |
-
$this->wpdb->delete(
|
806 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
807 |
-
[
|
808 |
-
'product_id' => $product_id,
|
809 |
-
'resource_id' => $resource_id,
|
810 |
-
]
|
811 |
-
);
|
812 |
-
|
813 |
-
}
|
814 |
-
|
815 |
-
public function update_product_resource( $product_id, $resource_id, $resource_data ) {
|
816 |
-
|
817 |
-
$this->wpdb->update(
|
818 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
819 |
-
[
|
820 |
-
'sort_order' => $resource_data->sort_order,
|
821 |
-
],
|
822 |
-
[
|
823 |
-
'product_id' => $product_id,
|
824 |
-
'resource_id' => $resource_id,
|
825 |
-
]
|
826 |
-
);
|
827 |
-
|
828 |
-
update_post_meta( $resource_id, 'qty', get_post_meta( $resource_data->resource_id, 'qty', true ) );
|
829 |
-
update_post_meta( $resource_id, '_wc_booking_availability', get_post_meta( $resource_data->resource_id, '_wc_booking_availability', true ) );
|
830 |
-
|
831 |
-
}
|
832 |
-
|
833 |
-
public function sync_persons( $original_product_id, $tr_product_id, $lang_code, $duplicate = true ) {
|
834 |
-
$orig_persons = $this->wpdb->get_col( $this->wpdb->prepare( "SELECT ID FROM {$this->wpdb->posts} WHERE post_parent = %d AND post_type = 'bookable_person'", $original_product_id ) );
|
835 |
-
|
836 |
-
$trnsl_persons = $this->wpdb->get_col( $this->wpdb->prepare( "SELECT ID FROM {$this->wpdb->posts} WHERE post_parent = %d AND post_type = 'bookable_person'", $tr_product_id ) );
|
837 |
-
|
838 |
-
foreach ( $orig_persons as $person ) {
|
839 |
-
|
840 |
-
$trnsl_person_id = apply_filters( 'translate_object_id', $person, 'bookable_person', false, $lang_code );
|
841 |
-
|
842 |
-
if ( ! is_null( $trnsl_person_id ) && in_array( $trnsl_person_id, $trnsl_persons ) ) {
|
843 |
-
|
844 |
-
if ( ( $key = array_search( $trnsl_person_id, $trnsl_persons ) ) !== false ) {
|
845 |
-
|
846 |
-
unset( $trnsl_persons[ $key ] );
|
847 |
-
|
848 |
-
update_post_meta( $trnsl_person_id, 'block_cost', get_post_meta( $person, 'block_cost', true ) );
|
849 |
-
update_post_meta( $trnsl_person_id, 'cost', get_post_meta( $person, 'cost', true ) );
|
850 |
-
update_post_meta( $trnsl_person_id, 'max', get_post_meta( $person, 'max', true ) );
|
851 |
-
update_post_meta( $trnsl_person_id, 'min', get_post_meta( $person, 'min', true ) );
|
852 |
-
|
853 |
-
if ( get_post_meta( $person, '_wcml_custom_costs_status', true ) && $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
854 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
855 |
-
|
856 |
-
foreach ( $currencies as $code => $currency ) {
|
857 |
-
|
858 |
-
update_post_meta( $trnsl_person_id, 'block_cost_' . $code, get_post_meta( $person, 'block_cost_' . $code, true ) );
|
859 |
-
update_post_meta( $trnsl_person_id, 'cost_' . $code, get_post_meta( $person, 'cost_' . $code, true ) );
|
860 |
-
|
861 |
-
}
|
862 |
-
}
|
863 |
-
}
|
864 |
-
} else {
|
865 |
-
|
866 |
-
if ( $duplicate ) {
|
867 |
-
|
868 |
-
$this->duplicate_person( $tr_product_id, $person, $lang_code );
|
869 |
-
|
870 |
-
} else {
|
871 |
-
|
872 |
-
continue;
|
873 |
-
|
874 |
-
}
|
875 |
-
}
|
876 |
-
}
|
877 |
-
|
878 |
-
foreach ( $trnsl_persons as $trnsl_person ) {
|
879 |
-
|
880 |
-
wp_delete_post( $trnsl_person );
|
881 |
-
|
882 |
-
}
|
883 |
-
|
884 |
-
}
|
885 |
-
|
886 |
-
public function duplicate_person( $tr_product_id, $person_id, $lang_code ) {
|
887 |
-
global $iclTranslationManagement;
|
888 |
-
|
889 |
-
if ( method_exists( $this->sitepress, 'make_duplicate' ) ) {
|
890 |
-
|
891 |
-
$new_person_id = $this->sitepress->make_duplicate( $person_id, $lang_code );
|
892 |
-
|
893 |
-
} else {
|
894 |
-
|
895 |
-
if ( ! isset( $iclTranslationManagement ) ) {
|
896 |
-
$iclTranslationManagement = new TranslationManagement();
|
897 |
-
}
|
898 |
-
|
899 |
-
$new_person_id = $iclTranslationManagement->make_duplicate( $person_id, $lang_code );
|
900 |
-
|
901 |
-
}
|
902 |
-
|
903 |
-
$this->wpdb->update(
|
904 |
-
$this->wpdb->posts,
|
905 |
-
[
|
906 |
-
'post_parent' => $tr_product_id,
|
907 |
-
],
|
908 |
-
[
|
909 |
-
'ID' => $new_person_id,
|
910 |
-
]
|
911 |
-
);
|
912 |
-
|
913 |
-
delete_post_meta( $new_person_id, '_icl_lang_duplicate_of' );
|
914 |
-
|
915 |
-
return $new_person_id;
|
916 |
-
}
|
917 |
-
|
918 |
-
public function filter_wc_booking_cost( $check, $object_id, $meta_key, $single ) {
|
919 |
-
|
920 |
-
if ( in_array(
|
921 |
-
$meta_key,
|
922 |
-
[
|
923 |
-
'_wc_booking_cost',
|
924 |
-
'_wc_booking_base_cost',
|
925 |
-
'_wc_display_cost',
|
926 |
-
'_wc_booking_pricing',
|
927 |
-
'cost',
|
928 |
-
'_wc_booking_block_cost',
|
929 |
-
'block_cost',
|
930 |
-
'_resource_base_costs',
|
931 |
-
'_resource_block_costs',
|
932 |
-
]
|
933 |
-
) ) {
|
934 |
-
|
935 |
-
if ( WCML_MULTI_CURRENCIES_INDEPENDENT === $this->woocommerce_wpml->settings['enable_multi_currency'] ) {
|
936 |
-
|
937 |
-
$original_id = $this->woocommerce_wpml->products->get_original_product_id( $object_id );
|
938 |
-
|
939 |
-
$cost_status = get_post_meta( $original_id, '_wcml_custom_costs_status', true );
|
940 |
-
|
941 |
-
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
942 |
-
|
943 |
-
if ( $currency === wcml_get_woocommerce_currency_option() ) {
|
944 |
-
return $check;
|
945 |
-
}
|
946 |
-
|
947 |
-
if ( in_array( $meta_key, [ 'cost', 'block_cost' ] ) ) {
|
948 |
-
|
949 |
-
if ( get_post_type( $object_id ) == 'bookable_person' ) {
|
950 |
-
|
951 |
-
$original_id = apply_filters( 'translate_object_id', wp_get_post_parent_id( $object_id ), 'product', true, $this->woocommerce_wpml->products->get_original_product_language( wp_get_post_parent_id( $object_id ) ) );
|
952 |
-
$cost_status = get_post_meta( $original_id, '_wcml_custom_costs_status', true );
|
953 |
-
|
954 |
-
$value = get_post_meta( $object_id, $meta_key . '_' . $currency, true );
|
955 |
-
|
956 |
-
if ( $cost_status && $value ) {
|
957 |
-
|
958 |
-
return $value;
|
959 |
-
|
960 |
-
} else {
|
961 |
-
|
962 |
-
remove_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10 );
|
963 |
-
|
964 |
-
$cost = get_post_meta( $object_id, $meta_key, true );
|
965 |
-
|
966 |
-
add_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10, 4 );
|
967 |
-
|
968 |
-
return $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $cost, $currency );
|
969 |
-
}
|
970 |
-
} else {
|
971 |
-
|
972 |
-
return $check;
|
973 |
-
|
974 |
-
}
|
975 |
-
}
|
976 |
-
|
977 |
-
if ( in_array(
|
978 |
-
$meta_key,
|
979 |
-
[
|
980 |
-
'_wc_booking_pricing',
|
981 |
-
'_resource_base_costs',
|
982 |
-
'_resource_block_costs',
|
983 |
-
]
|
984 |
-
) ) {
|
985 |
-
|
986 |
-
remove_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10 );
|
987 |
-
|
988 |
-
if ( $meta_key == '_wc_booking_pricing' ) {
|
989 |
-
|
990 |
-
if ( $original_id != $object_id ) {
|
991 |
-
$value = get_post_meta( $original_id, $meta_key );
|
992 |
-
} else {
|
993 |
-
$value = $check;
|
994 |
-
}
|
995 |
-
} else {
|
996 |
-
|
997 |
-
$costs = maybe_unserialize( get_post_meta( $object_id, $meta_key, true ) );
|
998 |
-
|
999 |
-
if ( ! $costs ) {
|
1000 |
-
$value = $check;
|
1001 |
-
} elseif ( $cost_status && isset( $costs['custom_costs'][ $currency ] ) ) {
|
1002 |
-
|
1003 |
-
$res_costs = [];
|
1004 |
-
foreach ( $costs['custom_costs'][ $currency ] as $resource_id => $cost ) {
|
1005 |
-
$trns_resource_id = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', true, $this->sitepress->get_current_language() );
|
1006 |
-
$res_costs[ $trns_resource_id ] = $cost;
|
1007 |
-
}
|
1008 |
-
$value = [ 0 => $res_costs ];
|
1009 |
-
} elseif ( $cost_status && isset( $costs[0]['custom_costs'][ $currency ] ) ) {
|
1010 |
-
$value = [ 0 => $costs[0]['custom_costs'][ $currency ] ];
|
1011 |
-
} else {
|
1012 |
-
|
1013 |
-
$converted_values = [];
|
1014 |
-
|
1015 |
-
foreach ( $costs as $resource_id => $cost ) {
|
1016 |
-
$converted_values[0][ $resource_id ] = $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $cost, $currency );
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
$value = $converted_values;
|
1020 |
-
}
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
add_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10, 4 );
|
1024 |
-
|
1025 |
-
return $value;
|
1026 |
-
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
$value = get_post_meta( $original_id, $meta_key . '_' . $currency, true );
|
1030 |
-
|
1031 |
-
if ( $cost_status && ( ! empty( $value ) || ( empty( $value ) && $meta_key == '_wc_display_cost' ) ) ) {
|
1032 |
-
|
1033 |
-
return $value;
|
1034 |
-
|
1035 |
-
} else {
|
1036 |
-
|
1037 |
-
remove_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10 );
|
1038 |
-
|
1039 |
-
$value = get_post_meta( $original_id, $meta_key, true );
|
1040 |
-
|
1041 |
-
$value = $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $value, $currency );
|
1042 |
-
|
1043 |
-
add_filter( 'get_post_metadata', [ $this, 'filter_wc_booking_cost' ], 10, 4 );
|
1044 |
-
|
1045 |
-
return $value;
|
1046 |
-
|
1047 |
-
}
|
1048 |
-
}
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
return $check;
|
1052 |
-
}
|
1053 |
-
|
1054 |
-
public function sync_resource_costs_with_translations( $object_id, $meta_key, $check = false ) {
|
1055 |
-
|
1056 |
-
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $object_id );
|
1057 |
-
|
1058 |
-
if ( $object_id == $original_product_id ) {
|
1059 |
-
|
1060 |
-
$translations = $this->wpml_post_translations->get_element_translations( $object_id, false, true );
|
1061 |
-
|
1062 |
-
foreach ( $translations as $translation ) {
|
1063 |
-
$this->sync_resource_costs(
|
1064 |
-
$original_product_id,
|
1065 |
-
$translation,
|
1066 |
-
$meta_key,
|
1067 |
-
$this->wpml_post_translations->get_element_lang_code( $translation )
|
1068 |
-
);
|
1069 |
-
}
|
1070 |
-
|
1071 |
-
return $check;
|
1072 |
-
} else {
|
1073 |
-
$this->sync_resource_costs(
|
1074 |
-
$original_product_id,
|
1075 |
-
$object_id,
|
1076 |
-
$meta_key,
|
1077 |
-
$this->wpml_post_translations->get_element_lang_code( $object_id )
|
1078 |
-
);
|
1079 |
-
return true;
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
public function sync_resource_costs( $original_product_id, $object_id, $meta_key, $language_code ) {
|
1085 |
-
|
1086 |
-
$original_costs = maybe_unserialize( get_post_meta( $original_product_id, $meta_key, true ) );
|
1087 |
-
|
1088 |
-
$wc_booking_resource_costs = [];
|
1089 |
-
if ( ! empty( $original_costs ) ) {
|
1090 |
-
foreach ( $original_costs as $resource_id => $costs ) {
|
1091 |
-
|
1092 |
-
if ( $resource_id == 'custom_costs' && isset( $costs['custom_costs'] ) ) {
|
1093 |
-
|
1094 |
-
foreach ( $costs['custom_costs'] as $code => $currencies ) {
|
1095 |
-
|
1096 |
-
foreach ( $currencies as $custom_costs_resource_id => $custom_cost ) {
|
1097 |
-
|
1098 |
-
$trns_resource_id = apply_filters( 'translate_object_id', $custom_costs_resource_id, 'bookable_resource', true, $language_code );
|
1099 |
-
|
1100 |
-
$wc_booking_resource_costs['custom_costs'][ $code ][ $trns_resource_id ] = $custom_cost;
|
1101 |
-
|
1102 |
-
}
|
1103 |
-
}
|
1104 |
-
} else {
|
1105 |
-
|
1106 |
-
$trns_resource_id = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', true, $language_code );
|
1107 |
-
|
1108 |
-
$wc_booking_resource_costs[ $trns_resource_id ] = $costs;
|
1109 |
-
|
1110 |
-
}
|
1111 |
-
}
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
update_post_meta( $object_id, $meta_key, $wc_booking_resource_costs );
|
1115 |
-
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
public function wc_bookings_process_cost_rules_cost( $cost, $fields, $key ) {
|
1119 |
-
return $this->filter_pricing_cost( $cost, $fields, 'cost_', $key );
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
public function wc_bookings_process_cost_rules_base_cost( $base_cost, $fields, $key ) {
|
1123 |
-
return $this->filter_pricing_cost( $base_cost, $fields, 'base_cost_', $key );
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
public function wc_bookings_process_cost_rules_override_block_cost( $override_cost, $fields, $key ) {
|
1127 |
-
return $this->filter_pricing_cost( $override_cost, $fields, 'override_block_', $key );
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
public function filter_pricing_cost( $cost, $fields, $name, $key ) {
|
1131 |
-
global $product;
|
1132 |
-
|
1133 |
-
if ( $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
1134 |
-
|
1135 |
-
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
1136 |
-
|
1137 |
-
if ( $currency === wcml_get_woocommerce_currency_option() ) {
|
1138 |
-
return $cost;
|
1139 |
-
}
|
1140 |
-
|
1141 |
-
if ( isset( $_POST['form'] ) ) {
|
1142 |
-
parse_str( $_POST['form'], $posted );
|
1143 |
-
|
1144 |
-
$booking_id = $posted['add-to-cart'];
|
1145 |
-
|
1146 |
-
} elseif ( isset( $_POST['add-to-cart'] ) ) {
|
1147 |
-
|
1148 |
-
$booking_id = $_POST['add-to-cart'];
|
1149 |
-
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
if ( isset( $booking_id ) ) {
|
1153 |
-
$original_id = $this->woocommerce_wpml->products->get_original_product_id( $booking_id );
|
1154 |
-
|
1155 |
-
if ( $booking_id != $original_id ) {
|
1156 |
-
$fields = maybe_unserialize( get_post_meta( $original_id, '_wc_booking_pricing', true ) );
|
1157 |
-
$fields = $fields[ $key ];
|
1158 |
-
}
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
$needs_filter_pricing_cost = $this->needs_filter_pricing_cost( $name, $fields );
|
1162 |
-
|
1163 |
-
if ( $needs_filter_pricing_cost ) {
|
1164 |
-
if ( isset( $fields[ $name . $currency ] ) ) {
|
1165 |
-
return $fields[ $name . $currency ];
|
1166 |
-
} else {
|
1167 |
-
return $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $cost, $currency );
|
1168 |
-
}
|
1169 |
-
}
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
return $cost;
|
1173 |
-
|
1174 |
-
}
|
1175 |
-
|
1176 |
-
public function needs_filter_pricing_cost( $name, $fields ) {
|
1177 |
-
|
1178 |
-
$modifier_skip_values = [ 'divide', 'times' ];
|
1179 |
-
|
1180 |
-
if (
|
1181 |
-
'override_block_' === $name ||
|
1182 |
-
( 'cost_' === $name && ! in_array( $fields['modifier'], $modifier_skip_values ) ) ||
|
1183 |
-
( 'base_cost_' === $name && ! in_array( $fields['base_modifier'], $modifier_skip_values ) )
|
1184 |
-
) {
|
1185 |
-
return true;
|
1186 |
-
} else {
|
1187 |
-
return false;
|
1188 |
-
}
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
public function load_assets( $external_product_type = false ) {
|
1192 |
-
global $pagenow;
|
1193 |
-
|
1194 |
-
$product_id = $pagenow == 'post.php' && isset( $_GET['post'] ) ? (int) $_GET['post'] : false;
|
1195 |
-
|
1196 |
-
if ( $product_id && get_post_type( $product_id ) === 'product' ) {
|
1197 |
-
$product = wc_get_product( $product_id );
|
1198 |
-
$product_type = $product->get_type();
|
1199 |
-
|
1200 |
-
if ( ( $this->is_booking( $product ) || $product_type === $external_product_type ) || $pagenow == 'post-new.php' ) {
|
1201 |
-
|
1202 |
-
wp_register_style( 'wcml-bookings-css', WCML_PLUGIN_URL . '/compatibility/res/css/wcml-bookings.css', [], WCML_VERSION );
|
1203 |
-
wp_enqueue_style( 'wcml-bookings-css' );
|
1204 |
-
|
1205 |
-
wp_register_script( 'wcml-bookings-js', WCML_PLUGIN_URL . '/compatibility/res/js/wcml-bookings.js', [ 'jquery' ], WCML_VERSION, true );
|
1206 |
-
wp_enqueue_script( 'wcml-bookings-js' );
|
1207 |
-
|
1208 |
-
}
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
public function localize_lock_fields_js() {
|
1214 |
-
wp_localize_script( 'wcml-bookings-js', 'lock_settings', [ 'lock_fields' => 1 ] );
|
1215 |
-
}
|
1216 |
-
|
1217 |
-
public function wcml_multi_currency_is_ajax( $actions ) {
|
1218 |
-
|
1219 |
-
$actions[] = 'wc_bookings_calculate_costs';
|
1220 |
-
|
1221 |
-
return $actions;
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
public function filter_bundled_product_in_cart_contents( $cart_item, $key, $current_language ) {
|
1225 |
-
|
1226 |
-
if ( $cart_item['data'] instanceof WC_Product_Booking && isset( $cart_item['booking'] ) ) {
|
1227 |
-
|
1228 |
-
$current_id = apply_filters( 'translate_object_id', $cart_item['product_id'], 'product', true, $current_language );
|
1229 |
-
$cart_product_id = $cart_item['product_id'];
|
1230 |
-
|
1231 |
-
if ( $current_id != $cart_product_id ) {
|
1232 |
-
|
1233 |
-
$cart_item['data'] = new WC_Product_Booking( $current_id );
|
1234 |
-
|
1235 |
-
}
|
1236 |
-
|
1237 |
-
if ( $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT || $current_id != $cart_product_id ) {
|
1238 |
-
|
1239 |
-
$booking_info = [
|
1240 |
-
'wc_bookings_field_start_date_year' => $cart_item['booking']['_year'],
|
1241 |
-
'wc_bookings_field_start_date_month' => $cart_item['booking']['_month'],
|
1242 |
-
'wc_bookings_field_start_date_day' => $cart_item['booking']['_day'],
|
1243 |
-
'add-to-cart' => $current_id,
|
1244 |
-
];
|
1245 |
-
|
1246 |
-
if ( isset( $cart_item['booking']['_persons'] ) ) {
|
1247 |
-
foreach ( $cart_item['booking']['_persons'] as $person_id => $value ) {
|
1248 |
-
$booking_info[ 'wc_bookings_field_persons_' . apply_filters( 'translate_object_id', $person_id, 'bookable_person', false, $current_language ) ] = $value;
|
1249 |
-
}
|
1250 |
-
}
|
1251 |
-
|
1252 |
-
if ( isset( $cart_item['booking']['_resource_id'] ) ) {
|
1253 |
-
$booking_info['wc_bookings_field_resource'] = apply_filters( 'translate_object_id', $cart_item['booking']['_resource_id'], 'bookable_resource', false, $current_language );
|
1254 |
-
}
|
1255 |
-
|
1256 |
-
if ( isset( $cart_item['booking']['_duration'] ) ) {
|
1257 |
-
$booking_info['wc_bookings_field_duration'] = $cart_item['booking']['_duration'];
|
1258 |
-
}
|
1259 |
-
|
1260 |
-
if ( isset( $cart_item['booking']['_time'] ) ) {
|
1261 |
-
$booking_info['wc_bookings_field_start_date_time'] = $cart_item['booking']['_time'];
|
1262 |
-
}
|
1263 |
-
|
1264 |
-
$current_product = wc_get_product( $current_id );
|
1265 |
-
|
1266 |
-
$cost = $this->get_booking_cost( $booking_info, $current_product );
|
1267 |
-
|
1268 |
-
if ( ! is_wp_error( $cost ) ) {
|
1269 |
-
$cart_item['data']->set_price( $cost );
|
1270 |
-
}
|
1271 |
-
}
|
1272 |
-
}
|
1273 |
-
|
1274 |
-
return $cart_item;
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
private function get_booking_cost( $booking_info, $current_product ) {
|
1278 |
-
if ( class_exists( 'WC_Bookings_Cost_Calculation' ) ) {
|
1279 |
-
$cost = WC_Bookings_Cost_Calculation::calculate_booking_cost( wc_bookings_get_posted_data( $booking_info, $current_product ), $current_product );
|
1280 |
-
} else {
|
1281 |
-
$booking_form = new WC_Booking_Form( $current_product );
|
1282 |
-
$cost = $booking_form->calculate_booking_cost( $booking_info );
|
1283 |
-
}
|
1284 |
-
|
1285 |
-
return $cost;
|
1286 |
-
}
|
1287 |
-
|
1288 |
-
public function booking_currency_dropdown() {
|
1289 |
-
|
1290 |
-
if ( $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
1291 |
-
$current_booking_currency = $this->get_cookie_booking_currency();
|
1292 |
-
|
1293 |
-
$wc_currencies = get_woocommerce_currencies();
|
1294 |
-
$currencies = $this->woocommerce_wpml->multi_currency->get_currencies( $include_default = true );
|
1295 |
-
?>
|
1296 |
-
<tr valign="top">
|
1297 |
-
<th scope="row"><?php _e( 'Booking currency', 'woocommerce-multilingual' ); ?></th>
|
1298 |
-
<td>
|
1299 |
-
<select id="dropdown_booking_currency">
|
1300 |
-
<?php foreach ( $currencies as $currency => $count ) : ?>
|
1301 |
-
<option
|
1302 |
-
value="<?php echo esc_html( $currency ); ?>" <?php echo $current_booking_currency == $currency ? 'selected="selected"' : ''; ?>><?php echo esc_html( $wc_currencies[ $currency ] ); ?></option>
|
1303 |
-
<?php endforeach; ?>
|
1304 |
-
</select>
|
1305 |
-
</td>
|
1306 |
-
</tr>
|
1307 |
-
|
1308 |
-
<?php
|
1309 |
-
|
1310 |
-
$wcml_booking_set_currency_nonce = wp_create_nonce( 'booking_set_currency' );
|
1311 |
-
|
1312 |
-
wc_enqueue_js(
|
1313 |
-
"
|
1314 |
-
|
1315 |
-
jQuery(document).on('change', '#dropdown_booking_currency', function(){
|
1316 |
-
jQuery.ajax({
|
1317 |
-
url: ajaxurl,
|
1318 |
-
type: 'post',
|
1319 |
-
data: {
|
1320 |
-
action: 'wcml_booking_set_currency',
|
1321 |
-
currency: jQuery('#dropdown_booking_currency').val(),
|
1322 |
-
wcml_nonce: '" . $wcml_booking_set_currency_nonce . "'
|
1323 |
-
},
|
1324 |
-
success: function( response ){
|
1325 |
-
if(typeof response.error !== 'undefined'){
|
1326 |
-
alert(response.error);
|
1327 |
-
}else{
|
1328 |
-
window.location = window.location.href;
|
1329 |
-
}
|
1330 |
-
}
|
1331 |
-
})
|
1332 |
-
});
|
1333 |
-
"
|
1334 |
-
);
|
1335 |
-
|
1336 |
-
}
|
1337 |
-
|
1338 |
-
}
|
1339 |
-
|
1340 |
-
public function set_booking_currency_ajax() {
|
1341 |
-
|
1342 |
-
$nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
1343 |
-
if ( ! $nonce || ! wp_verify_nonce( $nonce, 'booking_set_currency' ) ) {
|
1344 |
-
echo json_encode( [ 'error' => __( 'Invalid nonce', 'woocommerce-multilingual' ) ] );
|
1345 |
-
die();
|
1346 |
-
}
|
1347 |
-
|
1348 |
-
$this->set_booking_currency( filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
|
1349 |
-
|
1350 |
-
die();
|
1351 |
-
}
|
1352 |
-
|
1353 |
-
public function set_booking_currency( $currency_code = false ) {
|
1354 |
-
$cookie_name = '_wcml_booking_currency';
|
1355 |
-
|
1356 |
-
if ( ! isset( $_COOKIE[ $cookie_name ] ) && ! headers_sent() ) {
|
1357 |
-
$currency_code = wcml_get_woocommerce_currency_option();
|
1358 |
-
|
1359 |
-
if ( WCML_MULTI_CURRENCIES_INDEPENDENT === $this->woocommerce_wpml->settings['enable_multi_currency'] ) {
|
1360 |
-
$currency_code = $this->woocommerce_wpml->multi_currency->get_currency_code();
|
1361 |
-
}
|
1362 |
-
}
|
1363 |
-
|
1364 |
-
if ( $currency_code ) {
|
1365 |
-
// @todo uncomment or delete when #wpmlcore-5796 is resolved
|
1366 |
-
// do_action( 'wpsc_add_cookie', $cookie_name );
|
1367 |
-
setcookie( $cookie_name, $currency_code, time() + 86400, COOKIEPATH, COOKIE_DOMAIN );
|
1368 |
-
}
|
1369 |
-
}
|
1370 |
-
|
1371 |
-
public function get_cookie_booking_currency() {
|
1372 |
-
|
1373 |
-
if ( isset( $_COOKIE ['_wcml_booking_currency'] ) ) {
|
1374 |
-
$currency = $_COOKIE['_wcml_booking_currency'];
|
1375 |
-
} else {
|
1376 |
-
$currency = wcml_get_woocommerce_currency_option();
|
1377 |
-
}
|
1378 |
-
|
1379 |
-
return $currency;
|
1380 |
-
}
|
1381 |
-
|
1382 |
-
public function filter_booking_currency_symbol( $currency ) {
|
1383 |
-
global $pagenow;
|
1384 |
-
|
1385 |
-
remove_filter( 'woocommerce_currency_symbol', [ $this, 'filter_booking_currency_symbol' ] );
|
1386 |
-
if ( isset( $_COOKIE ['_wcml_booking_currency'] ) && $pagenow == 'edit.php' && isset( $_GET['page'] ) && $_GET['page'] == 'create_booking' ) {
|
1387 |
-
$currency = get_woocommerce_currency_symbol( $_COOKIE ['_wcml_booking_currency'] );
|
1388 |
-
}
|
1389 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_booking_currency_symbol' ] );
|
1390 |
-
|
1391 |
-
return $currency;
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
public function create_booking_page_client_currency( $currency ) {
|
1395 |
-
global $pagenow;
|
1396 |
-
|
1397 |
-
if ( wpml_is_ajax() && isset( $_POST['form'] ) ) {
|
1398 |
-
parse_str( $_POST['form'], $posted );
|
1399 |
-
}
|
1400 |
-
|
1401 |
-
if ( ( $pagenow == 'edit.php' && isset( $_GET['page'] ) && $_GET['page'] == 'create_booking' ) || ( isset( $posted['_wp_http_referer'] ) && strpos( $posted['_wp_http_referer'], 'page=create_booking' ) !== false ) ) {
|
1402 |
-
$currency = $this->get_cookie_booking_currency();
|
1403 |
-
}
|
1404 |
-
|
1405 |
-
return $currency;
|
1406 |
-
}
|
1407 |
-
|
1408 |
-
public function set_order_currency_on_create_booking_page( $order_id ) {
|
1409 |
-
update_post_meta( $order_id, '_order_currency', $this->get_cookie_booking_currency() );
|
1410 |
-
|
1411 |
-
update_post_meta( $order_id, 'wpml_language', $this->sitepress->get_current_language() );
|
1412 |
-
|
1413 |
-
}
|
1414 |
-
|
1415 |
-
public function filter_get_booking_products_args( $args ) {
|
1416 |
-
if ( isset( $args['suppress_filters'] ) ) {
|
1417 |
-
$args['suppress_filters'] = false;
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
return $args;
|
1421 |
-
}
|
1422 |
-
|
1423 |
-
public function custom_box_html( $obj, $product_id, $data ) {
|
1424 |
-
|
1425 |
-
if ( ! $this->is_booking( $product_id ) ) {
|
1426 |
-
return;
|
1427 |
-
}
|
1428 |
-
|
1429 |
-
$bookings_section = new WPML_Editor_UI_Field_Section( __( 'Bookings', 'woocommerce-multilingual' ) );
|
1430 |
-
|
1431 |
-
if ( get_post_meta( $product_id, '_wc_booking_has_resources', true ) == 'yes' ) {
|
1432 |
-
$group = new WPML_Editor_UI_Field_Group( '', true );
|
1433 |
-
$booking_field = new WPML_Editor_UI_Single_Line_Field( '_wc_booking_resouce_label', __( 'Resources Label', 'woocommerce-multilingual' ), $data, true );
|
1434 |
-
$group->add_field( $booking_field );
|
1435 |
-
$bookings_section->add_field( $group );
|
1436 |
-
}
|
1437 |
-
|
1438 |
-
$orig_resources = maybe_unserialize( get_post_meta( $product_id, '_resource_base_costs', true ) );
|
1439 |
-
|
1440 |
-
if ( $orig_resources ) {
|
1441 |
-
$group = new WPML_Editor_UI_Field_Group( __( 'Resources', 'woocommerce-multilingual' ) );
|
1442 |
-
$group_title = __( 'Resources', 'woocommerce-multilingual' );
|
1443 |
-
foreach ( $orig_resources as $resource_id => $cost ) {
|
1444 |
-
|
1445 |
-
if ( $resource_id == 'custom_costs' ) {
|
1446 |
-
continue;
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
$group = new WPML_Editor_UI_Field_Group( $group_title );
|
1450 |
-
$group_title = '';
|
1451 |
-
|
1452 |
-
$resource_field = new WPML_Editor_UI_Single_Line_Field( 'bookings-resource_' . $resource_id . '_title', __( 'Title', 'woocommerce-multilingual' ), $data, true );
|
1453 |
-
$group->add_field( $resource_field );
|
1454 |
-
$bookings_section->add_field( $group );
|
1455 |
-
}
|
1456 |
-
}
|
1457 |
-
|
1458 |
-
$original_persons = $this->get_original_persons( $product_id );
|
1459 |
-
end( $original_persons );
|
1460 |
-
$last_key = key( $original_persons );
|
1461 |
-
$divider = true;
|
1462 |
-
$group_title = __( 'Person Types', 'woocommerce-multilingual' );
|
1463 |
-
foreach ( $original_persons as $person_id ) {
|
1464 |
-
if ( $person_id == $last_key ) {
|
1465 |
-
$divider = false;
|
1466 |
-
}
|
1467 |
-
$group = new WPML_Editor_UI_Field_Group( $group_title, $divider );
|
1468 |
-
$group_title = '';
|
1469 |
-
|
1470 |
-
$person_field = new WPML_Editor_UI_Single_Line_Field( 'bookings-person_' . $person_id . '_title', __( 'Person Type Name', 'woocommerce-multilingual' ), $data, false );
|
1471 |
-
$group->add_field( $person_field );
|
1472 |
-
$person_field = new WPML_Editor_UI_Single_Line_Field( 'bookings-person_' . $person_id . '_description', __( 'Description', 'woocommerce-multilingual' ), $data, false );
|
1473 |
-
$group->add_field( $person_field );
|
1474 |
-
$bookings_section->add_field( $group );
|
1475 |
-
|
1476 |
-
}
|
1477 |
-
|
1478 |
-
if ( $orig_resources || $original_persons ) {
|
1479 |
-
$obj->add_field( $bookings_section );
|
1480 |
-
}
|
1481 |
-
|
1482 |
-
}
|
1483 |
-
|
1484 |
-
|
1485 |
-
public function custom_box_html_data( $data, $product_id, $translation, $lang ) {
|
1486 |
-
|
1487 |
-
if ( ! $this->is_booking( $product_id ) ) {
|
1488 |
-
return $data;
|
1489 |
-
}
|
1490 |
-
|
1491 |
-
if ( get_post_meta( $product_id, '_wc_booking_has_resources', true ) == 'yes' ) {
|
1492 |
-
|
1493 |
-
$data['_wc_booking_resouce_label'] = [ 'original' => get_post_meta( $product_id, '_wc_booking_resouce_label', true ) ];
|
1494 |
-
$data['_wc_booking_resouce_label']['translation'] = $translation ? get_post_meta( $translation->ID, '_wc_booking_resouce_label', true ) : '';
|
1495 |
-
}
|
1496 |
-
|
1497 |
-
$orig_resources = $this->get_original_resources( $product_id );
|
1498 |
-
|
1499 |
-
if ( $orig_resources && is_array( $orig_resources ) ) {
|
1500 |
-
|
1501 |
-
foreach ( $orig_resources as $resource_id => $cost ) {
|
1502 |
-
|
1503 |
-
if ( 'custom_costs' === $resource_id ) {
|
1504 |
-
continue;
|
1505 |
-
}
|
1506 |
-
$data[ 'bookings-resource_' . $resource_id . '_title' ] = [ 'original' => get_the_title( $resource_id ) ];
|
1507 |
-
global $sitepress;
|
1508 |
-
$trns_resource_id = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', false, $lang );
|
1509 |
-
$data[ 'bookings-resource_' . $resource_id . '_title' ]['translation'] = $trns_resource_id ? get_the_title( $trns_resource_id ) : '';
|
1510 |
-
}
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
$original_persons = $this->get_original_persons( $product_id );
|
1514 |
-
|
1515 |
-
foreach ( $original_persons as $person_id ) {
|
1516 |
-
|
1517 |
-
$data[ 'bookings-person_' . $person_id . '_title' ] = [ 'original' => get_the_title( $person_id ) ];
|
1518 |
-
$data[ 'bookings-person_' . $person_id . '_description' ] = [ 'original' => get_post( $person_id )->post_excerpt ];
|
1519 |
-
|
1520 |
-
$trnsl_person_id = apply_filters( 'translate_object_id', $person_id, 'bookable_person', false, $lang );
|
1521 |
-
$data[ 'bookings-person_' . $person_id . '_title' ]['translation'] = $trnsl_person_id ? get_the_title( $trnsl_person_id ) : '';
|
1522 |
-
$data[ 'bookings-person_' . $person_id . '_description' ]['translation'] = $trnsl_person_id ? get_post( $trnsl_person_id )->post_excerpt : '';
|
1523 |
-
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
return $data;
|
1527 |
-
}
|
1528 |
-
|
1529 |
-
|
1530 |
-
public function get_original_resources( $product_id ) {
|
1531 |
-
$orig_resources = maybe_unserialize( get_post_meta( $product_id, '_resource_base_costs', true ) );
|
1532 |
-
|
1533 |
-
return $orig_resources;
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
public function get_original_persons( $product_id ) {
|
1537 |
-
$original_persons = $this->wpdb->get_col( $this->wpdb->prepare( "SELECT ID FROM {$this->wpdb->posts} WHERE post_parent = %d AND post_type = 'bookable_person' AND post_status = 'publish'", $product_id ) );
|
1538 |
-
|
1539 |
-
return $original_persons;
|
1540 |
-
}
|
1541 |
-
|
1542 |
-
public function show_custom_blocks_for_resources_and_persons( $check, $product_id, $product_content ) {
|
1543 |
-
if ( in_array( $product_content, [ 'wc_booking_resources', 'wc_booking_persons' ] ) ) {
|
1544 |
-
return false;
|
1545 |
-
}
|
1546 |
-
|
1547 |
-
return $check;
|
1548 |
-
}
|
1549 |
-
|
1550 |
-
public function replace_tm_editor_custom_fields_with_own_sections( $fields ) {
|
1551 |
-
$fields[] = '_resource_base_costs';
|
1552 |
-
$fields[] = '_resource_block_costs';
|
1553 |
-
|
1554 |
-
return $fields;
|
1555 |
-
}
|
1556 |
-
|
1557 |
-
public function remove_single_custom_fields_to_translate( $fields ) {
|
1558 |
-
$fields[] = '_wc_booking_resouce_label';
|
1559 |
-
|
1560 |
-
return $fields;
|
1561 |
-
}
|
1562 |
-
|
1563 |
-
public function product_content_resource_label( $meta_key, $product_id ) {
|
1564 |
-
if ( $meta_key == '_wc_booking_resouce_label' ) {
|
1565 |
-
return __( 'Resources label', 'woocommerce-multilingual' );
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
return $meta_key;
|
1569 |
-
}
|
1570 |
-
|
1571 |
-
public function wcml_products_tab_sync_resources_and_persons( $original_product_id, $tr_product_id, $data, $language ) {
|
1572 |
-
global $wpml_post_translations;
|
1573 |
-
|
1574 |
-
remove_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100 );
|
1575 |
-
|
1576 |
-
$orig_resources = $orig_resources = $this->get_original_resources( $original_product_id );
|
1577 |
-
|
1578 |
-
if ( $orig_resources ) {
|
1579 |
-
|
1580 |
-
foreach ( $orig_resources as $orig_resource_id => $cost ) {
|
1581 |
-
|
1582 |
-
$resource_id = apply_filters( 'translate_object_id', $orig_resource_id, 'bookable_resource', false, $language );
|
1583 |
-
$orig_resource = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT resource_id, sort_order FROM {$this->wpdb->prefix}wc_booking_relationships WHERE resource_id = %d AND product_id = %d", $orig_resource_id, $original_product_id ), OBJECT );
|
1584 |
-
|
1585 |
-
if ( is_null( $resource_id ) ) {
|
1586 |
-
|
1587 |
-
if ( $orig_resource ) {
|
1588 |
-
$resource_id = $this->duplicate_resource( $tr_product_id, $orig_resource, $language );
|
1589 |
-
} else {
|
1590 |
-
continue;
|
1591 |
-
}
|
1592 |
-
} else {
|
1593 |
-
// update_relationship
|
1594 |
-
$exist = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT ID FROM {$this->wpdb->prefix}wc_booking_relationships WHERE resource_id = %d AND product_id = %d", $resource_id, $tr_product_id ) );
|
1595 |
-
|
1596 |
-
if ( ! $exist ) {
|
1597 |
-
|
1598 |
-
$this->wpdb->insert(
|
1599 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
1600 |
-
[
|
1601 |
-
'product_id' => $tr_product_id,
|
1602 |
-
'resource_id' => $resource_id,
|
1603 |
-
'sort_order' => $orig_resource->sort_order,
|
1604 |
-
]
|
1605 |
-
);
|
1606 |
-
|
1607 |
-
}
|
1608 |
-
}
|
1609 |
-
|
1610 |
-
$this->wpdb->update(
|
1611 |
-
$this->wpdb->posts,
|
1612 |
-
[
|
1613 |
-
'post_title' => $data[ md5( 'bookings-resource_' . $orig_resource_id . '_title' ) ],
|
1614 |
-
],
|
1615 |
-
[
|
1616 |
-
'ID' => $resource_id,
|
1617 |
-
]
|
1618 |
-
);
|
1619 |
-
|
1620 |
-
update_post_meta( $resource_id, 'wcml_is_translated', true );
|
1621 |
-
|
1622 |
-
}
|
1623 |
-
|
1624 |
-
// sync resources data
|
1625 |
-
$this->sync_resources( $original_product_id, $tr_product_id, $language, false );
|
1626 |
-
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
$original_persons = $this->get_original_persons( $original_product_id );
|
1630 |
-
|
1631 |
-
// sync persons
|
1632 |
-
if ( $original_persons ) {
|
1633 |
-
|
1634 |
-
foreach ( $original_persons as $original_person_id ) {
|
1635 |
-
|
1636 |
-
$person_id = apply_filters( 'translate_object_id', $original_person_id, 'bookable_person', false, $language );
|
1637 |
-
|
1638 |
-
if ( is_null( $person_id ) ) {
|
1639 |
-
|
1640 |
-
$person_id = $this->duplicate_person( $tr_product_id, $original_person_id, $language );
|
1641 |
-
|
1642 |
-
} else {
|
1643 |
-
|
1644 |
-
$this->wpdb->update(
|
1645 |
-
$this->wpdb->posts,
|
1646 |
-
[
|
1647 |
-
'post_parent' => $tr_product_id,
|
1648 |
-
],
|
1649 |
-
[
|
1650 |
-
'ID' => $person_id,
|
1651 |
-
]
|
1652 |
-
);
|
1653 |
-
|
1654 |
-
}
|
1655 |
-
|
1656 |
-
$this->wpdb->update(
|
1657 |
-
$this->wpdb->posts,
|
1658 |
-
[
|
1659 |
-
'post_title' => $data[ md5( 'bookings-person_' . $original_person_id . '_title' ) ],
|
1660 |
-
'post_excerpt' => $data[ md5( 'bookings-person_' . $original_person_id . '_description' ) ],
|
1661 |
-
],
|
1662 |
-
[
|
1663 |
-
'ID' => $person_id,
|
1664 |
-
]
|
1665 |
-
);
|
1666 |
-
|
1667 |
-
update_post_meta( $person_id, 'wcml_is_translated', true );
|
1668 |
-
|
1669 |
-
}
|
1670 |
-
|
1671 |
-
// sync persons data
|
1672 |
-
$this->sync_persons( $original_product_id, $tr_product_id, $language, false );
|
1673 |
-
|
1674 |
-
}
|
1675 |
-
|
1676 |
-
add_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100, 2 );
|
1677 |
-
|
1678 |
-
}
|
1679 |
-
|
1680 |
-
public function duplicate_booking_for_translations( $booking_id, $lang = false ) {
|
1681 |
-
$booking_object = get_post( $booking_id );
|
1682 |
-
|
1683 |
-
$booking_data = [
|
1684 |
-
'post_type' => 'wc_booking',
|
1685 |
-
'post_title' => $booking_object->post_title,
|
1686 |
-
'post_status' => $booking_object->post_status,
|
1687 |
-
'ping_status' => 'closed',
|
1688 |
-
];
|
1689 |
-
|
1690 |
-
if ( $booking_object->post_parent && $lang ) {
|
1691 |
-
$translated_parent = apply_filters( 'translate_object_id', $booking_object->post_parent, get_post_type( $booking_object->post_parent ), false, $lang );
|
1692 |
-
if ( $translated_parent ) {
|
1693 |
-
$booking_data['post_parent'] = $translated_parent;
|
1694 |
-
}
|
1695 |
-
}
|
1696 |
-
|
1697 |
-
$active_languages = $this->sitepress->get_active_languages();
|
1698 |
-
|
1699 |
-
foreach ( $active_languages as $language ) {
|
1700 |
-
|
1701 |
-
$booking_product_id = get_post_meta( $booking_id, '_booking_product_id', true );
|
1702 |
-
|
1703 |
-
if ( ! $lang ) {
|
1704 |
-
$booking_language = $this->sitepress->get_element_language_details( $booking_product_id, 'post_product' );
|
1705 |
-
if ( $booking_language->language_code == $language['code'] ) {
|
1706 |
-
continue;
|
1707 |
-
}
|
1708 |
-
} elseif ( $lang != $language['code'] ) {
|
1709 |
-
continue;
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
$booking_persons = maybe_unserialize( get_post_meta( $booking_id, '_booking_persons', true ) );
|
1713 |
-
$trnsl_booking_persons = [];
|
1714 |
-
|
1715 |
-
if ( is_array( $booking_persons ) && ! empty( $booking_persons ) ) {
|
1716 |
-
foreach ( $booking_persons as $person_id => $person_count ) {
|
1717 |
-
|
1718 |
-
$trnsl_person_id = apply_filters( 'translate_object_id', $person_id, 'bookable_person', false, $language['code'] );
|
1719 |
-
|
1720 |
-
if ( is_null( $trnsl_person_id ) ) {
|
1721 |
-
$trnsl_booking_persons[] = $person_count;
|
1722 |
-
} else {
|
1723 |
-
$trnsl_booking_persons[ $trnsl_person_id ] = $person_count;
|
1724 |
-
}
|
1725 |
-
}
|
1726 |
-
}
|
1727 |
-
|
1728 |
-
$trnsl_booking_id = wp_insert_post( $booking_data );
|
1729 |
-
$trid = $this->sitepress->get_element_trid( $booking_id );
|
1730 |
-
$this->sitepress->set_element_language_details( $trnsl_booking_id, 'post_wc_booking', $trid, $language['code'] );
|
1731 |
-
|
1732 |
-
$meta_args = [
|
1733 |
-
'_booking_order_item_id' => 0,
|
1734 |
-
'_booking_product_id' => $this->get_translated_booking_product_id( $booking_id, $language['code'] ),
|
1735 |
-
'_booking_resource_id' => $this->get_translated_booking_resource_id( $booking_id, $language['code'] ),
|
1736 |
-
'_booking_persons' => $this->get_translated_booking_persons_ids( $booking_id, $language['code'] ),
|
1737 |
-
'_booking_cost' => get_post_meta( $booking_id, '_booking_cost', true ),
|
1738 |
-
'_booking_start' => get_post_meta( $booking_id, '_booking_start', true ),
|
1739 |
-
'_booking_end' => get_post_meta( $booking_id, '_booking_end', true ),
|
1740 |
-
'_booking_all_day' => intval( get_post_meta( $booking_id, '_booking_all_day', true ) ),
|
1741 |
-
'_booking_parent_id' => get_post_meta( $booking_id, '_booking_parent_id', true ),
|
1742 |
-
'_booking_customer_id' => get_post_meta( $booking_id, '_booking_customer_id', true ),
|
1743 |
-
'_booking_duplicate_of' => $booking_id,
|
1744 |
-
'_language_code' => $language['code'],
|
1745 |
-
];
|
1746 |
-
|
1747 |
-
foreach ( $meta_args as $key => $value ) {
|
1748 |
-
update_post_meta( $trnsl_booking_id, $key, $value );
|
1749 |
-
}
|
1750 |
-
|
1751 |
-
WC_Cache_Helper::get_transient_version( 'bookings', true );
|
1752 |
-
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
public function get_translated_booking_product_id( $booking_id, $language ) {
|
1758 |
-
|
1759 |
-
$booking_product_id = get_post_meta( $booking_id, '_booking_product_id', true );
|
1760 |
-
$trnsl_booking_product_id = '';
|
1761 |
-
|
1762 |
-
if ( $booking_product_id ) {
|
1763 |
-
$trnsl_booking_product_id = apply_filters( 'translate_object_id', $booking_product_id, 'product', false, $language );
|
1764 |
-
if ( is_null( $trnsl_booking_product_id ) ) {
|
1765 |
-
$trnsl_booking_product_id = '';
|
1766 |
-
}
|
1767 |
-
}
|
1768 |
-
|
1769 |
-
return $trnsl_booking_product_id;
|
1770 |
-
|
1771 |
-
}
|
1772 |
-
|
1773 |
-
public function get_translated_booking_resource_id( $booking_id, $language ) {
|
1774 |
-
|
1775 |
-
$booking_resource_id = get_post_meta( $booking_id, '_booking_resource_id', true );
|
1776 |
-
$trnsl_booking_resource_id = '';
|
1777 |
-
|
1778 |
-
if ( $booking_resource_id ) {
|
1779 |
-
$trnsl_booking_resource_id = apply_filters( 'translate_object_id', $booking_resource_id, 'bookable_resource', false, $language );
|
1780 |
-
|
1781 |
-
if ( is_null( $trnsl_booking_resource_id ) ) {
|
1782 |
-
$trnsl_booking_resource_id = '';
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
|
1786 |
-
return $trnsl_booking_resource_id;
|
1787 |
-
}
|
1788 |
-
|
1789 |
-
public function get_translated_booking_persons_ids( $booking_id, $language ) {
|
1790 |
-
|
1791 |
-
$booking_persons = maybe_unserialize( get_post_meta( $booking_id, '_booking_persons', true ) );
|
1792 |
-
$trnsl_booking_persons = [];
|
1793 |
-
|
1794 |
-
if ( is_array( $booking_persons ) && ! empty( $booking_persons ) ) {
|
1795 |
-
foreach ( $booking_persons as $person_id => $person_count ) {
|
1796 |
-
|
1797 |
-
$trnsl_person_id = apply_filters( 'translate_object_id', $person_id, 'bookable_person', false, $language );
|
1798 |
-
|
1799 |
-
if ( is_null( $trnsl_person_id ) ) {
|
1800 |
-
$trnsl_booking_persons[] = $person_count;
|
1801 |
-
} else {
|
1802 |
-
$trnsl_booking_persons[ $trnsl_person_id ] = $person_count;
|
1803 |
-
}
|
1804 |
-
}
|
1805 |
-
}
|
1806 |
-
|
1807 |
-
return $trnsl_booking_persons;
|
1808 |
-
|
1809 |
-
}
|
1810 |
-
|
1811 |
-
public function update_status_for_translations( $booking_id ) {
|
1812 |
-
|
1813 |
-
foreach ( $this->get_translated_bookings( $booking_id ) as $translated_booking_id ) {
|
1814 |
-
|
1815 |
-
$status = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT post_status FROM {$this->wpdb->posts} WHERE ID = %d", $booking_id ) ); // get_post_status( $booking_id );
|
1816 |
-
$language = get_post_meta( $translated_booking_id, '_language_code', true );
|
1817 |
-
|
1818 |
-
$this->wpdb->update(
|
1819 |
-
$this->wpdb->posts,
|
1820 |
-
[
|
1821 |
-
'post_status' => $status,
|
1822 |
-
'post_parent' => wp_get_post_parent_id( $booking_id ),
|
1823 |
-
],
|
1824 |
-
[
|
1825 |
-
'ID' => $translated_booking_id,
|
1826 |
-
]
|
1827 |
-
);
|
1828 |
-
|
1829 |
-
$this->update_translated_booking_meta( $translated_booking_id, $booking_id, $language );
|
1830 |
-
}
|
1831 |
-
|
1832 |
-
}
|
1833 |
-
|
1834 |
-
public function get_translated_bookings( $booking_id, $actual_translations_only = true ) {
|
1835 |
-
|
1836 |
-
return $this->wpml_post_translations->get_element_translations( $booking_id, false, $actual_translations_only );
|
1837 |
-
}
|
1838 |
-
|
1839 |
-
public function booking_filters_query( $query ) {
|
1840 |
-
global $typenow;
|
1841 |
-
|
1842 |
-
if ( ( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'wc_booking' ) ) {
|
1843 |
-
|
1844 |
-
$current_lang = $this->sitepress->get_current_language();
|
1845 |
-
|
1846 |
-
$product_ids = $this->wpdb->get_col(
|
1847 |
-
$this->wpdb->prepare(
|
1848 |
-
"SELECT element_id
|
1849 |
-
FROM {$this->wpdb->prefix}icl_translations
|
1850 |
-
WHERE language_code = %s AND element_type = 'post_product'",
|
1851 |
-
$current_lang
|
1852 |
-
)
|
1853 |
-
);
|
1854 |
-
|
1855 |
-
$product_ids = array_diff( $product_ids, [ null ] );
|
1856 |
-
|
1857 |
-
if ( ( ! isset( $_GET['lang'] ) || ( isset( $_GET['lang'] ) && $_GET['lang'] != 'all' ) ) ) {
|
1858 |
-
$query->query_vars['meta_query'][] = [
|
1859 |
-
'relation' => 'OR',
|
1860 |
-
[
|
1861 |
-
'key' => '_language_code',
|
1862 |
-
'value' => $current_lang,
|
1863 |
-
'compare ' => '=',
|
1864 |
-
],
|
1865 |
-
[
|
1866 |
-
'key' => '_booking_product_id',
|
1867 |
-
'value' => $product_ids,
|
1868 |
-
'compare ' => 'IN',
|
1869 |
-
],
|
1870 |
-
];
|
1871 |
-
}
|
1872 |
-
}
|
1873 |
-
|
1874 |
-
return $query;
|
1875 |
-
}
|
1876 |
-
|
1877 |
-
public function bookings_in_date_range_query( $booking_ids ) {
|
1878 |
-
foreach ( $booking_ids as $key => $booking_id ) {
|
1879 |
-
|
1880 |
-
$language_code = $this->sitepress->get_language_for_element( get_post_meta( $booking_id, '_booking_product_id', true ), 'post_product' );
|
1881 |
-
$current_language = $this->sitepress->get_current_language();
|
1882 |
-
|
1883 |
-
if ( $language_code != $current_language ) {
|
1884 |
-
unset( $booking_ids[ $key ] );
|
1885 |
-
}
|
1886 |
-
}
|
1887 |
-
|
1888 |
-
return $booking_ids;
|
1889 |
-
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
public function clear_transient_fields() {
|
1893 |
-
|
1894 |
-
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'wc_booking' && isset( $_GET['page'] ) && $_GET['page'] == 'booking_calendar' ) {
|
1895 |
-
|
1896 |
-
// delete transient fields
|
1897 |
-
$this->wpdb->query(
|
1898 |
-
"
|
1899 |
-
DELETE FROM {$this->wpdb->options}
|
1900 |
-
WHERE option_name LIKE '%book_dr_%'
|
1901 |
-
"
|
1902 |
-
);
|
1903 |
-
|
1904 |
-
}
|
1905 |
-
|
1906 |
-
}
|
1907 |
-
|
1908 |
-
public function delete_bookings( $booking_id ) {
|
1909 |
-
|
1910 |
-
if (
|
1911 |
-
! $this->is_delete_all_action()
|
1912 |
-
&& $booking_id
|
1913 |
-
&& get_post_type( $booking_id ) == 'wc_booking'
|
1914 |
-
) {
|
1915 |
-
remove_action( 'before_delete_post', [ $this, 'delete_bookings' ] );
|
1916 |
-
|
1917 |
-
foreach ( $this->get_translated_bookings( $booking_id ) as $translated_booking_id ) {
|
1918 |
-
$this->wpdb->update(
|
1919 |
-
$this->wpdb->posts,
|
1920 |
-
[
|
1921 |
-
'post_parent' => 0,
|
1922 |
-
],
|
1923 |
-
[
|
1924 |
-
'ID' => $translated_booking_id,
|
1925 |
-
]
|
1926 |
-
);
|
1927 |
-
|
1928 |
-
wp_delete_post( $translated_booking_id );
|
1929 |
-
|
1930 |
-
}
|
1931 |
-
|
1932 |
-
add_action( 'before_delete_post', [ $this, 'delete_bookings' ] );
|
1933 |
-
}
|
1934 |
-
}
|
1935 |
-
|
1936 |
-
private function is_delete_all_action() {
|
1937 |
-
return array_key_exists( 'delete_all', $_GET ) && $_GET['delete_all'];
|
1938 |
-
}
|
1939 |
-
|
1940 |
-
public function trash_bookings( $booking_id ) {
|
1941 |
-
|
1942 |
-
if ( $booking_id > 0 && get_post_type( $booking_id ) == 'wc_booking' ) {
|
1943 |
-
|
1944 |
-
foreach ( $this->get_translated_bookings( $booking_id ) as $translated_booking_id ) {
|
1945 |
-
|
1946 |
-
$this->wpdb->update(
|
1947 |
-
$this->wpdb->posts,
|
1948 |
-
[
|
1949 |
-
'post_status' => 'trash',
|
1950 |
-
],
|
1951 |
-
[
|
1952 |
-
'ID' => $translated_booking_id,
|
1953 |
-
]
|
1954 |
-
);
|
1955 |
-
|
1956 |
-
}
|
1957 |
-
}
|
1958 |
-
|
1959 |
-
}
|
1960 |
-
|
1961 |
-
public function append_persons_to_translation_package( $package, $post ) {
|
1962 |
-
if ( 'product' === $post->post_type ) {
|
1963 |
-
if ( $this->is_booking( $post->ID ) ) {
|
1964 |
-
|
1965 |
-
$bookable_product = new WC_Product_Booking( $post->ID );
|
1966 |
-
|
1967 |
-
$person_types = $bookable_product->get_person_types();
|
1968 |
-
|
1969 |
-
foreach ( $person_types as $person_type ) {
|
1970 |
-
|
1971 |
-
$bookable_person = get_post( $person_type->ID );
|
1972 |
-
|
1973 |
-
$package['contents'][ 'wc_bookings:person:' . $bookable_person->ID . ':name' ] = [
|
1974 |
-
'translate' => 1,
|
1975 |
-
'data' => $this->tp->encode_field_data( $bookable_person->post_title, 'base64' ),
|
1976 |
-
'format' => 'base64',
|
1977 |
-
];
|
1978 |
-
|
1979 |
-
$package['contents'][ 'wc_bookings:person:' . $bookable_person->ID . ':description' ] = [
|
1980 |
-
'translate' => 1,
|
1981 |
-
'data' => $this->tp->encode_field_data( $bookable_person->post_excerpt, 'base64' ),
|
1982 |
-
'format' => 'base64',
|
1983 |
-
];
|
1984 |
-
|
1985 |
-
}
|
1986 |
-
}
|
1987 |
-
}
|
1988 |
-
|
1989 |
-
return $package;
|
1990 |
-
}
|
1991 |
-
|
1992 |
-
private function save_person_translation( $post_id, $data, $job ) {
|
1993 |
-
$person_translations = [];
|
1994 |
-
|
1995 |
-
if ( $this->is_booking( $post_id ) ) {
|
1996 |
-
|
1997 |
-
foreach ( $data as $value ) {
|
1998 |
-
|
1999 |
-
if ( $value['finished'] && strpos( $value['field_type'], 'wc_bookings:person:' ) === 0 ) {
|
2000 |
-
|
2001 |
-
$exp = explode( ':', $value['field_type'] );
|
2002 |
-
|
2003 |
-
$person_id = $exp[2];
|
2004 |
-
$field = $exp[3];
|
2005 |
-
|
2006 |
-
$person_translations[ $person_id ][ $field ] = $value['data'];
|
2007 |
-
|
2008 |
-
}
|
2009 |
-
}
|
2010 |
-
|
2011 |
-
if ( $person_translations ) {
|
2012 |
-
|
2013 |
-
foreach ( $person_translations as $person_id => $pt ) {
|
2014 |
-
|
2015 |
-
$person_trid = $this->sitepress->get_element_trid( $person_id, 'post_bookable_person' );
|
2016 |
-
|
2017 |
-
$person_id_translated = apply_filters( 'translate_object_id', $person_id, 'bookable_person', false, $job->language_code );
|
2018 |
-
|
2019 |
-
if ( empty( $person_id_translated ) ) {
|
2020 |
-
|
2021 |
-
$person_post = [
|
2022 |
-
|
2023 |
-
'post_type' => 'bookable_person',
|
2024 |
-
'post_status' => 'publish',
|
2025 |
-
'post_title' => $pt['name'],
|
2026 |
-
'post_parent' => $post_id,
|
2027 |
-
'post_excerpt' => isset( $pt['description'] ) ? $pt['description'] : '',
|
2028 |
-
|
2029 |
-
];
|
2030 |
-
|
2031 |
-
$person_id_translated = wp_insert_post( $person_post );
|
2032 |
-
|
2033 |
-
$this->sitepress->set_element_language_details( $person_id_translated, 'post_bookable_person', $person_trid, $job->language_code );
|
2034 |
-
|
2035 |
-
} else {
|
2036 |
-
|
2037 |
-
$person_post = [
|
2038 |
-
'ID' => $person_id_translated,
|
2039 |
-
'post_title' => $pt['name'],
|
2040 |
-
'post_excerpt' => isset( $pt['description'] ) ? $pt['description'] : '',
|
2041 |
-
];
|
2042 |
-
|
2043 |
-
wp_update_post( $person_post );
|
2044 |
-
|
2045 |
-
}
|
2046 |
-
}
|
2047 |
-
}
|
2048 |
-
}
|
2049 |
-
|
2050 |
-
}
|
2051 |
-
|
2052 |
-
public function append_resources_to_translation_package( $package, $post ) {
|
2053 |
-
|
2054 |
-
if ( $post->post_type == 'product' ) {
|
2055 |
-
$product = wc_get_product( $post->ID );
|
2056 |
-
if ( $this->is_booking( $product ) && $product->has_resources() ) {
|
2057 |
-
|
2058 |
-
$resources = $product->get_resources();
|
2059 |
-
|
2060 |
-
foreach ( $resources as $resource ) {
|
2061 |
-
|
2062 |
-
$package['contents'][ 'wc_bookings:resource:' . $resource->ID . ':name' ] = [
|
2063 |
-
'translate' => 1,
|
2064 |
-
'data' => $this->tp->encode_field_data( $resource->post_title, 'base64' ),
|
2065 |
-
'format' => 'base64',
|
2066 |
-
];
|
2067 |
-
|
2068 |
-
}
|
2069 |
-
}
|
2070 |
-
}
|
2071 |
-
|
2072 |
-
return $package;
|
2073 |
-
|
2074 |
-
}
|
2075 |
-
|
2076 |
-
private function save_resource_translation( $post_id, $data, $job ) {
|
2077 |
-
$resource_translations = [];
|
2078 |
-
|
2079 |
-
if ( $this->is_booking( $post_id ) ) {
|
2080 |
-
|
2081 |
-
foreach ( $data as $value ) {
|
2082 |
-
|
2083 |
-
if ( $value['finished'] && strpos( $value['field_type'], 'wc_bookings:resource:' ) === 0 ) {
|
2084 |
-
|
2085 |
-
$exp = explode( ':', $value['field_type'] );
|
2086 |
-
|
2087 |
-
$resource_id = $exp[2];
|
2088 |
-
$field = $exp[3];
|
2089 |
-
|
2090 |
-
$resource_translations[ $resource_id ][ $field ] = $value['data'];
|
2091 |
-
|
2092 |
-
}
|
2093 |
-
}
|
2094 |
-
|
2095 |
-
if ( $resource_translations ) {
|
2096 |
-
|
2097 |
-
foreach ( $resource_translations as $resource_id => $rt ) {
|
2098 |
-
|
2099 |
-
$resource_trid = $this->sitepress->get_element_trid( $resource_id, 'post_bookable_resource' );
|
2100 |
-
|
2101 |
-
$resource_id_translated = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', false, $job->language_code );
|
2102 |
-
|
2103 |
-
if ( empty( $resource_id_translated ) ) {
|
2104 |
-
|
2105 |
-
$resource_post = [
|
2106 |
-
|
2107 |
-
'post_type' => 'bookable_resource',
|
2108 |
-
'post_status' => 'publish',
|
2109 |
-
'post_title' => $rt['name'],
|
2110 |
-
'post_parent' => $post_id,
|
2111 |
-
];
|
2112 |
-
|
2113 |
-
$resource_id_translated = wp_insert_post( $resource_post );
|
2114 |
-
|
2115 |
-
$this->sitepress->set_element_language_details( $resource_id_translated, 'post_bookable_resource', $resource_trid, $job->language_code );
|
2116 |
-
|
2117 |
-
$sort_order = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT sort_order FROM {$this->wpdb->prefix}wc_booking_relationships WHERE resource_id=%d", $resource_id ) );
|
2118 |
-
$relationship = [
|
2119 |
-
'product_id' => $post_id,
|
2120 |
-
'resource_id' => $resource_id_translated,
|
2121 |
-
'sort_order' => $sort_order,
|
2122 |
-
];
|
2123 |
-
$this->wpdb->insert( $this->wpdb->prefix . 'wc_booking_relationships', $relationship );
|
2124 |
-
|
2125 |
-
} else {
|
2126 |
-
|
2127 |
-
$resource_post = [
|
2128 |
-
'ID' => $resource_id_translated,
|
2129 |
-
'post_title' => $rt['name'],
|
2130 |
-
];
|
2131 |
-
|
2132 |
-
wp_update_post( $resource_post );
|
2133 |
-
|
2134 |
-
$sort_order = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT sort_order FROM {$this->wpdb->prefix}wc_booking_relationships WHERE resource_id=%d", $resource_id ) );
|
2135 |
-
$this->wpdb->update(
|
2136 |
-
$this->wpdb->prefix . 'wc_booking_relationships',
|
2137 |
-
[ 'sort_order' => $sort_order ],
|
2138 |
-
[
|
2139 |
-
'product_id' => $post_id,
|
2140 |
-
'resource_id' => $resource_id_translated,
|
2141 |
-
]
|
2142 |
-
);
|
2143 |
-
|
2144 |
-
}
|
2145 |
-
}
|
2146 |
-
}
|
2147 |
-
}
|
2148 |
-
|
2149 |
-
}
|
2150 |
-
|
2151 |
-
public function wcml_js_lock_fields_ids( $ids ) {
|
2152 |
-
$ids = array_merge(
|
2153 |
-
$ids,
|
2154 |
-
[
|
2155 |
-
'_wc_booking_has_resources',
|
2156 |
-
'_wc_booking_has_persons',
|
2157 |
-
'_wc_booking_duration_type',
|
2158 |
-
'_wc_booking_duration',
|
2159 |
-
'_wc_booking_duration_unit',
|
2160 |
-
'_wc_booking_calendar_display_mode',
|
2161 |
-
'_wc_booking_requires_confirmation',
|
2162 |
-
'_wc_booking_user_can_cancel',
|
2163 |
-
'_wc_accommodation_booking_min_duration',
|
2164 |
-
'_wc_accommodation_booking_max_duration',
|
2165 |
-
'_wc_accommodation_booking_max_duration',
|
2166 |
-
'_wc_accommodation_booking_calendar_display_mode',
|
2167 |
-
'_wc_accommodation_booking_requires_confirmation',
|
2168 |
-
'_wc_accommodation_booking_user_can_cancel',
|
2169 |
-
'_wc_accommodation_booking_cancel_limit',
|
2170 |
-
'_wc_accommodation_booking_cancel_limit_unit',
|
2171 |
-
'_wc_accommodation_booking_qty',
|
2172 |
-
'_wc_accommodation_booking_min_date',
|
2173 |
-
'_wc_accommodation_booking_min_date_unit',
|
2174 |
-
'_wc_accommodation_booking_max_date',
|
2175 |
-
'_wc_accommodation_booking_max_date_unit',
|
2176 |
-
'bookings_pricing select',
|
2177 |
-
'bookings_resources select',
|
2178 |
-
'bookings_availability select',
|
2179 |
-
'bookings_persons input[type="checkbox"]',
|
2180 |
-
]
|
2181 |
-
);
|
2182 |
-
|
2183 |
-
return $ids;
|
2184 |
-
}
|
2185 |
-
|
2186 |
-
/**
|
2187 |
-
* @param array $args
|
2188 |
-
*
|
2189 |
-
* @return array
|
2190 |
-
*/
|
2191 |
-
public function filter_get_booking_resources_args( $args ) {
|
2192 |
-
|
2193 |
-
$screen = get_current_screen();
|
2194 |
-
if ( $screen->id == 'product' ) {
|
2195 |
-
$args['suppress_filters'] = false;
|
2196 |
-
}
|
2197 |
-
|
2198 |
-
return $args;
|
2199 |
-
|
2200 |
-
}
|
2201 |
-
|
2202 |
-
/**
|
2203 |
-
* @param array $currencies
|
2204 |
-
* @param int $post_id
|
2205 |
-
*
|
2206 |
-
* @return bool
|
2207 |
-
*/
|
2208 |
-
private function update_booking_costs( $currencies = [], $post_id = 0 ) {
|
2209 |
-
$booking_options = [
|
2210 |
-
'wcml_wc_booking_cost' => '_wc_booking_cost_',
|
2211 |
-
'wcml_wc_booking_block_cost' => '_wc_booking_block_cost_',
|
2212 |
-
'wcml_wc_display_cost' => '_wc_display_cost_',
|
2213 |
-
];
|
2214 |
-
|
2215 |
-
if ( $this->sitepress->get_wp_api()->version_compare( $this->sitepress->get_wp_api()->constant( 'WC_BOOKINGS_VERSION' ), '1.10.9', '<' ) ) {
|
2216 |
-
unset( $booking_options['wcml_wc_booking_block_cost'] );
|
2217 |
-
$booking_options['wcml_wc_booking_base_cost'] = '_wc_booking_base_cost_';
|
2218 |
-
}
|
2219 |
-
|
2220 |
-
foreach ( $currencies as $code => $currency ) {
|
2221 |
-
foreach ( $booking_options as $booking_options_post_key => $booking_options_meta_key_prefix ) {
|
2222 |
-
if ( isset( $_POST[ $booking_options_post_key ][ $code ] ) ) {
|
2223 |
-
update_post_meta( $post_id, $booking_options_meta_key_prefix . $code, sanitize_text_field( $_POST[ $booking_options_post_key ][ $code ] ) );
|
2224 |
-
}
|
2225 |
-
}
|
2226 |
-
}
|
2227 |
-
|
2228 |
-
return true;
|
2229 |
-
}
|
2230 |
-
|
2231 |
-
/**
|
2232 |
-
* @param array $currencies
|
2233 |
-
* @param int $post_id
|
2234 |
-
*
|
2235 |
-
* @return bool
|
2236 |
-
*/
|
2237 |
-
private function update_booking_pricing( $currencies = [], $post_id = 0 ) {
|
2238 |
-
$updated_meta = [];
|
2239 |
-
$booking_pricing = get_post_meta( $post_id, '_wc_booking_pricing', true );
|
2240 |
-
if ( empty( $booking_pricing ) ) {
|
2241 |
-
return false;
|
2242 |
-
}
|
2243 |
-
|
2244 |
-
foreach ( $booking_pricing as $key => $prices ) {
|
2245 |
-
$updated_meta[ $key ] = $prices;
|
2246 |
-
foreach ( $currencies as $code => $currency ) {
|
2247 |
-
if ( isset( $_POST['wcml_wc_booking_pricing_base_cost'][ $code ][ $key ] ) ) {
|
2248 |
-
$updated_meta[ $key ][ 'base_cost_' . $code ] = sanitize_text_field( $_POST['wcml_wc_booking_pricing_base_cost'][ $code ][ $key ] );
|
2249 |
-
}
|
2250 |
-
if ( isset( $_POST['wcml_wc_booking_pricing_cost'][ $code ][ $key ] ) ) {
|
2251 |
-
$updated_meta[ $key ][ 'cost_' . $code ] = sanitize_text_field( $_POST['wcml_wc_booking_pricing_cost'][ $code ][ $key ] );
|
2252 |
-
}
|
2253 |
-
}
|
2254 |
-
}
|
2255 |
-
|
2256 |
-
update_post_meta( $post_id, '_wc_booking_pricing', $updated_meta );
|
2257 |
-
|
2258 |
-
return true;
|
2259 |
-
}
|
2260 |
-
|
2261 |
-
/**
|
2262 |
-
* @param array $currencies
|
2263 |
-
* @param array $person_costs
|
2264 |
-
*
|
2265 |
-
* @return bool
|
2266 |
-
*/
|
2267 |
-
private function update_booking_person_cost( $currencies = [], $person_costs = [] ) {
|
2268 |
-
if ( empty( $person_costs ) ) {
|
2269 |
-
return false;
|
2270 |
-
}
|
2271 |
-
|
2272 |
-
foreach ( $person_costs as $person_id => $costs ) {
|
2273 |
-
foreach ( $currencies as $code => $currency ) {
|
2274 |
-
if ( isset( $costs[ $code ] ) ) {
|
2275 |
-
update_post_meta( $person_id, 'cost_' . $code, sanitize_text_field( $costs[ $code ] ) );
|
2276 |
-
}
|
2277 |
-
}
|
2278 |
-
}
|
2279 |
-
|
2280 |
-
return true;
|
2281 |
-
}
|
2282 |
-
|
2283 |
-
/**
|
2284 |
-
* @param array $currencies
|
2285 |
-
* @param array $block_costs
|
2286 |
-
*
|
2287 |
-
* @return bool
|
2288 |
-
*/
|
2289 |
-
private function update_booking_person_block_cost( $currencies = [], $block_costs = [] ) {
|
2290 |
-
if ( empty( $block_costs ) ) {
|
2291 |
-
return false;
|
2292 |
-
}
|
2293 |
-
|
2294 |
-
foreach ( $block_costs as $person_id => $costs ) {
|
2295 |
-
foreach ( $currencies as $code => $currency ) {
|
2296 |
-
if ( isset( $costs[ $code ] ) ) {
|
2297 |
-
update_post_meta( $person_id, 'block_cost_' . $code, sanitize_text_field( $costs[ $code ] ) );
|
2298 |
-
}
|
2299 |
-
}
|
2300 |
-
}
|
2301 |
-
|
2302 |
-
return true;
|
2303 |
-
}
|
2304 |
-
|
2305 |
-
/**
|
2306 |
-
* @param array $currencies
|
2307 |
-
* @param int $post_id
|
2308 |
-
* @param array $resource_cost
|
2309 |
-
*
|
2310 |
-
* @return bool
|
2311 |
-
*/
|
2312 |
-
private function update_booking_resource_cost( $currencies = [], $post_id = 0, $resource_cost = [] ) {
|
2313 |
-
if ( empty( $resource_cost ) ) {
|
2314 |
-
return false;
|
2315 |
-
}
|
2316 |
-
|
2317 |
-
$updated_meta = get_post_meta( $post_id, '_resource_base_costs', true );
|
2318 |
-
if ( ! is_array( $updated_meta ) ) {
|
2319 |
-
$updated_meta = [];
|
2320 |
-
}
|
2321 |
-
|
2322 |
-
$wc_booking_resource_costs = [];
|
2323 |
-
|
2324 |
-
foreach ( $resource_cost as $resource_id => $costs ) {
|
2325 |
-
|
2326 |
-
foreach ( $currencies as $code => $currency ) {
|
2327 |
-
|
2328 |
-
if ( isset( $costs[ $code ] ) ) {
|
2329 |
-
$wc_booking_resource_costs[ $code ][ $resource_id ] = sanitize_text_field( $costs[ $code ] );
|
2330 |
-
}
|
2331 |
-
}
|
2332 |
-
}
|
2333 |
-
|
2334 |
-
$updated_meta['custom_costs'] = $wc_booking_resource_costs;
|
2335 |
-
|
2336 |
-
update_post_meta( $post_id, '_resource_base_costs', $updated_meta );
|
2337 |
-
|
2338 |
-
$this->sync_resource_costs_with_translations( $post_id, '_resource_base_costs' );
|
2339 |
-
|
2340 |
-
return true;
|
2341 |
-
}
|
2342 |
-
|
2343 |
-
/**
|
2344 |
-
* @param array $currencies
|
2345 |
-
* @param int $post_id
|
2346 |
-
*
|
2347 |
-
* @return bool
|
2348 |
-
*/
|
2349 |
-
private function update_booking_resource_block_cost( $currencies = [], $post_id = 0, $resource_block_cost = [] ) {
|
2350 |
-
if ( empty( $resource_block_cost ) ) {
|
2351 |
-
return false;
|
2352 |
-
}
|
2353 |
-
|
2354 |
-
$updated_meta = get_post_meta( $post_id, '_resource_block_costs', true );
|
2355 |
-
|
2356 |
-
$wc_booking_resource_block_costs = [];
|
2357 |
-
|
2358 |
-
foreach ( $resource_block_cost as $resource_id => $costs ) {
|
2359 |
-
|
2360 |
-
foreach ( $currencies as $code => $currency ) {
|
2361 |
-
|
2362 |
-
if ( isset( $costs[ $code ] ) ) {
|
2363 |
-
$wc_booking_resource_block_costs[ $code ][ $resource_id ] = sanitize_text_field( $costs[ $code ] );
|
2364 |
-
}
|
2365 |
-
}
|
2366 |
-
}
|
2367 |
-
|
2368 |
-
$updated_meta['custom_costs'] = $wc_booking_resource_block_costs;
|
2369 |
-
|
2370 |
-
update_post_meta( $post_id, '_resource_block_costs', $updated_meta );
|
2371 |
-
|
2372 |
-
$this->sync_resource_costs_with_translations( $post_id, '_resource_block_costs' );
|
2373 |
-
|
2374 |
-
return true;
|
2375 |
-
}
|
2376 |
-
|
2377 |
-
public function extra_conditions_to_filter_bookings( $extra_conditions ) {
|
2378 |
-
|
2379 |
-
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'wc_booking' && ! isset( $_GET['post_status'] ) ) {
|
2380 |
-
$extra_conditions = str_replace( 'GROUP BY', " AND post_status = 'confirmed' GROUP BY", $extra_conditions );
|
2381 |
-
}
|
2382 |
-
|
2383 |
-
return $extra_conditions;
|
2384 |
-
}
|
2385 |
-
|
2386 |
-
public function hide_bookings_type_on_tm_dashboard( $types ) {
|
2387 |
-
unset( $types['wc_booking'] );
|
2388 |
-
return $types;
|
2389 |
-
}
|
2390 |
-
|
2391 |
-
public function show_pointer_info() {
|
2392 |
-
|
2393 |
-
$pointer_ui = new WCML_Pointer_UI(
|
2394 |
-
sprintf( __( 'You can translate the titles of your custom Resources on the %1$sWooCommerce product translation page%2$s', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=wpml-wcml' ) . '">', '</a>' ),
|
2395 |
-
WCML_Tracking_Link::getWcmlBookingsDoc(),
|
2396 |
-
'bookings_resources .woocommerce_bookable_resources #message'
|
2397 |
-
);
|
2398 |
-
|
2399 |
-
$pointer_ui->show();
|
2400 |
-
|
2401 |
-
$pointer_ui = new WCML_Pointer_UI(
|
2402 |
-
sprintf( __( 'You can translate the Person Type Name and Description on the %1$sWooCommerce product translation page%2$s', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=wpml-wcml' ) . '">', '</a>' ),
|
2403 |
-
WCML_Tracking_Link::getWcmlBookingsDoc(),
|
2404 |
-
'bookings_persons #persons-types>div.toolbar'
|
2405 |
-
);
|
2406 |
-
|
2407 |
-
$pointer_ui->show();
|
2408 |
-
|
2409 |
-
}
|
2410 |
-
|
2411 |
-
public function add_to_cart_sold_individually( $sold_indiv, $cart_item_data, $product_id, $quantity ) {
|
2412 |
-
|
2413 |
-
if ( isset( $cart_item_data['booking'] ) ) {
|
2414 |
-
$sold_indiv = false;
|
2415 |
-
foreach ( WC()->cart->cart_contents as $cart_item ) {
|
2416 |
-
if (
|
2417 |
-
isset( $cart_item['booking'] ) && isset( $cart_item['booking']['_booking_id'] ) &&
|
2418 |
-
$cart_item['booking']['_start_date'] == $cart_item_data['booking']['_start_date'] &&
|
2419 |
-
$cart_item['booking']['_end_date'] == $cart_item_data['booking']['_end_date'] &&
|
2420 |
-
$cart_item['booking']['_booking_id'] == $cart_item_data['booking']['_booking_id']
|
2421 |
-
) {
|
2422 |
-
$sold_indiv = true;
|
2423 |
-
}
|
2424 |
-
}
|
2425 |
-
}
|
2426 |
-
|
2427 |
-
return $sold_indiv;
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
// unset "bookings" from translatable documents to hide WPML languages section from booking edit page
|
2431 |
-
public function filter_translatable_documents( $icl_post_types ) {
|
2432 |
-
|
2433 |
-
if (
|
2434 |
-
( isset( $_GET['post_type'] ) && 'wc_booking' === $_GET['post_type'] ) ||
|
2435 |
-
( isset( $_GET['post'] ) && 'wc_booking' === get_post_type( $_GET['post'] ) )
|
2436 |
-
) {
|
2437 |
-
unset( $icl_post_types['wc_booking'] );
|
2438 |
-
}
|
2439 |
-
|
2440 |
-
return $icl_post_types;
|
2441 |
-
}
|
2442 |
-
|
2443 |
-
// hide WPML languages links section from bookings list page
|
2444 |
-
public function filter_is_translated_post_type( $type ) {
|
2445 |
-
|
2446 |
-
$getData = wpml_collect( $_GET );
|
2447 |
-
|
2448 |
-
if( 'wc_booking' === $getData->get('post_type') && 'create_booking' !== $getData->get( 'page' ) ){
|
2449 |
-
return false;
|
2450 |
-
}
|
2451 |
-
|
2452 |
-
return $type;
|
2453 |
-
}
|
2454 |
-
|
2455 |
-
/**
|
2456 |
-
* @param int $post_id
|
2457 |
-
* @param WP_Post $post
|
2458 |
-
* @param bool $update
|
2459 |
-
*/
|
2460 |
-
public function sync_booking_status( $post_id, $post, $update ) {
|
2461 |
-
|
2462 |
-
if ( $post->post_type === 'wc_booking' && $update ) {
|
2463 |
-
|
2464 |
-
foreach ( $this->get_translated_bookings( $post_id ) as $translated_booking_id ) {
|
2465 |
-
$this->wpdb->update(
|
2466 |
-
$this->wpdb->posts,
|
2467 |
-
[ 'post_status' => $post->post_status ],
|
2468 |
-
[ 'ID' => $translated_booking_id ]
|
2469 |
-
);
|
2470 |
-
}
|
2471 |
-
}
|
2472 |
-
|
2473 |
-
}
|
2474 |
-
|
2475 |
-
public function filter_my_account_bookings_tables_by_current_language( $tables ) {
|
2476 |
-
|
2477 |
-
$current_language = $this->sitepress->get_current_language();
|
2478 |
-
|
2479 |
-
foreach ( $tables as $table_key => $table ) {
|
2480 |
-
|
2481 |
-
if ( isset( $table['bookings'] ) ) {
|
2482 |
-
|
2483 |
-
foreach ( $table['bookings'] as $key => $booking ) {
|
2484 |
-
$language_code = get_post_meta( $booking->get_id(), '_language_code', true );
|
2485 |
-
|
2486 |
-
if ( ! $language_code ) {
|
2487 |
-
$language_code = $this->sitepress->get_language_for_element( $booking->get_product_id(), 'post_product' );
|
2488 |
-
}
|
2489 |
-
|
2490 |
-
if ( $language_code !== $current_language ) {
|
2491 |
-
unset( $tables[ $table_key ]['bookings'][ $key ] );
|
2492 |
-
}
|
2493 |
-
}
|
2494 |
-
}
|
2495 |
-
|
2496 |
-
$tables[ $table_key ]['bookings'] = array_values( $tables[ $table_key ]['bookings'] );
|
2497 |
-
}
|
2498 |
-
|
2499 |
-
return $tables;
|
2500 |
-
}
|
2501 |
-
|
2502 |
-
public function emails_options_to_translate( $emails_options ) {
|
2503 |
-
$emails_options[] = 'woocommerce_new_booking_settings';
|
2504 |
-
$emails_options[] = 'woocommerce_booking_reminder_settings';
|
2505 |
-
$emails_options[] = 'woocommerce_booking_confirmed_settings';
|
2506 |
-
$emails_options[] = 'woocommerce_booking_cancelled_settings';
|
2507 |
-
$emails_options[] = 'woocommerce_admin_booking_cancelled_settings';
|
2508 |
-
|
2509 |
-
return $emails_options;
|
2510 |
-
}
|
2511 |
-
|
2512 |
-
public function emails_text_keys_to_translate( $text_keys ) {
|
2513 |
-
$text_keys[] = 'subject_confirmation';
|
2514 |
-
$text_keys[] = 'heading_confirmation';
|
2515 |
-
|
2516 |
-
return $text_keys;
|
2517 |
-
}
|
2518 |
-
|
2519 |
-
/**
|
2520 |
-
* @param string $value
|
2521 |
-
* @param WC_Email $object
|
2522 |
-
* @param string $old_value
|
2523 |
-
* @param string $key
|
2524 |
-
*
|
2525 |
-
* @return string
|
2526 |
-
*/
|
2527 |
-
public function translate_emails_text_strings( $value, $object, $old_value, $key ) {
|
2528 |
-
$translated_value = false;
|
2529 |
-
|
2530 |
-
$emails_ids = wpml_collect( [
|
2531 |
-
// true if it's an admin email.
|
2532 |
-
'admin_booking_cancelled' => true,
|
2533 |
-
'new_booking' => true,
|
2534 |
-
'booking_cancelled' => false,
|
2535 |
-
'booking_confirmed' => false,
|
2536 |
-
'booking_reminder' => false,
|
2537 |
-
] );
|
2538 |
-
|
2539 |
-
$keys = [
|
2540 |
-
'subject',
|
2541 |
-
'subject_confirmation',
|
2542 |
-
'heading',
|
2543 |
-
'heading_confirmation',
|
2544 |
-
];
|
2545 |
-
|
2546 |
-
if ( in_array( $key, $keys ) && $emails_ids->has( $object->id ) ) {
|
2547 |
-
$is_admin_email = $emails_ids->get( $object->id, false );
|
2548 |
-
$translated_value = $this->woocommerce_wpml->emails->get_email_translated_string( $key, $object, $is_admin_email, $value, self::DOMAIN );
|
2549 |
-
}
|
2550 |
-
|
2551 |
-
return $translated_value ?: $value;
|
2552 |
-
}
|
2553 |
-
|
2554 |
-
public function translate_booking_confirmed_email_texts( $booking_id ) {
|
2555 |
-
$this->translate_email_strings( 'WC_Email_Booking_Confirmed', 'woocommerce_booking_confirmed_settings', self::getLanguage( $booking_id ) );
|
2556 |
-
}
|
2557 |
-
|
2558 |
-
public function translate_booking_cancelled_email_texts( $booking_id ) {
|
2559 |
-
$this->translate_email_strings( 'WC_Email_Booking_Cancelled', 'woocommerce_booking_cancelled_settings', self::getLanguage( $booking_id ) );
|
2560 |
-
}
|
2561 |
-
|
2562 |
-
public function translate_booking_reminder_email_texts( $booking_id ) {
|
2563 |
-
$this->translate_email_strings( 'WC_Email_Booking_Reminder', 'woocommerce_booking_reminder_settings', self::getLanguage( $booking_id ) );
|
2564 |
-
}
|
2565 |
-
|
2566 |
-
public function translate_new_booking_email_texts( $booking_id ) {
|
2567 |
-
$user_lang = $this->get_admin_user_email_language( 'WC_Email_New_Booking' ) ?: self::getLanguage( $booking_id );
|
2568 |
-
$this->translate_email_strings( 'WC_Email_New_Booking', 'woocommerce_new_booking_settings', $user_lang, [ 'heading_confirmation', 'subject_confirmation' ] );
|
2569 |
-
}
|
2570 |
-
|
2571 |
-
public function translate_booking_cancelled_admin_email_texts( $booking_id ) {
|
2572 |
-
$user_lang = $this->get_admin_user_email_language( 'WC_Email_Admin_Booking_Cancelled' ) ?: self::getLanguage( $booking_id );
|
2573 |
-
$this->translate_email_strings( 'WC_Email_Admin_Booking_Cancelled', 'woocommerce_admin_booking_cancelled_settings', $user_lang );
|
2574 |
-
}
|
2575 |
-
|
2576 |
-
/**
|
2577 |
-
* @param string $email_class
|
2578 |
-
*
|
2579 |
-
* @return bool
|
2580 |
-
*/
|
2581 |
-
private function email_class_exists( $email_class ) {
|
2582 |
-
return class_exists( $email_class ) && isset( $this->woocommerce->mailer()->emails[ $email_class ] );
|
2583 |
-
}
|
2584 |
-
|
2585 |
-
/**
|
2586 |
-
* @param string $email_class
|
2587 |
-
*
|
2588 |
-
* @return bool|mixed|null|string
|
2589 |
-
*/
|
2590 |
-
private function get_admin_user_email_language( $email_class ) {
|
2591 |
-
|
2592 |
-
$user = get_user_by( 'email', $this->getEmailObject( $email_class )->recipient );
|
2593 |
-
if ( $user ) {
|
2594 |
-
return $this->sitepress->get_user_admin_language( $user->ID, true );
|
2595 |
-
}
|
2596 |
-
|
2597 |
-
return null;
|
2598 |
-
}
|
2599 |
-
|
2600 |
-
/**
|
2601 |
-
* @param string $current_language
|
2602 |
-
*
|
2603 |
-
* @return string
|
2604 |
-
*/
|
2605 |
-
public function booking_email_language( $current_language ) {
|
2606 |
-
|
2607 |
-
if ( isset( $_POST['post_type'] ) && 'wc_booking' === $_POST['post_type'] && isset( $_POST['_booking_order_id'] ) ) {
|
2608 |
-
$order_language = get_post_meta( $_POST['_booking_order_id'], 'wpml_language', true );
|
2609 |
-
if ( $order_language ) {
|
2610 |
-
$current_language = $order_language;
|
2611 |
-
}
|
2612 |
-
}
|
2613 |
-
|
2614 |
-
return $current_language;
|
2615 |
-
}
|
2616 |
-
|
2617 |
-
/**
|
2618 |
-
* @param string $email_class
|
2619 |
-
* @param string $setting_slug
|
2620 |
-
* @param string|null $user_lang
|
2621 |
-
* @param array $extra_fields
|
2622 |
-
*/
|
2623 |
-
private function translate_email_strings( $email_class, $setting_slug, $user_lang, $extra_fields = [] ) {
|
2624 |
-
if ( $this->email_class_exists( $email_class ) && $user_lang ) {
|
2625 |
-
$getTranslation = function( $key ) use ( $email_class, $user_lang, $setting_slug ) {
|
2626 |
-
return $this->woocommerce_wpml->emails->getStringTranslation(
|
2627 |
-
'admin_texts_' . $setting_slug,
|
2628 |
-
'[' . $setting_slug . ']' . $key,
|
2629 |
-
$user_lang,
|
2630 |
-
$this->getEmailObject( $email_class )->{$key},
|
2631 |
-
self::DOMAIN
|
2632 |
-
);
|
2633 |
-
};
|
2634 |
-
|
2635 |
-
foreach ( array_merge( [ 'heading', 'subject' ], $extra_fields ) as $field ) {
|
2636 |
-
$this->getEmailObject( $email_class )->{$field} = $getTranslation( $field );
|
2637 |
-
}
|
2638 |
-
}
|
2639 |
-
}
|
2640 |
-
|
2641 |
-
/**
|
2642 |
-
* @param int $bookingId
|
2643 |
-
*
|
2644 |
-
* @return string|null
|
2645 |
-
*/
|
2646 |
-
private static function getLanguage( $bookingId ) {
|
2647 |
-
// @see https://onthegosystems.myjetbrains.com/youtrack/issue/wcml-2827
|
2648 |
-
$getOrder = pipe( 'get_wc_booking', invoke( 'get_order' ) );
|
2649 |
-
|
2650 |
-
return Maybe::of( $bookingId )
|
2651 |
-
->map( $getOrder )
|
2652 |
-
->map( invoke( 'get_id' ) )
|
2653 |
-
->map( WCML_Orders::getLanguage() )
|
2654 |
-
->getOrElse( null );
|
2655 |
-
}
|
2656 |
-
|
2657 |
-
public function maybe_set_booking_language( $booking_id ) {
|
2658 |
-
|
2659 |
-
if ( 'wc_booking' === get_post_type( $booking_id ) ) {
|
2660 |
-
$language_details = $this->sitepress->get_element_language_details( $booking_id, 'post_wc_booking' );
|
2661 |
-
if ( ! $language_details ) {
|
2662 |
-
$current_language = $this->sitepress->get_current_language();
|
2663 |
-
$this->sitepress->set_element_language_details( $booking_id, 'post_wc_booking', false, $current_language );
|
2664 |
-
}
|
2665 |
-
}
|
2666 |
-
|
2667 |
-
}
|
2668 |
-
|
2669 |
-
/**
|
2670 |
-
* @param WC_Product|int|string $product
|
2671 |
-
*
|
2672 |
-
* @return bool
|
2673 |
-
*/
|
2674 |
-
private function is_booking( $product ) {
|
2675 |
-
if ( ! $product instanceof WC_Product ) {
|
2676 |
-
$product = wc_get_product( $product );
|
2677 |
-
}
|
2678 |
-
|
2679 |
-
return $product ? $product->get_type() === 'booking' : false;
|
2680 |
-
}
|
2681 |
-
|
2682 |
-
/**
|
2683 |
-
* @param string $counts
|
2684 |
-
* @param string $type
|
2685 |
-
*
|
2686 |
-
* @return object
|
2687 |
-
*/
|
2688 |
-
public function count_bookings_by_current_language( $counts, $type ) {
|
2689 |
-
|
2690 |
-
$query = "SELECT p.post_status, COUNT( * ) AS num_posts FROM {$this->wpdb->posts} as p
|
2691 |
-
LEFT JOIN {$this->wpdb->prefix}icl_translations as icl ON p.ID = icl.element_id
|
2692 |
-
WHERE p.post_type = %s AND icl.language_code = %s AND icl.element_type = %s GROUP BY p.post_status";
|
2693 |
-
|
2694 |
-
$results = $this->wpdb->get_results( $this->wpdb->prepare( $query, $type, $this->sitepress->get_current_language(), 'post_wc_booking' ), ARRAY_A );
|
2695 |
-
$counts = array_fill_keys( get_post_stati(), 0 );
|
2696 |
-
|
2697 |
-
foreach ( $results as $row ) {
|
2698 |
-
$counts[ $row['post_status'] ] = $row['num_posts'];
|
2699 |
-
}
|
2700 |
-
|
2701 |
-
$counts = (object) $counts;
|
2702 |
-
|
2703 |
-
return $counts;
|
2704 |
-
}
|
2705 |
-
|
2706 |
-
/**
|
2707 |
-
* @param array $views
|
2708 |
-
*
|
2709 |
-
* @return array
|
2710 |
-
*/
|
2711 |
-
public function unset_mine_from_bookings_views( $views ) {
|
2712 |
-
unset( $views['mine'] );
|
2713 |
-
|
2714 |
-
return $views;
|
2715 |
-
}
|
2716 |
-
|
2717 |
-
public function remove_language_switcher() {
|
2718 |
-
remove_action( 'wp_before_admin_bar_render', [ $this->sitepress, 'admin_language_switcher' ] );
|
2719 |
-
}
|
2720 |
-
|
2721 |
-
/**
|
2722 |
-
* @return bool
|
2723 |
-
*/
|
2724 |
-
private function is_bookings_listing_page() {
|
2725 |
-
return isset( $_GET['post_type'] ) && 'wc_booking' === $_GET['post_type'];
|
2726 |
-
}
|
2727 |
-
|
2728 |
-
public function save_booking_data_to_translation( $post_id, $data, $job ){
|
2729 |
-
$this->save_person_translation( $post_id, $data, $job );
|
2730 |
-
$this->save_resource_translation( $post_id, $data, $job );
|
2731 |
-
}
|
2732 |
-
|
2733 |
-
/**
|
2734 |
-
* @param stdClass|false $event
|
2735 |
-
*
|
2736 |
-
* @return stdClass|false
|
2737 |
-
*/
|
2738 |
-
public function prevent_events_on_duplicates( $event ) {
|
2739 |
-
if (
|
2740 |
-
isset( $event->hook, $event->args[0] )
|
2741 |
-
&& in_array( $event->hook, [ 'wc-booking-reminder', 'wc-booking-complete' ], true )
|
2742 |
-
&& get_post_meta( $event->args[0], '_booking_duplicate_of', true )
|
2743 |
-
) {
|
2744 |
-
return false;
|
2745 |
-
}
|
2746 |
-
|
2747 |
-
return $event;
|
2748 |
-
}
|
2749 |
-
|
2750 |
-
/**
|
2751 |
-
* @param string $class
|
2752 |
-
*
|
2753 |
-
* @return WC_Email
|
2754 |
-
*/
|
2755 |
-
private function getEmailObject( $class ) {
|
2756 |
-
return $this->woocommerce->mailer()->emails[ $class ];
|
2757 |
-
}
|
2758 |
-
|
2759 |
-
/**
|
2760 |
-
* Sync updated booking meta.
|
2761 |
-
*
|
2762 |
-
* @param int $booking_id
|
2763 |
-
*/
|
2764 |
-
private function maybe_sync_updated_booking_meta( $booking_id ) {
|
2765 |
-
if ( 'wc_booking' === get_post_type( $booking_id ) ) {
|
2766 |
-
|
2767 |
-
$booking_translations = $this->get_translated_bookings( $booking_id, false );
|
2768 |
-
|
2769 |
-
$base_meta_args = [
|
2770 |
-
'_booking_cost' => get_post_meta( $booking_id, '_booking_cost', true ),
|
2771 |
-
'_booking_start' => get_post_meta( $booking_id, '_booking_start', true ),
|
2772 |
-
'_booking_end' => get_post_meta( $booking_id, '_booking_end', true ),
|
2773 |
-
'_booking_all_day' => intval( get_post_meta( $booking_id, '_booking_all_day', true ) ),
|
2774 |
-
'_booking_parent_id' => get_post_meta( $booking_id, '_booking_parent_id', true ),
|
2775 |
-
'_booking_customer_id' => get_post_meta( $booking_id, '_booking_customer_id', true ),
|
2776 |
-
];
|
2777 |
-
|
2778 |
-
foreach ( $booking_translations as $language_code => $translated_booking_id ) {
|
2779 |
-
if ( $translated_booking_id == $booking_id ) {
|
2780 |
-
continue;
|
2781 |
-
}
|
2782 |
-
$meta_args = array_merge(
|
2783 |
-
$base_meta_args,
|
2784 |
-
[
|
2785 |
-
'_booking_product_id' => $this->get_translated_booking_product_id( $booking_id, $language_code ),
|
2786 |
-
'_booking_resource_id' => $this->get_translated_booking_resource_id( $booking_id, $language_code ),
|
2787 |
-
'_booking_persons' => $this->get_translated_booking_persons_ids( $booking_id, $language_code ),
|
2788 |
-
]
|
2789 |
-
);
|
2790 |
-
|
2791 |
-
foreach ( $meta_args as $key => $value ) {
|
2792 |
-
update_post_meta( $translated_booking_id, $key, $value );
|
2793 |
-
}
|
2794 |
-
}
|
2795 |
-
}
|
2796 |
-
}
|
2797 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-bulk-stock-management.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Compatibility class for plugin WooCommerce Bulk Stock Management
|
4 |
-
* http://www.woothemes.com/products/bulk-stock-management/
|
5 |
-
*
|
6 |
-
* @author konrad
|
7 |
-
*/
|
8 |
-
class WCML_Bulk_Stock_Management {
|
9 |
-
public function __construct() {
|
10 |
-
if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'woocommerce-bulk-stock-management' ) {
|
11 |
-
global $sitepress;
|
12 |
-
remove_action( 'admin_enqueue_scripts', [ $sitepress, 'language_filter' ] );
|
13 |
-
}
|
14 |
-
|
15 |
-
add_action( 'wc_bulk_stock_after_process_qty', [ $this, 'wc_bulk_stock_after_process_qty_action' ], 10, 1 );
|
16 |
-
}
|
17 |
-
|
18 |
-
public function wc_bulk_stock_after_process_qty_action( $id ) {
|
19 |
-
global $sitepress;
|
20 |
-
|
21 |
-
$new_quantity = get_post_meta( $id, '_stock', true );
|
22 |
-
|
23 |
-
if ( is_numeric( $new_quantity ) ) {
|
24 |
-
|
25 |
-
$new_stock_status = ( $new_quantity > 0 ) ? 'instock' : 'outofstock';
|
26 |
-
wc_update_product_stock_status( $id, $new_stock_status );
|
27 |
-
|
28 |
-
$trid = $sitepress->get_element_trid( $id, 'post_product' );
|
29 |
-
if ( is_numeric( $trid ) ) {
|
30 |
-
$translations = $sitepress->get_element_translations( $trid, 'post_product' );
|
31 |
-
|
32 |
-
if ( is_array( $translations ) ) {
|
33 |
-
foreach ( $translations as $translation ) {
|
34 |
-
if ( ! isset( $translation->element_id ) || $translation->element_id == $id ) {
|
35 |
-
continue;
|
36 |
-
}
|
37 |
-
update_post_meta( $translation->element_id, '_stock', $new_quantity );
|
38 |
-
wc_update_product_stock_status( $translation->element_id, $new_stock_status );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-checkout-addons.php
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Compatibility class for wc_checkout_addons plugin.
|
4 |
-
*
|
5 |
-
* @author konrad
|
6 |
-
*/
|
7 |
-
class WCML_Checkout_Addons {
|
8 |
-
|
9 |
-
public function add_hooks() {
|
10 |
-
add_filter( 'option_wc_checkout_add_ons', [ $this, 'option_wc_checkout_add_ons' ], 10, 2 );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function option_wc_checkout_add_ons( $option_value, $option_name = null ) {
|
14 |
-
if ( is_array( $option_value ) ) {
|
15 |
-
foreach ( $option_value as $addon_id => $addon_conf ) {
|
16 |
-
$addon_conf = $this->handle_option_part( $addon_id, $addon_conf );
|
17 |
-
if ( isset( $addon_conf['options'] ) ) {
|
18 |
-
foreach ( $addon_conf['options'] as $index => $fields ) {
|
19 |
-
$addon_conf['options'][ $index ] = $this->handle_option_part( $index, $fields );
|
20 |
-
}
|
21 |
-
}
|
22 |
-
$option_value[ $addon_id ] = $addon_conf;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
return $option_value;
|
27 |
-
}
|
28 |
-
|
29 |
-
private function handle_option_part( $index, $conf ) {
|
30 |
-
$conf = $this->register_or_translate( 'label', $conf, $index );
|
31 |
-
$conf = $this->register_or_translate( 'description', $conf, $index );
|
32 |
-
$conf = $this->adjust_price( $conf );
|
33 |
-
return $conf;
|
34 |
-
}
|
35 |
-
|
36 |
-
private function register_or_translate( $element, $conf, $index ) {
|
37 |
-
if ( isset( $conf[ $element ] ) ) {
|
38 |
-
$string = $conf[ $element ];
|
39 |
-
$key = $index . '_' . $element . '_' . md5( $string );
|
40 |
-
if ( $this->is_default_language() ) {
|
41 |
-
do_action( 'wpml_register_single_string', 'wc_checkout_addons', $key, $string );
|
42 |
-
} else {
|
43 |
-
$conf[ $element ] = apply_filters( 'wpml_translate_single_string', $string, 'wc_checkout_addons', $key );
|
44 |
-
}
|
45 |
-
}
|
46 |
-
return $conf;
|
47 |
-
}
|
48 |
-
|
49 |
-
private function adjust_price( $conf ) {
|
50 |
-
if ( isset( $conf['adjustment'], $conf['adjustment_type'] )
|
51 |
-
&& $conf['adjustment_type'] === 'fixed'
|
52 |
-
&& ! $this->is_default_language() ) {
|
53 |
-
$conf['adjustment'] = apply_filters( 'wcml_raw_price_amount', $conf['adjustment'] );
|
54 |
-
}
|
55 |
-
return $conf;
|
56 |
-
}
|
57 |
-
|
58 |
-
private function is_default_language() {
|
59 |
-
return apply_filters( 'wpml_current_language', null ) === apply_filters( 'wpml_default_language', null );
|
60 |
-
}
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-checkout-field-editor.php
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Checkout_Field_Editor {
|
4 |
-
|
5 |
-
protected $package, $billing, $shipping, $additional;
|
6 |
-
|
7 |
-
public function __construct( $package = false ) {
|
8 |
-
$this->package = $package ? $package : (object) [
|
9 |
-
'kind' => 'WooCommerce Add-On',
|
10 |
-
'kind_slug' => 'woocommerce-add-on',
|
11 |
-
'name' => 'checkout-field-editor',
|
12 |
-
'title' => 'WooCommerce Checkout Field Editor',
|
13 |
-
];
|
14 |
-
}
|
15 |
-
|
16 |
-
public function add_hooks() {
|
17 |
-
global $supress_field_modification;
|
18 |
-
if ( ! is_admin() && ! $supress_field_modification ) {
|
19 |
-
add_filter( 'pre_option_wc_fields_billing', [ $this, 'get_billing' ] );
|
20 |
-
add_filter( 'pre_option_wc_fields_shipping', [ $this, 'get_shipping' ] );
|
21 |
-
add_filter( 'pre_option_wc_fields_additional', [ $this, 'get_additional' ] );
|
22 |
-
}
|
23 |
-
add_filter( 'pre_update_option_wc_fields_billing', [ $this, 'register_fields' ] );
|
24 |
-
add_filter( 'pre_update_option_wc_fields_shipping', [ $this, 'register_fields' ] );
|
25 |
-
add_filter( 'pre_update_option_wc_fields_additional', [ $this, 'register_fields' ] );
|
26 |
-
}
|
27 |
-
|
28 |
-
private function get_exclude_fields() {
|
29 |
-
|
30 |
-
$exclude_fields = [
|
31 |
-
'shipping_address_1',
|
32 |
-
'shipping_city',
|
33 |
-
'shipping_state',
|
34 |
-
'shipping_postcode',
|
35 |
-
'billing_address_1',
|
36 |
-
'billing_city',
|
37 |
-
'billing_state',
|
38 |
-
'billing_postcode',
|
39 |
-
];
|
40 |
-
|
41 |
-
return apply_filters( 'wcml_cfe_exclude_fields_to_register', $exclude_fields );
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
public function register_fields( $fields ) {
|
46 |
-
foreach ( $fields as $string_name => $field ) {
|
47 |
-
|
48 |
-
if ( in_array( $string_name, $this->get_exclude_fields() ) ) {
|
49 |
-
continue;
|
50 |
-
}
|
51 |
-
|
52 |
-
// Translate label
|
53 |
-
if ( ! empty( $field['label'] ) ) {
|
54 |
-
do_action(
|
55 |
-
'wpml_register_string',
|
56 |
-
$field['label'],
|
57 |
-
"{$string_name}_label",
|
58 |
-
$this->package,
|
59 |
-
"{$string_name} Label",
|
60 |
-
$this->package->kind
|
61 |
-
);
|
62 |
-
}
|
63 |
-
// Translate placeholder
|
64 |
-
if ( ! empty( $field['placeholder'] ) ) {
|
65 |
-
do_action(
|
66 |
-
'wpml_register_string',
|
67 |
-
$field['placeholder'],
|
68 |
-
"{$string_name}_placeholder",
|
69 |
-
$this->package,
|
70 |
-
"{$string_name} Placeholder",
|
71 |
-
$this->package->kind
|
72 |
-
);
|
73 |
-
}
|
74 |
-
// Translate options
|
75 |
-
if ( ! empty( $field['options'] ) ) {
|
76 |
-
$i = 1;
|
77 |
-
foreach ( $field['options'] as $option ) {
|
78 |
-
do_action(
|
79 |
-
'wpml_register_string',
|
80 |
-
$option,
|
81 |
-
"{$string_name}_option_{$i}",
|
82 |
-
$this->package,
|
83 |
-
"{$string_name} Option {$i}",
|
84 |
-
$this->package->kind
|
85 |
-
);
|
86 |
-
$i++;
|
87 |
-
}
|
88 |
-
}
|
89 |
-
}
|
90 |
-
return $fields;
|
91 |
-
}
|
92 |
-
|
93 |
-
public function translate_fields( $fields ) {
|
94 |
-
foreach ( $fields as $string_name => &$field ) {
|
95 |
-
|
96 |
-
if ( in_array( $string_name, $this->get_exclude_fields() ) ) {
|
97 |
-
continue;
|
98 |
-
}
|
99 |
-
|
100 |
-
// Translate label
|
101 |
-
if ( ! empty( $field['label'] ) ) {
|
102 |
-
$field['label'] = apply_filters(
|
103 |
-
'wpml_translate_string',
|
104 |
-
$field['label'],
|
105 |
-
"{$string_name}_label",
|
106 |
-
$this->package
|
107 |
-
);
|
108 |
-
}
|
109 |
-
// Translate placeholder
|
110 |
-
if ( ! empty( $field['placeholder'] ) ) {
|
111 |
-
$field['placeholder'] = apply_filters(
|
112 |
-
'wpml_translate_string',
|
113 |
-
$field['label'],
|
114 |
-
"{$string_name}_placeholder",
|
115 |
-
$this->package
|
116 |
-
);
|
117 |
-
}
|
118 |
-
// Translate options
|
119 |
-
if ( ! empty( $field['options'] ) ) {
|
120 |
-
$i = 1;
|
121 |
-
foreach ( $field['options'] as $k => $option ) {
|
122 |
-
$field['options'][ $k ] = apply_filters(
|
123 |
-
'wpml_translate_string',
|
124 |
-
$option,
|
125 |
-
"{$string_name}_option_{$i}",
|
126 |
-
$this->package
|
127 |
-
);
|
128 |
-
$i++;
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
return $fields;
|
133 |
-
}
|
134 |
-
|
135 |
-
public function get_billing() {
|
136 |
-
if ( is_null( $this->billing ) ) {
|
137 |
-
remove_filter( 'pre_option_wc_fields_billing', [ $this, 'get_billing' ] );
|
138 |
-
$this->billing = $this->translate_fields( get_option( 'wc_fields_billing', [] ) );
|
139 |
-
add_filter( 'pre_option_wc_fields_billing', [ $this, 'get_billing' ] );
|
140 |
-
}
|
141 |
-
return $this->billing;
|
142 |
-
}
|
143 |
-
|
144 |
-
public function get_shipping() {
|
145 |
-
if ( is_null( $this->shipping ) ) {
|
146 |
-
remove_filter( 'pre_option_wc_fields_shipping', [ $this, 'get_shipping' ] );
|
147 |
-
$this->shipping = $this->translate_fields( get_option( 'wc_fields_shipping', [] ) );
|
148 |
-
add_filter( 'pre_option_wc_fields_shipping', [ $this, 'get_shipping' ] );
|
149 |
-
}
|
150 |
-
return $this->shipping;
|
151 |
-
}
|
152 |
-
|
153 |
-
public function get_additional() {
|
154 |
-
if ( is_null( $this->additional ) ) {
|
155 |
-
remove_filter( 'pre_option_wc_fields_additional', [ $this, 'get_additional' ] );
|
156 |
-
$this->additional = $this->translate_fields( get_option( 'wc_fields_additional', [] ) );
|
157 |
-
add_filter( 'pre_option_wc_fields_additional', [ $this, 'get_additional' ] );
|
158 |
-
}
|
159 |
-
return $this->additional;
|
160 |
-
}
|
161 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-compatibility-helper.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Compatibility_Helper {
|
4 |
-
|
5 |
-
public function get_product_type( $product_id ) {
|
6 |
-
|
7 |
-
if ( $terms = wp_get_object_terms( $product_id, 'product_type' ) ) {
|
8 |
-
$product_type = sanitize_title( current( $terms )->name );
|
9 |
-
} else {
|
10 |
-
$product_type = apply_filters( 'default_product_type', 'simple' );
|
11 |
-
}
|
12 |
-
|
13 |
-
return $product_type;
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-composite-products.php
DELETED
@@ -1,586 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Fns;
|
4 |
-
use WPML\FP\Obj;
|
5 |
-
|
6 |
-
use function WPML\FP\partial;
|
7 |
-
use function WPML\FP\pipe;
|
8 |
-
|
9 |
-
class WCML_Composite_Products extends WCML_Compatibility_Helper{
|
10 |
-
|
11 |
-
const PRICE_FILTERS_PRIORITY_AFTER_COMPOSITE = 99;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var SitePress
|
15 |
-
*/
|
16 |
-
private $sitepress;
|
17 |
-
/**
|
18 |
-
* @var woocommerce_wpml
|
19 |
-
*/
|
20 |
-
private $woocommerce_wpml;
|
21 |
-
/**
|
22 |
-
* @var WPML_Element_Translation_Package
|
23 |
-
*/
|
24 |
-
private $tp;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* WCML_Composite_Products constructor.
|
28 |
-
* @param SitePress $sitepress
|
29 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
30 |
-
* @param WPML_Element_Translation_Package $tp
|
31 |
-
*/
|
32 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, WPML_Element_Translation_Package $tp ) {
|
33 |
-
$this->sitepress = $sitepress;
|
34 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
35 |
-
$this->tp = $tp;
|
36 |
-
}
|
37 |
-
|
38 |
-
public function add_hooks(){
|
39 |
-
|
40 |
-
add_filter( 'woocommerce_composite_component_default_option', array($this, 'woocommerce_composite_component_default_option'), 10, 3 );
|
41 |
-
add_filter( 'wcml_cart_contents', array($this, 'wpml_composites_compat'), 11, 4 );
|
42 |
-
add_filter( 'woocommerce_composite_component_options_query_args', array($this, 'wpml_composites_transients_cache_per_language'), 10, 3 );
|
43 |
-
add_action( 'wcml_before_sync_product_data', array( $this, 'sync_composite_data_across_translations' ), 10, 2 );
|
44 |
-
add_action( 'wpml_translation_job_saved', array( $this, 'save_composite_data_translation' ), 10, 3 );
|
45 |
-
if( is_admin() ){
|
46 |
-
|
47 |
-
add_action( 'wcml_gui_additional_box_html', array( $this, 'custom_box_html' ), 10, 3 );
|
48 |
-
add_filter( 'wcml_gui_additional_box_data', array( $this, 'custom_box_html_data' ), 10, 4 );
|
49 |
-
add_action( 'wcml_update_extra_fields', array( $this, 'update_component_strings' ), 10, 4 );
|
50 |
-
add_filter( 'woocommerce_json_search_found_products', array( $this, 'woocommerce_json_search_found_products' ) );
|
51 |
-
|
52 |
-
add_filter( 'wpml_tm_translation_job_data', array( $this, 'append_composite_data_translation_package' ), 10, 2 );
|
53 |
-
|
54 |
-
//lock fields on translations pages
|
55 |
-
add_filter( 'wcml_js_lock_fields_input_names', array( $this, 'wcml_js_lock_fields_input_names' ) );
|
56 |
-
add_filter( 'wcml_js_lock_fields_ids', array( $this, 'wcml_js_lock_fields_ids' ) );
|
57 |
-
add_filter( 'wcml_after_load_lock_fields_js', array( $this, 'localize_lock_fields_js' ) );
|
58 |
-
add_action( 'init', array( $this, 'load_assets' ) );
|
59 |
-
|
60 |
-
add_action( 'wcml_after_save_custom_prices', array( $this, 'update_composite_custom_prices' ), 10, 4 );
|
61 |
-
|
62 |
-
add_filter( 'wcml_do_not_display_custom_fields_for_product', array( $this, 'replace_tm_editor_custom_fields_with_own_sections' ) );
|
63 |
-
}else{
|
64 |
-
add_filter( 'get_post_metadata', array( $this, 'filter_composite_product_cost' ), 10, 4 );
|
65 |
-
$this->add_price_rounding_filters();
|
66 |
-
}
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
public function add_price_rounding_filters(){
|
71 |
-
|
72 |
-
$filters = array(
|
73 |
-
'woocommerce_product_get_price',
|
74 |
-
'woocommerce_product_get_sale_price',
|
75 |
-
'woocommerce_product_get_regular_price',
|
76 |
-
'woocommerce_product_variation_get_price',
|
77 |
-
'woocommerce_product_variation_get_sale_price',
|
78 |
-
'woocommerce_product_variation_get_regular_price'
|
79 |
-
);
|
80 |
-
|
81 |
-
foreach( $filters as $filter ){
|
82 |
-
add_filter( $filter, array( $this, 'apply_rounding_rules' ), self::PRICE_FILTERS_PRIORITY_AFTER_COMPOSITE );
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
public function woocommerce_composite_component_default_option($selected_value, $component_id, $object) {
|
87 |
-
|
88 |
-
if( !empty( $selected_value ) )
|
89 |
-
$selected_value = apply_filters( 'wpml_object_id', $selected_value, 'product', true );
|
90 |
-
|
91 |
-
|
92 |
-
return $selected_value;
|
93 |
-
}
|
94 |
-
|
95 |
-
public function wpml_composites_compat( $new_cart_data, $cart_contents, $key, $new_key ) {
|
96 |
-
|
97 |
-
if ( isset( $cart_contents[ $key ][ 'composite_children' ] ) || isset( $cart_contents[ $key ][ 'composite_parent' ] ) ) {
|
98 |
-
|
99 |
-
$buff = $new_cart_data[ $new_key ];
|
100 |
-
|
101 |
-
unset( $new_cart_data[ $new_key ] );
|
102 |
-
|
103 |
-
$new_cart_data[ $key ] = $buff;
|
104 |
-
}
|
105 |
-
|
106 |
-
return $new_cart_data;
|
107 |
-
}
|
108 |
-
|
109 |
-
public function wpml_composites_transients_cache_per_language( $args, $query_args, $component_data ) {
|
110 |
-
|
111 |
-
$args[ 'wpml_lang' ] = apply_filters( 'wpml_current_language', NULL );
|
112 |
-
|
113 |
-
return $args;
|
114 |
-
}
|
115 |
-
|
116 |
-
public function sync_composite_data_across_translations( $original_product_id, $current_product_id ){
|
117 |
-
|
118 |
-
if( $this->get_product_type( $original_product_id ) == 'composite' ){
|
119 |
-
|
120 |
-
$composite_data = $this->get_composite_data( $original_product_id );
|
121 |
-
$composite_scenarios_meta = $this->get_composite_scenarios_meta( $original_product_id );
|
122 |
-
|
123 |
-
$product_trid = $this->sitepress->get_element_trid( $original_product_id, 'post_product' );
|
124 |
-
$product_translations = $this->sitepress->get_element_translations( $product_trid, 'post_product' );
|
125 |
-
|
126 |
-
foreach ( $product_translations as $product_translation ) {
|
127 |
-
|
128 |
-
if ( empty($product_translation->original) ) {
|
129 |
-
|
130 |
-
$translated_composite_data = $this->get_composite_data( $product_translation->element_id );
|
131 |
-
|
132 |
-
foreach ( $composite_data as $component_id => $component ) {
|
133 |
-
|
134 |
-
if( isset( $translated_composite_data[$component_id]['title'] ) ){
|
135 |
-
$composite_data[$component_id]['title'] = $translated_composite_data[$component_id]['title'];
|
136 |
-
}
|
137 |
-
|
138 |
-
if( isset( $translated_composite_data[$component_id]['description'] ) ){
|
139 |
-
$composite_data[$component_id]['description'] = $translated_composite_data[$component_id]['description'];
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( $component['query_type'] == 'product_ids' ) {
|
143 |
-
|
144 |
-
foreach ( $component['assigned_ids'] as $idx => $assigned_id ) {
|
145 |
-
$composite_data[$component_id]['assigned_ids'][$idx] =
|
146 |
-
apply_filters( 'wpml_object_id', $assigned_id, 'product', true, $product_translation->language_code );
|
147 |
-
}
|
148 |
-
|
149 |
-
} elseif( $component['query_type'] == 'category_ids' ){
|
150 |
-
|
151 |
-
foreach ( $component['assigned_category_ids'] as $idx => $assigned_id ) {
|
152 |
-
$composite_data[$component_id]['assigned_category_ids'][$idx] =
|
153 |
-
apply_filters( 'wpml_object_id', $assigned_id, 'product_cat', true, $product_translation->language_code );
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
//sync default
|
160 |
-
if ( isset( $component['default_id'] ) && $component['default_id'] ) {
|
161 |
-
$translated_default_id = apply_filters( 'wpml_object_id', $component['default_id'], get_post_type( $component['default_id'] ), false, $product_translation->language_code );
|
162 |
-
if ( $translated_default_id ) {
|
163 |
-
$composite_data[ $component_id ]['default_id'] = $translated_default_id;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
update_post_meta( $product_translation->element_id, '_bto_data', $composite_data );
|
170 |
-
|
171 |
-
if ( $composite_scenarios_meta ) {
|
172 |
-
// sync product ids
|
173 |
-
$translate_product_ids = function ( $component_data ) use ( $product_translation ) {
|
174 |
-
$translate_assigned_product_id = function( $assigned_product_id ) use ( $product_translation ) {
|
175 |
-
return apply_filters( 'wpml_object_id', $assigned_product_id, get_post_type( $assigned_product_id ), false, $product_translation->language_code ) ?: $assigned_product_id;
|
176 |
-
};
|
177 |
-
|
178 |
-
return wpml_collect( (array) $component_data )
|
179 |
-
->map( Fns::map( $translate_assigned_product_id ) )
|
180 |
-
->toArray();
|
181 |
-
};
|
182 |
-
|
183 |
-
$composite_scenarios_meta = wpml_collect( $composite_scenarios_meta )
|
184 |
-
->map( Obj::over( Obj::lensPath( [ 'component_data' ] ), $translate_product_ids ) )
|
185 |
-
->map( Obj::over( Obj::lensPath( [ 'scenario_actions', 'conditional_options', 'component_data' ] ), $translate_product_ids ) )
|
186 |
-
->toArray();
|
187 |
-
|
188 |
-
update_post_meta( $product_translation->element_id, '_bto_scenario_data', $composite_scenarios_meta );
|
189 |
-
}
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
public function custom_box_html( $obj, $product_id, $data ){
|
197 |
-
|
198 |
-
if( $this->get_product_type( $product_id ) == 'composite' ){
|
199 |
-
|
200 |
-
$composite_data = $this->get_composite_data( $product_id );
|
201 |
-
|
202 |
-
$composite_section = new WPML_Editor_UI_Field_Section( __( 'Composite Products ( Components )', 'woocommerce-multilingual' ) );
|
203 |
-
end( $composite_data );
|
204 |
-
$last_key = key( $composite_data );
|
205 |
-
$divider = true;
|
206 |
-
foreach( $composite_data as $component_id => $component ) {
|
207 |
-
if( $component_id == $last_key ){
|
208 |
-
$divider = false;
|
209 |
-
}
|
210 |
-
$group = new WPML_Editor_UI_Field_Group( '', $divider );
|
211 |
-
$composite_field = new WPML_Editor_UI_Single_Line_Field( 'composite_'.$component_id.'_title', __( 'Name', 'woocommerce-multilingual' ), $data, false );
|
212 |
-
$group->add_field( $composite_field );
|
213 |
-
$composite_field = new WPML_Editor_UI_Single_Line_Field( 'composite_'.$component_id.'_description' , __( 'Description', 'woocommerce-multilingual' ), $data, false );
|
214 |
-
$group->add_field( $composite_field );
|
215 |
-
$composite_section->add_field( $group );
|
216 |
-
|
217 |
-
}
|
218 |
-
|
219 |
-
if( $composite_data ){
|
220 |
-
$obj->add_field( $composite_section );
|
221 |
-
}
|
222 |
-
|
223 |
-
$composite_scenarios_meta = $this->get_composite_scenarios_meta( $product_id );
|
224 |
-
if( $composite_scenarios_meta ){
|
225 |
-
|
226 |
-
$composite_scenarios = new WPML_Editor_UI_Field_Section( __( 'Composite Products ( Scenarios )', 'woocommerce-multilingual' ) );
|
227 |
-
end( $composite_scenarios_meta );
|
228 |
-
$last_key = key( $composite_scenarios_meta );
|
229 |
-
$divider = true;
|
230 |
-
foreach( $composite_scenarios_meta as $scenario_key => $scenario_meta ) {
|
231 |
-
if( $scenario_key == $last_key ){
|
232 |
-
$divider = false;
|
233 |
-
}
|
234 |
-
$group = new WPML_Editor_UI_Field_Group( '', $divider );
|
235 |
-
$composite_scenario_field = new WPML_Editor_UI_Single_Line_Field( 'composite_scenario_'.$scenario_key.'_title', __( 'Name', 'woocommerce-multilingual' ), $data, false );
|
236 |
-
$group->add_field( $composite_scenario_field );
|
237 |
-
$composite_scenario_field = new WPML_Editor_UI_Single_Line_Field( 'composite_scenario_'.$scenario_key.'_description' , __( 'Description', 'woocommerce-multilingual' ), $data, false );
|
238 |
-
$group->add_field( $composite_scenario_field );
|
239 |
-
$composite_scenarios->add_field( $group );
|
240 |
-
|
241 |
-
}
|
242 |
-
|
243 |
-
$obj->add_field( $composite_scenarios );
|
244 |
-
|
245 |
-
}
|
246 |
-
|
247 |
-
}
|
248 |
-
|
249 |
-
}
|
250 |
-
|
251 |
-
public function custom_box_html_data( $data, $product_id, $translation, $lang ){
|
252 |
-
|
253 |
-
if( $this->get_product_type( $product_id ) == 'composite' ){
|
254 |
-
|
255 |
-
$composite_data = $this->get_composite_data( $product_id );
|
256 |
-
|
257 |
-
foreach( $composite_data as $component_id => $component ) {
|
258 |
-
|
259 |
-
$data['composite_'.$component_id.'_title'] = array( 'original' =>
|
260 |
-
isset( $composite_data[$component_id]['title'] ) ? $composite_data[$component_id]['title'] : '' );
|
261 |
-
|
262 |
-
$data['composite_'.$component_id.'_description'] = array( 'original' =>
|
263 |
-
isset( $composite_data[$component_id]['description'] ) ? $composite_data[$component_id]['description'] : '' );
|
264 |
-
|
265 |
-
}
|
266 |
-
|
267 |
-
$composite_scenarios_meta = $this->get_composite_scenarios_meta( $product_id );
|
268 |
-
if( $composite_scenarios_meta ){
|
269 |
-
foreach( $composite_scenarios_meta as $scenario_key => $scenario_meta ){
|
270 |
-
$data[ 'composite_scenario_'.$scenario_key.'_title' ] = array(
|
271 |
-
'original' => isset( $scenario_meta['title'] ) ? $scenario_meta['title'] : '',
|
272 |
-
'translation' => ''
|
273 |
-
);
|
274 |
-
|
275 |
-
$data[ 'composite_scenario_'.$scenario_key.'_description' ] = array(
|
276 |
-
'original' => isset( $scenario_meta['description'] ) ? $scenario_meta['description'] : '',
|
277 |
-
'translation' => ''
|
278 |
-
);
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
if( $translation ){
|
283 |
-
$translated_composite_data = $this->get_composite_data( $translation->ID );
|
284 |
-
|
285 |
-
foreach( $composite_data as $component_id => $component ){
|
286 |
-
|
287 |
-
$data['composite_'.$component_id.'_title'][ 'translation' ] =
|
288 |
-
isset( $translated_composite_data[$component_id]['title'] ) ? $translated_composite_data[$component_id]['title'] : '';
|
289 |
-
|
290 |
-
$data['composite_'.$component_id.'_description'][ 'translation' ] =
|
291 |
-
isset( $translated_composite_data[$component_id]['description'] ) ? $translated_composite_data[$component_id]['description'] : '';
|
292 |
-
|
293 |
-
}
|
294 |
-
|
295 |
-
$translated_composite_scenarios_meta = $this->get_composite_scenarios_meta( $translation->ID );
|
296 |
-
if( $translated_composite_scenarios_meta ){
|
297 |
-
foreach( $translated_composite_scenarios_meta as $scenario_key => $translated_scenario_meta ){
|
298 |
-
$data[ 'composite_scenario_'.$scenario_key.'_title' ][ 'translation' ] =
|
299 |
-
isset( $translated_scenario_meta['title'] ) ? $translated_scenario_meta['title'] : '';
|
300 |
-
|
301 |
-
$data[ 'composite_scenario_'.$scenario_key.'_description' ][ 'translation' ] =
|
302 |
-
isset( $translated_scenario_meta['description'] ) ? $translated_scenario_meta['description'] : '';
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
}
|
307 |
-
|
308 |
-
}
|
309 |
-
|
310 |
-
return $data;
|
311 |
-
}
|
312 |
-
|
313 |
-
|
314 |
-
public function update_component_strings( $original_product_id, $product_id, $data, $language ){
|
315 |
-
|
316 |
-
$composite_data = $this->get_composite_data( $product_id );
|
317 |
-
|
318 |
-
foreach( $composite_data as $component_id => $component ) {
|
319 |
-
|
320 |
-
if(!empty($data[ md5( 'composite_'.$component_id.'_title' ) ] ) ){
|
321 |
-
$composite_data[$component_id]['title'] = $data[ md5( 'composite_'.$component_id.'_title' ) ];
|
322 |
-
}
|
323 |
-
|
324 |
-
if(!empty($data[ md5( 'composite_'.$component_id.'_description' ) ])) {
|
325 |
-
$composite_data[$component_id]['description'] = $data[ md5( 'composite_'.$component_id.'_description' ) ];
|
326 |
-
}
|
327 |
-
|
328 |
-
}
|
329 |
-
|
330 |
-
update_post_meta( $product_id, '_bto_data', $composite_data );
|
331 |
-
|
332 |
-
$composite_scenarios_meta = $this->get_composite_scenarios_meta( $product_id );
|
333 |
-
if( $composite_scenarios_meta ){
|
334 |
-
foreach( $composite_scenarios_meta as $scenario_key => $scenario_meta ){
|
335 |
-
if( !empty( $data[ md5( 'composite_scenario_'.$scenario_key.'_title' ) ] ) ){
|
336 |
-
$composite_scenarios_meta[ $scenario_key ][ 'title' ] = $data[ md5( 'composite_scenario_'.$scenario_key.'_title' ) ];
|
337 |
-
}
|
338 |
-
|
339 |
-
if( !empty( $data[ md5( 'composite_scenario_'.$scenario_key.'_description' ) ])) {
|
340 |
-
$composite_scenarios_meta[ $scenario_key ][ 'description' ] = $data[ md5( 'composite_scenario_'.$scenario_key.'_description' ) ];
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
update_post_meta( $product_id, '_bto_scenario_data', $composite_scenarios_meta );
|
346 |
-
|
347 |
-
return array(
|
348 |
-
'components' => $composite_data,
|
349 |
-
'scenarios' => $composite_scenarios_meta,
|
350 |
-
);
|
351 |
-
}
|
352 |
-
|
353 |
-
public function append_composite_data_translation_package( $package, $post ){
|
354 |
-
|
355 |
-
if( $post->post_type == 'product' ) {
|
356 |
-
|
357 |
-
$composite_data = get_post_meta( $post->ID, '_bto_data', true );
|
358 |
-
|
359 |
-
if( $composite_data ){
|
360 |
-
|
361 |
-
$fields = array( 'title', 'description' );
|
362 |
-
|
363 |
-
foreach( $composite_data as $component_id => $component ){
|
364 |
-
|
365 |
-
foreach( $fields as $field ) {
|
366 |
-
if ( !empty($component[$field]) ) {
|
367 |
-
|
368 |
-
$package['contents']['wc_composite:' . $component_id . ':' . $field] = array(
|
369 |
-
'translate' => 1,
|
370 |
-
'data' => $this->tp->encode_field_data( $component[$field], 'base64' ),
|
371 |
-
'format' => 'base64'
|
372 |
-
);
|
373 |
-
|
374 |
-
}
|
375 |
-
}
|
376 |
-
|
377 |
-
}
|
378 |
-
|
379 |
-
}
|
380 |
-
|
381 |
-
}
|
382 |
-
|
383 |
-
return $package;
|
384 |
-
|
385 |
-
}
|
386 |
-
|
387 |
-
public function save_composite_data_translation( $post_id, $data, $job ){
|
388 |
-
|
389 |
-
|
390 |
-
$translated_composite_data = array();
|
391 |
-
foreach( $data as $value){
|
392 |
-
|
393 |
-
if( preg_match( '/wc_composite:([0-9]+):(.+)/', $value['field_type'], $matches ) ){
|
394 |
-
|
395 |
-
$component_id = $matches[1];
|
396 |
-
$field = $matches[2];
|
397 |
-
|
398 |
-
$translated_composite_data[$component_id][$field] = $value['data'];
|
399 |
-
|
400 |
-
}
|
401 |
-
|
402 |
-
}
|
403 |
-
|
404 |
-
if( $translated_composite_data ){
|
405 |
-
|
406 |
-
$composite_data = get_post_meta( $job->original_doc_id, '_bto_data', true );
|
407 |
-
|
408 |
-
|
409 |
-
foreach ( $composite_data as $component_id => $component ) {
|
410 |
-
|
411 |
-
if( isset( $translated_composite_data[$component_id]['title'] ) ){
|
412 |
-
$composite_data[$component_id]['title'] = $translated_composite_data[$component_id]['title'];
|
413 |
-
}
|
414 |
-
|
415 |
-
if( isset( $translated_composite_data[$component_id]['description'] ) ){
|
416 |
-
$composite_data[$component_id]['description'] = $translated_composite_data[$component_id]['description'];
|
417 |
-
}
|
418 |
-
|
419 |
-
if ( $component['query_type'] == 'product_ids' ) {
|
420 |
-
|
421 |
-
foreach ( $component['assigned_ids'] as $idx => $assigned_id ) {
|
422 |
-
$composite_data[$component_id]['assigned_ids'][$idx] =
|
423 |
-
apply_filters( 'wpml_object_id', $assigned_id, 'product', true, $job->language_code );
|
424 |
-
}
|
425 |
-
|
426 |
-
} elseif( $component['query_type'] == 'category_ids' ){
|
427 |
-
|
428 |
-
foreach ( $component['assigned_category_ids'] as $idx => $assigned_id ) {
|
429 |
-
$composite_data[$component_id]['assigned_category_ids'][$idx] =
|
430 |
-
apply_filters( 'wpml_object_id', $assigned_id, 'product_cat', true, $job->language_code );
|
431 |
-
|
432 |
-
}
|
433 |
-
|
434 |
-
}
|
435 |
-
|
436 |
-
}
|
437 |
-
|
438 |
-
update_post_meta( $post_id, '_bto_data', $composite_data );
|
439 |
-
}
|
440 |
-
}
|
441 |
-
|
442 |
-
public function wcml_js_lock_fields_input_names( $names ){
|
443 |
-
|
444 |
-
$names[] = '_base_regular_price';
|
445 |
-
$names[] = '_base_sale_price';
|
446 |
-
$names[] = 'bto_style';
|
447 |
-
|
448 |
-
return $names;
|
449 |
-
}
|
450 |
-
|
451 |
-
public function wcml_js_lock_fields_ids( $names ){
|
452 |
-
|
453 |
-
$names[] = '_per_product_pricing_bto';
|
454 |
-
$names[] = '_per_product_shipping_bto';
|
455 |
-
$names[] = '_bto_hide_shop_price';
|
456 |
-
|
457 |
-
return $names;
|
458 |
-
}
|
459 |
-
|
460 |
-
public function localize_lock_fields_js(){
|
461 |
-
wp_localize_script( 'wcml-composite-js', 'lock_settings' , array( 'lock_fields' => 1 ) );
|
462 |
-
}
|
463 |
-
|
464 |
-
public function load_assets( ){
|
465 |
-
global $pagenow;
|
466 |
-
|
467 |
-
$is_composite_edit_page = false;
|
468 |
-
|
469 |
-
if( $pagenow == 'post.php' && isset( $_GET[ 'post' ] ) ){
|
470 |
-
$wc_product = wc_get_product( $_GET[ 'post' ] );
|
471 |
-
if( $wc_product && $wc_product->get_type() === 'composite' ){
|
472 |
-
$is_composite_edit_page = true;
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
if( $is_composite_edit_page || $pagenow == 'post-new.php' ){
|
477 |
-
wp_register_script( 'wcml-composite-js', WCML_PLUGIN_URL . '/compatibility/res/js/wcml-composite.js', array( 'jquery' ), WCML_VERSION, true );
|
478 |
-
wp_enqueue_script( 'wcml-composite-js' );
|
479 |
-
|
480 |
-
}
|
481 |
-
|
482 |
-
}
|
483 |
-
|
484 |
-
public function woocommerce_json_search_found_products( $found_products ){
|
485 |
-
global $wpml_post_translations;
|
486 |
-
|
487 |
-
foreach( $found_products as $id => $product_name ){
|
488 |
-
if( $wpml_post_translations->get_element_lang_code ( $id ) != $this->sitepress->get_current_language() ){
|
489 |
-
unset( $found_products[ $id ] );
|
490 |
-
}
|
491 |
-
}
|
492 |
-
|
493 |
-
return $found_products;
|
494 |
-
}
|
495 |
-
|
496 |
-
public function get_composite_scenarios_meta( $product_id ){
|
497 |
-
return get_post_meta( $product_id, '_bto_scenario_data', true );
|
498 |
-
}
|
499 |
-
|
500 |
-
public function get_composite_data( $product_id ){
|
501 |
-
return get_post_meta( $product_id, '_bto_data', true ) ?: [];
|
502 |
-
}
|
503 |
-
|
504 |
-
|
505 |
-
public function filter_composite_product_cost( $value, $object_id, $meta_key, $single ) {
|
506 |
-
|
507 |
-
if ( in_array( $meta_key, array(
|
508 |
-
'_bto_base_regular_price',
|
509 |
-
'_bto_base_sale_price',
|
510 |
-
'_bto_base_price'
|
511 |
-
) ) ) {
|
512 |
-
|
513 |
-
if ( $this->woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ) {
|
514 |
-
|
515 |
-
$original_id = $this->woocommerce_wpml->products->get_original_product_id( $object_id );
|
516 |
-
|
517 |
-
$cost_status = get_post_meta( $original_id, '_wcml_custom_prices_status', true );
|
518 |
-
|
519 |
-
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
520 |
-
|
521 |
-
if ( $currency === wcml_get_woocommerce_currency_option() ) {
|
522 |
-
return $value;
|
523 |
-
}
|
524 |
-
|
525 |
-
$cost = get_post_meta( $original_id, $meta_key . '_' . $currency, true );
|
526 |
-
|
527 |
-
if ( $cost_status && !empty( $cost ) ) {
|
528 |
-
|
529 |
-
return $cost;
|
530 |
-
|
531 |
-
} else {
|
532 |
-
|
533 |
-
remove_filter( 'get_post_metadata', array( $this, 'filter_composite_product_cost' ), 10 );
|
534 |
-
|
535 |
-
$cost = get_post_meta( $original_id, $meta_key, true );
|
536 |
-
|
537 |
-
add_filter( 'get_post_metadata', array( $this, 'filter_composite_product_cost' ), 10, 4 );
|
538 |
-
|
539 |
-
if( $cost ){
|
540 |
-
|
541 |
-
$cost = $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $cost, $currency );
|
542 |
-
|
543 |
-
return $cost;
|
544 |
-
}
|
545 |
-
|
546 |
-
}
|
547 |
-
|
548 |
-
}
|
549 |
-
|
550 |
-
}
|
551 |
-
|
552 |
-
return $value;
|
553 |
-
}
|
554 |
-
|
555 |
-
public function update_composite_custom_prices( $product_id, $product_price, $custom_prices, $code ){
|
556 |
-
|
557 |
-
if( $this->get_product_type( $product_id ) == 'composite' ){
|
558 |
-
|
559 |
-
update_post_meta( $product_id, '_bto_base_regular_price'.'_'.$code, $custom_prices[ '_regular_price' ] );
|
560 |
-
update_post_meta( $product_id, '_bto_base_sale_price'.'_'.$code, $custom_prices[ '_sale_price' ] );
|
561 |
-
update_post_meta( $product_id, '_bto_base_price'.'_'.$code, $product_price );
|
562 |
-
|
563 |
-
}
|
564 |
-
|
565 |
-
}
|
566 |
-
|
567 |
-
public function replace_tm_editor_custom_fields_with_own_sections( $fields ){
|
568 |
-
$fields[] = '_bto_data';
|
569 |
-
$fields[] = '_bto_scenario_data';
|
570 |
-
|
571 |
-
return $fields;
|
572 |
-
}
|
573 |
-
|
574 |
-
public function apply_rounding_rules( $price ) {
|
575 |
-
|
576 |
-
if ( $price && is_composite_product() && wcml_is_multi_currency_on() ) {
|
577 |
-
$current_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
578 |
-
if( $current_currency !== wcml_get_woocommerce_currency_option() ) {
|
579 |
-
$price = $this->woocommerce_wpml->multi_currency->prices->apply_rounding_rules( $price, $current_currency );
|
580 |
-
}
|
581 |
-
}
|
582 |
-
|
583 |
-
return $price;
|
584 |
-
}
|
585 |
-
|
586 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-dynamic-pricing.php
DELETED
@@ -1,280 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Obj;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Class WCML_Dynamic_Pricing
|
7 |
-
*/
|
8 |
-
class WCML_Dynamic_Pricing {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var SitePress
|
12 |
-
*/
|
13 |
-
private $sitepress;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* WCML_Dynamic_Pricing constructor.
|
17 |
-
*
|
18 |
-
* @param SitePress $sitepress
|
19 |
-
*/
|
20 |
-
public function __construct( SitePress $sitepress ) {
|
21 |
-
$this->sitepress = $sitepress;
|
22 |
-
}
|
23 |
-
|
24 |
-
public function add_hooks() {
|
25 |
-
|
26 |
-
if ( ! is_admin() ) {
|
27 |
-
add_filter( 'woocommerce_dynamic_pricing_is_object_in_terms', [ $this, 'is_object_in_translated_terms' ], 10, 3 );
|
28 |
-
|
29 |
-
add_filter( 'wc_dynamic_pricing_load_modules', [ $this, 'filter_price' ] );
|
30 |
-
add_filter( 'wc_dynamic_pricing_load_modules', [ $this, 'translate_collector_args' ] );
|
31 |
-
add_filter( 'woocommerce_dynamic_pricing_is_applied_to', [ $this, 'woocommerce_dynamic_pricing_is_applied_to' ], 10, 5 );
|
32 |
-
add_filter( 'woocommerce_dynamic_pricing_get_rule_amount', [ $this, 'woocommerce_dynamic_pricing_get_rule_amount' ], 10, 2 );
|
33 |
-
add_filter( 'dynamic_pricing_product_rules', [ $this, 'dynamic_pricing_product_rules' ] );
|
34 |
-
} else {
|
35 |
-
$this->hide_language_switcher_for_settings_page();
|
36 |
-
}
|
37 |
-
add_filter( 'woocommerce_product_get__pricing_rules', [ $this, 'translate_variations_in_rules' ] );
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @param array $modules
|
43 |
-
*
|
44 |
-
* @return array
|
45 |
-
*/
|
46 |
-
public function filter_price( $modules ) {
|
47 |
-
|
48 |
-
foreach ( $modules as $mod_key => $module ) {
|
49 |
-
if ( isset( $module->available_rulesets ) ) {
|
50 |
-
$available_rulesets = $module->available_rulesets;
|
51 |
-
|
52 |
-
foreach ( $available_rulesets as $rule_key => $available_ruleset ) {
|
53 |
-
|
54 |
-
if ( isset( $available_ruleset['rules'] ) && is_array( $available_ruleset['rules'] ) ) {
|
55 |
-
$rules = $available_ruleset['rules'];
|
56 |
-
foreach ( $rules as $r_key => $rule ) {
|
57 |
-
if ( 'fixed_product' === $rule['type'] ) {
|
58 |
-
$rules[ $r_key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $rule['amount'] );
|
59 |
-
}
|
60 |
-
}
|
61 |
-
$modules[ $mod_key ]->available_rulesets[ $rule_key ]['rules'] = $rules;
|
62 |
-
|
63 |
-
} elseif ( isset( $available_ruleset['type'] ) && 'fixed_product' === $available_ruleset['type'] ) {
|
64 |
-
$modules[ $mod_key ]->available_rulesets[ $rule_key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $available_ruleset['amount'] );
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
return $modules;
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @param array $modules
|
75 |
-
*
|
76 |
-
* @return array
|
77 |
-
*/
|
78 |
-
public function translate_collector_args( $modules ) {
|
79 |
-
|
80 |
-
foreach ( $modules as $mod_key => $module ) {
|
81 |
-
if ( isset( $module->available_advanced_rulesets ) ) {
|
82 |
-
foreach ( $module->available_advanced_rulesets as $rule_key => $rule ) {
|
83 |
-
$taxonomy = $this->get_taxonomy( $rule );
|
84 |
-
if ( ! empty( $rule['targets'] ) ) {
|
85 |
-
$modules[ $mod_key ]->available_advanced_rulesets[ $rule_key ]['targets'] = $this->adjust_cat_ids( $rule['targets'], $taxonomy );
|
86 |
-
}
|
87 |
-
if ( ! empty( $rule['collector']['args']['cats'] ) ) {
|
88 |
-
$modules[ $mod_key ]->available_advanced_rulesets[ $rule_key ]['collector']['args']['cats'] = $this->adjust_cat_ids( $rule['collector']['args']['cats'], $taxonomy );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
return $modules;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* @param boolean $result
|
99 |
-
* @param int $product_id
|
100 |
-
* @param array $categories
|
101 |
-
*
|
102 |
-
* @return boolean
|
103 |
-
*/
|
104 |
-
public function is_object_in_translated_terms( $result, $product_id, $categories ) {
|
105 |
-
foreach ( $categories as &$cat_id ) {
|
106 |
-
$cat_id = apply_filters( 'translate_object_id', $cat_id, 'product_cat', true );
|
107 |
-
}
|
108 |
-
|
109 |
-
$product_id = apply_filters( 'translate_object_id', $product_id, 'product', true );
|
110 |
-
|
111 |
-
return is_object_in_term( $product_id, 'product_cat', $categories );
|
112 |
-
}
|
113 |
-
|
114 |
-
|
115 |
-
/**
|
116 |
-
* @param bool $process_discounts
|
117 |
-
* @param WC_Product $_product
|
118 |
-
* @param int $module_id
|
119 |
-
* @param WC_Dynamic_Pricing_Simple_Base|WC_Dynamic_Pricing_Advanced_Base $dynamic_pricing
|
120 |
-
* @param array|int $cat_ids
|
121 |
-
*
|
122 |
-
* @return bool|WP_Error
|
123 |
-
*/
|
124 |
-
public function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, WC_Product $_product, $module_id, $dynamic_pricing, $cat_ids ) {
|
125 |
-
if ( ! $_product || ! $cat_ids || ! $this->has_requirements( $dynamic_pricing ) ) {
|
126 |
-
return $process_discounts;
|
127 |
-
}
|
128 |
-
$taxonomy = $this->get_taxonomy( $dynamic_pricing );
|
129 |
-
$product_id = 'product_variation' === Obj::prop( 'post_type', $_product )
|
130 |
-
? $_product->get_parent_id()
|
131 |
-
: $_product->get_id();
|
132 |
-
|
133 |
-
$product_id = apply_filters( 'wpml_object_id', $product_id, 'product', true );
|
134 |
-
|
135 |
-
return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) );
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* @param WC_Dynamic_Pricing_Simple_Base|WC_Dynamic_Pricing_Advanced_Base $dynamic_pricing
|
140 |
-
*
|
141 |
-
* @return string
|
142 |
-
*/
|
143 |
-
private function get_taxonomy( $dynamic_pricing ) {
|
144 |
-
$taxonomy = 'product_cat';
|
145 |
-
if ( $dynamic_pricing instanceof WC_Dynamic_Pricing_Simple_Taxonomy || $dynamic_pricing instanceof WC_Dynamic_Pricing_Advanced_Taxonomy ) {
|
146 |
-
$taxonomy = $dynamic_pricing->taxonomy;
|
147 |
-
}
|
148 |
-
|
149 |
-
return $taxonomy;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* @param WC_Dynamic_Pricing_Simple_Base|WC_Dynamic_Pricing_Advanced_Base $dynamic_pricing
|
154 |
-
*
|
155 |
-
* @return bool
|
156 |
-
*/
|
157 |
-
private function has_requirements( $dynamic_pricing ) {
|
158 |
-
$requirements = [
|
159 |
-
'WC_Dynamic_Pricing_Advanced_Category' => [
|
160 |
-
'adjustment_sets',
|
161 |
-
],
|
162 |
-
'WC_Dynamic_Pricing_Advanced_Taxonomy' => [
|
163 |
-
'adjustment_sets',
|
164 |
-
],
|
165 |
-
'WC_Dynamic_Pricing_Advanced_Totals' => [
|
166 |
-
'adjustment_sets',
|
167 |
-
],
|
168 |
-
'WC_Dynamic_Pricing_Simple_Membership' => [
|
169 |
-
'available_rulesets',
|
170 |
-
],
|
171 |
-
'WC_Dynamic_Pricing_Simple_Category' => [
|
172 |
-
'available_rulesets',
|
173 |
-
],
|
174 |
-
'WC_Dynamic_Pricing_Simple_Taxonomy' => [
|
175 |
-
'available_rulesets',
|
176 |
-
],
|
177 |
-
'WC_Dynamic_Pricing_Simple_Base' => [
|
178 |
-
'available_rulesets',
|
179 |
-
],
|
180 |
-
];
|
181 |
-
|
182 |
-
$class_name = wpml_collect( array_keys( $requirements ) )
|
183 |
-
->first(
|
184 |
-
function ( $class_name ) use ( $dynamic_pricing ) {
|
185 |
-
return get_class( $dynamic_pricing ) === $class_name || is_subclass_of( $dynamic_pricing, $class_name );
|
186 |
-
}
|
187 |
-
);
|
188 |
-
|
189 |
-
if ( $class_name ) {
|
190 |
-
return wpml_collect( $requirements[ $class_name ] )
|
191 |
-
->filter(
|
192 |
-
function ( $property ) use ( $dynamic_pricing ) {
|
193 |
-
return isset( $dynamic_pricing->$property ) && $dynamic_pricing->$property;
|
194 |
-
}
|
195 |
-
)
|
196 |
-
->count();
|
197 |
-
}
|
198 |
-
|
199 |
-
return false;
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* @param array|int $cat_ids
|
204 |
-
* @param string $taxonomy
|
205 |
-
*
|
206 |
-
* @return array
|
207 |
-
*/
|
208 |
-
private function adjust_cat_ids( $cat_ids, $taxonomy ) {
|
209 |
-
if ( ! is_array( $cat_ids ) ) {
|
210 |
-
$cat_ids = [ $cat_ids ];
|
211 |
-
}
|
212 |
-
|
213 |
-
return array_map(
|
214 |
-
function ( $cat_id ) use ( $taxonomy ) {
|
215 |
-
return apply_filters( 'translate_object_id', $cat_id, $taxonomy, true );
|
216 |
-
},
|
217 |
-
$cat_ids
|
218 |
-
);
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* @param float $amount
|
223 |
-
* @param object $rule
|
224 |
-
*
|
225 |
-
* @return float
|
226 |
-
*/
|
227 |
-
public function woocommerce_dynamic_pricing_get_rule_amount( $amount, $rule ) {
|
228 |
-
|
229 |
-
if ( 'price_discount' === $rule['type'] || 'fixed_price' === $rule['type'] ) {
|
230 |
-
$amount = apply_filters( 'wcml_raw_price_amount', $amount );
|
231 |
-
}
|
232 |
-
|
233 |
-
return $amount;
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
/**
|
238 |
-
* @param array $rules
|
239 |
-
*
|
240 |
-
* @return array
|
241 |
-
*/
|
242 |
-
public function dynamic_pricing_product_rules( $rules ) {
|
243 |
-
if ( is_array( $rules ) ) {
|
244 |
-
foreach ( $rules as $r_key => $rule ) {
|
245 |
-
foreach ( $rule['rules'] as $key => $product_rule ) {
|
246 |
-
if ( 'price_discount' === $product_rule['type'] || 'fixed_price' === $product_rule['type'] ) {
|
247 |
-
$rules[ $r_key ]['rules'][ $key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $product_rule['amount'] );
|
248 |
-
}
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}
|
252 |
-
return $rules;
|
253 |
-
}
|
254 |
-
|
255 |
-
/**
|
256 |
-
* @param array $rules
|
257 |
-
*
|
258 |
-
* @return array
|
259 |
-
*/
|
260 |
-
public function translate_variations_in_rules( $rules ) {
|
261 |
-
if ( is_array( $rules ) ) {
|
262 |
-
foreach ( $rules as $r_key => $rule ) {
|
263 |
-
if ( isset( $rule['variation_rules']['args']['variations'] ) ) {
|
264 |
-
foreach ( $rule['variation_rules']['args']['variations'] as $i => $variation_id ) {
|
265 |
-
$rules[ $r_key ]['variation_rules']['args']['variations'][ $i ] = apply_filters( 'translate_object_id', $variation_id, 'product_variation', true );
|
266 |
-
}
|
267 |
-
}
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
return $rules;
|
272 |
-
}
|
273 |
-
|
274 |
-
public function hide_language_switcher_for_settings_page() {
|
275 |
-
if ( 'wc_dynamic_pricing' === filter_input( INPUT_GET, 'page' ) ) {
|
276 |
-
remove_action( 'wp_before_admin_bar_render', [ $this->sitepress, 'admin_language_switcher' ] );
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-extra-product-options.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Extra_Product_Options {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
|
7 |
-
add_action( 'tm_before_extra_product_options', [ $this, 'inf_translate_product_page_strings' ] );
|
8 |
-
add_action( 'tm_before_price_rules', [ $this, 'inf_translate_strings' ] );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function inf_translate_strings() {
|
12 |
-
if ( isset( $_GET['page'] ) && 'tm-global-epo' === $_GET['page'] ) {
|
13 |
-
$this->inf_message( 'Options Form' );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
public function inf_translate_product_page_strings() {
|
18 |
-
$this->inf_message( 'Product' );
|
19 |
-
}
|
20 |
-
|
21 |
-
public function inf_message( $text ) {
|
22 |
-
$message = '<div><p class="icl_cyan_box">';
|
23 |
-
$message .= sprintf( __( 'To translate Extra Options strings please save %1$s and go to the <b><a href="%2$s">String Translation interface</a></b>', 'woocommerce-multilingual' ), esc_html( $text ), admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=wc_extra_product_options' ) );
|
24 |
-
$message .= '</p></div>';
|
25 |
-
|
26 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
27 |
-
echo $message;
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-flatsome.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Flatsome {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'add_action_to_multi_currency_ajax' ] );
|
7 |
-
}
|
8 |
-
|
9 |
-
public function add_action_to_multi_currency_ajax( $actions ) {
|
10 |
-
|
11 |
-
$actions[] = 'ux_quickview';
|
12 |
-
$actions[] = 'flatsome_ajax_search_products';
|
13 |
-
|
14 |
-
return $actions;
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-gravityforms.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_gravityforms {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @param SitePress $sitepress
|
7 |
-
*/
|
8 |
-
private $sitepress;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var woocommerce_wpml
|
12 |
-
*/
|
13 |
-
private $woocommerce_wpml;
|
14 |
-
|
15 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml ) {
|
16 |
-
$this->sitepress = $sitepress;
|
17 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
18 |
-
}
|
19 |
-
|
20 |
-
public function add_hooks() {
|
21 |
-
add_filter( 'gform_formatted_money', [ $this, 'wcml_convert_price' ], 10, 2 );
|
22 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'add_ajax_action' ] );
|
23 |
-
|
24 |
-
add_action( 'wcml_after_duplicate_product_post_meta', [ $this, 'sync_gf_data' ], 10, 2 );
|
25 |
-
}
|
26 |
-
|
27 |
-
public function wcml_convert_price( $formatted, $unformatted ) {
|
28 |
-
if ( ! is_admin() ) {
|
29 |
-
$currency = apply_filters( 'wcml_price_currency', wcml_get_woocommerce_currency_option() );
|
30 |
-
$formatted = strip_tags( wc_price( apply_filters( 'wcml_raw_price_amount', $unformatted ), [ 'currency' => $currency ] ) );
|
31 |
-
}
|
32 |
-
return $formatted;
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
public function add_ajax_action( $actions ) {
|
37 |
-
$actions[] = 'get_updated_price'; // Deprecated from 2.7.
|
38 |
-
$actions[] = 'gforms_get_updated_price';
|
39 |
-
return $actions;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @param int $original_product_id
|
44 |
-
* @param int $trnsl_product_id
|
45 |
-
*/
|
46 |
-
public function sync_gf_data( $original_product_id, $trnsl_product_id ) {
|
47 |
-
// sync only if WCML editor is in use
|
48 |
-
if ( $this->woocommerce_wpml->is_wpml_prior_4_2() ) {
|
49 |
-
$wcml_settings = get_option( '_wcml_settings' );
|
50 |
-
$is_using_tm_editor = $wcml_settings['trnsl_interface'];
|
51 |
-
} else {
|
52 |
-
$is_using_tm_editor = WPML_TM_Post_Edit_TM_Editor_Mode::is_using_tm_editor( $this->sitepress, $original_product_id );
|
53 |
-
}
|
54 |
-
|
55 |
-
if ( $is_using_tm_editor ) {
|
56 |
-
$orig_gf = maybe_unserialize( get_post_meta( $original_product_id, '_gravity_form_data', true ) );
|
57 |
-
|
58 |
-
if ( $orig_gf ) {
|
59 |
-
$trnsl_gf = maybe_unserialize( get_post_meta( $trnsl_product_id, '_gravity_form_data', true ) );
|
60 |
-
|
61 |
-
if ( ! $trnsl_gf ) {
|
62 |
-
update_post_meta( $trnsl_product_id, '_gravity_form_data', $orig_gf );
|
63 |
-
} else {
|
64 |
-
$trnsl_gf['id'] = $orig_gf['id'];
|
65 |
-
$trnsl_gf['display_title'] = $orig_gf['display_title'];
|
66 |
-
$trnsl_gf['display_description'] = $orig_gf['display_description'];
|
67 |
-
$trnsl_gf['disable_woocommerce_price'] = $orig_gf['disable_woocommerce_price'];
|
68 |
-
$trnsl_gf['disable_calculations'] = $orig_gf['disable_calculations'];
|
69 |
-
$trnsl_gf['disable_label_subtotal'] = $orig_gf['disable_label_subtotal'];
|
70 |
-
$trnsl_gf['disable_label_options'] = $orig_gf['disable_label_options'];
|
71 |
-
$trnsl_gf['disable_label_total'] = $orig_gf['disable_label_total'];
|
72 |
-
$trnsl_gf['disable_anchor'] = $orig_gf['disable_anchor'];
|
73 |
-
|
74 |
-
update_post_meta( $trnsl_product_id, '_gravity_form_data', $trnsl_gf );
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-jck-wssv.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_JCK_WSSV {
|
4 |
-
|
5 |
-
private $transient_name = 'jck_wssv_term_counts';
|
6 |
-
|
7 |
-
public function __construct() {
|
8 |
-
|
9 |
-
add_filter( 'pre_transient_' . $this->transient_name, [ $this, 'get_language_specific_transient' ] );
|
10 |
-
add_filter( 'set_transient_' . $this->transient_name, [ $this, 'set_language_specific_transient' ], 10, 2 );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function get_language_specific_transient() {
|
14 |
-
return get_transient( $this->transient_name . '_' . ICL_LANGUAGE_CODE );
|
15 |
-
}
|
16 |
-
|
17 |
-
public function set_language_specific_transient( $value, $expiration ) {
|
18 |
-
|
19 |
-
delete_transient( $this->transient_name );
|
20 |
-
set_transient( $this->transient_name . '_' . ICL_LANGUAGE_CODE, $value, $expiration );
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-klarna-gateway.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Klarna_Gateway {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'ajax_action_needs_multi_currency' ] );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
public function ajax_action_needs_multi_currency( $actions ) {
|
12 |
-
|
13 |
-
$actions[] = 'klarna_checkout_cart_callback_update';
|
14 |
-
$actions[] = 'klarna_checkout_coupons_callback';
|
15 |
-
$actions[] = 'klarna_checkout_remove_coupon_callback';
|
16 |
-
$actions[] = 'klarna_checkout_cart_callback_remove';
|
17 |
-
$actions[] = 'klarna_checkout_shipping_callback';
|
18 |
-
$actions[] = 'kco_iframe_shipping_option_change_cb';
|
19 |
-
$actions[] = 'klarna_checkout_order_note_callback';
|
20 |
-
$actions[] = 'kco_iframe_change_cb';
|
21 |
-
$actions[] = 'kco_iframe_shipping_address_change_v2_cb';
|
22 |
-
$actions[] = 'kco_iframe_shipping_address_change_cb';
|
23 |
-
|
24 |
-
return $actions;
|
25 |
-
}
|
26 |
-
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-litespeed-cache.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_LiteSpeed_Cache {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
// LiteSpeed_Cache_API::vary is available since 2.6.
|
7 |
-
if ( method_exists( 'LiteSpeed_Cache_API', 'v' ) && LiteSpeed_Cache_API::v( '2.6' ) ) {
|
8 |
-
add_filter( 'wcml_client_currency', [ $this, 'apply_client_currency' ] );
|
9 |
-
add_action( 'wcml_set_client_currency', [ $this, 'set_client_currency' ] );
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
-
public function set_client_currency( $currency ) {
|
14 |
-
$this->apply_client_currency( $currency );
|
15 |
-
|
16 |
-
LiteSpeed_Cache_API::force_vary();
|
17 |
-
}
|
18 |
-
|
19 |
-
public function apply_client_currency( $currency ) {
|
20 |
-
LiteSpeed_Cache_API::vary( 'wcml_currency', $currency, wcml_get_woocommerce_currency_option() );
|
21 |
-
|
22 |
-
return $currency;
|
23 |
-
}
|
24 |
-
|
25 |
-
}
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-maxstore.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_MaxStore {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_force_reset_cart_fragments', [ $this, 'wcml_force_reset_cart_fragments' ] );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
public function wcml_force_reset_cart_fragments() {
|
12 |
-
|
13 |
-
return 1;
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-mix-and-match-products.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Mix_and_Match_Products {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
add_action( 'updated_post_meta', [ $this, 'sync_mnm_data' ], 10, 4 );
|
7 |
-
}
|
8 |
-
|
9 |
-
public function sync_mnm_data( $meta_id, $post_id, $meta_key, $meta_value ) {
|
10 |
-
if ( '_mnm_data' !== $meta_key ) {
|
11 |
-
return;
|
12 |
-
}
|
13 |
-
|
14 |
-
global $sitepress, $woocommerce_wpml;
|
15 |
-
|
16 |
-
$post = get_post( $post_id );
|
17 |
-
|
18 |
-
// Skip auto-drafts, skip autosave.
|
19 |
-
if ( 'auto-draft' === $post->post_status || isset( $_POST['autosave'] ) ) {
|
20 |
-
return;
|
21 |
-
}
|
22 |
-
|
23 |
-
if ( 'product' === $post->post_type ) {
|
24 |
-
remove_action( 'updated_post_meta', [ $this, 'sync_mnm_data' ], 10 );
|
25 |
-
|
26 |
-
if ( $woocommerce_wpml->products->is_original_product( $post_id ) ) {
|
27 |
-
$original_product_id = $post_id;
|
28 |
-
} else {
|
29 |
-
$original_product_id = $woocommerce_wpml->products->get_original_product_id( $post_id );
|
30 |
-
}
|
31 |
-
|
32 |
-
$mnm_data = maybe_unserialize( get_post_meta( $original_product_id, '_mnm_data', true ) );
|
33 |
-
$product_trid = $sitepress->get_element_trid( $original_product_id, 'post_product' );
|
34 |
-
$product_translations = $sitepress->get_element_translations( $product_trid, 'post_product' );
|
35 |
-
|
36 |
-
foreach ( $product_translations as $product_translation ) {
|
37 |
-
if ( empty( $product_translation->original ) ) {
|
38 |
-
foreach ( $mnm_data as $key => $mnm_element ) {
|
39 |
-
|
40 |
-
$trnsl_prod = apply_filters( 'translate_object_id', $key, 'product', true, $product_translation->language_code );
|
41 |
-
$mnm_element['product_id'] = $trnsl_prod;
|
42 |
-
$mnm_data[ $trnsl_prod ] = $mnm_element;
|
43 |
-
unset( $mnm_data[ $key ] );
|
44 |
-
}
|
45 |
-
|
46 |
-
update_post_meta( $product_translation->element_id, '_mnm_data', $mnm_data );
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
add_action( 'updated_post_meta', [ $this, 'sync_mnm_data' ], 10, 4 );
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-order-status-manager.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WCML_Order_Status_Manager
|
4 |
-
* compatibility class for WC Order Status Manager plugin.
|
5 |
-
*/
|
6 |
-
class WCML_Order_Status_Manager {
|
7 |
-
/**
|
8 |
-
* WordPress query object.
|
9 |
-
*
|
10 |
-
* @var WP_Query
|
11 |
-
*/
|
12 |
-
private $wp_query;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* WCML_Order_Status_Manager constructor.
|
16 |
-
*
|
17 |
-
* @param WP_Query $wp_query WordPress query object.
|
18 |
-
*/
|
19 |
-
public function __construct( WP_Query $wp_query ) {
|
20 |
-
$this->wp_query = $wp_query;
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Adds WordPress hooks.
|
25 |
-
*/
|
26 |
-
public function add_hooks() {
|
27 |
-
add_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 10, 1 );
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Adds post__not_in to the query arguments.
|
32 |
-
*
|
33 |
-
* @param null $q the parsed query.
|
34 |
-
*/
|
35 |
-
public function pre_get_posts( $q = null ) {
|
36 |
-
if ( isset( $q->query['post_type'] )
|
37 |
-
&& 'wc_order_status' === $q->query['post_type']
|
38 |
-
&& doing_filter( 'woocommerce_register_shop_order_post_statuses' )
|
39 |
-
) {
|
40 |
-
$q->set( 'post__not_in', $this->prepare_post_not_in( $q, $this->get_statuses() ) );
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Queries for all statuses in wp_posts table.
|
46 |
-
*/
|
47 |
-
private function get_statuses() {
|
48 |
-
remove_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 10 );
|
49 |
-
$this->wp_query->query(
|
50 |
-
[
|
51 |
-
'post_type' => 'wc_order_status',
|
52 |
-
'posts_per_page' => -1,
|
53 |
-
'suppress_filters' => false,
|
54 |
-
|
55 |
-
]
|
56 |
-
);
|
57 |
-
add_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 10, 1 );
|
58 |
-
return $this->wp_query->posts;
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Filters out elements not in the current language from query results.
|
63 |
-
*
|
64 |
-
* @param WP_Query $q The WordPress query.
|
65 |
-
* @param void $statuses Posts with post type wc_order_status
|
66 |
-
*
|
67 |
-
* @return array The post__not_in array.
|
68 |
-
*/
|
69 |
-
private function prepare_post_not_in( $q, $statuses ) {
|
70 |
-
$post__not_in = [];
|
71 |
-
|
72 |
-
if ( $statuses ) {
|
73 |
-
$current_language = apply_filters( 'wpml_current_language', null );
|
74 |
-
|
75 |
-
foreach ( $statuses as $status ) {
|
76 |
-
$post_language_details = apply_filters( 'wpml_post_language_details', '', $status->ID );
|
77 |
-
if ( isset( $post_language_details['language_code'] ) ) {
|
78 |
-
if ( $post_language_details['language_code'] !== $current_language ) {
|
79 |
-
$post__not_in[] = $status->ID;
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
$post__not_in_query = isset( $q->query_vars['post__not_in'] ) ? $q->query_vars['post__not_in'] : [];
|
86 |
-
return array_merge( $post__not_in_query, $post__not_in );
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-per-product-shipping.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Per_Product_Shipping {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
|
7 |
-
if ( ! is_admin() ) {
|
8 |
-
|
9 |
-
add_filter( 'woocommerce_per_product_shipping_get_matching_rule_product_id', [ $this, 'original_product_id' ] );
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
}
|
14 |
-
|
15 |
-
public function original_product_id( $product_id ) {
|
16 |
-
global $sitepress;
|
17 |
-
|
18 |
-
$trid = $sitepress->get_element_trid( $product_id, 'post_product' );
|
19 |
-
$translations = $sitepress->get_element_translations( $trid, 'post_product' );
|
20 |
-
foreach ( $translations as $language_code => $translation ) {
|
21 |
-
if ( $translation->original ) {
|
22 |
-
$product_id = $translation->element_id;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
return $product_id;
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-pip.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Pip {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_send_email_order_id', [ $this, 'wcml_send_email_order_id' ] );
|
8 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_pip_currency_symbol' ] );
|
9 |
-
add_filter( 'wcml_filter_currency_position', [ $this, 'filter_pip_currency_position' ] );
|
10 |
-
add_action( 'wc_pip_print', [ $this, 'print_invoice_language' ], 10, 3 );
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
public function wcml_send_email_order_id( $order_id ) {
|
15 |
-
|
16 |
-
$pip_order_id = $this->get_pip_order_id();
|
17 |
-
|
18 |
-
if ( $pip_order_id ) {
|
19 |
-
$order_id = $pip_order_id;
|
20 |
-
}
|
21 |
-
|
22 |
-
return $order_id;
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
public function filter_pip_currency_symbol( $currency_symbol ) {
|
27 |
-
|
28 |
-
remove_filter( 'woocommerce_currency_symbol', [ $this, 'filter_pip_currency_symbol' ] );
|
29 |
-
|
30 |
-
$currency = $this->get_pip_order_currency();
|
31 |
-
|
32 |
-
if ( $currency ) {
|
33 |
-
$currency_symbol = get_woocommerce_currency_symbol( $currency );
|
34 |
-
}
|
35 |
-
|
36 |
-
add_filter( 'woocommerce_currency_symbol', [ $this, 'filter_pip_currency_symbol' ] );
|
37 |
-
|
38 |
-
return $currency_symbol;
|
39 |
-
}
|
40 |
-
|
41 |
-
public function filter_pip_currency_position( $currency ) {
|
42 |
-
|
43 |
-
remove_filter( 'wcml_filter_currency_position', [ $this, 'filter_pip_currency_position' ] );
|
44 |
-
|
45 |
-
$currency = $this->get_pip_order_currency( $currency );
|
46 |
-
|
47 |
-
add_filter( 'wcml_filter_currency_position', [ $this, 'filter_pip_currency_position' ] );
|
48 |
-
|
49 |
-
return $currency;
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
public function get_pip_order_id() {
|
54 |
-
|
55 |
-
$order_id = false;
|
56 |
-
|
57 |
-
if ( isset( $_GET['wc_pip_action'] ) && isset( $_GET['order_id'] ) ) {
|
58 |
-
$order_id = $_GET['order_id'];
|
59 |
-
} elseif (
|
60 |
-
isset( $_POST['action'] ) &&
|
61 |
-
(
|
62 |
-
$_POST['action'] == 'wc_pip_order_send_email' ||
|
63 |
-
$_POST['action'] == 'wc_pip_send_email_packing_list'
|
64 |
-
) &&
|
65 |
-
isset( $_POST['order_id'] )
|
66 |
-
) {
|
67 |
-
$order_id = $_POST['order_id'];
|
68 |
-
}
|
69 |
-
|
70 |
-
return $order_id;
|
71 |
-
}
|
72 |
-
|
73 |
-
public function get_pip_order_currency( $currency = false ) {
|
74 |
-
|
75 |
-
$pip_order_id = $this->get_pip_order_id();
|
76 |
-
|
77 |
-
if ( $pip_order_id && isset( WC()->order_factory ) ) {
|
78 |
-
|
79 |
-
$the_order = WC()->order_factory->get_order( $pip_order_id );
|
80 |
-
|
81 |
-
if ( $the_order ) {
|
82 |
-
$currency = $the_order->get_currency();
|
83 |
-
|
84 |
-
if ( ! $currency && isset( $_COOKIE['_wcml_order_currency'] ) ) {
|
85 |
-
$currency = $_COOKIE['_wcml_order_currency'];
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
return $currency;
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
-
public function print_invoice_language( $type, $order_id, $order_ids ) {
|
95 |
-
|
96 |
-
$order_language = get_post_meta( $order_id, 'wpml_language', true );
|
97 |
-
|
98 |
-
if ( $order_language ) {
|
99 |
-
do_action( 'wpml_switch_language', $order_language );
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-product-addons.php
DELETED
@@ -1,664 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Product_Addons
|
5 |
-
*/
|
6 |
-
class WCML_Product_Addons {
|
7 |
-
|
8 |
-
const TEMPLATE_FOLDER = '/templates/compatibility/';
|
9 |
-
const DIALOG_TEMPLATE = 'product-addons-prices-dialog.twig';
|
10 |
-
const SETTINGS_TEMPLATE = 'product-addons-prices-settings.twig';
|
11 |
-
const PRICE_OPTION_KEY = '_product_addon_prices';
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var SitePress
|
15 |
-
*/
|
16 |
-
public $sitepress;
|
17 |
-
/**
|
18 |
-
* @var woocommerce_wpml
|
19 |
-
*/
|
20 |
-
private $woocommerce_wpml;
|
21 |
-
/**
|
22 |
-
* @var int
|
23 |
-
*/
|
24 |
-
private $multi_currency_mode;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* WCML_Product_Addons constructor.
|
28 |
-
*
|
29 |
-
* @param SitePress $sitepress
|
30 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
31 |
-
*/
|
32 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml ) {
|
33 |
-
$this->sitepress = $sitepress;
|
34 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
35 |
-
$this->multi_currency_mode = $woocommerce_wpml->settings['enable_multi_currency'];
|
36 |
-
}
|
37 |
-
|
38 |
-
public function add_hooks() {
|
39 |
-
|
40 |
-
add_action( 'init', [ $this, 'load_assets' ] );
|
41 |
-
add_filter( 'get_product_addons_product_terms', [ $this, 'addons_product_terms' ] );
|
42 |
-
add_filter( 'get_product_addons_fields', [ $this, 'product_addons_price_filter' ], 10, 2 );
|
43 |
-
|
44 |
-
add_action( 'updated_post_meta', [ $this, 'register_addons_strings' ], 10, 4 );
|
45 |
-
add_action( 'added_post_meta', [ $this, 'register_addons_strings' ], 10, 4 );
|
46 |
-
|
47 |
-
add_action( 'woocommerce-product-addons_panel_start', [ $this, 'show_pointer_info' ] );
|
48 |
-
|
49 |
-
if ( is_admin() ) {
|
50 |
-
|
51 |
-
if ( $this->is_global_addon_edit_page() ) {
|
52 |
-
if ( ! isset( $_GET['edit'] ) ) {
|
53 |
-
add_action( 'admin_notices', [ $this, 'inf_translate_strings' ] );
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
58 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 3 );
|
59 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'addons_update' ], 10, 3 );
|
60 |
-
|
61 |
-
add_action( 'woocommerce_product_data_panels', [ $this, 'show_pointer_info' ] );
|
62 |
-
|
63 |
-
add_filter( 'wcml_do_not_display_custom_fields_for_product', [ $this, 'replace_tm_editor_custom_fields_with_own_sections' ] );
|
64 |
-
|
65 |
-
if ( $this->is_multi_currency_on() ) {
|
66 |
-
add_action( 'woocommerce_product_addons_panel_start', [ $this, 'load_dialog_resources' ] );
|
67 |
-
add_action( 'woocommerce_product_addons_panel_option_row', [ $this, 'dialog_button_after_option_row' ], 10, 4 );
|
68 |
-
add_action( 'woocommerce_product_addons_panel_before_options', [ $this, 'dialog_button_before_options' ], 10, 3 );
|
69 |
-
add_action( 'wcml_before_sync_product', [ $this, 'update_custom_prices_values' ] );
|
70 |
-
add_action( 'woocommerce_product_addons_global_edit_objects', [ $this, 'custom_prices_settings_block' ] );
|
71 |
-
}
|
72 |
-
} else {
|
73 |
-
add_filter( 'get_post_metadata', [ $this, 'translate_addons_strings' ], 10, 4 );
|
74 |
-
}
|
75 |
-
|
76 |
-
add_filter(
|
77 |
-
'wcml_cart_contents_not_changed',
|
78 |
-
[
|
79 |
-
$this,
|
80 |
-
'filter_booking_addon_product_in_cart_contents',
|
81 |
-
],
|
82 |
-
20
|
83 |
-
);
|
84 |
-
|
85 |
-
add_filter(
|
86 |
-
'get_product_addons_global_query_args',
|
87 |
-
[
|
88 |
-
$this,
|
89 |
-
'set_global_ids_in_query_args',
|
90 |
-
]
|
91 |
-
);
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
private function is_global_addon_edit_page() {
|
96 |
-
global $pagenow;
|
97 |
-
|
98 |
-
return 'edit.php' === $pagenow &&
|
99 |
-
isset( $_GET['post_type'] ) &&
|
100 |
-
'product' === $_GET['post_type'] &&
|
101 |
-
isset( $_GET['page'] ) &&
|
102 |
-
( 'global_addons' === $_GET['page'] || 'addons' === $_GET['page'] );
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* @param string $product_id
|
107 |
-
*
|
108 |
-
* @return array
|
109 |
-
*/
|
110 |
-
private function get_product_addons( $product_id ) {
|
111 |
-
return maybe_unserialize( get_post_meta( $product_id, '_product_addons', true ) );
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* @param $meta_id
|
116 |
-
* @param $id
|
117 |
-
* @param $meta_key
|
118 |
-
* @param $addons
|
119 |
-
*/
|
120 |
-
public function register_addons_strings( $meta_id, $id, $meta_key, $addons ) {
|
121 |
-
if ( '_product_addons' === $meta_key && 'global_product_addon' === get_post_type( $id ) ) {
|
122 |
-
$this->update_custom_prices_values( $id );
|
123 |
-
foreach ( $addons as $addon ) {
|
124 |
-
$addon_data = wpml_collect( $addon );
|
125 |
-
$addon_type = $addon_data->get( 'type' );
|
126 |
-
$addon_position = $addon_data->get( 'position' );
|
127 |
-
// register name
|
128 |
-
do_action( 'wpml_register_single_string', 'wc_product_addons_strings', $id . '_addon_' . $addon_type . '_' . $addon_position . '_name', $addon_data->get( 'name' ) );
|
129 |
-
// register description
|
130 |
-
do_action( 'wpml_register_single_string', 'wc_product_addons_strings', $id . '_addon_' . $addon_type . '_' . $addon_position . '_description', $addon_data->get( 'description' ) );
|
131 |
-
// register options labels
|
132 |
-
if ( $addon_data->offsetExists( 'options' ) ) {
|
133 |
-
foreach ( $addon_data->get( 'options' ) as $key => $option ) {
|
134 |
-
do_action( 'wpml_register_single_string', 'wc_product_addons_strings', $id . '_addon_' . $addon_type . '_' . $addon_position . '_option_label_' . $key, wpml_collect( $option )->get( 'label' ) );
|
135 |
-
}
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* @param $null
|
143 |
-
* @param $object_id
|
144 |
-
* @param $meta_key
|
145 |
-
* @param $single
|
146 |
-
*
|
147 |
-
* @return array
|
148 |
-
*/
|
149 |
-
public function translate_addons_strings( $null, $object_id, $meta_key, $single ) {
|
150 |
-
|
151 |
-
if ( '_product_addons' === $meta_key && 'global_product_addon' === get_post_type( $object_id ) ) {
|
152 |
-
|
153 |
-
remove_filter( 'get_post_metadata', [ $this, 'translate_addons_strings' ], 10 );
|
154 |
-
$addons = get_post_meta( $object_id, $meta_key, true );
|
155 |
-
add_filter( 'get_post_metadata', [ $this, 'translate_addons_strings' ], 10, 4 );
|
156 |
-
|
157 |
-
if ( is_array( $addons ) ) {
|
158 |
-
foreach ( $addons as $key => $addon ) {
|
159 |
-
$addon_data = wpml_collect( $addon );
|
160 |
-
$addon_type = $addon_data->get( 'type' );
|
161 |
-
$addon_position = $addon_data->get( 'position' );
|
162 |
-
// register name
|
163 |
-
$addons[ $key ]['name'] = apply_filters( 'wpml_translate_single_string', $addon_data->get( 'name' ), 'wc_product_addons_strings', $object_id . '_addon_' . $addon_type . '_' . $addon_position . '_name' );
|
164 |
-
// register description
|
165 |
-
$addons[ $key ]['description'] = apply_filters( 'wpml_translate_single_string', $addon_data->get( 'description' ), 'wc_product_addons_strings', $object_id . '_addon_' . $addon_type . '_' . $addon_position . '_description' );
|
166 |
-
// register options labels
|
167 |
-
if ( $addon_data->offsetExists( 'options' ) ) {
|
168 |
-
foreach ( $addon['options'] as $opt_key => $option ) {
|
169 |
-
$addons[ $key ]['options'][ $opt_key ]['label'] = apply_filters( 'wpml_translate_single_string', wpml_collect( $option )->get( 'label' ), 'wc_product_addons_strings', $object_id . '_addon_' . $addon_type . '_' . $addon_position . '_option_label_' . $opt_key );
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
return [ 0 => $addons ];
|
176 |
-
}
|
177 |
-
|
178 |
-
return $null;
|
179 |
-
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* @param $addons
|
184 |
-
* @param $post_id
|
185 |
-
*
|
186 |
-
* @return mixed
|
187 |
-
*/
|
188 |
-
public function product_addons_price_filter( $addons, $post_id ) {
|
189 |
-
|
190 |
-
if ( $this->is_multi_currency_on() ) {
|
191 |
-
|
192 |
-
foreach ( $addons as $add_id => $addon ) {
|
193 |
-
|
194 |
-
$addon_data = wpml_collect( $addon );
|
195 |
-
|
196 |
-
if ( $addon_data->offsetExists( 'price' ) && $addon_data->get( 'price' ) ) {
|
197 |
-
$addons[ $add_id ]['price'] = $this->converted_addon_price( $addon, $post_id );
|
198 |
-
}
|
199 |
-
|
200 |
-
if ( $addon_data->offsetExists( 'options' ) ) {
|
201 |
-
foreach ( $addon_data->get( 'options' ) as $key => $option ) {
|
202 |
-
$addons[ $add_id ]['options'][ $key ]['price'] = $this->converted_addon_price( $option, $post_id );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
return $addons;
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* @param array $addon
|
213 |
-
* @param int $post_id
|
214 |
-
*
|
215 |
-
* @return string
|
216 |
-
*/
|
217 |
-
private function converted_addon_price( $addon, $post_id ) {
|
218 |
-
|
219 |
-
$addonData = wpml_collect( $addon );
|
220 |
-
|
221 |
-
$is_custom_prices_on = $this->is_product_custom_prices_on( $post_id );
|
222 |
-
$field = 'price_' . $this->woocommerce_wpml->multi_currency->get_client_currency();
|
223 |
-
|
224 |
-
if (
|
225 |
-
$is_custom_prices_on &&
|
226 |
-
$addonData->get( $field )
|
227 |
-
) {
|
228 |
-
return $addonData->get( $field );
|
229 |
-
}
|
230 |
-
|
231 |
-
if ( wpml_collect( [ 'flat_fee', 'quantity_based' ] )->contains( $addonData->get( 'price_type' ) ) ) {
|
232 |
-
return apply_filters( 'wcml_raw_price_amount', $addonData->get( 'price' ) );
|
233 |
-
}
|
234 |
-
|
235 |
-
return $addonData->get( 'price' );
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* @param $product_terms
|
240 |
-
*
|
241 |
-
* @return array
|
242 |
-
*/
|
243 |
-
public function addons_product_terms( $product_terms ) {
|
244 |
-
foreach ( $product_terms as $key => $product_term ) {
|
245 |
-
$product_terms[ $key ] = apply_filters( 'translate_object_id', $product_term, 'product_cat', true, $this->sitepress->get_default_language() );
|
246 |
-
}
|
247 |
-
|
248 |
-
return $product_terms;
|
249 |
-
}
|
250 |
-
|
251 |
-
public function inf_translate_strings() {
|
252 |
-
|
253 |
-
$pointer_ui = new WCML_Pointer_UI(
|
254 |
-
sprintf( __( 'You can translate strings related to global add-ons on the %1$sWPML String Translation page%2$s. Use the search on the top of that page to find the strings.', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=wc_product_addons_strings' ) . '">', '</a>' ),
|
255 |
-
WCML_Tracking_Link::getWcmlProductAddonsDoc(),
|
256 |
-
'wpbody-content .woocommerce>h2'
|
257 |
-
);
|
258 |
-
|
259 |
-
$pointer_ui->show();
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* @param $obj
|
264 |
-
* @param $product_id
|
265 |
-
* @param $data
|
266 |
-
*/
|
267 |
-
public function custom_box_html( $obj, $product_id, $data ) {
|
268 |
-
|
269 |
-
$product_addons = $this->get_product_addons( $product_id );
|
270 |
-
|
271 |
-
if ( ! empty( $product_addons ) ) {
|
272 |
-
foreach ( $product_addons as $addon_id => $product_addon ) {
|
273 |
-
$addon_data = wpml_collect( $product_addon );
|
274 |
-
|
275 |
-
$addons_section = new WPML_Editor_UI_Field_Section( sprintf( __( 'Product Add-ons Group "%s"', 'woocommerce-multilingual' ), $addon_data->get( 'name' ) ) );
|
276 |
-
|
277 |
-
$group = new WPML_Editor_UI_Field_Group( '', true );
|
278 |
-
$addon_field = new WPML_Editor_UI_Single_Line_Field( 'addon_' . $addon_id . '_name', __( 'Name', 'woocommerce-multilingual' ), $data, false );
|
279 |
-
$group->add_field( $addon_field );
|
280 |
-
$addon_field = new WPML_Editor_UI_Single_Line_Field( 'addon_' . $addon_id . '_description', __( 'Description', 'woocommerce-multilingual' ), $data, false );
|
281 |
-
$group->add_field( $addon_field );
|
282 |
-
|
283 |
-
$addons_section->add_field( $group );
|
284 |
-
|
285 |
-
if ( $addon_data->offsetExists( 'options' ) && $addon_data->get( 'options' ) ) {
|
286 |
-
|
287 |
-
$labels_group = new WPML_Editor_UI_Field_Group( __( 'Options', 'woocommerce-multilingual' ), true );
|
288 |
-
|
289 |
-
foreach ( $addon_data->get( 'options' ) as $option_id => $option ) {
|
290 |
-
$option_label_field = new WPML_Editor_UI_Single_Line_Field( 'addon_' . $addon_id . '_option_' . $option_id . '_label', __( 'Label', 'woocommerce-multilingual' ), $data, false );
|
291 |
-
$labels_group->add_field( $option_label_field );
|
292 |
-
}
|
293 |
-
$addons_section->add_field( $labels_group );
|
294 |
-
}
|
295 |
-
$obj->add_field( $addons_section );
|
296 |
-
}
|
297 |
-
}
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* @param $data
|
302 |
-
* @param $product_id
|
303 |
-
* @param $translation
|
304 |
-
*
|
305 |
-
* @return mixed
|
306 |
-
*/
|
307 |
-
public function custom_box_html_data( $data, $product_id, $translation ) {
|
308 |
-
|
309 |
-
$product_addons = $this->get_product_addons( $product_id );
|
310 |
-
|
311 |
-
if ( ! empty( $product_addons ) ) {
|
312 |
-
foreach ( $product_addons as $addon_id => $product_addon ) {
|
313 |
-
$addon_data = wpml_collect( $product_addon );
|
314 |
-
$data[ 'addon_' . $addon_id . '_name' ] = [ 'original' => $addon_data->get( 'name' ) ];
|
315 |
-
$data[ 'addon_' . $addon_id . '_description' ] = [ 'original' => $addon_data->get( 'description' ) ];
|
316 |
-
if ( $addon_data->offsetExists( 'options' ) && $addon_data->get( 'options' ) ) {
|
317 |
-
foreach ( $addon_data->get( 'options' ) as $option_id => $option ) {
|
318 |
-
$data[ 'addon_' . $addon_id . '_option_' . $option_id . '_label' ] = [ 'original' => wpml_collect( $option )->get( 'label' ) ];
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
if ( $translation ) {
|
324 |
-
$translated_product_addons = $this->get_product_addons( $translation->ID );
|
325 |
-
if ( ! empty( $translated_product_addons ) ) {
|
326 |
-
foreach ( $translated_product_addons as $addon_id => $transalted_product_addon ) {
|
327 |
-
$translated_addon_data = wpml_collect( $transalted_product_addon );
|
328 |
-
$data[ 'addon_' . $addon_id . '_name' ]['translation'] = $translated_addon_data->get( 'name' );
|
329 |
-
$data[ 'addon_' . $addon_id . '_description' ]['translation'] = $translated_addon_data->get( 'description' );
|
330 |
-
if ( $translated_addon_data->offsetExists( 'options' ) && $translated_addon_data->get( 'options' ) ) {
|
331 |
-
foreach ( $translated_addon_data->get( 'options' ) as $option_id => $option ) {
|
332 |
-
$data[ 'addon_' . $addon_id . '_option_' . $option_id . '_label' ]['translation'] = wpml_collect( $option )->get( 'label' );
|
333 |
-
}
|
334 |
-
}
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
|
340 |
-
return $data;
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* @param $original_product_id
|
345 |
-
* @param $product_id
|
346 |
-
* @param $data
|
347 |
-
*/
|
348 |
-
public function addons_update( $original_product_id, $product_id, $data ) {
|
349 |
-
|
350 |
-
$product_addons = $this->get_product_addons( $original_product_id );
|
351 |
-
|
352 |
-
if ( ! empty( $product_addons ) ) {
|
353 |
-
|
354 |
-
foreach ( $product_addons as $addon_id => $product_addon ) {
|
355 |
-
$addon_data = wpml_collect( $product_addon );
|
356 |
-
$product_addons[ $addon_id ]['name'] = $data[ md5( 'addon_' . $addon_id . '_name' ) ];
|
357 |
-
$product_addons[ $addon_id ]['description'] = $data[ md5( 'addon_' . $addon_id . '_description' ) ];
|
358 |
-
|
359 |
-
if ( $addon_data->offsetExists( 'options' ) && $addon_data->get( 'options' ) ) {
|
360 |
-
foreach ( $addon_data->get( 'options' ) as $option_id => $option ) {
|
361 |
-
$product_addons[ $addon_id ]['options'][ $option_id ]['label'] = $data[ md5( 'addon_' . $addon_id . '_option_' . $option_id . '_label' ) ];
|
362 |
-
}
|
363 |
-
}
|
364 |
-
}
|
365 |
-
}
|
366 |
-
|
367 |
-
update_post_meta( $product_id, '_product_addons', $product_addons );
|
368 |
-
}
|
369 |
-
|
370 |
-
public function show_pointer_info() {
|
371 |
-
|
372 |
-
$pointer_ui = new WCML_Pointer_UI(
|
373 |
-
sprintf( __( 'You can translate the Group Name, Group Description and every Option Label of your product add-on on the %1$sWooCommerce product translation page%2$s', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=wpml-wcml' ) . '">', '</a>' ),
|
374 |
-
WCML_Tracking_Link::getWcmlProductAddonsDoc(),
|
375 |
-
'product_addons_data>p'
|
376 |
-
);
|
377 |
-
|
378 |
-
$pointer_ui->show();
|
379 |
-
}
|
380 |
-
|
381 |
-
public function replace_tm_editor_custom_fields_with_own_sections( $fields ) {
|
382 |
-
$fields[] = '_product_addons';
|
383 |
-
|
384 |
-
return $fields;
|
385 |
-
}
|
386 |
-
|
387 |
-
// special case for WC Bookings plugin - need add addon cost after re-calculating booking costs #wcml-1877
|
388 |
-
public function filter_booking_addon_product_in_cart_contents( $cart_item ) {
|
389 |
-
|
390 |
-
$is_booking_product_with_addons = $cart_item['data'] instanceof WC_Product_Booking && isset( $cart_item['addons'] );
|
391 |
-
|
392 |
-
if ( $this->is_multi_currency_on() && $is_booking_product_with_addons ) {
|
393 |
-
$cost = $cart_item['data']->get_price();
|
394 |
-
|
395 |
-
foreach ( $cart_item['addons'] as $addon ) {
|
396 |
-
$cost += $addon['price'];
|
397 |
-
}
|
398 |
-
|
399 |
-
$cart_item['data']->set_price( $cost );
|
400 |
-
}
|
401 |
-
|
402 |
-
return $cart_item;
|
403 |
-
}
|
404 |
-
|
405 |
-
public function set_global_ids_in_query_args( $args ) {
|
406 |
-
|
407 |
-
if ( ! is_archive() ) {
|
408 |
-
|
409 |
-
remove_filter( 'get_terms_args', [ $this->sitepress, 'get_terms_args_filter' ], 10 );
|
410 |
-
remove_filter( 'get_term', [ $this->sitepress, 'get_term_adjust_id' ], 1 );
|
411 |
-
remove_filter( 'terms_clauses', [ $this->sitepress, 'terms_clauses' ], 10 );
|
412 |
-
|
413 |
-
$matched_addons_ids = wp_list_pluck( get_posts( $args ), 'ID' );
|
414 |
-
|
415 |
-
if ( $matched_addons_ids ) {
|
416 |
-
$args['include'] = $matched_addons_ids;
|
417 |
-
unset( $args['tax_query'] );
|
418 |
-
}
|
419 |
-
|
420 |
-
add_filter( 'get_terms_args', [ $this->sitepress, 'get_terms_args_filter' ], 10, 2 );
|
421 |
-
add_filter( 'get_term', [ $this->sitepress, 'get_term_adjust_id' ], 1 );
|
422 |
-
add_filter( 'terms_clauses', [ $this->sitepress, 'terms_clauses' ], 10, 3 );
|
423 |
-
}
|
424 |
-
|
425 |
-
return $args;
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* @return bool
|
430 |
-
*/
|
431 |
-
private function is_multi_currency_on() {
|
432 |
-
return $this->multi_currency_mode === $this->sitepress->get_wp_api()->constant( 'WCML_MULTI_CURRENCIES_INDEPENDENT' );
|
433 |
-
}
|
434 |
-
|
435 |
-
public function load_dialog_resources() {
|
436 |
-
wp_enqueue_script( 'wcml-dialogs', WCML_PLUGIN_URL . '/res/js/dialogs' . WCML_JS_MIN . '.js', [ 'jquery-ui-dialog', 'underscore' ], WCML_VERSION );
|
437 |
-
}
|
438 |
-
|
439 |
-
/**
|
440 |
-
* @param WP_Post|null $product
|
441 |
-
* @param array $product_addons
|
442 |
-
* @param int $loop
|
443 |
-
* @param array $option
|
444 |
-
*/
|
445 |
-
public function dialog_button_after_option_row( $product, $product_addons, $loop, $option ) {
|
446 |
-
if ( $option ) {
|
447 |
-
$this->render_edit_price_element( $this->get_prices_dialog_model( $product_addons, $option, $loop, $this->is_product_custom_prices_on( $product ? $product->ID : false ) ) );
|
448 |
-
}
|
449 |
-
|
450 |
-
}
|
451 |
-
|
452 |
-
/**
|
453 |
-
* @param WP_Post|null $product
|
454 |
-
* @param array $product_addons
|
455 |
-
* @param int $loop
|
456 |
-
*/
|
457 |
-
public function dialog_button_before_options( $product, $product_addons, $loop ) {
|
458 |
-
$this->render_edit_price_element( $this->get_prices_dialog_model( [], $product_addons, $loop, $this->is_product_custom_prices_on( $product ? $product->ID : false ) ) );
|
459 |
-
}
|
460 |
-
|
461 |
-
/**
|
462 |
-
* @param array $model
|
463 |
-
*/
|
464 |
-
private function render_edit_price_element( $model ) {
|
465 |
-
$twig_loader = $this->get_twig_loader();
|
466 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
467 |
-
echo $twig_loader->get_template()->show( $model, self::DIALOG_TEMPLATE );
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* @return array
|
472 |
-
*/
|
473 |
-
private function get_one_price_types() {
|
474 |
-
|
475 |
-
return [
|
476 |
-
'custom_text',
|
477 |
-
'custom_textarea',
|
478 |
-
'file_upload',
|
479 |
-
'input_multiplier',
|
480 |
-
];
|
481 |
-
}
|
482 |
-
|
483 |
-
/**
|
484 |
-
* @return WPML_Twig_Template_Loader
|
485 |
-
*/
|
486 |
-
private function get_twig_loader() {
|
487 |
-
return new WPML_Twig_Template_Loader( [ $this->sitepress->get_wp_api()->constant( 'WCML_PLUGIN_PATH' ) . self::TEMPLATE_FOLDER ] );
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* @param int|false $product
|
492 |
-
*
|
493 |
-
* @return mixed
|
494 |
-
*/
|
495 |
-
private function is_product_custom_prices_on( $product_id ) {
|
496 |
-
|
497 |
-
if ( $product_id ) {
|
498 |
-
return get_post_meta( $product_id, '_wcml_custom_prices_status', true );
|
499 |
-
}
|
500 |
-
|
501 |
-
if ( $this->is_global_addon_edit_page() ) {
|
502 |
-
return $this->get_global_addon_prices_status();
|
503 |
-
}
|
504 |
-
|
505 |
-
return false;
|
506 |
-
}
|
507 |
-
|
508 |
-
/**
|
509 |
-
* @return bool|mixed
|
510 |
-
*/
|
511 |
-
private function get_global_addon_prices_status() {
|
512 |
-
|
513 |
-
if ( isset( $_GET['edit'] ) ) {
|
514 |
-
return get_post_meta( $_GET['edit'], '_wcml_custom_prices_status', true );
|
515 |
-
} elseif ( isset( $_POST['_wcml_custom_prices'] ) ) {
|
516 |
-
return $_POST['_wcml_custom_prices'];
|
517 |
-
}
|
518 |
-
|
519 |
-
return false;
|
520 |
-
}
|
521 |
-
|
522 |
-
public function load_assets() {
|
523 |
-
global $pagenow;
|
524 |
-
|
525 |
-
$is_product_page = 'post.php' === $pagenow && isset( $_GET['post'] );
|
526 |
-
$is_product_new_page = 'post-new.php' === $pagenow && isset( $_GET['post_type'] ) && 'product' === $_GET['post_type'];
|
527 |
-
|
528 |
-
if ( $is_product_page || $is_product_new_page || $this->is_global_addon_edit_page() ) {
|
529 |
-
wp_enqueue_script( 'wcml-product-addons', WCML_PLUGIN_URL . '/compatibility/res/js/wcml-product-addons' . WCML_JS_MIN . '.js', [ 'jquery' ], WCML_VERSION );
|
530 |
-
wp_enqueue_style( 'wcml-product-addons', WCML_PLUGIN_URL . '/compatibility/res/css/wcml-product-addons.css', '', WCML_VERSION );
|
531 |
-
}
|
532 |
-
|
533 |
-
}
|
534 |
-
|
535 |
-
/**
|
536 |
-
* @param string $product_id
|
537 |
-
*/
|
538 |
-
public function update_custom_prices_values( $product_id ) {
|
539 |
-
|
540 |
-
if ( $this->is_multi_currency_on() ) {
|
541 |
-
$this->save_global_addon_prices_setting( $product_id );
|
542 |
-
$product_addons = $this->get_product_addons( $product_id );
|
543 |
-
|
544 |
-
if ( $product_addons ) {
|
545 |
-
$active_currencies = $this->woocommerce_wpml->multi_currency->get_currencies();
|
546 |
-
|
547 |
-
foreach ( $product_addons as $addon_key => $product_addon ) {
|
548 |
-
|
549 |
-
foreach ( $active_currencies as $code => $currency ) {
|
550 |
-
$price_option_key = self::PRICE_OPTION_KEY;
|
551 |
-
|
552 |
-
if ( in_array( $product_addon['type'], $this->get_one_price_types() ) ) {
|
553 |
-
$product_addons = $this->update_single_option_prices( $product_addons, $price_option_key, $addon_key, $code );
|
554 |
-
} else {
|
555 |
-
$product_addons = $this->update_multiple_options_prices( $product_addons, $price_option_key, $addon_key, $code );
|
556 |
-
}
|
557 |
-
}
|
558 |
-
}
|
559 |
-
|
560 |
-
update_post_meta( $product_id, '_product_addons', $product_addons );
|
561 |
-
}
|
562 |
-
}
|
563 |
-
}
|
564 |
-
|
565 |
-
/**
|
566 |
-
* @param array $product_addons
|
567 |
-
* @param string $price_option_key
|
568 |
-
* @param string $addon_key
|
569 |
-
* @param string $code
|
570 |
-
*
|
571 |
-
* @return array
|
572 |
-
*/
|
573 |
-
private function update_single_option_prices( $product_addons, $price_option_key, $addon_key, $code ) {
|
574 |
-
if ( isset( $_POST[ $price_option_key ][ $addon_key ][ 'price_' . $code ][0] ) ) {
|
575 |
-
$product_addons[ $addon_key ][ 'price_' . $code ] = wc_format_decimal( $_POST[ $price_option_key ][ $addon_key ][ 'price_' . $code ][0] );
|
576 |
-
}
|
577 |
-
|
578 |
-
return $product_addons;
|
579 |
-
}
|
580 |
-
|
581 |
-
/**
|
582 |
-
* @param array $product_addons
|
583 |
-
* @param string $price_option_key
|
584 |
-
* @param string $addon_key
|
585 |
-
* @param string $code
|
586 |
-
*
|
587 |
-
* @return array
|
588 |
-
*/
|
589 |
-
private function update_multiple_options_prices( $product_addons, $price_option_key, $addon_key, $code ) {
|
590 |
-
|
591 |
-
$addon_data = wpml_collect( $product_addons[ $addon_key ] );
|
592 |
-
|
593 |
-
if ( $addon_data->offsetExists( 'options' ) ) {
|
594 |
-
foreach ( $addon_data->get( 'options' ) as $option_key => $option ) {
|
595 |
-
if ( isset( $_POST[ $price_option_key ][ $addon_key ][ 'price_' . $code ][ $option_key ] ) ) {
|
596 |
-
$product_addons[ $addon_key ]['options'][ $option_key ][ 'price_' . $code ] = wc_format_decimal( $_POST[ $price_option_key ][ $addon_key ][ 'price_' . $code ][ $option_key ] );
|
597 |
-
}
|
598 |
-
}
|
599 |
-
}
|
600 |
-
|
601 |
-
return $product_addons;
|
602 |
-
}
|
603 |
-
|
604 |
-
/**
|
605 |
-
* @param array $product_addons
|
606 |
-
* @param array $option
|
607 |
-
* @param int $loop
|
608 |
-
* @param string|bool $custom_prices_on
|
609 |
-
*
|
610 |
-
* @return array
|
611 |
-
*/
|
612 |
-
private function get_prices_dialog_model( $product_addons, $option, $loop, $custom_prices_on ) {
|
613 |
-
|
614 |
-
$label = isset( $option['label'] ) ? $option['label'] : $option['name'];
|
615 |
-
|
616 |
-
return [
|
617 |
-
'strings' => [
|
618 |
-
'dialog_title' => __( 'Multi-currency settings', 'woocommerce-multilingual' ),
|
619 |
-
'description' => sprintf( __( 'Here you can set different prices for the %s in multiple currencies:', 'woocommerce-multilingual' ), '<strong>' . $label . '</strong>' ),
|
620 |
-
'apply' => __( 'Apply', 'woocommerce-multilingual' ),
|
621 |
-
'cancel' => __( 'Cancel', 'woocommerce-multilingual' ),
|
622 |
-
],
|
623 |
-
'custom_prices_on' => $custom_prices_on,
|
624 |
-
'dialog_id' => '_product_addon_option_' . md5( uniqid( $loop . $label ) ),
|
625 |
-
'option_id' => isset( $product_addons[ $loop ]['options'] ) ? array_search( $option, $product_addons[ $loop ]['options'] ) : '',
|
626 |
-
'addon_id' => $loop,
|
627 |
-
'option_details' => $option,
|
628 |
-
'default_currency' => wcml_get_woocommerce_currency_option(),
|
629 |
-
'active_currencies' => $this->woocommerce_wpml->multi_currency->get_currencies(),
|
630 |
-
];
|
631 |
-
}
|
632 |
-
|
633 |
-
public function custom_prices_settings_block() {
|
634 |
-
$twig_loader = $this->get_twig_loader();
|
635 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
636 |
-
echo $twig_loader->get_template()->show( $this->get_custom_prices_settings_model(), self::SETTINGS_TEMPLATE );
|
637 |
-
}
|
638 |
-
|
639 |
-
private function get_custom_prices_settings_model() {
|
640 |
-
return [
|
641 |
-
'strings' => [
|
642 |
-
'label' => __( 'Multi-currency settings', 'woocommerce-multilingual' ),
|
643 |
-
'auto' => __( 'Calculate prices in other currencies automatically', 'woocommerce-multilingual' ),
|
644 |
-
'manually' => __( 'Set prices in other currencies manually', 'woocommerce-multilingual' ),
|
645 |
-
],
|
646 |
-
'custom_prices_on' => $this->get_global_addon_prices_status(),
|
647 |
-
'nonce' => wp_create_nonce( 'wcml_save_custom_prices' ),
|
648 |
-
];
|
649 |
-
}
|
650 |
-
|
651 |
-
/**
|
652 |
-
* @param int $global_addon_id
|
653 |
-
*/
|
654 |
-
private function save_global_addon_prices_setting( $global_addon_id ) {
|
655 |
-
|
656 |
-
$nonce = filter_var( isset( $_POST['_wcml_custom_prices_nonce'] ) ? $_POST['_wcml_custom_prices_nonce'] : '', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
657 |
-
|
658 |
-
if ( isset( $_POST['_wcml_custom_prices'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_prices' ) ) {
|
659 |
-
update_post_meta( $global_addon_id, '_wcml_custom_prices_status', $_POST['_wcml_custom_prices'] );
|
660 |
-
}
|
661 |
-
|
662 |
-
}
|
663 |
-
|
664 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-product-bundles.php
DELETED
@@ -1,907 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Obj;
|
4 |
-
|
5 |
-
class WCML_Product_Bundles {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @var WPML_Element_Translation_Package
|
9 |
-
*/
|
10 |
-
public $tp;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* @var SitePress
|
14 |
-
*/
|
15 |
-
private $sitepress;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var woocommerce_wpml
|
19 |
-
*/
|
20 |
-
private $woocommerce_wpml;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var WCML_WC_Product_Bundles_Items
|
24 |
-
*/
|
25 |
-
private $product_bundles_items;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var wpdb
|
29 |
-
*/
|
30 |
-
private $wpdb;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* WCML_Product_Bundles constructor.
|
34 |
-
*/
|
35 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, $product_bundles_items, wpdb $wpdb ) {
|
36 |
-
|
37 |
-
$this->sitepress = $sitepress;
|
38 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
39 |
-
$this->product_bundles_items = $product_bundles_items;
|
40 |
-
$this->wpdb = $wpdb;
|
41 |
-
|
42 |
-
add_action( 'woocommerce_get_cart_item_from_session', [ $this, 'resync_bundle' ], 5, 3 );
|
43 |
-
add_filter( 'woocommerce_cart_loaded_from_session', [ $this, 'resync_bundle_clean' ], 10 );
|
44 |
-
add_action( 'wpml_translation_job_saved', [ $this, 'save_bundle_data_translation' ], 10, 3 );
|
45 |
-
|
46 |
-
if ( is_admin() ) {
|
47 |
-
$this->tp = new WPML_Element_Translation_Package();
|
48 |
-
|
49 |
-
add_filter(
|
50 |
-
'wpml_tm_translation_job_data',
|
51 |
-
[
|
52 |
-
$this,
|
53 |
-
'append_bundle_data_translation_package',
|
54 |
-
],
|
55 |
-
10,
|
56 |
-
2
|
57 |
-
);
|
58 |
-
|
59 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
60 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 4 );
|
61 |
-
|
62 |
-
add_action( 'wcml_after_duplicate_product_post_meta', [ $this, 'sync_bundled_ids' ], 10, 2 );
|
63 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'bundle_update' ], 10, 4 );
|
64 |
-
|
65 |
-
add_action( 'wp_insert_post', [ $this, 'sync_product_bundle_meta_with_translations' ], 10 );
|
66 |
-
|
67 |
-
add_filter( 'woocommerce_json_search_found_products', [ $this, 'woocommerce_json_search_filter_found_products' ] );
|
68 |
-
|
69 |
-
add_action( 'woocommerce_before_delete_bundled_item', [ $this, 'delete_bundled_item_relationship' ] );
|
70 |
-
}
|
71 |
-
|
72 |
-
// product bundle using separate custom fields for prices.
|
73 |
-
if ( wcml_is_multi_currency_on() ) {
|
74 |
-
add_filter( 'wcml_price_custom_fields_filtered', [ $this, 'get_price_custom_fields' ], 10, 2 );
|
75 |
-
add_filter( 'wcml_update_custom_prices_values', [ $this, 'update_bundles_custom_prices_values' ], 10, 2 );
|
76 |
-
add_filter( 'wcml_after_save_custom_prices', [ $this, 'update_bundles_base_price' ], 10, 4 );
|
77 |
-
}
|
78 |
-
|
79 |
-
add_action( 'init', [ $this, 'upgrade_bundles_items_relationships' ] );
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
private function get_product_bundle_data( $bundle_id ) {
|
84 |
-
$product_bundle_data = [];
|
85 |
-
|
86 |
-
$bundle_items = $this->product_bundles_items->get_items( $bundle_id );
|
87 |
-
foreach ( $bundle_items as $key => $bundle_item ) {
|
88 |
-
$product_bundle_data[ $bundle_item->item_id ] = $this->product_bundles_items->get_item_data( $bundle_item );
|
89 |
-
}
|
90 |
-
|
91 |
-
return $product_bundle_data;
|
92 |
-
}
|
93 |
-
|
94 |
-
private function save_product_bundle_data( $bundle_id, $product_bundle_data ) {
|
95 |
-
|
96 |
-
$bundle_items = $this->product_bundles_items->get_items( $bundle_id );
|
97 |
-
|
98 |
-
foreach ( $bundle_items as $item_id => $bundle_item ) {
|
99 |
-
$bundled_item_data = $this->product_bundles_items->get_item_data_object( $item_id );
|
100 |
-
|
101 |
-
foreach ( (array) Obj::prop( $item_id, (array) $product_bundle_data ) as $key => $value ) {
|
102 |
-
$this->product_bundles_items->update_item_meta( $bundled_item_data, $key, $value );
|
103 |
-
}
|
104 |
-
$this->product_bundles_items->save_item_meta( $bundled_item_data );
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
public function sync_product_bundle_meta( $bundle_id, $translated_bundle_id ) {
|
110 |
-
|
111 |
-
$bundle_items = $this->product_bundles_items->get_items( $bundle_id );
|
112 |
-
$fields_to_sync = [
|
113 |
-
'optional',
|
114 |
-
'stock_status',
|
115 |
-
'max_stock',
|
116 |
-
'quantity_min',
|
117 |
-
'quantity_max',
|
118 |
-
'shipped_individually',
|
119 |
-
'priced_individually',
|
120 |
-
'single_product_visibility',
|
121 |
-
'cart_visibility',
|
122 |
-
'order_visibility',
|
123 |
-
'single_product_price_visibility',
|
124 |
-
'cart_price_visibility',
|
125 |
-
'order_price_visibility',
|
126 |
-
'discount',
|
127 |
-
'override_variations',
|
128 |
-
'override_default_variation_attributes',
|
129 |
-
'hide_filtered_variations',
|
130 |
-
];
|
131 |
-
|
132 |
-
$target_lang = $this->sitepress->get_language_for_element( $translated_bundle_id, 'post_product' );
|
133 |
-
$translated_item_ids = [];
|
134 |
-
foreach ( $bundle_items as $item_id => $bundle_item ) {
|
135 |
-
|
136 |
-
$item_meta = $this->product_bundles_items->get_item_data( $bundle_item );
|
137 |
-
$translated_product_id = apply_filters( 'translate_object_id', $item_meta['product_id'], get_post_type( $item_meta['product_id'] ), false, $target_lang );
|
138 |
-
|
139 |
-
if ( $translated_product_id ) {
|
140 |
-
$translated_item_id = $this->get_item_id_for_language( $item_id, $target_lang );
|
141 |
-
$translated_item_ids[] = $translated_item_id;
|
142 |
-
|
143 |
-
$translated_item = $this->product_bundles_items->get_item_data_object( $translated_item_id );
|
144 |
-
foreach ( $fields_to_sync as $key ) {
|
145 |
-
if ( isset( $item_meta[ $key ] ) ) {
|
146 |
-
$this->product_bundles_items->update_item_meta( $translated_item, $key, $item_meta[ $key ] );
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
if ( isset( $item_meta['allowed_variations'] ) ) {
|
151 |
-
if ( is_array( $item_meta['allowed_variations'] ) ) {
|
152 |
-
$allowed_variations =
|
153 |
-
$this->translate_allowed_variations( $item_meta['allowed_variations'], $target_lang );
|
154 |
-
$this->product_bundles_items->update_item_meta( $translated_item, 'allowed_variations', $allowed_variations );
|
155 |
-
} else {
|
156 |
-
$this->product_bundles_items->update_item_meta( $translated_item, 'allowed_variations', $item_meta['allowed_variations'] );
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
if ( isset( $item_meta['default_variation_attributes'] ) ) {
|
161 |
-
$default_variation_attributes = $this->translate_default_variation_attributes( $item_meta['default_variation_attributes'], $target_lang, $item_meta['product_id'], $translated_product_id );
|
162 |
-
$this->product_bundles_items->update_item_meta( $translated_item, 'default_variation_attributes', $default_variation_attributes );
|
163 |
-
}
|
164 |
-
|
165 |
-
$this->product_bundles_items->save_item_meta( $translated_item );
|
166 |
-
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
// Delete removed items.
|
171 |
-
$translated_bundle_items = $this->product_bundles_items->get_items( $translated_bundle_id );
|
172 |
-
foreach ( $translated_bundle_items as $item_id => $bundle_item ) {
|
173 |
-
if ( ! in_array( $item_id, $translated_item_ids ) ) {
|
174 |
-
$bundled_item_data = $this->product_bundles_items->get_item_data_object( $item_id );
|
175 |
-
$bundled_item_data->delete();
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
public function sync_product_bundle_meta_with_translations( $bundle_id ) {
|
182 |
-
|
183 |
-
if ( $this->is_bundle_product( $bundle_id ) ) {
|
184 |
-
|
185 |
-
$trid = $this->sitepress->get_element_trid( $bundle_id, 'post_product' );
|
186 |
-
$translations = $this->sitepress->get_element_translations( $trid, 'post_product' );
|
187 |
-
$original_bundle_id = null;
|
188 |
-
|
189 |
-
foreach ( $translations as $language => $translation ) {
|
190 |
-
if ( $translation->original ) {
|
191 |
-
$original_bundle_id = $translation->element_id;
|
192 |
-
break;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
foreach ( $translations as $language => $translation ) {
|
197 |
-
if ( $original_bundle_id && $translation->element_id !== $original_bundle_id ) {
|
198 |
-
$this->sync_product_bundle_meta( $original_bundle_id, $translation->element_id );
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* @param array $allowed_variations
|
207 |
-
* @param string $lang
|
208 |
-
*
|
209 |
-
* @return array
|
210 |
-
*/
|
211 |
-
public function translate_allowed_variations( $allowed_variations, $lang ) {
|
212 |
-
|
213 |
-
foreach ( $allowed_variations as $k => $variation_id ) {
|
214 |
-
$allowed_variations[ $k ] =
|
215 |
-
apply_filters( 'translate_object_id', $variation_id, 'product_variation', true, $lang );
|
216 |
-
}
|
217 |
-
|
218 |
-
return $allowed_variations;
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* @param array $original_default_variation_attributes
|
223 |
-
* @param string $target_lang
|
224 |
-
* @param int $product_id
|
225 |
-
* @param int $translated_product_id
|
226 |
-
*
|
227 |
-
* @return array
|
228 |
-
*/
|
229 |
-
public function translate_default_variation_attributes( $original_default_variation_attributes, $target_lang, $product_id, $translated_product_id ) {
|
230 |
-
$default_variation_attributes = [];
|
231 |
-
|
232 |
-
if ( is_array( $original_default_variation_attributes ) ) {
|
233 |
-
foreach ( $original_default_variation_attributes as $attribute_taxonomy => $attribute_slug ) {
|
234 |
-
if ( 'pa_' === substr( $attribute_taxonomy, 0, 3 ) ) {
|
235 |
-
$attribute_term_id = $this->woocommerce_wpml->terms->wcml_get_term_id_by_slug( $attribute_taxonomy, $attribute_slug );
|
236 |
-
$translated_attribute_term_id = apply_filters( 'translate_object_id', $attribute_term_id, $attribute_taxonomy, true, $target_lang );
|
237 |
-
$translated_term = $this->woocommerce_wpml->terms->wcml_get_term_by_id( $translated_attribute_term_id, $attribute_taxonomy );
|
238 |
-
|
239 |
-
$default_variation_attributes[ $attribute_taxonomy ] = $translated_term->slug;
|
240 |
-
} else {
|
241 |
-
$default_variation_attributes[ $attribute_taxonomy ] = $this->woocommerce_wpml->attributes->get_custom_attr_translation( $product_id, $translated_product_id, $attribute_taxonomy, $attribute_slug );
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
return $default_variation_attributes;
|
247 |
-
}
|
248 |
-
|
249 |
-
private function get_product_id_for_item_id( $item_id ) {
|
250 |
-
|
251 |
-
return $this->wpdb->get_var(
|
252 |
-
$this->wpdb->prepare(
|
253 |
-
"SELECT product_id FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundled_item_id=%d",
|
254 |
-
$item_id
|
255 |
-
)
|
256 |
-
);
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* @param array $item_id
|
261 |
-
* @param string $language
|
262 |
-
*
|
263 |
-
* @return string
|
264 |
-
*/
|
265 |
-
public function get_item_id_for_language( $item_id, $language ) {
|
266 |
-
|
267 |
-
return $this->wpdb->get_var(
|
268 |
-
$this->wpdb->prepare(
|
269 |
-
"SELECT meta_value FROM {$this->wpdb->prefix}woocommerce_bundled_itemmeta WHERE bundled_item_id=%d AND meta_key=%s",
|
270 |
-
$item_id,
|
271 |
-
'translation_item_id_of_' . $language
|
272 |
-
)
|
273 |
-
);
|
274 |
-
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* @param int $original_item_id
|
279 |
-
* @param int $translated_item_id
|
280 |
-
* @param string $language
|
281 |
-
*/
|
282 |
-
public function set_translated_item_id_relationship( $original_item_id, $translated_item_id, $language ) {
|
283 |
-
|
284 |
-
$this->wpdb->insert(
|
285 |
-
$this->wpdb->prefix . 'woocommerce_bundled_itemmeta',
|
286 |
-
[
|
287 |
-
'bundled_item_id' => $original_item_id,
|
288 |
-
'meta_key' => 'translation_item_id_of_' . $language,
|
289 |
-
'meta_value' => $translated_item_id,
|
290 |
-
]
|
291 |
-
);
|
292 |
-
|
293 |
-
}
|
294 |
-
|
295 |
-
// Add Bundles Box to WCML Translation GUI.
|
296 |
-
public function custom_box_html( $obj, $bundle_id, $data ) {
|
297 |
-
|
298 |
-
$bundle_items = $this->product_bundles_items->get_items( $bundle_id );
|
299 |
-
|
300 |
-
if ( empty( $bundle_items ) ) {
|
301 |
-
return false;
|
302 |
-
}
|
303 |
-
|
304 |
-
$bundles_section = new WPML_Editor_UI_Field_Section( __( 'Product Bundles', 'woocommerce-multilingual' ) );
|
305 |
-
|
306 |
-
end( $bundle_items );
|
307 |
-
$last_item_id = key( $bundle_items );
|
308 |
-
$divider = true;
|
309 |
-
$flag = false;
|
310 |
-
|
311 |
-
foreach ( $bundle_items as $item_id => $bundle_item ) {
|
312 |
-
|
313 |
-
$translated_product = apply_filters( 'translate_object_id', $bundle_item->product_id, get_post_type( $bundle_item->product_id ), false, $obj->get_target_language() );
|
314 |
-
if ( ! is_null( $translated_product ) ) {
|
315 |
-
|
316 |
-
$add_group = false;
|
317 |
-
if ( $item_id == $last_item_id ) {
|
318 |
-
$divider = false;
|
319 |
-
}
|
320 |
-
|
321 |
-
$bundle_item_data = $this->product_bundles_items->get_item_data( $bundle_item );
|
322 |
-
|
323 |
-
$group = new WPML_Editor_UI_Field_Group( get_the_title( $bundle_item->product_id ), $divider );
|
324 |
-
|
325 |
-
if ( $bundle_item_data['override_title'] == 'yes' ) {
|
326 |
-
$bundle_field = new WPML_Editor_UI_Single_Line_Field(
|
327 |
-
'bundle_' . $bundle_item->product_id . '_title',
|
328 |
-
__( 'Name', 'woocommerce-multilingual' ),
|
329 |
-
$data,
|
330 |
-
false
|
331 |
-
);
|
332 |
-
$group->add_field( $bundle_field );
|
333 |
-
$add_group = true;
|
334 |
-
}
|
335 |
-
|
336 |
-
if ( $bundle_item_data['override_description'] == 'yes' ) {
|
337 |
-
$bundle_field = new WPML_Editor_UI_Single_Line_Field(
|
338 |
-
'bundle_' . $bundle_item->product_id . '_desc',
|
339 |
-
__( 'Description', 'woocommerce-multilingual' ),
|
340 |
-
$data,
|
341 |
-
false
|
342 |
-
);
|
343 |
-
$group->add_field( $bundle_field );
|
344 |
-
$add_group = true;
|
345 |
-
}
|
346 |
-
|
347 |
-
if ( $add_group ) {
|
348 |
-
$bundles_section->add_field( $group );
|
349 |
-
$flag = true;
|
350 |
-
}
|
351 |
-
}
|
352 |
-
}
|
353 |
-
|
354 |
-
if ( $flag ) {
|
355 |
-
$obj->add_field( $bundles_section );
|
356 |
-
}
|
357 |
-
|
358 |
-
}
|
359 |
-
|
360 |
-
public function custom_box_html_data( $data, $bundle_id, $translation, $lang ) {
|
361 |
-
|
362 |
-
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
363 |
-
|
364 |
-
if ( $translation ) {
|
365 |
-
$translated_bundle_id = $translation->ID;
|
366 |
-
$translated_bundle_data = $this->get_product_bundle_data( $translated_bundle_id );
|
367 |
-
}
|
368 |
-
|
369 |
-
if ( empty( $bundle_data ) || $bundle_data == false ) {
|
370 |
-
return $data;
|
371 |
-
}
|
372 |
-
|
373 |
-
$product_bundles = array_keys( $bundle_data );
|
374 |
-
|
375 |
-
foreach ( $product_bundles as $item_id ) {
|
376 |
-
|
377 |
-
$product_id = $this->get_product_id_for_item_id( $item_id );
|
378 |
-
$translated_item_id = null;
|
379 |
-
|
380 |
-
if ( $translation ) {
|
381 |
-
$translated_item_id = $this->get_item_id_for_language( $item_id, $lang );
|
382 |
-
}
|
383 |
-
|
384 |
-
if ( $bundle_data[ $item_id ]['override_title'] == 'yes' ) {
|
385 |
-
$data[ 'bundle_' . $product_id . '_title' ] = [ 'original' => $bundle_data[ $item_id ]['title'] ];
|
386 |
-
if ( $translated_item_id && isset( $translated_bundle_data[ $translated_item_id ]['override_title'] ) ) {
|
387 |
-
$data[ 'bundle_' . $product_id . '_title' ]['translation'] = $translated_bundle_data[ $translated_item_id ]['title'];
|
388 |
-
} else {
|
389 |
-
$data[ 'bundle_' . $product_id . '_title' ]['translation'] = '';
|
390 |
-
}
|
391 |
-
}
|
392 |
-
|
393 |
-
if ( $bundle_data[ $item_id ]['override_description'] == 'yes' ) {
|
394 |
-
$data[ 'bundle_' . $product_id . '_desc' ] = [ 'original' => $bundle_data[ $item_id ]['description'] ];
|
395 |
-
if ( $translated_item_id && isset( $translated_bundle_data[ $translated_item_id ]['override_description'] ) ) {
|
396 |
-
$data[ 'bundle_' . $product_id . '_desc' ]['translation'] = $translated_bundle_data[ $translated_item_id ]['description'];
|
397 |
-
} else {
|
398 |
-
$data[ 'bundle_' . $product_id . '_desc' ]['translation'] = '';
|
399 |
-
}
|
400 |
-
}
|
401 |
-
}
|
402 |
-
|
403 |
-
return $data;
|
404 |
-
}
|
405 |
-
|
406 |
-
public function append_bundle_data_translation_package( $package, $post ) {
|
407 |
-
|
408 |
-
if ( $post->post_type == 'product' ) {
|
409 |
-
|
410 |
-
$bundle_data = $this->get_product_bundle_data( $post->ID );
|
411 |
-
|
412 |
-
if ( $bundle_data ) {
|
413 |
-
|
414 |
-
$fields = [ 'title', 'description' ];
|
415 |
-
|
416 |
-
foreach ( $bundle_data as $item_id => $product_data ) {
|
417 |
-
|
418 |
-
$product_id = $this->get_product_id_for_item_id( $item_id );
|
419 |
-
foreach ( $fields as $field ) {
|
420 |
-
if ( $product_data[ 'override_' . $field ] == 'yes' && ! empty( $product_data[ $field ] ) ) {
|
421 |
-
$package['contents'][ 'product_bundles:' . $product_id . ':' . $item_id . ':' . $field ] = [
|
422 |
-
'translate' => 1,
|
423 |
-
'data' => $this->tp->encode_field_data( $product_data[ $field ], 'base64' ),
|
424 |
-
'format' => 'base64',
|
425 |
-
];
|
426 |
-
}
|
427 |
-
}
|
428 |
-
}
|
429 |
-
}
|
430 |
-
}
|
431 |
-
|
432 |
-
return $package;
|
433 |
-
|
434 |
-
}
|
435 |
-
|
436 |
-
// Update Bundled products title and description after saving the translation.
|
437 |
-
public function bundle_update( $bundle_id, $translated_bundle_id, $data, $lang ) {
|
438 |
-
|
439 |
-
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
440 |
-
$translated_bundle_data = $this->get_product_bundle_data( $translated_bundle_id );
|
441 |
-
|
442 |
-
if ( empty( $bundle_data ) ) {
|
443 |
-
return;
|
444 |
-
}
|
445 |
-
|
446 |
-
$translate_bundled_item_ids = $this->wpdb->get_col(
|
447 |
-
$this->wpdb->prepare(
|
448 |
-
"SELECT product_id FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundle_id = %d",
|
449 |
-
$translated_bundle_id
|
450 |
-
)
|
451 |
-
);
|
452 |
-
|
453 |
-
foreach ( $bundle_data as $item_id => $bundle_item_data ) {
|
454 |
-
|
455 |
-
$product_id = $this->get_product_id_for_item_id( $item_id );
|
456 |
-
$translated_product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), false, $lang );
|
457 |
-
|
458 |
-
if ( $translated_product_id ) {
|
459 |
-
|
460 |
-
if ( ! in_array( $translated_product_id, $translate_bundled_item_ids ) ) {
|
461 |
-
|
462 |
-
$menu_order = $this->wpdb->get_var(
|
463 |
-
$this->wpdb->prepare(
|
464 |
-
"
|
465 |
-
SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items
|
466 |
-
WHERE bundle_id=%d AND product_id=%d
|
467 |
-
",
|
468 |
-
$bundle_id,
|
469 |
-
$bundle_item_data['product_id']
|
470 |
-
)
|
471 |
-
);
|
472 |
-
|
473 |
-
$this->wpdb->insert(
|
474 |
-
$this->wpdb->prefix . 'woocommerce_bundled_items',
|
475 |
-
[
|
476 |
-
'product_id' => $translated_product_id,
|
477 |
-
'bundle_id' => $translated_bundle_id,
|
478 |
-
'menu_order' => $menu_order,
|
479 |
-
]
|
480 |
-
);
|
481 |
-
|
482 |
-
$translated_item_id = $this->wpdb->insert_id;
|
483 |
-
$this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang );
|
484 |
-
}
|
485 |
-
|
486 |
-
$translated_item_id = $this->get_item_id_for_language( $item_id, $lang );
|
487 |
-
|
488 |
-
// $this->product_bundles_items->copy_item_data( $item_id, $translated_item_id );
|
489 |
-
if ( isset( $data[ md5( 'bundle_' . $product_id . '_title' ) ] ) ) {
|
490 |
-
$translated_bundle_data[ $translated_item_id ]['title'] = $data[ md5( 'bundle_' . $product_id . '_title' ) ];
|
491 |
-
$translated_bundle_data[ $translated_item_id ]['override_title'] = $bundle_item_data['override_title'];
|
492 |
-
}
|
493 |
-
|
494 |
-
if ( isset( $data[ md5( 'bundle_' . $product_id . '_desc' ) ] ) ) {
|
495 |
-
$translated_bundle_data[ $translated_item_id ]['description'] = $data[ md5( 'bundle_' . $product_id . '_desc' ) ];
|
496 |
-
$translated_bundle_data[ $translated_item_id ]['override_description'] = $bundle_item_data['override_description'];
|
497 |
-
}
|
498 |
-
|
499 |
-
if ( isset( $bundle_item_data['allowed_variations'] ) ) {
|
500 |
-
if ( is_array( $bundle_item_data['allowed_variations'] ) ) {
|
501 |
-
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] =
|
502 |
-
$this->translate_allowed_variations( $bundle_item_data['allowed_variations'], $lang );
|
503 |
-
} else {
|
504 |
-
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] =
|
505 |
-
$bundle_item_data['allowed_variations'];
|
506 |
-
}
|
507 |
-
}
|
508 |
-
}
|
509 |
-
}
|
510 |
-
|
511 |
-
$this->save_product_bundle_data( $translated_bundle_id, $translated_bundle_data );
|
512 |
-
$this->sync_product_bundle_meta( $bundle_id, $translated_bundle_id );
|
513 |
-
|
514 |
-
$this->sitepress->copy_custom_fields( $bundle_id, $translated_bundle_id );
|
515 |
-
|
516 |
-
return $translated_bundle_data;
|
517 |
-
}
|
518 |
-
|
519 |
-
/**
|
520 |
-
* Sync product bundle data with translated values when the product is duplicated.
|
521 |
-
*
|
522 |
-
* @param int $bundle_id
|
523 |
-
* @param int $translated_bundle_id
|
524 |
-
*
|
525 |
-
* @return array|null
|
526 |
-
*/
|
527 |
-
public function sync_bundled_ids( $bundle_id, $translated_bundle_id ) {
|
528 |
-
|
529 |
-
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
530 |
-
if ( $bundle_data ) {
|
531 |
-
$translated_bundle_data = [];
|
532 |
-
$lang = $this->sitepress->get_language_for_element( $translated_bundle_id, 'post_product' );
|
533 |
-
$translated_bundle_data_before_update = $this->get_product_bundle_data( $translated_bundle_id );
|
534 |
-
|
535 |
-
foreach ( $bundle_data as $item_id => $product_data ) {
|
536 |
-
|
537 |
-
$product_id = $this->get_product_id_for_item_id( $item_id );
|
538 |
-
$translated_product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), false, $lang );
|
539 |
-
|
540 |
-
if ( $translated_product_id ) {
|
541 |
-
|
542 |
-
$translated_item_id = $this->get_item_id_for_language( $item_id, $lang );
|
543 |
-
if ( ! $translated_item_id ) {
|
544 |
-
$menu_order = $this->wpdb->get_var(
|
545 |
-
$this->wpdb->prepare(
|
546 |
-
"
|
547 |
-
SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items
|
548 |
-
WHERE bundle_id=%d AND product_id=%d
|
549 |
-
",
|
550 |
-
$bundle_id,
|
551 |
-
$product_id
|
552 |
-
)
|
553 |
-
);
|
554 |
-
|
555 |
-
$this->wpdb->insert(
|
556 |
-
$this->wpdb->prefix . 'woocommerce_bundled_items',
|
557 |
-
[
|
558 |
-
'product_id' => $translated_product_id,
|
559 |
-
'bundle_id' => $translated_bundle_id,
|
560 |
-
'menu_order' => $menu_order,
|
561 |
-
]
|
562 |
-
);
|
563 |
-
$translated_item_id = $this->wpdb->insert_id;
|
564 |
-
$this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang );
|
565 |
-
}
|
566 |
-
|
567 |
-
$translated_bundle_data[ $translated_item_id ] = $product_data;
|
568 |
-
$translated_bundle_data[ $translated_item_id ]['product_id'] = $translated_product_id;
|
569 |
-
|
570 |
-
if ( isset( $product_data['title'] ) ) {
|
571 |
-
if ( $product_data['override_title'] !== 'yes' ) {
|
572 |
-
$translated_bundle_data[ $translated_item_id ]['title'] = get_the_title( $translated_product_id );
|
573 |
-
} else {
|
574 |
-
$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'] : '';
|
575 |
-
}
|
576 |
-
}
|
577 |
-
|
578 |
-
if ( isset( $product_data['title'] ) ) {
|
579 |
-
if ( $product_data['override_description'] !== 'yes' ) {
|
580 |
-
$translated_bundle_data[ $translated_item_id ]['description'] = get_the_title( $translated_product_id );
|
581 |
-
} else {
|
582 |
-
$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'] : '';
|
583 |
-
}
|
584 |
-
}
|
585 |
-
|
586 |
-
if ( isset( $product_data['filter_variations'] ) && $product_data['filter_variations'] == 'yes' ) {
|
587 |
-
$allowed_var = maybe_unserialize( $product_data['allowed_variations'] );
|
588 |
-
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] = maybe_unserialize( $translated_bundle_data[ $translated_item_id ]['allowed_variations'] );
|
589 |
-
foreach ( $allowed_var as $key => $var_id ) {
|
590 |
-
$translated_var_id = apply_filters( 'translate_object_id', $var_id, get_post_type( $var_id ), true, $lang );
|
591 |
-
$translated_bundle_data[ $translated_item_id ]['allowed_variations'][ $key ] = $translated_var_id;
|
592 |
-
}
|
593 |
-
$translated_bundle_data[ $translated_item_id ]['allowed_variations'] = maybe_serialize( $translated_bundle_data[ $translated_item_id ]['allowed_variations'] );
|
594 |
-
}
|
595 |
-
|
596 |
-
if ( isset( $product_data['bundle_defaults'] ) && ! empty( $product_data['bundle_defaults'] ) ) {
|
597 |
-
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'] = maybe_unserialize( $translated_bundle_data[ $translated_item_id ]['bundle_defaults'] );
|
598 |
-
foreach ( maybe_unserialize( $product_data['bundle_defaults'] ) as $tax => $term_slug ) {
|
599 |
-
|
600 |
-
$term_id = $this->woocommerce_wpml->terms->wcml_get_term_id_by_slug( $tax, $term_slug );
|
601 |
-
if ( $term_id ) {
|
602 |
-
// Global Attribute.
|
603 |
-
$tr_def_id = apply_filters( 'translate_object_id', $term_id, $tax, true, $lang );
|
604 |
-
$tr_term = $this->woocommerce_wpml->terms->wcml_get_term_by_id( $tr_def_id, $tax );
|
605 |
-
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'][ $tax ] = $tr_term->slug;
|
606 |
-
} else {
|
607 |
-
// Custom Attribute.
|
608 |
-
$args = [
|
609 |
-
'post_type' => 'product_variation',
|
610 |
-
'meta_key' => 'attribute_' . $tax,
|
611 |
-
'meta_value' => $term_slug,
|
612 |
-
'meta_compare' => '=',
|
613 |
-
];
|
614 |
-
$variationloop = new WP_Query( $args );
|
615 |
-
while ( $variationloop->have_posts() ) :
|
616 |
-
$variationloop->the_post();
|
617 |
-
$tr_var_id = apply_filters( 'translate_object_id', get_the_ID(), 'product_variation', true, $lang );
|
618 |
-
$tr_meta = get_post_meta( $tr_var_id, 'attribute_' . $tax, true );
|
619 |
-
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'][ $tax ] = $tr_meta;
|
620 |
-
endwhile;
|
621 |
-
}
|
622 |
-
}
|
623 |
-
$translated_bundle_data[ $translated_item_id ]['bundle_defaults'] = maybe_serialize( $translated_bundle_data[ $translated_item_id ]['bundle_defaults'] );
|
624 |
-
}
|
625 |
-
}
|
626 |
-
}
|
627 |
-
|
628 |
-
$this->save_product_bundle_data( $translated_bundle_id, $translated_bundle_data );
|
629 |
-
|
630 |
-
return $translated_bundle_data;
|
631 |
-
}
|
632 |
-
|
633 |
-
return null;
|
634 |
-
}
|
635 |
-
|
636 |
-
public function resync_bundle( $cart_item, $session_values, $cart_item_key ) {
|
637 |
-
|
638 |
-
if ( isset( $cart_item['bundled_items'] ) && $cart_item['data']->product_type === 'bundle' ) {
|
639 |
-
$current_bundle_id = apply_filters( 'translate_object_id', $cart_item['product_id'], 'product', true );
|
640 |
-
if ( $cart_item['product_id'] != $current_bundle_id ) {
|
641 |
-
if ( isset( $cart_item['data']->bundle_data ) && is_array( $cart_item['data']->bundle_data ) ) {
|
642 |
-
$old_bundled_item_ids = array_keys( $cart_item['data']->bundle_data );
|
643 |
-
$cart_item['data'] = wc_get_product( $current_bundle_id );
|
644 |
-
if ( isset( $cart_item['data']->bundle_data ) && is_array( $cart_item['data']->bundle_data ) ) {
|
645 |
-
$new_bundled_item_ids = array_keys( $cart_item['data']->bundle_data );
|
646 |
-
$remapped_bundled_item_ids = [];
|
647 |
-
foreach ( $old_bundled_item_ids as $old_item_id_index => $old_item_id ) {
|
648 |
-
$remapped_bundled_item_ids[ $old_item_id ] = $new_bundled_item_ids[ $old_item_id_index ];
|
649 |
-
}
|
650 |
-
$cart_item['remapped_bundled_item_ids'] = $remapped_bundled_item_ids;
|
651 |
-
if ( isset( $cart_item['stamp'] ) ) {
|
652 |
-
$new_stamp = [];
|
653 |
-
foreach ( $cart_item['stamp'] as $bundled_item_id => $stamp_data ) {
|
654 |
-
$new_stamp[ $remapped_bundled_item_ids[ $bundled_item_id ] ] = $stamp_data;
|
655 |
-
}
|
656 |
-
$cart_item['stamp'] = $new_stamp;
|
657 |
-
}
|
658 |
-
}
|
659 |
-
}
|
660 |
-
}
|
661 |
-
}
|
662 |
-
if ( isset( $cart_item['bundled_by'] ) && isset( WC()->cart->cart_contents[ $cart_item['bundled_by'] ] ) ) {
|
663 |
-
$bundle_cart_item = WC()->cart->cart_contents[ $cart_item['bundled_by'] ];
|
664 |
-
if (
|
665 |
-
isset( $bundle_cart_item['remapped_bundled_item_ids'] ) &&
|
666 |
-
isset( $cart_item['bundled_item_id'] ) &&
|
667 |
-
isset( $bundle_cart_item['remapped_bundled_item_ids'][ $cart_item['bundled_item_id'] ] )
|
668 |
-
) {
|
669 |
-
$old_id = $cart_item['bundled_item_id'];
|
670 |
-
$remapped_bundled_item_ids = $bundle_cart_item['remapped_bundled_item_ids'];
|
671 |
-
$cart_item['bundled_item_id'] = $remapped_bundled_item_ids[ $cart_item['bundled_item_id'] ];
|
672 |
-
if ( isset( $cart_item['stamp'] ) ) {
|
673 |
-
$new_stamp = [];
|
674 |
-
foreach ( $cart_item['stamp'] as $bundled_item_id => $stamp_data ) {
|
675 |
-
$new_stamp[ $remapped_bundled_item_ids[ $bundled_item_id ] ] = $stamp_data;
|
676 |
-
}
|
677 |
-
$cart_item['stamp'] = $new_stamp;
|
678 |
-
}
|
679 |
-
}
|
680 |
-
}
|
681 |
-
|
682 |
-
return $cart_item;
|
683 |
-
}
|
684 |
-
|
685 |
-
public function resync_bundle_clean( $cart ) {
|
686 |
-
foreach ( $cart->cart_contents as $cart_item_key => $cart_item ) {
|
687 |
-
if ( isset( $cart_item['bundled_items'] ) && $this->is_bundle_product( $cart_item['product_id'] ) ) {
|
688 |
-
if ( isset( $cart_item['remapped_bundled_item_ids'] ) ) {
|
689 |
-
unset( WC()->cart->cart_contents[ $cart_item_key ]['remapped_bundled_item_ids'] );
|
690 |
-
}
|
691 |
-
}
|
692 |
-
}
|
693 |
-
}
|
694 |
-
|
695 |
-
public function save_bundle_data_translation( $translated_bundle_id, $data, $job ) {
|
696 |
-
|
697 |
-
if ( $this->is_bundle_product( $translated_bundle_id ) ) {
|
698 |
-
|
699 |
-
remove_action( 'wcml_after_duplicate_product_post_meta', [ $this, 'sync_bundled_ids' ], 10 );
|
700 |
-
|
701 |
-
$translated_bundle_data = $this->get_product_bundle_data( $translated_bundle_id );
|
702 |
-
|
703 |
-
$bundle_id = $job->original_doc_id;
|
704 |
-
|
705 |
-
$bundle_data = $this->get_product_bundle_data( $bundle_id );
|
706 |
-
|
707 |
-
foreach ( $data as $value ) {
|
708 |
-
|
709 |
-
if ( preg_match( '/product_bundles:([0-9]+):([0-9]+):(.+)/', $value['field_type'], $matches ) ) {
|
710 |
-
|
711 |
-
$product_id = $matches[1];
|
712 |
-
$item_id = $matches[2];
|
713 |
-
$field = $matches[3];
|
714 |
-
|
715 |
-
$translated_product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), false, $job->language_code );
|
716 |
-
$translated_item_id = $this->get_item_id_for_language( $item_id, $job->language_code );
|
717 |
-
if ( empty( $translated_item_id ) ) {
|
718 |
-
$translated_item_id = $this->add_product_to_bundle( $translated_product_id, $translated_bundle_id, $item_id, $job->language_code );
|
719 |
-
}
|
720 |
-
|
721 |
-
if ( ! isset( $translated_bundle_data[ $translated_item_id ] ) ) {
|
722 |
-
$translated_bundle_data[ $translated_item_id ] = [
|
723 |
-
'product_id' => $translated_product_id,
|
724 |
-
'hide_thumbnail' => $bundle_data[ $item_id ]['hide_thumbnail'],
|
725 |
-
'override_title' => $bundle_data[ $item_id ]['override_title'],
|
726 |
-
'product_title' => '',
|
727 |
-
'override_description' => $bundle_data[ $item_id ]['override_description'],
|
728 |
-
'product_description' => '',
|
729 |
-
'optional' => $bundle_data[ $item_id ]['optional'],
|
730 |
-
'bundle_quantity' => $bundle_data[ $item_id ]['bundle_quantity'],
|
731 |
-
'bundle_quantity_max' => $bundle_data[ $item_id ]['bundle_quantity_max'],
|
732 |
-
'bundle_discount' => $bundle_data[ $item_id ]['bundle_discount'],
|
733 |
-
'single_product_visibility' => $bundle_data[ $item_id ]['single_product_visibility'],
|
734 |
-
'cart_visibility' => $bundle_data[ $item_id ]['cart_visibility'],
|
735 |
-
'order_visibility' => $bundle_data[ $item_id ]['order_visibility'],
|
736 |
-
'stock_status' => $bundle_data[ $item_id ]['stock_status'],
|
737 |
-
'max_stock' => $bundle_data[ $item_id ]['max_stock'],
|
738 |
-
'quantity_min' => $bundle_data[ $item_id ]['quantity_min'],
|
739 |
-
'quantity_max' => $bundle_data[ $item_id ]['quantity_max'],
|
740 |
-
'shipped_individually' => $bundle_data[ $item_id ]['shipped_individually'],
|
741 |
-
'priced_individually' => $bundle_data[ $item_id ]['priced_individually'],
|
742 |
-
'single_product_price_visibility' => $bundle_data[ $item_id ]['single_product_price_visibility'],
|
743 |
-
'cart_price_visibility' => $bundle_data[ $item_id ]['cart_price_visibility'],
|
744 |
-
'order_price_visibility' => $bundle_data[ $item_id ]['order_price_visibility'],
|
745 |
-
];
|
746 |
-
}
|
747 |
-
|
748 |
-
$translated_bundle_data[ $translated_item_id ][ $field ] = $value['data'];
|
749 |
-
}
|
750 |
-
}
|
751 |
-
|
752 |
-
$this->save_product_bundle_data( $translated_bundle_id, $translated_bundle_data );
|
753 |
-
}
|
754 |
-
}
|
755 |
-
|
756 |
-
private function add_product_to_bundle( $product_id, $bundle_id, $item_id, $language ) {
|
757 |
-
|
758 |
-
$menu_order = $this->wpdb->get_var(
|
759 |
-
$this->wpdb->prepare(
|
760 |
-
"
|
761 |
-
SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items
|
762 |
-
WHERE bundled_item_id=%d
|
763 |
-
",
|
764 |
-
$item_id
|
765 |
-
)
|
766 |
-
);
|
767 |
-
|
768 |
-
$this->wpdb->insert(
|
769 |
-
$this->wpdb->prefix . 'woocommerce_bundled_items',
|
770 |
-
[
|
771 |
-
'product_id' => $product_id,
|
772 |
-
'bundle_id' => $bundle_id,
|
773 |
-
'menu_order' => $menu_order,
|
774 |
-
]
|
775 |
-
);
|
776 |
-
|
777 |
-
$translated_item_id = $this->wpdb->insert_id;
|
778 |
-
$this->set_translated_item_id_relationship( $item_id, $translated_item_id, $language );
|
779 |
-
|
780 |
-
return $translated_item_id;
|
781 |
-
}
|
782 |
-
|
783 |
-
/**
|
784 |
-
* @param array $custom_fields
|
785 |
-
*
|
786 |
-
* @return array
|
787 |
-
*/
|
788 |
-
public function get_price_custom_fields( $custom_fields ) {
|
789 |
-
|
790 |
-
$custom_fields = array_merge(
|
791 |
-
$custom_fields,
|
792 |
-
[
|
793 |
-
'_wc_pb_base_regular_price',
|
794 |
-
'_wc_pb_base_sale_price',
|
795 |
-
'_wc_pb_base_price',
|
796 |
-
'_wc_sw_max_price',
|
797 |
-
'_wc_sw_max_regular_price',
|
798 |
-
]
|
799 |
-
);
|
800 |
-
|
801 |
-
return $custom_fields;
|
802 |
-
}
|
803 |
-
|
804 |
-
|
805 |
-
public function update_bundles_custom_prices_values( $prices, $code ) {
|
806 |
-
|
807 |
-
if ( isset( $_POST['_custom_regular_price'][ $code ] ) ) {
|
808 |
-
$prices['_wc_pb_base_regular_price'] = wc_format_decimal( $_POST['_custom_regular_price'][ $code ] );
|
809 |
-
}
|
810 |
-
|
811 |
-
if ( isset( $_POST['_custom_sale_price'][ $code ] ) ) {
|
812 |
-
$prices['_wc_pb_base_sale_price'] = wc_format_decimal( $_POST['_custom_sale_price'][ $code ] );
|
813 |
-
}
|
814 |
-
|
815 |
-
return $prices;
|
816 |
-
|
817 |
-
}
|
818 |
-
|
819 |
-
public function update_bundles_base_price( $post_id, $product_price, $custom_prices, $code ) {
|
820 |
-
|
821 |
-
if ( isset( $custom_prices['_wc_pb_base_regular_price'] ) ) {
|
822 |
-
update_post_meta( $post_id, '_wc_pb_base_price_' . $code, $product_price );
|
823 |
-
}
|
824 |
-
|
825 |
-
}
|
826 |
-
|
827 |
-
public function is_bundle_product( $product_id ) {
|
828 |
-
|
829 |
-
$product = wc_get_product( $product_id );
|
830 |
-
|
831 |
-
if ( $product && 'bundle' === $product->get_type() ) {
|
832 |
-
return true;
|
833 |
-
}
|
834 |
-
|
835 |
-
return false;
|
836 |
-
}
|
837 |
-
|
838 |
-
// #wcml-2241.
|
839 |
-
public function upgrade_bundles_items_relationships() {
|
840 |
-
|
841 |
-
$table_exists = $this->wpdb->get_var( "SHOW TABLES LIKE '{$this->wpdb->prefix}woocommerce_bundled_items'" );
|
842 |
-
|
843 |
-
if ( $table_exists && ! get_option( 'wcml_upgrade_bundles_items_relationships' ) ) {
|
844 |
-
|
845 |
-
$bundled_items = $this->wpdb->get_results( "SELECT bundled_item_id, bundle_id, product_id FROM {$this->wpdb->prefix}woocommerce_bundled_items" );
|
846 |
-
$active_languages = $this->sitepress->get_active_languages();
|
847 |
-
|
848 |
-
foreach ( $bundled_items as $bundled_item ) {
|
849 |
-
|
850 |
-
if ( $this->woocommerce_wpml->products->is_original_product( $bundled_item->bundle_id ) ) {
|
851 |
-
|
852 |
-
foreach ( $active_languages as $lang ) {
|
853 |
-
|
854 |
-
if ( $lang['code'] !== $this->woocommerce_wpml->products->get_original_product_language( $bundled_item->bundle_id ) ) {
|
855 |
-
|
856 |
-
$translated_bundle_id = apply_filters( 'translate_object_id', $bundled_item->bundle_id, get_post_type( $bundled_item->bundle_id ), false, $lang['code'] );
|
857 |
-
$translated_product_id = apply_filters( 'translate_object_id', $bundled_item->product_id, get_post_type( $bundled_item->product_id ), false, $lang['code'] );
|
858 |
-
|
859 |
-
$translated_item_id = $this->wpdb->get_var(
|
860 |
-
$this->wpdb->prepare(
|
861 |
-
"SELECT bundled_item_id FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE product_id=%d AND bundle_id=%d",
|
862 |
-
$translated_product_id,
|
863 |
-
$translated_bundle_id
|
864 |
-
)
|
865 |
-
);
|
866 |
-
|
867 |
-
$this->wpdb->insert(
|
868 |
-
$this->wpdb->prefix . 'woocommerce_bundled_itemmeta',
|
869 |
-
[
|
870 |
-
'bundled_item_id' => $bundled_item->bundled_item_id,
|
871 |
-
'meta_key' => 'translation_item_id_of_' . $lang['code'],
|
872 |
-
'meta_value' => $translated_item_id,
|
873 |
-
]
|
874 |
-
);
|
875 |
-
}
|
876 |
-
}
|
877 |
-
}
|
878 |
-
}
|
879 |
-
|
880 |
-
add_option( 'wcml_upgrade_bundles_items_relationships', true );
|
881 |
-
|
882 |
-
}
|
883 |
-
}
|
884 |
-
|
885 |
-
public function woocommerce_json_search_filter_found_products( $found_products ) {
|
886 |
-
|
887 |
-
foreach ( $found_products as $id => $product_name ) {
|
888 |
-
if ( $this->sitepress->get_language_for_element( $id, 'post_' . get_post_type( $id ) ) != $this->sitepress->get_current_language() ) {
|
889 |
-
unset( $found_products[ $id ] );
|
890 |
-
}
|
891 |
-
}
|
892 |
-
|
893 |
-
return $found_products;
|
894 |
-
}
|
895 |
-
|
896 |
-
public function delete_bundled_item_relationship( $bundle_item ) {
|
897 |
-
|
898 |
-
$this->wpdb->query(
|
899 |
-
$this->wpdb->prepare(
|
900 |
-
"DELETE FROM {$this->wpdb->prefix}woocommerce_bundled_itemmeta WHERE `meta_value` = %d AND `meta_key` LIKE 'translation_item_id_of_%'",
|
901 |
-
$bundle_item->get_id()
|
902 |
-
)
|
903 |
-
);
|
904 |
-
|
905 |
-
}
|
906 |
-
|
907 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-relevanssi.php
DELETED
@@ -1,17 +0,0 @@
|
|
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', [ $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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-sensei.php
DELETED
@@ -1,249 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Sensei {
|
4 |
-
|
5 |
-
/** @var SitePress */
|
6 |
-
private $sitepress;
|
7 |
-
/** @var wpdb */
|
8 |
-
private $wpdb;
|
9 |
-
/** WPML_Custom_Columns $wpml_custom_columns */
|
10 |
-
private $custom_columns;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* WCML_Sensei constructor.
|
14 |
-
*
|
15 |
-
* @param Sitepress $sitepress
|
16 |
-
* @param wpdb $wpdb
|
17 |
-
* @param WPML_Custom_Columns $custom_columns
|
18 |
-
*/
|
19 |
-
public function __construct( SitePress $sitepress, wpdb $wpdb, WPML_Custom_Columns $custom_columns ) {
|
20 |
-
$this->sitepress = $sitepress;
|
21 |
-
$this->wpdb = $wpdb;
|
22 |
-
$this->custom_columns = $custom_columns;
|
23 |
-
}
|
24 |
-
|
25 |
-
public function add_hooks() {
|
26 |
-
|
27 |
-
add_filter( 'manage_edit-lesson_columns', [ $this->custom_columns, 'add_posts_management_column' ] );
|
28 |
-
add_filter( 'manage_edit-course_columns', [ $this->custom_columns, 'add_posts_management_column' ] );
|
29 |
-
add_filter( 'manage_edit-question_columns', [ $this->custom_columns, 'add_posts_management_column' ] );
|
30 |
-
|
31 |
-
add_action( 'save_post', [ $this, 'save_post_actions' ], 100, 2 );
|
32 |
-
add_action( 'sensei_log_activity_after', [ $this, 'log_activity_after' ], 10, 3 );
|
33 |
-
add_filter( 'sensei_bought_product_id', [ $this, 'filter_bought_product_id' ], 10, 2 );
|
34 |
-
add_action( 'delete_comment', [ $this, 'delete_user_activity' ] );
|
35 |
-
|
36 |
-
add_action( 'pre_get_comments', [ $this, 'pre_get_comments' ] );
|
37 |
-
|
38 |
-
if ( $this->is_sensei_admin_without_language_switcher() ) {
|
39 |
-
remove_action( 'wp_before_admin_bar_render', [ $this->sitepress, 'admin_language_switcher' ] );
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
private function is_sensei_admin_without_language_switcher() {
|
44 |
-
|
45 |
-
$is_message_post_type = isset( $_GET['post_type'] ) && $_GET['post_type'] == 'sensei_message';
|
46 |
-
$is_grading_page = isset( $_GET['page'] ) && $_GET['page'] == 'sensei_grading';
|
47 |
-
|
48 |
-
return is_admin() && ( $is_message_post_type || $is_grading_page );
|
49 |
-
}
|
50 |
-
|
51 |
-
public function save_post_actions( $post_id, $post ) {
|
52 |
-
global $sitepress;
|
53 |
-
|
54 |
-
// skip not related post types
|
55 |
-
if ( ! in_array( $post->post_type, [ 'lesson', 'course', 'quiz' ] ) ) {
|
56 |
-
return;
|
57 |
-
}
|
58 |
-
// skip auto-drafts
|
59 |
-
if ( $post->post_status == 'auto-draft' ) {
|
60 |
-
return;
|
61 |
-
}
|
62 |
-
// skip autosave
|
63 |
-
if ( isset( $_POST['autosave'] ) ) {
|
64 |
-
return;
|
65 |
-
}
|
66 |
-
|
67 |
-
if ( $post->post_type == 'quiz' && isset( $_POST['ID'] ) ) {
|
68 |
-
$this->save_post_actions( $_POST['ID'], get_post( $_POST['ID'] ) );
|
69 |
-
}
|
70 |
-
|
71 |
-
// sync fields from original
|
72 |
-
$trid = $sitepress->get_element_trid( $post_id, 'post_' . $post->post_type );
|
73 |
-
$translations = $sitepress->get_element_translations( $trid, 'post_' . $post->post_type );
|
74 |
-
|
75 |
-
if ( ! empty( $translations ) ) {
|
76 |
-
$original_post_id = false;
|
77 |
-
foreach ( $translations as $t ) {
|
78 |
-
if ( $t->original ) {
|
79 |
-
$original_post_id = $t->element_id;
|
80 |
-
break;
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( $post_id != $original_post_id ) {
|
85 |
-
$this->sync_custom_fields( $original_post_id, $post_id, $post->post_type );
|
86 |
-
} else {
|
87 |
-
foreach ( $translations as $t ) {
|
88 |
-
if ( $original_post_id != $t->element_id ) {
|
89 |
-
$this->sync_custom_fields( $original_post_id, $t->element_id, $post->post_type );
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
|
98 |
-
public function sync_custom_fields( $original_post_id, $post_id, $post_type ) {
|
99 |
-
global $sitepress;
|
100 |
-
|
101 |
-
$language = $sitepress->get_language_for_element( $post_id, 'post_' . $post_type );
|
102 |
-
if ( $post_type == 'quiz' ) {
|
103 |
-
|
104 |
-
// sync quiz lesson
|
105 |
-
$lesson_id = get_post_meta( $original_post_id, '_quiz_lesson', true );
|
106 |
-
|
107 |
-
if ( $lesson_id ) {
|
108 |
-
$tr_lesson_id = apply_filters( 'translate_object_id', $lesson_id, 'lesson', false, $language );
|
109 |
-
|
110 |
-
if ( ! is_null( $tr_lesson_id ) ) {
|
111 |
-
update_post_meta( $post_id, '_quiz_lesson', $tr_lesson_id );
|
112 |
-
}
|
113 |
-
} else {
|
114 |
-
delete_post_meta( $post_id, '_quiz_lesson' );
|
115 |
-
}
|
116 |
-
} elseif ( $post_type == 'lesson' ) {
|
117 |
-
// sync lesson course
|
118 |
-
$course_id = get_post_meta( $original_post_id, '_lesson_course', true );
|
119 |
-
|
120 |
-
if ( $course_id ) {
|
121 |
-
$tr_course_id = apply_filters( 'translate_object_id', $course_id, 'course', false, $language );
|
122 |
-
|
123 |
-
if ( ! is_null( $tr_course_id ) ) {
|
124 |
-
update_post_meta( $post_id, '_lesson_course', $tr_course_id );
|
125 |
-
}
|
126 |
-
} else {
|
127 |
-
delete_post_meta( $post_id, '_lesson_course' );
|
128 |
-
}
|
129 |
-
|
130 |
-
// sync lesson prerequisite
|
131 |
-
$lesson_id = get_post_meta( $original_post_id, '_lesson_prerequisite', true );
|
132 |
-
|
133 |
-
if ( $lesson_id ) {
|
134 |
-
$tr_lesson_id = apply_filters( 'translate_object_id', $lesson_id, 'lesson', false, $language );
|
135 |
-
|
136 |
-
if ( ! is_null( $tr_lesson_id ) ) {
|
137 |
-
update_post_meta( $post_id, '_lesson_prerequisite', $tr_lesson_id );
|
138 |
-
}
|
139 |
-
} else {
|
140 |
-
delete_post_meta( $post_id, '_lesson_prerequisite' );
|
141 |
-
}
|
142 |
-
} else {
|
143 |
-
|
144 |
-
// sync course woocommerce_product
|
145 |
-
$product_id = get_post_meta( $original_post_id, '_course_woocommerce_product', true );
|
146 |
-
|
147 |
-
if ( $product_id ) {
|
148 |
-
$tr_product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), false, $language );
|
149 |
-
|
150 |
-
if ( ! is_null( $tr_product_id ) ) {
|
151 |
-
update_post_meta( $post_id, '_course_woocommerce_product', $tr_product_id );
|
152 |
-
}
|
153 |
-
} else {
|
154 |
-
delete_post_meta( $post_id, '_course_woocommerce_product' );
|
155 |
-
}
|
156 |
-
|
157 |
-
// sync course prerequisite
|
158 |
-
$course_id = get_post_meta( $original_post_id, '_course_prerequisite', true );
|
159 |
-
|
160 |
-
if ( $course_id ) {
|
161 |
-
$tr_course_id = apply_filters( 'translate_object_id', $course_id, 'course', false, $language );
|
162 |
-
|
163 |
-
if ( ! is_null( $tr_course_id ) ) {
|
164 |
-
update_post_meta( $post_id, '_course_prerequisite', $tr_course_id );
|
165 |
-
}
|
166 |
-
} else {
|
167 |
-
delete_post_meta( $post_id, '_course_prerequisite' );
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
public function log_activity_after( $args, $data, $comment_id = false ) {
|
174 |
-
global $sitepress;
|
175 |
-
|
176 |
-
if ( ! $comment_id ) {
|
177 |
-
return false;
|
178 |
-
}
|
179 |
-
|
180 |
-
$comment_post_id = $data['comment_post_ID'];
|
181 |
-
$trid = $sitepress->get_element_trid( $comment_post_id, 'post_' . get_post_type( $comment_post_id ) );
|
182 |
-
$translations = $sitepress->get_element_translations( $trid, 'post_' . get_post_type( $comment_post_id ) );
|
183 |
-
|
184 |
-
foreach ( $translations as $translation ) {
|
185 |
-
|
186 |
-
if ( $comment_post_id != $translation->element_id ) {
|
187 |
-
$data['comment_post_ID'] = $translation->element_id;
|
188 |
-
|
189 |
-
$trid = $sitepress->get_element_trid( $comment_id, 'comment' );
|
190 |
-
|
191 |
-
$tr_comment_id = apply_filters( 'translate_object_id', $comment_id, 'comment', false, $translation->language_code );
|
192 |
-
if ( isset( $args['action'] ) && 'update' == $args['action'] && ! is_null( $tr_comment_id ) && get_comment( $tr_comment_id ) ) {
|
193 |
-
$data['comment_ID'] = $tr_comment_id;
|
194 |
-
$tr_comment_id = wp_update_comment( $data );
|
195 |
-
} else {
|
196 |
-
$tr_comment_id = wp_insert_comment( $data );
|
197 |
-
$sitepress->set_element_language_details( $tr_comment_id, 'comment', $trid, $translation->language_code );
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
}
|
203 |
-
|
204 |
-
public function filter_bought_product_id( $product_id, $order ) {
|
205 |
-
|
206 |
-
$order_id = method_exists( 'WC_Order', 'get_id' ) ? $order->get_id() : $order->id;
|
207 |
-
$order_language = get_post_meta( $order_id, 'wpml_language', true );
|
208 |
-
|
209 |
-
$tr_product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), false, $order_language );
|
210 |
-
|
211 |
-
if ( ! is_null( $tr_product_id ) ) {
|
212 |
-
return $tr_product_id;
|
213 |
-
} else {
|
214 |
-
return $product_id;
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
public function delete_user_activity( $comment_id ) {
|
219 |
-
global $sitepress;
|
220 |
-
|
221 |
-
$comment_type = get_comment_type( $comment_id );
|
222 |
-
|
223 |
-
if ( strstr( $comment_type, 'sensei' ) ) {
|
224 |
-
|
225 |
-
$trid = $sitepress->get_element_trid( $comment_id, 'comment' );
|
226 |
-
$translations = $sitepress->get_element_translations( $trid, 'comment' );
|
227 |
-
|
228 |
-
remove_action( 'delete_comment', [ $this, 'delete_user_activity' ] );
|
229 |
-
foreach ( $translations as $translation ) {
|
230 |
-
if ( $comment_id != $translation->element_id ) {
|
231 |
-
wp_delete_comment( $translation->element_id, true );
|
232 |
-
}
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
}
|
237 |
-
|
238 |
-
public function pre_get_comments( $obj ) {
|
239 |
-
global $sitepress;
|
240 |
-
|
241 |
-
if ( $obj->query_vars['type'] == 'sensei_course_start' ) {
|
242 |
-
|
243 |
-
remove_filter( 'comments_clauses', [ $sitepress, 'comments_clauses' ], 10 );
|
244 |
-
|
245 |
-
}
|
246 |
-
|
247 |
-
}
|
248 |
-
|
249 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-tab-manager.php
DELETED
@@ -1,760 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_Tab_Manager
|
5 |
-
*/
|
6 |
-
class WCML_Tab_Manager {
|
7 |
-
/**
|
8 |
-
* @var WPML_Element_Translation_Package
|
9 |
-
*/
|
10 |
-
private $tp;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* @var SitePress
|
14 |
-
*/
|
15 |
-
private $sitepress;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var WooCommerce
|
19 |
-
*/
|
20 |
-
private $woocommerce;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var woocommerce_wpml
|
24 |
-
*/
|
25 |
-
private $woocommerce_wpml;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var wpdb
|
29 |
-
*/
|
30 |
-
private $wpdb;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* WCML_Tab_Manager constructor.
|
34 |
-
*
|
35 |
-
* @param SitePress $sitepress
|
36 |
-
* @param WooCommerce $woocommerce
|
37 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
38 |
-
* @param wpdb $wpdb
|
39 |
-
* @param WPML_Element_Translation_Package $tp
|
40 |
-
*/
|
41 |
-
public function __construct( SitePress $sitepress, WooCommerce $woocommerce, woocommerce_wpml $woocommerce_wpml, wpdb $wpdb, WPML_Element_Translation_Package $tp ) {
|
42 |
-
$this->sitepress = $sitepress;
|
43 |
-
$this->woocommerce = $woocommerce;
|
44 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
45 |
-
$this->wpdb = $wpdb;
|
46 |
-
$this->tp = $tp;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function add_hooks() {
|
50 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'sync_tabs' ], 10, 4 );
|
51 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
52 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 4 );
|
53 |
-
add_filter( 'wpml_duplicate_custom_fields_exceptions', [ $this, 'duplicate_custom_fields_exceptions' ] );
|
54 |
-
add_action( 'wcml_after_duplicate_product', [ $this, 'duplicate_product_tabs' ], 10, 2 );
|
55 |
-
|
56 |
-
add_filter( 'wc_tab_manager_tab_id', [ $this, 'wc_tab_manager_tab_id' ], 10, 1 );
|
57 |
-
add_filter( 'option_wpml_config_files_arr', [ $this, 'make__product_tabs_not_translatable_by_default' ], 0 );
|
58 |
-
|
59 |
-
add_action( 'wpml_translation_job_saved', [ $this, 'save_custom_tabs_translation' ], 10, 3 );
|
60 |
-
|
61 |
-
if ( is_admin() ) {
|
62 |
-
|
63 |
-
add_action( 'save_post', [ $this, 'force_set_language_information_on_product_tabs' ], 10, 2 );
|
64 |
-
add_action( 'save_post', [ $this, 'sync_product_tabs' ], 10, 2 );
|
65 |
-
|
66 |
-
add_filter( 'wpml_tm_translation_job_data', [ $this, 'append_custom_tabs_to_translation_package' ], 10, 2 );
|
67 |
-
add_action( 'woocommerce_product_data_panels', [ $this, 'show_pointer_info' ] );
|
68 |
-
|
69 |
-
add_filter( 'wcml_do_not_display_custom_fields_for_product', [ $this, 'replace_tm_editor_custom_fields_with_own_sections' ] );
|
70 |
-
|
71 |
-
add_filter( 'wpml_duplicate_custom_fields_exceptions', [ $this, 'duplicate_categories_exception' ] );
|
72 |
-
add_action( 'wpml_after_copy_custom_field', [ $this, 'translate_categories' ], 10, 3 );
|
73 |
-
|
74 |
-
} else {
|
75 |
-
add_filter( 'option_wc_tab_manager_default_layout', [ $this, 'filter_default_layout' ] );
|
76 |
-
}
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @param $wpml_config_array
|
82 |
-
*
|
83 |
-
* @return mixed
|
84 |
-
*/
|
85 |
-
public function make__product_tabs_not_translatable_by_default( $wpml_config_array ) {
|
86 |
-
|
87 |
-
if ( isset( $wpml_config_array->plugins['WooCommerce Tab Manager'] ) ) {
|
88 |
-
$wpml_config_array->plugins['WooCommerce Tab Manager'] =
|
89 |
-
str_replace(
|
90 |
-
'<custom-field action="translate">_product_tabs</custom-field>',
|
91 |
-
'<custom-field action="nothing">_product_tabs</custom-field>',
|
92 |
-
$wpml_config_array->plugins['WooCommerce Tab Manager']
|
93 |
-
);
|
94 |
-
}
|
95 |
-
|
96 |
-
return $wpml_config_array;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* @param $original_product_id
|
101 |
-
* @param $trnsl_product_id
|
102 |
-
* @param $data
|
103 |
-
* @param $lang
|
104 |
-
*
|
105 |
-
* @return bool
|
106 |
-
*/
|
107 |
-
public function sync_tabs( $original_product_id, $trnsl_product_id, $data, $lang ) {
|
108 |
-
// check if "duplicate" product
|
109 |
-
if ( ( isset( $_POST['icl_ajx_action'] ) && ( 'make_duplicates' === $_POST['icl_ajx_action'] ) ) || ( get_post_meta( $trnsl_product_id, '_icl_lang_duplicate_of', true ) ) ) {
|
110 |
-
$this->duplicate_tabs( $original_product_id, $trnsl_product_id, $lang );
|
111 |
-
}
|
112 |
-
|
113 |
-
$orig_prod_tabs = $this->get_product_tabs( $original_product_id );
|
114 |
-
|
115 |
-
if ( $orig_prod_tabs ) {
|
116 |
-
$trnsl_product_tabs = [];
|
117 |
-
$i = 0;
|
118 |
-
foreach ( $orig_prod_tabs as $key => $orig_prod_tab ) {
|
119 |
-
switch ( $orig_prod_tab['type'] ) {
|
120 |
-
case 'core':
|
121 |
-
$default_language = $this->woocommerce_wpml->products->get_original_product_language( $original_product_id );
|
122 |
-
$current_language = $this->sitepress->get_current_language();
|
123 |
-
$trnsl_product_tabs[ $key ] = $orig_prod_tabs[ $key ];
|
124 |
-
$title = isset( $data[ md5( 'coretab_' . $orig_prod_tab['id'] . '_title' ) ] ) ? $data[ md5( 'coretab_' . $orig_prod_tab['id'] . '_title' ) ] : '';
|
125 |
-
$heading = isset( $data[ md5( 'coretab_' . $orig_prod_tab['id'] . '_heading' ) ] ) ? $data[ md5( 'coretab_' . $orig_prod_tab['id'] . '_heading' ) ] : '';
|
126 |
-
|
127 |
-
if ( $default_language !== $lang ) {
|
128 |
-
|
129 |
-
$this->refresh_text_domain( $lang );
|
130 |
-
|
131 |
-
if ( ! $title ) {
|
132 |
-
$title = isset( $_POST['product_tab_title'][ $orig_prod_tab['position'] ] ) ? $_POST['product_tab_title'][ $orig_prod_tab['position'] ] : $orig_prod_tabs[ $key ]['title'];
|
133 |
-
$title = __( $title, 'woocommerce' );
|
134 |
-
}
|
135 |
-
|
136 |
-
if ( ! $heading && ( isset( $orig_prod_tabs[ $key ]['heading'] ) || isset( $_POST['product_tab_heading'][ $orig_prod_tab['position'] ] ) ) ) {
|
137 |
-
$heading = isset( $_POST['product_tab_heading'][ $orig_prod_tab['position'] ] ) ? $_POST['product_tab_heading'][ $orig_prod_tab['position'] ] : $orig_prod_tabs[ $key ]['heading'];
|
138 |
-
$heading = __( $heading, 'woocommerce' );
|
139 |
-
}
|
140 |
-
|
141 |
-
$this->refresh_text_domain( $current_language );
|
142 |
-
}
|
143 |
-
|
144 |
-
$trnsl_product_tabs[ $key ]['title'] = $title;
|
145 |
-
$trnsl_product_tabs[ $key ]['heading'] = $heading;
|
146 |
-
break;
|
147 |
-
case 'global':
|
148 |
-
$trnsl_product_tabs = $this->set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang );
|
149 |
-
break;
|
150 |
-
case 'product':
|
151 |
-
$tab_id = false;
|
152 |
-
$title_key = md5( 'tab_' . $orig_prod_tab['position'] . '_title' );
|
153 |
-
$heading_key = md5( 'tab_' . $orig_prod_tab['position'] . '_heading' );
|
154 |
-
$title = isset( $data[ $title_key ] ) ? sanitize_text_field( $data[ $title_key ] ) : '';
|
155 |
-
$content = isset( $data[ $heading_key ] ) ? wp_kses_post( $data[ $heading_key ] ) : '';
|
156 |
-
|
157 |
-
$trnsl_product_tabs = $this->set_product_tab( $orig_prod_tab, $trnsl_product_tabs, $lang, $trnsl_product_id, $tab_id, $title, $content );
|
158 |
-
|
159 |
-
$i++;
|
160 |
-
break;
|
161 |
-
}
|
162 |
-
}
|
163 |
-
update_post_meta( $trnsl_product_id, '_product_tabs', $trnsl_product_tabs );
|
164 |
-
|
165 |
-
return true;
|
166 |
-
}
|
167 |
-
|
168 |
-
return false;
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* @param $original_product_id
|
173 |
-
* @param $trnsl_product_id
|
174 |
-
* @param $lang
|
175 |
-
*/
|
176 |
-
public function duplicate_tabs( $original_product_id, $trnsl_product_id, $lang ) {
|
177 |
-
$orig_prod_tabs = maybe_unserialize( get_post_meta( $original_product_id, '_product_tabs', true ) );
|
178 |
-
$prod_tabs = [];
|
179 |
-
foreach ( $orig_prod_tabs as $key => $orig_prod_tab ) {
|
180 |
-
switch ( $orig_prod_tab['type'] ) {
|
181 |
-
case 'core':
|
182 |
-
$prod_tabs[ $key ] = $orig_prod_tab;
|
183 |
-
$this->refresh_text_domain( $lang );
|
184 |
-
$prod_tabs[ $key ]['title'] = __( $orig_prod_tab['title'], 'woocommerce' );
|
185 |
-
if ( isset( $orig_prod_tab['heading'] ) ) {
|
186 |
-
$prod_tabs[ $key ]['heading'] = __( $orig_prod_tab['heading'], 'woocommerce' );
|
187 |
-
}
|
188 |
-
$orig_lang = $this->sitepress->get_language_for_element( $original_product_id, 'post_product' );
|
189 |
-
$this->refresh_text_domain( $orig_lang );
|
190 |
-
break;
|
191 |
-
case 'global':
|
192 |
-
$prod_tabs = $this->set_global_tab( $orig_prod_tab, $prod_tabs, $lang );
|
193 |
-
break;
|
194 |
-
case 'product':
|
195 |
-
$original_tab = get_post( $orig_prod_tab['id'] );
|
196 |
-
$prod_tabs = $this->set_product_tab( $orig_prod_tab, $prod_tabs, $lang, $trnsl_product_id, false, $original_tab->post_title, $original_tab->post_content );
|
197 |
-
break;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
update_post_meta( $trnsl_product_id, '_product_tabs', $prod_tabs );
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* @param $lang
|
206 |
-
*/
|
207 |
-
public function refresh_text_domain( $lang ) {
|
208 |
-
$this->sitepress->switch_lang( $lang );
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* @param $orig_prod_tab
|
213 |
-
* @param $trnsl_product_tabs
|
214 |
-
* @param $lang
|
215 |
-
*
|
216 |
-
* @return mixed
|
217 |
-
*/
|
218 |
-
public function set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang ) {
|
219 |
-
$tr_tab_id = apply_filters( 'translate_object_id', $orig_prod_tab['id'], 'wc_product_tab', true, $lang );
|
220 |
-
$trnsl_product_tabs[ $orig_prod_tab['type'] . '_tab_' . $tr_tab_id ] = [
|
221 |
-
'position' => $orig_prod_tab['position'],
|
222 |
-
'type' => $orig_prod_tab['type'],
|
223 |
-
'id' => $tr_tab_id,
|
224 |
-
'name' => get_post( $tr_tab_id )->post_name,
|
225 |
-
];
|
226 |
-
return $trnsl_product_tabs;
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* @param $orig_prod_tab
|
231 |
-
* @param $trnsl_product_tabs
|
232 |
-
* @param $lang
|
233 |
-
* @param $trnsl_product_id
|
234 |
-
* @param $tab_id
|
235 |
-
* @param $title
|
236 |
-
* @param $content
|
237 |
-
*
|
238 |
-
* @return mixed
|
239 |
-
*/
|
240 |
-
public function set_product_tab( $orig_prod_tab, $trnsl_product_tabs, $lang, $trnsl_product_id, $tab_id, $title, $content ) {
|
241 |
-
if ( ! $tab_id ) {
|
242 |
-
$tr_tab_id = apply_filters( 'translate_object_id', $orig_prod_tab['id'], 'wc_product_tab', false, $lang );
|
243 |
-
|
244 |
-
if ( ! is_null( $tr_tab_id ) ) {
|
245 |
-
$tab_id = $tr_tab_id;
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
if ( $tab_id ) {
|
250 |
-
// update existing tab
|
251 |
-
$args = [];
|
252 |
-
$args['post_title'] = $title;
|
253 |
-
$args['post_content'] = $content;
|
254 |
-
$this->wpdb->update( $this->wpdb->posts, $args, [ 'ID' => $tab_id ] );
|
255 |
-
} else {
|
256 |
-
// tab not exist creating new
|
257 |
-
$args = [];
|
258 |
-
$args['post_title'] = $title;
|
259 |
-
$args['post_content'] = $content;
|
260 |
-
$args['post_author'] = get_current_user_id();
|
261 |
-
$args['post_name'] = sanitize_title( $title );
|
262 |
-
$args['post_type'] = 'wc_product_tab';
|
263 |
-
$args['post_parent'] = $trnsl_product_id;
|
264 |
-
$args['post_status'] = 'publish';
|
265 |
-
$this->wpdb->insert( $this->wpdb->posts, $args );
|
266 |
-
|
267 |
-
$tab_id = $this->wpdb->insert_id;
|
268 |
-
$tab_trid = $this->sitepress->get_element_trid( $orig_prod_tab['id'], 'post_wc_product_tab' );
|
269 |
-
if ( ! $tab_trid ) {
|
270 |
-
$this->sitepress->set_element_language_details( $orig_prod_tab['id'], 'post_wc_product_tab', false, $this->sitepress->get_default_language() );
|
271 |
-
$tab_trid = $this->sitepress->get_element_trid( $orig_prod_tab['id'], 'post_wc_product_tab' );
|
272 |
-
}
|
273 |
-
$this->sitepress->set_element_language_details( $tab_id, 'post_wc_product_tab', $tab_trid, $lang );
|
274 |
-
}
|
275 |
-
|
276 |
-
if ( empty( $title ) || strlen( $title ) != strlen( utf8_encode( $title ) ) ) {
|
277 |
-
$tab_name = 'product-tab-' . $tab_id;
|
278 |
-
} else {
|
279 |
-
$tab_name = sanitize_title( $title );
|
280 |
-
}
|
281 |
-
|
282 |
-
$trnsl_product_tabs[ $orig_prod_tab['type'] . '_tab_' . $tab_id ] = [
|
283 |
-
'position' => $orig_prod_tab['position'],
|
284 |
-
'type' => $orig_prod_tab['type'],
|
285 |
-
'id' => $tab_id,
|
286 |
-
'name' => $tab_name,
|
287 |
-
];
|
288 |
-
|
289 |
-
return $trnsl_product_tabs;
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* @param $exceptions
|
294 |
-
*
|
295 |
-
* @return array
|
296 |
-
*/
|
297 |
-
public function duplicate_custom_fields_exceptions( $exceptions ) {
|
298 |
-
$exceptions[] = '_product_tabs';
|
299 |
-
return $exceptions;
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* @param $obj
|
304 |
-
* @param $product_id
|
305 |
-
* @param $data
|
306 |
-
*
|
307 |
-
* @return bool
|
308 |
-
*/
|
309 |
-
public function custom_box_html( $obj, $product_id, $data ) {
|
310 |
-
|
311 |
-
if ( 'yes' !== get_post_meta( $product_id, '_override_tab_layout', true ) ) {
|
312 |
-
return false;
|
313 |
-
}
|
314 |
-
|
315 |
-
$orig_prod_tabs = $this->get_product_tabs( $product_id );
|
316 |
-
if ( ! $orig_prod_tabs ) {
|
317 |
-
return false;
|
318 |
-
}
|
319 |
-
|
320 |
-
$tabs_section = new WPML_Editor_UI_Field_Section( __( 'Product tabs', 'woocommerce-multilingual' ) );
|
321 |
-
|
322 |
-
$keys = array_keys( $orig_prod_tabs );
|
323 |
-
$last_key = end( $keys );
|
324 |
-
$divider = true;
|
325 |
-
|
326 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
327 |
-
if ( $key === $last_key ) {
|
328 |
-
$divider = false;
|
329 |
-
}
|
330 |
-
|
331 |
-
if ( in_array( $prod_tab['type'], [ 'product', 'core' ] ) ) {
|
332 |
-
if ( 'core' === $prod_tab['type'] ) {
|
333 |
-
$group = new WPML_Editor_UI_Field_Group( $prod_tab['title'], $divider );
|
334 |
-
$tab_field = new WPML_Editor_UI_Single_Line_Field( 'coretab_' . $prod_tab['id'] . '_title', __( 'Title', 'woocommerce-multilingual' ), $data, false );
|
335 |
-
$group->add_field( $tab_field );
|
336 |
-
$tab_field = new WPML_Editor_UI_Single_Line_Field( 'coretab_' . $prod_tab['id'] . '_heading', __( 'Heading', 'woocommerce-multilingual' ), $data, false );
|
337 |
-
$group->add_field( $tab_field );
|
338 |
-
$tabs_section->add_field( $group );
|
339 |
-
} else {
|
340 |
-
$group = new WPML_Editor_UI_Field_Group( ucfirst( str_replace( '-', ' ', $prod_tab['name'] ) ), $divider );
|
341 |
-
$tab_field = new WPML_Editor_UI_Single_Line_Field( 'tab_' . $prod_tab['position'] . '_title', __( 'Title', 'woocommerce-multilingual' ), $data, false );
|
342 |
-
$group->add_field( $tab_field );
|
343 |
-
$tab_field = new WCML_Editor_UI_WYSIWYG_Field( 'tab_' . $prod_tab['position'] . '_heading', null, $data, false );
|
344 |
-
$group->add_field( $tab_field );
|
345 |
-
$tabs_section->add_field( $group );
|
346 |
-
}
|
347 |
-
}
|
348 |
-
}
|
349 |
-
$obj->add_field( $tabs_section );
|
350 |
-
|
351 |
-
return true;
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* @param $data
|
356 |
-
* @param $product_id
|
357 |
-
* @param $translation
|
358 |
-
* @param $lang
|
359 |
-
*
|
360 |
-
* @return mixed
|
361 |
-
*/
|
362 |
-
public function custom_box_html_data( $data, $product_id, $translation, $lang ) {
|
363 |
-
|
364 |
-
$orig_prod_tabs = $this->get_product_tabs( $product_id );
|
365 |
-
|
366 |
-
if ( empty( $orig_prod_tabs ) ) {
|
367 |
-
return $data;
|
368 |
-
}
|
369 |
-
|
370 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
371 |
-
if ( in_array( $prod_tab['type'], [ 'product', 'core' ] ) ) {
|
372 |
-
if ( 'core' === $prod_tab['type'] ) {
|
373 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_title' ] = [ 'original' => $prod_tab['title'] ];
|
374 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_heading' ] = [ 'original' => isset( $prod_tab['heading'] ) ? $prod_tab['heading'] : '' ];
|
375 |
-
} else {
|
376 |
-
$data[ 'tab_' . $prod_tab['position'] . '_title' ] = [ 'original' => get_the_title( $prod_tab['id'] ) ];
|
377 |
-
$data[ 'tab_' . $prod_tab['position'] . '_heading' ] = [ 'original' => get_post( $prod_tab['id'] )->post_content ];
|
378 |
-
}
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
if ( $translation ) {
|
383 |
-
$tr_prod_tabs = $this->get_product_tabs( $translation->ID );
|
384 |
-
|
385 |
-
if ( ! is_array( $tr_prod_tabs ) ) {
|
386 |
-
return $data; // __('Please update original product','woocommerce-multilingual');
|
387 |
-
}
|
388 |
-
|
389 |
-
foreach ( $tr_prod_tabs as $key => $prod_tab ) {
|
390 |
-
if ( in_array( $prod_tab['type'], [ 'product', 'core' ] ) ) {
|
391 |
-
if ( 'core' === $prod_tab['type'] ) {
|
392 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_title' ]['translation'] = $prod_tab['title'];
|
393 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_heading' ]['translation'] = isset( $prod_tab['heading'] ) ? $prod_tab['heading'] : '';
|
394 |
-
} else {
|
395 |
-
$data[ 'tab_' . $prod_tab['position'] . '_title' ]['translation'] = get_the_title( $prod_tab['id'] );
|
396 |
-
$data[ 'tab_' . $prod_tab['position'] . '_heading' ]['translation'] = get_post( $prod_tab['id'] )->post_content;
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
} else {
|
401 |
-
$current_language = $this->sitepress->get_current_language();
|
402 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
403 |
-
if ( 'core' === $prod_tab['type'] ) {
|
404 |
-
$this->sitepress->switch_lang( $lang );
|
405 |
-
$title = __( $prod_tab['title'], 'woocommerce' );
|
406 |
-
if ( $prod_tab['title'] !== $title ) {
|
407 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_title' ]['translation'] = $title;
|
408 |
-
}
|
409 |
-
|
410 |
-
if ( ! isset( $prod_tab['heading'] ) ) {
|
411 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_heading' ]['translation'] = '';
|
412 |
-
} else {
|
413 |
-
$heading = __( $prod_tab['heading'], 'woocommerce' );
|
414 |
-
if ( $prod_tab['heading'] !== $heading ) {
|
415 |
-
$data[ 'coretab_' . $prod_tab['id'] . '_heading' ]['translation'] = $heading;
|
416 |
-
}
|
417 |
-
}
|
418 |
-
|
419 |
-
$this->sitepress->switch_lang( $current_language );
|
420 |
-
}
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
return $data;
|
425 |
-
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* @param $new_id
|
430 |
-
* @param $original_post
|
431 |
-
*/
|
432 |
-
public function duplicate_product_tabs( $new_id, $original_post ) {
|
433 |
-
if ( function_exists( 'wc_tab_manager_duplicate_product' ) ) {
|
434 |
-
wc_tab_manager_duplicate_product( $new_id, $original_post );
|
435 |
-
}
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* @param $post_id
|
440 |
-
* @param $post
|
441 |
-
*/
|
442 |
-
public function force_set_language_information_on_product_tabs( $post_id, $post ) {
|
443 |
-
if ( 'wc_product_tab' === $post->post_type ) {
|
444 |
-
|
445 |
-
$language = $this->sitepress->get_language_for_element( $post_id, 'post_wc_product_tab' );
|
446 |
-
if ( empty( $language ) && $post->post_parent ) {
|
447 |
-
$parent_language = $this->sitepress->get_language_for_element( $post->post_parent, 'post_product' );
|
448 |
-
if ( $parent_language ) {
|
449 |
-
$this->sitepress->set_element_language_details( $post_id, 'post_wc_product_tab', null, $parent_language );
|
450 |
-
}
|
451 |
-
}
|
452 |
-
}
|
453 |
-
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* @param $package
|
458 |
-
* @param $post
|
459 |
-
*
|
460 |
-
* @return mixed
|
461 |
-
*/
|
462 |
-
public function append_custom_tabs_to_translation_package( $package, $post ) {
|
463 |
-
|
464 |
-
if ( 'product' === $post->post_type ) {
|
465 |
-
|
466 |
-
$override_tab_layout = get_post_meta( $post->ID, '_override_tab_layout', true );
|
467 |
-
|
468 |
-
if ( 'yes' === $override_tab_layout ) {
|
469 |
-
|
470 |
-
$meta = (array) get_post_meta( $post->ID, '_product_tabs', true );
|
471 |
-
|
472 |
-
foreach ( $meta as $key => $value ) {
|
473 |
-
|
474 |
-
if ( preg_match( '/product_tab_([0-9]+)/', $key, $matches ) ) {
|
475 |
-
|
476 |
-
$wc_product_tab_id = $matches[1];
|
477 |
-
$wc_product_tab = get_post( $wc_product_tab_id );
|
478 |
-
|
479 |
-
$package['contents'][ 'product_tabs:product_tab:' . $wc_product_tab_id . ':title' ] = [
|
480 |
-
'translate' => 1,
|
481 |
-
'data' => $this->tp->encode_field_data( $wc_product_tab->post_title, 'base64' ),
|
482 |
-
'format' => 'base64',
|
483 |
-
];
|
484 |
-
|
485 |
-
$package['contents'][ 'product_tabs:product_tab:' . $wc_product_tab_id . ':description' ] = [
|
486 |
-
'translate' => 1,
|
487 |
-
'data' => $this->tp->encode_field_data( $wc_product_tab->post_content, 'base64' ),
|
488 |
-
'format' => 'base64',
|
489 |
-
];
|
490 |
-
|
491 |
-
} elseif ( preg_match( '/^core_tab_(.+)$/', $key, $matches ) ) {
|
492 |
-
|
493 |
-
$package['contents'][ 'product_tabs:core_tab_title:' . $matches[1] ] = [
|
494 |
-
'translate' => 1,
|
495 |
-
'data' => $this->tp->encode_field_data( $value['title'], 'base64' ),
|
496 |
-
'format' => 'base64',
|
497 |
-
];
|
498 |
-
|
499 |
-
if ( isset( $value['heading'] ) ) {
|
500 |
-
$package['contents'][ 'product_tabs:core_tab_heading:' . $matches[1] ] = [
|
501 |
-
'translate' => 1,
|
502 |
-
'data' => $this->tp->encode_field_data( $value['heading'], 'base64' ),
|
503 |
-
'format' => 'base64',
|
504 |
-
];
|
505 |
-
}
|
506 |
-
}
|
507 |
-
}
|
508 |
-
}
|
509 |
-
}
|
510 |
-
|
511 |
-
return $package;
|
512 |
-
}
|
513 |
-
|
514 |
-
/**
|
515 |
-
* @param $post_id
|
516 |
-
* @param $data
|
517 |
-
* @param $job
|
518 |
-
*/
|
519 |
-
public function save_custom_tabs_translation( $post_id, $data, $job ) {
|
520 |
-
$translated_product_tabs_updated = false;
|
521 |
-
|
522 |
-
$original_product_tabs = get_post_meta( $job->original_doc_id, '_product_tabs', true );
|
523 |
-
|
524 |
-
if ( $original_product_tabs ) {
|
525 |
-
|
526 |
-
// custom tabs
|
527 |
-
$product_tab_translations = [];
|
528 |
-
|
529 |
-
foreach ( $data as $value ) {
|
530 |
-
|
531 |
-
if ( preg_match( '/product_tabs:product_tab:([0-9]+):(.+)/', $value['field_type'], $matches ) ) {
|
532 |
-
|
533 |
-
$wc_product_tab_id = $matches[1];
|
534 |
-
$field = $matches[2];
|
535 |
-
|
536 |
-
$product_tab_translations[ $wc_product_tab_id ][ $field ] = $value['data'];
|
537 |
-
}
|
538 |
-
}
|
539 |
-
|
540 |
-
if ( $product_tab_translations ) {
|
541 |
-
|
542 |
-
$translated_product_tabs = get_post_meta( $post_id, '_product_tabs', true );
|
543 |
-
$translated_product_tabs = $translated_product_tabs ?: [];
|
544 |
-
|
545 |
-
foreach ( $product_tab_translations as $wc_product_tab_id => $value ) {
|
546 |
-
|
547 |
-
$new_wc_product_tab = [
|
548 |
-
'post_type' => 'wp_product_tab',
|
549 |
-
'post_title' => $value['title'],
|
550 |
-
'post_content' => isset( $value['description'] ) ? $value['description'] : '',
|
551 |
-
'post_status' => 'publish',
|
552 |
-
];
|
553 |
-
|
554 |
-
$wc_product_tab_id_translated = wp_insert_post( $new_wc_product_tab );
|
555 |
-
|
556 |
-
if ( $wc_product_tab_id_translated ) {
|
557 |
-
|
558 |
-
$wc_product_tab_trid = $this->sitepress->get_element_trid( $wc_product_tab_id, 'post_wc_product_tab' );
|
559 |
-
$this->sitepress->set_element_language_details( $wc_product_tab_id_translated, 'post_wc_product_tab', $wc_product_tab_trid, $job->language_code );
|
560 |
-
|
561 |
-
$wc_product_tab_translated = get_post( $wc_product_tab_id_translated );
|
562 |
-
|
563 |
-
$translated_product_tabs[ 'product_tab_' . $wc_product_tab_id_translated ] = [
|
564 |
-
'position' => $original_product_tabs[ 'product_tab_' . $wc_product_tab_id ]['position'],
|
565 |
-
'type' => 'product',
|
566 |
-
'id' => $wc_product_tab_id_translated,
|
567 |
-
'name' => $wc_product_tab_translated->post_name,
|
568 |
-
|
569 |
-
];
|
570 |
-
}
|
571 |
-
}
|
572 |
-
|
573 |
-
$translated_product_tabs_updated = true;
|
574 |
-
}
|
575 |
-
|
576 |
-
// the other tabs
|
577 |
-
$product_tab_translations = [];
|
578 |
-
|
579 |
-
foreach ( $data as $value ) {
|
580 |
-
|
581 |
-
if ( preg_match( '/product_tabs:core_tab_(.+):(.+)/', $value['field_type'], $matches ) ) {
|
582 |
-
|
583 |
-
$tab_field = $matches[1];
|
584 |
-
$tab_id = $matches[2];
|
585 |
-
|
586 |
-
$product_tab_translations[ $tab_id ][ $tab_field ] = $value['data'];
|
587 |
-
}
|
588 |
-
}
|
589 |
-
|
590 |
-
if ( $product_tab_translations ) {
|
591 |
-
foreach ( $product_tab_translations as $id => $tab ) {
|
592 |
-
|
593 |
-
$translated_product_tabs[ 'core_tab_' . $id ] = [
|
594 |
-
'type' => 'core',
|
595 |
-
'position' => $original_product_tabs[ 'core_tab_' . $id ]['position'],
|
596 |
-
'id' => $id,
|
597 |
-
'title' => $tab['title'],
|
598 |
-
];
|
599 |
-
|
600 |
-
$translated_product_tabs[ 'core_tab_' . $id ]['heading'] = isset( $tab['heading'] ) ? $tab['heading'] : '';
|
601 |
-
}
|
602 |
-
|
603 |
-
$translated_product_tabs_updated = true;
|
604 |
-
}
|
605 |
-
|
606 |
-
foreach ( $original_product_tabs as $original_product_tab ) {
|
607 |
-
if ( isset( $translated_product_tabs ) && 'global' === $original_product_tab['type'] ) {
|
608 |
-
$translated_product_tabs = $this->set_global_tab( $original_product_tab, $translated_product_tabs, $job->language_code );
|
609 |
-
$translated_product_tabs_updated = true;
|
610 |
-
}
|
611 |
-
}
|
612 |
-
|
613 |
-
if ( true === $translated_product_tabs_updated && isset( $translated_product_tabs ) ) {
|
614 |
-
update_post_meta( $post_id, '_product_tabs', $translated_product_tabs );
|
615 |
-
}
|
616 |
-
}
|
617 |
-
}
|
618 |
-
|
619 |
-
/**
|
620 |
-
* @param $product_id
|
621 |
-
*
|
622 |
-
* @return array
|
623 |
-
*/
|
624 |
-
public function get_product_tabs( $product_id ) {
|
625 |
-
|
626 |
-
$override_tab_layout = get_post_meta( $product_id, '_override_tab_layout', true );
|
627 |
-
|
628 |
-
if ( 'yes' == $override_tab_layout ) {
|
629 |
-
// product defines its own tab layout?
|
630 |
-
$product_tabs = (array) get_post_meta( $product_id, '_product_tabs', true );
|
631 |
-
} else {
|
632 |
-
// otherwise, get the default layout if any
|
633 |
-
$product_tabs = (array) get_option( 'wc_tab_manager_default_layout', false );
|
634 |
-
}
|
635 |
-
|
636 |
-
return $product_tabs;
|
637 |
-
}
|
638 |
-
|
639 |
-
public function sync_product_tabs( $post_id, $post ) {
|
640 |
-
|
641 |
-
$override_tab_layout = get_post_meta( $post_id, '_override_tab_layout', true );
|
642 |
-
|
643 |
-
if ( $override_tab_layout && $this->woocommerce_wpml->products->is_original_product( $post_id ) ) {
|
644 |
-
|
645 |
-
$original_product_tabs = $this->get_product_tabs( $post_id );
|
646 |
-
|
647 |
-
$trid = $this->sitepress->get_element_trid( $post_id, 'post_' . $post->post_type );
|
648 |
-
$translations = $this->sitepress->get_element_translations( $trid, 'post_' . $post->post_type, true );
|
649 |
-
|
650 |
-
foreach ( $translations as $language => $translation ) {
|
651 |
-
|
652 |
-
if ( empty( $translation->original ) ) {
|
653 |
-
|
654 |
-
$translated_product_tabs = $this->get_product_tabs( $translation->element_id );
|
655 |
-
|
656 |
-
// sync tab positions for product tabs
|
657 |
-
foreach ( $original_product_tabs as $tab ) {
|
658 |
-
if ( $tab['type'] == 'product' ) {
|
659 |
-
$translated_tab_product_id = apply_filters( 'translate_object_id', $tab['id'], 'wc_product_tab', false, $language );
|
660 |
-
if ( $translated_tab_product_id && is_array( $translated_product_tabs[ 'product_tab_' . $translated_tab_product_id ] ) ) {
|
661 |
-
$translated_product_tabs[ 'product_tab_' . $translated_tab_product_id ]['position'] = $tab['position'];
|
662 |
-
}
|
663 |
-
}
|
664 |
-
}
|
665 |
-
|
666 |
-
// sync translated core tabs with original tabs
|
667 |
-
foreach ( $translated_product_tabs as $tab_key => $tab ) {
|
668 |
-
if ( $tab['type'] === 'core' && ! isset( $original_product_tabs[ $tab_key ] ) ) {
|
669 |
-
unset( $translated_product_tabs[ $tab_key ] );
|
670 |
-
}
|
671 |
-
}
|
672 |
-
|
673 |
-
update_post_meta( $translation->element_id, '_product_tabs', $translated_product_tabs );
|
674 |
-
|
675 |
-
}
|
676 |
-
}
|
677 |
-
}
|
678 |
-
|
679 |
-
}
|
680 |
-
|
681 |
-
/**
|
682 |
-
* @param int|string $tab_id
|
683 |
-
*
|
684 |
-
* @return int|string
|
685 |
-
*/
|
686 |
-
public function wc_tab_manager_tab_id( $tab_id ) {
|
687 |
-
if ( is_int( $tab_id ) ) {
|
688 |
-
return apply_filters( 'wpml_object_id', $tab_id, 'wc_product_tab', true );
|
689 |
-
} else {
|
690 |
-
return $tab_id;
|
691 |
-
}
|
692 |
-
}
|
693 |
-
|
694 |
-
public function filter_default_layout( $default_tabs ) {
|
695 |
-
|
696 |
-
if ( is_array( $default_tabs ) ) {
|
697 |
-
foreach ( $default_tabs as $tab_key => $default_tab ) {
|
698 |
-
if ( substr( $tab_key, 0, 10 ) == 'global_tab' ) {
|
699 |
-
$trnsl_tab_id = apply_filters( 'translate_object_id', $default_tab['id'], 'wc_product_tab', true, $this->sitepress->get_current_language() );
|
700 |
-
|
701 |
-
if ( $trnsl_tab_id != $default_tab['id'] ) {
|
702 |
-
$default_tabs[ 'global_tab_' . $trnsl_tab_id ] = $default_tab;
|
703 |
-
$default_tabs[ 'global_tab_' . $trnsl_tab_id ]['id'] = $trnsl_tab_id;
|
704 |
-
$default_tabs[ 'global_tab_' . $trnsl_tab_id ]['name'] = get_post( $trnsl_tab_id )->post_name;
|
705 |
-
unset( $default_tabs[ $tab_key ] );
|
706 |
-
}
|
707 |
-
}
|
708 |
-
}
|
709 |
-
}
|
710 |
-
|
711 |
-
return $default_tabs;
|
712 |
-
}
|
713 |
-
|
714 |
-
public function show_pointer_info() {
|
715 |
-
|
716 |
-
$pointer_ui = new WCML_Pointer_UI(
|
717 |
-
sprintf( __( 'You can translate your custom product tabs on the %1$sWooCommerce product translation page%2$s', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=wpml-wcml' ) . '">', '</a>' ),
|
718 |
-
WCML_Tracking_Link::getWcmlTabManagerDoc(),
|
719 |
-
'woocommerce_product_tabs>p'
|
720 |
-
);
|
721 |
-
|
722 |
-
$pointer_ui->show();
|
723 |
-
|
724 |
-
}
|
725 |
-
|
726 |
-
public function replace_tm_editor_custom_fields_with_own_sections( $fields ) {
|
727 |
-
$fields[] = '_product_tabs';
|
728 |
-
|
729 |
-
return $fields;
|
730 |
-
}
|
731 |
-
|
732 |
-
public function duplicate_categories_exception( $fields ) {
|
733 |
-
$fields[] = '_wc_tab_categories';
|
734 |
-
|
735 |
-
return $fields;
|
736 |
-
}
|
737 |
-
|
738 |
-
public function translate_categories( $post_id_from, $post_id_to, $meta_key ) {
|
739 |
-
if ( '_wc_tab_categories' === $meta_key ) {
|
740 |
-
// Saving has already been processed, remove nonce so that we dont
|
741 |
-
// process translations too (which would overwrite _wc_tab_categories.
|
742 |
-
unset( $_POST['wc_tab_manager_metabox_nonce'] );
|
743 |
-
|
744 |
-
$args = [
|
745 |
-
'element_id' => $post_id_to,
|
746 |
-
'element_type' => 'wc_product_tab',
|
747 |
-
];
|
748 |
-
$language = apply_filters( 'wpml_element_language_code', false, $args );
|
749 |
-
|
750 |
-
$categories = [];
|
751 |
-
$meta_value = get_post_meta( $post_id_from, $meta_key, true );
|
752 |
-
foreach ( $meta_value as $category ) {
|
753 |
-
$categories[] = apply_filters( 'wpml_object_id', $category, 'product_cat', true, $language );
|
754 |
-
}
|
755 |
-
|
756 |
-
update_post_meta( $post_id_to, $meta_key, $categories, $meta_value );
|
757 |
-
}
|
758 |
-
}
|
759 |
-
|
760 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-table-rate-shipping.php
DELETED
@@ -1,357 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use WPML\FP\Fns;
|
4 |
-
use WPML\FP\Logic;
|
5 |
-
use WPML\FP\Obj;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class WCML_Table_Rate_Shipping
|
9 |
-
*/
|
10 |
-
class WCML_Table_Rate_Shipping {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* @var SitePress
|
14 |
-
*/
|
15 |
-
public $sitepress;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var woocommerce_wpml
|
19 |
-
*/
|
20 |
-
public $woocommerce_wpml;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var wpdb
|
24 |
-
*/
|
25 |
-
private $wpdb;
|
26 |
-
|
27 |
-
const PRIORITY_BEFORE_DELETE = 5;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* WCML_Table_Rate_Shipping constructor.
|
31 |
-
*
|
32 |
-
* @param SitePress $sitepress
|
33 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
34 |
-
* @param wpdb $wpdb
|
35 |
-
*/
|
36 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml, wpdb $wpdb ) {
|
37 |
-
$this->sitepress = $sitepress;
|
38 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
39 |
-
$this->wpdb = $wpdb;
|
40 |
-
}
|
41 |
-
|
42 |
-
public function add_hooks() {
|
43 |
-
|
44 |
-
add_action( 'init', [ $this, 'init' ], 9 );
|
45 |
-
|
46 |
-
if ( ! is_admin() ) {
|
47 |
-
add_filter( 'get_the_terms', [ $this, 'shipping_class_id_in_default_language' ], 10, 3 );
|
48 |
-
add_filter( 'woocommerce_shipping_table_rate_is_available', [ $this, 'shipping_table_rate_is_available' ], 10, 3 );
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( wcml_is_multi_currency_on() ) {
|
52 |
-
$wpml_api = $this->sitepress->get_wp_api();
|
53 |
-
if ( $wpml_api->version_compare( $wpml_api->constant( 'TABLE_RATE_SHIPPING_VERSION' ), '3.0.11', '<' ) ) {
|
54 |
-
add_filter( 'woocommerce_table_rate_query_rates_args', [ $this, 'filter_query_rates_args' ] );
|
55 |
-
}
|
56 |
-
|
57 |
-
add_filter(
|
58 |
-
'woocommerce_table_rate_package_row_base_price',
|
59 |
-
[ $this, 'filter_product_base_price' ],
|
60 |
-
10,
|
61 |
-
3
|
62 |
-
);
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( is_admin() ) {
|
66 |
-
// phpcs:disable WordPress.Security.NonceVerification.Missing
|
67 |
-
if ( Obj::prop( 'shipping_abort_reason', $_POST ) ) {
|
68 |
-
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
69 |
-
add_filter( 'woocommerce_table_rate_get_shipping_rates', [ $this, 'register_abort_messages' ] );
|
70 |
-
}
|
71 |
-
add_action( 'wp_ajax_woocommerce_table_rate_delete', [ $this, 'unregister_abort_messages_ajax' ], self::PRIORITY_BEFORE_DELETE );
|
72 |
-
add_action( 'delete_product_shipping_class', [ $this, 'unregister_abort_messages_shipping_class' ], self::PRIORITY_BEFORE_DELETE );
|
73 |
-
}
|
74 |
-
add_filter( 'woocommerce_table_rate_query_rates', [ $this, 'translate_abort_messages' ] );
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Register shipping labels for string translation.
|
80 |
-
*/
|
81 |
-
public function init() {
|
82 |
-
// Register shipping label.
|
83 |
-
if (
|
84 |
-
isset( $_GET['page'] ) &&
|
85 |
-
(
|
86 |
-
'shipping_zones' === $_GET['page'] ||
|
87 |
-
(
|
88 |
-
'wc-settings' === $_GET['page'] &&
|
89 |
-
isset( $_GET['tab'] ) &&
|
90 |
-
'shipping' === $_GET['tab']
|
91 |
-
)
|
92 |
-
)
|
93 |
-
) {
|
94 |
-
|
95 |
-
$this->show_pointer_info();
|
96 |
-
|
97 |
-
if ( isset( $_POST['shipping_label'] ) &&
|
98 |
-
isset( $_POST['woocommerce_table_rate_title'] ) ) {
|
99 |
-
do_action( 'wpml_register_single_string', WCML_WC_Shipping::STRINGS_CONTEXT, sanitize_text_field( $_POST['woocommerce_table_rate_title'] ) . '_shipping_method_title', sanitize_text_field( $_POST['woocommerce_table_rate_title'] ) );
|
100 |
-
|
101 |
-
$shipping_labels = array_map( 'wc_clean', $_POST['shipping_label'] );
|
102 |
-
foreach ( $shipping_labels as $key => $shipping_label ) {
|
103 |
-
$rate_key = isset( $_GET['instance_id'] ) ? 'table_rate' . $_GET['instance_id'] . $_POST['rate_id'][ $key ] : $shipping_label;
|
104 |
-
do_action( 'wpml_register_single_string', WCML_WC_Shipping::STRINGS_CONTEXT, $rate_key . '_shipping_method_title', $shipping_label );
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* @param $terms
|
112 |
-
* @param $post_id
|
113 |
-
* @param $taxonomy
|
114 |
-
*
|
115 |
-
* @return mixed
|
116 |
-
*/
|
117 |
-
public function shipping_class_id_in_default_language( $terms, $post_id, $taxonomy ) {
|
118 |
-
global $icl_adjust_id_url_filter_off;
|
119 |
-
|
120 |
-
$is_product_object = 'product' === get_post_type( $post_id ) || 'product_variation' === get_post_type( $post_id );
|
121 |
-
if ( $terms && $is_product_object && 'product_shipping_class' === $taxonomy ) {
|
122 |
-
|
123 |
-
if ( is_admin() ) {
|
124 |
-
$shipp_class_language = $this->woocommerce_wpml->products->get_original_product_language( $post_id );
|
125 |
-
} else {
|
126 |
-
$shipp_class_language = $this->sitepress->get_default_language();
|
127 |
-
}
|
128 |
-
|
129 |
-
$cache_key = md5( wp_json_encode( $terms ) );
|
130 |
-
$cache_key .= ':' . $post_id . $shipp_class_language;
|
131 |
-
|
132 |
-
$cache_group = 'trnsl_shipping_class';
|
133 |
-
$cache_terms = wp_cache_get( $cache_key, $cache_group );
|
134 |
-
|
135 |
-
if ( $cache_terms ) {
|
136 |
-
return $cache_terms;
|
137 |
-
}
|
138 |
-
|
139 |
-
foreach ( $terms as $k => $term ) {
|
140 |
-
|
141 |
-
$shipping_class_id = apply_filters( 'translate_object_id', $term->term_id, 'product_shipping_class', false, $shipp_class_language );
|
142 |
-
|
143 |
-
$icl_adjust_id_url_filter = $icl_adjust_id_url_filter_off;
|
144 |
-
$icl_adjust_id_url_filter_off = true;
|
145 |
-
|
146 |
-
$terms[ $k ] = get_term( $shipping_class_id, 'product_shipping_class' );
|
147 |
-
|
148 |
-
$icl_adjust_id_url_filter_off = $icl_adjust_id_url_filter;
|
149 |
-
}
|
150 |
-
|
151 |
-
wp_cache_set( $cache_key, $terms, $cache_group );
|
152 |
-
}
|
153 |
-
|
154 |
-
return $terms;
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* It's not possible to filter rate_min and rate_max so we use the original price to compare against these values
|
159 |
-
*
|
160 |
-
* @param array $args
|
161 |
-
*
|
162 |
-
* @return mixed
|
163 |
-
*/
|
164 |
-
public function filter_query_rates_args( $args ) {
|
165 |
-
if ( isset( $args['price'] ) && wcml_get_woocommerce_currency_option() !== $this->woocommerce_wpml->multi_currency->get_client_currency() ) {
|
166 |
-
$args['price'] = $this->woocommerce_wpml->multi_currency->prices->unconvert_price_amount( $args['price'] );
|
167 |
-
}
|
168 |
-
|
169 |
-
return $args;
|
170 |
-
}
|
171 |
-
|
172 |
-
public function show_pointer_info() {
|
173 |
-
$pointer_ui = new WCML_Pointer_UI(
|
174 |
-
sprintf( __( 'You can translate this method title on the %1$sWPML String Translation page%2$s. Use the search on the top of that page to find the method title string.', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php' ) . '">', '</a>' ),
|
175 |
-
WCML_Tracking_Link::getWcmlTableRateShippingDoc(),
|
176 |
-
'woocommerce_table_rate_title'
|
177 |
-
);
|
178 |
-
|
179 |
-
$pointer_ui->show();
|
180 |
-
|
181 |
-
$pointer_ui = new WCML_Pointer_UI(
|
182 |
-
sprintf( __( 'You can translate the labels of your table rates on the %1$sWPML String Translation page%2$s. Use the search on the top of that page to find the labels strings.', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php' ) . '">', '</a>' ),
|
183 |
-
WCML_Tracking_Link::getWcmlTableRateShippingDoc(),
|
184 |
-
'shipping_rates .shipping_label a'
|
185 |
-
);
|
186 |
-
|
187 |
-
$pointer_ui->show();
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* @param $row_base_price
|
192 |
-
* @param WC_Product $_product
|
193 |
-
* @param $qty
|
194 |
-
*
|
195 |
-
* @return mixed
|
196 |
-
*/
|
197 |
-
public function filter_product_base_price( $row_base_price, $_product, $qty ) {
|
198 |
-
|
199 |
-
if ( $_product && wcml_get_woocommerce_currency_option() !== $this->woocommerce_wpml->multi_currency->get_client_currency() ) {
|
200 |
-
$row_base_price = $this->woocommerce_wpml->products->get_product_price_from_db( $_product->get_id() ) * $qty;
|
201 |
-
}
|
202 |
-
|
203 |
-
return $row_base_price;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Register the new rate's shipping abort reasons.
|
208 |
-
*
|
209 |
-
* @param array[] $rates
|
210 |
-
* @return array[]
|
211 |
-
*/
|
212 |
-
public function register_abort_messages( $rates ) {
|
213 |
-
// $registerAbortReason :: array -> void
|
214 |
-
$registerAbortReason = function( $rate ) {
|
215 |
-
do_action(
|
216 |
-
'wpml_register_single_string',
|
217 |
-
WCML_WC_Shipping::STRINGS_CONTEXT,
|
218 |
-
$this->get_rate_name( $rate['rate_id'] ),
|
219 |
-
$rate['rate_abort_reason']
|
220 |
-
);
|
221 |
-
};
|
222 |
-
|
223 |
-
return wpml_collect( $rates )
|
224 |
-
->filter( Obj::prop( 'rate_abort_reason' ) )
|
225 |
-
->map( $registerAbortReason )
|
226 |
-
->toArray();
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Unregister the deleted rate's shipping abort reasons when deleted via AJAX.
|
231 |
-
*/
|
232 |
-
public function unregister_abort_messages_ajax() {
|
233 |
-
check_ajax_referer( 'delete-rate', 'security' );
|
234 |
-
|
235 |
-
wpml_collect( (array) Obj::prop( 'rate_id', $_POST ) )
|
236 |
-
->map( Fns::unary( 'intval' ) )
|
237 |
-
->map( [ $this, 'unregister_abort_messages' ] );
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Unregister the deleted rate's shipping abort reasons when the shipping class it's for is deleted.
|
242 |
-
*
|
243 |
-
* @param int $term_id
|
244 |
-
*/
|
245 |
-
public function unregister_abort_messages_shipping_class( $term_id ) {
|
246 |
-
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
247 |
-
$table = $this->wpdb->prefix . 'woocommerce_shipping_table_rates';
|
248 |
-
$query = $this->wpdb->prepare(
|
249 |
-
"SELECT rate_id FROM $table WHERE rate_class=%d",
|
250 |
-
[ $term_id ]
|
251 |
-
);
|
252 |
-
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
253 |
-
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
254 |
-
wpml_collect( $this->wpdb->get_col( $query ) )
|
255 |
-
->map( [ $this, 'unregister_abort_messages' ] );
|
256 |
-
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Translate the rate's shipping abort reasons
|
261 |
-
*
|
262 |
-
* @param stdClass[] $rates
|
263 |
-
* @return stdClass[]
|
264 |
-
*/
|
265 |
-
public function translate_abort_messages( $rates ) {
|
266 |
-
// translateAbortReason :: stdClass -> stdClass
|
267 |
-
$translateAbortReason = function( $rate ) {
|
268 |
-
return Obj::assoc(
|
269 |
-
'rate_abort_reason',
|
270 |
-
apply_filters(
|
271 |
-
'wpml_translate_single_string',
|
272 |
-
$rate->rate_abort_reason,
|
273 |
-
WCML_WC_Shipping::STRINGS_CONTEXT,
|
274 |
-
$this->get_rate_name( $rate->rate_id )
|
275 |
-
),
|
276 |
-
$rate
|
277 |
-
);
|
278 |
-
};
|
279 |
-
|
280 |
-
return wpml_collect( $rates )
|
281 |
-
->map( Logic::ifElse( Obj::prop( 'rate_abort_reason' ), $translateAbortReason, Fns::identity() ) )
|
282 |
-
->toArray();
|
283 |
-
}
|
284 |
-
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Unregister the deleted rate's shipping abort reasons for list of ids
|
288 |
-
*
|
289 |
-
* @param int $rate_id
|
290 |
-
*/
|
291 |
-
public function unregister_abort_messages( $rate_id ) {
|
292 |
-
icl_unregister_string(
|
293 |
-
WCML_WC_Shipping::STRINGS_CONTEXT,
|
294 |
-
$this->get_rate_name( $rate_id )
|
295 |
-
);
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* The name for the rate's shipping abort reason
|
300 |
-
*
|
301 |
-
* @param int $rate_id
|
302 |
-
* @return string
|
303 |
-
*/
|
304 |
-
private function get_rate_name( $rate_id ) {
|
305 |
-
return 'table_rate_shipping_abort_reason_' . $rate_id;
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* @param bool $available
|
310 |
-
* @param array $package
|
311 |
-
* @param WC_Shipping_Method $object
|
312 |
-
*
|
313 |
-
* @return bool
|
314 |
-
*/
|
315 |
-
public function shipping_table_rate_is_available( $available, $package, $object ) {
|
316 |
-
|
317 |
-
add_filter(
|
318 |
-
'option_woocommerce_table_rate_priorities_' . $object->instance_id,
|
319 |
-
[ $this, 'filter_table_rate_priorities' ]
|
320 |
-
);
|
321 |
-
remove_filter(
|
322 |
-
'woocommerce_shipping_table_rate_is_available',
|
323 |
-
[ $this, 'shipping_table_rate_is_available' ],
|
324 |
-
10
|
325 |
-
);
|
326 |
-
|
327 |
-
$available = $object->is_available( $package );
|
328 |
-
|
329 |
-
add_filter(
|
330 |
-
'woocommerce_shipping_table_rate_is_available',
|
331 |
-
[ $this, 'shipping_table_rate_is_available' ],
|
332 |
-
10,
|
333 |
-
3
|
334 |
-
);
|
335 |
-
|
336 |
-
return $available;
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* @param array $priorities
|
341 |
-
*
|
342 |
-
* @return array
|
343 |
-
*/
|
344 |
-
public function filter_table_rate_priorities( $priorities ) {
|
345 |
-
|
346 |
-
foreach ( $priorities as $slug => $priority ) {
|
347 |
-
|
348 |
-
$shipping_class_term = get_term_by( 'slug', $slug, 'product_shipping_class' );
|
349 |
-
if ( $shipping_class_term->slug !== $slug ) {
|
350 |
-
unset( $priorities[ $slug ] );
|
351 |
-
$priorities[ $shipping_class_term->slug ] = $priority;
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
return $priorities;
|
356 |
-
}
|
357 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-the-events-calendar.php
DELETED
@@ -1,490 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_The_Events_Calendar {
|
4 |
-
|
5 |
-
/** @var SitePress */
|
6 |
-
private $sitepress;
|
7 |
-
/** @var woocommerce_wpml */
|
8 |
-
private $woocommerce_wpml;
|
9 |
-
|
10 |
-
/** @var WPML_Element_Translation_Package */
|
11 |
-
private $tp;
|
12 |
-
|
13 |
-
/** @var int|null $ticket_post_id_backup */
|
14 |
-
private $ticket_post_id_backup;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* WCML_The_Events_Calendar constructor.
|
18 |
-
*
|
19 |
-
* @param SitePress $sitepress
|
20 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
21 |
-
*/
|
22 |
-
public function __construct( $sitepress, $woocommerce_wpml ) {
|
23 |
-
// @todo Cover by tests, required for wcml-3037.
|
24 |
-
$this->sitepress = $sitepress;
|
25 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
26 |
-
|
27 |
-
if ( isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'tribe-ticket-add-' ) ) {
|
28 |
-
add_action( 'tribe_tickets_ticket_add', [ $this, 'unset_post_post_id' ] );
|
29 |
-
add_action( 'event_tickets_after_save_ticket', [ $this, 'restore_post_post_id' ] );
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
if ( is_admin() ) {
|
34 |
-
$this->tp = new WPML_Element_Translation_Package();
|
35 |
-
|
36 |
-
add_action( 'save_post', [ $this, 'synchronize_event_for_ticket' ], 20, 3 );
|
37 |
-
|
38 |
-
add_action( 'wpml_pb_shortcode_content_for_translation', [ $this, 'maybe_mark_event_as_needs_update' ], 100, 2 );
|
39 |
-
|
40 |
-
add_filter( 'wpml_tm_translation_job_data', [ $this, 'append_RSVP_tickets_to_translation_job' ], 10, 2 );
|
41 |
-
add_action( 'wpml_pro_translation_completed', [ $this, 'save_RSVP_tickets_translations' ], 10, 3 );
|
42 |
-
|
43 |
-
add_filter( 'wpml_tm_translation_job_data', [ $this, 'append_woo_tickets_to_translation_job' ], 10, 2 );
|
44 |
-
add_action( 'wpml_pro_translation_completed', [ $this, 'save_woo_tickets_translations' ], 10, 3 );
|
45 |
-
|
46 |
-
add_action( 'save_post', [ $this, 'synchronize_venue_for_event' ], 20, 3 );
|
47 |
-
add_action( 'admin_footer', [ $this, 'pre_select_translated_venue' ], 1000 );
|
48 |
-
add_action( 'wpml_pro_translation_completed', [ $this, 'save_venue_for_translation' ], 10, 3 );
|
49 |
-
|
50 |
-
} else {
|
51 |
-
add_action( 'event_tickets_rsvp_tickets_generated', [ $this, 'sync_rsvp_fields_on_attendee_created' ], 10, 3 );
|
52 |
-
add_filter( 'tribe_get_organizer_ids', [ $this, 'get_translated_organizer_ids' ], 10, 2 );
|
53 |
-
add_filter( 'tribe_events_cost_unformatted', [ $this, 'convert_events_cost' ], 10, 1 );
|
54 |
-
}
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
public function unset_post_post_id() {
|
59 |
-
if ( isset( $_POST['post_ID'] ) ) {
|
60 |
-
$this->ticket_post_id_backup = $_POST['post_ID'];
|
61 |
-
unset( $_POST['post_ID'] );
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
public function restore_post_post_id() {
|
66 |
-
if ( isset( $this->ticket_post_id_backup ) ) {
|
67 |
-
$_POST['post_ID'] = $this->ticket_post_id_backup;
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
public function synchronize_event_for_ticket( $post_id, $post, $update ) {
|
72 |
-
if ( 'product' === $post->post_type ) {
|
73 |
-
if ( ! $this->woocommerce_wpml->products->is_original_product( $post_id ) ) {
|
74 |
-
$original_product_id = apply_filters( 'translate_object_id', $post_id, 'product', false, $this->sitepress->get_default_language() );
|
75 |
-
if ( $original_product_id ) {
|
76 |
-
$original_event_id = get_post_meta( $original_product_id, '_tribe_wooticket_for_event', true );
|
77 |
-
if ( $original_event_id ) {
|
78 |
-
$event_id = apply_filters( 'translate_object_id', $original_event_id, 'tribe_events', false );
|
79 |
-
if ( $event_id ) {
|
80 |
-
update_post_meta( $post_id, '_tribe_wooticket_for_event', $event_id );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
public function maybe_mark_event_as_needs_update( $content, $post_id ) {
|
89 |
-
$post = get_post( $post_id );
|
90 |
-
|
91 |
-
if ( 'tribe_events' === $post->post_type ) {
|
92 |
-
if ( $post_id == $this->sitepress->get_original_element_id( $post_id, 'post_tribe_events' ) ) {
|
93 |
-
$tickets = [];
|
94 |
-
$ticket_meta = [];
|
95 |
-
|
96 |
-
if ( class_exists( 'Tribe__Tickets__RSVP' ) ) {
|
97 |
-
$ticket_ids = Tribe__Tickets__RSVP::get_instance()->get_tickets_ids( $post_id );
|
98 |
-
foreach ( $ticket_ids as $ticket_id ) {
|
99 |
-
$ticket = Tribe__Tickets__RSVP::get_instance()->get_ticket( $post_id, $ticket_id );
|
100 |
-
$tickets[] = $ticket->name . '|#|' . $ticket->description;
|
101 |
-
$ticket_meta[] = get_post_meta( $ticket_id, '_tribe_tickets_meta', true );
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
|
106 |
-
$ticket_ids = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance()->get_tickets_ids( $post->ID );
|
107 |
-
foreach ( $ticket_ids as $ticket_id ) {
|
108 |
-
$ticket = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance()->get_ticket( $post_id, $ticket_id );
|
109 |
-
$tickets[] = $ticket->name . '|#|' . $ticket->description;
|
110 |
-
$ticket_meta[] = get_post_meta( $ticket_id, '_tribe_tickets_meta', true );
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
$content .= md5( serialize( $tickets ) );
|
115 |
-
$content .= md5( serialize( $ticket_meta ) );
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
return $content;
|
120 |
-
}
|
121 |
-
|
122 |
-
public function append_RSVP_tickets_to_translation_job( $package, $post ) {
|
123 |
-
|
124 |
-
if ( 'tribe_events' === $post->post_type && class_exists( 'Tribe__Tickets__RSVP' ) ) {
|
125 |
-
|
126 |
-
$ticket_lang = $this->sitepress->get_language_for_element( $post->ID, 'post_tribe_events' );
|
127 |
-
$this->sitepress->switch_lang( $ticket_lang );
|
128 |
-
$ticket_ids = Tribe__Tickets__RSVP::get_instance()->get_tickets_ids( $post->ID );
|
129 |
-
$this->sitepress->switch_lang();
|
130 |
-
|
131 |
-
if ( $ticket_ids ) {
|
132 |
-
foreach ( $ticket_ids as $ticket_id ) {
|
133 |
-
|
134 |
-
$ticket_post = get_post( $ticket_id );
|
135 |
-
$original_ticket_id = $this->sitepress->get_original_element_id( $ticket_id, 'post_tribe_rsvp_tickets' );
|
136 |
-
|
137 |
-
if ( ! empty( $ticket_post->post_title ) ) {
|
138 |
-
$package['contents'][ 'rsvp_tickets_' . $original_ticket_id . '_title' ] = [
|
139 |
-
'translate' => 1,
|
140 |
-
'data' => $this->tp->encode_field_data( $ticket_post->post_title, 'base64' ),
|
141 |
-
'format' => 'base64',
|
142 |
-
];
|
143 |
-
}
|
144 |
-
if ( ! empty( $ticket_post->post_excerpt ) ) {
|
145 |
-
$package['contents'][ 'rsvp_tickets_' . $original_ticket_id . '_excerpt' ] = [
|
146 |
-
'translate' => 1,
|
147 |
-
'data' => $this->tp->encode_field_data( $ticket_post->post_excerpt, 'base64' ),
|
148 |
-
'format' => 'base64',
|
149 |
-
];
|
150 |
-
}
|
151 |
-
|
152 |
-
// fieldsets.
|
153 |
-
$package = $this->append_tickets_meta( $package, $ticket_id, $original_ticket_id );
|
154 |
-
|
155 |
-
}
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
return $package;
|
160 |
-
}
|
161 |
-
|
162 |
-
public function save_RSVP_tickets_translations( $post_id, $data, $job ) {
|
163 |
-
|
164 |
-
$translations = [];
|
165 |
-
|
166 |
-
foreach ( $data as $key => $value ) {
|
167 |
-
|
168 |
-
if ( preg_match( '/rsvp_tickets_([0-9]+)_title/', $key, $matches ) ) {
|
169 |
-
$rsvp_post_id = $matches[1];
|
170 |
-
if ( 'on' === $value['finished'] ) {
|
171 |
-
$translations[ $rsvp_post_id ]['post_title'] = $value['data'];
|
172 |
-
}
|
173 |
-
} elseif ( preg_match( '/rsvp_tickets_([0-9]+)_excerpt/', $key, $matches ) ) {
|
174 |
-
$rsvp_post_id = $matches[1];
|
175 |
-
if ( 'on' === $value['finished'] ) {
|
176 |
-
$translations[ $rsvp_post_id ]['post_excerpt'] = $value['data'];
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
foreach ( $translations as $rsvp_post_id => $translation ) {
|
182 |
-
|
183 |
-
$translated_rsvp_post_id = apply_filters( 'translate_object_id', $rsvp_post_id, 'tribe_rsvp_tickets', false, $job->language_code );
|
184 |
-
|
185 |
-
$postarr = [
|
186 |
-
'post_type' => 'tribe_rsvp_tickets',
|
187 |
-
'post_status' => 'publish',
|
188 |
-
'post_title' => $translation['post_title'],
|
189 |
-
'post_excerpt' => $translation['post_excerpt'],
|
190 |
-
'post_name' => sanitize_title_with_dashes( $translation['post_title'] ),
|
191 |
-
];
|
192 |
-
|
193 |
-
if ( $translated_rsvp_post_id && $translated_rsvp_post_id != $rsvp_post_id ) {
|
194 |
-
global $wpml_post_translations;
|
195 |
-
$postarr['ID'] = $translated_rsvp_post_id;
|
196 |
-
remove_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100 );
|
197 |
-
wp_update_post( $postarr );
|
198 |
-
add_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100 );
|
199 |
-
|
200 |
-
} else {
|
201 |
-
$translated_rsvp_post_id = wp_insert_post( $postarr );
|
202 |
-
$trid = $this->sitepress->get_element_trid( $rsvp_post_id, 'post_tribe_rsvp_tickets' );
|
203 |
-
$this->sitepress->set_element_language_details( $translated_rsvp_post_id, 'post_tribe_rsvp_tickets', $trid, $job->language_code );
|
204 |
-
}
|
205 |
-
|
206 |
-
$event_id = get_post_meta( $rsvp_post_id, '_tribe_rsvp_for_event', true );
|
207 |
-
|
208 |
-
$translated_event_id = apply_filters( 'translate_object_id', $event_id, 'tribe_events', false, $job->language_code );
|
209 |
-
update_post_meta( $translated_rsvp_post_id, '_tribe_rsvp_for_event', $translated_event_id );
|
210 |
-
|
211 |
-
$this->sync_custom_fields( $rsvp_post_id, $translated_rsvp_post_id );
|
212 |
-
|
213 |
-
$this->save_ticket_meta_translations( $rsvp_post_id, $translated_rsvp_post_id, $data );
|
214 |
-
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
public function append_woo_tickets_to_translation_job( $package, $post ) {
|
219 |
-
|
220 |
-
if ( 'tribe_events' === $post->post_type && class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
|
221 |
-
|
222 |
-
$ticket_lang = $this->sitepress->get_language_for_element( $post->ID, 'post_tribe_events' );
|
223 |
-
$this->sitepress->switch_lang( $ticket_lang );
|
224 |
-
$ticket_ids = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance()->get_tickets_ids( $post->ID );
|
225 |
-
$this->sitepress->switch_lang();
|
226 |
-
|
227 |
-
if ( $ticket_ids ) {
|
228 |
-
foreach ( $ticket_ids as $ticket_id ) {
|
229 |
-
|
230 |
-
$ticket_post = get_post( $ticket_id );
|
231 |
-
$original_ticket_id = $this->sitepress->get_original_element_id( $ticket_id, 'post_product' );
|
232 |
-
|
233 |
-
if ( ! empty( $ticket_post->post_title ) ) {
|
234 |
-
$package['contents'][ 'woo_tickets_' . $original_ticket_id . '_title' ] = [
|
235 |
-
'translate' => 1,
|
236 |
-
'data' => $this->tp->encode_field_data( $ticket_post->post_title, 'base64' ),
|
237 |
-
'format' => 'base64',
|
238 |
-
];
|
239 |
-
}
|
240 |
-
if ( ! empty( $ticket_post->post_excerpt ) ) {
|
241 |
-
$package['contents'][ 'woo_tickets_' . $original_ticket_id . '_excerpt' ] = [
|
242 |
-
'translate' => 1,
|
243 |
-
'data' => $this->tp->encode_field_data( $ticket_post->post_excerpt, 'base64' ),
|
244 |
-
'format' => 'base64',
|
245 |
-
];
|
246 |
-
}
|
247 |
-
|
248 |
-
// Fieldsets.
|
249 |
-
$package = $this->append_tickets_meta( $package, $ticket_id, $original_ticket_id );
|
250 |
-
|
251 |
-
}
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
return $package;
|
256 |
-
}
|
257 |
-
|
258 |
-
public function save_woo_tickets_translations( $post_id, $data, $job ) {
|
259 |
-
global $wpml_post_translations;
|
260 |
-
|
261 |
-
$translations = [];
|
262 |
-
|
263 |
-
foreach ( $data as $key => $value ) {
|
264 |
-
|
265 |
-
if ( preg_match( '/woo_tickets_([0-9]+)_title/', $key, $matches ) ) {
|
266 |
-
$ticket_post_id = $matches[1];
|
267 |
-
if ( 'on' === $value['finished'] ) {
|
268 |
-
$translations[ $ticket_post_id ]['post_title'] = $value['data'];
|
269 |
-
}
|
270 |
-
} elseif ( preg_match( '/woo_tickets_([0-9]+)_excerpt/', $key, $matches ) ) {
|
271 |
-
$ticket_post_id = $matches[1];
|
272 |
-
if ( 'on' === $value['finished'] ) {
|
273 |
-
$translations[ $ticket_post_id ]['post_excerpt'] = $value['data'];
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
foreach ( $translations as $ticket_post_id => $translation ) {
|
279 |
-
$translated_ticket_post_id = apply_filters( 'translate_object_id', $ticket_post_id, 'product', false, $job->language_code );
|
280 |
-
|
281 |
-
$postarr = [
|
282 |
-
'post_type' => 'product',
|
283 |
-
'post_status' => 'publish',
|
284 |
-
'post_title' => $translation['post_title'],
|
285 |
-
'post_excerpt' => $translation['post_excerpt'],
|
286 |
-
'post_name' => sanitize_title_with_dashes( $translation['post_title'] ),
|
287 |
-
];
|
288 |
-
|
289 |
-
remove_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100 );
|
290 |
-
if ( $translated_ticket_post_id && $translated_ticket_post_id != $ticket_post_id ) {
|
291 |
-
$postarr['ID'] = $translated_ticket_post_id;
|
292 |
-
wp_update_post( $postarr );
|
293 |
-
} else {
|
294 |
-
$translated_ticket_post_id = wp_insert_post( $postarr );
|
295 |
-
$trid = $this->sitepress->get_element_trid( $ticket_post_id, 'post_product' );
|
296 |
-
$this->sitepress->set_element_language_details( $translated_ticket_post_id, 'post_product', $trid, $job->language_code );
|
297 |
-
}
|
298 |
-
add_action( 'save_post', [ $wpml_post_translations, 'save_post_actions' ], 100, 2 );
|
299 |
-
|
300 |
-
$event_id = get_post_meta( $ticket_post_id, '_tribe_wooticket_for_event', true );
|
301 |
-
|
302 |
-
$translated_event_id = apply_filters( 'translate_object_id', $event_id, 'tribe_events', false, $job->language_code );
|
303 |
-
update_post_meta( $translated_ticket_post_id, '_tribe_wooticket_for_event', $translated_event_id );
|
304 |
-
|
305 |
-
$this->sync_custom_fields( $ticket_post_id, $translated_ticket_post_id );
|
306 |
-
|
307 |
-
$this->save_ticket_meta_translations( $ticket_post_id, $translated_ticket_post_id, $data );
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
private function append_tickets_meta( $package, $ticket_id, $original_ticket_id ) {
|
312 |
-
|
313 |
-
$ticket_meta = get_post_meta( $ticket_id, '_tribe_tickets_meta', true );
|
314 |
-
if ( is_array( $ticket_meta ) ) {
|
315 |
-
foreach ( $ticket_meta as $k => $meta ) {
|
316 |
-
$package['contents'][ 'rsvp_tickets_' . $original_ticket_id . '_meta_' . $k . '_label' ] = [
|
317 |
-
'translate' => 1,
|
318 |
-
'data' => $this->tp->encode_field_data( $meta['label'], 'base64' ),
|
319 |
-
'format' => 'base64',
|
320 |
-
];
|
321 |
-
$package['contents'][ 'rsvp_tickets_' . $original_ticket_id . '_meta_' . $k . '_slug' ] = [
|
322 |
-
'translate' => 1,
|
323 |
-
'data' => $this->tp->encode_field_data( $meta['slug'], 'base64' ),
|
324 |
-
'format' => 'base64',
|
325 |
-
];
|
326 |
-
if ( isset( $meta['extra']['options'] ) ) {
|
327 |
-
foreach ( $meta['extra']['options'] as $option_id => $option_name ) {
|
328 |
-
|
329 |
-
$package['contents'][ 'rsvp_tickets_' . $original_ticket_id . '_meta_' . $k . '_option_' . $option_id ] = [
|
330 |
-
'translate' => 1,
|
331 |
-
'data' => $this->tp->encode_field_data( $option_name, 'base64' ),
|
332 |
-
'format' => 'base64',
|
333 |
-
];
|
334 |
-
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
|
340 |
-
return $package;
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* @param int $ticket_id
|
345 |
-
* @param int $translated_ticket_id
|
346 |
-
* @param array $data
|
347 |
-
*/
|
348 |
-
private function save_ticket_meta_translations( $ticket_id, $translated_ticket_id, $data ) {
|
349 |
-
$ticket_meta = get_post_meta( $ticket_id, '_tribe_tickets_meta', true );
|
350 |
-
$translated_ticket_meta = $ticket_meta;
|
351 |
-
if ( is_array( $ticket_meta ) ) {
|
352 |
-
|
353 |
-
foreach ( $ticket_meta as $k => $meta ) {
|
354 |
-
$key = 'rsvp_tickets_' . $ticket_id . '_meta_' . $k . '_label';
|
355 |
-
if ( isset( $data[ $key ] ) && 'on' === $data[ $key ]['finished'] ) {
|
356 |
-
$translated_ticket_meta[ $k ]['label'] = $data[ $key ]['data'];
|
357 |
-
}
|
358 |
-
|
359 |
-
$key = 'rsvp_tickets_' . $ticket_id . '_meta_' . $k . '_slug';
|
360 |
-
if ( isset( $data[ $key ] ) && 'on' === $data[ $key ]['finished'] ) {
|
361 |
-
$translated_ticket_meta[ $k ]['slug'] = $data[ $key ]['data'];
|
362 |
-
}
|
363 |
-
|
364 |
-
if ( isset( $meta['extra']['options'] ) ) {
|
365 |
-
foreach ( $meta['extra']['options'] as $option_id => $option_name ) {
|
366 |
-
$key = 'rsvp_tickets_' . $ticket_id . '_meta_' . $k . '_option_' . $option_id;
|
367 |
-
if ( isset( $data[ $key ] ) && 'on' === $data[ $key ]['finished'] ) {
|
368 |
-
$translated_ticket_meta[ $k ]['extra']['options'][ $option_id ] = $data[ $key ]['data'];
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}
|
372 |
-
}
|
373 |
-
}
|
374 |
-
|
375 |
-
update_post_meta( $translated_ticket_id, '_tribe_tickets_meta', $translated_ticket_meta );
|
376 |
-
|
377 |
-
update_post_meta(
|
378 |
-
$translated_ticket_id,
|
379 |
-
'_tribe_tickets_meta_enabled',
|
380 |
-
get_post_meta( $ticket_id, '_tribe_tickets_meta_enabled', true )
|
381 |
-
);
|
382 |
-
|
383 |
-
}
|
384 |
-
|
385 |
-
private function sync_custom_fields( $original_ticket_id, $translated_ticket_id ) {
|
386 |
-
// Sync custom fields.
|
387 |
-
$custom_fields_sync = [ '_stock', '_manage_stock', 'total_sales', '_price' ];
|
388 |
-
foreach ( $custom_fields_sync as $custom_field ) {
|
389 |
-
$value = get_post_meta( $original_ticket_id, $custom_field, true );
|
390 |
-
if ( $value !== false ) {
|
391 |
-
update_post_meta( $translated_ticket_id, $custom_field, $value );
|
392 |
-
}
|
393 |
-
}
|
394 |
-
}
|
395 |
-
|
396 |
-
public function synchronize_venue_for_event( $post_id, $post, $update ) {
|
397 |
-
|
398 |
-
if ( $post->post_type === 'tribe_event' ) {
|
399 |
-
|
400 |
-
$venue_id = get_post_meta( $post_id, '_EventVenueID', true );
|
401 |
-
|
402 |
-
$original_event_id = $this->sitepress->get_original_element_id( $post_id, 'post_tribe_event' );
|
403 |
-
|
404 |
-
if ( $original_event_id == $post_id ) {
|
405 |
-
$event_trid = $this->sitepress->get_element_trid( $post_id, 'post_tribe_venue' );
|
406 |
-
$event_translations = $this->sitepress->get_element_translations( $event_trid, 'post_tribe_venue' );
|
407 |
-
|
408 |
-
if ( $venue_id ) {
|
409 |
-
foreach ( $event_translations as $language_code => $event_translation ) {
|
410 |
-
if ( $event_translation->element_id != $original_event_id ) {
|
411 |
-
$translated_venue_id = apply_filters( 'translate_object_id', $venue_id, 'tribe_venue', false, $language_code );
|
412 |
-
if ( $translated_venue_id ) {
|
413 |
-
update_post_meta( $event_translation->element_id, '_EventVenueID', $translated_venue_id );
|
414 |
-
}
|
415 |
-
}
|
416 |
-
}
|
417 |
-
} else { // delete venue from translations.
|
418 |
-
foreach ( $event_translations as $language_code => $event_translation ) {
|
419 |
-
if ( $event_translation->element_id != $original_event_id ) {
|
420 |
-
delete_post_meta( $event_translation->element_id, '_EventVenueID' );
|
421 |
-
}
|
422 |
-
}
|
423 |
-
}
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
}
|
428 |
-
|
429 |
-
public function pre_select_translated_venue() {
|
430 |
-
$current_screen = get_current_screen();
|
431 |
-
if ( $current_screen->base === 'post' && $current_screen->action === 'add' && $current_screen->id === 'tribe_events' ) {
|
432 |
-
if ( isset( $_GET['trid'] ) && isset( $_GET['lang'] ) && isset( $_GET['source_lang'] ) ) {
|
433 |
-
$event_translations = $this->sitepress->get_element_translations( $_GET['trid'], 'post_tribe_events' );
|
434 |
-
$original_event_id = $event_translations[ $_GET['source_lang'] ]->element_id;
|
435 |
-
$original_venue_id = get_post_meta( $original_event_id, '_EventVenueID', true );
|
436 |
-
if ( $original_venue_id ) {
|
437 |
-
$translated_venue_id = apply_filters( 'translate_object_id', $original_venue_id, 'tribe_venue', false, $_GET['lang'] );
|
438 |
-
if ( $translated_venue_id ) {
|
439 |
-
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
440 |
-
echo "<script type=\"text/javascript\">
|
441 |
-
jQuery('#saved_tribe_venue').val($translated_venue_id);
|
442 |
-
</script>";
|
443 |
-
}
|
444 |
-
}
|
445 |
-
}
|
446 |
-
}
|
447 |
-
}
|
448 |
-
|
449 |
-
public function save_venue_for_translation( $post_id, $data, $job ) {
|
450 |
-
|
451 |
-
$original_event_id = $this->sitepress->get_original_element_id( $post_id, 'post_tribe_event' );
|
452 |
-
$original_venue_id = get_post_meta( $original_event_id, '_EventVenueID', true );
|
453 |
-
|
454 |
-
if ( $original_venue_id ) {
|
455 |
-
$translated_venue_id = apply_filters( 'translate_object_id', $original_venue_id, 'tribe_venue', false, $job->language_code );
|
456 |
-
if ( $translated_venue_id ) {
|
457 |
-
update_post_meta( $post_id, '_EventVenueID', $translated_venue_id );
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
}
|
462 |
-
|
463 |
-
public function sync_rsvp_fields_on_attendee_created( $order_id, $post_id, $attendee_order_status ) {
|
464 |
-
|
465 |
-
$rsvp_post_id = isset( $_POST['product_id'][0] ) ? $_POST['product_id'][0] : false;
|
466 |
-
if ( $rsvp_post_id ) {
|
467 |
-
$rsvp_trid = $this->sitepress->get_element_trid( $rsvp_post_id, 'post_tribe_rsvp_tickets' );
|
468 |
-
$rsvp_translations = $this->sitepress->get_element_translations( $rsvp_trid, 'post_tribe_rsvp_tickets' );
|
469 |
-
|
470 |
-
foreach ( $rsvp_translations as $translation ) {
|
471 |
-
if ( $translation->element_id != $rsvp_post_id ) {
|
472 |
-
$this->sync_custom_fields( $rsvp_post_id, $translation->element_id );
|
473 |
-
}
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
public function get_translated_organizer_ids( $organizer_ids, $event_id ) {
|
479 |
-
foreach ( $organizer_ids as $key => $organizer_id ) {
|
480 |
-
$organizer_ids[ $key ] = apply_filters( 'translate_object_id', $organizer_id, 'tribe_organizer', true );
|
481 |
-
}
|
482 |
-
return $organizer_ids;
|
483 |
-
}
|
484 |
-
|
485 |
-
public function convert_events_cost( $cost ) {
|
486 |
-
return apply_filters( 'wcml_raw_price_amount', $cost );
|
487 |
-
}
|
488 |
-
|
489 |
-
}
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-variation-swatches-and-photos.php
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Compatibility class for Variation Swatches and Photos plugin
|
5 |
-
*/
|
6 |
-
class WCML_Variation_Swatches_And_Photos {
|
7 |
-
|
8 |
-
/** @var woocommerce_wpml */
|
9 |
-
private $woocommerce_wpml;
|
10 |
-
|
11 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml ) {
|
12 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
13 |
-
}
|
14 |
-
|
15 |
-
public function add_hooks() {
|
16 |
-
add_action( 'wcml_after_sync_product_data', [ $this, 'sync_variation_swatches_and_photos' ], 10, 3 );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Synchronize Variation Swatches and Photos
|
21 |
-
*
|
22 |
-
* @param int $original_product_id Original product ID.
|
23 |
-
* @param int $translated_product_id Translated product ID.
|
24 |
-
* @param string $language
|
25 |
-
*/
|
26 |
-
public function sync_variation_swatches_and_photos( $original_product_id, $translated_product_id, $language ) {
|
27 |
-
|
28 |
-
$swatch_options = maybe_unserialize( get_post_meta( $original_product_id, '_swatch_type_options', true ) );
|
29 |
-
$translated_swatch_options = $swatch_options;
|
30 |
-
|
31 |
-
if ( $swatch_options ) {
|
32 |
-
$original_product_attributes = $this->woocommerce_wpml->attributes->get_product_attributes( $original_product_id );
|
33 |
-
|
34 |
-
wpml_collect( $original_product_attributes )->each(
|
35 |
-
function ( $attribute, $attribute_key ) use ( $swatch_options, &$translated_swatch_options, $language, $original_product_id, $translated_product_id ) {
|
36 |
-
$attribute_name_hash = md5( sanitize_title( $attribute['name'] ) );
|
37 |
-
if ( $this->woocommerce_wpml->attributes->is_a_taxonomy( $attribute ) ) {
|
38 |
-
$translated_swatch_options = $this->translate_taxonomy_attributes( $attribute_key, $attribute_name_hash, $swatch_options, $translated_swatch_options, $language );
|
39 |
-
} else {
|
40 |
-
$translated_swatch_options = $this->translate_custom_attributes( $attribute_key, $attribute, $attribute_name_hash, $swatch_options, $translated_swatch_options, $original_product_id, $translated_product_id );
|
41 |
-
}
|
42 |
-
}
|
43 |
-
);
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
update_post_meta( $translated_product_id, '_swatch_type_options', $translated_swatch_options );
|
48 |
-
}
|
49 |
-
|
50 |
-
private function translate_taxonomy_attributes( $taxonomy, $attribute_name_hash, $swatch_options, $translated_swatch_options, $language ) {
|
51 |
-
$attribute_terms = get_terms( [ 'taxonomy' => $taxonomy ] );
|
52 |
-
|
53 |
-
wpml_collect( $attribute_terms )->each(
|
54 |
-
function ( $term ) use ( $taxonomy, $attribute_name_hash, $swatch_options, &$translated_swatch_options, $language ) {
|
55 |
-
$attribute_term_slug_md5 = md5( $term->slug );
|
56 |
-
$translated_swatch_options = $this->translate_taxonomy_term( $term, $attribute_term_slug_md5, $taxonomy, $attribute_name_hash, $swatch_options, $translated_swatch_options, $language );
|
57 |
-
}
|
58 |
-
);
|
59 |
-
|
60 |
-
return $translated_swatch_options;
|
61 |
-
}
|
62 |
-
|
63 |
-
private function translate_taxonomy_term( $term, $attribute_term_slug_md5, $taxonomy, $attribute_name_hash, $swatch_options, $translated_swatch_options, $language ) {
|
64 |
-
wpml_collect( $swatch_options[ $attribute_name_hash ]['attributes'] )->each(
|
65 |
-
function ( $swatch_attribute, $swatch_attribute_key ) use ( $term, $attribute_term_slug_md5, $taxonomy, $attribute_name_hash, &$translated_swatch_options, $language ) {
|
66 |
-
if ( $attribute_term_slug_md5 === $swatch_attribute_key ) {
|
67 |
-
$translated_term = $this->woocommerce_wpml->terms->wcml_get_translated_term( $term->term_id, $taxonomy, $language );
|
68 |
-
$translated_swatch_options[ $attribute_name_hash ]['attributes'][ md5( $translated_term->slug ) ] = $swatch_attribute;
|
69 |
-
unset( $translated_swatch_options[ $attribute_name_hash ]['attributes'][ $swatch_attribute_key ] );
|
70 |
-
}
|
71 |
-
}
|
72 |
-
);
|
73 |
-
|
74 |
-
return $translated_swatch_options;
|
75 |
-
}
|
76 |
-
|
77 |
-
private function translate_custom_attributes( $attribute_key, $attribute, $attribute_name_hash, $swatch_options, $translated_swatch_options, $original_product_id, $translated_product_id ) {
|
78 |
-
$attribute_values = explode( '|', $attribute['value'] );
|
79 |
-
|
80 |
-
wpml_collect( $attribute_values )->each(
|
81 |
-
function ( $attribute_value ) use ( $attribute_key, $attribute_name_hash, $swatch_options, &$translated_swatch_options, $original_product_id, $translated_product_id ) {
|
82 |
-
$attribute_value = trim( $attribute_value, ' ' );
|
83 |
-
$attribute_value_md5 = md5( sanitize_title( strtolower( $attribute_value ) ) );
|
84 |
-
$translated_swatch_options = $this->translate_custom_attribute_value( $attribute_key, $attribute_value, $attribute_value_md5, $attribute_name_hash, $swatch_options, $translated_swatch_options, $original_product_id, $translated_product_id );
|
85 |
-
}
|
86 |
-
);
|
87 |
-
|
88 |
-
return $translated_swatch_options;
|
89 |
-
}
|
90 |
-
|
91 |
-
private function translate_custom_attribute_value( $attribute_key, $attribute_value, $attribute_value_md5, $attribute_name_hash, $swatch_options, $translated_swatch_options, $original_product_id, $translated_product_id ) {
|
92 |
-
wpml_collect( $swatch_options[ $attribute_name_hash ]['attributes'] )->each(
|
93 |
-
function ( $swatch_attribute, $swatch_attribute_key ) use ( $attribute_key, $attribute_value, $attribute_value_md5, $attribute_name_hash, &$translated_swatch_options, $original_product_id, $translated_product_id ) {
|
94 |
-
if ( $attribute_value_md5 === $swatch_attribute_key ) {
|
95 |
-
$translated_attribute_value = $this->woocommerce_wpml->attributes->get_custom_attr_translation( $original_product_id, $translated_product_id, $attribute_key, $attribute_value );
|
96 |
-
$translated_attribute_value_md5 = md5( sanitize_title( strtolower( $translated_attribute_value ) ) );
|
97 |
-
$translated_swatch_options[ $attribute_name_hash ]['attributes'][ $translated_attribute_value_md5 ] = $swatch_attribute;
|
98 |
-
|
99 |
-
if ( $translated_attribute_value_md5 !== $swatch_attribute_key ) {
|
100 |
-
unset( $translated_swatch_options[ $attribute_name_hash ]['attributes'][ $swatch_attribute_key ] );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
);
|
105 |
-
|
106 |
-
return $translated_swatch_options;
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wc-memberships.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WC_Memberships {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var WPML_WP_API
|
7 |
-
*/
|
8 |
-
private $wp_api;
|
9 |
-
|
10 |
-
public function __construct( WPML_WP_API $wp_api ) {
|
11 |
-
$this->wp_api = $wp_api;
|
12 |
-
}
|
13 |
-
|
14 |
-
public function add_hooks() {
|
15 |
-
|
16 |
-
add_filter( 'parse_request', [ $this, 'adjust_query_vars' ] );
|
17 |
-
add_filter( 'wcml_register_endpoints_query_vars', [ $this, 'register_endpoints_query_vars' ], 10, 3 );
|
18 |
-
add_filter( 'wcml_endpoint_permalink_filter', [ $this, 'endpoint_permalink_filter' ], 10, 2 );
|
19 |
-
add_filter( 'wc_memberships_members_area_my-memberships_actions', [ $this, 'filter_actions_links' ] );
|
20 |
-
|
21 |
-
add_action( 'wp_enqueue_scripts', [ $this, 'load_assets' ] );
|
22 |
-
}
|
23 |
-
|
24 |
-
public function register_endpoints_query_vars( $query_vars, $wc_vars, $object ) {
|
25 |
-
$query_vars['members_area'] = $this->get_translated_endpoint( $object );
|
26 |
-
|
27 |
-
return $query_vars;
|
28 |
-
}
|
29 |
-
|
30 |
-
public function get_translated_endpoint( $object ) {
|
31 |
-
|
32 |
-
$translation = $object->get_endpoint_translation(
|
33 |
-
'members_area',
|
34 |
-
get_option( 'woocommerce_myaccount_members_area_endpoint', 'members-area' )
|
35 |
-
);
|
36 |
-
|
37 |
-
return $translation;
|
38 |
-
}
|
39 |
-
|
40 |
-
public function adjust_query_vars( $q ) {
|
41 |
-
|
42 |
-
if ( ! isset( $q->query_vars['members-area'] ) && isset( $q->query_vars['members_area'] ) ) {
|
43 |
-
$q->query_vars['members-area'] = $q->query_vars['members_area'];
|
44 |
-
}
|
45 |
-
|
46 |
-
return $q;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function endpoint_permalink_filter( $endpoint, $key ) {
|
50 |
-
|
51 |
-
if ( 'members_area' === $key ) {
|
52 |
-
$endpoint = get_option( 'woocommerce_myaccount_members_area_endpoint', 'members-area' );
|
53 |
-
}
|
54 |
-
|
55 |
-
return $endpoint;
|
56 |
-
}
|
57 |
-
|
58 |
-
public function filter_actions_links( $actions ) {
|
59 |
-
|
60 |
-
foreach ( $actions as $key => $action ) {
|
61 |
-
if ( 'view' === $key ) {
|
62 |
-
$membership_endpoints = $this->get_members_area_endpoint();
|
63 |
-
$actions[ $key ]['url'] = str_replace( $membership_endpoints['original'], $membership_endpoints['translated'], $action['url'] );
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
return $actions;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function load_assets() {
|
71 |
-
global $post;
|
72 |
-
|
73 |
-
if ( isset( $post->ID ) && wc_get_page_id( 'myaccount' ) == $post->ID ) {
|
74 |
-
$wcml_plugin_url = $this->wp_api->constant( 'WCML_PLUGIN_URL' );
|
75 |
-
$wcml_version = $this->wp_api->constant( 'WCML_VERSION' );
|
76 |
-
wp_register_script( 'wcml-members-js', $wcml_plugin_url . '/compatibility/res/js/wcml-members.js', [ 'jquery' ], $wcml_version, true );
|
77 |
-
wp_enqueue_script( 'wcml-members-js' );
|
78 |
-
wp_localize_script( 'wcml-members-js', 'wc_memberships_memebers_area_endpoint', $this->get_members_area_endpoint() );
|
79 |
-
}
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
public function get_members_area_endpoint() {
|
84 |
-
|
85 |
-
$endpoint = get_option( 'woocommerce_myaccount_members_area_endpoint', 'members-area' );
|
86 |
-
$string_context = class_exists( 'WPML_Endpoints_Support' ) ? WPML_Endpoints_Support::STRING_CONTEXT : 'WooCommerce Endpoints';
|
87 |
-
$translated_endpoint = apply_filters( 'wpml_translate_single_string', $endpoint, $string_context, 'members_area' );
|
88 |
-
|
89 |
-
return [
|
90 |
-
'original' => $endpoint,
|
91 |
-
'translated' => $translated_endpoint,
|
92 |
-
];
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wc-name-your-price.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WC_Name_Your_Price {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
|
7 |
-
add_action( 'init', [ $this, 'init' ], 9 );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
public function init() {
|
12 |
-
if ( ! is_admin() ) {
|
13 |
-
if ( is_callable( [ 'WC_Name_Your_Price_Compatibility', 'is_nyp_gte' ] ) && WC_Name_Your_Price_Compatibility::is_nyp_gte( '3.0' ) ) {
|
14 |
-
add_filter( 'wc_nyp_raw_suggested_price', [ $this, 'product_price_filter' ], 10, 2 );
|
15 |
-
add_filter( 'wc_nyp_raw_minimum_price', [ $this, 'product_price_filter' ], 10, 2 );
|
16 |
-
add_filter( 'wc_nyp_raw_maximum_price', [ $this, 'product_price_filter' ], 10, 2 );
|
17 |
-
} else {
|
18 |
-
add_filter( 'woocommerce_raw_suggested_price', [ $this, 'product_price_filter' ], 10, 2 );
|
19 |
-
add_filter( 'woocommerce_raw_minimum_price', [ $this, 'product_price_filter' ], 10, 2 );
|
20 |
-
add_filter( 'woocommerce_raw_maximum_price', [ $this, 'product_price_filter' ], 10, 2 );
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
public function product_price_filter( $price, $product ) {
|
26 |
-
return apply_filters( 'wcml_raw_price_amount', $price );
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wc-product-type-column.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WC_Product_Type_Column {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_show_type_column', [ $this, 'show_type_column' ] );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
public function show_type_column( $show ) {
|
12 |
-
|
13 |
-
wp_enqueue_style( 'wc-product-type-column-admin-styles' );
|
14 |
-
|
15 |
-
return true;
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wc-subscriptions.php
DELETED
@@ -1,460 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use function WPML\FP\tap as tap;
|
4 |
-
|
5 |
-
class WCML_WC_Subscriptions {
|
6 |
-
|
7 |
-
/** @var bool */
|
8 |
-
private $new_subscription = false;
|
9 |
-
|
10 |
-
/** @var bool */
|
11 |
-
private $prorating_price = false;
|
12 |
-
|
13 |
-
/** @var woocommerce_wpml */
|
14 |
-
private $woocommerce_wpml;
|
15 |
-
|
16 |
-
/** @var wpdb */
|
17 |
-
private $wpdb;
|
18 |
-
|
19 |
-
/** @var WC_Cart[]|null $recurring_carts */
|
20 |
-
private $recurring_carts;
|
21 |
-
|
22 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml, wpdb $wpdb ) {
|
23 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
24 |
-
$this->wpdb = $wpdb;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function add_hooks() {
|
28 |
-
|
29 |
-
add_action( 'init', [ $this, 'init' ], 9 );
|
30 |
-
add_filter( 'wcml_variation_term_taxonomy_ids', [ $this, 'wcml_variation_term_taxonomy_ids' ] );
|
31 |
-
add_filter( 'woocommerce_subscription_lengths', [ $this, 'woocommerce_subscription_lengths' ], 10, 2 );
|
32 |
-
|
33 |
-
add_filter( 'wcml_register_endpoints_query_vars', [ $this, 'register_endpoint' ], 10, 3 );
|
34 |
-
add_filter( 'wcml_endpoint_permalink_filter', [ $this, 'endpoint_permalink_filter' ], 10, 2 );
|
35 |
-
|
36 |
-
// Custom prices
|
37 |
-
add_filter( 'wcml_custom_prices_fields', [ $this, 'set_prices_fields' ], 10, 2 );
|
38 |
-
add_filter( 'wcml_custom_prices_strings', [ $this, 'set_labels_for_prices_fields' ], 10, 2 );
|
39 |
-
add_filter( 'wcml_custom_prices_fields_labels', [ $this, 'set_labels_for_prices_fields' ], 10, 2 );
|
40 |
-
add_filter( 'wcml_update_custom_prices_values', [ $this, 'update_custom_prices_values' ], 10, 3 );
|
41 |
-
add_action( 'wcml_after_custom_prices_block', [ $this, 'new_subscription_prices_block' ] );
|
42 |
-
|
43 |
-
add_action( 'woocommerce_subscriptions_product_options_pricing', [ $this, 'show_pointer_info' ] );
|
44 |
-
add_action( 'woocommerce_variable_subscription_pricing', [ $this, 'show_pointer_info' ] );
|
45 |
-
|
46 |
-
add_filter(
|
47 |
-
'woocommerce_subscriptions_product_price',
|
48 |
-
[
|
49 |
-
$this,
|
50 |
-
'woocommerce_subscription_price_from',
|
51 |
-
],
|
52 |
-
10,
|
53 |
-
2
|
54 |
-
);
|
55 |
-
|
56 |
-
add_filter( 'wcml_xliff_allowed_variations_types', [ $this, 'set_allowed_variations_types_in_xliff' ] );
|
57 |
-
|
58 |
-
// Add language links to email settings
|
59 |
-
add_filter( 'wcml_emails_options_to_translate', [ $this, 'translate_email_options' ] );
|
60 |
-
add_filter( 'wcml_emails_section_name_prefix', [ $this, 'email_option_section_prefix' ], 10, 2 );
|
61 |
-
}
|
62 |
-
|
63 |
-
public function init() {
|
64 |
-
if ( ! is_admin() ) {
|
65 |
-
add_filter(
|
66 |
-
'woocommerce_subscriptions_product_sign_up_fee',
|
67 |
-
[
|
68 |
-
$this,
|
69 |
-
'subscriptions_product_sign_up_fee_filter',
|
70 |
-
],
|
71 |
-
10,
|
72 |
-
2
|
73 |
-
);
|
74 |
-
|
75 |
-
add_action( 'woocommerce_before_calculate_totals', [ $this, 'maybe_backup_recurring_carts' ], 1 );
|
76 |
-
add_action( 'woocommerce_after_calculate_totals', [ $this, 'maybe_restore_recurring_carts' ], 200 );
|
77 |
-
|
78 |
-
$this->maybe_force_client_currency_for_subscription();
|
79 |
-
|
80 |
-
add_filter( 'wcs_get_subscription', [ $this, 'filter_subscription_items' ] );
|
81 |
-
}
|
82 |
-
|
83 |
-
// Translate emails
|
84 |
-
add_filter( 'woocommerce_generated_manual_renewal_order_renewal_notification', [ $this, 'translate_renewal_notification' ], 9 );
|
85 |
-
add_filter( 'woocommerce_order_status_failed_renewal_notification', [ $this, 'translate_renewal_notification' ], 9 );
|
86 |
-
|
87 |
-
add_filter( 'wcs_switch_proration_new_price_per_day', tap( [ $this, 'set_prorating_price' ] ) );
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Set a flag when we are prorating the price (upgrades/downgrades).
|
92 |
-
* We do this to skip currency conversion in the sign_up_fee because
|
93 |
-
* when switching subscription it has already been converted.
|
94 |
-
*/
|
95 |
-
public function set_prorating_price() {
|
96 |
-
$this->prorating_price = true;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Filter Subscription Sign-up fee cost
|
101 |
-
*
|
102 |
-
* @param string $subscription_sign_up_fee
|
103 |
-
* @param WC_Product $product
|
104 |
-
* @return string
|
105 |
-
*/
|
106 |
-
public function subscriptions_product_sign_up_fee_filter( $subscription_sign_up_fee, $product ) {
|
107 |
-
|
108 |
-
if ( $product && wcml_is_multi_currency_on() && ! $this->prorating_price ) {
|
109 |
-
$currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
110 |
-
|
111 |
-
if ( $currency !== wcml_get_woocommerce_currency_option() ) {
|
112 |
-
|
113 |
-
$product_id = $product->get_id();
|
114 |
-
if( $product instanceof WC_Product_Variable_Subscription ){
|
115 |
-
$product_id = $product->get_meta( '_min_price_variation_id', true );
|
116 |
-
}
|
117 |
-
|
118 |
-
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $product_id );
|
119 |
-
|
120 |
-
if ( get_post_meta( $original_product_id, '_wcml_custom_prices_status', true ) ) {
|
121 |
-
$subscription_sign_up_fee = get_post_meta( $original_product_id, '_subscription_sign_up_fee_' . $currency, true );
|
122 |
-
} else {
|
123 |
-
$subscription_sign_up_fee = apply_filters( 'wcml_raw_price_amount', $subscription_sign_up_fee );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
return $subscription_sign_up_fee;
|
129 |
-
}
|
130 |
-
|
131 |
-
public function wcml_variation_term_taxonomy_ids( $get_variation_term_taxonomy_ids ) {
|
132 |
-
|
133 |
-
$get_variation_term_taxonomy_id = $this->wpdb->get_var( "SELECT tt.term_taxonomy_id FROM {$this->wpdb->terms} AS t LEFT JOIN {$this->wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE t.slug = 'variable-subscription'" );
|
134 |
-
|
135 |
-
if ( ! empty( $get_variation_term_taxonomy_id ) ) {
|
136 |
-
$get_variation_term_taxonomy_ids[] = $get_variation_term_taxonomy_id;
|
137 |
-
}
|
138 |
-
|
139 |
-
return $get_variation_term_taxonomy_ids;
|
140 |
-
}
|
141 |
-
|
142 |
-
public function woocommerce_subscription_lengths( $subscription_ranges, $subscription_period ) {
|
143 |
-
|
144 |
-
if ( is_array( $subscription_ranges ) ) {
|
145 |
-
foreach ( $subscription_ranges as $period => $ranges ) {
|
146 |
-
if ( is_array( $ranges ) ) {
|
147 |
-
foreach ( $ranges as $range ) {
|
148 |
-
if ( $range == '9 months' ) {
|
149 |
-
$breakpoint = true;
|
150 |
-
}
|
151 |
-
$new_subscription_ranges[ $period ][] = apply_filters( 'wpml_translate_single_string', $range, 'wc_subscription_ranges', $range );
|
152 |
-
}
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
return isset( $new_subscription_ranges ) ? $new_subscription_ranges : $subscription_ranges;
|
158 |
-
}
|
159 |
-
|
160 |
-
public function set_prices_fields( $fields, $product_id ) {
|
161 |
-
if ( $this->is_subscriptions_product( $product_id ) || $this->new_subscription ) {
|
162 |
-
$fields[] = '_subscription_sign_up_fee';
|
163 |
-
}
|
164 |
-
|
165 |
-
return $fields;
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
public function set_labels_for_prices_fields( $labels, $product_id ) {
|
170 |
-
|
171 |
-
if ( $this->is_subscriptions_product( $product_id ) || $this->new_subscription ) {
|
172 |
-
$labels['_regular_price'] = __( 'Subscription Price', 'woocommerce-multilingual' );
|
173 |
-
$labels['_subscription_sign_up_fee'] = __( 'Sign-up Fee', 'woocommerce-multilingual' );
|
174 |
-
}
|
175 |
-
|
176 |
-
return $labels;
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
public function update_custom_prices_values( $prices, $code, $variation_id = false ) {
|
181 |
-
|
182 |
-
if ( isset( $_POST['_custom_subscription_sign_up_fee'][ $code ] ) ) {
|
183 |
-
$prices['_subscription_sign_up_fee'] = wc_format_decimal( $_POST['_custom_subscription_sign_up_fee'][ $code ] );
|
184 |
-
}
|
185 |
-
|
186 |
-
if ( $variation_id && isset( $_POST['_custom_variation_subscription_sign_up_fee'][ $code ][ $variation_id ] ) ) {
|
187 |
-
$prices['_subscription_sign_up_fee'] = wc_format_decimal( $_POST['_custom_variation_subscription_sign_up_fee'][ $code ][ $variation_id ] );
|
188 |
-
}
|
189 |
-
|
190 |
-
return $prices;
|
191 |
-
|
192 |
-
}
|
193 |
-
|
194 |
-
public function is_subscriptions_product( $product_id ) {
|
195 |
-
|
196 |
-
$get_variation_term_taxonomy_ids = $this->wpdb->get_col( "SELECT tt.term_taxonomy_id FROM {$this->wpdb->terms} AS t LEFT JOIN {$this->wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE t.slug IN ( 'subscription', 'variable-subscription' ) AND tt.taxonomy = 'product_type'" );
|
197 |
-
|
198 |
-
if ( get_post_type( $product_id ) == 'product_variation' ) {
|
199 |
-
$product_id = wp_get_post_parent_id( $product_id );
|
200 |
-
}
|
201 |
-
|
202 |
-
$is_subscriptions_product = $this->wpdb->get_var(
|
203 |
-
$this->wpdb->prepare(
|
204 |
-
"SELECT count(object_id) FROM {$this->wpdb->term_relationships}
|
205 |
-
WHERE object_id = %d AND term_taxonomy_id IN (" . wpml_prepare_in( $get_variation_term_taxonomy_ids, '%d' ) . ')',
|
206 |
-
$product_id
|
207 |
-
)
|
208 |
-
);
|
209 |
-
return $is_subscriptions_product;
|
210 |
-
}
|
211 |
-
|
212 |
-
public function new_subscription_prices_block( $product_id ) {
|
213 |
-
|
214 |
-
if ( $product_id == 'new' ) {
|
215 |
-
$this->new_subscription = true;
|
216 |
-
echo '<div class="wcml_prices_if_subscription" style="display: none">';
|
217 |
-
$custom_prices_ui = new WCML_Custom_Prices_UI( $this->woocommerce_wpml, 'new' );
|
218 |
-
$custom_prices_ui->show();
|
219 |
-
echo '</div>';
|
220 |
-
?>
|
221 |
-
<script>
|
222 |
-
jQuery(function($) {
|
223 |
-
jQuery('.wcml_prices_if_subscription .wcml_custom_prices_input').attr('name', '_wcml_custom_prices[new_subscription]').attr( 'id', '_wcml_custom_prices[new_subscription]');
|
224 |
-
jQuery('.wcml_prices_if_subscription .wcml_custom_prices_options_block>label').attr('for', '_wcml_custom_prices[new_subscription]');
|
225 |
-
jQuery('.wcml_prices_if_subscription .wcml_schedule_input').each( function(){
|
226 |
-
jQuery(this).attr('name', jQuery(this).attr('name')+'_subscription');
|
227 |
-
});
|
228 |
-
|
229 |
-
jQuery('.options_group>.wcml_custom_prices_block .wcml_custom_prices_input:first-child').click();
|
230 |
-
jQuery('.options_group>.wcml_custom_prices_block .wcml_schedule_options .wcml_schedule_input:first-child').click();
|
231 |
-
|
232 |
-
jQuery(document).on('change', 'select#product-type', function () {
|
233 |
-
if (jQuery(this).val() == 'subscription') {
|
234 |
-
jQuery('.wcml_prices_if_subscription').show();
|
235 |
-
jQuery('.options_group>.wcml_custom_prices_block').hide();
|
236 |
-
} else if (jQuery(this).val() != 'variable-subscription') {
|
237 |
-
jQuery('.wcml_prices_if_subscription').hide();
|
238 |
-
jQuery('.options_group>.wcml_custom_prices_block').show();
|
239 |
-
}
|
240 |
-
});
|
241 |
-
|
242 |
-
jQuery(document).on('click', '#publish', function () {
|
243 |
-
if ( jQuery('.wcml_prices_if_subscription').is( ':visible' ) ) {
|
244 |
-
jQuery('.options_group>.wcml_custom_prices_block').remove();
|
245 |
-
jQuery('.wcml_prices_if_subscription .wcml_custom_prices_input').attr('name', '_wcml_custom_prices[new]');
|
246 |
-
jQuery('.wcml_prices_if_subscription .wcml_schedule_input').each( function(){
|
247 |
-
jQuery(this).attr('name', jQuery(this).attr('name').replace('_subscription','') );
|
248 |
-
});
|
249 |
-
}else{
|
250 |
-
jQuery('.wcml_prices_if_subscription').remove();
|
251 |
-
}
|
252 |
-
});
|
253 |
-
});
|
254 |
-
</script>
|
255 |
-
<?php
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
public function register_endpoint( $query_vars, $wc_vars, $obj ) {
|
260 |
-
|
261 |
-
$query_vars['view-subscription'] = $obj->get_endpoint_translation( 'view-subscription', isset( $wc_vars['view-subscription'] ) ? $wc_vars['view-subscription'] : 'view-subscription' );
|
262 |
-
$query_vars['subscriptions'] = $obj->get_endpoint_translation( 'subscriptions', isset( $wc_vars['subscriptions'] ) ? $wc_vars['subscriptions'] : 'subscriptions' );
|
263 |
-
return $query_vars;
|
264 |
-
}
|
265 |
-
|
266 |
-
public function endpoint_permalink_filter( $endpoint, $key ) {
|
267 |
-
|
268 |
-
if ( $key == 'view-subscription' ) {
|
269 |
-
return 'view-subscription';
|
270 |
-
}
|
271 |
-
|
272 |
-
return $endpoint;
|
273 |
-
}
|
274 |
-
|
275 |
-
public function show_pointer_info() {
|
276 |
-
|
277 |
-
$pointer_ui = new WCML_Pointer_UI(
|
278 |
-
sprintf( __( 'You can translate strings related to subscription products on the %1$sWPML String Translation page%2$s. Use the search on the top of that page to find the strings.', 'woocommerce-multilingual' ), '<a href="' . admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=woocommerce_subscriptions' ) . '">', '</a>' ),
|
279 |
-
WCML_Tracking_Link::getWcmlSubscriptionsDoc(),
|
280 |
-
'general_product_data .subscription_pricing',
|
281 |
-
'prepend'
|
282 |
-
);
|
283 |
-
|
284 |
-
$pointer_ui->show();
|
285 |
-
}
|
286 |
-
|
287 |
-
/**
|
288 |
-
* @param WC_Cart $cart
|
289 |
-
*/
|
290 |
-
public function maybe_backup_recurring_carts( $cart ) {
|
291 |
-
if ( ! empty( $cart->recurring_carts ) ) {
|
292 |
-
$this->recurring_carts = $cart->recurring_carts;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* @param WC_Cart $cart
|
298 |
-
*/
|
299 |
-
public function maybe_restore_recurring_carts( $cart ) {
|
300 |
-
if ( ! empty( $this->recurring_carts ) ) {
|
301 |
-
$cart->recurring_carts = $this->recurring_carts;
|
302 |
-
$this->recurring_carts = null;
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* @param string $price
|
308 |
-
* @param WC_Product|WC_Product_Subscription_Variation $product
|
309 |
-
*
|
310 |
-
* @return string
|
311 |
-
*/
|
312 |
-
public function woocommerce_subscription_price_from( $price, $product ) {
|
313 |
-
|
314 |
-
if ( $product && $product instanceof WC_Product_Subscription_Variation ) {
|
315 |
-
|
316 |
-
$custom_prices_on = get_post_meta( $product->get_id(), '_wcml_custom_prices_status', true );
|
317 |
-
if ( $custom_prices_on ) {
|
318 |
-
$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
|
319 |
-
|
320 |
-
$price = get_post_meta( $product->get_id(), '_price_' . $client_currency, true );
|
321 |
-
} else {
|
322 |
-
$price = apply_filters( 'wcml_raw_price_amount', $price );
|
323 |
-
}
|
324 |
-
}
|
325 |
-
|
326 |
-
return $price;
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* Force client currency for resubscribe subscription
|
331 |
-
*/
|
332 |
-
public function maybe_force_client_currency_for_subscription() {
|
333 |
-
|
334 |
-
if ( wcml_is_multi_currency_on() ) {
|
335 |
-
|
336 |
-
$subscription_id = false;
|
337 |
-
$getData = wpml_collect( $_GET );
|
338 |
-
|
339 |
-
if ( $getData->has( 'resubscribe' ) ) {
|
340 |
-
$subscription_id = (int) $getData->get( 'resubscribe' );
|
341 |
-
} elseif ( $getData->has( 'subscription_renewal_early' ) ) {
|
342 |
-
$subscription_id = (int) $getData->get( 'subscription_renewal_early' );
|
343 |
-
} elseif ( is_cart() || is_checkout() ) {
|
344 |
-
$resubscribe_cart_item = wcs_cart_contains_resubscribe();
|
345 |
-
if ( $resubscribe_cart_item ) {
|
346 |
-
$subscription_id = $resubscribe_cart_item['subscription_resubscribe']['subscription_id'];
|
347 |
-
} else {
|
348 |
-
$early_renewal_cart_item = wcs_cart_contains_early_renewal();
|
349 |
-
if ( $early_renewal_cart_item ) {
|
350 |
-
$subscription_id = $early_renewal_cart_item['subscription_renewal']['subscription_renewal_early'];
|
351 |
-
}
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
if ( $subscription_id ) {
|
356 |
-
$subscription_currency = get_post_meta( $subscription_id, '_order_currency', true );
|
357 |
-
if ( $subscription_currency && $this->woocommerce_wpml->multi_currency->get_client_currency() !== $subscription_currency ) {
|
358 |
-
$this->woocommerce_wpml->multi_currency->set_client_currency( $subscription_currency );
|
359 |
-
}
|
360 |
-
}
|
361 |
-
}
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* @param array $allowed_types
|
366 |
-
*
|
367 |
-
* @return array
|
368 |
-
*/
|
369 |
-
public function set_allowed_variations_types_in_xliff( $allowed_types ) {
|
370 |
-
|
371 |
-
$allowed_types[] = 'variable-subscription';
|
372 |
-
$allowed_types[] = 'subscription_variation';
|
373 |
-
|
374 |
-
return $allowed_types;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Translate strings of renewal notifications
|
379 |
-
*
|
380 |
-
* @param integer $order_id Order ID
|
381 |
-
*/
|
382 |
-
public function translate_renewal_notification( $order_id ) {
|
383 |
-
|
384 |
-
if ( isset( WC()->mailer()->emails['WCS_Email_Customer_Renewal_Invoice'] ) ) {
|
385 |
-
$this->woocommerce_wpml->emails->refresh_email_lang( $order_id );
|
386 |
-
|
387 |
-
$WCS_Email_Customer_Renewal_Invoice = WC()->mailer()->emails['WCS_Email_Customer_Renewal_Invoice'];
|
388 |
-
$WCS_Email_Customer_Renewal_Invoice->heading = __( $WCS_Email_Customer_Renewal_Invoice->heading, 'woocommerce-subscriptions' );
|
389 |
-
$WCS_Email_Customer_Renewal_Invoice->subject = __( $WCS_Email_Customer_Renewal_Invoice->subject, 'woocommerce-subscriptions' );
|
390 |
-
|
391 |
-
add_filter( 'woocommerce_email_get_option', [ $this, 'translate_heading_subject' ], 10, 4 );
|
392 |
-
}
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Translate custom heading and subject for renewal notification
|
397 |
-
*
|
398 |
-
* @param string $return_value original string
|
399 |
-
* @param WCS_Email_Customer_Renewal_Invoice $obj Object of email class
|
400 |
-
* @param string $value Original value from setting
|
401 |
-
* @param string $key Name of the key
|
402 |
-
* @return string Translated value or original value incase of not translated
|
403 |
-
*/
|
404 |
-
public function translate_heading_subject( $return_value, $obj, $value, $key ) {
|
405 |
-
|
406 |
-
if ( $obj instanceof WCS_Email_Customer_Renewal_Invoice ) {
|
407 |
-
if ( $key == 'subject' || $key == 'heading' ) {
|
408 |
-
$translated_admin_string = $this->woocommerce_wpml->emails->getStringTranslation( 'admin_texts_woocommerce_customer_renewal_invoice_settings', '[woocommerce_customer_renewal_invoice_settings]' . $key );
|
409 |
-
return empty( $translated_admin_string ) ? $return_value : $translated_admin_string;
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
return $return_value;
|
414 |
-
}
|
415 |
-
|
416 |
-
/**
|
417 |
-
* Add customer renewal invoice option to translate
|
418 |
-
*
|
419 |
-
* @param array $emails_options list of option to translate
|
420 |
-
* @return array $emails_options
|
421 |
-
*/
|
422 |
-
public function translate_email_options( $emails_options ) {
|
423 |
-
|
424 |
-
if ( is_array( $emails_options ) ) {
|
425 |
-
$emails_options[] = 'woocommerce_customer_renewal_invoice_settings';
|
426 |
-
}
|
427 |
-
|
428 |
-
return $emails_options;
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Change section name prefix to add language links
|
433 |
-
*
|
434 |
-
* @param string $section_prefix section prefix
|
435 |
-
* @param string $emails_option current option name
|
436 |
-
* @return string $section_prefix
|
437 |
-
*/
|
438 |
-
public function email_option_section_prefix( $section_prefix, $emails_option ) {
|
439 |
-
|
440 |
-
if ( $emails_option === 'woocommerce_customer_renewal_invoice_settings' ) {
|
441 |
-
return 'wcs_email_';
|
442 |
-
}
|
443 |
-
|
444 |
-
return $section_prefix;
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* @param mixed $subscription
|
449 |
-
*
|
450 |
-
* @return mixed
|
451 |
-
*/
|
452 |
-
public function filter_subscription_items( $subscription ) {
|
453 |
-
|
454 |
-
if ( $subscription instanceof WC_Subscription ) {
|
455 |
-
$this->woocommerce_wpml->orders->adjust_order_item_in_language( $subscription->get_items() );
|
456 |
-
}
|
457 |
-
|
458 |
-
return $subscription;
|
459 |
-
}
|
460 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wcexporter.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_wcExporter {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var SitePress
|
7 |
-
*/
|
8 |
-
private $sitepress;
|
9 |
-
/**
|
10 |
-
* @var woocommerce_wpml
|
11 |
-
*/
|
12 |
-
private $woocommerce_wpml;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* WCML_wcExporter constructor.
|
16 |
-
*
|
17 |
-
* @param SitePress $sitepress
|
18 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
19 |
-
*/
|
20 |
-
public function __construct( SitePress $sitepress, woocommerce_wpml $woocommerce_wpml ) {
|
21 |
-
$this->sitepress = $sitepress;
|
22 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
23 |
-
}
|
24 |
-
|
25 |
-
public function add_hooks() {
|
26 |
-
|
27 |
-
add_filter( 'woo_ce_product_fields', array( $this, 'woo_ce_fields' ) );
|
28 |
-
add_filter( 'woo_ce_category_fields', array( $this, 'woo_ce_fields' ) );
|
29 |
-
add_filter( 'woo_ce_tag_fields', array( $this, 'woo_ce_fields' ) );
|
30 |
-
add_filter( 'woo_ce_order_fields', array( $this, 'woo_ce_order_fields' ) );
|
31 |
-
add_filter( 'woo_ce_product_item', array( $this, 'woo_ce_product_item' ), 10, 2 );
|
32 |
-
add_filter( 'woo_ce_category_item', array( $this, 'woo_ce_category_item' ), 10 );
|
33 |
-
add_filter( 'woo_ce_tags', array( $this, 'woo_ce_tags' ), 10 );
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
public function woo_ce_fields( $fields ) {
|
38 |
-
$fields[] = array(
|
39 |
-
'name' => 'language',
|
40 |
-
'label' => __( 'Language', 'woo_ce' ),
|
41 |
-
'default' => 1
|
42 |
-
);
|
43 |
-
$fields[] = array(
|
44 |
-
'name' => 'translation_of',
|
45 |
-
'label' => __( 'Translation of', 'woo_ce' ),
|
46 |
-
'default' => 1
|
47 |
-
);
|
48 |
-
|
49 |
-
return $fields;
|
50 |
-
}
|
51 |
-
|
52 |
-
public function woo_ce_order_fields( $fields ) {
|
53 |
-
$fields[] = array(
|
54 |
-
'name' => 'language',
|
55 |
-
'label' => __( 'Language', 'woo_ce' ),
|
56 |
-
'default' => 1
|
57 |
-
);
|
58 |
-
|
59 |
-
return $fields;
|
60 |
-
}
|
61 |
-
|
62 |
-
public function woo_ce_product_item( $data, $product_id ) {
|
63 |
-
|
64 |
-
$data->language = $this->sitepress->get_language_for_element( $product_id, 'post_' . get_post_type( $product_id ) );
|
65 |
-
$data->translation_of = $this->woocommerce_wpml->products->get_original_product_id( $product_id );
|
66 |
-
|
67 |
-
return $data;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function woo_ce_category_item( $data ) {
|
71 |
-
|
72 |
-
$data->language = $this->sitepress->get_language_for_element( $data->term_taxonomy_id, 'tax_product_cat' );
|
73 |
-
$data->translation_of = apply_filters( 'translate_object_id', $data->term_taxonomy_id, 'tax_product_cat', true, $this->sitepress->get_default_language() );
|
74 |
-
|
75 |
-
return $data;
|
76 |
-
}
|
77 |
-
|
78 |
-
public function woo_ce_tags( $tags ) {
|
79 |
-
|
80 |
-
foreach ( $tags as $key => $tag ) {
|
81 |
-
$tags[ $key ]->language = $this->sitepress->get_language_for_element( $tag->term_taxonomy_id, 'tax_product_tag' );
|
82 |
-
$tags[ $key ]->translation_of = apply_filters( 'translate_object_id', $tag->term_taxonomy_id, 'tax_product_tag', true, $this->sitepress->get_default_language() );
|
83 |
-
}
|
84 |
-
|
85 |
-
return $tags;
|
86 |
-
}
|
87 |
-
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-woo-var-table.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Woo Variations table Compatibility class
|
4 |
-
*/
|
5 |
-
|
6 |
-
class WCML_Woo_Var_Table {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @var string
|
10 |
-
*/
|
11 |
-
private $current_language;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @param string $current_language
|
15 |
-
*/
|
16 |
-
public function __construct( $current_language ) {
|
17 |
-
$this->current_language = $current_language;
|
18 |
-
}
|
19 |
-
|
20 |
-
public function add_hooks() {
|
21 |
-
|
22 |
-
add_filter( 'vartable_add_to_cart_product_id', [ $this, 'filter_add_to_cart_product_id' ] );
|
23 |
-
}
|
24 |
-
|
25 |
-
public function filter_add_to_cart_product_id( $product_id ) {
|
26 |
-
|
27 |
-
$product_id = apply_filters( 'translate_object_id', $product_id, get_post_type( $product_id ), true, $this->current_language );
|
28 |
-
|
29 |
-
return $product_id;
|
30 |
-
}
|
31 |
-
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-woobe.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_Woobe {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var SitePress
|
7 |
-
*/
|
8 |
-
private $sitepress;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var WPML_Post_Translation
|
12 |
-
*/
|
13 |
-
private $post_translations;
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* WCML_Woobe constructor.
|
18 |
-
*
|
19 |
-
* @param SitePress $sitepress
|
20 |
-
* @param WPML_Post_Translation $post_translations
|
21 |
-
*/
|
22 |
-
public function __construct( SitePress $sitepress, WPML_Post_Translation $post_translations ) {
|
23 |
-
$this->sitepress = $sitepress;
|
24 |
-
$this->post_translations = $post_translations;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function add_hooks() {
|
28 |
-
add_action( 'woobe_after_update_page_field', [ $this, 'replace_price_in_translations' ], 10, 5 );
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Replaces product price for translation of given product.
|
33 |
-
*
|
34 |
-
* @param int|null $product_id Product ID
|
35 |
-
* @param WC_Product|null $product Product object
|
36 |
-
* @param string|null $field_key Key of processed custom field
|
37 |
-
* @param mixed|null $value Value of processed custom field
|
38 |
-
* @param string|null $field_type Type of processed custom field
|
39 |
-
*/
|
40 |
-
public function replace_price_in_translations( $product_id = null, $product = null, $field_key = null, $value = null, $field_type = null ) {
|
41 |
-
if ( $this->is_price_updated( $product_id, $field_key, $value )
|
42 |
-
&& $this->is_field_set_to_copy( $field_key )
|
43 |
-
) {
|
44 |
-
$translations = $this->post_translations->get_element_translations( $product_id, false, true );
|
45 |
-
if ( ! empty( $translations ) ) {
|
46 |
-
foreach ( $translations as $translation ) {
|
47 |
-
update_post_meta( $translation, '_' . $field_key, $value );
|
48 |
-
update_post_meta( $translation, '_price', $value );
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Check if filter runs during the bulk price update
|
56 |
-
*
|
57 |
-
* @param $product_id Product ID
|
58 |
-
* @param $field_key Key of processed custom field
|
59 |
-
* @param $value Value of processed custom field
|
60 |
-
*
|
61 |
-
* @return bool
|
62 |
-
*/
|
63 |
-
private function is_price_updated( $product_id, $field_key, $value ) {
|
64 |
-
return is_numeric( $product_id )
|
65 |
-
&& 'regular_price' === $field_key
|
66 |
-
&& is_numeric( $value );
|
67 |
-
}
|
68 |
-
|
69 |
-
private function is_field_set_to_copy( $field_key ) {
|
70 |
-
$settings = $this->sitepress->get_settings();
|
71 |
-
$field_translation_setting = isset( $settings['translation-management']['custom_fields_translation'][ '_' . $field_key ] ) ? $settings['translation-management']['custom_fields_translation'][ '_' . $field_key ] : null;
|
72 |
-
return $field_translation_setting === $this->sitepress->get_wp_api()->constant( 'WPML_COPY_CUSTOM_FIELD' );
|
73 |
-
}
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-woof-woocommerce-product-filter.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WCML\Compatibility\WOOF;
|
4 |
-
|
5 |
-
class WooCommerceProductFilter {
|
6 |
-
/**
|
7 |
-
* @var string
|
8 |
-
*/
|
9 |
-
private $currentCurrency;
|
10 |
-
/**
|
11 |
-
* @var string
|
12 |
-
*/
|
13 |
-
private $defaultCurrency;
|
14 |
-
/**
|
15 |
-
* @var array
|
16 |
-
*/
|
17 |
-
private $rates;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Registers hooks.
|
21 |
-
*/
|
22 |
-
public function addHooks() {
|
23 |
-
if ( wcml_is_multi_currency_on() ) {
|
24 |
-
add_action( 'init', [ $this, 'setupCurrencies' ] );
|
25 |
-
add_filter( 'woof_get_meta_query', [ $this, 'priceInDefaultCurrency' ], 10, 1 );
|
26 |
-
add_filter( 'wcml_exchange_rates', [ $this, 'storeExchangeRates' ], 10, 1 );
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Stores default and current currency in attributes.
|
32 |
-
*/
|
33 |
-
public function setupCurrencies() {
|
34 |
-
$this->defaultCurrency = wcml_get_woocommerce_currency_option();
|
35 |
-
$this->currentCurrency = apply_filters( 'wcml_price_currency', $this->defaultCurrency );
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Filters meta query from WOOf plugin and maybe replaces the prices with the one
|
40 |
-
* in default currency.
|
41 |
-
*
|
42 |
-
* @param array $metaQuery
|
43 |
-
*
|
44 |
-
* @return mixed
|
45 |
-
*/
|
46 |
-
public function priceInDefaultCurrency( $metaQuery ) {
|
47 |
-
if ( $this->priceIsInSwitchedCurrency() ) {
|
48 |
-
foreach ( $metaQuery as $queryIndex => $queryMeta ) {
|
49 |
-
if ( $this->isMetaWithPriceValues( $queryIndex, $queryMeta ) ) {
|
50 |
-
foreach ( $queryMeta['value'] as $valueIndex => $valuePrice ) {
|
51 |
-
$metaQuery[ $queryIndex ]['value'][ $valueIndex ] = $this->getPriceInDefaultCurrency( $valuePrice );
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
return $metaQuery;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Stores exchange rates in attribute.
|
61 |
-
*
|
62 |
-
* @param array $rates
|
63 |
-
*
|
64 |
-
* @return array
|
65 |
-
*/
|
66 |
-
public function storeExchangeRates( $rates ) {
|
67 |
-
$this->rates = $rates;
|
68 |
-
return $rates;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Checks if price is in non default currency.
|
73 |
-
*
|
74 |
-
* @return bool
|
75 |
-
*/
|
76 |
-
private function priceIsInSwitchedCurrency() {
|
77 |
-
$multicurrencyOn = wcml_is_multi_currency_on();
|
78 |
-
return $multicurrencyOn && $this->currentCurrency !== $this->defaultCurrency;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Checks if meta data has a correct format.
|
83 |
-
*
|
84 |
-
* @param $index
|
85 |
-
* @param $meta
|
86 |
-
*
|
87 |
-
* @return bool
|
88 |
-
*/
|
89 |
-
private function isMetaWithPriceValues( $index, $meta ) {
|
90 |
-
return is_numeric( $index )
|
91 |
-
&& isset( $meta['key'], $meta['value'] )
|
92 |
-
&& '_price' === $meta['key']
|
93 |
-
&& is_array( $meta['value'] );
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Recalculates price into default currency.
|
98 |
-
*
|
99 |
-
* @param int|string $valuePrice
|
100 |
-
*
|
101 |
-
* @return int|string mixed
|
102 |
-
*/
|
103 |
-
private function getPriceInDefaultCurrency( $valuePrice ) {
|
104 |
-
if ( isset( $this->rates[ $this->currentCurrency ] ) ) {
|
105 |
-
$valuePrice /= $this->rates[ $this->currentCurrency ];
|
106 |
-
}
|
107 |
-
return $valuePrice;
|
108 |
-
}
|
109 |
-
|
110 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wpb-vc.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* WPBakery Page Builder ( formerly Visual Composer ) Compatibility class
|
4 |
-
*/
|
5 |
-
|
6 |
-
class WCML_Wpb_Vc {
|
7 |
-
|
8 |
-
public function add_hooks() {
|
9 |
-
|
10 |
-
add_filter( 'wcml_is_localize_woocommerce_on_ajax', [ $this, 'is_localize_woocommerce_on_ajax' ], 10, 2 );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function is_localize_woocommerce_on_ajax( $localize, $action ) {
|
14 |
-
|
15 |
-
if ( 'vc_edit_form' === $action ) {
|
16 |
-
$localize = false;
|
17 |
-
}
|
18 |
-
|
19 |
-
return $localize;
|
20 |
-
}
|
21 |
-
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wpfastest-cache.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WpFastest_Cache {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
add_filter(
|
7 |
-
'wcml_is_cache_enabled_for_switching_currency',
|
8 |
-
[
|
9 |
-
$this,
|
10 |
-
'is_cache_enabled_for_switching_currency',
|
11 |
-
]
|
12 |
-
);
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param bool $cache_enabled
|
17 |
-
*
|
18 |
-
* @return bool
|
19 |
-
*/
|
20 |
-
public function is_cache_enabled_for_switching_currency( $cache_enabled ) {
|
21 |
-
|
22 |
-
$wp_fastest_cache_options = json_decode( get_option( 'WpFastestCache' ) );
|
23 |
-
|
24 |
-
if ( isset( $wp_fastest_cache_options->wpFastestCacheStatus ) && 'on' === $wp_fastest_cache_options->wpFastestCacheStatus ) {
|
25 |
-
$cache_enabled = true;
|
26 |
-
}
|
27 |
-
|
28 |
-
return $cache_enabled;
|
29 |
-
}
|
30 |
-
|
31 |
-
}
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-wpseo.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WPSEO {
|
4 |
-
|
5 |
-
private $updated_post_id;
|
6 |
-
|
7 |
-
public function __construct() {
|
8 |
-
|
9 |
-
add_filter( 'wcml_product_content_label', [ $this, 'wpseo_custom_field_label' ], 10, 2 );
|
10 |
-
|
11 |
-
if ( 'all' === WPML\FP\Obj::prop( 'clang', $_GET ) ) {
|
12 |
-
add_filter( 'wpseo_robots_array', [ $this, 'noindex_all_comments_page' ], 10, 1 );
|
13 |
-
}
|
14 |
-
|
15 |
-
if ( defined( 'WPSEO_VERSION' ) && defined( 'WPSEO_PATH' ) && isset( $_GET['page'] ) && $_GET['page'] == 'wpml-wcml' && isset( $_GET['tab'] ) && $_GET['tab'] == 'products' ) {
|
16 |
-
if ( version_compare( WPSEO_VERSION, '3', '<' ) ) {
|
17 |
-
require_once WPSEO_PATH . 'admin/class-metabox.php';
|
18 |
-
} elseif ( file_exists( WPSEO_PATH . 'admin/metabox/class-metabox.php' ) ) {
|
19 |
-
require_once WPSEO_PATH . 'admin/metabox/class-metabox.php';
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
add_action( 'post_updated', [ $this, 'set_updated_post_id' ] );
|
24 |
-
add_action( 'wpseo_premium_post_redirect_slug_change', [ $this, 'wpseo_premium_post_redirect_slug_change' ] );
|
25 |
-
}
|
26 |
-
|
27 |
-
public function wpseo_custom_field_label( $field, $product_id ) {
|
28 |
-
global $woocommerce_wpml, $wpseo_metabox;
|
29 |
-
|
30 |
-
$yoast_seo_fields = [ '_yoast_wpseo_focuskw', '_yoast_wpseo_title', '_yoast_wpseo_metadesc' ];
|
31 |
-
|
32 |
-
if ( ! is_array( maybe_unserialize( get_post_meta( $product_id, $field, true ) ) ) ) {
|
33 |
-
|
34 |
-
if ( ! is_null( $wpseo_metabox ) && in_array( $field, $yoast_seo_fields ) ) {
|
35 |
-
|
36 |
-
$wpseo_metabox_values = $wpseo_metabox->get_meta_boxes( 'product' );
|
37 |
-
|
38 |
-
$label = $wpseo_metabox_values[ str_replace( '_yoast_wpseo_', '', $field ) ]['title'];
|
39 |
-
|
40 |
-
return $label;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
return $field;
|
45 |
-
}
|
46 |
-
|
47 |
-
public function set_updated_post_id( $post_id ) {
|
48 |
-
$this->updated_post_id = $post_id;
|
49 |
-
}
|
50 |
-
|
51 |
-
public function wpseo_premium_post_redirect_slug_change( $slug_changed_flag ) {
|
52 |
-
|
53 |
-
if ( null !== $this->updated_post_id && get_post_type( $this->updated_post_id ) === 'product_variation' ) {
|
54 |
-
return true;
|
55 |
-
}
|
56 |
-
|
57 |
-
return $slug_changed_flag;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function noindex_all_comments_page( $robotsArray ) {
|
61 |
-
if ( isset( $robotsArray['index'] ) ) {
|
62 |
-
unset( $robotsArray['index'] );
|
63 |
-
}
|
64 |
-
$robotsArray['noindex'] = 'noindex';
|
65 |
-
return $robotsArray;
|
66 |
-
}
|
67 |
-
|
68 |
-
}
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-yikes-custom-product-tabs.php
DELETED
@@ -1,262 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class WCML_YIKES_Custom_Product_Tabs
|
5 |
-
*/
|
6 |
-
class WCML_YIKES_Custom_Product_Tabs {
|
7 |
-
|
8 |
-
const CUSTOM_TABS_FIELD = 'yikes_woo_products_tabs';
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var WPML_Element_Translation_Package
|
12 |
-
*/
|
13 |
-
private $tp;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @var SitePress
|
17 |
-
*/
|
18 |
-
private $sitepress;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var woocommerce_wpml
|
22 |
-
*/
|
23 |
-
private $woocommerce_wpml;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* WCML_Tab_Manager constructor.
|
27 |
-
*
|
28 |
-
* @param woocommerce_wpml $woocommerce_wpml
|
29 |
-
* @param SitePress $sitepress
|
30 |
-
* @param WPML_Element_Translation_Package $tp
|
31 |
-
*/
|
32 |
-
public function __construct( woocommerce_wpml $woocommerce_wpml, SitePress $sitepress, WPML_Element_Translation_Package $tp ) {
|
33 |
-
$this->sitepress = $sitepress;
|
34 |
-
$this->woocommerce_wpml = $woocommerce_wpml;
|
35 |
-
$this->tp = $tp;
|
36 |
-
}
|
37 |
-
|
38 |
-
public function add_hooks() {
|
39 |
-
|
40 |
-
add_action( 'wpml_translation_job_saved', [ $this, 'save_custom_tabs_translation' ], 10, 3 );
|
41 |
-
|
42 |
-
if ( is_admin() ) {
|
43 |
-
add_action( 'wcml_gui_additional_box_html', [ $this, 'custom_box_html' ], 10, 3 );
|
44 |
-
add_filter( 'wcml_gui_additional_box_data', [ $this, 'custom_box_html_data' ], 10, 4 );
|
45 |
-
add_action( 'wcml_update_extra_fields', [ $this, 'sync_tabs' ], 10, 4 );
|
46 |
-
add_filter( 'wpml_duplicate_custom_fields_exceptions', [ $this, 'custom_fields_exceptions' ] );
|
47 |
-
add_filter( 'wcml_do_not_display_custom_fields_for_product', [ $this, 'custom_fields_exceptions' ] );
|
48 |
-
add_filter( 'wpml_tm_translation_job_data', [ $this, 'append_custom_tabs_to_translation_package' ], 10, 2 );
|
49 |
-
add_action( 'woocommerce_product_data_panels', [ $this, 'show_pointer_info' ] );
|
50 |
-
add_action( 'init', [ $this, 'maybe_remove_admin_language_switcher' ] );
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @param object $obj
|
56 |
-
* @param int $product_id
|
57 |
-
* @param array $data
|
58 |
-
*/
|
59 |
-
public function custom_box_html( $obj, $product_id, $data ) {
|
60 |
-
|
61 |
-
$orig_prod_tabs = $this->get_product_tabs( $product_id );
|
62 |
-
|
63 |
-
if ( $orig_prod_tabs ) {
|
64 |
-
$tabs_section = new WPML_Editor_UI_Field_Section( __( 'Custom Tabs', 'woocommerce-multilingual' ) );
|
65 |
-
|
66 |
-
$keys = array_keys( $orig_prod_tabs );
|
67 |
-
$last_key = end( $keys );
|
68 |
-
$divider = true;
|
69 |
-
|
70 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
71 |
-
if ( $key === $last_key ) {
|
72 |
-
$divider = false;
|
73 |
-
}
|
74 |
-
$group = new WPML_Editor_UI_Field_Group( '', $divider );
|
75 |
-
$tab_field = new WPML_Editor_UI_Single_Line_Field( 'tab_' . $key . '_title', __( 'Tab Title', 'woocommerce-multilingual' ), $data, false );
|
76 |
-
$group->add_field( $tab_field );
|
77 |
-
$tab_field = new WCML_Editor_UI_WYSIWYG_Field( 'tab_' . $key . '_content', null, $data, false );
|
78 |
-
$group->add_field( $tab_field );
|
79 |
-
$tabs_section->add_field( $group );
|
80 |
-
}
|
81 |
-
|
82 |
-
$obj->add_field( $tabs_section );
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @param array $data
|
89 |
-
* @param int $product_id
|
90 |
-
* @param object $translation
|
91 |
-
* @param string $lang
|
92 |
-
*
|
93 |
-
* @return array
|
94 |
-
*/
|
95 |
-
public function custom_box_html_data( $data, $product_id, $translation, $lang ) {
|
96 |
-
|
97 |
-
$orig_prod_tabs = $this->get_product_tabs( $product_id );
|
98 |
-
if ( $orig_prod_tabs ) {
|
99 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
100 |
-
if ( isset( $prod_tab['title'] ) ) {
|
101 |
-
$data[ 'tab_' . $key . '_title' ] = [ 'original' => $prod_tab['title'] ];
|
102 |
-
}
|
103 |
-
if ( isset( $prod_tab['content'] ) ) {
|
104 |
-
$data[ 'tab_' . $key . '_content' ] = [ 'original' => $prod_tab['content'] ];
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
if ( $translation ) {
|
109 |
-
$tr_prod_tabs = $this->get_product_tabs( $translation->ID );
|
110 |
-
if ( $tr_prod_tabs ) {
|
111 |
-
foreach ( $tr_prod_tabs as $key => $prod_tab ) {
|
112 |
-
if ( isset( $prod_tab['title'] ) ) {
|
113 |
-
$data[ 'tab_' . $key . '_title' ]['translation'] = $prod_tab['title'];
|
114 |
-
}
|
115 |
-
if ( isset( $prod_tab['content'] ) ) {
|
116 |
-
$data[ 'tab_' . $key . '_content' ]['translation'] = $prod_tab['content'];
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
return $data;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* @param int $original_product_id
|
128 |
-
* @param int $trnsl_product_id
|
129 |
-
* @param array $data
|
130 |
-
* @param string $lang
|
131 |
-
*/
|
132 |
-
public function sync_tabs( $original_product_id, $trnsl_product_id, $data, $lang ) {
|
133 |
-
|
134 |
-
$orig_prod_tabs = $this->get_product_tabs( $original_product_id );
|
135 |
-
|
136 |
-
if ( ( isset( $_POST['icl_ajx_action'] ) && ( 'make_duplicates' === $_POST['icl_ajx_action'] ) ) || ( get_post_meta( $trnsl_product_id, '_icl_lang_duplicate_of', true ) ) ) {
|
137 |
-
update_post_meta( $trnsl_product_id, self::CUSTOM_TABS_FIELD, $orig_prod_tabs );
|
138 |
-
} elseif ( $orig_prod_tabs ) {
|
139 |
-
$trnsl_product_tabs = [];
|
140 |
-
foreach ( $orig_prod_tabs as $key => $orig_prod_tab ) {
|
141 |
-
$title_key = md5( 'tab_' . $key . '_title' );
|
142 |
-
$content_key = md5( 'tab_' . $key . '_content' );
|
143 |
-
$trnsl_product_tabs[ $key ]['id'] = $orig_prod_tab['id'];
|
144 |
-
$trnsl_product_tabs[ $key ]['title'] = isset( $data[ $title_key ] ) ? sanitize_text_field( $data[ $title_key ] ) : '';
|
145 |
-
$trnsl_product_tabs[ $key ]['content'] = isset( $data[ $content_key ] ) ? wp_kses_post( $data[ $content_key ] ) : '';
|
146 |
-
}
|
147 |
-
update_post_meta( $trnsl_product_id, self::CUSTOM_TABS_FIELD, $trnsl_product_tabs );
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* @param int $product_id
|
153 |
-
*
|
154 |
-
* @return array
|
155 |
-
*/
|
156 |
-
private function get_product_tabs( $product_id ) {
|
157 |
-
return (array) get_post_meta( $product_id, self::CUSTOM_TABS_FIELD, true );
|
158 |
-
}
|
159 |
-
|
160 |
-
|
161 |
-
/**
|
162 |
-
* @param array $fields
|
163 |
-
*
|
164 |
-
* @return array
|
165 |
-
*/
|
166 |
-
public function custom_fields_exceptions( $fields ) {
|
167 |
-
$fields[] = self::CUSTOM_TABS_FIELD;
|
168 |
-
return $fields;
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* @param array $package
|
173 |
-
* @param object $post
|
174 |
-
*
|
175 |
-
* @return array
|
176 |
-
*/
|
177 |
-
public function append_custom_tabs_to_translation_package( $package, $post ) {
|
178 |
-
|
179 |
-
if ( 'product' === $post->post_type ) {
|
180 |
-
|
181 |
-
$orig_prod_tabs = $this->get_product_tabs( $post->ID );
|
182 |
-
if ( $orig_prod_tabs ) {
|
183 |
-
foreach ( $orig_prod_tabs as $key => $prod_tab ) {
|
184 |
-
if ( isset( $prod_tab['title'] ) ) {
|
185 |
-
$package['contents'][ self::CUSTOM_TABS_FIELD . ':product_tab:' . $key . ':title' ] = [
|
186 |
-
'translate' => 1,
|
187 |
-
'data' => $this->tp->encode_field_data( $prod_tab['title'], 'base64' ),
|
188 |
-
'format' => 'base64',
|
189 |
-
];
|
190 |
-
}
|
191 |
-
|
192 |
-
if ( isset( $prod_tab['content'] ) ) {
|
193 |
-
$package['contents'][ self::CUSTOM_TABS_FIELD . ':product_tab:' . $key . ':content' ] = [
|
194 |
-
'translate' => 1,
|
195 |
-
'data' => $this->tp->encode_field_data( $prod_tab['content'], 'base64' ),
|
196 |
-
'format' => 'base64',
|
197 |
-
];
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
return $package;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* @param int $post_id
|
208 |
-
* @param array $data
|
209 |
-
* @param object $job
|
210 |
-
*/
|
211 |
-
public function save_custom_tabs_translation( $post_id, $data, $job ) {
|
212 |
-
|
213 |
-
$original_product_tabs = $this->get_product_tabs( $job->original_doc_id );
|
214 |
-
|
215 |
-
if ( $original_product_tabs ) {
|
216 |
-
|
217 |
-
$translated_product_tabs = $this->get_product_tabs( $post_id );
|
218 |
-
|
219 |
-
if ( ! $translated_product_tabs ) {
|
220 |
-
$translated_product_tabs = $original_product_tabs;
|
221 |
-
}
|
222 |
-
|
223 |
-
foreach ( $data as $value ) {
|
224 |
-
|
225 |
-
if ( preg_match( '/' . self::CUSTOM_TABS_FIELD . ':product_tab:([0-9]+):(.+)/', $value['field_type'], $matches ) ) {
|
226 |
-
|
227 |
-
$tab_key = $matches[1];
|
228 |
-
$field = $matches[2];
|
229 |
-
|
230 |
-
$translated_product_tabs[ $tab_key ][ $field ] = 'title' === $field ? sanitize_text_field( $value['data'] ) : wp_kses_post( $value['data'] );
|
231 |
-
}
|
232 |
-
}
|
233 |
-
|
234 |
-
update_post_meta( $post_id, self::CUSTOM_TABS_FIELD, $translated_product_tabs );
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
public function show_pointer_info() {
|
239 |
-
|
240 |
-
$a = __( 'You can translate your custom product tabs on the %s', 'woocommerce-multilingual' );
|
241 |
-
$b = __( 'WooCommerce product translation page', 'woocommerce-multilingual' );
|
242 |
-
$link = '<a href="' . admin_url( 'admin.php?page=wpml-wcml' ) . '">' . $b . '</a>';
|
243 |
-
|
244 |
-
$pointer_ui = new WCML_Pointer_UI(
|
245 |
-
sprintf( $a, $link ),
|
246 |
-
WCML_Tracking_Link::getWcmlCustomProductTabs(),
|
247 |
-
'yikes_woocommerce_custom_product_tabs',
|
248 |
-
'prepend'
|
249 |
-
);
|
250 |
-
|
251 |
-
$pointer_ui->show();
|
252 |
-
}
|
253 |
-
|
254 |
-
public function maybe_remove_admin_language_switcher() {
|
255 |
-
|
256 |
-
if ( isset( $_GET['page'] ) && 'yikes-woo-settings' === $_GET['page'] ) {
|
257 |
-
remove_action( 'wp_before_admin_bar_render', [ $this->sitepress, 'admin_language_switcher' ] );
|
258 |
-
}
|
259 |
-
|
260 |
-
}
|
261 |
-
|
262 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/class-wcml-yith-wcqv.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_YITH_WCQV {
|
4 |
-
|
5 |
-
public function add_hooks() {
|
6 |
-
|
7 |
-
add_filter( 'wcml_multi_currency_ajax_actions', [ $this, 'ajax_action_needs_multi_currency' ] );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
public function ajax_action_needs_multi_currency( $actions ) {
|
12 |
-
|
13 |
-
$actions[] = 'yith_load_product_quick_view';
|
14 |
-
|
15 |
-
return $actions;
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/includes/class-wcml-wc-product-bundles-items.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WCML_WC_Product_Bundles_Items {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @param int
|
7 |
-
*
|
8 |
-
* @return array
|
9 |
-
*/
|
10 |
-
public function get_items( $product_id ) {
|
11 |
-
|
12 |
-
$items = [];
|
13 |
-
$product_bundle = new WC_Product_Bundle( $product_id );
|
14 |
-
if ( $product_bundle ) {
|
15 |
-
$items = $product_bundle->get_bundled_items();
|
16 |
-
}
|
17 |
-
return $items;
|
18 |
-
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param WC_Bundled_Item
|
23 |
-
*
|
24 |
-
* @return array
|
25 |
-
*/
|
26 |
-
public function get_item_data( $bundled_item ) {
|
27 |
-
$item_data = $bundled_item->get_data();
|
28 |
-
// #wcml-1927 - Insufficient Stock issue
|
29 |
-
if ( $item_data['max_stock'] === null ) {
|
30 |
-
$item_data['max_stock'] = '';
|
31 |
-
}
|
32 |
-
return $item_data;
|
33 |
-
}
|
34 |
-
|
35 |
-
public function copy_item_data( $item_id_1, $item_id_2 ) {
|
36 |
-
|
37 |
-
$item_1_data = $this->get_item_data_object( $item_id_1 );
|
38 |
-
$item_2_data = $this->get_item_data_object( $item_id_2 );
|
39 |
-
|
40 |
-
$meta_data = $item_1_data->get_meta_data();
|
41 |
-
|
42 |
-
foreach ( $meta_data as $key => $value ) {
|
43 |
-
$item_2_data->update_meta( $key, $value );
|
44 |
-
}
|
45 |
-
|
46 |
-
$item_2_data->save();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @param int
|
51 |
-
*
|
52 |
-
* @return WC_Bundled_Item_Data
|
53 |
-
*/
|
54 |
-
public function get_item_data_object( $item_id ) {
|
55 |
-
return new WC_Bundled_Item_Data( $item_id );
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @param WC_Bundled_Item_Data
|
60 |
-
* @param string
|
61 |
-
* @param mixed
|
62 |
-
*/
|
63 |
-
public function update_item_meta( $bundled_item_data, $key, $value ) {
|
64 |
-
$bundled_item_data->update_meta( $key, $value );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @param WC_Bundled_Item_Data
|
69 |
-
*/
|
70 |
-
public function save_item_meta( $bundled_item_data ) {
|
71 |
-
$bundled_item_data->save();
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/css/wcml-bookings.css
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
.wcml_custom_cost_field{
|
2 |
-
display: none;
|
3 |
-
clear: both;
|
4 |
-
}
|
5 |
-
|
6 |
-
.wcml_bookings_range_block,
|
7 |
-
.wcml_bookings_person_block,
|
8 |
-
.wcml_bookings_resource_block{
|
9 |
-
padding: 5px 0;
|
10 |
-
display: -webkit-flex;
|
11 |
-
display: flex;
|
12 |
-
display: -moz-box;
|
13 |
-
-webkit-flex-direction: row;
|
14 |
-
flex-direction: row;
|
15 |
-
}
|
16 |
-
|
17 |
-
.wcml_bookings_range_block label,
|
18 |
-
.wcml_bookings_person_block label,
|
19 |
-
.wcml_bookings_resource_block label{
|
20 |
-
width: auto;
|
21 |
-
margin: 0;
|
22 |
-
padding: 6px 7px;
|
23 |
-
}
|
24 |
-
|
25 |
-
.wcml_custom_costs{
|
26 |
-
padding: 9px 9px 0;
|
27 |
-
display: inline-block;
|
28 |
-
width: 100%;
|
29 |
-
float:left;
|
30 |
-
margin-top:10px;
|
31 |
-
}
|
32 |
-
|
33 |
-
#bookings_pricing .wcml_custom_costs label,
|
34 |
-
.woocommerce_options_panel .wcml_custom_costs label{
|
35 |
-
width: auto;
|
36 |
-
margin: 0 5px;
|
37 |
-
float: left;
|
38 |
-
}
|
39 |
-
.woocommerce_options_panel .wcml_bookings_range_block label{
|
40 |
-
width: 10px;;
|
41 |
-
margin: 0;
|
42 |
-
padding: inherit;
|
43 |
-
}
|
44 |
-
|
45 |
-
#bookings_pricing .wcml_custom_cost_field label,
|
46 |
-
#bookings_resources .woocommerce_booking_resource .wcml_bookings_resource_block label{
|
47 |
-
width: 20px;
|
48 |
-
margin: 0 5px;
|
49 |
-
float: left;
|
50 |
-
}
|
51 |
-
|
52 |
-
.wcml_custom_costs input{
|
53 |
-
width: 16px;
|
54 |
-
clear: both;
|
55 |
-
margin: 2px 5px 2px 0;
|
56 |
-
float: left;
|
57 |
-
}
|
58 |
-
input.wcml_bookings_custom_price,
|
59 |
-
#bookings_pricing .table_grid table td input.wcml_bookings_custom_price{
|
60 |
-
background-color: #F5F2E1;
|
61 |
-
}
|
62 |
-
#bookings_pricing #wcml_custom_costs_manually{
|
63 |
-
clear: both;
|
64 |
-
margin-bottom: 20px;
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/css/wcml-product-addons.css
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
.wc-pao-addon-option-row .wcml-option-prices:not(.hidden) {
|
2 |
-
align-self: center;
|
3 |
-
justify-self: center;
|
4 |
-
grid-column: 13/14;
|
5 |
-
}
|
6 |
-
.wc-pao-addon-option-row .wcml-option-prices:not(.hidden) + .wc-pao-addon-content-remove {
|
7 |
-
grid-column: 14/15;
|
8 |
-
}
|
9 |
-
|
10 |
-
.wcml-dialog-product-addons .wpml-form-row label {
|
11 |
-
text-align: start;
|
12 |
-
width: 30px;
|
13 |
-
margin: 4px 15px;
|
14 |
-
}
|
15 |
-
.wcml-dialog-product-addons .wpml-form-row input {
|
16 |
-
margin: 4px 10px;
|
17 |
-
}
|
18 |
-
|
19 |
-
.wcml-dialog-product-addons {
|
20 |
-
min-width: 300px;
|
21 |
-
max-width: 90%;
|
22 |
-
}
|
23 |
-
.wcml-dialog-product-addons .wcml-dialog-container {
|
24 |
-
padding-bottom: 20px !important;
|
25 |
-
}
|
26 |
-
.wcml-dialog-product-addons .wpml-form-row.default-price span {
|
27 |
-
display: inline-block;
|
28 |
-
margin: 0 14px 9px;
|
29 |
-
font-size: 1.3em;
|
30 |
-
}
|
31 |
-
|
32 |
-
.wc-pao-addon-adjust-price-settings .wcml-option-prices {
|
33 |
-
margin-inline-start: 10px;
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-adventure-tours.js
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
jQuery( function( $ ){
|
2 |
-
|
3 |
-
|
4 |
-
$( '.wcml_custom_cost_field').each( function(){
|
5 |
-
|
6 |
-
var tour_id = $(this).attr('data-tour');
|
7 |
-
|
8 |
-
$('input[name="tour-booking-row['+tour_id+'][spec_price]"]').after( $(this) );
|
9 |
-
|
10 |
-
if( $( '.wcml_custom_prices_input:checked' ).val() == 1 ){
|
11 |
-
$(this).show();
|
12 |
-
}
|
13 |
-
|
14 |
-
});
|
15 |
-
|
16 |
-
$(document).on( 'change', '.wcml_custom_prices_input', function(){
|
17 |
-
|
18 |
-
if( $(this).val() == 1 ){
|
19 |
-
|
20 |
-
$( '.wcml_custom_cost_field' ).show();
|
21 |
-
|
22 |
-
}else{
|
23 |
-
|
24 |
-
$( '.wcml_custom_cost_field' ).hide();
|
25 |
-
|
26 |
-
}
|
27 |
-
|
28 |
-
});
|
29 |
-
|
30 |
-
});
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-adventure-tours.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function($){$(".wcml_custom_cost_field").each(function(){var tour_id=$(this).attr("data-tour");$('input[name="tour-booking-row['+tour_id+'][spec_price]"]').after($(this));if($(".wcml_custom_prices_input:checked").val()==1){$(this).show()}});$(document).on("change",".wcml_custom_prices_input",function(){if($(this).val()==1){$(".wcml_custom_cost_field").show()}else{$(".wcml_custom_cost_field").hide()}})});
|
|
trunk/compatibility/res/js/wcml-bookings.js
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
jQuery( function( $ ){
|
2 |
-
|
3 |
-
wcml_lock_bookings_fields();
|
4 |
-
|
5 |
-
if( $( '.wcml_custom_costs_input:checked' ).val() == 1 ){
|
6 |
-
|
7 |
-
$( '.wcml_custom_cost_field' ).show();
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
$(document).on( 'change', '.wcml_custom_costs_input', function(){
|
12 |
-
|
13 |
-
if( $(this).val() == 1 ){
|
14 |
-
|
15 |
-
$( '.wcml_custom_cost_field' ).show();
|
16 |
-
|
17 |
-
}else{
|
18 |
-
|
19 |
-
$( '.wcml_custom_cost_field' ).hide();
|
20 |
-
|
21 |
-
}
|
22 |
-
|
23 |
-
});
|
24 |
-
|
25 |
-
$(document).on( 'mouseout', '.add_row', function(){
|
26 |
-
|
27 |
-
if( $( '.wcml_custom_costs_input:checked' ).val() == 1 ) {
|
28 |
-
|
29 |
-
$( '.wcml_custom_cost_field' ).show();
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
});
|
34 |
-
|
35 |
-
$(document).on( 'mouseout', '.add_person', function(){
|
36 |
-
|
37 |
-
if( $( '.wcml_custom_costs_input:checked' ).val() == 1 ) {
|
38 |
-
|
39 |
-
setTimeout(
|
40 |
-
function() {
|
41 |
-
$( '.wcml_custom_cost_field' ).show();
|
42 |
-
}, 3000);
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
});
|
47 |
-
|
48 |
-
function wcml_lock_bookings_fields(){
|
49 |
-
//lock fields
|
50 |
-
if( typeof lock_settings != 'undefined' && typeof lock_settings.lock_fields != 'undefined' && lock_settings.lock_fields == 1 ){
|
51 |
-
|
52 |
-
$('#bookings_pricing input[type="number"],' +
|
53 |
-
'#accommodation_bookings_rates input[type="number"], ' +
|
54 |
-
'#bookings_resources input[type="number"], ' +
|
55 |
-
'#bookings_availability input[type="number"], ' +
|
56 |
-
'#bookings_availability input[type="time"], ' +
|
57 |
-
|
58 |
-
'#bookings_persons input[type="number"]').each(function(){
|
59 |
-
$(this).prop('readonly', true);
|
60 |
-
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
61 |
-
});
|
62 |
-
|
63 |
-
var buttons = [ 'add_resource', 'add_row','remove_booking_resource','remove_booking_person','add_person' ];
|
64 |
-
|
65 |
-
for (i = 0; i < buttons.length; i++) {
|
66 |
-
$('.'+buttons[i]).prop('disabled', true);
|
67 |
-
$('.'+buttons[i]).off('click');
|
68 |
-
$('.'+buttons[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
69 |
-
}
|
70 |
-
$('.add_row').removeAttr('data-row');
|
71 |
-
|
72 |
-
$('form#post input[type="submit"]').click(function(){
|
73 |
-
|
74 |
-
for (i = 0; i < non_standard_fields.ids.length; i++) {
|
75 |
-
$('#'+non_standard_fields.ids[i]).prop('disabled', false);
|
76 |
-
}
|
77 |
-
|
78 |
-
$('#bookings_pricing select, #bookings_resources select, #bookings_availability select,#bookings_persons input[type="checkbox"]').each(function(){
|
79 |
-
$(this).prop('disabled', false);
|
80 |
-
});
|
81 |
-
|
82 |
-
});
|
83 |
-
|
84 |
-
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
});
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-bookings.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function($){wcml_lock_bookings_fields();if($(".wcml_custom_costs_input:checked").val()==1){$(".wcml_custom_cost_field").show()}$(document).on("change",".wcml_custom_costs_input",function(){if($(this).val()==1){$(".wcml_custom_cost_field").show()}else{$(".wcml_custom_cost_field").hide()}});$(document).on("mouseout",".add_row",function(){if($(".wcml_custom_costs_input:checked").val()==1){$(".wcml_custom_cost_field").show()}});$(document).on("mouseout",".add_person",function(){if($(".wcml_custom_costs_input:checked").val()==1){setTimeout(function(){$(".wcml_custom_cost_field").show()},3e3)}});function wcml_lock_bookings_fields(){if(typeof lock_settings!="undefined"&&typeof lock_settings.lock_fields!="undefined"&&lock_settings.lock_fields==1){$('#bookings_pricing input[type="number"],'+'#accommodation_bookings_rates input[type="number"], '+'#bookings_resources input[type="number"], '+'#bookings_availability input[type="number"], '+'#bookings_availability input[type="time"], '+'#bookings_persons input[type="number"]').each(function(){$(this).prop("readonly",true);$(this).after($(".wcml_lock_img").clone().removeClass("wcml_lock_img").show())});var buttons=["add_resource","add_row","remove_booking_resource","remove_booking_person","add_person"];for(i=0;i<buttons.length;i++){$("."+buttons[i]).prop("disabled",true);$("."+buttons[i]).off("click");$("."+buttons[i]).after($(".wcml_lock_img").clone().removeClass("wcml_lock_img").show())}$(".add_row").removeAttr("data-row");$('form#post input[type="submit"]').click(function(){for(i=0;i<non_standard_fields.ids.length;i++){$("#"+non_standard_fields.ids[i]).prop("disabled",false)}$('#bookings_pricing select, #bookings_resources select, #bookings_availability select,#bookings_persons input[type="checkbox"]').each(function(){$(this).prop("disabled",false)})})}}});
|
|
trunk/compatibility/res/js/wcml-composite.js
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
jQuery( function( $ ){
|
2 |
-
//lock fields
|
3 |
-
if( typeof lock_settings != 'undefined' && typeof lock_settings.lock_fields != 'undefined' && lock_settings.lock_fields == 1 ) {
|
4 |
-
|
5 |
-
$('#bto_config_group_inner .remove_row,.add_bto_group,.save_composition').each(function(){
|
6 |
-
$(this).prop('disabled', true);
|
7 |
-
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
8 |
-
});
|
9 |
-
|
10 |
-
$('#bto_product_data li,#bto_config_group_inner .subsubsub li a').on('click', function(){ return false; });
|
11 |
-
|
12 |
-
|
13 |
-
//components fields
|
14 |
-
jQuery('input.group_quantity_min,input.group_quantity_max,input.group_discount,.bto_query_type_selector .wc-product-search').each(function(){
|
15 |
-
jQuery(this).prop('readonly', true);
|
16 |
-
jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
17 |
-
});
|
18 |
-
|
19 |
-
jQuery('select.bto_query_type,.component_options_style select,.group_optional input').each(function(){
|
20 |
-
jQuery(this).prop('disabled', true);
|
21 |
-
jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
22 |
-
});
|
23 |
-
}
|
24 |
-
|
25 |
-
});
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-composite.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function($){if(typeof lock_settings!="undefined"&&typeof lock_settings.lock_fields!="undefined"&&lock_settings.lock_fields==1){$("#bto_config_group_inner .remove_row,.add_bto_group,.save_composition").each(function(){$(this).prop("disabled",true);$(this).after($(".wcml_lock_img").clone().removeClass("wcml_lock_img").show())});$("#bto_product_data li,#bto_config_group_inner .subsubsub li a").on("click",function(){return false});jQuery("input.group_quantity_min,input.group_quantity_max,input.group_discount,.bto_query_type_selector .wc-product-search").each(function(){jQuery(this).prop("readonly",true);jQuery(this).after(jQuery(".wcml_lock_img").clone().removeClass("wcml_lock_img").show())});jQuery("select.bto_query_type,.component_options_style select,.group_optional input").each(function(){jQuery(this).prop("disabled",true);jQuery(this).after(jQuery(".wcml_lock_img").clone().removeClass("wcml_lock_img").show())})}});
|
|
trunk/compatibility/res/js/wcml-members.js
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
jQuery(function ($) {
|
2 |
-
|
3 |
-
if (typeof wc_memberships_memebers_area_endpoint != 'undefined') {
|
4 |
-
|
5 |
-
var tabs = ['my-membership-content', 'my-membership-products', 'my-membership-discounts', 'my-membership-notes'];
|
6 |
-
|
7 |
-
for (var i = 0; i < tabs.length; i++) {
|
8 |
-
$('.' + tabs[i] + ' a').each(function () {
|
9 |
-
var href = $(this).attr('href');
|
10 |
-
if (href) {
|
11 |
-
$(this).attr('href', href.replace(wc_memberships_memebers_area_endpoint.original, wc_memberships_memebers_area_endpoint.translated));
|
12 |
-
}
|
13 |
-
});
|
14 |
-
}
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-members.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function($){if(typeof wc_memberships_memebers_area_endpoint!="undefined"){var tabs=["my-membership-content","my-membership-products","my-membership-discounts","my-membership-notes"];for(var i=0;i<tabs.length;i++){$("."+tabs[i]+" a").each(function(){var href=$(this).attr("href");if(href){$(this).attr("href",href.replace(wc_memberships_memebers_area_endpoint.original,wc_memberships_memebers_area_endpoint.translated))}})}}});
|
|
trunk/compatibility/res/js/wcml-product-addons.js
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
jQuery(function ($) {
|
2 |
-
|
3 |
-
$('.wc-pao-addon-header').each(function () {
|
4 |
-
fix_dialogs_visibility($(this));
|
5 |
-
});
|
6 |
-
|
7 |
-
if( $('.wcml_custom_prices').length > 0 ){
|
8 |
-
$('.wcml_custom_prices').insertAfter( $('.global-addons-form tr:eq(2)') ).show();
|
9 |
-
}
|
10 |
-
|
11 |
-
$(document).on('click', '#product_addons_data .js-wcml-dialog-trigger', function () {
|
12 |
-
var dialog = $(this).parent().find('.wcml-dialog');
|
13 |
-
var default_price = $(this).parent().parent().find('input.wc_input_price').val();
|
14 |
-
var option_type = $(this).closest('.wc-pao-addon-content').find('.wc-pao-addon-type-select').val();
|
15 |
-
|
16 |
-
dialog.find('.default-price strong').html(default_price ? default_price : 0);
|
17 |
-
|
18 |
-
if ('multiple_choice' === option_type || 'checkbox' === option_type) {
|
19 |
-
var option_text = $(this).parent().parent().find('.wc-pao-addon-content-label input[type="text"]').val();
|
20 |
-
if (option_text) {
|
21 |
-
dialog.find('p>strong').html(option_text);
|
22 |
-
}
|
23 |
-
} else {
|
24 |
-
var addon_text = $(this).closest('.wc-pao-addon-content').find('.wc-pao-addon-title input[type="text"]').val();
|
25 |
-
if (addon_text) {
|
26 |
-
dialog.find('p>strong').html(addon_text);
|
27 |
-
}
|
28 |
-
}
|
29 |
-
});
|
30 |
-
|
31 |
-
$(document).on('change', '.wc-pao-addon-type-select', function () {
|
32 |
-
fix_dialogs_visibility($(this));
|
33 |
-
maybe_set_prices_dialog_visible($(this));
|
34 |
-
});
|
35 |
-
|
36 |
-
$(document).on('click', '.wcml_product_addons_apply_prices', function () {
|
37 |
-
|
38 |
-
var dialog = $(this).closest('.wcml-ui-dialog');
|
39 |
-
var dialog_id = $(this).data('dialog');
|
40 |
-
|
41 |
-
dialog.find('.wc_input_price').each(function () {
|
42 |
-
$('.wcml-dialog#' + dialog_id).find('input[name="' + $(this).attr('name') + '"]').attr('value', $(this).val());
|
43 |
-
});
|
44 |
-
dialog.find('.wcml-dialog-close-button').trigger('click');
|
45 |
-
});
|
46 |
-
|
47 |
-
$(document).on('change', '.wcml_custom_prices_input', function () {
|
48 |
-
if (parseInt($(this).val()) === 1) {
|
49 |
-
$('#product_addons_data .js-wcml-option-prices').each(function () {
|
50 |
-
$(this).removeClass('hidden');
|
51 |
-
});
|
52 |
-
} else {
|
53 |
-
$('#product_addons_data .js-wcml-option-prices').each(function () {
|
54 |
-
$(this).addClass('hidden');
|
55 |
-
});
|
56 |
-
}
|
57 |
-
});
|
58 |
-
|
59 |
-
});
|
60 |
-
|
61 |
-
function fix_dialogs_visibility(element) {
|
62 |
-
|
63 |
-
var parent = element.closest('.wc-pao-addon');
|
64 |
-
var option_type = parent.find('.wc-pao-addon-type-select').val();
|
65 |
-
|
66 |
-
parent.find('.wc-pao-addon-adjust-price-settings').append(parent.find('.wc-pao-addon-content>.wcml-option-prices'));
|
67 |
-
|
68 |
-
if ('multiple_choice' !== option_type && 'checkbox' !== option_type) {
|
69 |
-
parent.find('.wc-pao-addon-content-option-rows .wcml-option-prices .wc_input_price').each(function () {
|
70 |
-
jQuery(this).prop('disabled', true);
|
71 |
-
});
|
72 |
-
parent.find('.wc-pao-addon-adjust-price-settings .wcml-option-prices .wc_input_price').each(function () {
|
73 |
-
jQuery(this).prop('disabled', false);
|
74 |
-
});
|
75 |
-
} else {
|
76 |
-
parent.find('.wc-pao-addon-adjust-price-settings .wcml-option-prices .wc_input_price').each(function () {
|
77 |
-
jQuery(this).prop('disabled', true);
|
78 |
-
});
|
79 |
-
|
80 |
-
parent.find('.wc-pao-addon-content-option-rows .wcml-option-prices .wc_input_price').each(function () {
|
81 |
-
jQuery(this).prop('disabled', false);
|
82 |
-
});
|
83 |
-
}
|
84 |
-
|
85 |
-
}
|
86 |
-
|
87 |
-
function maybe_set_prices_dialog_visible(element) {
|
88 |
-
if (element.closest('#wpbody').find('.wcml_custom_prices_input:checked').val() == 1) {
|
89 |
-
element.closest('.wc-pao-addon').find('.js-wcml-option-prices').each(function () {
|
90 |
-
jQuery(this).removeClass('hidden');
|
91 |
-
});
|
92 |
-
}
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/compatibility/res/js/wcml-product-addons.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function($){$(".wc-pao-addon-header").each(function(){fix_dialogs_visibility($(this))});if($(".wcml_custom_prices").length>0){$(".wcml_custom_prices").insertAfter($(".global-addons-form tr:eq(2)")).show()}$(document).on("click","#product_addons_data .js-wcml-dialog-trigger",function(){var dialog=$(this).parent().find(".wcml-dialog");var default_price=$(this).parent().parent().find("input.wc_input_price").val();var option_type=$(this).closest(".wc-pao-addon-content").find(".wc-pao-addon-type-select").val();dialog.find(".default-price strong").html(default_price?default_price:0);if("multiple_choice"===option_type||"checkbox"===option_type){var option_text=$(this).parent().parent().find('.wc-pao-addon-content-label input[type="text"]').val();if(option_text){dialog.find("p>strong").html(option_text)}}else{var addon_text=$(this).closest(".wc-pao-addon-content").find('.wc-pao-addon-title input[type="text"]').val();if(addon_text){dialog.find("p>strong").html(addon_text)}}});$(document).on("change",".wc-pao-addon-type-select",function(){fix_dialogs_visibility($(this));maybe_set_prices_dialog_visible($(this))});$(document).on("click",".wcml_product_addons_apply_prices",function(){var dialog=$(this).closest(".wcml-ui-dialog");var dialog_id=$(this).data("dialog");dialog.find(".wc_input_price").each(function(){$(".wcml-dialog#"+dialog_id).find('input[name="'+$(this).attr("name")+'"]').attr("value",$(this).val())});dialog.find(".wcml-dialog-close-button").trigger("click")});$(document).on("change",".wcml_custom_prices_input",function(){if(parseInt($(this).val())===1){$("#product_addons_data .js-wcml-option-prices").each(function(){$(this).removeClass("hidden")})}else{$("#product_addons_data .js-wcml-option-prices").each(function(){$(this).addClass("hidden")})}})});function fix_dialogs_visibility(element){var parent=element.closest(".wc-pao-addon");var option_type=parent.find(".wc-pao-addon-type-select").val();parent.find(".wc-pao-addon-adjust-price-settings").append(parent.find(".wc-pao-addon-content>.wcml-option-prices"));if("multiple_choice"!==option_type&&"checkbox"!==option_type){parent.find(".wc-pao-addon-content-option-rows .wcml-option-prices .wc_input_price").each(function(){jQuery(this).prop("disabled",true)});parent.find(".wc-pao-addon-adjust-price-settings .wcml-option-prices .wc_input_price").each(function(){jQuery(this).prop("disabled",false)})}else{parent.find(".wc-pao-addon-adjust-price-settings .wcml-option-prices .wc_input_price").each(function(){jQuery(this).prop("disabled",true)});parent.find(".wc-pao-addon-content-option-rows .wcml-option-prices .wc_input_price").each(function(){jQuery(this).prop("disabled",false)})}}function maybe_set_prices_dialog_visible(element){if(element.closest("#wpbody").find(".wcml_custom_prices_input:checked").val()==1){element.closest(".wc-pao-addon").find(".js-wcml-option-prices").each(function(){jQuery(this).removeClass("hidden")})}}
|
|
trunk/dist/css/multicurrencyAnalytics/styles.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
|
trunk/dist/css/multicurrencyOptions/styles.css
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
2 |
-
.ant-modal{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;top:100px;width:auto;margin:0 auto;padding-bottom:24px;pointer-events:none}.ant-modal-wrap{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;overflow:auto;outline:0;-webkit-overflow-scrolling:touch}.ant-modal-title{margin:0;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:22px;word-wrap:break-word}.ant-modal-content{position:relative;background-color:#fff;background-clip:padding-box;border:0;border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);pointer-events:auto}.ant-modal-close{position:absolute;top:0;right:0;z-index:10;padding:0;color:rgba(0,0,0,0.45);font-weight:700;line-height:1;text-decoration:none;background:transparent;border:0;outline:0;cursor:pointer;-webkit-transition:color 0.3s;transition:color 0.3s}.ant-modal-close-x{display:block;width:56px;height:56px;font-size:16px;font-style:normal;line-height:56px;text-align:center;text-transform:none;text-rendering:auto}.ant-modal-close:focus,.ant-modal-close:hover{color:rgba(0,0,0,0.75);text-decoration:none}.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,0.65);background:#fff;border-bottom:1px solid #f0f0f0;border-radius:2px 2px 0 0}.ant-modal-body{padding:24px;font-size:14px;line-height:1.5715;word-wrap:break-word}.ant-modal-footer{padding:10px 16px;text-align:right;background:transparent;border-top:1px solid #f0f0f0;border-radius:0 0 2px 2px}.ant-modal-footer button+button{margin-bottom:0;margin-left:8px}.ant-modal.zoom-enter,.ant-modal.zoom-appear{-webkit-transform:none;transform:none;opacity:0;-webkit-animation-duration:0.3s;animation-duration:0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;height:100%;background-color:rgba(0,0,0,0.45);filter:alpha(opacity=50)}.ant-modal-mask-hidden{display:none}.ant-modal-open{overflow:hidden}.ant-modal-centered{text-align:center}.ant-modal-centered::before{display:inline-block;width:0;height:100%;vertical-align:middle;content:''}.ant-modal-centered .ant-modal{top:0;display:inline-block;text-align:left;vertical-align:middle}@media (max-width: 767px){.ant-modal{max-width:calc(100vw - 16px);margin:8px auto}.ant-modal-centered .ant-modal{-webkit-box-flex:1;-ms-flex:1;flex:1}}.ant-modal-confirm .ant-modal-header{display:none}.ant-modal-confirm .ant-modal-close{display:none}.ant-modal-confirm .ant-modal-body{padding:32px 32px 24px}.ant-modal-confirm-body-wrapper::before{display:table;content:''}.ant-modal-confirm-body-wrapper::after{display:table;clear:both;content:''}.ant-modal-confirm-body .ant-modal-confirm-title{display:block;overflow:hidden;color:rgba(0,0,0,0.85);font-weight:500;font-size:16px;line-height:1.4}.ant-modal-confirm-body .ant-modal-confirm-content{margin-top:8px;color:rgba(0,0,0,0.65);font-size:14px}.ant-modal-confirm-body>.anticon{float:left;margin-right:16px;font-size:22px}.ant-modal-confirm-body>.anticon+.ant-modal-confirm-title+.ant-modal-confirm-content{margin-left:38px}.ant-modal-confirm .ant-modal-confirm-btns{float:right;margin-top:24px}.ant-modal-confirm .ant-modal-confirm-btns button+button{margin-bottom:0;margin-left:8px}.ant-modal-confirm-error .ant-modal-confirm-body>.anticon{color:#ff4d4f}.ant-modal-confirm-warning .ant-modal-confirm-body>.anticon,.ant-modal-confirm-confirm .ant-modal-confirm-body>.anticon{color:#faad14}.ant-modal-confirm-info .ant-modal-confirm-body>.anticon{color:#1890ff}.ant-modal-confirm-success .ant-modal-confirm-body>.anticon{color:#52c41a}.ant-modal-wrap-rtl{direction:rtl}.ant-modal-wrap-rtl .ant-modal-close{right:initial;left:0}.ant-modal-wrap-rtl .ant-modal-footer{text-align:left}.ant-modal-wrap-rtl .ant-modal-footer button+button{margin-right:8px;margin-left:0}.ant-modal-wrap-rtl.ant-modal-centered .ant-modal{text-align:right}
|
3 |
-
.ant-tooltip{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;z-index:1060;display:block;max-width:250px;visibility:visible}.ant-tooltip-hidden{display:none}.ant-tooltip-placement-top,.ant-tooltip-placement-topLeft,.ant-tooltip-placement-topRight{padding-bottom:8px}.ant-tooltip-placement-right,.ant-tooltip-placement-rightTop,.ant-tooltip-placement-rightBottom{padding-left:8px}.ant-tooltip-placement-bottom,.ant-tooltip-placement-bottomLeft,.ant-tooltip-placement-bottomRight{padding-top:8px}.ant-tooltip-placement-left,.ant-tooltip-placement-leftTop,.ant-tooltip-placement-leftBottom{padding-right:8px}.ant-tooltip-inner{min-width:30px;min-height:32px;padding:6px 8px;color:#fff;text-align:left;text-decoration:none;word-wrap:break-word;background-color:rgba(0,0,0,0.75);border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-tooltip-arrow{position:absolute;display:block;width:13.07106781px;height:13.07106781px;overflow:hidden;background:transparent;pointer-events:none}.ant-tooltip-arrow::before{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:5px;height:5px;margin:auto;background-color:rgba(0,0,0,0.75);content:'';pointer-events:auto}.ant-tooltip-placement-top .ant-tooltip-arrow,.ant-tooltip-placement-topLeft .ant-tooltip-arrow,.ant-tooltip-placement-topRight .ant-tooltip-arrow{bottom:-5.07106781px}.ant-tooltip-placement-top .ant-tooltip-arrow::before,.ant-tooltip-placement-topLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-topRight .ant-tooltip-arrow::before{-webkit-box-shadow:3px 3px 7px rgba(0,0,0,0.07);box-shadow:3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(-6.53553px) rotate(45deg);transform:translateY(-6.53553px) rotate(45deg)}.ant-tooltip-placement-top .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-topLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-topRight .ant-tooltip-arrow{right:13px}.ant-tooltip-placement-right .ant-tooltip-arrow,.ant-tooltip-placement-rightTop .ant-tooltip-arrow,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{left:-5.07106781px}.ant-tooltip-placement-right .ant-tooltip-arrow::before,.ant-tooltip-placement-rightTop .ant-tooltip-arrow::before,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow::before{-webkit-box-shadow:-3px 3px 7px rgba(0,0,0,0.07);box-shadow:-3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(6.53553px) rotate(45deg);transform:translateX(6.53553px) rotate(45deg)}.ant-tooltip-placement-right .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-rightTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-left .ant-tooltip-arrow,.ant-tooltip-placement-leftTop .ant-tooltip-arrow,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{right:-5.07106781px}.ant-tooltip-placement-left .ant-tooltip-arrow::before,.ant-tooltip-placement-leftTop .ant-tooltip-arrow::before,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow::before{-webkit-box-shadow:3px -3px 7px rgba(0,0,0,0.07);box-shadow:3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(-6.53553px) rotate(45deg);transform:translateX(-6.53553px) rotate(45deg)}.ant-tooltip-placement-left .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-leftTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-bottom .ant-tooltip-arrow,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{top:-5.07106781px}.ant-tooltip-placement-bottom .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow::before{-webkit-box-shadow:-3px -3px 7px rgba(0,0,0,0.07);box-shadow:-3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(6.53553px) rotate(45deg);transform:translateY(6.53553px) rotate(45deg)}.ant-tooltip-placement-bottom .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{right:13px}.ant-tooltip-rtl{direction:rtl}.ant-tooltip-rtl .ant-tooltip-inner{text-align:right}
|
4 |
-
.ant-select-single .ant-select-selector{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-single .ant-select-selector .ant-select-selection-search{position:absolute;top:0;right:11px;bottom:0;left:11px}.ant-select-single .ant-select-selector .ant-select-selection-search-input{width:100%}.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{padding:0;line-height:30px;-webkit-transition:all 0.3s;transition:all 0.3s}@supports (-moz-appearance: meterbar){.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{line-height:30px}}.ant-select-single .ant-select-selector .ant-select-selection-item{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-single .ant-select-selector .ant-select-selection-placeholder{pointer-events:none}.ant-select-single .ant-select-selector::after,.ant-select-single .ant-select-selector .ant-select-selection-item::after,.ant-select-single .ant-select-selector .ant-select-selection-placeholder::after{display:inline-block;width:0;visibility:hidden;content:'\a0'}.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:25px}.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:18px}.ant-select-single.ant-select-open .ant-select-selection-item{opacity:0.4}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);width:100%;height:32px;padding:0 11px}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:not-allowed}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{height:30px}.ant-select-single.ant-select-customize-input .ant-select-selector::after{display:none}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-search{position:static;width:100%}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder{position:absolute;right:0;left:0;padding:0 11px}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder::after{display:none}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{height:40px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:38px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:38px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{height:24px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selection-search{right:7px;left:7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{padding:0 7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:28px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:21px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-multiple .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1px 4px}.ant-select-multiple .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-multiple .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-multiple .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-multiple .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-multiple .ant-select-selector input{cursor:not-allowed}.ant-select-multiple .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-multiple .ant-select-selector::after{display:inline-block;width:0;margin:2px 0;line-height:24px;content:'\a0'}.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:24px}.ant-select-multiple .ant-select-selection-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:24px;margin-top:2px;margin-right:4px;margin-bottom:2px;padding:0 4px 0 8px;line-height:22px;background:#f5f5f5;border:1px solid #f0f0f0;border-radius:2px;cursor:default;-webkit-transition:font-size 0.3s, line-height 0.3s, height 0.3s;transition:font-size 0.3s, line-height 0.3s, height 0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-multiple .ant-select-selection-item-content{display:inline-block;margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-multiple .ant-select-selection-item-remove{color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:rgba(0,0,0,0.45);font-weight:bold;font-size:12px;line-height:inherit;cursor:pointer;display:inline-block;font-size:10px}.ant-select-multiple .ant-select-selection-item-remove>*{line-height:1}.ant-select-multiple .ant-select-selection-item-remove svg{display:inline-block}.ant-select-multiple .ant-select-selection-item-remove::before{display:none}.ant-select-multiple .ant-select-selection-item-remove .ant-select-multiple .ant-select-selection-item-remove-icon{display:block}.ant-select-multiple .ant-select-selection-item-remove>.anticon{vertical-align:-0.2em}.ant-select-multiple .ant-select-selection-item-remove:hover{color:rgba(0,0,0,0.75)}.ant-select-multiple .ant-select-selection-search{position:relative;margin-left:0.5px}.ant-select-multiple .ant-select-selection-search-input,.ant-select-multiple .ant-select-selection-search-mirror{font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';line-height:1.5715;-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple .ant-select-selection-search-input{width:100%;min-width:3px}.ant-select-multiple .ant-select-selection-search-mirror{position:absolute;top:0;left:0;z-index:999;white-space:nowrap;visibility:hidden}.ant-select-multiple .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:6.5px}.ant-select-multiple .ant-select-selection-placeholder{position:absolute;top:50%;right:11px;left:11px;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple.ant-select-lg .ant-select-selector::after{line-height:32px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:30px}.ant-select-multiple.ant-select-lg .ant-select-selection-search{height:33px;line-height:33px}.ant-select-multiple.ant-select-lg .ant-select-selection-search-input,.ant-select-multiple.ant-select-lg .ant-select-selection-search-mirror{height:32px;line-height:30px}.ant-select-multiple.ant-select-sm .ant-select-selector::after{line-height:16px}.ant-select-multiple.ant-select-sm .ant-select-selection-item{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-search{height:17px;line-height:17px}.ant-select-multiple.ant-select-sm .ant-select-selection-search-input,.ant-select-multiple.ant-select-sm .ant-select-selection-search-mirror{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{left:7px}.ant-select-multiple.ant-select-sm .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:3px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:32px}.ant-select-disabled .ant-select-selection-item-remove{display:none}.ant-select{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;display:inline-block;cursor:pointer}.ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important}.ant-select-selection-item{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media all and (-ms-high-contrast: none){.ant-select-selection-item *::-ms-backdrop,.ant-select-selection-item{-ms-flex:auto;flex:auto}}.ant-select-selection-placeholder{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0.4}@media all and (-ms-high-contrast: none){.ant-select-selection-placeholder *::-ms-backdrop,.ant-select-selection-placeholder{-ms-flex:auto;flex:auto}}.ant-select-arrow{display:inline-block;color:inherit;font-style:normal;line-height:0;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:53%;right:11px;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;line-height:1;text-align:center;pointer-events:none}.ant-select-arrow>*{line-height:1}.ant-select-arrow svg{display:inline-block}.ant-select-arrow::before{display:none}.ant-select-arrow .ant-select-arrow-icon{display:block}.ant-select-arrow .anticon{vertical-align:top;-webkit-transition:-webkit-transform 0.3s;transition:-webkit-transform 0.3s;transition:transform 0.3s;transition:transform 0.3s, -webkit-transform 0.3s}.ant-select-arrow .anticon>svg{vertical-align:top}.ant-select-arrow .anticon:not(.anticon-down){pointer-events:auto}.ant-select-clear{position:absolute;top:50%;right:11px;z-index:1;display:inline-block;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;font-style:normal;line-height:1;text-align:center;text-transform:none;background:#fff;cursor:pointer;opacity:0;-webkit-transition:color 0.3s ease, opacity 0.15s ease;transition:color 0.3s ease, opacity 0.15s ease;text-rendering:auto}.ant-select-clear::before{display:block}.ant-select-clear:hover{color:rgba(0,0,0,0.45)}.ant-select:hover .ant-select-clear{opacity:1}.ant-select-dropdown{margin:0;padding:0;color:rgba(0,0,0,0.65);font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;top:-9999px;left:-9999px;z-index:1050;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 0;overflow:hidden;font-size:14px;font-variant:initial;background-color:#fff;border-radius:2px;outline:none;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-bottomLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-topLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut}.ant-select-dropdown-hidden{display:none}.ant-select-item-empty{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px}.ant-select-item{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px;cursor:pointer;-webkit-transition:background 0.3s ease;transition:background 0.3s ease}.ant-select-item-group{color:rgba(0,0,0,0.45);font-size:12px;cursor:default}.ant-select-item-option{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-item-option-content{-webkit-box-flex:1;-ms-flex:auto;flex:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-item-option-state{-webkit-box-flex:0;-ms-flex:none;flex:none}.ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:#f5f5f5}.ant-select-item-option-selected:not(.ant-select-item-option-disabled){color:rgba(0,0,0,0.65);font-weight:600;background-color:#e6f7ff}.ant-select-item-option-selected:not(.ant-select-item-option-disabled) .ant-select-item-option-state{color:#1890ff}.ant-select-item-option-disabled{color:rgba(0,0,0,0.25);cursor:not-allowed}.ant-select-item-option-grouped{padding-left:24px}.ant-select-lg{font-size:16px}.ant-select-borderless .ant-select-selector{background-color:transparent !important;border-color:transparent !important;-webkit-box-shadow:none !important;box-shadow:none !important}.ant-select-rtl{direction:rtl}.ant-select-rtl .ant-select-arrow{right:initial;left:11px}.ant-select-rtl .ant-select-clear{right:initial;left:11px}.ant-select-dropdown-rtl{direction:rtl}.ant-select-dropdown-rtl .ant-select-item-option-grouped{padding-right:24px;padding-left:12px}.ant-select-rtl.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:4px;padding-left:24px}.ant-select-rtl.ant-select-multiple .ant-select-selection-item{margin-right:0;margin-left:4px;padding:0 8px 0 4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-item-content{margin-right:0;margin-left:4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-search{margin-right:0.5px;margin-left:4px}.ant-select-rtl.ant-select-multiple .ant-select-selection-search-mirror{right:0;left:auto}.ant-select-rtl.ant-select-multiple .ant-select-selection-placeholder{right:11px;left:auto}.ant-select-rtl.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{right:7px}.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-placeholder{right:0;left:9px;text-align:right}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:11px;left:25px}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:18px}.ant-select-rtl.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:0}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:21px}
|
|
|
|
|
|
|
|
trunk/dist/css/multicurrencyShippingAdmin/styles.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
|
trunk/dist/css/paymentGatewaysAdmin/styles.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
2 |
-
.ant-tooltip{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;z-index:1060;display:block;max-width:250px;visibility:visible}.ant-tooltip-hidden{display:none}.ant-tooltip-placement-top,.ant-tooltip-placement-topLeft,.ant-tooltip-placement-topRight{padding-bottom:8px}.ant-tooltip-placement-right,.ant-tooltip-placement-rightTop,.ant-tooltip-placement-rightBottom{padding-left:8px}.ant-tooltip-placement-bottom,.ant-tooltip-placement-bottomLeft,.ant-tooltip-placement-bottomRight{padding-top:8px}.ant-tooltip-placement-left,.ant-tooltip-placement-leftTop,.ant-tooltip-placement-leftBottom{padding-right:8px}.ant-tooltip-inner{min-width:30px;min-height:32px;padding:6px 8px;color:#fff;text-align:left;text-decoration:none;word-wrap:break-word;background-color:rgba(0,0,0,0.75);border-radius:2px;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-tooltip-arrow{position:absolute;display:block;width:13.07106781px;height:13.07106781px;overflow:hidden;background:transparent;pointer-events:none}.ant-tooltip-arrow::before{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:5px;height:5px;margin:auto;background-color:rgba(0,0,0,0.75);content:'';pointer-events:auto}.ant-tooltip-placement-top .ant-tooltip-arrow,.ant-tooltip-placement-topLeft .ant-tooltip-arrow,.ant-tooltip-placement-topRight .ant-tooltip-arrow{bottom:-5.07106781px}.ant-tooltip-placement-top .ant-tooltip-arrow::before,.ant-tooltip-placement-topLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-topRight .ant-tooltip-arrow::before{-webkit-box-shadow:3px 3px 7px rgba(0,0,0,0.07);box-shadow:3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(-6.53553px) rotate(45deg);transform:translateY(-6.53553px) rotate(45deg)}.ant-tooltip-placement-top .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-topLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-topRight .ant-tooltip-arrow{right:13px}.ant-tooltip-placement-right .ant-tooltip-arrow,.ant-tooltip-placement-rightTop .ant-tooltip-arrow,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{left:-5.07106781px}.ant-tooltip-placement-right .ant-tooltip-arrow::before,.ant-tooltip-placement-rightTop .ant-tooltip-arrow::before,.ant-tooltip-placement-rightBottom .ant-tooltip-arrow::before{-webkit-box-shadow:-3px 3px 7px rgba(0,0,0,0.07);box-shadow:-3px 3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(6.53553px) rotate(45deg);transform:translateX(6.53553px) rotate(45deg)}.ant-tooltip-placement-right .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-rightTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-rightBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-left .ant-tooltip-arrow,.ant-tooltip-placement-leftTop .ant-tooltip-arrow,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{right:-5.07106781px}.ant-tooltip-placement-left .ant-tooltip-arrow::before,.ant-tooltip-placement-leftTop .ant-tooltip-arrow::before,.ant-tooltip-placement-leftBottom .ant-tooltip-arrow::before{-webkit-box-shadow:3px -3px 7px rgba(0,0,0,0.07);box-shadow:3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateX(-6.53553px) rotate(45deg);transform:translateX(-6.53553px) rotate(45deg)}.ant-tooltip-placement-left .ant-tooltip-arrow{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.ant-tooltip-placement-leftTop .ant-tooltip-arrow{top:5px}.ant-tooltip-placement-leftBottom .ant-tooltip-arrow{bottom:5px}.ant-tooltip-placement-bottom .ant-tooltip-arrow,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{top:-5.07106781px}.ant-tooltip-placement-bottom .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow::before,.ant-tooltip-placement-bottomRight .ant-tooltip-arrow::before{-webkit-box-shadow:-3px -3px 7px rgba(0,0,0,0.07);box-shadow:-3px -3px 7px rgba(0,0,0,0.07);-webkit-transform:translateY(6.53553px) rotate(45deg);transform:translateY(6.53553px) rotate(45deg)}.ant-tooltip-placement-bottom .ant-tooltip-arrow{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ant-tooltip-placement-bottomLeft .ant-tooltip-arrow{left:13px}.ant-tooltip-placement-bottomRight .ant-tooltip-arrow{right:13px}.ant-tooltip-rtl{direction:rtl}.ant-tooltip-rtl .ant-tooltip-inner{text-align:right}
|
3 |
-
.ant-select-single .ant-select-selector{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-single .ant-select-selector .ant-select-selection-search{position:absolute;top:0;right:11px;bottom:0;left:11px}.ant-select-single .ant-select-selector .ant-select-selection-search-input{width:100%}.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{padding:0;line-height:30px;-webkit-transition:all 0.3s;transition:all 0.3s}@supports (-moz-appearance: meterbar){.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-single .ant-select-selector .ant-select-selection-placeholder{line-height:30px}}.ant-select-single .ant-select-selector .ant-select-selection-item{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-single .ant-select-selector .ant-select-selection-placeholder{pointer-events:none}.ant-select-single .ant-select-selector::after,.ant-select-single .ant-select-selector .ant-select-selection-item::after,.ant-select-single .ant-select-selector .ant-select-selection-placeholder::after{display:inline-block;width:0;visibility:hidden;content:'\a0'}.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:25px}.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:18px}.ant-select-single.ant-select-open .ant-select-selection-item{opacity:0.4}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);width:100%;height:32px;padding:0 11px}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector input{cursor:not-allowed}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{height:30px}.ant-select-single.ant-select-customize-input .ant-select-selector::after{display:none}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-search{position:static;width:100%}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder{position:absolute;right:0;left:0;padding:0 11px}.ant-select-single.ant-select-customize-input .ant-select-selector .ant-select-selection-placeholder::after{display:none}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{height:40px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:38px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:38px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{height:24px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder{line-height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input{height:22px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selection-search{right:7px;left:7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input) .ant-select-selector{padding:0 7px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:28px}.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:21px}.ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-multiple .ant-select-selector{position:relative;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;-webkit-transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1px 4px}.ant-select-multiple .ant-select-selector input{cursor:pointer}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-show-search.ant-select-multiple .ant-select-selector input{cursor:auto}.ant-select-focused.ant-select-multiple .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important;outline:0;-webkit-box-shadow:0 0 0 2px rgba(24,144,255,0.2);box-shadow:0 0 0 2px rgba(24,144,255,0.2)}.ant-select-disabled.ant-select-multiple .ant-select-selector{color:rgba(0,0,0,0.25);background:#f5f5f5;cursor:not-allowed}.ant-select-disabled.ant-select-multiple .ant-select-selector input{cursor:not-allowed}.ant-select-multiple .ant-select-selector .ant-select-selection-search-input{background:transparent;border:none;outline:none}.ant-select-show-search.ant-select-multiple .ant-select-selector{cursor:text}.ant-select-multiple .ant-select-selector::after{display:inline-block;width:0;margin:2px 0;line-height:24px;content:'\a0'}.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:24px}.ant-select-multiple .ant-select-selection-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:24px;margin-top:2px;margin-right:4px;margin-bottom:2px;padding:0 4px 0 8px;line-height:22px;background:#f5f5f5;border:1px solid #f0f0f0;border-radius:2px;cursor:default;-webkit-transition:font-size 0.3s, line-height 0.3s, height 0.3s;transition:font-size 0.3s, line-height 0.3s, height 0.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-select-multiple .ant-select-selection-item-content{display:inline-block;margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-multiple .ant-select-selection-item-remove{color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:rgba(0,0,0,0.45);font-weight:bold;font-size:12px;line-height:inherit;cursor:pointer;display:inline-block;font-size:10px}.ant-select-multiple .ant-select-selection-item-remove>*{line-height:1}.ant-select-multiple .ant-select-selection-item-remove svg{display:inline-block}.ant-select-multiple .ant-select-selection-item-remove::before{display:none}.ant-select-multiple .ant-select-selection-item-remove .ant-select-multiple .ant-select-selection-item-remove-icon{display:block}.ant-select-multiple .ant-select-selection-item-remove>.anticon{vertical-align:-0.2em}.ant-select-multiple .ant-select-selection-item-remove:hover{color:rgba(0,0,0,0.75)}.ant-select-multiple .ant-select-selection-search{position:relative;margin-left:0.5px}.ant-select-multiple .ant-select-selection-search-input,.ant-select-multiple .ant-select-selection-search-mirror{font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';line-height:1.5715;-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple .ant-select-selection-search-input{width:100%;min-width:3px}.ant-select-multiple .ant-select-selection-search-mirror{position:absolute;top:0;left:0;z-index:999;white-space:nowrap;visibility:hidden}.ant-select-multiple .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:6.5px}.ant-select-multiple .ant-select-selection-placeholder{position:absolute;top:50%;right:11px;left:11px;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:all 0.3s;transition:all 0.3s}.ant-select-multiple.ant-select-lg .ant-select-selector::after{line-height:32px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:30px}.ant-select-multiple.ant-select-lg .ant-select-selection-search{height:33px;line-height:33px}.ant-select-multiple.ant-select-lg .ant-select-selection-search-input,.ant-select-multiple.ant-select-lg .ant-select-selection-search-mirror{height:32px;line-height:30px}.ant-select-multiple.ant-select-sm .ant-select-selector::after{line-height:16px}.ant-select-multiple.ant-select-sm .ant-select-selection-item{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-search{height:17px;line-height:17px}.ant-select-multiple.ant-select-sm .ant-select-selection-search-input,.ant-select-multiple.ant-select-sm .ant-select-selection-search-mirror{height:16px;line-height:14px}.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{left:7px}.ant-select-multiple.ant-select-sm .ant-select-selection-search:first-child .ant-select-selection-search-input{margin-left:3px}.ant-select-multiple.ant-select-lg .ant-select-selection-item{height:32px;line-height:32px}.ant-select-disabled .ant-select-selection-item-remove{display:none}.ant-select{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,0.65);font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:relative;display:inline-block;cursor:pointer}.ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:#40a9ff;border-right-width:1px !important}.ant-select-selection-item{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media all and (-ms-high-contrast: none){.ant-select-selection-item *::-ms-backdrop,.ant-select-selection-item{-ms-flex:auto;flex:auto}}.ant-select-selection-placeholder{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0.4}@media all and (-ms-high-contrast: none){.ant-select-selection-placeholder *::-ms-backdrop,.ant-select-selection-placeholder{-ms-flex:auto;flex:auto}}.ant-select-arrow{display:inline-block;color:inherit;font-style:normal;line-height:0;text-transform:none;vertical-align:-0.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:53%;right:11px;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;line-height:1;text-align:center;pointer-events:none}.ant-select-arrow>*{line-height:1}.ant-select-arrow svg{display:inline-block}.ant-select-arrow::before{display:none}.ant-select-arrow .ant-select-arrow-icon{display:block}.ant-select-arrow .anticon{vertical-align:top;-webkit-transition:-webkit-transform 0.3s;transition:-webkit-transform 0.3s;transition:transform 0.3s;transition:transform 0.3s, -webkit-transform 0.3s}.ant-select-arrow .anticon>svg{vertical-align:top}.ant-select-arrow .anticon:not(.anticon-down){pointer-events:auto}.ant-select-clear{position:absolute;top:50%;right:11px;z-index:1;display:inline-block;width:12px;height:12px;margin-top:-6px;color:rgba(0,0,0,0.25);font-size:12px;font-style:normal;line-height:1;text-align:center;text-transform:none;background:#fff;cursor:pointer;opacity:0;-webkit-transition:color 0.3s ease, opacity 0.15s ease;transition:color 0.3s ease, opacity 0.15s ease;text-rendering:auto}.ant-select-clear::before{display:block}.ant-select-clear:hover{color:rgba(0,0,0,0.45)}.ant-select:hover .ant-select-clear{opacity:1}.ant-select-dropdown{margin:0;padding:0;color:rgba(0,0,0,0.65);font-variant:tabular-nums;line-height:1.5715;list-style:none;-webkit-font-feature-settings:'tnum';font-feature-settings:'tnum';position:absolute;top:-9999px;left:-9999px;z-index:1050;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 0;overflow:hidden;font-size:14px;font-variant:initial;background-color:#fff;border-radius:2px;outline:none;-webkit-box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05);box-shadow:0 3px 6px -4px rgba(0,0,0,0.12),0 6px 16px 0 rgba(0,0,0,0.08),0 9px 28px 8px rgba(0,0,0,0.05)}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-bottomLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn}.ant-select-dropdown.slide-up-enter.slide-up-enter-active.ant-select-dropdown-placement-topLeft,.ant-select-dropdown.slide-up-appear.slide-up-appear-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-bottomLeft{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut}.ant-select-dropdown.slide-up-leave.slide-up-leave-active.ant-select-dropdown-placement-topLeft{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut}.ant-select-dropdown-hidden{display:none}.ant-select-item-empty{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px}.ant-select-item{position:relative;display:block;min-height:32px;padding:5px 12px;color:rgba(0,0,0,0.65);font-weight:normal;font-size:14px;line-height:22px;cursor:pointer;-webkit-transition:background 0.3s ease;transition:background 0.3s ease}.ant-select-item-group{color:rgba(0,0,0,0.45);font-size:12px;cursor:default}.ant-select-item-option{display:-webkit-box;display:-ms-flexbox;display:flex}.ant-select-item-option-content{-webkit-box-flex:1;-ms-flex:auto;flex:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ant-select-item-option-state{-webkit-box-flex:0;-ms-flex:none;flex:none}.ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:#f5f5f5}.ant-select-item-option-selected:not(.ant-select-item-option-disabled){color:rgba(0,0,0,0.65);font-weight:600;background-color:#e6f7ff}.ant-select-item-option-selected:not(.ant-select-item-option-disabled) .ant-select-item-option-state{color:#1890ff}.ant-select-item-option-disabled{color:rgba(0,0,0,0.25);cursor:not-allowed}.ant-select-item-option-grouped{padding-left:24px}.ant-select-lg{font-size:16px}.ant-select-borderless .ant-select-selector{background-color:transparent !important;border-color:transparent !important;-webkit-box-shadow:none !important;box-shadow:none !important}.ant-select-rtl{direction:rtl}.ant-select-rtl .ant-select-arrow{right:initial;left:11px}.ant-select-rtl .ant-select-clear{right:initial;left:11px}.ant-select-dropdown-rtl{direction:rtl}.ant-select-dropdown-rtl .ant-select-item-option-grouped{padding-right:24px;padding-left:12px}.ant-select-rtl.ant-select-multiple.ant-select-allow-clear .ant-select-selector{padding-right:4px;padding-left:24px}.ant-select-rtl.ant-select-multiple .ant-select-selection-item{margin-right:0;margin-left:4px;padding:0 8px 0 4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-item-content{margin-right:0;margin-left:4px;text-align:right}.ant-select-rtl.ant-select-multiple .ant-select-selection-search{margin-right:0.5px;margin-left:4px}.ant-select-rtl.ant-select-multiple .ant-select-selection-search-mirror{right:0;left:auto}.ant-select-rtl.ant-select-multiple .ant-select-selection-placeholder{right:11px;left:auto}.ant-select-rtl.ant-select-multiple.ant-select-sm .ant-select-selection-placeholder{right:7px}.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-item,.ant-select-rtl.ant-select-single .ant-select-selector .ant-select-selection-placeholder{right:0;left:9px;text-align:right}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-search{right:11px;left:25px}.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:18px}.ant-select-rtl.ant-select-single:not(.ant-select-customize-input) .ant-select-selector{padding:0 11px}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-search{right:0}.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-item,.ant-select-rtl.ant-select-single.ant-select-sm:not(.ant-select-customize-input).ant-select-show-arrow .ant-select-selection-placeholder{padding-right:0;padding-left:21px}
|
|
|
|
|
|
trunk/dist/css/reportsOrders/styles.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.fade-enter,.fade-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.fade-enter.fade-enter-active,.fade-appear.fade-appear-active{-webkit-animation-name:antFadeIn;animation-name:antFadeIn;-webkit-animation-play-state:running;animation-play-state:running}.fade-leave.fade-leave-active{-webkit-animation-name:antFadeOut;animation-name:antFadeOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.fade-enter,.fade-appear{opacity:0;-webkit-animation-timing-function:linear;animation-timing-function:linear}.fade-leave{-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes antFadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes antFadeOut{0%{opacity:1}100%{opacity:0}}.move-up-enter,.move-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-up-enter.move-up-enter-active,.move-up-appear.move-up-appear-active{-webkit-animation-name:antMoveUpIn;animation-name:antMoveUpIn;-webkit-animation-play-state:running;animation-play-state:running}.move-up-leave.move-up-leave-active{-webkit-animation-name:antMoveUpOut;animation-name:antMoveUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-up-enter,.move-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-up-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-down-enter,.move-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-down-enter.move-down-enter-active,.move-down-appear.move-down-appear-active{-webkit-animation-name:antMoveDownIn;animation-name:antMoveDownIn;-webkit-animation-play-state:running;animation-play-state:running}.move-down-leave.move-down-leave-active{-webkit-animation-name:antMoveDownOut;animation-name:antMoveDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-down-enter,.move-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-down-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-left-enter,.move-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-left-enter.move-left-enter-active,.move-left-appear.move-left-appear-active{-webkit-animation-name:antMoveLeftIn;animation-name:antMoveLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.move-left-leave.move-left-leave-active{-webkit-animation-name:antMoveLeftOut;animation-name:antMoveLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-left-enter,.move-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-left-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}.move-right-enter,.move-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.move-right-enter.move-right-enter-active,.move-right-appear.move-right-appear-active{-webkit-animation-name:antMoveRightIn;animation-name:antMoveRightIn;-webkit-animation-play-state:running;animation-play-state:running}.move-right-leave.move-right-leave-active{-webkit-animation-name:antMoveRightOut;animation-name:antMoveRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.move-right-enter,.move-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.move-right-leave{-webkit-animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34);animation-timing-function:cubic-bezier(0.6, 0.04, 0.98, 0.34)}@-webkit-keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveDownIn{0%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveDownOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(100%);transform:translateY(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveLeftIn{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveLeftOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveRightIn{0%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveRightOut{0%{-webkit-transform:translateX(0%);transform:translateX(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@keyframes antMoveUpIn{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}100%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}}@-webkit-keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@keyframes antMoveUpOut{0%{-webkit-transform:translateY(0%);transform:translateY(0%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:1}100%{-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transform-origin:0 0;transform-origin:0 0;opacity:0}}@-webkit-keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loadingCircle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}[ant-click-animating='true'],[ant-click-animating-without-extra-node='true']{position:relative}html{--antd-wave-shadow-color: #1890ff;--scroll-bar: 0}[ant-click-animating-without-extra-node='true']::after,.ant-click-animating-node{position:absolute;top:0;right:0;bottom:0;left:0;display:block;border-radius:inherit;box-shadow:0 0 0 0 #1890ff;box-shadow:0 0 0 0 var(--antd-wave-shadow-color);opacity:0.2;-webkit-animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);animation:fadeEffect 2s cubic-bezier(0.08, 0.82, 0.17, 1),waveEffect 0.4s cubic-bezier(0.08, 0.82, 0.17, 1);-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;content:'';pointer-events:none}@-webkit-keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@keyframes waveEffect{100%{box-shadow:0 0 0 #1890ff;box-shadow:0 0 0 6px var(--antd-wave-shadow-color)}}@-webkit-keyframes fadeEffect{100%{opacity:0}}@keyframes fadeEffect{100%{opacity:0}}.slide-up-enter,.slide-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-up-enter.slide-up-enter-active,.slide-up-appear.slide-up-appear-active{-webkit-animation-name:antSlideUpIn;animation-name:antSlideUpIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-up-leave.slide-up-leave-active{-webkit-animation-name:antSlideUpOut;animation-name:antSlideUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-up-enter,.slide-up-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-up-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-down-enter,.slide-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-down-enter.slide-down-enter-active,.slide-down-appear.slide-down-appear-active{-webkit-animation-name:antSlideDownIn;animation-name:antSlideDownIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-down-leave.slide-down-leave-active{-webkit-animation-name:antSlideDownOut;animation-name:antSlideDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-down-enter,.slide-down-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-down-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-left-enter,.slide-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-left-enter.slide-left-enter-active,.slide-left-appear.slide-left-appear-active{-webkit-animation-name:antSlideLeftIn;animation-name:antSlideLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-left-leave.slide-left-leave-active{-webkit-animation-name:antSlideLeftOut;animation-name:antSlideLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-left-enter,.slide-left-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-left-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}.slide-right-enter,.slide-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.slide-right-enter.slide-right-enter-active,.slide-right-appear.slide-right-appear-active{-webkit-animation-name:antSlideRightIn;animation-name:antSlideRightIn;-webkit-animation-play-state:running;animation-play-state:running}.slide-right-leave.slide-right-leave-active{-webkit-animation-name:antSlideRightOut;animation-name:antSlideRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.slide-right-enter,.slide-right-appear{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1);animation-timing-function:cubic-bezier(0.23, 1, 0.32, 1)}.slide-right-leave{-webkit-animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06)}@-webkit-keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideUpIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideUpOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@keyframes antSlideDownIn{0%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}100%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}}@-webkit-keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@keyframes antSlideDownOut{0%{-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:1}100%{-webkit-transform:scaleY(0.8);transform:scaleY(0.8);-webkit-transform-origin:100% 100%;transform-origin:100% 100%;opacity:0}}@-webkit-keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@keyframes antSlideLeftIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}}@-webkit-keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@keyframes antSlideLeftOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:0% 0%;transform-origin:0% 0%;opacity:0}}@-webkit-keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@keyframes antSlideRightIn{0%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}100%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}}@-webkit-keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}@keyframes antSlideRightOut{0%{-webkit-transform:scaleX(1);transform:scaleX(1);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:1}100%{-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transform-origin:100% 0%;transform-origin:100% 0%;opacity:0}}.zoom-enter,.zoom-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-enter.zoom-enter-active,.zoom-appear.zoom-appear-active{-webkit-animation-name:antZoomIn;animation-name:antZoomIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-leave.zoom-leave-active{-webkit-animation-name:antZoomOut;animation-name:antZoomOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-enter,.zoom-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-enter,.zoom-big-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-enter.zoom-big-enter-active,.zoom-big-appear.zoom-big-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-leave.zoom-big-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-enter,.zoom-big-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-leave{-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-big-fast-enter.zoom-big-fast-enter-active,.zoom-big-fast-appear.zoom-big-fast-appear-active{-webkit-animation-name:antZoomBigIn;animation-name:antZoomBigIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-big-fast-leave.zoom-big-fast-leave-active{-webkit-animation-name:antZoomBigOut;animation-name:antZoomBigOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-big-fast-enter,.zoom-big-fast-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-big-fast-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-up-enter,.zoom-up-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-up-enter.zoom-up-enter-active,.zoom-up-appear.zoom-up-appear-active{-webkit-animation-name:antZoomUpIn;animation-name:antZoomUpIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-up-leave.zoom-up-leave-active{-webkit-animation-name:antZoomUpOut;animation-name:antZoomUpOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-up-enter,.zoom-up-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-up-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-down-enter,.zoom-down-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-down-enter.zoom-down-enter-active,.zoom-down-appear.zoom-down-appear-active{-webkit-animation-name:antZoomDownIn;animation-name:antZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-down-leave.zoom-down-leave-active{-webkit-animation-name:antZoomDownOut;animation-name:antZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-down-enter,.zoom-down-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-left-enter,.zoom-left-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-left-enter.zoom-left-enter-active,.zoom-left-appear.zoom-left-appear-active{-webkit-animation-name:antZoomLeftIn;animation-name:antZoomLeftIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-left-leave.zoom-left-leave-active{-webkit-animation-name:antZoomLeftOut;animation-name:antZoomLeftOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-left-enter,.zoom-left-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-left-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}.zoom-right-enter,.zoom-right-appear{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-leave{-webkit-animation-duration:0.2s;animation-duration:0.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-play-state:paused;animation-play-state:paused}.zoom-right-enter.zoom-right-enter-active,.zoom-right-appear.zoom-right-appear-active{-webkit-animation-name:antZoomRightIn;animation-name:antZoomRightIn;-webkit-animation-play-state:running;animation-play-state:running}.zoom-right-leave.zoom-right-leave-active{-webkit-animation-name:antZoomRightOut;animation-name:antZoomRightOut;-webkit-animation-play-state:running;animation-play-state:running;pointer-events:none}.zoom-right-enter,.zoom-right-appear{-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1);animation-timing-function:cubic-bezier(0.08, 0.82, 0.17, 1)}.zoom-right-leave{-webkit-animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86);animation-timing-function:cubic-bezier(0.78, 0.14, 0.15, 0.86)}@-webkit-keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomIn{0%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@keyframes antZoomOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.2);transform:scale(0.2);opacity:0}}@-webkit-keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes antZoomBigIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@keyframes antZoomBigOut{0%{-webkit-transform:scale(1);transform:scale(1)}100%{-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0}}@-webkit-keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@keyframes antZoomUpIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}}@-webkit-keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@keyframes antZoomUpOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 0%;transform-origin:50% 0%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 0%;transform-origin:50% 0%;opacity:0}}@-webkit-keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@keyframes antZoomLeftIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}}@-webkit-keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@keyframes antZoomLeftOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:0% 50%;transform-origin:0% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:0% 50%;transform-origin:0% 50%;opacity:0}}@-webkit-keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@keyframes antZoomRightIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}}@-webkit-keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@keyframes antZoomRightOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:100% 50%;transform-origin:100% 50%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:100% 50%;transform-origin:100% 50%;opacity:0}}@-webkit-keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@keyframes antZoomDownIn{0%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}}@-webkit-keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}@keyframes antZoomDownOut{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 100%;transform-origin:50% 100%}100%{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;opacity:0}}.ant-motion-collapse-legacy{overflow:hidden}.ant-motion-collapse-legacy-active{transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}.ant-motion-collapse{overflow:hidden;transition:height 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1) !important}
|
|
trunk/dist/js/multicurrencyAnalytics/app.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=6)}([function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default=function(t,r){var e=r.currency;return e&&wcmlAnalytics.currencyConfigs[e]?wcmlAnalytics.currencyConfigs[e]:t}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default=function(t){return t.push("currency"),t}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}Object.defineProperty(r,"__esModule",{value:!0});r.default=function(t){if(!["revenue","products","orders","categories","coupons","taxes"].includes(t.endpoint))return t;var r=[].concat(n(t.headers),[{label:wcmlAnalytics.strings.currencyLabel,key:"currency"}]),e=t.rows.map(function(r,e){var o=t.items.data[e],i="revenue"===t.endpoint?o.subtotals.currency:o.currency;return[].concat(n(r),[{display:i,value:i}])});return t.headers=r,t.rows=e,t}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}Object.defineProperty(r,"__esModule",{value:!0});var o=new Set(["woocommerce_admin_dashboard_filters","woocommerce_admin_products_report_filters","woocommerce_admin_revenue_report_filters","woocommerce_admin_orders_report_filters","woocommerce_admin_variations_report_filters","woocommerce_admin_categories_report_filters","woocommerce_admin_coupons_report_filters","woocommerce_admin_taxes_report_filters"]);r.default=function(t){return[].concat(n(t),[{label:wcmlAnalytics.strings.currencyLabel,staticParams:[],param:"currency",showFilters:function(){return!0},defaultValue:wcSettings.currency.code||"USD",filters:[].concat(n(wcmlAnalytics.filterItems||[])),settings:[]}])},r.currencyFilters=o},function(t,r,e){"use strict";var n=e(3),o=u(n),i=u(e(2)),a=u(e(1)),c=u(e(0));function u(t){return t&&t.__esModule?t:{default:t}}document.addEventListener("DOMContentLoaded",function(){var t=wp.hooks.addFilter;n.currencyFilters.forEach(function(r){t(r,"wcml/analytics/add-currency-filter",o.default)}),t("woocommerce_admin_report_table","wcml/analytics/add-table-column",i.default),t("woocommerce_admin_persisted_queries","wcml/analytics/persist-currency",a.default),t("woocommerce_admin_report_currency","wcml/analytics/update-report-currencies",c.default)})},function(t,r,e){var n=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return k()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===d)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=s(t,r,e);if("normal"===u.type){if(n=e.done?p:f,u.arg===d)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",h="executing",p="completed",d={};function y(){}function m(){}function v(){}var g={};g[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(P([])));_&&_!==e&&n.call(_,i)&&(g=_);var b=v.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function L(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(f).then(function(t){l.value=t,a(l)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function E(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:k}}function k(){return{value:r,done:!0}}return m.prototype=b.constructor=v,v.constructor=m,v[c]=m.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(L.prototype),L.prototype[a]=function(){return this},t.AsyncIterator=L,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new L(u(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(b),b[c]="Generator",b[i]=function(){return this},b.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=P,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,r,e){e(5),e(11),t.exports=e(4)},,,,,function(t,r){}]);
|
|
trunk/dist/js/multicurrencyOptions/app.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=257)}([function(e,t,n){"use strict";e.exports=n(255)},function(e,t,n){var r;
|
2 |
-
/*!
|
3 |
-
Copyright (c) 2017 Jed Watson.
|
4 |
-
Licensed under the MIT License (MIT), see
|
5 |
-
http://jedwatson.github.io/classnames
|
6 |
-
*/
|
7 |
-
/*!
|
8 |
-
Copyright (c) 2017 Jed Watson.
|
9 |
-
Licensed under the MIT License (MIT), see
|
10 |
-
http://jedwatson.github.io/classnames
|
11 |
-
*/
|
12 |
-
!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===i)for(var u in r)n.call(r,u)&&r[u]&&e.push(u)}}return e.join(" ")}void 0!==e&&e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){"use strict";n.d(t,"b",function(){return u});var r={};function o(e,t){0}function i(e,t){0}function a(e,t,n){t||r[n]||(e(!1,n),r[n]=!0)}function u(e,t){a(i,e,t)}t.a=function(e,t){a(o,e,t)}},function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(254)},function(e,t,n){"use strict";var r={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=r.F1&&t<=r.F12)return!1;switch(t){case r.ALT:case r.CAPS_LOCK:case r.CONTEXT_MENU:case r.CTRL:case r.DOWN:case r.END:case r.ESC:case r.HOME:case r.INSERT:case r.LEFT:case r.MAC_FF_META:case r.META:case r.NUMLOCK:case r.NUM_CENTER:case r.PAGE_DOWN:case r.PAGE_UP:case r.PAUSE:case r.PRINT_SCREEN:case r.RIGHT:case r.SHIFT:case r.UP:case r.WIN_KEY:case r.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=r.ZERO&&e<=r.NINE)return!0;if(e>=r.NUM_ZERO&&e<=r.NUM_MULTIPLY)return!0;if(e>=r.A&&e<=r.Z)return!0;if(-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case r.SPACE:case r.QUESTION_MARK:case r.NUM_PLUS:case r.NUM_MINUS:case r.NUM_PERIOD:case r.NUM_DIVISION:case r.SEMICOLON:case r.DASH:case r.EQUALS:case r.COMMA:case r.PERIOD:case r.SLASH:case r.APOSTROPHE:case r.SINGLE_QUOTE:case r.OPEN_SQUARE_BRACKET:case r.BACKSLASH:case r.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};t.a=r},function(e,t,n){e.exports=n(244)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ConfigConsumer",{enumerable:!0,get:function(){return u.ConfigConsumer}}),Object.defineProperty(t,"ConfigContext",{enumerable:!0,get:function(){return u.ConfigContext}}),t.default=t.configConsumerProps=void 0;var r=s(n(0)),o=n(114),i=s(n(238)),a=function(e){return e&&e.__esModule?e:{default:e}}(n(42)),u=n(233),l=n(35);function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function s(e){if(e&&e.__esModule)return e;if(null===e||"object"!==f(e)&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}return n.default=e,t&&t.set(e,n),n}function f(e){"@babel/helpers - typeof";return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=m(e);if(t){var o=m(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}t.configConsumerProps=["getTargetContainer","getPopupContainer","rootPrefixCls","getPrefixCls","renderEmpty","csp","autoInsertSpaceInButton","locale","pageHeader"];var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(n,r.Component);var t=h(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.apply(this,arguments)).getPrefixClsWrapper=function(t){return function(n,r){var o=e.props.prefixCls;if(r)return r;var i=o||t.getPrefixCls("");return n?"".concat(i,"-").concat(n):i}},e.renderProvider=function(t,n){var a=e.props,c=a.children,s=a.getTargetContainer,f=a.getPopupContainer,d=a.renderEmpty,y=a.csp,h=a.autoInsertSpaceInButton,m=a.form,v=a.input,b=a.locale,g=a.pageHeader,w=a.componentSize,O=a.direction,E=a.space,S=p(p({},t),{getPrefixCls:e.getPrefixClsWrapper(t),csp:y,autoInsertSpaceInButton:h,locale:b||n,direction:O,space:E});s&&(S.getTargetContainer=s),f&&(S.getPopupContainer=f),d&&(S.renderEmpty=d),g&&(S.pageHeader=g),v&&(S.input=v);var _=c,P={};return b&&b.Form&&b.Form.defaultValidateMessages&&(P=b.Form.defaultValidateMessages),m&&m.validateMessages&&(P=p(p({},P),m.validateMessages)),Object.keys(P).length>0&&(_=r.createElement(o.FormProvider,{validateMessages:P},c)),r.createElement(l.SizeContextProvider,{size:w},r.createElement(u.ConfigContext.Provider,{value:S},r.createElement(i.default,{locale:b||n,_ANT_MARK__:i.ANT_MARK},_)))},e}return function(e,t,n){t&&d(e.prototype,t),n&&d(e,n)}(n,[{key:"render",value:function(){var e=this;return r.createElement(a.default,null,function(t,n,o){return r.createElement(u.ConfigConsumer,null,function(t){return e.renderProvider(t,o)})})}}]),n}();t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useStore=t.getStore=t.getStoreAction=t.getStoreProperty=t.getCurrencyIndex=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(78),i=n(36),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(28));t.default=function(e){var t=e.activeCurrencies,n=e.allCurrencies,a=e.allCountries,l=e.languages,c=e.gateways,s=e.mode,f=e.maxMindKeyExist;return(0,o.createStore)({activeCurrencies:t,allCurrencies:n,allCountries:a,languages:l,gateways:c,mode:s,maxMindKeyExist:f,modalCurrency:null,updating:!1,setDefaultCurrencyForLang:(0,o.action)(function(e,t){var n=e.languages.findIndex(function(e){return e.code===t.language}),r=e.languages[n];r.defaultCurrency=t.currency,e.languages[n]=r}),getCurrencyIndex:(0,o.action)(function(e,t){e.activeCurrencies.findIndex(function(e){return e.code===t})}),enableCurrencyForLang:(0,o.action)(function(e,t){var n=u(e.activeCurrencies)(t.currency),o=e.activeCurrencies[n],i=t.enable?1:0;o.languages=r({},o.languages,function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},t.language,i)),e.activeCurrencies[n]=o}),deleteCurrency:(0,o.action)(function(e,t){var n=u(e.activeCurrencies)(t),o=r({},e.activeCurrencies[n]);e.activeCurrencies.splice(n,1),(0,i.triggerActiveCurrenciesChange)({action:"remove",currency:o})}),setModalCurrency:(0,o.action)(function(e,t){e.modalCurrency=e.setInitialGatewayCurrency(t,e.activeCurrencies)}),setInitialGatewayCurrency:function(e,t){var n=function(n){return void 0===n.currency||function(e){return t.find(function(t){return t.code===e})}(n.currency)||(n=r({},n,{currency:e.code})),n};return e&&e.gatewaysSettings&&Object.keys(e.gatewaysSettings).map(function(t){e.gatewaysSettings[t]=n(e.gatewaysSettings[t])}),e},saveModalCurrency:(0,o.action)(function(e){var t=u(e.activeCurrencies)(e.modalCurrency.code);if(t<0){var n=r({},e.modalCurrency,{isNew:!1});e.activeCurrencies.push(n),(0,i.triggerActiveCurrenciesChange)({action:"add",currency:n})}else e.activeCurrencies[t]=e.modalCurrency}),newCurrencies:(0,o.computed)(function(e){var t=e.activeCurrencies.map(function(e){return e.code});return e.allCurrencies.filter(function(e){return!t.includes(e.code)})}),defaultCurrency:(0,o.computed)(function(e){return e.activeCurrencies.filter(function(e){return e.isDefault})[0]}),setUpdating:(0,o.action)(function(e,t){e.updating=t}),setMode:(0,o.action)(function(e,t){e.mode=t,(0,i.triggerModeChange)({mode:t})}),setMaxMindKeyExist:(0,o.action)(function(e){e.maxMindKeyExist=!0})})};var u=t.getCurrencyIndex=function(e){return function(t){return a.findIndex(a.propEq("code",t))(e)}},l=t.getStoreProperty=function(e){return(0,o.useStoreState)(a.path(Array.isArray(e)?e:[e]))},c=t.getStoreAction=function(e){return(0,o.useStoreActions)(a.prop(e))};t.getStore=function(e,t){return[l(e),c(t)]},t.useStore=function(e){return[l(e),c("set"+(0,i.capitalize)(e)),c("reset"+(0,i.capitalize)(e))]}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(218));t.default=r.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){(function(t){for(var r=n(242),o="undefined"==typeof window?t:window,i=["moz","webkit"],a="AnimationFrame",u=o["request"+a],l=o["cancel"+a]||o["cancelRequest"+a],c=0;!u&&c<i.length;c++)u=o[i[c]+"Request"+a],l=o[i[c]+"Cancel"+a]||o[i[c]+"CancelRequest"+a];if(!u||!l){var s=0,f=0,p=[];u=function(e){if(0===p.length){var t=r(),n=Math.max(0,1e3/60-(t-s));s=n+t,setTimeout(function(){var e=p.slice(0);p.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(s)}catch(e){setTimeout(function(){throw e},0)}},Math.round(n))}return p.push({handle:++f,callback:e,cancelled:!1}),f},l=function(e){for(var t=0;t<p.length;t++)p[t].handle===e&&(p[t].cancelled=!0)}}e.exports=function(e){return u.call(o,e)},e.exports.cancel=function(){l.apply(o,arguments)},e.exports.polyfill=function(e){e||(e=o),e.requestAnimationFrame=u,e.cancelAnimationFrame=l}}).call(this,n(45))},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}n.default=e,t&&t.set(e,n);return n}(n(0)),i=c(n(1)),a=c(n(88)),u=n(174),l=n(56);function c(e){return e&&e.__esModule?e:{default:e}}function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(0,u.setTwoToneColor)("#1890ff");var y=o.forwardRef(function(e,t){var n=e.className,r=e.icon,u=e.spin,c=e.rotate,s=e.tabIndex,p=e.onClick,y=e.twoToneColor,h=d(e,["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"]),m=(0,i.default)("anticon",function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},"anticon-".concat(r.name),Boolean(r.name)),n),v=(0,i.default)({"anticon-spin":!!u||"loading"===r.name}),b=s;void 0===b&&p&&(b=-1);var g=c?{msTransform:"rotate(".concat(c,"deg)"),transform:"rotate(".concat(c,"deg)")}:void 0,w=f((0,l.normalizeTwoToneColors)(y),2),O=w[0],E=w[1];return o.createElement("span",Object.assign({role:"img","aria-label":r.name},h,{ref:t,tabIndex:b,onClick:p,className:m}),o.createElement(a.default,{className:v,icon:r,primaryColor:O,secondaryColor:E,style:g}))});y.displayName="AntdIcon",y.getTwoToneColor=u.getTwoToneColor,y.setTwoToneColor=u.setTwoToneColor;var h=y;t.default=h},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach(function(t){!function(e,t){"function"==typeof e?e(t):"object"===r(e)&&e&&"current"in e&&(e.current=t)}(t,e)})}}function i(e){return!(e.type&&e.type.prototype&&!e.type.prototype.render)&&!("function"==typeof e&&e.prototype&&!e.prototype.render)}n.d(t,"a",function(){return o}),n.d(t,"b",function(){return i})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Spinner=t.getTooltip=t.InputRow=t.SelectRow=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=a(n(0)),i=a(n(105));function a(e){return e&&e.__esModule?e:{default:e}}t.SelectRow=function(e){var t=e.onChange,n=e.label,i=e.attrs,a=e.tooltip,l=e.children,c=e.afterSelect,s=void 0===c?null:c;return o.default.createElement("div",{className:"wpml-form-row"},o.default.createElement("label",{htmlFor:i.id},n,u(a)),o.default.createElement("select",r({onChange:t},i),l),s)},t.InputRow=function(e){var t=e.onChange,n=e.label,i=e.attrs,a=e.tooltip;return o.default.createElement("div",{className:"wpml-form-row"},o.default.createElement("label",{htmlFor:i.id},n,u(a)),o.default.createElement("input",r({},i,{onChange:t})))};var u=t.getTooltip=function(e){return e&&o.default.createElement(i.default,{title:l(e)}," ",o.default.createElement("i",{className:"wcml-tip otgs-ico-help"}))},l=function(e){return o.default.createElement("div",{dangerouslySetInnerHTML:{__html:e}})};t.Spinner=function(e){var t=e.style,n=r({visibility:"visible"},t);return o.default.createElement("span",{className:"spinner",style:n})}},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(3),o=n.n(r);function i(e){return e instanceof HTMLElement?e:o.a.findDOMNode(e)}},function(e,t,n){"use strict";(function(e){var r;n.d(t,"a",function(){return $}),n.d(t,"b",function(){return q}),n.d(t,"c",function(){return u}),n.d(t,"d",function(){return c}),n.d(t,"e",function(){return B});var o="undefined"!=typeof Symbol?Symbol("immer-nothing"):((r={})["immer-nothing"]=!0,r),i="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-draftable"):"__$immer_draftable",a="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-state"):"__$immer_state";function u(e){return!!e&&!!e[a]}function l(e){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype||(!!e[i]||!!e.constructor[i])}function c(e){if(e&&e[a])return e[a].base}var s=Object.assign||function(e,t){for(var n in t)h(t,n)&&(e[n]=t[n]);return e},f="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function p(e,t){if(void 0===t&&(t=!1),Array.isArray(e))return e.slice();var n=Object.create(Object.getPrototypeOf(e));return f(e).forEach(function(r){if(r!==a){var o=Object.getOwnPropertyDescriptor(e,r),i=o.value;o.get&&t&&(i=o.get.call(e)),o.enumerable?n[r]=i:t&&Object.defineProperty(n,r,{value:i,writable:!0,configurable:!0})}}),n}function d(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t(n,e[n],e);else f(e).forEach(function(n){return t(n,e[n],e)})}function y(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.enumerable}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}var v=function(e){this.drafts=[],this.parent=e,this.canAutoFreeze=!0,this.patches=null};function b(e){e[a].revoke()}v.prototype.usePatches=function(e){e&&(this.patches=[],this.inversePatches=[],this.patchListener=e)},v.prototype.revoke=function(){this.leave(),this.drafts.forEach(b),this.drafts=null},v.prototype.leave=function(){this===v.current&&(v.current=this.parent)},v.current=null,v.enter=function(){return this.current=new v(this.current)};var g={};function w(e,t){var n=Array.isArray(e),r=x(e);d(r,function(t){!function(e,t,n){var r=g[t];r?r.enumerable=n:g[t]=r={configurable:!0,enumerable:n,get:function(){return function(e,t){j(e);var n=S(E(e),t);if(e.finalizing)return n;if(n===S(e.base,t)&&l(n))return P(e),e.copy[t]=w(n,e);return n}(this[a],t)},set:function(e){!function(e,t,n){if(j(e),e.assigned[t]=!0,!e.modified){if(m(n,S(E(e),t)))return;_(e),P(e)}e.copy[t]=n}(this[a],t,e)}};Object.defineProperty(e,t,r)}(r,t,n||y(e,t))});var o=t?t.scope:v.current;return function(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0})}(r,a,{scope:o,modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:t,base:e,draft:r,copy:null,revoke:O,revoked:!1}),o.drafts.push(r),r}function O(){this.revoked=!0}function E(e){return e.copy||e.base}function S(e,t){var n=e[a];if(n&&!n.finalizing){n.finalizing=!0;var r=e[t];return n.finalizing=!1,r}return e[t]}function _(e){e.modified||(e.modified=!0,e.parent&&_(e.parent))}function P(e){e.copy||(e.copy=x(e.base))}function x(e){var t=e&&e[a];if(t){t.finalizing=!0;var n=p(t.draft,!0);return t.finalizing=!1,n}return p(e)}function j(e){if(!0===e.revoked)throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(E(e)))}function C(e){for(var t=e.length-1;t>=0;t--){var n=e[t][a];n.modified||(Array.isArray(n.base)?T(n)&&_(n):k(n)&&_(n))}}function k(e){for(var t=e.base,n=e.draft,r=Object.keys(n),o=r.length-1;o>=0;o--){var i=r[o],u=t[i];if(void 0===u&&!h(t,i))return!0;var l=n[i],c=l&&l[a];if(c?c.base!==u:!m(l,u))return!0}return r.length!==Object.keys(t).length}function T(e){var t=e.draft;if(t.length!==e.base.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!n||n.get)}var M=Object.freeze({willFinalize:function(e,t,n){e.drafts.forEach(function(e){e[a].finalizing=!0}),n?u(t)&&t[a].scope===e&&C(e.drafts):(e.patches&&function e(t){if(t&&"object"==typeof t){var n=t[a];if(n){var r=n.base,o=n.draft,i=n.assigned;if(Array.isArray(t)){if(T(n)){if(_(n),i.length=!0,o.length<r.length)for(var u=o.length;u<r.length;u++)i[u]=!1;else for(var l=r.length;l<o.length;l++)i[l]=!0;for(var c=0;c<o.length;c++)void 0===i[c]&&e(o[c])}}else Object.keys(o).forEach(function(t){void 0!==r[t]||h(r,t)?i[t]||e(o[t]):(i[t]=!0,_(n))}),Object.keys(r).forEach(function(e){void 0!==o[e]||h(o,e)||(i[e]=!1,_(n))})}}}(e.drafts[0]),C(e.drafts))},createProxy:w});function A(e,t){var n=t?t.scope:v.current,r={scope:n,modified:!1,finalized:!1,assigned:{},parent:t,base:e,draft:null,drafts:{},copy:null,revoke:null},o=Array.isArray(e)?Proxy.revocable([r],R):Proxy.revocable(r,N),i=o.revoke,a=o.proxy;return r.draft=a,r.revoke=i,n.drafts.push(a),a}var N={get:function(e,t){if(t===a)return e;var n=e.drafts;if(!e.modified&&h(n,t))return n[t];var r=D(e)[t];if(e.finalized||!l(r))return r;if(e.modified){if(r!==I(e.base,t))return r;n=e.copy}return n[t]=A(r,e)},has:function(e,t){return t in D(e)},ownKeys:function(e){return Reflect.ownKeys(D(e))},set:function(e,t,n){if(!e.modified){var r=I(e.base,t),o=n?m(r,n)||n===e.drafts[t]:m(r,n)&&t in e.base;if(o)return!0;F(e)}return e.assigned[t]=!0,e.copy[t]=n,!0},deleteProperty:function(e,t){(void 0!==I(e.base,t)||t in e.base)&&(e.assigned[t]=!1,F(e));e.copy&&delete e.copy[t];return!0},getOwnPropertyDescriptor:function(e,t){var n=D(e),r=Reflect.getOwnPropertyDescriptor(n,t);r&&(r.writable=!0,r.configurable=!Array.isArray(n)||"length"!==t);return r},defineProperty:function(){throw new Error("Object.defineProperty() cannot be used on an Immer draft")},getPrototypeOf:function(e){return Object.getPrototypeOf(e.base)},setPrototypeOf:function(){throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft")}},R={};function D(e){return e.copy||e.base}function I(e,t){var n=e[a],r=Reflect.getOwnPropertyDescriptor(n?D(n):e,t);return r&&r.value}function F(e){e.modified||(e.modified=!0,e.copy=s(p(e.base),e.drafts),e.drafts=null,e.parent&&F(e.parent))}d(N,function(e,t){R[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),R.deleteProperty=function(e,t){if(isNaN(parseInt(t)))throw new Error("Immer only supports deleting array indices");return N.deleteProperty.call(this,e[0],t)},R.set=function(e,t,n){if("length"!==t&&isNaN(parseInt(t)))throw new Error("Immer only supports setting array indices and the 'length' property");return N.set.call(this,e[0],t,n)};var L=Object.freeze({willFinalize:function(){},createProxy:A});function z(e,t,n,r){Array.isArray(e.base)?function(e,t,n,r){var o,i,a=e.base,u=e.copy,l=e.assigned;u.length<a.length&&(a=(o=[u,a])[0],u=o[1],n=(i=[r,n])[0],r=i[1]);var c=u.length-a.length,s=0;for(;a[s]===u[s]&&s<a.length;)++s;var f=a.length;for(;f>s&&a[f-1]===u[f+c-1];)--f;for(var p=s;p<f;++p)if(l[p]&&u[p]!==a[p]){var d=t.concat([p]);n.push({op:"replace",path:d,value:u[p]}),r.push({op:"replace",path:d,value:a[p]})}for(var y=f!=a.length,h=n.length,m=f+c-1;m>=f;--m){var v=t.concat([m]);n[h+m-f]={op:"add",path:v,value:u[m]},y&&r.push({op:"remove",path:v})}y||r.push({op:"replace",path:t.concat(["length"]),value:a.length})}(e,t,n,r):function(e,t,n,r){var o=e.base,i=e.copy;d(e.assigned,function(e,a){var u=o[e],l=i[e],c=a?e in o?"replace":"add":"remove";if(u!==l||"replace"!==c){var s=t.concat(e);n.push("remove"===c?{op:c,path:s}:{op:c,path:s,value:l}),r.push("add"===c?{op:"remove",path:s}:"remove"===c?{op:"add",path:s,value:u}:{op:"replace",path:s,value:u})}})}(e,t,n,r)}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n],o=r.path;if(0===o.length&&"replace"===r.op)e=r.value;else{for(var i=e,a=0;a<o.length-1;a++)if(!(i=i[o[a]])||"object"!=typeof i)throw new Error("Cannot apply patch, path doesn't resolve: "+o.join("/"));var u=o[o.length-1];switch(r.op){case"replace":i[u]=r.value;break;case"add":Array.isArray(i)?i.splice(u,0,r.value):i[u]=r.value;break;case"remove":Array.isArray(i)?i.splice(u,1):delete i[u];break;default:throw new Error("Unsupported patch operation: "+r.op)}}}return e}var W={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:void 0===e&&"verifyMinified"===function(){}.name,onAssign:null,onDelete:null,onCopy:null},U=function(e){s(this,W,e),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)};U.prototype.produce=function(e,t,n){var r,i=this;if("function"==typeof e&&"function"!=typeof t){var a=t;t=e;var u=this;return function(e){var n=this;void 0===e&&(e=a);for(var r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return u.produce(e,function(e){return t.call.apply(t,[n,e].concat(r))})}}if("function"!=typeof t)throw new Error("The first or second argument to `produce` must be a function");if(void 0!==n&&"function"!=typeof n)throw new Error("The third argument to `produce` must be a function or undefined");if(l(e)){var c=v.enter(),s=this.createProxy(e),f=!0;try{r=t(s),f=!1}finally{f?c.revoke():c.leave()}return r instanceof Promise?r.then(function(e){return c.usePatches(n),i.processResult(e,c)},function(e){throw c.revoke(),e}):(c.usePatches(n),this.processResult(r,c))}return void 0===(r=t(e))?e:r!==o?r:void 0},U.prototype.createDraft=function(e){if(!l(e))throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var t=v.enter(),n=this.createProxy(e);return n[a].isManual=!0,t.leave(),n},U.prototype.finishDraft=function(e,t){var n=e&&e[a];if(!n||!n.isManual)throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(n.finalized)throw new Error("The given draft is already finalized");var r=n.scope;return r.usePatches(t),this.processResult(void 0,r)},U.prototype.setAutoFreeze=function(e){this.autoFreeze=e},U.prototype.setUseProxies=function(e){this.useProxies=e,s(this,e?L:M)},U.prototype.applyPatches=function(e,t){return u(e)?V(e,t):this.produce(e,function(e){return V(e,t)})},U.prototype.processResult=function(e,t){var n=t.drafts[0],r=void 0!==e&&e!==n;if(this.willFinalize(t,e,r),r){if(n[a].modified)throw t.revoke(),new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");l(e)&&(e=this.finalize(e,null,t)),t.patches&&(t.patches.push({op:"replace",path:[],value:e}),t.inversePatches.push({op:"replace",path:[],value:n[a].base}))}else e=this.finalize(n,[],t);return t.revoke(),t.patches&&t.patchListener(t.patches,t.inversePatches),e!==o?e:void 0},U.prototype.finalize=function(e,t,n){var r=this,o=e[a];if(!o)return Object.isFrozen(e)?e:this.finalizeTree(e,null,n);if(o.scope!==n)return e;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,t,n),this.onDelete)if(this.useProxies){var i=o.assigned;for(var u in i)i[u]||this.onDelete(o,u)}else{var l=o.base,c=o.copy;d(l,function(e){h(c,e)||r.onDelete(o,e)})}this.onCopy&&this.onCopy(o),this.autoFreeze&&n.canAutoFreeze&&Object.freeze(o.copy),t&&n.patches&&z(o,t,n.patches,n.inversePatches)}return o.copy},U.prototype.finalizeTree=function(e,t,n){var r=this,o=e[a];o&&(this.useProxies||(o.copy=p(o.draft,!0)),e=o.copy);var i=!!t&&!!n.patches,c=function(a,s,f){if(s===f)throw Error("Immer forbids circular references");var p=!!o&&f===e;if(u(s)){var h=p&&i&&!o.assigned[a]?t.concat(a):null;if(u(s=r.finalize(s,h,n))&&(n.canAutoFreeze=!1),Array.isArray(f)||y(f,a)?f[a]=s:Object.defineProperty(f,a,{value:s}),p&&s===o.base[a])return}else{if(p&&m(s,o.base[a]))return;l(s)&&!Object.isFrozen(s)&&d(s,c)}p&&r.onAssign&&r.onAssign(o,a,s)};return d(e,c),e};var H=new U,B=(H.produce,H.setAutoFreeze.bind(H)),$=(H.setUseProxies.bind(H),H.applyPatches.bind(H),H.createDraft.bind(H)),q=H.finishDraft.bind(H)}).call(this,n(74))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=wcmlMultiCurrency.strings},function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(0),o=n.n(r),i=n(107);function a(e){var t=[];return o.a.Children.forEach(e,function(e){void 0!==e&&null!==e&&(Array.isArray(e)?t=t.concat(a(e)):Object(i.isFragment)(e)&&e.props?t=t.concat(a(e.props.children)):t.push(e))}),t}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e,t){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}n.d(t,"a",function(){return r})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){e.exports=!n(31)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=n(106)},function(e,t,n){var r=n(65)("wks"),o=n(38),i=n(17).Symbol,a="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},function(e,t,n){var r=n(96),o=n(68);e.exports=function(e){return r(o(e))}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(32),o=n(99),i=n(69),a=Object.defineProperty;t.f=n(20)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(26),o=n(41);e.exports=n(20)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";n.r(t);var r=function(){return!1},o=function(){return!0},i={"@@functional/placeholder":!0};function a(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function u(e){return function t(n){return 0===arguments.length||a(n)?t:e.apply(this,arguments)}}function l(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return a(n)?t:u(function(t){return e(n,t)});default:return a(n)&&a(r)?t:a(n)?u(function(t){return e(t,r)}):a(r)?u(function(t){return e(n,t)}):e(n,r)}}}var c=l(function(e,t){return Number(e)+Number(t)});function s(e,t){var n;e=e||[],t=t||[];var r=e.length,o=t.length,i=[];for(n=0;n<r;)i[i.length]=e[n],n+=1;for(n=0;n<o;)i[i.length]=t[n],n+=1;return i}function f(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,i){return t.apply(this,arguments)};case 6:return function(e,n,r,o,i,a){return t.apply(this,arguments)};case 7:return function(e,n,r,o,i,a,u){return t.apply(this,arguments)};case 8:return function(e,n,r,o,i,a,u,l){return t.apply(this,arguments)};case 9:return function(e,n,r,o,i,a,u,l,c){return t.apply(this,arguments)};case 10:return function(e,n,r,o,i,a,u,l,c,s){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function p(e,t,n){return function(){for(var r=[],o=0,i=e,u=0;u<t.length||o<arguments.length;){var l;u<t.length&&(!a(t[u])||o>=arguments.length)?l=t[u]:(l=arguments[o],o+=1),r[u]=l,a(l)||(i-=1),u+=1}return i<=0?n.apply(this,r):f(i,p(e,r,n))}}var d=l(function(e,t){return 1===e?u(t):f(e,p(e,[],t))}),y=u(function(e){return d(e.length,function(){var t=0,n=arguments[0],r=arguments[arguments.length-1],o=Array.prototype.slice.call(arguments,0);return o[0]=function(){var e=n.apply(this,s(arguments,[t,r]));return t+=1,e},e.apply(this,o)})});function h(e){return function t(n,r,o){switch(arguments.length){case 0:return t;case 1:return a(n)?t:l(function(t,r){return e(n,t,r)});case 2:return a(n)&&a(r)?t:a(n)?l(function(t,n){return e(t,r,n)}):a(r)?l(function(t,r){return e(n,t,r)}):u(function(t){return e(n,r,t)});default:return a(n)&&a(r)&&a(o)?t:a(n)&&a(r)?l(function(t,n){return e(t,n,o)}):a(n)&&a(o)?l(function(t,n){return e(t,r,n)}):a(r)&&a(o)?l(function(t,r){return e(n,t,r)}):a(n)?u(function(t){return e(t,r,o)}):a(r)?u(function(t){return e(n,t,o)}):a(o)?u(function(t){return e(n,r,t)}):e(n,r,o)}}}var m=h(function(e,t,n){if(e>=n.length||e<-n.length)return n;var r=(e<0?n.length:0)+e,o=s(n);return o[r]=t(n[r]),o}),v=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};function b(e){return null!=e&&"function"==typeof e["@@transducer/step"]}function g(e,t,n){return function(){if(0===arguments.length)return n();var r=Array.prototype.slice.call(arguments,0),o=r.pop();if(!v(o)){for(var i=0;i<e.length;){if("function"==typeof o[e[i]])return o[e[i]].apply(o,r);i+=1}if(b(o))return t.apply(null,r)(o)}return n.apply(this,arguments)}}function w(e){return e&&e["@@transducer/reduced"]?e:{"@@transducer/value":e,"@@transducer/reduced":!0}}var O={init:function(){return this.xf["@@transducer/init"]()},result:function(e){return this.xf["@@transducer/result"](e)}},E=function(){function e(e,t){this.xf=t,this.f=e,this.all=!0}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)||(this.all=!1,e=w(this.xf["@@transducer/step"](e,!1))),e},e}(),S=l(g(["all"],l(function(e,t){return new E(e,t)}),function(e,t){for(var n=0;n<t.length;){if(!e(t[n]))return!1;n+=1}return!0})),_=l(function(e,t){return t>e?t:e});function P(e,t){for(var n=0,r=t.length,o=Array(r);n<r;)o[n]=e(t[n]),n+=1;return o}function x(e){return"[object String]"===Object.prototype.toString.call(e)}var j=u(function(e){return!!v(e)||!!e&&("object"==typeof e&&(!x(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))}),C=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();function k(e){return new C(e)}var T=l(function(e,t){return f(e.length,function(){return e.apply(t,arguments)})});function M(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function A(e,t,n,r){return e["@@transducer/result"](n[r](T(e["@@transducer/step"],e),t))}var N="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function R(e,t,n){if("function"==typeof e&&(e=k(e)),j(n))return function(e,t,n){for(var r=0,o=n.length;r<o;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}(e,t,n);if("function"==typeof n["fantasy-land/reduce"])return A(e,t,n,"fantasy-land/reduce");if(null!=n[N])return M(e,t,n[N]());if("function"==typeof n.next)return M(e,t,n);if("function"==typeof n.reduce)return A(e,t,n,"reduce");throw new TypeError("reduce: list must be array or iterable")}var D=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}(),I=l(function(e,t){return new D(e,t)});function F(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var L=Object.prototype.toString,z=function(){return"[object Arguments]"===L.call(arguments)?function(e){return"[object Arguments]"===L.call(e)}:function(e){return F("callee",e)}}(),V=!{toString:null}.propertyIsEnumerable("toString"),W=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],U=function(){return arguments.propertyIsEnumerable("length")}(),H=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1},B="function"!=typeof Object.keys||U?u(function(e){if(Object(e)!==e)return[];var t,n,r=[],o=U&&z(e);for(t in e)!F(t,e)||o&&"length"===t||(r[r.length]=t);if(V)for(n=W.length-1;n>=0;)F(t=W[n],e)&&!H(r,t)&&(r[r.length]=t),n-=1;return r}):u(function(e){return Object(e)!==e?[]:Object.keys(e)}),$=l(g(["fantasy-land/map","map"],I,function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return d(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return R(function(n,r){return n[r]=e(t[r]),n},{},B(t));default:return P(e,t)}})),q=Number.isInteger||function(e){return e<<0===e},K=l(function(e,t){var n=e<0?t.length+e:e;return x(t)?t.charAt(n):t[n]}),Y=l(function(e,t){return e.map(function(e){for(var n,r=t,o=0;o<e.length;){if(null==r)return;n=e[o],r=q(n)?K(n,r):r[n],o+=1}return r})}),X=l(function(e,t){return Y([e],t)[0]}),Q=l(function(e,t){return X([e],t)}),G=l(function(e,t){return $(Q(e),t)}),J=h(R),Z=u(function(e){return d(J(_,0,G("length",e)),function(){for(var t=0,n=e.length;t<n;){if(!e[t].apply(this,arguments))return!1;t+=1}return!0})}),ee=u(function(e){return function(){return e}}),te=l(function(e,t){return e&&t}),ne=function(){function e(e,t){this.xf=t,this.f=e,this.any=!1}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.any||(e=this.xf["@@transducer/step"](e,!1)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.any=!0,e=w(this.xf["@@transducer/step"](e,!0))),e},e}(),re=l(g(["any"],l(function(e,t){return new ne(e,t)}),function(e,t){for(var n=0;n<t.length;){if(e(t[n]))return!0;n+=1}return!1})),oe=u(function(e){return d(J(_,0,G("length",e)),function(){for(var t=0,n=e.length;t<n;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})}),ie=l(function(e,t){return"function"==typeof t["fantasy-land/ap"]?t["fantasy-land/ap"](e):"function"==typeof e.ap?e.ap(t):"function"==typeof e?function(n){return e(n)(t(n))}:R(function(e,n){return s(e,$(n,t))},[],e)});var ae=function(){function e(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.store(t),this.full?this.xf["@@transducer/step"](e,this.getCopy()):e},e.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},e.prototype.getCopy=function(){return s(Array.prototype.slice.call(this.acc,this.pos),Array.prototype.slice.call(this.acc,0,this.pos))},e}(),ue=l(g([],l(function(e,t){return new ae(e,t)}),function(e,t){for(var n=0,r=t.length-(e-1),o=new Array(r>=0?r:0);n<r;)o[n]=Array.prototype.slice.call(t,n,n+e),n+=1;return o})),le=l(function(e,t){return s(t,[e])}),ce=l(function(e,t){return e.apply(this,t)}),se=u(function(e){for(var t=B(e),n=t.length,r=[],o=0;o<n;)r[o]=e[t[o]],o+=1;return r});function fe(e,t){return B(t).reduce(function(n,r){return n[r]=e(t[r]),n},{})}var pe=u(function e(t){return t=fe(function(t){return"function"==typeof t?t:e(t)},t),d(J(_,0,G("length",se(t))),function(){var e=arguments;return fe(function(t){return ce(t,e)},t)})}),de=l(function(e,t){return t(e)}),ye=h(function(e,t,n){var r=e(t),o=e(n);return r<o?-1:r>o?1:0}),he=h(function(e,t,n){var r={};for(var o in n)r[o]=n[o];return r[e]=t,r}),me=u(function(e){return null==e}),ve=h(function e(t,n,r){if(0===t.length)return n;var o=t[0];if(t.length>1){var i=!me(r)&&F(o,r)?r[o]:q(t[1])?[]:{};n=e(Array.prototype.slice.call(t,1),n,i)}if(q(o)&&v(r)){var a=[].concat(r);return a[o]=n,a}return he(o,n,r)}),be=l(function(e,t){switch(e){case 0:return function(){return t.call(this)};case 1:return function(e){return t.call(this,e)};case 2:return function(e,n){return t.call(this,e,n)};case 3:return function(e,n,r){return t.call(this,e,n,r)};case 4:return function(e,n,r,o){return t.call(this,e,n,r,o)};case 5:return function(e,n,r,o,i){return t.call(this,e,n,r,o,i)};case 6:return function(e,n,r,o,i,a){return t.call(this,e,n,r,o,i,a)};case 7:return function(e,n,r,o,i,a,u){return t.call(this,e,n,r,o,i,a,u)};case 8:return function(e,n,r,o,i,a,u,l){return t.call(this,e,n,r,o,i,a,u,l)};case 9:return function(e,n,r,o,i,a,u,l,c){return t.call(this,e,n,r,o,i,a,u,l,c)};case 10:return function(e,n,r,o,i,a,u,l,c,s){return t.call(this,e,n,r,o,i,a,u,l,c,s)};default:throw new Error("First argument to nAry must be a non-negative integer no greater than ten")}}),ge=u(function(e){return be(2,e)});function we(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}var Oe=l(function(e,t){var n=d(e,t);return d(e,function(){return R(ie,$(n,arguments[0]),Array.prototype.slice.call(arguments,1))})}),Ee=u(function(e){return Oe(e.length,e)}),Se=l(function(e,t){return we(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:Ee(te)(e,t)}),_e=u(function(e){return d(e.length,e)}),Pe=_e(function(e){return e.apply(this,Array.prototype.slice.call(arguments,1))});function xe(e){return function t(n){for(var r,o,i,a=[],u=0,l=n.length;u<l;){if(j(n[u]))for(i=0,o=(r=e?t(n[u]):n[u]).length;i<o;)a[a.length]=r[i],i+=1;else a[a.length]=n[u];u+=1}return a}}var je=function(e){var t=function(e){return{"@@transducer/init":O.init,"@@transducer/result":function(t){return e["@@transducer/result"](t)},"@@transducer/step":function(t,n){var r=e["@@transducer/step"](t,n);return r["@@transducer/reduced"]?function(e){return{"@@transducer/value":e,"@@transducer/reduced":!0}}(r):r}}}(e);return{"@@transducer/init":O.init,"@@transducer/result":function(e){return t["@@transducer/result"](e)},"@@transducer/step":function(e,n){return j(n)?R(t,e,n):R(t,e,[n])}}},Ce=l(g(["fantasy-land/chain","chain"],l(function(e,t){return $(e,je(t))}),function(e,t){return"function"==typeof t?function(n){return e(t(n))(n)}:xe(!1)($(e,t))})),ke=h(function(e,t,n){if(e>t)throw new Error("min must not be greater than max in clamp(min, max, value)");return n<e?e:n>t?t:n});function Te(e){return new RegExp(e.source,(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":""))}var Me=u(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function Ae(e,t,n,r){var o=function(o){for(var i=t.length,a=0;a<i;){if(e===t[a])return n[a];a+=1}for(var u in t[a+1]=e,n[a+1]=o,e)o[u]=r?Ae(e[u],t,n,!0):e[u];return o};switch(Me(e)){case"Object":return o({});case"Array":return o([]);case"Date":return new Date(e.valueOf());case"RegExp":return Te(e);default:return e}}var Ne=u(function(e){return null!=e&&"function"==typeof e.clone?e.clone():Ae(e,[],[],!0)}),Re=u(function(e){return function(t,n){return e(t,n)?-1:e(n,t)?1:0}}),De=u(function(e){return!e}),Ie=Ee(De);function Fe(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function Le(e,t){return function(){var n=arguments.length;if(0===n)return t();var r=arguments[n-1];return v(r)||"function"!=typeof r[e]?t.apply(this,arguments):r[e].apply(r,Array.prototype.slice.call(arguments,0,n-1))}}var ze=h(Le("slice",function(e,t,n){return Array.prototype.slice.call(n,e,t)})),Ve=u(Le("tail",ze(1,1/0)));function We(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return f(arguments[0].length,J(Fe,arguments[0],Ve(arguments)))}var Ue=u(function(e){return x(e)?e.split("").reverse().join(""):Array.prototype.slice.call(e,0).reverse()});function He(){if(0===arguments.length)throw new Error("compose requires at least one argument");return We.apply(this,Ue(arguments))}function Be(){if(0===arguments.length)throw new Error("composeK requires at least one argument");var e=Array.prototype.slice.call(arguments),t=e.pop();return He(He.apply(this,$(Ce,e)),t)}function $e(e,t){return function(){var n=this;return e.apply(n,arguments).then(function(e){return t.call(n,e)})}}function qe(){if(0===arguments.length)throw new Error("pipeP requires at least one argument");return f(arguments[0].length,J($e,arguments[0],Ve(arguments)))}function Ke(){if(0===arguments.length)throw new Error("composeP requires at least one argument");return qe.apply(this,Ue(arguments))}var Ye=K(0);function Xe(e){return e}var Qe=u(Xe),Ge=l(function(e,t){if(t.length<=0)return Qe;var n=Ye(t),r=Ve(t);return f(n.length,function(){return R(function(t,n){return e.call(this,n,t)},n.apply(this,arguments),r)})}),Je=l(function(e,t){return Ge.apply(this,[e,Ue(t)])});function Ze(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function et(e,t,n){for(var r=0,o=n.length;r<o;){if(e(t,n[r]))return!0;r+=1}return!1}var tt="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};function nt(e,t,n,r){var o=Ze(e);function i(e,t){return rt(e,t,n.slice(),r.slice())}return!et(function(e,t){return!et(i,t,e)},Ze(t),o)}function rt(e,t,n,r){if(tt(e,t))return!0;var o=Me(e);if(o!==Me(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!tt(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!tt(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=n.length-1;i>=0;){if(n[i]===e)return r[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&nt(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&nt(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=B(e);if(a.length!==B(t).length)return!1;var u=n.concat([e]),l=r.concat([t]);for(i=a.length-1;i>=0;){var c=a[i];if(!F(c,t)||!rt(t[c],e[c],u,l))return!1;i-=1}return!0}var ot=l(function(e,t){return rt(e,t,[],[])});function it(e,t,n){var r,o;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(r=1/t;n<e.length;){if(0===(o=e[n])&&1/o===r)return n;n+=1}return-1}if(t!=t){for(;n<e.length;){if("number"==typeof(o=e[n])&&o!=o)return n;n+=1}return-1}return e.indexOf(t,n);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,n);case"object":if(null===t)return e.indexOf(t,n)}for(;n<e.length;){if(ot(e[n],t))return n;n+=1}return-1}function at(e,t){return it(t,e,0)>=0}function ut(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var lt=function(e){return(e<10?"0":"")+e},ct="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+lt(e.getUTCMonth()+1)+"-"+lt(e.getUTCDate())+"T"+lt(e.getUTCHours())+":"+lt(e.getUTCMinutes())+":"+lt(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function st(e){return function(){return!e.apply(this,arguments)}}function ft(e,t){for(var n=0,r=t.length,o=[];n<r;)e(t[n])&&(o[o.length]=t[n]),n+=1;return o}function pt(e){return"[object Object]"===Object.prototype.toString.call(e)}var dt=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}(),yt=l(g(["filter"],l(function(e,t){return new dt(e,t)}),function(e,t){return pt(t)?R(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{},B(t)):ft(e,t)})),ht=l(function(e,t){return yt(st(e),t)});function mt(e,t){var n=function(n){var r=t.concat([e]);return at(n,r)?"<Circular>":mt(n,r)},r=function(e,t){return P(function(t){return ut(t)+": "+n(e[t])},t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+P(n,e).join(", ")+"))";case"[object Array]":return"["+P(n,e).concat(r(e,ht(function(e){return/^\d+$/.test(e)},B(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+n(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?n(NaN):ut(ct(e)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+n(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object String]":return"object"==typeof e?"new String("+n(e.valueOf())+")":ut(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var o=e.toString();if("[object Object]"!==o)return o}return"{"+r(e,B(e)).join(", ")+"}"}}var vt=u(function(e){return mt(e,[])}),bt=l(function(e,t){if(v(e)){if(v(t))return e.concat(t);throw new TypeError(vt(t)+" is not an array")}if(x(e)){if(x(t))return e+t;throw new TypeError(vt(t)+" is not a string")}if(null!=e&&we(e["fantasy-land/concat"]))return e["fantasy-land/concat"](t);if(null!=e&&we(e.concat))return e.concat(t);throw new TypeError(vt(e)+' does not have a method named "concat" or "fantasy-land/concat"')}),gt=u(function(e){return f(J(_,0,$(function(e){return e[0].length},e)),function(){for(var t=0;t<e.length;){if(e[t][0].apply(this,arguments))return e[t][1].apply(this,arguments);t+=1}})}),wt=l(function(e,t){if(e>10)throw new Error("Constructor with greater than ten arguments");return 0===e?function(){return new t}:_e(be(e,function(e,n,r,o,i,a,u,l,c,s){switch(arguments.length){case 1:return new t(e);case 2:return new t(e,n);case 3:return new t(e,n,r);case 4:return new t(e,n,r,o);case 5:return new t(e,n,r,o,i);case 6:return new t(e,n,r,o,i,a);case 7:return new t(e,n,r,o,i,a,u);case 8:return new t(e,n,r,o,i,a,u,l);case 9:return new t(e,n,r,o,i,a,u,l,c);case 10:return new t(e,n,r,o,i,a,u,l,c,s)}}))}),Ot=u(function(e){return wt(e.length,e)}),Et=l(at),St=l(function(e,t){return d(J(_,0,G("length",t)),function(){var n=arguments,r=this;return e.apply(r,P(function(e){return e.apply(r,n)},t))})}),_t=function(){function e(e,t,n,r){this.valueFn=e,this.valueAcc=t,this.keyFn=n,this.xf=r,this.inputs={}}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){var t;for(t in this.inputs)if(F(t,this.inputs)&&(e=this.xf["@@transducer/step"](e,this.inputs[t]))["@@transducer/reduced"]){e=e["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){var n=this.keyFn(t);return this.inputs[n]=this.inputs[n]||[n,this.valueAcc],this.inputs[n][1]=this.valueFn(this.inputs[n][1],t),e},e}(),Pt=p(4,[],g([],p(4,[],function(e,t,n,r){return new _t(e,t,n,r)}),function(e,t,n,r){return R(function(r,o){var i=n(o);return r[i]=e(F(i,r)?r[i]:Ae(t,[],[],!1),o),r},{},r)})),xt=Pt(function(e,t){return e+1},0),jt=c(-1),Ct=l(function(e,t){return null==t||t!=t?e:t}),kt=h(function(e,t,n){var r=e(t),o=e(n);return r>o?-1:r<o?1:0});function Tt(e,t,n){var r,o=typeof e;switch(o){case"string":case"number":return 0===e&&1/e==-1/0?!!n._items["-0"]||(t&&(n._items["-0"]=!0),!1):null!==n._nativeSet?t?(r=n._nativeSet.size,n._nativeSet.add(e),n._nativeSet.size===r):n._nativeSet.has(e):o in n._items?e in n._items[o]||(t&&(n._items[o][e]=!0),!1):(t&&(n._items[o]={},n._items[o][e]=!0),!1);case"boolean":if(o in n._items){var i=e?1:0;return!!n._items[o][i]||(t&&(n._items[o][i]=!0),!1)}return t&&(n._items[o]=e?[!1,!0]:[!0,!1]),!1;case"function":return null!==n._nativeSet?t?(r=n._nativeSet.size,n._nativeSet.add(e),n._nativeSet.size===r):n._nativeSet.has(e):o in n._items?!!at(e,n._items[o])||(t&&n._items[o].push(e),!1):(t&&(n._items[o]=[e]),!1);case"undefined":return!!n._items[o]||(t&&(n._items[o]=!0),!1);case"object":if(null===e)return!!n._items.null||(t&&(n._items.null=!0),!1);default:return(o=Object.prototype.toString.call(e))in n._items?!!at(e,n._items[o])||(t&&n._items[o].push(e),!1):(t&&(n._items[o]=[e]),!1)}}var Mt=function(){function e(){this._nativeSet="function"==typeof Set?new Set:null,this._items={}}return e.prototype.add=function(e){return!Tt(e,!0,this)},e.prototype.has=function(e){return Tt(e,!1,this)},e}(),At=l(function(e,t){for(var n=[],r=0,o=e.length,i=t.length,a=new Mt,u=0;u<i;u+=1)a.add(t[u]);for(;r<o;)a.add(e[r])&&(n[n.length]=e[r]),r+=1;return n}),Nt=h(function(e,t,n){for(var r=[],o=0,i=t.length;o<i;)et(e,t[o],n)||et(e,t[o],r)||r.push(t[o]),o+=1;return r}),Rt=l(function(e,t){var n={};for(var r in t)n[r]=t[r];return delete n[e],n}),Dt=h(function(e,t,n){var r=Array.prototype.slice.call(n,0);return r.splice(e,t),r}),It=h(function(e,t,n){return m(e,ee(t),n)}),Ft=l(function e(t,n){switch(t.length){case 0:return n;case 1:return q(t[0])&&v(n)?Dt(t[0],1,n):Rt(t[0],n);default:var r=t[0],o=Array.prototype.slice.call(t,1);return null==n[r]?n:q(r)&&v(n)?It(r,e(o,n[r]),n):he(r,e(o,n[r]),n)}}),Lt=l(function(e,t){return e/t}),zt=function(){function e(e,t){this.xf=t,this.n=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){return this.n>0?(this.n-=1,e):this.xf["@@transducer/step"](e,t)},e}(),Vt=l(g(["drop"],l(function(e,t){return new zt(e,t)}),function(e,t){return ze(Math.max(0,e),1/0,t)})),Wt=function(){function e(e,t){this.xf=t,this.n=e,this.i=0}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){this.i+=1;var n=0===this.n?e:this.xf["@@transducer/step"](e,t);return this.n>=0&&this.i>=this.n?w(n):n},e}(),Ut=l(g(["take"],l(function(e,t){return new Wt(e,t)}),function(e,t){return ze(0,e<0?1/0:e,t)}));var Ht=function(){function e(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.full&&(e=this.xf["@@transducer/step"](e,this.acc[this.pos])),this.store(t),e},e.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},e}(),Bt=l(g([],l(function(e,t){return new Ht(e,t)}),function(e,t){return Ut(e<t.length?t.length-e:0,t)}));var $t=function(){function e(e,t){this.f=e,this.retained=[],this.xf=t}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.retained=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.retain(e,t):this.flush(e,t)},e.prototype.flush=function(e,t){return e=R(this.xf["@@transducer/step"],e,this.retained),this.retained=[],this.xf["@@transducer/step"](e,t)},e.prototype.retain=function(e,t){return this.retained.push(t),e},e}(),qt=l(g([],l(function(e,t){return new $t(e,t)}),function(e,t){for(var n=t.length-1;n>=0&&e(t[n]);)n-=1;return ze(0,n+1,t)})),Kt=function(){function e(e,t){this.xf=t,this.pred=e,this.lastValue=void 0,this.seenFirstValue=!1}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){var n=!1;return this.seenFirstValue?this.pred(this.lastValue,t)&&(n=!0):this.seenFirstValue=!0,this.lastValue=t,n?e:this.xf["@@transducer/step"](e,t)},e}(),Yt=l(function(e,t){return new Kt(e,t)}),Xt=K(-1),Qt=l(g([],Yt,function(e,t){var n=[],r=1,o=t.length;if(0!==o)for(n[0]=t[0];r<o;)e(Xt(n),t[r])||(n[n.length]=t[r]),r+=1;return n})),Gt=u(g([],Yt(ot),Qt(ot))),Jt=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){if(this.f){if(this.f(t))return e;this.f=null}return this.xf["@@transducer/step"](e,t)},e}(),Zt=l(g(["dropWhile"],l(function(e,t){return new Jt(e,t)}),function(e,t){for(var n=0,r=t.length;n<r&&e(t[n]);)n+=1;return ze(n,1/0,t)})),en=l(function(e,t){return e||t}),tn=l(function(e,t){return we(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:Ee(en)(e,t)}),nn=u(function(e){return null!=e&&"function"==typeof e["fantasy-land/empty"]?e["fantasy-land/empty"]():null!=e&&null!=e.constructor&&"function"==typeof e.constructor["fantasy-land/empty"]?e.constructor["fantasy-land/empty"]():null!=e&&"function"==typeof e.empty?e.empty():null!=e&&null!=e.constructor&&"function"==typeof e.constructor.empty?e.constructor.empty():v(e)?[]:x(e)?"":pt(e)?{}:z(e)?function(){return arguments}():void 0}),rn=l(function(e,t){return Vt(e>=0?t.length-e:0,t)}),on=l(function(e,t){return ot(rn(e.length,t),e)}),an=h(function(e,t,n){return ot(e(t),e(n))}),un=h(function(e,t,n){return ot(t[e],n[e])}),ln=l(function e(t,n){var r,o,i,a=n instanceof Array?[]:{};for(o in n)i=typeof(r=t[o]),a[o]="function"===i?r(n[o]):r&&"object"===i?e(r,n[o]):n[o];return a}),cn=function(){function e(e,t){this.xf=t,this.f=e,this.found=!1}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.found=!0,e=w(this.xf["@@transducer/step"](e,t))),e},e}(),sn=l(g(["find"],l(function(e,t){return new cn(e,t)}),function(e,t){for(var n=0,r=t.length;n<r;){if(e(t[n]))return t[n];n+=1}})),fn=function(){function e(e,t){this.xf=t,this.f=e,this.idx=-1,this.found=!1}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,-1)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.found=!0,e=w(this.xf["@@transducer/step"](e,this.idx))),e},e}(),pn=l(g([],l(function(e,t){return new fn(e,t)}),function(e,t){for(var n=0,r=t.length;n<r;){if(e(t[n]))return n;n+=1}return-1})),dn=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.last))},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.last=t),e},e}(),yn=l(g([],l(function(e,t){return new dn(e,t)}),function(e,t){for(var n=t.length-1;n>=0;){if(e(t[n]))return t[n];n-=1}})),hn=function(){function e(e,t){this.xf=t,this.f=e,this.idx=-1,this.lastIdx=-1}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.lastIdx))},e.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.lastIdx=this.idx),e},e}(),mn=l(g([],l(function(e,t){return new hn(e,t)}),function(e,t){for(var n=t.length-1;n>=0;){if(e(t[n]))return n;n-=1}return-1})),vn=u(xe(!0)),bn=u(function(e){return d(e.length,function(t,n){var r=Array.prototype.slice.call(arguments,0);return r[0]=n,r[1]=t,e.apply(this,r)})}),gn=l(Le("forEach",function(e,t){for(var n=t.length,r=0;r<n;)e(t[r]),r+=1;return t})),wn=l(function(e,t){for(var n=B(t),r=0;r<n.length;){var o=n[r];e(t[o],o,t),r+=1}return t}),On=u(function(e){for(var t={},n=0;n<e.length;)t[e[n][0]]=e[n][1],n+=1;return t}),En=l(Le("groupBy",Pt(function(e,t){return null==e&&(e=[]),e.push(t),e},null))),Sn=l(function(e,t){for(var n=[],r=0,o=t.length;r<o;){for(var i=r+1;i<o&&e(t[i-1],t[i]);)i+=1;n.push(t.slice(r,i)),r=i}return n}),_n=l(function(e,t){return e>t}),Pn=l(function(e,t){return e>=t}),xn=l(function(e,t){if(0===e.length||me(t))return!1;for(var n=t,r=0;r<e.length;){if(me(n)||!F(e[r],n))return!1;n=n[e[r]],r+=1}return!0}),jn=l(function(e,t){return xn([e],t)}),Cn=l(function(e,t){return e in t}),kn=l(tt),Tn=h(function(e,t,n){return d(Math.max(e.length,t.length,n.length),function(){return e.apply(this,arguments)?t.apply(this,arguments):n.apply(this,arguments)})}),Mn=c(1),An=l(at),Nn=Pt(function(e,t){return t},null),Rn=l(function(e,t){return"function"!=typeof t.indexOf||v(t)?it(t,e,0):t.indexOf(e)}),Dn=ze(0,-1),In=h(function(e,t,n){return ft(function(t){return et(e,t,n)},t)}),Fn=h(function(e,t,n){e=e<n.length&&e>=0?e:n.length;var r=Array.prototype.slice.call(n,0);return r.splice(e,0,t),r}),Ln=h(function(e,t,n){return e=e<n.length&&e>=0?e:n.length,[].concat(Array.prototype.slice.call(n,0,e),t,Array.prototype.slice.call(n,e))}),zn=l(function(e,t){for(var n,r,o=new Mt,i=[],a=0;a<t.length;)n=e(r=t[a]),o.add(n)&&i.push(r),a+=1;return i}),Vn=zn(Qe),Wn=l(function(e,t){var n,r;return e.length>t.length?(n=e,r=t):(n=t,r=e),Vn(ft(bn(at)(n),r))}),Un=l(Le("intersperse",function(e,t){for(var n=[],r=0,o=t.length;r<o;)r===o-1?n.push(t[r]):n.push(t[r],e),r+=1;return n}));var Hn="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1,r=arguments.length;n<r;){var o=arguments[n];if(null!=o)for(var i in o)F(i,o)&&(t[i]=o[i]);n+=1}return t},Bn=l(function(e,t){var n={};return n[e]=t,n}),$n={"@@transducer/init":Array,"@@transducer/step":function(e,t){return e.push(t),e},"@@transducer/result":Xe},qn={"@@transducer/init":String,"@@transducer/step":function(e,t){return e+t},"@@transducer/result":Xe},Kn={"@@transducer/init":Object,"@@transducer/step":function(e,t){return Hn(e,j(t)?Bn(t[0],t[1]):t)},"@@transducer/result":Xe};var Yn=h(function(e,t,n){return b(e)?R(t(e),e["@@transducer/init"](),n):R(t(function(e){if(b(e))return e;if(j(e))return $n;if("string"==typeof e)return qn;if("object"==typeof e)return Kn;throw new Error("Cannot create transformer for "+e)}(e)),Ae(e,[],[],!1),n)}),Xn=u(function(e){for(var t=B(e),n=t.length,r=0,o={};r<n;){var i=t[r],a=e[i],u=F(a,o)?o[a]:o[a]=[];u[u.length]=i,r+=1}return o}),Qn=u(function(e){for(var t=B(e),n=t.length,r=0,o={};r<n;){var i=t[r];o[e[i]]=i,r+=1}return o}),Gn=l(function(e,t){return d(e+1,function(){var n=arguments[e];if(null!=n&&we(n[t]))return n[t].apply(n,Array.prototype.slice.call(arguments,0,e));throw new TypeError(vt(n)+' does not have a method named "'+t+'"')})}),Jn=l(function(e,t){return null!=t&&t.constructor===e||t instanceof e}),Zn=u(function(e){return null!=e&&ot(e,nn(e))}),er=Gn(1,"join"),tr=u(function(e){return St(function(){return Array.prototype.slice.call(arguments,0)},e)}),nr=u(function(e){var t,n=[];for(t in e)n[n.length]=t;return n}),rr=l(function(e,t){if("function"!=typeof t.lastIndexOf||v(t)){for(var n=t.length-1;n>=0;){if(ot(t[n],e))return n;n-=1}return-1}return t.lastIndexOf(e)});function or(e){return"[object Number]"===Object.prototype.toString.call(e)}var ir=u(function(e){return null!=e&&or(e.length)?e.length:NaN}),ar=l(function(e,t){return function(n){return function(r){return $(function(e){return t(e,r)},n(e(r)))}}}),ur=u(function(e){return ar(K(e),It(e))}),lr=u(function(e){return ar(X(e),ve(e))}),cr=u(function(e){return ar(Q(e),he(e))}),sr=l(function(e,t){return e<t}),fr=l(function(e,t){return e<=t}),pr=h(function(e,t,n){for(var r=0,o=n.length,i=[],a=[t];r<o;)a=e(a[0],n[r]),i[r]=a[1],r+=1;return[a[0],i]}),dr=h(function(e,t,n){for(var r=n.length-1,o=[],i=[t];r>=0;)i=e(i[0],n[r]),o[r]=i[1],r-=1;return[i[0],o]}),yr=l(function(e,t){return R(function(n,r){return n[r]=e(t[r],r,t),n},{},B(t))}),hr=l(function(e,t){return t.match(e)||[]}),mr=l(function(e,t){return q(e)?!q(t)||t<1?NaN:(e%t+t)%t:NaN}),vr=h(function(e,t,n){return e(n)>e(t)?n:t}),br=J(c,0),gr=u(function(e){return br(e)/e.length}),wr=u(function(e){var t=e.length;if(0===t)return NaN;var n=2-t%2,r=(t-n)/2;return gr(Array.prototype.slice.call(e,0).sort(function(e,t){return e<t?-1:e>t?1:0}).slice(r,r+n))}),Or=l(function(e,t){var n={};return f(t.length,function(){var r=e.apply(this,arguments);return F(r,n)||(n[r]=t.apply(this,arguments)),n[r]})}),Er=l(function(e,t){return Hn({},e,t)}),Sr=u(function(e){return Hn.apply(null,[{}].concat(e))}),_r=h(function(e,t,n){var r,o={};for(r in t)F(r,t)&&(o[r]=F(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)F(r,n)&&!F(r,o)&&(o[r]=n[r]);return o}),Pr=h(function e(t,n,r){return _r(function(n,r,o){return pt(r)&&pt(o)?e(t,r,o):t(n,r,o)},n,r)}),xr=l(function(e,t){return Pr(function(e,t,n){return t},e,t)}),jr=l(function(e,t){return Pr(function(e,t,n){return n},e,t)}),Cr=h(function(e,t,n){return Pr(function(t,n,r){return e(n,r)},t,n)}),kr=l(function(e,t){return Hn({},t,e)}),Tr=l(function(e,t){return Hn({},e,t)}),Mr=h(function(e,t,n){return _r(function(t,n,r){return e(n,r)},t,n)}),Ar=l(function(e,t){return t<e?t:e}),Nr=h(function(e,t,n){return e(n)<e(t)?n:t}),Rr=l(function(e,t){return e%t}),Dr=h(function(e,t,n){var r=n.length,o=n.slice(),i=e<0?r+e:e,a=t<0?r+t:t,u=o.splice(i,1);return i<0||i>=n.length||a<0||a>=n.length?n:[].concat(o.slice(0,a)).concat(u).concat(o.slice(a,n.length))}),Ir=l(function(e,t){return e*t}),Fr=u(function(e){return-e}),Lr=l(function(e,t){return S(st(e),t)}),zr=u(function(e){return d(e<0?1:e+1,function(){return K(e,arguments)})}),Vr=h(function(e,t,n){return e(t(n))});var Wr=u(function(e){return[e]}),Ur=l(function(e,t){for(var n={},r={},o=0,i=e.length;o<i;)r[e[o]]=1,o+=1;for(var a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}),Hr=u(function(e){var t,n=!1;return f(e.length,function(){return n?t:(n=!0,t=e.apply(this,arguments))})});function Br(e,t){if(null==t||!we(t.then))throw new TypeError("`"+e+"` expected a Promise, received "+mt(t,[]))}var $r=l(function(e,t){return Br("otherwise",t),t.then(null,e)}),qr=function(e){return{value:e,map:function(t){return qr(t(e))}}},Kr=h(function(e,t,n){return e(function(e){return qr(t(e))})(n).value}),Yr=l(function(e,t){return[e,t]});function Xr(e){return l(function(t,n){return f(Math.max(0,t.length-n.length),function(){return t.apply(this,e(n,arguments))})})}var Qr=Xr(s),Gr=Xr(bn(s)),Jr=tr([yt,ht]),Zr=h(function(e,t,n){return ot(X(e,n),t)}),eo=h(function(e,t,n){return Ct(e,X(t,n))}),to=h(function(e,t,n){return e(X(t,n))}),no=l(function(e,t){for(var n={},r=0;r<e.length;)e[r]in t&&(n[e[r]]=t[e[r]]),r+=1;return n}),ro=l(function(e,t){for(var n={},r=0,o=e.length;r<o;){var i=e[r];n[i]=t[i],r+=1}return n}),oo=l(function(e,t){var n={};for(var r in t)e(t[r],r,t)&&(n[r]=t[r]);return n});function io(){if(0===arguments.length)throw new Error("pipeK requires at least one argument");return Be.apply(this,Ue(arguments))}var ao=l(function(e,t){return s([e],t)}),uo=J(Ir,1),lo=l(function(e,t){return d(t.length,function(){for(var n=[],r=0;r<t.length;)n.push(t[r].call(this,arguments[r])),r+=1;return e.apply(this,n.concat(Array.prototype.slice.call(arguments,t.length)))})}),co=lo(P,[ro,Qe]),so=h(function(e,t,n){return ot(t,n[e])}),fo=h(function(e,t,n){return Jn(e,n[t])}),po=h(function(e,t,n){return eo(e,[t],n)}),yo=h(function(e,t,n){return e(n[t])}),ho=l(function(e,t){return e.map(function(e){return X([e],t)})}),mo=l(function(e,t){if(!or(e)||!or(t))throw new TypeError("Both arguments to range must be numbers");for(var n=[],r=e;r<t;)n.push(r),r+=1;return n}),vo=h(function(e,t,n){for(var r=n.length-1;r>=0;)t=e(n[r],t),r-=1;return t}),bo=p(4,[],function(e,t,n,r){return R(function(n,r){return e(n,r)?t(n,r):w(n)},n,r)}),go=u(w),wo=l(function(e,t){var n,r=Number(t),o=0;if(r<0||isNaN(r))throw new RangeError("n must be a non-negative number");for(n=new Array(r);o<r;)n[o]=e(o),o+=1;return n}),Oo=l(function(e,t){return wo(ee(e),t)}),Eo=h(function(e,t,n){return n.replace(e,t)}),So=h(function(e,t,n){for(var r=0,o=n.length,i=[t];r<o;)t=e(t,n[r]),i[r+1]=t,r+=1;return i}),_o=l(function(e,t){return"function"==typeof t.sequence?t.sequence(e):vo(function(e,t){return ie($(ao,e),t)},e([]),t)}),Po=h(function(e,t,n){return Kr(e,ee(t),n)}),xo=l(function(e,t){return Array.prototype.slice.call(t,0).sort(e)}),jo=l(function(e,t){return Array.prototype.slice.call(t,0).sort(function(t,n){var r=e(t),o=e(n);return r<o?-1:r>o?1:0})}),Co=l(function(e,t){return Array.prototype.slice.call(t,0).sort(function(t,n){for(var r=0,o=0;0===r&&o<e.length;)r=e[o](t,n),o+=1;return r})}),ko=Gn(1,"split"),To=l(function(e,t){return[ze(0,e,t),ze(e,ir(t),t)]}),Mo=l(function(e,t){if(e<=0)throw new Error("First argument to splitEvery must be a positive integer");for(var n=[],r=0;r<t.length;)n.push(ze(r,r+=e,t));return n}),Ao=l(function(e,t){for(var n=0,r=t.length,o=[];n<r&&!e(t[n]);)o.push(t[n]),n+=1;return[o,Array.prototype.slice.call(t,n)]}),No=l(function(e,t){return ot(Ut(e.length,t),e)}),Ro=l(function(e,t){return Number(e)-Number(t)}),Do=l(function(e,t){return bt(At(e,t),At(t,e))}),Io=h(function(e,t,n){return bt(Nt(e,t,n),Nt(e,n,t))}),Fo=l(function(e,t){for(var n=t.length-1;n>=0&&e(t[n]);)n-=1;return ze(n+1,1/0,t)}),Lo=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):w(e)},e}(),zo=l(g(["takeWhile"],l(function(e,t){return new Lo(e,t)}),function(e,t){for(var n=0,r=t.length;n<r&&e(t[n]);)n+=1;return ze(0,n,t)})),Vo=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=O.init,e.prototype["@@transducer/result"]=O.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t),this.xf["@@transducer/step"](e,t)},e}(),Wo=l(g([],l(function(e,t){return new Vo(e,t)}),function(e,t){return e(t),t}));var Uo=l(function(e,t){if(!function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}(e))throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received "+vt(e));return Te(e).test(t)}),Ho=l(function(e,t){return Br("andThen",t),t.then(e)}),Bo=Gn(0,"toLowerCase"),$o=u(function(e){var t=[];for(var n in e)F(n,e)&&(t[t.length]=[n,e[n]]);return t}),qo=u(function(e){var t=[];for(var n in e)t[t.length]=[n,e[n]];return t}),Ko=Gn(0,"toUpperCase"),Yo=d(4,function(e,t,n,r){return R(e("function"==typeof t?k(t):t),n,r)}),Xo=u(function(e){for(var t=0,n=[];t<e.length;){for(var r=e[t],o=0;o<r.length;)void 0===n[o]&&(n[o]=[]),n[o].push(r[o]),o+=1;t+=1}return n}),Qo=h(function(e,t,n){return"function"==typeof n["fantasy-land/traverse"]?n["fantasy-land/traverse"](t,e):_o(e,$(t,n))}),Go="\t\n\v\f\r \u2028\u2029\ufeff",Jo=u("function"==typeof String.prototype.trim&&!Go.trim()&&"".trim()?function(e){return e.trim()}:function(e){var t=new RegExp("^["+Go+"]["+Go+"]*"),n=new RegExp("["+Go+"]["+Go+"]*$");return e.replace(t,"").replace(n,"")}),Zo=l(function(e,t){return f(e.length,function(){try{return e.apply(this,arguments)}catch(e){return t.apply(this,s([e],arguments))}})}),ei=u(function(e){return function(){return e(Array.prototype.slice.call(arguments,0))}}),ti=u(function(e){return be(1,e)}),ni=l(function(e,t){return d(e,function(){for(var n,r=1,o=t,i=0;r<=e&&"function"==typeof o;)n=r===e?arguments.length:i+o.length,o=o.apply(this,Array.prototype.slice.call(arguments,i,n)),r+=1,i=n;return o})}),ri=l(function(e,t){for(var n=e(t),r=[];n&&n.length;)r[r.length]=n[0],n=e(n[1]);return r}),oi=l(He(Vn,s)),ii=l(function(e,t){for(var n,r=0,o=t.length,i=[];r<o;)et(e,n=t[r],i)||(i[i.length]=n),r+=1;return i}),ai=h(function(e,t,n){return ii(e,s(t,n))}),ui=h(function(e,t,n){return e(n)?n:t(n)}),li=Ce(Xe),ci=h(function(e,t,n){for(var r=n;!e(r);)r=t(r);return r}),si=u(function(e){var t,n=[];for(t in e)n[n.length]=e[t];return n}),fi=function(e){return{value:e,"fantasy-land/map":function(){return this}}},pi=l(function(e,t){return e(fi)(t).value}),di=h(function(e,t,n){return e(n)?t(n):n}),yi=l(function(e,t){for(var n in e)if(F(n,e)&&!e[n](t[n]))return!1;return!0}),hi=l(function(e,t){return yi($(ot,e),t)}),mi=l(function(e,t){return ht(bn(at)(e),t)}),vi=l(function(e,t){return Boolean(!e^!t)}),bi=l(function(e,t){for(var n,r=0,o=e.length,i=t.length,a=[];r<o;){for(n=0;n<i;)a[a.length]=[e[r],t[n]],n+=1;r+=1}return a}),gi=l(function(e,t){for(var n=[],r=0,o=Math.min(e.length,t.length);r<o;)n[r]=[e[r],t[r]],r+=1;return n}),wi=l(function(e,t){for(var n=0,r=Math.min(e.length,t.length),o={};n<r;)o[e[n]]=t[n],n+=1;return o}),Oi=h(function(e,t,n){for(var r=[],o=0,i=Math.min(t.length,n.length);o<i;)r[o]=e(t[o],n[o]),o+=1;return r}),Ei=u(function(e){return d(e.length,function(){var t=arguments;return function(){return e.apply(this,t)}})});n.d(t,"F",function(){return r}),n.d(t,"T",function(){return o}),n.d(t,"__",function(){return i}),n.d(t,"add",function(){return c}),n.d(t,"addIndex",function(){return y}),n.d(t,"adjust",function(){return m}),n.d(t,"all",function(){return S}),n.d(t,"allPass",function(){return Z}),n.d(t,"always",function(){return ee}),n.d(t,"and",function(){return te}),n.d(t,"any",function(){return re}),n.d(t,"anyPass",function(){return oe}),n.d(t,"ap",function(){return ie}),n.d(t,"aperture",function(){return ue}),n.d(t,"append",function(){return le}),n.d(t,"apply",function(){return ce}),n.d(t,"applySpec",function(){return pe}),n.d(t,"applyTo",function(){return de}),n.d(t,"ascend",function(){return ye}),n.d(t,"assoc",function(){return he}),n.d(t,"assocPath",function(){return ve}),n.d(t,"binary",function(){return ge}),n.d(t,"bind",function(){return T}),n.d(t,"both",function(){return Se}),n.d(t,"call",function(){return Pe}),n.d(t,"chain",function(){return Ce}),n.d(t,"clamp",function(){return ke}),n.d(t,"clone",function(){return Ne}),n.d(t,"comparator",function(){return Re}),n.d(t,"complement",function(){return Ie}),n.d(t,"compose",function(){return He}),n.d(t,"composeK",function(){return Be}),n.d(t,"composeP",function(){return Ke}),n.d(t,"composeWith",function(){return Je}),n.d(t,"concat",function(){return bt}),n.d(t,"cond",function(){return gt}),n.d(t,"construct",function(){return Ot}),n.d(t,"constructN",function(){return wt}),n.d(t,"contains",function(){return Et}),n.d(t,"converge",function(){return St}),n.d(t,"countBy",function(){return xt}),n.d(t,"curry",function(){return _e}),n.d(t,"curryN",function(){return d}),n.d(t,"dec",function(){return jt}),n.d(t,"defaultTo",function(){return Ct}),n.d(t,"descend",function(){return kt}),n.d(t,"difference",function(){return At}),n.d(t,"differenceWith",function(){return Nt}),n.d(t,"dissoc",function(){return Rt}),n.d(t,"dissocPath",function(){return Ft}),n.d(t,"divide",function(){return Lt}),n.d(t,"drop",function(){return Vt}),n.d(t,"dropLast",function(){return Bt}),n.d(t,"dropLastWhile",function(){return qt}),n.d(t,"dropRepeats",function(){return Gt}),n.d(t,"dropRepeatsWith",function(){return Qt}),n.d(t,"dropWhile",function(){return Zt}),n.d(t,"either",function(){return tn}),n.d(t,"empty",function(){return nn}),n.d(t,"endsWith",function(){return on}),n.d(t,"eqBy",function(){return an}),n.d(t,"eqProps",function(){return un}),n.d(t,"equals",function(){return ot}),n.d(t,"evolve",function(){return ln}),n.d(t,"filter",function(){return yt}),n.d(t,"find",function(){return sn}),n.d(t,"findIndex",function(){return pn}),n.d(t,"findLast",function(){return yn}),n.d(t,"findLastIndex",function(){return mn}),n.d(t,"flatten",function(){return vn}),n.d(t,"flip",function(){return bn}),n.d(t,"forEach",function(){return gn}),n.d(t,"forEachObjIndexed",function(){return wn}),n.d(t,"fromPairs",function(){return On}),n.d(t,"groupBy",function(){return En}),n.d(t,"groupWith",function(){return Sn}),n.d(t,"gt",function(){return _n}),n.d(t,"gte",function(){return Pn}),n.d(t,"has",function(){return jn}),n.d(t,"hasIn",function(){return Cn}),n.d(t,"hasPath",function(){return xn}),n.d(t,"head",function(){return Ye}),n.d(t,"identical",function(){return kn}),n.d(t,"identity",function(){return Qe}),n.d(t,"ifElse",function(){return Tn}),n.d(t,"inc",function(){return Mn}),n.d(t,"includes",function(){return An}),n.d(t,"indexBy",function(){return Nn}),n.d(t,"indexOf",function(){return Rn}),n.d(t,"init",function(){return Dn}),n.d(t,"innerJoin",function(){return In}),n.d(t,"insert",function(){return Fn}),n.d(t,"insertAll",function(){return Ln}),n.d(t,"intersection",function(){return Wn}),n.d(t,"intersperse",function(){return Un}),n.d(t,"into",function(){return Yn}),n.d(t,"invert",function(){return Xn}),n.d(t,"invertObj",function(){return Qn}),n.d(t,"invoker",function(){return Gn}),n.d(t,"is",function(){return Jn}),n.d(t,"isEmpty",function(){return Zn}),n.d(t,"isNil",function(){return me}),n.d(t,"join",function(){return er}),n.d(t,"juxt",function(){return tr}),n.d(t,"keys",function(){return B}),n.d(t,"keysIn",function(){return nr}),n.d(t,"last",function(){return Xt}),n.d(t,"lastIndexOf",function(){return rr}),n.d(t,"length",function(){return ir}),n.d(t,"lens",function(){return ar}),n.d(t,"lensIndex",function(){return ur}),n.d(t,"lensPath",function(){return lr}),n.d(t,"lensProp",function(){return cr}),n.d(t,"lift",function(){return Ee}),n.d(t,"liftN",function(){return Oe}),n.d(t,"lt",function(){return sr}),n.d(t,"lte",function(){return fr}),n.d(t,"map",function(){return $}),n.d(t,"mapAccum",function(){return pr}),n.d(t,"mapAccumRight",function(){return dr}),n.d(t,"mapObjIndexed",function(){return yr}),n.d(t,"match",function(){return hr}),n.d(t,"mathMod",function(){return mr}),n.d(t,"max",function(){return _}),n.d(t,"maxBy",function(){return vr}),n.d(t,"mean",function(){return gr}),n.d(t,"median",function(){return wr}),n.d(t,"memoizeWith",function(){return Or}),n.d(t,"merge",function(){return Er}),n.d(t,"mergeAll",function(){return Sr}),n.d(t,"mergeDeepLeft",function(){return xr}),n.d(t,"mergeDeepRight",function(){return jr}),n.d(t,"mergeDeepWith",function(){return Cr}),n.d(t,"mergeDeepWithKey",function(){return Pr}),n.d(t,"mergeLeft",function(){return kr}),n.d(t,"mergeRight",function(){return Tr}),n.d(t,"mergeWith",function(){return Mr}),n.d(t,"mergeWithKey",function(){return _r}),n.d(t,"min",function(){return Ar}),n.d(t,"minBy",function(){return Nr}),n.d(t,"modulo",function(){return Rr}),n.d(t,"move",function(){return Dr}),n.d(t,"multiply",function(){return Ir}),n.d(t,"nAry",function(){return be}),n.d(t,"negate",function(){return Fr}),n.d(t,"none",function(){return Lr}),n.d(t,"not",function(){return De}),n.d(t,"nth",function(){return K}),n.d(t,"nthArg",function(){return zr}),n.d(t,"o",function(){return Vr}),n.d(t,"objOf",function(){return Bn}),n.d(t,"of",function(){return Wr}),n.d(t,"omit",function(){return Ur}),n.d(t,"once",function(){return Hr}),n.d(t,"or",function(){return en}),n.d(t,"otherwise",function(){return $r}),n.d(t,"over",function(){return Kr}),n.d(t,"pair",function(){return Yr}),n.d(t,"partial",function(){return Qr}),n.d(t,"partialRight",function(){return Gr}),n.d(t,"partition",function(){return Jr}),n.d(t,"path",function(){return X}),n.d(t,"paths",function(){return Y}),n.d(t,"pathEq",function(){return Zr}),n.d(t,"pathOr",function(){return eo}),n.d(t,"pathSatisfies",function(){return to}),n.d(t,"pick",function(){return no}),n.d(t,"pickAll",function(){return ro}),n.d(t,"pickBy",function(){return oo}),n.d(t,"pipe",function(){return We}),n.d(t,"pipeK",function(){return io}),n.d(t,"pipeP",function(){return qe}),n.d(t,"pipeWith",function(){return Ge}),n.d(t,"pluck",function(){return G}),n.d(t,"prepend",function(){return ao}),n.d(t,"product",function(){return uo}),n.d(t,"project",function(){return co}),n.d(t,"prop",function(){return Q}),n.d(t,"propEq",function(){return so}),n.d(t,"propIs",function(){return fo}),n.d(t,"propOr",function(){return po}),n.d(t,"propSatisfies",function(){return yo}),n.d(t,"props",function(){return ho}),n.d(t,"range",function(){return mo}),n.d(t,"reduce",function(){return J}),n.d(t,"reduceBy",function(){return Pt}),n.d(t,"reduceRight",function(){return vo}),n.d(t,"reduceWhile",function(){return bo}),n.d(t,"reduced",function(){return go}),n.d(t,"reject",function(){return ht}),n.d(t,"remove",function(){return Dt}),n.d(t,"repeat",function(){return Oo}),n.d(t,"replace",function(){return Eo}),n.d(t,"reverse",function(){return Ue}),n.d(t,"scan",function(){return So}),n.d(t,"sequence",function(){return _o}),n.d(t,"set",function(){return Po}),n.d(t,"slice",function(){return ze}),n.d(t,"sort",function(){return xo}),n.d(t,"sortBy",function(){return jo}),n.d(t,"sortWith",function(){return Co}),n.d(t,"split",function(){return ko}),n.d(t,"splitAt",function(){return To}),n.d(t,"splitEvery",function(){return Mo}),n.d(t,"splitWhen",function(){return Ao}),n.d(t,"startsWith",function(){return No}),n.d(t,"subtract",function(){return Ro}),n.d(t,"sum",function(){return br}),n.d(t,"symmetricDifference",function(){return Do}),n.d(t,"symmetricDifferenceWith",function(){return Io}),n.d(t,"tail",function(){return Ve}),n.d(t,"take",function(){return Ut}),n.d(t,"takeLast",function(){return rn}),n.d(t,"takeLastWhile",function(){return Fo}),n.d(t,"takeWhile",function(){return zo}),n.d(t,"tap",function(){return Wo}),n.d(t,"test",function(){return Uo}),n.d(t,"andThen",function(){return Ho}),n.d(t,"times",function(){return wo}),n.d(t,"toLower",function(){return Bo}),n.d(t,"toPairs",function(){return $o}),n.d(t,"toPairsIn",function(){return qo}),n.d(t,"toString",function(){return vt}),n.d(t,"toUpper",function(){return Ko}),n.d(t,"transduce",function(){return Yo}),n.d(t,"transpose",function(){return Xo}),n.d(t,"traverse",function(){return Qo}),n.d(t,"trim",function(){return Jo}),n.d(t,"tryCatch",function(){return Zo}),n.d(t,"type",function(){return Me}),n.d(t,"unapply",function(){return ei}),n.d(t,"unary",function(){return ti}),n.d(t,"uncurryN",function(){return ni}),n.d(t,"unfold",function(){return ri}),n.d(t,"union",function(){return oi}),n.d(t,"unionWith",function(){return ai}),n.d(t,"uniq",function(){return Vn}),n.d(t,"uniqBy",function(){return zn}),n.d(t,"uniqWith",function(){return ii}),n.d(t,"unless",function(){return ui}),n.d(t,"unnest",function(){return li}),n.d(t,"until",function(){return ci}),n.d(t,"update",function(){return It}),n.d(t,"useWith",function(){return lo}),n.d(t,"values",function(){return se}),n.d(t,"valuesIn",function(){return si}),n.d(t,"view",function(){return pi}),n.d(t,"when",function(){return di}),n.d(t,"where",function(){return yi}),n.d(t,"whereEq",function(){return hi}),n.d(t,"without",function(){return mi}),n.d(t,"xor",function(){return vi}),n.d(t,"xprod",function(){return bi}),n.d(t,"zip",function(){return gi}),n.d(t,"zipObj",function(){return wi}),n.d(t,"zipWith",function(){return Oi}),n.d(t,"thunkify",function(){return Ei})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fixControlledValue=w,t.resolveOnChange=O,t.getInputClassName=E,t.default=void 0;var r=p(n(0)),o=s(n(1)),i=s(n(30)),a=p(n(79)),u=n(6),l=s(n(35)),c=s(n(43));function s(e){return e&&e.__esModule?e:{default:e}}function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function p(e){if(e&&e.__esModule)return e;if(null===e||"object"!==d(e)&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}return n.default=e,t&&t.set(e,n),n}function d(e){"@babel/helpers - typeof";return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return void 0===e||null===e?"":e}function O(e,t,n){if(n){var r=t;if("click"===t.type){(r=Object.create(t)).target=e,r.currentTarget=e;var o=e.value;return e.value="",n(r),void(e.value=o)}n(r)}}function E(e,t,n,r){var i;return(0,o.default)(e,(g(i={},"".concat(e,"-sm"),"small"===t),g(i,"".concat(e,"-lg"),"large"===t),g(i,"".concat(e,"-disabled"),n),g(i,"".concat(e,"-rtl"),"rtl"===r),i))}var S=function(){var e=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(n,r.Component);var t=v(n);function n(e){var u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(u=t.call(this,e)).direction="ltr",u.focus=function(){u.input.focus()},u.saveClearableInput=function(e){u.clearableInput=e},u.saveInput=function(e){u.input=e},u.onFocus=function(e){var t=u.props.onFocus;u.setState({focused:!0}),t&&t(e)},u.onBlur=function(e){var t=u.props.onBlur;u.setState({focused:!1}),t&&t(e)},u.handleReset=function(e){u.setValue("",function(){u.focus()}),O(u.input,e,u.props.onChange)},u.renderInput=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=u.props,l=a.className,c=a.addonBefore,s=a.addonAfter,f=a.size,p=a.disabled,d=(0,i.default)(u.props,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","size","inputType"]);return r.createElement("input",y({autoComplete:n.autoComplete},d,{onChange:u.handleChange,onFocus:u.onFocus,onBlur:u.onBlur,onKeyDown:u.handleKeyDown,className:(0,o.default)(E(e,f||t,p,u.direction),g({},l,l&&!c&&!s)),ref:u.saveInput}))},u.clearPasswordValueAttribute=function(){u.removePasswordTimeout=setTimeout(function(){u.input&&"password"===u.input.getAttribute("type")&&u.input.hasAttribute("value")&&u.input.removeAttribute("value")})},u.handleChange=function(e){u.setValue(e.target.value,u.clearPasswordValueAttribute),O(u.input,e,u.props.onChange)},u.handleKeyDown=function(e){var t=u.props,n=t.onPressEnter,r=t.onKeyDown;13===e.keyCode&&n&&n(e),r&&r(e)},u.renderComponent=function(e){var t=e.getPrefixCls,n=e.direction,o=e.input,i=u.state,c=i.value,s=i.focused,f=t("input",u.props.prefixCls);return u.direction=n,r.createElement(l.default.Consumer,null,function(e){return r.createElement(a.default,y({size:e},u.props,{prefixCls:f,inputType:"input",value:w(c),element:u.renderInput(f,e,o),handleReset:u.handleReset,ref:u.saveClearableInput,direction:n,focused:s,triggerFocus:u.focus}))})};var c=void 0===e.value?e.defaultValue:e.value;return u.state={value:c,focused:!1,prevValue:e.value},u}return function(e,t,n){t&&h(e.prototype,t),n&&h(e,n)}(n,[{key:"componentDidMount",value:function(){this.clearPasswordValueAttribute()}},{key:"componentDidUpdate",value:function(){}},{key:"getSnapshotBeforeUpdate",value:function(e){return(0,a.hasPrefixSuffix)(e)!==(0,a.hasPrefixSuffix)(this.props)&&(0,c.default)(this.input!==document.activeElement,"Input","When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ"),null}},{key:"componentWillUnmount",value:function(){this.removePasswordTimeout&&clearTimeout(this.removePasswordTimeout)}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"setValue",value:function(e,t){void 0===this.props.value&&this.setState({value:e},t)}},{key:"render",value:function(){return r.createElement(u.ConfigConsumer,null,this.renderComponent)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevValue,r={prevValue:e.value};return void 0===e.value&&n===e.value||(r.value=e.value),r}}]),n}();return e.defaultProps={type:"text"},e}();t.default=S},function(e,t,n){"use strict";n.r(t);var r=n(8),o=n.n(r);t.default=function(e,t){for(var n=o()({},e),r=0;r<t.length;r++)delete n[t[r]];return n}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(25);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(17),o=n(21),i=n(100),a=n(27),u=n(19),l=function(e,t,n){var c,s,f,p=e&l.F,d=e&l.G,y=e&l.S,h=e&l.P,m=e&l.B,v=e&l.W,b=d?o:o[t]||(o[t]={}),g=b.prototype,w=d?r:y?r[t]:(r[t]||{}).prototype;for(c in d&&(n=t),n)(s=!p&&w&&void 0!==w[c])&&u(b,c)||(f=s?w[c]:n[c],b[c]=d&&"function"!=typeof w[c]?n[c]:m&&s?i(f,r):v&&w[c]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):h&&"function"==typeof f?i(Function.call,f):f,h&&((b.virtual||(b.virtual={}))[c]=f,e&l.R&&g&&!g[c]&&a(g,c,f)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createAjaxRequest=void 0;var r=n(227),o=function(e,t){return{body:(0,r.stringify)({action:e,nonce:wcmlMultiCurrency.nonce,data:JSON.stringify(t)})}},i={currencyForLang:function(e){var t=e.isEnabled,n=e.currencyCode,r=e.languageCode;return o("wcml_update_currency_lang",{value:t?1:0,code:n,lang:r})},defaultCurrencyForLang:function(e){var t=e.languageCode,n=e.currencyCode;return o("wcml_update_default_currency",{code:n,lang:t})},deleteCurrency:function(e){var t=e.currencyCode;return o("wcml_delete_currency",{code:t})},saveCurrency:function(e){return o("wcml_save_currency",{currency_options:e})},setCurrencyMode:function(e){return o("wcml_set_currency_mode",{mode:e})},setMaxMindKey:function(e){return o("wcml_set_max_mind_key",{MaxMindKey:e})}};t.createAjaxRequest=function(e){if(!i[e])throw new Error("The endpoint "+e+" is not defined");var t=(0,r.createAjax)();return{fetching:t.fetching,send:function(n){return t.doFetch(i[e](n))}}}},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.SizeContextProvider=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var u=o?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(n,a,u):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n(0));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}var a=o.createContext(void 0);t.SizeContextProvider=function(e){var t=e.children,n=e.size;return o.createElement(a.Consumer,null,function(e){return o.createElement(a.Provider,{value:n||e},t)})};var u=a;t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.triggerModeChange=t.triggerActiveCurrenciesChange=t.validateRate=t.getCountryLabel=t.getCurrencySymbol=t.getCurrencyLabel=t.getSmallFormattedPrice=t.getFormattedPricePreview=t.capitalize=void 0;var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(28));t.capitalize=function(e){return e[0].toUpperCase()+e.slice(1)},t.getFormattedPricePreview=function(e){return o("1","234","0")(e)},t.getSmallFormattedPrice=function(e){return o("","99","9")(e)};var o=function(e,t,n){return function(r){var o=i(r.code);return a(e,t,r.position).replace(/__SYMBOL__/,o.symbol).replace(/__THOUSAND_SEP__/,e?r.thousand_sep:"").replace(/__DECIMAL_SEP__/,r.num_decimals>0?r.decimal_sep:"").replace(/__DECIMALS_NUMBER__/,n.repeat(r.num_decimals))}},i=function(e){return wcmlMultiCurrency.allCurrencies.filter(function(t){return t.code===e})[0]},a=(t.getCurrencyLabel=r.pipe(i,r.prop("label")),t.getCurrencySymbol=r.pipe(i,r.prop("symbol")),t.getCountryLabel=r.pipe(function(e){return wcmlMultiCurrency.allCountries.filter(function(t){return t.code===e})[0]},r.prop("label")),function(e,t,n){switch(n){case"left":return"__SYMBOL__"+e+"__THOUSAND_SEP__"+t+"__DECIMAL_SEP____DECIMALS_NUMBER__";case"right":return e+"__THOUSAND_SEP__"+t+"__DECIMAL_SEP____DECIMALS_NUMBER____SYMBOL__";case"left_space":return"__SYMBOL__ "+e+"__THOUSAND_SEP__"+t+"__DECIMAL_SEP____DECIMALS_NUMBER__";case"right_space":return e+"__THOUSAND_SEP__"+t+"__DECIMAL_SEP____DECIMALS_NUMBER__ __SYMBOL__"}});t.validateRate=r.allPass([r.pipe(parseFloat,isNaN,r.not),isFinite,r.gt(r.__,0)]),t.triggerActiveCurrenciesChange=function(e){e.currencyData=i(e.currency.code),document.dispatchEvent(new CustomEvent("wcmlActiveCurrenciesChange",{detail:e}))},t.triggerModeChange=function(e){document.dispatchEvent(new CustomEvent("wcmlCurrencyModeChange"),{detail:e})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=!0},function(e,t,n){var r=n(97),o=n(64);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==l(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n(0)),o=a(n(234)),i=a(n(101));function a(e){return e&&e.__esModule?e:{default:e}}function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function l(e){"@babel/helpers - typeof";return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y=function(){var e=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,r.Component);var t=p(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(n,[{key:"getLocale",value:function(){var e=this.props,t=e.componentName,n=e.defaultLocale||o.default[t||"global"],r=this.context,i=t&&r?r[t]:{};return c(c({},"function"==typeof n?n():n),i||{})}},{key:"getLocaleCode",value:function(){var e=this.context,t=e&&e.locale;return e&&e.exist&&!t?o.default.locale:t}},{key:"render",value:function(){return this.props.children(this.getLocale(),this.getLocaleCode(),this.context)}}]),n}();return e.defaultProps={componentName:"global"},e.contextType=i.default,e}();t.default=y},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"resetWarned",{enumerable:!0,get:function(){return o.resetWarned}}),t.default=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var u=o?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(n,a,u):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n(104));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}t.default=function(e,t,n){(0,o.default)(e,"[antd: ".concat(t,"] ").concat(n))}},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.replaceElement=u,t.cloneElement=function(e,t){return u(e,e,t)},t.isValidElement=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var u=o?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(n,a,u):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n(0));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}var a=o.isValidElement;function u(e,t,n){return a(e)?o.cloneElement(e,"function"==typeof n?n():n):t}t.isValidElement=a},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";
|
13 |
-
/*
|
14 |
-
object-assign
|
15 |
-
(c) Sindre Sorhus
|
16 |
-
@license MIT
|
17 |
-
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,u=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var c in n=Object(arguments[l]))o.call(n,c)&&(u[c]=n[c]);if(r){a=r(n);for(var s=0;s<a.length;s++)i.call(n,a[s])&&(u[a[s]]=n[a[s]])}}return u}},function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=n(3),a=n.n(i),u=n(18),l=n(13),c=n(11),s=n(75),f=n.n(s);function p(e,t,n,r){var o=a.a.unstable_batchedUpdates?function(e){a.a.unstable_batchedUpdates(n,e)}:n;return f()(e,t,o,r)}var d=n(52),y=n(1),h=n.n(y);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var w,O=n(9),E=n.n(O);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var x={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function j(){if(void 0!==w)return w;w="";var e=document.createElement("p").style;for(var t in x)t+"Transform"in e&&(w=t);return w}function C(){return j()?"".concat(j(),"TransitionProperty"):"transitionProperty"}function k(){return j()?"".concat(j(),"Transform"):"transform"}function T(e,t){var n=C();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function M(e,t){var n=k();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var A,N=/matrix\((.*)\)/,R=/matrix3d\((.*)\)/;function D(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function I(e,t,n){var r=n;if("object"!==S(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):A(e,t);for(var o in t)t.hasOwnProperty(o)&&I(e,o,t[o])}function F(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function L(e){return F(e)}function z(e){return F(e,!0)}function V(e){var t=function(e){var t,n,r,o=e.ownerDocument,i=o.body,a=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=a.clientLeft||i.clientLeft||0,top:r-=a.clientTop||i.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=L(r),t.top+=z(r),t}function W(e){return null!==e&&void 0!==e&&e==e.window}function U(e){return W(e)?e.document:9===e.nodeType?e:e.ownerDocument}var H=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),B=/^(top|right|bottom|left)$/,$="currentStyle",q="runtimeStyle",K="left",Y="px";function X(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function Q(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function G(e,t,n){"static"===I(e,"position")&&(e.style.position="relative");var r=-999,o=-999,i=X("left",n),a=X("top",n),u=Q(i),l=Q(a);"left"!==i&&(r=999),"top"!==a&&(o=999);var c="",s=V(e);("left"in t||"top"in t)&&(c=function(e){return e.style.transitionProperty||e.style[C()]}(e)||"",T(e,"none")),"left"in t&&(e.style[u]="",e.style[i]="".concat(r,"px")),"top"in t&&(e.style[l]="",e.style[a]="".concat(o,"px")),D(e);var f=V(e),p={};for(var d in t)if(t.hasOwnProperty(d)){var y=X(d,n),h="left"===d?r:o,m=s[d]-f[d];p[y]=y===d?h+m:h-m}I(e,p),D(e),("left"in t||"top"in t)&&T(e,c);var v={};for(var b in t)if(t.hasOwnProperty(b)){var g=X(b,n),w=t[b]-s[b];v[g]=b===g?p[g]+w:p[g]-w}I(e,v)}function J(e,t){var n=V(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(k());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}(e),o={x:r.x,y:r.y};"left"in t&&(o.x=r.x+t.left-n.left),"top"in t&&(o.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(k());if(r&&"none"!==r){var o,i=r.match(N);i?((o=(i=i[1]).split(",").map(function(e){return parseFloat(e,10)}))[4]=t.x,o[5]=t.y,M(e,"matrix(".concat(o.join(","),")"))):((o=r.match(R)[1].split(",").map(function(e){return parseFloat(e,10)}))[12]=t.x,o[13]=t.y,M(e,"matrix3d(".concat(o.join(","),")")))}else M(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,o)}function Z(e,t){for(var n=0;n<e.length;n++)t(e[n])}function ee(e){return"border-box"===A(e,"boxSizing")}"undefined"!=typeof window&&(A=window.getComputedStyle?function(e,t,n){var r=n,o="",i=U(e);return(r=r||i.defaultView.getComputedStyle(e,null))&&(o=r.getPropertyValue(t)||r[t]),o}:function(e,t){var n=e[$]&&e[$][t];if(H.test(n)&&!B.test(t)){var r=e.style,o=r[K],i=e[q][K];e[q][K]=e[$][K],r[K]="fontSize"===t?"1em":n||0,n=r.pixelLeft+Y,r[K]=o,e[q][K]=i}return""===n?"auto":n});var te=["margin","border","padding"],ne=-1,re=2,oe=1;function ie(e,t,n){var r,o,i,a=0;for(o=0;o<t.length;o++)if(r=t[o])for(i=0;i<n.length;i++){var u=void 0;u="border"===r?"".concat(r).concat(n[i],"Width"):r+n[i],a+=parseFloat(A(e,u))||0}return a}var ae={getParent:function(e){var t=e;do{t=11===t.nodeType&&t.host?t.host:t.parentNode}while(t&&1!==t.nodeType&&9!==t.nodeType);return t}};function ue(e,t,n){var r=n;if(W(e))return"width"===t?ae.viewportWidth(e):ae.viewportHeight(e);if(9===e.nodeType)return"width"===t?ae.docWidth(e):ae.docHeight(e);var o="width"===t?["Left","Right"]:["Top","Bottom"],i="width"===t?e.getBoundingClientRect().width:e.getBoundingClientRect().height,a=(A(e),ee(e)),u=0;(null===i||void 0===i||i<=0)&&(i=void 0,(null===(u=A(e,t))||void 0===u||Number(u)<0)&&(u=e.style[t]||0),u=parseFloat(u)||0),void 0===r&&(r=a?oe:ne);var l=void 0!==i||a,c=i||u;return r===ne?l?c-ie(e,["border","padding"],o):u:l?r===oe?c:c+(r===re?-ie(e,["border"],o):ie(e,["margin"],o)):u+ie(e,te.slice(r),o)}Z(["Width","Height"],function(e){ae["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],ae["viewport".concat(e)](n))},ae["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,o=r.body,i=r.documentElement[n];return"CSS1Compat"===r.compatMode&&i||o&&o[n]||i}});var le={position:"absolute",visibility:"hidden",display:"block"};function ce(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=t[0];return 0!==o.offsetWidth?r=ue.apply(void 0,t):function(e,t,n){var r,o={},i=e.style;for(r in t)t.hasOwnProperty(r)&&(o[r]=i[r],i[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(i[r]=o[r])}(o,le,function(){r=ue.apply(void 0,t)}),r}function se(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}Z(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);ae["outer".concat(t)]=function(t,n){return t&&ce(t,e,n?0:oe)};var n="width"===e?["Left","Right"]:["Top","Bottom"];ae[e]=function(t,r){var o=r;if(void 0===o)return t&&ce(t,e,ne);if(t){A(t);return ee(t)&&(o+=ie(t,["padding","border"],n)),I(t,e,o)}}});var fe={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:U,offset:function(e,t,n){if(void 0===t)return V(e);!function(e,t,n){if(n.ignoreShake){var r=V(e),o=r.left.toFixed(0),i=r.top.toFixed(0),a=t.left.toFixed(0),u=t.top.toFixed(0);if(o===a&&i===u)return}n.useCssRight||n.useCssBottom?G(e,t,n):n.useCssTransform&&k()in document.body.style?J(e,t):G(e,t,n)}(e,t,n||{})},isWindow:W,each:Z,css:I,clone:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(e.overflow)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:se,getWindowScrollLeft:function(e){return L(e)},getWindowScrollTop:function(e){return z(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)fe.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};se(fe,ae);var pe=fe.getParent;function de(e){if(fe.isWindow(e)||9===e.nodeType)return null;var t,n=fe.getDocument(e).body,r=fe.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:pe(e);for(t=pe(e);t&&t!==n&&9!==t.nodeType;t=pe(t))if("static"!==(r=fe.css(t,"position")))return t;return null}var ye=fe.getParent;function he(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=de(e),o=fe.getDocument(e),i=o.defaultView||o.parentWindow,a=o.body,u=o.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===u||"visible"===fe.css(r,"overflow")){if(r===a||r===u)break}else{var l=fe.offset(r);l.left+=r.clientLeft,l.top+=r.clientTop,n.top=Math.max(n.top,l.top),n.right=Math.min(n.right,l.left+r.clientWidth),n.bottom=Math.min(n.bottom,l.top+r.clientHeight),n.left=Math.max(n.left,l.left)}r=de(r)}var c=null;fe.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===fe.css(e,"position")&&(e.style.position="fixed"));var s=fe.getWindowScrollLeft(i),f=fe.getWindowScrollTop(i),p=fe.viewportWidth(i),d=fe.viewportHeight(i),y=u.scrollWidth,h=u.scrollHeight,m=window.getComputedStyle(a);if("hidden"===m.overflowX&&(y=i.innerWidth),"hidden"===m.overflowY&&(h=i.innerHeight),e.style&&(e.style.position=c),t||function(e){if(fe.isWindow(e)||9===e.nodeType)return!1;var t=fe.getDocument(e).body,n=null;for(n=ye(e);n&&n!==t;n=ye(n))if("fixed"===fe.css(n,"position"))return!0;return!1}(e))n.left=Math.max(n.left,s),n.top=Math.max(n.top,f),n.right=Math.min(n.right,s+p),n.bottom=Math.min(n.bottom,f+d);else{var v=Math.max(y,s+p);n.right=Math.min(n.right,v);var b=Math.max(h,f+d);n.bottom=Math.min(n.bottom,b)}return n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function me(e){var t,n,r;if(fe.isWindow(e)||9===e.nodeType){var o=fe.getWindow(e);t={left:fe.getWindowScrollLeft(o),top:fe.getWindowScrollTop(o)},n=fe.viewportWidth(o),r=fe.viewportHeight(o)}else t=fe.offset(e),n=fe.outerWidth(e),r=fe.outerHeight(e);return t.width=n,t.height=r,t}function ve(e,t){var n=t.charAt(0),r=t.charAt(1),o=e.width,i=e.height,a=e.left,u=e.top;return"c"===n?u+=i/2:"b"===n&&(u+=i),"c"===r?a+=o/2:"r"===r&&(a+=o),{left:a,top:u}}function be(e,t,n,r,o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|