Skip to content

Commit

Permalink
updating fix for use conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Dec 12, 2024
1 parent 9016077 commit e73d6e0
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 43 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).

## [5.6.3]

### Fixed

- Broken Use conditions on settings

## [5.6.2]

### Fixed
Expand Down Expand Up @@ -854,6 +860,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[5.6.3]: https://github.com/infinum/eightshift-forms/compare/5.6.2...5.6.3
[5.6.2]: https://github.com/infinum/eightshift-forms/compare/5.6.1...5.6.2
[5.6.1]: https://github.com/infinum/eightshift-forms/compare/5.6.0...5.6.1
[5.6.0]: https://github.com/infinum/eightshift-forms/compare/5.5.1...5.6.0
Expand Down
2 changes: 1 addition & 1 deletion eightshift-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level.
* Author: WordPress team @Infinum
* Author URI: https://eightshift.com/
* Version: 5.6.2
* Version: 5.6.3
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
12 changes: 6 additions & 6 deletions src/Captcha/SettingsCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_CAPTCHA_USE_KEY, self::SETTINGS_CAPTCHA_USE_KEY);
$siteKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaSiteKey(), self::SETTINGS_CAPTCHA_SITE_KEY)['value'];
$secretKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaSecretKey(), self::SETTINGS_CAPTCHA_SECRET_KEY)['value'];
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaApiKey(), self::SETTINGS_CAPTCHA_API_KEY)['value'];
$projectIdKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaProjectIdKey(), self::SETTINGS_CAPTCHA_PROJECT_ID_KEY)['value'];
$siteKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaSiteKey(), self::SETTINGS_CAPTCHA_SITE_KEY)['value'];
$secretKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaSecretKey(), self::SETTINGS_CAPTCHA_SECRET_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaApiKey(), self::SETTINGS_CAPTCHA_API_KEY)['value'];
$projectIdKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getGoogleReCaptchaProjectIdKey(), self::SETTINGS_CAPTCHA_PROJECT_ID_KEY)['value'];

$isEnterprise = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_CAPTCHA_ENTERPRISE_KEY, self::SETTINGS_CAPTCHA_ENTERPRISE_KEY);

if ($isEnterprise) {
if (!$isUsed || empty($siteKey) || empty($apiKey) || empty($projectIdKey)) {
if (!$isUsed || !$siteKey || !$apiKey || !$projectIdKey) {
return false;
}
} else {
if (!$isUsed || empty($siteKey) || empty($secretKey)) {
if (!$isUsed || !$siteKey || !$secretKey) {
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/ActiveCampaign/SettingsActiveCampaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(SettingsActiveCampaign::SETTINGS_ACTIVE_CAMPAIGN_USE_KEY, SettingsActiveCampaign::SETTINGS_ACTIVE_CAMPAIGN_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyActiveCampaign(), self::SETTINGS_ACTIVE_CAMPAIGN_API_KEY_KEY)['value'];
$url = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUrlActiveCampaign(), self::SETTINGS_ACTIVE_CAMPAIGN_API_URL_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyActiveCampaign(), self::SETTINGS_ACTIVE_CAMPAIGN_API_KEY_KEY)['value'];
$url = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUrlActiveCampaign(), self::SETTINGS_ACTIVE_CAMPAIGN_API_URL_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($url)) {
if (!$isUsed || !$apiKey || !$url) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Airtable/SettingsAirtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_AIRTABLE_USE_KEY, self::SETTINGS_AIRTABLE_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyAirtable(), self::SETTINGS_AIRTABLE_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyAirtable(), self::SETTINGS_AIRTABLE_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Integrations/Clearbit/SettingsClearbit.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function isSettingsValid(string $formId, string $type): bool
public function isSettingsGlobalValid(string $type = ''): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_CLEARBIT_USE_KEY, self::SETTINGS_CLEARBIT_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyClearbit(), self::SETTINGS_CLEARBIT_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyClearbit(), self::SETTINGS_CLEARBIT_API_KEY_KEY)['value'];
$map = !empty($type) ? UtilsSettingsHelper::getOptionValueGroup(self::SETTINGS_CLEARBIT_MAP_HUBSPOT_KEYS_KEY . '-' . $type) : true;

if (!$isUsed || !$apiKey || !$map) {
Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Corvus/SettingsCorvus.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,9 @@ static function ($option) use ($mapParams, $item) {
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_CORVUS_USE_KEY, self::SETTINGS_CORVUS_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyCorvus(), self::SETTINGS_CORVUS_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyCorvus(), self::SETTINGS_CORVUS_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Goodbits/SettingsGoodbits.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_GOODBITS_USE_KEY, self::SETTINGS_GOODBITS_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyGoodbits(), self::SETTINGS_GOODBITS_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyGoodbits(), self::SETTINGS_GOODBITS_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/Greenhouse/SettingsGreenhouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_GREENHOUSE_USE_KEY, self::SETTINGS_GREENHOUSE_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyGreenhouse(), self::SETTINGS_GREENHOUSE_API_KEY_KEY)['value'];
$boardToken = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getBoardTokenGreenhouse(), self::SETTINGS_GREENHOUSE_BOARD_TOKEN_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyGreenhouse(), self::SETTINGS_GREENHOUSE_API_KEY_KEY)['value'];
$boardToken = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getBoardTokenGreenhouse(), self::SETTINGS_GREENHOUSE_BOARD_TOKEN_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($boardToken)) {
if (!$isUsed || !$apiKey || !$boardToken) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Hubspot/SettingsHubspot.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(SettingsHubspot::SETTINGS_HUBSPOT_USE_KEY, SettingsHubspot::SETTINGS_HUBSPOT_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyHubspot(), self::SETTINGS_HUBSPOT_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyHubspot(), self::SETTINGS_HUBSPOT_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Integrations/Jira/SettingsJira.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ function ($item) use ($mapParams) {
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_JIRA_USE_KEY, self::SETTINGS_JIRA_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyJira(), self::SETTINGS_JIRA_API_KEY_KEY)['value'];
$apiBoard = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiBoardJira(), self::SETTINGS_JIRA_API_BOARD_KEY)['value'];
$apiUser = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUserJira(), self::SETTINGS_JIRA_API_USER_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyJira(), self::SETTINGS_JIRA_API_KEY_KEY)['value'];
$apiBoard = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiBoardJira(), self::SETTINGS_JIRA_API_BOARD_KEY)['value'];
$apiUser = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUserJira(), self::SETTINGS_JIRA_API_USER_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($apiBoard) || empty($apiUser)) {
if (!$isUsed || !$apiKey || !$apiBoard || !$apiUser) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Mailchimp/SettingsMailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_MAILCHIMP_USE_KEY, self::SETTINGS_MAILCHIMP_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMailchimp(), self::SETTINGS_MAILCHIMP_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMailchimp(), self::SETTINGS_MAILCHIMP_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Mailerlite/SettingsMailerlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_MAILERLITE_USE_KEY, self::SETTINGS_MAILERLITE_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMailerlite(), self::SETTINGS_MAILERLITE_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMailerlite(), self::SETTINGS_MAILERLITE_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/Moments/SettingsMoments.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_MOMENTS_USE_KEY, self::SETTINGS_MOMENTS_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMoments(), self::SETTINGS_MOMENTS_API_KEY_KEY)['value'];
$url = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUrlMoments(), self::SETTINGS_MOMENTS_API_URL_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyMoments(), self::SETTINGS_MOMENTS_API_KEY_KEY)['value'];
$url = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiUrlMoments(), self::SETTINGS_MOMENTS_API_URL_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($url)) {
if (!$isUsed || !$apiKey || !$url) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/Paycek/SettingsPaycek.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ static function ($option) use ($mapParams, $item) {
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_PAYCEK_USE_KEY, self::SETTINGS_PAYCEK_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyPaycek(), self::SETTINGS_PAYCEK_API_KEY_KEY)['value'];
$profileKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiProfileKeyPaycek(), self::SETTINGS_PAYCEK_API_PROFILE_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyPaycek(), self::SETTINGS_PAYCEK_API_KEY_KEY)['value'];
$profileKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiProfileKeyPaycek(), self::SETTINGS_PAYCEK_API_PROFILE_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($profileKey)) {
if (!$isUsed || !$apiKey || !$profileKey) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Pipedrive/SettingsPipedrive.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,9 @@ static function ($option) use ($organization) {
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_PIPEDRIVE_USE_KEY, self::SETTINGS_PIPEDRIVE_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyPipedrive(), self::SETTINGS_PIPEDRIVE_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyPipedrive(), self::SETTINGS_PIPEDRIVE_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Integrations/Talentlyft/SettingsTalentlyft.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_TALENTLYFT_USE_KEY, self::SETTINGS_TALENTLYFT_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyTalentlyft(), self::SETTINGS_TALENTLYFT_API_KEY_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyTalentlyft(), self::SETTINGS_TALENTLYFT_API_KEY_KEY)['value'];

if (!$isUsed || empty($apiKey)) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/Workable/SettingsWorkable.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public function register(): void
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_WORKABLE_USE_KEY, self::SETTINGS_WORKABLE_USE_KEY);
$apiKey = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyWorkable(), self::SETTINGS_WORKABLE_API_KEY_KEY)['value'];
$subdomain = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getSubdomainWorkable(), self::SETTINGS_WORKABLE_SUBDOMAIN_KEY)['value'];
$apiKey = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyWorkable(), self::SETTINGS_WORKABLE_API_KEY_KEY)['value'];
$subdomain = (bool) UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getSubdomainWorkable(), self::SETTINGS_WORKABLE_SUBDOMAIN_KEY)['value'];

if (!$isUsed || empty($apiKey) || empty($subdomain)) {
if (!$isUsed || !$apiKey || !$subdomain) {
return false;
}

Expand Down

0 comments on commit e73d6e0

Please sign in to comment.