getKey(); $url = $settings->keyLocation(); if ( '' === $expected || '' === $url ) { return [ 'code' => 0, 'ok' => false, ]; } if ( ! function_exists( 'wp_safe_remote_get' ) ) { return [ 'code' => 0, 'ok' => false, ]; } $response = wp_safe_remote_get( $url, [ 'timeout' => 10 ] ); if ( function_exists( 'is_wp_error' ) && is_wp_error( $response ) ) { return [ 'code' => 0, 'ok' => false, ]; } $code = 0; if ( function_exists( 'wp_remote_retrieve_response_code' ) ) { $code = (int) wp_remote_retrieve_response_code( $response ); } $body = ''; if ( function_exists( 'wp_remote_retrieve_body' ) ) { $body = (string) wp_remote_retrieve_body( $response ); } $matched = 200 === $code && hash_equals( $expected, trim( $body ) ); return [ 'code' => $code, 'ok' => $matched, ]; } }