PasswordGate final class
Minn\Content\PasswordGate · public/minn/src/Minn/Content/PasswordGate.php · 75 lines
A password-protected post on the front end: its body is the password form, its excerpt a fixed sentence, its title prefixed, exactly as the reference shows them to a reader who has not entered the password.
Constants and properties
| const | EXCERPT = 'There is no excerpt because this is a protected post.' |
Public
| static | is(Minn\Content\PostRecord $post): bool# | True while the post has a password the reader's cookie does not match. | |||
| static | cookieUnlocks(string $password, string $cookie): bool# | Whether a wp-postpass cookie opens a post with this password. Only a hash in the setting the reference writes ("$P$B") is tried, as the reference tries it: a cookie naming its own work factor could otherwise make one request hash up to 2^30 times. | |||
| static | title(Minn\Content\PostRecord $post): string# | "Protected: " for a password, "Private: " for a private post, as the reference prefixes titles. | |||
| static | form(Minn\Content\PostRecord $post, string $siteUrl, string $permalink, string $invalid = ''): string# | The form, with the reference's stray closing p after the hidden field; with the message a wrong password earns ($invalid, see invalid()) above the field and named by it. | |||
| static | formForReader(Minn\Content\PostRecord $post, string $siteUrl, string $permalink): string# | The form as the current reader sees it: with the wrong-password message when their own form sent them back. | |||
| static | invalid(string $permalink, string $referer, string $cookie, Closure $post): string# | The message over the form for a reader the post's own page sent back with a password cookie set (the referer is exactly its address), as plugins word it (the_password_form_incorrect_password); '' for anyone else. The cookie is not checked: the form only shows while it fails. $post gives the post the filter is handed, asked for only then.
|
Nothing matches.