mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-11 18:56:18 +09:00
Promoted athelete_token check
This commit is contained in:
@@ -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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', '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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', 'wp-strava' );
|
||||
}
|
||||
|
||||
/* Make sure boolean values are actually boolean
|
||||
* @see https://wordpress.stackexchange.com/a/119299
|
||||
*/
|
||||
|
||||
@@ -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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', '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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', 'wp-strava' );
|
||||
}
|
||||
|
||||
$som = WPStrava_SOM::get_som( $args['som'] );
|
||||
$strava_activity = WPStrava::get_instance()->activity;
|
||||
$activities = array();
|
||||
|
||||
@@ -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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', 'wp-strava' ) );
|
||||
} else {
|
||||
echo $e->to_html();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $activities ) ) {
|
||||
|
||||
@@ -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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', '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 <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', 'wp-strava' );
|
||||
}
|
||||
|
||||
/* Make sure boolean values are actually boolean
|
||||
* @see https://wordpress.stackexchange.com/a/119299
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user