Open
Conversation
…eview=true [ED-14320] (elementor#25622)
louiswol94
reviewed
Apr 26, 2024
| public function get_doc_for_frontend( $post_id ) { | ||
| if ( is_preview() || Plugin::$instance->preview->is_preview_mode() ) { | ||
| $is_preview = is_preview() && isset( $_GET['preview_id'] ) && $post_id === (int) $_GET['preview_id']; | ||
| $is_nonce_verify = isset( $_GET['preview_id'] ) && wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ); |
There was a problem hiding this comment.
Suggested change
| $is_nonce_verify = isset( $_GET['preview_id'] ) && wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ); | |
| $is_nonce_verify = isset( $_GET['preview_id'] ) && wp_verify_nonce( Utils::get_super_global_value( $_GET, 'preview_nonce' ), 'post_preview_' . (int) $_GET['preview_id'] ); |
e795af0 to
ad2ac73
Compare
louiswol94
reviewed
Apr 26, 2024
| */ | ||
| public function get_doc_for_frontend( $post_id ) { | ||
| if ( is_preview() || Plugin::$instance->preview->is_preview_mode() ) { | ||
| $is_preview = is_preview() && isset( $_GET['preview_id'] ) && $post_id === (int) Utils::get_super_global_value( $_GET, 'preview_id' ); |
There was a problem hiding this comment.
Do you need the isset( $_GET['preview_id'] )? IIRC Utils::get_super_global_value() already handles the isset.
louiswol94
reviewed
Apr 26, 2024
Comment on lines
+278
to
+279
| $is_preview = is_preview() && $post_id === (int) Utils::get_super_global_value( $_GET, 'preview_id' ); | ||
| $is_nonce_verify = wp_verify_nonce( Utils::get_super_global_value( $_GET, 'preview_nonce' ), 'post_preview_' . (int) Utils::get_super_global_value( $_GET, 'preview_id' ) ); |
There was a problem hiding this comment.
Suggested change
| $is_preview = is_preview() && $post_id === (int) Utils::get_super_global_value( $_GET, 'preview_id' ); | |
| $is_nonce_verify = wp_verify_nonce( Utils::get_super_global_value( $_GET, 'preview_nonce' ), 'post_preview_' . (int) Utils::get_super_global_value( $_GET, 'preview_id' ) ); | |
| $preview_id = (int) Utils::get_super_global_value( $_GET, 'preview_id' ); | |
| $is_preview = is_preview() && $post_id === $preview_id; | |
| $is_nonce_verify = wp_verify_nonce( Utils::get_super_global_value( $_GET, 'preview_nonce' ), 'post_preview_' . $preview_id; |
Sorry one more. You can cache (int) Utils::get_super_global_value( $_GET, 'preview_id' ); in a variable.
louiswol94
approved these changes
Apr 26, 2024
mykytamurzin
approved these changes
Apr 26, 2024
…wed-by-anyone-with-the-article-url-preview-true
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.
PR Checklist
Description
Improve Preview
PR Type
What kind of change does this PR introduce?
Quality assurance