mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-17 05:33:44 +09:00
Updated API & Rides to be more useful
This commit is contained in:
+16
-2
@@ -10,6 +10,7 @@ class WPStrava {
|
||||
private static $instance = NULL;
|
||||
private $settings = NULL;
|
||||
private $api = NULL;
|
||||
private $rides = NULL;
|
||||
|
||||
private function __construct() {
|
||||
$this->settings = new WPStrava_Settings();
|
||||
@@ -19,8 +20,8 @@ class WPStrava {
|
||||
}
|
||||
|
||||
// Register StravaLatestRidesWidget widget
|
||||
add_action( 'widgets_init', function() { return register_widget( 'WPStrava_LatestRidesWidget' ); } );
|
||||
add_action( 'widgets_init', function() { return register_widget( 'WPStrava_LatestMapWidget' ); } );
|
||||
add_action( 'widgets_init', function() { return register_widget( 'WPStrava_LatestRidesWidget' ); } );
|
||||
add_action( 'widgets_init', function() { return register_widget( 'WPStrava_LatestMapWidget' ); } );
|
||||
|
||||
}
|
||||
|
||||
@@ -34,9 +35,13 @@ class WPStrava {
|
||||
if ( isset( $this->{$name} ) )
|
||||
return $this->{$name};
|
||||
|
||||
//on-demand classes
|
||||
if ( $name == 'api' )
|
||||
return $this->get_api();
|
||||
|
||||
if ( $name == 'rides' )
|
||||
return $this->get_rides();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -48,4 +53,13 @@ class WPStrava {
|
||||
|
||||
return $this->api;
|
||||
}
|
||||
|
||||
public function get_rides() {
|
||||
if ( ! $this->rides ) {
|
||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/Rides.class.php';
|
||||
$this->rides = new WPStrava_Rides();
|
||||
}
|
||||
|
||||
return $this->rides;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user