mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge pull request #3197 from Sosko/patch-1
Configurable container for honeypot
This commit is contained in:
commit
f5d899c906
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user