wpcf7_canonicalize

The Contact Form 7 wpcf7 canonicalize function.

Description

wpcf7_canonicalize( $text, (string) $strto = 'lower' ); 

Parameters (2)

0. $text
The text.
1. $strto — Optional. (string) => 'lower'
The strto.

Usage

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

Defined (1)

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

/includes/formatting.php  
  1. function wpcf7_canonicalize( $text, $strto = 'lower' ) { 
  2. if ( function_exists( 'mb_convert_kana' ) 
  3. && 'UTF-8' == get_option( 'blog_charset' ) ) { 
  4. $text = mb_convert_kana( $text, 'asKV', 'UTF-8' ); 
  5.  
  6. if ( 'lower' == $strto ) { 
  7. $text = strtolower( $text ); 
  8. } elseif ( 'upper' == $strto ) { 
  9. $text = strtoupper( $text ); 
  10.  
  11. $text = trim( $text ); 
  12. return $text;