* @since 2.2.0 */ public function get_html( $atts ) { $defaults = array( 'id' => 0, 'som' => WPStrava::get_instance()->settings->som, 'map_width' => '480', 'map_height' => '320', 'client_id' => WPStrava::get_instance()->settings->get_default_id(), 'markers' => false, 'image_only' => false, ); $atts = wp_parse_args( $atts, $defaults ); /* Make sure boolean values are actually boolean * @see https://wordpress.stackexchange.com/a/119299 */ $atts['markers'] = filter_var( $atts['markers'], FILTER_VALIDATE_BOOLEAN ); $atts['image_only'] = filter_var( $atts['image_only'], FILTER_VALIDATE_BOOLEAN ); $activity = WPStrava::get_instance()->activity; $activity_details = null; try { $activity_details = $activity->get_activity( $atts['client_id'], $atts['id'] ); } catch ( WPStrava_Exception $e ) { return $e->to_html(); } $activity_output = ''; if ( $activity_details ) { $activity_output .= '
| ' . __( 'Elapsed Time', 'wp-strava' ) . ' | ' . __( 'Moving Time', 'wp-strava' ) . ' | ' . __( 'Distance', 'wp-strava' ) . ' | ' . $avg_title . ' ' . $max_title . ' ' . $elevation_title . '
|---|---|---|
| ' . $strava_som->time( $activity_details->elapsed_time ) . ' | ' . $strava_som->time( $activity_details->moving_time ) . ' | ' . $strava_som->distance( $activity_details->distance ) . ' | ' . $avg_speed . ' ' . $max_speed . ' ' . $elevation . '
| ' . $strava_som->get_time_label() . ' | ' . $strava_som->get_time_label() . ' | ' . $strava_som->get_distance_label() . ' | ' . $speed_label . ' ' . $speed_label . ' ' . $elevation_label . '