equal
deleted
inserted
replaced
9 /** |
9 /** |
10 * Core class used to set, validate, and clear cookies that identify a Recovery Mode session. |
10 * Core class used to set, validate, and clear cookies that identify a Recovery Mode session. |
11 * |
11 * |
12 * @since 5.2.0 |
12 * @since 5.2.0 |
13 */ |
13 */ |
|
14 #[AllowDynamicProperties] |
14 final class WP_Recovery_Mode_Cookie_Service { |
15 final class WP_Recovery_Mode_Cookie_Service { |
15 |
16 |
16 /** |
17 /** |
17 * Checks whether the recovery mode cookie is set. |
18 * Checks whether the recovery mode cookie is set. |
18 * |
19 * |
195 * |
196 * |
196 * @param string $data Data to hash. |
197 * @param string $data Data to hash. |
197 * @return string|false The hashed $data, or false on failure. |
198 * @return string|false The hashed $data, or false on failure. |
198 */ |
199 */ |
199 private function recovery_mode_hash( $data ) { |
200 private function recovery_mode_hash( $data ) { |
200 if ( ! defined( 'AUTH_KEY' ) || AUTH_KEY === 'put your unique phrase here' ) { |
201 $default_keys = array_unique( |
|
202 array( |
|
203 'put your unique phrase here', |
|
204 /* |
|
205 * translators: This string should only be translated if wp-config-sample.php is localized. |
|
206 * You can check the localized release package or |
|
207 * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php |
|
208 */ |
|
209 __( 'put your unique phrase here' ), |
|
210 ) |
|
211 ); |
|
212 |
|
213 if ( ! defined( 'AUTH_KEY' ) || in_array( AUTH_KEY, $default_keys, true ) ) { |
201 $auth_key = get_site_option( 'recovery_mode_auth_key' ); |
214 $auth_key = get_site_option( 'recovery_mode_auth_key' ); |
202 |
215 |
203 if ( ! $auth_key ) { |
216 if ( ! $auth_key ) { |
204 if ( ! function_exists( 'wp_generate_password' ) ) { |
217 if ( ! function_exists( 'wp_generate_password' ) ) { |
205 require_once ABSPATH . WPINC . '/pluggable.php'; |
218 require_once ABSPATH . WPINC . '/pluggable.php'; |
210 } |
223 } |
211 } else { |
224 } else { |
212 $auth_key = AUTH_KEY; |
225 $auth_key = AUTH_KEY; |
213 } |
226 } |
214 |
227 |
215 if ( ! defined( 'AUTH_SALT' ) || AUTH_SALT === 'put your unique phrase here' || AUTH_SALT === $auth_key ) { |
228 if ( ! defined( 'AUTH_SALT' ) || in_array( AUTH_SALT, $default_keys, true ) || AUTH_SALT === $auth_key ) { |
216 $auth_salt = get_site_option( 'recovery_mode_auth_salt' ); |
229 $auth_salt = get_site_option( 'recovery_mode_auth_salt' ); |
217 |
230 |
218 if ( ! $auth_salt ) { |
231 if ( ! $auth_salt ) { |
219 if ( ! function_exists( 'wp_generate_password' ) ) { |
232 if ( ! function_exists( 'wp_generate_password' ) ) { |
220 require_once ABSPATH . WPINC . '/pluggable.php'; |
233 require_once ABSPATH . WPINC . '/pluggable.php'; |