← All changes
|
jetpack_vendor/automattic/jetpack-connection/src/class-secrets.php
+3
-1
12.1.3
→
16.3-beta
View file →
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | if ( false === $user_id ) { |
| 59 | 59 | $user_id = get_current_user_id(); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $callable = apply_filters( 'jetpack_connection_secret_generator', array( get_called_class(), 'secret_callable_method' ) ); | |
| 62 | + $callable = apply_filters( 'jetpack_connection_secret_generator', array( static::class, 'secret_callable_method' ) ); | |
| 63 | 63 | |
| 64 | 64 | $secrets = Jetpack_Options::get_raw_option( |
| 65 | 65 | self::LEGACY_SECRETS_OPTION_NAME, |
| 66 | 66 | array() |
| @@ -92,8 +92,9 @@ | ||
| 92 | 92 | * |
| 93 | 93 | * @param String $action The action name. |
| 94 | 94 | * @param Integer $user_id The user identifier. |
| 95 | 95 | * @return string|array an array of secrets or an error string. |
| 96 | + * @phan-return string|array{secret_1:string,secret_2:string,exp:int} | |
| 96 | 97 | */ |
| 97 | 98 | public function get( $action, $user_id ) { |
| 98 | 99 | $secret_name = 'jetpack_' . $action . '_' . $user_id; |
| 99 | 100 | $secrets = Jetpack_Options::get_raw_option( |
| @@ -157,8 +158,9 @@ | ||
| 157 | 158 | * @param \WP_User $user The user object. |
| 158 | 159 | */ |
| 159 | 160 | do_action( 'jetpack_verify_secrets_begin', $action, $user ); |
| 160 | 161 | |
| 162 | + /** Closure to run the 'fail' action and return an error. */ | |
| 161 | 163 | $return_error = function ( WP_Error $error ) use ( $action, $user ) { |
| 162 | 164 | /** |
| 163 | 165 | * Verifying of the previously generated secret has failed. |
| 164 | 166 | * |