: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( $type === 'placeholder' ) {
* @param string $form Form data and settings.
* @param string $type Field type.
* @param string $name Field name.
public function get_field_label( $form, $type, $name = '' ) {
preg_match_all( '/<label>([ \w\S\r\n\t]+?)<\/label>/', $form, $matches );
foreach ( $matches[1] as $match ) {
$match = trim( str_replace( "\n", '', $match ) );
preg_match( '/\[(?:' . preg_quote( $type ) . ') ' . $name . '(?:[ ](.*?))?(?:[\r\n\t ](\/))?\]/', $match, $input_match );
if ( ! empty( $input_match[0] ) ) {
return strip_shortcodes( sanitize_text_field( str_replace( $input_match[0], '', $match ) ) );
$label = sprintf( /* translators: %1$s - field type, %2$s - field name if available. */
esc_html__( '%1$s Field %2$s', 'wpforms-lite' ),
! empty( $name ) ? "($name)" : ''
* Replace 3rd-party form provider tags/shortcodes with our own Smart Tags.
* @param string $string Text to look for Smart Tags in.
* @param array $fields List of fields to process Smart Tags in.
public function get_smarttags( $string, $fields ) {
preg_match_all( '/\[(.+?)\]/', $string, $tags );
if ( empty( $tags[1] ) ) {
// Process form-tags and mail-tags.
foreach ( $tags[1] as $tag ) {
foreach ( $fields as $field ) {
if ( ! empty( $field['cf7_name'] ) && $field['cf7_name'] === $tag ) {
$string = str_replace( '[' . $tag . ']', '{field_id="' . $field['id'] . '"}', $string );
// Process CF7 tags that we can map with WPForms alternatives.
// Replace those CF7 that are used in Notifications by default and that we can't leave empty.
get_bloginfo( 'description' ),
* We are not replacing certain special CF7 tags: [_user_url], [_post_name], [_time], [_user_agent].
* Without them some logic may be broken and for user it will be harder to stop missing strings.
* With them - they can see strange text and will be able to understand, based on the tag name, which value is expected there.
* Find Reply-To in headers if provided.
* @param string $headers CF7 email headers.
* @param array $fields List of fields.
public function get_replyto( $headers, $fields ) {
if ( strpos( $headers, 'Reply-To:' ) !== false ) {
preg_match( '/Reply-To: \[(.+?)\]/', $headers, $tag );
if ( ! empty( $tag[1] ) ) {
foreach ( $fields as $field ) {
if ( ! empty( $field['cf7_name'] ) && $field['cf7_name'] === $tag[1] ) {
return '{field_id="' . $field['id'] . '"}';
* @param string $sender Sender strings in "Name <email@example.com>" format.
* @param array $fields List of fields.
public function get_sender_details( $sender, $fields ) {
preg_match( '/(.+?)\<(.+?)\>/', $sender, $tag );
if ( ! empty( $tag[1] ) && ! empty( $tag[2] ) ) {
'name' => $this->get_smarttags( $tag[1], $fields ),
'address' => $this->get_smarttags( $tag[2], $fields ),