| 1 |
<?php |
| 2 |
// Do not allow the file to be called directly. |
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
$id = 'g-recaptcha-response-' . uniqid(); |
| 8 |
|
| 9 |
?> |
| 10 |
<script id="gRecaptchaSrc" src="https://www.google.com/recaptcha/api.js?render=<?php echo esc_attr( $site_key ); ?>"></script> |
| 11 |
<script> |
| 12 |
grecaptcha.ready(function() { |
| 13 |
grecaptcha.execute('<?php echo esc_attr( $site_key ); ?>', {action: 'submit'}).then(function(token) { |
| 14 |
document.getElementById("<?php echo $id; ?>").value = token; |
| 15 |
}); |
| 16 |
}); |
| 17 |
</script> |
| 18 |
<input type="hidden" id="<?php echo $id; ?>" name="g-recaptcha-response" /> |
| 19 |
|