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 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.9.0 4.9.1 5.0.1 5.0.2 5.1.1 5.1.2 5.1.3 5.2.0 5.2.1 5.3.2 5.3.3.1 5.3.4 5.3.5 5.3.6 5.3.7
woocommerce-multilingual / inc / class-wcml-requests.php
woocommerce-multilingual / inc Last commit date
admin-menus 2 weeks ago currencies 2 weeks ago template-classes 2 weeks ago translation-editor 2 weeks ago class-wcml-ajax-setup.php 2 weeks ago class-wcml-attributes.php 2 weeks ago class-wcml-capabilities.php 2 weeks ago class-wcml-cart-removed-items-widget.php 1 year ago class-wcml-cart-switch-lang-functions.php 2 weeks ago class-wcml-cart-sync-warnings.php 2 weeks ago class-wcml-cart.php 2 weeks ago class-wcml-comments.php 2 weeks ago class-wcml-compatibility.php 2 weeks ago class-wcml-coupons.php 2 weeks ago class-wcml-dependencies.php 2 weeks ago class-wcml-emails.php 2 weeks ago class-wcml-endpoints.php 2 weeks ago class-wcml-install.php 2 weeks ago class-wcml-languages-upgrader.php 2 weeks ago class-wcml-locale.php 2 weeks ago class-wcml-orders.php 2 weeks ago class-wcml-products-screen-options.php 2 weeks ago class-wcml-products.php 2 weeks ago class-wcml-reports.php 2 weeks ago class-wcml-requests.php 2 weeks ago class-wcml-resources.php 2 weeks ago class-wcml-store-pages.php 2 weeks ago class-wcml-terms.php 2 weeks ago class-wcml-tp-support.php 2 weeks ago class-wcml-troubleshooting.php 2 weeks ago class-wcml-upgrade.php 2 weeks ago class-wcml-url-translation.php 2 weeks ago class-wcml-wc-gateways.php 2 weeks ago class-wcml-wc-shipping.php 2 weeks ago class-wcml-wc-strings.php 2 weeks ago class-wcml-widgets.php 2 weeks ago constants.php 2 weeks ago functions-pure.php 2 weeks ago functions.php 2 weeks ago installer-loader.php 2 weeks ago missing-php-functions.php 2 weeks ago wcml-core-functions.php 2 weeks ago wcml-switch-lang-request.php 2 weeks ago
class-wcml-requests.php
106 lines
1 <?php
2 class WCML_Requests {
3
4 public function __construct() {
5
6 add_action( 'init', [ $this, 'run' ] );
7
8 }
9
10 public function run() {
11 global $woocommerce_wpml;
12
13 $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
14 $settings_needs_update = false;
15
16 if ( isset( $_GET['wcml_action'] ) ) {
17 $settings_needs_update = true;
18
19 if ( 'dismiss' === $_GET['wcml_action'] ) {
20 $woocommerce_wpml->settings['dismiss_doc_main'] = 1;
21 } elseif ( 'dismiss_tm_warning' === $_GET['wcml_action'] ) {
22 $woocommerce_wpml->settings['dismiss_tm_warning'] = 1;
23 } elseif ( 'dismiss_cart_warning' === $_GET['wcml_action'] ) {
24 $woocommerce_wpml->settings['dismiss_cart_warning'] = 1;
25 } else {
26 $settings_needs_update = false;
27 }
28 }
29
30 if ( isset( $_POST['wcml_save_settings'] ) && wp_verify_nonce( $nonce, 'wcml_save_settings_nonce' ) ) {
31 global $sitepress,$sitepress_settings;
32
33 if ( isset( $_POST['trnsl_interface'] ) ) {
34 $woocommerce_wpml->settings['trnsl_interface'] = filter_input( INPUT_POST, 'trnsl_interface', FILTER_SANITIZE_NUMBER_INT );
35 }
36
37 $woocommerce_wpml->settings['products_sync_date'] = empty( $_POST['products_sync_date'] ) ? 0 : 1;
38 $woocommerce_wpml->settings['products_sync_order'] = empty( $_POST['products_sync_order'] ) ? 0 : 1;
39
40 $wcml_sync_media = empty( $_POST['sync_media'] ) ? 0 : 1;
41 $woocommerce_wpml->update_setting( 'sync_media', $wcml_sync_media, true );
42
43 $reviews_in_all_languages = ! empty( $_POST['reviews_in_all_languages'] );
44 $woocommerce_wpml->update_setting( 'reviews_in_all_languages', $reviews_in_all_languages, true );
45
46 $wcml_file_path_sync = filter_input( INPUT_POST, 'wcml_file_path_sync', FILTER_SANITIZE_NUMBER_INT );
47
48 $woocommerce_wpml->settings[ \WCML_Downloadable_Products::SYNC_MODE_SETTING_KEY ] = $wcml_file_path_sync;
49
50 if ( isset( $_POST['cart_sync_lang'] ) && isset( $_POST['cart_sync_currencies'] ) ) {
51 $woocommerce_wpml->settings['cart_sync']['lang_switch'] = (int) filter_input( INPUT_POST, 'cart_sync_lang', FILTER_SANITIZE_NUMBER_INT );
52 $woocommerce_wpml->settings['cart_sync']['currency_switch'] = (int) filter_input( INPUT_POST, 'cart_sync_currencies', FILTER_SANITIZE_NUMBER_INT );
53 }
54
55 $new_value = $wcml_file_path_sync == 0 ? 2 : $wcml_file_path_sync;
56 $sitepress_settings['translation-management']['custom_fields_translation']['_downloadable_files'] = $new_value;
57 $sitepress_settings['translation-management']['custom_fields_translation']['_file_paths'] = $new_value;
58
59 $sitepress->save_settings( $sitepress_settings );
60
61 $message = [
62 'id' => 'wcml-settings-saved',
63 'text' => __( 'Your settings have been saved.', 'woocommerce-multilingual' ),
64 'group' => 'wcml-settings',
65 'admin_notice' => true,
66 'limit_to_page' => true,
67 'classes' => [ 'updated', 'notice', 'notice-success' ],
68 'show_once' => true,
69 ];
70 ICL_AdminNotifier::add_message( $message );
71
72 $settings_needs_update = true;
73 }
74
75 if ( $settings_needs_update ) {
76 $woocommerce_wpml->update_settings();
77 }
78
79 add_action( 'wp_ajax_wcml_ignore_warning', [ $this, 'update_settings_from_warning' ] );
80
81 add_filter( 'woocommerce_cached_widget_id', [ $this, 'override_cached_widget_id' ] );
82 }
83
84 public function update_settings_from_warning() {
85 $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
86 if ( ! $nonce || ! wp_verify_nonce( $nonce, 'wcml_ignore_warning' ) ) {
87 die( 'Invalid nonce' );
88 }
89 global $woocommerce_wpml;
90
91 $woocommerce_wpml->settings[ $_POST['setting'] ] = 1;
92 $woocommerce_wpml->update_settings();
93
94 }
95
96 public function override_cached_widget_id( $widget_id ) {
97
98 if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
99 $widget_id .= ':' . ICL_LANGUAGE_CODE;
100 }
101
102 return $widget_id;
103 }
104
105 }
106