Lots of formatting (code standards)
Bumped version #
This commit is contained in:
Justin Foell
2017-12-26 14:18:13 -06:00
parent b6abb1912f
commit bd40fe4021
10 changed files with 197 additions and 165 deletions
+30 -24
View File
@@ -2,8 +2,6 @@
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';
require_once WPSTRAVA_PLUGIN_DIR . 'lib/ActivityShortcode.class.php';
require_once WPSTRAVA_PLUGIN_DIR . 'lib/RouteShortcode.class.php';
require_once WPSTRAVA_PLUGIN_DIR . 'lib/StaticMap.class.php';
@@ -11,10 +9,10 @@ require_once WPSTRAVA_PLUGIN_DIR . 'lib/StaticMap.class.php';
class WPStrava {
private static $instance = null;
private $settings = null;
private $api = array(); // Holds an array of APIs.
private $rides = null;
private $routes = null;
private $settings = null;
private $api = array(); // Holds an array of APIs.
private $rides = null;
private $routes = null;
private function __construct() {
$this->settings = new WPStrava_Settings();
@@ -25,14 +23,13 @@ class WPStrava {
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
}
// Register StravaLatestRidesWidget widget
add_action( 'widgets_init', create_function( '', 'return register_widget( "WPStrava_LatestRidesWidget" );' ) );
add_action( 'widgets_init', create_function( '', 'return register_widget( "WPStrava_LatestMapWidget" );' ) );
// Register widgets.
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
}
public static function get_instance() {
if ( ! self::$instance ) {
$class = __CLASS__;
$class = __CLASS__;
self::$instance = new $class();
}
return self::$instance;
@@ -40,11 +37,13 @@ class WPStrava {
public function __get( $name ) {
// On-demand classes.
if ( $name == 'rides' ) {
if ( 'rides' === $name ) {
return $this->get_rides();
} elseif ( $name == 'routes' ) {
return $this->get_routes();
}
}
if ( 'routes' === $name ) {
return $this->get_routes();
}
if ( isset( $this->{$name} ) ) {
return $this->{$name};
@@ -60,10 +59,10 @@ class WPStrava {
if ( empty( $this->api[ $token ] ) ) {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/API.class.php';
$this->api[$token] = new WPStrava_API( $token );
$this->api[ $token ] = new WPStrava_API( $token );
}
return $this->api[$token];
return $this->api[ $token ];
}
public function get_rides() {
@@ -75,16 +74,23 @@ class WPStrava {
return $this->rides;
}
public function get_routes() {
if ( ! $this->routes ) {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/Routes.class.php';
$this->routes = new WPStrava_Routes();
}
return $this->routes;
}
public function get_routes() {
if ( ! $this->routes ) {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/Routes.class.php';
$this->routes = new WPStrava_Routes();
}
return $this->routes;
}
public function register_scripts() {
// Register a personalized stylesheet
// Register a personalized stylesheet.
wp_register_style( 'wp-strava-style', WPSTRAVA_PLUGIN_URL . 'css/wp-strava.css' );
}
public function register_widgets() {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestRidesWidget.class.php';
require_once WPSTRAVA_PLUGIN_DIR . 'lib/LatestMapWidget.class.php';
register_widget( 'WPStrava_LatestRidesWidget' );
register_widget( 'WPStrava_LatestMapWidget' );
}
}