Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,53 +12,59 @@
namespace IPS\nexus\Purchase\LicenseKey;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\nexus\Purchase\LicenseKey;
use function chr;
use function defined;
use function in_array;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* License Key Model - Standard
*/
class _Standard extends \IPS\nexus\Purchase\LicenseKey
class Standard extends LicenseKey
{
/**
* @brief Number of blocks
*/
protected static $blocks = 5;
protected static int $blocks = 5;
/**
* @brief Number of characters in a block
*/
protected static $characters = 4;
protected static int $characters = 4;
/**
* @brief Lowest allowed ASCII number
*/
protected static $low = 48; // 0
protected static int $low = 48; // 0
/**
* @brief Highest allowed ASCII number
*/
protected static $high = 90; // Z
protected static int $high = 90; // Z
/**
* @brief Disallowed ASCII numbers
*/
protected static $disallowed = array( 58, 59, 60, 61, 62, 63, 64 ); // Various non A-Z / 0-9 characters
protected static array $disallowed = array( 58, 59, 60, 61, 62, 63, 64 ); // Various non A-Z / 0-9 characters
/**
* @brief Seperator between blocks
*/
protected static $seperator = '-';
protected static string $seperator = '-';
/**
* Generates a License Key
*
* @return string
*/
public function generate()
public function generateKey() : string
{
$key = array();
foreach ( range( 1, static::$blocks ) as $i )
@@ -70,8 +76,8 @@ class _Standard extends \IPS\nexus\Purchase\LicenseKey
{
$chr = rand( static::$low, static::$high );
}
while ( \in_array( $chr, static::$disallowed ) );
$_k .= \chr( $chr );
while ( in_array( $chr, static::$disallowed ) );
$_k .= chr( $chr );
}
$key[] = $_k;
}