everbox_sanitize_hex_color

Sanitizes a hex color.

Description

everbox_sanitize_hex_color( $color ); 

Parameters (1)

0. $color
The color.

Usage

  1. if ( !function_exists( 'everbox_sanitize_hex_color' ) ) { 
  2. require_once '/inc/extras.php'; 
  3.  
  4. // The color. 
  5. $color = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = everbox_sanitize_hex_color($color); 
  9.  

Defined (1)

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

/inc/extras.php  
  1. function everbox_sanitize_hex_color( $color ) { 
  2. if ( '' === $color || false == $color) { 
  3. return ''; 
  4.  
  5. // 3 or 6 hex digits, or the empty string. 
  6. if ( preg_match('|^#([A-Fa-f0-9]{3}) {1, 2}$|', $color ) ) { 
  7. return $color; 
  8. return null;