You are here

function _validate_keys_string in Shadowbox 6

Same name and namespace in other branches
  1. 5.2 shadowbox.module \_validate_keys_string()
  2. 5 shadowbox.module \_validate_keys_string()
  3. 6.4 shadowbox.module \_validate_keys_string()
  4. 6.2 shadowbox.module \_validate_keys_string()
  5. 6.3 shadowbox.module \_validate_keys_string()
  6. 7.4 shadowbox.admin.inc \_validate_keys_string()
  7. 7.3 shadowbox.admin.inc \_validate_keys_string()

Validate a delimited string of keys and/or keycodes.

Parameters

$input: A delimited string of keys and/or keycodes to validate.

Return value

TRUE if $input is valid otherwise FALSE.

1 call to _validate_keys_string()
shadowbox_admin_settings_validate in ./shadowbox.module
Validate admin settings form inputs.

File

./shadowbox.module, line 630
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialog.

Code

function _validate_keys_string($input) {
  foreach (explode(' ', $input) as $value) {
    preg_match('!^(?:[a-z]|\\d{1,3})$!i', $value) ? $items[] = TRUE : ($items[] = FALSE);
  }
  in_array(FALSE, $items) ? $return = TRUE : ($return = FALSE);
  return $return;
}