wpcf7_sanitize_query_var

The Contact Form 7 wpcf7 sanitize query var function.

Description

wpcf7_sanitize_query_var( $text ); 

Parameters (1)

0. $text
The text.

Usage

  1. if ( !function_exists( 'wpcf7_sanitize_query_var' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/formatting.php'; 
  3.  
  4. // The text. 
  5. $text = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_sanitize_query_var($text); 
  9.  

Defined (1)

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

/includes/formatting.php  
  1. function wpcf7_sanitize_query_var( $text ) { 
  2. $text = wp_unslash( $text ); 
  3. $text = wp_check_invalid_utf8( $text ); 
  4.  
  5. if ( false !== strpos( $text, '<' ) ) { 
  6. $text = wp_pre_kses_less_than( $text ); 
  7. $text = wp_strip_all_tags( $text ); 
  8.  
  9. $text = preg_replace( '/%[a-f0-9]{2}/i', '', $text ); 
  10. $text = preg_replace( '/ +/', ' ', $text ); 
  11. $text = trim( $text, ' ' ); 
  12.  
  13. return $text;