mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-11 18:56:18 +09:00
Increased API post timeout to 30 seconds
Simplified access token logic
This commit is contained in:
@@ -18,6 +18,7 @@ class WPStrava_API {
|
||||
'body' => http_build_query( $data ),
|
||||
'sslverify' => false,
|
||||
'headers' => array(),
|
||||
'timeout' => 30,
|
||||
);
|
||||
|
||||
if ( $this->access_token ) {
|
||||
|
||||
+11
-21
@@ -298,29 +298,19 @@ class WPStrava_Settings {
|
||||
|
||||
$strava_info = $api->post( 'oauth/token', $data );
|
||||
|
||||
if ( $strava_info ) {
|
||||
if ( ! empty( $strava_info->access_token ) ) {
|
||||
$this->feedback .= __( 'Successfully authenticated.', 'wp-strava' );
|
||||
return $strava_info->access_token;
|
||||
} else {
|
||||
if ( WP_STRAVA_DEBUG ) {
|
||||
// Translators: message shown when there's an authentication problem with the Strava API (debug on).
|
||||
$this->feedback .= sprintf( __( 'Authentication failed, OAuth response: <pre>%s</pre>', 'wp-strava' ), print_r( $strava_info, true ) ); // phpcs:ignore -- Debug output.
|
||||
} else {
|
||||
// Translators: message shown when there's an authentication problem with the Strava API.
|
||||
$this->feedback .= __( 'Authentication failed, please check your credentials. See full error by adding<br/><code>define( \'WP_STRAVA_DEBUG\', true );</code><br/>to wp-config.php', 'wp-strava' );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Translators: error message from Strava
|
||||
$this->feedback .= sprintf( __( 'There was an error receiving data from Strava: %s', 'wp-strava' ), print_r( $strava_info, true ) ); // phpcs:ignore -- Debug output.
|
||||
return false;
|
||||
if ( isset( $strava_info->access_token ) ) {
|
||||
$this->feedback .= __( 'Successfully authenticated.', 'wp-strava' );
|
||||
return $strava_info->access_token;
|
||||
}
|
||||
} else {
|
||||
$this->feedback .= __( 'Missing Client ID or Client Secret.', 'wp-strava' );
|
||||
|
||||
// Translators: error message from Strava
|
||||
$this->feedback .= sprintf( __( 'There was an error receiving data from Strava: <pre>%s</pre>', 'wp-strava' ), print_r( $strava_info, true ) ); // phpcs:ignore -- Debug output.
|
||||
return false;
|
||||
} // End if.
|
||||
|
||||
}
|
||||
|
||||
$this->feedback .= __( 'Missing Client ID or Client Secret.', 'wp-strava' );
|
||||
return false;
|
||||
}
|
||||
|
||||
public function print_gmaps_key_input() {
|
||||
|
||||
@@ -85,6 +85,7 @@ rawurlencode() redirect_uri so authentication works more consistently.
|
||||
Added FAQ about caching.
|
||||
Changed to new-style phpcs ignores and ignored some additional lines.
|
||||
Added debug option to Authentication Failed path for https://wordpress.org/support/topic/problem-authenticating-with-strava/
|
||||
Increased API Post timeout to 30 seconds.
|
||||
|
||||
|
||||
= 1.5.0 =
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: WP Strava
|
||||
* Plugin URI: https://wordpress.org/plugins/wp-strava/
|
||||
* Description: Show your strava.com activity on your WordPress site. Some Icons are Copyright © Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 license.
|
||||
* Version: 1.5.1-rc2
|
||||
* Version: 1.5.1-rc3
|
||||
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott
|
||||
* License: GPL2
|
||||
* Text Domain: wp-strava
|
||||
|
||||
Reference in New Issue
Block a user