wpcf7_is_name

Check whether a string is a valid NAME token.

Description

wpcf7_is_name( $string ); 

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Parameters (1)

0. $string
The string.

Usage

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

Defined (1)

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

/includes/formatting.php  
  1. function wpcf7_is_name( $string ) { 
  2. return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );