From afc132becd5d0c259734c64ac4f60787ede9c4bc Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Thu, 24 Dec 2020 11:53:14 -0600
Subject: [PATCH 1/4] Fix pace styles and water pace speeds
---
readme.txt | 3 +++
src/WPStrava/ActivityRenderer.php | 26 ++++++++++++--------------
src/WPStrava/ActivityType.php | 20 ++++++--------------
3 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/readme.txt b/readme.txt
index 944351e..0e48f13 100755
--- a/readme.txt
+++ b/readme.txt
@@ -116,6 +116,9 @@ On the WP-Strava settings page you cannot currently remove and add another athle
= Unreleased =
Fix latest_map class replacing echo with return https://wordpress.org/support/topic/latest-activity-map-shortcode-wrong-placed-on-page/
+Fix styling on pace activity max speed.
+Fix broken water pace on activity.
+Fix pace types and remove 'other' - making 'speed' default.
= 2.5.0 =
diff --git a/src/WPStrava/ActivityRenderer.php b/src/WPStrava/ActivityRenderer.php
index 100b932..59e2656 100644
--- a/src/WPStrava/ActivityRenderer.php
+++ b/src/WPStrava/ActivityRenderer.php
@@ -98,20 +98,11 @@ class WPStrava_ActivityRenderer {
' . $strava_som->get_pace_label() . '
';
$max_speed = '
- ' . $strava_som->pace( $activity_details->max_speed ) . '
+ ' . $strava_som->pace( $activity_details->max_speed ) . '
+ ' . $strava_som->get_pace_label() . '
| ';
break;
- case WPStrava_ActivityType::TYPE_GROUP_SPEED:
- $avg_speed = '
- ' . $strava_som->speed( $activity_details->average_speed ) . '
- ' . $strava_som->get_speed_label() . '
- | ';
- $max_speed = '
- ' . $strava_som->speed( $activity_details->max_speed ) . '
- ' . $strava_som->get_speed_label() . '
- | ';
- break;
- case WPStrava_ActivityType::TYPE_GROUP_PACE:
+ case WPStrava_ActivityType::TYPE_GROUP_WATER:
$avg_speed = '
' . $strava_som->swimpace( $activity_details->average_speed ) . '
' . $strava_som->get_swimpace_label() . '
@@ -121,9 +112,16 @@ class WPStrava_ActivityRenderer {
' . $strava_som->get_swimpace_label() . '
| ';
break;
+ case WPStrava_ActivityType::TYPE_GROUP_SPEED:
default:
- $avg_title = '';
- $max_title = '';
+ $avg_speed = '
+ ' . $strava_som->speed( $activity_details->average_speed ) . '
+ ' . $strava_som->get_speed_label() . '
+ | ';
+ $max_speed = '
+ ' . $strava_som->speed( $activity_details->max_speed ) . '
+ ' . $strava_som->get_speed_label() . '
+ | ';
break;
}
diff --git a/src/WPStrava/ActivityType.php b/src/WPStrava/ActivityType.php
index 7ef74e3..825020b 100644
--- a/src/WPStrava/ActivityType.php
+++ b/src/WPStrava/ActivityType.php
@@ -1,6 +1,6 @@
* @since 1.7.0
*/
@@ -70,15 +66,11 @@ class WPStrava_ActivityType {
return self::TYPE_GROUP_PACE;
}
- if ( in_array( $type, self::$speed_types, true ) ) {
- return self::TYPE_GROUP_SPEED;
- }
-
if ( in_array( $type, self::$water_types, true ) ) {
return self::TYPE_GROUP_WATER;
}
- return self::TYPE_GROUP_OTHER;
+ return self::TYPE_GROUP_SPEED;
}
}
From df85c9f360ba7f03c5932ea2a653f66962702cda Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Thu, 24 Dec 2020 12:24:37 -0600
Subject: [PATCH 2/4] Remove map link when doing REST request
---
readme.txt | 3 ++-
src/WPStrava/Activity.php | 13 ++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/readme.txt b/readme.txt
index 0e48f13..f791b3a 100755
--- a/readme.txt
+++ b/readme.txt
@@ -113,12 +113,13 @@ On the WP-Strava settings page you cannot currently remove and add another athle
== Changelog ==
-= Unreleased =
+= 2.5.1 =
Fix latest_map class replacing echo with return https://wordpress.org/support/topic/latest-activity-map-shortcode-wrong-placed-on-page/
Fix styling on pace activity max speed.
Fix broken water pace on activity.
Fix pace types and remove 'other' - making 'speed' default.
+Fix to remove map link in editor so you don't leave the editor.
= 2.5.0 =
diff --git a/src/WPStrava/Activity.php b/src/WPStrava/Activity.php
index 9623874..242792f 100755
--- a/src/WPStrava/Activity.php
+++ b/src/WPStrava/Activity.php
@@ -109,11 +109,22 @@ class WPStrava_Activity {
* @since 2.3.2
*/
public function get_activity_link( $activity_id, $text, $title = '' ) {
- if ( WPStrava::get_instance()->settings->no_link ) {
+ if ( $this->is_rest_request() || WPStrava::get_instance()->settings->no_link ) {
return $text;
}
$url = esc_url( self::ACTIVITIES_URL . $activity_id );
$title_attr = $title ? " title='" . esc_attr( $title ) . "'" : '';
return "{$text}";
}
+
+ /**
+ * Check if rest request to skip link rendering in block editor.
+ *
+ * @return boolean
+ * @author Justin Foell
+ * @since 2.5.1
+ */
+ private function is_rest_request() {
+ return defined( 'REST_REQUEST' ) && REST_REQUEST;
+ }
}
From a3a5139a8594dfdfc677e590026c79207af942ac Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Thu, 24 Dec 2020 12:24:54 -0600
Subject: [PATCH 3/4] Bump versions to 2.5.1
---
readme.txt | 2 +-
wp-strava.php | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/readme.txt b/readme.txt
index f791b3a..69b6a58 100755
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin
Requires at least: 4.6
Tested up to: 5.5
-Stable tag: 2.5.0
+Stable tag: 2.5.1
Requires PHP: 5.3
License: GPLv2 or later
diff --git a/wp-strava.php b/wp-strava.php
index e69507e..dd94dff 100755
--- a/wp-strava.php
+++ b/wp-strava.php
@@ -3,7 +3,7 @@
* Plugin Name: WP Strava
* Plugin URI: https://wordpress.org/plugins/wp-strava/
* Description: Show your strava.com activity on your WordPress site. Some Icons are Copyright © Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 license.
- * Version: 2.5.0
+ * Version: 2.5.1
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
* License: GPL2
* Text Domain: wp-strava
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-define( 'WPSTRAVA_PLUGIN_VERSION', '2.5.0' );
+define( 'WPSTRAVA_PLUGIN_VERSION', '2.5.1' );
define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ );
define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) );
define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
From 8f4fd60321788da58fae0994f193c1ef60b4ad50 Mon Sep 17 00:00:00 2001
From: Justin Foell <630830+jrfoell@users.noreply.github.com>
Date: Thu, 24 Dec 2020 12:27:02 -0600
Subject: [PATCH 4/4] Updated WP tested version
---
readme.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.txt b/readme.txt
index 69b6a58..339db77 100755
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@
Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin
Requires at least: 4.6
-Tested up to: 5.5
+Tested up to: 5.6
Stable tag: 2.5.1
Requires PHP: 5.3
License: GPLv2 or later