| Name | Size | Mode | Actions |
|---|---|---|---|
| Builder/ | - | 0755 | rm |
| Payments/ | - | 0755 | rm |
| Connect.php | 14435 | 0644 | editdlrm |
| Notices.php | 5333 | 0644 | editdlrm |
| Settings.php | 11997 | 0644 | editdlrm |
| WebhookSettings.php | 9517 | 0644 | editdlrm |
/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Integrations/Stripe/Admin/Settings.php (11997B)
Switching test/live modes requires Stripe account reconnection.
Press the "Connect with Stripe" button after saving the settings to reconnect.
', 'wpforms-lite' ), [ 'p' => [], 'em' => [], ] ), 'webhook_urls' => [ 'rest' => Helpers::get_webhook_url_for_rest(), 'curl' => Helpers::get_webhook_url_for_curl(), ], ]; wp_localize_script( 'wpforms-admin-settings-stripe', 'wpforms_admin_settings_stripe', $admin_settings_stripe_l10n ); } /** * Register "Stripe" settings fields. * * @since 1.8.2 * * @param array $settings Admin area settings list. * * @return array */ public function register_settings_fields( $settings ) { // Bail early, in case "Payments" settings is not registered. if ( ! isset( $settings['payments'] ) ) { return $settings; } $stripe_settings = [ 'stripe-heading' => [ 'id' => 'stripe-heading', 'content' => $this->get_heading_content(), 'type' => 'content', 'no_label' => true, 'class' => [ 'section-heading' ], ], 'stripe-connection-status' => [ 'id' => 'stripe-connection-status', 'name' => esc_html__( 'Connection Status', 'wpforms-lite' ), 'content' => $this->get_connection_status_content(), 'type' => 'content', ], 'stripe-test-mode' => [ 'id' => 'stripe-test-mode', 'name' => esc_html__( 'Test Mode', 'wpforms-lite' ), 'type' => 'toggle', 'status' => true, 'desc' => sprintf( wp_kses( /* translators: %s - WPForms.com URL for Stripe payments with more details. */ __( 'Prevent Stripe from processing live transactions. Please see our documentation on Stripe test payments for full details.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], 'class' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-test-stripe-payments-on-your-site/', 'Settings - Payments', 'Stripe Test Payments Documentation' ) ) ), ], ]; $stripe_settings = $this->webhook_settings->settings( $stripe_settings ); $this->maybe_set_card_mode(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! empty( $_GET['stripe_card_mode'] ) || ! Helpers::is_payment_element_enabled() ) { $stripe_settings['stripe-card-mode'] = [ 'id' => 'stripe-card-mode', 'name' => esc_html__( 'Credit Card Field Mode', 'wpforms-lite' ), 'type' => 'radio', 'default' => 'payment', 'desc_after' => $this->get_credit_card_field_desc_after(), 'options' => [ 'card' => esc_html__( 'Card Element', 'wpforms-lite' ), 'payment' => esc_html__( 'Payment Element', 'wpforms-lite' ), ], ]; } $settings['payments'] = array_merge( $settings['payments'], $stripe_settings ); return $settings; } /** * Maybe set card mode setting. * * @since 1.8.2 */ private function maybe_set_card_mode() { // Bail out if a card mode is already set. if ( wpforms_setting( 'stripe-card-mode' ) ) { return; } $settings = (array) get_option( 'wpforms_settings', [] ); $settings['stripe-card-mode'] = Helpers::has_stripe_keys() ? 'card' : 'payment'; update_option( 'wpforms_settings', $settings ); } /** * Section header content. * * @since 1.8.2 * * @return string */ private function get_heading_content() { return '' . sprintf( wp_kses( /* translators: %s - WPForms.com Stripe documentation article URL. */ __( 'Easily collect credit card payments with Stripe. For getting started and more information, see our Stripe documentation.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-install-and-use-the-stripe-addon-with-wpforms/', 'Settings - Payments', 'Stripe Documentation' ) ) ) . '
' . Notices::get_fee_notice(); } /** * Connection Status setting content. * * @since 1.8.2 * * @return string */ protected function get_connection_status_content() { $output = ''; $current_mode = Helpers::get_stripe_mode(); foreach ( Helpers::CONNECTION_MODES as $mode ) { $class_names = [ 'wpforms-stripe-connection-status', "wpforms-stripe-connection-status-{$mode}", $current_mode !== $mode ? 'wpforms-hide' : '', ]; $account = $this->connect->get_connected_account( $mode ); $output .= sprintf( '%s
' . sprintf( wp_kses( /* translators: %s - Stripe connect URL. */ __( 'Switch Accounts', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'class' => [], 'style' => [], ], ] ), esc_url( $connect_url ) ); $output .= sprintf( wp_kses( /* translators: %s - Stripe disconnect URL. */ __( 'Disconnect', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'class' => [], ], ] ), esc_url( $disconnect_url ) ) . '
'; return $output; } /** * Disconnected Status setting content. * * @since 1.8.2 * * @param string $mode Stripe mode (e.g. 'live' or 'test'). * * @return string */ protected function get_disconnected_status_content( $mode = '' ) { $connect_url = $this->connect->get_connect_with_stripe_url( $mode ); $connect_button = sprintf( wp_kses( /* translators: %s - WPForms.com Stripe documentation article URL. */ __( 'Securely connect to Stripe with just a few clicks to begin accepting payments! Learn More', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], 'class' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-install-and-use-the-stripe-addon-with-wpforms/#connect-stripe', 'Settings - Payments', 'Stripe Documentation' ) ) ); return sprintf( '', esc_url( $connect_url ), esc_attr__( 'Connect with Stripe', 'wpforms-lite' ), $connect_button ); } /** * Credit Card mode description. * * @since 1.8.2 * * @return string */ private function get_credit_card_field_desc_after() { return '' . sprintf( wp_kses( /* translators: %s - WPForms.com Stripe documentation article URL. */ __( 'Please see our documentation on Stripe Credit Card field modes for full details.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-install-and-use-the-stripe-addon-with-wpforms/#field-modes', 'Settings - Payments', 'Stripe Field Modes' ) ) ) . '
'; } }