Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-notes.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+    exit;
10 10
 }
11 11
 
12 12
 /**
@@ -14,22 +14,22 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class WC_Meta_Box_Order_Notes {
16 16
 
17
-	/**
18
-	 * Output the metabox.
19
-	 *
20
-	 * @param WP_Post $post Post object.
21
-	 */
22
-	public static function output( $post ) {
23
-		global $post;
17
+    /**
18
+     * Output the metabox.
19
+     *
20
+     * @param WP_Post $post Post object.
21
+     */
22
+    public static function output( $post ) {
23
+        global $post;
24 24
 
25
-		$args = array(
26
-			'order_id' => $post->ID,
27
-		);
25
+        $args = array(
26
+            'order_id' => $post->ID,
27
+        );
28 28
 
29
-		$notes = wc_get_order_notes( $args );
29
+        $notes = wc_get_order_notes( $args );
30 30
 
31
-		include __DIR__ . '/views/html-order-notes.php';
32
-		?>
31
+        include __DIR__ . '/views/html-order-notes.php';
32
+        ?>
33 33
 		<div class="add_note">
34 34
 			<p>
35 35
 				<label for="add_order_note"><?php esc_html_e( 'Add note', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce' ) ); ?></label>
@@ -45,5 +45,5 @@  discard block
 block discarded – undo
45 45
 			</p>
46 46
 		</div>
47 47
 		<?php
48
-	}
48
+    }
49 49
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WooCommerce\Admin\Meta Boxes
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
@@ -19,29 +19,29 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @param WP_Post $post Post object.
21 21
 	 */
22
-	public static function output( $post ) {
22
+	public static function output($post) {
23 23
 		global $post;
24 24
 
25 25
 		$args = array(
26 26
 			'order_id' => $post->ID,
27 27
 		);
28 28
 
29
-		$notes = wc_get_order_notes( $args );
29
+		$notes = wc_get_order_notes($args);
30 30
 
31 31
 		include __DIR__ . '/views/html-order-notes.php';
32 32
 		?>
33 33
 		<div class="add_note">
34 34
 			<p>
35
-				<label for="add_order_note"><?php esc_html_e( 'Add note', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce' ) ); ?></label>
35
+				<label for="add_order_note"><?php esc_html_e('Add note', 'woocommerce'); ?> <?php echo wc_help_tip(__('Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce')); ?></label>
36 36
 				<textarea type="text" name="order_note" id="add_order_note" class="input-text" cols="20" rows="5"></textarea>
37 37
 			</p>
38 38
 			<p>
39
-				<label for="order_note_type" class="screen-reader-text"><?php esc_html_e( 'Note type', 'woocommerce' ); ?></label>
39
+				<label for="order_note_type" class="screen-reader-text"><?php esc_html_e('Note type', 'woocommerce'); ?></label>
40 40
 				<select name="order_note_type" id="order_note_type">
41
-					<option value=""><?php esc_html_e( 'Private note', 'woocommerce' ); ?></option>
42
-					<option value="customer"><?php esc_html_e( 'Note to customer', 'woocommerce' ); ?></option>
41
+					<option value=""><?php esc_html_e('Private note', 'woocommerce'); ?></option>
42
+					<option value="customer"><?php esc_html_e('Note to customer', 'woocommerce'); ?></option>
43 43
 				</select>
44
-				<button type="button" class="add_note button"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
44
+				<button type="button" class="add_note button"><?php esc_html_e('Add', 'woocommerce'); ?></button>
45 45
 			</p>
46 46
 		</div>
47 47
 		<?php
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-data.php 2 patches
Indentation   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 if ( ! defined( 'ABSPATH' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 /**
@@ -17,552 +17,552 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WC_Meta_Box_Product_Data {
19 19
 
20
-	/**
21
-	 * Output the metabox.
22
-	 *
23
-	 * @param WP_Post $post Post object.
24
-	 */
25
-	public static function output( $post ) {
26
-		global $thepostid, $product_object;
27
-
28
-		$thepostid      = $post->ID;
29
-		$product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
30
-
31
-		wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
32
-
33
-		include __DIR__ . '/views/html-product-data-panel.php';
34
-	}
35
-
36
-	/**
37
-	 * Show tab content/settings.
38
-	 */
39
-	private static function output_tabs() {
40
-		global $post, $thepostid, $product_object;
41
-
42
-		include __DIR__ . '/views/html-product-data-general.php';
43
-		include __DIR__ . '/views/html-product-data-inventory.php';
44
-		include __DIR__ . '/views/html-product-data-shipping.php';
45
-		include __DIR__ . '/views/html-product-data-linked-products.php';
46
-		include __DIR__ . '/views/html-product-data-attributes.php';
47
-		include __DIR__ . '/views/html-product-data-advanced.php';
48
-	}
49
-
50
-	/**
51
-	 * Return array of product type options.
52
-	 *
53
-	 * @return array
54
-	 */
55
-	private static function get_product_type_options() {
56
-		return apply_filters(
57
-			'product_type_options',
58
-			array(
59
-				'virtual'      => array(
60
-					'id'            => '_virtual',
61
-					'wrapper_class' => 'show_if_simple',
62
-					'label'         => __( 'Virtual', 'woocommerce' ),
63
-					'description'   => __( 'Virtual products are intangible and are not shipped.', 'woocommerce' ),
64
-					'default'       => 'no',
65
-				),
66
-				'downloadable' => array(
67
-					'id'            => '_downloadable',
68
-					'wrapper_class' => 'show_if_simple',
69
-					'label'         => __( 'Downloadable', 'woocommerce' ),
70
-					'description'   => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
71
-					'default'       => 'no',
72
-				),
73
-			)
74
-		);
75
-	}
76
-
77
-	/**
78
-	 * Return array of tabs to show.
79
-	 *
80
-	 * @return array
81
-	 */
82
-	private static function get_product_data_tabs() {
83
-		$tabs = apply_filters(
84
-			'woocommerce_product_data_tabs',
85
-			array(
86
-				'general'        => array(
87
-					'label'    => __( 'General', 'woocommerce' ),
88
-					'target'   => 'general_product_data',
89
-					'class'    => array( 'hide_if_grouped' ),
90
-					'priority' => 10,
91
-				),
92
-				'inventory'      => array(
93
-					'label'    => __( 'Inventory', 'woocommerce' ),
94
-					'target'   => 'inventory_product_data',
95
-					'class'    => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
96
-					'priority' => 20,
97
-				),
98
-				'shipping'       => array(
99
-					'label'    => __( 'Shipping', 'woocommerce' ),
100
-					'target'   => 'shipping_product_data',
101
-					'class'    => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
102
-					'priority' => 30,
103
-				),
104
-				'linked_product' => array(
105
-					'label'    => __( 'Linked Products', 'woocommerce' ),
106
-					'target'   => 'linked_product_data',
107
-					'class'    => array(),
108
-					'priority' => 40,
109
-				),
110
-				'attribute'      => array(
111
-					'label'    => __( 'Attributes', 'woocommerce' ),
112
-					'target'   => 'product_attributes',
113
-					'class'    => array(),
114
-					'priority' => 50,
115
-				),
116
-				'variations'     => array(
117
-					'label'    => __( 'Variations', 'woocommerce' ),
118
-					'target'   => 'variable_product_options',
119
-					'class'    => array( 'show_if_variable' ),
120
-					'priority' => 60,
121
-				),
122
-				'advanced'       => array(
123
-					'label'    => __( 'Advanced', 'woocommerce' ),
124
-					'target'   => 'advanced_product_data',
125
-					'class'    => array(),
126
-					'priority' => 70,
127
-				),
128
-			)
129
-		);
130
-
131
-		// Sort tabs based on priority.
132
-		uasort( $tabs, array( __CLASS__, 'product_data_tabs_sort' ) );
133
-
134
-		return $tabs;
135
-	}
136
-
137
-	/**
138
-	 * Callback to sort product data tabs on priority.
139
-	 *
140
-	 * @since 3.1.0
141
-	 * @param int $a First item.
142
-	 * @param int $b Second item.
143
-	 *
144
-	 * @return bool
145
-	 */
146
-	private static function product_data_tabs_sort( $a, $b ) {
147
-		if ( ! isset( $a['priority'], $b['priority'] ) ) {
148
-			return -1;
149
-		}
150
-
151
-		if ( $a['priority'] === $b['priority'] ) {
152
-			return 0;
153
-		}
154
-
155
-		return $a['priority'] < $b['priority'] ? -1 : 1;
156
-	}
157
-
158
-	/**
159
-	 * Filter callback for finding variation attributes.
160
-	 *
161
-	 * @param  WC_Product_Attribute $attribute Product attribute.
162
-	 * @return bool
163
-	 */
164
-	private static function filter_variation_attributes( $attribute ) {
165
-		return true === $attribute->get_variation();
166
-	}
167
-
168
-	/**
169
-	 * Show options for the variable product type.
170
-	 */
171
-	public static function output_variations() {
172
-		global $post, $wpdb, $product_object;
173
-
174
-		$variation_attributes   = array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_variation_attributes' ) );
175
-		$default_attributes     = $product_object->get_default_attributes();
176
-		$variations_count       = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID ) ), $post->ID ) );
177
-		$variations_per_page    = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
178
-		$variations_total_pages = ceil( $variations_count / $variations_per_page );
179
-
180
-		include __DIR__ . '/views/html-product-data-variations.php';
181
-	}
182
-
183
-	/**
184
-	 * Prepare downloads for save.
185
-	 *
186
-	 * @param array $file_names File names.
187
-	 * @param array $file_urls File urls.
188
-	 * @param array $file_hashes File hashes.
189
-	 *
190
-	 * @return array
191
-	 */
192
-	private static function prepare_downloads( $file_names, $file_urls, $file_hashes ) {
193
-		$downloads = array();
194
-
195
-		if ( ! empty( $file_urls ) ) {
196
-			$file_url_size = count( $file_urls );
197
-
198
-			for ( $i = 0; $i < $file_url_size; $i ++ ) {
199
-				if ( ! empty( $file_urls[ $i ] ) ) {
200
-					$downloads[] = array(
201
-						'name'        => wc_clean( $file_names[ $i ] ),
202
-						'file'        => wp_unslash( trim( $file_urls[ $i ] ) ),
203
-						'download_id' => wc_clean( $file_hashes[ $i ] ),
204
-					);
205
-				}
206
-			}
207
-		}
208
-		return $downloads;
209
-	}
210
-
211
-	/**
212
-	 * Prepare children for save.
213
-	 *
214
-	 * @return array
215
-	 */
216
-	private static function prepare_children() {
217
-		return isset( $_POST['grouped_products'] ) ? array_filter( array_map( 'intval', (array) $_POST['grouped_products'] ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing
218
-	}
219
-
220
-	/**
221
-	 * Prepare attributes for save.
222
-	 *
223
-	 * @param array $data Attribute data.
224
-	 *
225
-	 * @return array
226
-	 */
227
-	public static function prepare_attributes( $data = false ) {
228
-		$attributes = array();
229
-
230
-		if ( ! $data ) {
231
-			$data = stripslashes_deep( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
232
-		}
233
-
234
-		if ( isset( $data['attribute_names'], $data['attribute_values'] ) ) {
235
-			$attribute_names         = $data['attribute_names'];
236
-			$attribute_values        = $data['attribute_values'];
237
-			$attribute_visibility    = isset( $data['attribute_visibility'] ) ? $data['attribute_visibility'] : array();
238
-			$attribute_variation     = isset( $data['attribute_variation'] ) ? $data['attribute_variation'] : array();
239
-			$attribute_position      = $data['attribute_position'];
240
-			$attribute_names_max_key = max( array_keys( $attribute_names ) );
241
-
242
-			for ( $i = 0; $i <= $attribute_names_max_key; $i++ ) {
243
-				if ( empty( $attribute_names[ $i ] ) || ! isset( $attribute_values[ $i ] ) ) {
244
-					continue;
245
-				}
246
-				$attribute_id   = 0;
247
-				$attribute_name = wc_clean( esc_html( $attribute_names[ $i ] ) );
248
-
249
-				if ( 'pa_' === substr( $attribute_name, 0, 3 ) ) {
250
-					$attribute_id = wc_attribute_taxonomy_id_by_name( $attribute_name );
251
-				}
252
-
253
-				$options = isset( $attribute_values[ $i ] ) ? $attribute_values[ $i ] : '';
254
-
255
-				if ( is_array( $options ) ) {
256
-					// Term ids sent as array.
257
-					$options = wp_parse_id_list( $options );
258
-				} else {
259
-					// Terms or text sent in textarea.
260
-					$options = 0 < $attribute_id ? wc_sanitize_textarea( esc_html( wc_sanitize_term_text_based( $options ) ) ) : wc_sanitize_textarea( esc_html( $options ) );
261
-					$options = wc_get_text_attributes( $options );
262
-				}
263
-
264
-				if ( empty( $options ) ) {
265
-					continue;
266
-				}
267
-
268
-				$attribute = new WC_Product_Attribute();
269
-				$attribute->set_id( $attribute_id );
270
-				$attribute->set_name( $attribute_name );
271
-				$attribute->set_options( $options );
272
-				$attribute->set_position( $attribute_position[ $i ] );
273
-				$attribute->set_visible( isset( $attribute_visibility[ $i ] ) );
274
-				$attribute->set_variation( isset( $attribute_variation[ $i ] ) );
275
-				$attributes[] = apply_filters( 'woocommerce_admin_meta_boxes_prepare_attribute', $attribute, $data, $i );
276
-			}
277
-		}
278
-		return $attributes;
279
-	}
280
-
281
-	/**
282
-	 * Prepare attributes for a specific variation or defaults.
283
-	 *
284
-	 * @param  array  $all_attributes List of attribute keys.
285
-	 * @param  string $key_prefix Attribute key prefix.
286
-	 * @param  int    $index Attribute array index.
287
-	 * @return array
288
-	 */
289
-	private static function prepare_set_attributes( $all_attributes, $key_prefix = 'attribute_', $index = null ) {
290
-		$attributes = array();
291
-
292
-		if ( $all_attributes ) {
293
-			foreach ( $all_attributes as $attribute ) {
294
-				if ( $attribute->get_variation() ) {
295
-					$attribute_key = sanitize_title( $attribute->get_name() );
296
-
297
-					if ( ! is_null( $index ) ) {
298
-						$value = isset( $_POST[ $key_prefix . $attribute_key ][ $index ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ][ $index ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
299
-					} else {
300
-						$value = isset( $_POST[ $key_prefix . $attribute_key ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
301
-					}
302
-
303
-					if ( $attribute->is_taxonomy() ) {
304
-						// Don't use wc_clean as it destroys sanitized characters.
305
-						$value = sanitize_title( $value );
306
-					} else {
307
-						$value = html_entity_decode( wc_clean( $value ), ENT_QUOTES, get_bloginfo( 'charset' ) ); // WPCS: sanitization ok.
308
-					}
309
-
310
-					$attributes[ $attribute_key ] = $value;
311
-				}
312
-			}
313
-		}
314
-
315
-		return $attributes;
316
-	}
317
-
318
-	/**
319
-	 * Save meta box data.
320
-	 *
321
-	 * @param int     $post_id WP post id.
322
-	 * @param WP_Post $post Post object.
323
-	 */
324
-	public static function save( $post_id, $post ) {
325
-		// phpcs:disable WordPress.Security.NonceVerification.Missing
326
-		// Process product type first so we have the correct class to run setters.
327
-		$product_type = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( wp_unslash( $_POST['product-type'] ) );
328
-		$classname    = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
329
-		$product      = new $classname( $post_id );
330
-		$attributes   = self::prepare_attributes();
331
-		$stock        = null;
332
-
333
-		// Handle stock changes.
334
-		if ( isset( $_POST['_stock'] ) ) {
335
-			if ( isset( $_POST['_original_stock'] ) && wc_stock_amount( $product->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['_original_stock'] ) ) ) {
336
-				/* translators: 1: product ID 2: quantity in stock */
337
-				WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $product->get_id(), $product->get_stock_quantity( 'edit' ) ) );
338
-			} else {
339
-				$stock = wc_stock_amount( wp_unslash( $_POST['_stock'] ) );
340
-			}
341
-		}
342
-
343
-		// Handle dates.
344
-		$date_on_sale_from = '';
345
-		$date_on_sale_to   = '';
346
-
347
-		// Force date from to beginning of day.
348
-		if ( isset( $_POST['_sale_price_dates_from'] ) ) {
349
-			$date_on_sale_from = wc_clean( wp_unslash( $_POST['_sale_price_dates_from'] ) );
350
-
351
-			if ( ! empty( $date_on_sale_from ) ) {
352
-				$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
353
-			}
354
-		}
355
-
356
-		// Force date to to the end of the day.
357
-		if ( isset( $_POST['_sale_price_dates_to'] ) ) {
358
-			$date_on_sale_to = wc_clean( wp_unslash( $_POST['_sale_price_dates_to'] ) );
359
-
360
-			if ( ! empty( $date_on_sale_to ) ) {
361
-				$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
362
-			}
363
-		}
364
-
365
-		$errors = $product->set_props(
366
-			array(
367
-				'sku'                => isset( $_POST['_sku'] ) ? wc_clean( wp_unslash( $_POST['_sku'] ) ) : null,
368
-				'purchase_note'      => isset( $_POST['_purchase_note'] ) ? wp_kses_post( wp_unslash( $_POST['_purchase_note'] ) ) : '',
369
-				'downloadable'       => isset( $_POST['_downloadable'] ),
370
-				'virtual'            => isset( $_POST['_virtual'] ),
371
-				'featured'           => isset( $_POST['_featured'] ),
372
-				'catalog_visibility' => isset( $_POST['_visibility'] ) ? wc_clean( wp_unslash( $_POST['_visibility'] ) ) : null,
373
-				'tax_status'         => isset( $_POST['_tax_status'] ) ? wc_clean( wp_unslash( $_POST['_tax_status'] ) ) : null,
374
-				'tax_class'          => isset( $_POST['_tax_class'] ) ? sanitize_title( wp_unslash( $_POST['_tax_class'] ) ) : null,
375
-				'weight'             => isset( $_POST['_weight'] ) ? wc_clean( wp_unslash( $_POST['_weight'] ) ) : null,
376
-				'length'             => isset( $_POST['_length'] ) ? wc_clean( wp_unslash( $_POST['_length'] ) ) : null,
377
-				'width'              => isset( $_POST['_width'] ) ? wc_clean( wp_unslash( $_POST['_width'] ) ) : null,
378
-				'height'             => isset( $_POST['_height'] ) ? wc_clean( wp_unslash( $_POST['_height'] ) ) : null,
379
-				'shipping_class_id'  => isset( $_POST['product_shipping_class'] ) ? absint( wp_unslash( $_POST['product_shipping_class'] ) ) : null,
380
-				'sold_individually'  => ! empty( $_POST['_sold_individually'] ),
381
-				'upsell_ids'         => isset( $_POST['upsell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['upsell_ids'] ) ) : array(),
382
-				'cross_sell_ids'     => isset( $_POST['crosssell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['crosssell_ids'] ) ) : array(),
383
-				'regular_price'      => isset( $_POST['_regular_price'] ) ? wc_clean( wp_unslash( $_POST['_regular_price'] ) ) : null,
384
-				'sale_price'         => isset( $_POST['_sale_price'] ) ? wc_clean( wp_unslash( $_POST['_sale_price'] ) ) : null,
385
-				'date_on_sale_from'  => $date_on_sale_from,
386
-				'date_on_sale_to'    => $date_on_sale_to,
387
-				'manage_stock'       => ! empty( $_POST['_manage_stock'] ),
388
-				'backorders'         => isset( $_POST['_backorders'] ) ? wc_clean( wp_unslash( $_POST['_backorders'] ) ) : null,
389
-				'stock_status'       => isset( $_POST['_stock_status'] ) ? wc_clean( wp_unslash( $_POST['_stock_status'] ) ) : null,
390
-				'stock_quantity'     => $stock,
391
-				'low_stock_amount'   => isset( $_POST['_low_stock_amount'] ) && '' !== $_POST['_low_stock_amount'] ? wc_stock_amount( wp_unslash( $_POST['_low_stock_amount'] ) ) : '',
392
-				'download_limit'     => isset( $_POST['_download_limit'] ) && '' !== $_POST['_download_limit'] ? absint( wp_unslash( $_POST['_download_limit'] ) ) : '',
393
-				'download_expiry'    => isset( $_POST['_download_expiry'] ) && '' !== $_POST['_download_expiry'] ? absint( wp_unslash( $_POST['_download_expiry'] ) ) : '',
394
-				// Those are sanitized inside prepare_downloads.
395
-				'downloads'          => self::prepare_downloads(
396
-					isset( $_POST['_wc_file_names'] ) ? wp_unslash( $_POST['_wc_file_names'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
397
-					isset( $_POST['_wc_file_urls'] ) ? wp_unslash( $_POST['_wc_file_urls'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
398
-					isset( $_POST['_wc_file_hashes'] ) ? wp_unslash( $_POST['_wc_file_hashes'] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
399
-				),
400
-				'product_url'        => isset( $_POST['_product_url'] ) ? esc_url_raw( wp_unslash( $_POST['_product_url'] ) ) : '',
401
-				'button_text'        => isset( $_POST['_button_text'] ) ? wc_clean( wp_unslash( $_POST['_button_text'] ) ) : '',
402
-				'children'           => 'grouped' === $product_type ? self::prepare_children() : null,
403
-				'reviews_allowed'    => ! empty( $_POST['comment_status'] ) && 'open' === $_POST['comment_status'],
404
-				'attributes'         => $attributes,
405
-				'default_attributes' => self::prepare_set_attributes( $attributes, 'default_attribute_' ),
406
-			)
407
-		);
408
-
409
-		if ( is_wp_error( $errors ) ) {
410
-			WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
411
-		}
412
-
413
-		/**
414
-		 * Set props before save.
415
-		 *
416
-		 * @since 3.0.0
417
-		 */
418
-		do_action( 'woocommerce_admin_process_product_object', $product );
419
-
420
-		$product->save();
421
-
422
-		if ( $product->is_type( 'variable' ) ) {
423
-			$original_post_title = isset( $_POST['original_post_title'] ) ? wc_clean( wp_unslash( $_POST['original_post_title'] ) ) : '';
424
-			$post_title          = isset( $_POST['post_title'] ) ? wc_clean( wp_unslash( $_POST['post_title'] ) ) : '';
425
-
426
-			$product->get_data_store()->sync_variation_names( $product, $original_post_title, $post_title );
427
-		}
428
-
429
-		do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );
430
-		// phpcs:enable WordPress.Security.NonceVerification.Missing
431
-	}
432
-
433
-	/**
434
-	 * Save variation meta box data.
435
-	 *
436
-	 * @param int     $post_id WP post id.
437
-	 * @param WP_Post $post Post object.
438
-	 */
439
-	public static function save_variations( $post_id, $post ) {
440
-		global $wpdb;
441
-
442
-		// phpcs:disable WordPress.Security.NonceVerification.Missing
443
-		if ( isset( $_POST['variable_post_id'] ) ) {
444
-			$parent = wc_get_product( $post_id );
445
-			$parent->set_default_attributes( self::prepare_set_attributes( $parent->get_attributes(), 'default_attribute_' ) );
446
-			$parent->save();
447
-
448
-			$max_loop   = max( array_keys( wp_unslash( $_POST['variable_post_id'] ) ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
449
-			$data_store = $parent->get_data_store();
450
-			$data_store->sort_all_product_variations( $parent->get_id() );
451
-			$new_variation_menu_order_id = ! empty( $_POST['new_variation_menu_order_id'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_id'] ) ) : false;
452
-			$new_variation_menu_order_value = ! empty( $_POST['new_variation_menu_order_value'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_value'] ) ) : false;
453
-
454
-			// Only perform this operation if setting menu order via the prompt.
455
-			if ( $new_variation_menu_order_id && $new_variation_menu_order_value ) {
456
-				/*
20
+    /**
21
+     * Output the metabox.
22
+     *
23
+     * @param WP_Post $post Post object.
24
+     */
25
+    public static function output( $post ) {
26
+        global $thepostid, $product_object;
27
+
28
+        $thepostid      = $post->ID;
29
+        $product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
30
+
31
+        wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
32
+
33
+        include __DIR__ . '/views/html-product-data-panel.php';
34
+    }
35
+
36
+    /**
37
+     * Show tab content/settings.
38
+     */
39
+    private static function output_tabs() {
40
+        global $post, $thepostid, $product_object;
41
+
42
+        include __DIR__ . '/views/html-product-data-general.php';
43
+        include __DIR__ . '/views/html-product-data-inventory.php';
44
+        include __DIR__ . '/views/html-product-data-shipping.php';
45
+        include __DIR__ . '/views/html-product-data-linked-products.php';
46
+        include __DIR__ . '/views/html-product-data-attributes.php';
47
+        include __DIR__ . '/views/html-product-data-advanced.php';
48
+    }
49
+
50
+    /**
51
+     * Return array of product type options.
52
+     *
53
+     * @return array
54
+     */
55
+    private static function get_product_type_options() {
56
+        return apply_filters(
57
+            'product_type_options',
58
+            array(
59
+                'virtual'      => array(
60
+                    'id'            => '_virtual',
61
+                    'wrapper_class' => 'show_if_simple',
62
+                    'label'         => __( 'Virtual', 'woocommerce' ),
63
+                    'description'   => __( 'Virtual products are intangible and are not shipped.', 'woocommerce' ),
64
+                    'default'       => 'no',
65
+                ),
66
+                'downloadable' => array(
67
+                    'id'            => '_downloadable',
68
+                    'wrapper_class' => 'show_if_simple',
69
+                    'label'         => __( 'Downloadable', 'woocommerce' ),
70
+                    'description'   => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
71
+                    'default'       => 'no',
72
+                ),
73
+            )
74
+        );
75
+    }
76
+
77
+    /**
78
+     * Return array of tabs to show.
79
+     *
80
+     * @return array
81
+     */
82
+    private static function get_product_data_tabs() {
83
+        $tabs = apply_filters(
84
+            'woocommerce_product_data_tabs',
85
+            array(
86
+                'general'        => array(
87
+                    'label'    => __( 'General', 'woocommerce' ),
88
+                    'target'   => 'general_product_data',
89
+                    'class'    => array( 'hide_if_grouped' ),
90
+                    'priority' => 10,
91
+                ),
92
+                'inventory'      => array(
93
+                    'label'    => __( 'Inventory', 'woocommerce' ),
94
+                    'target'   => 'inventory_product_data',
95
+                    'class'    => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
96
+                    'priority' => 20,
97
+                ),
98
+                'shipping'       => array(
99
+                    'label'    => __( 'Shipping', 'woocommerce' ),
100
+                    'target'   => 'shipping_product_data',
101
+                    'class'    => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
102
+                    'priority' => 30,
103
+                ),
104
+                'linked_product' => array(
105
+                    'label'    => __( 'Linked Products', 'woocommerce' ),
106
+                    'target'   => 'linked_product_data',
107
+                    'class'    => array(),
108
+                    'priority' => 40,
109
+                ),
110
+                'attribute'      => array(
111
+                    'label'    => __( 'Attributes', 'woocommerce' ),
112
+                    'target'   => 'product_attributes',
113
+                    'class'    => array(),
114
+                    'priority' => 50,
115
+                ),
116
+                'variations'     => array(
117
+                    'label'    => __( 'Variations', 'woocommerce' ),
118
+                    'target'   => 'variable_product_options',
119
+                    'class'    => array( 'show_if_variable' ),
120
+                    'priority' => 60,
121
+                ),
122
+                'advanced'       => array(
123
+                    'label'    => __( 'Advanced', 'woocommerce' ),
124
+                    'target'   => 'advanced_product_data',
125
+                    'class'    => array(),
126
+                    'priority' => 70,
127
+                ),
128
+            )
129
+        );
130
+
131
+        // Sort tabs based on priority.
132
+        uasort( $tabs, array( __CLASS__, 'product_data_tabs_sort' ) );
133
+
134
+        return $tabs;
135
+    }
136
+
137
+    /**
138
+     * Callback to sort product data tabs on priority.
139
+     *
140
+     * @since 3.1.0
141
+     * @param int $a First item.
142
+     * @param int $b Second item.
143
+     *
144
+     * @return bool
145
+     */
146
+    private static function product_data_tabs_sort( $a, $b ) {
147
+        if ( ! isset( $a['priority'], $b['priority'] ) ) {
148
+            return -1;
149
+        }
150
+
151
+        if ( $a['priority'] === $b['priority'] ) {
152
+            return 0;
153
+        }
154
+
155
+        return $a['priority'] < $b['priority'] ? -1 : 1;
156
+    }
157
+
158
+    /**
159
+     * Filter callback for finding variation attributes.
160
+     *
161
+     * @param  WC_Product_Attribute $attribute Product attribute.
162
+     * @return bool
163
+     */
164
+    private static function filter_variation_attributes( $attribute ) {
165
+        return true === $attribute->get_variation();
166
+    }
167
+
168
+    /**
169
+     * Show options for the variable product type.
170
+     */
171
+    public static function output_variations() {
172
+        global $post, $wpdb, $product_object;
173
+
174
+        $variation_attributes   = array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_variation_attributes' ) );
175
+        $default_attributes     = $product_object->get_default_attributes();
176
+        $variations_count       = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID ) ), $post->ID ) );
177
+        $variations_per_page    = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
178
+        $variations_total_pages = ceil( $variations_count / $variations_per_page );
179
+
180
+        include __DIR__ . '/views/html-product-data-variations.php';
181
+    }
182
+
183
+    /**
184
+     * Prepare downloads for save.
185
+     *
186
+     * @param array $file_names File names.
187
+     * @param array $file_urls File urls.
188
+     * @param array $file_hashes File hashes.
189
+     *
190
+     * @return array
191
+     */
192
+    private static function prepare_downloads( $file_names, $file_urls, $file_hashes ) {
193
+        $downloads = array();
194
+
195
+        if ( ! empty( $file_urls ) ) {
196
+            $file_url_size = count( $file_urls );
197
+
198
+            for ( $i = 0; $i < $file_url_size; $i ++ ) {
199
+                if ( ! empty( $file_urls[ $i ] ) ) {
200
+                    $downloads[] = array(
201
+                        'name'        => wc_clean( $file_names[ $i ] ),
202
+                        'file'        => wp_unslash( trim( $file_urls[ $i ] ) ),
203
+                        'download_id' => wc_clean( $file_hashes[ $i ] ),
204
+                    );
205
+                }
206
+            }
207
+        }
208
+        return $downloads;
209
+    }
210
+
211
+    /**
212
+     * Prepare children for save.
213
+     *
214
+     * @return array
215
+     */
216
+    private static function prepare_children() {
217
+        return isset( $_POST['grouped_products'] ) ? array_filter( array_map( 'intval', (array) $_POST['grouped_products'] ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing
218
+    }
219
+
220
+    /**
221
+     * Prepare attributes for save.
222
+     *
223
+     * @param array $data Attribute data.
224
+     *
225
+     * @return array
226
+     */
227
+    public static function prepare_attributes( $data = false ) {
228
+        $attributes = array();
229
+
230
+        if ( ! $data ) {
231
+            $data = stripslashes_deep( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
232
+        }
233
+
234
+        if ( isset( $data['attribute_names'], $data['attribute_values'] ) ) {
235
+            $attribute_names         = $data['attribute_names'];
236
+            $attribute_values        = $data['attribute_values'];
237
+            $attribute_visibility    = isset( $data['attribute_visibility'] ) ? $data['attribute_visibility'] : array();
238
+            $attribute_variation     = isset( $data['attribute_variation'] ) ? $data['attribute_variation'] : array();
239
+            $attribute_position      = $data['attribute_position'];
240
+            $attribute_names_max_key = max( array_keys( $attribute_names ) );
241
+
242
+            for ( $i = 0; $i <= $attribute_names_max_key; $i++ ) {
243
+                if ( empty( $attribute_names[ $i ] ) || ! isset( $attribute_values[ $i ] ) ) {
244
+                    continue;
245
+                }
246
+                $attribute_id   = 0;
247
+                $attribute_name = wc_clean( esc_html( $attribute_names[ $i ] ) );
248
+
249
+                if ( 'pa_' === substr( $attribute_name, 0, 3 ) ) {
250
+                    $attribute_id = wc_attribute_taxonomy_id_by_name( $attribute_name );
251
+                }
252
+
253
+                $options = isset( $attribute_values[ $i ] ) ? $attribute_values[ $i ] : '';
254
+
255
+                if ( is_array( $options ) ) {
256
+                    // Term ids sent as array.
257
+                    $options = wp_parse_id_list( $options );
258
+                } else {
259
+                    // Terms or text sent in textarea.
260
+                    $options = 0 < $attribute_id ? wc_sanitize_textarea( esc_html( wc_sanitize_term_text_based( $options ) ) ) : wc_sanitize_textarea( esc_html( $options ) );
261
+                    $options = wc_get_text_attributes( $options );
262
+                }
263
+
264
+                if ( empty( $options ) ) {
265
+                    continue;
266
+                }
267
+
268
+                $attribute = new WC_Product_Attribute();
269
+                $attribute->set_id( $attribute_id );
270
+                $attribute->set_name( $attribute_name );
271
+                $attribute->set_options( $options );
272
+                $attribute->set_position( $attribute_position[ $i ] );
273
+                $attribute->set_visible( isset( $attribute_visibility[ $i ] ) );
274
+                $attribute->set_variation( isset( $attribute_variation[ $i ] ) );
275
+                $attributes[] = apply_filters( 'woocommerce_admin_meta_boxes_prepare_attribute', $attribute, $data, $i );
276
+            }
277
+        }
278
+        return $attributes;
279
+    }
280
+
281
+    /**
282
+     * Prepare attributes for a specific variation or defaults.
283
+     *
284
+     * @param  array  $all_attributes List of attribute keys.
285
+     * @param  string $key_prefix Attribute key prefix.
286
+     * @param  int    $index Attribute array index.
287
+     * @return array
288
+     */
289
+    private static function prepare_set_attributes( $all_attributes, $key_prefix = 'attribute_', $index = null ) {
290
+        $attributes = array();
291
+
292
+        if ( $all_attributes ) {
293
+            foreach ( $all_attributes as $attribute ) {
294
+                if ( $attribute->get_variation() ) {
295
+                    $attribute_key = sanitize_title( $attribute->get_name() );
296
+
297
+                    if ( ! is_null( $index ) ) {
298
+                        $value = isset( $_POST[ $key_prefix . $attribute_key ][ $index ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ][ $index ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
299
+                    } else {
300
+                        $value = isset( $_POST[ $key_prefix . $attribute_key ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
301
+                    }
302
+
303
+                    if ( $attribute->is_taxonomy() ) {
304
+                        // Don't use wc_clean as it destroys sanitized characters.
305
+                        $value = sanitize_title( $value );
306
+                    } else {
307
+                        $value = html_entity_decode( wc_clean( $value ), ENT_QUOTES, get_bloginfo( 'charset' ) ); // WPCS: sanitization ok.
308
+                    }
309
+
310
+                    $attributes[ $attribute_key ] = $value;
311
+                }
312
+            }
313
+        }
314
+
315
+        return $attributes;
316
+    }
317
+
318
+    /**
319
+     * Save meta box data.
320
+     *
321
+     * @param int     $post_id WP post id.
322
+     * @param WP_Post $post Post object.
323
+     */
324
+    public static function save( $post_id, $post ) {
325
+        // phpcs:disable WordPress.Security.NonceVerification.Missing
326
+        // Process product type first so we have the correct class to run setters.
327
+        $product_type = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( wp_unslash( $_POST['product-type'] ) );
328
+        $classname    = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
329
+        $product      = new $classname( $post_id );
330
+        $attributes   = self::prepare_attributes();
331
+        $stock        = null;
332
+
333
+        // Handle stock changes.
334
+        if ( isset( $_POST['_stock'] ) ) {
335
+            if ( isset( $_POST['_original_stock'] ) && wc_stock_amount( $product->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['_original_stock'] ) ) ) {
336
+                /* translators: 1: product ID 2: quantity in stock */
337
+                WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $product->get_id(), $product->get_stock_quantity( 'edit' ) ) );
338
+            } else {
339
+                $stock = wc_stock_amount( wp_unslash( $_POST['_stock'] ) );
340
+            }
341
+        }
342
+
343
+        // Handle dates.
344
+        $date_on_sale_from = '';
345
+        $date_on_sale_to   = '';
346
+
347
+        // Force date from to beginning of day.
348
+        if ( isset( $_POST['_sale_price_dates_from'] ) ) {
349
+            $date_on_sale_from = wc_clean( wp_unslash( $_POST['_sale_price_dates_from'] ) );
350
+
351
+            if ( ! empty( $date_on_sale_from ) ) {
352
+                $date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
353
+            }
354
+        }
355
+
356
+        // Force date to to the end of the day.
357
+        if ( isset( $_POST['_sale_price_dates_to'] ) ) {
358
+            $date_on_sale_to = wc_clean( wp_unslash( $_POST['_sale_price_dates_to'] ) );
359
+
360
+            if ( ! empty( $date_on_sale_to ) ) {
361
+                $date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
362
+            }
363
+        }
364
+
365
+        $errors = $product->set_props(
366
+            array(
367
+                'sku'                => isset( $_POST['_sku'] ) ? wc_clean( wp_unslash( $_POST['_sku'] ) ) : null,
368
+                'purchase_note'      => isset( $_POST['_purchase_note'] ) ? wp_kses_post( wp_unslash( $_POST['_purchase_note'] ) ) : '',
369
+                'downloadable'       => isset( $_POST['_downloadable'] ),
370
+                'virtual'            => isset( $_POST['_virtual'] ),
371
+                'featured'           => isset( $_POST['_featured'] ),
372
+                'catalog_visibility' => isset( $_POST['_visibility'] ) ? wc_clean( wp_unslash( $_POST['_visibility'] ) ) : null,
373
+                'tax_status'         => isset( $_POST['_tax_status'] ) ? wc_clean( wp_unslash( $_POST['_tax_status'] ) ) : null,
374
+                'tax_class'          => isset( $_POST['_tax_class'] ) ? sanitize_title( wp_unslash( $_POST['_tax_class'] ) ) : null,
375
+                'weight'             => isset( $_POST['_weight'] ) ? wc_clean( wp_unslash( $_POST['_weight'] ) ) : null,
376
+                'length'             => isset( $_POST['_length'] ) ? wc_clean( wp_unslash( $_POST['_length'] ) ) : null,
377
+                'width'              => isset( $_POST['_width'] ) ? wc_clean( wp_unslash( $_POST['_width'] ) ) : null,
378
+                'height'             => isset( $_POST['_height'] ) ? wc_clean( wp_unslash( $_POST['_height'] ) ) : null,
379
+                'shipping_class_id'  => isset( $_POST['product_shipping_class'] ) ? absint( wp_unslash( $_POST['product_shipping_class'] ) ) : null,
380
+                'sold_individually'  => ! empty( $_POST['_sold_individually'] ),
381
+                'upsell_ids'         => isset( $_POST['upsell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['upsell_ids'] ) ) : array(),
382
+                'cross_sell_ids'     => isset( $_POST['crosssell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['crosssell_ids'] ) ) : array(),
383
+                'regular_price'      => isset( $_POST['_regular_price'] ) ? wc_clean( wp_unslash( $_POST['_regular_price'] ) ) : null,
384
+                'sale_price'         => isset( $_POST['_sale_price'] ) ? wc_clean( wp_unslash( $_POST['_sale_price'] ) ) : null,
385
+                'date_on_sale_from'  => $date_on_sale_from,
386
+                'date_on_sale_to'    => $date_on_sale_to,
387
+                'manage_stock'       => ! empty( $_POST['_manage_stock'] ),
388
+                'backorders'         => isset( $_POST['_backorders'] ) ? wc_clean( wp_unslash( $_POST['_backorders'] ) ) : null,
389
+                'stock_status'       => isset( $_POST['_stock_status'] ) ? wc_clean( wp_unslash( $_POST['_stock_status'] ) ) : null,
390
+                'stock_quantity'     => $stock,
391
+                'low_stock_amount'   => isset( $_POST['_low_stock_amount'] ) && '' !== $_POST['_low_stock_amount'] ? wc_stock_amount( wp_unslash( $_POST['_low_stock_amount'] ) ) : '',
392
+                'download_limit'     => isset( $_POST['_download_limit'] ) && '' !== $_POST['_download_limit'] ? absint( wp_unslash( $_POST['_download_limit'] ) ) : '',
393
+                'download_expiry'    => isset( $_POST['_download_expiry'] ) && '' !== $_POST['_download_expiry'] ? absint( wp_unslash( $_POST['_download_expiry'] ) ) : '',
394
+                // Those are sanitized inside prepare_downloads.
395
+                'downloads'          => self::prepare_downloads(
396
+                    isset( $_POST['_wc_file_names'] ) ? wp_unslash( $_POST['_wc_file_names'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
397
+                    isset( $_POST['_wc_file_urls'] ) ? wp_unslash( $_POST['_wc_file_urls'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
398
+                    isset( $_POST['_wc_file_hashes'] ) ? wp_unslash( $_POST['_wc_file_hashes'] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
399
+                ),
400
+                'product_url'        => isset( $_POST['_product_url'] ) ? esc_url_raw( wp_unslash( $_POST['_product_url'] ) ) : '',
401
+                'button_text'        => isset( $_POST['_button_text'] ) ? wc_clean( wp_unslash( $_POST['_button_text'] ) ) : '',
402
+                'children'           => 'grouped' === $product_type ? self::prepare_children() : null,
403
+                'reviews_allowed'    => ! empty( $_POST['comment_status'] ) && 'open' === $_POST['comment_status'],
404
+                'attributes'         => $attributes,
405
+                'default_attributes' => self::prepare_set_attributes( $attributes, 'default_attribute_' ),
406
+            )
407
+        );
408
+
409
+        if ( is_wp_error( $errors ) ) {
410
+            WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
411
+        }
412
+
413
+        /**
414
+         * Set props before save.
415
+         *
416
+         * @since 3.0.0
417
+         */
418
+        do_action( 'woocommerce_admin_process_product_object', $product );
419
+
420
+        $product->save();
421
+
422
+        if ( $product->is_type( 'variable' ) ) {
423
+            $original_post_title = isset( $_POST['original_post_title'] ) ? wc_clean( wp_unslash( $_POST['original_post_title'] ) ) : '';
424
+            $post_title          = isset( $_POST['post_title'] ) ? wc_clean( wp_unslash( $_POST['post_title'] ) ) : '';
425
+
426
+            $product->get_data_store()->sync_variation_names( $product, $original_post_title, $post_title );
427
+        }
428
+
429
+        do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );
430
+        // phpcs:enable WordPress.Security.NonceVerification.Missing
431
+    }
432
+
433
+    /**
434
+     * Save variation meta box data.
435
+     *
436
+     * @param int     $post_id WP post id.
437
+     * @param WP_Post $post Post object.
438
+     */
439
+    public static function save_variations( $post_id, $post ) {
440
+        global $wpdb;
441
+
442
+        // phpcs:disable WordPress.Security.NonceVerification.Missing
443
+        if ( isset( $_POST['variable_post_id'] ) ) {
444
+            $parent = wc_get_product( $post_id );
445
+            $parent->set_default_attributes( self::prepare_set_attributes( $parent->get_attributes(), 'default_attribute_' ) );
446
+            $parent->save();
447
+
448
+            $max_loop   = max( array_keys( wp_unslash( $_POST['variable_post_id'] ) ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
449
+            $data_store = $parent->get_data_store();
450
+            $data_store->sort_all_product_variations( $parent->get_id() );
451
+            $new_variation_menu_order_id = ! empty( $_POST['new_variation_menu_order_id'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_id'] ) ) : false;
452
+            $new_variation_menu_order_value = ! empty( $_POST['new_variation_menu_order_value'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_value'] ) ) : false;
453
+
454
+            // Only perform this operation if setting menu order via the prompt.
455
+            if ( $new_variation_menu_order_id && $new_variation_menu_order_value ) {
456
+                /*
457 457
 				 * We need to gather all the variations with menu order that is
458 458
 				 * equal or greater than the menu order that is newly set and
459 459
 				 * increment them by one so that we can correctly insert the updated
460 460
 				 * variation menu order.
461 461
 				 */
462
-				$wpdb->query(
463
-					$wpdb->prepare(
464
-						"UPDATE {$wpdb->posts} SET menu_order = menu_order + 1 WHERE post_type = 'product_variation' AND post_parent = %d AND post_status = 'publish' AND menu_order >= %d AND ID != %d",
465
-						$post_id,
466
-						$new_variation_menu_order_value,
467
-						$new_variation_menu_order_id
468
-					)
469
-				);
470
-			}
471
-
472
-			for ( $i = 0; $i <= $max_loop; $i++ ) {
473
-
474
-				if ( ! isset( $_POST['variable_post_id'][ $i ] ) ) {
475
-					continue;
476
-				}
477
-				$variation_id = absint( $_POST['variable_post_id'][ $i ] );
478
-				$variation    = wc_get_product_object( 'variation', $variation_id );
479
-				$stock        = null;
480
-
481
-				// Handle stock changes.
482
-				if ( isset( $_POST['variable_stock'], $_POST['variable_stock'][ $i ] ) ) {
483
-					if ( isset( $_POST['variable_original_stock'], $_POST['variable_original_stock'][ $i ] ) && wc_stock_amount( $variation->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['variable_original_stock'][ $i ] ) ) ) {
484
-						/* translators: 1: product ID 2: quantity in stock */
485
-						WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $variation->get_id(), $variation->get_stock_quantity( 'edit' ) ) );
486
-					} else {
487
-						$stock = wc_stock_amount( wp_unslash( $_POST['variable_stock'][ $i ] ) );
488
-					}
489
-				}
490
-
491
-				// Handle dates.
492
-				$date_on_sale_from = '';
493
-				$date_on_sale_to   = '';
494
-
495
-				// Force date from to beginning of day.
496
-				if ( isset( $_POST['variable_sale_price_dates_from'][ $i ] ) ) {
497
-					$date_on_sale_from = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_from'][ $i ] ) );
498
-
499
-					if ( ! empty( $date_on_sale_from ) ) {
500
-						$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
501
-					}
502
-				}
503
-
504
-				// Force date to to the end of the day.
505
-				if ( isset( $_POST['variable_sale_price_dates_to'][ $i ] ) ) {
506
-					$date_on_sale_to = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_to'][ $i ] ) );
507
-
508
-					if ( ! empty( $date_on_sale_to ) ) {
509
-						$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
510
-					}
511
-				}
512
-
513
-				$errors = $variation->set_props(
514
-					array(
515
-						'status'            => isset( $_POST['variable_enabled'][ $i ] ) ? 'publish' : 'private',
516
-						'menu_order'        => isset( $_POST['variation_menu_order'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variation_menu_order'][ $i ] ) ) : null,
517
-						'regular_price'     => isset( $_POST['variable_regular_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_regular_price'][ $i ] ) ) : null,
518
-						'sale_price'        => isset( $_POST['variable_sale_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sale_price'][ $i ] ) ) : null,
519
-						'virtual'           => isset( $_POST['variable_is_virtual'][ $i ] ),
520
-						'downloadable'      => isset( $_POST['variable_is_downloadable'][ $i ] ),
521
-						'date_on_sale_from' => $date_on_sale_from,
522
-						'date_on_sale_to'   => $date_on_sale_to,
523
-						'description'       => isset( $_POST['variable_description'][ $i ] ) ? wp_kses_post( wp_unslash( $_POST['variable_description'][ $i ] ) ) : null,
524
-						'download_limit'    => isset( $_POST['variable_download_limit'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_limit'][ $i ] ) ) : null,
525
-						'download_expiry'   => isset( $_POST['variable_download_expiry'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_expiry'][ $i ] ) ) : null,
526
-						// Those are sanitized inside prepare_downloads.
527
-						'downloads'         => self::prepare_downloads(
528
-							isset( $_POST['_wc_variation_file_names'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_names'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
529
-							isset( $_POST['_wc_variation_file_urls'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_urls'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
530
-							isset( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
531
-						),
532
-						'manage_stock'      => isset( $_POST['variable_manage_stock'][ $i ] ),
533
-						'stock_quantity'    => $stock,
534
-						'low_stock_amount'  => isset( $_POST['variable_low_stock_amount'][ $i ] ) && '' !== $_POST['variable_low_stock_amount'][ $i ] ? wc_stock_amount( wp_unslash( $_POST['variable_low_stock_amount'][ $i ] ) ) : '',
535
-						'backorders'        => isset( $_POST['variable_backorders'], $_POST['variable_backorders'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_backorders'][ $i ] ) ) : null,
536
-						'stock_status'      => isset( $_POST['variable_stock_status'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_stock_status'][ $i ] ) ) : null,
537
-						'image_id'          => isset( $_POST['upload_image_id'][ $i ] ) ? wc_clean( wp_unslash( $_POST['upload_image_id'][ $i ] ) ) : null,
538
-						'attributes'        => self::prepare_set_attributes( $parent->get_attributes(), 'attribute_', $i ),
539
-						'sku'               => isset( $_POST['variable_sku'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sku'][ $i ] ) ) : '',
540
-						'weight'            => isset( $_POST['variable_weight'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_weight'][ $i ] ) ) : '',
541
-						'length'            => isset( $_POST['variable_length'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_length'][ $i ] ) ) : '',
542
-						'width'             => isset( $_POST['variable_width'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_width'][ $i ] ) ) : '',
543
-						'height'            => isset( $_POST['variable_height'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_height'][ $i ] ) ) : '',
544
-						'shipping_class_id' => isset( $_POST['variable_shipping_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_shipping_class'][ $i ] ) ) : null,
545
-						'tax_class'         => isset( $_POST['variable_tax_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
546
-					)
547
-				);
548
-
549
-				if ( is_wp_error( $errors ) ) {
550
-					WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
551
-				}
552
-
553
-				/**
554
-				 * Set variation props before save.
555
-				 *
556
-				 * @param object $variation WC_Product_Variation object.
557
-				 * @param int $i
558
-				 * @since 3.8.0
559
-				 */
560
-				do_action( 'woocommerce_admin_process_variation_object', $variation, $i );
561
-
562
-				$variation->save();
563
-				do_action( 'woocommerce_save_product_variation', $variation_id, $i );
564
-			}
565
-		}
566
-		// phpcs:enable WordPress.Security.NonceVerification.Missing
567
-	}
462
+                $wpdb->query(
463
+                    $wpdb->prepare(
464
+                        "UPDATE {$wpdb->posts} SET menu_order = menu_order + 1 WHERE post_type = 'product_variation' AND post_parent = %d AND post_status = 'publish' AND menu_order >= %d AND ID != %d",
465
+                        $post_id,
466
+                        $new_variation_menu_order_value,
467
+                        $new_variation_menu_order_id
468
+                    )
469
+                );
470
+            }
471
+
472
+            for ( $i = 0; $i <= $max_loop; $i++ ) {
473
+
474
+                if ( ! isset( $_POST['variable_post_id'][ $i ] ) ) {
475
+                    continue;
476
+                }
477
+                $variation_id = absint( $_POST['variable_post_id'][ $i ] );
478
+                $variation    = wc_get_product_object( 'variation', $variation_id );
479
+                $stock        = null;
480
+
481
+                // Handle stock changes.
482
+                if ( isset( $_POST['variable_stock'], $_POST['variable_stock'][ $i ] ) ) {
483
+                    if ( isset( $_POST['variable_original_stock'], $_POST['variable_original_stock'][ $i ] ) && wc_stock_amount( $variation->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['variable_original_stock'][ $i ] ) ) ) {
484
+                        /* translators: 1: product ID 2: quantity in stock */
485
+                        WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $variation->get_id(), $variation->get_stock_quantity( 'edit' ) ) );
486
+                    } else {
487
+                        $stock = wc_stock_amount( wp_unslash( $_POST['variable_stock'][ $i ] ) );
488
+                    }
489
+                }
490
+
491
+                // Handle dates.
492
+                $date_on_sale_from = '';
493
+                $date_on_sale_to   = '';
494
+
495
+                // Force date from to beginning of day.
496
+                if ( isset( $_POST['variable_sale_price_dates_from'][ $i ] ) ) {
497
+                    $date_on_sale_from = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_from'][ $i ] ) );
498
+
499
+                    if ( ! empty( $date_on_sale_from ) ) {
500
+                        $date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
501
+                    }
502
+                }
503
+
504
+                // Force date to to the end of the day.
505
+                if ( isset( $_POST['variable_sale_price_dates_to'][ $i ] ) ) {
506
+                    $date_on_sale_to = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_to'][ $i ] ) );
507
+
508
+                    if ( ! empty( $date_on_sale_to ) ) {
509
+                        $date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
510
+                    }
511
+                }
512
+
513
+                $errors = $variation->set_props(
514
+                    array(
515
+                        'status'            => isset( $_POST['variable_enabled'][ $i ] ) ? 'publish' : 'private',
516
+                        'menu_order'        => isset( $_POST['variation_menu_order'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variation_menu_order'][ $i ] ) ) : null,
517
+                        'regular_price'     => isset( $_POST['variable_regular_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_regular_price'][ $i ] ) ) : null,
518
+                        'sale_price'        => isset( $_POST['variable_sale_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sale_price'][ $i ] ) ) : null,
519
+                        'virtual'           => isset( $_POST['variable_is_virtual'][ $i ] ),
520
+                        'downloadable'      => isset( $_POST['variable_is_downloadable'][ $i ] ),
521
+                        'date_on_sale_from' => $date_on_sale_from,
522
+                        'date_on_sale_to'   => $date_on_sale_to,
523
+                        'description'       => isset( $_POST['variable_description'][ $i ] ) ? wp_kses_post( wp_unslash( $_POST['variable_description'][ $i ] ) ) : null,
524
+                        'download_limit'    => isset( $_POST['variable_download_limit'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_limit'][ $i ] ) ) : null,
525
+                        'download_expiry'   => isset( $_POST['variable_download_expiry'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_expiry'][ $i ] ) ) : null,
526
+                        // Those are sanitized inside prepare_downloads.
527
+                        'downloads'         => self::prepare_downloads(
528
+                            isset( $_POST['_wc_variation_file_names'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_names'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
529
+                            isset( $_POST['_wc_variation_file_urls'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_urls'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
530
+                            isset( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
531
+                        ),
532
+                        'manage_stock'      => isset( $_POST['variable_manage_stock'][ $i ] ),
533
+                        'stock_quantity'    => $stock,
534
+                        'low_stock_amount'  => isset( $_POST['variable_low_stock_amount'][ $i ] ) && '' !== $_POST['variable_low_stock_amount'][ $i ] ? wc_stock_amount( wp_unslash( $_POST['variable_low_stock_amount'][ $i ] ) ) : '',
535
+                        'backorders'        => isset( $_POST['variable_backorders'], $_POST['variable_backorders'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_backorders'][ $i ] ) ) : null,
536
+                        'stock_status'      => isset( $_POST['variable_stock_status'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_stock_status'][ $i ] ) ) : null,
537
+                        'image_id'          => isset( $_POST['upload_image_id'][ $i ] ) ? wc_clean( wp_unslash( $_POST['upload_image_id'][ $i ] ) ) : null,
538
+                        'attributes'        => self::prepare_set_attributes( $parent->get_attributes(), 'attribute_', $i ),
539
+                        'sku'               => isset( $_POST['variable_sku'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sku'][ $i ] ) ) : '',
540
+                        'weight'            => isset( $_POST['variable_weight'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_weight'][ $i ] ) ) : '',
541
+                        'length'            => isset( $_POST['variable_length'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_length'][ $i ] ) ) : '',
542
+                        'width'             => isset( $_POST['variable_width'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_width'][ $i ] ) ) : '',
543
+                        'height'            => isset( $_POST['variable_height'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_height'][ $i ] ) ) : '',
544
+                        'shipping_class_id' => isset( $_POST['variable_shipping_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_shipping_class'][ $i ] ) ) : null,
545
+                        'tax_class'         => isset( $_POST['variable_tax_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
546
+                    )
547
+                );
548
+
549
+                if ( is_wp_error( $errors ) ) {
550
+                    WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
551
+                }
552
+
553
+                /**
554
+                 * Set variation props before save.
555
+                 *
556
+                 * @param object $variation WC_Product_Variation object.
557
+                 * @param int $i
558
+                 * @since 3.8.0
559
+                 */
560
+                do_action( 'woocommerce_admin_process_variation_object', $variation, $i );
561
+
562
+                $variation->save();
563
+                do_action( 'woocommerce_save_product_variation', $variation_id, $i );
564
+            }
565
+        }
566
+        // phpcs:enable WordPress.Security.NonceVerification.Missing
567
+    }
568 568
 }
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version  3.0.0
9 9
  */
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if (!defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param WP_Post $post Post object.
24 24
 	 */
25
-	public static function output( $post ) {
25
+	public static function output($post) {
26 26
 		global $thepostid, $product_object;
27 27
 
28 28
 		$thepostid      = $post->ID;
29
-		$product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
29
+		$product_object = $thepostid ? wc_get_product($thepostid) : new WC_Product();
30 30
 
31
-		wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
31
+		wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
32 32
 
33 33
 		include __DIR__ . '/views/html-product-data-panel.php';
34 34
 	}
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 				'virtual'      => array(
60 60
 					'id'            => '_virtual',
61 61
 					'wrapper_class' => 'show_if_simple',
62
-					'label'         => __( 'Virtual', 'woocommerce' ),
63
-					'description'   => __( 'Virtual products are intangible and are not shipped.', 'woocommerce' ),
62
+					'label'         => __('Virtual', 'woocommerce'),
63
+					'description'   => __('Virtual products are intangible and are not shipped.', 'woocommerce'),
64 64
 					'default'       => 'no',
65 65
 				),
66 66
 				'downloadable' => array(
67 67
 					'id'            => '_downloadable',
68 68
 					'wrapper_class' => 'show_if_simple',
69
-					'label'         => __( 'Downloadable', 'woocommerce' ),
70
-					'description'   => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
69
+					'label'         => __('Downloadable', 'woocommerce'),
70
+					'description'   => __('Downloadable products give access to a file upon purchase.', 'woocommerce'),
71 71
 					'default'       => 'no',
72 72
 				),
73 73
 			)
@@ -84,43 +84,43 @@  discard block
 block discarded – undo
84 84
 			'woocommerce_product_data_tabs',
85 85
 			array(
86 86
 				'general'        => array(
87
-					'label'    => __( 'General', 'woocommerce' ),
87
+					'label'    => __('General', 'woocommerce'),
88 88
 					'target'   => 'general_product_data',
89
-					'class'    => array( 'hide_if_grouped' ),
89
+					'class'    => array('hide_if_grouped'),
90 90
 					'priority' => 10,
91 91
 				),
92 92
 				'inventory'      => array(
93
-					'label'    => __( 'Inventory', 'woocommerce' ),
93
+					'label'    => __('Inventory', 'woocommerce'),
94 94
 					'target'   => 'inventory_product_data',
95
-					'class'    => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external' ),
95
+					'class'    => array('show_if_simple', 'show_if_variable', 'show_if_grouped', 'show_if_external'),
96 96
 					'priority' => 20,
97 97
 				),
98 98
 				'shipping'       => array(
99
-					'label'    => __( 'Shipping', 'woocommerce' ),
99
+					'label'    => __('Shipping', 'woocommerce'),
100 100
 					'target'   => 'shipping_product_data',
101
-					'class'    => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
101
+					'class'    => array('hide_if_virtual', 'hide_if_grouped', 'hide_if_external'),
102 102
 					'priority' => 30,
103 103
 				),
104 104
 				'linked_product' => array(
105
-					'label'    => __( 'Linked Products', 'woocommerce' ),
105
+					'label'    => __('Linked Products', 'woocommerce'),
106 106
 					'target'   => 'linked_product_data',
107 107
 					'class'    => array(),
108 108
 					'priority' => 40,
109 109
 				),
110 110
 				'attribute'      => array(
111
-					'label'    => __( 'Attributes', 'woocommerce' ),
111
+					'label'    => __('Attributes', 'woocommerce'),
112 112
 					'target'   => 'product_attributes',
113 113
 					'class'    => array(),
114 114
 					'priority' => 50,
115 115
 				),
116 116
 				'variations'     => array(
117
-					'label'    => __( 'Variations', 'woocommerce' ),
117
+					'label'    => __('Variations', 'woocommerce'),
118 118
 					'target'   => 'variable_product_options',
119
-					'class'    => array( 'show_if_variable' ),
119
+					'class'    => array('show_if_variable'),
120 120
 					'priority' => 60,
121 121
 				),
122 122
 				'advanced'       => array(
123
-					'label'    => __( 'Advanced', 'woocommerce' ),
123
+					'label'    => __('Advanced', 'woocommerce'),
124 124
 					'target'   => 'advanced_product_data',
125 125
 					'class'    => array(),
126 126
 					'priority' => 70,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		);
130 130
 
131 131
 		// Sort tabs based on priority.
132
-		uasort( $tabs, array( __CLASS__, 'product_data_tabs_sort' ) );
132
+		uasort($tabs, array(__CLASS__, 'product_data_tabs_sort'));
133 133
 
134 134
 		return $tabs;
135 135
 	}
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return bool
145 145
 	 */
146
-	private static function product_data_tabs_sort( $a, $b ) {
147
-		if ( ! isset( $a['priority'], $b['priority'] ) ) {
146
+	private static function product_data_tabs_sort($a, $b) {
147
+		if (!isset($a['priority'], $b['priority'])) {
148 148
 			return -1;
149 149
 		}
150 150
 
151
-		if ( $a['priority'] === $b['priority'] ) {
151
+		if ($a['priority'] === $b['priority']) {
152 152
 			return 0;
153 153
 		}
154 154
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param  WC_Product_Attribute $attribute Product attribute.
162 162
 	 * @return bool
163 163
 	 */
164
-	private static function filter_variation_attributes( $attribute ) {
164
+	private static function filter_variation_attributes($attribute) {
165 165
 		return true === $attribute->get_variation();
166 166
 	}
167 167
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	public static function output_variations() {
172 172
 		global $post, $wpdb, $product_object;
173 173
 
174
-		$variation_attributes   = array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_variation_attributes' ) );
174
+		$variation_attributes   = array_filter($product_object->get_attributes(), array(__CLASS__, 'filter_variation_attributes'));
175 175
 		$default_attributes     = $product_object->get_default_attributes();
176
-		$variations_count       = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID ) ), $post->ID ) );
177
-		$variations_per_page    = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
178
-		$variations_total_pages = ceil( $variations_count / $variations_per_page );
176
+		$variations_count       = absint(apply_filters('woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID)), $post->ID));
177
+		$variations_per_page    = absint(apply_filters('woocommerce_admin_meta_boxes_variations_per_page', 15));
178
+		$variations_total_pages = ceil($variations_count / $variations_per_page);
179 179
 
180 180
 		include __DIR__ . '/views/html-product-data-variations.php';
181 181
 	}
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return array
191 191
 	 */
192
-	private static function prepare_downloads( $file_names, $file_urls, $file_hashes ) {
192
+	private static function prepare_downloads($file_names, $file_urls, $file_hashes) {
193 193
 		$downloads = array();
194 194
 
195
-		if ( ! empty( $file_urls ) ) {
196
-			$file_url_size = count( $file_urls );
195
+		if (!empty($file_urls)) {
196
+			$file_url_size = count($file_urls);
197 197
 
198
-			for ( $i = 0; $i < $file_url_size; $i ++ ) {
199
-				if ( ! empty( $file_urls[ $i ] ) ) {
198
+			for ($i = 0; $i < $file_url_size; $i++) {
199
+				if (!empty($file_urls[$i])) {
200 200
 					$downloads[] = array(
201
-						'name'        => wc_clean( $file_names[ $i ] ),
202
-						'file'        => wp_unslash( trim( $file_urls[ $i ] ) ),
203
-						'download_id' => wc_clean( $file_hashes[ $i ] ),
201
+						'name'        => wc_clean($file_names[$i]),
202
+						'file'        => wp_unslash(trim($file_urls[$i])),
203
+						'download_id' => wc_clean($file_hashes[$i]),
204 204
 					);
205 205
 				}
206 206
 			}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return array
215 215
 	 */
216 216
 	private static function prepare_children() {
217
-		return isset( $_POST['grouped_products'] ) ? array_filter( array_map( 'intval', (array) $_POST['grouped_products'] ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing
217
+		return isset($_POST['grouped_products']) ? array_filter(array_map('intval', (array) $_POST['grouped_products'])) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing
218 218
 	}
219 219
 
220 220
 	/**
@@ -224,55 +224,55 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return array
226 226
 	 */
227
-	public static function prepare_attributes( $data = false ) {
227
+	public static function prepare_attributes($data = false) {
228 228
 		$attributes = array();
229 229
 
230
-		if ( ! $data ) {
231
-			$data = stripslashes_deep( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
230
+		if (!$data) {
231
+			$data = stripslashes_deep($_POST); // phpcs:ignore WordPress.Security.NonceVerification.Missing
232 232
 		}
233 233
 
234
-		if ( isset( $data['attribute_names'], $data['attribute_values'] ) ) {
234
+		if (isset($data['attribute_names'], $data['attribute_values'])) {
235 235
 			$attribute_names         = $data['attribute_names'];
236 236
 			$attribute_values        = $data['attribute_values'];
237
-			$attribute_visibility    = isset( $data['attribute_visibility'] ) ? $data['attribute_visibility'] : array();
238
-			$attribute_variation     = isset( $data['attribute_variation'] ) ? $data['attribute_variation'] : array();
237
+			$attribute_visibility    = isset($data['attribute_visibility']) ? $data['attribute_visibility'] : array();
238
+			$attribute_variation     = isset($data['attribute_variation']) ? $data['attribute_variation'] : array();
239 239
 			$attribute_position      = $data['attribute_position'];
240
-			$attribute_names_max_key = max( array_keys( $attribute_names ) );
240
+			$attribute_names_max_key = max(array_keys($attribute_names));
241 241
 
242
-			for ( $i = 0; $i <= $attribute_names_max_key; $i++ ) {
243
-				if ( empty( $attribute_names[ $i ] ) || ! isset( $attribute_values[ $i ] ) ) {
242
+			for ($i = 0; $i <= $attribute_names_max_key; $i++) {
243
+				if (empty($attribute_names[$i]) || !isset($attribute_values[$i])) {
244 244
 					continue;
245 245
 				}
246 246
 				$attribute_id   = 0;
247
-				$attribute_name = wc_clean( esc_html( $attribute_names[ $i ] ) );
247
+				$attribute_name = wc_clean(esc_html($attribute_names[$i]));
248 248
 
249
-				if ( 'pa_' === substr( $attribute_name, 0, 3 ) ) {
250
-					$attribute_id = wc_attribute_taxonomy_id_by_name( $attribute_name );
249
+				if ('pa_' === substr($attribute_name, 0, 3)) {
250
+					$attribute_id = wc_attribute_taxonomy_id_by_name($attribute_name);
251 251
 				}
252 252
 
253
-				$options = isset( $attribute_values[ $i ] ) ? $attribute_values[ $i ] : '';
253
+				$options = isset($attribute_values[$i]) ? $attribute_values[$i] : '';
254 254
 
255
-				if ( is_array( $options ) ) {
255
+				if (is_array($options)) {
256 256
 					// Term ids sent as array.
257
-					$options = wp_parse_id_list( $options );
257
+					$options = wp_parse_id_list($options);
258 258
 				} else {
259 259
 					// Terms or text sent in textarea.
260
-					$options = 0 < $attribute_id ? wc_sanitize_textarea( esc_html( wc_sanitize_term_text_based( $options ) ) ) : wc_sanitize_textarea( esc_html( $options ) );
261
-					$options = wc_get_text_attributes( $options );
260
+					$options = 0 < $attribute_id ? wc_sanitize_textarea(esc_html(wc_sanitize_term_text_based($options))) : wc_sanitize_textarea(esc_html($options));
261
+					$options = wc_get_text_attributes($options);
262 262
 				}
263 263
 
264
-				if ( empty( $options ) ) {
264
+				if (empty($options)) {
265 265
 					continue;
266 266
 				}
267 267
 
268 268
 				$attribute = new WC_Product_Attribute();
269
-				$attribute->set_id( $attribute_id );
270
-				$attribute->set_name( $attribute_name );
271
-				$attribute->set_options( $options );
272
-				$attribute->set_position( $attribute_position[ $i ] );
273
-				$attribute->set_visible( isset( $attribute_visibility[ $i ] ) );
274
-				$attribute->set_variation( isset( $attribute_variation[ $i ] ) );
275
-				$attributes[] = apply_filters( 'woocommerce_admin_meta_boxes_prepare_attribute', $attribute, $data, $i );
269
+				$attribute->set_id($attribute_id);
270
+				$attribute->set_name($attribute_name);
271
+				$attribute->set_options($options);
272
+				$attribute->set_position($attribute_position[$i]);
273
+				$attribute->set_visible(isset($attribute_visibility[$i]));
274
+				$attribute->set_variation(isset($attribute_variation[$i]));
275
+				$attributes[] = apply_filters('woocommerce_admin_meta_boxes_prepare_attribute', $attribute, $data, $i);
276 276
 			}
277 277
 		}
278 278
 		return $attributes;
@@ -286,28 +286,28 @@  discard block
 block discarded – undo
286 286
 	 * @param  int    $index Attribute array index.
287 287
 	 * @return array
288 288
 	 */
289
-	private static function prepare_set_attributes( $all_attributes, $key_prefix = 'attribute_', $index = null ) {
289
+	private static function prepare_set_attributes($all_attributes, $key_prefix = 'attribute_', $index = null) {
290 290
 		$attributes = array();
291 291
 
292
-		if ( $all_attributes ) {
293
-			foreach ( $all_attributes as $attribute ) {
294
-				if ( $attribute->get_variation() ) {
295
-					$attribute_key = sanitize_title( $attribute->get_name() );
292
+		if ($all_attributes) {
293
+			foreach ($all_attributes as $attribute) {
294
+				if ($attribute->get_variation()) {
295
+					$attribute_key = sanitize_title($attribute->get_name());
296 296
 
297
-					if ( ! is_null( $index ) ) {
298
-						$value = isset( $_POST[ $key_prefix . $attribute_key ][ $index ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ][ $index ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
297
+					if (!is_null($index)) {
298
+						$value = isset($_POST[$key_prefix . $attribute_key][$index]) ? wp_unslash($_POST[$key_prefix . $attribute_key][$index]) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
299 299
 					} else {
300
-						$value = isset( $_POST[ $key_prefix . $attribute_key ] ) ? wp_unslash( $_POST[ $key_prefix . $attribute_key ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
300
+						$value = isset($_POST[$key_prefix . $attribute_key]) ? wp_unslash($_POST[$key_prefix . $attribute_key]) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
301 301
 					}
302 302
 
303
-					if ( $attribute->is_taxonomy() ) {
303
+					if ($attribute->is_taxonomy()) {
304 304
 						// Don't use wc_clean as it destroys sanitized characters.
305
-						$value = sanitize_title( $value );
305
+						$value = sanitize_title($value);
306 306
 					} else {
307
-						$value = html_entity_decode( wc_clean( $value ), ENT_QUOTES, get_bloginfo( 'charset' ) ); // WPCS: sanitization ok.
307
+						$value = html_entity_decode(wc_clean($value), ENT_QUOTES, get_bloginfo('charset')); // WPCS: sanitization ok.
308 308
 					}
309 309
 
310
-					$attributes[ $attribute_key ] = $value;
310
+					$attributes[$attribute_key] = $value;
311 311
 				}
312 312
 			}
313 313
 		}
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 	 * @param int     $post_id WP post id.
322 322
 	 * @param WP_Post $post Post object.
323 323
 	 */
324
-	public static function save( $post_id, $post ) {
324
+	public static function save($post_id, $post) {
325 325
 		// phpcs:disable WordPress.Security.NonceVerification.Missing
326 326
 		// Process product type first so we have the correct class to run setters.
327
-		$product_type = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( wp_unslash( $_POST['product-type'] ) );
328
-		$classname    = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
329
-		$product      = new $classname( $post_id );
327
+		$product_type = empty($_POST['product-type']) ? WC_Product_Factory::get_product_type($post_id) : sanitize_title(wp_unslash($_POST['product-type']));
328
+		$classname    = WC_Product_Factory::get_product_classname($post_id, $product_type ? $product_type : 'simple');
329
+		$product      = new $classname($post_id);
330 330
 		$attributes   = self::prepare_attributes();
331 331
 		$stock        = null;
332 332
 
333 333
 		// Handle stock changes.
334
-		if ( isset( $_POST['_stock'] ) ) {
335
-			if ( isset( $_POST['_original_stock'] ) && wc_stock_amount( $product->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['_original_stock'] ) ) ) {
334
+		if (isset($_POST['_stock'])) {
335
+			if (isset($_POST['_original_stock']) && wc_stock_amount($product->get_stock_quantity('edit')) !== wc_stock_amount(wp_unslash($_POST['_original_stock']))) {
336 336
 				/* translators: 1: product ID 2: quantity in stock */
337
-				WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $product->get_id(), $product->get_stock_quantity( 'edit' ) ) );
337
+				WC_Admin_Meta_Boxes::add_error(sprintf(__('The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce'), $product->get_id(), $product->get_stock_quantity('edit')));
338 338
 			} else {
339
-				$stock = wc_stock_amount( wp_unslash( $_POST['_stock'] ) );
339
+				$stock = wc_stock_amount(wp_unslash($_POST['_stock']));
340 340
 			}
341 341
 		}
342 342
 
@@ -345,69 +345,69 @@  discard block
 block discarded – undo
345 345
 		$date_on_sale_to   = '';
346 346
 
347 347
 		// Force date from to beginning of day.
348
-		if ( isset( $_POST['_sale_price_dates_from'] ) ) {
349
-			$date_on_sale_from = wc_clean( wp_unslash( $_POST['_sale_price_dates_from'] ) );
348
+		if (isset($_POST['_sale_price_dates_from'])) {
349
+			$date_on_sale_from = wc_clean(wp_unslash($_POST['_sale_price_dates_from']));
350 350
 
351
-			if ( ! empty( $date_on_sale_from ) ) {
352
-				$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
351
+			if (!empty($date_on_sale_from)) {
352
+				$date_on_sale_from = date('Y-m-d 00:00:00', strtotime($date_on_sale_from)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
353 353
 			}
354 354
 		}
355 355
 
356 356
 		// Force date to to the end of the day.
357
-		if ( isset( $_POST['_sale_price_dates_to'] ) ) {
358
-			$date_on_sale_to = wc_clean( wp_unslash( $_POST['_sale_price_dates_to'] ) );
357
+		if (isset($_POST['_sale_price_dates_to'])) {
358
+			$date_on_sale_to = wc_clean(wp_unslash($_POST['_sale_price_dates_to']));
359 359
 
360
-			if ( ! empty( $date_on_sale_to ) ) {
361
-				$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
360
+			if (!empty($date_on_sale_to)) {
361
+				$date_on_sale_to = date('Y-m-d 23:59:59', strtotime($date_on_sale_to)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
362 362
 			}
363 363
 		}
364 364
 
365 365
 		$errors = $product->set_props(
366 366
 			array(
367
-				'sku'                => isset( $_POST['_sku'] ) ? wc_clean( wp_unslash( $_POST['_sku'] ) ) : null,
368
-				'purchase_note'      => isset( $_POST['_purchase_note'] ) ? wp_kses_post( wp_unslash( $_POST['_purchase_note'] ) ) : '',
369
-				'downloadable'       => isset( $_POST['_downloadable'] ),
370
-				'virtual'            => isset( $_POST['_virtual'] ),
371
-				'featured'           => isset( $_POST['_featured'] ),
372
-				'catalog_visibility' => isset( $_POST['_visibility'] ) ? wc_clean( wp_unslash( $_POST['_visibility'] ) ) : null,
373
-				'tax_status'         => isset( $_POST['_tax_status'] ) ? wc_clean( wp_unslash( $_POST['_tax_status'] ) ) : null,
374
-				'tax_class'          => isset( $_POST['_tax_class'] ) ? sanitize_title( wp_unslash( $_POST['_tax_class'] ) ) : null,
375
-				'weight'             => isset( $_POST['_weight'] ) ? wc_clean( wp_unslash( $_POST['_weight'] ) ) : null,
376
-				'length'             => isset( $_POST['_length'] ) ? wc_clean( wp_unslash( $_POST['_length'] ) ) : null,
377
-				'width'              => isset( $_POST['_width'] ) ? wc_clean( wp_unslash( $_POST['_width'] ) ) : null,
378
-				'height'             => isset( $_POST['_height'] ) ? wc_clean( wp_unslash( $_POST['_height'] ) ) : null,
379
-				'shipping_class_id'  => isset( $_POST['product_shipping_class'] ) ? absint( wp_unslash( $_POST['product_shipping_class'] ) ) : null,
380
-				'sold_individually'  => ! empty( $_POST['_sold_individually'] ),
381
-				'upsell_ids'         => isset( $_POST['upsell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['upsell_ids'] ) ) : array(),
382
-				'cross_sell_ids'     => isset( $_POST['crosssell_ids'] ) ? array_map( 'intval', (array) wp_unslash( $_POST['crosssell_ids'] ) ) : array(),
383
-				'regular_price'      => isset( $_POST['_regular_price'] ) ? wc_clean( wp_unslash( $_POST['_regular_price'] ) ) : null,
384
-				'sale_price'         => isset( $_POST['_sale_price'] ) ? wc_clean( wp_unslash( $_POST['_sale_price'] ) ) : null,
367
+				'sku'                => isset($_POST['_sku']) ? wc_clean(wp_unslash($_POST['_sku'])) : null,
368
+				'purchase_note'      => isset($_POST['_purchase_note']) ? wp_kses_post(wp_unslash($_POST['_purchase_note'])) : '',
369
+				'downloadable'       => isset($_POST['_downloadable']),
370
+				'virtual'            => isset($_POST['_virtual']),
371
+				'featured'           => isset($_POST['_featured']),
372
+				'catalog_visibility' => isset($_POST['_visibility']) ? wc_clean(wp_unslash($_POST['_visibility'])) : null,
373
+				'tax_status'         => isset($_POST['_tax_status']) ? wc_clean(wp_unslash($_POST['_tax_status'])) : null,
374
+				'tax_class'          => isset($_POST['_tax_class']) ? sanitize_title(wp_unslash($_POST['_tax_class'])) : null,
375
+				'weight'             => isset($_POST['_weight']) ? wc_clean(wp_unslash($_POST['_weight'])) : null,
376
+				'length'             => isset($_POST['_length']) ? wc_clean(wp_unslash($_POST['_length'])) : null,
377
+				'width'              => isset($_POST['_width']) ? wc_clean(wp_unslash($_POST['_width'])) : null,
378
+				'height'             => isset($_POST['_height']) ? wc_clean(wp_unslash($_POST['_height'])) : null,
379
+				'shipping_class_id'  => isset($_POST['product_shipping_class']) ? absint(wp_unslash($_POST['product_shipping_class'])) : null,
380
+				'sold_individually'  => !empty($_POST['_sold_individually']),
381
+				'upsell_ids'         => isset($_POST['upsell_ids']) ? array_map('intval', (array) wp_unslash($_POST['upsell_ids'])) : array(),
382
+				'cross_sell_ids'     => isset($_POST['crosssell_ids']) ? array_map('intval', (array) wp_unslash($_POST['crosssell_ids'])) : array(),
383
+				'regular_price'      => isset($_POST['_regular_price']) ? wc_clean(wp_unslash($_POST['_regular_price'])) : null,
384
+				'sale_price'         => isset($_POST['_sale_price']) ? wc_clean(wp_unslash($_POST['_sale_price'])) : null,
385 385
 				'date_on_sale_from'  => $date_on_sale_from,
386 386
 				'date_on_sale_to'    => $date_on_sale_to,
387
-				'manage_stock'       => ! empty( $_POST['_manage_stock'] ),
388
-				'backorders'         => isset( $_POST['_backorders'] ) ? wc_clean( wp_unslash( $_POST['_backorders'] ) ) : null,
389
-				'stock_status'       => isset( $_POST['_stock_status'] ) ? wc_clean( wp_unslash( $_POST['_stock_status'] ) ) : null,
387
+				'manage_stock'       => !empty($_POST['_manage_stock']),
388
+				'backorders'         => isset($_POST['_backorders']) ? wc_clean(wp_unslash($_POST['_backorders'])) : null,
389
+				'stock_status'       => isset($_POST['_stock_status']) ? wc_clean(wp_unslash($_POST['_stock_status'])) : null,
390 390
 				'stock_quantity'     => $stock,
391
-				'low_stock_amount'   => isset( $_POST['_low_stock_amount'] ) && '' !== $_POST['_low_stock_amount'] ? wc_stock_amount( wp_unslash( $_POST['_low_stock_amount'] ) ) : '',
392
-				'download_limit'     => isset( $_POST['_download_limit'] ) && '' !== $_POST['_download_limit'] ? absint( wp_unslash( $_POST['_download_limit'] ) ) : '',
393
-				'download_expiry'    => isset( $_POST['_download_expiry'] ) && '' !== $_POST['_download_expiry'] ? absint( wp_unslash( $_POST['_download_expiry'] ) ) : '',
391
+				'low_stock_amount'   => isset($_POST['_low_stock_amount']) && '' !== $_POST['_low_stock_amount'] ? wc_stock_amount(wp_unslash($_POST['_low_stock_amount'])) : '',
392
+				'download_limit'     => isset($_POST['_download_limit']) && '' !== $_POST['_download_limit'] ? absint(wp_unslash($_POST['_download_limit'])) : '',
393
+				'download_expiry'    => isset($_POST['_download_expiry']) && '' !== $_POST['_download_expiry'] ? absint(wp_unslash($_POST['_download_expiry'])) : '',
394 394
 				// Those are sanitized inside prepare_downloads.
395 395
 				'downloads'          => self::prepare_downloads(
396
-					isset( $_POST['_wc_file_names'] ) ? wp_unslash( $_POST['_wc_file_names'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
397
-					isset( $_POST['_wc_file_urls'] ) ? wp_unslash( $_POST['_wc_file_urls'] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
398
-					isset( $_POST['_wc_file_hashes'] ) ? wp_unslash( $_POST['_wc_file_hashes'] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
396
+					isset($_POST['_wc_file_names']) ? wp_unslash($_POST['_wc_file_names']) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
397
+					isset($_POST['_wc_file_urls']) ? wp_unslash($_POST['_wc_file_urls']) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
398
+					isset($_POST['_wc_file_hashes']) ? wp_unslash($_POST['_wc_file_hashes']) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
399 399
 				),
400
-				'product_url'        => isset( $_POST['_product_url'] ) ? esc_url_raw( wp_unslash( $_POST['_product_url'] ) ) : '',
401
-				'button_text'        => isset( $_POST['_button_text'] ) ? wc_clean( wp_unslash( $_POST['_button_text'] ) ) : '',
400
+				'product_url'        => isset($_POST['_product_url']) ? esc_url_raw(wp_unslash($_POST['_product_url'])) : '',
401
+				'button_text'        => isset($_POST['_button_text']) ? wc_clean(wp_unslash($_POST['_button_text'])) : '',
402 402
 				'children'           => 'grouped' === $product_type ? self::prepare_children() : null,
403
-				'reviews_allowed'    => ! empty( $_POST['comment_status'] ) && 'open' === $_POST['comment_status'],
403
+				'reviews_allowed'    => !empty($_POST['comment_status']) && 'open' === $_POST['comment_status'],
404 404
 				'attributes'         => $attributes,
405
-				'default_attributes' => self::prepare_set_attributes( $attributes, 'default_attribute_' ),
405
+				'default_attributes' => self::prepare_set_attributes($attributes, 'default_attribute_'),
406 406
 			)
407 407
 		);
408 408
 
409
-		if ( is_wp_error( $errors ) ) {
410
-			WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
409
+		if (is_wp_error($errors)) {
410
+			WC_Admin_Meta_Boxes::add_error($errors->get_error_message());
411 411
 		}
412 412
 
413 413
 		/**
@@ -415,18 +415,18 @@  discard block
 block discarded – undo
415 415
 		 *
416 416
 		 * @since 3.0.0
417 417
 		 */
418
-		do_action( 'woocommerce_admin_process_product_object', $product );
418
+		do_action('woocommerce_admin_process_product_object', $product);
419 419
 
420 420
 		$product->save();
421 421
 
422
-		if ( $product->is_type( 'variable' ) ) {
423
-			$original_post_title = isset( $_POST['original_post_title'] ) ? wc_clean( wp_unslash( $_POST['original_post_title'] ) ) : '';
424
-			$post_title          = isset( $_POST['post_title'] ) ? wc_clean( wp_unslash( $_POST['post_title'] ) ) : '';
422
+		if ($product->is_type('variable')) {
423
+			$original_post_title = isset($_POST['original_post_title']) ? wc_clean(wp_unslash($_POST['original_post_title'])) : '';
424
+			$post_title          = isset($_POST['post_title']) ? wc_clean(wp_unslash($_POST['post_title'])) : '';
425 425
 
426
-			$product->get_data_store()->sync_variation_names( $product, $original_post_title, $post_title );
426
+			$product->get_data_store()->sync_variation_names($product, $original_post_title, $post_title);
427 427
 		}
428 428
 
429
-		do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );
429
+		do_action('woocommerce_process_product_meta_' . $product_type, $post_id);
430 430
 		// phpcs:enable WordPress.Security.NonceVerification.Missing
431 431
 	}
432 432
 
@@ -436,23 +436,23 @@  discard block
 block discarded – undo
436 436
 	 * @param int     $post_id WP post id.
437 437
 	 * @param WP_Post $post Post object.
438 438
 	 */
439
-	public static function save_variations( $post_id, $post ) {
439
+	public static function save_variations($post_id, $post) {
440 440
 		global $wpdb;
441 441
 
442 442
 		// phpcs:disable WordPress.Security.NonceVerification.Missing
443
-		if ( isset( $_POST['variable_post_id'] ) ) {
444
-			$parent = wc_get_product( $post_id );
445
-			$parent->set_default_attributes( self::prepare_set_attributes( $parent->get_attributes(), 'default_attribute_' ) );
443
+		if (isset($_POST['variable_post_id'])) {
444
+			$parent = wc_get_product($post_id);
445
+			$parent->set_default_attributes(self::prepare_set_attributes($parent->get_attributes(), 'default_attribute_'));
446 446
 			$parent->save();
447 447
 
448
-			$max_loop   = max( array_keys( wp_unslash( $_POST['variable_post_id'] ) ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
448
+			$max_loop   = max(array_keys(wp_unslash($_POST['variable_post_id']))); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
449 449
 			$data_store = $parent->get_data_store();
450
-			$data_store->sort_all_product_variations( $parent->get_id() );
451
-			$new_variation_menu_order_id = ! empty( $_POST['new_variation_menu_order_id'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_id'] ) ) : false;
452
-			$new_variation_menu_order_value = ! empty( $_POST['new_variation_menu_order_value'] ) ? wc_clean( wp_unslash( $_POST['new_variation_menu_order_value'] ) ) : false;
450
+			$data_store->sort_all_product_variations($parent->get_id());
451
+			$new_variation_menu_order_id = !empty($_POST['new_variation_menu_order_id']) ? wc_clean(wp_unslash($_POST['new_variation_menu_order_id'])) : false;
452
+			$new_variation_menu_order_value = !empty($_POST['new_variation_menu_order_value']) ? wc_clean(wp_unslash($_POST['new_variation_menu_order_value'])) : false;
453 453
 
454 454
 			// Only perform this operation if setting menu order via the prompt.
455
-			if ( $new_variation_menu_order_id && $new_variation_menu_order_value ) {
455
+			if ($new_variation_menu_order_id && $new_variation_menu_order_value) {
456 456
 				/*
457 457
 				 * We need to gather all the variations with menu order that is
458 458
 				 * equal or greater than the menu order that is newly set and
@@ -469,22 +469,22 @@  discard block
 block discarded – undo
469 469
 				);
470 470
 			}
471 471
 
472
-			for ( $i = 0; $i <= $max_loop; $i++ ) {
472
+			for ($i = 0; $i <= $max_loop; $i++) {
473 473
 
474
-				if ( ! isset( $_POST['variable_post_id'][ $i ] ) ) {
474
+				if (!isset($_POST['variable_post_id'][$i])) {
475 475
 					continue;
476 476
 				}
477
-				$variation_id = absint( $_POST['variable_post_id'][ $i ] );
478
-				$variation    = wc_get_product_object( 'variation', $variation_id );
477
+				$variation_id = absint($_POST['variable_post_id'][$i]);
478
+				$variation    = wc_get_product_object('variation', $variation_id);
479 479
 				$stock        = null;
480 480
 
481 481
 				// Handle stock changes.
482
-				if ( isset( $_POST['variable_stock'], $_POST['variable_stock'][ $i ] ) ) {
483
-					if ( isset( $_POST['variable_original_stock'], $_POST['variable_original_stock'][ $i ] ) && wc_stock_amount( $variation->get_stock_quantity( 'edit' ) ) !== wc_stock_amount( wp_unslash( $_POST['variable_original_stock'][ $i ] ) ) ) {
482
+				if (isset($_POST['variable_stock'], $_POST['variable_stock'][$i])) {
483
+					if (isset($_POST['variable_original_stock'], $_POST['variable_original_stock'][$i]) && wc_stock_amount($variation->get_stock_quantity('edit')) !== wc_stock_amount(wp_unslash($_POST['variable_original_stock'][$i]))) {
484 484
 						/* translators: 1: product ID 2: quantity in stock */
485
-						WC_Admin_Meta_Boxes::add_error( sprintf( __( 'The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce' ), $variation->get_id(), $variation->get_stock_quantity( 'edit' ) ) );
485
+						WC_Admin_Meta_Boxes::add_error(sprintf(__('The stock has not been updated because the value has changed since editing. Product %1$d has %2$d units in stock.', 'woocommerce'), $variation->get_id(), $variation->get_stock_quantity('edit')));
486 486
 					} else {
487
-						$stock = wc_stock_amount( wp_unslash( $_POST['variable_stock'][ $i ] ) );
487
+						$stock = wc_stock_amount(wp_unslash($_POST['variable_stock'][$i]));
488 488
 					}
489 489
 				}
490 490
 
@@ -493,61 +493,61 @@  discard block
 block discarded – undo
493 493
 				$date_on_sale_to   = '';
494 494
 
495 495
 				// Force date from to beginning of day.
496
-				if ( isset( $_POST['variable_sale_price_dates_from'][ $i ] ) ) {
497
-					$date_on_sale_from = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_from'][ $i ] ) );
496
+				if (isset($_POST['variable_sale_price_dates_from'][$i])) {
497
+					$date_on_sale_from = wc_clean(wp_unslash($_POST['variable_sale_price_dates_from'][$i]));
498 498
 
499
-					if ( ! empty( $date_on_sale_from ) ) {
500
-						$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
499
+					if (!empty($date_on_sale_from)) {
500
+						$date_on_sale_from = date('Y-m-d 00:00:00', strtotime($date_on_sale_from)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
501 501
 					}
502 502
 				}
503 503
 
504 504
 				// Force date to to the end of the day.
505
-				if ( isset( $_POST['variable_sale_price_dates_to'][ $i ] ) ) {
506
-					$date_on_sale_to = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_to'][ $i ] ) );
505
+				if (isset($_POST['variable_sale_price_dates_to'][$i])) {
506
+					$date_on_sale_to = wc_clean(wp_unslash($_POST['variable_sale_price_dates_to'][$i]));
507 507
 
508
-					if ( ! empty( $date_on_sale_to ) ) {
509
-						$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
508
+					if (!empty($date_on_sale_to)) {
509
+						$date_on_sale_to = date('Y-m-d 23:59:59', strtotime($date_on_sale_to)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
510 510
 					}
511 511
 				}
512 512
 
513 513
 				$errors = $variation->set_props(
514 514
 					array(
515
-						'status'            => isset( $_POST['variable_enabled'][ $i ] ) ? 'publish' : 'private',
516
-						'menu_order'        => isset( $_POST['variation_menu_order'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variation_menu_order'][ $i ] ) ) : null,
517
-						'regular_price'     => isset( $_POST['variable_regular_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_regular_price'][ $i ] ) ) : null,
518
-						'sale_price'        => isset( $_POST['variable_sale_price'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sale_price'][ $i ] ) ) : null,
519
-						'virtual'           => isset( $_POST['variable_is_virtual'][ $i ] ),
520
-						'downloadable'      => isset( $_POST['variable_is_downloadable'][ $i ] ),
515
+						'status'            => isset($_POST['variable_enabled'][$i]) ? 'publish' : 'private',
516
+						'menu_order'        => isset($_POST['variation_menu_order'][$i]) ? wc_clean(wp_unslash($_POST['variation_menu_order'][$i])) : null,
517
+						'regular_price'     => isset($_POST['variable_regular_price'][$i]) ? wc_clean(wp_unslash($_POST['variable_regular_price'][$i])) : null,
518
+						'sale_price'        => isset($_POST['variable_sale_price'][$i]) ? wc_clean(wp_unslash($_POST['variable_sale_price'][$i])) : null,
519
+						'virtual'           => isset($_POST['variable_is_virtual'][$i]),
520
+						'downloadable'      => isset($_POST['variable_is_downloadable'][$i]),
521 521
 						'date_on_sale_from' => $date_on_sale_from,
522 522
 						'date_on_sale_to'   => $date_on_sale_to,
523
-						'description'       => isset( $_POST['variable_description'][ $i ] ) ? wp_kses_post( wp_unslash( $_POST['variable_description'][ $i ] ) ) : null,
524
-						'download_limit'    => isset( $_POST['variable_download_limit'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_limit'][ $i ] ) ) : null,
525
-						'download_expiry'   => isset( $_POST['variable_download_expiry'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_download_expiry'][ $i ] ) ) : null,
523
+						'description'       => isset($_POST['variable_description'][$i]) ? wp_kses_post(wp_unslash($_POST['variable_description'][$i])) : null,
524
+						'download_limit'    => isset($_POST['variable_download_limit'][$i]) ? wc_clean(wp_unslash($_POST['variable_download_limit'][$i])) : null,
525
+						'download_expiry'   => isset($_POST['variable_download_expiry'][$i]) ? wc_clean(wp_unslash($_POST['variable_download_expiry'][$i])) : null,
526 526
 						// Those are sanitized inside prepare_downloads.
527 527
 						'downloads'         => self::prepare_downloads(
528
-							isset( $_POST['_wc_variation_file_names'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_names'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
529
-							isset( $_POST['_wc_variation_file_urls'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_urls'][ $variation_id ] ) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
530
-							isset( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) ? wp_unslash( $_POST['_wc_variation_file_hashes'][ $variation_id ] ) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
528
+							isset($_POST['_wc_variation_file_names'][$variation_id]) ? wp_unslash($_POST['_wc_variation_file_names'][$variation_id]) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
529
+							isset($_POST['_wc_variation_file_urls'][$variation_id]) ? wp_unslash($_POST['_wc_variation_file_urls'][$variation_id]) : array(), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
530
+							isset($_POST['_wc_variation_file_hashes'][$variation_id]) ? wp_unslash($_POST['_wc_variation_file_hashes'][$variation_id]) : array() // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
531 531
 						),
532
-						'manage_stock'      => isset( $_POST['variable_manage_stock'][ $i ] ),
532
+						'manage_stock'      => isset($_POST['variable_manage_stock'][$i]),
533 533
 						'stock_quantity'    => $stock,
534
-						'low_stock_amount'  => isset( $_POST['variable_low_stock_amount'][ $i ] ) && '' !== $_POST['variable_low_stock_amount'][ $i ] ? wc_stock_amount( wp_unslash( $_POST['variable_low_stock_amount'][ $i ] ) ) : '',
535
-						'backorders'        => isset( $_POST['variable_backorders'], $_POST['variable_backorders'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_backorders'][ $i ] ) ) : null,
536
-						'stock_status'      => isset( $_POST['variable_stock_status'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_stock_status'][ $i ] ) ) : null,
537
-						'image_id'          => isset( $_POST['upload_image_id'][ $i ] ) ? wc_clean( wp_unslash( $_POST['upload_image_id'][ $i ] ) ) : null,
538
-						'attributes'        => self::prepare_set_attributes( $parent->get_attributes(), 'attribute_', $i ),
539
-						'sku'               => isset( $_POST['variable_sku'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_sku'][ $i ] ) ) : '',
540
-						'weight'            => isset( $_POST['variable_weight'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_weight'][ $i ] ) ) : '',
541
-						'length'            => isset( $_POST['variable_length'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_length'][ $i ] ) ) : '',
542
-						'width'             => isset( $_POST['variable_width'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_width'][ $i ] ) ) : '',
543
-						'height'            => isset( $_POST['variable_height'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_height'][ $i ] ) ) : '',
544
-						'shipping_class_id' => isset( $_POST['variable_shipping_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_shipping_class'][ $i ] ) ) : null,
545
-						'tax_class'         => isset( $_POST['variable_tax_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
534
+						'low_stock_amount'  => isset($_POST['variable_low_stock_amount'][$i]) && '' !== $_POST['variable_low_stock_amount'][$i] ? wc_stock_amount(wp_unslash($_POST['variable_low_stock_amount'][$i])) : '',
535
+						'backorders'        => isset($_POST['variable_backorders'], $_POST['variable_backorders'][$i]) ? wc_clean(wp_unslash($_POST['variable_backorders'][$i])) : null,
536
+						'stock_status'      => isset($_POST['variable_stock_status'][$i]) ? wc_clean(wp_unslash($_POST['variable_stock_status'][$i])) : null,
537
+						'image_id'          => isset($_POST['upload_image_id'][$i]) ? wc_clean(wp_unslash($_POST['upload_image_id'][$i])) : null,
538
+						'attributes'        => self::prepare_set_attributes($parent->get_attributes(), 'attribute_', $i),
539
+						'sku'               => isset($_POST['variable_sku'][$i]) ? wc_clean(wp_unslash($_POST['variable_sku'][$i])) : '',
540
+						'weight'            => isset($_POST['variable_weight'][$i]) ? wc_clean(wp_unslash($_POST['variable_weight'][$i])) : '',
541
+						'length'            => isset($_POST['variable_length'][$i]) ? wc_clean(wp_unslash($_POST['variable_length'][$i])) : '',
542
+						'width'             => isset($_POST['variable_width'][$i]) ? wc_clean(wp_unslash($_POST['variable_width'][$i])) : '',
543
+						'height'            => isset($_POST['variable_height'][$i]) ? wc_clean(wp_unslash($_POST['variable_height'][$i])) : '',
544
+						'shipping_class_id' => isset($_POST['variable_shipping_class'][$i]) ? wc_clean(wp_unslash($_POST['variable_shipping_class'][$i])) : null,
545
+						'tax_class'         => isset($_POST['variable_tax_class'][$i]) ? wc_clean(wp_unslash($_POST['variable_tax_class'][$i])) : null,
546 546
 					)
547 547
 				);
548 548
 
549
-				if ( is_wp_error( $errors ) ) {
550
-					WC_Admin_Meta_Boxes::add_error( $errors->get_error_message() );
549
+				if (is_wp_error($errors)) {
550
+					WC_Admin_Meta_Boxes::add_error($errors->get_error_message());
551 551
 				}
552 552
 
553 553
 				/**
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
 				 * @param int $i
558 558
 				 * @since 3.8.0
559 559
 				 */
560
-				do_action( 'woocommerce_admin_process_variation_object', $variation, $i );
560
+				do_action('woocommerce_admin_process_variation_object', $variation, $i);
561 561
 
562 562
 				$variation->save();
563
-				do_action( 'woocommerce_save_product_variation', $variation_id, $i );
563
+				do_action('woocommerce_save_product_variation', $variation_id, $i);
564 564
 			}
565 565
 		}
566 566
 		// phpcs:enable WordPress.Security.NonceVerification.Missing
Please login to merge, or discard this patch.
includes/admin/meta-boxes/views/html-order-download-permission.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 ?>
6 6
 <div class="wc-metabox closed">
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 		<div class="handlediv" aria-label="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
10 10
 		<strong>
11 11
 			<?php
12
-			printf(
13
-				'#%s &mdash; %s &mdash; %s: %s &mdash; ',
14
-				esc_html( $product->get_id() ),
15
-				esc_html( apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_name(), $download->get_product_id(), $download->get_order_id(), $download->get_order_key(), $download->get_download_id() ) ),
16
-				esc_html( $file_count ),
17
-				esc_html( wc_get_filename_from_url( $product->get_file_download_path( $download->get_download_id() ) ) )
18
-			);
19
-			printf( _n( 'Downloaded %s time', 'Downloaded %s times', $download->get_download_count(), 'woocommerce' ), esc_html( $download->get_download_count() ) )
20
-			?>
12
+            printf(
13
+                '#%s &mdash; %s &mdash; %s: %s &mdash; ',
14
+                esc_html( $product->get_id() ),
15
+                esc_html( apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_name(), $download->get_product_id(), $download->get_order_id(), $download->get_order_key(), $download->get_download_id() ) ),
16
+                esc_html( $file_count ),
17
+                esc_html( wc_get_filename_from_url( $product->get_file_download_path( $download->get_download_id() ) ) )
18
+            );
19
+            printf( _n( 'Downloaded %s time', 'Downloaded %s times', $download->get_download_count(), 'woocommerce' ), esc_html( $download->get_download_count() ) )
20
+            ?>
21 21
 		</strong>
22 22
 	</h3>
23 23
 	<table cellpadding="0" cellspacing="0" class="wc-metabox-content">
@@ -35,30 +35,30 @@  discard block
 block discarded – undo
35 35
 				<td>
36 36
 					<label><?php esc_html_e( 'Customer download link', 'woocommerce' ); ?></label>
37 37
 					<?php
38
-					$download_link = add_query_arg(
39
-						array(
40
-							'download_file' => $download->get_product_id(),
41
-							'order'         => $download->get_order_key(),
42
-							'email'         => urlencode( $download->get_user_email() ),
43
-							'key'           => $download->get_download_id(),
44
-						),
45
-						trailingslashit( home_url() )
46
-					);
47
-					?>
38
+                    $download_link = add_query_arg(
39
+                        array(
40
+                            'download_file' => $download->get_product_id(),
41
+                            'order'         => $download->get_order_key(),
42
+                            'email'         => urlencode( $download->get_user_email() ),
43
+                            'key'           => $download->get_download_id(),
44
+                        ),
45
+                        trailingslashit( home_url() )
46
+                    );
47
+                    ?>
48 48
 					<a id="copy-download-link" class="button" href="<?php echo esc_url( $download_link ); ?>" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>" data-tip-failed="<?php esc_attr_e( 'Copying to clipboard failed. You should be able to right-click the button and copy.', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy link', 'woocommerce' ); ?></a>
49 49
 				</td>
50 50
 				<td>
51 51
 					<label><?php esc_html_e( 'Customer download log', 'woocommerce' ); ?></label>
52 52
 					<?php
53
-					$report_url = add_query_arg(
54
-						'permission_id',
55
-						rawurlencode( $download->get_id() ),
56
-						admin_url( 'admin.php?page=wc-reports&tab=orders&report=downloads' )
57
-					);
58
-					echo '<a class="button" href="' . esc_url( $report_url ) . '">';
59
-					esc_html_e( 'View report', 'woocommerce' );
60
-					echo '</a>';
61
-					?>
53
+                    $report_url = add_query_arg(
54
+                        'permission_id',
55
+                        rawurlencode( $download->get_id() ),
56
+                        admin_url( 'admin.php?page=wc-reports&tab=orders&report=downloads' )
57
+                    );
58
+                    echo '<a class="button" href="' . esc_url( $report_url ) . '">';
59
+                    esc_html_e( 'View report', 'woocommerce' );
60
+                    echo '</a>';
61
+                    ?>
62 62
 				</td>
63 63
 			</tr>
64 64
 		</tbody>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 ?>
6 6
 <div class="wc-metabox closed">
7 7
 	<h3 class="fixed">
8
-		<button type="button" data-permission_id="<?php echo esc_attr( $download->get_id() ); ?>" rel="<?php echo esc_attr( $download->get_product_id() ) . ',' . esc_attr( $download->get_download_id() ); ?>" class="revoke_access button"><?php esc_html_e( 'Revoke access', 'woocommerce' ); ?></button>
9
-		<div class="handlediv" aria-label="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
8
+		<button type="button" data-permission_id="<?php echo esc_attr($download->get_id()); ?>" rel="<?php echo esc_attr($download->get_product_id()) . ',' . esc_attr($download->get_download_id()); ?>" class="revoke_access button"><?php esc_html_e('Revoke access', 'woocommerce'); ?></button>
9
+		<div class="handlediv" aria-label="<?php esc_attr_e('Click to toggle', 'woocommerce'); ?>"></div>
10 10
 		<strong>
11 11
 			<?php
12 12
 			printf(
13 13
 				'#%s &mdash; %s &mdash; %s: %s &mdash; ',
14
-				esc_html( $product->get_id() ),
15
-				esc_html( apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_name(), $download->get_product_id(), $download->get_order_id(), $download->get_order_key(), $download->get_download_id() ) ),
16
-				esc_html( $file_count ),
17
-				esc_html( wc_get_filename_from_url( $product->get_file_download_path( $download->get_download_id() ) ) )
14
+				esc_html($product->get_id()),
15
+				esc_html(apply_filters('woocommerce_admin_download_permissions_title', $product->get_name(), $download->get_product_id(), $download->get_order_id(), $download->get_order_key(), $download->get_download_id())),
16
+				esc_html($file_count),
17
+				esc_html(wc_get_filename_from_url($product->get_file_download_path($download->get_download_id())))
18 18
 			);
19
-			printf( _n( 'Downloaded %s time', 'Downloaded %s times', $download->get_download_count(), 'woocommerce' ), esc_html( $download->get_download_count() ) )
19
+			printf(_n('Downloaded %s time', 'Downloaded %s times', $download->get_download_count(), 'woocommerce'), esc_html($download->get_download_count()))
20 20
 			?>
21 21
 		</strong>
22 22
 	</h3>
@@ -24,39 +24,39 @@  discard block
 block discarded – undo
24 24
 		<tbody>
25 25
 			<tr>
26 26
 				<td>
27
-					<label><?php esc_html_e( 'Downloads remaining', 'woocommerce' ); ?></label>
28
-					<input type="hidden" name="permission_id[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $download->get_id() ); ?>" />
29
-					<input type="number" step="1" min="0" class="short" name="downloads_remaining[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $download->get_downloads_remaining() ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'woocommerce' ); ?>" />
27
+					<label><?php esc_html_e('Downloads remaining', 'woocommerce'); ?></label>
28
+					<input type="hidden" name="permission_id[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr($download->get_id()); ?>" />
29
+					<input type="number" step="1" min="0" class="short" name="downloads_remaining[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr($download->get_downloads_remaining()); ?>" placeholder="<?php esc_attr_e('Unlimited', 'woocommerce'); ?>" />
30 30
 				</td>
31 31
 				<td>
32
-					<label><?php esc_html_e( 'Access expires', 'woocommerce' ); ?></label>
33
-					<input type="text" class="short date-picker" name="access_expires[<?php echo esc_attr( $loop ); ?>]" value="<?php echo ! is_null( $download->get_access_expires() ) ? esc_attr( date_i18n( 'Y-m-d', $download->get_access_expires()->getTimestamp() ) ) : ''; ?>" maxlength="10" placeholder="<?php esc_attr_e( 'Never', 'woocommerce' ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />
32
+					<label><?php esc_html_e('Access expires', 'woocommerce'); ?></label>
33
+					<input type="text" class="short date-picker" name="access_expires[<?php echo esc_attr($loop); ?>]" value="<?php echo !is_null($download->get_access_expires()) ? esc_attr(date_i18n('Y-m-d', $download->get_access_expires()->getTimestamp())) : ''; ?>" maxlength="10" placeholder="<?php esc_attr_e('Never', 'woocommerce'); ?>" pattern="<?php echo esc_attr(apply_filters('woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])')); ?>" />
34 34
 				</td>
35 35
 				<td>
36
-					<label><?php esc_html_e( 'Customer download link', 'woocommerce' ); ?></label>
36
+					<label><?php esc_html_e('Customer download link', 'woocommerce'); ?></label>
37 37
 					<?php
38 38
 					$download_link = add_query_arg(
39 39
 						array(
40 40
 							'download_file' => $download->get_product_id(),
41 41
 							'order'         => $download->get_order_key(),
42
-							'email'         => urlencode( $download->get_user_email() ),
42
+							'email'         => urlencode($download->get_user_email()),
43 43
 							'key'           => $download->get_download_id(),
44 44
 						),
45
-						trailingslashit( home_url() )
45
+						trailingslashit(home_url())
46 46
 					);
47 47
 					?>
48
-					<a id="copy-download-link" class="button" href="<?php echo esc_url( $download_link ); ?>" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>" data-tip-failed="<?php esc_attr_e( 'Copying to clipboard failed. You should be able to right-click the button and copy.', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy link', 'woocommerce' ); ?></a>
48
+					<a id="copy-download-link" class="button" href="<?php echo esc_url($download_link); ?>" data-tip="<?php esc_attr_e('Copied!', 'woocommerce'); ?>" data-tip-failed="<?php esc_attr_e('Copying to clipboard failed. You should be able to right-click the button and copy.', 'woocommerce'); ?>"><?php esc_html_e('Copy link', 'woocommerce'); ?></a>
49 49
 				</td>
50 50
 				<td>
51
-					<label><?php esc_html_e( 'Customer download log', 'woocommerce' ); ?></label>
51
+					<label><?php esc_html_e('Customer download log', 'woocommerce'); ?></label>
52 52
 					<?php
53 53
 					$report_url = add_query_arg(
54 54
 						'permission_id',
55
-						rawurlencode( $download->get_id() ),
56
-						admin_url( 'admin.php?page=wc-reports&tab=orders&report=downloads' )
55
+						rawurlencode($download->get_id()),
56
+						admin_url('admin.php?page=wc-reports&tab=orders&report=downloads')
57 57
 					);
58
-					echo '<a class="button" href="' . esc_url( $report_url ) . '">';
59
-					esc_html_e( 'View report', 'woocommerce' );
58
+					echo '<a class="button" href="' . esc_url($report_url) . '">';
59
+					esc_html_e('View report', 'woocommerce');
60 60
 					echo '</a>';
61 61
 					?>
62 62
 				</td>
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/views/html-product-attribute.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 ?>
6 6
 <div data-taxonomy="<?php echo esc_attr( $attribute->get_taxonomy() ); ?>" class="woocommerce_attribute wc-metabox postbox closed <?php echo esc_attr( implode( ' ', $metabox_class ) ); ?>" rel="<?php echo esc_attr( $attribute->get_position() ); ?>">
@@ -29,45 +29,45 @@  discard block
 block discarded – undo
29 29
 					<td rowspan="3">
30 30
 						<label><?php esc_html_e( 'Value(s)', 'woocommerce' ); ?>:</label>
31 31
 						<?php
32
-						if ( $attribute->is_taxonomy() && $attribute_taxonomy = $attribute->get_taxonomy_object() ) {
33
-							$attribute_types = wc_get_attribute_types();
32
+                        if ( $attribute->is_taxonomy() && $attribute_taxonomy = $attribute->get_taxonomy_object() ) {
33
+                            $attribute_types = wc_get_attribute_types();
34 34
 
35
-							if ( ! array_key_exists( $attribute_taxonomy->attribute_type, $attribute_types ) ) {
36
-								$attribute_taxonomy->attribute_type = 'select';
37
-							}
35
+                            if ( ! array_key_exists( $attribute_taxonomy->attribute_type, $attribute_types ) ) {
36
+                                $attribute_taxonomy->attribute_type = 'select';
37
+                            }
38 38
 
39
-							if ( 'select' === $attribute_taxonomy->attribute_type ) {
40
-								?>
39
+                            if ( 'select' === $attribute_taxonomy->attribute_type ) {
40
+                                ?>
41 41
 								<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo esc_attr( $i ); ?>][]">
42 42
 									<?php
43
-									$args      = array(
44
-										'orderby'    => ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name',
45
-										'hide_empty' => 0,
46
-									);
47
-									$all_terms = get_terms( $attribute->get_taxonomy(), apply_filters( 'woocommerce_product_attribute_terms', $args ) );
48
-									if ( $all_terms ) {
49
-										foreach ( $all_terms as $term ) {
50
-											$options = $attribute->get_options();
51
-											$options = ! empty( $options ) ? $options : array();
52
-											echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_html( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
53
-										}
54
-									}
55
-									?>
43
+                                    $args      = array(
44
+                                        'orderby'    => ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name',
45
+                                        'hide_empty' => 0,
46
+                                    );
47
+                                    $all_terms = get_terms( $attribute->get_taxonomy(), apply_filters( 'woocommerce_product_attribute_terms', $args ) );
48
+                                    if ( $all_terms ) {
49
+                                        foreach ( $all_terms as $term ) {
50
+                                            $options = $attribute->get_options();
51
+                                            $options = ! empty( $options ) ? $options : array();
52
+                                            echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_html( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
53
+                                        }
54
+                                    }
55
+                                    ?>
56 56
 								</select>
57 57
 								<button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></button>
58 58
 								<button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woocommerce' ); ?></button>
59 59
 								<button class="button fr plus add_new_attribute"><?php esc_html_e( 'Add new', 'woocommerce' ); ?></button>
60 60
 								<?php
61
-							}
61
+                            }
62 62
 
63
-							do_action( 'woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute );
64
-						} else {
65
-							/* translators: %s: WC_DELIMITER */
66
-							?>
63
+                            do_action( 'woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute );
64
+                        } else {
65
+                            /* translators: %s: WC_DELIMITER */
66
+                            ?>
67 67
 							<textarea name="attribute_values[<?php echo esc_attr( $i ); ?>]" cols="5" rows="5" placeholder="<?php printf( esc_attr__( 'Enter some text, or some attributes by "%s" separating values.', 'woocommerce' ), WC_DELIMITER ); ?>"><?php echo esc_textarea( wc_implode_text_attributes( $attribute->get_options() ) ); ?></textarea>
68 68
 							<?php
69
-						}
70
-						?>
69
+                        }
70
+                        ?>
71 71
 					</td>
72 72
 				</tr>
73 73
 				<tr>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,70 +1,70 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 ?>
6
-<div data-taxonomy="<?php echo esc_attr( $attribute->get_taxonomy() ); ?>" class="woocommerce_attribute wc-metabox postbox closed <?php echo esc_attr( implode( ' ', $metabox_class ) ); ?>" rel="<?php echo esc_attr( $attribute->get_position() ); ?>">
6
+<div data-taxonomy="<?php echo esc_attr($attribute->get_taxonomy()); ?>" class="woocommerce_attribute wc-metabox postbox closed <?php echo esc_attr(implode(' ', $metabox_class)); ?>" rel="<?php echo esc_attr($attribute->get_position()); ?>">
7 7
 	<h3>
8
-		<a href="#" class="remove_row delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
9
-		<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
10
-		<div class="tips sort" data-tip="<?php esc_attr_e( 'Drag and drop to set admin attribute order', 'woocommerce' ); ?>"></div>			
11
-		<strong class="attribute_name"><?php echo wc_attribute_label( $attribute->get_name() ); ?></strong>
8
+		<a href="#" class="remove_row delete"><?php esc_html_e('Remove', 'woocommerce'); ?></a>
9
+		<div class="handlediv" title="<?php esc_attr_e('Click to toggle', 'woocommerce'); ?>"></div>
10
+		<div class="tips sort" data-tip="<?php esc_attr_e('Drag and drop to set admin attribute order', 'woocommerce'); ?>"></div>			
11
+		<strong class="attribute_name"><?php echo wc_attribute_label($attribute->get_name()); ?></strong>
12 12
 	</h3>
13 13
 	<div class="woocommerce_attribute_data wc-metabox-content hidden">
14 14
 		<table cellpadding="0" cellspacing="0">
15 15
 			<tbody>
16 16
 				<tr>
17 17
 					<td class="attribute_name">
18
-						<label><?php esc_html_e( 'Name', 'woocommerce' ); ?>:</label>
18
+						<label><?php esc_html_e('Name', 'woocommerce'); ?>:</label>
19 19
 
20
-						<?php if ( $attribute->is_taxonomy() ) : ?>
21
-							<strong><?php echo wc_attribute_label( $attribute->get_name() ); ?></strong>
22
-							<input type="hidden" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" />
20
+						<?php if ($attribute->is_taxonomy()) : ?>
21
+							<strong><?php echo wc_attribute_label($attribute->get_name()); ?></strong>
22
+							<input type="hidden" name="attribute_names[<?php echo esc_attr($i); ?>]" value="<?php echo esc_attr($attribute->get_name()); ?>" />
23 23
 						<?php else : ?>
24
-							<input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" />
24
+							<input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr($i); ?>]" value="<?php echo esc_attr($attribute->get_name()); ?>" />
25 25
 						<?php endif; ?>
26 26
 
27
-						<input type="hidden" name="attribute_position[<?php echo esc_attr( $i ); ?>]" class="attribute_position" value="<?php echo esc_attr( $attribute->get_position() ); ?>" />
27
+						<input type="hidden" name="attribute_position[<?php echo esc_attr($i); ?>]" class="attribute_position" value="<?php echo esc_attr($attribute->get_position()); ?>" />
28 28
 					</td>
29 29
 					<td rowspan="3">
30
-						<label><?php esc_html_e( 'Value(s)', 'woocommerce' ); ?>:</label>
30
+						<label><?php esc_html_e('Value(s)', 'woocommerce'); ?>:</label>
31 31
 						<?php
32
-						if ( $attribute->is_taxonomy() && $attribute_taxonomy = $attribute->get_taxonomy_object() ) {
32
+						if ($attribute->is_taxonomy() && $attribute_taxonomy = $attribute->get_taxonomy_object()) {
33 33
 							$attribute_types = wc_get_attribute_types();
34 34
 
35
-							if ( ! array_key_exists( $attribute_taxonomy->attribute_type, $attribute_types ) ) {
35
+							if (!array_key_exists($attribute_taxonomy->attribute_type, $attribute_types)) {
36 36
 								$attribute_taxonomy->attribute_type = 'select';
37 37
 							}
38 38
 
39
-							if ( 'select' === $attribute_taxonomy->attribute_type ) {
39
+							if ('select' === $attribute_taxonomy->attribute_type) {
40 40
 								?>
41
-								<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo esc_attr( $i ); ?>][]">
41
+								<select multiple="multiple" data-placeholder="<?php esc_attr_e('Select terms', 'woocommerce'); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo esc_attr($i); ?>][]">
42 42
 									<?php
43
-									$args      = array(
44
-										'orderby'    => ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name',
43
+									$args = array(
44
+										'orderby'    => !empty($attribute_taxonomy->attribute_orderby) ? $attribute_taxonomy->attribute_orderby : 'name',
45 45
 										'hide_empty' => 0,
46 46
 									);
47
-									$all_terms = get_terms( $attribute->get_taxonomy(), apply_filters( 'woocommerce_product_attribute_terms', $args ) );
48
-									if ( $all_terms ) {
49
-										foreach ( $all_terms as $term ) {
47
+									$all_terms = get_terms($attribute->get_taxonomy(), apply_filters('woocommerce_product_attribute_terms', $args));
48
+									if ($all_terms) {
49
+										foreach ($all_terms as $term) {
50 50
 											$options = $attribute->get_options();
51
-											$options = ! empty( $options ) ? $options : array();
52
-											echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_html( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
51
+											$options = !empty($options) ? $options : array();
52
+											echo '<option value="' . esc_attr($term->term_id) . '"' . wc_selected($term->term_id, $options) . '>' . esc_html(apply_filters('woocommerce_product_attribute_term_name', $term->name, $term)) . '</option>';
53 53
 										}
54 54
 									}
55 55
 									?>
56 56
 								</select>
57
-								<button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></button>
58
-								<button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woocommerce' ); ?></button>
59
-								<button class="button fr plus add_new_attribute"><?php esc_html_e( 'Add new', 'woocommerce' ); ?></button>
57
+								<button class="button plus select_all_attributes"><?php esc_html_e('Select all', 'woocommerce'); ?></button>
58
+								<button class="button minus select_no_attributes"><?php esc_html_e('Select none', 'woocommerce'); ?></button>
59
+								<button class="button fr plus add_new_attribute"><?php esc_html_e('Add new', 'woocommerce'); ?></button>
60 60
 								<?php
61 61
 							}
62 62
 
63
-							do_action( 'woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute );
63
+							do_action('woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute);
64 64
 						} else {
65 65
 							/* translators: %s: WC_DELIMITER */
66 66
 							?>
67
-							<textarea name="attribute_values[<?php echo esc_attr( $i ); ?>]" cols="5" rows="5" placeholder="<?php printf( esc_attr__( 'Enter some text, or some attributes by "%s" separating values.', 'woocommerce' ), WC_DELIMITER ); ?>"><?php echo esc_textarea( wc_implode_text_attributes( $attribute->get_options() ) ); ?></textarea>
67
+							<textarea name="attribute_values[<?php echo esc_attr($i); ?>]" cols="5" rows="5" placeholder="<?php printf(esc_attr__('Enter some text, or some attributes by "%s" separating values.', 'woocommerce'), WC_DELIMITER); ?>"><?php echo esc_textarea(wc_implode_text_attributes($attribute->get_options())); ?></textarea>
68 68
 							<?php
69 69
 						}
70 70
 						?>
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 				</tr>
73 73
 				<tr>
74 74
 					<td>
75
-						<label><input type="checkbox" class="checkbox" <?php checked( $attribute->get_visible(), true ); ?> name="attribute_visibility[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Visible on the product page', 'woocommerce' ); ?></label>
75
+						<label><input type="checkbox" class="checkbox" <?php checked($attribute->get_visible(), true); ?> name="attribute_visibility[<?php echo esc_attr($i); ?>]" value="1" /> <?php esc_html_e('Visible on the product page', 'woocommerce'); ?></label>
76 76
 					</td>
77 77
 				</tr>
78 78
 				<tr>
79 79
 					<td>
80 80
 						<div class="enable_variation show_if_variable">
81
-							<label><input type="checkbox" class="checkbox" <?php checked( $attribute->get_variation(), true ); ?> name="attribute_variation[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Used for variations', 'woocommerce' ); ?></label>
81
+							<label><input type="checkbox" class="checkbox" <?php checked($attribute->get_variation(), true); ?> name="attribute_variation[<?php echo esc_attr($i); ?>]" value="1" /> <?php esc_html_e('Used for variations', 'woocommerce'); ?></label>
82 82
 						</div>
83 83
 					</td>
84 84
 				</tr>
85
-				<?php do_action( 'woocommerce_after_product_attribute_settings', $attribute, $i ); ?>
85
+				<?php do_action('woocommerce_after_product_attribute_settings', $attribute, $i); ?>
86 86
 			</tbody>
87 87
 		</table>
88 88
 	</div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,11 @@
 block discarded – undo
20 20
 						<?php if ( $attribute->is_taxonomy() ) : ?>
21 21
 							<strong><?php echo wc_attribute_label( $attribute->get_name() ); ?></strong>
22 22
 							<input type="hidden" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" />
23
-						<?php else : ?>
24
-							<input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" />
23
+						<?php else {
24
+    : ?>
25
+							<input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i );
26
+}
27
+?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" />
25 28
 						<?php endif; ?>
26 29
 
27 30
 						<input type="hidden" name="attribute_position[<?php echo esc_attr( $i ); ?>]" class="attribute_position" value="<?php echo esc_attr( $attribute->get_position() ); ?>" />
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/views/html-order-item-meta.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@  discard block
 block discarded – undo
7 7
  * @var int $item_id The id of the item being displayed
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 $hidden_order_itemmeta = apply_filters(
14
-	'woocommerce_hidden_order_itemmeta',
15
-	array(
16
-		'_qty',
17
-		'_tax_class',
18
-		'_product_id',
19
-		'_variation_id',
20
-		'_line_subtotal',
21
-		'_line_subtotal_tax',
22
-		'_line_total',
23
-		'_line_tax',
24
-		'method_id',
25
-		'cost',
26
-		'_reduced_stock',
27
-		'_restock_refunded_items',
28
-	)
14
+    'woocommerce_hidden_order_itemmeta',
15
+    array(
16
+        '_qty',
17
+        '_tax_class',
18
+        '_product_id',
19
+        '_variation_id',
20
+        '_line_subtotal',
21
+        '_line_subtotal_tax',
22
+        '_line_total',
23
+        '_line_tax',
24
+        'method_id',
25
+        'cost',
26
+        '_reduced_stock',
27
+        '_restock_refunded_items',
28
+    )
29 29
 );
30 30
 ?><div class="view">
31 31
 	<?php
32
-	$meta_data = $item->get_all_formatted_meta_data( '' );
33
-	if ( $meta_data ) :
34
-		?>
32
+    $meta_data = $item->get_all_formatted_meta_data( '' );
33
+    if ( $meta_data ) :
34
+        ?>
35 35
 		<table cellspacing="0" class="display_meta">
36 36
 			<?php
37
-			foreach ( $meta_data as $meta_id => $meta ) :
38
-				if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
39
-					continue;
40
-				}
41
-				?>
37
+            foreach ( $meta_data as $meta_id => $meta ) :
38
+                if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
39
+                    continue;
40
+                }
41
+                ?>
42 42
 				<tr>
43 43
 					<th><?php echo wp_kses_post( $meta->display_key ); ?>:</th>
44 44
 					<td><?php echo wp_kses_post( force_balance_tags( $meta->display_value ) ); ?></td>
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 		<tbody class="meta_items">
53 53
 			<?php if ( $meta_data ) : ?>
54 54
 				<?php
55
-				foreach ( $meta_data as $meta_id => $meta ) :
56
-					if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
57
-						continue;
58
-					}
59
-					?>
55
+                foreach ( $meta_data as $meta_id => $meta ) :
56
+                    if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
57
+                        continue;
58
+                    }
59
+                    ?>
60 60
 					<tr data-meta_id="<?php echo esc_attr( $meta_id ); ?>">
61 61
 						<td>
62 62
 							<input type="text" maxlength="255" placeholder="<?php esc_attr_e( 'Name (required)', 'woocommerce' ); ?>" name="meta_key[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]" value="<?php echo esc_attr( $meta->key ); ?>" />
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @var object $item The item being displayed
7 7
  * @var int $item_id The id of the item being displayed
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 );
30 30
 ?><div class="view">
31 31
 	<?php
32
-	$meta_data = $item->get_all_formatted_meta_data( '' );
33
-	if ( $meta_data ) :
32
+	$meta_data = $item->get_all_formatted_meta_data('');
33
+	if ($meta_data) :
34 34
 		?>
35 35
 		<table cellspacing="0" class="display_meta">
36 36
 			<?php
37
-			foreach ( $meta_data as $meta_id => $meta ) :
38
-				if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
37
+			foreach ($meta_data as $meta_id => $meta) :
38
+				if (in_array($meta->key, $hidden_order_itemmeta, true)) {
39 39
 					continue;
40 40
 				}
41 41
 				?>
42 42
 				<tr>
43
-					<th><?php echo wp_kses_post( $meta->display_key ); ?>:</th>
44
-					<td><?php echo wp_kses_post( force_balance_tags( $meta->display_value ) ); ?></td>
43
+					<th><?php echo wp_kses_post($meta->display_key); ?>:</th>
44
+					<td><?php echo wp_kses_post(force_balance_tags($meta->display_value)); ?></td>
45 45
 				</tr>
46 46
 			<?php endforeach; ?>
47 47
 		</table>
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
 <div class="edit" style="display: none;">
51 51
 	<table class="meta" cellspacing="0">
52 52
 		<tbody class="meta_items">
53
-			<?php if ( $meta_data ) : ?>
53
+			<?php if ($meta_data) : ?>
54 54
 				<?php
55
-				foreach ( $meta_data as $meta_id => $meta ) :
56
-					if ( in_array( $meta->key, $hidden_order_itemmeta, true ) ) {
55
+				foreach ($meta_data as $meta_id => $meta) :
56
+					if (in_array($meta->key, $hidden_order_itemmeta, true)) {
57 57
 						continue;
58 58
 					}
59 59
 					?>
60
-					<tr data-meta_id="<?php echo esc_attr( $meta_id ); ?>">
60
+					<tr data-meta_id="<?php echo esc_attr($meta_id); ?>">
61 61
 						<td>
62
-							<input type="text" maxlength="255" placeholder="<?php esc_attr_e( 'Name (required)', 'woocommerce' ); ?>" name="meta_key[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]" value="<?php echo esc_attr( $meta->key ); ?>" />
63
-							<textarea placeholder="<?php esc_attr_e( 'Value (required)', 'woocommerce' ); ?>" name="meta_value[<?php echo esc_attr( $item_id ); ?>][<?php echo esc_attr( $meta_id ); ?>]"><?php echo esc_textarea( rawurldecode( $meta->value ) ); ?></textarea>
62
+							<input type="text" maxlength="255" placeholder="<?php esc_attr_e('Name (required)', 'woocommerce'); ?>" name="meta_key[<?php echo esc_attr($item_id); ?>][<?php echo esc_attr($meta_id); ?>]" value="<?php echo esc_attr($meta->key); ?>" />
63
+							<textarea placeholder="<?php esc_attr_e('Value (required)', 'woocommerce'); ?>" name="meta_value[<?php echo esc_attr($item_id); ?>][<?php echo esc_attr($meta_id); ?>]"><?php echo esc_textarea(rawurldecode($meta->value)); ?></textarea>
64 64
 						</td>
65 65
 						<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
66 66
 					</tr>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		</tbody>
70 70
 		<tfoot>
71 71
 			<tr>
72
-				<td colspan="4"><button class="add_order_item_meta button"><?php esc_html_e( 'Add&nbsp;meta', 'woocommerce' ); ?></button></td>
72
+				<td colspan="4"><button class="add_order_item_meta button"><?php esc_html_e('Add&nbsp;meta', 'woocommerce'); ?></button></td>
73 73
 			</tr>
74 74
 		</tfoot>
75 75
 	</table>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/views/html-product-data-attributes.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 ?>
6 6
 <div id="product_attributes" class="panel wc-metaboxes-wrapper hidden">
@@ -11,40 +11,40 @@  discard block
 block discarded – undo
11 11
 		<select name="attribute_taxonomy" class="attribute_taxonomy">
12 12
 			<option value=""><?php esc_html_e( 'Custom product attribute', 'woocommerce' ); ?></option>
13 13
 			<?php
14
-			global $wc_product_attributes;
14
+            global $wc_product_attributes;
15 15
 
16
-			// Array of defined attribute taxonomies.
17
-			$attribute_taxonomies = wc_get_attribute_taxonomies();
16
+            // Array of defined attribute taxonomies.
17
+            $attribute_taxonomies = wc_get_attribute_taxonomies();
18 18
 
19
-			if ( ! empty( $attribute_taxonomies ) ) {
20
-				foreach ( $attribute_taxonomies as $tax ) {
21
-					$attribute_taxonomy_name = wc_attribute_taxonomy_name( $tax->attribute_name );
22
-					$label                   = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
23
-					echo '<option value="' . esc_attr( $attribute_taxonomy_name ) . '">' . esc_html( $label ) . '</option>';
24
-				}
25
-			}
26
-			?>
19
+            if ( ! empty( $attribute_taxonomies ) ) {
20
+                foreach ( $attribute_taxonomies as $tax ) {
21
+                    $attribute_taxonomy_name = wc_attribute_taxonomy_name( $tax->attribute_name );
22
+                    $label                   = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
23
+                    echo '<option value="' . esc_attr( $attribute_taxonomy_name ) . '">' . esc_html( $label ) . '</option>';
24
+                }
25
+            }
26
+            ?>
27 27
 		</select>
28 28
 		<button type="button" class="button add_attribute"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
29 29
 	</div>
30 30
 	<div class="product_attributes wc-metaboxes">
31 31
 		<?php
32
-		// Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set.
33
-		$attributes = $product_object->get_attributes( 'edit' );
34
-		$i          = -1;
32
+        // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set.
33
+        $attributes = $product_object->get_attributes( 'edit' );
34
+        $i          = -1;
35 35
 
36
-		foreach ( $attributes as $attribute ) {
37
-			$i++;
38
-			$metabox_class = array();
36
+        foreach ( $attributes as $attribute ) {
37
+            $i++;
38
+            $metabox_class = array();
39 39
 
40
-			if ( $attribute->is_taxonomy() ) {
41
-				$metabox_class[] = 'taxonomy';
42
-				$metabox_class[] = $attribute->get_name();
43
-			}
40
+            if ( $attribute->is_taxonomy() ) {
41
+                $metabox_class[] = 'taxonomy';
42
+                $metabox_class[] = $attribute->get_name();
43
+            }
44 44
 
45
-			include __DIR__ . '/html-product-attribute.php';
46
-		}
47
-		?>
45
+            include __DIR__ . '/html-product-attribute.php';
46
+        }
47
+        ?>
48 48
 	</div>
49 49
 	<div class="toolbar">
50 50
 		<span class="expand-close">
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 ?>
6 6
 <div id="product_attributes" class="panel wc-metaboxes-wrapper hidden">
7 7
 	<div class="toolbar toolbar-top">
8 8
 		<span class="expand-close">
9
-			<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
9
+			<a href="#" class="expand_all"><?php esc_html_e('Expand', 'woocommerce'); ?></a> / <a href="#" class="close_all"><?php esc_html_e('Close', 'woocommerce'); ?></a>
10 10
 		</span>
11 11
 		<select name="attribute_taxonomy" class="attribute_taxonomy">
12
-			<option value=""><?php esc_html_e( 'Custom product attribute', 'woocommerce' ); ?></option>
12
+			<option value=""><?php esc_html_e('Custom product attribute', 'woocommerce'); ?></option>
13 13
 			<?php
14 14
 			global $wc_product_attributes;
15 15
 
16 16
 			// Array of defined attribute taxonomies.
17 17
 			$attribute_taxonomies = wc_get_attribute_taxonomies();
18 18
 
19
-			if ( ! empty( $attribute_taxonomies ) ) {
20
-				foreach ( $attribute_taxonomies as $tax ) {
21
-					$attribute_taxonomy_name = wc_attribute_taxonomy_name( $tax->attribute_name );
19
+			if (!empty($attribute_taxonomies)) {
20
+				foreach ($attribute_taxonomies as $tax) {
21
+					$attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name);
22 22
 					$label                   = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
23
-					echo '<option value="' . esc_attr( $attribute_taxonomy_name ) . '">' . esc_html( $label ) . '</option>';
23
+					echo '<option value="' . esc_attr($attribute_taxonomy_name) . '">' . esc_html($label) . '</option>';
24 24
 				}
25 25
 			}
26 26
 			?>
27 27
 		</select>
28
-		<button type="button" class="button add_attribute"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
28
+		<button type="button" class="button add_attribute"><?php esc_html_e('Add', 'woocommerce'); ?></button>
29 29
 	</div>
30 30
 	<div class="product_attributes wc-metaboxes">
31 31
 		<?php
32 32
 		// Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set.
33
-		$attributes = $product_object->get_attributes( 'edit' );
33
+		$attributes = $product_object->get_attributes('edit');
34 34
 		$i          = -1;
35 35
 
36
-		foreach ( $attributes as $attribute ) {
36
+		foreach ($attributes as $attribute) {
37 37
 			$i++;
38 38
 			$metabox_class = array();
39 39
 
40
-			if ( $attribute->is_taxonomy() ) {
40
+			if ($attribute->is_taxonomy()) {
41 41
 				$metabox_class[] = 'taxonomy';
42 42
 				$metabox_class[] = $attribute->get_name();
43 43
 			}
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	</div>
49 49
 	<div class="toolbar">
50 50
 		<span class="expand-close">
51
-			<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
51
+			<a href="#" class="expand_all"><?php esc_html_e('Expand', 'woocommerce'); ?></a> / <a href="#" class="close_all"><?php esc_html_e('Close', 'woocommerce'); ?></a>
52 52
 		</span>
53
-		<button type="button" class="button save_attributes button-primary"><?php esc_html_e( 'Save attributes', 'woocommerce' ); ?></button>
53
+		<button type="button" class="button save_attributes button-primary"><?php esc_html_e('Save attributes', 'woocommerce'); ?></button>
54 54
 	</div>
55
-	<?php do_action( 'woocommerce_product_options_attributes' ); ?>
55
+	<?php do_action('woocommerce_product_options_attributes'); ?>
56 56
 </div>
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/views/html-product-download.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 ?>
17 17
 <tr>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@
 block discarded – undo
9 9
  * @var string $key               Product download key.
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if (!defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 ?>
16 16
 <tr>
17 17
 	<td class="sort"></td>
18 18
 	<td class="file_name">
19
-		<input type="text" class="input_text" placeholder="<?php esc_attr_e( 'File name', 'woocommerce' ); ?>" name="_wc_file_names[]" value="<?php echo esc_attr( $file['name'] ); ?>" />
20
-		<input type="hidden" name="_wc_file_hashes[]" value="<?php echo esc_attr( $key ); ?>" />
19
+		<input type="text" class="input_text" placeholder="<?php esc_attr_e('File name', 'woocommerce'); ?>" name="_wc_file_names[]" value="<?php echo esc_attr($file['name']); ?>" />
20
+		<input type="hidden" name="_wc_file_hashes[]" value="<?php echo esc_attr($key); ?>" />
21 21
 	</td>
22 22
 	<td class="file_url">
23
-		<input type="text" class="input_text" placeholder="<?php esc_attr_e( 'http://', 'woocommerce' ); ?>" name="_wc_file_urls[]" value="<?php echo esc_attr( $file['file'] ); ?>" />
24
-		<?php if ( $disabled_download ) : ?>
23
+		<input type="text" class="input_text" placeholder="<?php esc_attr_e('http://', 'woocommerce'); ?>" name="_wc_file_urls[]" value="<?php echo esc_attr($file['file']); ?>" />
24
+		<?php if ($disabled_download) : ?>
25 25
 			<span class="disabled">*</span>
26 26
 		<?php endif; ?>
27 27
 	</td>
28
-	<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e( 'Choose file', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Insert file URL', 'woocommerce' ); ?>"><?php echo esc_html__( 'Choose file', 'woocommerce' ); ?></a></td>
29
-	<td width="1%"><a href="#" class="delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></td>
28
+	<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e('Choose file', 'woocommerce'); ?>" data-update="<?php esc_attr_e('Insert file URL', 'woocommerce'); ?>"><?php echo esc_html__('Choose file', 'woocommerce'); ?></a></td>
29
+	<td width="1%"><a href="#" class="delete"><?php esc_html_e('Delete', 'woocommerce'); ?></a></td>
30 30
 </tr>
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php 3 patches
Indentation   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -19,20 +19,20 @@  discard block
 block discarded – undo
19 19
 		<div class="tips sort" data-tip="<?php esc_attr_e( 'Drag and drop, or click to set admin variation order', 'woocommerce' ); ?>"></div>
20 20
 		<strong>#<?php echo esc_html( $variation_id ); ?> </strong>
21 21
 		<?php
22
-		$attribute_values = $variation_object->get_attributes( 'edit' );
23
-
24
-		foreach ( $product_object->get_attributes( 'edit' ) as $attribute ) {
25
-			if ( ! $attribute->get_variation() ) {
26
-				continue;
27
-			}
28
-			$selected_value = isset( $attribute_values[ sanitize_title( $attribute->get_name() ) ] ) ? $attribute_values[ sanitize_title( $attribute->get_name() ) ] : '';
29
-			?>
22
+        $attribute_values = $variation_object->get_attributes( 'edit' );
23
+
24
+        foreach ( $product_object->get_attributes( 'edit' ) as $attribute ) {
25
+            if ( ! $attribute->get_variation() ) {
26
+                continue;
27
+            }
28
+            $selected_value = isset( $attribute_values[ sanitize_title( $attribute->get_name() ) ] ) ? $attribute_values[ sanitize_title( $attribute->get_name() ) ] : '';
29
+            ?>
30 30
 			<select name="attribute_<?php echo esc_attr( sanitize_title( $attribute->get_name() ) . "[{$loop}]" ); ?>">
31 31
 				<option value="">
32 32
 					<?php
33
-					/* translators: %s: attribute label */
34
-					printf( esc_html__( 'Any %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
35
-					?>
33
+                    /* translators: %s: attribute label */
34
+                    printf( esc_html__( 'Any %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
35
+                    ?>
36 36
 				</option>
37 37
 				<?php if ( $attribute->is_taxonomy() ) : ?>
38 38
 					<?php foreach ( $attribute->get_terms() as $option ) : ?>
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
 				<?php endif; ?>
46 46
 			</select>
47 47
 			<?php
48
-		}
49
-		?>
48
+        }
49
+        ?>
50 50
 		<input type="hidden" class="variable_post_id" name="variable_post_id[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_id ); ?>" />
51 51
 		<input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_object->get_menu_order( 'edit' ) ); ?>" />
52 52
 
53 53
 		<?php
54
-		/**
55
-		 * Variations header action.
56
-		 *
57
-		 * @since 3.6.0
58
-		 *
59
-		 * @param WP_Post $variation Post data.
60
-		 * @param int     $loop      Position in the loop.
61
-		 */
62
-		do_action( 'woocommerce_variation_header', $variation, $loop );
63
-		?>
54
+        /**
55
+         * Variations header action.
56
+         *
57
+         * @since 3.6.0
58
+         *
59
+         * @param WP_Post $variation Post data.
60
+         * @param int     $loop      Position in the loop.
61
+         */
62
+        do_action( 'woocommerce_variation_header', $variation, $loop );
63
+        ?>
64 64
 	</h3>
65 65
 	<div class="woocommerce_variable_attributes wc-metabox-content" style="display: none;">
66 66
 		<div class="data">
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 				</a>
71 71
 			</p>
72 72
 			<?php
73
-			if ( wc_product_sku_enabled() ) {
74
-				woocommerce_wp_text_input(
75
-					array(
76
-						'id'            => "variable_sku{$loop}",
77
-						'name'          => "variable_sku[{$loop}]",
78
-						'value'         => $variation_object->get_sku( 'edit' ),
79
-						'placeholder'   => $variation_object->get_sku(),
80
-						'label'         => '<abbr title="' . esc_attr__( 'Stock Keeping Unit', 'woocommerce' ) . '">' . esc_html__( 'SKU', 'woocommerce' ) . '</abbr>',
81
-						'desc_tip'      => true,
82
-						'description'   => __( 'SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce' ),
83
-						'wrapper_class' => 'form-row form-row-last',
84
-					)
85
-				);
86
-			}
87
-			?>
73
+            if ( wc_product_sku_enabled() ) {
74
+                woocommerce_wp_text_input(
75
+                    array(
76
+                        'id'            => "variable_sku{$loop}",
77
+                        'name'          => "variable_sku[{$loop}]",
78
+                        'value'         => $variation_object->get_sku( 'edit' ),
79
+                        'placeholder'   => $variation_object->get_sku(),
80
+                        'label'         => '<abbr title="' . esc_attr__( 'Stock Keeping Unit', 'woocommerce' ) . '">' . esc_html__( 'SKU', 'woocommerce' ) . '</abbr>',
81
+                        'desc_tip'      => true,
82
+                        'description'   => __( 'SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce' ),
83
+                        'wrapper_class' => 'form-row form-row-last',
84
+                    )
85
+                );
86
+            }
87
+            ?>
88 88
 			<p class="form-row form-row-full options">
89 89
 				<label>
90 90
 					<?php esc_html_e( 'Enabled', 'woocommerce' ); ?>
@@ -111,48 +111,48 @@  discard block
 block discarded – undo
111 111
 
112 112
 			<div class="variable_pricing">
113 113
 				<?php
114
-				$label = sprintf(
115
-					/* translators: %s: currency symbol */
116
-					__( 'Regular price (%s)', 'woocommerce' ),
117
-					get_woocommerce_currency_symbol()
118
-				);
119
-
120
-				woocommerce_wp_text_input(
121
-					array(
122
-						'id'            => "variable_regular_price_{$loop}",
123
-						'name'          => "variable_regular_price[{$loop}]",
124
-						'value'         => wc_format_localized_price( $variation_object->get_regular_price( 'edit' ) ),
125
-						'label'         => $label,
126
-						'data_type'     => 'price',
127
-						'wrapper_class' => 'form-row form-row-first',
128
-						'placeholder'   => __( 'Variation price (required)', 'woocommerce' ),
129
-					)
130
-				);
131
-
132
-				$label = sprintf(
133
-					/* translators: %s: currency symbol */
134
-					__( 'Sale price (%s)', 'woocommerce' ),
135
-					get_woocommerce_currency_symbol()
136
-				);
137
-
138
-				woocommerce_wp_text_input(
139
-					array(
140
-						'id'            => "variable_sale_price{$loop}",
141
-						'name'          => "variable_sale_price[{$loop}]",
142
-						'value'         => wc_format_localized_price( $variation_object->get_sale_price( 'edit' ) ),
143
-						'data_type'     => 'price',
144
-						'label'         => $label . ' <a href="#" class="sale_schedule">' . esc_html__( 'Schedule', 'woocommerce' ) . '</a><a href="#" class="cancel_sale_schedule hidden">' . esc_html__( 'Cancel schedule', 'woocommerce' ) . '</a>',
145
-						'wrapper_class' => 'form-row form-row-last',
146
-					)
147
-				);
148
-
149
-				$sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from( 'edit' ) ? $variation_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() : false;
150
-				$sale_price_dates_to_timestamp   = $variation_object->get_date_on_sale_to( 'edit' ) ? $variation_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() : false;
151
-
152
-				$sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_from_timestamp ) : '';
153
-				$sale_price_dates_to   = $sale_price_dates_to_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_to_timestamp ) : '';
154
-
155
-				echo '<div class="form-field sale_price_dates_fields hidden">
114
+                $label = sprintf(
115
+                    /* translators: %s: currency symbol */
116
+                    __( 'Regular price (%s)', 'woocommerce' ),
117
+                    get_woocommerce_currency_symbol()
118
+                );
119
+
120
+                woocommerce_wp_text_input(
121
+                    array(
122
+                        'id'            => "variable_regular_price_{$loop}",
123
+                        'name'          => "variable_regular_price[{$loop}]",
124
+                        'value'         => wc_format_localized_price( $variation_object->get_regular_price( 'edit' ) ),
125
+                        'label'         => $label,
126
+                        'data_type'     => 'price',
127
+                        'wrapper_class' => 'form-row form-row-first',
128
+                        'placeholder'   => __( 'Variation price (required)', 'woocommerce' ),
129
+                    )
130
+                );
131
+
132
+                $label = sprintf(
133
+                    /* translators: %s: currency symbol */
134
+                    __( 'Sale price (%s)', 'woocommerce' ),
135
+                    get_woocommerce_currency_symbol()
136
+                );
137
+
138
+                woocommerce_wp_text_input(
139
+                    array(
140
+                        'id'            => "variable_sale_price{$loop}",
141
+                        'name'          => "variable_sale_price[{$loop}]",
142
+                        'value'         => wc_format_localized_price( $variation_object->get_sale_price( 'edit' ) ),
143
+                        'data_type'     => 'price',
144
+                        'label'         => $label . ' <a href="#" class="sale_schedule">' . esc_html__( 'Schedule', 'woocommerce' ) . '</a><a href="#" class="cancel_sale_schedule hidden">' . esc_html__( 'Cancel schedule', 'woocommerce' ) . '</a>',
145
+                        'wrapper_class' => 'form-row form-row-last',
146
+                    )
147
+                );
148
+
149
+                $sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from( 'edit' ) ? $variation_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() : false;
150
+                $sale_price_dates_to_timestamp   = $variation_object->get_date_on_sale_to( 'edit' ) ? $variation_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() : false;
151
+
152
+                $sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_from_timestamp ) : '';
153
+                $sale_price_dates_to   = $sale_price_dates_to_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_to_timestamp ) : '';
154
+
155
+                echo '<div class="form-field sale_price_dates_fields hidden">
156 156
 					<p class="form-row form-row-first">
157 157
 						<label>' . esc_html__( 'Sale start date', 'woocommerce' ) . '</label>
158 158
 						<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . esc_attr( $loop ) . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . esc_attr_x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
@@ -163,150 +163,150 @@  discard block
 block discarded – undo
163 163
 					</p>
164 164
 				</div>';
165 165
 
166
-				/**
167
-				 * Variation options pricing action.
168
-				 *
169
-				 * @since 2.5.0
170
-				 *
171
-				 * @param int     $loop           Position in the loop.
172
-				 * @param array   $variation_data Variation data.
173
-				 * @param WP_Post $variation      Post data.
174
-				 */
175
-				do_action( 'woocommerce_variation_options_pricing', $loop, $variation_data, $variation );
176
-				?>
166
+                /**
167
+                 * Variation options pricing action.
168
+                 *
169
+                 * @since 2.5.0
170
+                 *
171
+                 * @param int     $loop           Position in the loop.
172
+                 * @param array   $variation_data Variation data.
173
+                 * @param WP_Post $variation      Post data.
174
+                 */
175
+                do_action( 'woocommerce_variation_options_pricing', $loop, $variation_data, $variation );
176
+                ?>
177 177
 			</div>
178 178
 
179 179
 			<?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
180 180
 				<div class="show_if_variation_manage_stock" style="display: none;">
181 181
 					<?php
182
-					woocommerce_wp_text_input(
183
-						array(
184
-							'id'                => "variable_stock{$loop}",
185
-							'name'              => "variable_stock[{$loop}]",
186
-							'value'             => wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ),
187
-							'label'             => __( 'Stock quantity', 'woocommerce' ),
188
-							'desc_tip'          => true,
189
-							'description'       => __( "Enter a number to set stock quantity at the variation level. Use a variation's 'Manage stock?' check box above to enable/disable stock management at the variation level.", 'woocommerce' ),
190
-							'type'              => 'number',
191
-							'custom_attributes' => array(
192
-								'step' => 'any',
193
-							),
194
-							'data_type'         => 'stock',
195
-							'wrapper_class'     => 'form-row form-row-first',
196
-						)
197
-					);
198
-
199
-					echo '<input type="hidden" name="variable_original_stock[' . esc_attr( $loop ) . ']" value="' . esc_attr( wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ) ) . '" />';
200
-
201
-					woocommerce_wp_select(
202
-						array(
203
-							'id'            => "variable_backorders{$loop}",
204
-							'name'          => "variable_backorders[{$loop}]",
205
-							'value'         => $variation_object->get_backorders( 'edit' ),
206
-							'label'         => __( 'Allow backorders?', 'woocommerce' ),
207
-							'options'       => wc_get_product_backorder_options(),
208
-							'desc_tip'      => true,
209
-							'description'   => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
210
-							'wrapper_class' => 'form-row form-row-last',
211
-						)
212
-					);
213
-
214
-					$low_stock_placeholder = ( $product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount() )
215
-						? sprintf(
216
-							/* translators: %d: Amount of stock left */
217
-							esc_attr__( 'Parent product\'s threshold (%d)', 'woocommerce' ),
218
-							esc_attr( $product_object->get_low_stock_amount() )
219
-						)
220
-						: sprintf(
221
-							/* translators: %d: Amount of stock left */
222
-							esc_attr__( 'Store-wide threshold (%d)', 'woocommerce' ),
223
-							esc_attr( get_option( 'woocommerce_notify_low_stock_amount' ) )
224
-						);
225
-
226
-					woocommerce_wp_text_input(
227
-						array(
228
-							'id'                => "variable_low_stock_amount{$loop}",
229
-							'name'              => "variable_low_stock_amount[{$loop}]",
230
-							'value'             => $variation_object->get_low_stock_amount( 'edit' ),
231
-							'placeholder'       => $low_stock_placeholder,
232
-							'label'             => __( 'Low stock threshold', 'woocommerce' ),
233
-							'desc_tip'          => true,
234
-							'description'       => __( 'When variation stock reaches this amount you will be notified by email. The default value for all variations can be set in the product Inventory tab. The shop default value can be set in Settings > Products > Inventory.', 'woocommerce' ),
235
-							'type'              => 'number',
236
-							'custom_attributes' => array(
237
-								'step' => 'any',
238
-							),
239
-							'wrapper_class' => 'form-row',
240
-						)
241
-					);
242
-
243
-					/**
244
-					 * Variation options inventory action.
245
-					 *
246
-					 * @since 2.5.0
247
-					 *
248
-					 * @param int     $loop           Position in the loop.
249
-					 * @param array   $variation_data Variation data.
250
-					 * @param WP_Post $variation      Post data.
251
-					 */
252
-					do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
253
-					?>
182
+                    woocommerce_wp_text_input(
183
+                        array(
184
+                            'id'                => "variable_stock{$loop}",
185
+                            'name'              => "variable_stock[{$loop}]",
186
+                            'value'             => wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ),
187
+                            'label'             => __( 'Stock quantity', 'woocommerce' ),
188
+                            'desc_tip'          => true,
189
+                            'description'       => __( "Enter a number to set stock quantity at the variation level. Use a variation's 'Manage stock?' check box above to enable/disable stock management at the variation level.", 'woocommerce' ),
190
+                            'type'              => 'number',
191
+                            'custom_attributes' => array(
192
+                                'step' => 'any',
193
+                            ),
194
+                            'data_type'         => 'stock',
195
+                            'wrapper_class'     => 'form-row form-row-first',
196
+                        )
197
+                    );
198
+
199
+                    echo '<input type="hidden" name="variable_original_stock[' . esc_attr( $loop ) . ']" value="' . esc_attr( wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ) ) . '" />';
200
+
201
+                    woocommerce_wp_select(
202
+                        array(
203
+                            'id'            => "variable_backorders{$loop}",
204
+                            'name'          => "variable_backorders[{$loop}]",
205
+                            'value'         => $variation_object->get_backorders( 'edit' ),
206
+                            'label'         => __( 'Allow backorders?', 'woocommerce' ),
207
+                            'options'       => wc_get_product_backorder_options(),
208
+                            'desc_tip'      => true,
209
+                            'description'   => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
210
+                            'wrapper_class' => 'form-row form-row-last',
211
+                        )
212
+                    );
213
+
214
+                    $low_stock_placeholder = ( $product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount() )
215
+                        ? sprintf(
216
+                            /* translators: %d: Amount of stock left */
217
+                            esc_attr__( 'Parent product\'s threshold (%d)', 'woocommerce' ),
218
+                            esc_attr( $product_object->get_low_stock_amount() )
219
+                        )
220
+                        : sprintf(
221
+                            /* translators: %d: Amount of stock left */
222
+                            esc_attr__( 'Store-wide threshold (%d)', 'woocommerce' ),
223
+                            esc_attr( get_option( 'woocommerce_notify_low_stock_amount' ) )
224
+                        );
225
+
226
+                    woocommerce_wp_text_input(
227
+                        array(
228
+                            'id'                => "variable_low_stock_amount{$loop}",
229
+                            'name'              => "variable_low_stock_amount[{$loop}]",
230
+                            'value'             => $variation_object->get_low_stock_amount( 'edit' ),
231
+                            'placeholder'       => $low_stock_placeholder,
232
+                            'label'             => __( 'Low stock threshold', 'woocommerce' ),
233
+                            'desc_tip'          => true,
234
+                            'description'       => __( 'When variation stock reaches this amount you will be notified by email. The default value for all variations can be set in the product Inventory tab. The shop default value can be set in Settings > Products > Inventory.', 'woocommerce' ),
235
+                            'type'              => 'number',
236
+                            'custom_attributes' => array(
237
+                                'step' => 'any',
238
+                            ),
239
+                            'wrapper_class' => 'form-row',
240
+                        )
241
+                    );
242
+
243
+                    /**
244
+                     * Variation options inventory action.
245
+                     *
246
+                     * @since 2.5.0
247
+                     *
248
+                     * @param int     $loop           Position in the loop.
249
+                     * @param array   $variation_data Variation data.
250
+                     * @param WP_Post $variation      Post data.
251
+                     */
252
+                    do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
253
+                    ?>
254 254
 				</div>
255 255
 			<?php endif; ?>
256 256
 
257 257
 			<div>
258 258
 				<?php
259
-				woocommerce_wp_select(
260
-					array(
261
-						'id'            => "variable_stock_status{$loop}",
262
-						'name'          => "variable_stock_status[{$loop}]",
263
-						'value'         => $variation_object->get_stock_status( 'edit' ),
264
-						'label'         => __( 'Stock status', 'woocommerce' ),
265
-						'options'       => wc_get_product_stock_status_options(),
266
-						'desc_tip'      => true,
267
-						'description'   => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
268
-						'wrapper_class' => 'form-row form-row-full variable_stock_status',
269
-					)
270
-				);
271
-
272
-				if ( wc_product_weight_enabled() ) {
273
-					$label = sprintf(
274
-						/* translators: %s: weight unit */
275
-						__( 'Weight (%s)', 'woocommerce' ),
276
-						esc_html( get_option( 'woocommerce_weight_unit' ) )
277
-					);
278
-
279
-					woocommerce_wp_text_input(
280
-						array(
281
-							'id'            => "variable_weight{$loop}",
282
-							'name'          => "variable_weight[{$loop}]",
283
-							'value'         => wc_format_localized_decimal( $variation_object->get_weight( 'edit' ) ),
284
-							'placeholder'   => wc_format_localized_decimal( $product_object->get_weight() ),
285
-							'label'         => $label,
286
-							'desc_tip'      => true,
287
-							'description'   => __( 'Weight in decimal form', 'woocommerce' ),
288
-							'type'          => 'text',
289
-							'data_type'     => 'decimal',
290
-							'wrapper_class' => 'form-row form-row-first hide_if_variation_virtual',
291
-						)
292
-					);
293
-				}
294
-
295
-				if ( wc_product_dimensions_enabled() ) {
296
-					$parent_length = wc_format_localized_decimal( $product_object->get_length() );
297
-					$parent_width  = wc_format_localized_decimal( $product_object->get_width() );
298
-					$parent_height = wc_format_localized_decimal( $product_object->get_height() );
299
-
300
-					?>
259
+                woocommerce_wp_select(
260
+                    array(
261
+                        'id'            => "variable_stock_status{$loop}",
262
+                        'name'          => "variable_stock_status[{$loop}]",
263
+                        'value'         => $variation_object->get_stock_status( 'edit' ),
264
+                        'label'         => __( 'Stock status', 'woocommerce' ),
265
+                        'options'       => wc_get_product_stock_status_options(),
266
+                        'desc_tip'      => true,
267
+                        'description'   => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
268
+                        'wrapper_class' => 'form-row form-row-full variable_stock_status',
269
+                    )
270
+                );
271
+
272
+                if ( wc_product_weight_enabled() ) {
273
+                    $label = sprintf(
274
+                        /* translators: %s: weight unit */
275
+                        __( 'Weight (%s)', 'woocommerce' ),
276
+                        esc_html( get_option( 'woocommerce_weight_unit' ) )
277
+                    );
278
+
279
+                    woocommerce_wp_text_input(
280
+                        array(
281
+                            'id'            => "variable_weight{$loop}",
282
+                            'name'          => "variable_weight[{$loop}]",
283
+                            'value'         => wc_format_localized_decimal( $variation_object->get_weight( 'edit' ) ),
284
+                            'placeholder'   => wc_format_localized_decimal( $product_object->get_weight() ),
285
+                            'label'         => $label,
286
+                            'desc_tip'      => true,
287
+                            'description'   => __( 'Weight in decimal form', 'woocommerce' ),
288
+                            'type'          => 'text',
289
+                            'data_type'     => 'decimal',
290
+                            'wrapper_class' => 'form-row form-row-first hide_if_variation_virtual',
291
+                        )
292
+                    );
293
+                }
294
+
295
+                if ( wc_product_dimensions_enabled() ) {
296
+                    $parent_length = wc_format_localized_decimal( $product_object->get_length() );
297
+                    $parent_width  = wc_format_localized_decimal( $product_object->get_width() );
298
+                    $parent_height = wc_format_localized_decimal( $product_object->get_height() );
299
+
300
+                    ?>
301 301
 					<p class="form-field form-row dimensions_field hide_if_variation_virtual form-row-last">
302 302
 						<label for="product_length">
303 303
 							<?php
304
-							printf(
305
-								/* translators: %s: dimension unit */
306
-								esc_html__( 'Dimensions (L&times;W&times;H) (%s)', 'woocommerce' ),
307
-								esc_html( get_option( 'woocommerce_dimension_unit' ) )
308
-							);
309
-							?>
304
+                            printf(
305
+                                /* translators: %s: dimension unit */
306
+                                esc_html__( 'Dimensions (L&times;W&times;H) (%s)', 'woocommerce' ),
307
+                                esc_html( get_option( 'woocommerce_dimension_unit' ) )
308
+                            );
309
+                            ?>
310 310
 						</label>
311 311
 						<?php echo wc_help_tip( __( 'Length x width x height in decimal form', 'woocommerce' ) ); ?>
312 312
 						<span class="wrap">
@@ -316,80 +316,80 @@  discard block
 block discarded – undo
316 316
 						</span>
317 317
 					</p>
318 318
 					<?php
319
-				}
320
-
321
-				/**
322
-				 * Variation options dimensions action.
323
-				 *
324
-				 * @since 2.5.0
325
-				 *
326
-				 * @param int     $loop           Position in the loop.
327
-				 * @param array   $variation_data Variation data.
328
-				 * @param WP_Post $variation      Post data.
329
-				 */
330
-				do_action( 'woocommerce_variation_options_dimensions', $loop, $variation_data, $variation );
331
-				?>
319
+                }
320
+
321
+                /**
322
+                 * Variation options dimensions action.
323
+                 *
324
+                 * @since 2.5.0
325
+                 *
326
+                 * @param int     $loop           Position in the loop.
327
+                 * @param array   $variation_data Variation data.
328
+                 * @param WP_Post $variation      Post data.
329
+                 */
330
+                do_action( 'woocommerce_variation_options_dimensions', $loop, $variation_data, $variation );
331
+                ?>
332 332
 			</div>
333 333
 
334 334
 			<div>
335 335
 				<p class="form-row hide_if_variation_virtual form-row-full">
336 336
 					<label><?php esc_html_e( 'Shipping class', 'woocommerce' ); ?></label>
337 337
 					<?php
338
-					wp_dropdown_categories(
339
-						array(
340
-							'taxonomy'         => 'product_shipping_class',
341
-							'hide_empty'       => 0,
342
-							'show_option_none' => __( 'Same as parent', 'woocommerce' ),
343
-							'name'             => 'variable_shipping_class[' . $loop . ']',
344
-							'id'               => '',
345
-							'selected'         => $variation_object->get_shipping_class_id( 'edit' ),
346
-						)
347
-					);
348
-					?>
338
+                    wp_dropdown_categories(
339
+                        array(
340
+                            'taxonomy'         => 'product_shipping_class',
341
+                            'hide_empty'       => 0,
342
+                            'show_option_none' => __( 'Same as parent', 'woocommerce' ),
343
+                            'name'             => 'variable_shipping_class[' . $loop . ']',
344
+                            'id'               => '',
345
+                            'selected'         => $variation_object->get_shipping_class_id( 'edit' ),
346
+                        )
347
+                    );
348
+                    ?>
349 349
 				</p>
350 350
 
351 351
 				<?php
352
-				if ( wc_tax_enabled() ) {
353
-					woocommerce_wp_select(
354
-						array(
355
-							'id'            => "variable_tax_class{$loop}",
356
-							'name'          => "variable_tax_class[{$loop}]",
357
-							'value'         => $variation_object->get_tax_class( 'edit' ),
358
-							'label'         => __( 'Tax class', 'woocommerce' ),
359
-							'options'       => array( 'parent' => __( 'Same as parent', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
360
-							'desc_tip'      => 'true',
361
-							'description'   => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
362
-							'wrapper_class' => 'form-row form-row-full',
363
-						)
364
-					);
365
-
366
-					/**
367
-					 * Variation options tax action.
368
-					 *
369
-					 * @since 2.5.0
370
-					 *
371
-					 * @param int     $loop           Position in the loop.
372
-					 * @param array   $variation_data Variation data.
373
-					 * @param WP_Post $variation      Post data.
374
-					 */
375
-					do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
376
-				}
377
-				?>
352
+                if ( wc_tax_enabled() ) {
353
+                    woocommerce_wp_select(
354
+                        array(
355
+                            'id'            => "variable_tax_class{$loop}",
356
+                            'name'          => "variable_tax_class[{$loop}]",
357
+                            'value'         => $variation_object->get_tax_class( 'edit' ),
358
+                            'label'         => __( 'Tax class', 'woocommerce' ),
359
+                            'options'       => array( 'parent' => __( 'Same as parent', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
360
+                            'desc_tip'      => 'true',
361
+                            'description'   => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
362
+                            'wrapper_class' => 'form-row form-row-full',
363
+                        )
364
+                    );
365
+
366
+                    /**
367
+                     * Variation options tax action.
368
+                     *
369
+                     * @since 2.5.0
370
+                     *
371
+                     * @param int     $loop           Position in the loop.
372
+                     * @param array   $variation_data Variation data.
373
+                     * @param WP_Post $variation      Post data.
374
+                     */
375
+                    do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
376
+                }
377
+                ?>
378 378
 			</div>
379 379
 			<div>
380 380
 				<?php
381
-				woocommerce_wp_textarea_input(
382
-					array(
383
-						'id'            => "variable_description{$loop}",
384
-						'name'          => "variable_description[{$loop}]",
385
-						'value'         => $variation_object->get_description( 'edit' ),
386
-						'label'         => __( 'Description', 'woocommerce' ),
387
-						'desc_tip'      => true,
388
-						'description'   => __( 'Enter an optional description for this variation.', 'woocommerce' ),
389
-						'wrapper_class' => 'form-row form-row-full',
390
-					)
391
-				);
392
-				?>
381
+                woocommerce_wp_textarea_input(
382
+                    array(
383
+                        'id'            => "variable_description{$loop}",
384
+                        'name'          => "variable_description[{$loop}]",
385
+                        'value'         => $variation_object->get_description( 'edit' ),
386
+                        'label'         => __( 'Description', 'woocommerce' ),
387
+                        'desc_tip'      => true,
388
+                        'description'   => __( 'Enter an optional description for this variation.', 'woocommerce' ),
389
+                        'wrapper_class' => 'form-row form-row-full',
390
+                    )
391
+                );
392
+                ?>
393 393
 			</div>
394 394
 			<div class="show_if_variation_downloadable" style="display: none;">
395 395
 				<div class="form-row form-row-full downloadable_files">
@@ -404,46 +404,46 @@  discard block
 block discarded – undo
404 404
 						</thead>
405 405
 						<tbody>
406 406
 							<?php
407
-							$downloadable_files       = $variation_object->get_downloads( 'edit' );
408
-							$disabled_downloads_count = 0;
409
-
410
-							if ( $downloadable_files ) {
411
-								foreach ( $downloadable_files as $key => $file ) {
412
-									$disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
413
-									$disabled_downloads_count += (int) $disabled_download;
414
-									include __DIR__ . '/html-product-variation-download.php';
415
-								}
416
-							}
417
-							?>
407
+                            $downloadable_files       = $variation_object->get_downloads( 'edit' );
408
+                            $disabled_downloads_count = 0;
409
+
410
+                            if ( $downloadable_files ) {
411
+                                foreach ( $downloadable_files as $key => $file ) {
412
+                                    $disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
413
+                                    $disabled_downloads_count += (int) $disabled_download;
414
+                                    include __DIR__ . '/html-product-variation-download.php';
415
+                                }
416
+                            }
417
+                            ?>
418 418
 						</tbody>
419 419
 						<tfoot>
420 420
 							<div>
421 421
 								<th colspan="1">
422 422
 									<a href="#" class="button insert" data-row="
423 423
 									<?php
424
-									$key  = '';
425
-									$file = array(
426
-										'file' => '',
427
-										'name' => '',
428
-									);
429
-									$disabled_download = false;
430
-									ob_start();
431
-									require __DIR__ . '/html-product-variation-download.php';
432
-									echo esc_attr( ob_get_clean() );
433
-									?>
424
+                                    $key  = '';
425
+                                    $file = array(
426
+                                        'file' => '',
427
+                                        'name' => '',
428
+                                    );
429
+                                    $disabled_download = false;
430
+                                    ob_start();
431
+                                    require __DIR__ . '/html-product-variation-download.php';
432
+                                    echo esc_attr( ob_get_clean() );
433
+                                    ?>
434 434
 									"><?php esc_html_e( 'Add file', 'woocommerce' ); ?></a>
435 435
 								</th>
436 436
 								<th colspan="3">
437 437
 									<?php if ( $disabled_downloads_count ) : ?>
438 438
 										<span class="disabled">*</span>
439 439
 										<?php
440
-										printf(
441
-											/* translators: 1: opening link tag, 2: closing link tag. */
442
-											esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
443
-											'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
444
-											'</a>'
445
-										);
446
-										?>
440
+                                        printf(
441
+                                            /* translators: 1: opening link tag, 2: closing link tag. */
442
+                                            esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
443
+                                            '<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
444
+                                            '</a>'
445
+                                        );
446
+                                        ?>
447 447
 									<?php endif; ?>
448 448
 								</th>
449 449
 							</div>
@@ -453,53 +453,53 @@  discard block
 block discarded – undo
453 453
 			</div>
454 454
 			<div class="show_if_variation_downloadable" style="display: none;">
455 455
 				<?php
456
-				woocommerce_wp_text_input(
457
-					array(
458
-						'id'                => "variable_download_limit{$loop}",
459
-						'name'              => "variable_download_limit[{$loop}]",
460
-						'value'             => $variation_object->get_download_limit( 'edit' ) < 0 ? '' : $variation_object->get_download_limit( 'edit' ),
461
-						'label'             => __( 'Download limit', 'woocommerce' ),
462
-						'placeholder'       => __( 'Unlimited', 'woocommerce' ),
463
-						'description'       => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
464
-						'type'              => 'number',
465
-						'desc_tip'          => true,
466
-						'custom_attributes' => array(
467
-							'step' => '1',
468
-							'min'  => '0',
469
-						),
470
-						'wrapper_class'     => 'form-row form-row-first',
471
-					)
472
-				);
473
-
474
-				woocommerce_wp_text_input(
475
-					array(
476
-						'id'                => "variable_download_expiry{$loop}",
477
-						'name'              => "variable_download_expiry[{$loop}]",
478
-						'value'             => $variation_object->get_download_expiry( 'edit' ) < 0 ? '' : $variation_object->get_download_expiry( 'edit' ),
479
-						'label'             => __( 'Download expiry', 'woocommerce' ),
480
-						'placeholder'       => __( 'Never', 'woocommerce' ),
481
-						'description'       => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
482
-						'type'              => 'number',
483
-						'desc_tip'          => true,
484
-						'custom_attributes' => array(
485
-							'step' => '1',
486
-							'min'  => '0',
487
-						),
488
-						'wrapper_class'     => 'form-row form-row-last',
489
-					)
490
-				);
491
-
492
-				/**
493
-				 * Variation options download action.
494
-				 *
495
-				 * @since 2.5.0
496
-				 *
497
-				 * @param int     $loop           Position in the loop.
498
-				 * @param array   $variation_data Variation data.
499
-				 * @param WP_Post $variation      Post data.
500
-				 */
501
-				do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
502
-				?>
456
+                woocommerce_wp_text_input(
457
+                    array(
458
+                        'id'                => "variable_download_limit{$loop}",
459
+                        'name'              => "variable_download_limit[{$loop}]",
460
+                        'value'             => $variation_object->get_download_limit( 'edit' ) < 0 ? '' : $variation_object->get_download_limit( 'edit' ),
461
+                        'label'             => __( 'Download limit', 'woocommerce' ),
462
+                        'placeholder'       => __( 'Unlimited', 'woocommerce' ),
463
+                        'description'       => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
464
+                        'type'              => 'number',
465
+                        'desc_tip'          => true,
466
+                        'custom_attributes' => array(
467
+                            'step' => '1',
468
+                            'min'  => '0',
469
+                        ),
470
+                        'wrapper_class'     => 'form-row form-row-first',
471
+                    )
472
+                );
473
+
474
+                woocommerce_wp_text_input(
475
+                    array(
476
+                        'id'                => "variable_download_expiry{$loop}",
477
+                        'name'              => "variable_download_expiry[{$loop}]",
478
+                        'value'             => $variation_object->get_download_expiry( 'edit' ) < 0 ? '' : $variation_object->get_download_expiry( 'edit' ),
479
+                        'label'             => __( 'Download expiry', 'woocommerce' ),
480
+                        'placeholder'       => __( 'Never', 'woocommerce' ),
481
+                        'description'       => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
482
+                        'type'              => 'number',
483
+                        'desc_tip'          => true,
484
+                        'custom_attributes' => array(
485
+                            'step' => '1',
486
+                            'min'  => '0',
487
+                        ),
488
+                        'wrapper_class'     => 'form-row form-row-last',
489
+                    )
490
+                );
491
+
492
+                /**
493
+                 * Variation options download action.
494
+                 *
495
+                 * @since 2.5.0
496
+                 *
497
+                 * @param int     $loop           Position in the loop.
498
+                 * @param array   $variation_data Variation data.
499
+                 * @param WP_Post $variation      Post data.
500
+                 */
501
+                do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
502
+                ?>
503 503
 			</div>
504 504
 			<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
505 505
 		</div>
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -9,46 +9,46 @@  discard block
 block discarded – undo
9 9
  * @var array $variation_data array of variation data @deprecated 4.4.0.
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 ?>
15 15
 <div class="woocommerce_variation wc-metabox closed">
16 16
 	<h3>
17
-		<a href="#" class="remove_variation delete" rel="<?php echo esc_attr( $variation_id ); ?>"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
18
-		<div class="handlediv" aria-label="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
19
-		<div class="tips sort" data-tip="<?php esc_attr_e( 'Drag and drop, or click to set admin variation order', 'woocommerce' ); ?>"></div>
20
-		<strong>#<?php echo esc_html( $variation_id ); ?> </strong>
17
+		<a href="#" class="remove_variation delete" rel="<?php echo esc_attr($variation_id); ?>"><?php esc_html_e('Remove', 'woocommerce'); ?></a>
18
+		<div class="handlediv" aria-label="<?php esc_attr_e('Click to toggle', 'woocommerce'); ?>"></div>
19
+		<div class="tips sort" data-tip="<?php esc_attr_e('Drag and drop, or click to set admin variation order', 'woocommerce'); ?>"></div>
20
+		<strong>#<?php echo esc_html($variation_id); ?> </strong>
21 21
 		<?php
22
-		$attribute_values = $variation_object->get_attributes( 'edit' );
22
+		$attribute_values = $variation_object->get_attributes('edit');
23 23
 
24
-		foreach ( $product_object->get_attributes( 'edit' ) as $attribute ) {
25
-			if ( ! $attribute->get_variation() ) {
24
+		foreach ($product_object->get_attributes('edit') as $attribute) {
25
+			if (!$attribute->get_variation()) {
26 26
 				continue;
27 27
 			}
28
-			$selected_value = isset( $attribute_values[ sanitize_title( $attribute->get_name() ) ] ) ? $attribute_values[ sanitize_title( $attribute->get_name() ) ] : '';
28
+			$selected_value = isset($attribute_values[sanitize_title($attribute->get_name())]) ? $attribute_values[sanitize_title($attribute->get_name())] : '';
29 29
 			?>
30
-			<select name="attribute_<?php echo esc_attr( sanitize_title( $attribute->get_name() ) . "[{$loop}]" ); ?>">
30
+			<select name="attribute_<?php echo esc_attr(sanitize_title($attribute->get_name()) . "[{$loop}]"); ?>">
31 31
 				<option value="">
32 32
 					<?php
33 33
 					/* translators: %s: attribute label */
34
-					printf( esc_html__( 'Any %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
34
+					printf(esc_html__('Any %s&hellip;', 'woocommerce'), wc_attribute_label($attribute->get_name())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
35 35
 					?>
36 36
 				</option>
37
-				<?php if ( $attribute->is_taxonomy() ) : ?>
38
-					<?php foreach ( $attribute->get_terms() as $option ) : ?>
39
-						<option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object ) ); ?></option>
37
+				<?php if ($attribute->is_taxonomy()) : ?>
38
+					<?php foreach ($attribute->get_terms() as $option) : ?>
39
+						<option <?php selected($selected_value, $option->slug); ?> value="<?php echo esc_attr($option->slug); ?>"><?php echo esc_html(apply_filters('woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object)); ?></option>
40 40
 					<?php endforeach; ?>
41 41
 				<?php else : ?>
42
-					<?php foreach ( $attribute->get_options() as $option ) : ?>
43
-						<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
42
+					<?php foreach ($attribute->get_options() as $option) : ?>
43
+						<option <?php selected($selected_value, $option); ?> value="<?php echo esc_attr($option); ?>"><?php echo esc_html(apply_filters('woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object)); ?></option>
44 44
 					<?php endforeach; ?>
45 45
 				<?php endif; ?>
46 46
 			</select>
47 47
 			<?php
48 48
 		}
49 49
 		?>
50
-		<input type="hidden" class="variable_post_id" name="variable_post_id[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_id ); ?>" />
51
-		<input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_object->get_menu_order( 'edit' ) ); ?>" />
50
+		<input type="hidden" class="variable_post_id" name="variable_post_id[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr($variation_id); ?>" />
51
+		<input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr($variation_object->get_menu_order('edit')); ?>" />
52 52
 
53 53
 		<?php
54 54
 		/**
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
 		 * @param WP_Post $variation Post data.
60 60
 		 * @param int     $loop      Position in the loop.
61 61
 		 */
62
-		do_action( 'woocommerce_variation_header', $variation, $loop );
62
+		do_action('woocommerce_variation_header', $variation, $loop);
63 63
 		?>
64 64
 	</h3>
65 65
 	<div class="woocommerce_variable_attributes wc-metabox-content" style="display: none;">
66 66
 		<div class="data">
67 67
 			<p class="form-row form-row-first upload_image">
68
-				<a href="#" class="upload_image_button tips <?php echo $variation_object->get_image_id( 'edit' ) ? 'remove' : ''; ?>" data-tip="<?php echo $variation_object->get_image_id( 'edit' ) ? esc_attr__( 'Remove this image', 'woocommerce' ) : esc_attr__( 'Upload an image', 'woocommerce' ); ?>" rel="<?php echo esc_attr( $variation_id ); ?>">
69
-					<img src="<?php echo $variation_object->get_image_id( 'edit' ) ? esc_url( wp_get_attachment_thumb_url( $variation_object->get_image_id( 'edit' ) ) ) : esc_url( wc_placeholder_img_src() ); ?>" /><input type="hidden" name="upload_image_id[<?php echo esc_attr( $loop ); ?>]" class="upload_image_id" value="<?php echo esc_attr( $variation_object->get_image_id( 'edit' ) ); ?>" />
68
+				<a href="#" class="upload_image_button tips <?php echo $variation_object->get_image_id('edit') ? 'remove' : ''; ?>" data-tip="<?php echo $variation_object->get_image_id('edit') ? esc_attr__('Remove this image', 'woocommerce') : esc_attr__('Upload an image', 'woocommerce'); ?>" rel="<?php echo esc_attr($variation_id); ?>">
69
+					<img src="<?php echo $variation_object->get_image_id('edit') ? esc_url(wp_get_attachment_thumb_url($variation_object->get_image_id('edit'))) : esc_url(wc_placeholder_img_src()); ?>" /><input type="hidden" name="upload_image_id[<?php echo esc_attr($loop); ?>]" class="upload_image_id" value="<?php echo esc_attr($variation_object->get_image_id('edit')); ?>" />
70 70
 				</a>
71 71
 			</p>
72 72
 			<?php
73
-			if ( wc_product_sku_enabled() ) {
73
+			if (wc_product_sku_enabled()) {
74 74
 				woocommerce_wp_text_input(
75 75
 					array(
76 76
 						'id'            => "variable_sku{$loop}",
77 77
 						'name'          => "variable_sku[{$loop}]",
78
-						'value'         => $variation_object->get_sku( 'edit' ),
78
+						'value'         => $variation_object->get_sku('edit'),
79 79
 						'placeholder'   => $variation_object->get_sku(),
80
-						'label'         => '<abbr title="' . esc_attr__( 'Stock Keeping Unit', 'woocommerce' ) . '">' . esc_html__( 'SKU', 'woocommerce' ) . '</abbr>',
80
+						'label'         => '<abbr title="' . esc_attr__('Stock Keeping Unit', 'woocommerce') . '">' . esc_html__('SKU', 'woocommerce') . '</abbr>',
81 81
 						'desc_tip'      => true,
82
-						'description'   => __( 'SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce' ),
82
+						'description'   => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce'),
83 83
 						'wrapper_class' => 'form-row form-row-last',
84 84
 					)
85 85
 				);
@@ -87,33 +87,33 @@  discard block
 block discarded – undo
87 87
 			?>
88 88
 			<p class="form-row form-row-full options">
89 89
 				<label>
90
-					<?php esc_html_e( 'Enabled', 'woocommerce' ); ?>
91
-					<input type="checkbox" class="checkbox" name="variable_enabled[<?php echo esc_attr( $loop ); ?>]" <?php checked( in_array( $variation_object->get_status( 'edit' ), array( 'publish', false ), true ), true ); ?> />
90
+					<?php esc_html_e('Enabled', 'woocommerce'); ?>
91
+					<input type="checkbox" class="checkbox" name="variable_enabled[<?php echo esc_attr($loop); ?>]" <?php checked(in_array($variation_object->get_status('edit'), array('publish', false), true), true); ?> />
92 92
 				</label>
93
-				<label class="tips" data-tip="<?php esc_attr_e( 'Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce' ); ?>">
94
-					<?php esc_html_e( 'Downloadable', 'woocommerce' ); ?>
95
-					<input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_downloadable( 'edit' ), true ); ?> />
93
+				<label class="tips" data-tip="<?php esc_attr_e('Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce'); ?>">
94
+					<?php esc_html_e('Downloadable', 'woocommerce'); ?>
95
+					<input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php echo esc_attr($loop); ?>]" <?php checked($variation_object->get_downloadable('edit'), true); ?> />
96 96
 				</label>
97
-				<label class="tips" data-tip="<?php esc_attr_e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>">
98
-					<?php esc_html_e( 'Virtual', 'woocommerce' ); ?>
99
-					<input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_virtual( 'edit' ), true ); ?> />
97
+				<label class="tips" data-tip="<?php esc_attr_e('Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce'); ?>">
98
+					<?php esc_html_e('Virtual', 'woocommerce'); ?>
99
+					<input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo esc_attr($loop); ?>]" <?php checked($variation_object->get_virtual('edit'), true); ?> />
100 100
 				</label>
101 101
 
102
-				<?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
103
-					<label class="tips" data-tip="<?php esc_attr_e( 'Enable this option to enable stock management at variation level', 'woocommerce' ); ?>">
104
-						<?php esc_html_e( 'Manage stock?', 'woocommerce' ); ?>
105
-						<input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_manage_stock(), true ); // Use view context so 'parent' is considered. ?> />
102
+				<?php if ('yes' === get_option('woocommerce_manage_stock')) : ?>
103
+					<label class="tips" data-tip="<?php esc_attr_e('Enable this option to enable stock management at variation level', 'woocommerce'); ?>">
104
+						<?php esc_html_e('Manage stock?', 'woocommerce'); ?>
105
+						<input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php echo esc_attr($loop); ?>]" <?php checked($variation_object->get_manage_stock(), true); // Use view context so 'parent' is considered. ?> />
106 106
 					</label>
107 107
 				<?php endif; ?>
108 108
 
109
-				<?php do_action( 'woocommerce_variation_options', $loop, $variation_data, $variation ); ?>
109
+				<?php do_action('woocommerce_variation_options', $loop, $variation_data, $variation); ?>
110 110
 			</p>
111 111
 
112 112
 			<div class="variable_pricing">
113 113
 				<?php
114 114
 				$label = sprintf(
115 115
 					/* translators: %s: currency symbol */
116
-					__( 'Regular price (%s)', 'woocommerce' ),
116
+					__('Regular price (%s)', 'woocommerce'),
117 117
 					get_woocommerce_currency_symbol()
118 118
 				);
119 119
 
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
 					array(
122 122
 						'id'            => "variable_regular_price_{$loop}",
123 123
 						'name'          => "variable_regular_price[{$loop}]",
124
-						'value'         => wc_format_localized_price( $variation_object->get_regular_price( 'edit' ) ),
124
+						'value'         => wc_format_localized_price($variation_object->get_regular_price('edit')),
125 125
 						'label'         => $label,
126 126
 						'data_type'     => 'price',
127 127
 						'wrapper_class' => 'form-row form-row-first',
128
-						'placeholder'   => __( 'Variation price (required)', 'woocommerce' ),
128
+						'placeholder'   => __('Variation price (required)', 'woocommerce'),
129 129
 					)
130 130
 				);
131 131
 
132 132
 				$label = sprintf(
133 133
 					/* translators: %s: currency symbol */
134
-					__( 'Sale price (%s)', 'woocommerce' ),
134
+					__('Sale price (%s)', 'woocommerce'),
135 135
 					get_woocommerce_currency_symbol()
136 136
 				);
137 137
 
@@ -139,27 +139,27 @@  discard block
 block discarded – undo
139 139
 					array(
140 140
 						'id'            => "variable_sale_price{$loop}",
141 141
 						'name'          => "variable_sale_price[{$loop}]",
142
-						'value'         => wc_format_localized_price( $variation_object->get_sale_price( 'edit' ) ),
142
+						'value'         => wc_format_localized_price($variation_object->get_sale_price('edit')),
143 143
 						'data_type'     => 'price',
144
-						'label'         => $label . ' <a href="#" class="sale_schedule">' . esc_html__( 'Schedule', 'woocommerce' ) . '</a><a href="#" class="cancel_sale_schedule hidden">' . esc_html__( 'Cancel schedule', 'woocommerce' ) . '</a>',
144
+						'label'         => $label . ' <a href="#" class="sale_schedule">' . esc_html__('Schedule', 'woocommerce') . '</a><a href="#" class="cancel_sale_schedule hidden">' . esc_html__('Cancel schedule', 'woocommerce') . '</a>',
145 145
 						'wrapper_class' => 'form-row form-row-last',
146 146
 					)
147 147
 				);
148 148
 
149
-				$sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from( 'edit' ) ? $variation_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() : false;
150
-				$sale_price_dates_to_timestamp   = $variation_object->get_date_on_sale_to( 'edit' ) ? $variation_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() : false;
149
+				$sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from('edit') ? $variation_object->get_date_on_sale_from('edit')->getOffsetTimestamp() : false;
150
+				$sale_price_dates_to_timestamp   = $variation_object->get_date_on_sale_to('edit') ? $variation_object->get_date_on_sale_to('edit')->getOffsetTimestamp() : false;
151 151
 
152
-				$sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_from_timestamp ) : '';
153
-				$sale_price_dates_to   = $sale_price_dates_to_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_to_timestamp ) : '';
152
+				$sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n('Y-m-d', $sale_price_dates_from_timestamp) : '';
153
+				$sale_price_dates_to   = $sale_price_dates_to_timestamp ? date_i18n('Y-m-d', $sale_price_dates_to_timestamp) : '';
154 154
 
155 155
 				echo '<div class="form-field sale_price_dates_fields hidden">
156 156
 					<p class="form-row form-row-first">
157
-						<label>' . esc_html__( 'Sale start date', 'woocommerce' ) . '</label>
158
-						<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . esc_attr( $loop ) . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . esc_attr_x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
157
+						<label>' . esc_html__('Sale start date', 'woocommerce') . '</label>
158
+						<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . esc_attr($loop) . ']" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . esc_attr_x('From&hellip;', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr(apply_filters('woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])')) . '" />
159 159
 					</p>
160 160
 					<p class="form-row form-row-last">
161
-						<label>' . esc_html__( 'Sale end date', 'woocommerce' ) . '</label>
162
-						<input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . esc_attr( $loop ) . ']" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . esc_attr_x( 'To&hellip;', 'placeholder', 'woocommerce' ) . '  YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
161
+						<label>' . esc_html__('Sale end date', 'woocommerce') . '</label>
162
+						<input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . esc_attr($loop) . ']" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . esc_attr_x('To&hellip;', 'placeholder', 'woocommerce') . '  YYYY-MM-DD" maxlength="10" pattern="' . esc_attr(apply_filters('woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])')) . '" />
163 163
 					</p>
164 164
 				</div>';
165 165
 
@@ -172,21 +172,21 @@  discard block
 block discarded – undo
172 172
 				 * @param array   $variation_data Variation data.
173 173
 				 * @param WP_Post $variation      Post data.
174 174
 				 */
175
-				do_action( 'woocommerce_variation_options_pricing', $loop, $variation_data, $variation );
175
+				do_action('woocommerce_variation_options_pricing', $loop, $variation_data, $variation);
176 176
 				?>
177 177
 			</div>
178 178
 
179
-			<?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
179
+			<?php if ('yes' === get_option('woocommerce_manage_stock')) : ?>
180 180
 				<div class="show_if_variation_manage_stock" style="display: none;">
181 181
 					<?php
182 182
 					woocommerce_wp_text_input(
183 183
 						array(
184 184
 							'id'                => "variable_stock{$loop}",
185 185
 							'name'              => "variable_stock[{$loop}]",
186
-							'value'             => wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ),
187
-							'label'             => __( 'Stock quantity', 'woocommerce' ),
186
+							'value'             => wc_stock_amount($variation_object->get_stock_quantity('edit')),
187
+							'label'             => __('Stock quantity', 'woocommerce'),
188 188
 							'desc_tip'          => true,
189
-							'description'       => __( "Enter a number to set stock quantity at the variation level. Use a variation's 'Manage stock?' check box above to enable/disable stock management at the variation level.", 'woocommerce' ),
189
+							'description'       => __("Enter a number to set stock quantity at the variation level. Use a variation's 'Manage stock?' check box above to enable/disable stock management at the variation level.", 'woocommerce'),
190 190
 							'type'              => 'number',
191 191
 							'custom_attributes' => array(
192 192
 								'step' => 'any',
@@ -196,42 +196,42 @@  discard block
 block discarded – undo
196 196
 						)
197 197
 					);
198 198
 
199
-					echo '<input type="hidden" name="variable_original_stock[' . esc_attr( $loop ) . ']" value="' . esc_attr( wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ) ) . '" />';
199
+					echo '<input type="hidden" name="variable_original_stock[' . esc_attr($loop) . ']" value="' . esc_attr(wc_stock_amount($variation_object->get_stock_quantity('edit'))) . '" />';
200 200
 
201 201
 					woocommerce_wp_select(
202 202
 						array(
203 203
 							'id'            => "variable_backorders{$loop}",
204 204
 							'name'          => "variable_backorders[{$loop}]",
205
-							'value'         => $variation_object->get_backorders( 'edit' ),
206
-							'label'         => __( 'Allow backorders?', 'woocommerce' ),
205
+							'value'         => $variation_object->get_backorders('edit'),
206
+							'label'         => __('Allow backorders?', 'woocommerce'),
207 207
 							'options'       => wc_get_product_backorder_options(),
208 208
 							'desc_tip'      => true,
209
-							'description'   => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
209
+							'description'   => __('If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce'),
210 210
 							'wrapper_class' => 'form-row form-row-last',
211 211
 						)
212 212
 					);
213 213
 
214
-					$low_stock_placeholder = ( $product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount() )
214
+					$low_stock_placeholder = ($product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount())
215 215
 						? sprintf(
216 216
 							/* translators: %d: Amount of stock left */
217
-							esc_attr__( 'Parent product\'s threshold (%d)', 'woocommerce' ),
218
-							esc_attr( $product_object->get_low_stock_amount() )
217
+							esc_attr__('Parent product\'s threshold (%d)', 'woocommerce'),
218
+							esc_attr($product_object->get_low_stock_amount())
219 219
 						)
220 220
 						: sprintf(
221 221
 							/* translators: %d: Amount of stock left */
222
-							esc_attr__( 'Store-wide threshold (%d)', 'woocommerce' ),
223
-							esc_attr( get_option( 'woocommerce_notify_low_stock_amount' ) )
222
+							esc_attr__('Store-wide threshold (%d)', 'woocommerce'),
223
+							esc_attr(get_option('woocommerce_notify_low_stock_amount'))
224 224
 						);
225 225
 
226 226
 					woocommerce_wp_text_input(
227 227
 						array(
228 228
 							'id'                => "variable_low_stock_amount{$loop}",
229 229
 							'name'              => "variable_low_stock_amount[{$loop}]",
230
-							'value'             => $variation_object->get_low_stock_amount( 'edit' ),
230
+							'value'             => $variation_object->get_low_stock_amount('edit'),
231 231
 							'placeholder'       => $low_stock_placeholder,
232
-							'label'             => __( 'Low stock threshold', 'woocommerce' ),
232
+							'label'             => __('Low stock threshold', 'woocommerce'),
233 233
 							'desc_tip'          => true,
234
-							'description'       => __( 'When variation stock reaches this amount you will be notified by email. The default value for all variations can be set in the product Inventory tab. The shop default value can be set in Settings > Products > Inventory.', 'woocommerce' ),
234
+							'description'       => __('When variation stock reaches this amount you will be notified by email. The default value for all variations can be set in the product Inventory tab. The shop default value can be set in Settings > Products > Inventory.', 'woocommerce'),
235 235
 							'type'              => 'number',
236 236
 							'custom_attributes' => array(
237 237
 								'step' => 'any',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 					 * @param array   $variation_data Variation data.
250 250
 					 * @param WP_Post $variation      Post data.
251 251
 					 */
252
-					do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
252
+					do_action('woocommerce_variation_options_inventory', $loop, $variation_data, $variation);
253 253
 					?>
254 254
 				</div>
255 255
 			<?php endif; ?>
@@ -260,31 +260,31 @@  discard block
 block discarded – undo
260 260
 					array(
261 261
 						'id'            => "variable_stock_status{$loop}",
262 262
 						'name'          => "variable_stock_status[{$loop}]",
263
-						'value'         => $variation_object->get_stock_status( 'edit' ),
264
-						'label'         => __( 'Stock status', 'woocommerce' ),
263
+						'value'         => $variation_object->get_stock_status('edit'),
264
+						'label'         => __('Stock status', 'woocommerce'),
265 265
 						'options'       => wc_get_product_stock_status_options(),
266 266
 						'desc_tip'      => true,
267
-						'description'   => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
267
+						'description'   => __('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce'),
268 268
 						'wrapper_class' => 'form-row form-row-full variable_stock_status',
269 269
 					)
270 270
 				);
271 271
 
272
-				if ( wc_product_weight_enabled() ) {
272
+				if (wc_product_weight_enabled()) {
273 273
 					$label = sprintf(
274 274
 						/* translators: %s: weight unit */
275
-						__( 'Weight (%s)', 'woocommerce' ),
276
-						esc_html( get_option( 'woocommerce_weight_unit' ) )
275
+						__('Weight (%s)', 'woocommerce'),
276
+						esc_html(get_option('woocommerce_weight_unit'))
277 277
 					);
278 278
 
279 279
 					woocommerce_wp_text_input(
280 280
 						array(
281 281
 							'id'            => "variable_weight{$loop}",
282 282
 							'name'          => "variable_weight[{$loop}]",
283
-							'value'         => wc_format_localized_decimal( $variation_object->get_weight( 'edit' ) ),
284
-							'placeholder'   => wc_format_localized_decimal( $product_object->get_weight() ),
283
+							'value'         => wc_format_localized_decimal($variation_object->get_weight('edit')),
284
+							'placeholder'   => wc_format_localized_decimal($product_object->get_weight()),
285 285
 							'label'         => $label,
286 286
 							'desc_tip'      => true,
287
-							'description'   => __( 'Weight in decimal form', 'woocommerce' ),
287
+							'description'   => __('Weight in decimal form', 'woocommerce'),
288 288
 							'type'          => 'text',
289 289
 							'data_type'     => 'decimal',
290 290
 							'wrapper_class' => 'form-row form-row-first hide_if_variation_virtual',
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 					);
293 293
 				}
294 294
 
295
-				if ( wc_product_dimensions_enabled() ) {
296
-					$parent_length = wc_format_localized_decimal( $product_object->get_length() );
297
-					$parent_width  = wc_format_localized_decimal( $product_object->get_width() );
298
-					$parent_height = wc_format_localized_decimal( $product_object->get_height() );
295
+				if (wc_product_dimensions_enabled()) {
296
+					$parent_length = wc_format_localized_decimal($product_object->get_length());
297
+					$parent_width  = wc_format_localized_decimal($product_object->get_width());
298
+					$parent_height = wc_format_localized_decimal($product_object->get_height());
299 299
 
300 300
 					?>
301 301
 					<p class="form-field form-row dimensions_field hide_if_variation_virtual form-row-last">
@@ -303,16 +303,16 @@  discard block
 block discarded – undo
303 303
 							<?php
304 304
 							printf(
305 305
 								/* translators: %s: dimension unit */
306
-								esc_html__( 'Dimensions (L&times;W&times;H) (%s)', 'woocommerce' ),
307
-								esc_html( get_option( 'woocommerce_dimension_unit' ) )
306
+								esc_html__('Dimensions (L&times;W&times;H) (%s)', 'woocommerce'),
307
+								esc_html(get_option('woocommerce_dimension_unit'))
308 308
 							);
309 309
 							?>
310 310
 						</label>
311
-						<?php echo wc_help_tip( __( 'Length x width x height in decimal form', 'woocommerce' ) ); ?>
311
+						<?php echo wc_help_tip(__('Length x width x height in decimal form', 'woocommerce')); ?>
312 312
 						<span class="wrap">
313
-							<input id="product_length" placeholder="<?php echo $parent_length ? esc_attr( $parent_length ) : esc_attr__( 'Length', 'woocommerce' ); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_length( 'edit' ) ) ); ?>" />
314
-							<input placeholder="<?php echo $parent_width ? esc_attr( $parent_width ) : esc_attr__( 'Width', 'woocommerce' ); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_width( 'edit' ) ) ); ?>" />
315
-							<input placeholder="<?php echo $parent_height ? esc_attr( $parent_height ) : esc_attr__( 'Height', 'woocommerce' ); ?>" class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_height( 'edit' ) ) ); ?>" />
313
+							<input id="product_length" placeholder="<?php echo $parent_length ? esc_attr($parent_length) : esc_attr__('Length', 'woocommerce'); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr(wc_format_localized_decimal($variation_object->get_length('edit'))); ?>" />
314
+							<input placeholder="<?php echo $parent_width ? esc_attr($parent_width) : esc_attr__('Width', 'woocommerce'); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr(wc_format_localized_decimal($variation_object->get_width('edit'))); ?>" />
315
+							<input placeholder="<?php echo $parent_height ? esc_attr($parent_height) : esc_attr__('Height', 'woocommerce'); ?>" class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php echo esc_attr($loop); ?>]" value="<?php echo esc_attr(wc_format_localized_decimal($variation_object->get_height('edit'))); ?>" />
316 316
 						</span>
317 317
 					</p>
318 318
 					<?php
@@ -327,38 +327,38 @@  discard block
 block discarded – undo
327 327
 				 * @param array   $variation_data Variation data.
328 328
 				 * @param WP_Post $variation      Post data.
329 329
 				 */
330
-				do_action( 'woocommerce_variation_options_dimensions', $loop, $variation_data, $variation );
330
+				do_action('woocommerce_variation_options_dimensions', $loop, $variation_data, $variation);
331 331
 				?>
332 332
 			</div>
333 333
 
334 334
 			<div>
335 335
 				<p class="form-row hide_if_variation_virtual form-row-full">
336
-					<label><?php esc_html_e( 'Shipping class', 'woocommerce' ); ?></label>
336
+					<label><?php esc_html_e('Shipping class', 'woocommerce'); ?></label>
337 337
 					<?php
338 338
 					wp_dropdown_categories(
339 339
 						array(
340 340
 							'taxonomy'         => 'product_shipping_class',
341 341
 							'hide_empty'       => 0,
342
-							'show_option_none' => __( 'Same as parent', 'woocommerce' ),
342
+							'show_option_none' => __('Same as parent', 'woocommerce'),
343 343
 							'name'             => 'variable_shipping_class[' . $loop . ']',
344 344
 							'id'               => '',
345
-							'selected'         => $variation_object->get_shipping_class_id( 'edit' ),
345
+							'selected'         => $variation_object->get_shipping_class_id('edit'),
346 346
 						)
347 347
 					);
348 348
 					?>
349 349
 				</p>
350 350
 
351 351
 				<?php
352
-				if ( wc_tax_enabled() ) {
352
+				if (wc_tax_enabled()) {
353 353
 					woocommerce_wp_select(
354 354
 						array(
355 355
 							'id'            => "variable_tax_class{$loop}",
356 356
 							'name'          => "variable_tax_class[{$loop}]",
357
-							'value'         => $variation_object->get_tax_class( 'edit' ),
358
-							'label'         => __( 'Tax class', 'woocommerce' ),
359
-							'options'       => array( 'parent' => __( 'Same as parent', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
357
+							'value'         => $variation_object->get_tax_class('edit'),
358
+							'label'         => __('Tax class', 'woocommerce'),
359
+							'options'       => array('parent' => __('Same as parent', 'woocommerce')) + wc_get_product_tax_class_options(),
360 360
 							'desc_tip'      => 'true',
361
-							'description'   => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
361
+							'description'   => __('Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce'),
362 362
 							'wrapper_class' => 'form-row form-row-full',
363 363
 						)
364 364
 					);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 					 * @param array   $variation_data Variation data.
373 373
 					 * @param WP_Post $variation      Post data.
374 374
 					 */
375
-					do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
375
+					do_action('woocommerce_variation_options_tax', $loop, $variation_data, $variation);
376 376
 				}
377 377
 				?>
378 378
 			</div>
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 					array(
383 383
 						'id'            => "variable_description{$loop}",
384 384
 						'name'          => "variable_description[{$loop}]",
385
-						'value'         => $variation_object->get_description( 'edit' ),
386
-						'label'         => __( 'Description', 'woocommerce' ),
385
+						'value'         => $variation_object->get_description('edit'),
386
+						'label'         => __('Description', 'woocommerce'),
387 387
 						'desc_tip'      => true,
388
-						'description'   => __( 'Enter an optional description for this variation.', 'woocommerce' ),
388
+						'description'   => __('Enter an optional description for this variation.', 'woocommerce'),
389 389
 						'wrapper_class' => 'form-row form-row-full',
390 390
 					)
391 391
 				);
@@ -393,23 +393,23 @@  discard block
 block discarded – undo
393 393
 			</div>
394 394
 			<div class="show_if_variation_downloadable" style="display: none;">
395 395
 				<div class="form-row form-row-full downloadable_files">
396
-					<label><?php esc_html_e( 'Downloadable files', 'woocommerce' ); ?></label>
396
+					<label><?php esc_html_e('Downloadable files', 'woocommerce'); ?></label>
397 397
 					<table class="widefat">
398 398
 						<thead>
399 399
 							<div>
400
-								<th><?php esc_html_e( 'Name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'This is the name of the download shown to the customer.', 'woocommerce' ) ); ?></th>
401
-								<th colspan="2"><?php esc_html_e( 'File URL', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce' ) ); ?></th>
400
+								<th><?php esc_html_e('Name', 'woocommerce'); ?> <?php echo wc_help_tip(__('This is the name of the download shown to the customer.', 'woocommerce')); ?></th>
401
+								<th colspan="2"><?php esc_html_e('File URL', 'woocommerce'); ?> <?php echo wc_help_tip(__('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce')); ?></th>
402 402
 								<th>&nbsp;</th>
403 403
 							</div>
404 404
 						</thead>
405 405
 						<tbody>
406 406
 							<?php
407
-							$downloadable_files       = $variation_object->get_downloads( 'edit' );
407
+							$downloadable_files       = $variation_object->get_downloads('edit');
408 408
 							$disabled_downloads_count = 0;
409 409
 
410
-							if ( $downloadable_files ) {
411
-								foreach ( $downloadable_files as $key => $file ) {
412
-									$disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
410
+							if ($downloadable_files) {
411
+								foreach ($downloadable_files as $key => $file) {
412
+									$disabled_download = isset($file['enabled']) && false === $file['enabled'];
413 413
 									$disabled_downloads_count += (int) $disabled_download;
414 414
 									include __DIR__ . '/html-product-variation-download.php';
415 415
 								}
@@ -429,17 +429,17 @@  discard block
 block discarded – undo
429 429
 									$disabled_download = false;
430 430
 									ob_start();
431 431
 									require __DIR__ . '/html-product-variation-download.php';
432
-									echo esc_attr( ob_get_clean() );
432
+									echo esc_attr(ob_get_clean());
433 433
 									?>
434
-									"><?php esc_html_e( 'Add file', 'woocommerce' ); ?></a>
434
+									"><?php esc_html_e('Add file', 'woocommerce'); ?></a>
435 435
 								</th>
436 436
 								<th colspan="3">
437
-									<?php if ( $disabled_downloads_count ) : ?>
437
+									<?php if ($disabled_downloads_count) : ?>
438 438
 										<span class="disabled">*</span>
439 439
 										<?php
440 440
 										printf(
441 441
 											/* translators: 1: opening link tag, 2: closing link tag. */
442
-											esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
442
+											esc_html__('The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce'),
443 443
 											'<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
444 444
 											'</a>'
445 445
 										);
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
 					array(
458 458
 						'id'                => "variable_download_limit{$loop}",
459 459
 						'name'              => "variable_download_limit[{$loop}]",
460
-						'value'             => $variation_object->get_download_limit( 'edit' ) < 0 ? '' : $variation_object->get_download_limit( 'edit' ),
461
-						'label'             => __( 'Download limit', 'woocommerce' ),
462
-						'placeholder'       => __( 'Unlimited', 'woocommerce' ),
463
-						'description'       => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
460
+						'value'             => $variation_object->get_download_limit('edit') < 0 ? '' : $variation_object->get_download_limit('edit'),
461
+						'label'             => __('Download limit', 'woocommerce'),
462
+						'placeholder'       => __('Unlimited', 'woocommerce'),
463
+						'description'       => __('Leave blank for unlimited re-downloads.', 'woocommerce'),
464 464
 						'type'              => 'number',
465 465
 						'desc_tip'          => true,
466 466
 						'custom_attributes' => array(
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 					array(
476 476
 						'id'                => "variable_download_expiry{$loop}",
477 477
 						'name'              => "variable_download_expiry[{$loop}]",
478
-						'value'             => $variation_object->get_download_expiry( 'edit' ) < 0 ? '' : $variation_object->get_download_expiry( 'edit' ),
479
-						'label'             => __( 'Download expiry', 'woocommerce' ),
480
-						'placeholder'       => __( 'Never', 'woocommerce' ),
481
-						'description'       => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
478
+						'value'             => $variation_object->get_download_expiry('edit') < 0 ? '' : $variation_object->get_download_expiry('edit'),
479
+						'label'             => __('Download expiry', 'woocommerce'),
480
+						'placeholder'       => __('Never', 'woocommerce'),
481
+						'description'       => __('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'),
482 482
 						'type'              => 'number',
483 483
 						'desc_tip'          => true,
484 484
 						'custom_attributes' => array(
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 				 * @param array   $variation_data Variation data.
499 499
 				 * @param WP_Post $variation      Post data.
500 500
 				 */
501
-				do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
501
+				do_action('woocommerce_variation_options_download', $loop, $variation_data, $variation);
502 502
 				?>
503 503
 			</div>
504
-			<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
504
+			<?php do_action('woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation); ?>
505 505
 		</div>
506 506
 	</div>
507 507
 </div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,12 @@
 block discarded – undo
38 38
 					<?php foreach ( $attribute->get_terms() as $option ) : ?>
39 39
 						<option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object ) ); ?></option>
40 40
 					<?php endforeach; ?>
41
-				<?php else : ?>
41
+				<?php else {
42
+    : ?>
42 43
 					<?php foreach ( $attribute->get_options() as $option ) : ?>
43
-						<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
44
+						<option <?php selected( $selected_value, $option );
45
+}
46
+?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
44 47
 					<?php endforeach; ?>
45 48
 				<?php endif; ?>
46 49
 			</select>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/views/html-product-data-variations.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+    exit;
10 10
 }
11 11
 ?>
12 12
 <div id="variable_product_options" class="panel wc-metaboxes-wrapper hidden">
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 				<div class="variations-defaults">
26 26
 					<strong><?php esc_html_e( 'Default Form Values', 'woocommerce' ); ?>: <?php echo wc_help_tip( __( 'Choose a default form value if you want a certain variation already selected when a user visits the product page.', 'woocommerce' ) ); ?></strong>
27 27
 					<?php
28
-					foreach ( $variation_attributes as $attribute ) {
29
-						$selected_value = isset( $default_attributes[ sanitize_title( $attribute->get_name() ) ] ) ? $default_attributes[ sanitize_title( $attribute->get_name() ) ] : '';
30
-						?>
28
+                    foreach ( $variation_attributes as $attribute ) {
29
+                        $selected_value = isset( $default_attributes[ sanitize_title( $attribute->get_name() ) ] ) ? $default_attributes[ sanitize_title( $attribute->get_name() ) ] : '';
30
+                        ?>
31 31
 						<select name="default_attribute_<?php echo esc_attr( sanitize_title( $attribute->get_name() ) ); ?>" data-current="<?php echo esc_attr( $selected_value ); ?>">
32 32
 							<?php /* translators: WooCommerce attribute label */ ?>
33 33
 							<option value=""><?php echo esc_html( sprintf( __( 'No default %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ) ); ?></option>
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 							<?php endif; ?>
43 43
 						</select>
44 44
 						<?php
45
-					}
46
-					?>
45
+                    }
46
+                    ?>
47 47
 				</div>
48 48
 				<div class="clear"></div>
49 49
 			</div>
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -5,39 +5,39 @@  discard block
 block discarded – undo
5 5
  * @package WooCommerce\Admin\Metaboxes\Views
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 ?>
12 12
 <div id="variable_product_options" class="panel wc-metaboxes-wrapper hidden">
13 13
 	<div id="variable_product_options_inner">
14 14
 
15
-		<?php if ( ! count( $variation_attributes ) ) : ?>
15
+		<?php if (!count($variation_attributes)) : ?>
16 16
 
17 17
 			<div id="message" class="inline notice woocommerce-message">
18
-				<p><?php echo wp_kses_post( __( 'Before you can add a variation you need to add some variation attributes on the <strong>Attributes</strong> tab.', 'woocommerce' ) ); ?></p>
19
-				<p><a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a></p>
18
+				<p><?php echo wp_kses_post(__('Before you can add a variation you need to add some variation attributes on the <strong>Attributes</strong> tab.', 'woocommerce')); ?></p>
19
+				<p><a class="button-primary" href="<?php echo esc_url(apply_filters('woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations')); ?>" target="_blank"><?php esc_html_e('Learn more', 'woocommerce'); ?></a></p>
20 20
 			</div>
21 21
 
22 22
 		<?php else : ?>
23 23
 
24 24
 			<div class="toolbar toolbar-variations-defaults">
25 25
 				<div class="variations-defaults">
26
-					<strong><?php esc_html_e( 'Default Form Values', 'woocommerce' ); ?>: <?php echo wc_help_tip( __( 'Choose a default form value if you want a certain variation already selected when a user visits the product page.', 'woocommerce' ) ); ?></strong>
26
+					<strong><?php esc_html_e('Default Form Values', 'woocommerce'); ?>: <?php echo wc_help_tip(__('Choose a default form value if you want a certain variation already selected when a user visits the product page.', 'woocommerce')); ?></strong>
27 27
 					<?php
28
-					foreach ( $variation_attributes as $attribute ) {
29
-						$selected_value = isset( $default_attributes[ sanitize_title( $attribute->get_name() ) ] ) ? $default_attributes[ sanitize_title( $attribute->get_name() ) ] : '';
28
+					foreach ($variation_attributes as $attribute) {
29
+						$selected_value = isset($default_attributes[sanitize_title($attribute->get_name())]) ? $default_attributes[sanitize_title($attribute->get_name())] : '';
30 30
 						?>
31
-						<select name="default_attribute_<?php echo esc_attr( sanitize_title( $attribute->get_name() ) ); ?>" data-current="<?php echo esc_attr( $selected_value ); ?>">
31
+						<select name="default_attribute_<?php echo esc_attr(sanitize_title($attribute->get_name())); ?>" data-current="<?php echo esc_attr($selected_value); ?>">
32 32
 							<?php /* translators: WooCommerce attribute label */ ?>
33
-							<option value=""><?php echo esc_html( sprintf( __( 'No default %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ) ); ?></option>
34
-							<?php if ( $attribute->is_taxonomy() ) : ?>
35
-								<?php foreach ( $attribute->get_terms() as $option ) : ?>
36
-									<option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object ) ); ?></option>
33
+							<option value=""><?php echo esc_html(sprintf(__('No default %s&hellip;', 'woocommerce'), wc_attribute_label($attribute->get_name()))); ?></option>
34
+							<?php if ($attribute->is_taxonomy()) : ?>
35
+								<?php foreach ($attribute->get_terms() as $option) : ?>
36
+									<option <?php selected($selected_value, $option->slug); ?> value="<?php echo esc_attr($option->slug); ?>"><?php echo esc_html(apply_filters('woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object)); ?></option>
37 37
 								<?php endforeach; ?>
38 38
 							<?php else : ?>
39
-								<?php foreach ( $attribute->get_options() as $option ) : ?>
40
-									<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
39
+								<?php foreach ($attribute->get_options() as $option) : ?>
40
+									<option <?php selected($selected_value, $option); ?> value="<?php echo esc_attr($option); ?>"><?php echo esc_html(apply_filters('woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object)); ?></option>
41 41
 								<?php endforeach; ?>
42 42
 							<?php endif; ?>
43 43
 						</select>
@@ -48,100 +48,100 @@  discard block
 block discarded – undo
48 48
 				<div class="clear"></div>
49 49
 			</div>
50 50
 
51
-			<?php do_action( 'woocommerce_variable_product_before_variations' ); ?>
51
+			<?php do_action('woocommerce_variable_product_before_variations'); ?>
52 52
 
53 53
 			<div class="toolbar toolbar-top">
54 54
 				<select id="field_to_edit" class="variation_actions">
55
-					<option data-global="true" value="add_variation"><?php esc_html_e( 'Add variation', 'woocommerce' ); ?></option>
56
-					<option data-global="true" value="link_all_variations"><?php esc_html_e( 'Create variations from all attributes', 'woocommerce' ); ?></option>
57
-					<option value="delete_all"><?php esc_html_e( 'Delete all variations', 'woocommerce' ); ?></option>
58
-					<optgroup label="<?php esc_attr_e( 'Status', 'woocommerce' ); ?>">
59
-						<option value="toggle_enabled"><?php esc_html_e( 'Toggle &quot;Enabled&quot;', 'woocommerce' ); ?></option>
60
-						<option value="toggle_downloadable"><?php esc_html_e( 'Toggle &quot;Downloadable&quot;', 'woocommerce' ); ?></option>
61
-						<option value="toggle_virtual"><?php esc_html_e( 'Toggle &quot;Virtual&quot;', 'woocommerce' ); ?></option>
55
+					<option data-global="true" value="add_variation"><?php esc_html_e('Add variation', 'woocommerce'); ?></option>
56
+					<option data-global="true" value="link_all_variations"><?php esc_html_e('Create variations from all attributes', 'woocommerce'); ?></option>
57
+					<option value="delete_all"><?php esc_html_e('Delete all variations', 'woocommerce'); ?></option>
58
+					<optgroup label="<?php esc_attr_e('Status', 'woocommerce'); ?>">
59
+						<option value="toggle_enabled"><?php esc_html_e('Toggle &quot;Enabled&quot;', 'woocommerce'); ?></option>
60
+						<option value="toggle_downloadable"><?php esc_html_e('Toggle &quot;Downloadable&quot;', 'woocommerce'); ?></option>
61
+						<option value="toggle_virtual"><?php esc_html_e('Toggle &quot;Virtual&quot;', 'woocommerce'); ?></option>
62 62
 					</optgroup>
63
-					<optgroup label="<?php esc_attr_e( 'Pricing', 'woocommerce' ); ?>">
64
-						<option value="variable_regular_price"><?php esc_html_e( 'Set regular prices', 'woocommerce' ); ?></option>
65
-						<option value="variable_regular_price_increase"><?php esc_html_e( 'Increase regular prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
66
-						<option value="variable_regular_price_decrease"><?php esc_html_e( 'Decrease regular prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
67
-						<option value="variable_sale_price"><?php esc_html_e( 'Set sale prices', 'woocommerce' ); ?></option>
68
-						<option value="variable_sale_price_increase"><?php esc_html_e( 'Increase sale prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
69
-						<option value="variable_sale_price_decrease"><?php esc_html_e( 'Decrease sale prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
70
-						<option value="variable_sale_schedule"><?php esc_html_e( 'Set scheduled sale dates', 'woocommerce' ); ?></option>
63
+					<optgroup label="<?php esc_attr_e('Pricing', 'woocommerce'); ?>">
64
+						<option value="variable_regular_price"><?php esc_html_e('Set regular prices', 'woocommerce'); ?></option>
65
+						<option value="variable_regular_price_increase"><?php esc_html_e('Increase regular prices (fixed amount or percentage)', 'woocommerce'); ?></option>
66
+						<option value="variable_regular_price_decrease"><?php esc_html_e('Decrease regular prices (fixed amount or percentage)', 'woocommerce'); ?></option>
67
+						<option value="variable_sale_price"><?php esc_html_e('Set sale prices', 'woocommerce'); ?></option>
68
+						<option value="variable_sale_price_increase"><?php esc_html_e('Increase sale prices (fixed amount or percentage)', 'woocommerce'); ?></option>
69
+						<option value="variable_sale_price_decrease"><?php esc_html_e('Decrease sale prices (fixed amount or percentage)', 'woocommerce'); ?></option>
70
+						<option value="variable_sale_schedule"><?php esc_html_e('Set scheduled sale dates', 'woocommerce'); ?></option>
71 71
 					</optgroup>
72
-					<optgroup label="<?php esc_attr_e( 'Inventory', 'woocommerce' ); ?>">
73
-						<option value="toggle_manage_stock"><?php esc_html_e( 'Toggle &quot;Manage stock&quot;', 'woocommerce' ); ?></option>
74
-						<option value="variable_stock"><?php esc_html_e( 'Stock', 'woocommerce' ); ?></option>
75
-						<option value="variable_stock_status_instock"><?php esc_html_e( 'Set Status - In stock', 'woocommerce' ); ?></option>
76
-						<option value="variable_stock_status_outofstock"><?php esc_html_e( 'Set Status - Out of stock', 'woocommerce' ); ?></option>
77
-						<option value="variable_stock_status_onbackorder"><?php esc_html_e( 'Set Status - On backorder', 'woocommerce' ); ?></option>
78
-						<option value="variable_low_stock_amount"><?php esc_html_e( 'Low stock threshold', 'woocommerce' ); ?></option>
72
+					<optgroup label="<?php esc_attr_e('Inventory', 'woocommerce'); ?>">
73
+						<option value="toggle_manage_stock"><?php esc_html_e('Toggle &quot;Manage stock&quot;', 'woocommerce'); ?></option>
74
+						<option value="variable_stock"><?php esc_html_e('Stock', 'woocommerce'); ?></option>
75
+						<option value="variable_stock_status_instock"><?php esc_html_e('Set Status - In stock', 'woocommerce'); ?></option>
76
+						<option value="variable_stock_status_outofstock"><?php esc_html_e('Set Status - Out of stock', 'woocommerce'); ?></option>
77
+						<option value="variable_stock_status_onbackorder"><?php esc_html_e('Set Status - On backorder', 'woocommerce'); ?></option>
78
+						<option value="variable_low_stock_amount"><?php esc_html_e('Low stock threshold', 'woocommerce'); ?></option>
79 79
 					</optgroup>
80
-					<optgroup label="<?php esc_attr_e( 'Shipping', 'woocommerce' ); ?>">
81
-						<option value="variable_length"><?php esc_html_e( 'Length', 'woocommerce' ); ?></option>
82
-						<option value="variable_width"><?php esc_html_e( 'Width', 'woocommerce' ); ?></option>
83
-						<option value="variable_height"><?php esc_html_e( 'Height', 'woocommerce' ); ?></option>
84
-						<option value="variable_weight"><?php esc_html_e( 'Weight', 'woocommerce' ); ?></option>
80
+					<optgroup label="<?php esc_attr_e('Shipping', 'woocommerce'); ?>">
81
+						<option value="variable_length"><?php esc_html_e('Length', 'woocommerce'); ?></option>
82
+						<option value="variable_width"><?php esc_html_e('Width', 'woocommerce'); ?></option>
83
+						<option value="variable_height"><?php esc_html_e('Height', 'woocommerce'); ?></option>
84
+						<option value="variable_weight"><?php esc_html_e('Weight', 'woocommerce'); ?></option>
85 85
 					</optgroup>
86
-					<optgroup label="<?php esc_attr_e( 'Downloadable products', 'woocommerce' ); ?>">
87
-						<option value="variable_download_limit"><?php esc_html_e( 'Download limit', 'woocommerce' ); ?></option>
88
-						<option value="variable_download_expiry"><?php esc_html_e( 'Download expiry', 'woocommerce' ); ?></option>
86
+					<optgroup label="<?php esc_attr_e('Downloadable products', 'woocommerce'); ?>">
87
+						<option value="variable_download_limit"><?php esc_html_e('Download limit', 'woocommerce'); ?></option>
88
+						<option value="variable_download_expiry"><?php esc_html_e('Download expiry', 'woocommerce'); ?></option>
89 89
 					</optgroup>
90
-					<?php do_action( 'woocommerce_variable_product_bulk_edit_actions' ); ?>
90
+					<?php do_action('woocommerce_variable_product_bulk_edit_actions'); ?>
91 91
 				</select>
92
-				<a class="button bulk_edit do_variation_action"><?php esc_html_e( 'Go', 'woocommerce' ); ?></a>
92
+				<a class="button bulk_edit do_variation_action"><?php esc_html_e('Go', 'woocommerce'); ?></a>
93 93
 
94 94
 				<div class="variations-pagenav">
95 95
 					<?php /* translators: variations count */ ?>
96
-					<span class="displaying-num"><?php echo esc_html( sprintf( _n( '%s item', '%s items', $variations_count, 'woocommerce' ), $variations_count ) ); ?></span>
96
+					<span class="displaying-num"><?php echo esc_html(sprintf(_n('%s item', '%s items', $variations_count, 'woocommerce'), $variations_count)); ?></span>
97 97
 					<span class="expand-close">
98
-						(<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>)
98
+						(<a href="#" class="expand_all"><?php esc_html_e('Expand', 'woocommerce'); ?></a> / <a href="#" class="close_all"><?php esc_html_e('Close', 'woocommerce'); ?></a>)
99 99
 					</span>
100 100
 					<span class="pagination-links">
101
-						<a class="first-page disabled" title="<?php esc_attr_e( 'Go to the first page', 'woocommerce' ); ?>" href="#">&laquo;</a>
102
-						<a class="prev-page disabled" title="<?php esc_attr_e( 'Go to the previous page', 'woocommerce' ); ?>" href="#">&lsaquo;</a>
101
+						<a class="first-page disabled" title="<?php esc_attr_e('Go to the first page', 'woocommerce'); ?>" href="#">&laquo;</a>
102
+						<a class="prev-page disabled" title="<?php esc_attr_e('Go to the previous page', 'woocommerce'); ?>" href="#">&lsaquo;</a>
103 103
 						<span class="paging-select">
104
-							<label for="current-page-selector-1" class="screen-reader-text"><?php esc_html_e( 'Select Page', 'woocommerce' ); ?></label>
105
-							<select class="page-selector" id="current-page-selector-1" title="<?php esc_attr_e( 'Current page', 'woocommerce' ); ?>">
106
-								<?php for ( $i = 1; $i <= $variations_total_pages; $i++ ) : ?>
104
+							<label for="current-page-selector-1" class="screen-reader-text"><?php esc_html_e('Select Page', 'woocommerce'); ?></label>
105
+							<select class="page-selector" id="current-page-selector-1" title="<?php esc_attr_e('Current page', 'woocommerce'); ?>">
106
+								<?php for ($i = 1; $i <= $variations_total_pages; $i++) : ?>
107 107
 									<option value="<?php echo $i; // WPCS: XSS ok. ?>"><?php echo $i; // WPCS: XSS ok. ?></option>
108 108
 								<?php endfor; ?>
109 109
 							</select>
110
-							<?php echo esc_html_x( 'of', 'number of pages', 'woocommerce' ); ?> <span class="total-pages"><?php echo esc_html( $variations_total_pages ); ?></span>
110
+							<?php echo esc_html_x('of', 'number of pages', 'woocommerce'); ?> <span class="total-pages"><?php echo esc_html($variations_total_pages); ?></span>
111 111
 						</span>
112
-						<a class="next-page" title="<?php esc_attr_e( 'Go to the next page', 'woocommerce' ); ?>" href="#">&rsaquo;</a>
113
-						<a class="last-page" title="<?php esc_attr_e( 'Go to the last page', 'woocommerce' ); ?>" href="#">&raquo;</a>
112
+						<a class="next-page" title="<?php esc_attr_e('Go to the next page', 'woocommerce'); ?>" href="#">&rsaquo;</a>
113
+						<a class="last-page" title="<?php esc_attr_e('Go to the last page', 'woocommerce'); ?>" href="#">&raquo;</a>
114 114
 					</span>
115 115
 				</div>
116 116
 				<div class="clear"></div>
117 117
 			</div>
118 118
 
119
-			<div class="woocommerce_variations wc-metaboxes" data-attributes="<?php echo wc_esc_json( wp_json_encode( wc_list_pluck( $variation_attributes, 'get_data' ) ) ); // WPCS: XSS ok. ?>" data-total="<?php echo esc_attr( $variations_count ); ?>" data-total_pages="<?php echo esc_attr( $variations_total_pages ); ?>" data-page="1" data-edited="false"></div>
119
+			<div class="woocommerce_variations wc-metaboxes" data-attributes="<?php echo wc_esc_json(wp_json_encode(wc_list_pluck($variation_attributes, 'get_data'))); // WPCS: XSS ok. ?>" data-total="<?php echo esc_attr($variations_count); ?>" data-total_pages="<?php echo esc_attr($variations_total_pages); ?>" data-page="1" data-edited="false"></div>
120 120
 
121 121
 			<div class="toolbar">
122
-				<button type="button" class="button-primary save-variation-changes" disabled="disabled"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
123
-				<button type="button" class="button cancel-variation-changes" disabled="disabled"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
122
+				<button type="button" class="button-primary save-variation-changes" disabled="disabled"><?php esc_html_e('Save changes', 'woocommerce'); ?></button>
123
+				<button type="button" class="button cancel-variation-changes" disabled="disabled"><?php esc_html_e('Cancel', 'woocommerce'); ?></button>
124 124
 
125 125
 				<div class="variations-pagenav">
126 126
 					<?php /* translators: variations count*/ ?>
127
-					<span class="displaying-num"><?php echo esc_html( sprintf( _n( '%s item', '%s items', $variations_count, 'woocommerce' ), $variations_count ) ); ?></span>
127
+					<span class="displaying-num"><?php echo esc_html(sprintf(_n('%s item', '%s items', $variations_count, 'woocommerce'), $variations_count)); ?></span>
128 128
 					<span class="expand-close">
129
-						(<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>)
129
+						(<a href="#" class="expand_all"><?php esc_html_e('Expand', 'woocommerce'); ?></a> / <a href="#" class="close_all"><?php esc_html_e('Close', 'woocommerce'); ?></a>)
130 130
 					</span>
131 131
 					<span class="pagination-links">
132
-						<a class="first-page disabled" title="<?php esc_attr_e( 'Go to the first page', 'woocommerce' ); ?>" href="#">&laquo;</a>
133
-						<a class="prev-page disabled" title="<?php esc_attr_e( 'Go to the previous page', 'woocommerce' ); ?>" href="#">&lsaquo;</a>
132
+						<a class="first-page disabled" title="<?php esc_attr_e('Go to the first page', 'woocommerce'); ?>" href="#">&laquo;</a>
133
+						<a class="prev-page disabled" title="<?php esc_attr_e('Go to the previous page', 'woocommerce'); ?>" href="#">&lsaquo;</a>
134 134
 						<span class="paging-select">
135
-							<label for="current-page-selector-1" class="screen-reader-text"><?php esc_html_e( 'Select Page', 'woocommerce' ); ?></label>
136
-							<select class="page-selector" id="current-page-selector-1" title="<?php esc_attr_e( 'Current page', 'woocommerce' ); ?>">
137
-								<?php for ( $i = 1; $i <= $variations_total_pages; $i++ ) : ?>
135
+							<label for="current-page-selector-1" class="screen-reader-text"><?php esc_html_e('Select Page', 'woocommerce'); ?></label>
136
+							<select class="page-selector" id="current-page-selector-1" title="<?php esc_attr_e('Current page', 'woocommerce'); ?>">
137
+								<?php for ($i = 1; $i <= $variations_total_pages; $i++) : ?>
138 138
 									<option value="<?php echo $i; // WPCS: XSS ok. ?>"><?php echo $i; // WPCS: XSS ok. ?></option>
139 139
 								<?php endfor; ?>
140 140
 							</select>
141
-							<?php echo esc_html_x( 'of', 'number of pages', 'woocommerce' ); ?> <span class="total-pages"><?php echo esc_html( $variations_total_pages ); ?></span>
141
+							<?php echo esc_html_x('of', 'number of pages', 'woocommerce'); ?> <span class="total-pages"><?php echo esc_html($variations_total_pages); ?></span>
142 142
 						</span>
143
-						<a class="next-page" title="<?php esc_attr_e( 'Go to the next page', 'woocommerce' ); ?>" href="#">&rsaquo;</a>
144
-						<a class="last-page" title="<?php esc_attr_e( 'Go to the last page', 'woocommerce' ); ?>" href="#">&raquo;</a>
143
+						<a class="next-page" title="<?php esc_attr_e('Go to the next page', 'woocommerce'); ?>" href="#">&rsaquo;</a>
144
+						<a class="last-page" title="<?php esc_attr_e('Go to the last page', 'woocommerce'); ?>" href="#">&raquo;</a>
145 145
 					</span>
146 146
 				</div>
147 147
 				<div class="clear"></div>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,14 @@  discard block
 block discarded – undo
19 19
 				<p><a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a></p>
20 20
 			</div>
21 21
 
22
-		<?php else : ?>
22
+		<?php else {
23
+    : ?>
23 24
 
24 25
 			<div class="toolbar toolbar-variations-defaults">
25 26
 				<div class="variations-defaults">
26
-					<strong><?php esc_html_e( 'Default Form Values', 'woocommerce' ); ?>: <?php echo wc_help_tip( __( 'Choose a default form value if you want a certain variation already selected when a user visits the product page.', 'woocommerce' ) ); ?></strong>
27
+					<strong><?php esc_html_e( 'Default Form Values', 'woocommerce' );
28
+}
29
+?>: <?php echo wc_help_tip( __( 'Choose a default form value if you want a certain variation already selected when a user visits the product page.', 'woocommerce' ) ); ?></strong>
27 30
 					<?php
28 31
 					foreach ( $variation_attributes as $attribute ) {
29 32
 						$selected_value = isset( $default_attributes[ sanitize_title( $attribute->get_name() ) ] ) ? $default_attributes[ sanitize_title( $attribute->get_name() ) ] : '';
@@ -35,9 +38,12 @@  discard block
 block discarded – undo
35 38
 								<?php foreach ( $attribute->get_terms() as $option ) : ?>
36 39
 									<option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object ) ); ?></option>
37 40
 								<?php endforeach; ?>
38
-							<?php else : ?>
41
+							<?php else {
42
+    : ?>
39 43
 								<?php foreach ( $attribute->get_options() as $option ) : ?>
40
-									<option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
44
+									<option <?php selected( $selected_value, $option );
45
+}
46
+?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
41 47
 								<?php endforeach; ?>
42 48
 							<?php endif; ?>
43 49
 						</select>
Please login to merge, or discard this patch.