ID; if ( ! $uid ) { /** * Filters whether the user who generated the nonce is logged out. * * @param int $uid ID of the nonce-owning user. * @param string|int $action The nonce action, or -1 if none was provided. */ $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } if ( empty( $nonce ) ) { return false; } $token = wp_get_session_token(); $tick = wp_nonce_tick( $action ); $i = 0; while ( $i <= NONCENSIBLE_TICKS_PER_NONCE_LIFE ) { # yes, ticks + 1 $expected = substr( wp_hash( "$tick|$action|$uid|$token", 'nonce' ), -12, 10 ); if ( hash_equals( $expected, $nonce ) ) { // Nonce generated 0-15 hours ago. if ( $i <= ( NONCENSIBLE_TICKS_PER_NONCE_LIFE / 2 ) ) { return 1; } // Nonce generated 12-27 hours ago. return 2; } $tick--; $i++; } /** * Fires when nonce verification fails. * * @param string $nonce The invalid nonce. * @param string|int $action The nonce action. * @param WP_User $user The current user object. * @param string $token The user's session token. */ do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token ); // Invalid nonce. return false; } }