Repository navigation
Cookie scope - #25
Open
tomjn wants to merge 9 commits into
Open
Cookie scope#25tomjn wants to merge 9 commits into
tomjn wants to merge 9 commits into
Conversation
Contributor
Author
|
Needs further testing |
3 of 4 tasks
Cookie\save() called setcookie() with only a name and value. When the flag is toggled through admin-ajax.php, the cookie then gets the /wp-admin/ path, so front-end requests never send it, and it expires when the browser closes. Use the options form of setcookie() with COOKIEPATH, COOKIE_DOMAIN, a Secure attribute that follows is_ssl(), HttpOnly, SameSite=Lax and a one-year expiry. Also update $_COOKIE so reads later in the same request see the new value, and correct the docblock: setcookie() returns bool, not int. Co-Authored-By: Claude <noreply@anthropic.com>
The branch added `: void` return types to functions in files the cookie scope does not touch, and put a full stop in the plugin.php docblock. Restore those files to their state on master so the pull request only adds the cookie scope: inc/cookie.php, the Cookie\bootstrap() call and the require_once. Co-Authored-By: Claude <noreply@anthropic.com>
The updated coding standards in the coding-standards pull request reject `function foo() : void` (PSR12.Functions.ReturnTypeDeclaration .SpaceBeforeColon). Use `function foo(): void`, which the current standards also accept, so the file passes lint before and after that change. Co-Authored-By: Claude <noreply@anthropic.com>
The "Scope of Setting a Flag" section listed only `user` and `site`. Add `cookie`, and say why to pick it: the value lives in the visitor's browser, so it works for logged-out visitors and is readable before `init`, unlike the user scope. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
@tomjn I've picked this up. Changes since your last commit:
A smoke test with stubbed WordPress functions passes: a stored Merge this after #31. The options-array form of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new cookie based scope for flags that loads earlier