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 ) ) {
+
+ if ( ! empty( $args['distance_min'] ) ) {
+ $activities = $strava_activity->get_activities_longer_than( $activities, $args['distance_min'] );
+ }
+
+ $activity = current( $activities );
+
+ // Compare transient (temporary storage) to option (more permanent).
+ // If the option isn't set or the transient is different, update the option.
+ if ( empty( $activity_option->id ) || $activity->id != $activity_option->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ $build_new = true;
+ self::update_activity( $id, $activity );
+ }
+
+ // Update the transient if it needs updating.
+ if ( empty( $activity_transient->id ) || $activity->id != $activity_transient->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ self::update_activity_transient( $id, $activity );
+ }
+ }
+ }
+
+ if ( $activity ) {
+ echo empty( $activity->map ) ?
+ // Translators: Text with activity name shown in place of image if not available.
+ sprintf( __( 'Map not available for activity "%s"', 'wp-strava' ), $activity->name ) :
+ "" .
+ self::get_static_image( $id, $activity, $build_new ) .
+ '';
+ }
+
+ }
+
+ /**
+ * Get image for specific activity using Static Maps class.
+ *
+ * @author Justin Foell 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 ) ) {
-
- if ( ! empty( $distance_min ) ) {
- $activities = $strava_activity->get_activities_longer_than( $activities, $distance_min );
- }
-
- $activity = current( $activities );
-
- // Compare transient (temporary storage) to option (more permanent).
- // If the option isn't set or the transient is different, update the option.
- if ( empty( $activity_option->id ) || $activity->id != $activity_option->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
- $build_new = true;
- $this->update_activity( $id, $activity );
- }
-
- // Update the transient if it needs updating.
- if ( empty( $activity_transient->id ) || $activity->id != $activity_transient->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
- $this->update_activity_transient( $id, $activity );
- }
- }
- }
-
- if ( $activity ) {
- echo empty( $activity->map ) ?
- // Translators: Text with activity name shown in place of image if not available.
- sprintf( __( 'Map not available for activity "%s"', 'wp-strava' ), $activity->name ) :
- "" .
- $this->get_static_image( $id, $activity, $build_new ) .
- '';
- }
+ echo WPStrava_LatestMap::get_map_html( $activities_args );
echo $args['after_widget'];
}
-
- /**
- * Get image for specific activity using Static Maps class.
- *
- * @author Justin Foell 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();
+ echo $e->to_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Debug only.
}
}
@@ -63,9 +63,9 @@ class WPStrava_LatestMap {
if ( $activity ) {
echo empty( $activity->map ) ?
// Translators: Text with activity name shown in place of image if not available.
- sprintf( __( 'Map not available for activity "%s"', 'wp-strava' ), $activity->name ) :
- "" .
- self::get_static_image( $id, $activity, $build_new ) .
+ esc_html( sprintf( __( 'Map not available for activity "%s"', 'wp-strava' ), $activity->name ) ) :
+ "" .
+ self::get_static_image( $id, $activity, $build_new ) . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Image OK.
'';
}
diff --git a/includes/WPStrava/LatestMapWidget.php b/includes/WPStrava/LatestMapWidget.php
index 7975faa..630ce19 100644
--- a/includes/WPStrava/LatestMapWidget.php
+++ b/includes/WPStrava/LatestMapWidget.php
@@ -24,30 +24,30 @@ class WPStrava_LatestMapWidget extends WP_Widget {
?>
-
-
-
-