PluginProbe
Faust.js / 0.7.3
Faust.js v0.7.3
1.8.12 1.8.11 1.4.1 1.8.0 1.8.8 1.8.9 trunk 0.7.0 0.7.1 0.7.10 0.7.11 0.7.3 0.7.4 0.7.5 0.7.6 0.7.7 0.7.8 0.7.9 0.8.0 0.8.1 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 All 40 releases
faustwp / includes / deny-public-access / functions.php

functions.php in Faust.js 0.7.3, at includes/deny-public-access/functions.php

40 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Utility functions pertaining to denying public access.
4 *
5 * @package FaustWP
6 */
7
8 namespace WPE\FaustWP\Deny_Public_Access;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Checks if the current request is coming from the file editor.
16 *
17 * @see https://github.com/WordPress/wordpress-develop/blob/5.8.1/src/wp-includes/load.php#L1591-L1593
18 *
19 * @return bool
20 */
21 function doing_file_editor_save() {
22 // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
23 // Disabling as we are mimicking WordPress core's own check.
24 // https://github.com/WordPress/wordpress-develop/blob/5.8.1/src/wp-includes/load.php#L1591-L1595.
25 if ( ! isset( $_REQUEST['wp_scrape_key'] ) || ! isset( $_REQUEST['wp_scrape_nonce'] ) ) {
26 return false;
27 }
28
29 $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 );
30 $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] );
31 // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
32
33 // Validate nonce.
34 if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) {
35 return false;
36 }
37
38 return true;
39 }
40