Skip to content

Commit

Permalink
Formatting and spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfoell committed Oct 6, 2019
1 parent 5bf4dad commit c1c1feb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
14 changes: 7 additions & 7 deletions includes/WPStrava/ActivityShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public function handler( $atts ) {
$this->add_script = true;

$defaults = array(
'id' => 0,
'som' => WPStrava::get_instance()->settings->som,
'map_width' => '480',
'map_height' => '320',
'client_id' => WPStrava::get_instance()->settings->get_default_id(),
'markers' => false,
'image_only' => false,
'id' => 0,
'som' => WPStrava::get_instance()->settings->som,
'map_width' => '480',
'map_height' => '320',
'client_id' => WPStrava::get_instance()->settings->get_default_id(),
'markers' => false,
'image_only' => false,
);

$atts = shortcode_atts( $defaults, $atts, 'activity' );
Expand Down
7 changes: 4 additions & 3 deletions includes/WPStrava/LatestActivities.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public static function get_activities_html( $args ) {
$response .= "<div class='activity-item'>";

if ( ! empty( $activity->start_date_local ) ) {
$unixtime = strtotime( $activity->start_date_local );
// Translators: Shows something like "On <date> <[went 10 miles] [during 2 hours] [climbing 100 feet]>."
$response .= sprintf( __( 'On %1$s %2$s', 'wp-strava' ),
$unixtime = strtotime( $activity->start_date_local );
$response .= sprintf(
// Translators: Shows something like "On <date> <[went 10 miles] [during 2 hours] [climbing 100 feet]>."
__( 'On %1$s %2$s', 'wp-strava' ),
date_i18n( get_option( 'date_format' ), $unixtime ),
self::get_activity_time( $unixtime )
);
Expand Down
8 changes: 4 additions & 4 deletions includes/WPStrava/LatestActivitiesWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct() {

public function maybe_enqueue() {
if ( is_active_widget( false, false, $this->id_base ) ) {
wp_enqueue_style( 'wp-strava-style' ); //only load this when wigit is loaded
wp_enqueue_style( 'wp-strava-style' ); // Only load this when widget is loaded.
}
}

Expand All @@ -41,9 +41,9 @@ public function widget( $args, $instance ) {
/** @see WP_Widget::update */
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['client_id'] = strip_tags( $new_instance['client_id'] );
$instance['strava_club_id'] = strip_tags( $new_instance['strava_club_id'] );
$instance['title'] = wp_strip_all_tags( $new_instance['title'] );
$instance['client_id'] = wp_strip_all_tags( $new_instance['client_id'] );
$instance['strava_club_id'] = wp_strip_all_tags( $new_instance['strava_club_id'] );
$instance['quantity'] = $new_instance['quantity'];

return $instance;
Expand Down
9 changes: 5 additions & 4 deletions includes/WPStrava/LatestMapWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public function form( $instance ) {
public function update( $new_instance, $old_instance ) {
// Processes widget options to be saved from the admin.
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['client_id'] = strip_tags( $new_instance['client_id'] );
$instance['strava_club_id'] = strip_tags( $new_instance['strava_club_id'] );
$instance['distance_min'] = strip_tags( $new_instance['distance_min'] );
$instance['title'] = wp_strip_all_tags( $new_instance['title'] );
$instance['client_id'] = wp_strip_all_tags( $new_instance['client_id'] );
$instance['strava_club_id'] = wp_strip_all_tags( $new_instance['strava_club_id'] );
$instance['distance_min'] = wp_strip_all_tags( $new_instance['distance_min'] );
return $instance;
}

Expand Down Expand Up @@ -97,6 +97,7 @@ public function widget( $args, $instance ) {
try {
$activities = $strava_activity->get_activities( $client_id, $strava_club_id );
} catch ( WPStrava_Exception $e ) {
// If athlete_token is still set, warn about that first and foremost.
if ( isset( $instance['athlete_token'] ) ) {
// Translators: Message shown when using deprecated athlete_token parameter.
echo wp_kses_post( __( 'The <code>athlete_token</code> parameter is deprecated as of WP-Strava version 2 and should be replaced with <code>client_id</code>.', 'wp-strava' ) );
Expand Down
3 changes: 2 additions & 1 deletion includes/WPStrava/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,9 @@ public function add_id( $id ) {
public function save_info( $id, $secret, $info ) {
$infos = get_option( 'strava_info', array() );
$infos = array_filter( $infos, array( $this, 'filter_by_id' ), ARRAY_FILTER_USE_KEY ); // Remove old IDs.

$info->client_secret = $secret;
$infos[ $id ] = $info;
$infos[ $id ] = $info;
update_option( 'strava_info', $infos );
}

Expand Down

0 comments on commit c1c1feb

Please sign in to comment.