From 6e23cb1acf0cf39ca9c07fe8ead8a5f8e660c333 Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Fri, 1 Nov 2019 13:34:47 -0500
Subject: [PATCH] Escape output to fix PHPCS errors
---
includes/WPStrava/LatestMap.php | 8 ++++----
includes/WPStrava/LatestMapWidget.php | 22 ++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/includes/WPStrava/LatestMap.php b/includes/WPStrava/LatestMap.php
index 9925b3c..58b68f1 100644
--- a/includes/WPStrava/LatestMap.php
+++ b/includes/WPStrava/LatestMap.php
@@ -34,7 +34,7 @@ class WPStrava_LatestMap {
// Translators: Message shown when using deprecated athlete_token parameter.
echo wp_kses_post( __( 'The 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 {
?>
-
-
-
-