diff --git a/lib/API.class.php b/lib/API.class.php index a547a1f..44dd657 100755 --- a/lib/API.class.php +++ b/lib/API.class.php @@ -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 ); diff --git a/lib/LatestMapWidget.class.php b/lib/LatestMapWidget.class.php index 243acb2..ce86ff9 100644 --- a/lib/LatestMapWidget.class.php +++ b/lib/LatestMapWidget.class.php @@ -61,9 +61,13 @@ class WPStrava_LatestMapWidget extends WP_Widget { if ( is_wp_error( $rides ) ) { echo $before_widget; - echo '
'; - print_r($rides); - echo ''; + if ( WPSTRAVA_DEBUG ) { + echo '
'; + print_r($rides); + echo ''; + } else { + echo $rides->get_error_message(); + } echo $after_widget; return; } diff --git a/lib/Rides.class.php b/lib/Rides.class.php index c00aef9..309de3a 100755 --- a/lib/Rides.class.php +++ b/lib/Rides.class.php @@ -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 { diff --git a/lib/Settings.class.php b/lib/Settings.class.php index 74f958f..698116c 100644 --- a/lib/Settings.class.php +++ b/lib/Settings.class.php @@ -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 = 'page_name}" ) . '">' . __( 'Settings' ) . ''; + $links[] = $settings_link; + return $links; + } } \ No newline at end of file diff --git a/readme.txt b/readme.txt index c2c68d8..c4bebca 100755 --- a/readme.txt +++ b/readme.txt @@ -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 diff --git a/wp-strava.php b/wp-strava.php index d8a659d..60927b0 100755 --- a/wp-strava.php +++ b/wp-strava.php @@ -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');