diff --git a/lib/Form/Renderer.php b/lib/Form/Renderer.php index 807b3269ee..b0be305403 100644 --- a/lib/Form/Renderer.php +++ b/lib/Form/Renderer.php @@ -5,7 +5,6 @@ namespace MailPoet\Form; use MailPoet\Form\Util\Styles; use MailPoet\Settings\SettingsController; use MailPoet\Subscription\Captcha; -use MailPoet\WP\Functions as WPFunctions; class Renderer { /** @var Styles */ @@ -46,37 +45,42 @@ class Renderer { public function renderBlocks(array $blocks = [], bool $honeypotEnabled = true): string { // add honeypot for spambots - $html = ($honeypotEnabled) ? - '' : - ''; + $html = ($honeypotEnabled) ? $this->renderHoneypot() : ''; foreach ($blocks as $key => $block) { if ($block['type'] == 'submit' && $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA) { - $siteKey = $this->settings->get('captcha.recaptcha_site_token'); - $html .= '
-
- - -
'; + $html .= $this->renderReCaptcha(); } $html .= $this->renderBlock($block) . PHP_EOL; } - return $html; } + private function renderHoneypot(): string { + return ''; + } + + private function renderReCaptcha(): string { + $siteKey = $this->settings->get('captcha.recaptcha_site_token'); + return '
+
+ + +
'; + } + private function renderBlock(array $block = []): string { $html = ''; switch ($block['type']) {