PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.7.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.7.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor_prefixed / guzzlehttp / guzzle / src / Cookie / SessionCookieJar.php
wp-mail-smtp / vendor_prefixed / guzzlehttp / guzzle / src / Cookie Last commit date
CookieJar.php 3 years ago CookieJarInterface.php 3 years ago FileCookieJar.php 3 years ago SessionCookieJar.php 3 years ago SetCookie.php 3 years ago
SessionCookieJar.php
68 lines
1 <?php
2
3 namespace WPMailSMTP\Vendor\GuzzleHttp\Cookie;
4
5 /**
6 * Persists cookies in the client session
7 */
8 class SessionCookieJar extends \WPMailSMTP\Vendor\GuzzleHttp\Cookie\CookieJar
9 {
10 /** @var string session key */
11 private $sessionKey;
12 /** @var bool Control whether to persist session cookies or not. */
13 private $storeSessionCookies;
14 /**
15 * Create a new SessionCookieJar object
16 *
17 * @param string $sessionKey Session key name to store the cookie
18 * data in session
19 * @param bool $storeSessionCookies Set to true to store session cookies
20 * in the cookie jar.
21 */
22 public function __construct($sessionKey, $storeSessionCookies = \false)
23 {
24 parent::__construct();
25 $this->sessionKey = $sessionKey;
26 $this->storeSessionCookies = $storeSessionCookies;
27 $this->load();
28 }
29 /**
30 * Saves cookies to session when shutting down
31 */
32 public function __destruct()
33 {
34 $this->save();
35 }
36 /**
37 * Save cookies to the client session
38 */
39 public function save()
40 {
41 $json = [];
42 foreach ($this as $cookie) {
43 /** @var SetCookie $cookie */
44 if (\WPMailSMTP\Vendor\GuzzleHttp\Cookie\CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
45 $json[] = $cookie->toArray();
46 }
47 }
48 $_SESSION[$this->sessionKey] = \json_encode($json);
49 }
50 /**
51 * Load the contents of the client session into the data array
52 */
53 protected function load()
54 {
55 if (!isset($_SESSION[$this->sessionKey])) {
56 return;
57 }
58 $data = \json_decode($_SESSION[$this->sessionKey], \true);
59 if (\is_array($data)) {
60 foreach ($data as $cookie) {
61 $this->setCookie(new \WPMailSMTP\Vendor\GuzzleHttp\Cookie\SetCookie($cookie));
62 }
63 } elseif (\strlen($data)) {
64 throw new \RuntimeException("Invalid cookie data");
65 }
66 }
67 }
68