: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'default' => esc_html__( 'Field values do not match.', 'wpforms-lite' ),
'validation-inputmask-incomplete' => [
'id' => 'validation-inputmask-incomplete',
'name' => esc_html__( 'Input Mask Incomplete', 'wpforms-lite' ),
'default' => esc_html__( 'Please fill out the field in required format.', 'wpforms-lite' ),
'validation-check-limit' => [
'id' => 'validation-check-limit',
'name' => esc_html__( 'Checkbox Selection Limit', 'wpforms-lite' ),
'default' => esc_html__( 'You have exceeded the number of allowed selections: {#}.', 'wpforms-lite' ),
'validation-character-limit' => [
'id' => 'validation-character-limit',
'name' => esc_html__( 'Character Limit', 'wpforms-lite' ),
'default' => sprintf( /* translators: %1$s - characters limit, %2$s - number of characters left. */
esc_html__( 'Limit is %1$s characters. Characters remaining: %2$s.', 'wpforms-lite' ),
'validation-word-limit' => [
'id' => 'validation-word-limit',
'name' => esc_html__( 'Word Limit', 'wpforms-lite' ),
'default' => sprintf( /* translators: %1$s - words limit, %2$s - number of words left. */
esc_html__( 'Limit is %1$s words. Words remaining: %2$s.', 'wpforms-lite' ),
'validation-requiredpayment' => [
'id' => 'validation-requiredpayment',
'name' => esc_html__( 'Payment Required', 'wpforms-lite' ),
'default' => esc_html__( 'Payment is required.', 'wpforms-lite' ),
'validation-creditcard' => [
'id' => 'validation-creditcard',
'name' => esc_html__( 'Credit Card', 'wpforms-lite' ),
'default' => esc_html__( 'Please enter a valid credit card number.', 'wpforms-lite' ),
// Provider integrations settings tab.
'integrations-heading' => [
'id' => 'integrations-heading',
'content' => '<h4>' . esc_html__( 'Integrations', 'wpforms-lite' ) . '</h4><p>' . esc_html__( 'Manage integrations with popular providers such as Constant Contact, Mailchimp, Zapier, and more.', 'wpforms-lite' ) . '</p>',
'class' => [ 'section-heading' ],
'integrations-providers' => [
'id' => 'integrations-providers',
'content' => '<h4>' . esc_html__( 'Integrations', 'wpforms-lite' ) . '</h4><p>' . esc_html__( 'Manage integrations with popular providers such as Constant Contact, Mailchimp, Zapier, and more.', 'wpforms-lite' ) . '</p>',
'content' => '<h4>' . esc_html__( 'Miscellaneous', 'wpforms-lite' ) . '</h4>',
'class' => [ 'section-heading', 'no-desc' ],
'hide-announcements' => [
'id' => 'hide-announcements',
'name' => esc_html__( 'Hide Announcements', 'wpforms-lite' ),
'desc' => esc_html__( 'Hide plugin announcements and update details.', 'wpforms-lite' ),
'id' => 'hide-admin-bar',
'name' => esc_html__( 'Hide Admin Bar Menu', 'wpforms-lite' ),
'desc' => esc_html__( 'Hide the WPForms admin bar menu.', 'wpforms-lite' ),
'id' => 'uninstall-data',
'name' => esc_html__( 'Uninstall WPForms', 'wpforms-lite' ),
'desc' => $this->get_uninstall_desc(),
$defaults = apply_filters( 'wpforms_settings_defaults', $defaults );
// Take care of invalid views.
if ( ! empty( $view ) && ! array_key_exists( $view, $defaults ) ) {
$this->view = key( $defaults );
return reset( $defaults );
return empty( $view ) ? $defaults : $defaults[ $view ];
* Get uninstall description.
private function get_uninstall_desc() {
$desc = esc_html__( 'Remove ALL WPForms data upon plugin deletion.', 'wpforms-lite' );
$warning = esc_html__( 'All forms and settings will be unrecoverable.', 'wpforms-lite' );
if ( wpforms()->is_pro() ) {
$desc = esc_html__( 'Remove ALL WPForms data upon plugin deletion.', 'wpforms-lite' );
$warning = esc_html__( 'All forms, entries, and uploaded files will be unrecoverable.', 'wpforms-lite' );
return sprintf( '%s <span class="wpforms-settings-warning">%s</span>', $desc, $warning );
* Return array containing markup for all the appropriate settings fields.
* @param string $view View slug.
public function get_settings_fields( $view = '' ) {
$settings = $this->get_registered_settings( $view );
foreach ( $settings as $id => $args ) {
$fields[ $id ] = wpforms_settings_output_field( $args );
return apply_filters( 'wpforms_settings_fields', $fields, $view );
* Build the output for the plugin settings page.
public function output() {
$tabs = $this->get_tabs();
$fields = $this->get_settings_fields( $this->view );
<div id="wpforms-settings" class="wrap wpforms-admin-wrap">
<h1 class="wpforms-h1-placeholder"></h1>
if ( wpforms()->is_pro() && class_exists( 'WPForms_License', false ) ) {
wpforms()->get( 'license' )->notices( true );
<div class="wpforms-admin-content wpforms-admin-settings wpforms-admin-content-<?php echo esc_attr( $this->view ); ?> wpforms-admin-settings-<?php echo esc_attr( $this->view ); ?>">
// Some tabs rely on AJAX and do not contain a form, such as Integrations.
if ( ! empty( $tabs[ $this->view ]['form'] ) ) :
<form class="wpforms-admin-settings-form" method="post">
<input type="hidden" name="action" value="update-settings">
<input type="hidden" name="view" value="<?php echo esc_attr( $this->view ); ?>">
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'wpforms-settings-nonce' ) ); ?>">
<?php do_action( 'wpforms_admin_settings_before', $this->view, $fields ); ?>
foreach ( $fields as $field ) {
echo $field; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
<?php if ( ! empty( $tabs[ $this->view ]['submit'] ) ) : ?>
<button type="submit" class="wpforms-btn wpforms-btn-md wpforms-btn-orange" name="wpforms-settings-submit">
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $tabs[ $this->view ]['submit'];
<?php do_action( 'wpforms_admin_settings_after', $this->view, $fields ); ?>
<?php if ( ! empty( $tabs[ $this->view ]['form'] ) ) : ?>
* Monitor that all custom tables exist and recreate if missing.
* This logic works on Settings > General page only.
public function monitor_custom_tables() {
// Proceed on Settings plugin admin area page only.
if ( $this->view !== 'general' ) {
$meta = new \WPForms\Tasks\Meta();
if ( $meta->table_exists() ) {
* Validate radio and select fields.
* @param array $field Field.
* @param mixed $value Value.
* @param mixed $value_prev Previous value.
private function validate_field_with_options( $field, $value, $value_prev ) {
$value = sanitize_text_field( $value );
if ( isset( $field['options'] ) && array_key_exists( $value, $field['options'] ) ) {
return isset( $field['default'] ) ? $field['default'] : $value_prev;