From a0d19b7ab6c4088781857200958f9c9495568167 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 19 Feb 2025 01:03:46 +0200 Subject: [PATCH] Simplify honeypot script and inline style logic. Removed unnecessary condition checks around honeypot script and style injection. Streamlined the code to always enqueue the honeypot logic, improving maintainability and reducing complexity. --- includes/frontend/class-enqueue.php | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/includes/frontend/class-enqueue.php b/includes/frontend/class-enqueue.php index 7cc2f3e9..098c885a 100644 --- a/includes/frontend/class-enqueue.php +++ b/includes/frontend/class-enqueue.php @@ -145,16 +145,14 @@ final class Enqueue extends \um\common\Enqueue { wp_localize_script( 'um_scripts', 'um_scripts', $localize_data ); // Makes the honeypot. - if ( ! empty( UM()->fields()->set_mode ) && ( 'profile' !== UM()->fields()->set_mode || true === UM()->fields()->editing ) ) { - ob_start(); - ?> - jQuery( window ).on( 'load', function() { - jQuery('input[name="honeypot ); ?>"]').val(''); - }); - + jQuery( window ).on( 'load', function() { + jQuery('input[name="honeypot ); ?>"]').val(''); + }); + fields()->set_mode ) && ( 'profile' !== UM()->fields()->set_mode || true === UM()->fields()->editing ) ) { - ob_start(); - ?> - .honeypot ); ?>_name { - display: none !important; - } - honeypot ) . '_name { display: none !important; }' ); wp_register_style( 'um_members', $css_url . 'um-members' . $suffix . '.css', array( 'um_styles' ), UM_VERSION ); // RTL styles.