feat: Add localhost license bypass for development
All checks were successful
Create Release Package / build-release (push) Successful in 1m2s

- License check bypassed on localhost, 127.0.0.1, ::1
- Also bypassed for .local, .test, .localhost, .dev.local TLDs
- Bump version to 0.5.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 20:50:06 +01:00
parent df3b8a7ec2
commit 0627dd0db7
4 changed files with 48 additions and 4 deletions

View File

@@ -421,15 +421,50 @@ final class Manager {
/**
* Check if the license is currently valid.
*
* Uses cached status for performance.
* Uses cached status for performance. Bypasses license check on localhost.
*
* @return bool
*/
public static function is_license_valid(): bool {
// Bypass license check on localhost for development.
if ( self::is_localhost() ) {
return true;
}
$status = get_option( self::OPTION_LICENSE_STATUS, 'unchecked' );
return 'valid' === $status;
}
/**
* Check if the current site is running on localhost.
*
* @return bool
*/
public static function is_localhost(): bool {
$host = wp_parse_url( home_url(), PHP_URL_HOST );
// Common localhost identifiers.
$localhost_hosts = array(
'localhost',
'127.0.0.1',
'::1',
);
if ( in_array( $host, $localhost_hosts, true ) ) {
return true;
}
// Common local development TLDs.
$local_tlds = array( '.local', '.test', '.localhost', '.dev.local' );
foreach ( $local_tlds as $tld ) {
if ( str_ends_with( $host, $tld ) ) {
return true;
}
}
return false;
}
/**
* Get the license key.
*