Fix lint.

This commit is contained in:
Pedro Silva 2024-04-11 18:07:20 +01:00
parent 9bf23550dd
commit 832baeaac9
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
10 changed files with 75 additions and 98 deletions

View file

@ -129,7 +129,7 @@ return array(
)
),
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' )
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
)
);
@ -188,7 +188,7 @@ return array(
)
),
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' )
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
'applepay_button_domain_registration' => array(
'title' => __( 'Domain Registration', 'woocommerce-paypal-payments' ),

View file

@ -37,7 +37,7 @@ return array(
$fields,
'vault_enabled_dcc',
array(
'axo_heading' => array(
'axo_heading' => array(
'heading' => __( 'Fastlane', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'description' => wp_kses_post(
@ -62,7 +62,7 @@ return array(
),
'gateway' => 'dcc',
),
'axo_enabled' => array(
'axo_enabled' => array(
'title' => __( 'Fastlane', 'woocommerce-paypal-payments' ),
'title_html' => sprintf(
'<img src="%sassets/images/fastlane.png" alt="%s" style="max-width: 150px; max-height: 45px;" />',
@ -113,9 +113,9 @@ return array(
)
),
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' )
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
'axo_gateway_title' => array(
'axo_gateway_title' => array(
'title' => __( 'Gateway Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -134,59 +134,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_email_widget' => array(
'title' => __( 'Email Widget', 'woocommerce-paypal-payments' ),
'type' => 'select',
'desc_tip' => true,
'description' => __(
'This controls if the Hosted Email Widget should be used.',
'woocommerce-paypal-payments'
),
'classes' => array( 'ppcp-field-indent' ),
'class' => array(),
'input_class' => array( 'wc-enhanced-select' ),
'default' => 'render',
'options' => PropertiesDictionary::email_widget_options(),
'screens' => array( State::STATE_ONBOARDED ),
'gateway' => 'dcc',
'requirements' => array(),
),
//'axo_address_widget' => array(
// 'title' => __( 'Address Widget', 'woocommerce-paypal-payments' ),
// 'type' => 'select',
// 'desc_tip' => true,
// 'description' => __(
// 'This controls if the Hosted Address Widget should be used.',
// 'woocommerce-paypal-payments'
// ),
// 'classes' => array( 'ppcp-field-indent' ),
// 'class' => array(),
// 'input_class' => array( 'wc-enhanced-select' ),
// 'default' => 'render',
// 'options' => PropertiesDictionary::address_widget_options(),
// 'screens' => array( State::STATE_ONBOARDED ),
// 'gateway' => 'dcc',
// 'requirements' => array(),
//),
//'axo_payment_widget' => array(
// 'title' => __( 'Payment Widget', 'woocommerce-paypal-payments' ),
// 'type' => 'select',
// 'desc_tip' => true,
// 'description' => __(
// 'This controls if the Hosted Payment Widget should be used.',
// 'woocommerce-paypal-payments'
// ),
// 'label' => '',
// 'input_class' => array( 'wc-enhanced-select' ),
// 'classes' => array( 'ppcp-field-indent' ),
// 'class' => array(),
// 'default' => 'render',
// 'options' => PropertiesDictionary::payment_widget_options(),
// 'screens' => array( State::STATE_ONBOARDED ),
// 'gateway' => 'dcc',
// 'requirements' => array(),
//),
'axo_privacy' => array(
'axo_privacy' => array(
'title' => __( 'Privacy', 'woocommerce-paypal-payments' ),
'type' => 'select',
'desc_tip' => true,
@ -203,7 +151,7 @@ return array(
'gateway' => 'dcc',
'requirements' => array(),
),
'axo_style_heading' => array(
'axo_style_heading' => array(
'heading' => __( 'Advanced Style Settings (optional)', 'woocommerce-paypal-payments' ),
'heading_html' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
@ -239,7 +187,7 @@ return array(
'gateway' => 'dcc',
),
'axo_style_root_heading' => array(
'axo_style_root_heading' => array(
'heading' => __( 'Root Settings', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'description' => __(
@ -251,7 +199,7 @@ return array(
'requirements' => array( 'dcc' ),
'gateway' => 'dcc',
),
'axo_style_root_bg_color' => array(
'axo_style_root_bg_color' => array(
'title' => __( 'Background Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -261,7 +209,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_root_error_color' => array(
'axo_style_root_error_color' => array(
'title' => __( 'Error Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -271,7 +219,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_root_font_family' => array(
'axo_style_root_font_family' => array(
'title' => __( 'Font Family', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -281,7 +229,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_root_font_size_base' => array(
'axo_style_root_font_size_base' => array(
'title' => __( 'Font Size Base', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -291,7 +239,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_root_padding' => array(
'axo_style_root_padding' => array(
'title' => __( 'Padding', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -301,7 +249,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_root_primary_color' => array(
'axo_style_root_primary_color' => array(
'title' => __( 'Primary Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -311,8 +259,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_input_heading' => array(
'axo_style_input_heading' => array(
'heading' => __( 'Input Settings', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'description' => __(
@ -324,7 +271,7 @@ return array(
'requirements' => array( 'dcc' ),
'gateway' => 'dcc',
),
'axo_style_input_bg_color' => array(
'axo_style_input_bg_color' => array(
'title' => __( 'Background Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -334,7 +281,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_input_border_radius' => array(
'axo_style_input_border_radius' => array(
'title' => __( 'Border Radius', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -344,7 +291,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_input_border_color' => array(
'axo_style_input_border_color' => array(
'title' => __( 'Border Color', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -354,7 +301,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_input_border_width' => array(
'axo_style_input_border_width' => array(
'title' => __( 'Border Width', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),
@ -364,7 +311,7 @@ return array(
'requirements' => array(),
'gateway' => 'dcc',
),
'axo_style_input_text_color_base' => array(
'axo_style_input_text_color_base' => array(
'title' => __( 'Text Color Base', 'woocommerce-paypal-payments' ),
'type' => 'text',
'classes' => array( 'ppcp-field-indent' ),

View file

@ -37,7 +37,7 @@ return array(
return true;
},
'axo.url' => static function ( ContainerInterface $container ): string {
'axo.url' => static function ( ContainerInterface $container ): string {
$path = realpath( __FILE__ );
if ( false === $path ) {
return '';
@ -48,7 +48,7 @@ return array(
);
},
'axo.manager' => static function ( ContainerInterface $container ): AxoManager {
'axo.manager' => static function ( ContainerInterface $container ): AxoManager {
return new AxoManager(
$container->get( 'axo.url' ),
$container->get( 'ppcp.asset-version' ),
@ -61,7 +61,7 @@ return array(
);
},
'axo.gateway' => static function ( ContainerInterface $container ): AxoGateway {
'axo.gateway' => static function ( ContainerInterface $container ): AxoGateway {
return new AxoGateway(
$container->get( 'wcgateway.settings' ),
$container->get( 'wcgateway.url' ),
@ -76,7 +76,7 @@ return array(
);
},
'axo.card_icons' => static function ( ContainerInterface $container ): array {
'axo.card_icons' => static function ( ContainerInterface $container ): array {
return array(
array(
'title' => 'Visa',

View file

@ -155,7 +155,7 @@ class AxoManager {
$payment_widget = $this->settings->has( 'axo_payment_widget' ) ? $this->settings->get( 'axo_payment_widget' ) : null;
return array(
'widgets' => array(
'widgets' => array(
'email' => $email_widget ?: 'render',
'address' => $address_widget ?: 'render',
'payment' => $payment_widget ?: 'render',
@ -163,12 +163,17 @@ class AxoManager {
'insights' => array(
'enabled' => true,
'client_id' => ( $this->settings->has( 'client_id' ) ? $this->settings->get( 'client_id' ) : null ),
'session_id' => substr( md5( WC()->session->get_customer_unique_id() ), 0, 16 ),
'session_id' =>
substr(
method_exists( WC()->session, 'get_customer_unique_id' ) ? md5( WC()->session->get_customer_unique_id() ) : '',
0,
16
),
'amount' => array(
'currency_code' => get_woocommerce_currency(),
'value' => WC()->cart->get_total( 'numeric' )
)
)
'value' => WC()->cart->get_total( 'numeric' ),
),
),
);
}
@ -187,7 +192,7 @@ class AxoManager {
/**
* Renders the HTML for the AXO submit button.
*/
public function render_checkout_button() {
public function render_checkout_button(): void {
$id = 'ppcp-axo-submit-button-container';
/**

View file

@ -37,7 +37,16 @@ class AxoModule implements ModuleInterface {
public function run( ContainerInterface $c ): void {
add_filter(
'woocommerce_payment_gateways',
/**
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
function ( $methods ) use ( $c ): array {
if ( ! is_array( $methods ) ) {
return $methods;
}
$gateway = $c->get( 'axo.gateway' );
// Check if the module is applicable, correct country, currency, ... etc.
@ -64,8 +73,17 @@ class AxoModule implements ModuleInterface {
add_filter(
'ppcp_onboarding_dcc_table_rows',
/**
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
function ( $rows, $renderer ): array {
if ( $renderer instanceof OnboardingOptionsRenderer ) {
if ( ! is_array( $rows ) ) {
return $rows;
}
if ( $renderer instanceof OnboardingOptionsRenderer ) {
$rows[] = $renderer->render_table_row(
__( 'Fastlane by PayPal', 'woocommerce-paypal-payments' ),
__( 'Yes', 'woocommerce-paypal-payments' ),
@ -124,12 +142,13 @@ class AxoModule implements ModuleInterface {
}
);
add_action('wp_head', function () {
echo '
<!-- PayPal Insights SDK JS library -->
<script async src="https://www.paypalobjects.com/insights/v1/paypal-insights.sandbox.min.js"></script>
';
});
add_action(
'wp_head',
function () {
// phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
echo '<script async src="https://www.paypalobjects.com/insights/v1/paypal-insights.sandbox.min.js"></script>';
}
);
},
1

View file

@ -193,7 +193,7 @@ class AxoGateway extends WC_Payment_Gateway {
* @return array
*/
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
$wc_order = wc_get_order( $order_id );
$payment_method_title = __( 'Credit Card (via Fastlane by PayPal)', 'woocommerce-paypal-payments' );
@ -202,6 +202,7 @@ class AxoGateway extends WC_Payment_Gateway {
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$nonce = wc_clean( wp_unslash( $_POST['axo_nonce'] ?? '' ) );
try {

View file

@ -71,7 +71,7 @@ class ApmApplies {
* @return bool
*/
public function for_settings(): bool {
if ( get_option('woocommerce_ship_to_destination') === 'billing_only' ) { // Force shipping to the customer billing address
if ( get_option( 'woocommerce_ship_to_destination' ) === 'billing_only' ) { // Force shipping to the customer billing address.
return false;
}
return true;

View file

@ -100,7 +100,7 @@ return array(
)
),
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' )
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
)
);
@ -147,7 +147,7 @@ return array(
)
),
),
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' )
'classes' => array( 'ppcp-valign-label-middle', 'ppcp-align-label-center' ),
),
'googlepay_button_type' => array(
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),

View file

@ -139,7 +139,7 @@ class OnboardingOptionsRenderer {
$basic_table_rows = apply_filters( 'ppcp_onboarding_basic_table_rows', $basic_table_rows );
$items[] = '
$items[] = '
<li>
<label>
<input type="radio" id="ppcp-onboarding-dcc-basic" name="ppcp_onboarding_dcc" value="basic" checked ' .
@ -197,7 +197,7 @@ class OnboardingOptionsRenderer {
$dcc_table_rows = apply_filters( 'ppcp_onboarding_dcc_table_rows', $dcc_table_rows, $this );
$items[] = '
$items[] = '
<li>
<label>
<input type="radio" id="ppcp-onboarding-dcc-acdc" name="ppcp_onboarding_dcc" value="acdc" ' .

View file

@ -388,7 +388,12 @@ $data_rows_html
<th scope="row" valign="bottom">
<label
for="<?php echo esc_attr( $id ); ?>"
><?php echo isset( $config['title_html'] ) ? $config['title_html'] : esc_html( $config['title'] ); ?></label>
>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo isset( $config['title_html'] ) ? $config['title_html'] : esc_html( $config['title'] );
?>
</label>
<?php if ( isset( $config['desc_tip'] ) && $config['desc_tip'] ) : ?>
<span
class="woocommerce-help-tip"