mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-16 21:23:48 +09:00
Updated version
Addd handling of 503 service unavail
This commit is contained in:
@@ -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 );
|
||||
|
||||
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user