Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove add_reasons_to_defaults() from general initialization #627

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions antispam_bee.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ public static function init() {

self::_init_internal_vars();

if ( self::_current_page( 'dashboard' ) || self::_current_page( 'plugins' ) || self::_current_page( 'options' ) || self::_current_page( 'edit-comments' ) || self::_current_page( 'admin-post' ) ) {
self::load_plugin_lang();
self::add_reasons_to_defaults();
}
add_action(
'init',
array(
__CLASS__,
'add_reasons_to_defaults',
)
);

if ( defined( 'DOING_CRON' ) ) {
add_action(
Expand Down Expand Up @@ -478,7 +481,7 @@ private static function _init_internal_vars() {
*
* @since 2.11.2
*/
private static function add_reasons_to_defaults() {
public static function add_reasons_to_defaults() {
self::$defaults['reasons'] = array(
'css' => esc_attr__( 'Honeypot', 'antispam-bee' ),
'time' => esc_attr__( 'Comment time', 'antispam-bee' ),
Expand Down Expand Up @@ -565,19 +568,6 @@ private static function _current_page( $page ) {
}


/**
* Integration of the localization file
*
* @since 0.1
* @since 2.4
*/
public static function load_plugin_lang() {
load_plugin_textdomain(
'antispam-bee'
);
}


/**
* Add the link to the settings
*
Expand Down Expand Up @@ -2553,9 +2543,6 @@ public static function send_mail_notification( $id ) {
return $id;
}

self::load_plugin_lang();
self::add_reasons_to_defaults();

$subject = sprintf(
'[%s] %s',
stripslashes_deep(
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Contributors: pluginkollektiv, websupporter, schlessera, zodiac1978, swissspidy, krafit, kau-boy, florianbrinkmann, pfefferle
* Tags: anti-spam, antispam, block spam, comment, comments, comment spam, pingback, spam, spam filter, trackback, GDPR
* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
* Requires at least: 4.5
* Requires at least: 4.6
* Tested up to: 6.5
* Requires PHP: 5.2
* Stable tag: 2.11.6
Expand Down Expand Up @@ -65,7 +65,7 @@ Antispam Bee works best with default WordPress comments. It does not help to pro
Antispam Bee works best with default WordPress comments. It is not compatible with Jetpack, wpDiscuz or Disqus Comments as those plugins load a new comment form within an iframe. Thus Antispam Bee can not access the comment form directly.

### Does Antispam Bee work with AJAX comment plugins or similar theme features?
Whether Antispam Bee works with a comment form submitted via AJAX depends on how the AJAX request is made. If the request goes to the file that usually also receives the comments, Antispam Bee could work with it out of the box (the [WP Ajaxify Comments](https://wordpress.org/plugins/wp-ajaxify-comments/) plugin does this, for example).
Whether Antispam Bee works with a comment form submitted via AJAX depends on how the AJAX request is made. If the request goes to the file that usually also receives the comments, Antispam Bee could work with it out of the box (the [WP Ajaxify Comments](https://wordpress.org/plugins/wp-ajaxify-comments/) plugin does this, for example).

If the comments are sent to the `admin-ajax.php`, the `antispam_bee_disallow_ajax_calls` filter must be used to run ASB for requests to that file as well. If the script does not send all form data to the file, but only some selected ones, further customization is probably necessary, as [exemplified in this post by Torsten Landsiedel](https://torstenlandsiedel.de/2020/10/04/ajaxifizierte-kommentare-und-antispam-bee/) (in German).

Expand Down
Loading