This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

View File

@@ -1 +1 @@
document.addEventListener("DOMContentLoaded",(t=>{var e;wpcf7_recaptcha={...null!==(e=wpcf7_recaptcha)&&void 0!==e?e:{}};const c=wpcf7_recaptcha.sitekey,{homepage:n,contactform:a}=wpcf7_recaptcha.actions,o=t=>{const{action:e,func:n,params:a}=t;grecaptcha.execute(c,{action:e}).then((t=>{const c=new CustomEvent("wpcf7grecaptchaexecuted",{detail:{action:e,token:t}});document.dispatchEvent(c)})).then((()=>{"function"==typeof n&&n(...a)})).catch((t=>console.error(t)))};if(grecaptcha.ready((()=>{o({action:n})})),document.addEventListener("change",(t=>{o({action:a})})),"undefined"!=typeof wpcf7&&"function"==typeof wpcf7.submit){const t=wpcf7.submit;wpcf7.submit=function(e){o({action:a,func:t,params:[e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}]})}}document.addEventListener("wpcf7grecaptchaexecuted",(t=>{const e=document.querySelectorAll('form.wpcf7-form input[name="_wpcf7_recaptcha_response"]');for(let c=0;c<e.length;c++)e[c].setAttribute("value",t.detail.token)}))}));
document.addEventListener("DOMContentLoaded",(e=>{var t;wpcf7_recaptcha={...null!==(t=wpcf7_recaptcha)&&void 0!==t?t:{}};const c=wpcf7_recaptcha.sitekey,{homepage:n,contactform:a}=wpcf7_recaptcha.actions,o=e=>{const{action:t,func:n,params:a}=e;grecaptcha.execute(c,{action:t}).then((e=>{const c=new CustomEvent("wpcf7grecaptchaexecuted",{detail:{action:t,token:e}});document.dispatchEvent(c)})).then((()=>{"function"==typeof n&&n(...a)})).catch((e=>console.error(e)))};if(grecaptcha.ready((()=>{o({action:n})})),document.addEventListener("change",(e=>{o({action:a})})),"undefined"!=typeof wpcf7&&"function"==typeof wpcf7.submit){const e=wpcf7.submit;wpcf7.submit=(t,c={})=>{o({action:a,func:e,params:[t,c]})}}document.addEventListener("wpcf7grecaptchaexecuted",(e=>{const t=document.querySelectorAll('form.wpcf7-form input[name="_wpcf7_recaptcha_response"]');for(let c=0;c<t.length;c++)t[c].setAttribute("value",e.detail.token)}))}));

View File

@@ -53,7 +53,7 @@ function wpcf7_recaptcha_enqueue_scripts() {
),
array(),
'3.0',
true
array( 'in_footer' => true )
);
$assets = array();
@@ -79,7 +79,7 @@ function wpcf7_recaptcha_enqueue_scripts() {
)
),
$assets['version'],
true
array( 'in_footer' => true )
);
wp_enqueue_script( 'wpcf7-recaptcha' );
@@ -135,8 +135,7 @@ function wpcf7_recaptcha_verify_response( $spam, $submission ) {
return $spam;
}
$token = isset( $_POST['_wpcf7_recaptcha_response'] )
? trim( $_POST['_wpcf7_recaptcha_response'] ) : '';
$token = trim( $_POST['_wpcf7_recaptcha_response'] ?? '' );
if ( $service->verify( $token ) ) { // Human
$spam = false;

View File

@@ -133,6 +133,10 @@ class WPCF7_RECAPTCHA extends WPCF7_Service {
$endpoint = 'https://www.google.com/recaptcha/api/siteverify';
if ( apply_filters( 'wpcf7_use_recaptcha_net', false ) ) {
$endpoint = 'https://www.recaptcha.net/recaptcha/api/siteverify';
}
$sitekey = $this->get_sitekey();
$secret = $this->get_secret( $sitekey );
@@ -221,8 +225,8 @@ class WPCF7_RECAPTCHA extends WPCF7_Service {
$this->reset_data();
$redirect_to = $this->menu_page_url( 'action=setup' );
} else {
$sitekey = isset( $_POST['sitekey'] ) ? trim( $_POST['sitekey'] ) : '';
$secret = isset( $_POST['secret'] ) ? trim( $_POST['secret'] ) : '';
$sitekey = trim( $_POST['sitekey'] ?? '' );
$secret = trim( $_POST['secret'] ?? '' );
if ( $sitekey and $secret ) {
$this->sitekeys = array( $sitekey => $secret );