wpcf7_sanitize_messages

The Contact Form 7 wpcf7 sanitize messages function.

Description

wpcf7_sanitize_messages( $input, (array) $defaults = array() ); 

Parameters (2)

0. $input
The input.
1. $defaults — Optional. (array) => array()
The defaults.

Usage

  1. if ( !function_exists( 'wpcf7_sanitize_messages' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/contact-form-functions.php'; 
  3.  
  4. // The input. 
  5. $input = null; 
  6.  
  7. // The defaults. 
  8. $defaults = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wpcf7_sanitize_messages($input, $defaults); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/contact-form-functions.php  
  1. function wpcf7_sanitize_messages( $input, $defaults = array() ) { 
  2. $output = array(); 
  3.  
  4. foreach ( wpcf7_messages() as $key => $val ) { 
  5. if ( isset( $input[$key] ) ) { 
  6. $output[$key] = trim( $input[$key] ); 
  7. } elseif ( isset( $defaults[$key] ) ) { 
  8. $output[$key] = $defaults[$key]; 
  9.  
  10. return $output;