Business Profile - Version 2.1.3

Version Description

(2021-04-06) = - Correcting an issue in which certain times were being output always in UTC and not using the timezone set in the WordPress general settings, which could create an offset in the time displayed for exceptions on the front end. - Updated the order in which the exceptions are displayed on the front end, so that it is chronological and not using the order from the admin.

Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Business Profile
Version 2.1.3
Comparing to
See all releases

Code changes from version 2.1.2 to 2.1.3

business-profile.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Five Star Business Profile and Schema
4
  * Plugin URI: https://www.fivestarplugins.com/plugins/business-profile/
5
  * Description: Add schema structured data to any page or post type. Create an SEO friendly contact card with your business info and associated schema. Supports Google Map, opening hours and more.
6
- * Version: 2.1.2
7
  * Author: Five Star Plugins
8
  * Author URI: https://www.fivestarplugins.com
9
  * License: GPLv3
3
  * Plugin Name: Five Star Business Profile and Schema
4
  * Plugin URI: https://www.fivestarplugins.com/plugins/business-profile/
5
  * Description: Add schema structured data to any page or post type. Create an SEO friendly contact card with your business info and associated schema. Supports Google Map, opening hours and more.
6
+ * Version: 2.1.3
7
  * Author: Five Star Plugins
8
  * Author URI: https://www.fivestarplugins.com
9
  * License: GPLv3
includes/template-functions.php CHANGED
@@ -347,6 +347,8 @@ if ( ! function_exists( 'bpwfwp_print_opening_hours' ) ) {
347
  return;
348
  }
349
 
 
 
350
  // Output display format.
351
  if ( bpfwp_get_display( 'show_opening_hours_brief' ) ) :
352
  ?>
@@ -383,10 +385,10 @@ if ( ! function_exists( 'bpwfwp_print_opening_hours' ) ) {
383
  unset( $start );
384
  unset( $end );
385
  if ( ! empty( $slot['time']['start'] ) ) {
386
- $start = new DateTime( $slot['time']['start'] );
387
  }
388
  if ( ! empty( $slot['time']['end'] ) ) {
389
- $end = new DateTime( $slot['time']['end'] );
390
  }
391
 
392
  if ( empty( $start ) ) {
@@ -434,10 +436,10 @@ if ( ! function_exists( 'bpwfwp_print_opening_hours' ) ) {
434
  } else {
435
 
436
  if ( ! empty( $rule['time']['start'] ) ) {
437
- $start = new DateTime( $rule['time']['start'] );
438
  }
439
  if ( ! empty( $rule['time']['end'] ) ) {
440
- $end = new DateTime( $rule['time']['end'] );
441
  }
442
 
443
  if ( empty( $start ) ) {
@@ -591,6 +593,8 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
591
  $date_format = get_option('date_format');
592
  $time_format = get_option('time_format');
593
 
 
 
594
  $data = array(
595
  'special_hours' => array(),
596
  'holiday' => array()
@@ -608,6 +612,13 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
608
  }
609
  }
610
 
 
 
 
 
 
 
 
611
  if ( 0 < count( $data['special_hours'] ) ) { ?>
612
 
613
  <div class="bp-opening-hours special">
@@ -616,19 +627,19 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
616
  <?php foreach ( $data['special_hours'] as $exception ) { ?>
617
 
618
  <?php
619
- $date = new DateTime( $exception['date'] );
620
- $start = new DateTime( $exception['time']['start'] );
621
- $end = new DateTime( $exception['time']['end'] );
622
  ?>
623
 
624
  <div class="bp-date">
625
- <span class="label"><?php echo wp_date($date_format, $date->format( 'U' )); ?></span>
626
  <span class="bp-times">
627
  <span class="bp-time">
628
  <?php
629
- echo wp_date($time_format, $start->format( 'U' ))
630
  . ' – '
631
- . wp_date($time_format, $end->format( 'U' ));
632
  ?>
633
  </span>
634
  </span>
@@ -645,11 +656,11 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
645
 
646
  <?php foreach ( $data['holiday'] as $exception ) { ?>
647
 
648
- <?php $date = new DateTime($exception['date']); ?>
649
 
650
  <div class="bp-date">
651
  <span class="label">
652
- <?php echo wp_date($date_format, $date->format( 'U' )); ?>
653
  </span>
654
  <span class="bp-times">
655
  <span class="bp-time">
347
  return;
348
  }
349
 
350
+ $tz = new DateTimeZone( wp_timezone_string() );
351
+
352
  // Output display format.
353
  if ( bpfwp_get_display( 'show_opening_hours_brief' ) ) :
354
  ?>
385
  unset( $start );
386
  unset( $end );
387
  if ( ! empty( $slot['time']['start'] ) ) {
388
+ $start = new DateTime( $slot['time']['start'], $tz );
389
  }
390
  if ( ! empty( $slot['time']['end'] ) ) {
391
+ $end = new DateTime( $slot['time']['end'], $tz );
392
  }
393
 
394
  if ( empty( $start ) ) {
436
  } else {
437
 
438
  if ( ! empty( $rule['time']['start'] ) ) {
439
+ $start = new DateTime( $rule['time']['start'], $tz );
440
  }
441
  if ( ! empty( $rule['time']['end'] ) ) {
442
+ $end = new DateTime( $rule['time']['end'], $tz );
443
  }
444
 
445
  if ( empty( $start ) ) {
593
  $date_format = get_option('date_format');
594
  $time_format = get_option('time_format');
595
 
596
+ $tz = new DateTimeZone( wp_timezone_string() );
597
+
598
  $data = array(
599
  'special_hours' => array(),
600
  'holiday' => array()
612
  }
613
  }
614
 
615
+ usort( $data['special_hours'], function( $a, $b ) {
616
+ return strcasecmp( $a['date'], $b['date'] );
617
+ });
618
+ usort( $data['holiday'], function( $a, $b ) {
619
+ return strcasecmp( $a['date'], $b['date'] );
620
+ });
621
+
622
  if ( 0 < count( $data['special_hours'] ) ) { ?>
623
 
624
  <div class="bp-opening-hours special">
627
  <?php foreach ( $data['special_hours'] as $exception ) { ?>
628
 
629
  <?php
630
+ $date = new DateTime( $exception['date'], $tz );
631
+ $start = new DateTime( $exception['time']['start'], $tz );
632
+ $end = new DateTime( $exception['time']['end'], $tz );
633
  ?>
634
 
635
  <div class="bp-date">
636
+ <span class="label"><?php echo wp_date( $date_format, $date->format( 'U' ) ); ?></span>
637
  <span class="bp-times">
638
  <span class="bp-time">
639
  <?php
640
+ echo wp_date( $time_format, $start->format( 'U' ) )
641
  . ' – '
642
+ . wp_date( $time_format, $end->format( 'U' ) );
643
  ?>
644
  </span>
645
  </span>
656
 
657
  <?php foreach ( $data['holiday'] as $exception ) { ?>
658
 
659
+ <?php $date = new DateTime( $exception['date'], $tz ); ?>
660
 
661
  <div class="bp-date">
662
  <span class="label">
663
+ <?php echo wp_date( $date_format, $date->format( 'U' ) ); ?>
664
  </span>
665
  <span class="bp-times">
666
  <span class="bp-time">
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin URL: https://www.fivestarplugins.com/plugins/business-profile/
5
  Requires at Least: 5.3
6
  Tested Up To: 5.7
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone, contact card, vcard, contact info, business location, business address, business map, business schema, organization schema, corporation schema, contact schema, address schema, location schema, map schema, business structured data, business microdata, address microdata, location structured data, location microdata, contact shortcode, location shortcode, address shortcode, schema shortcode, gutenberg schema, gutenberg address
8
- Stable tag: 2.1.2
9
  License: GPLv3
10
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -192,6 +192,10 @@ You'll find more help in the [User Guide](http://doc.themeofthecrop.com/plugins/
192
 
193
  == Changelog ==
194
 
 
 
 
 
195
  = 2.1.2 (2021-03-08) =
196
  - Update for the conditional enqueueing of assets in the admin.
197
  - Styling fix for the location create/edit screen when using the classic editor.
5
  Requires at Least: 5.3
6
  Tested Up To: 5.7
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone, contact card, vcard, contact info, business location, business address, business map, business schema, organization schema, corporation schema, contact schema, address schema, location schema, map schema, business structured data, business microdata, address microdata, location structured data, location microdata, contact shortcode, location shortcode, address shortcode, schema shortcode, gutenberg schema, gutenberg address
8
+ Stable tag: 2.1.3
9
  License: GPLv3
10
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
11
 
192
 
193
  == Changelog ==
194
 
195
+ = 2.1.3 (2021-04-06) =
196
+ - Correcting an issue in which certain times were being output always in UTC and not using the timezone set in the WordPress general settings, which could create an offset in the time displayed for exceptions on the front end.
197
+ - Updated the order in which the exceptions are displayed on the front end, so that it is chronological and not using the order from the admin.
198
+
199
  = 2.1.2 (2021-03-08) =
200
  - Update for the conditional enqueueing of assets in the admin.
201
  - Styling fix for the location create/edit screen when using the classic editor.