Validator
1 month ago
BehavioralSignals.php
1 month ago
CaptchaConstants.php
2 months ago
CaptchaFormRenderer.php
2 weeks ago
CaptchaHooks.php
2 months ago
CaptchaPhrase.php
1 year ago
CaptchaRenderer.php
4 months ago
CaptchaSession.php
1 year ago
CaptchaUrlFactory.php
4 months ago
PageRenderer.php
5 months ago
ReCaptchaHooks.php
2 months ago
ReCaptchaRenderer.php
1 year ago
ReCaptchaValidator.php
1 year ago
TurnstileHooks.php
2 months ago
TurnstileRenderer.php
2 months ago
TurnstileValidator.php
2 months ago
index.php
1 year ago
CaptchaConstants.php
33 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Captcha; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class CaptchaConstants { |
| 9 | const TYPE_BUILTIN = 'built-in'; |
| 10 | const TYPE_RECAPTCHA = 'recaptcha'; |
| 11 | const TYPE_RECAPTCHA_INVISIBLE = 'recaptcha-invisible'; |
| 12 | const TYPE_TURNSTILE = 'turnstile'; |
| 13 | const TYPE_DISABLED = null; |
| 14 | const TYPE_SETTING_NAME = 'captcha.type'; |
| 15 | const ON_REGISTER_FORMS_SETTING_NAME = 'captcha.on_register_forms.enabled'; |
| 16 | |
| 17 | public static function isReCaptcha(?string $captchaType) { |
| 18 | return in_array($captchaType, [self::TYPE_RECAPTCHA, self::TYPE_RECAPTCHA_INVISIBLE]); |
| 19 | } |
| 20 | |
| 21 | public static function isBuiltIn(?string $captchaType) { |
| 22 | return $captchaType === self::TYPE_BUILTIN; |
| 23 | } |
| 24 | |
| 25 | public static function isTurnstile(?string $captchaType) { |
| 26 | return $captchaType === self::TYPE_TURNSTILE; |
| 27 | } |
| 28 | |
| 29 | public static function isDisabled(?string $captchaType) { |
| 30 | return $captchaType === self::TYPE_DISABLED || $captchaType === ''; |
| 31 | } |
| 32 | } |
| 33 |