| 1 |
<div <?php echo $this->attr('age-gate-shortcode'); ?><?php echo ($settings->poster ? ' style="background-image: url(' . esc_url($settings->poster) . ');"' : '') ?>><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 2 |
<form method="post" <?php echo $this->attr('age-gate-form'); ?>><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 3 |
<div <?php echo $this->attr('age-gate-shortcode-inner'); ?>><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 4 |
<?php if ($settings->inputType !== 'buttons') : ?> |
| 5 |
<<?php echo esc_attr($settings->challengeElement ?: 'p') ?> <?php echo $this->attr('age-gate-challenge') ?>><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 6 |
<?php echo esc_html(sprintf($this->stringTemplate($settings->labelButtons, ['age' => $content->getAge($settings->anonymous)]), $content->getAge($settings->anonymous))) ?> |
| 7 |
</<?php echo esc_attr($settings->challengeElement ?: 'p') ?>> |
| 8 |
<?php endif ?> |
| 9 |
<?php |
| 10 |
try { |
| 11 |
$this->insert('partials/form/sections/' . $settings->inputType); |
| 12 |
} catch (Exception $e) { |
| 13 |
$settings->set('inputType', 'buttons'); |
| 14 |
$this->insert('partials/form/sections/buttons'); |
| 15 |
} |
| 16 |
?> |
| 17 |
<?php if ($settings->method === 'js') : ?> |
| 18 |
<div <?php echo $this->attr('age-gate-errors') ?>></div><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 19 |
<?php endif; ?> |
| 20 |
|
| 21 |
<?php if ($settings->method !== 'js' && $e && $c == ($postData['ag_sc'] ?? false)) : ?><?php // phpcs:ignore WordPress.Security.NonceVerification.Missing ?> |
| 22 |
<div <?php echo $this->attr('age-gate-errors') ?>><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 23 |
<p <?php echo $this->attr('age-gate-error') ?>><?php echo $this->mdLine(end($e)) ?></p><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 24 |
|
| 25 |
</div> |
| 26 |
<?php endif; ?> |
| 27 |
|
| 28 |
<?php if ($settings->inputType !== 'buttons') : ?> |
| 29 |
<?php $this->insert('partials/form/submit') ?> |
| 30 |
<?php endif; ?> |
| 31 |
<input type="hidden" name="age_gate[age]" value="<?php echo esc_attr($encrypt->encrypt($content->getAge())) ?>" /> |
| 32 |
<input type="hidden" name="age_gate[shortcode]" value="<?php echo esc_attr($encrypt->encrypt($settings->inputType)) ?>" /> |
| 33 |
<input type="hidden" name="ag_sc" value="<?php echo esc_attr($c) ?>" /> |
| 34 |
</div> |
| 35 |
</form> |
| 36 |
</div> |
| 37 |
|