: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/help-tabs.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/tag-generator.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/welcome-panel.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/config-validator.php';
do_action( 'wpcf7_admin_init' );
function wpcf7_admin_menu() {
do_action( 'wpcf7_admin_menu' );
__( 'Contact Form 7', 'contact-form-7' ),
__( 'Contact', 'contact-form-7' )
. wpcf7_admin_menu_change_notice(),
'wpcf7_read_contact_forms',
'wpcf7_admin_management_page',
$edit = add_submenu_page( 'wpcf7',
__( 'Edit Contact Form', 'contact-form-7' ),
__( 'Contact Forms', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7' ),
'wpcf7_read_contact_forms',
'wpcf7_admin_management_page'
add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin', 10, 0 );
$addnew = add_submenu_page( 'wpcf7',
__( 'Add New Contact Form', 'contact-form-7' ),
__( 'Add New', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7-new' ),
'wpcf7_edit_contact_forms',
'wpcf7_admin_add_new_page'
add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin', 10, 0 );
$integration = WPCF7_Integration::get_instance();
if ( $integration->service_exists() ) {
$integration = add_submenu_page( 'wpcf7',
__( 'Integration with External API', 'contact-form-7' ),
__( 'Integration', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7-integration' ),
'wpcf7_manage_integration',
'wpcf7_admin_integration_page'
add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 );
function wpcf7_admin_menu_change_notice( $menu_slug = '' ) {
$counts = apply_filters( 'wpcf7_admin_menu_change_notice',
'wpcf7-integration' => 0,
if ( empty( $menu_slug ) ) {
$count = absint( array_sum( $counts ) );
} elseif ( isset( $counts[$menu_slug] ) ) {
$count = absint( $counts[$menu_slug] );
' <span class="update-plugins %1$d"><span class="plugin-count">%2$s</span></span>',
esc_html( number_format_i18n( $count ) )
'wpcf7_admin_enqueue_scripts',
function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
if ( false === strpos( $hook_suffix, 'wpcf7' ) ) {
wp_enqueue_style( 'contact-form-7-admin',
wpcf7_plugin_url( 'admin/css/styles.css' ),
array(), WPCF7_VERSION, 'all'
wp_enqueue_style( 'contact-form-7-admin-rtl',
wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
array(), WPCF7_VERSION, 'all'
wp_enqueue_script( 'wpcf7-admin',
wpcf7_plugin_url( 'admin/js/scripts.js' ),
array( 'jquery', 'jquery-ui-tabs' ),
array( 'in_footer' => true )
'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ),
'namespace' => 'contact-form-7/v1',
'nonce' => ( wp_installing() && ! is_multisite() )
? '' : wp_create_nonce( 'wp_rest' ),
'pluginUrl' => wpcf7_plugin_url(),
"The changes you made will be lost if you navigate away from this page.",
'activeTab' => (int) ( $_GET['active-tab'] ?? 0 ),
'configValidator' => array(
'howToCorrect' => __( "How to resolve?", 'contact-form-7' ),
'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
/* translators: screen reader text */
'iconAlt' => __( '(configuration error)', 'contact-form-7' ),
if ( $post = wpcf7_get_current_contact_form()
and current_user_can( 'wpcf7_edit_contact_form', $post->id() )
and wpcf7_validate_configuration() ) {
$config_validator = new WPCF7_ConfigValidator( $post );
$config_validator->restore();
$l10n['configValidator']['errors'] =
$config_validator->collect_error_messages();
wp_localize_script( 'wpcf7-admin', 'wpcf7', $l10n );
wp_enqueue_script( 'wpcf7-admin-taggenerator',
wpcf7_plugin_url( 'admin/js/tag-generator.js' ),
array( 'jquery', 'thickbox', 'wpcf7-admin' ),
array( 'in_footer' => true )
'set_screen_option_wpcf7_contact_forms_per_page',
static function ( $result, $option, $value ) {
'wpcf7_contact_forms_per_page',
if ( in_array( $option, $wpcf7_screens ) ) {
function wpcf7_load_contact_form_admin() {
$action = wpcf7_current_action();
do_action( 'wpcf7_admin_load',
trim( $_GET['page'] ?? '' ),
if ( 'save' === $action ) {
$id = $_POST['post_ID'] ?? '-1';
check_admin_referer( 'wpcf7-save-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
__( "You are not allowed to edit this item.", 'contact-form-7' )
$contact_form = wpcf7_save_contact_form(
'title' => $_POST['post_title'] ?? null,
'locale' => $_POST['wpcf7-locale'] ?? null,
'form' => $_POST['wpcf7-form'] ?? '',
'mail' => $_POST['wpcf7-mail'] ?? array(),
'mail_2' => $_POST['wpcf7-mail-2'] ?? array(),
'messages' => $_POST['wpcf7-messages'] ?? array(),
'additional_settings' => $_POST['wpcf7-additional-settings'] ?? '',
if ( $contact_form and wpcf7_validate_configuration() ) {
$config_validator = new WPCF7_ConfigValidator( $contact_form );
$config_validator->validate();
$config_validator->save();
'post' => $contact_form ? $contact_form->id() : 0,
'active-tab' => (int) ( $_POST['active-tab'] ?? 0 ),
$query['message'] = 'failed';
$query['message'] = 'created';
$query['message'] = 'saved';
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
if ( 'copy' === $action ) {
$id = absint( $_POST['post_ID'] ?? $_REQUEST['post'] ?? '' );
check_admin_referer( 'wpcf7-copy-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
__( "You are not allowed to edit this item.", 'contact-form-7' )
if ( $contact_form = wpcf7_contact_form( $id ) ) {
$new_contact_form = $contact_form->copy();
$new_contact_form->save();
$query['post'] = $new_contact_form->id();
$query['message'] = 'created';
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
if ( 'delete' === $action ) {
if ( ! empty( $_POST['post_ID'] ) ) {
check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] );
} elseif ( ! is_array( $_REQUEST['post'] ) ) {
check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] );
check_admin_referer( 'bulk-posts' );
$posts = (array) ( $_POST['post_ID'] ?? $_REQUEST['post'] ?? array() );
foreach ( $posts as $post ) {
$post = WPCF7_ContactForm::get_instance( $post );
if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) {
__( "You are not allowed to delete this item.", 'contact-form-7' )
if ( ! $post->delete() ) {
wp_die( __( "Error in deleting.", 'contact-form-7' ) );
if ( ! empty( $deleted ) ) {
$query['message'] = 'deleted';
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
if ( 'wpcf7-new' === $plugin_page ) {
$post = WPCF7_ContactForm::get_template( array(
'locale' => $_GET['locale'] ?? null,
} elseif ( ! empty( $_GET['post'] ) ) {
$post = WPCF7_ContactForm::get_instance( $_GET['post'] );
$current_screen = get_current_screen();
$help_tabs = new WPCF7_Help_Tabs( $current_screen );
and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) {
$help_tabs->set_help_tabs( 'edit' );
$help_tabs->set_help_tabs( 'list' );
if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) ) {
require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php';
'manage_' . $current_screen->id . '_columns',
array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ),
add_screen_option( 'per_page', array(
'option' => 'wpcf7_contact_forms_per_page',
function wpcf7_admin_management_page() {
if ( $post = wpcf7_get_current_contact_form() ) {
$post_id = $post->initial() ? -1 : $post->id();
require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
if ( 'validate' == wpcf7_current_action()
and wpcf7_validate_configuration()
and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
wpcf7_admin_bulk_validate_page();
$list_table = new WPCF7_Contact_Form_List_Table();
$list_table->prepare_items();
<div class="wrap" id="wpcf7-contact-form-list-table">
<h1 class="wp-heading-inline"><?php
echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
menu_page_url( 'wpcf7-new', false ),
__( 'Add New', 'contact-form-7' ),
array( 'class' => 'page-title-action' )
if ( ! empty( $_REQUEST['s'] ) ) {
'<span class="subtitle">'
/* translators: %s: search keywords */
. __( 'Search results for “%s”', 'contact-form-7' )
esc_html( $_REQUEST['s'] )
<hr class="wp-header-end">
do_action( 'wpcf7_admin_warnings',
'wpcf7', wpcf7_current_action(), null
do_action( 'wpcf7_admin_notices',
'wpcf7', wpcf7_current_action(), null
<form method="get" action="">
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
<?php $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); ?>
<?php $list_table->display(); ?>
function wpcf7_admin_add_new_page() {
$post = wpcf7_get_current_contact_form();
$post = WPCF7_ContactForm::get_template();
require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
function wpcf7_load_integration_page() {
do_action( 'wpcf7_admin_load',
trim( $_GET['page'] ?? '' ),
$integration = WPCF7_Integration::get_instance();
if ( isset( $_REQUEST['service'] )
and $integration->service_exists( $_REQUEST['service'] ) ) {
$service = $integration->get_service( $_REQUEST['service'] );
$service->load( wpcf7_current_action() );
$help_tabs = new WPCF7_Help_Tabs( get_current_screen() );
$help_tabs->set_help_tabs( 'integration' );
function wpcf7_admin_integration_page() {
$integration = WPCF7_Integration::get_instance();
$service = isset( $_REQUEST['service'] )
? $integration->get_service( $_REQUEST['service'] )
<div class="wrap" id="wpcf7-integration">
<h1><?php echo esc_html( __( 'Integration with External API', 'contact-form-7' ) ); ?></h1>
/* translators: %s: link labeled 'Integration with external APIs' */
esc_html( __( "You can expand the possibilities of your contact forms by integrating them with external services. For details, see %s.", 'contact-form-7' ) ),
__( 'https://contactform7.com/integration-with-external-apis/', 'contact-form-7' ),
__( 'Integration with external APIs', 'contact-form-7' )
do_action( 'wpcf7_admin_warnings',