PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.2.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.2.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / packages / blocks / Controllers / Middleware / SubscriptionNonceVerificationMiddleware.php
SubscriptionNonceVerificationMiddleware.php
27 lines 570 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace SureCartBlocks\Controllers\Middleware;
3
4 use Closure;
5
6 /**
7 * Handles nonce check for controller.
8 */
9 class SubscriptionNonceVerificationMiddleware {
10 /**
11 * Handle the middleware.
12 *
13 * @param string $action Action.
14 * @param Closure $next Next.
15 * @return function
16 */
17 public function handle( string $action, Closure $next ) {
18 // check nonce.
19 if ( ! wp_verify_nonce( $_REQUEST['nonce'] ?? '', 'subscription-switch' ) ) {
20 wp_die( esc_html__( 'Your session expired - please try again.', 'surecart' ) );
21 exit;
22 }
23
24 return $next();
25 }
26 }
27