Renamed Util to API

Added SOM classes for English & Metric
Use WP HTTP API for requests
This commit is contained in:
Justin Foell
2013-03-31 21:28:49 -05:00
parent 8d511f72ec
commit 414e2648bb
10 changed files with 341 additions and 101 deletions
+16
View File
@@ -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;
}
}