mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-13 19:56:41 +09:00
Renamed Util to API
Added SOM classes for English & Metric Use WP HTTP API for requests
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class WPStrava_SOMEnglish extends WPStrava_SOM {
|
||||
|
||||
/**
|
||||
* @param string $m meters
|
||||
* @return string mi
|
||||
*/
|
||||
public function distance( $m ) {
|
||||
return number_format( $m / 1609.344, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dist miles
|
||||
* @return string meters
|
||||
*/
|
||||
public function distance_inverse( $dist ) {
|
||||
return number_format( $dist * 1609.344, 2 );
|
||||
}
|
||||
|
||||
public function get_distance_label() {
|
||||
return __( 'mi.', 'wp-strava' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mps
|
||||
* @return string mph
|
||||
*/
|
||||
public function speed( $mps ) {
|
||||
return number_format( $mps * 2.2369, 2 );
|
||||
}
|
||||
|
||||
public function get_speed_label() {
|
||||
return __( 'mph', 'wp-strava' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $m meters
|
||||
* @return string feet
|
||||
*/
|
||||
public function elevation( $m ) {
|
||||
return number_format( $m / 0.3048, 2 );
|
||||
}
|
||||
|
||||
public function get_elevation_label() {
|
||||
return __( 'ft.', 'wp-strava' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user