: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Helper functions that were deprecated and can be removed in future.
* Get formatted [ id => title ] pages list.
* @todo Move to includes/deprecated.php
* @param array|string $args Array or string of arguments to retrieve pages.
function wpforms_get_pages_list( $args = [] ) {
_deprecated_function( __FUNCTION__, '1.7.9 of the WPForms plugin' );
$args = wp_parse_args( $args, $defaults );
$pages = get_pages( $args );
foreach ( $pages as $page ) {
$title = wpforms_get_post_title( $page );
$depth = count( $page->ancestors );
$list[ $page->ID ] = str_repeat( ' ', $depth * 3 ) . $title;
* Dequeue enqueues by URI list.
* Parts of URI (e.g. filename) is also supported.
* @param array|string $uris List of URIs or individual URI to dequeue.
* @param WP_Scripts|WP_Styles $enqueues Enqueues list to dequeue from.
function wpforms_dequeue_by_uri( $uris, $enqueues ) {
if ( empty( $enqueues->queue ) ) {
foreach ( $enqueues->queue as $handle ) {
if ( empty( $enqueues->registered[ $handle ]->src ) ) {
$src = wp_make_link_relative( $enqueues->registered[ $handle ]->src );
foreach ( (array) $uris as $uri ) {
if ( strpos( $src, $uri ) !== false ) {
wp_dequeue_script( $handle );
* Dequeue scripts by URI list.
* Parts of URI (e.g. filename) is also supported.
* @param array|string $uris List of URIs or individual URI to dequeue.
function wpforms_dequeue_scripts_by_uri( $uris ) {
wpforms_dequeue_by_uri( $uris, wp_scripts() );
* Dequeue styles by URI list.
* Parts of URI (e.g. filename) is also supported.
* @param array|string $uris List of URIs or individual URI to dequeue.
function wpforms_dequeue_styles_by_uri( $uris ) {
wpforms_dequeue_by_uri( $uris, wp_styles() );
* Check if form provided contains Page Break, if so give details.
* @todo It is not used since 1.4.0. Probably, it should be deprecated and suggest using the wpforms_get_pagebreak_details() function.
* @param WP_Post|array $form Form data.
* @return int|bool Pages count or false.
function wpforms_has_pagebreak( $form = false ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
if ( ! wpforms()->is_pro() ) {
if ( is_object( $form ) && ! empty( $form->post_content ) ) {
$form_data = wpforms_decode( $form->post_content );
} elseif ( is_array( $form ) ) {
if ( empty( $form_data['fields'] ) ) {
$fields = $form_data['fields'];
foreach ( $fields as $field ) {
if ( $field['type'] === 'pagebreak' && empty( $field['position'] ) ) {
* Try to find and return a top or bottom Page Break.
* @todo It is not used since 1.4.0. Probably, it should be deprecated and suggest using the wpforms_get_pagebreak_details() function.
* @param WP_Post|array $form Form data.
* @param string|bool $type Type of Page Break fields (top, bottom, pages or false).
function wpforms_get_pagebreak( $form = false, $type = false ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.MaxExceeded
if ( ! wpforms()->is_pro() ) {
if ( is_object( $form ) && ! empty( $form->post_content ) ) {
$form_data = wpforms_decode( $form->post_content );
} elseif ( is_array( $form ) ) {
if ( empty( $form_data['fields'] ) ) {
$fields = $form_data['fields'];
foreach ( $fields as $field ) {
if ( $field['type'] !== 'pagebreak' ) {
$position = ! empty( $field['position'] ) ? $field['position'] : false;
if ( $type === 'pages' && $position !== 'bottom' ) {
} elseif ( $position === $type ) {
if ( ! empty( $pages ) ) {
* Get meta key value for a form field.
* @param int|string $id Field ID.
* @param string $key Meta key.
* @param mixed $form_data Form data array.
function wpforms_get_form_field_meta( $id = '', $key = '', $form_data = '' ) {
if ( empty( $id ) || empty( $key ) || empty( $form_data ) ) {
if ( ! empty( $form_data['fields'][ $id ]['meta'][ $key ] ) ) {
return $form_data['fields'][ $id ]['meta'][ $key ];
* Get an array of all possible provider addons.
function wpforms_get_providers_all() {
'name' => 'ActiveCampaign',
'slug' => 'activecampaign',
'img' => 'addon-icon-activecampaign.png',
'plugin' => 'wpforms-activecampaign/wpforms-activecampaign.php',
'plugin_slug' => 'wpforms-activecampaign',
'img' => 'addon-icon-aweber.png',
'plugin' => 'wpforms-aweber/wpforms-aweber.php',
'plugin_slug' => 'wpforms-aweber',
'name' => 'Campaign Monitor',
'slug' => 'campaign-monitor',
'img' => 'addon-icon-campaign-monitor.png',
'plugin' => 'wpforms-campaign-monitor/wpforms-campaign-monitor.php',
'plugin_slug' => 'wpforms-campaign-monitor',
'img' => 'addon-icon-drip.png',
'plugin' => 'wpforms-drip/wpforms-drip.php',
'plugin_slug' => 'wpforms-drip',
'img' => 'addon-icon-getresponse.png',
'plugin' => 'wpforms-getresponse/wpforms-getresponse.php',
'plugin_slug' => 'wpforms-getresponse',
'img' => 'addon-icon-mailchimp.png',
'plugin' => 'wpforms-mailchimp/wpforms-mailchimp.php',
'plugin_slug' => 'wpforms-mailchimp',
'img' => 'addon-icon-salesforce.png',
'plugin' => 'wpforms-salesforce/wpforms-salesforce.php',
'plugin_slug' => 'wpforms-salesforce',
'img' => 'addon-icon-brevo.png',
'plugin' => 'wpforms-sendinblue/wpforms-sendinblue.php',
'plugin_slug' => 'wpforms-sendinblue',
'img' => 'addon-icon-zapier.png',
'plugin' => 'wpforms-zapier/wpforms-zapier.php',
'plugin_slug' => 'wpforms-zapier',
'img' => 'addon-icon-hubspot.png',
'plugin' => 'wpforms-hubspot/wpforms-hubspot.php',
'plugin_slug' => 'wpforms-hubspot',
'img' => 'addon-icon-convertkit.png',
'plugin' => 'wpforms-convertkit/wpforms-convertkit.php',
'plugin_slug' => 'wpforms-convertkit',