Disable phpcs when nonce check not needed

This commit is contained in:
dinamiko 2022-10-19 17:22:09 +02:00
parent 4e248a815e
commit a18832371e
8 changed files with 14 additions and 14 deletions

View file

@ -275,7 +275,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
* If customer has chosen change Subscription payment.
*/
if ( $this->subscription_helper->has_subscription( $order_id ) && $this->subscription_helper->is_subscription_change_payment() ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$saved_paypal_payment = wc_clean( wp_unslash( $_POST['saved_paypal_payment'] ?? '' ) );
if ( $saved_paypal_payment ) {
update_post_meta( $order_id, 'payment_token_id', $saved_paypal_payment );

View file

@ -360,7 +360,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
/**
* If customer has chosen a saved credit card payment.
*/
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$saved_credit_card = wc_clean( wp_unslash( $_POST['saved_credit_card'] ?? '' ) );
if ( $saved_credit_card ) {
try {

View file

@ -183,7 +183,7 @@ class OXXO {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$billing_country = wc_clean( wp_unslash( $_POST['country'] ?? '' ) );
if ( $billing_country && 'MX' !== $billing_country ) {
return false;

View file

@ -400,7 +400,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
);
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$funding_source = wc_clean( wp_unslash( $_POST['ppcp-funding-source'] ?? '' ) );
if ( 'card' !== $funding_source && $this->is_free_trial_order( $wc_order ) ) {
$user_id = (int) $wc_order->get_customer_id();
@ -423,7 +423,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
* If customer has chosen change Subscription payment.
*/
if ( $this->subscription_helper->has_subscription( $order_id ) && $this->subscription_helper->is_subscription_change_payment() ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$saved_paypal_payment = wc_clean( wp_unslash( $_POST['saved_paypal_payment'] ?? '' ) );
if ( $saved_paypal_payment ) {
update_post_meta( $order_id, 'payment_token_id', $saved_paypal_payment );

View file

@ -409,7 +409,7 @@ class PayUponInvoice {
add_action(
'woocommerce_after_checkout_validation',
function( array $fields, WP_Error $errors ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$payment_method = wc_clean( wp_unslash( $_POST['payment_method'] ?? '' ) );
if ( PayUponInvoiceGateway::ID !== $payment_method ) {
return;
@ -419,7 +419,7 @@ class PayUponInvoice {
$errors->add( 'validation', __( 'Billing country not available.', 'woocommerce-paypal-payments' ) );
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) );
if ( ( $birth_date && ! $this->checkout_helper->validate_birth_date( $birth_date ) ) || $birth_date === '' ) {
$errors->add( 'validation', __( 'Invalid birth date.', 'woocommerce-paypal-payments' ) );
@ -530,7 +530,7 @@ class PayUponInvoice {
'add_meta_boxes',
function( string $post_type ) {
if ( $post_type === 'shop_order' ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$post_id = wc_clean( wp_unslash( $_GET['post'] ?? 0 ) );
$order = wc_get_order( $post_id );
if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === PayUponInvoiceGateway::ID ) {

View file

@ -202,9 +202,9 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
* @return array
*/
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
// phpcs:disable WordPress.Security.NonceVerification.Recommended
$birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) );
$wc_order = wc_get_order( $order_id );
// phpcs:disable WordPress.Security.NonceVerification.Missing
$birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) );
$pay_for_order = wc_clean( wp_unslash( $_GET['pay_for_order'] ?? '' ) );
if ( 'true' === $pay_for_order ) {
if ( ! $this->checkout_helper->validate_birth_date( $birth_date ) ) {
@ -216,7 +216,7 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
}
$phone_number = wc_clean( wp_unslash( $_POST['billing_phone'] ?? '' ) );
// phpcs:enable WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.NonceVerification.Missing
if ( $phone_number ) {
$wc_order->set_billing_phone( $phone_number );
$wc_order->save();

View file

@ -54,7 +54,7 @@ class PayUponInvoiceHelper {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$billing_country = wc_clean( wp_unslash( $_POST['country'] ?? '' ) );
if ( $billing_country && 'DE' !== $billing_country ) {
return false;