0, 'som' => WPStrava::get_instance()->settings->som, 'map_width' => '480', 'map_height' => '320', 'athlete_token' => WPStrava::get_instance()->settings->get_default_token(), 'markers' => false, ); $atts = shortcode_atts( $defaults, $atts ); $strava_som = WPStrava_SOM::get_som( $atts['som'] ); $activity = WPStrava::get_instance()->activity; $activity_details = $activity->get_activity( $atts['athlete_token'], $atts['id'] ); if ( is_wp_error( $activity_details ) ) { if ( WPSTRAVA_DEBUG ) { return '
' . print_r( $activity_details, true ) . '
'; // phpcs:ignore -- Debug output. } else { return $activity_details->get_error_message(); } } //sanitize width & height $map_width = str_replace( '%', '', $atts['map_width'] ); $map_height = str_replace( '%', '', $atts['map_height'] ); $map_width = str_replace( 'px', '', $map_width ); $map_height = str_replace( 'px', '', $map_height ); if ( $activity_details ) { return '
' . __( 'Elapsed Time', 'wp-strava' ) . ' ' . __( 'Moving Time', 'wp-strava' ) . ' ' . __( 'Distance', 'wp-strava' ) . ' ' . __( 'Average Speed', 'wp-strava' ) . ' ' . __( 'Max Speed', 'wp-strava' ) . ' ' . __( 'Elevation Gain', 'wp-strava' ) . '
' . $strava_som->time( $activity_details->elapsed_time ) . ' ' . $strava_som->time( $activity_details->moving_time ) . ' ' . $strava_som->distance( $activity_details->distance ) . ' ' . $strava_som->speed( $activity_details->average_speed ) . ' ' . $strava_som->speed( $activity_details->max_speed ) . ' ' . $strava_som->elevation( $activity_details->total_elevation_gain ) . '
' . $strava_som->get_time_label() . ' ' . $strava_som->get_time_label() . ' ' . $strava_som->get_distance_label() . ' ' . $strava_som->get_speed_label() . ' ' . $strava_som->get_speed_label() . ' ' . $strava_som->get_elevation_label() . '
' . WPStrava_StaticMap::get_image_tag( $activity_details, $map_height, $map_width, $atts['markers'] ) . '
'; } // End if( $activity_details ). } public static function print_scripts() { if ( self::$add_script ) { wp_enqueue_style( 'wp-strava-style' ); } } } // Initialize short code WPStrava_ActivityShortcode::init();