PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / intervention / httpauth / src / Token / PhpAuthDigest.php

PhpAuthDigest.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.7.0, at vendor/intervention/httpauth/src/Token/PhpAuthDigest.php

50 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\HttpAuth\Token;
4
5 use Intervention\HttpAuth\Key;
6
7 class PhpAuthDigest extends NullToken
8 {
9 /**
10 * Parsed authentification value
11 *
12 * @var string
13 */
14 protected $value;
15
16 /**
17 * Transform current instance to key object
18 *
19 * @return Key
20 */
21 public function toKey(): Key
22 {
23 $authKey = new Key();
24 preg_match_all('@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@', $this->value, $matches, PREG_SET_ORDER);
25 foreach ($matches as $m) {
26 $key = $m[1];
27 $value = $m[2] ? $m[2] : $m[3];
28 $authKey->setProperty($key, $value);
29 }
30
31 return $authKey;
32 }
33
34 /**
35 * Parse environment variables and store value in object
36 *
37 * @return bool "true" if value was found or "false"
38 */
39 protected function parse(): bool
40 {
41 if ($value = $this->getArrayValue($_SERVER, 'PHP_AUTH_DIGEST')) {
42 $this->value = $value;
43
44 return true;
45 }
46
47 return false;
48 }
49 }
50