mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-18 14:14:01 +09:00
Update activity shortcode to handle multiple athletes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class WPStrava_RideShortcode {
|
class WPStrava_ActivityShortcode {
|
||||||
private static $add_script;
|
private static $add_script;
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
@@ -15,22 +15,23 @@ class WPStrava_RideShortcode {
|
|||||||
self::$add_script = true;
|
self::$add_script = true;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'som' => WPStrava::get_instance()->settings->som,
|
'som' => WPStrava::get_instance()->settings->som,
|
||||||
'map_width' => '480',
|
'map_width' => '480',
|
||||||
'map_height' => '320',
|
'map_height' => '320',
|
||||||
|
'athlete_token' => WPStrava::get_instance()->settings->get_default_token(),
|
||||||
);
|
);
|
||||||
|
|
||||||
extract( shortcode_atts( $defaults, $atts ) );
|
extract( shortcode_atts( $defaults, $atts ) );
|
||||||
|
|
||||||
$strava_som = WPStrava_SOM::get_som( $som );
|
$strava_som = WPStrava_SOM::get_som( $som );
|
||||||
$strava_ride = WPStrava::get_instance()->rides;
|
$activity = WPStrava::get_instance()->rides;
|
||||||
$ride_details = $strava_ride->getRide( $id );
|
$ride_details = $activity->getRide( $athlete_token, $id );
|
||||||
|
|
||||||
//sanitize width & height
|
//sanitize width & height
|
||||||
$map_width = str_replace( '%', '', $map_width );
|
$map_width = str_replace( '%', '', $map_width );
|
||||||
$map_height = str_replace( '%', '', $map_height );
|
$map_height = str_replace( '%', '', $map_height );
|
||||||
$map_width = str_replace( 'px', '', $map_width );
|
$map_width = str_replace( 'px', '', $map_width );
|
||||||
$map_height = str_replace( 'px', '', $map_height );
|
$map_height = str_replace( 'px', '', $map_height );
|
||||||
|
|
||||||
if ( $ride_details ) {
|
if ( $ride_details ) {
|
||||||
@@ -82,4 +83,4 @@ class WPStrava_RideShortcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize short code
|
// Initialize short code
|
||||||
WPStrava_RideShortcode::init();
|
WPStrava_ActivityShortcode::init();
|
||||||
@@ -4,7 +4,7 @@ require_once WPSTRAVA_PLUGIN_DIR . 'lib/Settings.class.php';
|
|||||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/SOM.class.php';
|
require_once WPSTRAVA_PLUGIN_DIR . 'lib/SOM.class.php';
|
||||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestRidesWidget.class.php';
|
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestRidesWidget.class.php';
|
||||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestMapWidget.class.php';
|
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestMapWidget.class.php';
|
||||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/RideShortcode.class.php';
|
require_once WPSTRAVA_PLUGIN_DIR . 'lib/ActivityShortcode.class.php';
|
||||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/StaticMap.class.php';
|
require_once WPSTRAVA_PLUGIN_DIR . 'lib/StaticMap.class.php';
|
||||||
|
|
||||||
class WPStrava {
|
class WPStrava {
|
||||||
|
|||||||
Reference in New Issue
Block a user