Server : LiteSpeed
System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64
User : gazetufm ( 1431)
PHP Version : 8.1.35
Disable Function : NONE
Directory :  /home2/gazetufm/leonora.al/wp-content/plugins/wpforms-lite/src/Integrations/Drip/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: Helpers.php

Path: //home2/gazetufm/leonora.al/wp-content/plugins/wpforms-lite/src/Integrations/Drip/Helpers.php

Size: 1.98 KB

Permissions: 0644

<?php

namespace WPForms\Integrations\Drip;

/**
 * Drip integration helpers.
 *
 * @since 2.0.5
 */
class Helpers {

	/**
	 * Sanitize a custom field identifier the way Drip accepts it: latin letters, digits and
	 * underscores, with whitespace runs collapsed into one underscore.
	 *
	 * @since 2.0.5
	 *
	 * @param string $name Field name as typed in the builder.
	 *
	 * @return string
	 */
	public static function sanitize_field_id( string $name ): string {

		$name = preg_replace( '/[^A-Za-z0-9_ ]/', '', trim( $name ) );

		return preg_replace( '/\s+/', '_', $name );
	}

	/**
	 * Sanitize an API token: whitespace and quotes go, letter case stays.
	 *
	 * @since 2.0.5
	 *
	 * @param string $token Token as pasted by the user.
	 *
	 * @return string
	 */
	public static function sanitize_api_token( string $token ): string {

		return wpforms_sanitize_key( $token );
	}

	/**
	 * Get the Drip custom fields offered in the builder before the user types their own.
	 *
	 * @since 2.0.5
	 *
	 * @return array Field identifier => label.
	 */
	public static function get_predefined_custom_fields(): array {

		$fields = [
			'first_name' => __( 'First name', 'wpforms-lite' ),
			'last_name'  => __( 'Last name', 'wpforms-lite' ),
			'address1'   => __( 'Address line 1', 'wpforms-lite' ),
			'address2'   => __( 'Address line 2', 'wpforms-lite' ),
			'city'       => __( 'City', 'wpforms-lite' ),
			'state'      => __( 'State', 'wpforms-lite' ),
			'zip'        => __( 'ZIP', 'wpforms-lite' ),
			'country'    => __( 'Country', 'wpforms-lite' ),
			'phone'      => __( 'Phone', 'wpforms-lite' ),
			'sms_number' => __( 'SMS number', 'wpforms-lite' ),
		];

		/**
		 * Filter the predefined Drip custom fields.
		 *
		 * @since 2.0.5
		 *
		 * @param array $fields Field identifier => label.
		 */
		return (array) apply_filters( 'wpforms_drip_provider_form_builder_get_custom_fields', $fields ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName -- Preserved from the Drip addon for backward compatibility.
	}
}

← Back to Directory Edit File 🔒 Chmod

WP File Manager