Inventory_Presser_Addon_License_Validator::is_active( string $product_id, string $license_key )
Checks if a license key is active.
On This Page
Parameters Parameters
- $product_id
-
(string) (Required) The post ID of the download on inventorypresser.com.
- $license_key
-
(string) (Required) The license key sold to the user.
Return Return
(bool)
Source Source
File: includes/addon/class-addon-license-validator.php
public static function is_active( $product_id, $license_key ) {
$transient_key = 'invp_addon_' . $product_id;
$response = get_transient( $transient_key );
if ( false === $response ) {
// Cached value is missing, hit inventorypresser.com.
$response = self::api_response( 'check_license', $product_id, $license_key );
set_transient( $transient_key, $response, 24 * HOUR_IN_SECONDS );
}
return isset( $response->license ) && 'valid' === $response->license;
}
Expand full source codeCollapse full source codeView on Github