PluginProbe
Metricool – Social media and site statistics / 2.1.1
Metricool – Social media and site statistics v2.1.1
2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
← All changes | app/Http/Middleware/VerifyNonce.php +3 -6 2.0.2 → 2.1.1 View file →
@@ -15,12 +15,9 @@
15 15 {
16 16 use HasRestAccess;
17 17 use HasNonces;
18 18
19 - /**
20 - * @throws \Exception when not called with a capability
21 - */
22 - public function handle(\WP_REST_Request $request): ?\WP_REST_Response
19 + public function handle(\WP_REST_Request $request, callable $next)
23 20 {
24 21 $method = $request->get_method();
25 22 $nonce = $request->get_param('nonce');
26 23
@@ -27,13 +24,13 @@
27 24 // For methods that modify data, verify the nonce
28 25 $methodsRequiringNonce = ['POST', 'PUT', 'PATCH', 'DELETE'];
29 26 if (in_array($method, $methodsRequiringNonce) && ($this->verifyNonce($nonce) === false)) {
30 27 return $this->sendHttpErrorResponse(
31 - __('Forbidden', 'metricool'),
28 + 'Forbidden',
32 29 null,
33 30 403
34 31 );
35 32 }
36 33
37 - return null;
34 + return $next($request);
38 35 }
39 36 }