Updated version

Addd handling of 503 service unavail
This commit is contained in:
Justin Foell
2014-09-23 13:39:48 -05:00
parent 140c04fd24
commit 7992db37f0
6 changed files with 32 additions and 15 deletions
+2
View File
@@ -68,6 +68,8 @@ class WPStrava_API {
$error = '';
if ( ! empty( $body->error ) )
$error = $body->error;
else if ( $response['response']['code'] == 503 )
$error = __( 'Strava Temporarily Unavailable', 'wp-strava' );
else
$error = print_r( $response, true );
+7 -3
View File
@@ -61,9 +61,13 @@ class WPStrava_LatestMapWidget extends WP_Widget {
if ( is_wp_error( $rides ) ) {
echo $before_widget;
echo '<pre>';
print_r($rides);
echo '</pre>';
if ( WPSTRAVA_DEBUG ) {
echo '<pre>';
print_r($rides);
echo '</pre>';
} else {
echo $rides->get_error_message();
}
echo $after_widget;
return;
}
+1 -1
View File
@@ -45,7 +45,7 @@ class WPStrava_Rides {
//return $map_details;
return $json;
} else {
$this->feedback .= _e("There was an error pulling data of strava.com.", "wp-strava");
$this->feedback .= _e("There was an error pulling data from strava.com.", "wp-strava");
return false;
}
} else {
+7
View File
@@ -21,6 +21,7 @@ class WPStrava_Settings {
add_action( 'admin_init', array( $this, 'register_strava_settings' ) );
add_action( 'admin_menu', array( $this, 'add_strava_menu' ) );
add_action( 'option_home', array( $this, 'option_home' ) );
add_filter( 'plugin_action_links_' . WPSTRAVA_PLUGIN_NAME, array( $this, 'settings_link' ) );
}
/**
@@ -225,5 +226,11 @@ class WPStrava_Settings {
public function __get( $name ) {
return get_option( "strava_{$name}" );
}
public function settings_link( $links ) {
$settings_link = '<a href="' . admin_url( "options-general.php?page={$this->page_name}" ) . '">' . __( 'Settings' ) . '</a>';
$links[] = $settings_link;
return $links;
}
}