exists() && $this->get_price() !== ''; } /** * Get max activations for this product (parent default) * Falls back to default settings if not set on product */ public function get_max_activations(): int { $value = $this->get_meta('_licensed_max_activations', true); if ($value !== '' && $value !== null) { return max(1, (int) $value); } return SettingsController::getDefaultMaxActivations(); } /** * Check if product has custom max activations set */ public function has_custom_max_activations(): bool { $value = $this->get_meta('_licensed_max_activations', true); return $value !== '' && $value !== null; } /** * Get validity days (parent default - variations override this) * Falls back to default settings if not set on product */ public function get_validity_days(): ?int { $value = $this->get_meta('_licensed_validity_days', true); if ($value !== '' && $value !== null) { return (int) $value > 0 ? (int) $value : null; } return SettingsController::getDefaultValidityDays(); } /** * Check if product has custom validity days set */ public function has_custom_validity_days(): bool { $value = $this->get_meta('_licensed_validity_days', true); return $value !== '' && $value !== null; } /** * Check if license should be bound to major version * Falls back to default settings if not set on product */ public function is_bound_to_version(): bool { $value = $this->get_meta('_licensed_bind_to_version', true); if ($value !== '' && $value !== null) { return $value === 'yes'; } return SettingsController::getDefaultBindToVersion(); } /** * Check if product has custom bind to version setting */ public function has_custom_bind_to_version(): bool { $value = $this->get_meta('_licensed_bind_to_version', true); return $value !== '' && $value !== null; } /** * Get current software version (derived from latest product version) */ public function get_current_version(): string { $versionManager = new VersionManager(); $latestVersion = $versionManager->getLatestVersion($this->get_id()); return $latestVersion ? $latestVersion->getVersion() : ''; } /** * Get major version number from version string */ public function get_major_version(): int { $versionManager = new VersionManager(); $latestVersion = $versionManager->getLatestVersion($this->get_id()); if ($latestVersion) { return $latestVersion->getMajorVersion(); } return 1; } }