Skip to content

Commit 659956e

Browse files
Clarify that it is logged-out AND admins, not logged-out OR admins
Co-authored-by: swissspidy <[email protected]>
1 parent cd25c51 commit 659956e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

plugins/speculation-rules/hooks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function plsr_is_speculative_loading_enabled(): bool {
2727
||
2828
'any' === $option['authentication']
2929
||
30-
( current_user_can( 'manage_options' ) && 'logged_out_or_admins' === $option['authentication'] )
30+
( current_user_can( 'manage_options' ) && 'logged_out_and_admins' === $option['authentication'] )
3131
)
3232
&&
3333
(

plugins/speculation-rules/settings.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function plsr_get_eagerness_labels(): array {
4646
*
4747
* @since n.e.x.t
4848
*
49-
* @return array{ logged_out: string, logged_out_or_admins: string, any: string } Associative array of `$authentication => $label` pairs.
49+
* @return array{ logged_out: string, logged_out_and_admins: string, any: string } Associative array of `$authentication => $label` pairs.
5050
*/
5151
function plsr_get_authentication_labels(): array {
5252
return array(
5353
'logged_out' => _x( 'Logged-out visitors only (default)', 'setting label', 'speculation-rules' ),
54-
'logged_out_or_admins' => _x( 'Administrators or logged-out visitors', 'setting label', 'speculation-rules' ),
54+
'logged_out_and_admins' => _x( 'Administrators and logged-out visitors', 'setting label', 'speculation-rules' ),
5555
'any' => _x( 'Any user (logged-in or logged-out)', 'setting label', 'speculation-rules' ),
5656
);
5757
}
@@ -82,7 +82,7 @@ function plsr_get_setting_default(): array {
8282
*
8383
* @since 1.4.0
8484
*
85-
* @return array{ mode: 'prefetch'|'prerender', eagerness: 'conservative'|'moderate'|'eager', authentication: 'logged_out'|'logged_out_or_admins'|'any' } {
85+
* @return array{ mode: 'prefetch'|'prerender', eagerness: 'conservative'|'moderate'|'eager', authentication: 'logged_out'|'logged_out_and_admins'|'any' } {
8686
* Stored setting value.
8787
*
8888
* @type string $mode Mode.
@@ -101,7 +101,7 @@ function plsr_get_stored_setting_value(): array {
101101
* @todo Consider whether the JSON schema for the setting could be reused here.
102102
*
103103
* @param mixed $input Setting to sanitize.
104-
* @return array{ mode: 'prefetch'|'prerender', eagerness: 'conservative'|'moderate'|'eager', authentication: 'logged_out'|'logged_out_or_admins'|'any' } {
104+
* @return array{ mode: 'prefetch'|'prerender', eagerness: 'conservative'|'moderate'|'eager', authentication: 'logged_out'|'logged_out_and_admins'|'any' } {
105105
* Sanitized setting.
106106
*
107107
* @type string $mode Mode.

plugins/speculation-rules/tests/test-speculation-rules-settings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ public function data_plsr_sanitize_setting(): array {
132132
)
133133
),
134134
),
135-
'valid auth logged_out_or_admins' => array(
135+
'valid auth logged_out_and_admins' => array(
136136
array(
137-
'authentication' => 'logged_out_or_admins',
137+
'authentication' => 'logged_out_and_admins',
138138
),
139139
array_merge(
140140
$default_value,
141141
array(
142-
'authentication' => 'logged_out_or_admins',
142+
'authentication' => 'logged_out_and_admins',
143143
)
144144
),
145145
),
@@ -158,14 +158,14 @@ public function data_plsr_sanitize_setting(): array {
158158
array(
159159
'mode' => 'prefetch',
160160
'eagerness' => 'conservative',
161-
'authentication' => 'logged_out_or_admins',
161+
'authentication' => 'logged_out_and_admins',
162162
),
163163
array_merge(
164164
$default_value,
165165
array(
166166
'mode' => 'prefetch',
167167
'eagerness' => 'conservative',
168-
'authentication' => 'logged_out_or_admins',
168+
'authentication' => 'logged_out_and_admins',
169169
)
170170
),
171171
),

plugins/speculation-rules/tests/test-speculation-rules.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ public function data_provider_to_test_plsr_is_speculative_loading_enabled(): arr
6060
'set_up' => null,
6161
'expected' => true,
6262
),
63-
'authentication_logged_out_or_admins_auth_subscriber_auth_with_pretty_permalinks' => array(
63+
'authentication_logged_out_and_admins_auth_subscriber_auth_with_pretty_permalinks' => array(
6464
'settings' => array(
65-
'authentication' => 'logged_out_or_admins',
65+
'authentication' => 'logged_out_and_admins',
6666
),
6767
'pretty_permalinks' => true,
6868
'current_user_role' => 'subscriber',
6969
'set_up' => null,
7070
'expected' => false,
7171
),
72-
'authentication_logged_out_or_admins_auth_administrator_auth_with_pretty_permalinks' => array(
72+
'authentication_logged_out_and_admins_auth_administrator_auth_with_pretty_permalinks' => array(
7373
'settings' => array(
74-
'authentication' => 'logged_out_or_admins',
74+
'authentication' => 'logged_out_and_admins',
7575
),
7676
'pretty_permalinks' => true,
7777
'current_user_role' => 'administrator',

0 commit comments

Comments
 (0)