'; $html .= '.mailpoet_hp_email_label{display:none;}'; // move honeypot field out of sight $html .= $styles->render($this->getStyles($form), $prefix); $html .= ''; return $html; } public function renderHTML(array $form = []): string { if (isset($form['body']) && !empty($form['body'])) { return $this->renderBlocks($form['body']); } return ''; } public function getStyles(array $form = []): string { if (isset($form['styles']) && strlen(trim($form['styles'])) > 0) { return strip_tags($form['styles']); } else { $styles = new Util\Styles(); return $styles->getDefaultStyles(); } } public function renderBlocks(array $blocks = [], bool $honeypotEnabled = true): string { $settings = SettingsController::getInstance(); // add honeypot for spambots $html = ($honeypotEnabled) ? '' : ''; foreach ($blocks as $key => $block) { if ($block['type'] == 'submit' && $settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA) { $siteKey = $settings->get('captcha.recaptcha_site_token'); $html .= '
'; } $html .= $this->renderBlock($block) . PHP_EOL; } return $html; } private function renderBlock(array $block = []): string { $html = ''; switch ($block['type']) { case 'html': $html .= Block\Html::render($block); break; case 'divider': $html .= Block\Divider::render(); break; case 'checkbox': $html .= Block\Checkbox::render($block); break; case 'radio': $html .= Block\Radio::render($block); break; case 'segment': $html .= Block\Segment::render($block); break; case 'date': $html .= Block\Date::render($block); break; case 'select': $html .= Block\Select::render($block); break; case 'text': $html .= Block\Text::render($block); break; case 'textarea': $html .= Block\Textarea::render($block); break; case 'submit': $html .= Block\Submit::render($block); break; } return $html; } }