Changeset 3434522
- Timestamp:
- 01/07/2026 04:56:52 PM (3 months ago)
- Location:
- helloform/trunk
- Files:
-
- 2 edited
-
Readme.txt (modified) (4 diffs)
-
helloform.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
helloform/trunk/Readme.txt
r3430600 r3434522 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 52 52 == External Services == 53 53 54 This plugin uses **Google reCAPTCHA** (version v2 "I'm not a robot" checkbox) to protect the forms from spam and automated abuse. This feature is optional and disabled by default until configured by the user in the plugin settings.54 This plugin uses **Google reCAPTCHA** (version v2 or v3) to protect the forms from spam. This feature is optional and disabled by default until configured by the user. 55 55 56 56 **What data is sent and when:** … … 70 70 71 71 == Changelog == 72 73 = 1.0.4 = 74 * **Feature:** Optimized script loading. reCAPTCHA scripts are now registered and enqueued ONLY when the shortcode is present on the page. 75 * **Fix:** Resolved layout conflicts (CSS/Flexbox) in search pages and global footers caused by reCAPTCHA script injection. 76 * **Performance:** Reduced global page weight by preventing unnecessary third-party script loading on pages without forms. 72 77 73 78 = 1.0.3 = … … 92 97 == Upgrade Notice == 93 98 99 = 1.0.4 = 100 Critical update for layout stability and performance. Optimized reCAPTCHA loading to prevent theme conflicts. Recommended for all users. 101 94 102 = 1.0.3 = 95 103 This update includes critical stability fixes for reCAPTCHA and new security options. Immediate update is highly recommended. -
helloform/trunk/helloform.php
r3430576 r3434522 3 3 Plugin Name: HelloForm 4 4 Description: Customizable contact form for quote requests. 5 Version: 1.0. 35 Version: 1.0.4 6 6 Author: Simone Cipolletta 7 7 Author URI: https://github.com/simonecipolletta … … 16 16 } 17 17 /*definisco la versione */ 18 define('HELLOFORM_VERSION', '1.0. 3');18 define('HELLOFORM_VERSION', '1.0.4'); 19 19 20 20 // Definisci debug solo se non definita altrove … … 86 86 87 87 function helloform_shortcode() { 88 // Sveglia lo script registrato solo in questa pagina 89 wp_enqueue_script('google-recaptcha'); 90 88 91 ob_start(); 89 92 … … 316 319 317 320 // Enqueue reCAPTCHA script in front-end se attivo con supporto v2/v3 318 if (!function_exists('helloform_enqueue_recaptcha_script')) { 319 function helloform_enqueue_recaptcha_script() { 320 if (get_option('helloform_recaptcha_enabled') === '1') { 321 $site_key = get_option('helloform_recaptcha_site'); 322 $version = get_option('helloform_recaptcha_version', 'v2'); 323 324 $api_url = 'https://www.google.com/recaptcha/api.js'; 325 326 // Se è v3, aggiungiamo il parametro render con la site key 327 if ($version === 'v3' && !empty($site_key)) { 328 $api_url .= '?render=' . esc_attr($site_key); 329 } 330 331 wp_enqueue_script( 332 'google-recaptcha', 333 $api_url, 334 [], 335 HELLOFORM_VERSION, 336 true 337 ); 338 } 339 } 340 add_action('wp_enqueue_scripts', 'helloform_enqueue_recaptcha_script'); 341 } 321 if (!function_exists('helloform_register_recaptcha_script')) { 322 function helloform_register_recaptcha_script() { 323 // 1. Controllo se il reCAPTCHA è attivo nelle impostazioni 324 if (get_option('helloform_recaptcha_enabled') !== '1') { 325 return; 326 } 327 328 $site_key = get_option('helloform_recaptcha_site'); 329 $version = get_option('helloform_recaptcha_version', 'v2'); 330 331 // 2. Se manca la chiave, non serve registrare nulla (Early Return) 332 if (empty($site_key)) { 333 return; 334 } 335 336 $api_url = 'https://www.google.com/recaptcha/api.js'; 337 338 if ($version === 'v3') { 339 $api_url .= '?render=' . esc_attr($site_key); 340 } 341 342 // 3. Registriamo lo script: è pronto, ma "dorme" finché lo shortcode non lo sveglia 343 wp_register_script( 344 'google-recaptcha', 345 $api_url, 346 [], 347 HELLOFORM_VERSION, 348 true 349 ); 350 } 351 add_action('wp_enqueue_scripts', 'helloform_register_recaptcha_script'); 352 }
Note: See TracChangeset
for help on using the changeset viewer.