1 | <?php |
---|
2 | |
---|
3 | namespace LiteSpeed; |
---|
4 | |
---|
5 | defined('WPINC') || exit; |
---|
6 | ?> |
---|
7 | |
---|
8 | <tr> |
---|
9 | <th> |
---|
10 | <?php $id = Base::O_CACHE_LOGIN_COOKIE; ?> |
---|
11 | <?php $this->title($id); ?> |
---|
12 | </th> |
---|
13 | <td> |
---|
14 | <?php |
---|
15 | $this->build_input($id); |
---|
16 | |
---|
17 | $this->_validate_syntax($id); |
---|
18 | |
---|
19 | echo '<p class="litespeed-desc">' . __('SYNTAX: alphanumeric and "_".', 'litespeed-cache') |
---|
20 | . ' ' . __('No spaces and case sensitive.', 'litespeed-cache') |
---|
21 | . ' ' . __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache') |
---|
22 | . '</p>' |
---|
23 | . '<p class="litespeed-desc">' |
---|
24 | . sprintf(__('The default login cookie is %s.', 'litespeed-cache'), '<code>_lscache_vary</code>') |
---|
25 | . ' ' . __('The server will determine if the user is logged in based on the existence of this cookie.', 'litespeed-cache') |
---|
26 | . ' ' . __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache') |
---|
27 | . ' ' . __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache') |
---|
28 | . ' ' . __('The cookie set here will be used for this WordPress installation.', 'litespeed-cache') |
---|
29 | . '</p>' |
---|
30 | . '<p class="litespeed-desc">' |
---|
31 | . __('Example use case:', 'litespeed-cache') |
---|
32 | . '<br />' |
---|
33 | . sprintf(__('There is a WordPress installed for %s.', 'litespeed-cache'), '<u>www.example.com</u>') |
---|
34 | . '<br />' |
---|
35 | . sprintf(__('Then another WordPress is installed (NOT MULTISITE) at %s', 'litespeed-cache'), '<u>www.example.com/blog/</u>') |
---|
36 | . ' ' . __('The cache needs to distinguish who is logged into which WordPress site in order to cache correctly.', 'litespeed-cache') |
---|
37 | . '<br />'; ?> |
---|
38 | <?php Doc::notice_htaccess(); |
---|
39 | echo '</p>'; ?> |
---|
40 | <?php |
---|
41 | |
---|
42 | if (preg_match('#[^\w\-]#', $this->conf($id))) { |
---|
43 | echo '<div class="litespeed-callout notice notice-error inline"><p>❌ ' . __('Invalid login cookie. Invalid characters found.', 'litespeed-cache') . '</p></div>'; |
---|
44 | } |
---|
45 | |
---|
46 | if (defined('LITESPEED_ON') && $this->conf($id)) { |
---|
47 | $cookie_rule = ''; |
---|
48 | try { |
---|
49 | $cookie_rule = Htaccess::cls()->current_login_cookie(); |
---|
50 | } catch (\Exception $e) { |
---|
51 | echo '<div class="litespeed-callout notice notice-error inline"><p>' . $e->getMessage() . '</p></div>'; |
---|
52 | } |
---|
53 | |
---|
54 | $cookie_arr = explode(',', $cookie_rule); |
---|
55 | if (!in_array($this->conf($id), $cookie_arr)) { |
---|
56 | echo '<div class="litespeed-callout notice notice-warning inline"><p>' |
---|
57 | . __('WARNING: The .htaccess login cookie and Database login cookie do not match.', 'litespeed-cache') |
---|
58 | . '</p></div>'; |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | ?> |
---|
63 | </td> |
---|
64 | </tr> |
---|
65 | |
---|
66 | <tr> |
---|
67 | <th> |
---|
68 | <?php $id = Base::O_CACHE_VARY_COOKIES; ?> |
---|
69 | <?php $this->title($id); ?> |
---|
70 | </th> |
---|
71 | <td> |
---|
72 | <?php |
---|
73 | $this->build_textarea($id, 50); |
---|
74 | |
---|
75 | $this->_validate_syntax($id); |
---|
76 | |
---|
77 | echo '<p class="litespeed-desc">' . __('SYNTAX: alphanumeric and "_".', 'litespeed-cache') |
---|
78 | . ' ' . __('No spaces and case sensitive.', 'litespeed-cache') |
---|
79 | . '</p>' |
---|
80 | . '<p class="litespeed-desc">' |
---|
81 | . ' ' . __('You can list the 3rd party vary cookies here.', 'litespeed-cache') |
---|
82 | . '</p>' |
---|
83 | . '<p class="litespeed-desc">'; ?> |
---|
84 | <?php Doc::notice_htaccess(); |
---|
85 | echo '</p>'; ?> |
---|
86 | </td> |
---|
87 | </tr> |
---|