WC_Admin_Report::check_current_range_nonce()
Check nonce for current range.
Method of the class: WC_Admin_Report{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_Report = new WC_Admin_Report(); $WC_Admin_Report->check_current_range_nonce( $current_range );
- $current_range(string) (required)
- Current range.
Changelog
Since 3.0.4 | Introduced. |
WC_Admin_Report::check_current_range_nonce() WC Admin Report::check current range nonce code WC 9.7.1
public function check_current_range_nonce( $current_range ) { if ( 'custom' !== $current_range ) { return; } if ( ! isset( $_GET['wc_reports_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_GET['wc_reports_nonce'] ), 'custom_range' ) ) { // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated wp_die( /* translators: %1$s: open link, %2$s: close link */ sprintf( esc_html__( 'This report link has expired. %1$sClick here to view the filtered report%2$s.', 'woocommerce' ), '<a href="' . esc_url( wp_nonce_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'custom_range', 'wc_reports_nonce' ) ) . '">', '</a>' ), esc_attr__( 'Confirm navigation', 'woocommerce' ) ); // phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated exit; } }