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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 / template-classes / class-wcml-troubleshooting-ui.php
woocommerce-multilingual / inc / template-classes Last commit date
currency-switcher 4 weeks ago multi-currency 4 weeks ago setup 4 weeks ago status 4 weeks ago store-urls 4 weeks ago class-wcml-currencies-dropdown-ui.php 5 years ago class-wcml-custom-files-ui.php 4 weeks ago class-wcml-languages-upgrade-notice.php 4 years ago class-wcml-menus-wrap-base.php 4 weeks ago class-wcml-menus-wrap.php 4 weeks ago class-wcml-multilingual-ui.php 9 months ago class-wcml-not-translatable-attributes.php 4 weeks ago class-wcml-pointer-ui.php 1 year ago class-wcml-removed-cart-items-ui.php 4 weeks ago class-wcml-settings-ui.php 4 weeks ago class-wcml-st-taxonomy-ui.php 11 months ago class-wcml-sync-taxonomy.php 4 weeks ago class-wcml-templates-factory.php 4 weeks ago class-wcml-troubleshooting-ui.php 4 weeks ago
class-wcml-troubleshooting-ui.php
155 lines
1 <?php
2
3 use WCML\Reviews\Translations\FrontEndHooks;
4 use WCML\Utilities\AdminUrl;
5
6 class WCML_Troubleshooting_UI extends WCML_Templates_Factory {
7
8 private $woocommerce_wpml;
9
10 public function __construct( $woocommerce_wpml ) {
11 parent::__construct();
12
13 $this->woocommerce_wpml = $woocommerce_wpml;
14 }
15
16
17 public function get_model() {
18
19 $translatedProductTypeTerms = WCML_Install::translated_product_type_terms();
20 $wcmlSettings = print_r( get_option( '_wcml_settings', [] ), true );
21 $wpmlElementSyncSettingsFaxctory = new WPML_Element_Sync_Settings_Factory();
22
23 $model = [
24 'header' => [
25 'title' => __( 'Troubleshooting', 'woocommerce-multilingual' ),
26 'warning' => __( 'Please make a backup of your database before using these tools', 'woocommerce-multilingual' ),
27 ],
28 'status' => [
29 'title' => __( 'Status', 'woocommerce-multilingual' ),
30 'items' => [
31 /* translators: The placeholder is the number of products. */
32 'total' => sprintf( __( 'There are <strong>%s product(s)</strong> in total.', 'woocommerce-multilingual' ), $this->woocommerce_wpml->troubleshooting->countProducts() ),
33 /* translators: The placeholder is the number of products. */
34 'variable' => sprintf( __( 'There are <strong>%s product(s)</strong> with variations.', 'woocommerce-multilingual' ), $this->woocommerce_wpml->troubleshooting->countVariableProducts() ),
35 /* translators: The placeholder is the number of products. */
36 'variations' => sprintf( __( 'There are <strong>%s variation(s)</strong> in total.', 'woocommerce-multilingual' ), $this->woocommerce_wpml->troubleshooting->countVariations() ),
37 ],
38 ],
39 'synchronizeData' => [
40 'title' => __( 'Synchronize data into translations', 'woocommerce-multilingual' ),
41 'items' => [
42 'variations' => __( 'Synchronize product variations', 'woocommerce-multilingual' ),
43 'gallery' => __( 'Synchronize products image galleries', 'woocommerce-multilingual' ),
44 'categoriesMetadata' => __( 'Synchronize metadata for product categories (display type, thumbnail)', 'woocommerce-multilingual' ),
45 'stock' => __( 'Synchronize stock for products and product variations', 'woocommerce-multilingual' ),
46 ],
47 'galleryEnable' => $wpmlElementSyncSettingsFaxctory->create( 'post' )->is_sync( 'attachment' ),
48 ],
49 'connect' => [
50 'title' => __( 'Fix multilingual information', 'woocommerce-multilingual' ),
51 'items' => [
52 'variations' => __( 'Fix incorrect or missing translation links for product variations', 'woocommerce-multilingual' ),
53 ],
54 ],
55 'taxonomies' => [
56 'title' => __( 'Fix product taxonomies', 'woocommerce-multilingual' ),
57 'items' => [
58 'productType' => __( 'Set product types as not translatable and delete unwanted translations', 'woocommerce-multilingual' ),
59 'attributes' => __( 'Create missing translations for product attributes:', 'woocommerce-multilingual' ),
60 ],
61 'productTypeEnable' => ! empty( $translatedProductTypeTerms ),
62 'link' => sprintf(
63 /* translators: %1$s and %2$s are opening and closing HTML link tags */
64 esc_html__( 'To translate product taxonomies, go to the %1$sTaxonomy Translation%2$s page.', 'woocommerce-multilingual' ),
65 '<a href="' . esc_url( AdminUrl::getWPMLTaxonomyTranslation() ) . '">',
66 '</a>'
67 ),
68 'data' => [
69 'attributes' => $this->get_all_products_taxonomies(),
70 'none' => __( 'none', 'woocommerce-multilingual' ),
71 ]
72 ],
73 'reviews' => [
74 'title' => __( 'Fix missing product reviews', 'woocommerce-multilingual' ),
75 'items' => [
76 'register' => __( 'Allow to translate missing product reviews', 'woocommerce-multilingual' ),
77 ],
78 'reviewsEnable' => apply_filters( FrontEndHooks::HOOK_ENABLE, true ),
79 'link' => sprintf(
80 /* translators: %1$s and %2$s are opening and closing HTML link tags */
81 esc_html__( 'To translate product reviews, go to the %1$sTranslation Dashboard%2$s.', 'woocommerce-multilingual' ),
82 '<a href="' . esc_url( AdminUrl::getWPMLTMDashboardStringDomain( FrontEndHooks::CONTEXT ) ) . '">',
83 '</a>'
84 ),
85 ],
86 'cleanup' => [
87 'title' => __( 'Cleanup tools', 'woocommerce-multilingual' ),
88 'items' => [
89 'orphanedMeta' => __( 'Remove unused custom fields from product and variation translations', 'woocommerce-multilingual' ),
90 ],
91 ],
92 'run' => [
93 'start' => __( 'Run the selected tools', 'woocommerce-multilingual' ),
94 'running' => __( 'Processing', 'woocommerce-multilingual' ),
95 ],
96 'settings' => [
97 'title' => __( 'WPML Multilingual & Multicurrency for WooCommerce settings', 'woocommerce-multilingual' ),
98 'data' => esc_html( $wcmlSettings ),
99 ],
100 'counter' => sprintf(
101 /* translators: The placeholder is the number of processed items. */
102 __( '%s items processed', 'woocommerce-multilingual' ),
103 '<span class="count"></span>'
104 ),
105 'doing' => __( 'Processing...', 'woocommerce-multilingual' ),
106 'done' => __( 'Completed', 'woocommerce-multilingual' ),
107 'error' => __( 'Something went wrong, please reload the page and try again', 'woocommerce-multilingual' ),
108 'nonces' => [
109 'trbl_sync_variations' => wp_nonce_field( 'trbl_sync_variations', 'trbl_sync_variations_nonce', true, false ),
110 'trbl_gallery_images' => wp_nonce_field( 'trbl_gallery_images', 'trbl_gallery_images_nonce', true, false ),
111 'trbl_sync_categories' => wp_nonce_field( 'trbl_sync_categories', 'trbl_sync_categories_nonce', true, false ),
112 'trbl_duplicate_terms' => wp_nonce_field( 'trbl_duplicate_terms', 'trbl_duplicate_terms_nonce', true, false ),
113 'trbl_product_type_terms' => wp_nonce_field( 'trbl_product_type_terms', 'trbl_product_type_terms_nonce', true, false ),
114 'trbl_sync_stock' => wp_nonce_field( 'trbl_sync_stock', 'trbl_sync_stock_nonce', true, false ),
115 'fix_relationships' => wp_nonce_field( 'fix_relationships', 'fix_relationships_nonce', true, false ),
116 'sync_deleted_meta' => wp_nonce_field( 'sync_deleted_meta', 'sync_deleted_meta_nonce', true, false ),
117 'register_reviews_in_st' => wp_nonce_field( 'register_reviews_in_st', 'register_reviews_in_st_nonce', true, false ),
118 ],
119 ];
120
121 return $model;
122 }
123
124 public function get_all_products_taxonomies() {
125
126 $all_products_taxonomies = get_taxonomies( [ 'object_type' => [ 'product' ] ], 'objects' );
127 unset(
128 $all_products_taxonomies['product_type'],
129 $all_products_taxonomies['product_cat'],
130 $all_products_taxonomies['product_tag']
131 );
132
133 foreach ( $all_products_taxonomies as $key => $taxonomy ) {
134 if ( is_taxonomy_translated( $key ) ) {
135 $all_products_taxonomies[ $key ]->tax_key = $key;
136 } else {
137 unset( $all_products_taxonomies[ $key ] );
138 }
139 }
140
141 return $all_products_taxonomies;
142
143 }
144
145 public function init_template_base_dir() {
146 $this->template_paths = [
147 WCML_PLUGIN_PATH . '/templates/',
148 ];
149 }
150
151 public function get_template() {
152 return 'troubleshooting.twig';
153 }
154 }
155