Added new v3 settings

This commit is contained in:
Justin Foell
2014-09-10 23:35:08 -05:00
parent dfc4ca81c1
commit fde59eab6d
4 changed files with 159 additions and 68 deletions
+8 -6
View File
@@ -26,15 +26,14 @@ class WPStrava {
}
public static function get_instance() {
if ( ! self::$instance )
self::$instance = new WPStrava();
if ( ! self::$instance ) {
$class = __CLASS__;
self::$instance = new $class();
}
return self::$instance;
}
public function __get( $name ) {
if ( isset( $this->{$name} ) )
return $this->{$name};
//on-demand classes
if ( $name == 'api' )
return $this->get_api();
@@ -42,13 +41,16 @@ class WPStrava {
if ( $name == 'rides' )
return $this->get_rides();
if ( isset( $this->{$name} ) )
return $this->{$name};
return NULL;
}
public function get_api() {
if ( ! $this->api ) {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/API.class.php';
$this->api = new WPStrava_API();
$this->api = new WPStrava_API( get_option('strava_token') );
}
return $this->api;