ram 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;
}
}