diff --git a/includes/WPStrava/ActivityShortcode.php b/includes/WPStrava/ActivityShortcode.php index 021482e..4591af4 100644 --- a/includes/WPStrava/ActivityShortcode.php +++ b/includes/WPStrava/ActivityShortcode.php @@ -44,6 +44,11 @@ class WPStrava_ActivityShortcode { * @since 1.0 */ public function handler( $atts ) { + if ( isset( $atts['athlete_token'] ) ) { + // Translators: Message shown when using deprecated athlete_token parameter. + return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); + } + $this->add_script = true; $defaults = array( @@ -58,11 +63,6 @@ class WPStrava_ActivityShortcode { $atts = shortcode_atts( $defaults, $atts, 'activity' ); - if ( isset( $atts['athlete_token'] ) ) { - // Translators: Message shown when using deprecated athlete_token parameter. - return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); - } - /* Make sure boolean values are actually boolean * @see https://wordpress.stackexchange.com/a/119299 */ diff --git a/includes/WPStrava/LatestActivities.php b/includes/WPStrava/LatestActivities.php index e3bc61e..a6c0f49 100644 --- a/includes/WPStrava/LatestActivities.php +++ b/includes/WPStrava/LatestActivities.php @@ -2,6 +2,10 @@ class WPStrava_LatestActivities { public static function get_activities_html( $args ) { + if ( isset( $args['athlete_token'] ) ) { + // Translators: Message shown when using deprecated athlete_token parameter. + return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); + } $defaults = array( 'client_id' => WPStrava::get_instance()->settings->get_default_id(), @@ -12,11 +16,6 @@ class WPStrava_LatestActivities { $args = wp_parse_args( $args, $defaults ); - if ( isset( $args['athlete_token'] ) ) { - // Translators: Message shown when using deprecated athlete_token parameter. - return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); - } - $som = WPStrava_SOM::get_som( $args['som'] ); $strava_activity = WPStrava::get_instance()->activity; $activities = array(); diff --git a/includes/WPStrava/LatestMapWidget.php b/includes/WPStrava/LatestMapWidget.php index a58e44a..76262b2 100644 --- a/includes/WPStrava/LatestMapWidget.php +++ b/includes/WPStrava/LatestMapWidget.php @@ -97,7 +97,12 @@ class WPStrava_LatestMapWidget extends WP_Widget { try { $activities = $strava_activity->get_activities( $client_id, $strava_club_id ); } catch ( WPStrava_Exception $e ) { - echo $e->to_html(); + if ( isset( $instance['athlete_token'] ) ) { + // Translators: Message shown when using deprecated athlete_token parameter. + echo wp_kses_post( __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ) ); + } else { + echo $e->to_html(); + } } if ( ! empty( $activities ) ) { diff --git a/includes/WPStrava/RouteShortcode.php b/includes/WPStrava/RouteShortcode.php index 4bf1d63..65ee859 100644 --- a/includes/WPStrava/RouteShortcode.php +++ b/includes/WPStrava/RouteShortcode.php @@ -44,6 +44,11 @@ class WPStrava_RouteShortcode { * @since 1.3.0 */ public function handler( $atts ) { + if ( isset( $atts['athlete_token'] ) ) { + // Translators: Message shown when using deprecated athlete_token parameter. + return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); + } + $this->add_script = true; $defaults = array( @@ -58,11 +63,6 @@ class WPStrava_RouteShortcode { $atts = shortcode_atts( $defaults, $atts, 'route' ); - if ( isset( $atts['athlete_token'] ) ) { - // Translators: Message shown when using deprecated athlete_token parameter. - return __( 'The athlete_token parameter is deprecated as of WP-Strava version 2 and should be replaced with client_id.', 'wp-strava' ); - } - /* Make sure boolean values are actually boolean * @see https://wordpress.stackexchange.com/a/119299 */