Skip to content

Commit 52dd77b

Browse files
authored
Merge pull request #186 from andrewlimaza/fix-checkbox
Removed escaping as it was already escaped
2 parents 195a431 + f0eae0d commit 52dd77b

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

pmpro-woocommerce.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -545,30 +545,34 @@ function pmprowoo_tab_options() {
545545
<h3><?php esc_html_e( 'Give Customers a Membership Level', 'pmpro-woocommerce' ); ?></h3>
546546
<?php
547547
// Membership Product
548+
// woocommerce_wp_select() escapes attributes for us.
548549
woocommerce_wp_select(
549550
array(
550551
'id' => '_membership_product_level',
551-
'label' => esc_html__( 'Membership Product', 'pmpro-woocommerce' ),
552-
'options' => $membership_level_options,
552+
'label' => __( 'Membership Product', 'pmpro-woocommerce' ),
553+
'options' => $membership_level_options, // phpcs:ignore WordPress.Security.EscapeOutput
553554
)
554555
);
555556

556557
// Membership Product
557-
if( !empty( $post->ID ) ) {
558+
if ( ! empty( $post->ID ) ) {
558559
$cbvalue = get_post_meta( $post->ID, '_membership_product_autocomplete', true );
559560
}
560-
if( empty( $cbvalue ) ) {
561+
562+
if ( empty( $cbvalue ) ) {
561563
$cbvalue = NULL;
562564
}
563565

566+
// woocommerce_wp_checkbox() escapes attributes for us.
564567
woocommerce_wp_checkbox(
565568
array(
566569
'id' => '_membership_product_autocomplete',
567-
'label' => esc_html__( 'Autocomplete Order Status', 'pmpro-woocommerce' ),
568-
'description' => esc_html__( "Check this to mark the order as completed immediately after checkout to activate the associated membership.", 'pmpro-woocommerce' ),
569-
'cbvalue' => esc_attr( $cbvalue ),
570+
'label' => __( 'Autocomplete Order Status', 'pmpro-woocommerce' ),
571+
'description' => __( "Check this to mark the order as completed immediately after checkout to activate the associated membership.", 'pmpro-woocommerce' ),
572+
'cbvalue' => $cbvalue, // phpcs:ignore WordPress.Security.EscapeOutput
570573
)
571574
);
575+
572576
?>
573577
</div> <!-- end pmprowoo_options_group-membership_product -->
574578
<div class="options-group pmprowoo_options_group-membership_discount">
@@ -616,7 +620,12 @@ function pmprowoo_process_product_meta() {
616620
} else {
617621
$autocomplete = 0;
618622
}
619-
623+
624+
// update post meta for the autocomplete option
625+
if ( isset ( $autocomplete ) ) {
626+
update_post_meta( $post_id, '_membership_product_autocomplete', $autocomplete );
627+
}
628+
620629
// update array of product levels
621630
if ( ! empty( $level ) ) {
622631
$pmprowoo_product_levels[ $post_id ] = $level;
@@ -637,10 +646,6 @@ function pmprowoo_process_product_meta() {
637646
}
638647
}
639648

640-
// update post meta for the autocomplete option
641-
if ( isset ( $autocomplete ) ) {
642-
update_post_meta( $post_id, '_membership_product_autocomplete', $autocomplete );
643-
}
644649
}
645650
add_action( 'woocommerce_process_product_meta', 'pmprowoo_process_product_meta' );
646651

0 commit comments

Comments
 (0)