$required, $field ) { return $field['type'] === $this->type ? true : $required; } /** * Enqueue assets for the builder. * * @since 1.8.2 * * @param string $view Current view. */ public function builder_enqueues( $view ) { $min = wpforms_get_min_suffix(); wp_enqueue_style( 'wpforms-builder-stripe-card-field', WPFORMS_PLUGIN_URL . "assets/css/integrations/stripe/builder-stripe{$min}.css", [], WPFORMS_VERSION ); wp_enqueue_script( 'wpforms-builder-stripe-card-field', WPFORMS_PLUGIN_URL . "assets/js/integrations/stripe/admin-builder-stripe-card-field{$min}.js", [ 'jquery', 'wpforms-builder' ], WPFORMS_VERSION, true ); wp_localize_script( 'wpforms-builder-stripe-card-field', 'wpforms_builder_stripe_card_field', [ 'field_slug' => Helpers::get_field_slug(), ] ); } /** * Add our localized strings to be available in the form builder. * * @since 1.8.2 * * @param array $strings Form builder JS strings. * @param array $form Form data. * * @return array */ public function builder_js_strings( $strings, $form ) { $strings['stripe_ajax_required'] = wp_kses( __( '

AJAX form submissions are required when using the Stripe Credit Card field.

To proceed, please go to Settings » General » Advanced and check Enable AJAX form submission.

', 'wpforms-lite' ), [ 'p' => [], 'strong' => [], ] ); $strings['stripe_keys_required'] = wp_kses( __( '

Stripe account connection is required when using the Stripe Credit Card field.

To proceed, please go to WPForms Settings » Payments » Stripe and press Connect with Stripe button.

', 'wpforms-lite' ), [ 'p' => [], 'strong' => [], ] ); $strings['payments_enabled_required'] = wp_kses( __( '

Stripe Payments must be enabled when using the Stripe Credit Card field.

To proceed, please go to Payments » Stripe and check Enable Stripe payments.

', 'wpforms-lite' ), [ 'p' => [], 'strong' => [], ] ); return $strings; } /** * Define additional "Add Field" button attributes. * * @since 1.8.2 * * @param array $attributes Button attributes. * @param array $field Field settings. * @param array $form_data Form data and settings. * * @return array */ public function field_button_attributes( $attributes, $field, $form_data ) { if ( Helpers::get_field_slug() !== $field['type'] ) { return $attributes; } if ( Helpers::has_stripe_field( $form_data ) ) { $attributes['atts']['disabled'] = 'true'; return $attributes; } if ( ! Helpers::has_stripe_keys() ) { $attributes['class'][] = 'warning-modal'; $attributes['class'][] = 'stripe-keys-required'; } return $attributes; } /** * Currently validation happens on the front end. We do not do * generic server-side validation because we do not allow the card * details to POST to the server. * * @since 1.8.2 * * @param int $field_id Field ID. * @param array $field_submit Submitted field value. * @param array $form_data Form data and settings. */ public function validate( $field_id, $field_submit, $form_data ) { } /** * Format field. * * @since 1.8.2 * * @param int $field_id Field ID. * @param array $field_submit Submitted field value. * @param array $form_data Form data and settings. */ public function format( $field_id, $field_submit, $form_data ) { // Define data. $name = ! empty( $form_data['fields'][ $field_id ]['label'] ) ? $form_data['fields'][ $field_id ]['label'] : ''; // Set final field details. wpforms()->get( 'process' )->fields[ $field_id ] = [ 'name' => sanitize_text_field( $name ), 'value' => '', 'id' => absint( $field_id ), 'type' => $this->type, ]; } /** * The field value availability for the entry preview field. * * @since 1.8.2 * * @param bool $is_supported The field availability. * @param string $value The submitted Credit Card detail. * @param array $field Field data. * @param array $form_data Form data. * * @return bool */ public function entry_preview_availability( $is_supported, $value, $field, $form_data ) { return ! empty( $value ) && $value !== '-'; } /** * Maybe display errors before field. * * @since 1.8.2 * * @param array $form_data Form data and settings. * * @return bool */ private function field_display_errors( $form_data ) { // Display warning for non SSL pages. if ( ! is_ssl() ) { echo '
'; esc_html_e( 'This page is insecure. Credit Card field should be used for testing purposes only.', 'wpforms-lite' ); echo '
'; } if ( ! Helpers::has_stripe_keys() ) { echo '
'; esc_html_e( 'Credit Card field is disabled, Stripe keys are missing.', 'wpforms-lite' ); echo '
'; return true; } if ( ! Helpers::has_stripe_enabled( [ $form_data ] ) ) { echo '
'; esc_html_e( 'Credit Card field is disabled, Stripe payments are not enabled in the form settings.', 'wpforms-lite' ); echo '
'; return true; } return false; } /** * Checking if block editor is loaded. * * @since 1.8.2 * * @return bool True if is block editor. */ private function is_block_editor() { // phpcs:disable WordPress.Security.NonceVerification $is_gutenberg = defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && $_REQUEST['context'] === 'edit'; $is_elementor = ( ! empty( $_POST['action'] ) && $_POST['action'] === 'elementor_ajax' ) || ( ! empty( $_GET['action'] ) && $_GET['action'] === 'elementor' ); $is_divi = ! empty( $_GET['et_fb'] ) || ( ! empty( $_POST['action'] ) && $_POST['action'] === 'wpforms_divi_preview' ); // phpcs:enable WordPress.Security.NonceVerification return $is_gutenberg || $is_elementor || $is_divi; } }
Fatal error: Trait "WPForms\Integrations\Stripe\Fields\Traits\CreditCard" not found in /htdocs/wp-content/plugins/wpforms-lite/src/Integrations/Stripe/Fields/StripeCreditCard.php on line 13