PluginProbe
Metricool – Social media and site statistics / trunk
Metricool – Social media and site statistics vtrunk
2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
metricool / app / Traits / HasNonces.php

HasNonces.php in Metricool – Social media and site statistics trunk, at app/Traits/HasNonces.php

22 lines 482 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 }
22