Merge branch 'master' into feature/wp_mock-tests

This commit is contained in:
Justin Foell
2019-03-01 10:23:47 -06:00
13 changed files with 389 additions and 111 deletions
-3
View File
@@ -32,6 +32,3 @@
.activity-details-table-units {
font-size: 0.8em;
}
.wp-strava-activity-container img {
max-width: none;
}
+4 -5
View File
@@ -13,7 +13,7 @@ class WPStrava_Activity {
* @param string $athlete_token Token of athlete to retrieve for
* @param int $activity_id ID of activity to retrieve.
* @return object stdClass representing this activity.
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
*/
public function get_activity( $athlete_token, $activity_id ) {
return WPStrava::get_instance()->get_api( $athlete_token )->get( "activities/{$activity_id}" );
@@ -22,8 +22,7 @@ class WPStrava_Activity {
/**
* Get activity list from Strava API.
*
* @author Justin Foell
*
* @author Justin Foell <justin@foell.org>
* @param string $athlete_token Token of athlete to retrieve for
* @param int $club_id Club ID of all club riders (optional).
* @param int|null $quantity Number of records to retrieve (optional).
@@ -52,12 +51,12 @@ class WPStrava_Activity {
}
/**
* Undocumented function
* Get activities with a distance longer than specified length.
*
* @param array $activities
* @param float $dist Distance in default system of measure (km/mi).
* @return void
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
*/
public function get_activities_longer_than( $activities, $dist ) {
$som = WPStrava_SOM::get_som();
+101 -45
View File
@@ -53,64 +53,120 @@ class WPStrava_ActivityShortcode {
'map_height' => '320',
'athlete_token' => WPStrava::get_instance()->settings->get_default_token(),
'markers' => false,
'image_only' => false,
);
$atts = shortcode_atts( $defaults, $atts );
$atts = shortcode_atts( $defaults, $atts, 'activity' );
/* Make sure boolean values are actually boolean
* @see https://wordpress.stackexchange.com/a/119299
*/
$atts['markers'] = filter_var( $atts['markers'], FILTER_VALIDATE_BOOLEAN );
$atts['image_only'] = filter_var( $atts['image_only'], FILTER_VALIDATE_BOOLEAN );
$strava_som = WPStrava_SOM::get_som( $atts['som'] );
$activity = WPStrava::get_instance()->activity;
$activity_details = null;
try {
$activity_details = $activity->get_activity( $atts['athlete_token'], $atts['id'] );
} catch( WPStrava_Exception $e ) {
} catch ( WPStrava_Exception $e ) {
return $e->to_html();
}
//sanitize width & height
$map_width = str_replace( '%', '', $atts['map_width'] );
$map_height = str_replace( '%', '', $atts['map_height'] );
$map_width = str_replace( 'px', '', $map_width );
$map_height = str_replace( 'px', '', $map_height );
$activity_output = '';
if ( $activity_details ) {
return '
<div id="activity-header-' . $atts['id'] . '" class="wp-strava-activity-container">
<table id="activity-details-table">
<thead>
<tr>
<th>' . __( 'Elapsed Time', 'wp-strava' ) . '</th>
<th>' . __( 'Moving Time', 'wp-strava' ) . '</th>
<th>' . __( 'Distance', 'wp-strava' ) . '</th>
<th>' . __( 'Average Speed', 'wp-strava' ) . '</th>
<th>' . __( 'Max Speed', 'wp-strava' ) . '</th>
<th>' . __( 'Elevation Gain', 'wp-strava' ) . '</th>
</tr>
</thead>
<tbody>
<tr class="activity-details-table-info">
<td>' . $strava_som->time( $activity_details->elapsed_time ) . '</td>
<td>' . $strava_som->time( $activity_details->moving_time ) . '</td>
<td>' . $strava_som->distance( $activity_details->distance ) . '</td>
<td>' . $strava_som->speed( $activity_details->average_speed ) . '</td>
<td>' . $strava_som->speed( $activity_details->max_speed ) . '</td>
<td>' . $strava_som->elevation( $activity_details->total_elevation_gain ) . '</td>
</tr>
<tr class="activity-details-table-units">
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_distance_label() . '</td>
<td>' . $strava_som->get_speed_label() . '</td>
<td>' . $strava_som->get_speed_label() . '</td>
<td>' . $strava_som->get_elevation_label() . '</td>
</tr>
</tbody>
</table>
<a title="' . $activity_details->name . '" href="' . WPStrava_Activity::ACTIVITIES_URL . $activity_details->id . '">' .
WPStrava_StaticMap::get_image_tag( $activity_details, $map_height, $map_width, $atts['markers'] ) .
'</a>
</div>';
$activity_output .= '<div id="activity-header-' . $atts['id'] . '" class="wp-strava-activity-container">';
if ( ! $atts['image_only'] ) {
$activity_output .= $this->get_table( $activity_details, $atts['som'] );
}
// Sanitize width & height.
$map_width = str_replace( '%', '', $atts['map_width'] );
$map_height = str_replace( '%', '', $atts['map_height'] );
$map_width = str_replace( 'px', '', $map_width );
$map_height = str_replace( 'px', '', $map_height );
$activity_output .= '<a title="' . $activity_details->name . '" href="' . WPStrava_Activity::ACTIVITIES_URL . $activity_details->id . '">' .
WPStrava_StaticMap::get_image_tag( $activity_details, $map_height, $map_width, $atts['markers'] ) .
'</a>
</div>';
} // End if( $activity_details ).
return $activity_output;
}
/**
* The the activity details in in HTML table.
*
* @param string $activity_details Activity details from the activity class.
* @param string $som System of measure (english/metric).
* @return string HTML Table of activity details.
* @author Justin Foell <justin@foell.org>
* @author Sebastian Erb <mail@sebastianerb.com>
* @since 1.7.0
*/
private function get_table( $activity_details, $som ) {
$strava_som = WPStrava_SOM::get_som( $som );
$strava_activitytype = WPStrava_ActivityType::get_type_group( $activity_details->type );
$avg_speed = '';
$max_speed = '';
$speed_label = '';
$avg_title = '<th>' . __( 'Average Speed', 'wp-strava' ) . '</th>';
$max_title = '<th>' . __( 'Max Speed', 'wp-strava' ) . '</th>';
switch ( $strava_activitytype ) {
case WPStrava_ActivityType::TYPE_GROUP_PACE:
$avg_speed = '<td>' . $strava_som->pace( $activity_details->average_speed ) . '</td>';
$max_speed = '<td>' . $strava_som->pace( $activity_details->max_speed ) . '</td>';
$speed_label = '<td>' . $strava_som->get_pace_label() . '</td>';
break;
case WPStrava_ActivityType::TYPE_GROUP_SPEED:
$avg_speed = '<td>' . $strava_som->speed( $activity_details->average_speed ) . '</td>';
$max_speed = '<td>' . $strava_som->speed( $activity_details->max_speed ) . '</td>';
$speed_label = '<td>' . $strava_som->get_speed_label() . '</td>';
break;
case WPStrava_ActivityType::TYPE_GROUP_PACE:
$avg_speed = '<td>' . $strava_som->swimpace( $activity_details->average_speed ) . '</td>';
$max_speed = '<td>' . $strava_som->swimpace( $activity_details->max_speed ) . '</td>';
$speed_label = '<td>' . $strava_som->get_swimpace_label() . '</td>';
break;
default:
$avg_title = '';
$max_title = '';
break;
}
return '
<table id="activity-details-table">
<thead>
<tr>
<th>' . __( 'Elapsed Time', 'wp-strava' ) . '</th>
<th>' . __( 'Moving Time', 'wp-strava' ) . '</th>
<th>' . __( 'Distance', 'wp-strava' ) . '</th>
' . $avg_title . '
' . $max_title . '
<th>' . __( 'Elevation Gain', 'wp-strava' ) . '</th>
</tr>
</thead>
<tbody>
<tr class="activity-details-table-info">
<td>' . $strava_som->time( $activity_details->elapsed_time ) . '</td>
<td>' . $strava_som->time( $activity_details->moving_time ) . '</td>
<td>' . $strava_som->distance( $activity_details->distance ) . '</td>
' . $avg_speed . '
' . $max_speed . '
<td>' . $strava_som->elevation( $activity_details->total_elevation_gain ) . '</td>
</tr>
<tr class="activity-details-table-units">
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_distance_label() . '</td>
' . $speed_label . '
' . $speed_label . '
<td>' . $strava_som->get_elevation_label() . '</td>
</tr>
</tbody>
</table>
';
}
/**
+84
View File
@@ -0,0 +1,84 @@
<?php
/**
* ActivityType [activitytype].
* @package WPStrava
*/
/**
* ActivityType class.
*
* @author Sebastian Erb <mail@sebastianerb.com>
* @since 1.7.0
*/
class WPStrava_ActivityType {
const TYPE_ALPINESKI = 'AlpineSki';
const TYPE_BACKCOUNTRYSKI = 'BackcountrySki';
const TYPE_CANOEING = 'Canoeing';
const TYPE_CROSSFIT = 'Crossfit';
const TYPE_EBIKERIDE = 'EBikeRide';
const TYPE_ELLIPTICAL = 'Elliptical';
const TYPE_HANDCYCLE = 'Hike';
const TYPE_HIKE = 'IceSkate';
const TYPE_ICESKATE = 'InlineSkate';
const TYPE_INLINESKATE = 'AlpineSki';
const TYPE_KAYAKING = 'Kayaking';
const TYPE_KITESURF = 'Kitesurf';
const TYPE_NORDICSKI = 'NordicSki';
const TYPE_RIDE = 'Ride';
const TYPE_ROCKCLIMBING = 'RockClimbing';
const TYPE_ROLLERSKI = 'RollerSki';
const TYPE_ROWING = 'Rowing';
const TYPE_RUN = 'Run';
const TYPE_SNOWBOARD = 'Snowboard';
const TYPE_SNOWSHOE = 'Snowshoe';
const TYPE_STAIRSTEPPER = 'StairStepper';
const TYPE_STANDUPPADDLING = 'StandUpPaddling';
const TYPE_SURFING = 'Surfing';
const TYPE_SWIM = 'Swim';
const TYPE_VIRTUALRIDE = 'VirtualRide';
const TYPE_VIRTUALRUN = 'VirtualRun';
const TYPE_WALK = 'Walk';
const TYPE_WEIGHTTRAINING = 'WeightTraining';
const TYPE_WHEELCHAIR = 'Wheelchair';
const TYPE_WINDSURF = 'Windsurf';
const TYPE_WORKOUT = 'Workout';
const TYPE_YOGA = 'Yoga';
const TYPE_DEFAULT = self::TYPE_RIDE;
private static $water_types = array( self::TYPE_SWIM );
private static $pace_types = array( self::TYPE_CANOEING, self::TYPE_HIKE, self::TYPE_RUN, self::TYPE_SNOWSHOE, self::TYPE_VIRTUALRUN, self::TYPE_WALK );
private static $speed_types = array( self::TYPE_ALPINESKI, self::TYPE_BACKCOUNTRYSKI, self::TYPE_EBIKERIDE, self::TYPE_ELLIPTICAL, self::TYPE_HANDCYCLE, self::TYPE_ICESKATE, self::TYPE_INLINESKATE, self::TYPE_KAYAKING, self::TYPE_KITESURF, self::TYPE_NORDICSKI, self::TYPE_RIDE, self::TYPE_ROCKCLIMBING, self::TYPE_ROLLERSKI, self::TYPE_ROWING, self::TYPE_SNOWBOARD, self::TYPE_STAIRSTEPPER, self::TYPE_STANDUPPADDLING, self::TYPE_SURFING, self::TYPE_VIRTUALRIDE, self::TYPE_WHEELCHAIR, self::TYPE_WINDSURF );
const TYPE_GROUP_WATER = 'water';
const TYPE_GROUP_PACE = 'pace';
const TYPE_GROUP_SPEED = 'speed';
const TYPE_GROUP_OTHER = 'other';
/**
* Get the type of activity.
*
* @param string $type Type provided by Strava.
* @return string Type group (water/pace/speed/other).
* @author Sebastian Erb <mail@sebastianerb.com>
* @since 1.7.0
*/
public static function get_type_group( $type ) {
if ( in_array( $type, self::$pace_types, true ) ) {
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;
}
}
+24 -2
View File
@@ -38,18 +38,32 @@ class WPStrava_Exception extends WPStrava_Abstract_Exception {
*
* @param WP_Error $error
* @return WPStrava_Exception
* @author Justin Foell <justin.foell@webdevstudios.com>
* @since
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public static function from_wp_error( WP_Error $error ) {
$class = __CLASS__;
return new $class( $error->get_error_message( $error->get_error_code() ) );
}
/**
* HTML version of this exception.
*
* @return string The exception string wrapped in <pre> tags.
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function to_html() {
return '<pre>' . $this . '</pre>';
}
/**
* Magic method to convert this exception to a string.
*
* @return string
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function __toString() {
if ( WPSTRAVA_DEBUG && $this->getPrevious() ) {
return $this->get_formatted_message( $this->getPrevious() );
@@ -58,6 +72,14 @@ class WPStrava_Exception extends WPStrava_Abstract_Exception {
return $this->get_formatted_message( $this );
}
/**
* Exception message with extra formatting.
*
* @param Exception $exception
* @return string Formatted exception message.
* @author Justin Foell <justin@foell.org>
* @since 1.6.0
*/
public function get_formatted_message( $exception ) {
$code = $exception->getCode();
+5 -9
View File
@@ -96,7 +96,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
try {
$activities = $strava_activity->get_activities( $athlete_token, $strava_club_id );
} catch( WPStrava_Exception $e ) {
} catch ( WPStrava_Exception $e ) {
echo $e->to_html();
}
@@ -136,8 +136,7 @@ class WPStrava_LatestMapWidget extends WP_Widget {
/**
* Get image for specific activity using Static Maps class.
*
* @author Justin Foell
*
* @author Justin Foell <justin@foell.org>
* @param string $id Athlete Token or Club ID.
* @param object $activity Activity to get image for.
* @param boolean $build_new Whether to refresh the image from cache.
@@ -157,9 +156,8 @@ class WPStrava_LatestMapWidget extends WP_Widget {
/**
* Update map in option to cache.
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*
* @param string $id Athlete Token or Club ID.
* @param string $img Image tag.
*/
@@ -170,9 +168,8 @@ class WPStrava_LatestMapWidget extends WP_Widget {
/**
* Update activity in option to cache.
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*
* @param string $id Athlete Token or Club ID.
* @param object $activity stdClass Strava activity object.
*/
@@ -183,9 +180,8 @@ class WPStrava_LatestMapWidget extends WP_Widget {
/**
* Update activity in transient to cache.
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*
* @param string $id Athlete Token or Club ID.
* @param object $activity stdClass Strava activity object.
*/
+59 -33
View File
@@ -53,55 +53,81 @@ class WPStrava_RouteShortcode {
'map_height' => '320',
'athlete_token' => WPStrava::get_instance()->settings->get_default_token(),
'markers' => false,
'image_only' => false,
);
$atts = shortcode_atts( $defaults, $atts );
$atts = shortcode_atts( $defaults, $atts, 'route' );
/* Make sure boolean values are actually boolean
* @see https://wordpress.stackexchange.com/a/119299
*/
$atts['markers'] = filter_var( $atts['markers'], FILTER_VALIDATE_BOOLEAN );
$atts['image_only'] = filter_var( $atts['image_only'], FILTER_VALIDATE_BOOLEAN );
$strava_som = WPStrava_SOM::get_som( $atts['som'] );
$route = WPStrava::get_instance()->routes;
$route_details = null;
try {
$route_details = $route->get_route( $atts['id'] );
} catch( WPStrava_Exception $e ) {
} catch ( WPStrava_Exception $e ) {
return $e->to_html();
}
// Sanitize width & height.
$map_width = str_replace( '%', '', $atts['map_width'] );
$map_height = str_replace( '%', '', $atts['map_height'] );
$map_width = str_replace( 'px', '', $map_width );
$map_height = str_replace( 'px', '', $map_height );
$route_output = '';
if ( $route_details ) {
return '
<div id="activity-header-' . $atts['id'] . '" class="wp-strava-activity-container">
<table id="activity-details-table">
<thead>
<tr>
<th>' . __( 'Est. Moving Time', 'wp-strava' ) . '</th>
<th>' . __( 'Distance', 'wp-strava' ) . '</th>
<th>' . __( 'Elevation Gain', 'wp-strava' ) . '</th>
</tr>
</thead>
<tbody>
<tr class="activity-details-table-info">
<td>' . $strava_som->time( $route_details->estimated_moving_time ) . '</td>
<td>' . $strava_som->distance( $route_details->distance ) . '</td>
<td>' . $strava_som->elevation( $route_details->elevation_gain ) . '</td>
</tr>
<tr class="activity-details-table-units">
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_distance_label() . '</td>
<td>' . $strava_som->get_elevation_label() . '</td>
</tr>
</tbody>
</table>
<a title="' . $route_details->name . '" href="' . WPStrava_Routes::ROUTES_URL . $route_details->id . '">' .
$route_output = '<div id="activity-header-' . $atts['id'] . '" class="wp-strava-activity-container">';
if ( ! $atts['image_only'] ) {
$route_output .= $this->get_table( $route_details, $atts['som'] );
}
// Sanitize width & height.
$map_width = str_replace( '%', '', $atts['map_width'] );
$map_height = str_replace( '%', '', $atts['map_height'] );
$map_width = str_replace( 'px', '', $map_width );
$map_height = str_replace( 'px', '', $map_height );
$route_output .= '<a title="' . $route_details->name . '" href="' . WPStrava_Routes::ROUTES_URL . $route_details->id . '">' .
WPStrava_StaticMap::get_image_tag( $route_details, $map_height, $map_width, $atts['markers'] ) .
'</a>
</div>';
} // End if( $route_details ).
return $route_output;
}
/**
* The the route details in in HTML table.
*
* @param string $route_details route details from the route class.
* @param string $som System of measure (english/metric).
* @return string HTML Table of route details.
* @author Justin Foell <justin@foell.org>
* @since 1.7.0
*/
private function get_table( $route_details, $som ) {
$strava_som = WPStrava_SOM::get_som( $som );
return '
<table id="activity-details-table">
<thead>
<tr>
<th>' . __( 'Est. Moving Time', 'wp-strava' ) . '</th>
<th>' . __( 'Distance', 'wp-strava' ) . '</th>
<th>' . __( 'Elevation Gain', 'wp-strava' ) . '</th>
</tr>
</thead>
<tbody>
<tr class="activity-details-table-info">
<td>' . $strava_som->time( $route_details->estimated_moving_time ) . '</td>
<td>' . $strava_som->distance( $route_details->distance ) . '</td>
<td>' . $strava_som->elevation( $route_details->elevation_gain ) . '</td>
</tr>
<tr class="activity-details-table-units">
<td>' . $strava_som->get_time_label() . '</td>
<td>' . $strava_som->get_distance_label() . '</td>
<td>' . $strava_som->get_elevation_label() . '</td>
</tr>
</tbody>
</table>
';
}
/**
+26 -1
View File
@@ -8,7 +8,7 @@ abstract class WPStrava_SOM {
*
* @param string $som 'english' or 'metric'
* @return WPStrava_SOM Instance of SOM
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
*/
public static function get_som( $som = null ) {
$som = $som ? $som : WPStrava::get_instance()->settings->som;
@@ -26,6 +26,8 @@ abstract class WPStrava_SOM {
abstract public function get_speed_label();
abstract public function elevation( $m );
abstract public function get_elevation_label();
abstract public function pace( $mps );
abstract public function get_pace_label();
public function time( $seconds ) {
return date( 'H:i:s', mktime( 0, 0, $seconds ) );
@@ -34,4 +36,27 @@ abstract class WPStrava_SOM {
public function get_time_label() {
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 );
}
}
+31
View File
@@ -55,6 +55,37 @@ class WPStrava_SOMEnglish extends WPStrava_SOM {
return __( 'mph', 'wp-strava' );
}
/**
* Change meters per second to minutes per mile.
*
* @param float $mps Meters per second.
* @return float Minutes Per Mile.
*/
public function pace( $mps ) {
if ( ! $mps ) {
return __( 'N/A', 'wp-strava' );
}
$mph = $mps * 2.2369;
$s = 3600 / $mph;
$ss = $s / 60;
$ms = floor( $ss ) * 60;
$sec = round( $s - $ms );
$min = floor( $ss );
return "{$min}:{$sec}";
}
/**
* Abbreviated label for this system of measure's pace - Minutes Per Mile: min/mile
*
* @return string 'min/mile'
*/
public function get_pace_label() {
return __( 'min/mile', 'wp-strava' );
}
/**
* Change meters to feet.
*
+32
View File
@@ -55,6 +55,38 @@ class WPStrava_SOMMetric extends WPStrava_SOM {
return __( 'km/h', 'wp-strava' );
}
/**
* Change meters per second to minutes per kilometer.
*
* @param float $mps Meters per second.
* @return float Kilometers per hour.
*/
public function pace( $mps ) {
if ( ! $mps ) {
return __( 'N/A', 'wp-strava' );
}
// 4 m/s => 14,4 km/h => 4:10 min/km
$kmh = $mps * 3.6;
$s = 3600 / $kmh;
$ss = $s / 60;
$ms = floor( $ss ) * 60;
$sec = round( $s - $ms );
$min = floor( $ss );
return "{$min}:{$sec}";
}
/**
* Abbreviated label for this system of measure's speed - Minutes Per Kilometers: min/km
*
* @return string 'min/km'
*/
public function get_pace_label() {
return __( 'min/km', 'wp-strava' );
}
/**
* Change meters to meters };^)
*
+6 -6
View File
@@ -357,7 +357,7 @@ class WPStrava_Settings {
* Gets all saved strava tokens as an array.
*
* @return array
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*/
public function get_tokens() {
@@ -379,7 +379,7 @@ class WPStrava_Settings {
* Returns first (default) token saved.
*
* @return string|null
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*/
public function get_default_token() {
@@ -391,7 +391,7 @@ class WPStrava_Settings {
* Get all tokens and their nicknames in one array.
*
* @return void
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*/
public function get_all_tokens() {
@@ -413,7 +413,7 @@ class WPStrava_Settings {
/**
* Returns default nickname 'Default' / 'Athlete n'.
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*
* @param integer $number Athlete number (default 1).
@@ -427,7 +427,7 @@ class WPStrava_Settings {
/**
* Checks for valid tokens.
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*
* @param string|array Single token or array of tokens.
@@ -454,7 +454,7 @@ class WPStrava_Settings {
*
* @param string $token
*
* @author Justin Foell
* @author Justin Foell <justin@foell.org>
* @since 1.2.0
*/
public function add_token( $token ) {
Executable → Regular
+15 -5
View File
@@ -1,10 +1,10 @@
=== 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
Requires at least: 4.6
Tested up to: 4.9
Stable tag: 1.6.0
Tested up to: 5.0
Stable tag: 1.7.0
Requires PHP: 5.2
License: GPLv2 or later
@@ -27,6 +27,7 @@ Also takes the following optional parameters:
* map_height - height (height of image in pixels).
* athlete_token - specify a different athlete (you can copy this value from https://www.strava.com/settings/api or the wp-strava settings page at /wp-admin/options-general.php?page=wp-strava-options).
* markers - Display markers at the start/finish point (true/false, defaults to false).
* image_only - Display only the map image and not the table (true/false, defaults to false).
[ride] - an alias for [activity] that will accept the same parameters (kept for backwards compatibility).
@@ -72,12 +73,21 @@ WP-Strava caches activity for one hour so your site doesn't hit the Strava API o
6. Activity Shortcode - Shows a map of activity with some statistics.
7. Activity Shortcode Settings - An example activity shortcode. The athlete_token parameter is only needed if your site is connected to multiple athlete accounts.
8. Route Shortcode - Shows a map of a route.
9. Route Shortcode Settings - An example route shortcode. Add markers=true to show green/red start stop points.
9. Route Shortcode Settings - An example route shortcode. Add markers=true to show green/red start/stop points.
10. Activities Shortcode - Shows latest athlete activity in a page or post.
11. Activities Shortcode Settings - An example activities shortcode. The athlete_token parameter is only needed if your site is connected to multiple athlete accounts.
== Changelog ==
= 1.7.0 =
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 'image_only' attribute to [activity] and [route] shortcode to optionally remove data table.
Added boolean filtering to shortcodes to prevent false-positive "truthiness" to a shortcode attribute like image_only="false".
Removed 'max-width: none' from activity image to make it responsive.
= 1.6.0 =
Added class autoloader (removed composer autoloader).
@@ -121,7 +131,7 @@ Fix array indices on map widget
= 1.4.0 =
Added dlintott to contributors.
Added Daniel Lintott to contributors.
Fixed non-existent settings js from being enqueued.
Changed all 'ride' styles and functions to 'activity'.
Added inline documentation.
+2 -2
View File
@@ -3,8 +3,8 @@
* 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: 1.7.0-b1
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott
* Version: 1.7.1-b1
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
* License: GPL2
* Text Domain: wp-strava
* Domain Path: /lang