current license - force disable it if (is_array($featureSettings) && isset($featureSettings['enabled'])) { $featuresIntegrations[$featureCode]['enabled'] = false; } } } return $featuresIntegrations; } /** * Checks if a feature is both enabled in settings AND available in current license. * This is a convenience method for use in SettingsStorage and other places. * * @param string $featureCode The feature code (e.g., 'googleCalendar', 'packages') * @param array|null $featureSettings The feature settings array from database * @return bool True if feature is enabled and license has access, false otherwise */ public static function isFeatureEnabledWithLicense($featureCode, $featureSettings) { // Check if feature settings exist and are valid if (!is_array($featureSettings) || !isset($featureSettings['enabled'])) { return false; } // Feature must be enabled in settings AND license must have access to it return $featureSettings['enabled'] && self::hasFeatureAccess($featureCode); } /** * Override getCommands to delegate to the appropriate license class in development mode * * @param \AmeliaBooking\Infrastructure\Common\Container $c * @return array */ public static function getCommands($c) { // In production, use normal inheritance (class extends were changed by build scripts) if (!AMELIA_DEV) { return parent::getCommands($c); } // In development, dynamically load the appropriate license class $licenseClass = self::getLicenseClass(); return $licenseClass::getCommands($c); } /** * Override setRoutes to delegate to the appropriate license class in development mode * * @param \Slim\App $app * @param \AmeliaBooking\Infrastructure\Common\Container $container * @return void */ public static function setRoutes($app, $container) { // In production, use normal inheritance (class extends were changed by build scripts) if (!AMELIA_DEV) { parent::setRoutes($app, $container); return; } // In development, dynamically load the appropriate license class $licenseClass = self::getLicenseClass(); $licenseClass::setRoutes($app, $container); } /** * Override getPaddleUrl to delegate to the appropriate license class in development mode * * @return string */ public static function getPaddleUrl() { // In production, use normal inheritance (class extends were changed by build scripts) if (!AMELIA_DEV) { return parent::getPaddleUrl(); } // In development, dynamically load the appropriate license class $licenseClass = self::getLicenseClass(); return $licenseClass::getPaddleUrl(); } /** * Get the current license name * This is kept for backward compatibility but should use hasLicenseAccess() instead * * @return string */ public static function getLicence() { if (AMELIA_DEV) { $settingsService = new SettingsService(new SettingsStorage()); $currentLicense = $settingsService->getSetting('activation', 'licence'); return !empty($currentLicense) ? $currentLicense : LicenceConstants::DEVELOPER; } return self::$licence; } /** * Check if current license is premium * This is kept for backward compatibility but should use hasLicenseAccess() instead * * @return bool */ public static function isPremium() { if (AMELIA_DEV) { $settingsService = new SettingsService(new SettingsStorage()); $currentLicense = $settingsService->getSetting('activation', 'licence'); $currentLicense = !empty($currentLicense) ? $currentLicense : LicenceConstants::DEVELOPER; // Lite is the only non-premium license return $currentLicense !== LicenceConstants::LITE; } return self::$premium; } }