: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Sanitizes content for allowed HTML tags for the specified context.
* @param string $input Content to filter.
* @param string $context Context used to decide allowed tags and attributes.
* @return string Filtered text with allowed HTML tags and attributes intact.
function wpcf7_kses( $input, $context = 'form' ) {
wpcf7_kses_allowed_html( $context )
* Returns a formatted string of HTML attributes.
* @param array $atts Associative array of attribute name and value pairs.
* @return string Formatted HTML attributes.
function wpcf7_format_atts( $atts ) {
$atts_filtered = array();
foreach ( $atts as $name => $value ) {
$name = strtolower( trim( $name ) );
if ( ! preg_match( '/^[a-z_:][a-z_:.0-9-]*$/', $name ) ) {
static $boolean_attributes = array(
if ( in_array( $name, $boolean_attributes ) and '' === $value ) {
if ( is_numeric( $value ) ) {
$value = (string) $value;
if ( null === $value or false === $value ) {
unset( $atts_filtered[$name] );
} elseif ( true === $value ) {
$atts_filtered[$name] = $name; // boolean attribute
} elseif ( is_string( $value ) ) {
$atts_filtered[$name] = trim( $value );
foreach ( $atts_filtered as $name => $value ) {
$output .= sprintf( ' %1$s="%2$s"', $name, esc_attr( $value ) );