mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-16 13:13:41 +09:00
Renamed Util to API
Added SOM classes for English & Metric Use WP HTTP API for requests
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
<?php
|
||||
|
||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/Settings.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/LatestMapWidget.class.php';
|
||||
|
||||
class WPStrava {
|
||||
|
||||
private static $instance = NULL;
|
||||
private $settings = NULL;
|
||||
private $api = NULL;
|
||||
|
||||
private function __construct() {
|
||||
$this->settings = new WPStrava_Settings();
|
||||
@@ -17,6 +20,7 @@ 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' ); } );
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +34,18 @@ class WPStrava {
|
||||
if ( isset( $this->{$name} ) )
|
||||
return $this->{$name};
|
||||
|
||||
if ( $name == 'api' )
|
||||
return $this->get_api();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function get_api() {
|
||||
if ( ! $this->api ) {
|
||||
require_once WPSTRAVA_PLUGIN_DIR . 'lib/API.class.php';
|
||||
$this->api = new WPStrava_API();
|
||||
}
|
||||
|
||||
return $this->api;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user