Kirki_Color::sanitize_hex PHP Метод

sanitize_hex() публичный статический Метод

A proxy for the sanitize_color method.
public static sanitize_hex ( string | array $color = '#FFFFFF', boolean $hash = true ) : string
$color string | array The color.
$hash boolean Whether we want to include a hash (#) at the beginning or not.
Результат string The sanitized hex color.
        public static function sanitize_hex($color = '#FFFFFF', $hash = true)
        {
            if (!$hash) {
                return ltrim(self::sanitize_color($color, 'hex'), '#');
            }
            return self::sanitize_color($color, 'hex');
        }

Usage Example

Пример #1
0
 /**
  * Returns an array properly formatted for use by the Kirki_Palette control.
  *
  * @param 	$palettes_nr	int		the number of palettes we want to get
  * @return array
  */
 public static function get_palettes($palettes_nr = 5)
 {
     $palettes = self::parse();
     $palettes = array_slice($palettes, 0, $palettes_nr);
     $i = 0;
     foreach ($palettes as $palette) {
         $palettes[$i] = array();
         foreach ($palette as $key => $value) {
             $palettes[$i][$key] = Kirki_Color::sanitize_hex($value);
         }
         $i++;
     }
     return $palettes;
 }
All Usage Examples Of Kirki_Color::sanitize_hex