diff --git a/lib/Settings.class.php b/lib/Settings.class.php index c1811f4..2936ec8 100644 --- a/lib/Settings.class.php +++ b/lib/Settings.class.php @@ -20,7 +20,7 @@ class WPStrava_Settings { public function hook() { add_action( 'admin_init', array( $this, 'register_strava_settings' ) ); add_action( 'admin_menu', array( $this, 'add_strava_menu' ) ); - add_filter( 'pre_set_transient_settings_errors', array( $this, 'maybe_oauth' ), 10 ); + add_filter( 'pre_set_transient_settings_errors', array( $this, 'maybe_oauth' ) ); add_filter( 'plugin_action_links_' . WPSTRAVA_PLUGIN_NAME, array( $this, 'settings_link' ) ); //for process debugging //add_action( 'all', array( $this, 'hook_debug' ) ); @@ -112,6 +112,11 @@ public function register_strava_settings() { register_setting( $this->option_page, 'strava_som', array( $this, 'sanitize_som' ) ); add_settings_section( 'strava_options', __( 'Options', 'wp-strava' ), null, 'wp-strava' ); add_settings_field( 'strava_som', __( 'System of Measurement', 'wp-strava' ), array( $this, 'print_som_input' ), 'wp-strava', 'strava_options' ); + + // Clear cache. + register_setting( $this->option_page, 'strava_cache_clear', array( $this, 'sanitize_cache_clear' ) ); + add_settings_section( 'strava_cache', __( 'Cache', 'wp-strava' ), null, 'wp-strava' ); + add_settings_field( 'strava_cache_clear', __( 'Clear cache (images & transient data)', 'wp-strava' ), array( $this, 'print_clear_input' ), 'wp-strava', 'strava_cache' ); } public function print_api_instructions() { @@ -242,6 +247,20 @@ public function sanitize_som( $som ) { return $som; } + public function print_clear_input() { + ?>get_api(); } @@ -56,7 +56,7 @@ public function __get( $name ) { public function get_api() { if ( ! $this->api ) { require_once WPSTRAVA_PLUGIN_DIR . 'lib/API.class.php'; - $this->api = new WPStrava_API( get_option('strava_token') ); + $this->api = new WPStrava_API( get_option( 'strava_token' ) ); } return $this->api; diff --git a/readme.txt b/readme.txt index 1835676..8fcfe79 100755 --- a/readme.txt +++ b/readme.txt @@ -39,6 +39,7 @@ Added title to Strava Latest Map Widget Added Lance Willett to contributors Added target="_blank" to widget hrefs Added Google Maps Key to settings (required for map images) +Added cache clear option to remove transient & image data Cleaned up formatting = 1.0 =