mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-11 18:56:18 +09:00
Merge branch 'master' into feature/14-responsive-tables
This commit is contained in:
@@ -136,16 +136,18 @@ class WPStrava_API {
|
||||
throw WPStrava_Exception::from_wp_error( $response );
|
||||
}
|
||||
|
||||
// Try *one* real-time token refresh if 404.
|
||||
if ( $retry && 404 == $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
||||
// Try *one* real-time token refresh if Unauthorized.
|
||||
if ( $retry && 401 == $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
||||
$retry = false;
|
||||
$auth = WPStrava::get_instance()->auth;
|
||||
if ( $auth instanceof WPStrava_AuthRefresh ) {
|
||||
$auth->auth_refresh();
|
||||
return $this->remote_get( $uri, $args );
|
||||
$access_token = $this->get_access_token();
|
||||
if ( $access_token ) {
|
||||
$get_args['headers']['Authorization'] = 'Bearer ' . $access_token;
|
||||
}
|
||||
return $this->remote_get( $uri, $get_args );
|
||||
}
|
||||
} else {
|
||||
$retry = true;
|
||||
}
|
||||
|
||||
if ( 200 != $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
||||
|
||||
@@ -305,6 +305,11 @@ class WPStrava_Settings {
|
||||
|
||||
$input = filter_input_array( INPUT_POST, $input_args );
|
||||
|
||||
// All IDs have been removed.
|
||||
if ( empty( $input['strava_id'] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Chop $nicknames to same size as ids.
|
||||
$nicknames = array_slice( $nicknames, 0, count( $input['strava_id'] ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user