* @since 2.3.0 */ class WPStrava_ActivitiesListRenderer { /** * Get the HTML for an Activities List. * * @param array $atts * @return string HTML for an route. * @author Justin Foell * @since 2.8.0 */ public function get_html( $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' ); } $defaults = array( 'client_id' => WPStrava::get_instance()->settings->get_default_id(), 'strava_club_id' => null, 'quantity' => 5, 'som' => WPStrava::get_instance()->settings->som, 'date_start' => '', 'date_end' => '', ); $atts = wp_parse_args( $atts, $defaults ); $som = WPStrava_SOM::get_som( $atts['som'] ); $strava_activity = WPStrava::get_instance()->activity; $activities = array(); try { $activities = $strava_activity->get_activities( $atts ); } catch ( WPStrava_Exception $e ) { return $e->to_html(); } $response = "'; return $response; } /** * Get the activity time, possibly hiding it. * * @param int $unixtime * @return string Formatted time, or empty string depending on hide_time option. * @author Justin Foell * @since 1.7.1 */ private function get_activity_time( $unixtime ) { if ( WPStrava::get_instance()->settings->hide_time ) { return ''; } return date_i18n( get_option( 'time_format' ), $unixtime ); } }