Added extended timeout to all API requests

Bumped version
Fixed spelling errors
This commit is contained in:
Justin Foell
2018-03-29 10:44:58 -05:00
parent 5797d2b639
commit 71060c35b0
4 changed files with 13 additions and 11 deletions
+7 -4
View File
@@ -44,8 +44,8 @@ class WPStrava_API {
return new WP_Error(
'wp-strava_post',
// Translators: message shown when there's a problem with ab HTTP POST to the Strava API.
sprintf( __( 'ERROR %1$s %2$s - See full error by adding<br/><code>define( \'WP_STRAVA_DEBUG\', true );</code><br/>to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
// Translators: message shown when there's a problem with an HTTP POST to the Strava API.
sprintf( __( 'ERROR %1$s %2$s - See full error by adding<br/><code>define( \'WPSTRAVA_DEBUG\', true );</code><br/>to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
$error
);
}
@@ -63,8 +63,11 @@ class WPStrava_API {
}
$get_args = array(
'headers' => array(),
'headers' => array(),
'sslverify' => false,
'timeout' => 30,
);
if ( $this->access_token ) {
$get_args['headers']['Authorization'] = 'Bearer ' . $this->access_token;
}
@@ -91,7 +94,7 @@ class WPStrava_API {
return new WP_Error(
'wp-strava_get',
// Translators: message shown when there's a problem with an HTTP GET to the Strava API.
sprintf( __( 'ERROR %1$s %2$s - See full error by adding<br/><code>define( \'WP_STRAVA_DEBUG\', true );</code><br/>to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
sprintf( __( 'ERROR %1$s %2$s - See full error by adding<br/><code>define( \'WPSTRAVA_DEBUG\', true );</code><br/>to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
$error
);
}
+2 -2
View File
@@ -91,7 +91,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
if ( is_wp_error( $activities ) ) {
echo $args['before_widget'];
if ( $title ) {
echo $args['$before_title'] . $title . $args['$after_title'];
echo $args['before_title'] . $title . $args['after_title'];
}
if ( WPSTRAVA_DEBUG ) {
@@ -101,7 +101,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
} else {
echo $activities->get_error_message();
}
echo $args['$after_widget'];
echo $args['after_widget'];
return;
}