mirror of
https://github.com/10h30/wp-strava.git
synced 2026-06-05 15:10:01 +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;
|
||||
}
|
||||
|
||||
}
|
||||
+11
-6
@@ -1,20 +1,25 @@
|
||||
=== Plugin Name ===
|
||||
Contributors: cmanon, jrfoell
|
||||
Donate link: http://cmanon.com/
|
||||
Tags: bicycle, cycling, strava
|
||||
Requires at least: 2.0
|
||||
Tested up to: 3.5.1
|
||||
Stable tag: 0.62
|
||||
Tags: strava, bicycle, cycling, biking, running, run, swimming, swim, gps, shortcode, widget, plugin
|
||||
Requires at least: 3.0
|
||||
Tested up to: 4.0
|
||||
Stable tag: 1.0
|
||||
License: GPLv2 or later
|
||||
|
||||
This plugin is intended to show your strava.com information in your WordPress site.
|
||||
Show your Strava activity on your WordPress site.
|
||||
|
||||
== Description ==
|
||||
|
||||
This plugin uses the REST strava.com API to pull the data out and show the information in your WordPress site.
|
||||
This plugin uses the Strava V3 API to embed maps and activity for
|
||||
athletes and clubs on your WordPress site. Included are several
|
||||
widgets and shortcodes for showing maps and activity summaries.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0 =
|
||||
Change to Strava API V3
|
||||
|
||||
= 0.70 =
|
||||
Use WordPress HTTP API for all remote calls
|
||||
Use WordPress Settings API for settings page
|
||||
|
||||
+4
-5
@@ -27,6 +27,8 @@ License: GPL2
|
||||
|
||||
define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__) ) );
|
||||
define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
|
||||
define( 'WPSTRAVA_PLUGIN_NAME', plugin_basename(__FILE__) );
|
||||
define( 'WPSTRAVA_DEBUG', false );
|
||||
|
||||
// Load the multilingual support.
|
||||
if( file_exists( WPSTRAVA_PLUGIN_DIR . 'lang/' . get_locale() . '.mo' ) ) {
|
||||
@@ -37,16 +39,13 @@ require_once WPSTRAVA_PLUGIN_DIR . 'lib/Strava.class.php';
|
||||
$wpstrava = WPStrava::get_instance();
|
||||
|
||||
//@TODO only load these when needed using is_active_widget()
|
||||
function load_styles() {
|
||||
function wpstrava_load_scripts_and_styles() {
|
||||
// Register a personalized stylesheet
|
||||
wp_register_style('wp-strava-style', WPSTRAVA_PLUGIN_URL . 'css/wp-strava.css' );
|
||||
wp_enqueue_style('wp-strava');
|
||||
}
|
||||
add_action('wp_enqueue_script', 'load_styles');
|
||||
|
||||
function load_scripts() {
|
||||
// Load required javascript libraries
|
||||
wp_enqueue_script('jquery');
|
||||
//wp_enqueue_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
|
||||
}
|
||||
add_action('wp-enqueue_script', 'load_scripts');
|
||||
add_action('wp_enqueue_script', 'wpstrava_load_scripts_and_styles');
|
||||
|
||||
Reference in New Issue
Block a user