From da81d6551de7c5da9460a4ed75da0ca2dec8c26e Mon Sep 17 00:00:00 2001 From: Roric van Schalkwijk Date: Tue, 17 Feb 2026 10:30:00 +0100 Subject: [PATCH] feat: add gravitysmtp vars registration --- config/yard-config-expander.php | 4 +++ src/Licenses/Contracts/AbstractLicense.php | 4 +-- src/Licenses/LicensesServiceProvider.php | 2 ++ src/Licenses/Plugins/GravitySMTPLicense.php | 35 +++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/Licenses/Plugins/GravitySMTPLicense.php diff --git a/config/yard-config-expander.php b/config/yard-config-expander.php index 794bed1..a0292ba 100644 --- a/config/yard-config-expander.php +++ b/config/yard-config-expander.php @@ -63,6 +63,10 @@ 'ACF_PRO_LICENSE_KEY' => $_SERVER['ACF_PRO_LICENSE_KEY'] ?? null, 'FACETWP_LICENSE_KEY' => $_SERVER['FACETWP_LICENSE_KEY'] ?? null, 'GF_LICENSE_KEY' => $_SERVER['GF_LICENSE_KEY'] ?? null, + 'GRAVITYSMTP_GENERIC_HOST' => $_SERVER['GRAVITYSMTP_GENERIC_HOST'] ?? null, + 'GRAVITYSMTP_GENERIC_PORT' => $_SERVER['GRAVITYSMTP_GENERIC_PORT'] ?? null, + 'GRAVITYSMTP_GENERIC_ENCRYPTION_TYPE' => $_SERVER['GRAVITYSMTP_GENERIC_ENCRYPTION_TYPE'] ?? null, + 'GRAVITYSMTP_GENERIC_AUTH' => $_SERVER['GRAVITYSMTP_GENERIC_AUTH'] ?? null, 'SEARCHWP_LICENSE_KEY' => $_SERVER['SEARCHWP_LICENSE_KEY'] ?? null, 'SEOPRESS_LICENSE_KEY' => $_SERVER['SEOPRESS_LICENSE_KEY'] ?? null, 'WPMDB_LICENSE_KEY' => $_SERVER['WPMDB_LICENSE_KEY'] ?? null, diff --git a/src/Licenses/Contracts/AbstractLicense.php b/src/Licenses/Contracts/AbstractLicense.php index 28893cb..abd4f26 100644 --- a/src/Licenses/Contracts/AbstractLicense.php +++ b/src/Licenses/Contracts/AbstractLicense.php @@ -28,8 +28,8 @@ public function __construct(array $licenses) abstract public function register(): void; - protected function getLicense(): string + protected function getLicense(?string $configKey = null): string { - return $this->licenses[static::LICENSE_CONFIG_KEY] ?? ''; + return $this->licenses[$configKey ?? static::LICENSE_CONFIG_KEY] ?? ''; } } diff --git a/src/Licenses/LicensesServiceProvider.php b/src/Licenses/LicensesServiceProvider.php index 7ccf455..8f4f19d 100644 --- a/src/Licenses/LicensesServiceProvider.php +++ b/src/Licenses/LicensesServiceProvider.php @@ -8,6 +8,7 @@ use Yard\ConfigExpander\Licenses\Plugins\AdvancedCustomFieldsLicense; use Yard\ConfigExpander\Licenses\Plugins\FacetWPLicense; use Yard\ConfigExpander\Licenses\Plugins\GravityFormsLicense; +use Yard\ConfigExpander\Licenses\Plugins\GravitySMTPLicense; use Yard\ConfigExpander\Licenses\Plugins\SearchWPLicense; use Yard\ConfigExpander\Licenses\Plugins\SeoPressLicense; use Yard\ConfigExpander\Licenses\Plugins\WpMigrateLicense; @@ -30,6 +31,7 @@ protected function setLicenses(): void LicenseManager::make($licenses)->registerPlugins([ AdvancedCustomFieldsLicense::class, GravityFormsLicense::class, + GravitySMTPLicense::class, FacetWPLicense::class, SearchWPLicense::class, SeoPressLicense::class, diff --git a/src/Licenses/Plugins/GravitySMTPLicense.php b/src/Licenses/Plugins/GravitySMTPLicense.php new file mode 100644 index 0000000..5dd80b0 --- /dev/null +++ b/src/Licenses/Plugins/GravitySMTPLicense.php @@ -0,0 +1,35 @@ +getLicense($constant); + + if (defined($constant) || ('' === $value)) { + continue; + } + + define($constant, $value); + } + } +}