Merge pull request #3197 from Sosko/patch-1

Configurable container for honeypot
This commit is contained in:
Michal Sniatala 2020-07-11 07:03:25 +02:00 committed by GitHub
commit f5d899c906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,14 @@ class Honeypot extends BaseConfig
* @var boolean
*/
public $hidden = true;
/**
* Div wrapper of honeypot.
*
* @var string
*/
public $container = '<div style="display:none">%s</div>';
/**
* Honeypot Label Content
*

View File

@ -72,6 +72,11 @@ class Honeypot
{
throw HoneypotException::forNoHiddenValue();
}
if (empty($this->config->container) || strpos($this->config->container, '%s') === false)
{
$this->config->container = '<div style="display:none">%s</div>';
}
if ($this->config->template === '')
{
@ -124,7 +129,7 @@ class Honeypot
if ($this->config->hidden)
{
$template = '<div style="display:none">' . $template . '</div>';
$template = sprintf($this->config->container, $template);
}
return $template;
}