From 1c884ed97f75685031888a927ff7d6beed2df0fc Mon Sep 17 00:00:00 2001 From: carpentryplus25 Date: Thu, 26 Feb 2026 14:20:17 -0500 Subject: [PATCH] Update to paypal express anti-spam blocks --- .gitattributes | 17 +- dapper.php | 415 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 390 insertions(+), 42 deletions(-) diff --git a/.gitattributes b/.gitattributes index dfe0770..c6b5b2f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,17 @@ -# Auto detect text files and perform LF normalization +# Auto-normalize line endings * text=auto + +# Force text files to LF +*.php text eol=lf +*.js text eol=lf +*.css text eol=lf +*.md text eol=lf +*.txt text eol=lf +*.json text eol=lf + +# Binaries +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary diff --git a/dapper.php b/dapper.php index ebd1cab..bb0d14c 100644 --- a/dapper.php +++ b/dapper.php @@ -38,7 +38,7 @@ function dapper_activation() { foreach ($existing_users as $user) { update_mailing_list($user->ID, $user->user_email, 'subscribed'); } - make_images_dir(); + //make_images_dir(); make_backup_dir(); // Mark setup completed update_option('dapper_setup_complete', true); @@ -47,6 +47,7 @@ function dapper_activation() { register_activation_hook(__FILE__, 'dapper_activation'); /* +// Depreciated in v1.1.1 to be removed in later versions // Checks for an images directory inside the dapper plugin // Creates the 'images' folder when plugin gets activated // Used for custom logos on login page @@ -581,6 +582,31 @@ function dapper_woo_conditional_load() { return $errors; } + /** + * Returns true if the current posted payment method is any known PayPal variant + * + * + */ + function dapper_is_paypal_payment_method() { + if (!isset($_POST['payment_method'])) { + return false; + } + + $method = $_POST['payment_method']; + + $paypal_methods = [ + 'paypal', + 'ppec_paypal', // older PayPal Express Checkout + 'ppcp-gateway', // PayPal Payments (most common now) + 'paypal_express', + 'braintree_paypal', // if using Braintree integration + // add more here if you ever see other variants in logs + ]; + + return in_array($method, $paypal_methods, true); + } + + // =================== // CHECKOUT HONEYPOT + ANTI-BOT LAYERS // =================== @@ -650,7 +676,12 @@ function dapper_woo_conditional_load() { add_action('woocommerce_checkout_before_customer_details', 'dapper_add_custom_human_check'); function dapper_add_custom_human_check() { - if (get_option('dapper_enable_paypal_human_check', 'on') !== 'on') return; + if (get_option('dapper_enable_paypal_human_check', 'on') !== 'on') { + return; + } + if ( ! dapper_is_paypal_payment_method() && ! is_checkout() ) { + return; + } ?>