mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
codestyle
This commit is contained in:
parent
ccda439569
commit
5fc8dde271
4 changed files with 21 additions and 7 deletions
|
@ -289,7 +289,7 @@ return array(
|
||||||
'gateway' => 'paypal',
|
'gateway' => 'paypal',
|
||||||
),
|
),
|
||||||
'dcc_enabled' => array(
|
'dcc_enabled' => array(
|
||||||
'title' => __( 'Enable/Disable' ),
|
'title' => __( 'Enable/Disable', 'paypal-for-woocommerce' ),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'gateway' => 'dcc',
|
'gateway' => 'dcc',
|
||||||
|
|
|
@ -198,7 +198,12 @@ class CreditCardGateway extends PayPalGateway {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the gateway is available or not.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function is_available() : bool {
|
public function is_available() : bool {
|
||||||
return $this->config->has('dcc_enabled') && $this->config->get('dcc_enabled');
|
return $this->config->has( 'dcc_enabled' ) && $this->config->get( 'dcc_enabled' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,8 +333,13 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||||
private function is_credit_card_tab() : bool
|
|
||||||
{
|
/**
|
||||||
|
* Determines, whether the current session is on the credit card tab in the admin settings.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function is_credit_card_tab() : bool {
|
||||||
return is_admin() && isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
|
return is_admin() && isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ class SettingsListener {
|
||||||
$this->maybe_register_webhooks( $settings );
|
$this->maybe_register_webhooks( $settings );
|
||||||
}
|
}
|
||||||
if ( isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === $_GET[ SectionsRenderer::KEY ] ) {
|
if ( isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === $_GET[ SectionsRenderer::KEY ] ) {
|
||||||
$dcc_enabled_post_key = 'woocommerce_ppcp-credit-card-gateway_enabled';
|
$dcc_enabled_post_key = 'woocommerce_ppcp-credit-card-gateway_enabled';
|
||||||
$settings['dcc_enabled'] = isset( $_POST[ $dcc_enabled_post_key ] )
|
$settings['dcc_enabled'] = isset( $_POST[ $dcc_enabled_post_key ] )
|
||||||
&& 1 === absint( $_POST[ $dcc_enabled_post_key ] );
|
&& 1 === absint( $_POST[ $dcc_enabled_post_key ] );
|
||||||
}
|
}
|
||||||
|
@ -189,13 +189,17 @@ class SettingsListener {
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
'dcc' === $config['gateway']
|
'dcc' === $config['gateway']
|
||||||
&& sanitize_text_field( wp_unslash( $_GET[SectionsRenderer::KEY] ) ) !== CreditCardGateway::ID
|
&& (
|
||||||
|
! isset( $_GET[ SectionsRenderer::KEY ] )
|
||||||
|
|| sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) !== CreditCardGateway::ID
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
'paypal' === $config['gateway']
|
'paypal' === $config['gateway']
|
||||||
&& sanitize_text_field( wp_unslash( $_GET[SectionsRenderer::KEY] ) ) !== PayPalGateway::ID
|
&& isset( $_GET[ SectionsRenderer::KEY ] )
|
||||||
|
&& sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) !== PayPalGateway::ID
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue