You are here

function mp3player_validate_hex in MP3 Player 7.2

Same name and namespace in other branches
  1. 6.2 mp3player.module \mp3player_validate_hex()

Various tests to hex values.

Parameters

$value:

Return value

bool|null|string

1 call to mp3player_validate_hex()
mp3player_player_form_validate in ./mp3player.module
Custom validation function for the system settings form.

File

./mp3player.module, line 537
mp3player main module file.

Code

function mp3player_validate_hex($value) {
  if (strlen($value) != 6) {
    return t('HEX code must be 6 characters long.');
  }
  if (preg_match('/[^0-9a-fA-F]/', $value)) {
    return t('Invalid HEX code submitted');
  }
  return FALSE;
}