PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.7
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.7
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 / PhpAuthUser.php

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

54 lines 1.1 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 PhpAuthUser extends NullToken
8 {
9 /**
10 * Parsed authentification username
11 *
12 * @var string
13 */
14 protected $username;
15
16 /**
17 * Parsed authentification password
18 *
19 * @var string
20 */
21 protected $password;
22
23 /**
24 * Transform current instance to key object
25 *
26 * @return Key
27 */
28 public function toKey(): Key
29 {
30 $key = new Key();
31 $key->setProperty('username', $this->username);
32 $key->setProperty('password', $this->password);
33
34 return $key;
35 }
36
37 /**
38 * Parse environment variables and store value in object
39 *
40 * @return bool "true" if value was found or "false"
41 */
42 protected function parse(): bool
43 {
44 if ($username = $this->getArrayValue($_SERVER, 'PHP_AUTH_USER')) {
45 $this->username = $username;
46 $this->password = array_key_exists('PHP_AUTH_PW', $_SERVER) ? $_SERVER['PHP_AUTH_PW'] : null;
47
48 return true;
49 }
50
51 return false;
52 }
53 }
54