mirror of
https://github.com/10h30/wp-strava.git
synced 2026-06-05 15:10:01 +09:00
Merge pull request #114 from cmanon/feature/109-error-unauthorized
Feature/109 error unauthorized
This commit is contained in:
+5
-1
@@ -4,7 +4,7 @@ Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb
|
||||
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin, block, blocks
|
||||
Requires at least: 4.6
|
||||
Tested up to: 5.8
|
||||
Stable tag: 2.10.0
|
||||
Stable tag: 2.10.1
|
||||
Requires PHP: 5.3
|
||||
License: GPLv2 or later
|
||||
|
||||
@@ -134,6 +134,10 @@ On the WP-Strava settings page you cannot currently remove and add another athle
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.10.1 =
|
||||
Reworked settings save with multiple athletes, related to https://wordpress.org/support/topic/wp-strava-error-401-unauthorized/
|
||||
|
||||
|
||||
= 2.10.0 =
|
||||
Add ability to paste Activity/Route/Segment URL into the block editor and have it insert the appropriate block https://wordpress.org/support/topic/sorry-this-content-could-not-be-embedded-5/
|
||||
Add `reduce_polyline()` for maps with large polylines but no summary provided (prevents empty map) https://wordpress.org/support/topic/map-embed-from-segment-shows-default-map/
|
||||
|
||||
@@ -333,8 +333,8 @@ class WPStrava_Settings {
|
||||
}
|
||||
}
|
||||
|
||||
// Process $nicknames so indexes start with zero.
|
||||
$nicknames = array_merge( $nicknames, array() );
|
||||
// Rebase array keys after unset.
|
||||
$nicknames = array_values( $nicknames );
|
||||
}
|
||||
|
||||
foreach ( $nicknames as $index => $nickname ) {
|
||||
@@ -351,13 +351,54 @@ class WPStrava_Settings {
|
||||
*
|
||||
* Renamed from sanitize_token().
|
||||
*
|
||||
* @param string $id Client ID.
|
||||
* @return string
|
||||
* @param array $ids Client IDs.
|
||||
* @return array
|
||||
* @author Justin Foell <justin@foell.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
public function sanitize_id( $id ) {
|
||||
return $id;
|
||||
public function sanitize_id( $ids ) {
|
||||
$this->get_ids();
|
||||
|
||||
if ( ! is_array( $ids ) ) {
|
||||
$ids = array( $ids );
|
||||
}
|
||||
|
||||
// Filter empty IDs.
|
||||
$ids = array_filter( $ids );
|
||||
|
||||
// Rebase array keys after unset.
|
||||
$ids = array_values( $ids );
|
||||
|
||||
$this->maybe_clean_info( $ids );
|
||||
|
||||
$this->ids = $ids;
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove IDs from strava_info that are being deleted.
|
||||
*
|
||||
* @param array $ids IDs that we're keeping.
|
||||
* @author Justin Foell <justin@foell.org>
|
||||
* @since 2.10.1
|
||||
*/
|
||||
private function maybe_clean_info( $ids ) {
|
||||
$update = false;
|
||||
|
||||
$infos = $this->info;
|
||||
|
||||
foreach ( $infos as $id => $info ) {
|
||||
if ( ! in_array( $id, $ids ) ) {
|
||||
$update = true;
|
||||
unset( $infos[ $id ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
update_option( 'strava_info', $infos );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -584,10 +625,11 @@ class WPStrava_Settings {
|
||||
foreach ( $ids as $index => $id ) {
|
||||
if ( empty( $id ) ) {
|
||||
unset( $ids[ $index ] );
|
||||
$ids = array_values( $ids ); // Rebase array keys after unset @see https://stackoverflow.com/a/5943165/2146022
|
||||
}
|
||||
}
|
||||
$this->ids = $ids;
|
||||
|
||||
// Rebase array keys after unset @see https://stackoverflow.com/a/5943165/2146022
|
||||
$this->ids = array_values( $ids );
|
||||
return $this->ids;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: WP Strava
|
||||
* Plugin URI: https://wordpress.org/plugins/wp-strava/
|
||||
* Description: Show your strava.com activity on your WordPress site. Some Icons are Copyright © Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 license.
|
||||
* Version: 2.10.0
|
||||
* Version: 2.10.1
|
||||
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
|
||||
* License: GPL2
|
||||
* Text Domain: wp-strava
|
||||
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
define( 'WPSTRAVA_PLUGIN_VERSION', '2.10.0' );
|
||||
define( 'WPSTRAVA_PLUGIN_VERSION', '2.10.1' );
|
||||
define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ );
|
||||
define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) );
|
||||
define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
|
||||
|
||||
Reference in New Issue
Block a user