From aef75e53a97ed1a5656bb820a77606ebd3708587 Mon Sep 17 00:00:00 2001 From: Tim Nolte Date: Mon, 15 Apr 2019 21:51:42 -0400 Subject: [PATCH] release/1.3.10 (#54) * Adds related check for PHP 7.1 Date/Time object changes. (#53) * Uses an explicit PHP version check in order to run the correct setTime() method version. * Fixes bug with close time not selecting the correct array element for hours. * Fixes #52 --- README.md | 5 +++- .../woocommerce-local-pickup-time-cs_CZ.mo | Bin 7454 -> 7454 bytes .../woocommerce-local-pickup-time-cs_CZ.po | 12 ++++----- .../woocommerce-local-pickup-time-en_US.mo | Bin 841 -> 841 bytes .../woocommerce-local-pickup-time-en_US.po | 12 ++++----- languages/woocommerce-local-pickup-time.pot | 14 +++++----- package.json | 2 +- public/class-local-pickup-time.php | 24 ++++++++++++++---- readme.txt | 5 +++- woocommerce-local-pickup-time.php | 2 +- 10 files changed, 48 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9010b8c..9440aae 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** woocommcerce, shipping, local pickup, checkout fields, ecommerce, e-commerce, wordpress ecommerce **Requires at least:** 4.7 **Tested up to:** 5.1.1 -**Stable tag:** 1.3.9 +**Stable tag:** 1.3.10 **Requires PHP:** 5.6 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -69,6 +69,9 @@ The location, by default, is hooked to `woocommerce_admin_order_data_after_billi ## Changelog ## +### 1.3.10 ### +* Adds check for PHP 7.1+ Date/Time object changes and makes appropriate PHP version specific calls. + ### 1.3.9 ### * Fixes how the starting interval is set, especially during the middle of the current open/close pickup time. * Sets end time 1 interval past it in order to have the end close pickup time be inclusive for pickup. diff --git a/languages/woocommerce-local-pickup-time-cs_CZ.mo b/languages/woocommerce-local-pickup-time-cs_CZ.mo index 1954772d21622c21a3194554afed0d76cf939dd4..46d010ce0c39c8922ff85073a97bb5de7cdc82b7 100644 GIT binary patch delta 24 fcmbPdHP328xd6AJk%ED-m8qqbvE}9_fjK+?U5y76 delta 24 fcmbPdHP328xd69;iGrb_m8r3nf%)bpfjK+?T{#B{ diff --git a/languages/woocommerce-local-pickup-time-cs_CZ.po b/languages/woocommerce-local-pickup-time-cs_CZ.po index 186154c..e2cac06 100644 --- a/languages/woocommerce-local-pickup-time-cs_CZ.po +++ b/languages/woocommerce-local-pickup-time-cs_CZ.po @@ -5,7 +5,7 @@ msgstr "" "Project-Id-Version: WooCommerce Local Pickup Time\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-local-" "pickup-time\n" -"POT-Creation-Date: 2019-04-04 11:53:07+00:00\n" +"POT-Creation-Date: 2019-04-12 03:59:39+00:00\n" "PO-Revision-Date: 2019-02-01 14:28:47+0000\n" "Language: cs_CZ\n" "MIME-Version: 1.0\n" @@ -288,9 +288,9 @@ msgid "Pickup Time:" msgstr "Čas vyzvednutí:" #: admin/class-local-pickup-time-admin.php:356 -#: public/class-local-pickup-time.php:528 -#: public/class-local-pickup-time.php:535 -#: public/class-local-pickup-time.php:587 +#: public/class-local-pickup-time.php:542 +#: public/class-local-pickup-time.php:549 +#: public/class-local-pickup-time.php:601 msgid "Pickup Time" msgstr "Čas vyzvednutí" @@ -326,11 +326,11 @@ msgstr "Neděle" msgid "Select time" msgstr "Vyberte čas" -#: public/class-local-pickup-time.php:555 +#: public/class-local-pickup-time.php:569 msgid "Please select a pickup time." msgstr "vyberte si čas vyzvednutí." -#: public/class-local-pickup-time.php:607 +#: public/class-local-pickup-time.php:621 msgid "None" msgstr "Žádná" diff --git a/languages/woocommerce-local-pickup-time-en_US.mo b/languages/woocommerce-local-pickup-time-en_US.mo index 07bdfd80c8bf53feeaac1dad56ccd87f7200ba86..5ff37711718e07c25dd5e2402e655f5a99aa4705 100644 GIT binary patch delta 22 dcmX@fc9LzvGj2m81p{L%Q%fsj%Z(o+m;hJV2T%Y2 delta 22 dcmX@fc9LzvGj0PD1w%tCQ)4Rw^Nk-Pm;hIh2Soq? diff --git a/languages/woocommerce-local-pickup-time-en_US.po b/languages/woocommerce-local-pickup-time-en_US.po index 4f23f17..876f8f1 100644 --- a/languages/woocommerce-local-pickup-time-en_US.po +++ b/languages/woocommerce-local-pickup-time-en_US.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: WooCommerce Local Pickup Time Select\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-local-" "pickup-time\n" -"POT-Creation-Date: 2019-04-04 11:53:07+00:00\n" +"POT-Creation-Date: 2019-04-12 03:59:39+00:00\n" "PO-Revision-Date: 2017-05-11 11:03+0200\n" "Last-Translator: Karolína Vyskočilová \n" "Language-Team: Matt Banks \n" @@ -261,9 +261,9 @@ msgid "Pickup Time:" msgstr "" #: admin/class-local-pickup-time-admin.php:356 -#: public/class-local-pickup-time.php:528 -#: public/class-local-pickup-time.php:535 -#: public/class-local-pickup-time.php:587 +#: public/class-local-pickup-time.php:542 +#: public/class-local-pickup-time.php:549 +#: public/class-local-pickup-time.php:601 msgid "Pickup Time" msgstr "" @@ -299,11 +299,11 @@ msgstr "" msgid "Select time" msgstr "" -#: public/class-local-pickup-time.php:555 +#: public/class-local-pickup-time.php:569 msgid "Please select a pickup time." msgstr "" -#: public/class-local-pickup-time.php:607 +#: public/class-local-pickup-time.php:621 msgid "None" msgstr "" diff --git a/languages/woocommerce-local-pickup-time.pot b/languages/woocommerce-local-pickup-time.pot index e17a169..d606357 100644 --- a/languages/woocommerce-local-pickup-time.pot +++ b/languages/woocommerce-local-pickup-time.pot @@ -2,10 +2,10 @@ # This file is distributed under the GPL-2.0+. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Local Pickup Time Select 1.3.9\n" +"Project-Id-Version: WooCommerce Local Pickup Time Select 1.3.10\n" "Report-Msgid-Bugs-To: " "https://wordpress.org/support/plugin/woocommerce-local-pickup-time\n" -"POT-Creation-Date: 2019-04-04 11:53:07+00:00\n" +"POT-Creation-Date: 2019-04-12 03:59:39+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -266,9 +266,9 @@ msgid "Pickup Time:" msgstr "" #: admin/class-local-pickup-time-admin.php:356 -#: public/class-local-pickup-time.php:528 -#: public/class-local-pickup-time.php:535 -#: public/class-local-pickup-time.php:587 +#: public/class-local-pickup-time.php:542 +#: public/class-local-pickup-time.php:549 +#: public/class-local-pickup-time.php:601 msgid "Pickup Time" msgstr "" @@ -304,11 +304,11 @@ msgstr "" msgid "Select time" msgstr "" -#: public/class-local-pickup-time.php:555 +#: public/class-local-pickup-time.php:569 msgid "Please select a pickup time." msgstr "" -#: public/class-local-pickup-time.php:607 +#: public/class-local-pickup-time.php:621 msgid "None" msgstr "" diff --git a/package.json b/package.json index 6eeb089..287967e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-local-pickup-time", - "version": "1.3.9", + "version": "1.3.10", "description": "Add an an option to WooCommerce checkout pages for Local Pickup that allows the user to choose a pickup time.", "main": "Gruntfile.js", "scripts": { diff --git a/public/class-local-pickup-time.php b/public/class-local-pickup-time.php index 6281a75..ac284dc 100644 --- a/public/class-local-pickup-time.php +++ b/public/class-local-pickup-time.php @@ -25,7 +25,7 @@ class Local_Pickup_Time { * * @var string */ - const VERSION = '1.3.9'; + const VERSION = '1.3.10'; /** * Unique identifier for plugin. @@ -461,8 +461,12 @@ public function build_pickup_time_options() { $pickup_datetime->modify( '+1 day' ); // Reset the interval starting time. - $pickup_datetime->setTime( 0, 0, 0, 0 ); - + // Note: PHP pre-7.1 doesn't support milliseconds with the setTime() call. + if ( ! defined( 'PHP_VERSION' ) || ! function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '7.1.0', '<' ) ) { + $pickup_datetime->setTime( 0, 0, 0 ); + } else { + $pickup_datetime->setTime( 0, 0, 0, 0 ); + } } return $pickup_options; @@ -492,13 +496,23 @@ public function build_pickup_time_intervals( $pickup_timestamp, $minutes_interva // Set the open DateTime to the configured open time. $pickup_day_hours_time_array = explode( ':', $pickup_day_open_time ); - $pickup_open_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1] ); + // Note: PHP pre-7.1 doesn't support milliseconds with the setTime() call. + if ( ! defined( 'PHP_VERSION' ) || ! function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '7.1.0', '<' ) ) { + $pickup_open_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1], 0 ); + } else { + $pickup_open_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1], 0, 0 ); + } // Initialize ending DateTime based on day closed time. $pickup_end_datetime = new DateTime( "@$pickup_timestamp" ); // Set ending hour based on close time. $pickup_day_hours_time_array = explode( ':', $pickup_day_close_time ); - $pickup_end_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1] ); + // Note: PHP pre-7.1 doesn't support milliseconds with the setTime() call. + if ( ! defined( 'PHP_VERSION' ) || ! function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '7.1.0', '<' ) ) { + $pickup_end_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1], 0 ); + } else { + $pickup_end_datetime->setTime( $pickup_day_hours_time_array[0], $pickup_day_hours_time_array[1], 0, 0 ); + } // Advance to 1 interval past the close time so that close time is inclusive. $pickup_end_datetime->modify( "+$minutes_interval minute" ); diff --git a/readme.txt b/readme.txt index 58374e0..1d04d60 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: http://mattbanks.me Tags: woocommcerce, shipping, local pickup, checkout fields, ecommerce, e-commerce, wordpress ecommerce Requires at least: 4.7 Tested up to: 5.1.1 -Stable tag: 1.3.9 +Stable tag: 1.3.10 Requires PHP: 5.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -69,6 +69,9 @@ The location, by default, is hooked to `woocommerce_admin_order_data_after_billi == Changelog == += 1.3.10 = +* Adds check for PHP 7.1+ Date/Time object changes and makes appropriate PHP version specific calls. + = 1.3.9 = * Fixes how the starting interval is set, especially during the middle of the current open/close pickup time. * Sets end time 1 interval past it in order to have the end close pickup time be inclusive for pickup. diff --git a/woocommerce-local-pickup-time.php b/woocommerce-local-pickup-time.php index 818ce09..d9b890d 100644 --- a/woocommerce-local-pickup-time.php +++ b/woocommerce-local-pickup-time.php @@ -16,7 +16,7 @@ * Plugin Name: WooCommerce Local Pickup Time Select * Plugin URI: http://mattbanks.me * Description: Add an an option to WooCommerce checkout pages for Local Pickup that allows the user to choose a pickup time. - * Version: 1.3.9 + * Version: 1.3.10 * Author: Matt Banks * Author URI: http://mattbanks.me * Text Domain: woocommerce-local-pickup-time