wpcf7_enctype_value

The Contact Form 7 wpcf7 enctype value function.

Description

wpcf7_enctype_value( $enctype ); 

Parameters (1)

0. $enctype
The enctype.

Usage

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

Defined (1)

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

/includes/functions.php  
  1. function wpcf7_enctype_value( $enctype ) { 
  2. $enctype = trim( $enctype ); 
  3.  
  4. if ( empty( $enctype ) ) { 
  5. return ''; 
  6.  
  7. $valid_enctypes = array( 
  8. 'application/x-www-form-urlencoded',  
  9. 'multipart/form-data',  
  10. 'text/plain',  
  11. ); 
  12.  
  13. if ( in_array( $enctype, $valid_enctypes ) ) { 
  14. return $enctype; 
  15.  
  16. $pattern = '%^enctype="(' . implode( '|', $valid_enctypes ) . ')"$%'; 
  17.  
  18. if ( preg_match( $pattern, $enctype, $matches ) ) { 
  19. return $matches[1]; // for back-compat 
  20.  
  21. return '';