← All changes
|
includes/Editors/BlockEditor/Blocks/ArticleSummary.php
+4
-3
4.4.1
→
4.9.3
View file →
| @@ -77,11 +77,12 @@ | ||
| 77 | 77 | * |
| 78 | 78 | * @return bool |
| 79 | 79 | */ |
| 80 | 80 | private function is_editor_mode() { |
| 81 | - // Check if we're in Gutenberg editor | |
| 82 | - return defined( 'REST_REQUEST' ) && REST_REQUEST && | |
| 83 | - isset( $_REQUEST['context'] ) && $_REQUEST['context'] === 'edit'; | |
| 81 | + // Check if we're in Gutenberg editor. | |
| 82 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- REST request context check; nonce verified by REST cookie auth. | |
| 83 | + $context = isset( $_REQUEST['context'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ) : ''; | |
| 84 | + return defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $context; | |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | 87 | /** |
| 87 | 88 | * Get view parameters for the template |