You are here

function _commerce_file_is_integer_or_zero in Commerce File 7

Returns TRUE if value is a positive integer or 0

See also

element_validate_integer_positive()

3 calls to _commerce_file_is_integer_or_zero()
commerce_file_limit_integer_element_validate in includes/commerce_file.elements.inc
FAPI element validate callback for limit textfield element type.
_commerce_file_element_validate_integer_positive_or_zero in ./commerce_file.module
Validate an element value as a positive integer or zero
_commerce_file_metadata_validate_limit_integer_positive_or_zero in ./commerce_file.module
Returns TRUE if value is a postive integer, 0, unlimited, or inherited

File

./commerce_file.module, line 1510
Provides integration of file licenses with Commerce

Code

function _commerce_file_is_integer_or_zero($value) {
  $invalid = $value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0);
  return !$invalid;
}