diff --git a/lib/API.class.php b/lib/API.class.php
index 79c9e77..66e8e73 100755
--- a/lib/API.class.php
+++ b/lib/API.class.php
@@ -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 define( \'WP_STRAVA_DEBUG\' true ); 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 define( \'WP_STRAVA_DEBUG\' true ); to wp-config.php', 'wp-strava' ), $response['response']['code'], $response['response']['message'] ),
+ $error
+ );
}
return json_decode( $response['body'] );
diff --git a/lib/LatestMapWidget.class.php b/lib/LatestMapWidget.class.php
index bb4234f..89d925a 100644
--- a/lib/LatestMapWidget.class.php
+++ b/lib/LatestMapWidget.class.php
@@ -64,7 +64,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Latest Activity Map', 'wp-strava' ) : $instance['title'] );
$athlete_token = isset( $instance['athlete_token'] ) ? $instance['athlete_token'] : WPStrava::get_instance()->settings->get_default_token();
- $distance_min = $instance['distance_min'];
+ $distance_min = empty( $instance['distance_min'] ) ? 0 : absint( $instance['distance_min'] );
$strava_club_id = empty( $instance['strava_club_id'] ) ? null : $instance['strava_club_id'];
$build_new = false;
@@ -80,6 +80,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
if ( is_wp_error( $rides ) ) {
echo $before_widget;
+ if ( $title ) echo $before_title . $title . $after_title;
if ( WPSTRAVA_DEBUG ) {
echo '
';
print_r($rides);
diff --git a/lib/Settings.class.php b/lib/Settings.class.php
index 71e9a2e..368f94e 100644
--- a/lib/Settings.class.php
+++ b/lib/Settings.class.php
@@ -1,7 +1,7 @@
page_name,
- array( $this, 'print_strava_options' ) );
+ add_options_page(
+ __( 'Strava Settings', 'wp-strava' ),
+ __( 'Strava', 'wp-strava' ),
+ 'manage_options',
+ $this->page_name,
+ array( $this, 'print_strava_options' )
+ );
}
public function init() {
@@ -143,7 +145,7 @@ class WPStrava_Settings {
$app_name = sprintf( esc_html( '%s Strava', 'wp-strava' ), $blog_name );
$site_url = site_url();
$description = 'WP-Strava for ' . $blog_name;
- printf( __( "Steps:
+ printf( __( "Steps:
- Create your free API Application/Connection here: %2\$s using the following information:
@@ -171,7 +173,7 @@ class WPStrava_Settings {
public function print_gmaps_instructions() {
$maps_url = 'https://developers.google.com/maps/documentation/static-maps/';
- printf( __( "Steps:
+ printf( __( "Steps:
- To use Google map images, you must create a Static Maps API Key. Create a free key by going here: %2\$s and clicking Get a Key
- Once you've created your Google Static Maps API Key, enter the key below.
@@ -184,7 +186,7 @@ class WPStrava_Settings {
-
+