From 7fc803ccacb0cc9796120829976dd0b0dc8732fc Mon Sep 17 00:00:00 2001 From: Justin Foell <630830+jrfoell@users.noreply.github.com> Date: Fri, 26 Jun 2020 14:17:54 -0500 Subject: [PATCH] Add no_link setting --- src/WPStrava/Settings.php | 48 ++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/WPStrava/Settings.php b/src/WPStrava/Settings.php index fcb0eb1..247650f 100644 --- a/src/WPStrava/Settings.php +++ b/src/WPStrava/Settings.php @@ -93,14 +93,18 @@ class WPStrava_Settings { // Hide Options. register_setting( $this->option_page, 'strava_hide_time', array( $this, 'sanitize_hide_time' ) ); - add_settings_field( 'strava_hide_time', __( 'Hide Activity Time', 'wp-strava' ), array( $this, 'print_hide_time_input' ), 'wp-strava', 'strava_options' ); + add_settings_field( 'strava_hide_time', __( 'Time', 'wp-strava' ), array( $this, 'print_hide_time_input' ), 'wp-strava', 'strava_options' ); register_setting( $this->option_page, 'strava_hide_elevation', array( $this, 'sanitize_hide_elevation' ) ); - add_settings_field( 'strava_hide_elevation', __( 'Hide Activity Elevation', 'wp-strava' ), array( $this, 'print_hide_elevation_input' ), 'wp-strava', 'strava_options' ); + add_settings_field( 'strava_hide_elevation', __( 'Elevation', 'wp-strava' ), array( $this, 'print_hide_elevation_input' ), 'wp-strava', 'strava_options' ); + + // No Activity Links. + register_setting( $this->option_page, 'strava_no_link', array( $this, 'sanitize_no_link' ) ); + add_settings_field( 'strava_no_link', __( 'Links', 'wp-strava' ), array( $this, 'print_no_link_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' ); + add_settings_field( 'strava_cache_clear', __( 'Clear cache', 'wp-strava' ), array( $this, 'print_clear_input' ), 'wp-strava', 'strava_cache' ); } /** @@ -398,7 +402,8 @@ class WPStrava_Settings { */ public function print_hide_time_input() { ?> - hide_time, 'on' ); ?>/> + - hide_elevation, 'on' ); ?>/> + + * @since 2.3.2 + */ + public function print_no_link_input() { + ?> + + + * @since 2.3.2 + */ + public function sanitize_no_link( $checked ) { + if ( 'on' === $checked ) { + return $checked; + } + return null; + } + /** * Print checkbox option to clear cache. * @@ -452,7 +486,9 @@ class WPStrava_Settings { */ public function print_clear_input() { ?> - + +