From 0a2093db17c5e31c2faadd713065c3edc2a9fb90 Mon Sep 17 00:00:00 2001 From: Justin Foell Date: Sat, 21 Sep 2019 22:02:26 -0500 Subject: [PATCH 1/2] Updated 1.7.3 --- lib/WPStrava/Settings.php | 41 +++++++++++++++++++++++++++++++++++++++ readme.txt | 18 +++++++++++++++-- wp-strava.php | 2 +- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/lib/WPStrava/Settings.php b/lib/WPStrava/Settings.php index 1db745f..201bea5 100644 --- a/lib/WPStrava/Settings.php +++ b/lib/WPStrava/Settings.php @@ -28,6 +28,8 @@ public function hook() { add_action( 'admin_menu', array( $this, 'add_strava_menu' ) ); add_filter( 'pre_set_transient_settings_errors', array( $this, 'maybe_oauth' ) ); add_filter( 'plugin_action_links_' . WPSTRAVA_PLUGIN_NAME, array( $this, 'settings_link' ) ); + add_action( 'in_plugin_update_message-wp-strava/wp-strava.php', array( $this, 'plugin_update_message' ), 10, 2 ); + add_action( 'after_plugin_row_wp-strava/wp-strava.php', array( $this, 'ms_plugin_update_message' ), 10, 2 ); } /** @@ -701,4 +703,43 @@ public function settings_link( $links ) { $links[] = $settings_link; return $links; } + + /** + * Plugin Upgrade Notice. + * + * @param array $data Plugin data with readme additions. + * @param array $response Response from wp.org. + * @author Justin Foell + * @since 1.7.3 + * @see https://wisdomplugin.com/add-inline-plugin-update-message/ + */ + public function plugin_update_message( $data, $response ) { + if ( isset( $data['upgrade_notice'] ) ) { + printf( + '
%s
', + wpautop( $data['upgrade_notice'] ) + ); + } + } + + /** + * Plugin Upgrade Notice (multisite). + * + * @param string $file Relative path to plugin, i.e. wp-strava/wp-strava.php. + * @param array $plugin Plugin data with readme additions. + * @author Justin Foell + * @since 1.7.3 + */ + public function ms_plugin_update_message( $file, $plugin ) { + if ( is_multisite() && version_compare( $plugin['Version'], $plugin['new_version'], '<' ) ) { + $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); + printf( + '

%s

%s
', + $wp_list_table->get_column_count(), + $plugin['Name'], + wpautop( $plugin['upgrade_notice'] ) + ); + } + } + } diff --git a/readme.txt b/readme.txt index 290d264..ec4c838 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ === WP-Strava === Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb -Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, gps, shortcode, widget, plugin +Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin Requires at least: 4.6 Tested up to: 5.1 -Stable tag: 1.7.2 +Stable tag: 1.7.3 Requires PHP: 5.2 License: GPLv2 or later @@ -16,6 +16,11 @@ Show your Strava activity on your WordPress site. This plugin uses the Strava API to embed maps and activity for athletes and clubs on your WordPress site. Included are several widgets and shortcodes for showing maps and activity summaries. += Cron = + +Using WP-Strava 2.0+ requires a working WordPress cron configuration. By default, WordPress has a built-in cron system to run scheduled events, but it relies on your website getting frequent visitors. The Strava authentication token system expires after 6 hours if not refreshed. If you think your site will not get any visitors over the span on 6 hours, you might want to set up a _real_ cron: https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/. Setting up this sort of cron is beyond the scope of support for this free plugin, so you should seek assistance through your host. Force-running the WordPress cron once an hour is good enough for WP-Strava. + + = Shortcodes = [activity id=NUMBER] - add to any page or post. Shows a summary of the activity plus a map if a google maps key has been added. @@ -83,6 +88,10 @@ WP-Strava caches activity for one hour so your site doesn't hit the Strava API o == Changelog == += 1.7.3 = + +Added update notice. + = 1.7.2 = Added setting to hide elevation. @@ -222,3 +231,8 @@ Added option to select unit of measurements on the widget. https://wordpress.org = 0.6 = Initial version. + + +== upgrade_notice == + +The version 2.0 upgrade is coming soon and will be mandatory to use the Strava API after October 15th, 2019. To participate in the 2.0 beta program please visit https://github.com/cmanon/wp-strava/releases. After upgrading to version 2.0, you must upgrade your settings to continue to use WP-Strava 2.0. See https://github.com/cmanon/wp-strava/wiki/2.0-Upgrade. diff --git a/wp-strava.php b/wp-strava.php index 3aad5c5..fb46b46 100755 --- a/wp-strava.php +++ b/wp-strava.php @@ -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: 1.7.2 + * Version: 1.7.3 * Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb * License: GPL2 * Text Domain: wp-strava From cabbd83322ec0f0d88f36d72c47d83deb5202688 Mon Sep 17 00:00:00 2001 From: Justin Foell Date: Sat, 21 Sep 2019 23:17:17 -0500 Subject: [PATCH 2/2] Updated upgrade notice and display --- lib/WPStrava/Settings.php | 10 +++------- readme.txt | 6 ++++-- 2 files changed, 7 insertions(+), 9 deletions(-) mode change 100644 => 100755 readme.txt diff --git a/lib/WPStrava/Settings.php b/lib/WPStrava/Settings.php index 201bea5..9a09ab2 100644 --- a/lib/WPStrava/Settings.php +++ b/lib/WPStrava/Settings.php @@ -711,14 +711,10 @@ public function settings_link( $links ) { * @param array $response Response from wp.org. * @author Justin Foell * @since 1.7.3 - * @see https://wisdomplugin.com/add-inline-plugin-update-message/ */ public function plugin_update_message( $data, $response ) { if ( isset( $data['upgrade_notice'] ) ) { - printf( - '
%s
', - wpautop( $data['upgrade_notice'] ) - ); + echo wp_kses_post( $data['upgrade_notice'] ); } } @@ -731,13 +727,13 @@ public function plugin_update_message( $data, $response ) { * @since 1.7.3 */ public function ms_plugin_update_message( $file, $plugin ) { - if ( is_multisite() && version_compare( $plugin['Version'], $plugin['new_version'], '<' ) ) { + if ( is_multisite() && ! is_network_admin() && version_compare( $plugin['Version'], $plugin['new_version'], '<' ) ) { $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); printf( '

%s

%s
', $wp_list_table->get_column_count(), $plugin['Name'], - wpautop( $plugin['upgrade_notice'] ) + wp_kses_post( $plugin['upgrade_notice'] ) ); } } diff --git a/readme.txt b/readme.txt old mode 100644 new mode 100755 index ec4c838..2259e15 --- a/readme.txt +++ b/readme.txt @@ -233,6 +233,8 @@ Added option to select unit of measurements on the widget. https://wordpress.org Initial version. -== upgrade_notice == +== Upgrade Notice == -The version 2.0 upgrade is coming soon and will be mandatory to use the Strava API after October 15th, 2019. To participate in the 2.0 beta program please visit https://github.com/cmanon/wp-strava/releases. After upgrading to version 2.0, you must upgrade your settings to continue to use WP-Strava 2.0. See https://github.com/cmanon/wp-strava/wiki/2.0-Upgrade. += 1.7.3 = + +Version 2.0 will be mandatory after October 15th, 2019. Try the 2.0 beta: https://github.com/cmanon/wp-strava/releases. 2.0 settings upgrade instructions: https://github.com/cmanon/wp-strava/wiki/2.0-Upgrade.