minor fixes
This commit is contained in:
@ -8,8 +8,8 @@ function ( // eslint-disable-line func-names
|
||||
jQuery
|
||||
) {
|
||||
jQuery(function ($) { // eslint-disable-line func-names
|
||||
window.reCaptchaCallback = function () {
|
||||
$('.mailpoet_recaptcha').each(function () {
|
||||
window.reCaptchaCallback = function reCaptchaCallback() {
|
||||
$('.mailpoet_recaptcha').each(function () { // eslint-disable-line func-names
|
||||
var sitekey = $(this).attr('data-sitekey');
|
||||
var container = $(this).find('> .mailpoet_recaptcha_container').get(0);
|
||||
var field = $(this).find('> .mailpoet_recaptcha_field');
|
||||
@ -65,14 +65,12 @@ function ( // eslint-disable-line func-names
|
||||
return error.message;
|
||||
}).join('<br />')
|
||||
).show();
|
||||
<<<<<<< HEAD
|
||||
}).done(function (response) { // eslint-disable-line func-names
|
||||
=======
|
||||
if (window.grecaptcha) {
|
||||
window.grecaptcha.reset(formData.recaptcha);
|
||||
}
|
||||
}).done(function (response) {
|
||||
>>>>>>> handling multiple instances of reCaptcha
|
||||
return response;
|
||||
}).done(function (response) { // eslint-disable-line func-names
|
||||
// successfully subscribed
|
||||
if (
|
||||
response.meta !== undefined
|
||||
|
@ -141,7 +141,7 @@ class Populator {
|
||||
}
|
||||
|
||||
// set reCaptcha settings
|
||||
$re_captcha = Setting::getValue('re_captcha', array());
|
||||
$re_captcha = Setting::getValue('re_captcha');
|
||||
if(empty($re_captcha)) {
|
||||
Setting::setValue('re_captcha', array(
|
||||
'enabled' => false,
|
||||
|
@ -16,6 +16,8 @@ if(!defined('ABSPATH')) exit;
|
||||
class Widget extends \WP_Widget {
|
||||
private $renderer;
|
||||
|
||||
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit';
|
||||
|
||||
function __construct() {
|
||||
parent::__construct(
|
||||
'mailpoet_form',
|
||||
@ -49,7 +51,7 @@ class Widget extends \WP_Widget {
|
||||
wp_print_scripts('jquery');
|
||||
wp_print_scripts('mailpoet_vendor');
|
||||
wp_print_scripts('mailpoet_public');
|
||||
echo '<script src="https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit" async defer></script>';
|
||||
echo '<script src="'.self::RECAPTCHA_API_URL.'" async defer></script>';
|
||||
$scripts = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
@ -114,7 +116,7 @@ class Widget extends \WP_Widget {
|
||||
if(!empty($captcha['enabled'])) {
|
||||
wp_enqueue_script(
|
||||
'mailpoet_recaptcha',
|
||||
'https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit',
|
||||
self::RECAPTCHA_API_URL,
|
||||
array('mailpoet_public')
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user