function _valid_card_start in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_credit/uc_credit.module \_valid_card_start()
Validates a start date on a card.
Parameters
$month: The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12.
$year: The 4-digit numeric representation of the year, i.e. 2008.
Return value
TRUE for cards whose start date is blank (both month and year) or in the past, FALSE otherwise.
1 call to _valid_card_start()
- uc_payment_method_credit in payment/
uc_credit/ uc_credit.module
File
- payment/
uc_credit/ uc_credit.module, line 1708 - Defines the credit card payment method and hooks in payment gateways.
Code
function _valid_card_start($month, $year) {
if (empty($month) && empty($year)) {
return TRUE;
}
if (empty($month) || empty($year)) {
return FALSE;
}
if ($year > date('Y')) {
return FALSE;
}
else {
if ($year == date('Y')) {
if ($month > date('n')) {
return FALSE;
}
}
}
return TRUE;
}