mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-20 07:04:24 +09:00
Moved pace functions to base SOM class
This commit is contained in:
@@ -63,7 +63,7 @@ class WPStrava_RouteShortcode {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$route_details = $route->get_route( $atts['id'] );
|
$route_details = $route->get_route( $atts['id'] );
|
||||||
} catch( WPStrava_Exception $e ) {
|
} catch ( WPStrava_Exception $e ) {
|
||||||
return $e->to_html();
|
return $e->to_html();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-2
@@ -28,8 +28,6 @@ abstract class WPStrava_SOM {
|
|||||||
abstract public function get_elevation_label();
|
abstract public function get_elevation_label();
|
||||||
abstract public function pace( $mps );
|
abstract public function pace( $mps );
|
||||||
abstract public function get_pace_label();
|
abstract public function get_pace_label();
|
||||||
abstract public function swimpace( $mps );
|
|
||||||
abstract public function get_swimpace_label();
|
|
||||||
|
|
||||||
public function time( $seconds ) {
|
public function time( $seconds ) {
|
||||||
return date( 'H:i:s', mktime( 0, 0, $seconds ) );
|
return date( 'H:i:s', mktime( 0, 0, $seconds ) );
|
||||||
@@ -38,4 +36,27 @@ abstract class WPStrava_SOM {
|
|||||||
public function get_time_label() {
|
public function get_time_label() {
|
||||||
return __( 'hours', 'wp-strava' );
|
return __( 'hours', 'wp-strava' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abbreviated label for this system of measure's pace - Minutes Per 100 Meters: min/100m. Same for English/metric.
|
||||||
|
*
|
||||||
|
* @return string 'min/100m'
|
||||||
|
*/
|
||||||
|
public function get_swimpace_label() {
|
||||||
|
return __( 'min/100m', 'wp-strava' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change meters per second to Minutes Per 100 Meters. Same for English/metric.
|
||||||
|
*
|
||||||
|
* @param float $mps Meters per second.
|
||||||
|
* @return float Minutes Per 100 Meters.
|
||||||
|
*/
|
||||||
|
public function swimpace( $mps ) {
|
||||||
|
|
||||||
|
$kmh = $mps * 3.6;
|
||||||
|
$min100m = 60 / $kmh / 10;
|
||||||
|
|
||||||
|
return number_format( $min100m, 2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class WPStrava_SOMEnglish extends WPStrava_SOM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change meters per second to Minutes Per Mile.
|
* Change meters per second to minutes per mile.
|
||||||
*
|
*
|
||||||
* @param float $mps Meters per second.
|
* @param float $mps Meters per second.
|
||||||
* @return float Minutes Per Mile.
|
* @return float Minutes Per Mile.
|
||||||
@@ -86,30 +86,6 @@ class WPStrava_SOMEnglish extends WPStrava_SOM {
|
|||||||
return __( 'min/mile', 'wp-strava' );
|
return __( 'min/mile', 'wp-strava' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change meters per second to Minutes Per 100 Meters.
|
|
||||||
*
|
|
||||||
* @param float $mps Meters per second.
|
|
||||||
* @return float Minutes Per 100 Meters.
|
|
||||||
*/
|
|
||||||
public function swimpace( $mps ) {
|
|
||||||
|
|
||||||
$kmh = $mps * 3.6;
|
|
||||||
$min100m = 60 / $kmh / 10;
|
|
||||||
|
|
||||||
return number_format( $min100m, 2 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abbreviated label for this system of measure's pace - Minutes Per 100 Meters: min/100m
|
|
||||||
*
|
|
||||||
* @return string 'min/100m'
|
|
||||||
*/
|
|
||||||
public function get_swimpace_label() {
|
|
||||||
return __( 'min/100m', 'wp-strava' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change meters to feet.
|
* Change meters to feet.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class WPStrava_SOMMetric extends WPStrava_SOM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change meters per second to kilometers per hour.
|
* Change meters per second to minutes per kilometer.
|
||||||
*
|
*
|
||||||
* @param float $mps Meters per second.
|
* @param float $mps Meters per second.
|
||||||
* @return float Kilometers per hour.
|
* @return float Kilometers per hour.
|
||||||
@@ -87,29 +87,6 @@ class WPStrava_SOMMetric extends WPStrava_SOM {
|
|||||||
return __( 'min/km', 'wp-strava' );
|
return __( 'min/km', 'wp-strava' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change meters per second to Minutes Per 100 Meters.
|
|
||||||
*
|
|
||||||
* @param float $mps Meters per second.
|
|
||||||
* @return float Minutes Per 100 Meters.
|
|
||||||
*/
|
|
||||||
public function swimpace( $mps ) {
|
|
||||||
|
|
||||||
$kmh = $mps * 3.6;
|
|
||||||
$min100m = 60 / $kmh / 10;
|
|
||||||
|
|
||||||
return number_format( $min100m, 2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abbreviated label for this system of measure's pace - Minutes Per 100 Meters: min/100m
|
|
||||||
*
|
|
||||||
* @return string 'min/100m'
|
|
||||||
*/
|
|
||||||
public function get_swimpace_label() {
|
|
||||||
return __( 'min/100m', 'wp-strava' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change meters to meters };^)
|
* Change meters to meters };^)
|
||||||
*
|
*
|
||||||
|
|||||||
+5
-4
@@ -1,9 +1,9 @@
|
|||||||
=== WP-Strava ===
|
=== WP-Strava ===
|
||||||
|
|
||||||
Contributors: cmanon, jrfoell, lancewillett, dlintott
|
Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb
|
||||||
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, gps, shortcode, widget, plugin
|
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, gps, shortcode, widget, plugin
|
||||||
Requires at least: 4.6
|
Requires at least: 4.6
|
||||||
Tested up to: 4.9
|
Tested up to: 5.0
|
||||||
Stable tag: 1.6.0
|
Stable tag: 1.6.0
|
||||||
Requires PHP: 5.2
|
Requires PHP: 5.2
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
@@ -80,7 +80,8 @@ WP-Strava caches activity for one hour so your site doesn't hit the Strava API o
|
|||||||
|
|
||||||
= NEXT =
|
= NEXT =
|
||||||
|
|
||||||
Added Pace support (min/km) for Activity Shortcode
|
Added Sebastian Erb to contributors.
|
||||||
|
Added Pace support (min/km) and (min/mile) for Activity Shortcode
|
||||||
Added Swimpace support (min/100m) for Activity Shortcode
|
Added Swimpace support (min/100m) for Activity Shortcode
|
||||||
|
|
||||||
= 1.6.0 =
|
= 1.6.0 =
|
||||||
@@ -126,7 +127,7 @@ Fix array indices on map widget
|
|||||||
|
|
||||||
= 1.4.0 =
|
= 1.4.0 =
|
||||||
|
|
||||||
Added dlintott to contributors.
|
Added Daniel Lintott to contributors.
|
||||||
Fixed non-existent settings js from being enqueued.
|
Fixed non-existent settings js from being enqueued.
|
||||||
Changed all 'ride' styles and functions to 'activity'.
|
Changed all 'ride' styles and functions to 'activity'.
|
||||||
Added inline documentation.
|
Added inline documentation.
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
* Plugin URI: https://wordpress.org/plugins/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.
|
* 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: 1.6.0
|
* Version: 1.6.0
|
||||||
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott
|
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
|
||||||
* License: GPL2
|
* License: GPL2
|
||||||
* Text Domain: wp-strava
|
* Text Domain: wp-strava
|
||||||
* Domain Path: /lang
|
* Domain Path: /lang
|
||||||
|
|||||||
Reference in New Issue
Block a user