Skip to content

Commit

Permalink
Merge pull request #474 from infinum/feature/clearbit-fix
Browse files Browse the repository at this point in the history
Release 5.6.4
  • Loading branch information
iruzevic authored Dec 16, 2024
2 parents e73d6e0 + 4639c50 commit 21e1e7c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 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.4]

### Fixed

- Usage condition for Clearbit cron job.

## [5.6.3]

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

- Initial production release.

[5.6.4]: https://github.com/infinum/eightshift-forms/compare/5.6.3...5.6.4
[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
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.3
* Version: 5.6.4
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
11 changes: 3 additions & 8 deletions src/CronJobs/ClearbitJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ public function __construct(
*/
public function register(): void
{
$use = \apply_filters(SettingsClearbit::FILTER_SETTINGS_GLOBAL_IS_VALID_NAME, false);
$useCron = UtilsSettingsHelper::isOptionCheckboxChecked(SettingsClearbit::SETTINGS_CLEARBIT_USE_JOBS_QUEUE_KEY, SettingsClearbit::SETTINGS_CLEARBIT_USE_JOBS_QUEUE_KEY);

if (!$use || !$useCron) {
return;
}

\add_action('admin_init', [$this, 'checkIfJobIsSet']);
\add_filter('cron_schedules', [$this, 'addJobToSchedule']); // phpcs:ignore WordPress.WP.CronInterval.CronSchedulesInterval
\add_action(self::JOB_NAME, [$this, 'getJobCallback']);
Expand Down Expand Up @@ -118,9 +111,11 @@ public function addJobToSchedule(array $schedules): array
*/
public function getJobCallback()
{
$use = \apply_filters(SettingsClearbit::FILTER_SETTINGS_GLOBAL_IS_VALID_NAME, false);
$useCron = UtilsSettingsHelper::isOptionCheckboxChecked(SettingsClearbit::SETTINGS_CLEARBIT_USE_JOBS_QUEUE_KEY, SettingsClearbit::SETTINGS_CLEARBIT_USE_JOBS_QUEUE_KEY);
$jobs = UtilsSettingsHelper::getOptionValueGroup(SettingsClearbit::SETTINGS_CLEARBIT_JOBS_KEY);

if (!$jobs) {
if (!$use || !$useCron || !$jobs) {
return;
}

Expand Down
14 changes: 5 additions & 9 deletions src/Integrations/Clearbit/SettingsClearbit.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,20 @@ public function register(): void
{
\add_filter(self::FILTER_SETTINGS_NAME, [$this, 'getSettingsData']);
\add_filter(self::FILTER_SETTINGS_GLOBAL_NAME, [$this, 'getSettingsGlobalData']);
\add_filter(self::FILTER_SETTINGS_IS_VALID_NAME, [$this, 'isSettingsValid'], 10, 2);
\add_filter(self::FILTER_SETTINGS_IS_VALID_NAME, [$this, 'isSettingsValid']);
\add_filter(self::FILTER_SETTINGS_GLOBAL_IS_VALID_NAME, [$this, 'isSettingsGlobalValid']);
}

/**
* Determine if settings are valid.
*
* @param string $formId Form ID.
* @param string $type Integration type.
*
* @return boolean
*/
public function isSettingsValid(string $formId, string $type): bool
public function isSettingsValid(string $formId): bool
{
if (!$this->isSettingsGlobalValid($type)) {
if (!$this->isSettingsGlobalValid()) {
return false;
}

Expand All @@ -140,17 +139,14 @@ public function isSettingsValid(string $formId, string $type): bool
/**
* Determine if settings global are valid.
*
* @param string $type Integration type.
*
* @return boolean
*/
public function isSettingsGlobalValid(string $type = ''): bool
public function isSettingsGlobalValid(): bool
{
$isUsed = UtilsSettingsHelper::isOptionCheckboxChecked(self::SETTINGS_CLEARBIT_USE_KEY, self::SETTINGS_CLEARBIT_USE_KEY);
$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) {
if (!$isUsed || !$apiKey) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Integrations/Talentlyft/SettingsTalentlyft.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function getSettingsGlobalData(): array
'stepsTitle' => \__('How to get the API key?', 'eightshift-forms'),
'stepsContent' => [
// translators: %s will be replaced with the link.
\sprintf(\__('Log in to your <a target="_blank" rel="noopener noreferrer" href="%s">Talentlyft Account</a>.', 'eightshift-forms'), 'https://app.talentlyft.io/'),
\sprintf(\__('Log in to your <a target="_blank" rel="noopener noreferrer" href="%s">Talentlyft Account</a>.', 'eightshift-forms'), 'https://app.talentlyft.com/'),
// translators: %s will be replaced with the link.
\sprintf(\__('Go to <a target="_blank" rel="noopener noreferrer" href="%s">Integrations Settings</a>.', 'eightshift-forms'), 'https://app.talentlyft.com/infinum/settings/integrations'),
\__('Click on <strong>Settings under the TalentLyft card</strong>.', 'eightshift-forms'),
Expand Down

0 comments on commit 21e1e7c

Please sign in to comment.