: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'wpcf7_pre_construct_contact_form_properties',
'wpcf7_constant_contact_register_property',
* Registers the constant_contact contact form property.
function wpcf7_constant_contact_register_property( $properties, $contact_form ) {
$service = WPCF7_ConstantContact::get_instance();
if ( $service->is_active() ) {
'constant_contact' => array(),
'wpcf7_contact_form_property_constant_contact',
'wpcf7_constant_contact_setup_property',
* Sets up the constant_contact property value. For back-compat, this attempts
* to take over the value from old settings if the property is empty.
function wpcf7_constant_contact_setup_property( $property, $contact_form ) {
if ( ! empty( $property ) ) {
$property = wp_parse_args(
'enable_contact_list' => false,
'contact_lists' => array(),
'enable_contact_list' => true,
'contact_lists' => array(),
if ( $contact_form->initial() ) {
$service_option = (array) WPCF7::get_option( 'constant_contact' );
$property['enable_contact_list'] = ! $contact_form->is_false(
if ( isset( $service_option['contact_lists'] ) ) {
$contact_lists = (array) $service_option['contact_lists'];
$contact_lists_selected = array();
foreach ( $contact_lists as $list ) {
if ( empty( $list['selected'] ) ) {
foreach ( (array) $list['selected'] as $key => $val ) {
if ( ! isset( $contact_lists_selected[$key] ) ) {
$contact_lists_selected[$key] = array();
$contact_lists_selected[$key][] = $list['list_id'];
sprintf( 'wpcf7_contact_form:%d', $contact_form->id() ),
foreach ( $related_keys as $key ) {
if ( ! empty( $contact_lists_selected[$key] ) ) {
$property['contact_lists'] = $contact_lists_selected[$key];
'wpcf7_save_contact_form',
'wpcf7_constant_contact_save_contact_form',
* Saves the constant_contact property value.
function wpcf7_constant_contact_save_contact_form( $contact_form ) {
$service = WPCF7_ConstantContact::get_instance();
if ( ! $service->is_active() ) {
$prop = isset( $_POST['wpcf7-ctct'] )
? (array) $_POST['wpcf7-ctct']
'enable_contact_list' => false,
'contact_lists' => array(),
$contact_form->set_properties( array(
'constant_contact' => $prop,
'wpcf7_constant_contact_editor_panels',
* Builds the editor panel for the constant_contact property.
function wpcf7_constant_contact_editor_panels( $panels ) {
$service = WPCF7_ConstantContact::get_instance();
if ( ! $service->is_active() ) {
$contact_form = WPCF7_ContactForm::get_current();
$contact_form->prop( 'constant_contact' ),
'enable_contact_list' => false,
'contact_lists' => array(),
$editor_panel = static function () use ( $prop, $service ) {
__( "You can set up the Constant Contact integration here. For details, see %s.", 'contact-form-7' )
__( 'https://contactform7.com/constant-contact-integration/', 'contact-form-7' ),
__( 'Constant Contact integration', 'contact-form-7' )
$lists = $service->get_contact_lists();
<h2><?php echo esc_html( __( 'Constant Contact', 'contact-form-7' ) ); ?></h2>
<legend><?php echo $description; ?></legend>
<table class="form-table" role="presentation">
<tr class="<?php echo $prop['enable_contact_list'] ? '' : 'inactive'; ?>">
echo esc_html( __( 'Contact lists', 'contact-form-7' ) );
<legend class="screen-reader-text">
echo esc_html( __( 'Contact lists', 'contact-form-7' ) );
<label for="wpcf7-ctct-enable-contact-list">
<input type="checkbox" name="wpcf7-ctct[enable_contact_list]" id="wpcf7-ctct-enable-contact-list" value="1" <?php checked( $prop['enable_contact_list'] ); ?> />
__( "Add form submitters to your contact lists", 'contact-form-7' )
esc_html( __( 'Select lists to which contacts are added:', 'contact-form-7' ) )
foreach ( $lists as $list ) {
'<li><label><input %1$s /> %2$s</label></li>',
wpcf7_format_atts( array(
'name' => 'wpcf7-ctct[contact_lists][]',
'value' => $list['list_id'],
'checked' => in_array( $list['list_id'], $prop['contact_lists'] ),
esc_html( $list['name'] )
esc_html( __( 'You have no contact list yet.', 'contact-form-7' ) )
'<p><a %1$s>%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
wpcf7_format_atts( array(
'href' => 'https://app.constantcontact.com/pages/contacts/ui#lists',
'rel' => 'external noreferrer noopener',
esc_html( __( 'Manage your contact lists', 'contact-form-7' ) ),
esc_html( __( '(opens in a new tab)', 'contact-form-7' ) )
'title' => __( 'Constant Contact', 'contact-form-7' ),
'callback' => $editor_panel,