Skip to content

Commit de9be9e

Browse files
authored
Usage of config hiddenContainer and hiddenByClass
1 parent a80c2f0 commit de9be9e

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

system/Honeypot/Honeypot.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,15 @@ function __construct(BaseConfig $config)
7272
{
7373
throw HoneypotException::forNoHiddenValue();
7474
}
75-
if ($this->config->hiddenBy === '')
75+
76+
if (!$this->config->hiddenByClass)
7677
{
77-
throw HoneypotException::forNoHiddenValue();
78+
$this->config->hiddenByClass = null;
79+
}
80+
81+
if (!$this->config->hiddenContainer)
82+
{
83+
$this->config->hiddenContainer = '<div %s>%s</div>';
7884
}
7985

8086
if ($this->config->template === '')
@@ -128,7 +134,13 @@ protected function prepareTemplate(string $template): string
128134

129135
if ($this->config->hidden)
130136
{
131-
$template = '<div ' . $this->config->hiddenBy . '>' . $template . '</div>';
137+
if(substr_count($this->config->hiddenContainer, "%") != 2)
138+
{
139+
$this->config->hiddenContainer = '<div %s>%s</div>';
140+
}
141+
$template = sprintf($this->config->hiddenContainer,
142+
($this->config->hiddenByClass ? (sprintf('class="%s"', $this->config->hiddenByClass)) : (sprintf('style="%s"', 'display:none'))),
143+
$template);
132144
}
133145
return $template;
134146
}

0 commit comments

Comments
 (0)