AccountClaimMiddleware.php
3 years ago
AdminColorMiddleware.php
2 years ago
ArchiveModelMiddleware.php
3 years ago
BrandColorMiddleware.php
3 years ago
CheckoutFormModeMiddleware.php
2 years ago
CheckoutRedirectMiddleware.php
3 years ago
ComponentAssetsMiddleware.php
3 years ago
CustomerDashboardRedirectMiddleware.php
3 years ago
EditModelMiddleware.php
3 years ago
InvoiceRedirectMiddleware.php
1 year ago
LoginLinkMiddleware.php
1 year ago
LoginMiddleware.php
2 years ago
NonceMiddleware.php
3 years ago
OrderRedirectMiddleware.php
3 years ago
PathRedirectMiddleware.php
3 years ago
PaymentFailureRedirectMiddleware.php
3 years ago
PurchaseRedirectMiddleware.php
3 years ago
SubscriptionRedirectMiddleware.php
3 years ago
UpsellMiddleware.php
2 years ago
WebhooksMiddleware.php
2 years ago
UpsellMiddleware.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Middleware; |
| 4 | |
| 5 | use Closure; |
| 6 | use SureCartCore\Requests\RequestInterface; |
| 7 | |
| 8 | /** |
| 9 | * Middleware for handling model archiving. |
| 10 | */ |
| 11 | class UpsellMiddleware { |
| 12 | /** |
| 13 | * Handle the request. |
| 14 | * |
| 15 | * @param RequestInterface $request Request. |
| 16 | * @param Closure $next Next. |
| 17 | * @return function |
| 18 | */ |
| 19 | public function handle( RequestInterface $request, Closure $next ) { |
| 20 | if ( empty( $request->query( 'sc_checkout_id' ) ) && ! current_user_can( 'edit_sc_orders' ) ) { |
| 21 | wp_die( esc_html__( 'You do not have permission to access this page.', 'surecart' ), esc_html__( 'Error', 'surecart' ), [ 'response' => 403 ] ); |
| 22 | } |
| 23 | |
| 24 | return $next( $request ); |
| 25 | } |
| 26 | } |
| 27 |