Skip to content

Commit

Permalink
Fix. SFW Error Text. Checking whether the init or plugins_loaded hook…
Browse files Browse the repository at this point in the history
… was executed (#529)

* Fix. SFW Error Text. Checking whether the init or plugins_loaded hook was executed

* Fix. SFW Error Text. Adding a space after the function

* Fix. Localization. Text domain loading fixed.

---------

Co-authored-by: Glomberg <[email protected]>
  • Loading branch information
AntonV1211 and Glomberg authored Dec 20, 2024
1 parent 4e6cc34 commit 3cf962c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cleantalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ function apbct_wpms__delete_blog(WP_Site $old_site)
}

// After plugin loaded - to load locale as described in manual
add_action('plugins_loaded', 'apbct_plugin_loaded');
add_action('init', 'apbct_plugin_loaded');

if ( ! empty($apbct->settings['data__use_ajax']) &&
! apbct_is_in_uri('.xml') &&
Expand Down Expand Up @@ -875,14 +875,16 @@ function apbct_sfw__check()
// Checking if database was outdated
$is_sfw_outdated = $apbct->stats['sfw']['last_update_time'] + $apbct->stats['sfw']['update_period'] * 3 < time();

$apbct->errorToggle(
$is_sfw_outdated,
'sfw_outdated',
esc_html__(
'SpamFireWall database is outdated. Please, try to synchronize with the cloud.',
'cleantalk-spam-protect'
)
);
add_action('init', function () use ($apbct, $is_sfw_outdated) {
$apbct->errorToggle(
$is_sfw_outdated,
'sfw_outdated',
esc_html__(
'SpamFireWall database is outdated. Please, try to synchronize with the cloud.',
'cleantalk-spam-protect'
)
);
});

if ( $is_sfw_outdated ) {
return;
Expand All @@ -895,14 +897,16 @@ function apbct_sfw__check()
$sfw_tables_names = SFW::getSFWTablesNames();

if (!$sfw_tables_names) {
add_action('init', function () use ($apbct) {
$apbct->errorAdd(
'sfw',
esc_html__(
'Can not get SFW table names from main blog options',
'cleantalk-spam-protect'
)
);
return;
});
return;
}

$firewall->loadFwModule(
Expand Down

0 comments on commit 3cf962c

Please sign in to comment.