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