bsf_is_license_expiring_soon( string $product_id, int|float $days = 14 )
Returns true if the stored license expires within the given number of days.
Description
Lifetime licenses and products with no stored expiry always return false.
Parameters
- $product_id
-
(string) (Required) Product ID.
- $days
-
(int|float) (Optional) Threshold in days (default 14); non-integer values are cast to int.
Default value: 14
Return
(bool)
Source
File: admin/bsf-core/includes/helpers.php
function bsf_is_license_expiring_soon( $product_id, $days = 14 ) {
$expires = bsf_get_license_expires( $product_id );
if ( empty( $expires ) || 'lifetime' === $expires ) {
return false;
}
$expires_ts = strtotime( $expires );
if ( false === $expires_ts ) {
return false;
}
$now = time();
return $expires_ts > $now && $expires_ts <= ( $now + ( (int) $days * DAY_IN_SECONDS ) );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.29.14 | Introduced. |