Fixed Activity filter and added Activity Unit Test

This commit is contained in:
Justin Foell
2019-10-04 15:50:08 -05:00
parent 319b220aa3
commit 00812e55e8
11 changed files with 130 additions and 64 deletions
+21 -13
View File
@@ -47,19 +47,6 @@ class WPStrava {
private function __construct() {
$this->settings = new WPStrava_Settings();
$this->auth = WPStrava_Auth::get_auth( 'refresh' );
$this->auth->hook();
if ( is_admin() ) {
$this->settings->hook();
} else {
add_action( 'init', array( $this, 'register_shortcodes' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
}
// Register widgets.
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
}
/**
@@ -75,6 +62,27 @@ class WPStrava {
return self::$instance;
}
/**
* Function to install hooks at WP runtime.
*
* @author Justin Foell <justin@foell.org>
* @since 2.0.0
*/
public function hook() {
$this->auth->hook();
if ( is_admin() ) {
$this->settings->hook();
} else {
add_action( 'init', array( $this, 'register_shortcodes' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
}
// Register widgets.
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
}
/**
* Magic method to access activity, routes, settings, etc.
*