Added check for distance_min and make sure it's a positive integer - fixes Issue #7

Revise name/token update settings
Minor formatting
This commit is contained in:
Justin Foell
2017-12-08 12:33:29 -06:00
parent 7f65a6c145
commit 4668b4fc4e
4 changed files with 43 additions and 28 deletions
+14 -7
View File
@@ -40,9 +40,12 @@ class WPStrava_API {
else
$error = print_r( $response, true );
return new WP_Error( 'wp-strava_post',
sprintf( __( 'ERROR %s %s - %s', 'wp-strava'), $response['response']['code'], $response['response']['message'], $error ),
$response );
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 <code>define( \'WP_STRAVA_DEBUG\' true );</code> to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
$error
);
}
return json_decode( $response['body'] );
@@ -53,8 +56,9 @@ class WPStrava_API {
$url .= $uri;
if ( ! empty( $args ) )
if ( ! empty( $args ) ) {
$url = add_query_arg( $args, $url );
}
$get_args = array(
'headers' => array(),
@@ -79,9 +83,12 @@ class WPStrava_API {
else
$error = print_r( $response, true );
return new WP_Error( 'wp-strava_get',
sprintf( __( 'ERROR %s %s - %s', 'wp-strava' ), $response['response']['code'], $response['response']['message'], $error ),
$response );
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 <code>define( \'WP_STRAVA_DEBUG\' true );</code> to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
$error
);
}
return json_decode( $response['body'] );