/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Admin/Payments
NameSizeModeActions
Views/-0755rm
BuilderReturnNotice.php39210644editdlrm
Payments.php61950644editdlrm
ScreenOptions.php48310644editdlrm
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Admin/Payments/BuilderReturnNotice.php (3921B)
` query arg check shared by all OAuth-based * gateways (Stripe, Square). * * @since 1.10.1.1 * * @param string $gateway_slug Gateway slug as emitted by the callback * (e.g. "stripe", "square"). * @param string $gateway_label Localized gateway name (e.g. "Stripe"). */ public static function maybe_queue_oauth( string $gateway_slug, string $gateway_label ): void { if ( ! wpforms_is_admin_page( 'settings', 'payments' ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( empty( $_GET[ self::GATEWAY_QUERY_ARG ] ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( sanitize_key( $_GET[ self::GATEWAY_QUERY_ARG ] ) !== $gateway_slug ) { return; } self::maybe_queue( $gateway_label, $gateway_slug ); } /** * Queue the success notice if the request carries a valid return form ID * and the current user can edit that form. * * @since 1.10.1.1 * * @param string $gateway_label Localized gateway name (e.g. "Stripe"). * @param string $gateway_slug Builder payments-panel section slug * (e.g. "stripe", "square", "authorize_net"). * Appended as `§ion=…` so the user lands * back on the same gateway tab. */ public static function maybe_queue( string $gateway_label, string $gateway_slug = '' ): void { $form_id = self::get_return_form_id(); if ( $form_id <= 0 ) { return; } if ( ! wpforms_current_user_can( 'edit_form_single', $form_id ) ) { return; } $form = wpforms()->obj( 'form' )->get( $form_id ); if ( empty( $form ) ) { return; } $builder_url_args = [ 'page' => 'wpforms-builder', 'view' => 'payments', 'form_id' => $form_id, ]; if ( $gateway_slug !== '' ) { $builder_url_args['section'] = sanitize_key( $gateway_slug ); } $builder_url = add_query_arg( $builder_url_args, admin_url( 'admin.php' ) ); $message = sprintf( wp_kses( /* translators: %1$s - Gateway name, %2$s - Builder URL. */ __( 'You have successfully connected to %1$s. Return to your form to continue editing.', 'wpforms-lite' ), [ 'strong' => [], 'a' => [ 'href' => [] ], ] ), esc_html( $gateway_label ), esc_url( $builder_url ) ); Notice::success( $message, [ 'slug' => 'wpforms-payments-builder-return-' . $form_id, ] ); } /** * Read and validate the return form ID from the current request. * * @since 1.10.1.1 * * @return int Positive form ID, or 0 if missing/invalid. */ public static function get_return_form_id(): int { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return ! empty( $_GET[ self::FORM_ID_QUERY_ARG ] ) ? absint( $_GET[ self::FORM_ID_QUERY_ARG ] ) : 0; } }