monsterinsights_sanitize_html_class

Sanitize HTML Class Names.

Description

(string) monsterinsights_sanitize_html_class( (string) $class = '' ); 

Returns (string)

$class

Parameters (1)

0. $class — Optional. (string) => ''
HTML Class Name(s)

Usage

  1. if ( !function_exists( 'monsterinsights_sanitize_html_class' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/settings/settings-api.php'; 
  3.  
  4. // HTML Class Name(s) 
  5. $class = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = monsterinsights_sanitize_html_class($class); 
  9.  

Defined (1)

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

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_sanitize_html_class( $class = '' ) { 
  2.  
  3. if ( is_string( $class ) ) { 
  4. $class = sanitize_html_class( $class ); 
  5. } else if ( is_array( $class ) ) { 
  6. $class = array_values( array_map( 'sanitize_html_class', $class ) ); 
  7. $class = implode( ' ', array_unique( $class ) ); 
  8.  
  9. return $class; 
  10.