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.
This commit is contained in:
Mykyta Synelnikov
2025-02-19 01:03:46 +02:00
parent 14a6b6e887
commit a0d19b7ab6
+1 -12
View File
@@ -145,7 +145,6 @@ 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() {
@@ -154,7 +153,6 @@ final class Enqueue extends \um\common\Enqueue {
<?php
$inline_script = ob_get_clean();
wp_add_inline_script( 'um_scripts', $inline_script );
}
wp_register_script( 'um_dropdown', $js_url . 'dropdown' . $suffix . '.js', array( 'jquery' ), UM_VERSION, true );
@@ -207,16 +205,7 @@ final class Enqueue extends \um\common\Enqueue {
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', $deps, UM_VERSION );
// Makes the honeypot invisible.
if ( ! empty( UM()->fields()->set_mode ) && ( 'profile' !== UM()->fields()->set_mode || true === UM()->fields()->editing ) ) {
ob_start();
?>
.<?php echo esc_attr( UM()->honeypot ); ?>_name {
display: none !important;
}
<?php
$inline_styles = ob_get_clean();
wp_add_inline_style( 'um_styles', $inline_styles );
}
wp_add_inline_style( 'um_styles', '.' . esc_attr( UM()->honeypot ) . '_name { display: none !important; }' );
wp_register_style( 'um_members', $css_url . 'um-members' . $suffix . '.css', array( 'um_styles' ), UM_VERSION );
// RTL styles.