wooccm_clean

The WooCommerce Checkout Manager wooccm clean function.

Description

wooccm_clean( $string ); 

Parameters (1)

0. $string
The string.

Usage

  1. if ( !function_exists( 'wooccm_clean' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/main.php'; 
  3.  
  4. // The string. 
  5. $string = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wooccm_clean($string); 
  9.  

Defined (1)

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

/includes/classes/main.php  
  1. function wooccm_clean($string) { 
  2. $trim_length = 200; //desired length of text to display 
  3.  
  4. $string = str_replace('-', '', $string); // Replaces all spaces with hyphens. 
  5. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. 
  6. // $string = preg_replace('/\s+/', '', strip_tags($string)); // removes html and spaces 
  7. // $string = preg_replace('/\d/', '', $string); // Replaces multiple hyphens with single one. 
  8.  
  9. return rtrim(substr($string, 0, $trim_length));