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/Traits/HasNonces.php +21 -0 2.0.0 → 2.1.1 View file →
@@ -1,0 +1,21 @@
1 +<?php
2 +
3 +declare(strict_types=1);
4 +
5 +namespace Metricool\Traits;
6 +
7 +trait HasNonces
8 +{
9 + /**
10 + * Method for verifying the nonce
11 + * @param mixed $nonce Preferably string, not type-casted to prevent errors
12 + */
13 + protected function verifyNonce($nonce, string $action = 'metricool_nonce'): bool
14 + {
15 + if (is_string($nonce) === false) {
16 + return false;
17 + }
18 +
19 + return (bool) wp_verify_nonce(sanitize_text_field(wp_unslash($nonce)), $action);
20 + }
21 +}