diff --git a/lib/Form/Widget.php b/lib/Form/Widget.php index 845eb37b39..9ab1e8e8d9 100644 --- a/lib/Form/Widget.php +++ b/lib/Form/Widget.php @@ -14,6 +14,8 @@ use MailPoet\WP\Hooks; if(!defined('ABSPATH')) exit; class Widget extends \WP_Widget { + const RECAPTCHA_API_SCRIPT = ''; + private $renderer; function __construct() { @@ -50,7 +52,7 @@ class Widget extends \WP_Widget { wp_print_scripts('mailpoet_vendor'); wp_print_scripts('mailpoet_public'); if(Setting::getValue('re_captcha.enabled')) { - echo ''; + echo self::RECAPTCHA_API_SCRIPT; } $scripts = ob_get_contents(); ob_end_clean(); @@ -275,7 +277,9 @@ EOL; if(!empty($body)) { $form_id = $this->id_base . '_' . $form['id']; - + if(Setting::getValue('re_captcha.enabled')) { + $before_widget .= self::RECAPTCHA_API_SCRIPT; + } $data = array( 'form_id' => $form_id, 'form_type' => $form_type, diff --git a/views/form/widget.html b/views/form/widget.html index e152e71f08..14e84d3777 100644 --- a/views/form/widget.html +++ b/views/form/widget.html @@ -4,7 +4,7 @@ <% if(title) %> <%= before_title | raw %><%= title | raw %><%= after_title | raw %> <% endif %> - +