Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
includes/admin/meta-boxes/views/html-product-variation-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
@@ -10,21 +10,21 @@
 block discarded – undo
10 10
  * @var int    $variation_id      Variation ID.
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if (!defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 ?>
17 17
 <tr>
18 18
 	<td class="file_name">
19
-		<input type="text" class="input_text" placeholder="<?php esc_attr_e( 'File name', 'woocommerce' ); ?>" name="_wc_variation_file_names[<?php echo esc_attr( $variation_id ); ?>][]" value="<?php echo esc_attr( $file['name'] ); ?>" />
20
-		<input type="hidden" name="_wc_variation_file_hashes[<?php echo esc_attr( $variation_id ); ?>][]" value="<?php echo esc_attr( $key ); ?>" />
19
+		<input type="text" class="input_text" placeholder="<?php esc_attr_e('File name', 'woocommerce'); ?>" name="_wc_variation_file_names[<?php echo esc_attr($variation_id); ?>][]" value="<?php echo esc_attr($file['name']); ?>" />
20
+		<input type="hidden" name="_wc_variation_file_hashes[<?php echo esc_attr($variation_id); ?>][]" 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_variation_file_urls[<?php echo esc_attr( $variation_id ); ?>][]" 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_variation_file_urls[<?php echo esc_attr($variation_id); ?>][]" 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 esc_html_e( '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 esc_html_e('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.
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php 3 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 $line_items_shipping = $order->get_items( 'shipping' );
28 28
 
29 29
 if ( wc_tax_enabled() ) {
30
-	$order_taxes      = $order->get_taxes();
31
-	$tax_classes      = WC_Tax::get_tax_classes();
32
-	$classes_options  = wc_get_product_tax_class_options();
33
-	$show_tax_columns = count( $order_taxes ) === 1;
30
+    $order_taxes      = $order->get_taxes();
31
+    $tax_classes      = WC_Tax::get_tax_classes();
32
+    $classes_options  = wc_get_product_tax_class_options();
33
+    $show_tax_columns = count( $order_taxes ) === 1;
34 34
 }
35 35
 ?>
36 36
 <div class="woocommerce_order_items_wrapper wc-order-items-editable">
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 				<th class="quantity sortable" data-sort="int"><?php esc_html_e( 'Qty', 'woocommerce' ); ?></th>
44 44
 				<th class="line_cost sortable" data-sort="float"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
45 45
 				<?php
46
-				if ( ! empty( $order_taxes ) ) :
47
-					foreach ( $order_taxes as $tax_id => $tax_item ) :
48
-						$tax_class      = wc_get_tax_class_by_tax_id( $tax_item['rate_id'] );
49
-						$tax_class_name = isset( $classes_options[ $tax_class ] ) ? $classes_options[ $tax_class ] : __( 'Tax', 'woocommerce' );
50
-						$column_label   = ! empty( $tax_item['label'] ) ? $tax_item['label'] : __( 'Tax', 'woocommerce' );
51
-						/* translators: %1$s: tax item name %2$s: tax class name  */
52
-						$column_tip = sprintf( esc_html__( '%1$s (%2$s)', 'woocommerce' ), $tax_item['name'], $tax_class_name );
53
-						?>
46
+                if ( ! empty( $order_taxes ) ) :
47
+                    foreach ( $order_taxes as $tax_id => $tax_item ) :
48
+                        $tax_class      = wc_get_tax_class_by_tax_id( $tax_item['rate_id'] );
49
+                        $tax_class_name = isset( $classes_options[ $tax_class ] ) ? $classes_options[ $tax_class ] : __( 'Tax', 'woocommerce' );
50
+                        $column_label   = ! empty( $tax_item['label'] ) ? $tax_item['label'] : __( 'Tax', 'woocommerce' );
51
+                        /* translators: %1$s: tax item name %2$s: tax class name  */
52
+                        $column_tip = sprintf( esc_html__( '%1$s (%2$s)', 'woocommerce' ), $tax_item['name'], $tax_class_name );
53
+                        ?>
54 54
 						<th class="line_tax tips" data-tip="<?php echo esc_attr( $column_tip ); ?>">
55 55
 							<?php echo esc_attr( $column_label ); ?>
56 56
 							<input type="hidden" class="order-tax-id" name="order_taxes[<?php echo esc_attr( $tax_id ); ?>]" value="<?php echo esc_attr( $tax_item['rate_id'] ); ?>">
@@ -59,84 +59,84 @@  discard block
 block discarded – undo
59 59
 							<?php endif; ?>
60 60
 						</th>
61 61
 						<?php
62
-					endforeach;
63
-				endif;
64
-				?>
62
+                    endforeach;
63
+                endif;
64
+                ?>
65 65
 				<th class="wc-order-edit-line-item" width="1%">&nbsp;</th>
66 66
 			</tr>
67 67
 		</thead>
68 68
 		<tbody id="order_line_items">
69 69
 			<?php
70
-			foreach ( $line_items as $item_id => $item ) {
71
-				do_action( 'woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
70
+            foreach ( $line_items as $item_id => $item ) {
71
+                do_action( 'woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
72 72
 
73
-				include __DIR__ . '/html-order-item.php';
73
+                include __DIR__ . '/html-order-item.php';
74 74
 
75
-				do_action( 'woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
76
-			}
77
-			do_action( 'woocommerce_admin_order_items_after_line_items', $order->get_id() );
78
-			?>
75
+                do_action( 'woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
76
+            }
77
+            do_action( 'woocommerce_admin_order_items_after_line_items', $order->get_id() );
78
+            ?>
79 79
 		</tbody>
80 80
 		<tbody id="order_fee_line_items">
81 81
 			<?php
82
-			foreach ( $line_items_fee as $item_id => $item ) {
83
-				include __DIR__ . '/html-order-fee.php';
84
-			}
85
-			do_action( 'woocommerce_admin_order_items_after_fees', $order->get_id() );
86
-			?>
82
+            foreach ( $line_items_fee as $item_id => $item ) {
83
+                include __DIR__ . '/html-order-fee.php';
84
+            }
85
+            do_action( 'woocommerce_admin_order_items_after_fees', $order->get_id() );
86
+            ?>
87 87
 		</tbody>
88 88
 		<tbody id="order_shipping_line_items">
89 89
 			<?php
90
-			$shipping_methods = WC()->shipping() ? WC()->shipping()->load_shipping_methods() : array();
91
-			foreach ( $line_items_shipping as $item_id => $item ) {
92
-				include __DIR__ . '/html-order-shipping.php';
93
-			}
94
-			do_action( 'woocommerce_admin_order_items_after_shipping', $order->get_id() );
95
-			?>
90
+            $shipping_methods = WC()->shipping() ? WC()->shipping()->load_shipping_methods() : array();
91
+            foreach ( $line_items_shipping as $item_id => $item ) {
92
+                include __DIR__ . '/html-order-shipping.php';
93
+            }
94
+            do_action( 'woocommerce_admin_order_items_after_shipping', $order->get_id() );
95
+            ?>
96 96
 		</tbody>
97 97
 		<tbody id="order_refunds">
98 98
 			<?php
99
-			$refunds = $order->get_refunds();
99
+            $refunds = $order->get_refunds();
100 100
 
101
-			if ( $refunds ) {
102
-				foreach ( $refunds as $refund ) {
103
-					include __DIR__ . '/html-order-refund.php';
104
-				}
105
-				do_action( 'woocommerce_admin_order_items_after_refunds', $order->get_id() );
106
-			}
107
-			?>
101
+            if ( $refunds ) {
102
+                foreach ( $refunds as $refund ) {
103
+                    include __DIR__ . '/html-order-refund.php';
104
+                }
105
+                do_action( 'woocommerce_admin_order_items_after_refunds', $order->get_id() );
106
+            }
107
+            ?>
108 108
 		</tbody>
109 109
 	</table>
110 110
 </div>
111 111
 <div class="wc-order-data-row wc-order-totals-items wc-order-items-editable">
112 112
 	<?php
113
-	$coupons = $order->get_items( 'coupon' );
114
-	if ( $coupons ) :
115
-		?>
113
+    $coupons = $order->get_items( 'coupon' );
114
+    if ( $coupons ) :
115
+        ?>
116 116
 		<div class="wc-used-coupons">
117 117
 			<ul class="wc_coupon_list">
118 118
 				<li><strong><?php esc_html_e( 'Coupon(s)', 'woocommerce' ); ?></strong></li>
119 119
 				<?php
120
-				foreach ( $coupons as $item_id => $item ) :
121
-					$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1;", $item->get_code() ) ); // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
122
-					$class   = $order->is_editable() ? 'code editable' : 'code';
123
-					?>
120
+                foreach ( $coupons as $item_id => $item ) :
121
+                    $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1;", $item->get_code() ) ); // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
122
+                    $class   = $order->is_editable() ? 'code editable' : 'code';
123
+                    ?>
124 124
 					<li class="<?php echo esc_attr( $class ); ?>">
125 125
 						<?php if ( $post_id ) : ?>
126 126
 							<?php
127
-							$post_url = apply_filters(
128
-								'woocommerce_admin_order_item_coupon_url',
129
-								add_query_arg(
130
-									array(
131
-										'post'   => $post_id,
132
-										'action' => 'edit',
133
-									),
134
-									admin_url( 'post.php' )
135
-								),
136
-								$item,
137
-								$order
138
-							);
139
-							?>
127
+                            $post_url = apply_filters(
128
+                                'woocommerce_admin_order_item_coupon_url',
129
+                                add_query_arg(
130
+                                    array(
131
+                                        'post'   => $post_id,
132
+                                        'action' => 'edit',
133
+                                    ),
134
+                                    admin_url( 'post.php' )
135
+                                ),
136
+                                $item,
137
+                                $order
138
+                            );
139
+                            ?>
140 140
 							<a href="<?php echo esc_url( $post_url ); ?>" class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
141 141
 								<span><?php echo esc_html( $item->get_code() ); ?></span>
142 142
 							</a>
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 					<td width="1%"></td>
202 202
 					<td class="total">
203 203
 						<?php
204
-							// We use wc_round_tax_total here because tax may need to be round up or round down depending upon settings, whereas wc_price alone will always round it down.
205
-							echo wc_price( wc_round_tax_total( $tax_total->amount ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
206
-						?>
204
+                            // We use wc_round_tax_total here because tax may need to be round up or round down depending upon settings, whereas wc_price alone will always round it down.
205
+                            echo wc_price( wc_round_tax_total( $tax_total->amount ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
206
+                        ?>
207 207
 					</td>
208 208
 				</tr>
209 209
 			<?php endforeach; ?>
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
 				<td>
238 238
 					<span class="description">
239 239
 					<?php
240
-					if ( $order->get_payment_method_title() ) {
241
-						/* translators: 1: payment date. 2: payment method */
242
-						echo esc_html( sprintf( __( '%1$s via %2$s', 'woocommerce' ), $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ), $order->get_payment_method_title() ) );
243
-					} else {
244
-						echo esc_html( $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ) );
245
-					}
246
-					?>
240
+                    if ( $order->get_payment_method_title() ) {
241
+                        /* translators: 1: payment date. 2: payment method */
242
+                        echo esc_html( sprintf( __( '%1$s via %2$s', 'woocommerce' ), $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ), $order->get_payment_method_title() ) );
243
+                    } else {
244
+                        echo esc_html( $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ) );
245
+                    }
246
+                    ?>
247 247
 					</span>
248 248
 				</td>
249 249
 				<td colspan="2"></td>
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 			<button type="button" class="button refund-items"><?php esc_html_e( 'Refund', 'woocommerce' ); ?></button>
298 298
 		<?php endif; ?>
299 299
 		<?php
300
-			// Allow adding custom buttons.
301
-			do_action( 'woocommerce_order_item_add_action_buttons', $order );
302
-		?>
300
+            // Allow adding custom buttons.
301
+            do_action( 'woocommerce_order_item_add_action_buttons', $order );
302
+        ?>
303 303
 		<?php if ( $order->is_editable() ) : ?>
304 304
 			<button type="button" class="button button-primary calculate-action"><?php esc_html_e( 'Recalculate', 'woocommerce' ); ?></button>
305 305
 		<?php endif; ?>
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
 		<button type="button" class="button add-order-tax"><?php esc_html_e( 'Add tax', 'woocommerce' ); ?></button>
314 314
 	<?php endif; ?>
315 315
 	<?php
316
-		// Allow adding custom buttons.
317
-		do_action( 'woocommerce_order_item_add_line_buttons', $order );
318
-	?>
316
+        // Allow adding custom buttons.
317
+        do_action( 'woocommerce_order_item_add_line_buttons', $order );
318
+    ?>
319 319
 	<button type="button" class="button cancel-action"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
320 320
 	<button type="button" class="button button-primary save-action"><?php esc_html_e( 'Save', 'woocommerce' ); ?></button>
321 321
 </div>
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
 			<td class="total">
347 347
 				<input type="text" id="refund_amount" name="refund_amount" class="wc_input_price"
348 348
 				<?php
349
-				if ( wc_tax_enabled() ) {
350
-					// If taxes are enabled, using this refund amount can cause issues due to taxes not being refunded also.
351
-					// The refunds should be added to the line items, not the order as a whole.
352
-					echo 'readonly';
353
-				}
354
-				?>
349
+                if ( wc_tax_enabled() ) {
350
+                    // If taxes are enabled, using this refund amount can cause issues due to taxes not being refunded also.
351
+                    // The refunds should be added to the line items, not the order as a whole.
352
+                    echo 'readonly';
353
+                }
354
+                ?>
355 355
 				/>
356 356
 				<div class="clear"></div>
357 357
 			</td>
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	<div class="clear"></div>
373 373
 	<div class="refund-actions">
374 374
 		<?php
375
-		$refund_amount = '<span class="wc-order-refund-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>';
376
-		$gateway_name  = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment gateway', 'woocommerce' );
375
+        $refund_amount = '<span class="wc-order-refund-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>';
376
+        $gateway_name  = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment gateway', 'woocommerce' );
377 377
 
378
-		if ( false !== $payment_gateway && $payment_gateway->can_refund_order( $order ) ) {
379
-			/* translators: refund amount, gateway name */
380
-			echo '<button type="button" class="button button-primary do-api-refund">' . sprintf( esc_html__( 'Refund %1$s via %2$s', 'woocommerce' ), wp_kses_post( $refund_amount ), esc_html( $gateway_name ) ) . '</button>';
381
-		}
382
-		?>
378
+        if ( false !== $payment_gateway && $payment_gateway->can_refund_order( $order ) ) {
379
+            /* translators: refund amount, gateway name */
380
+            echo '<button type="button" class="button button-primary do-api-refund">' . sprintf( esc_html__( 'Refund %1$s via %2$s', 'woocommerce' ), wp_kses_post( $refund_amount ), esc_html( $gateway_name ) ) . '</button>';
381
+        }
382
+        ?>
383 383
 		<?php /* translators: refund amount  */ ?>
384 384
 		<button type="button" class="button button-primary do-manual-refund tips" data-tip="<?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?>"><?php printf( esc_html__( 'Refund %s manually', 'woocommerce' ), wp_kses_post( $refund_amount ) ); ?></button>
385 385
 		<button type="button" class="button cancel-action"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 								</tr>
410 410
 							</thead>
411 411
 							<?php
412
-								$row = '
412
+                                $row = '
413 413
 									<td><select class="wc-product-search" name="item_id" data-allow_clear="true" data-display_stock="true" data-exclude_type="variable" data-placeholder="' . esc_attr__( 'Search for a product&hellip;', 'woocommerce' ) . '"></select></td>
414 414
 									<td><input type="number" step="1" min="0" max="9999" autocomplete="off" name="item_qty" placeholder="1" size="4" class="quantity" /></td>';
415
-							?>
415
+                            ?>
416 416
 							<tbody data-row="<?php echo esc_attr( $row ); ?>">
417 417
 								<tr>
418 418
 									<?php echo $row; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
@@ -455,9 +455,9 @@  discard block
 block discarded – undo
455 455
 								</tr>
456 456
 							</thead>
457 457
 						<?php
458
-						$rates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100" );
459
-						foreach ( $rates as $rate ) {
460
-							echo '
458
+                        $rates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100" );
459
+                        foreach ( $rates as $rate ) {
460
+                            echo '
461 461
 									<tr>
462 462
 										<td><input type="radio" id="add_order_tax_' . absint( $rate->tax_rate_id ) . '" name="add_order_tax" value="' . absint( $rate->tax_rate_id ) . '" /></td>
463 463
 										<td><label for="add_order_tax_' . absint( $rate->tax_rate_id ) . '">' . esc_html( WC_Tax::get_rate_label( $rate ) ) . '</label></td>
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 										<td>' . esc_html( WC_Tax::get_rate_percent( $rate ) ) . '</td>
467 467
 									</tr>
468 468
 								';
469
-						}
470
-						?>
469
+                        }
470
+                        ?>
471 471
 						</table>
472 472
 						<?php if ( absint( $wpdb->get_var( "SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates;" ) ) > 100 ) : ?>
473 473
 							<p>
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WooCommerce\Admin
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Allow plugins to determine whether refunds UI should be rendered in the template.
@@ -16,46 +16,46 @@  discard block
 block discarded – undo
16 16
  * @param int      $order_id       The Order ID.
17 17
  * @param WC_Order $order          The Order object.
18 18
  */
19
-$render_refunds = (bool) apply_filters( 'woocommerce_admin_order_should_render_refunds', 0 < $order->get_total() - $order->get_total_refunded() || 0 < absint( $order->get_item_count() - $order->get_item_count_refunded() ), $order->get_id(), $order );
19
+$render_refunds = (bool) apply_filters('woocommerce_admin_order_should_render_refunds', 0 < $order->get_total() - $order->get_total_refunded() || 0 < absint($order->get_item_count() - $order->get_item_count_refunded()), $order->get_id(), $order);
20 20
 
21 21
 global $wpdb;
22 22
 
23
-$payment_gateway     = wc_get_payment_gateway_by_order( $order );
24
-$line_items          = $order->get_items( apply_filters( 'woocommerce_admin_order_item_types', 'line_item' ) );
25
-$discounts           = $order->get_items( 'discount' );
26
-$line_items_fee      = $order->get_items( 'fee' );
27
-$line_items_shipping = $order->get_items( 'shipping' );
23
+$payment_gateway     = wc_get_payment_gateway_by_order($order);
24
+$line_items          = $order->get_items(apply_filters('woocommerce_admin_order_item_types', 'line_item'));
25
+$discounts           = $order->get_items('discount');
26
+$line_items_fee      = $order->get_items('fee');
27
+$line_items_shipping = $order->get_items('shipping');
28 28
 
29
-if ( wc_tax_enabled() ) {
29
+if (wc_tax_enabled()) {
30 30
 	$order_taxes      = $order->get_taxes();
31 31
 	$tax_classes      = WC_Tax::get_tax_classes();
32 32
 	$classes_options  = wc_get_product_tax_class_options();
33
-	$show_tax_columns = count( $order_taxes ) === 1;
33
+	$show_tax_columns = count($order_taxes) === 1;
34 34
 }
35 35
 ?>
36 36
 <div class="woocommerce_order_items_wrapper wc-order-items-editable">
37 37
 	<table cellpadding="0" cellspacing="0" class="woocommerce_order_items">
38 38
 		<thead>
39 39
 			<tr>
40
-				<th class="item sortable" colspan="2" data-sort="string-ins"><?php esc_html_e( 'Item', 'woocommerce' ); ?></th>
41
-				<?php do_action( 'woocommerce_admin_order_item_headers', $order ); ?>
42
-				<th class="item_cost sortable" data-sort="float"><?php esc_html_e( 'Cost', 'woocommerce' ); ?></th>
43
-				<th class="quantity sortable" data-sort="int"><?php esc_html_e( 'Qty', 'woocommerce' ); ?></th>
44
-				<th class="line_cost sortable" data-sort="float"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
40
+				<th class="item sortable" colspan="2" data-sort="string-ins"><?php esc_html_e('Item', 'woocommerce'); ?></th>
41
+				<?php do_action('woocommerce_admin_order_item_headers', $order); ?>
42
+				<th class="item_cost sortable" data-sort="float"><?php esc_html_e('Cost', 'woocommerce'); ?></th>
43
+				<th class="quantity sortable" data-sort="int"><?php esc_html_e('Qty', 'woocommerce'); ?></th>
44
+				<th class="line_cost sortable" data-sort="float"><?php esc_html_e('Total', 'woocommerce'); ?></th>
45 45
 				<?php
46
-				if ( ! empty( $order_taxes ) ) :
47
-					foreach ( $order_taxes as $tax_id => $tax_item ) :
48
-						$tax_class      = wc_get_tax_class_by_tax_id( $tax_item['rate_id'] );
49
-						$tax_class_name = isset( $classes_options[ $tax_class ] ) ? $classes_options[ $tax_class ] : __( 'Tax', 'woocommerce' );
50
-						$column_label   = ! empty( $tax_item['label'] ) ? $tax_item['label'] : __( 'Tax', 'woocommerce' );
46
+				if (!empty($order_taxes)) :
47
+					foreach ($order_taxes as $tax_id => $tax_item) :
48
+						$tax_class      = wc_get_tax_class_by_tax_id($tax_item['rate_id']);
49
+						$tax_class_name = isset($classes_options[$tax_class]) ? $classes_options[$tax_class] : __('Tax', 'woocommerce');
50
+						$column_label   = !empty($tax_item['label']) ? $tax_item['label'] : __('Tax', 'woocommerce');
51 51
 						/* translators: %1$s: tax item name %2$s: tax class name  */
52
-						$column_tip = sprintf( esc_html__( '%1$s (%2$s)', 'woocommerce' ), $tax_item['name'], $tax_class_name );
52
+						$column_tip = sprintf(esc_html__('%1$s (%2$s)', 'woocommerce'), $tax_item['name'], $tax_class_name);
53 53
 						?>
54
-						<th class="line_tax tips" data-tip="<?php echo esc_attr( $column_tip ); ?>">
55
-							<?php echo esc_attr( $column_label ); ?>
56
-							<input type="hidden" class="order-tax-id" name="order_taxes[<?php echo esc_attr( $tax_id ); ?>]" value="<?php echo esc_attr( $tax_item['rate_id'] ); ?>">
57
-							<?php if ( $order->is_editable() ) : ?>
58
-								<a class="delete-order-tax" href="#" data-rate_id="<?php echo esc_attr( $tax_id ); ?>"></a>
54
+						<th class="line_tax tips" data-tip="<?php echo esc_attr($column_tip); ?>">
55
+							<?php echo esc_attr($column_label); ?>
56
+							<input type="hidden" class="order-tax-id" name="order_taxes[<?php echo esc_attr($tax_id); ?>]" value="<?php echo esc_attr($tax_item['rate_id']); ?>">
57
+							<?php if ($order->is_editable()) : ?>
58
+								<a class="delete-order-tax" href="#" data-rate_id="<?php echo esc_attr($tax_id); ?>"></a>
59 59
 							<?php endif; ?>
60 60
 						</th>
61 61
 						<?php
@@ -67,42 +67,42 @@  discard block
 block discarded – undo
67 67
 		</thead>
68 68
 		<tbody id="order_line_items">
69 69
 			<?php
70
-			foreach ( $line_items as $item_id => $item ) {
71
-				do_action( 'woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
70
+			foreach ($line_items as $item_id => $item) {
71
+				do_action('woocommerce_before_order_item_' . $item->get_type() . '_html', $item_id, $item, $order);
72 72
 
73 73
 				include __DIR__ . '/html-order-item.php';
74 74
 
75
-				do_action( 'woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order );
75
+				do_action('woocommerce_order_item_' . $item->get_type() . '_html', $item_id, $item, $order);
76 76
 			}
77
-			do_action( 'woocommerce_admin_order_items_after_line_items', $order->get_id() );
77
+			do_action('woocommerce_admin_order_items_after_line_items', $order->get_id());
78 78
 			?>
79 79
 		</tbody>
80 80
 		<tbody id="order_fee_line_items">
81 81
 			<?php
82
-			foreach ( $line_items_fee as $item_id => $item ) {
82
+			foreach ($line_items_fee as $item_id => $item) {
83 83
 				include __DIR__ . '/html-order-fee.php';
84 84
 			}
85
-			do_action( 'woocommerce_admin_order_items_after_fees', $order->get_id() );
85
+			do_action('woocommerce_admin_order_items_after_fees', $order->get_id());
86 86
 			?>
87 87
 		</tbody>
88 88
 		<tbody id="order_shipping_line_items">
89 89
 			<?php
90 90
 			$shipping_methods = WC()->shipping() ? WC()->shipping()->load_shipping_methods() : array();
91
-			foreach ( $line_items_shipping as $item_id => $item ) {
91
+			foreach ($line_items_shipping as $item_id => $item) {
92 92
 				include __DIR__ . '/html-order-shipping.php';
93 93
 			}
94
-			do_action( 'woocommerce_admin_order_items_after_shipping', $order->get_id() );
94
+			do_action('woocommerce_admin_order_items_after_shipping', $order->get_id());
95 95
 			?>
96 96
 		</tbody>
97 97
 		<tbody id="order_refunds">
98 98
 			<?php
99 99
 			$refunds = $order->get_refunds();
100 100
 
101
-			if ( $refunds ) {
102
-				foreach ( $refunds as $refund ) {
101
+			if ($refunds) {
102
+				foreach ($refunds as $refund) {
103 103
 					include __DIR__ . '/html-order-refund.php';
104 104
 				}
105
-				do_action( 'woocommerce_admin_order_items_after_refunds', $order->get_id() );
105
+				do_action('woocommerce_admin_order_items_after_refunds', $order->get_id());
106 106
 			}
107 107
 			?>
108 108
 		</tbody>
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 </div>
111 111
 <div class="wc-order-data-row wc-order-totals-items wc-order-items-editable">
112 112
 	<?php
113
-	$coupons = $order->get_items( 'coupon' );
114
-	if ( $coupons ) :
113
+	$coupons = $order->get_items('coupon');
114
+	if ($coupons) :
115 115
 		?>
116 116
 		<div class="wc-used-coupons">
117 117
 			<ul class="wc_coupon_list">
118
-				<li><strong><?php esc_html_e( 'Coupon(s)', 'woocommerce' ); ?></strong></li>
118
+				<li><strong><?php esc_html_e('Coupon(s)', 'woocommerce'); ?></strong></li>
119 119
 				<?php
120
-				foreach ( $coupons as $item_id => $item ) :
121
-					$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1;", $item->get_code() ) ); // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
120
+				foreach ($coupons as $item_id => $item) :
121
+					$post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1;", $item->get_code())); // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
122 122
 					$class   = $order->is_editable() ? 'code editable' : 'code';
123 123
 					?>
124
-					<li class="<?php echo esc_attr( $class ); ?>">
125
-						<?php if ( $post_id ) : ?>
124
+					<li class="<?php echo esc_attr($class); ?>">
125
+						<?php if ($post_id) : ?>
126 126
 							<?php
127 127
 							$post_url = apply_filters(
128 128
 								'woocommerce_admin_order_item_coupon_url',
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
 										'post'   => $post_id,
132 132
 										'action' => 'edit',
133 133
 									),
134
-									admin_url( 'post.php' )
134
+									admin_url('post.php')
135 135
 								),
136 136
 								$item,
137 137
 								$order
138 138
 							);
139 139
 							?>
140
-							<a href="<?php echo esc_url( $post_url ); ?>" class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
141
-								<span><?php echo esc_html( $item->get_code() ); ?></span>
140
+							<a href="<?php echo esc_url($post_url); ?>" class="tips" data-tip="<?php echo esc_attr(wc_price($item->get_discount(), array('currency' => $order->get_currency()))); ?>">
141
+								<span><?php echo esc_html($item->get_code()); ?></span>
142 142
 							</a>
143 143
 						<?php else : ?>
144
-							<span class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
145
-								<span><?php echo esc_html( $item->get_code() ); ?></span>
144
+							<span class="tips" data-tip="<?php echo esc_attr(wc_price($item->get_discount(), array('currency' => $order->get_currency()))); ?>">
145
+								<span><?php echo esc_html($item->get_code()); ?></span>
146 146
 							</span>
147 147
 						<?php endif; ?>
148
-						<?php if ( $order->is_editable() ) : ?>
149
-							<a class="remove-coupon" href="javascript:void(0)" aria-label="Remove" data-code="<?php echo esc_attr( $item->get_code() ); ?>"></a>
148
+						<?php if ($order->is_editable()) : ?>
149
+							<a class="remove-coupon" href="javascript:void(0)" aria-label="Remove" data-code="<?php echo esc_attr($item->get_code()); ?>"></a>
150 150
 						<?php endif; ?>
151 151
 					</li>
152 152
 				<?php endforeach; ?>
@@ -155,67 +155,67 @@  discard block
 block discarded – undo
155 155
 	<?php endif; ?>
156 156
 	<table class="wc-order-totals">
157 157
 			<tr>
158
-				<td class="label"><?php esc_html_e( 'Items Subtotal:', 'woocommerce' ); ?></td>
158
+				<td class="label"><?php esc_html_e('Items Subtotal:', 'woocommerce'); ?></td>
159 159
 				<td width="1%"></td>
160 160
 				<td class="total">
161
-					<?php echo wc_price( $order->get_subtotal(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
161
+					<?php echo wc_price($order->get_subtotal(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
162 162
 				</td>
163 163
 			</tr>
164
-		<?php if ( 0 < $order->get_total_discount() ) : ?>
164
+		<?php if (0 < $order->get_total_discount()) : ?>
165 165
 			<tr>
166
-				<td class="label"><?php esc_html_e( 'Coupon(s):', 'woocommerce' ); ?></td>
166
+				<td class="label"><?php esc_html_e('Coupon(s):', 'woocommerce'); ?></td>
167 167
 				<td width="1%"></td>
168 168
 				<td class="total">-
169
-					<?php echo wc_price( $order->get_total_discount(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
169
+					<?php echo wc_price($order->get_total_discount(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
170 170
 				</td>
171 171
 			</tr>
172 172
 		<?php endif; ?>
173
-		<?php if ( 0 < $order->get_total_fees() ) : ?>
173
+		<?php if (0 < $order->get_total_fees()) : ?>
174 174
 			<tr>
175
-				<td class="label"><?php esc_html_e( 'Fees:', 'woocommerce' ); ?></td>
175
+				<td class="label"><?php esc_html_e('Fees:', 'woocommerce'); ?></td>
176 176
 				<td width="1%"></td>
177 177
 				<td class="total">
178
-					<?php echo wc_price( $order->get_total_fees(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
178
+					<?php echo wc_price($order->get_total_fees(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
179 179
 				</td>
180 180
 			</tr>
181 181
 		<?php endif; ?>
182 182
 
183
-		<?php do_action( 'woocommerce_admin_order_totals_after_discount', $order->get_id() ); ?>
183
+		<?php do_action('woocommerce_admin_order_totals_after_discount', $order->get_id()); ?>
184 184
 
185
-		<?php if ( $order->get_shipping_methods() ) : ?>
185
+		<?php if ($order->get_shipping_methods()) : ?>
186 186
 			<tr>
187
-				<td class="label"><?php esc_html_e( 'Shipping:', 'woocommerce' ); ?></td>
187
+				<td class="label"><?php esc_html_e('Shipping:', 'woocommerce'); ?></td>
188 188
 				<td width="1%"></td>
189 189
 				<td class="total">
190
-					<?php echo wc_price( $order->get_shipping_total(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
190
+					<?php echo wc_price($order->get_shipping_total(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
191 191
 				</td>
192 192
 			</tr>
193 193
 		<?php endif; ?>
194 194
 
195
-		<?php do_action( 'woocommerce_admin_order_totals_after_shipping', $order->get_id() ); ?>
195
+		<?php do_action('woocommerce_admin_order_totals_after_shipping', $order->get_id()); ?>
196 196
 
197
-		<?php if ( wc_tax_enabled() ) : ?>
198
-			<?php foreach ( $order->get_tax_totals() as $code => $tax_total ) : ?>
197
+		<?php if (wc_tax_enabled()) : ?>
198
+			<?php foreach ($order->get_tax_totals() as $code => $tax_total) : ?>
199 199
 				<tr>
200
-					<td class="label"><?php echo esc_html( $tax_total->label ); ?>:</td>
200
+					<td class="label"><?php echo esc_html($tax_total->label); ?>:</td>
201 201
 					<td width="1%"></td>
202 202
 					<td class="total">
203 203
 						<?php
204 204
 							// We use wc_round_tax_total here because tax may need to be round up or round down depending upon settings, whereas wc_price alone will always round it down.
205
-							echo wc_price( wc_round_tax_total( $tax_total->amount ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
205
+							echo wc_price(wc_round_tax_total($tax_total->amount), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
206 206
 						?>
207 207
 					</td>
208 208
 				</tr>
209 209
 			<?php endforeach; ?>
210 210
 		<?php endif; ?>
211 211
 
212
-		<?php do_action( 'woocommerce_admin_order_totals_after_tax', $order->get_id() ); ?>
212
+		<?php do_action('woocommerce_admin_order_totals_after_tax', $order->get_id()); ?>
213 213
 
214 214
 		<tr>
215
-			<td class="label"><?php esc_html_e( 'Order Total', 'woocommerce' ); ?>:</td>
215
+			<td class="label"><?php esc_html_e('Order Total', 'woocommerce'); ?>:</td>
216 216
 			<td width="1%"></td>
217 217
 			<td class="total">
218
-				<?php echo wc_price( $order->get_total(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
218
+				<?php echo wc_price($order->get_total(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
219 219
 			</td>
220 220
 		</tr>
221 221
 
@@ -223,25 +223,25 @@  discard block
 block discarded – undo
223 223
 
224 224
 	<div class="clear"></div>
225 225
 
226
-	<?php if ( in_array( $order->get_status(), array( 'processing', 'completed', 'refunded' ), true ) && ! empty( $order->get_date_paid() ) ) : ?>
226
+	<?php if (in_array($order->get_status(), array('processing', 'completed', 'refunded'), true) && !empty($order->get_date_paid())) : ?>
227 227
 
228 228
 		<table class="wc-order-totals" style="border-top: 1px solid #999; margin-top:12px; padding-top:12px">
229 229
 			<tr>
230
-				<td class="<?php echo $order->get_total_refunded() ? 'label' : 'label label-highlight'; ?>"><?php esc_html_e( 'Paid', 'woocommerce' ); ?>: <br /></td>
230
+				<td class="<?php echo $order->get_total_refunded() ? 'label' : 'label label-highlight'; ?>"><?php esc_html_e('Paid', 'woocommerce'); ?>: <br /></td>
231 231
 				<td width="1%"></td>
232 232
 				<td class="total">
233
-					<?php echo wc_price( $order->get_total(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
233
+					<?php echo wc_price($order->get_total(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
234 234
 				</td>
235 235
 			</tr>
236 236
 			<tr>
237 237
 				<td>
238 238
 					<span class="description">
239 239
 					<?php
240
-					if ( $order->get_payment_method_title() ) {
240
+					if ($order->get_payment_method_title()) {
241 241
 						/* translators: 1: payment date. 2: payment method */
242
-						echo esc_html( sprintf( __( '%1$s via %2$s', 'woocommerce' ), $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ), $order->get_payment_method_title() ) );
242
+						echo esc_html(sprintf(__('%1$s via %2$s', 'woocommerce'), $order->get_date_paid()->date_i18n(get_option('date_format')), $order->get_payment_method_title()));
243 243
 					} else {
244
-						echo esc_html( $order->get_date_paid()->date_i18n( get_option( 'date_format' ) ) );
244
+						echo esc_html($order->get_date_paid()->date_i18n(get_option('date_format')));
245 245
 					}
246 246
 					?>
247 247
 					</span>
@@ -254,21 +254,21 @@  discard block
 block discarded – undo
254 254
 
255 255
 	<?php endif; ?>
256 256
 
257
-	<?php if ( $order->get_total_refunded() ) : ?>
257
+	<?php if ($order->get_total_refunded()) : ?>
258 258
 		<table class="wc-order-totals" style="border-top: 1px solid #999; margin-top:12px; padding-top:12px">
259 259
 			<tr>
260
-				<td class="label refunded-total"><?php esc_html_e( 'Refunded', 'woocommerce' ); ?>:</td>
260
+				<td class="label refunded-total"><?php esc_html_e('Refunded', 'woocommerce'); ?>:</td>
261 261
 				<td width="1%"></td>
262
-				<td class="total refunded-total">-<?php echo wc_price( $order->get_total_refunded(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
262
+				<td class="total refunded-total">-<?php echo wc_price($order->get_total_refunded(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
263 263
 			</tr>
264 264
 
265
-			<?php do_action( 'woocommerce_admin_order_totals_after_refunded', $order->get_id() ); ?>
265
+			<?php do_action('woocommerce_admin_order_totals_after_refunded', $order->get_id()); ?>
266 266
 
267 267
 			<tr>
268
-				<td class="label label-highlight"><?php esc_html_e( 'Net Payment', 'woocommerce' ); ?>:</td>
268
+				<td class="label label-highlight"><?php esc_html_e('Net Payment', 'woocommerce'); ?>:</td>
269 269
 				<td width="1%"></td>
270 270
 				<td class="total">
271
-				<?php echo wc_price( $order->get_total() - $order->get_total_refunded(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
271
+				<?php echo wc_price($order->get_total() - $order->get_total_refunded(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
272 272
 				</td>
273 273
 			</tr>
274 274
 
@@ -278,75 +278,75 @@  discard block
 block discarded – undo
278 278
 	<div class="clear"></div>
279 279
 
280 280
 	<table class="wc-order-totals">
281
-		<?php do_action( 'woocommerce_admin_order_totals_after_total', $order->get_id() ); ?>
281
+		<?php do_action('woocommerce_admin_order_totals_after_total', $order->get_id()); ?>
282 282
 	</table>
283 283
 
284 284
 	<div class="clear"></div>
285 285
 </div>
286 286
 <div class="wc-order-data-row wc-order-bulk-actions wc-order-data-row-toggle">
287 287
 	<p class="add-items">
288
-		<?php if ( $order->is_editable() ) : ?>
289
-			<button type="button" class="button add-line-item"><?php esc_html_e( 'Add item(s)', 'woocommerce' ); ?></button>
290
-			<?php if ( wc_coupons_enabled() ) : ?>
291
-				<button type="button" class="button add-coupon"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
288
+		<?php if ($order->is_editable()) : ?>
289
+			<button type="button" class="button add-line-item"><?php esc_html_e('Add item(s)', 'woocommerce'); ?></button>
290
+			<?php if (wc_coupons_enabled()) : ?>
291
+				<button type="button" class="button add-coupon"><?php esc_html_e('Apply coupon', 'woocommerce'); ?></button>
292 292
 			<?php endif; ?>
293 293
 		<?php else : ?>
294
-			<span class="description"><?php echo wc_help_tip( __( 'To edit this order change the status back to "Pending payment"', 'woocommerce' ) ); ?> <?php esc_html_e( 'This order is no longer editable.', 'woocommerce' ); ?></span>
294
+			<span class="description"><?php echo wc_help_tip(__('To edit this order change the status back to "Pending payment"', 'woocommerce')); ?> <?php esc_html_e('This order is no longer editable.', 'woocommerce'); ?></span>
295 295
 		<?php endif; ?>
296
-		<?php if ( $render_refunds ) : ?>
297
-			<button type="button" class="button refund-items"><?php esc_html_e( 'Refund', 'woocommerce' ); ?></button>
296
+		<?php if ($render_refunds) : ?>
297
+			<button type="button" class="button refund-items"><?php esc_html_e('Refund', 'woocommerce'); ?></button>
298 298
 		<?php endif; ?>
299 299
 		<?php
300 300
 			// Allow adding custom buttons.
301
-			do_action( 'woocommerce_order_item_add_action_buttons', $order );
301
+			do_action('woocommerce_order_item_add_action_buttons', $order);
302 302
 		?>
303
-		<?php if ( $order->is_editable() ) : ?>
304
-			<button type="button" class="button button-primary calculate-action"><?php esc_html_e( 'Recalculate', 'woocommerce' ); ?></button>
303
+		<?php if ($order->is_editable()) : ?>
304
+			<button type="button" class="button button-primary calculate-action"><?php esc_html_e('Recalculate', 'woocommerce'); ?></button>
305 305
 		<?php endif; ?>
306 306
 	</p>
307 307
 </div>
308 308
 <div class="wc-order-data-row wc-order-add-item wc-order-data-row-toggle" style="display:none;">
309
-	<button type="button" class="button add-order-item"><?php esc_html_e( 'Add product(s)', 'woocommerce' ); ?></button>
310
-	<button type="button" class="button add-order-fee"><?php esc_html_e( 'Add fee', 'woocommerce' ); ?></button>
311
-	<button type="button" class="button add-order-shipping"><?php esc_html_e( 'Add shipping', 'woocommerce' ); ?></button>
312
-	<?php if ( wc_tax_enabled() ) : ?>
313
-		<button type="button" class="button add-order-tax"><?php esc_html_e( 'Add tax', 'woocommerce' ); ?></button>
309
+	<button type="button" class="button add-order-item"><?php esc_html_e('Add product(s)', 'woocommerce'); ?></button>
310
+	<button type="button" class="button add-order-fee"><?php esc_html_e('Add fee', 'woocommerce'); ?></button>
311
+	<button type="button" class="button add-order-shipping"><?php esc_html_e('Add shipping', 'woocommerce'); ?></button>
312
+	<?php if (wc_tax_enabled()) : ?>
313
+		<button type="button" class="button add-order-tax"><?php esc_html_e('Add tax', 'woocommerce'); ?></button>
314 314
 	<?php endif; ?>
315 315
 	<?php
316 316
 		// Allow adding custom buttons.
317
-		do_action( 'woocommerce_order_item_add_line_buttons', $order );
317
+		do_action('woocommerce_order_item_add_line_buttons', $order);
318 318
 	?>
319
-	<button type="button" class="button cancel-action"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
320
-	<button type="button" class="button button-primary save-action"><?php esc_html_e( 'Save', 'woocommerce' ); ?></button>
319
+	<button type="button" class="button cancel-action"><?php esc_html_e('Cancel', 'woocommerce'); ?></button>
320
+	<button type="button" class="button button-primary save-action"><?php esc_html_e('Save', 'woocommerce'); ?></button>
321 321
 </div>
322
-<?php if ( $render_refunds ) : ?>
322
+<?php if ($render_refunds) : ?>
323 323
 <div class="wc-order-data-row wc-order-refund-items wc-order-data-row-toggle" style="display: none;">
324 324
 	<table class="wc-order-totals">
325
-		<?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
325
+		<?php if ('yes' === get_option('woocommerce_manage_stock')) : ?>
326 326
 			<tr>
327
-				<td class="label"><label for="restock_refunded_items"><?php esc_html_e( 'Restock refunded items', 'woocommerce' ); ?>:</label></td>
328
-				<td class="total"><input type="checkbox" id="restock_refunded_items" name="restock_refunded_items" <?php checked( apply_filters( 'woocommerce_restock_refunded_items', true ) ); ?> /></td>
327
+				<td class="label"><label for="restock_refunded_items"><?php esc_html_e('Restock refunded items', 'woocommerce'); ?>:</label></td>
328
+				<td class="total"><input type="checkbox" id="restock_refunded_items" name="restock_refunded_items" <?php checked(apply_filters('woocommerce_restock_refunded_items', true)); ?> /></td>
329 329
 			</tr>
330 330
 		<?php endif; ?>
331 331
 		<tr>
332
-			<td class="label"><?php esc_html_e( 'Amount already refunded', 'woocommerce' ); ?>:</td>
333
-			<td class="total">-<?php echo wc_price( $order->get_total_refunded(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
332
+			<td class="label"><?php esc_html_e('Amount already refunded', 'woocommerce'); ?>:</td>
333
+			<td class="total">-<?php echo wc_price($order->get_total_refunded(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
334 334
 		</tr>
335 335
 		<tr>
336
-			<td class="label"><?php esc_html_e( 'Total available to refund', 'woocommerce' ); ?>:</td>
337
-			<td class="total"><?php echo wc_price( $order->get_total() - $order->get_total_refunded(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
336
+			<td class="label"><?php esc_html_e('Total available to refund', 'woocommerce'); ?>:</td>
337
+			<td class="total"><?php echo wc_price($order->get_total() - $order->get_total_refunded(), array('currency' => $order->get_currency())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
338 338
 		</tr>
339 339
 		<tr>
340 340
 			<td class="label">
341 341
 				<label for="refund_amount">
342
-					<?php echo wc_help_tip( __( 'Refund the line items above. This will show the total amount to be refunded', 'woocommerce' ) ); ?>
343
-					<?php esc_html_e( 'Refund amount', 'woocommerce' ); ?>:
342
+					<?php echo wc_help_tip(__('Refund the line items above. This will show the total amount to be refunded', 'woocommerce')); ?>
343
+					<?php esc_html_e('Refund amount', 'woocommerce'); ?>:
344 344
 				</label>
345 345
 			</td>
346 346
 			<td class="total">
347 347
 				<input type="text" id="refund_amount" name="refund_amount" class="wc_input_price"
348 348
 				<?php
349
-				if ( wc_tax_enabled() ) {
349
+				if (wc_tax_enabled()) {
350 350
 					// If taxes are enabled, using this refund amount can cause issues due to taxes not being refunded also.
351 351
 					// The refunds should be added to the line items, not the order as a whole.
352 352
 					echo 'readonly';
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 		<tr>
360 360
 			<td class="label">
361 361
 				<label for="refund_reason">
362
-					<?php echo wc_help_tip( __( 'Note: the refund reason will be visible by the customer.', 'woocommerce' ) ); ?>
363
-					<?php esc_html_e( 'Reason for refund (optional):', 'woocommerce' ); ?>
362
+					<?php echo wc_help_tip(__('Note: the refund reason will be visible by the customer.', 'woocommerce')); ?>
363
+					<?php esc_html_e('Reason for refund (optional):', 'woocommerce'); ?>
364 364
 				</label>
365 365
 			</td>
366 366
 			<td class="total">
@@ -372,18 +372,18 @@  discard block
 block discarded – undo
372 372
 	<div class="clear"></div>
373 373
 	<div class="refund-actions">
374 374
 		<?php
375
-		$refund_amount = '<span class="wc-order-refund-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>';
376
-		$gateway_name  = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment gateway', 'woocommerce' );
375
+		$refund_amount = '<span class="wc-order-refund-amount">' . wc_price(0, array('currency' => $order->get_currency())) . '</span>';
376
+		$gateway_name  = false !== $payment_gateway ? (!empty($payment_gateway->method_title) ? $payment_gateway->method_title : $payment_gateway->get_title()) : __('Payment gateway', 'woocommerce');
377 377
 
378
-		if ( false !== $payment_gateway && $payment_gateway->can_refund_order( $order ) ) {
378
+		if (false !== $payment_gateway && $payment_gateway->can_refund_order($order)) {
379 379
 			/* translators: refund amount, gateway name */
380
-			echo '<button type="button" class="button button-primary do-api-refund">' . sprintf( esc_html__( 'Refund %1$s via %2$s', 'woocommerce' ), wp_kses_post( $refund_amount ), esc_html( $gateway_name ) ) . '</button>';
380
+			echo '<button type="button" class="button button-primary do-api-refund">' . sprintf(esc_html__('Refund %1$s via %2$s', 'woocommerce'), wp_kses_post($refund_amount), esc_html($gateway_name)) . '</button>';
381 381
 		}
382 382
 		?>
383 383
 		<?php /* translators: refund amount  */ ?>
384
-		<button type="button" class="button button-primary do-manual-refund tips" data-tip="<?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?>"><?php printf( esc_html__( 'Refund %s manually', 'woocommerce' ), wp_kses_post( $refund_amount ) ); ?></button>
385
-		<button type="button" class="button cancel-action"><?php esc_html_e( 'Cancel', 'woocommerce' ); ?></button>
386
-		<input type="hidden" id="refunded_amount" name="refunded_amount" value="<?php echo esc_attr( $order->get_total_refunded() ); ?>" />
384
+		<button type="button" class="button button-primary do-manual-refund tips" data-tip="<?php esc_attr_e('You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce'); ?>"><?php printf(esc_html__('Refund %s manually', 'woocommerce'), wp_kses_post($refund_amount)); ?></button>
385
+		<button type="button" class="button cancel-action"><?php esc_html_e('Cancel', 'woocommerce'); ?></button>
386
+		<input type="hidden" id="refunded_amount" name="refunded_amount" value="<?php echo esc_attr($order->get_total_refunded()); ?>" />
387 387
 		<div class="clear"></div>
388 388
 	</div>
389 389
 </div>
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		<div class="wc-backbone-modal-content">
395 395
 			<section class="wc-backbone-modal-main" role="main">
396 396
 				<header class="wc-backbone-modal-header">
397
-					<h1><?php esc_html_e( 'Add products', 'woocommerce' ); ?></h1>
397
+					<h1><?php esc_html_e('Add products', 'woocommerce'); ?></h1>
398 398
 					<button class="modal-close modal-close-link dashicons dashicons-no-alt">
399 399
 						<span class="screen-reader-text">Close modal panel</span>
400 400
 					</button>
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 						<table class="widefat">
405 405
 							<thead>
406 406
 								<tr>
407
-									<th><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
408
-									<th><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
407
+									<th><?php esc_html_e('Product', 'woocommerce'); ?></th>
408
+									<th><?php esc_html_e('Quantity', 'woocommerce'); ?></th>
409 409
 								</tr>
410 410
 							</thead>
411 411
 							<?php
412 412
 								$row = '
413
-									<td><select class="wc-product-search" name="item_id" data-allow_clear="true" data-display_stock="true" data-exclude_type="variable" data-placeholder="' . esc_attr__( 'Search for a product&hellip;', 'woocommerce' ) . '"></select></td>
413
+									<td><select class="wc-product-search" name="item_id" data-allow_clear="true" data-display_stock="true" data-exclude_type="variable" data-placeholder="' . esc_attr__('Search for a product&hellip;', 'woocommerce') . '"></select></td>
414 414
 									<td><input type="number" step="1" min="0" max="9999" autocomplete="off" name="item_qty" placeholder="1" size="4" class="quantity" /></td>';
415 415
 							?>
416
-							<tbody data-row="<?php echo esc_attr( $row ); ?>">
416
+							<tbody data-row="<?php echo esc_attr($row); ?>">
417 417
 								<tr>
418 418
 									<?php echo $row; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
419 419
 								</tr>
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 				</article>
424 424
 				<footer>
425 425
 					<div class="inner">
426
-						<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
426
+						<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e('Add', 'woocommerce'); ?></button>
427 427
 					</div>
428 428
 				</footer>
429 429
 			</section>
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		<div class="wc-backbone-modal-content">
438 438
 			<section class="wc-backbone-modal-main" role="main">
439 439
 				<header class="wc-backbone-modal-header">
440
-					<h1><?php esc_html_e( 'Add tax', 'woocommerce' ); ?></h1>
440
+					<h1><?php esc_html_e('Add tax', 'woocommerce'); ?></h1>
441 441
 					<button class="modal-close modal-close-link dashicons dashicons-no-alt">
442 442
 						<span class="screen-reader-text">Close modal panel</span>
443 443
 					</button>
@@ -448,38 +448,38 @@  discard block
 block discarded – undo
448 448
 							<thead>
449 449
 								<tr>
450 450
 									<th>&nbsp;</th>
451
-									<th><?php esc_html_e( 'Rate name', 'woocommerce' ); ?></th>
452
-									<th><?php esc_html_e( 'Tax class', 'woocommerce' ); ?></th>
453
-									<th><?php esc_html_e( 'Rate code', 'woocommerce' ); ?></th>
454
-									<th><?php esc_html_e( 'Rate %', 'woocommerce' ); ?></th>
451
+									<th><?php esc_html_e('Rate name', 'woocommerce'); ?></th>
452
+									<th><?php esc_html_e('Tax class', 'woocommerce'); ?></th>
453
+									<th><?php esc_html_e('Rate code', 'woocommerce'); ?></th>
454
+									<th><?php esc_html_e('Rate %', 'woocommerce'); ?></th>
455 455
 								</tr>
456 456
 							</thead>
457 457
 						<?php
458
-						$rates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100" );
459
-						foreach ( $rates as $rate ) {
458
+						$rates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100");
459
+						foreach ($rates as $rate) {
460 460
 							echo '
461 461
 									<tr>
462
-										<td><input type="radio" id="add_order_tax_' . absint( $rate->tax_rate_id ) . '" name="add_order_tax" value="' . absint( $rate->tax_rate_id ) . '" /></td>
463
-										<td><label for="add_order_tax_' . absint( $rate->tax_rate_id ) . '">' . esc_html( WC_Tax::get_rate_label( $rate ) ) . '</label></td>
464
-										<td>' . ( isset( $classes_options[ $rate->tax_rate_class ] ) ? esc_html( $classes_options[ $rate->tax_rate_class ] ) : '-' ) . '</td>
465
-										<td>' . esc_html( WC_Tax::get_rate_code( $rate ) ) . '</td>
466
-										<td>' . esc_html( WC_Tax::get_rate_percent( $rate ) ) . '</td>
462
+										<td><input type="radio" id="add_order_tax_' . absint($rate->tax_rate_id) . '" name="add_order_tax" value="' . absint($rate->tax_rate_id) . '" /></td>
463
+										<td><label for="add_order_tax_' . absint($rate->tax_rate_id) . '">' . esc_html(WC_Tax::get_rate_label($rate)) . '</label></td>
464
+										<td>' . (isset($classes_options[$rate->tax_rate_class]) ? esc_html($classes_options[$rate->tax_rate_class]) : '-') . '</td>
465
+										<td>' . esc_html(WC_Tax::get_rate_code($rate)) . '</td>
466
+										<td>' . esc_html(WC_Tax::get_rate_percent($rate)) . '</td>
467 467
 									</tr>
468 468
 								';
469 469
 						}
470 470
 						?>
471 471
 						</table>
472
-						<?php if ( absint( $wpdb->get_var( "SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates;" ) ) > 100 ) : ?>
472
+						<?php if (absint($wpdb->get_var("SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates;")) > 100) : ?>
473 473
 							<p>
474
-								<label for="manual_tax_rate_id"><?php esc_html_e( 'Or, enter tax rate ID:', 'woocommerce' ); ?></label><br/>
475
-								<input type="number" name="manual_tax_rate_id" id="manual_tax_rate_id" step="1" placeholder="<?php esc_attr_e( 'Optional', 'woocommerce' ); ?>" />
474
+								<label for="manual_tax_rate_id"><?php esc_html_e('Or, enter tax rate ID:', 'woocommerce'); ?></label><br/>
475
+								<input type="number" name="manual_tax_rate_id" id="manual_tax_rate_id" step="1" placeholder="<?php esc_attr_e('Optional', 'woocommerce'); ?>" />
476 476
 							</p>
477 477
 						<?php endif; ?>
478 478
 					</form>
479 479
 				</article>
480 480
 				<footer>
481 481
 					<div class="inner">
482
-						<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
482
+						<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e('Add', 'woocommerce'); ?></button>
483 483
 					</div>
484 484
 				</footer>
485 485
 			</section>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,8 +140,11 @@  discard block
 block discarded – undo
140 140
 							<a href="<?php echo esc_url( $post_url ); ?>" class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
141 141
 								<span><?php echo esc_html( $item->get_code() ); ?></span>
142 142
 							</a>
143
-						<?php else : ?>
144
-							<span class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ); ?>">
143
+						<?php else {
144
+    : ?>
145
+							<span class="tips" data-tip="<?php echo esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) );
146
+}
147
+?>">
145 148
 								<span><?php echo esc_html( $item->get_code() ); ?></span>
146 149
 							</span>
147 150
 						<?php endif; ?>
@@ -290,8 +293,11 @@  discard block
 block discarded – undo
290 293
 			<?php if ( wc_coupons_enabled() ) : ?>
291 294
 				<button type="button" class="button add-coupon"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
292 295
 			<?php endif; ?>
293
-		<?php else : ?>
294
-			<span class="description"><?php echo wc_help_tip( __( 'To edit this order change the status back to "Pending payment"', 'woocommerce' ) ); ?> <?php esc_html_e( 'This order is no longer editable.', 'woocommerce' ); ?></span>
296
+		<?php else {
297
+    : ?>
298
+			<span class="description"><?php echo wc_help_tip( __( 'To edit this order change the status back to "Pending payment"', 'woocommerce' ) );
299
+}
300
+?> <?php esc_html_e( 'This order is no longer editable.', 'woocommerce' ); ?></span>
295 301
 		<?php endif; ?>
296 302
 		<?php if ( $render_refunds ) : ?>
297 303
 			<button type="button" class="button refund-items"><?php esc_html_e( 'Refund', 'woocommerce' ); ?></button>
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-images.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit; // Exit if accessed directly
14
+    exit; // Exit if accessed directly
15 15
 }
16 16
 
17 17
 /**
@@ -19,59 +19,59 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class WC_Meta_Box_Product_Images {
21 21
 
22
-	/**
23
-	 * Output the metabox.
24
-	 *
25
-	 * @param WP_Post $post
26
-	 */
27
-	public static function output( $post ) {
28
-		global $thepostid, $product_object;
22
+    /**
23
+     * Output the metabox.
24
+     *
25
+     * @param WP_Post $post
26
+     */
27
+    public static function output( $post ) {
28
+        global $thepostid, $product_object;
29 29
 
30
-		$thepostid      = $post->ID;
31
-		$product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
32
-		wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
33
-		?>
30
+        $thepostid      = $post->ID;
31
+        $product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
32
+        wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
33
+        ?>
34 34
 		<div id="product_images_container">
35 35
 			<ul class="product_images">
36 36
 				<?php
37
-				$product_image_gallery = $product_object->get_gallery_image_ids( 'edit' );
37
+                $product_image_gallery = $product_object->get_gallery_image_ids( 'edit' );
38 38
 
39
-				$attachments         = array_filter( $product_image_gallery );
40
-				$update_meta         = false;
41
-				$updated_gallery_ids = array();
39
+                $attachments         = array_filter( $product_image_gallery );
40
+                $update_meta         = false;
41
+                $updated_gallery_ids = array();
42 42
 
43
-				if ( ! empty( $attachments ) ) {
44
-					foreach ( $attachments as $attachment_id ) {
45
-						$attachment = wp_get_attachment_image( $attachment_id, 'thumbnail' );
43
+                if ( ! empty( $attachments ) ) {
44
+                    foreach ( $attachments as $attachment_id ) {
45
+                        $attachment = wp_get_attachment_image( $attachment_id, 'thumbnail' );
46 46
 
47
-						// if attachment is empty skip.
48
-						if ( empty( $attachment ) ) {
49
-							$update_meta = true;
50
-							continue;
51
-						}
52
-						?>
47
+                        // if attachment is empty skip.
48
+                        if ( empty( $attachment ) ) {
49
+                            $update_meta = true;
50
+                            continue;
51
+                        }
52
+                        ?>
53 53
 						<li class="image" data-attachment_id="<?php echo esc_attr( $attachment_id ); ?>">
54 54
 							<?php echo $attachment; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
55 55
 							<ul class="actions">
56 56
 								<li><a href="#" class="delete tips" data-tip="<?php esc_attr_e( 'Delete image', 'woocommerce' ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></li>
57 57
 							</ul>
58 58
 							<?php
59
-							// Allow for extra info to be exposed or extra action to be executed for this attachment.
60
-							do_action( 'woocommerce_admin_after_product_gallery_item', $thepostid, $attachment_id );
61
-							?>
59
+                            // Allow for extra info to be exposed or extra action to be executed for this attachment.
60
+                            do_action( 'woocommerce_admin_after_product_gallery_item', $thepostid, $attachment_id );
61
+                            ?>
62 62
 						</li>
63 63
 						<?php
64 64
 
65
-						// rebuild ids to be saved.
66
-						$updated_gallery_ids[] = $attachment_id;
67
-					}
65
+                        // rebuild ids to be saved.
66
+                        $updated_gallery_ids[] = $attachment_id;
67
+                    }
68 68
 
69
-					// need to update product meta to set new gallery ids
70
-					if ( $update_meta ) {
71
-						update_post_meta( $post->ID, '_product_image_gallery', implode( ',', $updated_gallery_ids ) );
72
-					}
73
-				}
74
-				?>
69
+                    // need to update product meta to set new gallery ids
70
+                    if ( $update_meta ) {
71
+                        update_post_meta( $post->ID, '_product_image_gallery', implode( ',', $updated_gallery_ids ) );
72
+                    }
73
+                }
74
+                ?>
75 75
 			</ul>
76 76
 
77 77
 			<input type="hidden" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( implode( ',', $updated_gallery_ids ) ); ?>" />
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 			<a href="#" data-choose="<?php esc_attr_e( 'Add images to product gallery', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Add to gallery', 'woocommerce' ); ?>" data-delete="<?php esc_attr_e( 'Delete image', 'woocommerce' ); ?>" data-text="<?php esc_attr_e( 'Delete', 'woocommerce' ); ?>"><?php esc_html_e( 'Add product gallery images', 'woocommerce' ); ?></a>
82 82
 		</p>
83 83
 		<?php
84
-	}
84
+    }
85 85
 
86
-	/**
87
-	 * Save meta box data.
88
-	 *
89
-	 * @param int     $post_id
90
-	 * @param WP_Post $post
91
-	 */
92
-	public static function save( $post_id, $post ) {
93
-		$product_type   = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
94
-		$classname      = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
95
-		$product        = new $classname( $post_id );
96
-		$attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();
86
+    /**
87
+     * Save meta box data.
88
+     *
89
+     * @param int     $post_id
90
+     * @param WP_Post $post
91
+     */
92
+    public static function save( $post_id, $post ) {
93
+        $product_type   = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
94
+        $classname      = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
95
+        $product        = new $classname( $post_id );
96
+        $attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();
97 97
 
98
-		$product->set_gallery_image_ids( $attachment_ids );
99
-		$product->save();
100
-	}
98
+        $product->set_gallery_image_ids( $attachment_ids );
99
+        $product->save();
100
+    }
101 101
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version     2.1.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if (!defined('ABSPATH')) {
14 14
 	exit; // Exit if accessed directly
15 15
 }
16 16
 
@@ -24,40 +24,40 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param WP_Post $post
26 26
 	 */
27
-	public static function output( $post ) {
27
+	public static function output($post) {
28 28
 		global $thepostid, $product_object;
29 29
 
30 30
 		$thepostid      = $post->ID;
31
-		$product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
32
-		wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
31
+		$product_object = $thepostid ? wc_get_product($thepostid) : new WC_Product();
32
+		wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
33 33
 		?>
34 34
 		<div id="product_images_container">
35 35
 			<ul class="product_images">
36 36
 				<?php
37
-				$product_image_gallery = $product_object->get_gallery_image_ids( 'edit' );
37
+				$product_image_gallery = $product_object->get_gallery_image_ids('edit');
38 38
 
39
-				$attachments         = array_filter( $product_image_gallery );
39
+				$attachments         = array_filter($product_image_gallery);
40 40
 				$update_meta         = false;
41 41
 				$updated_gallery_ids = array();
42 42
 
43
-				if ( ! empty( $attachments ) ) {
44
-					foreach ( $attachments as $attachment_id ) {
45
-						$attachment = wp_get_attachment_image( $attachment_id, 'thumbnail' );
43
+				if (!empty($attachments)) {
44
+					foreach ($attachments as $attachment_id) {
45
+						$attachment = wp_get_attachment_image($attachment_id, 'thumbnail');
46 46
 
47 47
 						// if attachment is empty skip.
48
-						if ( empty( $attachment ) ) {
48
+						if (empty($attachment)) {
49 49
 							$update_meta = true;
50 50
 							continue;
51 51
 						}
52 52
 						?>
53
-						<li class="image" data-attachment_id="<?php echo esc_attr( $attachment_id ); ?>">
53
+						<li class="image" data-attachment_id="<?php echo esc_attr($attachment_id); ?>">
54 54
 							<?php echo $attachment; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
55 55
 							<ul class="actions">
56
-								<li><a href="#" class="delete tips" data-tip="<?php esc_attr_e( 'Delete image', 'woocommerce' ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></li>
56
+								<li><a href="#" class="delete tips" data-tip="<?php esc_attr_e('Delete image', 'woocommerce'); ?>"><?php esc_html_e('Delete', 'woocommerce'); ?></a></li>
57 57
 							</ul>
58 58
 							<?php
59 59
 							// Allow for extra info to be exposed or extra action to be executed for this attachment.
60
-							do_action( 'woocommerce_admin_after_product_gallery_item', $thepostid, $attachment_id );
60
+							do_action('woocommerce_admin_after_product_gallery_item', $thepostid, $attachment_id);
61 61
 							?>
62 62
 						</li>
63 63
 						<?php
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 					}
68 68
 
69 69
 					// need to update product meta to set new gallery ids
70
-					if ( $update_meta ) {
71
-						update_post_meta( $post->ID, '_product_image_gallery', implode( ',', $updated_gallery_ids ) );
70
+					if ($update_meta) {
71
+						update_post_meta($post->ID, '_product_image_gallery', implode(',', $updated_gallery_ids));
72 72
 					}
73 73
 				}
74 74
 				?>
75 75
 			</ul>
76 76
 
77
-			<input type="hidden" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( implode( ',', $updated_gallery_ids ) ); ?>" />
77
+			<input type="hidden" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr(implode(',', $updated_gallery_ids)); ?>" />
78 78
 
79 79
 		</div>
80 80
 		<p class="add_product_images hide-if-no-js">
81
-			<a href="#" data-choose="<?php esc_attr_e( 'Add images to product gallery', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Add to gallery', 'woocommerce' ); ?>" data-delete="<?php esc_attr_e( 'Delete image', 'woocommerce' ); ?>" data-text="<?php esc_attr_e( 'Delete', 'woocommerce' ); ?>"><?php esc_html_e( 'Add product gallery images', 'woocommerce' ); ?></a>
81
+			<a href="#" data-choose="<?php esc_attr_e('Add images to product gallery', 'woocommerce'); ?>" data-update="<?php esc_attr_e('Add to gallery', 'woocommerce'); ?>" data-delete="<?php esc_attr_e('Delete image', 'woocommerce'); ?>" data-text="<?php esc_attr_e('Delete', 'woocommerce'); ?>"><?php esc_html_e('Add product gallery images', 'woocommerce'); ?></a>
82 82
 		</p>
83 83
 		<?php
84 84
 	}
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	 * @param int     $post_id
90 90
 	 * @param WP_Post $post
91 91
 	 */
92
-	public static function save( $post_id, $post ) {
93
-		$product_type   = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
94
-		$classname      = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
95
-		$product        = new $classname( $post_id );
96
-		$attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();
92
+	public static function save($post_id, $post) {
93
+		$product_type   = empty($_POST['product-type']) ? WC_Product_Factory::get_product_type($post_id) : sanitize_title(stripslashes($_POST['product-type']));
94
+		$classname      = WC_Product_Factory::get_product_classname($post_id, $product_type ? $product_type : 'simple');
95
+		$product        = new $classname($post_id);
96
+		$attachment_ids = isset($_POST['product_image_gallery']) ? array_filter(explode(',', wc_clean($_POST['product_image_gallery']))) : array();
97 97
 
98
-		$product->set_gallery_image_ids( $attachment_ids );
98
+		$product->set_gallery_image_ids($attachment_ids);
99 99
 		$product->save();
100 100
 	}
101 101
 }
Please login to merge, or discard this patch.
woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-items.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit; // Exit if accessed directly
14
+    exit; // Exit if accessed directly
15 15
 }
16 16
 
17 17
 /**
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class WC_Meta_Box_Order_Items {
21 21
 
22
-	/**
23
-	 * Output the metabox.
24
-	 *
25
-	 * @param WP_Post $post
26
-	 */
27
-	public static function output( $post ) {
28
-		global $post, $thepostid, $theorder;
29
-
30
-		if ( ! is_int( $thepostid ) ) {
31
-			$thepostid = $post->ID;
32
-		}
33
-
34
-		if ( ! is_object( $theorder ) ) {
35
-			$theorder = wc_get_order( $thepostid );
36
-		}
37
-
38
-		$order = $theorder;
39
-		$data  = get_post_meta( $post->ID );
40
-
41
-		include __DIR__ . '/views/html-order-items.php';
42
-	}
43
-
44
-	/**
45
-	 * Save meta box data.
46
-	 *
47
-	 * @param int $post_id
48
-	 */
49
-	public static function save( $post_id ) {
50
-		/**
51
-		 * This $_POST variable's data has been validated and escaped
52
-		 * inside `wc_save_order_items()` function.
53
-		 */
54
-		wc_save_order_items( $post_id, $_POST );
55
-	}
22
+    /**
23
+     * Output the metabox.
24
+     *
25
+     * @param WP_Post $post
26
+     */
27
+    public static function output( $post ) {
28
+        global $post, $thepostid, $theorder;
29
+
30
+        if ( ! is_int( $thepostid ) ) {
31
+            $thepostid = $post->ID;
32
+        }
33
+
34
+        if ( ! is_object( $theorder ) ) {
35
+            $theorder = wc_get_order( $thepostid );
36
+        }
37
+
38
+        $order = $theorder;
39
+        $data  = get_post_meta( $post->ID );
40
+
41
+        include __DIR__ . '/views/html-order-items.php';
42
+    }
43
+
44
+    /**
45
+     * Save meta box data.
46
+     *
47
+     * @param int $post_id
48
+     */
49
+    public static function save( $post_id ) {
50
+        /**
51
+         * This $_POST variable's data has been validated and escaped
52
+         * inside `wc_save_order_items()` function.
53
+         */
54
+        wc_save_order_items( $post_id, $_POST );
55
+    }
56 56
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version     2.1.0
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if (!defined('ABSPATH')) {
14 14
 	exit; // Exit if accessed directly
15 15
 }
16 16
 
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param WP_Post $post
26 26
 	 */
27
-	public static function output( $post ) {
27
+	public static function output($post) {
28 28
 		global $post, $thepostid, $theorder;
29 29
 
30
-		if ( ! is_int( $thepostid ) ) {
30
+		if (!is_int($thepostid)) {
31 31
 			$thepostid = $post->ID;
32 32
 		}
33 33
 
34
-		if ( ! is_object( $theorder ) ) {
35
-			$theorder = wc_get_order( $thepostid );
34
+		if (!is_object($theorder)) {
35
+			$theorder = wc_get_order($thepostid);
36 36
 		}
37 37
 
38 38
 		$order = $theorder;
39
-		$data  = get_post_meta( $post->ID );
39
+		$data  = get_post_meta($post->ID);
40 40
 
41 41
 		include __DIR__ . '/views/html-order-items.php';
42 42
 	}
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param int $post_id
48 48
 	 */
49
-	public static function save( $post_id ) {
49
+	public static function save($post_id) {
50 50
 		/**
51 51
 		 * This $_POST variable's data has been validated and escaped
52 52
 		 * inside `wc_save_order_items()` function.
53 53
 		 */
54
-		wc_save_order_items( $post_id, $_POST );
54
+		wc_save_order_items($post_id, $_POST);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
plugins/woocommerce/includes/admin/class-wc-admin-pointers.php 2 patches
Indentation   +254 added lines, -254 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use Automattic\WooCommerce\Admin\Features\Features;
11 11
 
12 12
 if ( ! defined( 'ABSPATH' ) ) {
13
-	exit;
13
+    exit;
14 14
 }
15 15
 
16 16
 /**
@@ -18,269 +18,269 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class WC_Admin_Pointers {
20 20
 
21
-	/**
22
-	 * Constructor.
23
-	 */
24
-	public function __construct() {
25
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_pointers_for_screen' ) );
26
-	}
21
+    /**
22
+     * Constructor.
23
+     */
24
+    public function __construct() {
25
+        add_action( 'admin_enqueue_scripts', array( $this, 'setup_pointers_for_screen' ) );
26
+    }
27 27
 
28
-	/**
29
-	 * Setup pointers for screen.
30
-	 */
31
-	public function setup_pointers_for_screen() {
32
-		$screen = get_current_screen();
28
+    /**
29
+     * Setup pointers for screen.
30
+     */
31
+    public function setup_pointers_for_screen() {
32
+        $screen = get_current_screen();
33 33
 
34
-		if ( ! $screen ) {
35
-			return;
36
-		}
34
+        if ( ! $screen ) {
35
+            return;
36
+        }
37 37
 
38
-		switch ( $screen->id ) {
39
-			case 'product':
40
-				$this->create_product_tutorial();
41
-				break;
42
-		}
43
-	}
38
+        switch ( $screen->id ) {
39
+            case 'product':
40
+                $this->create_product_tutorial();
41
+                break;
42
+        }
43
+    }
44 44
 
45
-	/**
46
-	 * Check if product tour experiment is treatment.
47
-	 *
48
-	 * @return bool
49
-	 */
50
-	public static function is_experiment_product_tour() {
51
-		$anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
52
-		$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
53
-		$abtest         = new \WooCommerce\Admin\Experimental_Abtest(
54
-			$anon_id,
55
-			'woocommerce',
56
-			$allow_tracking
57
-		);
58
-		return $abtest->get_variation( 'woocommerce_products_tour' ) === 'treatment';
59
-	}
45
+    /**
46
+     * Check if product tour experiment is treatment.
47
+     *
48
+     * @return bool
49
+     */
50
+    public static function is_experiment_product_tour() {
51
+        $anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
52
+        $allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
53
+        $abtest         = new \WooCommerce\Admin\Experimental_Abtest(
54
+            $anon_id,
55
+            'woocommerce',
56
+            $allow_tracking
57
+        );
58
+        return $abtest->get_variation( 'woocommerce_products_tour' ) === 'treatment';
59
+    }
60 60
 
61
-	/**
62
-	 * Pointers for creating a product.
63
-	 */
64
-	public function create_product_tutorial() {
65
-		if ( ! isset( $_GET['tutorial'] ) || ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
66
-			return;
67
-		}
61
+    /**
62
+     * Pointers for creating a product.
63
+     */
64
+    public function create_product_tutorial() {
65
+        if ( ! isset( $_GET['tutorial'] ) || ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
66
+            return;
67
+        }
68 68
 
69
-		global $wp_post_types;
69
+        global $wp_post_types;
70 70
 
71
-		if (
72
-			Features::is_enabled( 'experimental-product-tour' ) &&
73
-			isset( $_GET['spotlight'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
74
-			isset( $wp_post_types ) &&
75
-			self::is_experiment_product_tour()
76
-		) {
77
-			$labels          = $wp_post_types['product']->labels;
78
-			$labels->add_new = __( 'Enable guided mode', 'woocommerce' );
71
+        if (
72
+            Features::is_enabled( 'experimental-product-tour' ) &&
73
+            isset( $_GET['spotlight'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
74
+            isset( $wp_post_types ) &&
75
+            self::is_experiment_product_tour()
76
+        ) {
77
+            $labels          = $wp_post_types['product']->labels;
78
+            $labels->add_new = __( 'Enable guided mode', 'woocommerce' );
79 79
 
80
-			$script_assets_filename = WCAdminAssets::get_script_asset_filename( 'wp-admin-scripts', 'onboarding-homepage-notice' );
81
-			$script_assets          = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
80
+            $script_assets_filename = WCAdminAssets::get_script_asset_filename( 'wp-admin-scripts', 'onboarding-homepage-notice' );
81
+            $script_assets          = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
82 82
 
83
-			wp_enqueue_script(
84
-				'product-tutorial',
85
-				WCAdminAssets::get_url( 'wp-admin-scripts/product-tour', 'js' ),
86
-				array_merge( array( WC_ADMIN_APP ), $script_assets ['dependencies'] ),
87
-				WC_VERSION,
88
-				true
89
-			);
90
-			return;
91
-		}
83
+            wp_enqueue_script(
84
+                'product-tutorial',
85
+                WCAdminAssets::get_url( 'wp-admin-scripts/product-tour', 'js' ),
86
+                array_merge( array( WC_ADMIN_APP ), $script_assets ['dependencies'] ),
87
+                WC_VERSION,
88
+                true
89
+            );
90
+            return;
91
+        }
92 92
 
93
-		// These pointers will chain - they will not be shown at once.
94
-		$pointers = array(
95
-			'pointers' => array(
96
-				'title'          => array(
97
-					'target'       => '#title',
98
-					'next'         => 'content',
99
-					'next_trigger' => array(
100
-						'target' => '#title',
101
-						'event'  => 'input',
102
-					),
103
-					'options'      => array(
104
-						'step_name' => 'old-product-name',
105
-						'content'  => '<h3>' . esc_html__( 'Product name', 'woocommerce' ) . '</h3>' .
106
-										'<p>' . esc_html__( 'Give your new product a name here. This is a required field and will be what your customers will see in your store.', 'woocommerce' ) . '</p>',
107
-						'position' => array(
108
-							'edge'  => 'top',
109
-							'align' => 'left',
110
-						),
111
-					),
112
-				),
113
-				'content'        => array(
114
-					'target'       => '#wp-content-editor-container',
115
-					'next'         => 'product-type',
116
-					'next_trigger' => array(),
117
-					'options'      => array(
118
-						'step_name' => 'old-product-description',
119
-						'content'  => '<h3>' . esc_html__( 'Product description', 'woocommerce' ) . '</h3>' .
120
-										'<p>' . esc_html__( 'This is your products main body of content. Here you should describe your product in detail.', 'woocommerce' ) . '</p>',
121
-						'position' => array(
122
-							'edge'  => 'bottom',
123
-							'align' => 'middle',
124
-						),
125
-					),
126
-				),
127
-				'product-type'   => array(
128
-					'target'       => '#product-type',
129
-					'next'         => 'virtual',
130
-					'next_trigger' => array(
131
-						'target' => '#product-type',
132
-						'event'  => 'change blur click',
133
-					),
134
-					'options'      => array(
135
-						'step_name' => 'old-product-type',
136
-						'content'  => '<h3>' . esc_html__( 'Choose product type', 'woocommerce' ) . '</h3>' .
137
-										'<p>' . esc_html__( 'Choose a type for this product. Simple is suitable for most physical goods and services (we recommend setting up a simple product for now).', 'woocommerce' ) . '</p>' .
138
-										'<p>' . esc_html__( 'Variable is for more complex products such as t-shirts with multiple sizes.', 'woocommerce' ) . '</p>' .
139
-										'<p>' . esc_html__( 'Grouped products are for grouping several simple products into one.', 'woocommerce' ) . '</p>' .
140
-										'<p>' . esc_html__( 'Finally, external products are for linking off-site.', 'woocommerce' ) . '</p>',
141
-						'position' => array(
142
-							'edge'  => 'bottom',
143
-							'align' => 'middle',
144
-						),
145
-					),
146
-				),
147
-				'virtual'        => array(
148
-					'target'       => '#_virtual',
149
-					'next'         => 'downloadable',
150
-					'next_trigger' => array(
151
-						'target' => '#_virtual',
152
-						'event'  => 'change',
153
-					),
154
-					'options'      => array(
155
-						'step_name' => 'old-virtual-product',
156
-						'content'  => '<h3>' . esc_html__( 'Virtual products', 'woocommerce' ) . '</h3>' .
157
-										'<p>' . esc_html__( 'Check the "Virtual" box if this is a non-physical item, for example a service, which does not need shipping.', 'woocommerce' ) . '</p>',
158
-						'position' => array(
159
-							'edge'  => 'bottom',
160
-							'align' => 'middle',
161
-						),
162
-					),
163
-				),
164
-				'downloadable'   => array(
165
-					'target'       => '#_downloadable',
166
-					'next'         => 'regular_price',
167
-					'next_trigger' => array(
168
-						'target' => '#_downloadable',
169
-						'event'  => 'change',
170
-					),
171
-					'options'      => array(
172
-						'step_name' => 'old-downloadable-product',
173
-						'content'  => '<h3>' . esc_html__( 'Downloadable products', 'woocommerce' ) . '</h3>' .
174
-										'<p>' . esc_html__( 'If purchasing this product gives a customer access to a downloadable file, e.g. software, check this box.', 'woocommerce' ) . '</p>',
175
-						'position' => array(
176
-							'edge'  => 'bottom',
177
-							'align' => 'middle',
178
-						),
179
-					),
180
-				),
181
-				'regular_price'  => array(
182
-					'target'       => '#_regular_price',
183
-					'next'         => 'postexcerpt',
184
-					'next_trigger' => array(
185
-						'target' => '#_regular_price',
186
-						'event'  => 'input',
187
-					),
188
-					'options'      => array(
189
-						'step_name' => 'old-product-price',
190
-						'content'  => '<h3>' . esc_html__( 'Prices', 'woocommerce' ) . '</h3>' .
191
-										'<p>' . esc_html__( 'Next you need to give your product a price.', 'woocommerce' ) . '</p>',
192
-						'position' => array(
193
-							'edge'  => 'bottom',
194
-							'align' => 'middle',
195
-						),
196
-					),
197
-				),
198
-				'postexcerpt'    => array(
199
-					'target'       => '#postexcerpt',
200
-					'next'         => 'postimagediv',
201
-					'next_trigger' => array(
202
-						'target' => '#postexcerpt',
203
-						'event'  => 'input',
204
-					),
205
-					'options'      => array(
206
-						'step_name' => 'old-product-short-description',
207
-						'content'  => '<h3>' . esc_html__( 'Product short description', 'woocommerce' ) . '</h3>' .
208
-										'<p>' . esc_html__( 'Add a quick summary for your product here. This will appear on the product page under the product name.', 'woocommerce' ) . '</p>',
209
-						'position' => array(
210
-							'edge'  => 'bottom',
211
-							'align' => 'middle',
212
-						),
213
-					),
214
-				),
215
-				'postimagediv'   => array(
216
-					'target'  => '#postimagediv',
217
-					'next'    => 'product_tag',
218
-					'options' => array(
219
-						'step_name' => 'old-product-image',
220
-						'content'  => '<h3>' . esc_html__( 'Product images', 'woocommerce' ) . '</h3>' .
221
-										'<p>' . esc_html__( "Upload or assign an image to your product here. This image will be shown in your store's catalog.", 'woocommerce' ) . '</p>',
222
-						'position' => array(
223
-							'edge'  => 'right',
224
-							'align' => 'middle',
225
-						),
226
-					),
227
-				),
228
-				'product_tag'    => array(
229
-					'target'  => '#tagsdiv-product_tag',
230
-					'next'    => 'product_catdiv',
231
-					'options' => array(
232
-						'step_name' => 'old-product-tags',
233
-						'content'  => '<h3>' . esc_html__( 'Product tags', 'woocommerce' ) . '</h3>' .
234
-										'<p>' . esc_html__( 'You can optionally "tag" your products here. Tags are a method of labeling your products to make them easier for customers to find.', 'woocommerce' ) . '</p>',
235
-						'position' => array(
236
-							'edge'  => 'right',
237
-							'align' => 'middle',
238
-						),
239
-					),
240
-				),
241
-				'product_catdiv' => array(
242
-					'target'  => '#product_catdiv',
243
-					'next'    => 'submitdiv',
244
-					'options' => array(
245
-						'step_name' => 'old-product-categories',
246
-						'content'  => '<h3>' . esc_html__( 'Product categories', 'woocommerce' ) . '</h3>' .
247
-										'<p>' . esc_html__( 'Optionally assign categories to your products to make them easier to browse through and find in your store.', 'woocommerce' ) . '</p>',
248
-						'position' => array(
249
-							'edge'  => 'right',
250
-							'align' => 'middle',
251
-						),
252
-					),
253
-				),
254
-				'submitdiv'      => array(
255
-					'target'  => '#submitdiv',
256
-					'next'    => '',
257
-					'options' => array(
258
-						'step_name' => 'old-publish',
259
-						'content'  => '<h3>' . esc_html__( 'Publish your product!', 'woocommerce' ) . '</h3>' .
260
-										'<p>' . esc_html__( 'When you are finished editing your product, hit the "Publish" button to publish your product to your store.', 'woocommerce' ) . '</p>',
261
-						'position' => array(
262
-							'edge'  => 'right',
263
-							'align' => 'middle',
264
-						),
265
-					),
266
-				),
267
-			),
268
-		);
93
+        // These pointers will chain - they will not be shown at once.
94
+        $pointers = array(
95
+            'pointers' => array(
96
+                'title'          => array(
97
+                    'target'       => '#title',
98
+                    'next'         => 'content',
99
+                    'next_trigger' => array(
100
+                        'target' => '#title',
101
+                        'event'  => 'input',
102
+                    ),
103
+                    'options'      => array(
104
+                        'step_name' => 'old-product-name',
105
+                        'content'  => '<h3>' . esc_html__( 'Product name', 'woocommerce' ) . '</h3>' .
106
+                                        '<p>' . esc_html__( 'Give your new product a name here. This is a required field and will be what your customers will see in your store.', 'woocommerce' ) . '</p>',
107
+                        'position' => array(
108
+                            'edge'  => 'top',
109
+                            'align' => 'left',
110
+                        ),
111
+                    ),
112
+                ),
113
+                'content'        => array(
114
+                    'target'       => '#wp-content-editor-container',
115
+                    'next'         => 'product-type',
116
+                    'next_trigger' => array(),
117
+                    'options'      => array(
118
+                        'step_name' => 'old-product-description',
119
+                        'content'  => '<h3>' . esc_html__( 'Product description', 'woocommerce' ) . '</h3>' .
120
+                                        '<p>' . esc_html__( 'This is your products main body of content. Here you should describe your product in detail.', 'woocommerce' ) . '</p>',
121
+                        'position' => array(
122
+                            'edge'  => 'bottom',
123
+                            'align' => 'middle',
124
+                        ),
125
+                    ),
126
+                ),
127
+                'product-type'   => array(
128
+                    'target'       => '#product-type',
129
+                    'next'         => 'virtual',
130
+                    'next_trigger' => array(
131
+                        'target' => '#product-type',
132
+                        'event'  => 'change blur click',
133
+                    ),
134
+                    'options'      => array(
135
+                        'step_name' => 'old-product-type',
136
+                        'content'  => '<h3>' . esc_html__( 'Choose product type', 'woocommerce' ) . '</h3>' .
137
+                                        '<p>' . esc_html__( 'Choose a type for this product. Simple is suitable for most physical goods and services (we recommend setting up a simple product for now).', 'woocommerce' ) . '</p>' .
138
+                                        '<p>' . esc_html__( 'Variable is for more complex products such as t-shirts with multiple sizes.', 'woocommerce' ) . '</p>' .
139
+                                        '<p>' . esc_html__( 'Grouped products are for grouping several simple products into one.', 'woocommerce' ) . '</p>' .
140
+                                        '<p>' . esc_html__( 'Finally, external products are for linking off-site.', 'woocommerce' ) . '</p>',
141
+                        'position' => array(
142
+                            'edge'  => 'bottom',
143
+                            'align' => 'middle',
144
+                        ),
145
+                    ),
146
+                ),
147
+                'virtual'        => array(
148
+                    'target'       => '#_virtual',
149
+                    'next'         => 'downloadable',
150
+                    'next_trigger' => array(
151
+                        'target' => '#_virtual',
152
+                        'event'  => 'change',
153
+                    ),
154
+                    'options'      => array(
155
+                        'step_name' => 'old-virtual-product',
156
+                        'content'  => '<h3>' . esc_html__( 'Virtual products', 'woocommerce' ) . '</h3>' .
157
+                                        '<p>' . esc_html__( 'Check the "Virtual" box if this is a non-physical item, for example a service, which does not need shipping.', 'woocommerce' ) . '</p>',
158
+                        'position' => array(
159
+                            'edge'  => 'bottom',
160
+                            'align' => 'middle',
161
+                        ),
162
+                    ),
163
+                ),
164
+                'downloadable'   => array(
165
+                    'target'       => '#_downloadable',
166
+                    'next'         => 'regular_price',
167
+                    'next_trigger' => array(
168
+                        'target' => '#_downloadable',
169
+                        'event'  => 'change',
170
+                    ),
171
+                    'options'      => array(
172
+                        'step_name' => 'old-downloadable-product',
173
+                        'content'  => '<h3>' . esc_html__( 'Downloadable products', 'woocommerce' ) . '</h3>' .
174
+                                        '<p>' . esc_html__( 'If purchasing this product gives a customer access to a downloadable file, e.g. software, check this box.', 'woocommerce' ) . '</p>',
175
+                        'position' => array(
176
+                            'edge'  => 'bottom',
177
+                            'align' => 'middle',
178
+                        ),
179
+                    ),
180
+                ),
181
+                'regular_price'  => array(
182
+                    'target'       => '#_regular_price',
183
+                    'next'         => 'postexcerpt',
184
+                    'next_trigger' => array(
185
+                        'target' => '#_regular_price',
186
+                        'event'  => 'input',
187
+                    ),
188
+                    'options'      => array(
189
+                        'step_name' => 'old-product-price',
190
+                        'content'  => '<h3>' . esc_html__( 'Prices', 'woocommerce' ) . '</h3>' .
191
+                                        '<p>' . esc_html__( 'Next you need to give your product a price.', 'woocommerce' ) . '</p>',
192
+                        'position' => array(
193
+                            'edge'  => 'bottom',
194
+                            'align' => 'middle',
195
+                        ),
196
+                    ),
197
+                ),
198
+                'postexcerpt'    => array(
199
+                    'target'       => '#postexcerpt',
200
+                    'next'         => 'postimagediv',
201
+                    'next_trigger' => array(
202
+                        'target' => '#postexcerpt',
203
+                        'event'  => 'input',
204
+                    ),
205
+                    'options'      => array(
206
+                        'step_name' => 'old-product-short-description',
207
+                        'content'  => '<h3>' . esc_html__( 'Product short description', 'woocommerce' ) . '</h3>' .
208
+                                        '<p>' . esc_html__( 'Add a quick summary for your product here. This will appear on the product page under the product name.', 'woocommerce' ) . '</p>',
209
+                        'position' => array(
210
+                            'edge'  => 'bottom',
211
+                            'align' => 'middle',
212
+                        ),
213
+                    ),
214
+                ),
215
+                'postimagediv'   => array(
216
+                    'target'  => '#postimagediv',
217
+                    'next'    => 'product_tag',
218
+                    'options' => array(
219
+                        'step_name' => 'old-product-image',
220
+                        'content'  => '<h3>' . esc_html__( 'Product images', 'woocommerce' ) . '</h3>' .
221
+                                        '<p>' . esc_html__( "Upload or assign an image to your product here. This image will be shown in your store's catalog.", 'woocommerce' ) . '</p>',
222
+                        'position' => array(
223
+                            'edge'  => 'right',
224
+                            'align' => 'middle',
225
+                        ),
226
+                    ),
227
+                ),
228
+                'product_tag'    => array(
229
+                    'target'  => '#tagsdiv-product_tag',
230
+                    'next'    => 'product_catdiv',
231
+                    'options' => array(
232
+                        'step_name' => 'old-product-tags',
233
+                        'content'  => '<h3>' . esc_html__( 'Product tags', 'woocommerce' ) . '</h3>' .
234
+                                        '<p>' . esc_html__( 'You can optionally "tag" your products here. Tags are a method of labeling your products to make them easier for customers to find.', 'woocommerce' ) . '</p>',
235
+                        'position' => array(
236
+                            'edge'  => 'right',
237
+                            'align' => 'middle',
238
+                        ),
239
+                    ),
240
+                ),
241
+                'product_catdiv' => array(
242
+                    'target'  => '#product_catdiv',
243
+                    'next'    => 'submitdiv',
244
+                    'options' => array(
245
+                        'step_name' => 'old-product-categories',
246
+                        'content'  => '<h3>' . esc_html__( 'Product categories', 'woocommerce' ) . '</h3>' .
247
+                                        '<p>' . esc_html__( 'Optionally assign categories to your products to make them easier to browse through and find in your store.', 'woocommerce' ) . '</p>',
248
+                        'position' => array(
249
+                            'edge'  => 'right',
250
+                            'align' => 'middle',
251
+                        ),
252
+                    ),
253
+                ),
254
+                'submitdiv'      => array(
255
+                    'target'  => '#submitdiv',
256
+                    'next'    => '',
257
+                    'options' => array(
258
+                        'step_name' => 'old-publish',
259
+                        'content'  => '<h3>' . esc_html__( 'Publish your product!', 'woocommerce' ) . '</h3>' .
260
+                                        '<p>' . esc_html__( 'When you are finished editing your product, hit the "Publish" button to publish your product to your store.', 'woocommerce' ) . '</p>',
261
+                        'position' => array(
262
+                            'edge'  => 'right',
263
+                            'align' => 'middle',
264
+                        ),
265
+                    ),
266
+                ),
267
+            ),
268
+        );
269 269
 
270
-		$this->enqueue_pointers( $pointers );
271
-	}
270
+        $this->enqueue_pointers( $pointers );
271
+    }
272 272
 
273
-	/**
274
-	 * Enqueue pointers and add script to page.
275
-	 *
276
-	 * @param array $pointers Pointers data.
277
-	 */
278
-	public function enqueue_pointers( $pointers ) {
279
-		$pointers = rawurlencode( wp_json_encode( $pointers ) );
280
-		wp_enqueue_style( 'wp-pointer' );
281
-		wp_enqueue_script( 'wp-pointer' );
282
-		wc_enqueue_js(
283
-			"jQuery( function( $ ) {
273
+    /**
274
+     * Enqueue pointers and add script to page.
275
+     *
276
+     * @param array $pointers Pointers data.
277
+     */
278
+    public function enqueue_pointers( $pointers ) {
279
+        $pointers = rawurlencode( wp_json_encode( $pointers ) );
280
+        wp_enqueue_style( 'wp-pointer' );
281
+        wp_enqueue_script( 'wp-pointer' );
282
+        wc_enqueue_js(
283
+            "jQuery( function( $ ) {
284 284
 				var wc_pointers = JSON.parse( decodeURIComponent( '{$pointers}' ) );
285 285
 				var current_pointer;
286 286
 				const recordEvent =
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 					}
367 367
 				}
368 368
 			});"
369
-		);
370
-	}
369
+        );
370
+    }
371 371
 }
372 372
 
373 373
 new WC_Admin_Pointers();
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
10 10
 use Automattic\WooCommerce\Admin\Features\Features;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if (!defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * Constructor.
23 23
 	 */
24 24
 	public function __construct() {
25
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_pointers_for_screen' ) );
25
+		add_action('admin_enqueue_scripts', array($this, 'setup_pointers_for_screen'));
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	public function setup_pointers_for_screen() {
32 32
 		$screen = get_current_screen();
33 33
 
34
-		if ( ! $screen ) {
34
+		if (!$screen) {
35 35
 			return;
36 36
 		}
37 37
 
38
-		switch ( $screen->id ) {
38
+		switch ($screen->id) {
39 39
 			case 'product':
40 40
 				$this->create_product_tutorial();
41 41
 				break;
@@ -48,42 +48,42 @@  discard block
 block discarded – undo
48 48
 	 * @return bool
49 49
 	 */
50 50
 	public static function is_experiment_product_tour() {
51
-		$anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
52
-		$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
51
+		$anon_id        = isset($_COOKIE['tk_ai']) ? sanitize_text_field(wp_unslash($_COOKIE['tk_ai'])) : '';
52
+		$allow_tracking = 'yes' === get_option('woocommerce_allow_tracking');
53 53
 		$abtest         = new \WooCommerce\Admin\Experimental_Abtest(
54 54
 			$anon_id,
55 55
 			'woocommerce',
56 56
 			$allow_tracking
57 57
 		);
58
-		return $abtest->get_variation( 'woocommerce_products_tour' ) === 'treatment';
58
+		return $abtest->get_variation('woocommerce_products_tour') === 'treatment';
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * Pointers for creating a product.
63 63
 	 */
64 64
 	public function create_product_tutorial() {
65
-		if ( ! isset( $_GET['tutorial'] ) || ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
65
+		if (!isset($_GET['tutorial']) || !current_user_can('manage_options')) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
66 66
 			return;
67 67
 		}
68 68
 
69 69
 		global $wp_post_types;
70 70
 
71 71
 		if (
72
-			Features::is_enabled( 'experimental-product-tour' ) &&
73
-			isset( $_GET['spotlight'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
74
-			isset( $wp_post_types ) &&
72
+			Features::is_enabled('experimental-product-tour') &&
73
+			isset($_GET['spotlight']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
74
+			isset($wp_post_types) &&
75 75
 			self::is_experiment_product_tour()
76 76
 		) {
77 77
 			$labels          = $wp_post_types['product']->labels;
78
-			$labels->add_new = __( 'Enable guided mode', 'woocommerce' );
78
+			$labels->add_new = __('Enable guided mode', 'woocommerce');
79 79
 
80
-			$script_assets_filename = WCAdminAssets::get_script_asset_filename( 'wp-admin-scripts', 'onboarding-homepage-notice' );
80
+			$script_assets_filename = WCAdminAssets::get_script_asset_filename('wp-admin-scripts', 'onboarding-homepage-notice');
81 81
 			$script_assets          = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
82 82
 
83 83
 			wp_enqueue_script(
84 84
 				'product-tutorial',
85
-				WCAdminAssets::get_url( 'wp-admin-scripts/product-tour', 'js' ),
86
-				array_merge( array( WC_ADMIN_APP ), $script_assets ['dependencies'] ),
85
+				WCAdminAssets::get_url('wp-admin-scripts/product-tour', 'js'),
86
+				array_merge(array(WC_ADMIN_APP), $script_assets ['dependencies']),
87 87
 				WC_VERSION,
88 88
 				true
89 89
 			);
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 					),
103 103
 					'options'      => array(
104 104
 						'step_name' => 'old-product-name',
105
-						'content'  => '<h3>' . esc_html__( 'Product name', 'woocommerce' ) . '</h3>' .
106
-										'<p>' . esc_html__( 'Give your new product a name here. This is a required field and will be what your customers will see in your store.', 'woocommerce' ) . '</p>',
105
+						'content'  => '<h3>' . esc_html__('Product name', 'woocommerce') . '</h3>' .
106
+										'<p>' . esc_html__('Give your new product a name here. This is a required field and will be what your customers will see in your store.', 'woocommerce') . '</p>',
107 107
 						'position' => array(
108 108
 							'edge'  => 'top',
109 109
 							'align' => 'left',
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 					'next_trigger' => array(),
117 117
 					'options'      => array(
118 118
 						'step_name' => 'old-product-description',
119
-						'content'  => '<h3>' . esc_html__( 'Product description', 'woocommerce' ) . '</h3>' .
120
-										'<p>' . esc_html__( 'This is your products main body of content. Here you should describe your product in detail.', 'woocommerce' ) . '</p>',
119
+						'content'  => '<h3>' . esc_html__('Product description', 'woocommerce') . '</h3>' .
120
+										'<p>' . esc_html__('This is your products main body of content. Here you should describe your product in detail.', 'woocommerce') . '</p>',
121 121
 						'position' => array(
122 122
 							'edge'  => 'bottom',
123 123
 							'align' => 'middle',
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 					),
134 134
 					'options'      => array(
135 135
 						'step_name' => 'old-product-type',
136
-						'content'  => '<h3>' . esc_html__( 'Choose product type', 'woocommerce' ) . '</h3>' .
137
-										'<p>' . esc_html__( 'Choose a type for this product. Simple is suitable for most physical goods and services (we recommend setting up a simple product for now).', 'woocommerce' ) . '</p>' .
138
-										'<p>' . esc_html__( 'Variable is for more complex products such as t-shirts with multiple sizes.', 'woocommerce' ) . '</p>' .
139
-										'<p>' . esc_html__( 'Grouped products are for grouping several simple products into one.', 'woocommerce' ) . '</p>' .
140
-										'<p>' . esc_html__( 'Finally, external products are for linking off-site.', 'woocommerce' ) . '</p>',
136
+						'content'  => '<h3>' . esc_html__('Choose product type', 'woocommerce') . '</h3>' .
137
+										'<p>' . esc_html__('Choose a type for this product. Simple is suitable for most physical goods and services (we recommend setting up a simple product for now).', 'woocommerce') . '</p>' .
138
+										'<p>' . esc_html__('Variable is for more complex products such as t-shirts with multiple sizes.', 'woocommerce') . '</p>' .
139
+										'<p>' . esc_html__('Grouped products are for grouping several simple products into one.', 'woocommerce') . '</p>' .
140
+										'<p>' . esc_html__('Finally, external products are for linking off-site.', 'woocommerce') . '</p>',
141 141
 						'position' => array(
142 142
 							'edge'  => 'bottom',
143 143
 							'align' => 'middle',
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 					),
154 154
 					'options'      => array(
155 155
 						'step_name' => 'old-virtual-product',
156
-						'content'  => '<h3>' . esc_html__( 'Virtual products', 'woocommerce' ) . '</h3>' .
157
-										'<p>' . esc_html__( 'Check the "Virtual" box if this is a non-physical item, for example a service, which does not need shipping.', 'woocommerce' ) . '</p>',
156
+						'content'  => '<h3>' . esc_html__('Virtual products', 'woocommerce') . '</h3>' .
157
+										'<p>' . esc_html__('Check the "Virtual" box if this is a non-physical item, for example a service, which does not need shipping.', 'woocommerce') . '</p>',
158 158
 						'position' => array(
159 159
 							'edge'  => 'bottom',
160 160
 							'align' => 'middle',
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 					),
171 171
 					'options'      => array(
172 172
 						'step_name' => 'old-downloadable-product',
173
-						'content'  => '<h3>' . esc_html__( 'Downloadable products', 'woocommerce' ) . '</h3>' .
174
-										'<p>' . esc_html__( 'If purchasing this product gives a customer access to a downloadable file, e.g. software, check this box.', 'woocommerce' ) . '</p>',
173
+						'content'  => '<h3>' . esc_html__('Downloadable products', 'woocommerce') . '</h3>' .
174
+										'<p>' . esc_html__('If purchasing this product gives a customer access to a downloadable file, e.g. software, check this box.', 'woocommerce') . '</p>',
175 175
 						'position' => array(
176 176
 							'edge'  => 'bottom',
177 177
 							'align' => 'middle',
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 					),
188 188
 					'options'      => array(
189 189
 						'step_name' => 'old-product-price',
190
-						'content'  => '<h3>' . esc_html__( 'Prices', 'woocommerce' ) . '</h3>' .
191
-										'<p>' . esc_html__( 'Next you need to give your product a price.', 'woocommerce' ) . '</p>',
190
+						'content'  => '<h3>' . esc_html__('Prices', 'woocommerce') . '</h3>' .
191
+										'<p>' . esc_html__('Next you need to give your product a price.', 'woocommerce') . '</p>',
192 192
 						'position' => array(
193 193
 							'edge'  => 'bottom',
194 194
 							'align' => 'middle',
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 					),
205 205
 					'options'      => array(
206 206
 						'step_name' => 'old-product-short-description',
207
-						'content'  => '<h3>' . esc_html__( 'Product short description', 'woocommerce' ) . '</h3>' .
208
-										'<p>' . esc_html__( 'Add a quick summary for your product here. This will appear on the product page under the product name.', 'woocommerce' ) . '</p>',
207
+						'content'  => '<h3>' . esc_html__('Product short description', 'woocommerce') . '</h3>' .
208
+										'<p>' . esc_html__('Add a quick summary for your product here. This will appear on the product page under the product name.', 'woocommerce') . '</p>',
209 209
 						'position' => array(
210 210
 							'edge'  => 'bottom',
211 211
 							'align' => 'middle',
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 					'next'    => 'product_tag',
218 218
 					'options' => array(
219 219
 						'step_name' => 'old-product-image',
220
-						'content'  => '<h3>' . esc_html__( 'Product images', 'woocommerce' ) . '</h3>' .
221
-										'<p>' . esc_html__( "Upload or assign an image to your product here. This image will be shown in your store's catalog.", 'woocommerce' ) . '</p>',
220
+						'content'  => '<h3>' . esc_html__('Product images', 'woocommerce') . '</h3>' .
221
+										'<p>' . esc_html__("Upload or assign an image to your product here. This image will be shown in your store's catalog.", 'woocommerce') . '</p>',
222 222
 						'position' => array(
223 223
 							'edge'  => 'right',
224 224
 							'align' => 'middle',
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 					'next'    => 'product_catdiv',
231 231
 					'options' => array(
232 232
 						'step_name' => 'old-product-tags',
233
-						'content'  => '<h3>' . esc_html__( 'Product tags', 'woocommerce' ) . '</h3>' .
234
-										'<p>' . esc_html__( 'You can optionally "tag" your products here. Tags are a method of labeling your products to make them easier for customers to find.', 'woocommerce' ) . '</p>',
233
+						'content'  => '<h3>' . esc_html__('Product tags', 'woocommerce') . '</h3>' .
234
+										'<p>' . esc_html__('You can optionally "tag" your products here. Tags are a method of labeling your products to make them easier for customers to find.', 'woocommerce') . '</p>',
235 235
 						'position' => array(
236 236
 							'edge'  => 'right',
237 237
 							'align' => 'middle',
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 					'next'    => 'submitdiv',
244 244
 					'options' => array(
245 245
 						'step_name' => 'old-product-categories',
246
-						'content'  => '<h3>' . esc_html__( 'Product categories', 'woocommerce' ) . '</h3>' .
247
-										'<p>' . esc_html__( 'Optionally assign categories to your products to make them easier to browse through and find in your store.', 'woocommerce' ) . '</p>',
246
+						'content'  => '<h3>' . esc_html__('Product categories', 'woocommerce') . '</h3>' .
247
+										'<p>' . esc_html__('Optionally assign categories to your products to make them easier to browse through and find in your store.', 'woocommerce') . '</p>',
248 248
 						'position' => array(
249 249
 							'edge'  => 'right',
250 250
 							'align' => 'middle',
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 					'next'    => '',
257 257
 					'options' => array(
258 258
 						'step_name' => 'old-publish',
259
-						'content'  => '<h3>' . esc_html__( 'Publish your product!', 'woocommerce' ) . '</h3>' .
260
-										'<p>' . esc_html__( 'When you are finished editing your product, hit the "Publish" button to publish your product to your store.', 'woocommerce' ) . '</p>',
259
+						'content'  => '<h3>' . esc_html__('Publish your product!', 'woocommerce') . '</h3>' .
260
+										'<p>' . esc_html__('When you are finished editing your product, hit the "Publish" button to publish your product to your store.', 'woocommerce') . '</p>',
261 261
 						'position' => array(
262 262
 							'edge'  => 'right',
263 263
 							'align' => 'middle',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			),
268 268
 		);
269 269
 
270
-		$this->enqueue_pointers( $pointers );
270
+		$this->enqueue_pointers($pointers);
271 271
 	}
272 272
 
273 273
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @param array $pointers Pointers data.
277 277
 	 */
278
-	public function enqueue_pointers( $pointers ) {
279
-		$pointers = rawurlencode( wp_json_encode( $pointers ) );
280
-		wp_enqueue_style( 'wp-pointer' );
281
-		wp_enqueue_script( 'wp-pointer' );
278
+	public function enqueue_pointers($pointers) {
279
+		$pointers = rawurlencode(wp_json_encode($pointers));
280
+		wp_enqueue_style('wp-pointer');
281
+		wp_enqueue_script('wp-pointer');
282 282
 		wc_enqueue_js(
283 283
 			"jQuery( function( $ ) {
284 284
 				var wc_pointers = JSON.parse( decodeURIComponent( '{$pointers}' ) );
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 							}
324 324
 						},
325 325
 						buttons: function( event, t ) {
326
-							var close   = '" . esc_js( __( 'Dismiss', 'woocommerce' ) ) . "',
327
-								next    = '" . esc_js( __( 'Next', 'woocommerce' ) ) . "',
326
+							var close   = '" . esc_js(__('Dismiss', 'woocommerce')) . "',
327
+								next    = '" . esc_js(__('Next', 'woocommerce')) . "',
328 328
 								button  = $( '<a class=\"close\" href=\"#\">' + close + '</a>' ),
329 329
 								button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ),
330 330
 								wrapper = $( '<div class=\"wc-pointer-buttons\" />' );
Please login to merge, or discard this patch.
woocommerce/includes/admin/plugin-updates/class-wc-plugin-updates.php 2 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11 11
 if ( ! defined( 'ABSPATH' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 /**
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WC_Plugin_Updates {
19 19
 
20
-	/**
21
-	 * This is the header used by extensions to show requirements.
22
-	 *
23
-	 * @var string
24
-	 */
25
-	const VERSION_REQUIRED_HEADER = 'WC requires at least';
26
-
27
-	/**
28
-	 * This is the header used by extensions to show testing.
29
-	 *
30
-	 * @var string
31
-	 */
32
-	const VERSION_TESTED_HEADER = 'WC tested up to';
33
-
34
-	/**
35
-	 * The version for the update to WooCommerce.
36
-	 *
37
-	 * @var string
38
-	 */
39
-	protected $new_version = '';
40
-
41
-	/**
42
-	 * Array of plugins lacking testing with the major version.
43
-	 *
44
-	 * @var array
45
-	 */
46
-	protected $major_untested_plugins = array();
47
-
48
-	/**
49
-	 * Common JS for initializing and managing thickbox-based modals.
50
-	 */
51
-	protected function generic_modal_js() {
52
-		?>
20
+    /**
21
+     * This is the header used by extensions to show requirements.
22
+     *
23
+     * @var string
24
+     */
25
+    const VERSION_REQUIRED_HEADER = 'WC requires at least';
26
+
27
+    /**
28
+     * This is the header used by extensions to show testing.
29
+     *
30
+     * @var string
31
+     */
32
+    const VERSION_TESTED_HEADER = 'WC tested up to';
33
+
34
+    /**
35
+     * The version for the update to WooCommerce.
36
+     *
37
+     * @var string
38
+     */
39
+    protected $new_version = '';
40
+
41
+    /**
42
+     * Array of plugins lacking testing with the major version.
43
+     *
44
+     * @var array
45
+     */
46
+    protected $major_untested_plugins = array();
47
+
48
+    /**
49
+     * Common JS for initializing and managing thickbox-based modals.
50
+     */
51
+    protected function generic_modal_js() {
52
+        ?>
53 53
 		<script>
54 54
 			( function( $ ) {
55 55
 				// Initialize thickbox.
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 			})( jQuery );
87 87
 		</script>
88 88
 		<?php
89
-	}
89
+    }
90 90
 
91
-	/*
91
+    /*
92 92
 	|--------------------------------------------------------------------------
93 93
 	| Message Helpers
94 94
 	|--------------------------------------------------------------------------
@@ -96,45 +96,45 @@  discard block
 block discarded – undo
96 96
 	| Methods for getting messages.
97 97
 	*/
98 98
 
99
-	/**
100
-	 * Get the inline warning notice for major version updates.
101
-	 *
102
-	 * @return string
103
-	 */
104
-	protected function get_extensions_inline_warning_major() {
105
-		$upgrade_type  = 'major';
106
-		$plugins       = $this->major_untested_plugins;
107
-		$version_parts = explode( '.', $this->new_version );
108
-		$new_version   = $version_parts[0] . '.0';
109
-
110
-		if ( empty( $plugins ) ) {
111
-			return;
112
-		}
113
-
114
-		/* translators: %s: version number */
115
-		$message = sprintf( __( "<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce' ), $new_version );
116
-
117
-		ob_start();
118
-		include __DIR__ . '/views/html-notice-untested-extensions-inline.php';
119
-		return ob_get_clean();
120
-	}
121
-
122
-	/**
123
-	 * Get the warning notice for the modal window.
124
-	 *
125
-	 * @return string
126
-	 */
127
-	protected function get_extensions_modal_warning() {
128
-		$version_parts = explode( '.', $this->new_version );
129
-		$new_version   = $version_parts[0] . '.0';
130
-		$plugins       = $this->major_untested_plugins;
131
-
132
-		ob_start();
133
-		include __DIR__ . '/views/html-notice-untested-extensions-modal.php';
134
-		return ob_get_clean();
135
-	}
136
-
137
-	/*
99
+    /**
100
+     * Get the inline warning notice for major version updates.
101
+     *
102
+     * @return string
103
+     */
104
+    protected function get_extensions_inline_warning_major() {
105
+        $upgrade_type  = 'major';
106
+        $plugins       = $this->major_untested_plugins;
107
+        $version_parts = explode( '.', $this->new_version );
108
+        $new_version   = $version_parts[0] . '.0';
109
+
110
+        if ( empty( $plugins ) ) {
111
+            return;
112
+        }
113
+
114
+        /* translators: %s: version number */
115
+        $message = sprintf( __( "<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce' ), $new_version );
116
+
117
+        ob_start();
118
+        include __DIR__ . '/views/html-notice-untested-extensions-inline.php';
119
+        return ob_get_clean();
120
+    }
121
+
122
+    /**
123
+     * Get the warning notice for the modal window.
124
+     *
125
+     * @return string
126
+     */
127
+    protected function get_extensions_modal_warning() {
128
+        $version_parts = explode( '.', $this->new_version );
129
+        $new_version   = $version_parts[0] . '.0';
130
+        $plugins       = $this->major_untested_plugins;
131
+
132
+        ob_start();
133
+        include __DIR__ . '/views/html-notice-untested-extensions-modal.php';
134
+        return ob_get_clean();
135
+    }
136
+
137
+    /*
138 138
 	|--------------------------------------------------------------------------
139 139
 	| Data Helpers
140 140
 	|--------------------------------------------------------------------------
@@ -142,95 +142,95 @@  discard block
 block discarded – undo
142 142
 	| Methods for getting & manipulating data.
143 143
 	*/
144 144
 
145
-	/**
146
-	 * Get installed plugins that have a tested version lower than the input version.
147
-	 *
148
-	 * In case of testing major version compatibility and if current WC version is >= major version part
149
-	 * of the $new_version, no plugins are returned, even if they don't explicitly declare compatibility
150
-	 * with the $new_version.
151
-	 *
152
-	 * @param string $new_version WooCommerce version to test against.
153
-	 * @param string $release 'major', 'minor', or 'none'.
154
-	 * @return array of plugin info arrays
155
-	 */
156
-	public function get_untested_plugins( $new_version, $release ) {
157
-		// Since 5.0 all versions are backwards compatible.
158
-		if ( 'none' === $release ) {
159
-			return array();
160
-		}
161
-
162
-		$extensions        = array_merge( $this->get_plugins_with_header( self::VERSION_TESTED_HEADER ), $this->get_plugins_for_woocommerce() );
163
-		$untested          = array();
164
-		$new_version_parts = explode( '.', $new_version );
165
-		$version           = $new_version_parts[0];
166
-
167
-		if ( 'minor' === $release ) {
168
-			$version .= '.' . $new_version_parts[1];
169
-		}
170
-
171
-		foreach ( $extensions as $file => $plugin ) {
172
-			if ( ! empty( $plugin[ self::VERSION_TESTED_HEADER ] ) ) {
173
-				$plugin_version_parts = explode( '.', $plugin[ self::VERSION_TESTED_HEADER ] );
174
-
175
-				if ( ! is_numeric( $plugin_version_parts[0] )
176
-					|| ( 'minor' === $release && ! isset( $plugin_version_parts[1] ) )
177
-					|| ( 'minor' === $release && ! is_numeric( $plugin_version_parts[1] ) )
178
-					) {
179
-					continue;
180
-				}
181
-
182
-				$plugin_version = $plugin_version_parts[0];
183
-
184
-				if ( 'minor' === $release ) {
185
-					$plugin_version .= '.' . $plugin_version_parts[1];
186
-				}
187
-
188
-				if ( version_compare( $plugin_version, $version, '<' ) ) {
189
-					$untested[ $file ] = $plugin;
190
-				}
191
-			} else {
192
-				$plugin[ self::VERSION_TESTED_HEADER ] = __( 'unknown', 'woocommerce' );
193
-				$untested[ $file ]                     = $plugin;
194
-			}
195
-		}
196
-
197
-		return $untested;
198
-	}
199
-
200
-	/**
201
-	 * Get plugins that have a valid value for a specific header.
202
-	 *
203
-	 * @param string $header Plugin header to search for.
204
-	 * @return array Array of plugins that contain the searched header.
205
-	 */
206
-	protected function get_plugins_with_header( $header ) {
207
-		$plugins = get_plugins();
208
-		$matches = array();
209
-
210
-		foreach ( $plugins as $file => $plugin ) {
211
-			if ( ! empty( $plugin[ $header ] ) ) {
212
-				$matches[ $file ] = $plugin;
213
-			}
214
-		}
215
-
216
-		return apply_filters( 'woocommerce_get_plugins_with_header', $matches, $header, $plugins );
217
-	}
218
-
219
-	/**
220
-	 * Get plugins which "maybe" are for WooCommerce.
221
-	 *
222
-	 * @return array of plugin info arrays
223
-	 */
224
-	protected function get_plugins_for_woocommerce() {
225
-		$plugins = get_plugins();
226
-		$matches = array();
227
-
228
-		foreach ( $plugins as $file => $plugin ) {
229
-			if ( 'WooCommerce' !== $plugin['Name'] && ( stristr( $plugin['Name'], 'woocommerce' ) || stristr( $plugin['Description'], 'woocommerce' ) ) ) {
230
-				$matches[ $file ] = $plugin;
231
-			}
232
-		}
233
-
234
-		return apply_filters( 'woocommerce_get_plugins_for_woocommerce', $matches, $plugins );
235
-	}
145
+    /**
146
+     * Get installed plugins that have a tested version lower than the input version.
147
+     *
148
+     * In case of testing major version compatibility and if current WC version is >= major version part
149
+     * of the $new_version, no plugins are returned, even if they don't explicitly declare compatibility
150
+     * with the $new_version.
151
+     *
152
+     * @param string $new_version WooCommerce version to test against.
153
+     * @param string $release 'major', 'minor', or 'none'.
154
+     * @return array of plugin info arrays
155
+     */
156
+    public function get_untested_plugins( $new_version, $release ) {
157
+        // Since 5.0 all versions are backwards compatible.
158
+        if ( 'none' === $release ) {
159
+            return array();
160
+        }
161
+
162
+        $extensions        = array_merge( $this->get_plugins_with_header( self::VERSION_TESTED_HEADER ), $this->get_plugins_for_woocommerce() );
163
+        $untested          = array();
164
+        $new_version_parts = explode( '.', $new_version );
165
+        $version           = $new_version_parts[0];
166
+
167
+        if ( 'minor' === $release ) {
168
+            $version .= '.' . $new_version_parts[1];
169
+        }
170
+
171
+        foreach ( $extensions as $file => $plugin ) {
172
+            if ( ! empty( $plugin[ self::VERSION_TESTED_HEADER ] ) ) {
173
+                $plugin_version_parts = explode( '.', $plugin[ self::VERSION_TESTED_HEADER ] );
174
+
175
+                if ( ! is_numeric( $plugin_version_parts[0] )
176
+                    || ( 'minor' === $release && ! isset( $plugin_version_parts[1] ) )
177
+                    || ( 'minor' === $release && ! is_numeric( $plugin_version_parts[1] ) )
178
+                    ) {
179
+                    continue;
180
+                }
181
+
182
+                $plugin_version = $plugin_version_parts[0];
183
+
184
+                if ( 'minor' === $release ) {
185
+                    $plugin_version .= '.' . $plugin_version_parts[1];
186
+                }
187
+
188
+                if ( version_compare( $plugin_version, $version, '<' ) ) {
189
+                    $untested[ $file ] = $plugin;
190
+                }
191
+            } else {
192
+                $plugin[ self::VERSION_TESTED_HEADER ] = __( 'unknown', 'woocommerce' );
193
+                $untested[ $file ]                     = $plugin;
194
+            }
195
+        }
196
+
197
+        return $untested;
198
+    }
199
+
200
+    /**
201
+     * Get plugins that have a valid value for a specific header.
202
+     *
203
+     * @param string $header Plugin header to search for.
204
+     * @return array Array of plugins that contain the searched header.
205
+     */
206
+    protected function get_plugins_with_header( $header ) {
207
+        $plugins = get_plugins();
208
+        $matches = array();
209
+
210
+        foreach ( $plugins as $file => $plugin ) {
211
+            if ( ! empty( $plugin[ $header ] ) ) {
212
+                $matches[ $file ] = $plugin;
213
+            }
214
+        }
215
+
216
+        return apply_filters( 'woocommerce_get_plugins_with_header', $matches, $header, $plugins );
217
+    }
218
+
219
+    /**
220
+     * Get plugins which "maybe" are for WooCommerce.
221
+     *
222
+     * @return array of plugin info arrays
223
+     */
224
+    protected function get_plugins_for_woocommerce() {
225
+        $plugins = get_plugins();
226
+        $matches = array();
227
+
228
+        foreach ( $plugins as $file => $plugin ) {
229
+            if ( 'WooCommerce' !== $plugin['Name'] && ( stristr( $plugin['Name'], 'woocommerce' ) || stristr( $plugin['Description'], 'woocommerce' ) ) ) {
230
+                $matches[ $file ] = $plugin;
231
+            }
232
+        }
233
+
234
+        return apply_filters( 'woocommerce_get_plugins_for_woocommerce', $matches, $plugins );
235
+    }
236 236
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if (!defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	protected function get_extensions_inline_warning_major() {
105 105
 		$upgrade_type  = 'major';
106 106
 		$plugins       = $this->major_untested_plugins;
107
-		$version_parts = explode( '.', $this->new_version );
107
+		$version_parts = explode('.', $this->new_version);
108 108
 		$new_version   = $version_parts[0] . '.0';
109 109
 
110
-		if ( empty( $plugins ) ) {
110
+		if (empty($plugins)) {
111 111
 			return;
112 112
 		}
113 113
 
114 114
 		/* translators: %s: version number */
115
-		$message = sprintf( __( "<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce' ), $new_version );
115
+		$message = sprintf(__("<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce'), $new_version);
116 116
 
117 117
 		ob_start();
118 118
 		include __DIR__ . '/views/html-notice-untested-extensions-inline.php';
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @return string
126 126
 	 */
127 127
 	protected function get_extensions_modal_warning() {
128
-		$version_parts = explode( '.', $this->new_version );
128
+		$version_parts = explode('.', $this->new_version);
129 129
 		$new_version   = $version_parts[0] . '.0';
130 130
 		$plugins       = $this->major_untested_plugins;
131 131
 
@@ -153,44 +153,44 @@  discard block
 block discarded – undo
153 153
 	 * @param string $release 'major', 'minor', or 'none'.
154 154
 	 * @return array of plugin info arrays
155 155
 	 */
156
-	public function get_untested_plugins( $new_version, $release ) {
156
+	public function get_untested_plugins($new_version, $release) {
157 157
 		// Since 5.0 all versions are backwards compatible.
158
-		if ( 'none' === $release ) {
158
+		if ('none' === $release) {
159 159
 			return array();
160 160
 		}
161 161
 
162
-		$extensions        = array_merge( $this->get_plugins_with_header( self::VERSION_TESTED_HEADER ), $this->get_plugins_for_woocommerce() );
162
+		$extensions        = array_merge($this->get_plugins_with_header(self::VERSION_TESTED_HEADER), $this->get_plugins_for_woocommerce());
163 163
 		$untested          = array();
164
-		$new_version_parts = explode( '.', $new_version );
164
+		$new_version_parts = explode('.', $new_version);
165 165
 		$version           = $new_version_parts[0];
166 166
 
167
-		if ( 'minor' === $release ) {
167
+		if ('minor' === $release) {
168 168
 			$version .= '.' . $new_version_parts[1];
169 169
 		}
170 170
 
171
-		foreach ( $extensions as $file => $plugin ) {
172
-			if ( ! empty( $plugin[ self::VERSION_TESTED_HEADER ] ) ) {
173
-				$plugin_version_parts = explode( '.', $plugin[ self::VERSION_TESTED_HEADER ] );
171
+		foreach ($extensions as $file => $plugin) {
172
+			if (!empty($plugin[self::VERSION_TESTED_HEADER])) {
173
+				$plugin_version_parts = explode('.', $plugin[self::VERSION_TESTED_HEADER]);
174 174
 
175
-				if ( ! is_numeric( $plugin_version_parts[0] )
176
-					|| ( 'minor' === $release && ! isset( $plugin_version_parts[1] ) )
177
-					|| ( 'minor' === $release && ! is_numeric( $plugin_version_parts[1] ) )
175
+				if (!is_numeric($plugin_version_parts[0])
176
+					|| ('minor' === $release && !isset($plugin_version_parts[1]))
177
+					|| ('minor' === $release && !is_numeric($plugin_version_parts[1]))
178 178
 					) {
179 179
 					continue;
180 180
 				}
181 181
 
182 182
 				$plugin_version = $plugin_version_parts[0];
183 183
 
184
-				if ( 'minor' === $release ) {
184
+				if ('minor' === $release) {
185 185
 					$plugin_version .= '.' . $plugin_version_parts[1];
186 186
 				}
187 187
 
188
-				if ( version_compare( $plugin_version, $version, '<' ) ) {
189
-					$untested[ $file ] = $plugin;
188
+				if (version_compare($plugin_version, $version, '<')) {
189
+					$untested[$file] = $plugin;
190 190
 				}
191 191
 			} else {
192
-				$plugin[ self::VERSION_TESTED_HEADER ] = __( 'unknown', 'woocommerce' );
193
-				$untested[ $file ]                     = $plugin;
192
+				$plugin[self::VERSION_TESTED_HEADER] = __('unknown', 'woocommerce');
193
+				$untested[$file]                     = $plugin;
194 194
 			}
195 195
 		}
196 196
 
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 	 * @param string $header Plugin header to search for.
204 204
 	 * @return array Array of plugins that contain the searched header.
205 205
 	 */
206
-	protected function get_plugins_with_header( $header ) {
206
+	protected function get_plugins_with_header($header) {
207 207
 		$plugins = get_plugins();
208 208
 		$matches = array();
209 209
 
210
-		foreach ( $plugins as $file => $plugin ) {
211
-			if ( ! empty( $plugin[ $header ] ) ) {
212
-				$matches[ $file ] = $plugin;
210
+		foreach ($plugins as $file => $plugin) {
211
+			if (!empty($plugin[$header])) {
212
+				$matches[$file] = $plugin;
213 213
 			}
214 214
 		}
215 215
 
216
-		return apply_filters( 'woocommerce_get_plugins_with_header', $matches, $header, $plugins );
216
+		return apply_filters('woocommerce_get_plugins_with_header', $matches, $header, $plugins);
217 217
 	}
218 218
 
219 219
 	/**
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 		$plugins = get_plugins();
226 226
 		$matches = array();
227 227
 
228
-		foreach ( $plugins as $file => $plugin ) {
229
-			if ( 'WooCommerce' !== $plugin['Name'] && ( stristr( $plugin['Name'], 'woocommerce' ) || stristr( $plugin['Description'], 'woocommerce' ) ) ) {
230
-				$matches[ $file ] = $plugin;
228
+		foreach ($plugins as $file => $plugin) {
229
+			if ('WooCommerce' !== $plugin['Name'] && (stristr($plugin['Name'], 'woocommerce') || stristr($plugin['Description'], 'woocommerce'))) {
230
+				$matches[$file] = $plugin;
231 231
 			}
232 232
 		}
233 233
 
234
-		return apply_filters( 'woocommerce_get_plugins_for_woocommerce', $matches, $plugins );
234
+		return apply_filters('woocommerce_get_plugins_for_woocommerce', $matches, $plugins);
235 235
 	}
236 236
 }
Please login to merge, or discard this patch.
includes/admin/plugin-updates/class-wc-plugins-screen-updates.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11 11
 if ( ! defined( 'ABSPATH' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
16
-	include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
16
+    include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
17 17
 }
18 18
 
19 19
 /**
@@ -21,124 +21,124 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
23 23
 
24
-	/**
25
-	 * The upgrade notice shown inline.
26
-	 *
27
-	 * @var string
28
-	 */
29
-	protected $upgrade_notice = '';
30
-
31
-	/**
32
-	 * Constructor.
33
-	 */
34
-	public function __construct() {
35
-		add_action( 'in_plugin_update_message-woocommerce/woocommerce.php', array( $this, 'in_plugin_update_message' ), 10, 2 );
36
-	}
37
-
38
-	/**
39
-	 * Show plugin changes on the plugins screen. Code adapted from W3 Total Cache.
40
-	 *
41
-	 * @param array    $args Unused parameter.
42
-	 * @param stdClass $response Plugin update response.
43
-	 */
44
-	public function in_plugin_update_message( $args, $response ) {
45
-		$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
46
-		if ( ! is_string( $version_type ) ) {
47
-			$version_type = 'none';
48
-		}
49
-
50
-		$this->new_version            = $response->new_version;
51
-		$this->upgrade_notice         = $this->get_upgrade_notice( $response->new_version );
52
-		$this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, $version_type );
53
-
54
-		$current_version_parts = explode( '.', Constants::get_constant( 'WC_VERSION' ) );
55
-		$new_version_parts     = explode( '.', $this->new_version );
56
-
57
-		// If user has already moved to the minor version, we don't need to flag up anything.
58
-		if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) {
59
-			return;
60
-		}
61
-
62
-		if ( ! empty( $this->major_untested_plugins ) ) {
63
-			$this->upgrade_notice .= $this->get_extensions_inline_warning_major();
64
-		}
65
-
66
-		if ( ! empty( $this->major_untested_plugins ) ) {
67
-			$this->upgrade_notice .= $this->get_extensions_modal_warning();
68
-			add_action( 'admin_print_footer_scripts', array( $this, 'plugin_screen_modal_js' ) );
69
-		}
70
-
71
-		echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post( $this->upgrade_notice ) . '<p class="dummy">' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
72
-	}
73
-
74
-	/**
75
-	 * Get the upgrade notice from WordPress.org.
76
-	 *
77
-	 * @param  string $version WooCommerce new version.
78
-	 * @return string
79
-	 */
80
-	protected function get_upgrade_notice( $version ) {
81
-		$transient_name = 'wc_upgrade_notice_' . $version;
82
-		$upgrade_notice = get_transient( $transient_name );
83
-
84
-		if ( false === $upgrade_notice ) {
85
-			$response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' );
86
-
87
-			if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
88
-				$upgrade_notice = $this->parse_update_notice( $response['body'], $version );
89
-				set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS );
90
-			}
91
-		}
92
-		return $upgrade_notice;
93
-	}
94
-
95
-	/**
96
-	 * Parse update notice from readme file.
97
-	 *
98
-	 * @param  string $content WooCommerce readme file content.
99
-	 * @param  string $new_version WooCommerce new version.
100
-	 * @return string
101
-	 */
102
-	private function parse_update_notice( $content, $new_version ) {
103
-		$version_parts     = explode( '.', $new_version );
104
-		$check_for_notices = array(
105
-			$version_parts[0] . '.0', // Major.
106
-			$version_parts[0] . '.0.0', // Major.
107
-			$version_parts[0] . '.' . $version_parts[1], // Minor.
108
-			$version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch.
109
-		);
110
-		$notice_regexp     = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
111
-		$upgrade_notice    = '';
112
-
113
-		foreach ( $check_for_notices as $check_version ) {
114
-			if ( version_compare( Constants::get_constant( 'WC_VERSION' ), $check_version, '>' ) ) {
115
-				continue;
116
-			}
117
-
118
-			$matches = null;
119
-			if ( preg_match( $notice_regexp, $content, $matches ) ) {
120
-				$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
121
-
122
-				if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) {
123
-					$upgrade_notice .= '<p class="wc_plugin_upgrade_notice">';
124
-
125
-					foreach ( $notices as $index => $line ) {
126
-						$upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
127
-					}
128
-
129
-					$upgrade_notice .= '</p>';
130
-				}
131
-				break;
132
-			}
133
-		}
134
-		return wp_kses_post( $upgrade_notice );
135
-	}
136
-
137
-	/**
138
-	 * JS for the modal window on the plugins screen.
139
-	 */
140
-	public function plugin_screen_modal_js() {
141
-		?>
24
+    /**
25
+     * The upgrade notice shown inline.
26
+     *
27
+     * @var string
28
+     */
29
+    protected $upgrade_notice = '';
30
+
31
+    /**
32
+     * Constructor.
33
+     */
34
+    public function __construct() {
35
+        add_action( 'in_plugin_update_message-woocommerce/woocommerce.php', array( $this, 'in_plugin_update_message' ), 10, 2 );
36
+    }
37
+
38
+    /**
39
+     * Show plugin changes on the plugins screen. Code adapted from W3 Total Cache.
40
+     *
41
+     * @param array    $args Unused parameter.
42
+     * @param stdClass $response Plugin update response.
43
+     */
44
+    public function in_plugin_update_message( $args, $response ) {
45
+        $version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
46
+        if ( ! is_string( $version_type ) ) {
47
+            $version_type = 'none';
48
+        }
49
+
50
+        $this->new_version            = $response->new_version;
51
+        $this->upgrade_notice         = $this->get_upgrade_notice( $response->new_version );
52
+        $this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, $version_type );
53
+
54
+        $current_version_parts = explode( '.', Constants::get_constant( 'WC_VERSION' ) );
55
+        $new_version_parts     = explode( '.', $this->new_version );
56
+
57
+        // If user has already moved to the minor version, we don't need to flag up anything.
58
+        if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) {
59
+            return;
60
+        }
61
+
62
+        if ( ! empty( $this->major_untested_plugins ) ) {
63
+            $this->upgrade_notice .= $this->get_extensions_inline_warning_major();
64
+        }
65
+
66
+        if ( ! empty( $this->major_untested_plugins ) ) {
67
+            $this->upgrade_notice .= $this->get_extensions_modal_warning();
68
+            add_action( 'admin_print_footer_scripts', array( $this, 'plugin_screen_modal_js' ) );
69
+        }
70
+
71
+        echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post( $this->upgrade_notice ) . '<p class="dummy">' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
72
+    }
73
+
74
+    /**
75
+     * Get the upgrade notice from WordPress.org.
76
+     *
77
+     * @param  string $version WooCommerce new version.
78
+     * @return string
79
+     */
80
+    protected function get_upgrade_notice( $version ) {
81
+        $transient_name = 'wc_upgrade_notice_' . $version;
82
+        $upgrade_notice = get_transient( $transient_name );
83
+
84
+        if ( false === $upgrade_notice ) {
85
+            $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' );
86
+
87
+            if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
88
+                $upgrade_notice = $this->parse_update_notice( $response['body'], $version );
89
+                set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS );
90
+            }
91
+        }
92
+        return $upgrade_notice;
93
+    }
94
+
95
+    /**
96
+     * Parse update notice from readme file.
97
+     *
98
+     * @param  string $content WooCommerce readme file content.
99
+     * @param  string $new_version WooCommerce new version.
100
+     * @return string
101
+     */
102
+    private function parse_update_notice( $content, $new_version ) {
103
+        $version_parts     = explode( '.', $new_version );
104
+        $check_for_notices = array(
105
+            $version_parts[0] . '.0', // Major.
106
+            $version_parts[0] . '.0.0', // Major.
107
+            $version_parts[0] . '.' . $version_parts[1], // Minor.
108
+            $version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch.
109
+        );
110
+        $notice_regexp     = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
111
+        $upgrade_notice    = '';
112
+
113
+        foreach ( $check_for_notices as $check_version ) {
114
+            if ( version_compare( Constants::get_constant( 'WC_VERSION' ), $check_version, '>' ) ) {
115
+                continue;
116
+            }
117
+
118
+            $matches = null;
119
+            if ( preg_match( $notice_regexp, $content, $matches ) ) {
120
+                $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
121
+
122
+                if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) {
123
+                    $upgrade_notice .= '<p class="wc_plugin_upgrade_notice">';
124
+
125
+                    foreach ( $notices as $index => $line ) {
126
+                        $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
127
+                    }
128
+
129
+                    $upgrade_notice .= '</p>';
130
+                }
131
+                break;
132
+            }
133
+        }
134
+        return wp_kses_post( $upgrade_notice );
135
+    }
136
+
137
+    /**
138
+     * JS for the modal window on the plugins screen.
139
+     */
140
+    public function plugin_screen_modal_js() {
141
+        ?>
142 142
 		<script>
143 143
 			( function( $ ) {
144 144
 				var $update_box = $( '#woocommerce-update' );
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			})( jQuery );
168 168
 		</script>
169 169
 		<?php
170
-		$this->generic_modal_js();
171
-	}
170
+        $this->generic_modal_js();
171
+    }
172 172
 }
173 173
 new WC_Plugins_Screen_Updates();
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if (!defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
15
-if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
16
-	include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
15
+if (!class_exists('WC_Plugin_Updates')) {
16
+	include_once dirname(__FILE__) . '/class-wc-plugin-updates.php';
17 17
 }
18 18
 
19 19
 /**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Constructor.
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'in_plugin_update_message-woocommerce/woocommerce.php', array( $this, 'in_plugin_update_message' ), 10, 2 );
35
+		add_action('in_plugin_update_message-woocommerce/woocommerce.php', array($this, 'in_plugin_update_message'), 10, 2);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,34 +41,34 @@  discard block
 block discarded – undo
41 41
 	 * @param array    $args Unused parameter.
42 42
 	 * @param stdClass $response Plugin update response.
43 43
 	 */
44
-	public function in_plugin_update_message( $args, $response ) {
45
-		$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
46
-		if ( ! is_string( $version_type ) ) {
44
+	public function in_plugin_update_message($args, $response) {
45
+		$version_type = Constants::get_constant('WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE');
46
+		if (!is_string($version_type)) {
47 47
 			$version_type = 'none';
48 48
 		}
49 49
 
50 50
 		$this->new_version            = $response->new_version;
51
-		$this->upgrade_notice         = $this->get_upgrade_notice( $response->new_version );
52
-		$this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, $version_type );
51
+		$this->upgrade_notice         = $this->get_upgrade_notice($response->new_version);
52
+		$this->major_untested_plugins = $this->get_untested_plugins($response->new_version, $version_type);
53 53
 
54
-		$current_version_parts = explode( '.', Constants::get_constant( 'WC_VERSION' ) );
55
-		$new_version_parts     = explode( '.', $this->new_version );
54
+		$current_version_parts = explode('.', Constants::get_constant('WC_VERSION'));
55
+		$new_version_parts     = explode('.', $this->new_version);
56 56
 
57 57
 		// If user has already moved to the minor version, we don't need to flag up anything.
58
-		if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) {
58
+		if (version_compare($current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=')) {
59 59
 			return;
60 60
 		}
61 61
 
62
-		if ( ! empty( $this->major_untested_plugins ) ) {
62
+		if (!empty($this->major_untested_plugins)) {
63 63
 			$this->upgrade_notice .= $this->get_extensions_inline_warning_major();
64 64
 		}
65 65
 
66
-		if ( ! empty( $this->major_untested_plugins ) ) {
66
+		if (!empty($this->major_untested_plugins)) {
67 67
 			$this->upgrade_notice .= $this->get_extensions_modal_warning();
68
-			add_action( 'admin_print_footer_scripts', array( $this, 'plugin_screen_modal_js' ) );
68
+			add_action('admin_print_footer_scripts', array($this, 'plugin_screen_modal_js'));
69 69
 		}
70 70
 
71
-		echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post( $this->upgrade_notice ) . '<p class="dummy">' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
71
+		echo apply_filters('woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post($this->upgrade_notice) . '<p class="dummy">' : ''); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
72 72
 	}
73 73
 
74 74
 	/**
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 	 * @param  string $version WooCommerce new version.
78 78
 	 * @return string
79 79
 	 */
80
-	protected function get_upgrade_notice( $version ) {
80
+	protected function get_upgrade_notice($version) {
81 81
 		$transient_name = 'wc_upgrade_notice_' . $version;
82
-		$upgrade_notice = get_transient( $transient_name );
82
+		$upgrade_notice = get_transient($transient_name);
83 83
 
84
-		if ( false === $upgrade_notice ) {
85
-			$response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' );
84
+		if (false === $upgrade_notice) {
85
+			$response = wp_safe_remote_get('https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt');
86 86
 
87
-			if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
88
-				$upgrade_notice = $this->parse_update_notice( $response['body'], $version );
89
-				set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS );
87
+			if (!is_wp_error($response) && !empty($response['body'])) {
88
+				$upgrade_notice = $this->parse_update_notice($response['body'], $version);
89
+				set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS);
90 90
 			}
91 91
 		}
92 92
 		return $upgrade_notice;
@@ -99,31 +99,31 @@  discard block
 block discarded – undo
99 99
 	 * @param  string $new_version WooCommerce new version.
100 100
 	 * @return string
101 101
 	 */
102
-	private function parse_update_notice( $content, $new_version ) {
103
-		$version_parts     = explode( '.', $new_version );
102
+	private function parse_update_notice($content, $new_version) {
103
+		$version_parts     = explode('.', $new_version);
104 104
 		$check_for_notices = array(
105 105
 			$version_parts[0] . '.0', // Major.
106 106
 			$version_parts[0] . '.0.0', // Major.
107 107
 			$version_parts[0] . '.' . $version_parts[1], // Minor.
108 108
 			$version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch.
109 109
 		);
110
-		$notice_regexp     = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
110
+		$notice_regexp     = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote($new_version) . '\s*=|$)~Uis';
111 111
 		$upgrade_notice    = '';
112 112
 
113
-		foreach ( $check_for_notices as $check_version ) {
114
-			if ( version_compare( Constants::get_constant( 'WC_VERSION' ), $check_version, '>' ) ) {
113
+		foreach ($check_for_notices as $check_version) {
114
+			if (version_compare(Constants::get_constant('WC_VERSION'), $check_version, '>')) {
115 115
 				continue;
116 116
 			}
117 117
 
118 118
 			$matches = null;
119
-			if ( preg_match( $notice_regexp, $content, $matches ) ) {
120
-				$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
119
+			if (preg_match($notice_regexp, $content, $matches)) {
120
+				$notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
121 121
 
122
-				if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) {
122
+				if (version_compare(trim($matches[1]), $check_version, '=')) {
123 123
 					$upgrade_notice .= '<p class="wc_plugin_upgrade_notice">';
124 124
 
125
-					foreach ( $notices as $index => $line ) {
126
-						$upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
125
+					foreach ($notices as $index => $line) {
126
+						$upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line);
127 127
 					}
128 128
 
129 129
 					$upgrade_notice .= '</p>';
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				break;
132 132
 			}
133 133
 		}
134
-		return wp_kses_post( $upgrade_notice );
134
+		return wp_kses_post($upgrade_notice);
135 135
 	}
136 136
 
137 137
 	/**
Please login to merge, or discard this patch.
includes/admin/plugin-updates/class-wc-updates-screen-updates.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11 11
 if ( ! defined( 'ABSPATH' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
16
-	include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
16
+    include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
17 17
 }
18 18
 
19 19
 /**
@@ -21,43 +21,43 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
23 23
 
24
-	/**
25
-	 * Constructor.
26
-	 */
27
-	public function __construct() {
28
-		add_action( 'admin_print_footer_scripts', array( $this, 'update_screen_modal' ) );
29
-	}
24
+    /**
25
+     * Constructor.
26
+     */
27
+    public function __construct() {
28
+        add_action( 'admin_print_footer_scripts', array( $this, 'update_screen_modal' ) );
29
+    }
30 30
 
31
-	/**
32
-	 * Show a warning message on the upgrades screen if the user tries to upgrade and has untested plugins.
33
-	 */
34
-	public function update_screen_modal() {
35
-		$updateable_plugins = get_plugin_updates();
36
-		if ( empty( $updateable_plugins['woocommerce/woocommerce.php'] )
37
-			|| empty( $updateable_plugins['woocommerce/woocommerce.php']->update )
38
-			|| empty( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version ) ) {
39
-			return;
40
-		}
31
+    /**
32
+     * Show a warning message on the upgrades screen if the user tries to upgrade and has untested plugins.
33
+     */
34
+    public function update_screen_modal() {
35
+        $updateable_plugins = get_plugin_updates();
36
+        if ( empty( $updateable_plugins['woocommerce/woocommerce.php'] )
37
+            || empty( $updateable_plugins['woocommerce/woocommerce.php']->update )
38
+            || empty( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version ) ) {
39
+            return;
40
+        }
41 41
 
42
-		$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
43
-		if ( ! is_string( $version_type ) ) {
44
-			$version_type = 'none';
45
-		}
42
+        $version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
43
+        if ( ! is_string( $version_type ) ) {
44
+            $version_type = 'none';
45
+        }
46 46
 
47
-		$this->new_version            = wc_clean( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version );
48
-		$this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, $version_type );
47
+        $this->new_version            = wc_clean( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version );
48
+        $this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, $version_type );
49 49
 
50
-		if ( ! empty( $this->major_untested_plugins ) ) {
51
-			echo $this->get_extensions_modal_warning(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
52
-			$this->update_screen_modal_js();
53
-		}
54
-	}
50
+        if ( ! empty( $this->major_untested_plugins ) ) {
51
+            echo $this->get_extensions_modal_warning(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
52
+            $this->update_screen_modal_js();
53
+        }
54
+    }
55 55
 
56
-	/**
57
-	 * JS for the modal window on the updates screen.
58
-	 */
59
-	protected function update_screen_modal_js() {
60
-		?>
56
+    /**
57
+     * JS for the modal window on the updates screen.
58
+     */
59
+    protected function update_screen_modal_js() {
60
+        ?>
61 61
 		<script>
62 62
 			( function( $ ) {
63 63
 				var modal_dismissed = false;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			})( jQuery );
97 97
 		</script>
98 98
 		<?php
99
-		$this->generic_modal_js();
100
-	}
99
+        $this->generic_modal_js();
100
+    }
101 101
 }
102 102
 new WC_Updates_Screen_Updates();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Automattic\Jetpack\Constants;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if (!defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
15
-if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
16
-	include_once dirname( __FILE__ ) . '/class-wc-plugin-updates.php';
15
+if (!class_exists('WC_Plugin_Updates')) {
16
+	include_once dirname(__FILE__) . '/class-wc-plugin-updates.php';
17 17
 }
18 18
 
19 19
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * Constructor.
26 26
 	 */
27 27
 	public function __construct() {
28
-		add_action( 'admin_print_footer_scripts', array( $this, 'update_screen_modal' ) );
28
+		add_action('admin_print_footer_scripts', array($this, 'update_screen_modal'));
29 29
 	}
30 30
 
31 31
 	/**
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function update_screen_modal() {
35 35
 		$updateable_plugins = get_plugin_updates();
36
-		if ( empty( $updateable_plugins['woocommerce/woocommerce.php'] )
37
-			|| empty( $updateable_plugins['woocommerce/woocommerce.php']->update )
38
-			|| empty( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version ) ) {
36
+		if (empty($updateable_plugins['woocommerce/woocommerce.php'])
37
+			|| empty($updateable_plugins['woocommerce/woocommerce.php']->update)
38
+			|| empty($updateable_plugins['woocommerce/woocommerce.php']->update->new_version)) {
39 39
 			return;
40 40
 		}
41 41
 
42
-		$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
43
-		if ( ! is_string( $version_type ) ) {
42
+		$version_type = Constants::get_constant('WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE');
43
+		if (!is_string($version_type)) {
44 44
 			$version_type = 'none';
45 45
 		}
46 46
 
47
-		$this->new_version            = wc_clean( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version );
48
-		$this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, $version_type );
47
+		$this->new_version            = wc_clean($updateable_plugins['woocommerce/woocommerce.php']->update->new_version);
48
+		$this->major_untested_plugins = $this->get_untested_plugins($this->new_version, $version_type);
49 49
 
50
-		if ( ! empty( $this->major_untested_plugins ) ) {
50
+		if (!empty($this->major_untested_plugins)) {
51 51
 			echo $this->get_extensions_modal_warning(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
52 52
 			$this->update_screen_modal_js();
53 53
 		}
Please login to merge, or discard this patch.
admin/plugin-updates/views/html-notice-untested-extensions-inline.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+    exit;
10 10
 }
11 11
 ?>
12 12
 <div class="wc_plugin_upgrade_notice extensions_warning <?php echo esc_attr( $upgrade_type ); ?>">
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@
 block discarded – undo
5 5
  * @package WooCommerce\Admin
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 ?>
12
-<div class="wc_plugin_upgrade_notice extensions_warning <?php echo esc_attr( $upgrade_type ); ?>">
13
-	<p><?php echo wp_kses_post( $message ); ?></p>
12
+<div class="wc_plugin_upgrade_notice extensions_warning <?php echo esc_attr($upgrade_type); ?>">
13
+	<p><?php echo wp_kses_post($message); ?></p>
14 14
 
15 15
 	<table class="plugin-details-table" cellspacing="0">
16 16
 		<thead>
17 17
 			<tr>
18
-				<th><?php esc_html_e( 'Plugin', 'woocommerce' ); ?></th>
19
-				<th><?php esc_html_e( 'Tested up to WooCommerce version', 'woocommerce' ); ?></th>
18
+				<th><?php esc_html_e('Plugin', 'woocommerce'); ?></th>
19
+				<th><?php esc_html_e('Tested up to WooCommerce version', 'woocommerce'); ?></th>
20 20
 			</tr>
21 21
 		</thead>
22 22
 		<tbody>
23
-			<?php foreach ( $plugins as $plugin ) : ?>
23
+			<?php foreach ($plugins as $plugin) : ?>
24 24
 				<tr>
25
-					<td><?php echo esc_html( $plugin['Name'] ); ?></td>
26
-					<td><?php echo esc_html( $plugin['WC tested up to'] ); ?></td>
25
+					<td><?php echo esc_html($plugin['Name']); ?></td>
26
+					<td><?php echo esc_html($plugin['WC tested up to']); ?></td>
27 27
 				</tr>
28 28
 			<?php endforeach ?>
29 29
 		</tbody>
Please login to merge, or discard this patch.